var Editor=function(){"use strict";function _typeof$2(en){return _typeof$2="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(en){return typeof en}:function(en){return en&&"function"==typeof Symbol&&en.constructor===Symbol&&en!==Symbol.prototype?"symbol":typeof en},_typeof$2(en)}function _classCallCheck(en,tn){if(!(en instanceof tn))throw new TypeError("Cannot call a class as a function")}function _defineProperties(en,tn){for(var nn=0;nnen.length)&&(tn=en.length);for(var nn=0,rn=new Array(tn);nn1&&void 0!==arguments[1]?arguments[1]:{};_classCallCheck(this,Logger),this.init(en,tn)}return _createClass(Logger,[{key:"init",value:function init(tn){var nn=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=nn.prefix||"i18next:",this.logger=tn||en,this.options=nn,this.debug=nn.debug}},{key:"setDebug",value:function setDebug(en){this.debug=en}},{key:"log",value:function log(){for(var en=arguments.length,tn=new Array(en),nn=0;nn1?tn-1:0),rn=1;rn-1?en.replace(/###/g,"."):en}function canNotTraverseDeeper(){return!en||"string"==typeof en}for(var rn="string"!=typeof tn?[].concat(tn):tn.split(".");rn.length>1;){if(canNotTraverseDeeper())return{};var an=cleanKey(rn.shift());!en[an]&&nn&&(en[an]=new nn),en=Object.prototype.hasOwnProperty.call(en,an)?en[an]:{}}return canNotTraverseDeeper()?{}:{obj:en,k:cleanKey(rn.shift())}}function setPath(en,tn,nn){var rn=getLastOfPath(en,tn,Object);rn.obj[rn.k]=nn}function getPath(en,tn){var nn=getLastOfPath(en,tn),rn=nn.obj,an=nn.k;if(rn)return rn[an]}function getPathWithDefaults(en,tn,nn){var rn=getPath(en,nn);return void 0!==rn?rn:getPath(tn,nn)}function deepExtend(en,tn,nn){for(var rn in tn)"__proto__"!==rn&&"constructor"!==rn&&(rn in en?"string"==typeof en[rn]||en[rn]instanceof String||"string"==typeof tn[rn]||tn[rn]instanceof String?nn&&(en[rn]=tn[rn]):deepExtend(en[rn],tn[rn],nn):en[rn]=tn[rn]);return en}function regexEscape$1(en){return en.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var an={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function escape$1(en){return"string"==typeof en?en.replace(/[&<>"'\/]/g,(function(en){return an[en]})):en}var sn="undefined"!=typeof window&&window.navigator&&void 0===window.navigator.userAgentData&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,cn=[" ",",","?","!",";"];function ownKeys$1$1(en,tn){var nn=Object.keys(en);if(Object.getOwnPropertySymbols){var rn=Object.getOwnPropertySymbols(en);tn&&(rn=rn.filter((function(tn){return Object.getOwnPropertyDescriptor(en,tn).enumerable}))),nn.push.apply(nn,rn)}return nn}function _objectSpread$1$1(en){for(var tn=1;tn2&&void 0!==arguments[2]?arguments[2]:".";if(en){if(en[tn])return en[tn];for(var rn=tn.split(nn),an=en,sn=0;snsn+cn;)cn++,dn=an[An=rn.slice(sn,sn+cn).join(nn)];if(void 0===dn)return;if(null===dn)return null;if(tn.endsWith(An)){if("string"==typeof dn)return dn;if(An&&"string"==typeof dn[An])return dn[An]}var un=rn.slice(sn+cn).join(nn);return un?deepFind(dn,un,nn):void 0}an=an[rn[sn]]}return an}}var An=function(en){_inherits(ResourceStore,en);var tn=_createSuper(ResourceStore);function ResourceStore(en){var nn,an=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return _classCallCheck(this,ResourceStore),nn=tn.call(this),sn&&rn.call(_assertThisInitialized(nn)),nn.data=en||{},nn.options=an,void 0===nn.options.keySeparator&&(nn.options.keySeparator="."),void 0===nn.options.ignoreJSONStructure&&(nn.options.ignoreJSONStructure=!0),nn}return _createClass(ResourceStore,[{key:"addNamespaces",value:function addNamespaces(en){this.options.ns.indexOf(en)<0&&this.options.ns.push(en)}},{key:"removeNamespaces",value:function removeNamespaces(en){var tn=this.options.ns.indexOf(en);tn>-1&&this.options.ns.splice(tn,1)}},{key:"getResource",value:function getResource(en,tn,nn){var rn=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},an=void 0!==rn.keySeparator?rn.keySeparator:this.options.keySeparator,sn=void 0!==rn.ignoreJSONStructure?rn.ignoreJSONStructure:this.options.ignoreJSONStructure,cn=[en,tn];nn&&"string"!=typeof nn&&(cn=cn.concat(nn)),nn&&"string"==typeof nn&&(cn=cn.concat(an?nn.split(an):nn)),en.indexOf(".")>-1&&(cn=en.split("."));var An=getPath(this.data,cn);return An||!sn||"string"!=typeof nn?An:deepFind(this.data&&this.data[en]&&this.data[en][tn],nn,an)}},{key:"addResource",value:function addResource(en,tn,nn,rn){var an=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1},sn=this.options.keySeparator;void 0===sn&&(sn=".");var cn=[en,tn];nn&&(cn=cn.concat(sn?nn.split(sn):nn)),en.indexOf(".")>-1&&(rn=tn,tn=(cn=en.split("."))[1]),this.addNamespaces(tn),setPath(this.data,cn,rn),an.silent||this.emit("added",en,tn,nn,rn)}},{key:"addResources",value:function addResources(en,tn,nn){var rn=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var an in nn)"string"!=typeof nn[an]&&"[object Array]"!==Object.prototype.toString.apply(nn[an])||this.addResource(en,tn,an,nn[an],{silent:!0});rn.silent||this.emit("added",en,tn,nn)}},{key:"addResourceBundle",value:function addResourceBundle(en,tn,nn,rn,an){var sn=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},cn=[en,tn];en.indexOf(".")>-1&&(rn=nn,nn=tn,tn=(cn=en.split("."))[1]),this.addNamespaces(tn);var An=getPath(this.data,cn)||{};rn?deepExtend(An,nn,an):An=_objectSpread$1$1(_objectSpread$1$1({},An),nn),setPath(this.data,cn,An),sn.silent||this.emit("added",en,tn,nn)}},{key:"removeResourceBundle",value:function removeResourceBundle(en,tn){this.hasResourceBundle(en,tn)&&delete this.data[en][tn],this.removeNamespaces(tn),this.emit("removed",en,tn)}},{key:"hasResourceBundle",value:function hasResourceBundle(en,tn){return void 0!==this.getResource(en,tn)}},{key:"getResourceBundle",value:function getResourceBundle(en,tn){return tn||(tn=this.options.defaultNS),"v1"===this.options.compatibilityAPI?_objectSpread$1$1(_objectSpread$1$1({},{}),this.getResource(en,tn)):this.getResource(en,tn)}},{key:"getDataByLanguage",value:function getDataByLanguage(en){return this.data[en]}},{key:"hasLanguageSomeTranslations",value:function hasLanguageSomeTranslations(en){var tn=this.getDataByLanguage(en);return!!(tn&&Object.keys(tn)||[]).find((function(en){return tn[en]&&Object.keys(tn[en]).length>0}))}},{key:"toJSON",value:function toJSON(){return this.data}}]),ResourceStore}(rn),dn={processors:{},addPostProcessor:function addPostProcessor(en){this.processors[en.name]=en},handle:function handle(en,tn,nn,rn,an){var sn=this;return en.forEach((function(en){sn.processors[en]&&(tn=sn.processors[en].process(tn,nn,rn,an))})),tn}};function ownKeys$2$1(en,tn){var nn=Object.keys(en);if(Object.getOwnPropertySymbols){var rn=Object.getOwnPropertySymbols(en);tn&&(rn=rn.filter((function(tn){return Object.getOwnPropertyDescriptor(en,tn).enumerable}))),nn.push.apply(nn,rn)}return nn}function _objectSpread$2$1(en){for(var tn=1;tn1&&void 0!==arguments[1]?arguments[1]:{};return _classCallCheck(this,Translator),an=tn.call(this),sn&&rn.call(_assertThisInitialized(an)),copy(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],en,_assertThisInitialized(an)),an.options=cn,void 0===an.options.keySeparator&&(an.options.keySeparator="."),an.logger=nn.create("translator"),an}return _createClass(Translator,[{key:"changeLanguage",value:function changeLanguage(en){en&&(this.language=en)}},{key:"exists",value:function exists(en){var tn=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(null==en)return!1;var nn=this.resolve(en,tn);return nn&&void 0!==nn.res}},{key:"extractFromKey",value:function extractFromKey(en,tn){var nn=void 0!==tn.nsSeparator?tn.nsSeparator:this.options.nsSeparator;void 0===nn&&(nn=":");var rn=void 0!==tn.keySeparator?tn.keySeparator:this.options.keySeparator,an=tn.ns||this.options.defaultNS||[],sn=nn&&en.indexOf(nn)>-1,An=!(this.options.userDefinedKeySeparator||tn.keySeparator||this.options.userDefinedNsSeparator||tn.nsSeparator||function looksLikeObjectPath(en,tn,nn){tn=tn||"",nn=nn||"";var rn=cn.filter((function(en){return tn.indexOf(en)<0&&nn.indexOf(en)<0}));if(0===rn.length)return!0;var an=new RegExp("(".concat(rn.map((function(en){return"?"===en?"\\?":en})).join("|"),")")),sn=!an.test(en);if(!sn){var An=en.indexOf(nn);An>0&&!an.test(en.substring(0,An))&&(sn=!0)}return sn}(en,nn,rn));if(sn&&!An){var dn=en.match(this.interpolator.nestingRegexp);if(dn&&dn.length>0)return{key:en,namespaces:an};var un=en.split(nn);(nn!==rn||nn===rn&&this.options.ns.indexOf(un[0])>-1)&&(an=un.shift()),en=un.join(rn)}return"string"==typeof an&&(an=[an]),{key:en,namespaces:an}}},{key:"translate",value:function translate(en,tn,nn){var rn=this;if("object"!==_typeof$2(tn)&&this.options.overloadTranslationOptionHandler&&(tn=this.options.overloadTranslationOptionHandler(arguments)),tn||(tn={}),null==en)return"";Array.isArray(en)||(en=[String(en)]);var an=void 0!==tn.returnDetails?tn.returnDetails:this.options.returnDetails,sn=void 0!==tn.keySeparator?tn.keySeparator:this.options.keySeparator,cn=this.extractFromKey(en[en.length-1],tn),An=cn.key,dn=cn.namespaces,un=dn[dn.length-1],pn=tn.lng||this.language,hn=tn.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(pn&&"cimode"===pn.toLowerCase()){if(hn){var gn=tn.nsSeparator||this.options.nsSeparator;return an?(_n.res="".concat(un).concat(gn).concat(An),_n):"".concat(un).concat(gn).concat(An)}return an?(_n.res=An,_n):An}var _n=this.resolve(en,tn),mn=_n&&_n.res,fn=_n&&_n.usedKey||An,yn=_n&&_n.exactUsedKey||An,bn=Object.prototype.toString.apply(mn),vn=["[object Number]","[object Function]","[object RegExp]"],wn=void 0!==tn.joinArrays?tn.joinArrays:this.options.joinArrays,xn=!this.i18nFormat||this.i18nFormat.handleAsObject,kn="string"!=typeof mn&&"boolean"!=typeof mn&&"number"!=typeof mn;if(xn&&mn&&kn&&vn.indexOf(bn)<0&&("string"!=typeof wn||"[object Array]"!==bn)){if(!tn.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var Cn=this.options.returnedObjectHandler?this.options.returnedObjectHandler(fn,mn,_objectSpread$2$1(_objectSpread$2$1({},tn),{},{ns:dn})):"key '".concat(An," (").concat(this.language,")' returned an object instead of string.");return an?(_n.res=Cn,_n):Cn}if(sn){var Sn="[object Array]"===bn,Bn=Sn?[]:{},En=Sn?yn:fn;for(var jn in mn)if(Object.prototype.hasOwnProperty.call(mn,jn)){var Ln="".concat(En).concat(sn).concat(jn);Bn[jn]=this.translate(Ln,_objectSpread$2$1(_objectSpread$2$1({},tn),{joinArrays:!1,ns:dn})),Bn[jn]===Ln&&(Bn[jn]=mn[jn])}mn=Bn}}else if(xn&&"string"==typeof wn&&"[object Array]"===bn)(mn=mn.join(wn))&&(mn=this.extendTranslation(mn,en,tn,nn));else{var Pn=!1,Tn=!1,Fn=void 0!==tn.count&&"string"!=typeof tn.count,Un=Translator.hasDefaultValue(tn),Nn=Fn?this.pluralResolver.getSuffix(pn,tn.count,tn):"",In=tn["defaultValue".concat(Nn)]||tn.defaultValue;!this.isValidLookup(mn)&&Un&&(Pn=!0,mn=In),this.isValidLookup(mn)||(Tn=!0,mn=An);var Mn=tn.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,Rn=Mn&&Tn?void 0:mn,On=Un&&In!==mn&&this.options.updateMissing;if(Tn||Pn||On){if(this.logger.log(On?"updateKey":"missingKey",pn,un,An,On?In:mn),sn){var Qn=this.resolve(An,_objectSpread$2$1(_objectSpread$2$1({},tn),{},{keySeparator:!1}));Qn&&Qn.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var qn=[],Vn=this.languageUtils.getFallbackCodes(this.options.fallbackLng,tn.lng||this.language);if("fallback"===this.options.saveMissingTo&&Vn&&Vn[0])for(var Gn=0;Gn1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof en&&(en=[en]),en.forEach((function(en){if(!cn.isValidLookup(tn)){var dn=cn.extractFromKey(en,An),pn=dn.key;nn=pn;var hn=dn.namespaces;cn.options.fallbackNS&&(hn=hn.concat(cn.options.fallbackNS));var gn=void 0!==An.count&&"string"!=typeof An.count,_n=gn&&!An.ordinal&&0===An.count&&cn.pluralResolver.shouldUseIntlApi(),mn=void 0!==An.context&&("string"==typeof An.context||"number"==typeof An.context)&&""!==An.context,fn=An.lngs?An.lngs:cn.languageUtils.toResolveHierarchy(An.lng||cn.language,An.fallbackLng);hn.forEach((function(en){cn.isValidLookup(tn)||(sn=en,!un["".concat(fn[0],"-").concat(en)]&&cn.utils&&cn.utils.hasLoadedNamespace&&!cn.utils.hasLoadedNamespace(sn)&&(un["".concat(fn[0],"-").concat(en)]=!0,cn.logger.warn('key "'.concat(nn,'" for languages "').concat(fn.join(", "),'" won\'t get resolved as namespace "').concat(sn,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),fn.forEach((function(nn){if(!cn.isValidLookup(tn)){an=nn;var sn,dn=[pn];if(cn.i18nFormat&&cn.i18nFormat.addLookupKeys)cn.i18nFormat.addLookupKeys(dn,pn,nn,en,An);else{var un;gn&&(un=cn.pluralResolver.getSuffix(nn,An.count,An));var hn="".concat(cn.options.pluralSeparator,"zero");if(gn&&(dn.push(pn+un),_n&&dn.push(pn+hn)),mn){var fn="".concat(pn).concat(cn.options.contextSeparator).concat(An.context);dn.push(fn),gn&&(dn.push(fn+un),_n&&dn.push(fn+hn))}}for(;sn=dn.pop();)cn.isValidLookup(tn)||(rn=sn,tn=cn.getResource(nn,en,sn,An))}})))}))}})),{res:tn,usedKey:nn,exactUsedKey:rn,usedLng:an,usedNS:sn}}},{key:"isValidLookup",value:function isValidLookup(en){return!(void 0===en||!this.options.returnNull&&null===en||!this.options.returnEmptyString&&""===en)}},{key:"getResource",value:function getResource(en,tn,nn){var rn=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(en,tn,nn,rn):this.resourceStore.getResource(en,tn,nn,rn)}}],[{key:"hasDefaultValue",value:function hasDefaultValue(en){var tn="defaultValue";for(var nn in en)if(Object.prototype.hasOwnProperty.call(en,nn)&&tn===nn.substring(0,tn.length)&&void 0!==en[nn])return!0;return!1}}]),Translator}(rn);function capitalize(en){return en.charAt(0).toUpperCase()+en.slice(1)}var hn=function(){function LanguageUtil(en){_classCallCheck(this,LanguageUtil),this.options=en,this.supportedLngs=this.options.supportedLngs||!1,this.logger=nn.create("languageUtils")}return _createClass(LanguageUtil,[{key:"getScriptPartFromCode",value:function getScriptPartFromCode(en){if(!en||en.indexOf("-")<0)return null;var tn=en.split("-");return 2===tn.length?null:(tn.pop(),"x"===tn[tn.length-1].toLowerCase()?null:this.formatLanguageCode(tn.join("-")))}},{key:"getLanguagePartFromCode",value:function getLanguagePartFromCode(en){if(!en||en.indexOf("-")<0)return en;var tn=en.split("-");return this.formatLanguageCode(tn[0])}},{key:"formatLanguageCode",value:function formatLanguageCode(en){if("string"==typeof en&&en.indexOf("-")>-1){var tn=["hans","hant","latn","cyrl","cans","mong","arab"],nn=en.split("-");return this.options.lowerCaseLng?nn=nn.map((function(en){return en.toLowerCase()})):2===nn.length?(nn[0]=nn[0].toLowerCase(),nn[1]=nn[1].toUpperCase(),tn.indexOf(nn[1].toLowerCase())>-1&&(nn[1]=capitalize(nn[1].toLowerCase()))):3===nn.length&&(nn[0]=nn[0].toLowerCase(),2===nn[1].length&&(nn[1]=nn[1].toUpperCase()),"sgn"!==nn[0]&&2===nn[2].length&&(nn[2]=nn[2].toUpperCase()),tn.indexOf(nn[1].toLowerCase())>-1&&(nn[1]=capitalize(nn[1].toLowerCase())),tn.indexOf(nn[2].toLowerCase())>-1&&(nn[2]=capitalize(nn[2].toLowerCase()))),nn.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?en.toLowerCase():en}},{key:"isSupportedCode",value:function isSupportedCode(en){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(en=this.getLanguagePartFromCode(en)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(en)>-1}},{key:"getBestMatchFromCodes",value:function getBestMatchFromCodes(en){var tn,nn=this;return en?(en.forEach((function(en){if(!tn){var rn=nn.formatLanguageCode(en);nn.options.supportedLngs&&!nn.isSupportedCode(rn)||(tn=rn)}})),!tn&&this.options.supportedLngs&&en.forEach((function(en){if(!tn){var rn=nn.getLanguagePartFromCode(en);if(nn.isSupportedCode(rn))return tn=rn;tn=nn.options.supportedLngs.find((function(en){if(0===en.indexOf(rn))return en}))}})),tn||(tn=this.getFallbackCodes(this.options.fallbackLng)[0]),tn):null}},{key:"getFallbackCodes",value:function getFallbackCodes(en,tn){if(!en)return[];if("function"==typeof en&&(en=en(tn)),"string"==typeof en&&(en=[en]),"[object Array]"===Object.prototype.toString.apply(en))return en;if(!tn)return en.default||[];var nn=en[tn];return nn||(nn=en[this.getScriptPartFromCode(tn)]),nn||(nn=en[this.formatLanguageCode(tn)]),nn||(nn=en[this.getLanguagePartFromCode(tn)]),nn||(nn=en.default),nn||[]}},{key:"toResolveHierarchy",value:function toResolveHierarchy(en,tn){var nn=this,rn=this.getFallbackCodes(tn||this.options.fallbackLng||[],en),an=[],sn=function addCode(en){en&&(nn.isSupportedCode(en)?an.push(en):nn.logger.warn("rejecting language code not found in supportedLngs: ".concat(en)))};return"string"==typeof en&&en.indexOf("-")>-1?("languageOnly"!==this.options.load&&sn(this.formatLanguageCode(en)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&sn(this.getScriptPartFromCode(en)),"currentOnly"!==this.options.load&&sn(this.getLanguagePartFromCode(en))):"string"==typeof en&&sn(this.formatLanguageCode(en)),rn.forEach((function(en){an.indexOf(en)<0&&sn(nn.formatLanguageCode(en))})),an}}]),LanguageUtil}(),gn=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],_n={1:function _(en){return Number(en>1)},2:function _(en){return Number(1!=en)},3:function _(en){return 0},4:function _(en){return Number(en%10==1&&en%100!=11?0:en%10>=2&&en%10<=4&&(en%100<10||en%100>=20)?1:2)},5:function _(en){return Number(0==en?0:1==en?1:2==en?2:en%100>=3&&en%100<=10?3:en%100>=11?4:5)},6:function _(en){return Number(1==en?0:en>=2&&en<=4?1:2)},7:function _(en){return Number(1==en?0:en%10>=2&&en%10<=4&&(en%100<10||en%100>=20)?1:2)},8:function _(en){return Number(1==en?0:2==en?1:8!=en&&11!=en?2:3)},9:function _(en){return Number(en>=2)},10:function _(en){return Number(1==en?0:2==en?1:en<7?2:en<11?3:4)},11:function _(en){return Number(1==en||11==en?0:2==en||12==en?1:en>2&&en<20?2:3)},12:function _(en){return Number(en%10!=1||en%100==11)},13:function _(en){return Number(0!==en)},14:function _(en){return Number(1==en?0:2==en?1:3==en?2:3)},15:function _(en){return Number(en%10==1&&en%100!=11?0:en%10>=2&&(en%100<10||en%100>=20)?1:2)},16:function _(en){return Number(en%10==1&&en%100!=11?0:0!==en?1:2)},17:function _(en){return Number(1==en||en%10==1&&en%100!=11?0:1)},18:function _(en){return Number(0==en?0:1==en?1:2)},19:function _(en){return Number(1==en?0:0==en||en%100>1&&en%100<11?1:en%100>10&&en%100<20?2:3)},20:function _(en){return Number(1==en?0:0==en||en%100>0&&en%100<20?1:2)},21:function _(en){return Number(en%100==1?1:en%100==2?2:en%100==3||en%100==4?3:0)},22:function _(en){return Number(1==en?0:2==en?1:(en<0||en>10)&&en%10==0?2:3)}},mn=["v1","v2","v3"],fn={zero:0,one:1,two:2,few:3,many:4,other:5};function createRules(){var en={};return gn.forEach((function(tn){tn.lngs.forEach((function(nn){en[nn]={numbers:tn.nr,plurals:_n[tn.fc]}}))})),en}var yn=function(){function PluralResolver(en){var tn=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};_classCallCheck(this,PluralResolver),this.languageUtils=en,this.options=tn,this.logger=nn.create("pluralResolver"),this.options.compatibilityJSON&&"v4"!==this.options.compatibilityJSON||"undefined"!=typeof Intl&&Intl.PluralRules||(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=createRules()}return _createClass(PluralResolver,[{key:"addRule",value:function addRule(en,tn){this.rules[en]=tn}},{key:"getRule",value:function getRule(en){var tn=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(en,{type:tn.ordinal?"ordinal":"cardinal"})}catch(en){return}return this.rules[en]||this.rules[this.languageUtils.getLanguagePartFromCode(en)]}},{key:"needsPlural",value:function needsPlural(en){var tn=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},nn=this.getRule(en,tn);return this.shouldUseIntlApi()?nn&&nn.resolvedOptions().pluralCategories.length>1:nn&&nn.numbers.length>1}},{key:"getPluralFormsOfKey",value:function getPluralFormsOfKey(en,tn){var nn=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.getSuffixes(en,nn).map((function(en){return"".concat(tn).concat(en)}))}},{key:"getSuffixes",value:function getSuffixes(en){var tn=this,nn=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},rn=this.getRule(en,nn);return rn?this.shouldUseIntlApi()?rn.resolvedOptions().pluralCategories.sort((function(en,tn){return fn[en]-fn[tn]})).map((function(en){return"".concat(tn.options.prepend).concat(en)})):rn.numbers.map((function(rn){return tn.getSuffix(en,rn,nn)})):[]}},{key:"getSuffix",value:function getSuffix(en,tn){var nn=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},rn=this.getRule(en,nn);return rn?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(rn.select(tn)):this.getSuffixRetroCompatible(rn,tn):(this.logger.warn("no plural rule found for: ".concat(en)),"")}},{key:"getSuffixRetroCompatible",value:function getSuffixRetroCompatible(en,tn){var nn=this,rn=en.noAbs?en.plurals(tn):en.plurals(Math.abs(tn)),an=en.numbers[rn];this.options.simplifyPluralSuffix&&2===en.numbers.length&&1===en.numbers[0]&&(2===an?an="plural":1===an&&(an=""));var sn=function returnSuffix(){return nn.options.prepend&&an.toString()?nn.options.prepend+an.toString():an.toString()};return"v1"===this.options.compatibilityJSON?1===an?"":"number"==typeof an?"_plural_".concat(an.toString()):sn():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===en.numbers.length&&1===en.numbers[0]?sn():this.options.prepend&&rn.toString()?this.options.prepend+rn.toString():rn.toString()}},{key:"shouldUseIntlApi",value:function shouldUseIntlApi(){return!mn.includes(this.options.compatibilityJSON)}}]),PluralResolver}();function ownKeys$3$1(en,tn){var nn=Object.keys(en);if(Object.getOwnPropertySymbols){var rn=Object.getOwnPropertySymbols(en);tn&&(rn=rn.filter((function(tn){return Object.getOwnPropertyDescriptor(en,tn).enumerable}))),nn.push.apply(nn,rn)}return nn}function _objectSpread$3(en){for(var tn=1;tn0&&void 0!==arguments[0]?arguments[0]:{};_classCallCheck(this,Interpolator),this.logger=nn.create("interpolator"),this.options=en,this.format=en.interpolation&&en.interpolation.format||function(en){return en},this.init(en)}return _createClass(Interpolator,[{key:"init",value:function init(){var en=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};en.interpolation||(en.interpolation={escapeValue:!0});var tn=en.interpolation;this.escape=void 0!==tn.escape?tn.escape:escape$1,this.escapeValue=void 0===tn.escapeValue||tn.escapeValue,this.useRawValueToEscape=void 0!==tn.useRawValueToEscape&&tn.useRawValueToEscape,this.prefix=tn.prefix?regexEscape$1(tn.prefix):tn.prefixEscaped||"{{",this.suffix=tn.suffix?regexEscape$1(tn.suffix):tn.suffixEscaped||"}}",this.formatSeparator=tn.formatSeparator?tn.formatSeparator:tn.formatSeparator||",",this.unescapePrefix=tn.unescapeSuffix?"":tn.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":tn.unescapeSuffix||"",this.nestingPrefix=tn.nestingPrefix?regexEscape$1(tn.nestingPrefix):tn.nestingPrefixEscaped||regexEscape$1("$t("),this.nestingSuffix=tn.nestingSuffix?regexEscape$1(tn.nestingSuffix):tn.nestingSuffixEscaped||regexEscape$1(")"),this.nestingOptionsSeparator=tn.nestingOptionsSeparator?tn.nestingOptionsSeparator:tn.nestingOptionsSeparator||",",this.maxReplaces=tn.maxReplaces?tn.maxReplaces:1e3,this.alwaysFormat=void 0!==tn.alwaysFormat&&tn.alwaysFormat,this.resetRegExp()}},{key:"reset",value:function reset(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function resetRegExp(){var en="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(en,"g");var tn="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(tn,"g");var nn="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(nn,"g")}},{key:"interpolate",value:function interpolate(en,tn,nn,rn){var an,sn,cn,An=this,dn=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function regexSafe(en){return en.replace(/\$/g,"$$$$")}var un=function handleFormat(en){if(en.indexOf(An.formatSeparator)<0){var an=getPathWithDefaults(tn,dn,en);return An.alwaysFormat?An.format(an,void 0,nn,_objectSpread$3(_objectSpread$3(_objectSpread$3({},rn),tn),{},{interpolationkey:en})):an}var sn=en.split(An.formatSeparator),cn=sn.shift().trim(),un=sn.join(An.formatSeparator).trim();return An.format(getPathWithDefaults(tn,dn,cn),un,nn,_objectSpread$3(_objectSpread$3(_objectSpread$3({},rn),tn),{},{interpolationkey:cn}))};this.resetRegExp();var pn=rn&&rn.missingInterpolationHandler||this.options.missingInterpolationHandler,hn=rn&&rn.interpolation&&void 0!==rn.interpolation.skipOnVariables?rn.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:function safeValue(en){return regexSafe(en)}},{regex:this.regexp,safeValue:function safeValue(en){return An.escapeValue?regexSafe(An.escape(en)):regexSafe(en)}}].forEach((function(tn){for(cn=0;an=tn.regex.exec(en);){var nn=an[1].trim();if(void 0===(sn=un(nn)))if("function"==typeof pn){var dn=pn(en,an,rn);sn="string"==typeof dn?dn:""}else if(rn&&rn.hasOwnProperty(nn))sn="";else{if(hn){sn=an[0];continue}An.logger.warn("missed to pass in variable ".concat(nn," for interpolating ").concat(en)),sn=""}else"string"==typeof sn||An.useRawValueToEscape||(sn=makeString(sn));var gn=tn.safeValue(sn);if(en=en.replace(an[0],gn),hn?(tn.regex.lastIndex+=sn.length,tn.regex.lastIndex-=an[0].length):tn.regex.lastIndex=0,++cn>=An.maxReplaces)break}})),en}},{key:"nest",value:function nest(en,tn){var nn,rn,an=this,sn=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},cn=_objectSpread$3({},sn);function handleHasOptions(en,tn){var nn=this.nestingOptionsSeparator;if(en.indexOf(nn)<0)return en;var rn=en.split(new RegExp("".concat(nn,"[ ]*{"))),an="{".concat(rn[1]);en=rn[0],an=(an=this.interpolate(an,cn)).replace(/'/g,'"');try{cn=JSON.parse(an),tn&&(cn=_objectSpread$3(_objectSpread$3({},tn),cn))}catch(tn){return this.logger.warn("failed parsing options string in nesting for key ".concat(en),tn),"".concat(en).concat(nn).concat(an)}return delete cn.defaultValue,en}for(cn.applyPostProcessor=!1,delete cn.defaultValue;nn=this.nestingRegexp.exec(en);){var An=[],dn=!1;if(-1!==nn[0].indexOf(this.formatSeparator)&&!/{.*}/.test(nn[1])){var un=nn[1].split(this.formatSeparator).map((function(en){return en.trim()}));nn[1]=un.shift(),An=un,dn=!0}if((rn=tn(handleHasOptions.call(this,nn[1].trim(),cn),cn))&&nn[0]===en&&"string"!=typeof rn)return rn;"string"!=typeof rn&&(rn=makeString(rn)),rn||(this.logger.warn("missed to resolve ".concat(nn[1]," for nesting ").concat(en)),rn=""),dn&&(rn=An.reduce((function(en,tn){return an.format(en,tn,sn.lng,_objectSpread$3(_objectSpread$3({},sn),{},{interpolationkey:nn[1].trim()}))}),rn.trim())),en=en.replace(nn[0],rn),this.regexp.lastIndex=0}return en}}]),Interpolator}();function ownKeys$4(en,tn){var nn=Object.keys(en);if(Object.getOwnPropertySymbols){var rn=Object.getOwnPropertySymbols(en);tn&&(rn=rn.filter((function(tn){return Object.getOwnPropertyDescriptor(en,tn).enumerable}))),nn.push.apply(nn,rn)}return nn}function _objectSpread$4(en){for(var tn=1;tn0&&void 0!==arguments[0]?arguments[0]:{};_classCallCheck(this,Formatter),this.logger=nn.create("formatter"),this.options=en,this.formats={number:function number(en,tn,nn){return new Intl.NumberFormat(tn,nn).format(en)},currency:function currency(en,tn,nn){return new Intl.NumberFormat(tn,_objectSpread$4(_objectSpread$4({},nn),{},{style:"currency"})).format(en)},datetime:function datetime(en,tn,nn){return new Intl.DateTimeFormat(tn,_objectSpread$4({},nn)).format(en)},relativetime:function relativetime(en,tn,nn){return new Intl.RelativeTimeFormat(tn,_objectSpread$4({},nn)).format(en,nn.range||"day")},list:function list(en,tn,nn){return new Intl.ListFormat(tn,_objectSpread$4({},nn)).format(en)}},this.init(en)}return _createClass(Formatter,[{key:"init",value:function init(en){var tn=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}},nn=tn.interpolation;this.formatSeparator=nn.formatSeparator?nn.formatSeparator:nn.formatSeparator||","}},{key:"add",value:function add(en,tn){this.formats[en.toLowerCase().trim()]=tn}},{key:"format",value:function format(en,tn,nn,rn){var an=this,sn=tn.split(this.formatSeparator).reduce((function(en,tn){var sn=function parseFormatStr(en){var tn=en.toLowerCase().trim(),nn={};if(en.indexOf("(")>-1){var rn=en.split("(");tn=rn[0].toLowerCase().trim();var an=rn[1].substring(0,rn[1].length-1);"currency"===tn&&an.indexOf(":")<0?nn.currency||(nn.currency=an.trim()):"relativetime"===tn&&an.indexOf(":")<0?nn.range||(nn.range=an.trim()):an.split(";").forEach((function(en){if(en){var tn=_toArray(en.split(":")),rn=tn[0],an=tn.slice(1).join(":").trim().replace(/^'+|'+$/g,"");nn[rn.trim()]||(nn[rn.trim()]=an),"false"===an&&(nn[rn.trim()]=!1),"true"===an&&(nn[rn.trim()]=!0),isNaN(an)||(nn[rn.trim()]=parseInt(an,10))}}))}return{formatName:tn,formatOptions:nn}}(tn),cn=sn.formatName,An=sn.formatOptions;if(an.formats[cn]){var dn=en;try{var un=rn&&rn.formatParams&&rn.formatParams[rn.interpolationkey]||{},pn=un.locale||un.lng||rn.locale||rn.lng||nn;dn=an.formats[cn](en,pn,_objectSpread$4(_objectSpread$4(_objectSpread$4({},An),rn),un))}catch(en){an.logger.warn(en)}return dn}return an.logger.warn("there was no format function for ".concat(cn)),en}),en);return sn}}]),Formatter}();function ownKeys$5(en,tn){var nn=Object.keys(en);if(Object.getOwnPropertySymbols){var rn=Object.getOwnPropertySymbols(en);tn&&(rn=rn.filter((function(tn){return Object.getOwnPropertyDescriptor(en,tn).enumerable}))),nn.push.apply(nn,rn)}return nn}function _objectSpread$5(en){for(var tn=1;tn3&&void 0!==arguments[3]?arguments[3]:{};return _classCallCheck(this,Connector),An=tn.call(this),sn&&rn.call(_assertThisInitialized(An)),An.backend=en,An.store=an,An.services=cn,An.languageUtils=cn.languageUtils,An.options=dn,An.logger=nn.create("backendConnector"),An.waitingReads=[],An.maxParallelReads=dn.maxParallelReads||10,An.readingCalls=0,An.maxRetries=dn.maxRetries>=0?dn.maxRetries:5,An.retryTimeout=dn.retryTimeout>=1?dn.retryTimeout:350,An.state={},An.queue=[],An.backend&&An.backend.init&&An.backend.init(cn,dn.backend,dn),An}return _createClass(Connector,[{key:"queueLoad",value:function queueLoad(en,tn,nn,rn){var an=this,sn={},cn={},An={},dn={};return en.forEach((function(en){var rn=!0;tn.forEach((function(tn){var An="".concat(en,"|").concat(tn);!nn.reload&&an.store.hasResourceBundle(en,tn)?an.state[An]=2:an.state[An]<0||(1===an.state[An]?void 0===cn[An]&&(cn[An]=!0):(an.state[An]=1,rn=!1,void 0===cn[An]&&(cn[An]=!0),void 0===sn[An]&&(sn[An]=!0),void 0===dn[tn]&&(dn[tn]=!0)))})),rn||(An[en]=!0)})),(Object.keys(sn).length||Object.keys(cn).length)&&this.queue.push({pending:cn,pendingCount:Object.keys(cn).length,loaded:{},errors:[],callback:rn}),{toLoad:Object.keys(sn),pending:Object.keys(cn),toLoadLanguages:Object.keys(An),toLoadNamespaces:Object.keys(dn)}}},{key:"loaded",value:function loaded(en,tn,nn){var rn=en.split("|"),an=rn[0],sn=rn[1];tn&&this.emit("failedLoading",an,sn,tn),nn&&this.store.addResourceBundle(an,sn,nn),this.state[en]=tn?-1:2;var loaded={};this.queue.forEach((function(nn){!function pushPath(en,tn,nn,rn){var an=getLastOfPath(en,tn,Object),sn=an.obj,cn=an.k;sn[cn]=sn[cn]||[],rn&&(sn[cn]=sn[cn].concat(nn)),rn||sn[cn].push(nn)}(nn.loaded,[an],sn),function removePending(en,tn){void 0!==en.pending[tn]&&(delete en.pending[tn],en.pendingCount--)}(nn,en),tn&&nn.errors.push(tn),0!==nn.pendingCount||nn.done||(Object.keys(nn.loaded).forEach((function(en){loaded[en]||(loaded[en]={});var tn=nn.loaded[en];tn.length&&tn.forEach((function(tn){void 0===loaded[en][tn]&&(loaded[en][tn]=!0)}))})),nn.done=!0,nn.errors.length?nn.callback(nn.errors):nn.callback())})),this.emit("loaded",loaded),this.queue=this.queue.filter((function(en){return!en.done}))}},{key:"read",value:function read(en,tn,nn){var rn=this,an=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,sn=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.retryTimeout,cn=arguments.length>5?arguments[5]:void 0;return en.length?this.readingCalls>=this.maxParallelReads?void this.waitingReads.push({lng:en,ns:tn,fcName:nn,tried:an,wait:sn,callback:cn}):(this.readingCalls++,this.backend[nn](en,tn,(function(An,dn){if(rn.readingCalls--,rn.waitingReads.length>0){var un=rn.waitingReads.shift();rn.read(un.lng,un.ns,un.fcName,un.tried,un.wait,un.callback)}An&&dn&&an2&&void 0!==arguments[2]?arguments[2]:{},an=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),an&&an();"string"==typeof en&&(en=this.languageUtils.toResolveHierarchy(en)),"string"==typeof tn&&(tn=[tn]);var sn=this.queueLoad(en,tn,rn,an);if(!sn.toLoad.length)return sn.pending.length||an(),null;sn.toLoad.forEach((function(en){nn.loadOne(en)}))}},{key:"load",value:function load(en,tn,nn){this.prepareLoading(en,tn,{},nn)}},{key:"reload",value:function reload(en,tn,nn){this.prepareLoading(en,tn,{reload:!0},nn)}},{key:"loadOne",value:function loadOne(en){var tn=this,nn=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",rn=en.split("|"),an=rn[0],sn=rn[1];this.read(an,sn,"read",void 0,void 0,(function(rn,cn){rn&&tn.logger.warn("".concat(nn,"loading namespace ").concat(sn," for language ").concat(an," failed"),rn),!rn&&cn&&tn.logger.log("".concat(nn,"loaded namespace ").concat(sn," for language ").concat(an),cn),tn.loaded(en,rn,cn)}))}},{key:"saveMissing",value:function saveMissing(en,tn,nn,rn,an){var sn=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(tn)?this.logger.warn('did not save key "'.concat(nn,'" as the namespace "').concat(tn,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!"):null!=nn&&""!==nn&&(this.backend&&this.backend.create&&this.backend.create(en,tn,nn,rn,null,_objectSpread$5(_objectSpread$5({},sn),{},{isUpdate:an})),en&&en[0]&&this.store.addResource(en[0],tn,nn,rn))}}]),Connector}(rn);function get(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function handle(en){var tn={};if("object"===_typeof$2(en[1])&&(tn=en[1]),"string"==typeof en[1]&&(tn.defaultValue=en[1]),"string"==typeof en[2]&&(tn.tDescription=en[2]),"object"===_typeof$2(en[2])||"object"===_typeof$2(en[3])){var nn=en[3]||en[2];Object.keys(nn).forEach((function(en){tn[en]=nn[en]}))}return tn},interpolation:{escapeValue:!0,format:function format(en,tn,nn,rn){return en},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function transformOptions(en){return"string"==typeof en.ns&&(en.ns=[en.ns]),"string"==typeof en.fallbackLng&&(en.fallbackLng=[en.fallbackLng]),"string"==typeof en.fallbackNS&&(en.fallbackNS=[en.fallbackNS]),en.supportedLngs&&en.supportedLngs.indexOf("cimode")<0&&(en.supportedLngs=en.supportedLngs.concat(["cimode"])),en}function ownKeys$6(en,tn){var nn=Object.keys(en);if(Object.getOwnPropertySymbols){var rn=Object.getOwnPropertySymbols(en);tn&&(rn=rn.filter((function(tn){return Object.getOwnPropertyDescriptor(en,tn).enumerable}))),nn.push.apply(nn,rn)}return nn}function _objectSpread$6(en){for(var tn=1;tn0&&void 0!==arguments[0]?arguments[0]:{},cn=arguments.length>1?arguments[1]:void 0;if(_classCallCheck(this,I18n),en=tn.call(this),sn&&rn.call(_assertThisInitialized(en)),en.options=transformOptions(an),en.services={},en.logger=nn,en.modules={external:[]},bindMemberFunctions(_assertThisInitialized(en)),cn&&!en.isInitialized&&!an.isClone){if(!en.options.initImmediate)return en.init(an,cn),_possibleConstructorReturn(en,_assertThisInitialized(en));setTimeout((function(){en.init(an,cn)}),0)}return en}return _createClass(I18n,[{key:"init",value:function init(){var en=this,tn=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},rn=arguments.length>1?arguments[1]:void 0;"function"==typeof tn&&(rn=tn,tn={}),!tn.defaultNS&&tn.ns&&("string"==typeof tn.ns?tn.defaultNS=tn.ns:tn.ns.indexOf("translation")<0&&(tn.defaultNS=tn.ns[0]));var an=get();function createClassOnDemand(en){return en?"function"==typeof en?new en:en:null}if(this.options=_objectSpread$6(_objectSpread$6(_objectSpread$6({},an),this.options),transformOptions(tn)),"v1"!==this.options.compatibilityAPI&&(this.options.interpolation=_objectSpread$6(_objectSpread$6({},an.interpolation),this.options.interpolation)),void 0!==tn.keySeparator&&(this.options.userDefinedKeySeparator=tn.keySeparator),void 0!==tn.nsSeparator&&(this.options.userDefinedNsSeparator=tn.nsSeparator),!this.options.isClone){var sn;this.modules.logger?nn.init(createClassOnDemand(this.modules.logger),this.options):nn.init(null,this.options),this.modules.formatter?sn=this.modules.formatter:"undefined"!=typeof Intl&&(sn=vn);var cn=new hn(this.options);this.store=new An(this.options.resources,this.options);var dn=this.services;dn.logger=nn,dn.resourceStore=this.store,dn.languageUtils=cn,dn.pluralResolver=new yn(cn,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!sn||this.options.interpolation.format&&this.options.interpolation.format!==an.interpolation.format||(dn.formatter=createClassOnDemand(sn),dn.formatter.init(dn,this.options),this.options.interpolation.format=dn.formatter.format.bind(dn.formatter)),dn.interpolator=new bn(this.options),dn.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},dn.backendConnector=new wn(createClassOnDemand(this.modules.backend),dn.resourceStore,dn,this.options),dn.backendConnector.on("*",(function(tn){for(var nn=arguments.length,rn=new Array(nn>1?nn-1:0),an=1;an1?nn-1:0),an=1;an0&&"dev"!==un[0]&&(this.options.lng=un[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");var gn=["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"];gn.forEach((function(tn){en[tn]=function(){var nn;return(nn=en.store)[tn].apply(nn,arguments)}}));var _n=["addResource","addResources","addResourceBundle","removeResourceBundle"];_n.forEach((function(tn){en[tn]=function(){var nn;return(nn=en.store)[tn].apply(nn,arguments),en}}));var mn=defer(),fn=function load(){var tn=function finish(tn,nn){en.isInitialized&&!en.initializedStoreOnce&&en.logger.warn("init: i18next is already initialized. You should call init just once!"),en.isInitialized=!0,en.options.isClone||en.logger.log("initialized",en.options),en.emit("initialized",en.options),mn.resolve(nn),rn(tn,nn)};if(en.languages&&"v1"!==en.options.compatibilityAPI&&!en.isInitialized)return tn(null,en.t.bind(en));en.changeLanguage(en.options.lng,tn)};return this.options.resources||!this.options.initImmediate?fn():setTimeout(fn,0),mn}},{key:"loadResources",value:function loadResources(en){var tn=this,nn=arguments.length>1&&void 0!==arguments[1]?arguments[1]:noop$2,rn=nn,an="string"==typeof en?en:this.language;if("function"==typeof en&&(rn=en),!this.options.resources||this.options.partialBundledLanguages){if(an&&"cimode"===an.toLowerCase())return rn();var sn=[],cn=function append(en){en&&tn.services.languageUtils.toResolveHierarchy(en).forEach((function(en){sn.indexOf(en)<0&&sn.push(en)}))};if(an)cn(an);else{var An=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);An.forEach((function(en){return cn(en)}))}this.options.preload&&this.options.preload.forEach((function(en){return cn(en)})),this.services.backendConnector.load(sn,this.options.ns,(function(en){en||tn.resolvedLanguage||!tn.language||tn.setResolvedLanguage(tn.language),rn(en)}))}else rn(null)}},{key:"reloadResources",value:function reloadResources(en,tn,nn){var rn=defer();return en||(en=this.languages),tn||(tn=this.options.ns),nn||(nn=noop$2),this.services.backendConnector.reload(en,tn,(function(en){rn.resolve(),nn(en)})),rn}},{key:"use",value:function use(en){if(!en)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!en.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===en.type&&(this.modules.backend=en),("logger"===en.type||en.log&&en.warn&&en.error)&&(this.modules.logger=en),"languageDetector"===en.type&&(this.modules.languageDetector=en),"i18nFormat"===en.type&&(this.modules.i18nFormat=en),"postProcessor"===en.type&&dn.addPostProcessor(en),"formatter"===en.type&&(this.modules.formatter=en),"3rdParty"===en.type&&this.modules.external.push(en),this}},{key:"setResolvedLanguage",value:function setResolvedLanguage(en){if(en&&this.languages&&!(["cimode","dev"].indexOf(en)>-1))for(var tn=0;tn-1)&&this.store.hasLanguageSomeTranslations(nn)){this.resolvedLanguage=nn;break}}}},{key:"changeLanguage",value:function changeLanguage(en,tn){var nn=this;this.isLanguageChangingTo=en;var rn=defer();this.emit("languageChanging",en);var an=function setLngProps(en){nn.language=en,nn.languages=nn.services.languageUtils.toResolveHierarchy(en),nn.resolvedLanguage=void 0,nn.setResolvedLanguage(en)},sn=function setLng(sn){en||sn||!nn.services.languageDetector||(sn=[]);var cn="string"==typeof sn?sn:nn.services.languageUtils.getBestMatchFromCodes(sn);cn&&(nn.language||an(cn),nn.translator.language||nn.translator.changeLanguage(cn),nn.services.languageDetector&&nn.services.languageDetector.cacheUserLanguage(cn)),nn.loadResources(cn,(function(en){!function done(en,sn){sn?(an(sn),nn.translator.changeLanguage(sn),nn.isLanguageChangingTo=void 0,nn.emit("languageChanged",sn),nn.logger.log("languageChanged",sn)):nn.isLanguageChangingTo=void 0,rn.resolve((function(){return nn.t.apply(nn,arguments)})),tn&&tn(en,(function(){return nn.t.apply(nn,arguments)}))}(en,cn)}))};return en||!this.services.languageDetector||this.services.languageDetector.async?!en&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect(sn):sn(en):sn(this.services.languageDetector.detect()),rn}},{key:"getFixedT",value:function getFixedT(en,tn,nn){var rn=this,an=function fixedT(en,tn){var an;if("object"!==_typeof$2(tn)){for(var sn=arguments.length,cn=new Array(sn>2?sn-2:0),An=2;An1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var rn=this.resolvedLanguage||this.languages[0],an=!!this.options&&this.options.fallbackLng,sn=this.languages[this.languages.length-1];if("cimode"===rn.toLowerCase())return!0;var cn=function loadNotPending(en,nn){var rn=tn.services.backendConnector.state["".concat(en,"|").concat(nn)];return-1===rn||2===rn};if(nn.precheck){var An=nn.precheck(this,cn);if(void 0!==An)return An}return!!this.hasResourceBundle(rn,en)||(!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!cn(rn,en)||an&&!cn(sn,en)))}},{key:"loadNamespaces",value:function loadNamespaces(en,tn){var nn=this,rn=defer();return this.options.ns?("string"==typeof en&&(en=[en]),en.forEach((function(en){nn.options.ns.indexOf(en)<0&&nn.options.ns.push(en)})),this.loadResources((function(en){rn.resolve(),tn&&tn(en)})),rn):(tn&&tn(),Promise.resolve())}},{key:"loadLanguages",value:function loadLanguages(en,tn){var nn=defer();"string"==typeof en&&(en=[en]);var rn=this.options.preload||[],an=en.filter((function(en){return rn.indexOf(en)<0}));return an.length?(this.options.preload=rn.concat(an),this.loadResources((function(en){nn.resolve(),tn&&tn(en)})),nn):(tn&&tn(),Promise.resolve())}},{key:"dir",value:function dir(en){if(en||(en=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!en)return"rtl";return["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(this.services.languageUtils.getLanguagePartFromCode(en))>-1||en.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}},{key:"cloneInstance",value:function cloneInstance(){var en=this,tn=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},nn=arguments.length>1&&void 0!==arguments[1]?arguments[1]:noop$2,rn=_objectSpread$6(_objectSpread$6(_objectSpread$6({},this.options),tn),{isClone:!0}),an=new I18n(rn),sn=["store","services","language"];return sn.forEach((function(tn){an[tn]=en[tn]})),an.services=_objectSpread$6({},this.services),an.services.utils={hasLoadedNamespace:an.hasLoadedNamespace.bind(an)},an.translator=new pn(an.services,an.options),an.translator.on("*",(function(en){for(var tn=arguments.length,nn=new Array(tn>1?tn-1:0),rn=1;rn0&&void 0!==arguments[0]?arguments[0]:{},tn=arguments.length>1?arguments[1]:void 0;return new xn(en,tn)}));var kn=xn.createInstance();let Cn;kn.createInstance=xn.createInstance,kn.createInstance,kn.init,kn.loadResources,kn.reloadResources,kn.use,kn.changeLanguage,kn.getFixedT,kn.t,kn.exists,kn.setDefaultNamespace,kn.hasLoadedNamespace,kn.loadNamespaces,kn.loadLanguages;const putLocale=async function(en,tn){en?Cn=en:navigator.userLanguage?Cn=navigator.userLanguage:navigator.language&&(Cn=navigator.language),tn.includes(Cn)||"test"===Cn||(Cn="en");const nn=await function __variableDynamicImportRuntime0__(en){switch(en){case"./locale/lang.af.js":return Promise.resolve().then((function(){return KS}));case"./locale/lang.ar.js":return Promise.resolve().then((function(){return $S}));case"./locale/lang.az.js":return Promise.resolve().then((function(){return WS}));case"./locale/lang.be.js":return Promise.resolve().then((function(){return XS}));case"./locale/lang.bg.js":return Promise.resolve().then((function(){return YS}));case"./locale/lang.ca.js":return Promise.resolve().then((function(){return ZS}));case"./locale/lang.cs.js":return Promise.resolve().then((function(){return JS}));case"./locale/lang.cy.js":return Promise.resolve().then((function(){return eB}));case"./locale/lang.da.js":return Promise.resolve().then((function(){return tB}));case"./locale/lang.de.js":return Promise.resolve().then((function(){return nB}));case"./locale/lang.el.js":return Promise.resolve().then((function(){return rB}));case"./locale/lang.en.js":return Promise.resolve().then((function(){return oB}));case"./locale/lang.es.js":return Promise.resolve().then((function(){return iB}));case"./locale/lang.et.js":return Promise.resolve().then((function(){return aB}));case"./locale/lang.fa.js":return Promise.resolve().then((function(){return sB}));case"./locale/lang.fi.js":return Promise.resolve().then((function(){return lB}));case"./locale/lang.fr.js":return Promise.resolve().then((function(){return cB}));case"./locale/lang.fy.js":return Promise.resolve().then((function(){return AB}));case"./locale/lang.ga.js":return Promise.resolve().then((function(){return dB}));case"./locale/lang.gl.js":return Promise.resolve().then((function(){return uB}));case"./locale/lang.he.js":return Promise.resolve().then((function(){return pB}));case"./locale/lang.hi.js":return Promise.resolve().then((function(){return hB}));case"./locale/lang.hr.js":return Promise.resolve().then((function(){return gB}));case"./locale/lang.hu.js":return Promise.resolve().then((function(){return _B}));case"./locale/lang.hy.js":return Promise.resolve().then((function(){return mB}));case"./locale/lang.id.js":return Promise.resolve().then((function(){return fB}));case"./locale/lang.is.js":return Promise.resolve().then((function(){return yB}));case"./locale/lang.it.js":return Promise.resolve().then((function(){return bB}));case"./locale/lang.ja.js":return Promise.resolve().then((function(){return vB}));case"./locale/lang.ko.js":return Promise.resolve().then((function(){return wB}));case"./locale/lang.lt.js":return Promise.resolve().then((function(){return xB}));case"./locale/lang.lv.js":return Promise.resolve().then((function(){return kB}));case"./locale/lang.mk.js":return Promise.resolve().then((function(){return CB}));case"./locale/lang.ms.js":return Promise.resolve().then((function(){return SB}));case"./locale/lang.mt.js":return Promise.resolve().then((function(){return BB}));case"./locale/lang.nl.js":return Promise.resolve().then((function(){return EB}));case"./locale/lang.no.js":return Promise.resolve().then((function(){return jB}));case"./locale/lang.pl.js":return Promise.resolve().then((function(){return LB}));case"./locale/lang.pt-BR.js":return Promise.resolve().then((function(){return PB}));case"./locale/lang.pt-PT.js":return Promise.resolve().then((function(){return TB}));case"./locale/lang.ro.js":return Promise.resolve().then((function(){return FB}));case"./locale/lang.ru.js":return Promise.resolve().then((function(){return UB}));case"./locale/lang.sk.js":return Promise.resolve().then((function(){return NB}));case"./locale/lang.sl.js":return Promise.resolve().then((function(){return IB}));case"./locale/lang.sq.js":return Promise.resolve().then((function(){return MB}));case"./locale/lang.sr.js":return Promise.resolve().then((function(){return RB}));case"./locale/lang.sv.js":return Promise.resolve().then((function(){return OB}));case"./locale/lang.sw.js":return Promise.resolve().then((function(){return QB}));case"./locale/lang.test.js":return Promise.resolve().then((function(){return qB}));case"./locale/lang.th.js":return Promise.resolve().then((function(){return VB}));case"./locale/lang.tl.js":return Promise.resolve().then((function(){return GB}));case"./locale/lang.tr.js":return Promise.resolve().then((function(){return DB}));case"./locale/lang.uk.js":return Promise.resolve().then((function(){return HB}));case"./locale/lang.vi.js":return Promise.resolve().then((function(){return zB}));case"./locale/lang.yi.js":return Promise.resolve().then((function(){return KB}));case"./locale/lang.zh-CN.js":return Promise.resolve().then((function(){return $B}));case"./locale/lang.zh-HK.js":return Promise.resolve().then((function(){return WB}));case"./locale/lang.zh-TW.js":return Promise.resolve().then((function(){return XB}));default:return new Promise((function(tn,nn){("function"==typeof queueMicrotask?queueMicrotask:setTimeout)(nn.bind(null,new Error("Unknown variable dynamic import: "+en)))}))}}("./locale/lang.".concat(encodeURIComponent(Cn),".js"));return kn.init({lng:Cn,debug:!1,resources:{[Cn]:{translation:nn.default}}}),{langParam:Cn,i18next:kn}},t$1=function(en){return kn.t(en)},Sn=document.createElement("template");Sn.innerHTML='\n \n
\n icon\n
\n';class ToolButton extends HTMLElement{constructor(){super(),this._shadowRoot=this.attachShadow({mode:"open"}),this._shadowRoot.append(Sn.content.cloneNode(!0)),this.$div=this._shadowRoot.querySelector("div"),this.$img=this._shadowRoot.querySelector("img"),this.imgPath=svgEditor.configObj.curConfig.imgPath}static get observedAttributes(){return["title","src","pressed","disabled","size","style"]}attributeChangedCallback(en,tn,nn){if(tn!==nn)switch(en){case"title":{const en=this.getAttribute("shortcut");this.$div.setAttribute("title","".concat(t$1(nn)," ").concat(en?"[".concat(t$1(en),"]"):""))}break;case"style":this.$div.style=nn;break;case"src":-1!==nn.indexOf("data:")?this.$img.setAttribute("src",nn):this.$img.setAttribute("src",this.imgPath+"/"+nn);break;case"pressed":null===nn?this.$div.classList.remove("pressed"):this.$div.classList.add("pressed");break;case"size":"small"===nn?this.$div.classList.add("small"):this.$div.classList.remove("small");break;case"disabled":nn?this.$div.classList.add("disabled"):this.$div.classList.remove("disabled");break;default:console.error("unknown attribute: ".concat(en))}}get title(){return this.getAttribute("title")}set title(en){this.setAttribute("title",en)}get pressed(){return this.hasAttribute("pressed")}set pressed(en){en?this.setAttribute("pressed","true"):this.removeAttribute("pressed")}get disabled(){return this.hasAttribute("disabled")}set disabled(en){en?this.setAttribute("disabled","true"):this.removeAttribute("disabled")}get src(){return this.getAttribute("src")}set src(en){this.setAttribute("src",en)}get size(){return this.getAttribute("size")}set size(en){this.setAttribute("size",en)}connectedCallback(){const en=this.getAttribute("shortcut");en&&document.addEventListener("keydown",(tn=>{if("BODY"!==tn.target.nodeName)return;const nn="".concat(tn.metaKey?"meta+":"").concat(tn.ctrlKey?"ctrl+":"").concat(tn.key.toUpperCase());en===nn&&(this.click(),tn.preventDefault())}))}}customElements.define("se-button",ToolButton);class FlyingButton extends HTMLElement{constructor(){super(),this.imgPath=svgEditor.configObj.curConfig.imgPath,this.template=this.createTemplate(this.imgPath),this._shadowRoot=this.attachShadow({mode:"open"}),this._shadowRoot.append(this.template.content.cloneNode(!0)),this.$button=this._shadowRoot.querySelector(".menu-button"),this.$handle=this._shadowRoot.querySelector(".handle"),this.$overall=this._shadowRoot.querySelector(".overall"),this.$img=this._shadowRoot.querySelector("img"),this.$menu=this._shadowRoot.querySelector(".menu"),this.$elements=this.$menu.lastElementChild.assignedElements()}createTemplate(en){const tn=document.createElement("template");return tn.innerHTML="\n \n\n
\n \n \n
'),tn}static get observedAttributes(){return["title","pressed","disabled","opened"]}attributeChangedCallback(en,tn,nn){if(tn!==nn)switch(en){case"title":{const en=this.getAttribute("shortcut");this.$button.setAttribute("title","".concat(t$1(nn)," ").concat(en?"[".concat(t$1(en),"]"):""))}break;case"pressed":nn?this.$overall.classList.add("pressed"):this.$overall.classList.remove("pressed");break;case"opened":nn?this.$menu.classList.add("open"):this.$menu.classList.remove("open");break;case"disabled":nn?this.$overall.classList.add("disabled"):this.$overall.classList.remove("disabled");break;default:console.error("unknown attribute: ".concat(en))}}get title(){return this.getAttribute("title")}set title(en){this.setAttribute("title",en)}get pressed(){return this.hasAttribute("pressed")}set pressed(en){en?this.setAttribute("pressed","true"):(this.removeAttribute("pressed",""),this.removeAttribute("opened"))}get opened(){return this.hasAttribute("opened")}set opened(en){en?this.setAttribute("opened","opened"):this.removeAttribute("opened")}get disabled(){return this.hasAttribute("disabled")}set disabled(en){en?this.setAttribute("disabled","true"):this.removeAttribute("disabled","")}connectedCallback(){this.activeSlot=this.shadowRoot.querySelector("slot").assignedElements()[0],this.$img.setAttribute("src",this.imgPath+"/"+this.activeSlot.getAttribute("src"));const onClickHandler=en=>{switch(en.stopPropagation(),en.target.nodeName){case"SE-FLYINGBUTTON":this.pressed?this.setAttribute("opened","opened"):(this.activeSlot.click(),this.setAttribute("pressed","pressed"));break;case"SE-BUTTON":this.$img.setAttribute("src",this.imgPath+"/"+en.target.getAttribute("src")),this.activeSlot=en.target,this.setAttribute("pressed","pressed"),this.$menu.classList.remove("open");break;case"DIV":if(this.opened)this.removeAttribute("opened");else{this.setAttribute("opened","opened");const en=this.getBoundingClientRect();this.$menu.style.top=en.top+"px"}break;default:console.error("unkonw nodeName for:",en.target,en.target.className)}};svgEditor.$click(this,onClickHandler),svgEditor.$click(this.$handle,onClickHandler)}}customElements.define("se-flyingbutton",FlyingButton);class ExplorerButton extends HTMLElement{constructor(){super(),this.imgPath=svgEditor.configObj.curConfig.imgPath,this.template=this.createTemplate(this.imgPath),this._shadowRoot=this.attachShadow({mode:"open"}),this._shadowRoot.append(this.template.content.cloneNode(!0)),this.$button=this._shadowRoot.querySelector(".menu-button"),this.$overall=this._shadowRoot.querySelector(".overall"),this.$img=this._shadowRoot.querySelector(".menu-button img"),this.$menu=this._shadowRoot.querySelector(".menu"),this.$handle=this._shadowRoot.querySelector(".handle"),this.$lib=this._shadowRoot.querySelector(".image-lib"),this.files=[],this.request=new XMLHttpRequest,this.imgPath=svgEditor.configObj.curConfig.imgPath}createTemplate(en){const tn=document.createElement("template");return tn.innerHTML="\n \n \n
\n \n
\n \n
\n \n
'),tn}static get observedAttributes(){return["title","pressed","disabled","lib","src"]}async attributeChangedCallback(en,tn,nn){if(tn!==nn)switch(en){case"title":{const en=this.getAttribute("shortcut");this.$button.setAttribute("title","".concat(nn," [").concat(en,"]"))}break;case"pressed":nn?this.$overall.classList.add("pressed"):this.$overall.classList.remove("pressed");break;case"disabled":nn?this.$overall.classList.add("disabled"):this.$overall.classList.remove("disabled");break;case"lib":try{const en=await fetch("".concat(nn,"index.json")),tn=await en.json(),{lib:rn}=tn;this.$menu.innerHTML=rn.map(((en,tn)=>'"))).join(""),await this.updateLib(rn[0])}catch(en){console.error(en)}break;case"src":this.$img.setAttribute("src",this.imgPath+"/"+nn);break;default:console.error("unknown attribute: ".concat(en))}}get title(){return this.getAttribute("title")}set title(en){this.setAttribute("title",en)}get pressed(){return this.hasAttribute("pressed")}set pressed(en){en?this.setAttribute("pressed","true"):this.removeAttribute("pressed","")}get disabled(){return this.hasAttribute("disabled")}set disabled(en){en?this.setAttribute("disabled","true"):this.removeAttribute("disabled","")}connectedCallback(){const onClickHandler=en=>{switch(en.stopPropagation(),en.target.nodeName){case"SE-EXPLORERBUTTON":this.$menu.classList.add("open"),this.$lib.classList.add("open-lib");break;case"SE-BUTTON":this.currentAction=en.target,this.$img.setAttribute("src",this.currentAction.getAttribute("src")),this.dataset.draw=this.data[this.currentAction.dataset.shape],this._shadowRoot.querySelectorAll(".image-lib [pressed]").forEach((en=>{en.pressed=!1})),this.currentAction.setAttribute("pressed","pressed"),this.$menu.classList.remove("open"),this.$lib.classList.remove("open-lib");break;case"DIV":"handle"===en.target.classList[0]?(this.$menu.classList.toggle("open"),this.$lib.classList.toggle("open-lib")):(this._shadowRoot.querySelectorAll(".menu > .pressed").forEach((en=>{en.classList.remove("pressed")})),en.target.classList.add("pressed"),this.updateLib(en.target.dataset.menu));break;default:console.error("unknown nodeName for:",en.target,en.target.className)}};svgEditor.$click(this,onClickHandler),svgEditor.$click(this.$menu,onClickHandler),svgEditor.$click(this.$lib,onClickHandler),svgEditor.$click(this.$handle,onClickHandler)}async updateLib(en){const tn=this.getAttribute("lib");try{var nn;const rn=await fetch("".concat(tn).concat(en,".json")),an=await rn.json();this.data=an.data;const sn=null!==(nn=an.size)&&void 0!==nn?nn:300,cn=an.fill?"#333":"none",An=.05*sn,dn=[-An,-An,sn+2*An,sn+2*An].join(" "),un=an.fill?0:sn/30;this.$lib.innerHTML=Object.entries(this.data).map((en=>{let[tn,nn]=en;const rn=btoa('\n \n \n '));return'')})).join("")}catch(nn){console.error("could not read file:".concat(tn).concat(en,".json"),nn)}}}customElements.define("se-explorerbutton",ExplorerButton);const Bn=document.createElement("template");Bn.innerHTML='\n \n
\n icon\n \n
\n
\n
\n
\n
\n \n
\n
\n \n';class SeZoom extends HTMLElement{constructor(){super(),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.initPopup=this.initPopup.bind(this),this.handleInput=this.handleInput.bind(this),this._shadowRoot=this.attachShadow({mode:"open"}),this._shadowRoot.append(Bn.content.cloneNode(!0)),this.slotElement=this._shadowRoot.querySelector("slot"),this.slotElement.addEventListener("slotchange",this.handleOptionsChange.bind(this)),this.inputElement=this._shadowRoot.querySelector("input"),this.inputElement.addEventListener("click",this.handleClick.bind(this)),this.inputElement.addEventListener("change",this.handleInput),this.inputElement.addEventListener("keydown",this.handleKeyDown),this.clickArea=this._shadowRoot.querySelector("#down"),this.clickArea.addEventListener("click",this.handleClick.bind(this)),this.imageElement=this._shadowRoot.querySelector("img"),this.imageElement.setAttribute("src",this.imgPath=svgEditor.configObj.curConfig.imgPath+"/"+this.getAttribute("src")),this.arrowUp=this._shadowRoot.querySelector("#arrow-up"),this.arrowUp.addEventListener("click",this.increment.bind(this)),this.arrowUp.addEventListener("mousedown",(en=>this.handleMouseDown("up",!0))),this.arrowUp.addEventListener("mouseleave",(en=>this.handleMouseUp("up"))),this.arrowUp.addEventListener("mouseup",(en=>this.handleMouseUp("up"))),this.arrowDown=this._shadowRoot.querySelector("#arrow-down"),this.arrowDown.addEventListener("click",this.decrement.bind(this)),this.arrowDown.addEventListener("mousedown",(en=>this.handleMouseDown("down",!0))),this.arrowDown.addEventListener("mouseleave",(en=>this.handleMouseUp("down"))),this.arrowDown.addEventListener("mouseup",(en=>this.handleMouseUp("down"))),this.optionsContainer=this._shadowRoot.querySelector("#options-container"),document.addEventListener("click",(en=>this.handleClose(en))),this.changedTimeout=null}static get observedAttributes(){return["value"]}get value(){return this.getAttribute("value")}set value(en){this.setAttribute("value",en)}attributeChangedCallback(en,tn,nn){if(tn!==nn){if("value"===en)this.inputElement.value=nn,this.dispatchEvent(new CustomEvent("change",{detail:{value:nn}}))}else if("value"===en)parseInt(this.inputElement.value)!==nn&&(this.inputElement.value=nn)}handleOptionsChange(){this.slotElement.assignedElements().length>0&&(this.options=this.slotElement.assignedElements(),this.selectedValue=this.options[0].textContent,this.initPopup(),this.options.forEach((en=>{en.addEventListener("click",(en=>this.handleSelect(en)))})))}handleClick(){this.optionsContainer.style.display="flex",this.inputElement.select(),this.initPopup()}handleSelect(en){this.value=en.target.getAttribute("value"),this.title=en.target.getAttribute("text")}initPopup(){const en=this.getBoundingClientRect(),tn=this.optionsContainer.getBoundingClientRect(),nn=en.top-tn.height,rn=en.left;this.optionsContainer.style.position="fixed",this.optionsContainer.style.top="".concat(nn,"px"),this.optionsContainer.style.left="".concat(rn,"px")}handleClose(en){en.target!==this&&(this.optionsContainer.style.display="none",this.inputElement.blur())}handleInput(){this.changedTimeout&&clearTimeout(this.changedTimeout),this.changedTimeout=setTimeout(this.triggerInputChanged.bind(this),500)}triggerInputChanged(){const en=this.inputElement.value;this.value=en}increment(){this.value=parseInt(this.value)+10}decrement(){this.value-10<=0?this.value=10:this.value=parseInt(this.value)-10}handleMouseDown(en,tn){"up"===en?(this.incrementHold=!0,!tn&&this.increment(),setTimeout((()=>{this.incrementHold&&this.handleMouseDown(en,!1)}),tn?500:50)):"down"===en&&(this.decrementHold=!0,!tn&&this.decrement(),setTimeout((()=>{this.decrementHold&&this.handleMouseDown(en,!1)}),tn?500:50))}handleMouseUp(en){"up"===en?this.incrementHold=!1:this.decrementHold=!1}handleKeyDown(en){"ArrowUp"===en.key?this.increment():"ArrowDown"===en.key&&this.decrement()}}function _defineProperty$1(en,tn,nn){return tn in en?Object.defineProperty(en,tn,{value:nn,enumerable:!0,configurable:!0,writable:!0}):en[tn]=nn,en}function _taggedTemplateLiteral(en,tn){return tn||(tn=en.slice(0)),Object.freeze(Object.defineProperties(en,{raw:{value:Object.freeze(tn)}}))}customElements.define("se-zoom",SeZoom);const En={html(en){for(var tn=arguments.length,nn=new Array(tn>1?tn-1:0),rn=1;rn1?nn-1:0),an=1;an{const nn=Object.getOwnPropertyDescriptor(en.prototype,tn);return nn&&"function"==typeof nn.set})).map((en=>function propertyNameToAttribute(en){let tn=Wn[en];if(!tn){const nn=/([A-Z])/g;tn=en.replace(nn,"-$1").toLowerCase(),Wn[en]=tn}return tn}(en))).filter((en=>nn.indexOf(en)<0));return nn.concat(rn)}function booleanAttributeValue(en,tn){return"boolean"==typeof tn?tn:"string"==typeof tn&&(""===tn||en.toLowerCase()===tn.toLowerCase())}const Xn={checked:!0,defer:!0,disabled:!0,hidden:!0,ismap:!0,multiple:!0,noresize:!0,readonly:!0,selected:!0},Yn=Symbol("state"),Zn=Symbol("raiseChangeEventsInNextRender"),Jn=Symbol("changedSinceLastRender");function fieldsChanged(en,tn){const nn={};for(const sn in tn)rn=tn[sn],an=en[sn],(rn instanceof Date&&an instanceof Date?rn.getTime()===an.getTime():rn===an)||(nn[sn]=!0);var rn,an;return nn}const Tr=new Map,Ur=Symbol("shadowIdProxy"),Rr=Symbol("proxyElement"),Qr={get(en,tn){const nn=en[Rr][Gn];return nn&&"string"==typeof tn?nn.getElementById(tn):null}};const Vr=function AttributeMarshallingMixin(en){return class AttributeMarshalling extends en{attributeChangedCallback(en,tn,nn){if(super.attributeChangedCallback&&super.attributeChangedCallback(en,tn,nn),nn!==tn&&!this[qn]){const tn=function attributeToPropertyName(en){let tn=$n[en];if(!tn){const nn=/-([a-z])/g;tn=en.replace(nn,(en=>en[1].toUpperCase())),$n[en]=tn}return tn}(en);if(tn in this){const rn=Xn[en]?booleanAttributeValue(en,nn):nn;this[tn]=rn}}}static get observedAttributes(){return attributesForClass(this)}}}(function ReactiveMixin(en){class Reactive extends en{constructor(){super(),this[Tn]=void 0,this[Mn]=!1,this[Jn]=null,this[Vn](this[Ln])}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this[On]()}get[Ln](){return super[Ln]||{}}[Rn](en){super[Rn]&&super[Rn](en)}[On](){void 0===this[Tn]&&(this[Tn]=!0);const en=this[Jn];if(this[Tn]||en){const tn=this[Mn];this[Mn]=this[Zn],this[Zn]=!1,this[qn]=!0,this[Rn](en),this[qn]=!1,this[Jn]=null,this[Qn](en),this[Tn]=!1,this[Mn]=tn}}[Qn](en){super[Qn]&&super[Qn](en)}async[Vn](en){this[qn]&&console.warn("".concat(this.constructor.name," called [setState] during rendering, which you should avoid.\nSee https://elix.org/documentation/ReactiveMixin."));const{state:tn,changed:nn}=function copyStateWithChanges(en,tn){const nn=Object.assign({},en[Yn]),rn={};let an=tn;for(;;){const tn=fieldsChanged(nn,an);if(0===Object.keys(tn).length)break;Object.assign(nn,an),Object.assign(rn,tn),an=en[zn](nn,tn)}return{state:nn,changed:rn}}(this,en);if(this[Yn]&&0===Object.keys(nn).length)return;Object.freeze(tn),this[Yn]=tn,this[Mn]&&(this[Zn]=!0);const rn=void 0===this[Tn]||null!==this[Jn];this[Jn]=Object.assign(this[Jn]||{},nn);this.isConnected&&!rn&&(await Promise.resolve(),this[On]())}get[Hn](){return this[Yn]}[zn](en,tn){return super[zn]?super[zn](en,tn):{}}}return"true"===new URLSearchParams(location.search).get("elixdebug")&&Object.defineProperty(Reactive.prototype,"state",{get(){return this[Hn]}}),Reactive}(function ShadowTemplateMixin(en){return class ShadowTemplate extends en{get[Nn](){if(!this[Ur]){const en={[Rr]:this};this[Ur]=new Proxy(en,Qr)}return this[Ur]}[Rn](en){if(super[Rn]&&super[Rn](en),void 0===this[Gn]){const en=function getTemplate(en){let tn=en[Un]?void 0:Tr.get(en.constructor);if(void 0===tn){if(tn=en[Kn],tn&&!(tn instanceof HTMLTemplateElement))throw"Warning: the [template] property for ".concat(en.constructor.name," must return an HTMLTemplateElement.");en[Un]||Tr.set(en.constructor,tn||null)}return tn}(this);if(en){const tn=this.attachShadow({delegatesFocus:this[Pn],mode:this[Dn]}),nn=document.importNode(en.content,!0);tn.append(nn),this[Gn]=tn}else this[Gn]=null}}get[Dn](){return"open"}}}(HTMLElement))),Gr=Symbol("checkSize"),Dr=Symbol("closestAvailableItemIndex"),Hr=Symbol("contentSlot"),zr=Ln,Kr=Symbol("defaultTabIndex"),$r=Pn,Wr=Symbol("effectEndTarget"),Xr=Tn,Yr=Fn,Zr=Symbol("getItemText"),Jr=Symbol("goDown"),eo=Symbol("goEnd"),to=Symbol("goFirst"),no=Symbol("goLast"),ro=Symbol("goLeft"),oo=Symbol("goNext"),io=Symbol("goPrevious"),ao=Symbol("goRight"),so=Symbol("goStart"),lo=Symbol("goToItemWithPrefix"),co=Symbol("goUp"),Ao=Un,uo=Nn,po=Symbol("inputDelegate"),ho=Symbol("itemsDelegate"),go=Symbol("keydown"),_o=Symbol("mouseenter"),mo=Symbol("mouseleave"),fo=In,yo=Mn,bo=Rn,vo=On,wo=Symbol("renderDataToElement"),xo=Qn,ko=qn,Co=Symbol("scrollTarget"),So=Vn,Bo=Gn,Eo=Dn,jo=Symbol("startEffect"),Lo=Hn,Po=zn,To=Symbol("swipeDown"),Fo=Symbol("swipeDownComplete"),Uo=Symbol("swipeLeft"),No=Symbol("swipeLeftTransitionEnd"),Io=Symbol("swipeRight"),Mo=Symbol("swipeRightTransitionEnd"),Ro=Symbol("swipeUp"),Oo=Symbol("swipeUpComplete"),Qo=Symbol("swipeStart"),qo=Symbol("swipeTarget"),Vo=Symbol("tap"),Go=Kn,Do=Symbol("toggleSelectedFlag");function DelegateInputLabelMixin(en){return class DelegateInputLabel extends en{get ariaLabel(){return this[Lo].ariaLabel}set ariaLabel(en){this[Lo].removingAriaAttribute||this[So]({ariaLabel:String(en)})}get ariaLabelledby(){return this[Lo].ariaLabelledby}set ariaLabelledby(en){this[Lo].removingAriaAttribute||this[So]({ariaLabelledby:String(en)})}get[zr](){return Object.assign(super[zr]||{},{ariaLabel:null,ariaLabelledby:null,inputLabel:null,removingAriaAttribute:!1})}[bo](en){if(super[bo]&&super[bo](en),this[Xr]&&this.addEventListener("focus",(()=>{this[yo]=!0;const en=refreshInputLabel(this,this[Lo]);this[So]({inputLabel:en}),this[yo]=!1})),en.inputLabel){const{inputLabel:en}=this[Lo];en?this[po].setAttribute("aria-label",en):this[po].removeAttribute("aria-label")}}[xo](en){if(super[xo]&&super[xo](en),this[Xr]){(window.requestIdleCallback||setTimeout)((()=>{const en=refreshInputLabel(this,this[Lo]);this[So]({inputLabel:en})}))}const{ariaLabel:tn,ariaLabelledby:nn}=this[Lo];en.ariaLabel&&!this[Lo].removingAriaAttribute&&this.getAttribute("aria-label")&&(this.setAttribute("delegated-label",tn),this[So]({removingAriaAttribute:!0}),this.removeAttribute("aria-label")),en.ariaLabelledby&&!this[Lo].removingAriaAttribute&&this.getAttribute("aria-labelledby")&&(this.setAttribute("delegated-labelledby",nn),this[So]({removingAriaAttribute:!0}),this.removeAttribute("aria-labelledby")),en.removingAriaAttribute&&this[Lo].removingAriaAttribute&&this[So]({removingAriaAttribute:!1})}[Po](en,tn){const nn=super[Po]?super[Po](en,tn):{};if(tn.ariaLabel&&en.ariaLabel||tn.selectedText&&en.ariaLabelledby&&this.matches(":focus-within")){const tn=refreshInputLabel(this,en);Object.assign(nn,{inputLabel:tn})}return nn}}}function getLabelFromElement(en){if("selectedText"in en)return en.selectedText;if("value"in en&&"options"in en){const tn=en.value,nn=en.options.find((en=>en.value===tn));return nn?nn.innerText:""}return"value"in en?en.value:en.innerText}function refreshInputLabel(en,tn){const{ariaLabel:nn,ariaLabelledby:rn}=tn,an=en.isConnected?en.getRootNode():null;let sn=null;if(rn&&an){const nn=rn.split(" ").map((nn=>{const rn=an.getElementById(nn);return rn?rn===en&&null!==tn.value?tn.selectedText:getLabelFromElement(rn):""}));sn=nn.join(" ")}else if(nn)sn=nn;else if(an){const tn=en.id;if(tn){const en=an.querySelector('[for="'.concat(tn,'"]'));en instanceof HTMLElement&&(sn=getLabelFromElement(en))}if(null===sn){const tn=en.closest("label");tn&&(sn=getLabelFromElement(tn))}}return sn&&(sn=sn.trim()),sn}"true"===new URLSearchParams(location.search).get("elixdebug")&&(window.elix={internal:{checkSize:Gr,closestAvailableItemIndex:Dr,contentSlot:Hr,defaultState:zr,defaultTabIndex:Kr,delegatesFocus:$r,effectEndTarget:Wr,firstRender:Xr,focusTarget:Yr,getItemText:Zr,goDown:Jr,goEnd:eo,goFirst:to,goLast:no,goLeft:ro,goNext:oo,goPrevious:io,goRight:ao,goStart:so,goToItemWithPrefix:lo,goUp:co,hasDynamicTemplate:Ao,ids:uo,inputDelegate:po,itemsDelegate:ho,keydown:go,mouseenter:_o,mouseleave:mo,nativeInternals:fo,event:event,raiseChangeEvents:yo,render:bo,renderChanges:vo,renderDataToElement:wo,rendered:xo,rendering:ko,scrollTarget:Co,setState:So,shadowRoot:Bo,shadowRootMode:Eo,startEffect:jo,state:Lo,stateEffects:Po,swipeDown:To,swipeDownComplete:Fo,swipeLeft:Uo,swipeLeftTransitionEnd:No,swipeRight:Io,swipeRightTransitionEnd:Mo,swipeUp:Ro,swipeUpComplete:Oo,swipeStart:Qo,swipeTarget:qo,tap:Vo,template:Go,toggleSelectedFlag:Do}});const Ho=Symbol("mousedownListener");function closestFocusableNode(en){for(const tn of selfAndComposedAncestors(en)){const en=tn[Fn]||tn,nn=en;if(en instanceof HTMLElement&&en.tabIndex>=0&&!nn.disabled&&!(en instanceof HTMLSlotElement))return en}return null}function deepContains(en,tn){let nn=tn;for(;nn;){const tn=nn.assignedSlot||nn.parentNode||nn.host;if(tn===en)return!0;nn=tn}return!1}function firstFocusableElement(en){const tn=walkComposedTree(en,(en=>en instanceof HTMLElement&&en.matches('a[href],area[href],button:not([disabled]),details,iframe,input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[contentEditable="true"],[tabindex]')&&en.tabIndex>=0)),{value:nn}=tn.next();return nn instanceof HTMLElement?nn:null}function forwardFocus(en,tn){en[Ho]&&en.removeEventListener("mousedown",en[Ho]),tn&&(en[Ho]=en=>{if(0!==en.button)return;const nn=closestFocusableNode(tn[Fn]||tn);nn&&(nn.focus(),en.preventDefault())},en.addEventListener("mousedown",en[Ho]))}function indexOfItemContainingTarget(en,tn){return Array.prototype.findIndex.call(en,(en=>en===tn||deepContains(en,tn)))}function ownEvent(en,tn){const nn=tn.composedPath()[0];return en===nn||deepContains(en,nn)}function*selfAndComposedAncestors(en){en&&(yield en,yield*function*composedAncestors(en){let tn=en;for(;tn=tn instanceof HTMLElement&&tn.assignedSlot?tn.assignedSlot:tn instanceof ShadowRoot?tn.host:tn.parentNode,tn;)yield tn}(en))}function setInternalState(en,tn,nn){if(en.toggleAttribute(tn,nn),en[In]&&en[In].states){const rn=en[In].states,an="--".concat(tn);nn?rn.add(an):rn.delete(an)}}function*walkComposedTree(en,tn){let nn;if(tn(en)&&(yield en),en instanceof HTMLElement&&en.shadowRoot)nn=en.shadowRoot.children;else{const tn=en instanceof HTMLSlotElement?en.assignedNodes({flatten:!0}):[];nn=tn.length>0?tn:en.childNodes}if(nn)for(let en=0;en{Promise.resolve().then((()=>{const tn=en.relatedTarget||document.activeElement,nn=this===tn,rn=deepContains(this,tn);!nn&&!rn&&(this[So]({focusVisible:!1}),document.removeEventListener("focusvisiblechange",this[Wo]),this[Wo]=null)}))})),this.addEventListener("focusin",(()=>{Promise.resolve().then((()=>{this[Lo].focusVisible!==$o&&this[So]({focusVisible:$o}),this[Wo]||(this[Wo]=()=>function refreshFocus(en){en[So]({focusVisible:$o})}(this),document.addEventListener("focusvisiblechange",this[Wo]))}))}))}get[zr](){return Object.assign(super[zr]||{},{focusVisible:!1})}[bo](en){if(super[bo]&&super[bo](en),en.focusVisible){const{focusVisible:en}=this[Lo];this.toggleAttribute("focus-visible",en)}}get[Go](){const en=super[Go]||jn.html(zo||(zo=_taggedTemplateLiteral([""])));return en.content.append(En.html(Ko||(Ko=_taggedTemplateLiteral(["\n \n "])))),en}}}function updateKeyboardActive(en){if($o!==en){$o=en;const tn=new CustomEvent("focusvisiblechange",{detail:{focusVisible:$o}});document.dispatchEvent(tn)}}function FormElementMixin(en){return class FormElement extends en{constructor(){super();const en=this;!this[fo]&&en.attachInternals&&(this[fo]=en.attachInternals())}checkValidity(){return this[fo].checkValidity()}get[zr](){return Object.assign(super[zr]||{},{name:"",validationMessage:"",valid:!0})}get internals(){return this[fo]}static get formAssociated(){return!0}get form(){return this[fo].form}get name(){return this[Lo]?this[Lo].name:""}set name(tn){const nn=String(tn);"name"in en.prototype&&(super.name=nn),this[So]({name:nn})}[bo](en){if(super[bo]&&super[bo](en),en.name){const{name:en}=this[Lo];en?this.setAttribute("name",en):this.removeAttribute("name")}if(this[fo]&&this[fo].setValidity&&(en.valid||en.validationMessage)){const{valid:en,validationMessage:tn}=this[Lo];en?this[fo].setValidity({}):this[fo].setValidity({customError:!0},tn)}}[xo](en){super[xo]&&super[xo](en),en.value&&this[fo]&&this[fo].setFormValue&&this[fo].setFormValue(this[Lo].value,this[Lo])}reportValidity(){return this[fo].reportValidity()}get type(){return super.type||this.localName}get validationMessage(){return this[Lo].validationMessage}get validity(){return this[fo].validity}get willValidate(){return this[fo].willValidate}}}function refreshSelectionState(en){const tn=en.inner,{selectionEnd:nn,selectionStart:rn}=tn;en[So]({selectionEnd:nn,selectionStart:rn})}function DelegateFocusMixin(en){return class DelegateFocus extends en{get[$r](){return!0}focus(en){const tn=this[Yr];tn&&tn.focus(en)}get[Yr](){return firstFocusableElement(this[Bo])}}}var Xo;window.addEventListener("keydown",(()=>{updateKeyboardActive(!0)}),{capture:!0}),window.addEventListener("mousedown",(()=>{updateKeyboardActive(!1)}),{capture:!0});const Yo=Symbol("extends"),Zo=Symbol("delegatedPropertySetters"),Jo={a:!0,area:!0,button:!0,details:!0,iframe:!0,input:!0,select:!0,textarea:!0},ei={address:["scroll"],blockquote:["scroll"],caption:["scroll"],center:["scroll"],dd:["scroll"],dir:["scroll"],div:["scroll"],dl:["scroll"],dt:["scroll"],fieldset:["scroll"],form:["reset","scroll"],frame:["load"],h1:["scroll"],h2:["scroll"],h3:["scroll"],h4:["scroll"],h5:["scroll"],h6:["scroll"],iframe:["load"],img:["abort","error","load"],input:["abort","change","error","select","load"],li:["scroll"],link:["load"],menu:["scroll"],object:["error","scroll"],ol:["scroll"],p:["scroll"],script:["error","load"],select:["change","scroll"],tbody:["scroll"],tfoot:["scroll"],thead:["scroll"],textarea:["change","select","scroll"]},ti=["click","dblclick","mousedown","mouseenter","mouseleave","mousemove","mouseout","mouseover","mouseup","wheel"],ni={abort:!0,change:!0,reset:!0},ri=["address","article","aside","blockquote","canvas","dd","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","li","main","nav","noscript","ol","output","p","pre","section","table","tfoot","ul","video"],oi=["accept-charset","autoplay","buffered","challenge","codebase","colspan","contenteditable","controls","crossorigin","datetime","dirname","for","formaction","http-equiv","icon","ismap","itemprop","keytype","language","loop","manifest","maxlength","minlength","muted","novalidate","preload","radiogroup","readonly","referrerpolicy","rowspan","scoped","usemap"],ii=DelegateFocusMixin(Vr);class WrappedStandardElement extends ii{constructor(){super();const en=this;!this[fo]&&en.attachInternals&&(this[fo]=en.attachInternals())}attributeChangedCallback(en,tn,nn){if(oi.indexOf(en)>=0){const tn=Object.assign({},this[Lo].innerAttributes,{[en]:nn});this[So]({innerAttributes:tn})}else super.attributeChangedCallback(en,tn,nn)}blur(){this.inner.blur()}get[zr](){return Object.assign(super[zr],{innerAttributes:{}})}get[Kr](){return Jo[this.extends]?0:-1}get extends(){return this.constructor[Yo]}get inner(){const en=this[uo]&&this[uo].inner;return en||console.warn("Attempted to get an inner standard element before it was instantiated."),en}static get observedAttributes(){return[...super.observedAttributes,...oi]}[bo](en){super[bo](en);const tn=this.inner;if(this[Xr]){(ei[this.extends]||[]).forEach((en=>{tn.addEventListener(en,(()=>{const tn=new Event(en,{bubbles:ni[en]||!1});this.dispatchEvent(tn)}))})),"disabled"in tn&&ti.forEach((en=>{this.addEventListener(en,(en=>{tn.disabled&&en.stopImmediatePropagation()}))}))}if(en.tabIndex&&(tn.tabIndex=this[Lo].tabIndex),en.innerAttributes){const{innerAttributes:en}=this[Lo];for(const nn in en)applyAttribute(tn,nn,en[nn])}this.constructor[Zo].forEach((nn=>{if(en[nn]){const en=this[Lo][nn];("selectionEnd"===nn||"selectionStart"===nn)&&null===en||(tn[nn]=en)}}))}[xo](en){if(super[xo](en),en.disabled){const{disabled:en}=this[Lo];void 0!==en&&setInternalState(this,"disabled",en)}}get[Go](){const en=ri.includes(this.extends)?"block":"inline-block",tn=this.extends;return jn.html(Xo||(Xo=_taggedTemplateLiteral(["\n \n <',' id="inner" part="inner ','">\n \n \n "])),en,tn,tn,tn)}static wrap(en){class Wrapped extends WrappedStandardElement{}Wrapped[Yo]=en;const tn=document.createElement(en);return function defineDelegates(en,tn){const nn=Object.getOwnPropertyNames(tn);en[Zo]=[],nn.forEach((nn=>{const rn=Object.getOwnPropertyDescriptor(tn,nn);if(!rn)return;const an=function createDelegate(en,tn){if("function"==typeof tn.value){if("constructor"!==en)return function createMethodDelegate(en,tn){const value=function(){this.inner[en](...arguments)};return{configurable:tn.configurable,enumerable:tn.enumerable,value:value,writable:tn.writable}}(en,tn)}else if("function"==typeof tn.get||"function"==typeof tn.set)return function createPropertyDelegate(en,tn){const nn={configurable:tn.configurable,enumerable:tn.enumerable};tn.get&&(nn.get=function(){return function getInnerProperty(en,tn){return en[Lo][tn]||en[Bo]&&en.inner[tn]}(this,en)});tn.set&&(nn.set=function(tn){!function setInnerProperty(en,tn,nn){en[Lo][tn]!==nn&&en[So]({[tn]:nn})}(this,en,tn)});tn.writable&&(nn.writable=tn.writable);return nn}(en,tn);return null}(nn,rn);an&&(Object.defineProperty(en.prototype,nn,an),an.set&&en[Zo].push(nn))}))}(Wrapped,Object.getPrototypeOf(tn)),Wrapped}}function applyAttribute(en,tn,nn){Xn[tn]?"string"==typeof nn?en.setAttribute(tn,""):null===nn&&en.removeAttribute(tn):null!=nn?en.setAttribute(tn,nn.toString()):en.removeAttribute(tn)}var ai;const si=DelegateInputLabelMixin(FocusVisibleMixin(FormElementMixin(function TrackTextSelectionMixin(en){return class TrackTextSelection extends en{get[zr](){return Object.assign(super[zr]||{},{selectionEnd:0,selectionStart:0})}[bo](en){if(super[bo]&&super[bo](en),this[Xr]){const en=(()=>{setTimeout((()=>{this[yo]=!0,refreshSelectionState(this),this[yo]=!1}),10)}).bind(this);this.addEventListener("keydown",en),this.addEventListener("mousedown",en),this.addEventListener("touchend",en)}}[xo](en){super[xo](en),en.value&&refreshSelectionState(this)}}}(WrappedStandardElement.wrap("input")))));class Input extends si{get[zr](){return Object.assign(super[zr],{value:""})}get[po](){return this.inner}[bo](en){super[bo](en),this[Xr]&&this[uo].inner.addEventListener("input",(()=>{this[yo]=!0;const en=this[uo].inner;this[So]({value:en.value}),this[yo]=!1}))}get[Go](){const en=super[Go];return en.content.append(En.html(ai||(ai=_taggedTemplateLiteral(['\n \n '])))),en}get value(){return this[Lo].value}set value(en){this[So]({value:String(en)})}}var li;class PlainInput extends(function PlainInputMixin(en){return class PlainInput extends en{get[Go](){const en=super[Go];return en.content.append(En.html(li||(li=_taggedTemplateLiteral(['\n \n '])))),en}}}(Input)){}customElements.define("elix-input",class ElixInput extends PlainInput{});const ci=document.createElement("template");ci.innerHTML='\n \n
\n icon\n label\n \n
\n';class SEInput extends HTMLElement{constructor(){super(),this._shadowRoot=this.attachShadow({mode:"open"}),this._shadowRoot.append(ci.content.cloneNode(!0)),this.$div=this._shadowRoot.querySelector("div"),this.$img=this._shadowRoot.querySelector("img"),this.$label=this.shadowRoot.getElementById("label"),this.$event=new CustomEvent("change"),this.$input=this._shadowRoot.querySelector("elix-input")}static get observedAttributes(){return["value","label","src","size","title"]}attributeChangedCallback(en,tn,nn){if(tn!==nn)switch(en){case"title":this.$div.setAttribute("title","".concat(t$1(nn)));break;case"src":this.$img.setAttribute("src",nn),this.$label.remove();break;case"size":this.$input.setAttribute("size",nn);break;case"label":this.$label.textContent=t$1(nn),this.$img.remove();break;case"value":this.$input.value=nn;break;default:console.error("unknown attribute: ".concat(en))}}get title(){return this.getAttribute("title")}set title(en){this.setAttribute("title",en)}get label(){return this.getAttribute("label")}set label(en){this.setAttribute("label",en)}get value(){return this.$input.value}set value(en){this.$input.value=en}get src(){return this.getAttribute("src")}set src(en){this.setAttribute("src",en)}get size(){return this.getAttribute("size")}set size(en){this.setAttribute("size",en)}connectedCallback(){this.$input.addEventListener("change",(en=>{en.preventDefault(),this.value=en.target.value,this.dispatchEvent(this.$event)})),this.$input.addEventListener("keyup",(en=>{en.preventDefault(),this.value=en.target.value,this.dispatchEvent(this.$event)}))}}customElements.define("se-input",SEInput);const Ai=document.createElement("div");Ai.attachShadow({mode:"open",delegatesFocus:!0});const di=Ai.shadowRoot.delegatesFocus;var ui;const pi=function ComposedFocusMixin(en){return class ComposedFocus extends en{get[zr](){return Object.assign(super[zr]||{},{composeFocus:!di})}[bo](en){super[bo]&&super[bo](en),this[Xr]&&this.addEventListener("mousedown",(en=>{if(this[Lo].composeFocus&&0===en.button&&en.target instanceof Element){const tn=closestFocusableNode(en.target);tn&&(tn.focus(),en.preventDefault())}}))}}}(DelegateInputLabelMixin(FocusVisibleMixin(WrappedStandardElement.wrap("button"))));class Button extends pi{get[zr](){return Object.assign(super[zr],{role:"button"})}get[po](){return this[uo].inner}[Vo](){const en=new MouseEvent("click",{bubbles:!0,cancelable:!0});this.dispatchEvent(en)}get[Go](){const en=super[Go];return en.content.append(En.html(ui||(ui=_taggedTemplateLiteral(['\n \n '])))),en}}class SyntheticMouseEvent extends MouseEvent{}function clearRepeat(en){en[Lo].repeatTimeout&&clearTimeout(en[Lo].repeatTimeout),en[Lo].repeatInterval&&clearInterval(en[Lo].repeatInterval)}function repeatStart(en){const{repeatIntervalDuration:tn,repeatDelayDuration:nn}=en[Lo],rn=setTimeout((()=>{const nn=setInterval((()=>{!function raiseMousedown(en){const tn=new SyntheticMouseEvent("mousedown",{bubbles:!0,button:0,cancelable:!0,clientX:0,clientY:0});en.dispatchEvent(tn)}(en)}),tn);en[So]({repeatInterval:nn})}),nn-tn);en[So]({repeatTimeout:rn})}function repeatStop(en){clearRepeat(en),en[So]({repeatTimeout:null,repeatInterval:null})}class RepeatButton extends(function RepeatMousedownMixin(en){return class RepeatMousedown extends en{get[zr](){return Object.assign(super[zr]||{},{repeatDelayDuration:500,repeatInterval:null,repeatIntervalDuration:50,repeatTimeout:null})}[bo](en){super[bo]&&super[bo](en),this[Xr]&&(this.addEventListener("mousedown",(en=>{en instanceof SyntheticMouseEvent||0!==en.button||(this[yo]=!0,repeatStart(this),this[yo]=!1)})),this.addEventListener("mouseup",(en=>{0===en.button&&(this[yo]=!0,repeatStop(this),this[yo]=!1)})),this.addEventListener("mouseleave",(en=>{0===en.button&&(this[yo]=!0,repeatStop(this),this[yo]=!1)})),this.addEventListener("touchstart",(()=>{this[yo]=!0,repeatStart(this),this[yo]=!1})),this.addEventListener("touchend",(()=>{this[yo]=!0,repeatStop(this),this[yo]=!1})))}[Po](en,tn){const nn=super[Po]?super[Po](en,tn):{};return tn.disabled&&en.disabled&&(clearRepeat(this),Object.assign(nn,{repeatInterval:null,repeatTimeout:null})),nn}}}(Button)){}var hi,gi;function PlainButtonMixin(en){return class PlainButton extends en{get[Go](){const en=super[Go];return en.content.append(En.html(hi||(hi=_taggedTemplateLiteral(['\n \n '])))),en}}}class PlainRepeatButton extends(PlainButtonMixin(RepeatButton)){}const _i=new Map;function createElement(en){if("function"==typeof en){let tn;try{tn=new en}catch(nn){if("TypeError"!==nn.name)throw nn;!function registerCustomElement(en){let tn;const nn=/^[A-Za-z][A-Za-z0-9_$]*$/,rn=en.name&&en.name.match(nn);if(rn){const en=/([A-Z])/g;tn=rn[0].replace(en,((en,tn,nn)=>nn>0?"-".concat(tn):tn)).toLowerCase()}else tn="custom-element";let an,sn=_i.get(tn)||0;for(;an="".concat(tn,"-").concat(sn),customElements.get(an);sn++);customElements.define(an,en),_i.set(tn,sn+1)}(en),tn=new en}return tn}return document.createElement(en)}function replace(en,tn){const nn=en.parentNode;if(!nn)throw"An element must have a parent before it can be substituted.";return(en instanceof HTMLElement||en instanceof SVGElement)&&(tn instanceof HTMLElement||tn instanceof SVGElement)&&(Array.prototype.forEach.call(en.attributes,(en=>{tn.getAttribute(en.name)||"class"===en.name||"style"===en.name||tn.setAttribute(en.name,en.value)})),Array.prototype.forEach.call(en.classList,(en=>{tn.classList.add(en)})),Array.prototype.forEach.call(en.style,(nn=>{tn.style[nn]||(tn.style[nn]=en.style[nn])}))),tn.append(...en.childNodes),nn.replaceChild(tn,en),tn}function transmute(en,tn){if("function"==typeof tn&&en.constructor===tn||"string"==typeof tn&&en instanceof Element&&en.localName===tn)return en;{const nn=createElement(tn);return replace(en,nn),nn}}function DisabledMixin(en){return class Disabled extends en{get[zr](){return Object.assign(super[zr]||{},{disabled:!1})}get disabled(){return this[Lo].disabled}set disabled(en){this[So]({disabled:en})}[xo](en){if(super[xo]&&super[xo](en),en.disabled&&(this.toggleAttribute("disabled",this.disabled),this[yo])){const en=new CustomEvent("disabledchange",{bubbles:!0});this.dispatchEvent(en)}}}}function KeyboardDirectionMixin(en){return class KeyboardDirection extends en{get[zr](){return Object.assign(super[zr],{handleBubblingDirectionKeys:!1})}[Jr](){if(super[Jr])return super[Jr]()}[eo](){if(super[eo])return super[eo]()}[ro](){if(super[ro])return super[ro]()}[ao](){if(super[ao])return super[ao]()}[so](){if(super[so])return super[so]()}[co](){if(super[co])return super[co]()}[go](en){let tn=!1;if(this[Lo].handleBubblingDirectionKeys||en.target===this){const nn=this[Lo].orientation||"both",rn="horizontal"===nn||"both"===nn,an="vertical"===nn||"both"===nn;switch(en.key){case"ArrowDown":an&&(tn=en.altKey?this[eo]():this[Jr]());break;case"ArrowLeft":!rn||en.metaKey||en.altKey||(tn=this[ro]());break;case"ArrowRight":!rn||en.metaKey||en.altKey||(tn=this[ao]());break;case"ArrowUp":an&&(tn=en.altKey?this[so]():this[co]());break;case"End":tn=this[eo]();break;case"Home":tn=this[so]()}}return tn||super[go]&&super[go](en)||!1}}}function KeyboardMixin(en){return class Keyboard extends en{constructor(){super(),this.addEventListener("keydown",(async en=>{this[yo]=!0,this[Lo].focusVisible||this[So]({focusVisible:!0});this[go](en)&&(en.preventDefault(),en.stopImmediatePropagation()),await Promise.resolve(),this[yo]=!1}))}attributeChangedCallback(en,tn,nn){if("tabindex"===en){let en;null===nn?en=-1:(en=Number(nn),isNaN(en)&&(en=this[Kr]?this[Kr]:0)),this.tabIndex=en}else super.attributeChangedCallback(en,tn,nn)}get[zr](){const en=this[$r]?-1:0;return Object.assign(super[zr]||{},{tabIndex:en})}[go](en){return!!super[go]&&super[go](en)}[bo](en){super[bo]&&super[bo](en),en.tabIndex&&(this.tabIndex=this[Lo].tabIndex)}get tabIndex(){return super.tabIndex}set tabIndex(en){super.tabIndex!==en&&(super.tabIndex=en),this[ko]||this[So]({tabIndex:en})}}}var mi;const fi=DelegateFocusMixin(DelegateInputLabelMixin(function DelegateInputSelectionMixin(en){return class DelegateInputSelection extends en{select(){this[po].select()}get selectionEnd(){return this[po].selectionEnd}set selectionEnd(en){this[po].selectionEnd=en}get selectionStart(){return this[po].selectionStart}set selectionStart(en){this[po].selectionStart=en}setRangeText(){this[po].setRangeText(...arguments)}setSelectionRange(){this[po].setSelectionRange(...arguments);document.createElement("input").select}}}(DisabledMixin(FocusVisibleMixin(FormElementMixin(KeyboardDirectionMixin(KeyboardMixin(Vr))))))));class SpinBox extends fi{get[zr](){return Object.assign(super[zr],{buttonPartType:"button",canGoDown:!0,canGoUp:!0,inputPartType:"input",orientation:"vertical",step:1,stepSelect:!1,value:""})}[Jr](){return super[Jr]&&super[Jr](),this.stepDown(),!0}[co](){return super[co]&&super[co](),this.stepUp(),!0}get[po](){return this[uo].input}[bo](en){if(super[bo](en),function renderParts$4(en,tn,nn){if(!nn||nn.inputPartType){const{buttonPartType:nn}=tn;en.querySelectorAll('[part~="spin-button"]').forEach((en=>{transmute(en,nn)}))}if(!nn||nn.inputPartType){const{inputPartType:nn}=tn,rn=en.getElementById("input");rn&&transmute(rn,nn)}}(this[Bo],this[Lo],en),en.buttonPartType&&(this[uo].downButton.addEventListener("mousedown",(()=>{this[yo]=!0,this.stepDown(),this[yo]=!1})),this[uo].upButton.addEventListener("mousedown",(()=>{this[yo]=!0,this.stepUp(),this[yo]=!1}))),en.inputPartType&&this[uo].input.addEventListener("input",(()=>{this[yo]=!0,this.value=this[uo].input.value,this[yo]=!1})),en.buttonPartType||en.inputPartType){const en=this[uo].input,tn=this[uo].downButton;tn instanceof HTMLElement&&en instanceof HTMLElement&&forwardFocus(tn,en);const nn=this[uo].upButton;nn instanceof HTMLElement&&en instanceof HTMLElement&&forwardFocus(nn,en)}const{disabled:tn,value:nn}=this[Lo];if(en.canGoUp||en.canGoDown||en.disabled){const{canGoUp:en,canGoDown:nn}=this[Lo];if("disabled"in this[uo].input&&(this[uo].input.disabled=tn),"disabled"in this[uo].downButton){const nn=tn||!en;this[uo].upButton.disabled=nn}if("disabled"in this[uo].upButton){const en=tn||!nn;this[uo].downButton.disabled=en}}en.value&&(this[uo].input.value=nn)}[xo](en){super[xo](en);const{stepSelect:tn,value:nn}=this[Lo];if(en.value&&tn){const en=this[uo].input,tn=nn.length;en.selectionStart=tn,en.selectionEnd=tn,this[So]({stepSelect:!1})}if(en.value&&this[yo]){const en=new CustomEvent("change",{bubbles:!0,detail:{value:nn}});this.dispatchEvent(en)}}stepDown(){this[So]({stepSelect:!0})}stepUp(){this[So]({stepSelect:!0})}get[Go](){const en=super[Go];return en.content.append(En.html(mi||(mi=_taggedTemplateLiteral(['\n \n
\n
\n
\n '])))),en}get value(){return this[Lo].value}set value(en){this[So]({value:String(en)})}}class NumberSpinBox extends SpinBox{attributeChangedCallback(en,tn,nn){"max"===en?this.max=parseFloat(nn):"min"===en?this.min=parseFloat(nn):"step"===en?this.step=parseFloat(nn):super.attributeChangedCallback(en,tn,nn)}get[zr](){return Object.assign(super[zr],{max:null,min:null,step:1})}formatValue(en,tn){return Number(en).toFixed(tn)}get max(){return this[Lo].max}set max(en){this[So]({max:en})}get min(){return this[Lo].min}set min(en){this[So]({min:en})}parseValue(en,tn){const nn=0===tn?parseInt(en):parseFloat(en);return isNaN(nn)?0:nn}[Po](en,tn){const nn=super[Po];if(tn.step){const{step:tn}=en,rn=/\.(\d)+$/.exec(String(tn)),an=rn&&rn[1]?rn[1].length:0;Object.assign(nn,{precision:an})}if(tn.max||tn.min||tn.value){const{max:tn,min:rn,precision:an,value:sn}=en,cn=parseInt(sn,an);""!==sn&&isNaN(cn)?Object.assign(nn,{valid:!1,validationMessage:"Value must be a number"}):null===tn||cn<=tn?null===rn||cn>=rn?Object.assign(nn,{valid:!0,validationMessage:""}):Object.assign(nn,{valid:!1,validationMessage:"Value must be greater than or equal to ".concat(rn,".")}):Object.assign(nn,{valid:!1,validationMessage:"Value must be less than or equal to ".concat(tn,".")}),Object.assign(nn,{canGoUp:isNaN(cn)||null===en.max||cn<=en.max}),Object.assign(nn,{canGoDown:isNaN(cn)||null===en.min||cn>=en.min})}return nn}get step(){return this[Lo].step}set step(en){isNaN(en)||this[So]({step:en})}stepDown(){super.stepDown();const{max:en,precision:tn,value:nn}=this[Lo];let rn=this.parseValue(nn,tn)-this.step;null!==en&&(rn=Math.min(rn,en));const{min:an}=this[Lo];(null===an||rn>=an)&&(this.value=this.formatValue(rn,tn))}stepUp(){super.stepUp();const{min:en,precision:tn,value:nn}=this[Lo];let rn=this.parseValue(nn,tn)+this.step;null!==en&&(rn=Math.max(rn,en));const{max:an}=this[Lo];(null===an||rn<=an)&&(this.value=this.formatValue(rn,tn))}}class PlainNumberSpinBox extends(function PlainSpinBoxMixin(en){return class PlainSpinBox extends en{get[zr](){return Object.assign(super[zr]||{},{buttonPartType:PlainRepeatButton,inputPartType:PlainInput})}get[Go](){const en=super[Go];en.content.getElementById("upButton").textContent="▲";return en.content.getElementById("downButton").textContent="▼",en.content.append(En.html(gi||(gi=_taggedTemplateLiteral(['\n \n '])))),en}}}(NumberSpinBox)){}customElements.define("elix-number-spin-box",class ElixNumberSpinBox extends PlainNumberSpinBox{});const yi=document.createElement("template");yi.innerHTML='\n \n
\n icon\n label\n \n
\n';class SESpinInput extends HTMLElement{constructor(){super(),this._shadowRoot=this.attachShadow({mode:"open"}),this._shadowRoot.append(yi.content.cloneNode(!0)),this.$div=this._shadowRoot.querySelector("div"),this.$img=this._shadowRoot.querySelector("img"),this.$label=this.shadowRoot.getElementById("label"),this.$event=new CustomEvent("change"),this.$input=this._shadowRoot.querySelector("elix-number-spin-box"),this.imgPath=svgEditor.configObj.curConfig.imgPath}static get observedAttributes(){return["value","label","src","size","min","max","step","title"]}attributeChangedCallback(en,tn,nn){if(tn!==nn)switch(en){case"title":{const en=this.getAttribute("shortcut");this.$div.setAttribute("title","".concat(t$1(nn)," ").concat(en?"[".concat(t$1(en),"]"):""))}break;case"src":this.$img.setAttribute("src",this.imgPath+"/"+nn),this.$label.remove(),this.$div.classList.add("imginside");break;case"size":this.$input.shadowRoot.getElementById("input").size=nn,this.$input.shadowRoot.getElementById("input").style.width="unset";break;case"step":this.$input.setAttribute("step",nn);break;case"min":this.$input.setAttribute("min",nn);break;case"max":this.$input.setAttribute("max",nn);break;case"label":this.$label.textContent=t$1(nn),this.$img.remove();break;case"value":this.$input.value=nn;break;default:console.error("unknown attribute: ".concat(en))}}get title(){return this.getAttribute("title")}set title(en){this.setAttribute("title",en)}get label(){return this.getAttribute("label")}set label(en){this.setAttribute("label",en)}get value(){return this.$input.value}set value(en){this.$input.value=en}get src(){return this.getAttribute("src")}set src(en){this.setAttribute("src",en)}get size(){return this.getAttribute("size")}set size(en){this.setAttribute("size",en)}connectedCallback(){const en=this.$input.shadowRoot;Array.from(en.childNodes).forEach((en=>{"input"===(null==en?void 0:en.id)&&en.addEventListener("keyup",(en=>{en.preventDefault(),isNaN(en.target.value)||(this.value=en.target.value,this.dispatchEvent(this.$event))}))})),this.$input.addEventListener("change",(en=>{en.preventDefault(),this.value=en.target.value,this.dispatchEvent(this.$event)})),svgEditor.$click(this.$input,(en=>{en.preventDefault(),this.value=en.target.value,this.dispatchEvent(this.$event)}))}}customElements.define("se-spin-input",SESpinInput);const bi=["none","#000000","#3f3f3f","#7f7f7f","#bfbfbf","#ffffff","#ff0000","#ff7f00","#ffff00","#7fff00","#00ff00","#00ff7f","#00ffff","#007fff","#0000ff","#7f00ff","#ff00ff","#ff007f","#7f0000","#7f3f00","#7f7f00","#3f7f00","#007f00","#007f3f","#007f7f","#003f7f","#00007f","#3f007f","#7f007f","#7f003f","#ffaaaa","#ffd4aa","#ffffaa","#d4ffaa","#aaffaa","#aaffd4","#aaffff","#aad4ff","#aaaaff","#d4aaff","#ffaaff","#ffaad4"],vi=document.createElement("template");vi.innerHTML='\n \n
\n
\n
\n
\n';class SEPalette extends HTMLElement{constructor(){super(),this._shadowRoot=this.attachShadow({mode:"open"}),this._shadowRoot.append(vi.content.cloneNode(!0)),this.$strip=this._shadowRoot.querySelector("#js-se-palette"),bi.forEach((en=>{const tn=document.createElement("div");if(tn.classList.add("square"),"none"===en){const en=document.createElement("img");en.src="data:image/svg+xml;charset=utf-8;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjQgMjQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgY2xhc3M9InN2Z19pY29uIj48c3ZnIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+CiAgICA8bGluZSBmaWxsPSJub25lIiBzdHJva2U9IiNkNDAwMDAiIGlkPSJzdmdfOTAiIHkyPSIyNCIgeDI9IjI0IiB5MT0iMCIgeDE9IjAiLz4KICAgIDxsaW5lIGlkPSJzdmdfOTIiIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2Q0MDAwMCIgeTI9IjI0IiB4Mj0iMCIgeTE9IjAiIHgxPSIyNCIvPgogIDwvc3ZnPjwvc3ZnPg==",en.style.width="15px",en.style.height="15px",tn.append(en)}else tn.style.backgroundColor=en;tn.dataset.rgb=en,svgEditor.$click(tn,(en=>{en.preventDefault();const nn=en.shiftKey||2===en.button?"stroke":"fill";let rn=tn.dataset.rgb;"none"!==rn&&"transparent"!==rn&&"initial"!==rn||(rn="none");const an=new CustomEvent("change",{detail:{picker:nn,color:rn},bubbles:!1});this.dispatchEvent(an)})),this.$strip.append(tn)}))}init(en){this.setAttribute("ui-palette_info",en.t("ui.palette_info"))}static get observedAttributes(){return["ui-palette_info"]}attributeChangedCallback(en,tn,nn){let rn;"ui-palette_info"===en&&(rn=this._shadowRoot.querySelector("#palette_holder"),rn.setAttribute("title",nn))}connectedCallback(){}}customElements.define("se-palette",SEPalette);class MenuItem extends(function CurrentMixin(en){return class Current extends en{constructor(){super();const en=this;!this[fo]&&en.attachInternals&&(this[fo]=en.attachInternals())}attributeChangedCallback(en,tn,nn){if("current"===en){const tn=booleanAttributeValue(en,nn);this.current!==tn&&(this.current=tn)}else super.attributeChangedCallback(en,tn,nn)}get[zr](){return Object.assign(super[zr]||{},{current:!1})}[bo](en){if(super[bo](en),en.current){const{current:en}=this[Lo];setInternalState(this,"current",en)}}[xo](en){if(super[xo]&&super[xo](en),en.current){const{current:en}=this[Lo],tn=new CustomEvent("currentchange",{bubbles:!0,detail:{current:en}});this.dispatchEvent(tn)}}get current(){return this[Lo].current}set current(en){this[So]({current:en})}}}(DisabledMixin(function SelectableMixin(en){return class Selectable extends en{constructor(){super();const en=this;!this[fo]&&en.attachInternals&&(this[fo]=en.attachInternals())}get[zr](){return Object.assign(super[zr]||{},{selected:!1})}[bo](en){if(super[bo](en),en.selected){const{selected:en}=this[Lo];setInternalState(this,"selected",en)}}[xo](en){if(super[xo]&&super[xo](en),en.selected){const{selected:en}=this[Lo],tn=new CustomEvent("selectedchange",{bubbles:!0,detail:{selected:en}});this.dispatchEvent(tn)}}get selected(){return this[Lo].selected}set selected(en){this[So]({selected:en})}}}(Vr)))){}var wi;class PlainMenuItem extends MenuItem{get[Go](){return jn.html(wi||(wi=_taggedTemplateLiteral(['\n \n \n \n \n \n \n '])))}}customElements.define("elix-menu-item",class ElixMenuItem extends PlainMenuItem{});const xi={a:"link",article:"region",button:"button",h1:"sectionhead",h2:"sectionhead",h3:"sectionhead",h4:"sectionhead",h5:"sectionhead",h6:"sectionhead",hr:"sectionhead",iframe:"region",link:"link",menu:"menu",ol:"list",option:"option",output:"liveregion",progress:"progressbar",select:"select",table:"table",td:"td",textarea:"textbox",th:"th",ul:"list"};function defaultScrollTarget(en){const tn=en[Bo],nn=tn&&tn.querySelector("slot:not([name])");return nn&&nn.parentNode instanceof Element&&function getScrollableElement(en){for(const tn of selfAndComposedAncestors(en))if(tn instanceof HTMLElement&&isElementScrollable(tn))return tn;return null}(nn.parentNode)||en}function isElementScrollable(en){const tn=getComputedStyle(en),nn=tn.overflowX,rn=tn.overflowY;return"scroll"===nn||"auto"===nn||"scroll"===rn||"auto"===rn}function moveToIndex(en,tn,nn){const rn=en[Dr](en[Lo],{direction:nn,index:tn});if(rn<0)return!1;const an=en[Lo].currentIndex!==rn;return an&&en[So]({currentIndex:rn}),an}const ki=["applet","basefont","embed","font","frame","frameset","isindex","keygen","link","multicol","nextid","noscript","object","param","script","style","template","noembed"];function getIndexOfItemAtY(en,tn,nn){const rn=en[Lo].items,an=nn?0:rn.length-1,sn=nn?rn.length:0,cn=nn?1:-1;let An,dn,un=null;const{availableItemFlags:pn}=en[Lo];for(An=an;An!==sn;An+=cn){if((!pn||pn[An])&&(dn=rn[An].getBoundingClientRect(),dn.top<=tn&&tn<=dn.bottom)){un=rn[An];break}}if(!un||!dn)return null;const hn=getComputedStyle(un),gn=hn.paddingTop?parseFloat(hn.paddingTop):0,_n=hn.paddingBottom?parseFloat(hn.paddingBottom):0,mn=dn.top+gn,fn=mn+un.clientHeight-gn-_n;return nn&&mn<=tn||!nn&&fn>=tn?An:An-cn}function scrollOnePage(en,tn){const nn=en[Lo].items,rn=en[Lo].currentIndex,an=en[Co].getBoundingClientRect(),sn=getIndexOfItemAtY(en,tn?an.bottom:an.top,tn);let cn;if(sn&&rn===sn){const an=nn[rn].getBoundingClientRect(),sn=en[Co].clientHeight;cn=getIndexOfItemAtY(en,tn?an.bottom+sn:an.top-sn,tn)}else cn=sn;if(!cn){const rn=tn?nn.length-1:0;cn=en[Dr]?en[Dr](en[Lo],{direction:tn?-1:1,index:rn}):rn}const An=cn!==rn;if(An){const tn=en[yo];en[yo]=!0,en[So]({currentIndex:cn}),en[yo]=tn}return An}const Ci=Symbol("typedPrefix"),Si=Symbol("prefixTimeout");function resetPrefixTimeout(en){const tn=en;tn[Si]&&(clearTimeout(tn[Si]),tn[Si]=!1)}function resetTypedPrefix(en){en[Ci]="",resetPrefixTimeout(en)}function setPrefixTimeout(en){resetPrefixTimeout(en),en[Si]=setTimeout((()=>{resetTypedPrefix(en)}),1e3)}function LanguageDirectionMixin(en){return class LanguageDirection extends en{connectedCallback(){const en="rtl"===getComputedStyle(this).direction;this[So]({rightToLeft:en}),super.connectedCallback()}}}function ContentItemsMixin(en){return class ContentItems extends en{get[zr](){return Object.assign(super[zr]||{},{items:null})}[Po](en,tn){const nn=super[Po]?super[Po](en,tn):{};if(tn.content){const tn=en.content,rn=tn?Array.prototype.filter.call(tn,(en=>function isSubstantiveElement(en){return en instanceof Element&&(!en.localName||ki.indexOf(en.localName)<0)}(en))):null;rn&&Object.freeze(rn),Object.assign(nn,{items:rn})}return nn}}}function SlotContentMixin(en){return class SlotContent extends en{get[Hr](){const en=this[Bo]&&this[Bo].querySelector("slot:not([name])");return this[Bo]&&en||console.warn("SlotContentMixin expects ".concat(this.constructor.name," to define a shadow tree that includes a default (unnamed) slot.\nSee https://elix.org/documentation/SlotContentMixin.")),en}get[zr](){return Object.assign(super[zr]||{},{content:null})}[xo](en){if(super[xo]&&super[xo](en),this[Xr]){const en=this[Hr];en&&en.addEventListener("slotchange",(async()=>{this[yo]=!0;const tn=en.assignedNodes({flatten:!0});Object.freeze(tn),this[So]({content:tn}),await Promise.resolve(),this[yo]=!1}))}}}}var Bi;const Ei=function AriaMenuMixin(en){return class AriaMenu extends en{get[zr](){const en=super[zr];return Object.assign(en,{itemRole:en.itemRole||"menuitem",role:en.role||"menu"})}get itemRole(){return this[Lo].itemRole}set itemRole(en){this[So]({itemRole:en})}[bo](en){super[bo]&&super[bo](en);const tn=this[Lo].items;if((en.items||en.itemRole)&&tn){const{itemRole:en}=this[Lo];tn.forEach((tn=>{en===xi[tn.localName]?tn.removeAttribute("role"):tn.setAttribute("role",en)}))}if(en.role){const{role:en}=this[Lo];this.setAttribute("role",en)}}get role(){return super.role}set role(en){super.role=en,this[ko]||this[So]({role:en})}}}(function CursorAPIMixin(en){return class CursorAPI extends en{attributeChangedCallback(en,tn,nn){if("current-index"===en)this.currentIndex=Number(nn);else if("current-item-required"===en){const tn=booleanAttributeValue(en,nn);this.currentItemRequired!==tn&&(this.currentItemRequired=tn)}else if("cursor-operations-wrap"===en){const tn=booleanAttributeValue(en,nn);this.cursorOperationsWrap!==tn&&(this.cursorOperationsWrap=tn)}else super.attributeChangedCallback(en,tn,nn)}get currentIndex(){const{items:en,currentIndex:tn}=this[Lo];return en&&en.length>0?tn:-1}set currentIndex(en){isNaN(en)||this[So]({currentIndex:en})}get currentItem(){const{items:en,currentIndex:tn}=this[Lo];return en&&en[tn]}set currentItem(en){const{items:tn}=this[Lo];if(!tn)return;const nn=tn.indexOf(en);this[So]({currentIndex:nn})}get currentItemRequired(){return this[Lo].currentItemRequired}set currentItemRequired(en){this[So]({currentItemRequired:en})}get cursorOperationsWrap(){return this[Lo].cursorOperationsWrap}set cursorOperationsWrap(en){this[So]({cursorOperationsWrap:en})}goFirst(){return super.goFirst&&super.goFirst(),this[to]()}goLast(){return super.goLast&&super.goLast(),this[no]()}goNext(){return super.goNext&&super.goNext(),this[oo]()}goPrevious(){return super.goPrevious&&super.goPrevious(),this[io]()}[xo](en){if(super[xo]&&super[xo](en),en.currentIndex&&this[yo]){const{currentIndex:en}=this[Lo],tn=new CustomEvent("currentindexchange",{bubbles:!0,detail:{currentIndex:en}});this.dispatchEvent(tn)}}}}(function CursorInViewMixin(en){return class CursorInView extends en{[xo](en){super[xo]&&super[xo](en),en.currentItem&&this.scrollCurrentItemIntoView()}scrollCurrentItemIntoView(){super.scrollCurrentItemIntoView&&super.scrollCurrentItemIntoView();const{currentItem:en,items:tn}=this[Lo];if(!en||!tn)return;const nn=this[Co].getBoundingClientRect(),rn=en.getBoundingClientRect(),an=rn.bottom-nn.bottom,sn=rn.left-nn.left,cn=rn.right-nn.right,An=rn.top-nn.top,dn=this[Lo].orientation||"both";"horizontal"!==dn&&"both"!==dn||(cn>0?this[Co].scrollLeft+=cn:sn<0&&(this[Co].scrollLeft+=Math.ceil(sn))),"vertical"!==dn&&"both"!==dn||(an>0?this[Co].scrollTop+=an:An<0&&(this[Co].scrollTop+=Math.ceil(An)))}get[Co](){return super[Co]||defaultScrollTarget(this)}}}(DelegateFocusMixin(function DirectionCursorMixin(en){return class DirectionCursor extends en{get[zr](){return Object.assign(super[zr]||{},{canGoDown:null,canGoLeft:null,canGoRight:null,canGoUp:null})}[Jr](){return super[Jr]&&super[Jr](),this[oo]()}[eo](){return super[eo]&&super[eo](),this[no]()}[ro](){return super[ro]&&super[ro](),this[Lo]&&this[Lo].rightToLeft?this[oo]():this[io]()}[ao](){return super[ao]&&super[ao](),this[Lo]&&this[Lo].rightToLeft?this[io]():this[oo]()}[so](){return super[so]&&super[so](),this[to]()}[co](){return super[co]&&super[co](),this[io]()}[Po](en,tn){const nn=super[Po]?super[Po](en,tn):{};if(tn.canGoNext||tn.canGoPrevious||tn.languageDirection||tn.orientation||tn.rightToLeft){const{canGoNext:tn,canGoPrevious:rn,orientation:an,rightToLeft:sn}=en,cn="horizontal"===an||"both"===an,An="vertical"===an||"both"===an,dn=An&&tn,un=!!cn&&(sn?tn:rn),pn=!!cn&&(sn?rn:tn),hn=An&&rn;Object.assign(nn,{canGoDown:dn,canGoLeft:un,canGoRight:pn,canGoUp:hn})}return nn}}}(function ItemsAPIMixin(en){return class ItemsAPI extends en{get items(){return this[Lo]?this[Lo].items:null}[xo](en){if(super[xo]&&super[xo](en),!this[Xr]&&en.items&&this[yo]){const en=new CustomEvent("itemschange",{bubbles:!0});this.dispatchEvent(en)}}}}(function ItemsCursorMixin(en){return class ItemsCursor extends en{[Dr](en){let tn=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const nn=void 0!==tn.direction?tn.direction:1,rn=void 0!==tn.index?tn.index:en.currentIndex,an=void 0!==tn.wrap?tn.wrap:en.cursorOperationsWrap,{items:sn}=en,cn=sn?sn.length:0;if(0===cn)return-1;if(an){let tn=(rn%cn+cn)%cn;const an=((tn-nn)%cn+cn)%cn;for(;tn!==an;){if(!en.availableItemFlags||en.availableItemFlags[tn])return tn;tn=((tn+nn)%cn+cn)%cn}}else for(let tn=rn;tn>=0&&tn0&&An[rn]!==sn){const en=An.indexOf(sn);en>=0&&(pn=en)}else tn.currentIndex&&(rn<0&&null!==sn||rn>=0&&(0===dn||An[rn]!==sn)||null===an)&&(pn=rn);cn&&pn<0&&(pn=0),pn<0?(pn=-1,un=-1):0===dn?un=-1:(un=Math.max(Math.min(dn-1,pn),0),un=this[Dr](en,{direction:1,index:un,wrap:!1}),un<0&&(un=this[Dr](en,{direction:-1,index:un-1,wrap:!1})));const hn=An&&An[un]||null;Object.assign(nn,{currentIndex:un,desiredCurrentIndex:pn,currentItem:hn})}return nn}}}(function ItemsTextMixin(en){return class ItemsText extends en{get[zr](){return Object.assign(super[zr]||{},{texts:null})}[Zr](en){return super[Zr]?super[Zr](en):function getDefaultText(en){return en.getAttribute("aria-label")||en.getAttribute("alt")||en.innerText||en.textContent||""}(en)}[Po](en,tn){const nn=super[Po]?super[Po](en,tn):{};if(tn.items){const{items:tn}=en,rn=function getTextsFromItems(en,tn){return en?Array.from(en,(en=>tn(en))):null}(tn,this[Zr]);rn&&(Object.freeze(rn),Object.assign(nn,{texts:rn}))}return nn}}}(KeyboardDirectionMixin(KeyboardMixin(function KeyboardPagedCursorMixin(en){return class KeyboardPagedCursor extends en{[go](en){let tn=!1;if("horizontal"!==this.orientation)switch(en.key){case"PageDown":tn=this.pageDown();break;case"PageUp":tn=this.pageUp()}return tn||super[go]&&super[go](en)}get orientation(){return super.orientation||this[Lo]&&this[Lo].orientation||"both"}pageDown(){return super.pageDown&&super.pageDown(),scrollOnePage(this,!0)}pageUp(){return super.pageUp&&super.pageUp(),scrollOnePage(this,!1)}get[Co](){return super[Co]||defaultScrollTarget(this)}}}(function KeyboardPrefixCursorMixin(en){return class KeyboardPrefixCursor extends en{constructor(){super(),resetTypedPrefix(this)}[lo](en){if(super[lo]&&super[lo](en),null==en||0===en.length)return!1;const tn=en.toLowerCase(),nn=this[Lo].texts.findIndex((nn=>nn.substr(0,en.length).toLowerCase()===tn));if(nn>=0){const en=this[Lo].currentIndex;return this[So]({currentIndex:nn}),this[Lo].currentIndex!==en}return!1}[go](en){let tn;switch(en.key){case"Backspace":!function handleBackspace(en){const tn=en,nn=tn[Ci]?tn[Ci].length:0;nn>0&&(tn[Ci]=tn[Ci].substr(0,nn-1));en[lo](tn[Ci]),setPrefixTimeout(en)}(this),tn=!0;break;case"Escape":resetTypedPrefix(this);break;default:en.ctrlKey||en.metaKey||en.altKey||1!==en.key.length||function handlePlainCharacter(en,tn){const nn=en,rn=nn[Ci]||"";nn[Ci]=rn+tn,en[lo](nn[Ci]),setPrefixTimeout(en)}(this,en.key)}return tn||super[go]&&super[go](en)}}}(LanguageDirectionMixin(function SlotItemsMixin(en){return ContentItemsMixin(SlotContentMixin(en))}(function TapCursorMixin(en){return class TapCursor extends en{constructor(){super(),this.addEventListener("mousedown",(en=>{0===en.button&&(this[yo]=!0,this[Vo](en),this[yo]=!1)}))}[bo](en){super[bo]&&super[bo](en),this[Xr]&&Object.assign(this.style,{touchAction:"manipulation",mozUserSelect:"none",msUserSelect:"none",webkitUserSelect:"none",userSelect:"none"})}[Vo](en){const tn=en.composedPath?en.composedPath()[0]:en.target,{items:nn,currentItemRequired:rn}=this[Lo];if(nn&&tn instanceof Node){const an=indexOfItemContainingTarget(nn,tn),sn=an>=0?nn[an]:null;(sn&&!sn.disabled||!sn&&!rn)&&(this[So]({currentIndex:an}),en.stopPropagation())}}}}(Vr)))))))))))))));class Menu extends Ei{get[zr](){return Object.assign(super[zr],{availableItemFlags:null,handleBubblingDirectionKeys:!0,highlightCurrentItem:!0,orientation:"vertical",currentItemFocused:!1})}async flashCurrentItem(){const en=this[Lo].focusVisible,tn=matchMedia("(pointer: fine)").matches;if(en||tn){const en=75;this[So]({highlightCurrentItem:!1}),await new Promise((tn=>setTimeout(tn,en))),this[So]({highlightCurrentItem:!0}),await new Promise((tn=>setTimeout(tn,en)))}}[bo](en){super[bo](en),this[Xr]&&(this.addEventListener("disabledchange",(en=>{this[yo]=!0;const tn=en.target,{items:nn}=this[Lo],rn=null===nn?-1:nn.indexOf(tn);if(rn>=0){const en=this[Lo].availableItemFlags.slice();en[rn]=!tn.disabled,this[So]({availableItemFlags:en})}this[yo]=!1})),"PointerEvent"in window?this.addEventListener("pointerdown",(en=>this[Vo](en))):this.addEventListener("touchstart",(en=>this[Vo](en))),this.removeAttribute("tabindex"));const{currentIndex:tn,items:nn}=this[Lo];if((en.items||en.currentIndex||en.highlightCurrentItem)&&nn){const{highlightCurrentItem:en}=this[Lo];nn.forEach(((nn,rn)=>{nn.toggleAttribute("current",en&&rn===tn)}))}(en.items||en.currentIndex||en.currentItemFocused||en.focusVisible)&&nn&&nn.forEach(((en,nn)=>{const rn=nn===tn,an=tn<0&&0===nn;this[Lo].currentItemFocused?rn||an||en.removeAttribute("tabindex"):(rn||an)&&(en.tabIndex=0)}))}[xo](en){if(super[xo](en),!this[Xr]&&en.currentIndex&&!this[Lo].currentItemFocused){const{currentItem:en}=this[Lo];(en instanceof HTMLElement?en:this).focus(),this[So]({currentItemFocused:!0})}}get[Co](){return this[uo].content}[Po](en,tn){const nn=super[Po](en,tn);if(tn.currentIndex&&Object.assign(nn,{currentItemFocused:!1}),tn.items){const{items:tn}=en,rn=null===tn?null:tn.map((en=>!en.disabled));Object.assign(nn,{availableItemFlags:rn})}return nn}get[Go](){return jn.html(Bi||(Bi=_taggedTemplateLiteral(['\n \n
\n \n
\n '])))}}const ji=Symbol("documentMouseupListener");async function handleMouseup(en){const tn=this,nn=tn[Bo].elementsFromPoint(en.clientX,en.clientY);if(tn.opened){const en=nn.indexOf(tn[uo].source)>=0,rn=tn[uo].popup,an=nn.indexOf(rn)>=0,sn=rn.frame&&nn.indexOf(rn.frame)>=0;en?tn[Lo].dragSelect&&(tn[yo]=!0,tn[So]({dragSelect:!1}),tn[yo]=!1):an||sn||(tn[yo]=!0,await tn.close(),tn[yo]=!1)}}function listenIfOpenAndConnected$1(en){en[Lo].opened&&en.isConnected?en[ji]||(en[ji]=handleMouseup.bind(en),document.addEventListener("mouseup",en[ji])):en[ji]&&(document.removeEventListener("mouseup",en[ji]),en[ji]=null)}function availableSpace(en,tn,nn,rn){const an=getSourceOrigin(en,nn,rn);let sn=0,cn=0;const An="above"===nn||"below"===nn;switch(nn){case"above":sn=an.y-tn.top;break;case"below":sn=tn.bottom-an.y;break;case"left":cn=an.x-tn.left;break;case"right":cn=tn.right-an.x}switch(rn){case"bottom":sn=an.y-tn.top;break;case"center":An?cn=tn.width:sn=tn.height;break;case"stretch":An?cn=en.width:sn=en.height;break;case"left":cn=tn.right-an.x;break;case"right":cn=an.x-tn.left;break;case"top":sn=tn.bottom-an.y}return sn=Math.max(0,sn),cn=Math.max(0,cn),{height:sn,width:cn}}function getSourceOrigin(en,tn,nn){let rn=0,an=0;const sn="above"===tn||"below"===tn;switch(tn){case"above":an=en.top;break;case"below":an=en.bottom;break;case"left":case"right":rn=en[tn]}switch(nn){case"bottom":case"top":an=en[nn];break;case"left":case"right":rn=en[nn];break;case"center":sn?rn=en.left+en.width/2:an=en.top+en.height/2;break;case"stretch":sn?rn=en.left:an=en.top}return{x:rn,y:an}}function layoutPopup(en,tn,nn,rn){const an=function normalizeOptions(en){const{align:tn,direction:nn,rightToLeft:rn}=en,an="below",sn={above:"above",below:"below",column:"below","column-reverse":"above",left:"left",right:"right",row:rn?"left":"right","row-reverse":rn?"right":"left"}[nn]||an,cn={above:"horizontal",below:"horizontal",left:"vertical",right:"vertical"}[sn],An={horizontal:"left",vertical:"top"}[cn];return{align:{horizontal:{center:"center",end:rn?"left":"right",left:"left",right:"right",start:rn?"right":"left",stretch:"stretch"},vertical:{bottom:"bottom",center:"center",end:"bottom",start:"top",stretch:"stretch",top:"top"}}[cn][tn]||An,direction:sn,rightToLeft:rn}}(rn),sn=function prioritizedLayouts(en,tn){const nn={above:"below",below:"above",left:"right",right:"left"},rn={top:"bottom",bottom:"top",left:"right",right:"left"},an=[{align:tn,direction:en}];"center"===tn||"stretch"===tn?an.push({align:tn,direction:nn[en]}):(an.push({align:rn[tn],direction:en}),an.push({align:tn,direction:nn[en]}),an.push({align:rn[tn],direction:nn[en]}));return an}(an.direction,an.align);sn.sort(((rn,an)=>function compareLayouts(en,tn,nn,rn,an){const sn=availableSpace(nn,an,en.direction,en.align),cn=availableSpace(nn,an,tn.direction,tn.align),An=rn.width<=sn.width,dn=rn.height<=sn.height,un=An||dn,pn=An&&dn,hn=rn.width<=cn.width,gn=rn.height<=cn.height,_n=hn||gn,mn=hn&&gn,fn=sn.width*sn.height,yn=cn.width*cn.height;return pn&&mn?0:pn?-1:mn?1:un&&!_n?-1:_n&&!un?1:un&&fn>yn?-1:_n&&yn>fn?1:fn>yn?-1:yn>fn?1:0}(rn,an,en,tn,nn)));const cn=sn[0];return cn.rect=function getPositionedRect(en,tn,nn,rn,an){const sn=getSourceOrigin(en,rn,an);let{x:cn,y:An,bottom:dn,right:un}=nn,pn=0,hn=0,gn=tn.height,_n=tn.width;const mn="above"===rn||"below"===rn;switch(rn){case"above":hn=sn.y-tn.height,dn=sn.y;break;case"below":hn=sn.y,An=sn.y;break;case"left":pn=sn.x-tn.width,un=sn.x;break;case"right":pn=sn.x,cn=sn.x}switch(an){case"bottom":hn=sn.y-tn.height,dn=sn.y;break;case"left":pn=sn.x,cn=sn.x;break;case"center":mn?pn=sn.x-tn.width/2:hn=sn.y-tn.height/2;break;case"right":pn=sn.x-tn.width,un=sn.x;break;case"stretch":mn?(pn=sn.x,_n=en.width):(hn=sn.y,gn=en.height);break;case"top":hn=sn.y,An=sn.y}return pn=Math.max(pn,cn),hn=Math.max(hn,An),_n=Math.min(_n,un-pn),gn=Math.min(gn,dn-hn),new DOMRect(pn,hn,_n,gn)}(en,tn,nn,cn.direction,cn.align),cn}const Li=Symbol("closePromise"),Pi=Symbol("closeResolve");function OpenCloseMixin(en){return class OpenClose extends en{attributeChangedCallback(en,tn,nn){if("opened"===en){const tn=booleanAttributeValue(en,nn);this.opened!==tn&&(this.opened=tn)}else super.attributeChangedCallback(en,tn,nn)}async close(en){super.close&&await super.close(),this[So]({closeResult:en}),await this.toggle(!1)}get closed(){return this[Lo]&&!this[Lo].opened}get closeFinished(){return this[Lo].closeFinished}get closeResult(){return this[Lo].closeResult}get[zr](){const en={closeResult:void 0,opened:!1};return this[jo]&&Object.assign(en,{closeFinished:!0,effect:"close",effectPhase:"after",openCloseEffects:!0}),Object.assign(super[zr]||{},en)}async open(){super.open&&await super.open(),await this.toggle(!0)}get opened(){return this[Lo]&&this[Lo].opened}set opened(en){this[So]({closeResult:void 0}),this.toggle(en)}[bo](en){if(super[bo](en),en.opened){const{opened:en}=this[Lo];setInternalState(this,"opened",en)}if(en.closeFinished){const{closeFinished:en}=this[Lo];setInternalState(this,"closed",en)}}[xo](en){if(super[xo]&&super[xo](en),en.opened&&this[yo]){const en=new CustomEvent("openedchange",{bubbles:!0,detail:{closeResult:this[Lo].closeResult,opened:this[Lo].opened}});if(this.dispatchEvent(en),this[Lo].opened){const en=new CustomEvent("opened",{bubbles:!0});this.dispatchEvent(en);const tn=new CustomEvent("open",{bubbles:!0});this.dispatchEvent(tn)}else{const en=new CustomEvent("closed",{bubbles:!0,detail:{closeResult:this[Lo].closeResult}});this.dispatchEvent(en);const tn=new CustomEvent("close",{bubbles:!0,detail:{closeResult:this[Lo].closeResult}});this.dispatchEvent(tn)}}const tn=this[Pi];this.closeFinished&&tn&&(this[Pi]=null,this[Li]=null,tn(this[Lo].closeResult))}[Po](en,tn){const nn=super[Po]?super[Po](en,tn):{};if(tn.opened&&en.opened&&Object.assign(nn,{closeResult:void 0}),tn.openCloseEffects||tn.effect||tn.effectPhase||tn.opened){const{effect:tn,effectPhase:rn,openCloseEffects:an,opened:sn}=en,cn=an?"close"===tn&&"after"===rn:!sn;Object.assign(nn,{closeFinished:cn})}return nn}async toggle(){let en=arguments.length>0&&void 0!==arguments[0]?arguments[0]:!this.opened;super.toggle&&await super.toggle(en);if(en!==this[Lo].opened){const tn={opened:en};this[Lo].openCloseEffects&&(tn.effect=en?"open":"close","after"===this[Lo].effectPhase&&(tn.effectPhase="before")),await this[So](tn)}}whenClosed(){return this[Li]||(this[Li]=new Promise((en=>{this[Pi]=en}))),this[Li]}}}var Ti;const Fi=function AriaRoleMixin(en){return class AriaRole extends en{get[zr](){return Object.assign(super[zr]||{},{role:null})}[bo](en){if(super[bo]&&super[bo](en),en.role){const{role:en}=this[Lo];en?this.setAttribute("role",en):this.removeAttribute("role")}}get role(){return super.role}set role(en){const tn=String(en);super.role=tn,this[ko]||this[So]({s:tn})}}}(Vr);class Backdrop extends Fi{get[zr](){return Object.assign(super[zr],{role:"none"})}get[Go](){return jn.html(Ti||(Ti=_taggedTemplateLiteral(["\n \n \n "])))}}var Ui,Ni,Ii;class OverlayFrame extends Vr{get[Go](){return jn.html(Ui||(Ui=_taggedTemplateLiteral(["\n \n \n "])))}}const Mi=Symbol("appendedToDocument"),Ri=Symbol("assignedZIndex"),Oi=Symbol("restoreFocusToElement");function bringToFront(en){const tn=function maxZIndexInUse(){const en=document.body.querySelectorAll("*"),tn=Array.from(en,(en=>{const tn=getComputedStyle(en);let nn=0;if("static"!==tn.position&&"auto"!==tn.zIndex){const en=tn.zIndex?parseInt(tn.zIndex):0;nn=isNaN(en)?0:en}return nn}));return Math.max(...tn)}()+1;en[Ri]=tn,en.style.zIndex=tn.toString()}function hasZIndex(en){const tn=getComputedStyle(en).zIndex,nn=en.style.zIndex,rn=!isNaN(parseInt(nn));if("auto"===tn)return rn;if("0"===tn&&!rn){const tn=en.assignedSlot||(en instanceof ShadowRoot?en.host:en.parentNode);if(!(tn instanceof HTMLElement))return!0;if(!hasZIndex(tn))return!1}return!0}var Qi;const qi=OpenCloseMixin(function OverlayMixin(en){return class Overlay extends en{get autoFocus(){return this[Lo].autoFocus}set autoFocus(en){this[So]({autoFocus:en})}get[zr](){return Object.assign(super[zr]||{},{autoFocus:!0,persistent:!1})}async open(){this[Lo].persistent||this.isConnected||(this[Mi]=!0,document.body.append(this)),super.open&&await super.open()}[bo](en){if(super[bo]&&super[bo](en),this[Xr]&&this.addEventListener("blur",(en=>{const tn=en.relatedTarget||document.activeElement;if(tn instanceof HTMLElement){deepContains(this,tn)||(this.opened?this[Oi]=tn:(tn.focus(),this[Oi]=null))}})),(en.effectPhase||en.opened||en.persistent)&&!this[Lo].persistent){(void 0===this.closeFinished?this.closed:this.closeFinished)?this[Ri]&&(this.style.zIndex="",this[Ri]=null):this[Ri]?this.style.zIndex=this[Ri]:hasZIndex(this)||bringToFront(this)}}[xo](en){if(super[xo]&&super[xo](en),this[Xr]&&this[Lo].persistent&&!hasZIndex(this)&&bringToFront(this),en.opened&&this[Lo].autoFocus)if(this[Lo].opened){this[Oi]||document.activeElement===document.body||(this[Oi]=document.activeElement);const en=firstFocusableElement(this);en&&en.focus()}else this[Oi]&&(this[Oi].focus(),this[Oi]=null);!this[Xr]&&!this[Lo].persistent&&this.closeFinished&&this[Mi]&&(this[Mi]=!1,this.parentNode&&this.parentNode.removeChild(this))}get[Go](){const en=super[Go]||jn.html(Ni||(Ni=_taggedTemplateLiteral([""])));return en.content.append(En.html(Ii||(Ii=_taggedTemplateLiteral(["\n \n "])))),en}}}(SlotContentMixin(Vr)));class Overlay extends qi{get backdrop(){return this[uo]&&this[uo].backdrop}get backdropPartType(){return this[Lo].backdropPartType}set backdropPartType(en){this[So]({backdropPartType:en})}get[zr](){return Object.assign(super[zr],{backdropPartType:Backdrop,framePartType:OverlayFrame})}get frame(){return this[uo].frame}get framePartType(){return this[Lo].framePartType}set framePartType(en){this[So]({framePartType:en})}[bo](en){super[bo](en),renderParts$3(this[Bo],this[Lo],en)}[xo](en){super[xo](en),en.opened&&this[Lo].content&&this[Lo].content.forEach((en=>{en[Gr]&&en[Gr]()}))}get[Go](){const en=super[Go];return en.content.append(En.html(Qi||(Qi=_taggedTemplateLiteral(['\n \n
\n
\n \n
\n '])))),renderParts$3(en.content,this[Lo]),en}}function renderParts$3(en,tn,nn){if(!nn||nn.backdropPartType){const{backdropPartType:nn}=tn,rn=en.getElementById("backdrop");rn&&transmute(rn,nn)}if(!nn||nn.framePartType){const{framePartType:nn}=tn,rn=en.getElementById("frame");rn&&transmute(rn,nn)}}const Vi=Symbol("implicitCloseListener"),Gi="true"===new URLSearchParams(location.search).get("elixdebugpopup");async function blurHandler$1(en){const tn=this,nn=en.relatedTarget||document.activeElement;nn instanceof Element&&!deepContains(tn,nn)&&(tn[yo]=!0,await tn.close({canceled:"window blur"}),tn[yo]=!1)}async function closeHandler(en){const tn=this,nn="resize"!==en.type||tn[Lo].closeOnWindowResize;!ownEvent(tn,en)&&nn&&(tn[yo]=!0,await tn.close({canceled:"window ".concat(en.type)}),tn[yo]=!1)}var Di;const Hi=KeyboardMixin(function PopupModalityMixin(en){return class PopupModality extends en{get closeOnWindowResize(){return this[Lo].closeOnWindowResize}set closeOnWindowResize(en){this[So]({closeOnWindowResize:en})}get[zr](){return Object.assign(super[zr]||{},{closeOnWindowResize:!0,role:"alert"})}[go](en){let tn=!1;if("Escape"===en.key)this.close({canceled:"Escape"}),tn=!0;return tn||super.keydown&&super.keydown(en)||!1}[bo](en){if(super[bo]&&super[bo](en),this[Xr]&&(Gi||this.addEventListener("blur",blurHandler$1.bind(this))),en.role){const{role:en}=this[Lo];this.setAttribute("role",en)}}[xo](en){if(super[xo]&&super[xo](en),en.opened)if(this.opened){("requestIdleCallback"in window?window.requestIdleCallback:setTimeout)((()=>{this.opened&&function addEventListeners$1(en){en[Vi]=closeHandler.bind(en),Gi||window.addEventListener("blur",en[Vi]);window.addEventListener("resize",en[Vi]),window.addEventListener("scroll",en[Vi])}(this)}))}else!function removeEventListeners$1(en){en[Vi]&&(Gi||window.removeEventListener("blur",en[Vi]),window.removeEventListener("resize",en[Vi]),window.removeEventListener("scroll",en[Vi]),en[Vi]=null)}(this)}get role(){return super.role}set role(en){super.role=en,this[ko]||this[So]({role:en})}}}(Overlay));class Popup extends Hi{[bo](en){super[bo](en),en.backdropPartType&&(this[uo].backdrop.addEventListener("mousedown",mousedownHandler.bind(this)),"PointerEvent"in window||this[uo].backdrop.addEventListener("touchend",mousedownHandler))}get[Go](){const en=super[Go];return en.content.append(En.html(Di||(Di=_taggedTemplateLiteral(["\n \n "])))),en}}async function mousedownHandler(en){const tn=this;tn[yo]=!0,await tn.close({canceled:"mousedown outside"}),tn[yo]=!1,en.preventDefault(),en.stopPropagation()}var zi;const Ki=Symbol("resizeListener"),$i=DisabledMixin(FocusVisibleMixin(LanguageDirectionMixin(OpenCloseMixin(Vr))));function choosePopupLayout(en){const{popupAlign:tn,popupDirection:nn,rightToLeft:rn}=en[Lo],an=en[uo].source.getBoundingClientRect(),sn=en[uo].popup.getBoundingClientRect();en[uo].popup.frame&&(sn.height=en[uo].popup[uo].frame.scrollHeight,sn.width=en[uo].popup[uo].frame.scrollWidth);const cn=layoutPopup(an,sn,function viewportBounds(){const en=window.visualViewport;return en?new DOMRect(en.offsetLeft,en.offsetTop,en.width,en.height):new DOMRect(0,0,window.innerWidth,window.innerHeight)}(),{align:tn,direction:nn,rightToLeft:rn});en[So]({popupLayout:cn})}function renderParts$2(en,tn,nn){if(!nn||nn.popupPartType){const{popupPartType:nn}=tn,rn=en.getElementById("popup");rn&&transmute(rn,nn)}if(!nn||nn.sourcePartType){const{sourcePartType:nn}=tn,rn=en.getElementById("source");rn&&transmute(rn,nn)}}var Wi;const Xi="true"===new URLSearchParams(location.search).get("elixdebugpopup"),Yi=DelegateFocusMixin(KeyboardMixin(function PopupDragSelectMixin(en){return class PopupDragSelect extends en{connectedCallback(){super.connectedCallback(),listenIfOpenAndConnected$1(this)}get[zr](){return Object.assign(super[zr]||{},{dragSelect:!0})}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),listenIfOpenAndConnected$1(this)}[xo](en){super[xo](en),en.opened&&listenIfOpenAndConnected$1(this)}[Po](en,tn){const nn=super[Po](en,tn);return tn.opened&&en.opened&&Object.assign(nn,{dragSelect:!0}),nn}}}(class PopupSource extends $i{get[zr](){return Object.assign(super[zr],{ariaHasPopup:"true",popupAlign:"start",popupDirection:"column",popupLayout:null,popupPartType:Popup,sourcePartType:"div"})}get[po](){return this[uo].source}get frame(){return this[uo].popup.frame}get popupAlign(){return this[Lo].popupAlign}set popupAlign(en){this[So]({popupAlign:en})}get popupDirection(){return this[Lo].popupDirection}set popupDirection(en){this[So]({popupDirection:en})}get popupPartType(){return this[Lo].popupPartType}set popupPartType(en){this[So]({popupPartType:en})}[bo](en){if(super[bo](en),renderParts$2(this[Bo],this[Lo],en),this[Xr]||en.ariaHasPopup){const{ariaHasPopup:en}=this[Lo];null===en?this[po].removeAttribute("aria-haspopup"):this[po].setAttribute("aria-haspopup",this[Lo].ariaHasPopup)}if(en.popupPartType&&(this[uo].popup.addEventListener("open",(()=>{this.opened||(this[yo]=!0,this.open(),this[yo]=!1)})),this[uo].popup.addEventListener("close",(en=>{if(!this.closed){this[yo]=!0;const tn=en.detail.closeResult;this.close(tn),this[yo]=!1}}))),en.opened||en.popupLayout){const{opened:en,popupLayout:tn}=this[Lo],nn={height:"",left:"",opacity:"",top:"",width:""};if(en)if(tn){const{align:en,direction:rn,rect:an}=tn,sn="stretch"===en,cn="above"===rn||"below"===rn,An=!cn&&sn?"minmax(0, 1fr)":"",dn=cn&&sn?"minmax(0, 1fr)":"";Object.assign(nn,{gridTemplateColumns:dn,gridTemplateRows:An,height:"".concat(an.height,"px"),left:"".concat(an.left,"px"),top:"".concat(an.top,"px"),width:"".concat(an.width,"px")})}else nn.opacity=0;else;Object.assign(this[uo].popup.style,nn)}if(en.opened){const{opened:en}=this[Lo];this[uo].popup.opened=en}if(en.disabled&&"disabled"in this[uo].source){const{disabled:en}=this[Lo];this[uo].source.disabled=en}if(en.popupLayout){const{popupLayout:en}=this[Lo];if(en){const{align:tn,direction:nn}=en,rn=this[uo].popup;"position"in rn&&(rn.position=nn),"align"in rn&&(rn.align=tn)}}}[xo](en){super[xo](en);const{opened:tn}=this[Lo];en.opened?tn?function waitThenRenderOpened(en){setTimeout((()=>{en[Lo].opened&&(choosePopupLayout(en),function addEventListeners(en){const tn=en;tn[Ki]=()=>{choosePopupLayout(en)};(window.visualViewport||window).addEventListener("resize",tn[Ki])}(en))}))}(this):function removeEventListeners(en){const tn=en;if(tn[Ki]){(window.visualViewport||window).removeEventListener("resize",tn[Ki]),tn[Ki]=null}}(this):en.popupLayout&&this[Lo].opened&&!this[Lo].popupLayout&&choosePopupLayout(this)}get sourcePartType(){return this[Lo].sourcePartType}set sourcePartType(en){this[So]({sourcePartType:en})}[Po](en,tn){const nn=super[Po](en,tn);return(tn.opened&&!en.opened||en.opened&&(tn.popupAlign||tn.popupDirection||tn.rightToLeft))&&Object.assign(nn,{popupLayout:null}),nn}get[Go](){const en=super[Go];return en.content.append(En.html(zi||(zi=_taggedTemplateLiteral(['\n \n
\n \n
\n \n '])))),renderParts$2(en.content,this[Lo]),en}})));async function blurHandler(en){const tn=this,nn=en.relatedTarget||document.activeElement;nn instanceof Element&&!deepContains(tn,nn)&&(tn[yo]=!0,await tn.close({canceled:"blur"}),tn[yo]=!1)}const Zi=Symbol("documentMousemoveListener");function handleMousemove(en){const tn=this,{hasHoveredOverItemSinceOpened:nn,opened:rn}=tn[Lo];if(rn){const rn=en.composedPath?en.composedPath()[0]:en.target,an=tn.items;if(rn&&rn instanceof Node&&an){const en=indexOfItemContainingTarget(an,rn),sn=an[en],cn=sn&&!sn.disabled?en:-1;(nn||cn>=0)&&cn!==tn[Lo].currentIndex&&(tn[yo]=!0,tn[So]({currentIndex:cn}),cn>=0&&!nn&&tn[So]({hasHoveredOverItemSinceOpened:!0}),tn[yo]=!1)}}}function listenIfOpenAndConnected(en){en[Lo].opened&&en.isConnected?en[Zi]||(en[Zi]=handleMousemove.bind(en),document.addEventListener("mousemove",en[Zi])):en[Zi]&&(document.removeEventListener("mousemove",en[Zi]),en[Zi]=null)}async function selectCurrentItemAndClose(en){const tn=en[yo],nn=en[Lo].currentIndex>=0,rn=en.items;if(rn){const an=nn?rn[en[Lo].currentIndex]:void 0,sn=en[Lo].popupList;nn&&"flashCurrentItem"in sn&&await sn.flashCurrentItem();const cn=en[yo];en[yo]=tn,await en.close(an),en[yo]=cn}}var Ji,ea;const ta=function PopupListMixin(en){return class PopupList extends en{connectedCallback(){super.connectedCallback(),listenIfOpenAndConnected(this)}get[zr](){return Object.assign(super[zr]||{},{currentIndex:-1,hasHoveredOverItemSinceOpened:!1,popupList:null})}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),listenIfOpenAndConnected(this)}[go](en){let tn=!1;if("Enter"===en.key)this.opened&&(selectCurrentItemAndClose(this),tn=!0);return tn||super[go]&&super[go](en)||!1}[bo](en){if(super[bo]&&super[bo](en),en.popupList){const{popupList:en}=this[Lo];en&&(en.addEventListener("mouseup",(async en=>{const tn=this[Lo].currentIndex;this[Lo].dragSelect||tn>=0?(en.stopPropagation(),this[yo]=!0,await selectCurrentItemAndClose(this),this[yo]=!1):en.stopPropagation()})),en.addEventListener("currentindexchange",(en=>{this[yo]=!0;const tn=en;this[So]({currentIndex:tn.detail.currentIndex}),this[yo]=!1})))}if(en.currentIndex||en.popupList){const{currentIndex:en,popupList:tn}=this[Lo];tn&&"currentIndex"in tn&&(tn.currentIndex=en)}}[xo](en){if(super[xo]&&super[xo](en),en.opened){if(this[Lo].opened){const{popupList:en}=this[Lo];en.scrollCurrentItemIntoView&&setTimeout((()=>{en.scrollCurrentItemIntoView()}))}listenIfOpenAndConnected(this)}}[Po](en,tn){const nn=super[Po]?super[Po](en,tn):{};return tn.opened&&en.opened&&Object.assign(nn,{hasHoveredOverItemSinceOpened:!1}),nn}}}(class PopupButton extends Yi{get[zr](){return Object.assign(super[zr],{sourcePartType:"button"})}[go](en){let tn;switch(en.key){case" ":case"ArrowDown":case"ArrowUp":this.closed&&(this.open(),tn=!0);break;case"Enter":this.opened||(this.open(),tn=!0);break;case"Escape":this.opened&&(this.close({canceled:"Escape"}),tn=!0)}if(tn=super[go]&&super[go](en),!tn&&this.opened&&!en.metaKey&&!en.altKey)switch(en.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":case"PageDown":case"PageUp":case" ":tn=!0}return tn}[bo](en){if(super[bo](en),this[Xr]&&(Xi||this.addEventListener("blur",blurHandler.bind(this)),this[uo].source.addEventListener("focus",(async en=>{const tn=ownEvent(this[uo].popup,en),nn=null!==this[Lo].popupHeight;!tn&&this.opened&&nn&&(this[yo]=!0,await this.close(),this[yo]=!1)}))),en.opened){const{opened:en}=this[Lo];this.toggleAttribute("opened",en)}if(en.sourcePartType){this[uo].source.addEventListener("mousedown",(en=>{if(this.disabled)return void en.preventDefault();const tn=en;tn.button&&0!==tn.button||(setTimeout((()=>{this.opened||(this[yo]=!0,this.open(),this[yo]=!1)})),en.stopPropagation())}))}en.popupPartType&&this[uo].popup.removeAttribute("tabindex")}get[Go](){const en=super[Go];return en.content.append(En.html(Wi||(Wi=_taggedTemplateLiteral(['\n \n '])))),en}});class MenuButton extends ta{get[zr](){return Object.assign(super[zr],{menuPartType:Menu})}get items(){const en=this[uo]&&this[uo].menu;return en?en.items:null}get menuPartType(){return this[Lo].menuPartType}set menuPartType(en){this[So]({menuPartType:en})}[bo](en){if(super[bo](en),renderParts$1(this[Bo],this[Lo],en),en.menuPartType&&(this[uo].menu.addEventListener("blur",(async en=>{const tn=en.relatedTarget||document.activeElement;this.opened&&!deepContains(this[uo].menu,tn)&&(this[yo]=!0,await this.close(),this[yo]=!1)})),this[uo].menu.addEventListener("mousedown",(en=>{0===en.button&&this.opened&&(en.stopPropagation(),en.preventDefault())}))),en.opened){const{opened:en}=this[Lo];this[uo].source.setAttribute("aria-expanded",en.toString())}}[xo](en){super[xo](en),en.menuPartType&&this[So]({popupList:this[uo].menu})}[Po](en,tn){const nn=super[Po](en,tn);return tn.opened&&!en.opened&&Object.assign(nn,{currentIndex:-1}),nn}get[Go](){const en=super[Go],tn=en.content.querySelector("slot:not([name])");return tn&&tn.replaceWith(En.html(Ji||(Ji=_taggedTemplateLiteral(['\n \n '])))),renderParts$1(en.content,this[Lo]),en.content.append(En.html(ea||(ea=_taggedTemplateLiteral(['\n \n '])))),en}}function renderParts$1(en,tn,nn){if(!nn||nn.menuPartType){const{menuPartType:nn}=tn,rn=en.getElementById("menu");rn&&transmute(rn,nn)}}var na;const ra=DisabledMixin(Vr);class UpDownToggle extends ra{get[zr](){return Object.assign(super[zr],{direction:"down"})}get direction(){return this[Lo].direction}set direction(en){this[So]({direction:en})}[bo](en){if(super[bo](en),en.direction){const{direction:en}=this[Lo];this[uo].downIcon.style.display="down"===en?"block":"none",this[uo].upIcon.style.display="up"===en?"block":"none"}}get[Go](){return jn.html(na||(na=_taggedTemplateLiteral(['\n \n
\n \n
\n
\n \n
\n '])))}}var oa,ia,aa,sa,la,ca,Aa,da,ua,pa;function renderParts(en,tn,nn){if(!nn||nn.popupTogglePartType){const{popupTogglePartType:nn}=tn,rn=en.getElementById("popupToggle");rn&&transmute(rn,nn)}}class PlainButton extends(PlainButtonMixin(Button)){}class PlainBorderButton extends PlainButton{get[Go](){const en=super[Go];return en.content.append(En.html(aa||(aa=_taggedTemplateLiteral(['\n \n '])))),en}}class PlainMenu extends Menu{get[Go](){const en=super[Go];return en.content.append(En.html(sa||(sa=_taggedTemplateLiteral(["\n \n "])))),en}}class PlainOpenCloseToggle extends UpDownToggle{get[Go](){const en=super[Go],tn=en.content.getElementById("downIcon"),nn=En.html(la||(la=_taggedTemplateLiteral(['\n \n \n \n ']))).firstElementChild;tn&&nn&&replace(tn,nn);const rn=en.content.getElementById("upIcon"),an=En.html(ca||(ca=_taggedTemplateLiteral(['\n \n \n \n ']))).firstElementChild;return rn&&an&&replace(rn,an),en.content.append(En.html(Aa||(Aa=_taggedTemplateLiteral(['\n \n '])))),en}}class PlainBackdrop extends Backdrop{}class PlainOverlayFrame extends OverlayFrame{get[Go](){const en=super[Go];return en.content.append(En.html(da||(da=_taggedTemplateLiteral(["\n \n "])))),en}}class PlainPopup extends Popup{get[zr](){return Object.assign(super[zr],{backdropPartType:PlainBackdrop,framePartType:PlainOverlayFrame})}}class PlainMenuButton extends(function PopupToggleMixin(en){return class PopupToggle extends en{get[zr](){return Object.assign(super[zr]||{},{popupTogglePartType:UpDownToggle})}get popupTogglePartType(){return this[Lo].popupTogglePartType}set popupTogglePartType(en){this[So]({popupTogglePartType:en})}[bo](en){if(super[bo](en),renderParts(this[Bo],this[Lo],en),en.popupDirection||en.popupTogglePartType){const{popupDirection:en}=this[Lo],tn="above"===en||"column-reverse"===en?"up":"down",nn=this[uo].popupToggle;"direction"in nn&&(nn.direction=tn)}if(en.disabled){const{disabled:en}=this[Lo];this[uo].popupToggle.disabled=en}}get[Go](){const en=super[Go],tn=en.content.querySelector('[part~="source"]');return tn&&tn.append(En.html(oa||(oa=_taggedTemplateLiteral(['\n \n '])))),renderParts(en.content,this[Lo]),en.content.append(En.html(ia||(ia=_taggedTemplateLiteral(['\n \n '])))),en}}}(MenuButton)){get[zr](){return Object.assign(super[zr],{menuPartType:PlainMenu,popupPartType:PlainPopup,popupTogglePartType:PlainOpenCloseToggle,sourcePartType:PlainBorderButton})}get[Go](){const en=super[Go];return en.content.append(En.html(ua||(ua=_taggedTemplateLiteral(['\n \n '])))),en}}class SePlainBorderButton extends PlainButton{get[Go](){const en=super[Go];return en.content.append(En.html(pa||(pa=_taggedTemplateLiteral(['\n \n '])))),en}}customElements.define("elix-menu-button",class ElixMenuButton extends PlainMenuButton{get[zr](){return Object.assign(super[zr],{sourcePartType:SePlainBorderButton})}});const ha=document.createElement("template");ha.innerHTML='\n \n\n \n \n \n\n';class SeMenu extends HTMLElement{constructor(){super(),this._shadowRoot=this.attachShadow({mode:"open"}),this._shadowRoot.append(ha.content.cloneNode(!0)),this.$menu=this._shadowRoot.querySelector("elix-menu-button"),this.$label=this.$menu.shadowRoot.querySelector("#popupToggle").shadowRoot,this.imgPath=svgEditor.configObj.curConfig.imgPath}static get observedAttributes(){return["label","src"]}attributeChangedCallback(en,tn,nn){const rn=new Image;if(tn!==nn)switch(en){case"src":rn.src=this.imgPath+"/"+nn,rn.width=24,rn.height=24,this.$label.prepend(rn);break;case"label":this.$label.prepend(nn);break;default:console.error("unknown attribute: ".concat(en))}}get label(){return this.getAttribute("label")}set label(en){this.setAttribute("label",en)}get src(){return this.getAttribute("src")}set src(en){this.setAttribute("src",en)}}customElements.define("se-menu",SeMenu);customElements.define("elix-menu",class ElixMenu extends PlainMenu{});const ga=document.createElement("template");ga.innerHTML='\n \n \n
\n icon\n \n
\n
\n';class SeMenuItem extends HTMLElement{constructor(){super(),this._shadowRoot=this.attachShadow({mode:"open"}),this._shadowRoot.append(ga.content.cloneNode(!0)),this.$img=this._shadowRoot.querySelector("img"),this.$label=this._shadowRoot.querySelector("span"),this.$menuitem=this._shadowRoot.querySelector("elix-menu-item"),this.$svg=this.$menuitem.shadowRoot.querySelector("#checkmark"),this.$svg.setAttribute("style","display: none;"),this.imgPath=svgEditor.configObj.curConfig.imgPath}static get observedAttributes(){return["label","src"]}attributeChangedCallback(en,tn,nn){let rn="";if(tn!==nn)switch(en){case"src":this.$img.style.display="inline-block",this.$img.setAttribute("src",this.imgPath+"/"+nn);break;case"label":rn=this.getAttribute("shortcut"),this.$label.textContent="".concat(t$1(nn)," ").concat(rn?"(".concat(rn,")"):"");break;default:console.error("unknown attribute: ".concat(en))}}get label(){return this.getAttribute("label")}set label(en){this.setAttribute("label",en)}get src(){return this.getAttribute("src")}set src(en){this.setAttribute("src",en)}connectedCallback(){const en=this.getAttribute("shortcut");en&&document.addEventListener("keydown",(tn=>{if("BODY"!==tn.target.nodeName)return;const nn="".concat(tn.metaKey?"meta+":"").concat(tn.ctrlKey?"ctrl+":"").concat(tn.key.toUpperCase());en===nn&&(this.id&&document.getElementById(this.id).click(),tn.preventDefault())}))}}customElements.define("se-menu-item",SeMenuItem);const _a=document.createElement("template");_a.innerHTML='\n\n \n
\n
\n
\n \n
\n
\n\n';class SeList extends HTMLElement{constructor(){super(),_defineProperty$1(this,"toggleList",(en=>{this.isDropdownOpen?this.closeDropdown():(this.openDropdown(),this.setDropdownListPosition())})),_defineProperty$1(this,"updateSelectedValue",(en=>{Array.from(this.items).forEach((tn=>{if(tn.getAttribute("value")===en)if(tn.setAttribute("selected",!0),tn.hasAttribute("src")){for(;this.$selection.firstChild;)this.$selection.removeChild(this.$selection.firstChild);const en=document.createElement("img");en.src=this.imgPath+"/"+tn.getAttribute("src"),en.style.height=tn.getAttribute("img-height"),en.setAttribute("title",t$1(tn.getAttribute("title"))),this.$selection.append(en)}else this.$selection.textContent=t$1(tn.getAttribute("option"));else tn.setAttribute("selected",!1)}))})),_defineProperty$1(this,"openDropdown",(()=>{this.isDropdownOpen=!0,this.$optionsContainer.classList.remove("closed")})),_defineProperty$1(this,"closeDropdown",(()=>{this.isDropdownOpen=!1,this.$optionsContainer.classList.add("closed")})),_defineProperty$1(this,"setDropdownListPosition",(()=>{const en=window.innerHeight,tn=this.$selection.getBoundingClientRect(),nn=this.$optionsContainer.getBoundingClientRect();tn.bottom+nn.height>en?(this.$optionsContainer.style.top=tn.top-nn.height+"px",this.$optionsContainer.style.left=tn.left+"px"):(this.$optionsContainer.style.top=tn.bottom+"px",this.$optionsContainer.style.left=tn.left+"px")})),this._shadowRoot=this.attachShadow({mode:"open"}),this._shadowRoot.append(_a.content.cloneNode(!0)),this.$dropdown=this._shadowRoot.querySelector("#select-container"),this.$label=this._shadowRoot.querySelector("label"),this.$selection=this.$dropdown.querySelector("#selected-value"),this.items=this.querySelectorAll("se-list-item"),this.imgPath=svgEditor.configObj.curConfig.imgPath,this.$optionsContainer=this._shadowRoot.querySelector("#options-container"),this.$optionsContainer.classList.add("closed"),this.$selection.addEventListener("click",this.toggleList),this.updateSelectedValue(this.items[0].getAttribute("value")),this.isDropdownOpen=!1}static get observedAttributes(){return["label","width","height","title","value"]}attributeChangedCallback(en,tn,nn){if(tn!==nn)switch(en){case"title":this.$dropdown.setAttribute("title",t$1(nn));break;case"label":this.$label.textContent=t$1(nn);break;case"height":this.$dropdown.style.height=nn;break;case"width":this.$dropdown.style.width=nn;break;case"value":this.updateSelectedValue(nn);break;default:console.error("unknown attribute: ".concat(en))}}get title(){return this.getAttribute("title")}set title(en){this.setAttribute("title",en)}get label(){return this.getAttribute("label")}set label(en){this.setAttribute("label",en)}get width(){return this.getAttribute("width")}set width(en){this.setAttribute("width",en)}get height(){return this.getAttribute("height")}set height(en){this.setAttribute("height",en)}connectedCallback(){const en=this;this.$dropdown.addEventListener("selectedindexchange",(tn=>{var nn;if(void 0!==(null==tn||null===(nn=tn.detail)||void 0===nn?void 0:nn.selectedItem)){const nn=tn.detail.selectedItem,rn=new CustomEvent("change",{detail:{value:nn}});en.dispatchEvent(rn),en.value=nn,en.setAttribute("value",nn)}})),this.$dropdown.addEventListener("focusout",(en=>{this.closeDropdown()})),window.addEventListener("mousedown",(en=>{this.isDropdownOpen&&(en.target.closest("se-list")||(en.stopPropagation(),this.closeDropdown()))}),{capture:!0})}}customElements.define("se-list",SeList);const ma=document.createElement("template");ma.innerHTML='\n \n
\n icon\n \n
\n';class SeListItem extends HTMLElement{constructor(){super(),this._shadowRoot=this.attachShadow({mode:"open"}),this._shadowRoot.append(ma.content.cloneNode(!0)),this.$menuitem=this._shadowRoot.querySelector("[aria-label=option]"),this.$img=this._shadowRoot.querySelector("img"),this.$img.setAttribute("style","display: none;"),this.imgPath=svgEditor.configObj.curConfig.imgPath,this.$menuitem.addEventListener("mousedown",(en=>{this.$menuitem.dispatchEvent(new CustomEvent("selectedindexchange",{bubbles:!0,composed:!0,detail:{selectedItem:this.getAttribute("value")}}))}))}static get observedAttributes(){return["option","src","title","img-height","selected"]}attributeChangedCallback(en,tn,nn){if(tn!==nn)switch(en){case"option":this.$menuitem.setAttribute("option",nn),this.$menuitem.textContent=t$1(nn);break;case"src":this.$img.setAttribute("style","display: block;"),this.$img.setAttribute("src",this.imgPath+"/"+nn);break;case"title":this.$img.setAttribute("title",t$1(nn));break;case"img-height":this.$img.setAttribute("height",nn);break;case"selected":"true"===nn?this.$menuitem.classList.add("selected"):this.$menuitem.classList.remove("selected");break;default:console.error("unknown attribute: ".concat(en))}}get option(){return this.getAttribute("option")}set option(en){this.setAttribute("option",en)}get title(){return this.getAttribute("title")}set title(en){this.setAttribute("title",en)}get imgHeight(){return this.getAttribute("img-height")}set imgHeight(en){this.setAttribute("img-height",en)}get src(){return this.getAttribute("src")}set src(en){this.setAttribute("src",en)}}function _mergeNamespaces$1(en,tn){return tn.forEach((function(tn){tn&&"string"!=typeof tn&&!Array.isArray(tn)&&Object.keys(tn).forEach((function(nn){if("default"!==nn&&!(nn in en)){var rn=Object.getOwnPropertyDescriptor(tn,nn);Object.defineProperty(en,nn,rn.get?rn:{enumerable:!0,get:function(){return tn[nn]}})}}))})),Object.freeze(en)}customElements.define("se-list-item",SeListItem),"undefined"!=typeof window&&("SVGPathSeg"in window||(window.SVGPathSeg=function(en,tn,nn){this.pathSegType=en,this.pathSegTypeAsLetter=tn,this._owningPathSegList=nn},window.SVGPathSeg.prototype.classname="SVGPathSeg",window.SVGPathSeg.PATHSEG_UNKNOWN=0,window.SVGPathSeg.PATHSEG_CLOSEPATH=1,window.SVGPathSeg.PATHSEG_MOVETO_ABS=2,window.SVGPathSeg.PATHSEG_MOVETO_REL=3,window.SVGPathSeg.PATHSEG_LINETO_ABS=4,window.SVGPathSeg.PATHSEG_LINETO_REL=5,window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS=6,window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL=7,window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS=8,window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL=9,window.SVGPathSeg.PATHSEG_ARC_ABS=10,window.SVGPathSeg.PATHSEG_ARC_REL=11,window.SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS=12,window.SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL=13,window.SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS=14,window.SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL=15,window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS=16,window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL=17,window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS=18,window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL=19,window.SVGPathSeg.prototype._segmentChanged=function(){this._owningPathSegList&&this._owningPathSegList.segmentChanged(this)},window.SVGPathSegClosePath=function(en){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_CLOSEPATH,"z",en)},window.SVGPathSegClosePath.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegClosePath.prototype.toString=function(){return"[object SVGPathSegClosePath]"},window.SVGPathSegClosePath.prototype._asPathString=function(){return this.pathSegTypeAsLetter},window.SVGPathSegClosePath.prototype.clone=function(){return new window.SVGPathSegClosePath(void 0)},window.SVGPathSegMovetoAbs=function(en,tn,nn){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_MOVETO_ABS,"M",en),this._x=tn,this._y=nn},window.SVGPathSegMovetoAbs.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegMovetoAbs.prototype.toString=function(){return"[object SVGPathSegMovetoAbs]"},window.SVGPathSegMovetoAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y},window.SVGPathSegMovetoAbs.prototype.clone=function(){return new window.SVGPathSegMovetoAbs(void 0,this._x,this._y)},Object.defineProperty(window.SVGPathSegMovetoAbs.prototype,"x",{get:function(){return this._x},set:function(en){this._x=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegMovetoAbs.prototype,"y",{get:function(){return this._y},set:function(en){this._y=en,this._segmentChanged()},enumerable:!0}),window.SVGPathSegMovetoRel=function(en,tn,nn){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_MOVETO_REL,"m",en),this._x=tn,this._y=nn},window.SVGPathSegMovetoRel.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegMovetoRel.prototype.toString=function(){return"[object SVGPathSegMovetoRel]"},window.SVGPathSegMovetoRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y},window.SVGPathSegMovetoRel.prototype.clone=function(){return new window.SVGPathSegMovetoRel(void 0,this._x,this._y)},Object.defineProperty(window.SVGPathSegMovetoRel.prototype,"x",{get:function(){return this._x},set:function(en){this._x=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegMovetoRel.prototype,"y",{get:function(){return this._y},set:function(en){this._y=en,this._segmentChanged()},enumerable:!0}),window.SVGPathSegLinetoAbs=function(en,tn,nn){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_LINETO_ABS,"L",en),this._x=tn,this._y=nn},window.SVGPathSegLinetoAbs.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegLinetoAbs.prototype.toString=function(){return"[object SVGPathSegLinetoAbs]"},window.SVGPathSegLinetoAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y},window.SVGPathSegLinetoAbs.prototype.clone=function(){return new window.SVGPathSegLinetoAbs(void 0,this._x,this._y)},Object.defineProperty(window.SVGPathSegLinetoAbs.prototype,"x",{get:function(){return this._x},set:function(en){this._x=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegLinetoAbs.prototype,"y",{get:function(){return this._y},set:function(en){this._y=en,this._segmentChanged()},enumerable:!0}),window.SVGPathSegLinetoRel=function(en,tn,nn){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_LINETO_REL,"l",en),this._x=tn,this._y=nn},window.SVGPathSegLinetoRel.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegLinetoRel.prototype.toString=function(){return"[object SVGPathSegLinetoRel]"},window.SVGPathSegLinetoRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y},window.SVGPathSegLinetoRel.prototype.clone=function(){return new window.SVGPathSegLinetoRel(void 0,this._x,this._y)},Object.defineProperty(window.SVGPathSegLinetoRel.prototype,"x",{get:function(){return this._x},set:function(en){this._x=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegLinetoRel.prototype,"y",{get:function(){return this._y},set:function(en){this._y=en,this._segmentChanged()},enumerable:!0}),window.SVGPathSegCurvetoCubicAbs=function(en,tn,nn,rn,an,sn,cn){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS,"C",en),this._x=tn,this._y=nn,this._x1=rn,this._y1=an,this._x2=sn,this._y2=cn},window.SVGPathSegCurvetoCubicAbs.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegCurvetoCubicAbs.prototype.toString=function(){return"[object SVGPathSegCurvetoCubicAbs]"},window.SVGPathSegCurvetoCubicAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x2+" "+this._y2+" "+this._x+" "+this._y},window.SVGPathSegCurvetoCubicAbs.prototype.clone=function(){return new window.SVGPathSegCurvetoCubicAbs(void 0,this._x,this._y,this._x1,this._y1,this._x2,this._y2)},Object.defineProperty(window.SVGPathSegCurvetoCubicAbs.prototype,"x",{get:function(){return this._x},set:function(en){this._x=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicAbs.prototype,"y",{get:function(){return this._y},set:function(en){this._y=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicAbs.prototype,"x1",{get:function(){return this._x1},set:function(en){this._x1=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicAbs.prototype,"y1",{get:function(){return this._y1},set:function(en){this._y1=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicAbs.prototype,"x2",{get:function(){return this._x2},set:function(en){this._x2=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicAbs.prototype,"y2",{get:function(){return this._y2},set:function(en){this._y2=en,this._segmentChanged()},enumerable:!0}),window.SVGPathSegCurvetoCubicRel=function(en,tn,nn,rn,an,sn,cn){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL,"c",en),this._x=tn,this._y=nn,this._x1=rn,this._y1=an,this._x2=sn,this._y2=cn},window.SVGPathSegCurvetoCubicRel.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegCurvetoCubicRel.prototype.toString=function(){return"[object SVGPathSegCurvetoCubicRel]"},window.SVGPathSegCurvetoCubicRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x2+" "+this._y2+" "+this._x+" "+this._y},window.SVGPathSegCurvetoCubicRel.prototype.clone=function(){return new window.SVGPathSegCurvetoCubicRel(void 0,this._x,this._y,this._x1,this._y1,this._x2,this._y2)},Object.defineProperty(window.SVGPathSegCurvetoCubicRel.prototype,"x",{get:function(){return this._x},set:function(en){this._x=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicRel.prototype,"y",{get:function(){return this._y},set:function(en){this._y=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicRel.prototype,"x1",{get:function(){return this._x1},set:function(en){this._x1=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicRel.prototype,"y1",{get:function(){return this._y1},set:function(en){this._y1=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicRel.prototype,"x2",{get:function(){return this._x2},set:function(en){this._x2=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicRel.prototype,"y2",{get:function(){return this._y2},set:function(en){this._y2=en,this._segmentChanged()},enumerable:!0}),window.SVGPathSegCurvetoQuadraticAbs=function(en,tn,nn,rn,an){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS,"Q",en),this._x=tn,this._y=nn,this._x1=rn,this._y1=an},window.SVGPathSegCurvetoQuadraticAbs.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegCurvetoQuadraticAbs.prototype.toString=function(){return"[object SVGPathSegCurvetoQuadraticAbs]"},window.SVGPathSegCurvetoQuadraticAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x+" "+this._y},window.SVGPathSegCurvetoQuadraticAbs.prototype.clone=function(){return new window.SVGPathSegCurvetoQuadraticAbs(void 0,this._x,this._y,this._x1,this._y1)},Object.defineProperty(window.SVGPathSegCurvetoQuadraticAbs.prototype,"x",{get:function(){return this._x},set:function(en){this._x=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoQuadraticAbs.prototype,"y",{get:function(){return this._y},set:function(en){this._y=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoQuadraticAbs.prototype,"x1",{get:function(){return this._x1},set:function(en){this._x1=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoQuadraticAbs.prototype,"y1",{get:function(){return this._y1},set:function(en){this._y1=en,this._segmentChanged()},enumerable:!0}),window.SVGPathSegCurvetoQuadraticRel=function(en,tn,nn,rn,an){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL,"q",en),this._x=tn,this._y=nn,this._x1=rn,this._y1=an},window.SVGPathSegCurvetoQuadraticRel.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegCurvetoQuadraticRel.prototype.toString=function(){return"[object SVGPathSegCurvetoQuadraticRel]"},window.SVGPathSegCurvetoQuadraticRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x+" "+this._y},window.SVGPathSegCurvetoQuadraticRel.prototype.clone=function(){return new window.SVGPathSegCurvetoQuadraticRel(void 0,this._x,this._y,this._x1,this._y1)},Object.defineProperty(window.SVGPathSegCurvetoQuadraticRel.prototype,"x",{get:function(){return this._x},set:function(en){this._x=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoQuadraticRel.prototype,"y",{get:function(){return this._y},set:function(en){this._y=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoQuadraticRel.prototype,"x1",{get:function(){return this._x1},set:function(en){this._x1=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoQuadraticRel.prototype,"y1",{get:function(){return this._y1},set:function(en){this._y1=en,this._segmentChanged()},enumerable:!0}),window.SVGPathSegArcAbs=function(en,tn,nn,rn,an,sn,cn,An){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_ARC_ABS,"A",en),this._x=tn,this._y=nn,this._r1=rn,this._r2=an,this._angle=sn,this._largeArcFlag=cn,this._sweepFlag=An},window.SVGPathSegArcAbs.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegArcAbs.prototype.toString=function(){return"[object SVGPathSegArcAbs]"},window.SVGPathSegArcAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._r1+" "+this._r2+" "+this._angle+" "+(this._largeArcFlag?"1":"0")+" "+(this._sweepFlag?"1":"0")+" "+this._x+" "+this._y},window.SVGPathSegArcAbs.prototype.clone=function(){return new window.SVGPathSegArcAbs(void 0,this._x,this._y,this._r1,this._r2,this._angle,this._largeArcFlag,this._sweepFlag)},Object.defineProperty(window.SVGPathSegArcAbs.prototype,"x",{get:function(){return this._x},set:function(en){this._x=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegArcAbs.prototype,"y",{get:function(){return this._y},set:function(en){this._y=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegArcAbs.prototype,"r1",{get:function(){return this._r1},set:function(en){this._r1=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegArcAbs.prototype,"r2",{get:function(){return this._r2},set:function(en){this._r2=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegArcAbs.prototype,"angle",{get:function(){return this._angle},set:function(en){this._angle=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegArcAbs.prototype,"largeArcFlag",{get:function(){return this._largeArcFlag},set:function(en){this._largeArcFlag=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegArcAbs.prototype,"sweepFlag",{get:function(){return this._sweepFlag},set:function(en){this._sweepFlag=en,this._segmentChanged()},enumerable:!0}),window.SVGPathSegArcRel=function(en,tn,nn,rn,an,sn,cn,An){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_ARC_REL,"a",en),this._x=tn,this._y=nn,this._r1=rn,this._r2=an,this._angle=sn,this._largeArcFlag=cn,this._sweepFlag=An},window.SVGPathSegArcRel.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegArcRel.prototype.toString=function(){return"[object SVGPathSegArcRel]"},window.SVGPathSegArcRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._r1+" "+this._r2+" "+this._angle+" "+(this._largeArcFlag?"1":"0")+" "+(this._sweepFlag?"1":"0")+" "+this._x+" "+this._y},window.SVGPathSegArcRel.prototype.clone=function(){return new window.SVGPathSegArcRel(void 0,this._x,this._y,this._r1,this._r2,this._angle,this._largeArcFlag,this._sweepFlag)},Object.defineProperty(window.SVGPathSegArcRel.prototype,"x",{get:function(){return this._x},set:function(en){this._x=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegArcRel.prototype,"y",{get:function(){return this._y},set:function(en){this._y=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegArcRel.prototype,"r1",{get:function(){return this._r1},set:function(en){this._r1=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegArcRel.prototype,"r2",{get:function(){return this._r2},set:function(en){this._r2=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegArcRel.prototype,"angle",{get:function(){return this._angle},set:function(en){this._angle=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegArcRel.prototype,"largeArcFlag",{get:function(){return this._largeArcFlag},set:function(en){this._largeArcFlag=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegArcRel.prototype,"sweepFlag",{get:function(){return this._sweepFlag},set:function(en){this._sweepFlag=en,this._segmentChanged()},enumerable:!0}),window.SVGPathSegLinetoHorizontalAbs=function(en,tn){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS,"H",en),this._x=tn},window.SVGPathSegLinetoHorizontalAbs.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegLinetoHorizontalAbs.prototype.toString=function(){return"[object SVGPathSegLinetoHorizontalAbs]"},window.SVGPathSegLinetoHorizontalAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x},window.SVGPathSegLinetoHorizontalAbs.prototype.clone=function(){return new window.SVGPathSegLinetoHorizontalAbs(void 0,this._x)},Object.defineProperty(window.SVGPathSegLinetoHorizontalAbs.prototype,"x",{get:function(){return this._x},set:function(en){this._x=en,this._segmentChanged()},enumerable:!0}),window.SVGPathSegLinetoHorizontalRel=function(en,tn){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL,"h",en),this._x=tn},window.SVGPathSegLinetoHorizontalRel.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegLinetoHorizontalRel.prototype.toString=function(){return"[object SVGPathSegLinetoHorizontalRel]"},window.SVGPathSegLinetoHorizontalRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x},window.SVGPathSegLinetoHorizontalRel.prototype.clone=function(){return new window.SVGPathSegLinetoHorizontalRel(void 0,this._x)},Object.defineProperty(window.SVGPathSegLinetoHorizontalRel.prototype,"x",{get:function(){return this._x},set:function(en){this._x=en,this._segmentChanged()},enumerable:!0}),window.SVGPathSegLinetoVerticalAbs=function(en,tn){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS,"V",en),this._y=tn},window.SVGPathSegLinetoVerticalAbs.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegLinetoVerticalAbs.prototype.toString=function(){return"[object SVGPathSegLinetoVerticalAbs]"},window.SVGPathSegLinetoVerticalAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._y},window.SVGPathSegLinetoVerticalAbs.prototype.clone=function(){return new window.SVGPathSegLinetoVerticalAbs(void 0,this._y)},Object.defineProperty(window.SVGPathSegLinetoVerticalAbs.prototype,"y",{get:function(){return this._y},set:function(en){this._y=en,this._segmentChanged()},enumerable:!0}),window.SVGPathSegLinetoVerticalRel=function(en,tn){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL,"v",en),this._y=tn},window.SVGPathSegLinetoVerticalRel.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegLinetoVerticalRel.prototype.toString=function(){return"[object SVGPathSegLinetoVerticalRel]"},window.SVGPathSegLinetoVerticalRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._y},window.SVGPathSegLinetoVerticalRel.prototype.clone=function(){return new window.SVGPathSegLinetoVerticalRel(void 0,this._y)},Object.defineProperty(window.SVGPathSegLinetoVerticalRel.prototype,"y",{get:function(){return this._y},set:function(en){this._y=en,this._segmentChanged()},enumerable:!0}),window.SVGPathSegCurvetoCubicSmoothAbs=function(en,tn,nn,rn,an){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS,"S",en),this._x=tn,this._y=nn,this._x2=rn,this._y2=an},window.SVGPathSegCurvetoCubicSmoothAbs.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegCurvetoCubicSmoothAbs.prototype.toString=function(){return"[object SVGPathSegCurvetoCubicSmoothAbs]"},window.SVGPathSegCurvetoCubicSmoothAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x2+" "+this._y2+" "+this._x+" "+this._y},window.SVGPathSegCurvetoCubicSmoothAbs.prototype.clone=function(){return new window.SVGPathSegCurvetoCubicSmoothAbs(void 0,this._x,this._y,this._x2,this._y2)},Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothAbs.prototype,"x",{get:function(){return this._x},set:function(en){this._x=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothAbs.prototype,"y",{get:function(){return this._y},set:function(en){this._y=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothAbs.prototype,"x2",{get:function(){return this._x2},set:function(en){this._x2=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothAbs.prototype,"y2",{get:function(){return this._y2},set:function(en){this._y2=en,this._segmentChanged()},enumerable:!0}),window.SVGPathSegCurvetoCubicSmoothRel=function(en,tn,nn,rn,an){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL,"s",en),this._x=tn,this._y=nn,this._x2=rn,this._y2=an},window.SVGPathSegCurvetoCubicSmoothRel.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegCurvetoCubicSmoothRel.prototype.toString=function(){return"[object SVGPathSegCurvetoCubicSmoothRel]"},window.SVGPathSegCurvetoCubicSmoothRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x2+" "+this._y2+" "+this._x+" "+this._y},window.SVGPathSegCurvetoCubicSmoothRel.prototype.clone=function(){return new window.SVGPathSegCurvetoCubicSmoothRel(void 0,this._x,this._y,this._x2,this._y2)},Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothRel.prototype,"x",{get:function(){return this._x},set:function(en){this._x=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothRel.prototype,"y",{get:function(){return this._y},set:function(en){this._y=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothRel.prototype,"x2",{get:function(){return this._x2},set:function(en){this._x2=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothRel.prototype,"y2",{get:function(){return this._y2},set:function(en){this._y2=en,this._segmentChanged()},enumerable:!0}),window.SVGPathSegCurvetoQuadraticSmoothAbs=function(en,tn,nn){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS,"T",en),this._x=tn,this._y=nn},window.SVGPathSegCurvetoQuadraticSmoothAbs.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegCurvetoQuadraticSmoothAbs.prototype.toString=function(){return"[object SVGPathSegCurvetoQuadraticSmoothAbs]"},window.SVGPathSegCurvetoQuadraticSmoothAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y},window.SVGPathSegCurvetoQuadraticSmoothAbs.prototype.clone=function(){return new window.SVGPathSegCurvetoQuadraticSmoothAbs(void 0,this._x,this._y)},Object.defineProperty(window.SVGPathSegCurvetoQuadraticSmoothAbs.prototype,"x",{get:function(){return this._x},set:function(en){this._x=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoQuadraticSmoothAbs.prototype,"y",{get:function(){return this._y},set:function(en){this._y=en,this._segmentChanged()},enumerable:!0}),window.SVGPathSegCurvetoQuadraticSmoothRel=function(en,tn,nn){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL,"t",en),this._x=tn,this._y=nn},window.SVGPathSegCurvetoQuadraticSmoothRel.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegCurvetoQuadraticSmoothRel.prototype.toString=function(){return"[object SVGPathSegCurvetoQuadraticSmoothRel]"},window.SVGPathSegCurvetoQuadraticSmoothRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y},window.SVGPathSegCurvetoQuadraticSmoothRel.prototype.clone=function(){return new window.SVGPathSegCurvetoQuadraticSmoothRel(void 0,this._x,this._y)},Object.defineProperty(window.SVGPathSegCurvetoQuadraticSmoothRel.prototype,"x",{get:function(){return this._x},set:function(en){this._x=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoQuadraticSmoothRel.prototype,"y",{get:function(){return this._y},set:function(en){this._y=en,this._segmentChanged()},enumerable:!0}),window.SVGPathElement.prototype.createSVGPathSegClosePath=function(){return new window.SVGPathSegClosePath(void 0)},window.SVGPathElement.prototype.createSVGPathSegMovetoAbs=function(en,tn){return new window.SVGPathSegMovetoAbs(void 0,en,tn)},window.SVGPathElement.prototype.createSVGPathSegMovetoRel=function(en,tn){return new window.SVGPathSegMovetoRel(void 0,en,tn)},window.SVGPathElement.prototype.createSVGPathSegLinetoAbs=function(en,tn){return new window.SVGPathSegLinetoAbs(void 0,en,tn)},window.SVGPathElement.prototype.createSVGPathSegLinetoRel=function(en,tn){return new window.SVGPathSegLinetoRel(void 0,en,tn)},window.SVGPathElement.prototype.createSVGPathSegCurvetoCubicAbs=function(en,tn,nn,rn,an,sn){return new window.SVGPathSegCurvetoCubicAbs(void 0,en,tn,nn,rn,an,sn)},window.SVGPathElement.prototype.createSVGPathSegCurvetoCubicRel=function(en,tn,nn,rn,an,sn){return new window.SVGPathSegCurvetoCubicRel(void 0,en,tn,nn,rn,an,sn)},window.SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticAbs=function(en,tn,nn,rn){return new window.SVGPathSegCurvetoQuadraticAbs(void 0,en,tn,nn,rn)},window.SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticRel=function(en,tn,nn,rn){return new window.SVGPathSegCurvetoQuadraticRel(void 0,en,tn,nn,rn)},window.SVGPathElement.prototype.createSVGPathSegArcAbs=function(en,tn,nn,rn,an,sn,cn){return new window.SVGPathSegArcAbs(void 0,en,tn,nn,rn,an,sn,cn)},window.SVGPathElement.prototype.createSVGPathSegArcRel=function(en,tn,nn,rn,an,sn,cn){return new window.SVGPathSegArcRel(void 0,en,tn,nn,rn,an,sn,cn)},window.SVGPathElement.prototype.createSVGPathSegLinetoHorizontalAbs=function(en){return new window.SVGPathSegLinetoHorizontalAbs(void 0,en)},window.SVGPathElement.prototype.createSVGPathSegLinetoHorizontalRel=function(en){return new window.SVGPathSegLinetoHorizontalRel(void 0,en)},window.SVGPathElement.prototype.createSVGPathSegLinetoVerticalAbs=function(en){return new window.SVGPathSegLinetoVerticalAbs(void 0,en)},window.SVGPathElement.prototype.createSVGPathSegLinetoVerticalRel=function(en){return new window.SVGPathSegLinetoVerticalRel(void 0,en)},window.SVGPathElement.prototype.createSVGPathSegCurvetoCubicSmoothAbs=function(en,tn,nn,rn){return new window.SVGPathSegCurvetoCubicSmoothAbs(void 0,en,tn,nn,rn)},window.SVGPathElement.prototype.createSVGPathSegCurvetoCubicSmoothRel=function(en,tn,nn,rn){return new window.SVGPathSegCurvetoCubicSmoothRel(void 0,en,tn,nn,rn)},window.SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticSmoothAbs=function(en,tn){return new window.SVGPathSegCurvetoQuadraticSmoothAbs(void 0,en,tn)},window.SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticSmoothRel=function(en,tn){return new window.SVGPathSegCurvetoQuadraticSmoothRel(void 0,en,tn)},"getPathSegAtLength"in window.SVGPathElement.prototype||(window.SVGPathElement.prototype.getPathSegAtLength=function(en){if(void 0===en||!isFinite(en))throw"Invalid arguments.";var tn=document.createElementNS("http://www.w3.org/2000/svg","path");tn.setAttribute("d",this.getAttribute("d"));var nn=tn.pathSegList.numberOfItems-1;if(nn<=0)return 0;do{if(tn.pathSegList.removeItem(nn),en>tn.getTotalLength())break;nn--}while(nn>0);return nn})),"SVGPathSegList"in window&&"appendItem"in window.SVGPathSegList.prototype||(window.SVGPathSegList=function(en){this._pathElement=en,this._list=this._parsePath(this._pathElement.getAttribute("d")),this._mutationObserverConfig={attributes:!0,attributeFilter:["d"]},this._pathElementMutationObserver=new MutationObserver(this._updateListFromPathMutations.bind(this)),this._pathElementMutationObserver.observe(this._pathElement,this._mutationObserverConfig)},window.SVGPathSegList.prototype.classname="SVGPathSegList",Object.defineProperty(window.SVGPathSegList.prototype,"numberOfItems",{get:function(){return this._checkPathSynchronizedToList(),this._list.length},enumerable:!0}),Object.defineProperty(window.SVGPathSegList.prototype,"length",{get:function(){return this._checkPathSynchronizedToList(),this._list.length},enumerable:!0}),Object.defineProperty(window.SVGPathElement.prototype,"pathSegList",{get:function(){return this._pathSegList||(this._pathSegList=new window.SVGPathSegList(this)),this._pathSegList},enumerable:!0}),Object.defineProperty(window.SVGPathElement.prototype,"normalizedPathSegList",{get:function(){return this.pathSegList},enumerable:!0}),Object.defineProperty(window.SVGPathElement.prototype,"animatedPathSegList",{get:function(){return this.pathSegList},enumerable:!0}),Object.defineProperty(window.SVGPathElement.prototype,"animatedNormalizedPathSegList",{get:function(){return this.pathSegList},enumerable:!0}),window.SVGPathSegList.prototype._checkPathSynchronizedToList=function(){this._updateListFromPathMutations(this._pathElementMutationObserver.takeRecords())},window.SVGPathSegList.prototype._updateListFromPathMutations=function(en){if(this._pathElement){var tn=!1;en.forEach((function(en){"d"==en.attributeName&&(tn=!0)})),tn&&(this._list=this._parsePath(this._pathElement.getAttribute("d")))}},window.SVGPathSegList.prototype._writeListToPath=function(){this._pathElementMutationObserver.disconnect(),this._pathElement.setAttribute("d",window.SVGPathSegList._pathSegArrayAsString(this._list)),this._pathElementMutationObserver.observe(this._pathElement,this._mutationObserverConfig)},window.SVGPathSegList.prototype.segmentChanged=function(en){this._writeListToPath()},window.SVGPathSegList.prototype.clear=function(){this._checkPathSynchronizedToList(),this._list.forEach((function(en){en._owningPathSegList=null})),this._list=[],this._writeListToPath()},window.SVGPathSegList.prototype.initialize=function(en){return this._checkPathSynchronizedToList(),this._list=[en],en._owningPathSegList=this,this._writeListToPath(),en},window.SVGPathSegList.prototype._checkValidIndex=function(en){if(isNaN(en)||en<0||en>=this.numberOfItems)throw"INDEX_SIZE_ERR"},window.SVGPathSegList.prototype.getItem=function(en){return this._checkPathSynchronizedToList(),this._checkValidIndex(en),this._list[en]},window.SVGPathSegList.prototype.insertItemBefore=function(en,tn){return this._checkPathSynchronizedToList(),tn>this.numberOfItems&&(tn=this.numberOfItems),en._owningPathSegList&&(en=en.clone()),this._list.splice(tn,0,en),en._owningPathSegList=this,this._writeListToPath(),en},window.SVGPathSegList.prototype.replaceItem=function(en,tn){return this._checkPathSynchronizedToList(),en._owningPathSegList&&(en=en.clone()),this._checkValidIndex(tn),this._list[tn]=en,en._owningPathSegList=this,this._writeListToPath(),en},window.SVGPathSegList.prototype.removeItem=function(en){this._checkPathSynchronizedToList(),this._checkValidIndex(en);var tn=this._list[en];return this._list.splice(en,1),this._writeListToPath(),tn},window.SVGPathSegList.prototype.appendItem=function(en){return this._checkPathSynchronizedToList(),en._owningPathSegList&&(en=en.clone()),this._list.push(en),en._owningPathSegList=this,this._writeListToPath(),en},window.SVGPathSegList._pathSegArrayAsString=function(en){var tn="",nn=!0;return en.forEach((function(en){nn?(nn=!1,tn+=en._asPathString()):tn+=" "+en._asPathString()})),tn},window.SVGPathSegList.prototype._parsePath=function(en){if(!en||0==en.length)return[];var tn=this,Builder=function(){this.pathSegList=[]};Builder.prototype.appendSegment=function(en){this.pathSegList.push(en)};var Source=function(en){this._string=en,this._currentIndex=0,this._endIndex=this._string.length,this._previousCommand=window.SVGPathSeg.PATHSEG_UNKNOWN,this._skipOptionalSpaces()};Source.prototype._isCurrentSpace=function(){var en=this._string[this._currentIndex];return en<=" "&&(" "==en||"\n"==en||"\t"==en||"\r"==en||"\f"==en)},Source.prototype._skipOptionalSpaces=function(){for(;this._currentIndex="0"&&en<="9")&&tn!=window.SVGPathSeg.PATHSEG_CLOSEPATH?tn==window.SVGPathSeg.PATHSEG_MOVETO_ABS?window.SVGPathSeg.PATHSEG_LINETO_ABS:tn==window.SVGPathSeg.PATHSEG_MOVETO_REL?window.SVGPathSeg.PATHSEG_LINETO_REL:tn:window.SVGPathSeg.PATHSEG_UNKNOWN},Source.prototype.initialCommandIsMoveTo=function(){if(!this.hasMoreData())return!0;var en=this.peekSegmentType();return en==window.SVGPathSeg.PATHSEG_MOVETO_ABS||en==window.SVGPathSeg.PATHSEG_MOVETO_REL},Source.prototype._parseNumber=function(){var en=0,tn=0,nn=1,rn=0,an=1,sn=1,cn=this._currentIndex;if(this._skipOptionalSpaces(),this._currentIndex"9")&&"."!=this._string.charAt(this._currentIndex))){for(var An=this._currentIndex;this._currentIndex="0"&&this._string.charAt(this._currentIndex)<="9";)this._currentIndex++;if(this._currentIndex!=An)for(var dn=this._currentIndex-1,un=1;dn>=An;)tn+=un*(this._string.charAt(dn--)-"0"),un*=10;if(this._currentIndex=this._endIndex||this._string.charAt(this._currentIndex)<"0"||this._string.charAt(this._currentIndex)>"9")return;for(;this._currentIndex="0"&&this._string.charAt(this._currentIndex)<="9";)nn*=10,rn+=(this._string.charAt(this._currentIndex)-"0")/nn,this._currentIndex+=1}if(this._currentIndex!=cn&&this._currentIndex+1=this._endIndex||this._string.charAt(this._currentIndex)<"0"||this._string.charAt(this._currentIndex)>"9")return;for(;this._currentIndex="0"&&this._string.charAt(this._currentIndex)<="9";)en*=10,en+=this._string.charAt(this._currentIndex)-"0",this._currentIndex++}var pn=tn+rn;if(pn*=an,en&&(pn*=Math.pow(10,sn*en)),cn!=this._currentIndex)return this._skipOptionalSpacesOrDelimiter(),pn}},Source.prototype._parseArcFlag=function(){if(!(this._currentIndex>=this._endIndex)){var en=!1,tn=this._string.charAt(this._currentIndex++);if("0"==tn)en=!1;else{if("1"!=tn)return;en=!0}return this._skipOptionalSpacesOrDelimiter(),en}},Source.prototype.parseSegment=function(){var en=this._string[this._currentIndex],nn=this._pathSegTypeFromChar(en);if(nn==window.SVGPathSeg.PATHSEG_UNKNOWN){if(this._previousCommand==window.SVGPathSeg.PATHSEG_UNKNOWN)return null;if((nn=this._nextCommandHelper(en,this._previousCommand))==window.SVGPathSeg.PATHSEG_UNKNOWN)return null}else this._currentIndex++;switch(this._previousCommand=nn,nn){case window.SVGPathSeg.PATHSEG_MOVETO_REL:return new window.SVGPathSegMovetoRel(tn,this._parseNumber(),this._parseNumber());case window.SVGPathSeg.PATHSEG_MOVETO_ABS:return new window.SVGPathSegMovetoAbs(tn,this._parseNumber(),this._parseNumber());case window.SVGPathSeg.PATHSEG_LINETO_REL:return new window.SVGPathSegLinetoRel(tn,this._parseNumber(),this._parseNumber());case window.SVGPathSeg.PATHSEG_LINETO_ABS:return new window.SVGPathSegLinetoAbs(tn,this._parseNumber(),this._parseNumber());case window.SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL:return new window.SVGPathSegLinetoHorizontalRel(tn,this._parseNumber());case window.SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS:return new window.SVGPathSegLinetoHorizontalAbs(tn,this._parseNumber());case window.SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL:return new window.SVGPathSegLinetoVerticalRel(tn,this._parseNumber());case window.SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS:return new window.SVGPathSegLinetoVerticalAbs(tn,this._parseNumber());case window.SVGPathSeg.PATHSEG_CLOSEPATH:return this._skipOptionalSpaces(),new window.SVGPathSegClosePath(tn);case window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL:var rn={x1:this._parseNumber(),y1:this._parseNumber(),x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new window.SVGPathSegCurvetoCubicRel(tn,rn.x,rn.y,rn.x1,rn.y1,rn.x2,rn.y2);case window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS:return rn={x1:this._parseNumber(),y1:this._parseNumber(),x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()},new window.SVGPathSegCurvetoCubicAbs(tn,rn.x,rn.y,rn.x1,rn.y1,rn.x2,rn.y2);case window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL:return rn={x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()},new window.SVGPathSegCurvetoCubicSmoothRel(tn,rn.x,rn.y,rn.x2,rn.y2);case window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:return rn={x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()},new window.SVGPathSegCurvetoCubicSmoothAbs(tn,rn.x,rn.y,rn.x2,rn.y2);case window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL:return rn={x1:this._parseNumber(),y1:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()},new window.SVGPathSegCurvetoQuadraticRel(tn,rn.x,rn.y,rn.x1,rn.y1);case window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS:return rn={x1:this._parseNumber(),y1:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()},new window.SVGPathSegCurvetoQuadraticAbs(tn,rn.x,rn.y,rn.x1,rn.y1);case window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL:return new window.SVGPathSegCurvetoQuadraticSmoothRel(tn,this._parseNumber(),this._parseNumber());case window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS:return new window.SVGPathSegCurvetoQuadraticSmoothAbs(tn,this._parseNumber(),this._parseNumber());case window.SVGPathSeg.PATHSEG_ARC_REL:return rn={x1:this._parseNumber(),y1:this._parseNumber(),arcAngle:this._parseNumber(),arcLarge:this._parseArcFlag(),arcSweep:this._parseArcFlag(),x:this._parseNumber(),y:this._parseNumber()},new window.SVGPathSegArcRel(tn,rn.x,rn.y,rn.x1,rn.y1,rn.arcAngle,rn.arcLarge,rn.arcSweep);case window.SVGPathSeg.PATHSEG_ARC_ABS:return rn={x1:this._parseNumber(),y1:this._parseNumber(),arcAngle:this._parseNumber(),arcLarge:this._parseArcFlag(),arcSweep:this._parseArcFlag(),x:this._parseNumber(),y:this._parseNumber()},new window.SVGPathSegArcAbs(tn,rn.x,rn.y,rn.x1,rn.y1,rn.arcAngle,rn.arcLarge,rn.arcSweep);default:throw"Unknown path seg type."}};var nn=new Builder,rn=new Source(en);if(!rn.initialCommandIsMoveTo())return[];for(;rn.hasMoreData();){var an=rn.parseSegment();if(!an)return[];nn.appendSegment(an)}return nn.pathSegList}));class Paint{constructor(en){const tn=en||{};if(this.alpha=isNaN(tn.alpha)?100:tn.alpha,tn.copy)switch(this.type=tn.copy.type,this.alpha=tn.copy.alpha,this.solidColor=null,this.linearGradient=null,this.radialGradient=null,this.type){case"none":break;case"solidColor":this.solidColor=tn.copy.solidColor;break;case"linearGradient":this.linearGradient=tn.copy.linearGradient.cloneNode(!0);break;case"radialGradient":this.radialGradient=tn.copy.radialGradient.cloneNode(!0)}else if(tn.linearGradient)if(this.type="linearGradient",this.solidColor=null,this.radialGradient=null,tn.linearGradient.hasAttribute("xlink:href")){const en=document.getElementById(tn.linearGradient.getAttribute("xlink:href").substr(1));this.linearGradient=en.cloneNode(!0)}else this.linearGradient=tn.linearGradient.cloneNode(!0);else if(tn.radialGradient)if(this.type="radialGradient",this.solidColor=null,this.linearGradient=null,tn.radialGradient.hasAttribute("xlink:href")){const en=document.getElementById(tn.radialGradient.getAttribute("xlink:href").substr(1));this.radialGradient=en.cloneNode(!0)}else this.radialGradient=tn.radialGradient.cloneNode(!0);else tn.solidColor?(this.type="solidColor",this.solidColor=tn.solidColor):(this.type="none",this.solidColor=null,this.linearGradient=null,this.radialGradient=null)}} /** * Tools for working with units. * @module units * @license MIT * * @copyright 2010 Alexis Deveria, 2010 Jeff Schiller */const fa="http://www.w3.org/2000/svg",ya=["x","x1","cx","rx","width"],ba=["y","y1","cy","ry","height"],va=["r","radius",...ya,...ba];let wa,xa={};const getTypeMap$2=()=>xa,shortFloat=en=>{const tn=wa.getRoundDigits();return isNaN(en)?Array.isArray(en)?shortFloat(en[0])+","+shortFloat(en[1]):Number.parseFloat(en).toFixed(tn)-0:Number(Number(en).toFixed(tn))},convertUnit$3=(en,tn)=>(tn=tn||wa.getBaseUnit(),shortFloat(en/xa[tn])),setUnitAttr=(en,tn,nn)=>{en.setAttribute(tn,nn)},convertToNum=(en,tn)=>{if(!isNaN(tn))return tn-0;if("%"===tn.substr(-1)){const nn=tn.substr(0,tn.length-1)/100,rn=wa.getWidth(),an=wa.getHeight();return ya.includes(en)?nn*rn:ba.includes(en)?nn*an:nn*Math.sqrt(rn*rn+an*an)/Math.sqrt(2)}const nn=tn.substr(-2);return tn.substr(0,tn.length-2)*xa[nn]},ka={HTML:"http://www.w3.org/1999/xhtml",MATH:"http://www.w3.org/1998/Math/MathML",SE:"http://svg-edit.googlecode.com",SVG:"http://www.w3.org/2000/svg",XLINK:"http://www.w3.org/1999/xlink",OI:"http://www.optimistik.fr/namespace/svg/OIdata",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"},getReverseNS=function(){const en={};return Object.entries(ka).forEach((tn=>{let[nn,rn]=tn;en[rn]=nn.toLowerCase()})),en},Ca=document.createElementNS(ka.SVG,"svg"),transformPoint=function(en,tn,nn){return{x:nn.a*en+nn.c*tn+nn.e,y:nn.b*en+nn.d*tn+nn.f}},isIdentity=function(en){return 1===en.a&&0===en.b&&0===en.c&&1===en.d&&0===en.e&&0===en.f},matrixMultiply=function(){for(var en=arguments.length,tn=new Array(en),nn=0;nntn.multiply(en)));return Math.abs(rn.a)<1e-14&&(rn.a=0),Math.abs(rn.b)<1e-14&&(rn.b=0),Math.abs(rn.c)<1e-14&&(rn.c=0),Math.abs(rn.d)<1e-14&&(rn.d=0),Math.abs(rn.e)<1e-14&&(rn.e=0),Math.abs(rn.f)<1e-14&&(rn.f=0),rn},hasMatrixTransform=function(en){if(!en)return!1;let tn=en.numberOfItems;for(;tn--;){const nn=en.getItem(tn);if(1===nn.type&&!isIdentity(nn.matrix))return!0}return!1},transformBox=function(en,tn,nn,rn,an){const sn=transformPoint(en,tn,an),cn=transformPoint(en+nn,tn,an),An=transformPoint(en,tn+rn,an),dn=transformPoint(en+nn,tn+rn,an),un=Math.min(sn.x,cn.x,An.x,dn.x),pn=Math.max(sn.x,cn.x,An.x,dn.x),hn=Math.min(sn.y,cn.y,An.y,dn.y);return{tl:sn,tr:cn,bl:An,br:dn,aabox:{x:un,y:hn,width:pn-un,height:Math.max(sn.y,cn.y,An.y,dn.y)-hn}}},transformListToTransform=function(en,tn,nn){if(!en)return Ca.createSVGTransformFromMatrix(Ca.createSVGMatrix());if(tn=tn||0,nn=nn||en.numberOfItems-1,(tn=Number.parseInt(tn))>(nn=Number.parseInt(nn))){const en=nn;nn=tn,tn=en}let rn=Ca.createSVGMatrix();for(let an=tn;an<=nn;++an){const tn=an>=0&&an{const tn=en.transform.baseVal;return transformListToTransform(tn).matrix},snapToAngle=(en,tn,nn,rn)=>{const an=Math.PI/4,sn=nn-en,cn=rn-tn,An=Math.atan2(cn,sn),dn=Math.sqrt(sn*sn+cn*cn),un=Math.round(An/an)*an;return{x:en+dn*Math.cos(un),y:tn+dn*Math.sin(un),a:un}},rectsIntersect=(en,tn)=>tn.xen.x&&tn.yen.y;function isObject$9(en){return en&&"object"==typeof en&&!Array.isArray(en)}function mergeDeep$1(en,tn){const nn=Object.assign({},en);return isObject$9(en)&&isObject$9(tn)&&Object.keys(tn).forEach((rn=>{isObject$9(tn[rn])?rn in en?nn[rn]=mergeDeep$1(en[rn],tn[rn]):Object.assign(nn,{[rn]:tn[rn]}):Object.assign(nn,{[rn]:tn[rn]})})),nn}function getClosest(en,tn){const nn=tn.charAt(0),rn="classList"in document.documentElement;let an,sn;for("["===nn&&(an=(tn=tn.substr(1,tn.length-2)).split("="),an.length>1&&(sn=!0,an[1]=an[1].replace(/"/g,"").replace(/'/g,"")));en&&en!==document&&1===en.nodeType;en=en.parentNode){if("."===nn)if(rn){if(en.classList.contains(tn.substr(1)))return en}else if(new RegExp("(^|\\s)"+tn.substr(1)+"(\\s|$)").test(en.className))return en;if("#"===nn&&en.id===tn.substr(1))return en;if("["===nn&&en.hasAttribute(an[0])){if(!sn)return en;if(en.getAttribute(an[0])===an[1])return en}if(en.tagName.toLowerCase()===tn)return en}return null}function getParents(en,tn){const nn=[],rn=null==tn?void 0:tn.charAt(0);for(;en&&en!==document;en=en.parentNode)tn?("."===rn&&en.classList.contains(tn.substr(1))&&nn.push(en),"#"===rn&&en.id===tn.substr(1)&&nn.push(en),"["===rn&&en.hasAttribute(tn.substr(1,tn.length-1))&&nn.push(en),en.tagName.toLowerCase()===tn&&nn.push(en)):nn.push(en);return nn.length?nn:null} /** * Miscellaneous utilities. * @module utilities * @license MIT * * @copyright 2010 Alexis Deveria, 2010 Jeff Schiller */const Sa="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use,clipPath".split(",");let Ba=null,Ea=null;const toXml=en=>en.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'");function encode64(en){return en=encodeUTF8(en),window.btoa(en)}function decode64$1(en){return function decodeUTF8(en){return decodeURIComponent(escape(en))}(window.atob(en))}const encodeUTF8=en=>unescape(encodeURIComponent(en)),createObjectURL=en=>en&&"undefined"!=typeof URL&&URL.createObjectURL?URL.createObjectURL(en):"",ja=(()=>{if("undefined"==typeof Blob)return"";const en=new Blob(["SVG-edit "],{type:"text/html"});return createObjectURL(en)})(),text2xml=en=>{let tn,nn;en.includes("{if(1===(null==en?void 0:en.nodeType)){tn(en);let nn=en.childNodes.length;for(;nn--;)walkTree(en.childNodes.item(nn),tn)}},getUrlFromAttr=function(en){if(en){if(en.startsWith('url("'))return en.substring(5,en.indexOf('"',6));if(en.startsWith("url('"))return en.substring(5,en.indexOf("'",6));if(en.startsWith("url("))return en.substring(4,en.indexOf(")"))}return null};let getHref=function(en){return en.getAttributeNS(ka.XLINK,"href")},setHref=function(en,tn){en.setAttributeNS(ka.XLINK,"xlink:href",tn)};const findDefs=function(){const en=Ba.getSvgContent();let tn=en.getElementsByTagNameNS(ka.SVG,"defs");return tn.length>0?tn=tn[0]:(tn=en.ownerDocument.createElementNS(ka.SVG,"defs"),en.firstChild?en.insertBefore(tn,en.firstChild.nextSibling):en.append(tn)),tn},getBBox=function(en){const tn=en||Ba.getSelectedElements()[0];if(1!==en.nodeType)return null;const nn=tn.nodeName;let rn=null;switch(nn){case"text":""===tn.textContent?(tn.textContent="a",rn=tn.getBBox(),tn.textContent=""):tn.getBBox&&(rn=tn.getBBox());break;case"path":case"g":case"a":tn.getBBox&&(rn=tn.getBBox());break;default:if("use"===nn)rn=tn.getBBox();else if(Sa.includes(nn))if(tn)try{rn=tn.getBBox()}catch(en){const nn=tn.getExtentOfChar(0),an=tn.getComputedTextLength();rn={x:nn.x,y:nn.y,width:an,height:nn.height}}else{const en=getClosest(tn.parentNode,"foreignObject");en.length&&en[0].getBBox&&(rn=en[0].getBBox())}}return rn&&(rn=(en=>{let{x:tn,y:nn,width:rn,height:an}=en;return{x:tn,y:nn,width:rn,height:an}})(rn)),rn},getPathDFromSegments=function(en){let tn="";return en.forEach((function(en,nn){let[rn,an]=en;tn+=rn;for(let en=0;en-.001&&nn<.001||nn<-89.99||nn>89.99)}(sn,cn))if(["ellipse","path","line","polyline","polygon"].includes(en.tagName))An=getBBoxOfElementAsPath(en,tn,nn),rn=An;else if("rect"===en.tagName){const an=Number(en.getAttribute("rx")),sn=Number(en.getAttribute("ry"));(an||sn)&&(An=getBBoxOfElementAsPath(en,tn,nn),rn=An)}if(!An){const{matrix:en}=transformListToTransform(an);rn=transformBox(rn.x,rn.y,rn.width,rn.height,en).aabox}}return rn},getStrokeOffsetForBBox=en=>{const tn=en.getAttribute("stroke-width");return isNaN(tn)||"none"===en.getAttribute("stroke")?0:tn/2},getStrokedBBox=(en,tn,nn)=>{if(!en||!en.length)return!1;let rn;if(en.forEach((en=>{rn||en.parentNode&&(rn=getBBoxWithTransform(en,tn,nn))})),!rn)return null;let an=rn.x+rn.width,sn=rn.y+rn.height,cn=rn.x,An=rn.y;if(1===en.length){const tn=getStrokeOffsetForBBox(en[0]);cn-=tn,An-=tn,an+=tn,sn+=tn}else en.forEach((en=>{const rn=getBBoxWithTransform(en,tn,nn);if(rn){const tn=getStrokeOffsetForBBox(en);cn=Math.min(cn,rn.x-tn),An=Math.min(An,rn.y-tn),1===en.nodeType&&(an=Math.max(an,rn.x+rn.width+tn),sn=Math.max(sn,rn.y+rn.height+tn))}}));return rn.x=cn,rn.y=An,rn.width=an-cn,rn.height=sn-An,rn},getVisibleElements=en=>{en||(en=Ba.getSvgContent().children[0]);const tn=[],nn=en.children;return Array.from(nn,(en=>{en.getBBox&&tn.push(en)})),tn.reverse()},getStrokedBBoxDefaultVisible=en=>(en||(en=getVisibleElements()),getStrokedBBox(en,Ba.addSVGElementsFromJson,Ba.pathActions)),getRotationAngleFromTransformList=(en,tn)=>{if(!en)return 0;for(let nn=0;nn{var nn;const rn=null===(nn=(en||Ba.getSelectedElements()[0]).transform)||void 0===nn?void 0:nn.baseVal;return getRotationAngleFromTransformList(rn,tn)};const getRefElem=en=>getElement(getUrlFromAttr(en).substr(1)),getFeGaussianBlur=en=>{var tn;if("feGaussianBlur"===(null==en||null===(tn=en.firstChild)||void 0===tn?void 0:tn.tagName))return en.firstChild;{const tn=en.children;for(const[en,nn]of Object.entries(tn))if("feGaussianBlur"===nn.tagName)return nn}return null},getElement=en=>Ea.querySelector("#"+en),assignAttributes=(en,tn,nn,rn)=>{for(const[nn,an]of Object.entries(tn)){const tn="xml:"===nn.substr(0,4)?ka.XML:"xlink:"===nn.substr(0,6)?ka.XLINK:null;void 0!==an?tn?en.setAttributeNS(tn,nn,an):rn?setUnitAttr(en,nn,an):en.setAttribute(nn,an):tn?en.removeAttributeNS(tn,nn):en.removeAttribute(nn)}},cleanupElement=en=>{const tn={"fill-opacity":1,"stop-opacity":1,opacity:1,stroke:"none","stroke-dasharray":"none","stroke-linejoin":"miter","stroke-linecap":"butt","stroke-opacity":1,"stroke-width":1,rx:0,ry:0};"ellipse"===en.nodeName&&(delete tn.rx,delete tn.ry),Object.entries(tn).forEach((tn=>{let[nn,rn]=tn;en.getAttribute(nn)===String(rn)&&en.removeAttribute(nn)}))},snapToGrid=en=>{const tn=Ba.getBaseUnit();let nn=Ba.getSnappingStep();return"px"!==tn&&(nn*=getTypeMap$2()[tn]),Math.round(en/nn)*nn},preventClickDefault=en=>{$click$6(en,(en=>{en.preventDefault()}))},stringToHTML=en=>(new DOMParser).parseFromString(en,"text/html").body.firstChild,insertChildAtIndex=function(en,tn){let nn=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const rn=stringToHTML(tn);nn>=en.children.length?en.appendChild(rn):en.insertBefore(rn,en.children[nn])},$id$8=en=>document.getElementById(en),$qq$1=en=>document.querySelector(en),$qa$2=en=>[...document.querySelectorAll(en)],$click$6=(en,tn)=>{en.addEventListener("click",tn),en.addEventListener("touchend",tn)},La={BEFORE_APPLY:"before_apply",AFTER_APPLY:"after_apply",BEFORE_UNAPPLY:"before_unapply",AFTER_UNAPPLY:"after_unapply"};class Command{getText(){return this.text}apply(en,tn){en&&en.handleHistoryEvent(La.BEFORE_APPLY,this),tn(en),en&&en.handleHistoryEvent(La.AFTER_APPLY,this)}unapply(en,tn){en&&en.handleHistoryEvent(La.BEFORE_UNAPPLY,this),tn(),en&&en.handleHistoryEvent(La.AFTER_UNAPPLY,this)}elements(){return[this.elem]}type(){return this.constructor.name}}class MoveElementCommand$1 extends Command{constructor(en,tn,nn,rn){super(),this.elem=en,this.text=rn?"Move "+en.tagName+" to "+rn:"Move "+en.tagName,this.oldNextSibling=tn,this.oldParent=nn,this.newNextSibling=en.nextSibling,this.newParent=en.parentNode}apply(en){super.apply(en,(()=>{this.elem=this.newParent.insertBefore(this.elem,this.newNextSibling)}))}unapply(en){super.unapply(en,(()=>{this.elem=this.oldParent.insertBefore(this.elem,this.oldNextSibling)}))}}class InsertElementCommand$4 extends Command{constructor(en,tn){super(),this.elem=en,this.text=tn||"Create "+en.tagName,this.parent=en.parentNode,this.nextSibling=this.elem.nextSibling}apply(en){super.apply(en,(()=>{this.elem=this.parent.insertBefore(this.elem,this.nextSibling)}))}unapply(en){super.unapply(en,(()=>{this.parent=this.elem.parentNode,this.elem.remove()}))}}class RemoveElementCommand$2 extends Command{constructor(en,tn,nn,rn){super(),this.elem=en,this.text=rn||"Delete "+en.tagName,this.nextSibling=tn,this.parent=nn}apply(en){super.apply(en,(()=>{this.parent=this.elem.parentNode,this.elem.remove()}))}unapply(en){super.unapply(en,(()=>{this.nextSibling||console.error("Reference element was lost"),this.parent.insertBefore(this.elem,this.nextSibling)}))}}class ChangeElementCommand$2 extends Command{constructor(en,tn,nn){super(),this.elem=en,this.text=nn?"Change "+en.tagName+" "+nn:"Change "+en.tagName,this.newValues={},this.oldValues=tn;for(const nn in tn)this.newValues[nn]="#text"===nn?en?en.textContent:"":"#href"===nn?getHref(en):en.getAttribute(nn)}apply(en){super.apply(en,(()=>{let en=!1;if(Object.entries(this.newValues).forEach((tn=>{let[nn,rn]=tn;rn?"#text"===nn?this.elem.textContent=rn:"#href"===nn?setHref(this.elem,rn):this.elem.setAttribute(nn,rn):"#text"===nn?this.elem.textContent="":(this.elem.setAttribute(nn,""),this.elem.removeAttribute(nn)),"transform"===nn&&(en=!0)})),!en){const en=getRotationAngle(this.elem);if(en){const tn=getBBox(this.elem),nn=["rotate(",en," ",tn.x+tn.width/2,",",tn.y+tn.height/2,")"].join("");nn!==this.elem.getAttribute("transform")&&this.elem.setAttribute("transform",nn)}}}))}unapply(en){super.unapply(en,(()=>{let en=!1;if(Object.entries(this.oldValues).forEach((tn=>{let[nn,rn]=tn;rn?"#text"===nn?this.elem.textContent=rn:"#href"===nn?setHref(this.elem,rn):this.elem.setAttribute(nn,rn):"#text"===nn?this.elem.textContent="":this.elem.removeAttribute(nn),"transform"===nn&&(en=!0)})),!en){const en=getRotationAngle(this.elem);if(en){const tn=getBBox(this.elem),nn=["rotate(",en," ",tn.x+tn.width/2,",",tn.y+tn.height/2,")"].join("");nn!==this.elem.getAttribute("transform")&&this.elem.setAttribute("transform",nn)}}}))}}class BatchCommand$4 extends Command{constructor(en){super(),this.text=en||"Batch Command",this.stack=[]}apply(en){super.apply(en,(()=>{this.stack.forEach((tn=>{console.assert(tn,"stack item should not be null"),tn&&tn.apply(en)}))}))}unapply(en){super.unapply(en,(()=>{this.stack.reverse().forEach((tn=>{console.assert(tn,"stack item should not be null"),tn&&tn.unapply(en)}))}))}elements(){const en=[];let tn=this.stack.length;for(;tn--;){if(!this.stack[tn])continue;const nn=this.stack[tn].elements();let rn=nn.length;for(;rn--;)en.includes(nn[rn])||en.push(nn[rn])}return en}addSubCommand(en){console.assert(null!==en,"cmd should not be null"),this.stack.push(en)}isEmpty(){return!this.stack.length}}var Pa=Object.freeze({__proto__:null,HistoryEventTypes:La,Command:Command,MoveElementCommand:MoveElementCommand$1,InsertElementCommand:InsertElementCommand$4,RemoveElementCommand:RemoveElementCommand$2,ChangeElementCommand:ChangeElementCommand$2,BatchCommand:BatchCommand$4,UndoManager:class UndoManager$1{constructor(en){this.handler_=en||null,this.undoStackPointer=0,this.undoStack=[],this.undoChangeStackPointer=-1,this.undoableChangeStack=[]}resetUndoStack(){this.undoStack=[],this.undoStackPointer=0}getUndoStackSize(){return this.undoStackPointer}getRedoStackSize(){return this.undoStack.length-this.undoStackPointer}getNextUndoCommandText(){return this.undoStackPointer>0?this.undoStack[this.undoStackPointer-1].getText():""}getNextRedoCommandText(){return this.undoStackPointer0&&this.undoStack[--this.undoStackPointer].unapply(this.handler_)}redo(){this.undoStackPointer0&&this.undoStack[this.undoStackPointer++].apply(this.handler_)}addCommandToHistory(en){this.undoStackPointer0&&(this.undoStack=this.undoStack.splice(0,this.undoStackPointer)),this.undoStack.push(en),this.undoStackPointer=this.undoStack.length}beginUndoableChange(en,tn){const nn=++this.undoChangeStackPointer;let rn=tn.length;const an=new Array(rn),sn=new Array(rn);for(;rn--;){const nn=tn[rn];nn&&(sn[rn]=nn,an[rn]=nn.getAttribute(en))}this.undoableChangeStack[nn]={attrName:en,oldValues:an,elements:sn}}finishUndoableChange(){const en=this.undoChangeStackPointer--,tn=this.undoableChangeStack[en],{attrName:nn}=tn,rn=new BatchCommand$4("Change "+nn);let an=tn.elements.length;for(;an--;){const en=tn.elements[an];if(!en)continue;const sn={};sn[nn]=tn.oldValues[an],sn[nn]!==en.getAttribute(nn)&&rn.addSubCommand(new ChangeElementCommand$2(en,sn,nn))}return this.undoableChangeStack[en]=null,rn}}}); /** * Path functionality. * @module path * @license MIT * * @copyright 2011 Alexis Deveria, 2011 Jeff Schiller */let Ta=null;const ptObjToArrMethod=function(en,tn){return Ta.getSegData()[en].map((en=>tn[en]))},getGripPtMethod=function(en,tn){const{path:nn}=en;let rn={x:tn?tn.x:en.item.x,y:tn?tn.y:en.item.y};nn.matrix&&(rn=transformPoint(rn.x,rn.y,nn.matrix));const an=Ta.getZoom();return rn.x*=an,rn.y*=an,rn},getPointFromGripMethod=function(en,tn){const nn={x:en.x,y:en.y};tn.matrix&&(en=transformPoint(nn.x,nn.y,tn.imatrix),nn.x=en.x,nn.y=en.y);const rn=Ta.getZoom();return nn.x/=rn,nn.y/=rn,nn},getGripContainerMethod=function(){let en=getElement("pathpointgrip_container");if(!en){const tn=getElement("selectorParentGroup");en=document.createElementNS(ka.SVG,"g"),tn.append(en),en.id="pathpointgrip_container"}return en},addPointGripMethod=function(en,tn,nn){const rn=getGripContainerMethod();let an=getElement("pathpointgrip_"+en);if(!an){var sn;an=document.createElementNS(ka.SVG,"circle");const tn={id:"pathpointgrip_"+en,display:"none",r:4,fill:"#0FF",stroke:"#00F","stroke-width":2,cursor:"move",style:"pointer-events:all"},nn=Ta.getUIStrings();"pathNodeTooltip"in nn&&(tn["xlink:title"]=nn.pathNodeTooltip),assignAttributes(an,tn),rn.append(an),null===(sn=document.getElementById("pathpointgrip_"+en))||void 0===sn||sn.addEventListener("dblclick",(()=>{const en=Ta.getPathObj();en&&en.setSegType()}))}return tn&&nn&&assignAttributes(an,{cx:tn,cy:nn,display:"inline"}),an},addCtrlGripMethod=function(en){let tn=getElement("ctrlpointgrip_"+en);if(tn)return tn;tn=document.createElementNS(ka.SVG,"circle");const nn={id:"ctrlpointgrip_"+en,display:"none",r:4,fill:"#0FF",stroke:"#55F","stroke-width":1,cursor:"move",style:"pointer-events:all"},rn=Ta.getUIStrings();return"pathCtrlPtTooltip"in rn&&(nn["xlink:title"]=rn.pathCtrlPtTooltip),assignAttributes(tn,nn),getGripContainerMethod().append(tn),tn},getCtrlLineMethod=function(en){let tn=getElement("ctrlLine_"+en);return tn||(tn=document.createElementNS(ka.SVG,"line"),assignAttributes(tn,{id:"ctrlLine_"+en,stroke:"#555","stroke-width":1,style:"pointer-events:none"}),getGripContainerMethod().append(tn),tn)},getPointGripMethod=function(en,tn){const{index:nn}=en,rn=addPointGripMethod(nn);if(tn){const tn=getGripPtMethod(en);assignAttributes(rn,{cx:tn.x,cy:tn.y,display:"inline"})}return rn},getControlPointsMethod=function(en){const{item:tn,index:nn}=en;if(!("x1"in tn)||!("x2"in tn))return null;const rn={};getGripContainerMethod();const an=[Ta.getPathObj().segs[nn-1].item,tn];for(let sn=1;sn<3;sn++){const cn=nn+"c"+sn,An=rn["c"+sn+"_line"]=getCtrlLineMethod(cn),dn=getGripPtMethod(en,{x:tn["x"+sn],y:tn["y"+sn]}),un=getGripPtMethod(en,{x:an[sn-1].x,y:an[sn-1].y});assignAttributes(An,{x1:dn.x,y1:dn.y,x2:un.x,y2:un.y,display:"inline"}),rn["c"+sn+"_line"]=An;const pn=rn["c"+sn]=addCtrlGripMethod(cn);assignAttributes(pn,{cx:dn.x,cy:dn.y,display:"inline"}),rn["c"+sn]=pn}return rn},replacePathSegMethod=function(en,tn,nn,rn){const an=Ta.getPathObj(),sn=rn||an.elem,cn=sn["createSVGPathSeg"+Ta.getPathFuncs()[en]](...nn);sn.pathSegList.replaceItem(cn,tn)},getSegSelectorMethod=function(en,tn){const{index:nn}=en;let rn=getElement("segline_"+nn);if(!rn){const en=getGripContainerMethod();rn=document.createElementNS(ka.SVG,"path"),assignAttributes(rn,{id:"segline_"+nn,display:"none",fill:"none",stroke:"#0FF","stroke-width":2,style:"pointer-events:none",d:"M0,0 0,0"}),en.append(rn)}if(tn){const{prev:tn}=en;if(!tn)return rn.setAttribute("display","none"),rn;const nn=getGripPtMethod(tn);replacePathSegMethod(2,0,[nn.x,nn.y],rn);const an=ptObjToArrMethod(en.type,en.item);for(let tn=0;tn element");this.elem=en,this.segs=[],this.selected_pts=[],Ta.setPathObj(this),this.init()}setPathContext(){Ta.setPathObj(this)}init(){const en=getGripContainerMethod().querySelectorAll("*");Array.prototype.forEach.call(en,(function(en){en.setAttribute("display","none")}));const tn=this.elem.pathSegList,nn=tn.numberOfItems;this.segs=[],this.selected_pts=[],this.first_seg=null;for(let en=0;en=nn?null:rn[en+1],cn=en-1<0?null:rn[en-1];if(2===tn.type){if(cn&&1!==cn.type){const en=rn[an];en.next=rn[an+1],en.next.prev=en,en.addGrip()}an=en}else if(1===(null==sn?void 0:sn.type))tn.next=rn[an+1],tn.next.prev=tn,tn.mate=rn[an],tn.addGrip(),this.first_seg||(this.first_seg=tn);else if(sn)1!==tn.type&&(tn.addGrip(),sn&&2!==sn.type&&(tn.next=sn,tn.next.prev=tn));else if(1!==tn.type){const en=rn[an];en.next=rn[an+1],en.next.prev=en,en.addGrip(),tn.addGrip(),this.first_seg||(this.first_seg=rn[an])}}return this}eachSeg(en){const tn=this.segs.length;for(let nn=0;nn{this.segs[en].ptgrip&&!this.selected_pts.includes(en)&&en>=0&&this.selected_pts.push(en)})),this.selected_pts.sort();let tn=this.selected_pts.length;const nn=[];for(nn.length=tn;tn--;){const en=this.selected_pts[tn],rn=this.segs[en];rn.select(!0),nn[tn]=rn.ptgrip}const rn=Path$1.subpathIsClosed(this.selected_pts[0]);Ta.addPtsToSelection({grips:nn,closedSubpath:rn})}static subpathIsClosed(en){let tn=!1;return Ta.getPathObj().eachSeg((function(nn){return nn<=en||2!==this.type&&(1!==this.type||(tn=!0,!1))})),tn}} /** * Path functionality. * @module path * @license MIT * * @copyright 2011 Alexis Deveria, 2011 Jeff Schiller */let Fa=null,Ua=null;const convertPath$1=function(en,tn){const{pathSegList:nn}=en,rn=nn.numberOfItems;let an=0,sn=0,cn="",An=null;for(let en=0;en=nn-an&&un<=nn+an&&pn>=cn-an&&pn<=cn+an){sn=!0;break}}cn=Fa.getId(),Fa.removePath_(cn);const An=getElement(cn);let fn,yn;const bn=en.numberOfItems;if(sn){if(rn<=1&&bn>=2){const tn=en.getItem(0).x,nn=en.getItem(0).y;yn=hn.pathSegList.getItem(1),fn=4===yn.pathSegType?mn.createSVGPathSegLinetoAbs(tn,nn):mn.createSVGPathSegCurvetoCubicAbs(tn,nn,yn.x1/dn,yn.y1/dn,tn,nn);const rn=mn.createSVGPathSegClosePath();en.appendItem(fn),en.appendItem(rn)}else if(bn<3)return _n=!1,_n;if(hn.remove(),Fa.setDrawnPath(null),Fa.setStarted(!1),nn){Ua.matrix&&Fa.remapElement(An,{},Ua.matrix.inverse());const en=An.getAttribute("d"),tn=Ua.elem.getAttribute("d");return Ua.elem.setAttribute("d",tn+en),An.parentNode.removeChild(An),Ua.matrix&&Fa.recalcRotatedPath(),Na.toEditMode(Ua.elem),Ua.selectPt(),!1}}else{if(Fa.getContainer()===Fa.getMouseTarget(tn)||!Fa.getContainer().contains(Fa.getMouseTarget(tn)))return!1;const en=mn.pathSegList.numberOfItems,rn=mn.pathSegList.getItem(en-1),an=rn.x,sn=rn.y;if(tn.shiftKey){const en=snapToAngle(an,sn,un,pn);({x:un,y:pn}=en)}yn=hn.pathSegList.getItem(1),fn=4===yn.pathSegType?mn.createSVGPathSegLinetoAbs(Fa.round(un),Fa.round(pn)):mn.createSVGPathSegCurvetoCubicAbs(Fa.round(un),Fa.round(pn),yn.x1/dn,yn.y1/dn,yn.x2/dn,yn.y2/dn),mn.pathSegList.appendItem(fn),un*=dn,pn*=dn,hn.setAttribute("d",["M",un,pn,un,pn].join(" ")),gn=en,nn&&(gn+=Ua.segs.length),Fa.addPointGrip(gn,un,pn)}}else{const en="M"+un+","+pn+" ";Fa.setDrawnPath(Fa.addSVGElementsFromJson({element:"path",curStyles:!0,attr:{d:en,id:Fa.getNextId(),opacity:Fa.getOpacity()/2}})),hn.setAttribute("d",["M",rn,An,rn,An].join(" ")),gn=nn?Ua.segs.length:0,Fa.addPointGrip(gn,rn,An)}}},mouseMove(nn,rn){const sn=Fa.getZoom();an=!0;const cn=Fa.getDrawnPath();if("path"!==Fa.getCurrentMode())if(Ua.dragging){const en=Fa.getPointFromGrip({x:Ua.dragging[0],y:Ua.dragging[1]},Ua),tn=Fa.getPointFromGrip({x:nn,y:rn},Ua),an=tn.x-en.x,sn=tn.y-en.y;Ua.dragging=[nn,rn],Ua.dragctrl?Ua.moveCtrl(an,sn):Ua.movePts(an,sn)}else Ua.selected_pts=[],Ua.eachSeg((function(en){const tn=this;if(!tn.next&&!tn.prev)return;const nn=Fa.getRubberBox(),rn=getBBox(nn),an=Fa.getGripPt(tn),sn={x:an.x,y:an.y,width:0,height:0},cn=rectsIntersect(rn,sn);this.select(cn),cn&&Ua.selected_pts.push(tn.index)}));else{if(!cn)return;const an=cn.pathSegList,An=an.numberOfItems-1;if(en){const dn=Fa.addCtrlGrip("1c1"),un=Fa.addCtrlGrip("0c2");dn.setAttribute("cx",nn),dn.setAttribute("cy",rn),dn.setAttribute("display","inline");const pn=en[0],hn=en[1],gn=pn+(pn-nn/sn),_n=hn+(hn-rn/sn);un.setAttribute("cx",gn*sn),un.setAttribute("cy",_n*sn),un.setAttribute("display","inline");const mn=Fa.getCtrlLine(1);if(assignAttributes(mn,{x1:nn,y1:rn,x2:gn*sn,y2:_n*sn,display:"inline"}),0===An)tn=[nn,rn];else{const en=an.getItem(An-1);let nn=en.x,rn=en.y;6===en.pathSegType?(nn+=nn-en.x2,rn+=rn-en.y2):tn&&(nn=tn[0]/sn,rn=tn[1]/sn),Fa.replacePathSeg(6,An,[pn,hn,nn,rn,gn,_n],cn)}}else{const en=getElement("path_stretch_line");if(en){const cn=an.getItem(An);if(6===cn.pathSegType){const tn=cn.x+(cn.x-cn.x2),an=cn.y+(cn.y-cn.y2);Fa.replacePathSeg(6,1,[nn,rn,tn*sn,an*sn,nn,rn],en)}else tn?Fa.replacePathSeg(6,1,[nn,rn,tn[0],tn[1],nn,rn],en):Fa.replacePathSeg(4,1,[nn,rn],en)}}}},mouseUp(nn,rn,sn,cn){const An=Fa.getDrawnPath();if("path"===Fa.getCurrentMode())return en=null,An||(rn=getElement(Fa.getId()),Fa.setStarted(!1),tn=null),{keep:!0,element:rn};const dn=Fa.getRubberBox();if(Ua.dragging){const en=Ua.cur_pt;Ua.dragging=!1,Ua.dragctrl=!1,Ua.update(),an&&Ua.endChanges("Move path point(s)"),nn.shiftKey||an||Ua.selectPt(en)}else"none"!==(null==dn?void 0:dn.getAttribute("display"))?(dn.setAttribute("display","none"),dn.getAttribute("width")<=2&&dn.getAttribute("height")<=2&&Na.toSelectMode(nn.target)):Na.toSelectMode(nn.target);an=!1},toEditMode(en){Ua=Fa.getPath_(en),Fa.setCurrentMode("pathedit"),Fa.clearSelection(),Ua.setPathContext(),Ua.show(!0).update(),Ua.oldbbox=getBBox(Ua.elem),nn=!1},toSelectMode(en){const tn=en===Ua.elem;Fa.setCurrentMode("select"),Ua.setPathContext(),Ua.show(!1),rn=!1,Fa.clearSelection(),Ua.matrix&&Fa.recalcRotatedPath(),tn&&(Fa.call("selected",[en]),Fa.addToSelection([en],!0))},addSubPath(en){en?(Fa.setCurrentMode("path"),nn=!0):(Na.clear(!0),Na.toEditMode(Ua.elem))},select(en){rn===en?(Na.toEditMode(en),Fa.setCurrentMode("pathedit")):rn=en},reorient(){const en=Fa.getSelectedElements()[0];if(!en)return;if(0===getRotationAngle(en))return;const tn=new BatchCommand$4("Reorient path"),nn={d:en.getAttribute("d"),transform:en.getAttribute("transform")};tn.addSubCommand(new ChangeElementCommand$2(en,nn)),Fa.clearSelection(),this.resetOrientation(en),Fa.addCommandToHistory(tn),Fa.getPath_(en).show(!1).matrix=null,this.clear(),Fa.addToSelection([en],!0),Fa.call("changed",Fa.getSelectedElements())},clear(){const en=Fa.getDrawnPath();if(rn=null,en){const en=getElement(Fa.getId()),nn=getElement("path_stretch_line");nn.parentNode.removeChild(nn),en.parentNode.removeChild(en);const rn=getElement("pathpointgrip_container").querySelectorAll("*");Array.prototype.forEach.call(rn,(function(en){en.setAttribute("display","none")})),tn=null,Fa.setDrawnPath(null),Fa.setStarted(!1)}else"pathedit"===Fa.getCurrentMode()&&this.toSelectMode();Ua&&Ua.init().show(!1)},resetOrientation(en){if("path"!==(null==en?void 0:en.nodeName))return!1;const tn=en.transform.baseVal,nn=transformListToTransform(tn).matrix;tn.clear(),en.removeAttribute("transform");const rn=en.pathSegList,an=rn.numberOfItems;for(let tn=0;tn0){const nn=en.getItem(tn-1).pathSegType;if(2===nn){remItems(tn-1,1),cleanup();break}if(1===nn&&en.numberOfItems-1===tn){remItems(tn,1),cleanup();break}}}return!1};if(cleanup(),Ua.elem.pathSegList.numberOfItems<=1)return Na.toSelectMode(Ua.elem),void Fa.canvas.deleteSelectedElements();Ua.init(),Ua.clearSelection(),window.opera&&Ua.elem.setAttribute("d",Ua.elem.getAttribute("d")),Ua.endChanges("Delete path node(s)")},smoothPolylineIntoPath:function(en){let tn;const{points:nn}=en,rn=nn.numberOfItems;if(rn>=4){let an=nn.getItem(0),sn=null,cn=[];for(cn.push(["M",an.x,",",an.y," C"].join("")),tn=1;tn<=rn-4;tn+=3){let en=nn.getItem(tn);const rn=nn.getItem(tn+1),An=nn.getItem(tn+2);if(sn){const tn=Fa.smoothControlPoints(sn,en,an);if(2===(null==tn?void 0:tn.length)){const nn=cn[cn.length-1].split(",");nn[2]=tn[0].x,nn[3]=tn[0].y,cn[cn.length-1]=nn.join(","),en=tn[1]}}cn.push([en.x,en.y,rn.x,rn.y,An.x,An.y].join(",")),an=An,sn=rn}for(cn.push("L");tn{Object.assign(Ra,en.ui)};let Oa=[],Qa=!0,qa={};const setLinkControlPoints=en=>{Qa=en};let Va=null;const init$g=en=>{Ma=en,Ma.replacePathSeg=replacePathSegMethod,Ma.addPointGrip=addPointGripMethod,Ma.removePath_=removePath_,Ma.getPath_=getPath_,Ma.addCtrlGrip=addCtrlGripMethod,Ma.getCtrlLine=getCtrlLineMethod,Ma.getGripPt=Da,Ma.getPointFromGrip=getPointFromGripMethod,Ma.setLinkControlPoints=setLinkControlPoints,Ma.reorientGrads=reorientGrads,Ma.getSegData=()=>Ia,Ma.getUIStrings=()=>Ra,Ma.getPathObj=()=>Va,Ma.setPathObj=en=>{Va=en},Ma.getPathFuncs=()=>Oa,Ma.getLinkControlPts=()=>Qa,Oa=[0,"ClosePath"],["Moveto","Lineto","CurvetoCubic","CurvetoQuadratic","Arc","LinetoHorizontal","LinetoVertical","CurvetoCubicSmooth","CurvetoQuadraticSmooth"].forEach((en=>{Oa.push(en+"Abs"),Oa.push(en+"Rel")})),(en=>{Fa=en})(Ma),(en=>{Ta=en})(Ma)},Ga=ptObjToArrMethod,Da=getGripPtMethod,Ha=getPointFromGripMethod,za=addPointGripMethod,Ka=getGripContainerMethod,$a=addCtrlGripMethod,Wa=getCtrlLineMethod,Xa=getPointGripMethod,Ya=getControlPointsMethod,Za=replacePathSegMethod,Ja=getSegSelectorMethod,smoothControlPoints=(en,tn,nn)=>{const rn=en.x-nn.x,an=en.y-nn.y,sn=tn.x-nn.x,cn=tn.y-nn.y;if(!(0===rn&&0===an||0===sn&&0===cn)){const en=Math.sqrt(rn*rn+an*an),tn=Math.sqrt(sn*sn+cn*cn),An=Ma.getSvgRoot().createSVGPoint(),dn=Ma.getSvgRoot().createSVGPoint();let un=Math.atan2(an,rn),pn=Math.atan2(cn,sn);un<0&&(un+=2*Math.PI),pn<0&&(pn+=2*Math.PI);const hn=Math.abs(un-pn),gn=Math.abs(Math.PI-hn)/2;let _n,mn;return un-pn>0?(_n=hn{let tn=qa[en.id];return tn||(tn=qa[en.id]=new Path$1(en)),tn},removePath_=en=>{en in qa&&delete qa[en]};let es,ts,ns,rs,os;const getRotVals=(en,tn)=>{let nn=en-ns,rn=tn-rs,an=Math.sqrt(nn*nn+rn*rn),sn=Math.atan2(rn,nn)+os;return nn=an*Math.cos(sn)+ns,rn=an*Math.sin(sn)+rs,nn-=es,rn-=ts,an=Math.sqrt(nn*nn+rn*rn),sn=Math.atan2(rn,nn)-os,{x:an*Math.cos(sn)+es,y:an*Math.sin(sn)+ts}},clearData=()=>{qa={}},reorientGrads=(en,tn)=>{const nn=getBBox(en);for(let rn=0;rn<2;rn++){const an=0===rn?"fill":"stroke",sn=en.getAttribute(an);if(sn&&sn.startsWith("url(")){const rn=getRefElem(sn);if("linearGradient"===rn.tagName){let sn=rn.getAttribute("x1")||0,cn=rn.getAttribute("y1")||0,An=rn.getAttribute("x2")||1,dn=rn.getAttribute("y2")||0;sn=nn.width*sn+nn.x,cn=nn.height*cn+nn.y,An=nn.width*An+nn.x,dn=nn.height*dn+nn.y;const un=transformPoint(sn,cn,tn),pn=transformPoint(An,dn,tn),hn={x1:(un.x-nn.x)/nn.width,y1:(un.y-nn.y)/nn.height,x2:(pn.x-nn.x)/nn.width,y2:(pn.y-nn.y)/nn.height},gn=rn.cloneNode(!0);for(const[en,tn]of Object.entries(hn))gn.setAttribute(en,tn);gn.id=Ma.getNextId(),findDefs().append(gn),en.setAttribute(an,"url(#"+gn.id+")")}}}},is=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],pathDSegment=(en,tn,nn,rn)=>{tn.forEach(((en,nn)=>{tn[nn]=shortFloat(en)}));let an=en+tn.join(" ");return nn&&(an+=" "+nn.join(" ")),rn&&(an+=" "+shortFloat(rn)),an},as=Na;var ss=Object.freeze({__proto__:null,setUiStrings:setUiStrings,setLinkControlPoints:setLinkControlPoints,get path(){return Va},init:init$g,ptObjToArr:Ga,getGripPt:Da,getPointFromGrip:Ha,addPointGrip:za,getGripContainer:Ka,addCtrlGrip:$a,getCtrlLine:Wa,getPointGrip:Xa,getControlPoints:Ya,replacePathSeg:Za,getSegSelector:Ja,smoothControlPoints:smoothControlPoints,getPath_:getPath_,removePath_:removePath_,recalcRotatedPath:()=>{const en=Va.elem;if(os=getRotationAngle(en,!0),!os)return;const tn=Va.oldbbox;ns=tn.x+tn.width/2,rs=tn.y+tn.height/2;const nn=getBBox(en);es=nn.x+nn.width/2,ts=nn.y+nn.height/2;const rn=es-ns,an=ts-rs,sn=Math.sqrt(rn*rn+an*an),cn=Math.atan2(an,rn)+os;es=sn*Math.cos(cn)+ns,ts=sn*Math.sin(cn)+rs;const An=en.pathSegList;let dn=An.numberOfItems;for(;dn;){dn-=1;const en=An.getItem(dn),tn=en.pathSegType;if(1===tn)continue;const nn=getRotVals(en.x,en.y),rn=[nn.x,nn.y];if(en.x1&&en.x2){const tn=getRotVals(en.x1,en.y1),nn=getRotVals(en.x2,en.y2);rn.splice(rn.length,0,tn.x,tn.y,nn.x,nn.y)}Za(tn,dn,rn)}getBBox(en);const un=Ma.getSvgRoot().createSVGTransform(),pn=en.transform.baseVal;un.setRotate(180*os/Math.PI,es,ts),pn.replaceItem(un,0)},clearData:clearData,reorientGrads:reorientGrads,convertPath:(en,tn)=>{const{pathSegList:nn}=en,rn=nn.numberOfItems;let an=0,sn=0,cn="",An=null;for(let en=0;en=0&&en<=1&&this.group_.setAttribute("opacity",en)}appendChildren(en){for(const tn of en)this.group_.append(tn)}getTitleElement(){const en=this.group_.childNodes.length;for(let tn=0;tn{nn.setAttributeNS(en.namespaceURI,en.nodeName,en.value)})),nn.removeAttribute("id"),nn.id=tn(),en.childNodes.forEach((function(en){switch(en.nodeType){case 1:nn.append(copyElem(en,tn));break;case 3:nn.textContent=en.nodeValue}})),en.dataset.gsvg)nn.dataset.gsvg=nn.firstChild;else if(en.dataset.symbol){const tn=en.dataset.symbol;nn.dataset.ref=tn,nn.dataset.symbol=tn}else"image"===nn.tagName&&preventClickDefault(nn);return nn},ls="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use".split(","); /** * Tools for drawing. * @module draw * @license MIT * @copyright 2011 Jeff Schiller */let cs=0,As=[];function historyRecordingService(en){return en||new HistoryRecordingService(ds.undoMgr)}function findLayerNameInGroup(en){const tn=en.querySelector("title");return tn?tn.textContent:""}function getNewLayerName(en){let tn=1;for(;en.includes("Layer "+tn);)tn++;return"Layer "+tn}class Drawing{constructor(en,tn){if(!en||!en.tagName||!en.namespaceURI||"svg"!==en.tagName||en.namespaceURI!==ka.SVG)throw new Error("Error: svgedit.draw.Drawing instance initialized without a element");this.svgElem_=en,this.obj_num=0,this.idPrefix=tn||"svg_",this.releasedNums=[],this.all_layers=[],this.layer_map={},this.current_layer=null,this.nonce_="";const nn=this.svgElem_.getAttributeNS(ka.SE,"nonce");nn&&2!==cs?this.nonce_=nn:1===cs&&this.setNonce(Math.floor(100001*Math.random()))}getElem_(en){return this.svgElem_.querySelector?this.svgElem_.querySelector("#"+en):this.svgElem_.querySelector("[id="+en+"]")}getSvgElem(){return this.svgElem_}getNonce(){return this.nonce_}setNonce(en){this.svgElem_.setAttributeNS(ka.XMLNS,"xmlns:se",ka.SE),this.svgElem_.setAttributeNS(ka.SE,"se:nonce",en),this.nonce_=en}clearNonce(){this.nonce_=""}getId(){return this.nonce_?this.idPrefix+this.nonce_+"_"+this.obj_num:this.idPrefix+this.obj_num}getNextId(){const en=this.obj_num;let tn=!1;this.releasedNums.length>0?(this.obj_num=this.releasedNums.pop(),tn=!0):this.obj_num++;let nn=this.getId();for(;this.getElem_(nn);)tn&&(this.obj_num=en,tn=!1),this.obj_num++,nn=this.getId();return tn&&(this.obj_num=en),nn}releaseId(en){const tn=this.idPrefix+(this.nonce_?this.nonce_+"_":"");if("string"!=typeof en||!en.startsWith(tn))return!1;const nn=Number.parseInt(en.substr(tn.length));return!("number"!=typeof nn||nn<=0||this.releasedNums.includes(nn)||(this.releasedNums.push(nn),0))}getNumLayers(){return this.all_layers.length}hasLayer(en){return void 0!==this.layer_map[en]}getLayerName(en){return en>=0&&en=tn)return null;const nn=this.indexCurrentLayer();if(-1===nn||nn===en)return null;const rn=this.current_layer.getGroup(),an=rn.nextSibling;let sn=null;return en>nn?en0){const en=this.current_layer.getName();this.current_layer=this.all_layers[an-1],this.all_layers.splice(an,1),delete this.layer_map[en]}en.endBatchCommand()}mergeAllLayers(en){for(this.current_layer=this.all_layers[this.all_layers.length-1],en.startBatchCommand("Merge all Layers");this.all_layers.length>1;)this.mergeLayer(en);en.endBatchCommand()}setCurrentLayer(en){const tn=this.layer_map[en];return!!tn&&(this.current_layer&&this.current_layer.deactivate(),this.current_layer=tn,this.current_layer.activate(),!0)}indexCurrentLayer(){return this.all_layers.indexOf(this.current_layer)}deleteCurrentLayer(){if(this.current_layer&&this.getNumLayers()>1){const en=this.current_layer.removeGroup();return this.identifyLayers(),en}return null}identifyLayers(){this.all_layers=[],this.layer_map={};const en=this.svgElem_.childNodes.length,tn=[],nn=[];let rn=null,an=!1;for(let sn=0;sn0||!an?(rn=new Layer(getNewLayerName(nn),null,this.svgElem_),rn.appendChildren(tn),this.all_layers.push(rn),this.layer_map[name]=rn):rn.activate(),this.current_layer=rn}createLayer(en,tn){this.current_layer&&this.current_layer.deactivate(),(null==en||""===en||this.layer_map[en])&&(en=getNewLayerName(Object.keys(this.layer_map)));const nn=new Layer(en,null,this.svgElem_);return tn&&(tn.startBatchCommand("Create Layer"),tn.insertElement(nn.getGroup()),tn.endBatchCommand()),this.all_layers.push(nn),this.layer_map[en]=nn,this.current_layer=nn,nn.getGroup()}cloneLayer(en,tn){if(!this.current_layer)return null;this.current_layer.deactivate(),(null==en||""===en||this.layer_map[en])&&(en=getNewLayerName(Object.keys(this.layer_map)));const nn=this.current_layer.getGroup(),rn=new Layer(en,nn,this.svgElem_),an=rn.getGroup();[...nn.childNodes].forEach((en=>{"title"!==en.localName&&an.append(this.copyElem(en))})),tn&&(tn.startBatchCommand("Duplicate Layer"),tn.insertElement(an),tn.endBatchCommand());const sn=this.indexCurrentLayer();return sn>=0?this.all_layers.splice(sn+1,0,rn):this.all_layers.push(rn),this.layer_map[en]=rn,this.current_layer=rn,an}getLayerVisibility(en){const tn=this.layer_map[en];return!!tn&&tn.isVisible()}setLayerVisibility(en,tn){if("boolean"!=typeof tn)return null;const nn=this.layer_map[en];return nn?(nn.setVisible(tn),nn.getGroup()):null}getLayerOpacity(en){const tn=this.layer_map[en];return tn?tn.getOpacity():null}setLayerOpacity(en,tn){if("number"!=typeof tn||tn<0||tn>1)return;const nn=this.layer_map[en];nn&&nn.setOpacity(tn)}copyElem(en){const tn=this;return copyElem(en,(function(){return tn.getNextId()}))}}let ds;const identifyLayers=()=>{leaveContext(),ds.getCurrentDrawing().identifyLayers()},indexCurrentLayer=()=>ds.getCurrentDrawing().indexCurrentLayer(),createLayer=(en,tn)=>{const nn=ds.getCurrentDrawing().createLayer(en,historyRecordingService(tn));ds.clearSelection(),ds.call("changed",[nn])},cloneLayer=(en,tn)=>{const nn=ds.getCurrentDrawing().cloneLayer(en,historyRecordingService(tn));ds.clearSelection(),leaveContext(),ds.call("changed",[nn])},deleteCurrentLayer=()=>{const{BatchCommand:en,RemoveElementCommand:tn}=ds.history;let nn=ds.getCurrentDrawing().getCurrentLayer();const{nextSibling:rn}=nn,an=nn.parentNode;if(nn=ds.getCurrentDrawing().deleteCurrentLayer(),nn){const sn=new en("Delete Layer");return sn.addSubCommand(new tn(nn,rn,an)),ds.addCommandToHistory(sn),ds.clearSelection(),ds.call("changed",[an]),!0}return!1},setCurrentLayer=en=>{const tn=ds.getCurrentDrawing().setCurrentLayer(toXml(en));return tn&&ds.clearSelection(),tn},renameCurrentLayer=en=>{const tn=ds.getCurrentDrawing(),nn=tn.getCurrentLayer();return!(!nn||!tn.setCurrentLayerName(en,historyRecordingService()))&&(ds.call("changed",[nn]),!0)},setCurrentLayerPosition=en=>{const{MoveElementCommand:tn}=ds.history,nn=ds.getCurrentDrawing().setCurrentLayerPosition(en);return!!nn&&(ds.addCommandToHistory(new tn(nn.currentGroup,nn.oldNextSibling,ds.getSvgContent())),!0)},setLayerVisibility=(en,tn)=>{const{ChangeElementCommand:nn}=ds.history,rn=ds.getCurrentDrawing(),an=rn.getLayerVisibility(en),sn=rn.setLayerVisibility(en,tn);if(!sn)return!1;{const en=an?"inline":"none";ds.addCommandToHistory(new nn(sn,{display:en},"Layer Visibility"))}return sn===rn.getCurrentLayer()&&(ds.clearSelection(),ds.pathActions.clear()),!0},moveSelectedToLayer=en=>{const{BatchCommand:tn,MoveElementCommand:nn}=ds.history,rn=ds.getCurrentDrawing().getLayerByName(en);if(!rn)return!1;const an=new tn("Move Elements to Layer"),sn=ds.getSelectedElements();let cn=sn.length;for(;cn--;){const en=sn[cn];if(!en)continue;const tn=en.nextSibling,An=en.parentNode;rn.append(en),an.addSubCommand(new nn(en,tn,An))}return ds.addCommandToHistory(an),!0},mergeLayer=en=>{ds.getCurrentDrawing().mergeLayer(historyRecordingService(en)),ds.clearSelection(),leaveContext(),ds.changeSvgContent()},mergeAllLayers=en=>{ds.getCurrentDrawing().mergeAllLayers(historyRecordingService(en)),ds.clearSelection(),leaveContext(),ds.changeSvgContent()},leaveContext=()=>{const en=As.length,tn=ds.getDataStorage();if(en){for(let nn=0;nn{const tn=ds.getDataStorage();leaveContext(),"string"==typeof en&&(en=getElement(en)),ds.setCurrentGroup(en);const nn=function getParentsUntil(en,tn,nn){const rn=[],an=null==tn?void 0:tn.charAt(0),sn=null==nn?void 0:nn.selector.charAt(0);for(;en&&en!==document;en=en.parentNode){if(tn){if("."===an&&en.classList.contains(tn.substr(1)))break;if("#"===an&&en.id===tn.substr(1))break;if("["===an&&en.hasAttribute(tn.substr(1,tn.length-1)))break;if(en.tagName.toLowerCase()===tn)break}nn?("."===sn&&en.classList.contains(nn.substr(1))&&rn.push(en),"#"===sn&&en.id===nn.substr(1)&&rn.push(en),"["===sn&&en.hasAttribute(nn.substr(1,nn.length-1))&&rn.push(en),en.tagName.toLowerCase()===nn&&rn.push(en)):rn.push(en)}return rn.length?rn:null}(en,"#svgcontent"),rn=[];nn.forEach((function(en){Array.prototype.filter.call(en.parentNode.children,(function(tn){return tn!==en})).forEach((function(en){rn.push(en)}))})),rn.forEach((function(en){const nn=en.getAttribute("opacity")||1;tn.put(en,"orig_opac",nn),en.setAttribute("opacity",.33*nn),en.setAttribute("style","pointer-events: none"),As.push(en)})),ds.clearSelection(),ds.call("contextset",ds.getCurrentGroup())},{InsertElementCommand:us,BatchCommand:ps}=Pa;let hs=null;const pasteElementsMethod=function(en,tn,nn){let rn=JSON.parse(sessionStorage.getItem(hs.getClipboardID()));if(!rn)return;let an=rn.length;if(!an)return;const sn=[],cn=new ps("Paste elements"),An={};function checkIDs(en){var tn;null!==(tn=en.attr)&&void 0!==tn&&tn.id&&(An[en.attr.id]=hs.getNextId(),en.attr.id=An[en.attr.id]),en.children&&en.children.forEach((en=>checkIDs(en)))}for(rn.forEach((en=>checkIDs(en))),hs.runExtensions("IDsUpdated",{elems:rn,changes:An},!0).forEach((function(en){en&&"remove"in en&&en.remove.forEach((function(en){rn=rn.filter((function(tn){return tn.attr.id!==en}))}))}));an--;){const en=rn[an];if(!en)continue;const tn=hs.addSVGElementsFromJson(en);sn.push(tn),cn.addSubCommand(new us(tn)),hs.restoreRefElements(tn)}if(hs.selectOnly(sn),"in_place"!==en){let rn,an;en?"point"===en&&(rn=tn,an=nn):(rn=hs.getLastClickPoint("x"),an=hs.getLastClickPoint("y"));const An=getStrokedBBoxDefaultVisible(sn),dn=rn-(An.x+An.width/2),un=an-(An.y+An.height/2),pn=[],hn=[];sn.forEach((function(en){pn.push(dn),hn.push(un)}));const gn=hs.moveSelectedElements(pn,hn,!1);gn&&cn.addSubCommand(gn)}hs.addCommandToHistory(cn),hs.call("changed",sn)},touchHandler=en=>{en.preventDefault();const{changedTouches:tn}=en,nn=tn[0];let rn="";switch(en.type){case"touchstart":rn="mousedown";break;case"touchmove":rn="mousemove";break;case"touchend":rn="mouseup";break;default:return}const{screenX:an,screenY:sn,clientX:cn,clientY:An}=nn,dn=new MouseEvent(rn,{bubbles:!0,cancelable:!0,view:window,detail:1,screenX:an,screenY:sn,clientX:cn,clientY:An,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:null});tn.length<2&&nn.target.dispatchEvent(dn)},gs="http://www.w3.org/2000/svg",{userAgent:_s}=navigator,ms=_s.includes("AppleWebKit"),fs=_s.includes("Gecko/"),ys=_s.includes("Chrome/");_s.includes("Macintosh");const bs=function(){const en=document.createElementNS(gs,"svg"),tn=document.createElementNS(gs,"svg");document.documentElement.append(en),tn.setAttribute("x",5),en.append(tn);const nn=document.createElementNS(gs,"text");nn.textContent="a",tn.append(nn);try{return 0===nn.getStartPositionOfChar(0).x}catch(en){return!1}finally{en.remove()}}(),isWebkit=()=>ms,isGecko$1=()=>fs,{UndoManager:vs,HistoryEventTypes:ws}=Pa;let ks=null;const ffClone=function(en){if(!isGecko$1())return en;const tn=en.cloneNode(!0);return en.before(tn),en.remove(),ks.selectorManager.releaseSelector(en),ks.setSelectedElements(0,tn),ks.selectorManager.requestSelector(tn).showGrips(!0),tn},changeSelectedAttributeNoUndoMethod=(en,tn,nn)=>{var rn;if("id"===en){const en=nn[0],rn=en.id;return void(rn!==tn&&(ks.clearSelection(),en.id=tn,ks.addToSelection([en],!0),ks.call("elementRenamed",{elem:en,oldId:rn,newId:tn})))}const an=ks.getSelectedElements(),sn=ks.getZoom();"pathedit"===ks.getCurrentMode()&&ks.pathActions.moveNode(en,tn);let cn=(nn=null!==(rn=nn)&&void 0!==rn?rn:an).length;const An=["g","polyline","path"];for(;cn--;){let rn=nn[cn];if(!rn)continue;if(("x"===en||"y"===en)&&An.includes(rn.tagName)){const nn=getStrokedBBoxDefaultVisible([rn]),an="x"===en?tn-nn.x:0,cn="y"===en?tn-nn.y:0;ks.moveSelectedElements(an*sn,cn*sn,!0);continue}let un="#text"===en?rn.textContent:rn.getAttribute(en);if(un||(un=""),un!==String(tn)){"#text"===en?(rn.textContent=tn,/rotate/.test(rn.getAttribute("transform"))&&(rn=ffClone(rn))):"#href"===en?setHref(rn,tn):tn||"number"==typeof tn?rn.setAttribute(en,tn):rn.removeAttribute(en),"textedit"===ks.getCurrentMode()&&"#text"!==en&&rn.textContent.length&&ks.textActions.toSelectMode(rn),isGecko$1()&&"text"===rn.nodeName&&/rotate/.test(rn.getAttribute("transform"))&&(String(tn).startsWith("url")||["font-size","font-family","x","y"].includes(en)&&rn.textContent)&&(rn=ffClone(rn)),an.includes(rn)&&setTimeout((function(){rn.parentNode&&ks.selectorManager.requestSelector(rn).resize()}),0);const nn=getRotationAngle(rn);if(0!==nn&&"transform"!==en){var dn;const en=null===(dn=rn.transform)||void 0===dn?void 0:dn.baseVal;let tn=en.numberOfItems;for(;tn--;)if(4===en.getItem(tn).type){en.removeItem(tn);const an=getBBox(rn),sn=transformPoint(an.x+an.width/2,an.y+an.height/2,transformListToTransform(en).matrix),cn=sn.x,An=sn.y,dn=ks.getSvgRoot().createSVGTransform();dn.setRotate(nn,cn,An),en.insertItemBefore(dn,tn);break}}}}},changeSelectedAttributeMethod=function(en,tn,nn){const rn=ks.getSelectedElements();nn=nn||rn,ks.undoMgr.beginUndoableChange(en,nn),changeSelectedAttributeNoUndoMethod(en,tn,nn);const an=ks.undoMgr.finishUndoableChange();an.isEmpty()||ks.undoMgr.addCommandToHistory(an)},{BatchCommand:Cs}=Pa;let Bs=null;const clearSelectionMethod=en=>{var tn;Bs.getSelectedElements().forEach((en=>{en&&Bs.selectorManager.releaseSelector(en)})),null!==(tn=Bs)&&void 0!==tn&&tn.setEmptySelectedElements(),en||Bs.call("selected",Bs.getSelectedElements())},addToSelectionMethod=(en,tn)=>{const nn=Bs.getSelectedElements();if(!en.length)return;let rn=0;for(;rn1&&en.showGrips(!1)}}if(nn.length)for(Bs.call("selected",nn),1===nn.length&&Bs.selectorManager.requestSelector(nn[0]).showGrips(tn),nn.sort(((en,tn)=>en&&tn&&en.compareDocumentPosition?3-(6&tn.compareDocumentPosition(en)):en?0:1));!nn[0];)nn.shift(0)},getMouseTargetMethod=en=>{if(!en)return null;let tn=en.target;if(tn.correspondingUseElement&&(tn=tn.correspondingUseElement),[ka.MATH,ka.HTML].includes(tn.namespaceURI)&&"svgcanvas"!==tn.id)for(;"foreignObject"!==tn.nodeName;)if(tn=tn.parentNode,!tn)return Bs.getSvgRoot();const nn=Bs.getCurrentDrawing().getCurrentLayer();if([Bs.getSvgRoot(),Bs.getDOMContainer(),Bs.getSvgContent(),nn].includes(tn))return Bs.getSvgRoot();if(getClosest(tn.parentNode,"#selectorParentGroup"))return Bs.selectorManager.selectorParentGroup;for(;null===(rn=tn)||void 0===rn||null===(an=rn.parentNode)||void 0===an||!an.isSameNode(Bs.getCurrentGroup()||nn);){var rn,an;tn=tn.parentNode}return tn},runExtensionsMethod=(en,tn,nn)=>{let rn=!!nn&&[];for(const[an,sn]of Object.entries(Bs.getExtensions()))if("function"==typeof tn&&(tn=tn(an)),sn.eventBased){const nn=new CustomEvent("svgedit",{detail:{action:en,vars:tn}});document.dispatchEvent(nn)}else sn[en]&&(nn?rn.push(sn[en](tn)):rn=sn[en](tn));return rn},getIntersectionListMethod=en=>{const tn=Bs.getZoom();if(!Bs.getRubberBox())return null;const nn=Bs.getCurrentGroup()||Bs.getCurrentDrawing().getCurrentLayer();let rn;if(en)rn=Bs.getSvgContent().createSVGRect(),rn.x=en.x,rn.y=en.y,rn.width=en.width,rn.height=en.height;else{rn=getBBox(Bs.getRubberBox());const en=Bs.getSvgContent().createSVGRect();["x","y","width","height","top","right","bottom","left"].forEach((nn=>{en[nn]=rn[nn]/tn})),rn=en}const an=[];0===Bs.getCurBBoxes().length&&Bs.setCurBBoxes((en=>{en||(en=Bs.getSvgContent().children);const tn=[],nn=en.children;return Array.from(nn).forEach((en=>{en.getBBox&&tn.push({elem:en,bbox:getStrokedBBoxDefaultVisible([en])})})),tn.reverse()})(nn));let sn=Bs.getCurBBoxes().length;for(;sn--;){const en=Bs.getCurBBoxes();rn.width&&rectsIntersect(rn,en[sn].bbox)&&an.push(en[sn].elem)}return an},groupSvgElem=en=>{const tn=Bs.getDataStorage(),nn=document.createElementNS(ka.SVG,"g");en.replaceWith(nn),nn.appendChild(en),tn.put(nn,"gsvg",en),nn.id=Bs.getNextId()},prepareSvg=en=>{Bs.sanitizeSvg(en.documentElement),[...en.getElementsByTagNameNS(ka.SVG,"path")].forEach((en=>{const tn=Bs.pathActions.convertPath(en);en.setAttribute("d",tn),Bs.pathActions.fixEnd(en)}))},setRotationAngle=(en,tn)=>{const nn=Bs.getSelectedElements();en=Number.parseFloat(en);const rn=nn[0],an=rn.getAttribute("transform"),sn=getBBox(rn),cn=sn.x+sn.width/2,An=sn.y+sn.height/2,dn=rn.transform.baseVal;if(dn.numberOfItems>0&&4===dn.getItem(0).type&&dn.removeItem(0),0!==en){const tn=transformPoint(cn,An,transformListToTransform(dn).matrix),nn=Bs.getSvgRoot().createSVGTransform();nn.setRotate(en,tn.x,tn.y),dn.numberOfItems?dn.insertItemBefore(nn,0):dn.appendItem(nn)}else 0===dn.numberOfItems&&rn.removeAttribute("transform");if(!tn){let en=rn.getAttribute("transform");if(en){const tn=en.split(" "),nn=(en=>Math.round(Number(en)+Number.EPSILON))(tn[1]);en="".concat(tn[0]," ").concat(nn," ").concat(tn[2])}an?rn.setAttribute("transform",an):rn.removeAttribute("transform"),Bs.changeSelectedAttribute("transform",en,nn),Bs.call("changed",nn)}Bs.selectorManager.requestSelector(nn[0]).resize(),Bs.getSelector().updateGripCursors(en)},recalculateAllSelectedDimensions=()=>{const en="none"===Bs.getCurrentResizeMode()?"position":"size",tn=new Cs(en),nn=Bs.getSelectedElements();nn.forEach((en=>{const nn=Bs.recalculateDimensions(en);nn&&tn.addSubCommand(nn)})),tn.isEmpty()||(Bs.addCommandToHistory(tn),Bs.call("changed",nn))}; /** * @module text-actions Tools for Text edit functions * @license MIT * * @copyright 2010 Alexis Deveria, 2010 Jeff Schiller */let js=null;const Ls=function(){let en,tn,nn,rn,an,sn,cn,An,dn,un,pn=[];function setCursor(en){const cn=""===tn.value;if(tn.focus(),!arguments.length)if(cn)en=0;else{if(tn.selectionEnd!==tn.selectionStart)return;en=tn.selectionEnd}const An=pn[en];cn||tn.setSelectionRange(en,en),nn=getElement("text_cursor"),nn||(nn=document.createElementNS(ka.SVG,"line"),assignAttributes(nn,{id:"text_cursor",stroke:"#333","stroke-width":1}),getElement("selectorParentGroup").append(nn)),an||(an=setInterval((function(){const en="none"===nn.getAttribute("display");nn.setAttribute("display",en?"inline":"none")}),600));const dn=ptToScreen(An.x,sn.y),un=ptToScreen(An.x,sn.y+sn.height);assignAttributes(nn,{x1:dn.x,y1:dn.y,x2:un.x,y2:un.y,visibility:"visible",display:"inline"}),rn&&rn.setAttribute("d","")}function setSelection(en,an,cn){if(en===an)return void setCursor(an);cn||tn.setSelectionRange(en,an),rn=getElement("text_selectblock"),rn||(rn=document.createElementNS(ka.SVG,"path"),assignAttributes(rn,{id:"text_selectblock",fill:"green",opacity:.5,style:"pointer-events:none"}),getElement("selectorParentGroup").append(rn));const An=pn[en],dn=pn[an];nn.setAttribute("visibility","hidden");const un=ptToScreen(An.x,sn.y),hn=ptToScreen(An.x+(dn.x-An.x),sn.y),gn=ptToScreen(An.x,sn.y+sn.height),_n=ptToScreen(An.x+(dn.x-An.x),sn.y+sn.height),mn="M"+un.x+","+un.y+" L"+hn.x+","+hn.y+" "+_n.x+","+_n.y+" "+gn.x+","+gn.y+"z";assignAttributes(rn,{d:mn,display:"inline"})}function getIndexFromPoint(tn,nn){const rn=js.getSvgRoot().createSVGPoint();if(rn.x=tn,rn.y=nn,1===pn.length)return 0;let an=en.getCharNumAtPosition(rn);an<0?(an=pn.length-2,tn<=pn[0].x&&(an=0)):an>=pn.length-2&&(an=pn.length-2);const sn=pn[an];return tn>sn.x+sn.width/2&&an++,an}function setCursorFromPoint(en,tn){setCursor(getIndexFromPoint(en,tn))}function setEndSelectionFromPoint(en,nn,rn){const an=tn.selectionStart,sn=getIndexFromPoint(en,nn);setSelection(Math.min(an,sn),Math.max(an,sn),!rn)}function screenToPt(en,tn){const nn={x:en,y:tn},rn=js.getZoom();if(nn.x/=rn,nn.y/=rn,cn){const en=transformPoint(nn.x,nn.y,cn.inverse());nn.x=en.x,nn.y=en.y}return nn}function ptToScreen(en,tn){const nn={x:en,y:tn};if(cn){const en=transformPoint(nn.x,nn.y,cn);nn.x=en.x,nn.y=en.y}const rn=js.getZoom();return nn.x*=rn,nn.y*=rn,nn}function selectAll(tn){setSelection(0,en.textContent.length),tn.target.removeEventListener("click",selectAll)}function selectWord(tn){if(!un||!en)return;const nn=js.getZoom(),rn=transformPoint(tn.pageX,tn.pageY,js.getrootSctm()),an=screenToPt(rn.x*nn,rn.y*nn),sn=getIndexFromPoint(an.x,an.y),cn=en.textContent,An=cn.substr(0,sn).replace(/[a-z\d]+$/i,"").length,dn=cn.substr(sn).match(/^[a-z\d]+/i);setSelection(An,(dn?dn[0].length:0)+sn),js.$click(tn.target,selectAll),setTimeout((function(){tn.target.removeEventListener("click",selectAll)}),300)}return{select(tn,nn,rn){en=tn,js.textActions.toEditMode(nn,rn)},start(tn){en=tn,js.textActions.toEditMode()},mouseDown(en,nn,rn,an){const sn=screenToPt(rn,an);tn.focus(),setCursorFromPoint(sn.x,sn.y),An=rn,dn=an},mouseMove(en,tn){const nn=screenToPt(en,tn);setEndSelectionFromPoint(nn.x,nn.y)},mouseUp(tn,nn,rn){const an=screenToPt(nn,rn);setEndSelectionFromPoint(an.x,an.y,!0),tn.target!==en&&nnAn-2&&rndn-2&&js.textActions.toSelectMode(!0)},setCursor:setCursor,toEditMode(tn,nn){if(un=!1,js.setCurrentMode("textedit"),js.selectorManager.requestSelector(en).showGrips(!1),js.selectorManager.requestSelector(en),js.textActions.init(),en.style.cursor="text",arguments.length){const en=screenToPt(tn,nn);setCursorFromPoint(en.x,en.y)}else setCursor();setTimeout((function(){un=!0}),300)},toSelectMode(sn){var cn;js.setCurrentMode("select"),clearInterval(an),an=null,rn&&rn.setAttribute("display","none"),nn&&nn.setAttribute("visibility","hidden"),en.style.cursor="move",sn&&(js.clearSelection(),en.style.cursor="move",js.call("selected",[en]),js.addToSelection([en],!0)),null!==(cn=en)&&void 0!==cn&&cn.textContent.length||js.deleteSelectedElements(),tn.blur(),en=!1},setInputElem(en){tn=en},clear(){"textedit"===js.getCurrentMode()&&js.textActions.toSelectMode()},init(nn){if(!en)return;let rn,an;if(!en.parentNode){const tn=js.getSelectedElements();en=tn[0],js.selectorManager.requestSelector(en).showGrips(!1)}const An=en.textContent.length,dn=en.getAttribute("transform");for(sn=getBBox(en),cn=dn?getMatrix(en):null,pn=[],pn.length=An,tn.focus(),en.removeEventListener("dblclick",selectWord),en.addEventListener("dblclick",selectWord),An||(an={x:sn.x+sn.width/2,width:0}),rn=0;rn{const tn={x:0,y:0},nn=Ts.getControllPoint2("x"),rn=Ts.getControllPoint2("y"),an=Ts.getControllPoint1("x"),sn=Ts.getControllPoint1("y"),cn=Ts.getStart("x"),An=Ts.getStart("y"),dn=Ts.getEnd("x"),un=Ts.getEnd("y"),pn=1/6,hn=en*en,gn=hn*en,_n=[[-1,3,-3,1],[3,-6,3,0],[-3,0,3,0],[1,4,1,0]];return tn.x=pn*((nn*_n[0][0]+an*_n[0][1]+cn*_n[0][2]+dn*_n[0][3])*gn+(nn*_n[1][0]+an*_n[1][1]+cn*_n[1][2]+dn*_n[1][3])*hn+(nn*_n[2][0]+an*_n[2][1]+cn*_n[2][2]+dn*_n[2][3])*en+(nn*_n[3][0]+an*_n[3][1]+cn*_n[3][2]+dn*_n[3][3])),tn.y=pn*((rn*_n[0][0]+sn*_n[0][1]+An*_n[0][2]+un*_n[0][3])*gn+(rn*_n[1][0]+sn*_n[1][1]+An*_n[1][2]+un*_n[1][3])*hn+(rn*_n[2][0]+sn*_n[2][1]+An*_n[2][2]+un*_n[2][3])*en+(rn*_n[3][0]+sn*_n[3][1]+An*_n[3][2]+un*_n[3][3])),{x:tn.x,y:tn.y}},mouseMoveEvent=en=>{var tn;if(!Ts.getStarted())return;if(1===en.button||Ts.spaceKey)return;Ts.textActions.init(),en.preventDefault();const nn=Ts.getSelectedElements(),rn=Ts.getZoom(),an=Ts.getSvgRoot(),sn=nn[0];let cn,An,dn,un,pn,hn,gn,_n,mn;const fn=transformPoint(en.clientX,en.clientY,Ts.getrootSctm()),yn=fn.x*rn,bn=fn.y*rn,vn=getElement(Ts.getId());let wn,xn=yn/rn,kn=xn,Cn=bn/rn,Sn=Cn;switch(Ts.getCurConfig().gridSnapping&&(kn=snapToGrid(kn),Sn=snapToGrid(Sn)),Ts.getCurrentMode()){case"select":sn&&(pn=kn-Ts.getStartX(),hn=Sn-Ts.getStartY(),Ts.getCurConfig().gridSnapping&&(pn=snapToGrid(pn),hn=snapToGrid(hn)),(pn||hn)&&(nn.forEach((en=>{en&&(((en,tn,nn,rn)=>{var an;const sn=en.createSVGTransform();sn.setTranslate(nn,rn);const cn=null===(an=tn.transform)||void 0===an?void 0:an.baseVal;cn.numberOfItems?2===cn.getItem(0).type?cn.replaceItem(sn,0):cn.insertItemBefore(sn,0):cn.appendItem(sn)})(an,en,pn,hn),Ts.selectorManager.requestSelector(en).resize())})),Ts.call("transition",nn)));break;case"multiselect":{xn*=rn,Cn*=rn,assignAttributes(Ts.getRubberBox(),{x:Math.min(Ts.getRStartX(),xn),y:Math.min(Ts.getRStartY(),Cn),width:Math.abs(xn-Ts.getRStartX()),height:Math.abs(Cn-Ts.getRStartY())});const en=nn.slice(),tn=[],an=Ts.getIntersectionList();for(gn=an.length,cn=0;cn0&&Ts.removeFromSelection(en),tn.length>0&&Ts.addToSelection(tn);break}case"resize":{wn=sn.transform.baseVal;const tn=hasMatrixTransform(wn);mn=tn?Ts.getInitBbox():getBBox(sn);let rn=mn.x,cn=mn.y,{width:An,height:dn}=mn;if(pn=kn-Ts.getStartX(),hn=Sn-Ts.getStartY(),Ts.getCurConfig().gridSnapping&&(pn=snapToGrid(pn),hn=snapToGrid(hn),dn=snapToGrid(dn),An=snapToGrid(An)),_n=getRotationAngle(sn),_n){const en=Math.sqrt(pn*pn+hn*hn),tn=Math.atan2(hn,pn)-_n*Math.PI/180;pn=en*Math.cos(tn),hn=en*Math.sin(tn)}Ts.getCurrentResizeMode().includes("n")||Ts.getCurrentResizeMode().includes("s")||(hn=0),Ts.getCurrentResizeMode().includes("e")||Ts.getCurrentResizeMode().includes("w")||(pn=0);let un=0,gn=0,fn=dn?(dn+hn)/dn:1,yn=An?(An+pn)/An:1;Ts.getCurrentResizeMode().includes("n")&&(fn=dn?(dn-hn)/dn:1,gn=dn),Ts.getCurrentResizeMode().includes("w")&&(yn=An?(An-pn)/An:1,un=An);const bn=an.createSVGTransform(),vn=an.createSVGTransform(),xn=an.createSVGTransform();if(Ts.getCurConfig().gridSnapping&&(rn=snapToGrid(rn),un=snapToGrid(un),cn=snapToGrid(cn),gn=snapToGrid(gn)),bn.setTranslate(-(rn+un),-(cn+gn)),en.shiftKey&&(1===yn?yn=fn:fn=yn),vn.setScale(yn,fn),xn.setTranslate(rn+un,cn+gn),tn){const en=_n?1:0;wn.replaceItem(bn,2+en),wn.replaceItem(vn,1+en),wn.replaceItem(xn,Number(en))}else{const en=wn.numberOfItems;wn.replaceItem(xn,en-3),wn.replaceItem(vn,en-2),wn.replaceItem(bn,en-1)}Ts.selectorManager.requestSelector(sn).resize(),Ts.call("transition",nn);break}case"zoom":xn*=rn,Cn*=rn,assignAttributes(Ts.getRubberBox(),{x:Math.min(Ts.getRStartX()*rn,xn),y:Math.min(Ts.getRStartY()*rn,Cn),width:Math.abs(xn-Ts.getRStartX()*rn),height:Math.abs(Cn-Ts.getRStartY()*rn)});break;case"text":assignAttributes(vn,{x:kn,y:Sn});break;case"line":{Ts.getCurConfig().gridSnapping&&(kn=snapToGrid(kn),Sn=snapToGrid(Sn));let tn=kn,nn=Sn;en.shiftKey&&(An=snapToAngle(Ts.getStartX(),Ts.getStartY(),tn,nn),tn=An.x,nn=An.y),vn.setAttribute("x2",tn),vn.setAttribute("y2",nn);break}case"foreignObject":case"square":case"rect":case"image":{const tn="square"===Ts.getCurrentMode()||en.shiftKey;let nn,rn,an=Math.abs(kn-Ts.getStartX()),sn=Math.abs(Sn-Ts.getStartY());tn?(an=sn=Math.max(an,sn),nn=Ts.getStartX()Ts.getThreSholdDist()){Ts.setSumDistance(Ts.getSumDistance()-Ts.getThreSholdDist());const en=Ts.getSvgContent().createSVGPoint();en.x=Ts.getbSpline("x"),en.y=Ts.getbSpline("y"),vn.points.appendItem(en)}Ts.setControllPoint2("x",Ts.getControllPoint1("x")),Ts.setControllPoint2("y",Ts.getControllPoint1("y")),Ts.setControllPoint1("x",Ts.getStart("x")),Ts.setControllPoint1("y",Ts.getStart("y")),Ts.setStart({x:Ts.getEnd("x"),y:Ts.getEnd("y")});break;case"path":case"pathedit":if(kn*=rn,Sn*=rn,Ts.getCurConfig().gridSnapping&&(kn=snapToGrid(kn),Sn=snapToGrid(Sn),Ts.setStartX(snapToGrid(Ts.getStartX())),Ts.setStartY(snapToGrid(Ts.getStartY()))),en.shiftKey){const{path:en}=ss;let tn,nn;en?(tn=en.dragging?en.dragging[0]:Ts.getStartX(),nn=en.dragging?en.dragging[1]:Ts.getStartY()):(tn=Ts.getStartX(),nn=Ts.getStartY()),An=snapToAngle(tn,nn,kn,Sn),({x:kn,y:Sn}=An)}"none"!==(null===(tn=Ts.getRubberBox())||void 0===tn?void 0:tn.getAttribute("display"))&&(xn*=rn,Cn*=rn,assignAttributes(Ts.getRubberBox(),{x:Math.min(Ts.getRStartX()*rn,xn),y:Math.min(Ts.getRStartY()*rn,Cn),width:Math.abs(xn-Ts.getRStartX()*rn),height:Math.abs(Cn-Ts.getRStartY()*rn)})),Ts.pathActions.mouseMove(kn,Sn);break;case"textedit":kn*=rn,Sn*=rn,Ts.textActions.mouseMove(yn,bn);break;case"rotate":{mn=getBBox(sn),dn=mn.x+mn.width/2,un=mn.y+mn.height/2;const tn=getMatrix(sn),rn=transformPoint(dn,un,tn);if(dn=rn.x,un=rn.y,_n=(Math.atan2(un-Sn,dn-kn)*(180/Math.PI)-90)%360,Ts.getCurConfig().gridSnapping&&(_n=snapToGrid(_n)),en.shiftKey){const en=45;_n=Math.round(_n/en)*en}Ts.setRotationAngle(_n<-180?360+_n:_n,!0),Ts.call("transition",nn);break}}Ts.runExtensions("mouseMove",{event:en,mouse_x:yn,mouse_y:bn,selected:sn})},mouseOutEvent=()=>{const{$id:en}=Ts;if("select"!==Ts.getCurrentMode()&&Ts.getStarted()){const tn=new Event("mouseup");en("svgcanvas").dispatchEvent(tn)}},mouseUpEvent=en=>{if(2===en.button)return;if(!Ts.getStarted())return;Ts.textActions.init();const tn=Ts.getSelectedElements(),nn=Ts.getZoom(),rn=Ts.getJustSelected();Ts.setJustSelected(null);const an=transformPoint(en.clientX,en.clientY,Ts.getrootSctm()),sn=an.x*nn,cn=an.y*nn,An=sn/nn,dn=cn/nn;let un=getElement(Ts.getId()),pn=!1;const hn=An,gn=dn;let _n;switch(Ts.setStarted(!1),Ts.getCurrentMode()){case"resize":case"multiselect":Ts.getRubberBox()&&(Ts.getRubberBox().setAttribute("display","none"),Ts.setCurBBoxes([])),Ts.setCurrentMode("select");case"select":if(tn[0]){if(!tn[1]){const en=tn[0];switch(en.tagName){case"g":case"use":case"image":case"foreignObject":break;case"text":Ts.setCurText("font_size",en.getAttribute("font-size")),Ts.setCurText("font_family",en.getAttribute("font-family"));default:Ts.setCurProperties("fill",en.getAttribute("fill")),Ts.setCurProperties("fill_opacity",en.getAttribute("fill-opacity")),Ts.setCurProperties("stroke",en.getAttribute("stroke")),Ts.setCurProperties("stroke_opacity",en.getAttribute("stroke-opacity")),Ts.setCurProperties("stroke_width",en.getAttribute("stroke-width")),Ts.setCurProperties("stroke_dasharray",en.getAttribute("stroke-dasharray")),Ts.setCurProperties("stroke_linejoin",en.getAttribute("stroke-linejoin")),Ts.setCurProperties("stroke_linecap",en.getAttribute("stroke-linecap"))}Ts.selectorManager.requestSelector(en).showGrips(!0)}if(Ts.recalculateAllSelectedDimensions(),hn!==Ts.getRStartX()||gn!==Ts.getRStartY()){const en=tn.length;for(let nn=0;nn{en.removeAttribute("style")})))}return;case"zoom":{var mn;null===(mn=Ts.getRubberBox())||void 0===mn||mn.setAttribute("display","none");const tn=en.shiftKey?.5:2;return void Ts.call("zoomed",{x:Math.min(Ts.getRStartX(),hn),y:Math.min(Ts.getRStartY(),gn),width:Math.abs(hn-Ts.getRStartX()),height:Math.abs(gn-Ts.getRStartY()),factor:tn})}case"fhpath":{Ts.setSumDistance(0),Ts.setControllPoint2("x",0),Ts.setControllPoint2("y",0),Ts.setControllPoint1("x",0),Ts.setControllPoint1("y",0),Ts.setStart({x:0,y:0}),Ts.setEnd("x",0),Ts.setEnd("y",0);const en=un.getAttribute("points"),tn=en.indexOf(",");pn=tn>=0?en.includes(",",tn+1):en.includes(" ",en.indexOf(" ")+1),pn&&(un=Ts.pathActions.smoothPolylineIntoPath(un));break}case"line":{const en=un.getAttribute("x1"),tn=un.getAttribute("y1"),nn=un.getAttribute("x2"),rn=un.getAttribute("y2");pn=en!==nn||tn!==rn}break;case"foreignObject":case"square":case"rect":case"image":{const en=un.getAttribute("width"),tn=un.getAttribute("height");pn=en||tn||"image"===Ts.getCurrentMode()}break;case"circle":pn="0"!==un.getAttribute("r");break;case"ellipse":{const en=Number(un.getAttribute("rx")),tn=Number(un.getAttribute("ry"));pn=en||tn}break;case"fhellipse":Ts.getFreehand("maxx")-Ts.getFreehand("minx")>0&&Ts.getFreehand("maxy")-Ts.getFreehand("miny")>0&&(un=Ts.addSVGElementsFromJson({element:"ellipse",curStyles:!0,attr:{cx:(Ts.getFreehand("minx")+Ts.getFreehand("maxx"))/2,cy:(Ts.getFreehand("miny")+Ts.getFreehand("maxy"))/2,rx:(Ts.getFreehand("maxx")-Ts.getFreehand("minx"))/2,ry:(Ts.getFreehand("maxy")-Ts.getFreehand("miny"))/2,id:Ts.getId()}}),Ts.call("changed",[un]),pn=!0);break;case"fhrect":Ts.getFreehand("maxx")-Ts.getFreehand("minx")>0&&Ts.getFreehand("maxy")-Ts.getFreehand("miny")>0&&(un=Ts.addSVGElementsFromJson({element:"rect",curStyles:!0,attr:{x:Ts.getFreehand("minx"),y:Ts.getFreehand("miny"),width:Ts.getFreehand("maxx")-Ts.getFreehand("minx"),height:Ts.getFreehand("maxy")-Ts.getFreehand("miny"),id:Ts.getId()}}),Ts.call("changed",[un]),pn=!0);break;case"text":pn=!0,Ts.selectOnly([un]),Ts.textActions.start(un);break;case"path":{un=null,Ts.setStarted(!0);const tn=Ts.pathActions.mouseUp(en,un,sn,cn);({element:un}=tn),({keep:pn}=tn);break}case"pathedit":pn=!0,un=null,Ts.pathActions.mouseUp(en);break;case"textedit":pn=!1,un=null,Ts.textActions.mouseUp(en,sn,cn);break;case"rotate":{pn=!0,un=null,Ts.setCurrentMode("select");const en=Ts.undoMgr.finishUndoableChange();en.isEmpty()||Ts.addCommandToHistory(en),Ts.recalculateAllSelectedDimensions(),Ts.call("changed",tn);break}}if(Ts.runExtensions("mouseUp",{event:en,mouse_x:sn,mouse_y:cn},!0).forEach((en=>{en&&(pn=en.keep||pn,({element:un}=en),Ts.setStarted(en.started||Ts.getStarted()))})),!pn&&un){var fn;for(Ts.getCurrentDrawing().releaseId(Ts.getId()),un.remove(),un=null,_n=en.target;"g"===(null===(yn=_n)||void 0===yn||null===(bn=yn.parentNode)||void 0===bn||null===(vn=bn.parentNode)||void 0===vn?void 0:vn.tagName);){var yn,bn,vn;_n=_n.parentNode}"path"===Ts.getCurrentMode()&&Ts.getDrawnPath()||!_n||"selectorParentGroup"===(null===(fn=_n.parentNode)||void 0===fn?void 0:fn.id)||"svgcanvas"===_n.id||"svgroot"===_n.id||(Ts.setMode("select"),Ts.selectOnly([_n],!0))}else if(un){Ts.addedNew=!0;let tn,nn=.2;const rn=Ts.getStyle(),an=Ts.getOpacAni();if(an.beginElement&&Number.parseFloat(un.getAttribute("opacity"))!==rn.opacity){tn=an.cloneNode(!0),tn.setAttribute("to",rn.opacity),tn.setAttribute("dur",nn),un.appendChild(tn);try{tn.beginElement()}catch(en){}}else nn=0;setTimeout((()=>{tn&&tn.remove(),un.setAttribute("opacity",rn.opacity),un.setAttribute("style","pointer-events:inherit"),cleanupElement(un),"path"===Ts.getCurrentMode()?Ts.pathActions.toEditMode(un):Ts.getCurConfig().selectNew&&(-1!==["circle","ellipse","square","rect","fhpath","line","fhellipse","fhrect","star","polygon"].indexOf(Ts.getCurrentMode())&&Ts.setMode("select"),Ts.selectOnly([un],!0)),Ts.addCommandToHistory(new Ps(un)),Ts.call("changed",[un])}),1e3*nn)}Ts.setStartTransform(null)},dblClickEvent=en=>{const tn=Ts.getSelectedElements(),nn=en.target.parentNode;let rn=Ts.getMouseTarget(en);const{tagName:an}=rn;if("text"===an&&"textedit"!==Ts.getCurrentMode()){const tn=transformPoint(en.clientX,en.clientY,Ts.getrootSctm());Ts.textActions.select(rn,tn.x,tn.y)}nn!==Ts.getCurrentGroup()&&("g"!==an&&"a"!==an||!getRotationAngle(rn)||(Ts.pushGroupProperties(rn),rn=tn[0],Ts.clearSelection(!0)),Ts.getCurrentGroup()&&leaveContext(),"g"!==nn.tagName&&"a"!==nn.tagName||nn===Ts.getCurrentDrawing().getCurrentLayer()||rn===Ts.selectorManager.selectorParentGroup||setContext(rn))},mouseDownEvent=en=>{const tn=Ts.getDataStorage(),nn=Ts.getSelectedElements(),rn=Ts.getZoom(),an=Ts.getStyle(),sn=Ts.getSvgRoot(),{$id:cn}=Ts;if(Ts.spaceKey||1===en.button)return;const An=2===en.button;en.altKey&&Ts.cloneSelectedElements(0,0),Ts.setRootSctm(cn("svgcontent").querySelector("g").getScreenCTM().inverse());const dn=transformPoint(en.clientX,en.clientY,Ts.getrootSctm()),un=dn.x*rn,pn=dn.y*rn;if(en.preventDefault(),An){if("path"===Ts.getCurrentMode())return;Ts.setCurrentMode("select"),Ts.setLastClickPoint(dn)}let hn=un/rn,gn=pn/rn,_n=Ts.getMouseTarget(en);"a"===_n.tagName&&1===_n.childNodes.length&&(_n=_n.firstChild);const mn=hn;Ts.setStartX(hn),Ts.setRStartX(hn);const fn=gn;if(Ts.setStartY(gn),Ts.setRStartY(gn),Ts.getCurConfig().gridSnapping&&(hn=snapToGrid(hn),gn=snapToGrid(gn),Ts.setStartX(snapToGrid(Ts.getStartX())),Ts.setStartY(snapToGrid(Ts.getStartY()))),_n===Ts.selectorManager.selectorParentGroup&&nn[0]){const rn=en.target,an=tn.get(rn,"type");"rotate"===an?Ts.setCurrentMode("rotate"):"resize"===an&&(Ts.setCurrentMode("resize"),Ts.setCurrentResizeMode(tn.get(rn,"dir"))),_n=nn[0]}Ts.setStartTransform(_n.getAttribute("transform"));const yn=_n.transform.baseVal;if(yn.numberOfItems>1){const en=yn.getItem(0);yn.removeItem(0),yn.consolidate(),yn.insertItemBefore(en,0)}switch(Ts.getCurrentMode()){case"select":if(Ts.setStarted(!0),Ts.setCurrentResizeMode("none"),An&&Ts.setStarted(!1),_n!==sn){if(nn.includes(_n)||(en.shiftKey||Ts.clearSelection(!0),Ts.addToSelection([_n]),Ts.setJustSelected(_n),Ts.pathActions.clear()),!An)for(const en of nn){var bn;if(!en)continue;const tn=null===(bn=en.transform)||void 0===bn?void 0:bn.baseVal;tn.numberOfItems?tn.insertItemBefore(sn.createSVGTransform(),0):tn.appendItem(sn.createSVGTransform())}}else An||(Ts.clearSelection(),Ts.setCurrentMode("multiselect"),Ts.getRubberBox()||Ts.setRubberBox(Ts.selectorManager.getRubberBandBox()),Ts.setRStartX(Ts.getRStartX()*rn),Ts.setRStartY(Ts.getRStartY()*rn),assignAttributes(Ts.getRubberBox(),{x:Ts.getRStartX(),y:Ts.getRStartY(),width:0,height:0,display:"inline"}));break;case"zoom":Ts.setStarted(!0),Ts.getRubberBox()||Ts.setRubberBox(Ts.selectorManager.getRubberBandBox()),assignAttributes(Ts.getRubberBox(),{x:mn*rn,y:mn*rn,width:0,height:0,display:"inline"});break;case"resize":{Ts.setStarted(!0),Ts.setStartX(hn),Ts.setStartY(gn),Ts.setInitBbox(getBBox(cn("selectedBox0")));const en={};for(const[tn,nn]of Object.entries(Ts.getInitBbox()))en[tn]=nn/rn;Ts.setInitBbox(en);const tn=getRotationAngle(_n)?1:0;hasMatrixTransform(yn)?(yn.insertItemBefore(sn.createSVGTransform(),tn),yn.insertItemBefore(sn.createSVGTransform(),tn),yn.insertItemBefore(sn.createSVGTransform(),tn)):(yn.appendItem(sn.createSVGTransform()),yn.appendItem(sn.createSVGTransform()),yn.appendItem(sn.createSVGTransform()));break}case"fhellipse":case"fhrect":case"fhpath":Ts.setStart({x:mn,y:fn}),Ts.setControllPoint1("x",0),Ts.setControllPoint1("y",0),Ts.setControllPoint2("x",0),Ts.setControllPoint2("y",0),Ts.setStarted(!0),Ts.setDAttr(mn+","+fn+" "),Ts.addSVGElementsFromJson({element:"polyline",curStyles:!0,attr:{points:Ts.getDAttr(),id:Ts.getNextId(),fill:"none",opacity:an.opacity/2,"stroke-linecap":"round",style:"pointer-events:none"}}),Ts.setFreehand("minx",mn),Ts.setFreehand("maxx",mn),Ts.setFreehand("miny",fn),Ts.setFreehand("maxy",fn);break;case"image":{Ts.setStarted(!0);const en=Ts.addSVGElementsFromJson({element:"image",attr:{x:hn,y:gn,width:0,height:0,id:Ts.getNextId(),opacity:an.opacity/2,style:"pointer-events:inherit"}});setHref(en,Ts.getLastGoodImgUrl()),preventClickDefault(en);break}case"square":case"rect":Ts.setStarted(!0),Ts.setStartX(hn),Ts.setStartY(gn),Ts.addSVGElementsFromJson({element:"rect",curStyles:!0,attr:{x:hn,y:gn,width:0,height:0,id:Ts.getNextId(),opacity:an.opacity/2}});break;case"line":{Ts.setStarted(!0);const en=0===Number(an.stroke_width)?1:an.stroke_width;Ts.addSVGElementsFromJson({element:"line",curStyles:!0,attr:{x1:hn,y1:gn,x2:hn,y2:gn,id:Ts.getNextId(),stroke:an.stroke,"stroke-width":en,"stroke-dasharray":an.stroke_dasharray,"stroke-linejoin":an.stroke_linejoin,"stroke-linecap":an.stroke_linecap,"stroke-opacity":an.stroke_opacity,fill:"none",opacity:an.opacity/2,style:"pointer-events:none"}});break}case"circle":Ts.setStarted(!0),Ts.addSVGElementsFromJson({element:"circle",curStyles:!0,attr:{cx:hn,cy:gn,r:0,id:Ts.getNextId(),opacity:an.opacity/2}});break;case"ellipse":Ts.setStarted(!0),Ts.addSVGElementsFromJson({element:"ellipse",curStyles:!0,attr:{cx:hn,cy:gn,rx:0,ry:0,id:Ts.getNextId(),opacity:an.opacity/2}});break;case"text":Ts.setStarted(!0),Ts.addSVGElementsFromJson({element:"text",curStyles:!0,attr:{x:hn,y:gn,id:Ts.getNextId(),fill:Ts.getCurText("fill"),"stroke-width":Ts.getCurText("stroke_width"),"font-size":Ts.getCurText("font_size"),"font-family":Ts.getCurText("font_family"),"text-anchor":"middle","xml:space":"preserve",opacity:an.opacity}});break;case"path":case"pathedit":Ts.setStartX(Ts.getStartX()*rn),Ts.setStartY(Ts.getStartY()*rn),Ts.pathActions.mouseDown(en,_n,Ts.getStartX(),Ts.getStartY()),Ts.setStarted(!0);break;case"textedit":Ts.setStartX(Ts.getStartX()*rn),Ts.setStartY(Ts.getStartY()*rn),Ts.textActions.mouseDown(en,_n,Ts.getStartX(),Ts.getStartY()),Ts.setStarted(!0);break;case"rotate":Ts.setStarted(!0),Ts.undoMgr.beginUndoableChange("transform",nn)}Ts.runExtensions("mouseDown",{event:en,start_x:Ts.getStartX(),start_y:Ts.getStartY(),selectedElements:nn},!0).forEach((en=>{(null==en?void 0:en.started)&&Ts.setStarted(!0)}))},DOMMouseScrollEvent=en=>{const tn=Ts.getZoom(),{$id:nn}=Ts;if(!en.shiftKey)return;en.preventDefault(),Ts.setRootSctm(nn("svgcontent").querySelector("g").getScreenCTM().inverse());const rn=document.getElementById("workarea"),an=Ts.getCurConfig().showRulers?16:0,sn=transformPoint(en.clientX,en.clientY,Ts.getrootSctm()),cn=parseFloat(getComputedStyle(rn,null).width.replace("px","")),An=parseFloat(getComputedStyle(rn,null).height.replace("px","")),dn=cn-15-an,un=An-15-an,pn=dn*Ts.getrootSctm().a,hn=un*Ts.getrootSctm().d,gn=function findPos(en){let tn=0,nn=0;if(en.offsetParent){do{tn+=en.offsetLeft,nn+=en.offsetTop}while(en=en.offsetParent);return{left:tn,top:nn}}return{left:tn,top:nn}}(rn),_n=gn.left+an,mn=gn.top+an,fn=en.wheelDelta?en.wheelDelta:en.detail?-en.detail:0;if(!fn)return;let yn,bn,vn=Math.max(3/4,Math.min(4/3,fn));vn>1?(yn=Math.ceil(dn/pn*vn*100)/100,bn=Math.ceil(un/hn*vn*100)/100):(yn=Math.floor(dn/pn*vn*100)/100,bn=Math.floor(un/hn*vn*100)/100);let wn=Math.min(yn,bn);if(wn=Math.min(10,Math.max(.01,wn)),wn===tn)return;vn=wn/tn;const xn=transformPoint(_n,mn,Ts.getrootSctm()),kn={x:(sn.x-(sn.x-xn.x)/vn)*wn-an+cn/2,y:(sn.y-(sn.y-xn.y)/vn)*wn-an+An/2};Ts.setZoom(wn),document.getElementById("zoom").value=(100*wn).toFixed(1),Ts.call("updateCanvas",{center:!1,newCtr:kn}),Ts.call("zoomDone")}; /** * Tools for SVG handle on JSON format. * @module svgcanvas * @license MIT * * @copyright 2010 Alexis Deveria, 2010 Jeff Schiller */let Ns=null,Is=null;const getJsonFromSvgElements=en=>{if(3===en.nodeType)return en.nodeValue;const tn={element:en.tagName,attr:{},children:[]};for(let nn,rn=0;nn=en.attributes[rn];rn++)tn.attr[nn.name]=nn.value;for(let nn,rn=0;nn=en.childNodes[rn];rn++)tn.children[rn]=getJsonFromSvgElements(nn);return tn},addSVGElementsFromJson=en=>{if("string"==typeof en)return Is.createTextNode(en);let tn=getElement(en.attr.id);const nn=Ns.getDrawing().getCurrentLayer();if(tn&&en.element!==tn.tagName&&(tn.remove(),tn=null),!tn){const rn=en.namespace||ka.SVG;tn=Is.createElementNS(rn,en.element),nn&&(Ns.getCurrentGroup()||nn).append(tn)}const rn=Ns.getCurShape();return en.curStyles&&assignAttributes(tn,{fill:rn.fill,stroke:rn.stroke,"stroke-width":rn.strokeWidth,"stroke-dasharray":rn.stroke_dasharray,"stroke-linejoin":rn.stroke_linejoin,"stroke-linecap":rn.stroke_linecap,"stroke-opacity":rn.stroke_opacity,"fill-opacity":rn.fill_opacity,opacity:rn.opacity/2,style:"pointer-events:inherit"}),assignAttributes(tn,en.attr),cleanupElement(tn),en.children&&en.children.forEach((en=>{tn.append(addSVGElementsFromJson(en))})),tn}; /** * @module elem-get-set get and set methods. * @license MIT * @copyright 2011 Jeff Schiller */let Ms=null;const getResolutionMethod=()=>{const en=Ms.getZoom();return{w:Ms.getSvgContent().getAttribute("width")/en,h:Ms.getSvgContent().getAttribute("height")/en,zoom:en}},getTitleMethod=en=>{const tn=Ms.getSelectedElements(),nn=Ms.getDataStorage();if(!(en=en||tn[0]))return;nn.has(en,"gsvg")?en=nn.get(en,"gsvg"):nn.has(en,"symbol")&&(en=nn.get(en,"symbol"));const rn=en.childNodes;for(const en of rn)if("title"===en.nodeName)return en.textContent;return""},setGroupTitleMethod=en=>{const{InsertElementCommand:tn,RemoveElementCommand:nn,ChangeElementCommand:rn,BatchCommand:an}=Ms.history,sn=Ms.getSelectedElements(),cn=Ms.getDataStorage();let An=sn[0];cn.has(An,"gsvg")&&(An=cn.get(An,"gsvg"));const dn=An.querySelectorAll("title"),un=new an("Set Label");let pn;if(0===en.length){const en=dn.nextSibling;un.addSubCommand(new nn(dn[0],en,An)),dn.remove()}else dn.length?(pn=dn[0],un.addSubCommand(new rn(pn,{"#text":pn.textContent})),pn.textContent=en):(pn=Ms.getDOMDocument().createElementNS(ka.SVG,"title"),pn.textContent=en,An.insertBefore(pn,An.firstChild),un.addSubCommand(new tn(pn)));Ms.addCommandToHistory(un)},setDocumentTitleMethod=en=>{const{ChangeElementCommand:tn,BatchCommand:nn}=Ms.history,rn=Ms.getSvgContent().childNodes;let an=!1,sn="";const cn=new nn("Change Image Title");for(const en of rn)if("title"===en.nodeName){an=en,sn=an.textContent;break}an||(an=Ms.getDOMDocument().createElementNS(ka.SVG,"title"),Ms.getSvgContent().insertBefore(an,Ms.getSvgContent().firstChild)),en.length?an.textContent=en:an.remove(),cn.addSubCommand(new tn(an,{"#text":sn})),Ms.addCommandToHistory(cn)},setResolutionMethod=(en,tn)=>{const{ChangeElementCommand:nn,BatchCommand:rn}=Ms.history,an=Ms.getZoom(),sn=Ms.getResolution(),{w:cn,h:An}=sn;let dn;if("fit"===en){const nn=getStrokedBBoxDefaultVisible();if(!nn)return!1;{dn=new rn("Fit Canvas to Content");const an=getVisibleElements();Ms.addToSelection(an);const sn=[],cn=[];an.forEach(((en,tn)=>{sn.push(-1*nn.x),cn.push(-1*nn.y)}));const An=Ms.moveSelectedElements(sn,cn,!0);dn.addSubCommand(An),Ms.clearSelection(),en=Math.round(nn.width),tn=Math.round(nn.height)}}return en===cn&&tn===An||(dn||(dn=new rn("Change Image Dimensions")),en=convertToNum("width",en),tn=convertToNum("height",tn),Ms.getSvgContent().setAttribute("width",en),Ms.getSvgContent().setAttribute("height",tn),Ms.contentW=en,Ms.contentH=tn,dn.addSubCommand(new nn(Ms.getSvgContent(),{width:cn,height:An})),Ms.getSvgContent().setAttribute("viewBox",[0,0,en/an,tn/an].join(" ")),dn.addSubCommand(new nn(Ms.getSvgContent(),{viewBox:["0 0",cn,An].join(" ")})),Ms.addCommandToHistory(dn),Ms.call("changed",[Ms.getSvgContent()])),!0},getEditorNSMethod=en=>(en&&Ms.getSvgContent().setAttribute("xmlns:se",ka.SE),ka.SE),setBBoxZoomMethod=(en,tn,nn)=>{const rn=Ms.getZoom(),an=Ms.getSelectedElements();let sn,cn=.85;const calcZoom=en=>{if(!en)return!1;const rn=Math.round(tn/en.width*100*cn)/100,an=Math.round(nn/en.height*100*cn)/100,sn=Math.min(rn,an);return Ms.setZoom(sn),{zoom:sn,bbox:en}};if("object"==typeof en){if(sn=en,0===sn.width||0===sn.height){const en=sn.zoom?sn.zoom:rn*sn.factor;return Ms.setZoom(en),{zoom:rn,bbox:sn}}return calcZoom(sn)}switch(en){case"selection":{if(!an[0])return;const en=an.map(((en,tn)=>{if(en)return en}));sn=getStrokedBBoxDefaultVisible(en);break}case"canvas":{const en=Ms.getResolution();cn=.95,sn={width:en.w,height:en.h,x:0,y:0};break}case"content":sn=getStrokedBBoxDefaultVisible();break;case"layer":sn=getStrokedBBoxDefaultVisible(getVisibleElements(Ms.getCurrentDrawing().getCurrentLayer()));break;default:return}return calcZoom(sn)},setZoomMethod=en=>{const tn=Ms.getSelectedElements(),nn=Ms.getResolution();Ms.getSvgContent().setAttribute("viewBox","0 0 "+nn.w/en+" "+nn.h/en),Ms.setZoom(en),tn.forEach((en=>{en&&Ms.selectorManager.requestSelector(en).resize()})),Ms.pathActions.zoomChange(),Ms.runExtensions("zoomChanged",en)},setColorMethod=(en,tn,nn)=>{const rn=Ms.getSelectedElements();Ms.setCurShape(en,tn),Ms.setCurProperties(en+"_paint",{type:"solidColor"});const an=[],addNonG=en=>{"g"!==en.nodeName&&an.push(en)};let sn=rn.length;for(;sn--;){const tn=rn[sn];tn&&("g"===tn.tagName?walkTree(tn,addNonG):"fill"===en?"polyline"!==tn.tagName&&"line"!==tn.tagName&&an.push(tn):an.push(tn))}an.length>0&&(nn?Ms.changeSelectedAttributeNoUndo(en,tn,an):(Ms.changeSelectedAttribute(en,tn,an),Ms.call("changed",an)))},setGradientMethod=en=>{if(!Ms.getCurProperties(en+"_paint")||"solidColor"===Ms.getCurProperties(en+"_paint").type)return;let tn=Ms[en+"Grad"];const nn=findDuplicateGradient(tn),rn=findDefs();nn?tn=nn:(tn=Ms.getDOMDocument().importNode(tn,!0),rn.append(tn),tn.id=Ms.getNextId()),Ms.setColor(en,"url(#"+tn.id+")")},findDuplicateGradient=en=>{const tn=findDefs().querySelectorAll("linearGradient, radialGradient");let nn=tn.length;const rn=["r","cx","cy","fx","fy"];for(;nn--;){const an=tn[nn];if("linearGradient"===en.tagName){if(en.getAttribute("x1")!==an.getAttribute("x1")||en.getAttribute("y1")!==an.getAttribute("y1")||en.getAttribute("x2")!==an.getAttribute("x2")||en.getAttribute("y2")!==an.getAttribute("y2"))continue}else{const tn={r:Number(en.getAttribute("r")),cx:Number(en.getAttribute("cx")),cy:Number(en.getAttribute("cy")),fx:Number(en.getAttribute("fx")),fy:Number(en.getAttribute("fy"))},nn={r:Number(an.getAttribute("r")),cx:Number(an.getAttribute("cx")),cy:Number(an.getAttribute("cy")),fx:Number(an.getAttribute("fx")),fy:Number(an.getAttribute("fy"))};let sn=!1;if(rn.forEach((en=>{tn[en]!==nn[en]&&(sn=!0)})),sn)continue}const sn=en.getElementsByTagNameNS(ka.SVG,"stop"),cn=an.getElementsByTagNameNS(ka.SVG,"stop");if(sn.length!==cn.length)continue;let An=sn.length;for(;An--;){const en=sn[An],tn=cn[An];if(en.getAttribute("offset")!==tn.getAttribute("offset")||en.getAttribute("stop-opacity")!==tn.getAttribute("stop-opacity")||en.getAttribute("stop-color")!==tn.getAttribute("stop-color"))break}if(-1===An)return an}return null},setPaintMethod=(en,tn)=>{const nn=new Paint(tn);switch(Ms.setPaintOpacity(en,nn.alpha/100,!0),Ms.setCurProperties(en+"_paint",nn),nn.type){case"solidColor":Ms.setColor(en,"none"!==nn.solidColor?"#"+nn.solidColor:"none");break;case"linearGradient":case"radialGradient":Ms.setCanvas(en+"Grad",nn[nn.type]),Ms.setGradient(en)}},setStrokeWidthMethod=en=>{const tn=Ms.getSelectedElements();if(0===en&&["line","path"].includes(Ms.getMode()))return void Ms.setStrokeWidth(1);Ms.setCurProperties("stroke_width",en);const nn=[],addNonG=en=>{"g"!==en.nodeName&&nn.push(en)};let rn=tn.length;for(;rn--;){const en=tn[rn];en&&("g"===en.tagName?walkTree(en,addNonG):nn.push(en))}nn.length>0&&(Ms.changeSelectedAttribute("stroke-width",en,nn),Ms.call("changed",tn))},setStrokeAttrMethod=(en,tn)=>{const nn=Ms.getSelectedElements();Ms.setCurShape(en.replace("-","_"),tn);const rn=[];let an=nn.length;for(;an--;){const en=nn[an];en&&("g"===en.tagName?walkTree(en,(en=>{"g"!==en.nodeName&&rn.push(en)})):rn.push(en))}rn.length>0&&(Ms.changeSelectedAttribute(en,tn,rn),Ms.call("changed",nn))},getBoldMethod=()=>{const en=Ms.getSelectedElements(),tn=en[0];return"text"===(null==tn?void 0:tn.tagName)&&!en[1]&&"bold"===tn.getAttribute("font-weight")},setBoldMethod=en=>{var tn;const nn=Ms.getSelectedElements();"text"!==(null===(tn=nn[0])||void 0===tn?void 0:tn.tagName)||nn[1]||Ms.changeSelectedAttribute("font-weight",en?"bold":"normal"),nn[0].textContent||Ms.textActions.setCursor()},hasTextDecorationMethod=en=>{const tn=Ms.getSelectedElements(),nn=tn[0];return"text"===(null==nn?void 0:nn.tagName)&&!tn[1]&&(nn.getAttribute("text-decoration")||"").includes(en)},addTextDecorationMethod=en=>{const tn=Ms.getSelectedElements(),nn=tn[0];if("text"===(null==nn?void 0:nn.tagName)&&!tn[1]){const tn=nn.getAttribute("text-decoration")||"";Ms.changeSelectedAttribute("text-decoration",(tn+" "+en).trim())}tn.length>0&&!tn[0].textContent&&Ms.textActions.setCursor()},removeTextDecorationMethod=en=>{const tn=Ms.getSelectedElements(),nn=tn[0];if("text"===(null==nn?void 0:nn.tagName)&&!tn[1]){const tn=nn.getAttribute("text-decoration")||"";Ms.changeSelectedAttribute("text-decoration",tn.replace(en,"").trim())}tn.length>0&&!tn[0].textContent&&Ms.textActions.setCursor()},getItalicMethod=()=>{const en=Ms.getSelectedElements(),tn=en[0];return"text"===(null==tn?void 0:tn.tagName)&&!en[1]&&"italic"===tn.getAttribute("font-style")},setItalicMethod=en=>{var tn;const nn=Ms.getSelectedElements();"text"!==(null===(tn=nn[0])||void 0===tn?void 0:tn.tagName)||nn[1]||Ms.changeSelectedAttribute("font-style",en?"italic":"normal"),nn[0].textContent||Ms.textActions.setCursor()},setTextAnchorMethod=en=>{var tn;const nn=Ms.getSelectedElements();"text"!==(null===(tn=nn[0])||void 0===tn?void 0:tn.tagName)||nn[1]||Ms.changeSelectedAttribute("text-anchor",en),nn.length>0&&!nn[0].textContent&&Ms.textActions.setCursor()},setLetterSpacingMethod=en=>{var tn;const nn=Ms.getSelectedElements();"text"!==(null===(tn=nn[0])||void 0===tn?void 0:tn.tagName)||nn[1]||Ms.changeSelectedAttribute("letter-spacing",en),nn.length>0&&!nn[0].textContent&&Ms.textActions.setCursor()},setWordSpacingMethod=en=>{var tn;const nn=Ms.getSelectedElements();"text"!==(null===(tn=nn[0])||void 0===tn?void 0:tn.tagName)||nn[1]||Ms.changeSelectedAttribute("word-spacing",en),nn.length>0&&!nn[0].textContent&&Ms.textActions.setCursor()},setTextLengthMethod=en=>{var tn;const nn=Ms.getSelectedElements();"text"!==(null===(tn=nn[0])||void 0===tn?void 0:tn.tagName)||nn[1]||Ms.changeSelectedAttribute("textLength",en),nn.length>0&&!nn[0].textContent&&Ms.textActions.setCursor()},setLengthAdjustMethod=en=>{var tn;const nn=Ms.getSelectedElements();"text"!==(null===(tn=nn[0])||void 0===tn?void 0:tn.tagName)||nn[1]||Ms.changeSelectedAttribute("lengthAdjust",en),nn.length>0&&!nn[0].textContent&&Ms.textActions.setCursor()},getFontFamilyMethod=()=>Ms.getCurText("font_family"),setFontFamilyMethod=en=>{var tn;const nn=Ms.getSelectedElements();Ms.setCurText("font_family",en),Ms.changeSelectedAttribute("font-family",en),(null===(tn=nn[0])||void 0===tn?void 0:tn.textContent)||Ms.textActions.setCursor()},setFontColorMethod=en=>{Ms.setCurText("fill",en),Ms.changeSelectedAttribute("fill",en)},getFontColorMethod=()=>Ms.getCurText("fill"),getFontSizeMethod=()=>Ms.getCurText("font_size"),setFontSizeMethod=en=>{var tn;const nn=Ms.getSelectedElements();Ms.setCurText("font_size",en),Ms.changeSelectedAttribute("font-size",en),(null===(tn=nn[0])||void 0===tn?void 0:tn.textContent)||Ms.textActions.setCursor()},getTextMethod=()=>{const en=Ms.getSelectedElements()[0];return en?en.textContent:""},setTextContentMethod=en=>{Ms.changeSelectedAttribute("#text",en),Ms.textActions.init(en),Ms.textActions.setCursor()},setImageURLMethod=en=>{const{ChangeElementCommand:tn,BatchCommand:nn}=Ms.history,rn=Ms.getSelectedElements()[0];if(!rn)return;const an=rn.getAttribute("width"),sn=rn.getAttribute("height"),cn=!an||!sn,An=getHref(rn);if(An===en&&!cn)return;const dn=new nn("Change Image URL");setHref(rn,en),dn.addSubCommand(new tn(rn,{"#href":An}));const un=new Image;un.onload=function(){const en={width:rn.getAttribute("width"),height:rn.getAttribute("height")};rn.setAttribute("width",this.width),rn.setAttribute("height",this.height),Ms.selectorManager.requestSelector(rn).resize(),dn.addSubCommand(new tn(rn,en)),Ms.addCommandToHistory(dn),Ms.call("changed",[rn])},un.src=en},setLinkURLMethod=en=>{const{ChangeElementCommand:tn,BatchCommand:nn}=Ms.history;let rn=Ms.getSelectedElements()[0];if(!rn)return;if("a"!==rn.tagName){const en=getParents(rn.parentNode,"a");if(null==en||!en.length)return;rn=en[0]}const an=getHref(rn);if(an===en)return;const sn=new nn("Change Link URL");setHref(rn,en),sn.addSubCommand(new tn(rn,{"#href":an})),Ms.addCommandToHistory(sn)},setRectRadiusMethod=en=>{const{ChangeElementCommand:tn}=Ms.history,nn=Ms.getSelectedElements()[0];if("rect"===(null==nn?void 0:nn.tagName)){const rn=Number(nn.getAttribute("rx"));rn!==en&&(nn.setAttribute("rx",en),nn.setAttribute("ry",en),Ms.addCommandToHistory(new tn(nn,{rx:rn,ry:rn},"Radius")),Ms.call("changed",[nn]))}},makeHyperlinkMethod=en=>{Ms.groupSelectedElements("a",en)},removeHyperlinkMethod=()=>{Ms.ungroupSelectedElement()},setSegTypeMethod=en=>{Ms.pathActions.setSegType(en)},setBackgroundMethod=(en,tn)=>{const nn=getElement("canvasBackground"),rn=nn.querySelector("rect");let an=getElement("background_image"),sn=getElement("background_pattern");if(rn.setAttribute("fill","chessboard"===en?"#fff":en),"chessboard"===en){if(!sn){sn=Ms.getDOMDocument().createElementNS(ka.SVG,"foreignObject"),Ms.assignAttributes(sn,{id:"background_pattern",width:"100%",height:"100%",preserveAspectRatio:"xMinYMin",style:"pointer-events:none"});const en=document.createElement("div");Ms.assignAttributes(en,{style:"pointer-events:none;width:100%;height:100%;background-image:url(data:image/gif;base64,R0lGODlhEAAQAIAAAP///9bW1iH5BAAAAAAALAAAAAAQABAAAAIfjG+gq4jM3IFLJgpswNly/XkcBpIiVaInlLJr9FZWAQA7);"}),sn.append(en),nn.append(sn)}}else sn&&sn.remove();tn?(an||(an=Ms.getDOMDocument().createElementNS(ka.SVG,"image"),Ms.assignAttributes(an,{id:"background_image",width:"100%",height:"100%",preserveAspectRatio:"xMinYMin",style:"pointer-events:none"})),setHref(an,tn),nn.append(an)):an&&an.remove()},Rs=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"];let Os=null;const remapElement=(en,tn,nn)=>{const remap=(en,tn)=>transformPoint(en,tn,nn),scalew=en=>nn.a*en,scaleh=en=>nn.d*en,rn=Os.getGridSnapping()&&"svg"===en.parentNode.parentNode.localName,finishUp=()=>{rn&&Object.entries(tn).forEach((en=>{let[nn,rn]=en;tn[nn]=snapToGrid(rn)})),assignAttributes(en,tn,0,!0)},an=getBBox(en);["fill","stroke"].forEach((tn=>{const rn=en.getAttribute(tn);if(null!=rn&&rn.startsWith("url(")&&(nn.a<0||nn.d<0)){const an=getRefElem(rn).cloneNode(!0);if(nn.a<0){const en=an.getAttribute("x1"),tn=an.getAttribute("x2");an.setAttribute("x1",-(en-1)),an.setAttribute("x2",-(tn-1))}if(nn.d<0){const en=an.getAttribute("y1"),tn=an.getAttribute("y2");an.setAttribute("y1",-(en-1)),an.setAttribute("y2",-(tn-1))}an.id=Os.getCurrentDrawing().getNextId(),findDefs().append(an),en.setAttribute(tn,"url(#"+an.id+")")}}));const sn=en.tagName;if("g"===sn||"text"===sn||"tspan"===sn||"use"===sn)if(1!==nn.a||0!==nn.b||0!==nn.c||1!==nn.d||0===nn.e&&0===nn.f){const tn=en.transform.baseVal,rn=Os.getSvgRoot().createSVGTransform();rn.setMatrix(matrixMultiply(transformListToTransform(tn).matrix,nn)),tn.clear(),tn.appendItem(rn)}else{const rn=transformListToTransform(en).matrix,an=matrixMultiply(rn.inverse(),nn,rn);tn.x=Number.parseFloat(tn.x)+an.e,tn.y=Number.parseFloat(tn.y)+an.f}switch(sn){case"foreignObject":case"rect":case"image":if("image"===sn&&(nn.a<0||nn.d<0)){const tn=en.transform.baseVal,rn=Os.getSvgRoot().createSVGTransform();rn.setMatrix(matrixMultiply(transformListToTransform(tn).matrix,nn)),tn.clear(),tn.appendItem(rn)}else{const en=remap(tn.x,tn.y);tn.width=scalew(tn.width),tn.height=scaleh(tn.height),tn.x=en.x+Math.min(0,tn.width),tn.y=en.y+Math.min(0,tn.height),tn.width=Math.abs(tn.width),tn.height=Math.abs(tn.height)}finishUp();break;case"ellipse":{const en=remap(tn.cx,tn.cy);tn.cx=en.x,tn.cy=en.y,tn.rx=scalew(tn.rx),tn.ry=scaleh(tn.ry),tn.rx=Math.abs(tn.rx),tn.ry=Math.abs(tn.ry),finishUp();break}case"circle":{const en=remap(tn.cx,tn.cy);tn.cx=en.x,tn.cy=en.y;const rn=transformBox(an.x,an.y,an.width,an.height,nn),sn=rn.tr.x-rn.tl.x,cn=rn.bl.y-rn.tl.y;tn.r=Math.min(sn/2,cn/2),tn.r&&(tn.r=Math.abs(tn.r)),finishUp();break}case"line":{const en=remap(tn.x1,tn.y1),nn=remap(tn.x2,tn.y2);tn.x1=en.x,tn.y1=en.y,tn.x2=nn.x,tn.y2=nn.y}case"text":case"tspan":case"use":finishUp();break;case"g":{const nn=Os.getDataStorage().get(en,"gsvg");nn&&assignAttributes(nn,tn,0,!0);break}case"polyline":case"polygon":{tn.points.forEach((en=>{const{x:tn,y:nn}=remap(en.x,en.y);en.x=tn,en.y=nn}));let nn="";tn.points.forEach((en=>{nn+=en.x+","+en.y+" "})),en.setAttribute("points",nn);break}case"path":{const nn=en.pathSegList;let rn=nn.numberOfItems;tn.d=[];for(let en=0;en0&&(sn=remap(an.x,an.y),tn.d[0].x=sn.x,tn.d[0].y=sn.y);for(let en=1;en{const{type:tn}=en;switch(cn+=Rs[tn],tn){case 13:case 12:cn+=en.x+" ";break;case 15:case 14:cn+=en.y+" ";break;case 3:case 5:case 19:case 2:case 4:case 18:cn+=en.x+","+en.y+" ";break;case 7:case 6:cn+=en.x1+","+en.y1+" "+en.x2+","+en.y2+" "+en.x+","+en.y+" ";break;case 9:case 8:cn+=en.x1+","+en.y1+" "+en.x+","+en.y+" ";break;case 11:case 10:cn+=en.r1+","+en.r2+" "+en.angle+" "+Number(en.largeArcFlag)+" "+Number(en.sweepFlag)+" "+en.x+","+en.y+" ";break;case 17:case 16:cn+=en.x2+","+en.y2+" "+en.x+","+en.y+" "}})),en.setAttribute("d",cn);break}}}; /** * Recalculate. * @module recalculate * @license MIT */let Qs;const updateClipPath=(en,tn,nn)=>{const rn=getRefElem(en).firstChild,an=rn.transform.baseVal,sn=Qs.getSvgRoot().createSVGTransform();sn.setTranslate(tn,nn),an.appendItem(sn),recalculateDimensions(rn)},recalculateDimensions=en=>{var tn;if(!en)return null;const nn=Qs.getSvgRoot(),rn=Qs.getDataStorage(),an=null===(tn=en.transform)||void 0===tn?void 0:tn.baseVal;if((null==an?void 0:an.numberOfItems)>0){let tn=an.numberOfItems;const nn=tn;for(;tn--;){const rn=an.getItem(tn);if(0===rn.type)an.removeItem(tn);else if(1===rn.type){if(isIdentity(rn.matrix)){if(1===nn)return en.removeAttribute("transform"),null;an.removeItem(tn)}}else 4===rn.type&&0===rn.angle&&an.removeItem(tn)}if(1===an.numberOfItems&&getRotationAngle(en))return null}if(!an||0===an.numberOfItems)return en.setAttribute("transform",""),en.removeAttribute("transform"),null;if(an){let en=[],tn=an.numberOfItems;for(;tn--;){const nn=an.getItem(tn);1===nn.type?en.push([nn.matrix,tn]):en.length&&(en=[])}if(2===en.length){const tn=nn.createSVGTransformFromMatrix(matrixMultiply(en[1][0],en[0][0]));an.removeItem(en[0][1]),an.removeItem(en[1][1]),an.insertItemBefore(tn,en[1][1])}if(tn=an.numberOfItems,tn>=2&&1===an.getItem(tn-2).type&&2===an.getItem(tn-1).type){const en=nn.createSVGTransform(),rn=matrixMultiply(an.getItem(tn-2).matrix,an.getItem(tn-1).matrix);en.setMatrix(rn),an.removeItem(tn-2),an.removeItem(tn-2),an.appendItem(en)}}switch(en.tagName){case"line":case"polyline":case"polygon":case"path":break;default:if(1===an.numberOfItems&&1===an.getItem(0).type||2===an.numberOfItems&&1===an.getItem(0).type&&4===an.getItem(0).type)return null}const sn=rn.has(en,"gsvg")?rn.get(en,"gsvg"):void 0,cn=new BatchCommand$4("Transform");let An,dn,un={},pn=null,hn=[];switch(en.tagName){case"line":hn=["x1","y1","x2","y2"];break;case"circle":hn=["cx","cy","r"];break;case"ellipse":hn=["cx","cy","rx","ry"];break;case"foreignObject":case"rect":case"image":hn=["width","height","x","y"];break;case"use":case"text":case"tspan":hn=["x","y"];break;case"polygon":case"polyline":{pn={},pn.points=en.getAttribute("points");const tn=en.points,nn=tn.numberOfItems;un.points=new Array(nn);for(let en=0;en{un[tn]=convertToNum(tn,en.getAttribute(tn))})):sn&&(un={x:Number(sn.getAttribute("x"))||0,y:Number(sn.getAttribute("y"))||0}),!pn){pn=mergeDeep$1({},un);for(const[en,tn]of Object.entries(pn))pn[en]=convertToNum(en,tn)}if(pn.transform=Qs.getStartTransform()||"","g"===en.tagName&&!sn||"a"===en.tagName){const tn=getBBox(en);An={x:tn.x+tn.width/2,y:tn.y+tn.height/2},dn=transformPoint(tn.x+tn.width/2,tn.y+tn.height/2,transformListToTransform(an).matrix);const rn=getRotationAngle(en);if(rn){const en=rn*Math.PI/180,tn=Math.abs(en)>1e-10?Math.sin(en)/(1-Math.cos(en)):2/en;for(let en=0;en=3&&3===an.getItem(sn-2).type&&2===an.getItem(sn-3).type&&2===an.getItem(sn-1).type){yn=3;const tn=an.getItem(sn-3).matrix,rn=an.getItem(sn-2).matrix,An=an.getItem(sn-1).matrix,dn=en.childNodes;let un=dn.length;for(;un--;){const en=dn.item(un);if(hn=0,fn=0,1===en.nodeType){const an=en.transform.baseVal;if(!an)continue;const sn=transformListToTransform(an).matrix,dn=getRotationAngle(en);if(pn=Qs.getStartTransform(),Qs.setStartTransform(en.getAttribute("transform")),dn||hasMatrixTransform(an)){const en=nn.createSVGTransform();en.setMatrix(matrixMultiply(tn,rn,An,sn)),an.clear(),an.appendItem(en)}else{const en=matrixMultiply(sn.inverse(),An,sn),cn=nn.createSVGMatrix();cn.e=-en.e,cn.f=-en.f;const dn=matrixMultiply(cn.inverse(),sn.inverse(),tn,rn,An,sn,en.inverse()),un=nn.createSVGTransform(),pn=nn.createSVGTransform(),hn=nn.createSVGTransform();un.setTranslate(en.e,en.f),pn.setScale(dn.a,dn.d),hn.setTranslate(cn.e,cn.f),an.appendItem(hn),an.appendItem(pn),an.appendItem(un)}cn.addSubCommand(recalculateDimensions(en)),Qs.setStartTransform(pn)}}an.removeItem(sn-1),an.removeItem(sn-2),an.removeItem(sn-3)}else if(sn>=3&&1===an.getItem(sn-1).type){yn=3;const en=transformListToTransform(an).matrix,tn=nn.createSVGTransform();tn.setMatrix(en),an.clear(),an.appendItem(tn)}else if((1===sn||sn>1&&3!==an.getItem(1).type)&&2===an.getItem(0).type){yn=2;const tn=transformListToTransform(an).matrix;an.removeItem(0);const rn=transformListToTransform(an).matrix.inverse(),sn=matrixMultiply(rn,tn);if(hn=sn.e,fn=sn.f,0!==hn||0!==fn){const tn=en.childNodes;let rn=tn.length;const an=[];for(;rn--;){const sn=tn.item(rn);if(1===sn.nodeType){var gn;if(sn.getAttribute("clip-path")){const en=sn.getAttribute("clip-path");an.includes(en)||(updateClipPath(en,hn,fn),an.push(en))}pn=Qs.getStartTransform(),Qs.setStartTransform(sn.getAttribute("transform"));const tn=null===(gn=sn.transform)||void 0===gn?void 0:gn.baseVal;if(tn){const rn=nn.createSVGTransform();rn.setTranslate(hn,fn),tn.numberOfItems?tn.insertItemBefore(rn,0):tn.appendItem(rn),cn.addSubCommand(recalculateDimensions(sn));const an=en.getElementsByTagNameNS(ka.SVG,"use"),An="#"+sn.id;let dn=an.length;for(;dn--;){const en=an.item(dn);if(An===getHref(en)){const tn=nn.createSVGTransform();tn.setTranslate(-hn,-fn),en.transform.baseVal.insertItemBefore(tn,0),cn.addSubCommand(recalculateDimensions(en))}}Qs.setStartTransform(pn)}}}Qs.setStartTransform(pn)}}else{if(1!==sn||1!==an.getItem(0).type||rn){if(rn){const en=nn.createSVGTransform();en.setRotate(rn,dn.x,dn.y),an.numberOfItems?an.insertItemBefore(en,0):an.appendItem(en)}return 0===an.numberOfItems&&en.removeAttribute("transform"),null}{yn=1;const tn=an.getItem(0).matrix,rn=en.childNodes;let sn=rn.length;for(;sn--;){const en=rn.item(sn);if(1===en.nodeType){var _n;pn=Qs.getStartTransform(),Qs.setStartTransform(en.getAttribute("transform"));const rn=null===(_n=en.transform)||void 0===_n?void 0:_n.baseVal;if(!rn)continue;const an=matrixMultiply(tn,transformListToTransform(rn).matrix),sn=nn.createSVGTransform();sn.setMatrix(an),rn.clear(),rn.appendItem(sn,0),cn.addSubCommand(recalculateDimensions(en)),Qs.setStartTransform(pn);const An=en.getAttribute("stroke-width");if("none"!==en.getAttribute("stroke")&&!isNaN(An)){const tn=(Math.abs(an.a)+Math.abs(an.d))/2;en.setAttribute("stroke-width",An*tn)}}}an.clear()}}if(2===yn){if(rn){dn={x:An.x+un.e,y:An.y+un.f};const en=nn.createSVGTransform();en.setRotate(rn,dn.x,dn.y),an.numberOfItems?an.insertItemBefore(en,0):an.appendItem(en)}}else if(3===yn){const tn=transformListToTransform(an).matrix,sn=nn.createSVGTransform();sn.setRotate(rn,An.x,An.y);const un=sn.matrix,gn=nn.createSVGTransform();gn.setRotate(rn,dn.x,dn.y);const _n=gn.matrix.inverse(),yn=tn.inverse(),bn=matrixMultiply(yn,_n,un,tn);if(hn=bn.e,fn=bn.f,0!==hn||0!==fn){const tn=en.childNodes;let rn=tn.length;for(;rn--;){const en=tn.item(rn);if(1===en.nodeType){var mn;pn=Qs.getStartTransform(),Qs.setStartTransform(en.getAttribute("transform"));const tn=null===(mn=en.transform)||void 0===mn?void 0:mn.baseVal,rn=nn.createSVGTransform();rn.setTranslate(hn,fn),tn.numberOfItems?tn.insertItemBefore(rn,0):tn.appendItem(rn),cn.addSubCommand(recalculateDimensions(en)),Qs.setStartTransform(pn)}}}rn&&(an.numberOfItems?an.insertItemBefore(gn,0):an.appendItem(gn))}}else{const tn=getBBox(en);if(!tn&&"path"!==en.tagName)return null;let rn;const sn=getRotationAngle(en);if(sn){An={x:tn.x+tn.width/2,y:tn.y+tn.height/2},dn=transformPoint(tn.x+tn.width/2,tn.y+tn.height/2,transformListToTransform(an).matrix);const en=sn*Math.PI/180,nn=Math.abs(en)>1e-10?Math.sin(en)/(1-Math.cos(en)):2/en;for(let en=0;en=3&&3===an.getItem(pn-2).type&&2===an.getItem(pn-3).type&&2===an.getItem(pn-1).type)cn=3,rn=transformListToTransform(an,pn-3,pn-1).matrix,an.removeItem(pn-1),an.removeItem(pn-2),an.removeItem(pn-3);else if(4===pn&&1===an.getItem(pn-1).type){cn=3,rn=transformListToTransform(an).matrix;const en=nn.createSVGTransform();en.setMatrix(rn),an.clear(),an.appendItem(en),rn=nn.createSVGMatrix()}else if((1===pn||pn>1&&3!==an.getItem(1).type)&&2===an.getItem(0).type){cn=2;const en=an.getItem(0).matrix,tn=transformListToTransform(an,1).matrix,nn=tn.inverse();rn=matrixMultiply(nn,en,tn),an.removeItem(0)}else{if(1!==pn||1!==an.getItem(0).type||sn){if(sn){const en=nn.createSVGTransform();en.setRotate(sn,dn.x,dn.y),an.numberOfItems?an.insertItemBefore(en,0):an.appendItem(en)}return 0===an.numberOfItems&&en.removeAttribute("transform"),null}switch(rn=transformListToTransform(an).matrix,en.tagName){case"line":un={x1:en.getAttribute("x1"),y1:en.getAttribute("y1"),x2:en.getAttribute("x2"),y2:en.getAttribute("y2")};case"polyline":case"polygon":if(un.points=en.getAttribute("points"),un.points){const tn=en.points,nn=tn.numberOfItems;un.points=new Array(nn);for(let en=0;en{const[en]=Ks.getSelectedElements();if(en){const tn=en,nn=tn.parentNode,rn=tn.nextSibling;tn.parentNode.append(tn),rn!==tn.nextSibling&&(Ks.addCommandToHistory(new Vs(tn,rn,nn,"top")),Ks.call("changed",[tn]))}},moveToBottomSelectedElem=()=>{const[en]=Ks.getSelectedElements();if(en){let tn=en;const nn=tn.parentNode,rn=tn.nextSibling;let{firstChild:an}=tn.parentNode;"title"===an.tagName&&(an=an.nextSibling),"defs"===an.tagName&&(an=an.nextSibling),tn=tn.parentNode.insertBefore(tn,an),rn!==tn.nextSibling&&(Ks.addCommandToHistory(new Vs(tn,rn,nn,"bottom")),Ks.call("changed",[tn]))}},moveUpDownSelected=en=>{const tn=Ks.getSelectedElements()[0];if(!tn)return;let nn,rn;Ks.setCurBBoxes([]);const an=Ks.getIntersectionList(getStrokedBBoxDefaultVisible([tn]));if("Down"===en&&an.reverse(),Array.prototype.forEach.call(an,(en=>rn?(void 0===nn&&(nn=en),!1):(en===tn&&(rn=!0),!0))),!nn)return;const sn=tn,cn=sn.parentNode,An=sn.nextSibling;"Down"===en?nn.insertAdjacentElement("beforebegin",sn):nn.insertAdjacentElement("afterend",sn),An!==sn.nextSibling&&(Ks.addCommandToHistory(new Vs(sn,An,cn,"Move "+en)),Ks.call("changed",[sn]))},moveSelectedElements=function(en,tn){let nn=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const rn=Ks.getSelectedElements(),an=Ks.getZoom();Array.isArray(en)||(en/=an,tn/=an);const sn=new Gs("position");if(rn.forEach(((nn,rn)=>{if(nn){var an;const cn=Ks.getSvgRoot().createSVGTransform(),An=null===(an=nn.transform)||void 0===an?void 0:an.baseVal;Array.isArray(en)?cn.setTranslate(en[rn],tn[rn]):cn.setTranslate(en,tn),An.numberOfItems?An.insertItemBefore(cn,0):An.appendItem(cn);const dn=recalculateDimensions(nn);dn&&sn.addSubCommand(dn),Ks.gettingSelectorManager().requestSelector(nn).resize()}})),!sn.isEmpty())return nn&&Ks.addCommandToHistory(sn),Ks.call("changed",rn),sn},cloneSelectedElements=(en,tn)=>{const nn=Ks.getSelectedElements(),rn=Ks.getCurrentGroup();let an,sn;const cn=new Gs("Clone Elements"),An=nn.length,index=en=>{if(!en)return-1;let tn=0;do{tn++}while(en===en.previousElementSibling);return tn};for(nn.sort(((en,tn)=>index(tn)-index(en))),an=0;an{const nn=Ks.getSelectedElements(),rn=[],an=nn.length;if(!an)return;let sn=Number.MAX_VALUE,cn=Number.MIN_VALUE,An=Number.MAX_VALUE,dn=Number.MIN_VALUE;const isHorizontalAlign=en=>["l","c","r","left","center","right"].includes(en),isVerticalAlign=en=>["t","m","b","top","middle","bottom"].includes(en);for(let en=0;enen.width-tn.width)),tn=en[0];sn=tn.x,An=tn.y,cn=tn.x+tn.width,dn=tn.y+tn.height}break;case"largest":if(isHorizontalAlign(en)||isVerticalAlign(en)){const en=rn.slice().sort(((en,tn)=>en.width-tn.width)),tn=en[rn.length-1];sn=tn.x,An=tn.y,cn=tn.x+tn.width,dn=tn.y+tn.height}break;case"page":sn=0,An=0,cn=Ks.getContentW(),dn=Ks.getContentH();break;default:sn=Math.min(...rn.map((en=>en.x))),An=Math.min(...rn.map((en=>en.y))),cn=Math.max(...rn.map((en=>en.x+en.width))),dn=Math.max(...rn.map((en=>en.y+en.height)))}let un=[],pn=[];["dh","distrib_horiz"].includes(en)?[un,pn]=_getDistributeHorizontalDistances(tn,nn,rn,sn,cn,An,dn):["dv","distrib_verti"].includes(en)?[un,pn]=_getDistributeVerticalDistances(tn,nn,rn,sn,cn,An,dn):[un,pn]=_getNormalDistances(en,nn,rn,sn,cn,An,dn),moveSelectedElements(un,pn)},_getDistributeHorizontalDistances=(en,tn,nn,rn,an,sn,cn)=>{const An=[],dn=[];for(let en=0;en{const nn=en.x+en.width,rn=tn.x+tn.width;return nn===rn?0:nn>rn?1:-1}));"page"===en&&(un.unshift({x:0,y:0,width:0,height:cn}),un.push({x:an,y:0,width:0,height:cn}));const pn=an-rn,hn=un.map((en=>en.width)).reduce(((en,tn)=>en+tn),0),gn=(pn-hn)/(un.length-1),_n=[];for(let en=0;en{const rn=nn.findIndex((tn=>tn===en));-1!==rn&&(An[rn]=_n[tn])})),[An,dn]},_getDistributeVerticalDistances=(en,tn,nn,rn,an,sn,cn)=>{const An=[],dn=[];for(let en=0;en{const nn=en.y+en.height,rn=tn.y+tn.height;return nn===rn?0:nn>rn?1:-1}));"page"===en&&(un.unshift({x:0,y:0,width:an,height:0}),un.push({x:0,y:cn,width:an,height:0}));const pn=cn-sn,hn=un.map((en=>en.height)).reduce(((en,tn)=>en+tn),0),gn=(pn-hn)/(un.length-1),_n=[];for(let en=0;en{const rn=nn.findIndex((tn=>tn===en));-1!==rn&&(dn[rn]=_n[tn])})),[An,dn]},_getNormalDistances=(en,tn,nn,rn,an,sn,cn)=>{const An=tn.length,dn=new Array(An),un=new Array(An);for(let pn=0;pn{const en=Ks.getSelectedElements(),tn=new Gs("Delete Elements"),nn=[];en.forEach((en=>{if(en){let rn=en.parentNode,an=en;Ks.gettingSelectorManager().releaseSelector(an),removePath_(an.id),"a"===rn.tagName&&1===rn.childNodes.length&&(an=rn,rn=rn.parentNode);const{nextSibling:sn}=an;an.remove();const cn=an;nn.push(en),tn.addSubCommand(new Hs(cn,sn,rn))}})),Ks.setEmptySelectedElements(),tn.isEmpty()||Ks.addCommandToHistory(tn),Ks.call("changed",nn),Ks.clearSelection()},copySelectedElements=()=>{const en=Ks.getSelectedElements(),tn=JSON.stringify(en.map((en=>Ks.getJsonFromSvgElements(en))));sessionStorage.setItem(Ks.getClipboardID(),tn),Ks.flashStorage(),document.getElementById("se-cmenu_canvas").setAttribute("enablemenuitems","#paste,#paste_in_place")},groupSelectedElements=(en,tn)=>{const nn=Ks.getSelectedElements();en||(en="g");let rn,an="";"a"===en?(an="Make hyperlink",rn=tn||""):(en="g",an="Group Elements");const sn=new Gs(an),cn=Ks.addSVGElementsFromJson({element:en,attr:{id:Ks.getNextId()}});"a"===en&&setHref(cn,rn),sn.addSubCommand(new Ds(cn));let An=nn.length;for(;An--;){let en=nn[An];if(!en)continue;"a"===en.parentNode.tagName&&1===en.parentNode.childNodes.length&&(en=en.parentNode);const tn=en.nextSibling,rn=en.parentNode;cn.append(en),sn.addSubCommand(new Vs(en,tn,rn))}sn.isEmpty()||Ks.addCommandToHistory(sn),Ks.selectOnly([cn],!0)},pushGroupProperty=(en,tn)=>{const nn=en.childNodes,rn=nn.length,an=en.getAttribute("transform"),sn=en.transform.baseVal,cn=transformListToTransform(sn).matrix,An=new Gs("Push group properties"),dn=getRotationAngle(en),un={filter:en.getAttribute("filter"),opacity:en.getAttribute("opacity")};let pn,hn,gn;const _n=Ks.getDrawing();for(let tn=0;tn{const tn=Ks.getSelectedElements();en||(en=tn[0]);const nn=en,rn=new Gs;let an;const sn=Ks.getDataStorage();if(sn.has(nn,"gsvg")){const tn=en.firstChild,nn={x:Number(tn.getAttribute("x")),y:Number(tn.getAttribute("y"))},rn=en.firstChild.firstChild;rn&&(rn.outerHTML=rn.innerHTML),sn.remove(en,"gsvg");const an=en.transform.baseVal,cn=Ks.getSvgRoot().createSVGTransform();cn.setTranslate(nn.x,nn.y),an.appendItem(cn),recalculateDimensions(en),Ks.call("selected",[en])}else if(sn.has(nn,"symbol")){en=sn.get(nn,"symbol"),an=nn.getAttribute("transform");const tn={x:Number(nn.getAttribute("x")),y:Number(nn.getAttribute("y"))},cn=en.getAttribute("viewBox");if(cn){const en=cn.split(" ");tn.x-=Number(en[0]),tn.y-=Number(en[1])}an+=" translate("+(tn.x||0)+","+(tn.y||0)+")";const An=nn.previousElementSibling;rn.addSubCommand(new Hs(nn,nn.nextElementSibling,nn.parentNode)),nn.remove();const dn=Ks.getSvgContent().querySelectorAll("use").length,un=Ks.getDOMDocument().createElementNS(ka.SVG,"g"),pn=en.childNodes;let hn;for(hn=0;hntn;tn++)un.appendChild(en[tn].cloneNode(!0))}an&&un.setAttribute("transform",an);const gn=en.parentNode;if(Ks.uniquifyElems(un),isGecko$1()){const en=findDefs(),tn=un.querySelectorAll("linearGradient,radialGradient,pattern");for(let nn=0,rn=tn.length;rn>nn;nn++)en.appendChild(tn[nn])}if(un.id=Ks.getNextId(),An.after(un),gn){if(!dn){const{nextSibling:tn}=en;en.remove(),rn.addSubCommand(new Hs(en,tn,gn))}rn.addSubCommand(new Ds(un))}Ks.setUseData(un),isGecko$1()?Ks.convertGradients(findDefs()):Ks.convertGradients(un),((en,tn)=>{if(1===(null==en?void 0:en.nodeType)){let nn=en.childNodes.length;for(;nn--;)walkTree(en.childNodes.item(nn),tn);tn(en)}})(un,(en=>{try{recalculateDimensions(en)}catch(en){console.error(en)}}));const _n=un.querySelectorAll(Ks.getVisElems());Array.prototype.forEach.call(_n,(en=>{en.id||(en.id=Ks.getNextId())})),Ks.selectOnly([un]);const mn=pushGroupProperty(un,!0);mn&&rn.addSubCommand(mn),Ks.addCommandToHistory(rn)}else console.warn("Unexpected element to ungroup:",en)},ungroupSelectedElement=()=>{const en=Ks.getSelectedElements(),tn=Ks.getDataStorage();let nn=en[0];if(!nn)return;if(tn.has(nn,"gsvg")||tn.has(nn,"symbol"))return void convertToGroup(nn);if("use"===nn.tagName){const en=getElement(getHref(nn).substr(1));return tn.put(nn,"symbol",en),tn.put(nn,"ref",en),void convertToGroup(nn)}const rn=getParents(nn.parentNode,"a");if(null!=rn&&rn.length&&(nn=rn[0]),"g"===nn.tagName||"a"===nn.tagName){const en=new Gs("Ungroup Elements"),tn=pushGroupProperty(nn,!0);tn&&en.addSubCommand(tn);const rn=nn.parentNode,an=nn.nextSibling,sn=new Array(nn.childNodes.length);let cn=0;for(;nn.firstChild;){const tn=nn.firstChild,An=tn.nextSibling,dn=tn.parentNode;if("title"!==tn.tagName)sn[cn++]=rn.insertBefore(tn,an),en.addSubCommand(new Vs(tn,An,dn));else{const{nextSibling:nn}=tn;en.addSubCommand(new Hs(tn,nn,dn)),tn.remove()}}Ks.clearSelection();const An=nn.nextSibling;nn.remove(),en.addSubCommand(new Hs(nn,An,rn)),en.isEmpty()||Ks.addCommandToHistory(en),Ks.addToSelection(sn)}},updateCanvas=(en,tn)=>{Ks.getSvgRoot().setAttribute("width",en),Ks.getSvgRoot().setAttribute("height",tn);const nn=Ks.getZoom(),rn=document.getElementById("canvasBackground"),an=Number(Ks.getSvgContent().getAttribute("x")),sn=Number(Ks.getSvgContent().getAttribute("y")),cn=(en-Ks.contentW*nn)/2,An=(tn-Ks.contentH*nn)/2;assignAttributes(Ks.getSvgContent(),{width:Ks.contentW*nn,height:Ks.contentH*nn,x:cn,y:An,viewBox:"0 0 "+Ks.contentW+" "+Ks.contentH}),assignAttributes(rn,{width:Ks.getSvgContent().getAttribute("width"),height:Ks.getSvgContent().getAttribute("height"),x:cn,y:An});const dn=getElement("background_image");return dn&&assignAttributes(dn,{width:"100%",height:"100%"}),Ks.selectorManager.selectorParentGroup.setAttribute("transform","translate("+cn+","+An+")"),Ks.runExtensions("canvasUpdated",{new_x:cn,new_y:An,old_x:an,old_y:sn,d_x:cn-an,d_y:An-sn}),{x:cn,y:An,old_x:an,old_y:sn,d_x:cn-an,d_y:An-sn}},cycleElement=en=>{const tn=Ks.getSelectedElements(),nn=Ks.getCurrentGroup();let rn;const an=tn[0];let sn=!1;const cn=getVisibleElements(nn||Ks.getCurrentDrawing().getCurrentLayer());if(cn.length){if(an){let tn=cn.length;for(;tn--;)if(cn[tn]===an){rn=en?tn-1:tn+1,rn>=cn.length?rn=0:rn<0&&(rn=cn.length-1),sn=cn[rn];break}}else rn=en?cn.length-1:0,sn=cn[rn];Ks.selectOnly([sn],!0),Ks.call("selected",tn)}}; /** * Tools for blur event. * @module blur * @license MIT * @copyright 2011 Jeff Schiller */let $s=null;const setBlurNoUndo=function(en){const tn=$s.getSelectedElements();if($s.getFilter())if(0===en)$s.changeSelectedAttributeNoUndo("filter",""),$s.setFilterHidden(!0);else{const nn=tn[0];$s.getFilterHidden()&&$s.changeSelectedAttributeNoUndo("filter","url(#"+nn.id+"_blur)");const rn=$s.getFilter();$s.changeSelectedAttributeNoUndo("stdDeviation",en,[rn.firstChild]),$s.setBlurOffsets(rn,en)}else $s.setBlur(en)};function finishChange(){const en=$s.undoMgr.finishUndoableChange();$s.getCurCommand().addSubCommand(en),$s.addCommandToHistory($s.getCurCommand()),$s.setCurCommand(null),$s.setFilter(null)}const setBlurOffsets=function(en,tn){tn>3?$s.assignAttributes(en,{x:"-50%",y:"-50%",width:"200%",height:"200%"},100):(en.removeAttribute("x"),en.removeAttribute("y"),en.removeAttribute("width"),en.removeAttribute("height"))},setBlur=function(en,tn){const{InsertElementCommand:nn,ChangeElementCommand:rn,BatchCommand:an}=$s.history,sn=$s.getSelectedElements();if($s.getCurCommand())return void finishChange();const cn=sn[0],An=cn.id;$s.setFilter($s.getElement(An+"_blur")),en-=0;const dn=new an;if($s.getFilter())0===en&&$s.setFilter(null);else{const tn=$s.addSVGElementsFromJson({element:"feGaussianBlur",attr:{in:"SourceGraphic",stdDeviation:en}});$s.setFilter($s.addSVGElementsFromJson({element:"filter",attr:{id:An+"_blur"}})),$s.getFilter().append(tn),$s.findDefs().append($s.getFilter()),dn.addSubCommand(new nn($s.getFilter()))}const un={filter:cn.getAttribute("filter")};if(0===en)return cn.removeAttribute("filter"),void dn.addSubCommand(new rn(cn,un));$s.changeSelectedAttribute("filter","url(#"+An+"_blur)"),dn.addSubCommand(new rn(cn,un)),$s.setBlurOffsets($s.getFilter(),en);const pn=$s.getFilter();$s.setCurCommand(dn),$s.undoMgr.beginUndoableChange("stdDeviation",[pn?pn.firstChild:null]),tn&&($s.setBlurNoUndo(en),finishChange())},Ws=getReverseNS(),Xs=["class","id","display","transform","style"],Ys={a:["clip-path","clip-rule","fill","fill-opacity","fill-rule","filter","mask","opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","systemLanguage","xlink:href","xlink:title"],circle:["clip-path","clip-rule","cx","cy","enable-background","fill","fill-opacity","fill-rule","filter","mask","opacity","r","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","systemLanguage"],clipPath:["clipPathUnits"],defs:[],desc:[],ellipse:["clip-path","clip-rule","cx","cy","fill","fill-opacity","fill-rule","filter","mask","opacity","requiredFeatures","rx","ry","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","systemLanguage"],feBlend:["in","in2"],feColorMatrix:["in","type","value","result","values"],feComposite:["in","operator","result","in2"],feFlood:["flood-color","in","result","flood-opacity"],feGaussianBlur:["color-interpolation-filters","in","requiredFeatures","stdDeviation","result"],feMerge:[],feMergeNode:["in"],feMorphology:["in","operator","radius"],feOffset:["dx","in","dy","result"],filter:["color-interpolation-filters","filterRes","filterUnits","height","primitiveUnits","requiredFeatures","width","x","xlink:href","y"],foreignObject:["font-size","height","opacity","requiredFeatures","width","x","y"],g:["clip-path","clip-rule","fill","fill-opacity","fill-rule","filter","mask","opacity","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","systemLanguage","font-family","font-size","font-style","font-weight","text-anchor"],image:["clip-path","clip-rule","filter","height","mask","opacity","requiredFeatures","systemLanguage","width","x","xlink:href","xlink:title","y"],line:["clip-path","clip-rule","fill","fill-opacity","fill-rule","filter","marker-end","marker-mid","marker-start","mask","opacity","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","systemLanguage","x1","x2","y1","y2"],linearGradient:["gradientTransform","gradientUnits","requiredFeatures","spreadMethod","systemLanguage","x1","x2","xlink:href","y1","y2"],marker:["markerHeight","markerUnits","markerWidth","orient","preserveAspectRatio","refX","refY","se_type","systemLanguage","viewBox"],mask:["height","maskContentUnits","maskUnits","width","x","y"],metadata:[],path:["clip-path","clip-rule","d","enable-background","fill","fill-opacity","fill-rule","filter","marker-end","marker-mid","marker-start","mask","opacity","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","systemLanguage"],pattern:["height","patternContentUnits","patternTransform","patternUnits","requiredFeatures","systemLanguage","viewBox","width","x","xlink:href","y"],polygon:["clip-path","clip-rule","fill","fill-opacity","fill-rule","filter","marker-end","marker-mid","marker-start","mask","opacity","points","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","systemLanguage","sides","shape","edge","point","starRadiusMultiplier","r","radialshift","r2","orient","cx","cy"],polyline:["clip-path","clip-rule","fill","fill-opacity","fill-rule","filter","marker-end","marker-mid","marker-start","mask","opacity","points","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","systemLanguage","se:connector"],radialGradient:["cx","cy","fx","fy","gradientTransform","gradientUnits","r","requiredFeatures","spreadMethod","systemLanguage","xlink:href"],rect:["clip-path","clip-rule","fill","fill-opacity","fill-rule","filter","height","mask","opacity","requiredFeatures","rx","ry","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","systemLanguage","width","x","y"],stop:["offset","requiredFeatures","stop-opacity","systemLanguage","stop-color","gradientUnits","gradientTransform"],style:["type"],svg:["clip-path","clip-rule","enable-background","filter","height","mask","preserveAspectRatio","requiredFeatures","systemLanguage","version","viewBox","width","x","xmlns","xmlns:se","xmlns:xlink","xmlns:oi","oi:animations","y","stroke-linejoin","fill-rule","aria-label","stroke-width","fill-rule","xml:space"],switch:["requiredFeatures","systemLanguage"],symbol:["fill","fill-opacity","fill-rule","filter","font-family","font-size","font-style","font-weight","opacity","overflow","preserveAspectRatio","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","systemLanguage","viewBox","width","height"],text:["clip-path","clip-rule","fill","fill-opacity","fill-rule","filter","font-family","font-size","font-style","font-weight","mask","opacity","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","systemLanguage","text-anchor","letter-spacing","word-spacing","text-decoration","textLength","lengthAdjust","x","xml:space","y"],textPath:["method","requiredFeatures","spacing","startOffset","systemLanguage","xlink:href"],title:[],tspan:["clip-path","clip-rule","dx","dy","fill","fill-opacity","fill-rule","filter","font-family","font-size","font-style","font-weight","mask","opacity","requiredFeatures","rotate","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","systemLanguage","text-anchor","textLength","x","xml:space","y"],use:["clip-path","clip-rule","fill","fill-opacity","fill-rule","filter","height","mask","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","width","x","xlink:href","y","overflow"],annotation:["encoding"],"annotation-xml":["encoding"],maction:["actiontype","other","selection"],math:["xmlns"],menclose:["notation"],merror:[],mfrac:["linethickness"],mi:["mathvariant"],mmultiscripts:[],mn:[],mo:["fence","lspace","maxsize","minsize","rspace","stretchy"],mover:[],mpadded:["lspace","width","height","depth","voffset"],mphantom:[],mprescripts:[],mroot:[],mrow:["xlink:href","xlink:type","xmlns:xlink"],mspace:["depth","height","width"],msqrt:[],mstyle:["displaystyle","mathbackground","mathcolor","mathvariant","scriptlevel"],msub:[],msubsup:[],msup:[],mtable:["align","columnalign","columnlines","columnspacing","displaystyle","equalcolumns","equalrows","frame","rowalign","rowlines","rowspacing","width"],mtd:["columnalign","columnspan","rowalign","rowspan"],mtext:[],mtr:["columnalign","rowalign"],munder:[],munderover:[],none:[],semantics:[]};Object.keys(Ys).forEach((en=>{Ys[en]=[...Ys[en],...Xs]}));const Zs={};Object.entries(Ys).forEach((en=>{let[tn,nn]=en;const rn={};Object.entries(nn).forEach((en=>{let[tn,nn]=en;if(nn.includes(":")){const en=nn.split(":");rn[en[1]]=ka[en[0].toUpperCase()]}else rn[nn]="xmlns"===nn?ka.XMLNS:null})),Zs[tn]=rn}));const sanitizeSvg=en=>{if(3===en.nodeType&&(en.nodeValue=en.nodeValue.trim(),en.nodeValue.length||en.remove()),1!==en.nodeType)return;const tn=en.ownerDocument,nn=en.parentNode;if(!tn||!nn)return;const rn=Ys[en.nodeName],an=Zs[en.nodeName];if(void 0!==rn){const tn=[];let nn=en.attributes.length;for(;nn--;){const sn=en.attributes.item(nn),cn=sn.nodeName,An=sn.localName,dn=sn.namespaceURI;if(dn!==an[An]&&dn!==ka.XMLNS&&(dn!==ka.XMLNS||!Ws[sn.value]))if(cn.startsWith("se:")||cn.startsWith("oi:")||cn.startsWith("data-")){const en=cn.startsWith("se:")?ka.SE:cn.startsWith("oi:")?ka.OI:null;tn.push([cn,sn.value,en])}else console.warn("sanitizeSvg: attribute ".concat(cn," in element ").concat(en.nodeName," not in whitelist is removed")),en.removeAttributeNS(dn,An);if("style"===cn){const tn=sn.value.split(";");let nn=tn.length;for(;nn--;){const[an,sn]=tn[nn].split(":"),cn=(an||"").trim(),An=(sn||"").trim();rn.includes(cn)&&en.setAttribute(cn,An)}en.removeAttribute("style")}}Object.values(tn).forEach((tn=>{let[nn,rn,an]=tn;en.setAttributeNS(an,nn,rn)}));const sn=getHref(en);if(sn&&["filter","linearGradient","pattern","radialGradient","textPath","use"].includes(en.nodeName)&&"#"!==sn[0]&&(setHref(en,""),console.warn("sanitizeSvg: attribute href in element ".concat(en.nodeName," pointing to a non-local reference (").concat(sn,") is removed")),en.removeAttributeNS(ka.XLINK,"href")),"use"===en.nodeName&&!getHref(en))return console.warn("sanitizeSvg: element ".concat(en.nodeName," without a xlink:href is removed")),void en.remove();for(Object.values(["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],(tn=>{let nn=en.getAttribute(tn);nn&&(nn=getUrlFromAttr(nn),nn&&"#"!==nn[0]&&(en.setAttribute(tn,""),console.warn("sanitizeSvg: attribute ".concat(tn," in element ").concat(en.nodeName," pointing to a non-local reference (").concat(nn,") is removed")),en.removeAttribute(tn)))})),nn=en.childNodes.length;nn--;)sanitizeSvg(en.childNodes.item(nn))}else{console.warn("sanitizeSvg: element ".concat(en.nodeName," not supported is removed"));const tn=[];for(;en.hasChildNodes();)tn.push(nn.insertBefore(en.firstChild,en));en.remove();let rn=tn.length;for(;rn--;)sanitizeSvg(tn[rn])}};function _typeof$1(en){return _typeof$1="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(en){return typeof en}:function(en){return en&&"function"==typeof Symbol&&en.constructor===Symbol&&en!==Symbol.prototype?"symbol":typeof en},_typeof$1(en)}var Js=Uint8Array,el=Uint16Array,tl=Uint32Array,nl=new Js([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),rl=new Js([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),ol=new Js([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),freb=function(en,tn){for(var nn=new el(31),rn=0;rn<31;++rn)nn[rn]=tn+=1<>>1|(21845&ul)<<1;pl=(61680&(pl=(52428&pl)>>>2|(13107&pl)<<2))>>>4|(3855&pl)<<4,dl[ul]=((65280&pl)>>>8|(255&pl)<<8)>>>1}var hMap=function(en,tn,nn){for(var rn=en.length,an=0,sn=new el(tn);an>>dn]=un}else for(cn=new el(rn),an=0;an>>15-en[an];return cn},hl=new Js(288);for(ul=0;ul<144;++ul)hl[ul]=8;for(ul=144;ul<256;++ul)hl[ul]=9;for(ul=256;ul<280;++ul)hl[ul]=7;for(ul=280;ul<288;++ul)hl[ul]=8;var gl=new Js(32);for(ul=0;ul<32;++ul)gl[ul]=5;var _l=hMap(hl,9,0),ml=hMap(hl,9,1),fl=hMap(gl,5,0),yl=hMap(gl,5,1),max$3=function(en){for(var tn=en[0],nn=1;nntn&&(tn=en[nn]);return tn},bits=function(en,tn,nn){var rn=tn/8>>0;return(en[rn]|en[rn+1]<<8)>>>(7&tn)&nn},bits16=function(en,tn){var nn=tn/8>>0;return(en[nn]|en[nn+1]<<8|en[nn+2]<<16)>>>(7&tn)},shft=function(en){return(en/8>>0)+(7&en&&1)},slc=function(en,tn,nn){(null==tn||tn<0)&&(tn=0),(null==nn||nn>en.length)&&(nn=en.length);var rn=new(en instanceof el?el:en instanceof tl?tl:Js)(nn-tn);return rn.set(en.subarray(tn,nn)),rn},wbits=function(en,tn,nn){nn<<=7&tn;var rn=tn/8>>0;en[rn]|=nn,en[rn+1]|=nn>>>8},wbits16=function(en,tn,nn){nn<<=7&tn;var rn=tn/8>>0;en[rn]|=nn,en[rn+1]|=nn>>>8,en[rn+2]|=nn>>>16},hTree=function(en,tn){for(var nn=[],rn=0;rngn&&(gn=sn[rn].s);var _n=new el(gn+1),mn=ln(nn[pn-1],_n,0);if(mn>tn){rn=0;var fn=0,yn=mn-tn,bn=1<tn))break;fn+=bn-(1<>>=yn;fn>0;){var wn=sn[rn].s;_n[wn]=0&&fn;--rn){var xn=sn[rn].s;_n[xn]==tn&&(--_n[xn],++fn)}mn=tn}return[new Js(_n),mn]},ln=function(en,tn,nn){return-1==en.s?Math.max(ln(en.l,tn,nn+1),ln(en.r,tn,nn+1)):tn[en.s]=nn},lc=function(en){for(var tn=en.length;tn&&!en[--tn];);for(var nn=new el(++tn),rn=0,an=en[0],sn=1,w=function(en){nn[rn++]=en},cn=1;cn<=tn;++cn)if(en[cn]==an&&cn!=tn)++sn;else{if(!an&&sn>2){for(;sn>138;sn-=138)w(32754);sn>2&&(w(sn>10?sn-11<<5|28690:sn-3<<5|12305),sn=0)}else if(sn>3){for(w(an),--sn;sn>6;sn-=6)w(8304);sn>2&&(w(sn-3<<5|8208),sn=0)}for(;sn--;)w(an);sn=1,an=en[cn]}return[nn.subarray(0,rn),tn]},clen=function(en,tn){for(var nn=0,rn=0;rn>>8,en[an+2]=255^en[an],en[an+3]=255^en[an+1];for(var sn=0;sn4&&!jn[ol[Pn-1]];--Pn);var Tn,Fn,Un,Nn,In=un+5<<3,Mn=clen(an,hl)+clen(sn,gl)+cn,Rn=clen(an,gn)+clen(sn,fn)+cn+14+3*Pn+clen(Sn,jn)+(2*Sn[16]+3*Sn[17]+7*Sn[18]);if(In<=Mn&&In<=Rn)return wfblk(tn,pn,en.subarray(dn,dn+un));if(wbits(tn,pn,1+(Rn15&&(wbits(tn,pn,Vn[Bn]>>>5&127),pn+=Vn[Bn]>>>12)}}}else Tn=_l,Fn=hl,Un=fl,Nn=gl;for(Bn=0;Bn255){Gn=rn[Bn]>>>18&31,wbits16(tn,pn,Tn[Gn+257]),pn+=Fn[Gn+257],Gn>7&&(wbits(tn,pn,rn[Bn]>>>23&31),pn+=nl[Gn]);var Dn=31&rn[Bn];wbits16(tn,pn,Un[Dn]),pn+=Nn[Dn],Dn>3&&(wbits16(tn,pn,rn[Bn]>>>5&8191),pn+=rl[Dn])}else wbits16(tn,pn,Tn[rn[Bn]]),pn+=Fn[rn[Bn]];return wbits16(tn,pn,Tn[256]),pn+Fn[256]},bl=new tl([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),vl=new Js(0);function zlibSync(en,tn){void 0===tn&&(tn={});var nn=function(){var en=1,tn=0;return{p:function(nn){for(var rn=en,an=tn,sn=nn.length,cn=0;cn!=sn;){for(var An=Math.min(cn+5552,sn);cn>>8<<16|(255&tn)<<8|tn>>>8)+2*((255&en)<<23)}}}();nn.p(en);var rn=function(en,tn,nn,rn,an){return function(en,tn,nn,rn,an,sn){var cn=en.length,An=new Js(rn+cn+5*(1+Math.floor(cn/7e3))+an),dn=An.subarray(rn,An.length-an),un=0;if(!tn||cn<8)for(var pn=0;pn<=cn;pn+=65535){var hn=pn+65535;hn>>13,mn=8191&gn,fn=(1<7e3||En>24576)&&Un>423){un=wblk(en,dn,0,xn,kn,Cn,Bn,En,Ln,pn-Ln,un),En=Sn=Bn=0,Ln=pn;for(var Nn=0;Nn<286;++Nn)kn[Nn]=0;for(Nn=0;Nn<30;++Nn)Cn[Nn]=0}var In=2,Mn=0,Rn=mn,On=Tn-Fn&32767;if(Un>2&&Pn==hsh(pn-On))for(var Qn=Math.min(_n,Un)-1,qn=Math.min(32767,pn),Vn=Math.min(258,Un);On<=qn&&--Rn&&Tn!=Fn;){if(en[pn+In]==en[pn+In-On]){for(var Gn=0;GnIn){if(In=Gn,Mn=On,Gn>Qn)break;var Dn=Math.min(On,Gn-2),Hn=0;for(Nn=0;NnHn&&(Hn=Kn,Fn=zn)}}}On+=(Tn=Fn)-(Fn=yn[Tn])+32768&32767}if(Mn){xn[En++]=268435456|sl[In]<<18|Al[Mn];var $n=31&sl[In],Wn=31&Al[Mn];Bn+=nl[$n]+rl[Wn],++kn[257+$n],++Cn[Wn],jn=pn+In,++Sn}else xn[En++]=en[pn],++kn[en[pn]]}}un=wblk(en,dn,sn,xn,kn,Cn,Bn,En,Ln,pn-Ln,un),sn||(un=wfblk(dn,un,vl))}return slc(An,0,rn+shft(un)+an)}(en,null==tn.level?6:tn.level,null==tn.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(en.length)))):12+tn.mem,nn,rn,!an)}(en,tn,2,4);return function(en,tn){var nn=tn.level,rn=0==nn?0:nn<6?1:9==nn?3:2;en[0]=120,en[1]=rn<<6|(rn?32-2*rn:1)}(rn,tn),function(en,tn,nn){for(;nn;++tn)en[tn]=nn,nn>>>=8}(rn,rn.length-4,nn.d()),rn} /** @license * * jsPDF - PDF Document creation from JavaScript * Version 2.5.1 Built on 2022-01-28T15:37:57.791Z * CommitID 00000000 * * Copyright (c) 2010-2021 James Hall , https://github.com/MrRio/jsPDF * 2015-2021 yWorks GmbH, http://www.yworks.com * 2015-2021 Lukas Holländer , https://github.com/HackbrettXXX * 2016-2018 Aras Abbasi * 2010 Aaron Spike, https://github.com/acspike * 2012 Willow Systems Corporation, https://github.com/willowsystems * 2012 Pablo Hess, https://github.com/pablohess * 2012 Florian Jenett, https://github.com/fjenett * 2013 Warren Weckesser, https://github.com/warrenweckesser * 2013 Youssef Beddad, https://github.com/lifof * 2013 Lee Driscoll, https://github.com/lsdriscoll * 2013 Stefan Slonevskiy, https://github.com/stefslon * 2013 Jeremy Morel, https://github.com/jmorel * 2013 Christoph Hartmann, https://github.com/chris-rock * 2014 Juan Pablo Gaviria, https://github.com/juanpgaviria * 2014 James Makes, https://github.com/dollaruw * 2014 Diego Casorran, https://github.com/diegocr * 2014 Steven Spungin, https://github.com/Flamenco * 2014 Kenneth Glassey, https://github.com/Gavvers * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Contributor(s): * siefkenj, ahwolf, rickygu, Midnith, saintclair, eaparango, * kim3er, mfo, alnorth, Flamenco */ var wl=function(){return"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this}();function i$2(){wl.console&&"function"==typeof wl.console.log&&wl.console.log.apply(wl.console,arguments)}var xl={log:i$2,warn:function(en){wl.console&&("function"==typeof wl.console.warn?wl.console.warn.apply(wl.console,arguments):i$2.call(null,arguments))},error:function(en){wl.console&&("function"==typeof wl.console.error?wl.console.error.apply(wl.console,arguments):i$2(en))}};function o$1(en,tn,nn){var rn=new XMLHttpRequest;rn.open("GET",en),rn.responseType="blob",rn.onload=function(){Sl(rn.response,tn,nn)},rn.onerror=function(){xl.error("could not download file")},rn.send()}function s$1(en){var tn=new XMLHttpRequest;tn.open("HEAD",en,!1);try{tn.send()}catch(en){}return tn.status>=200&&tn.status<=299}function c$2(en){try{en.dispatchEvent(new MouseEvent("click"))}catch(nn){var tn=document.createEvent("MouseEvents");tn.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),en.dispatchEvent(tn)}}var kl,Cl,Sl=wl.saveAs||("object"!==("undefined"==typeof window?"undefined":_typeof$1(window))||window!==wl?function(){}:"undefined"!=typeof HTMLAnchorElement&&"download"in HTMLAnchorElement.prototype?function(en,tn,nn){var rn=wl.URL||wl.webkitURL,an=document.createElement("a");tn=tn||en.name||"download",an.download=tn,an.rel="noopener","string"==typeof en?(an.href=en,an.origin!==location.origin?s$1(an.href)?o$1(en,tn,nn):c$2(an,an.target="_blank"):c$2(an)):(an.href=rn.createObjectURL(en),setTimeout((function(){rn.revokeObjectURL(an.href)}),4e4),setTimeout((function(){c$2(an)}),0))}:"msSaveOrOpenBlob"in navigator?function(en,tn,nn){if(tn=tn||en.name||"download","string"==typeof en)if(s$1(en))o$1(en,tn,nn);else{var rn=document.createElement("a");rn.href=en,rn.target="_blank",setTimeout((function(){c$2(rn)}))}else navigator.msSaveOrOpenBlob(function(en,tn){return void 0===tn?tn={autoBom:!1}:"object"!==_typeof$1(tn)&&(xl.warn("Deprecated: Expected third argument to be a object"),tn={autoBom:!tn}),tn.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(en.type)?new Blob([String.fromCharCode(65279),en],{type:en.type}):en}(en,nn),tn)}:function(en,tn,nn,rn){if((rn=rn||open("","_blank"))&&(rn.document.title=rn.document.body.innerText="downloading..."),"string"==typeof en)return o$1(en,tn,nn);var an="application/octet-stream"===en.type,sn=/constructor/i.test(wl.HTMLElement)||wl.safari,cn=/CriOS\/[\d]+/.test(navigator.userAgent);if((cn||an&&sn)&&"object"===("undefined"==typeof FileReader?"undefined":_typeof$1(FileReader))){var An=new FileReader;An.onloadend=function(){var en=An.result;en=cn?en:en.replace(/^data:[^;]*;/,"data:attachment/file;"),rn?rn.location.href=en:location=en,rn=null},An.readAsDataURL(en)}else{var dn=wl.URL||wl.webkitURL,un=dn.createObjectURL(en);rn?rn.location=un:location.href=un,rn=null,setTimeout((function(){dn.revokeObjectURL(un)}),4e4)}}); /** * A class to parse color values * @author Stoyan Stefanov * {@link http://www.phpied.com/rgb-color-parser-in-javascript/} * @license Use it if you like it */function f$1(en){var tn;en=en||"",this.ok=!1,"#"==en.charAt(0)&&(en=en.substr(1,6)),en={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"}[en=(en=en.replace(/ /g,"")).toLowerCase()]||en;for(var nn=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(en){return[parseInt(en[1]),parseInt(en[2]),parseInt(en[3])]}},{re:/^(\w{2})(\w{2})(\w{2})$/,example:["#00ff00","336699"],process:function(en){return[parseInt(en[1],16),parseInt(en[2],16),parseInt(en[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:["#fb0","f0f"],process:function(en){return[parseInt(en[1]+en[1],16),parseInt(en[2]+en[2],16),parseInt(en[3]+en[3],16)]}}],rn=0;rn255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toHex=function(){var en=this.r.toString(16),tn=this.g.toString(16),nn=this.b.toString(16);return 1==en.length&&(en="0"+en),1==tn.length&&(tn="0"+tn),1==nn.length&&(nn="0"+nn),"#"+en+tn+nn}} /** * @license * Joseph Myers does not specify a particular license for his work. * * Author: Joseph Myers * Accessed from: http://www.myersdaily.org/joseph/javascript/md5.js * * Modified by: Owen Leong */function d(en,tn){var nn=en[0],rn=en[1],an=en[2],sn=en[3];nn=g(nn,rn,an,sn,tn[0],7,-680876936),sn=g(sn,nn,rn,an,tn[1],12,-389564586),an=g(an,sn,nn,rn,tn[2],17,606105819),rn=g(rn,an,sn,nn,tn[3],22,-1044525330),nn=g(nn,rn,an,sn,tn[4],7,-176418897),sn=g(sn,nn,rn,an,tn[5],12,1200080426),an=g(an,sn,nn,rn,tn[6],17,-1473231341),rn=g(rn,an,sn,nn,tn[7],22,-45705983),nn=g(nn,rn,an,sn,tn[8],7,1770035416),sn=g(sn,nn,rn,an,tn[9],12,-1958414417),an=g(an,sn,nn,rn,tn[10],17,-42063),rn=g(rn,an,sn,nn,tn[11],22,-1990404162),nn=g(nn,rn,an,sn,tn[12],7,1804603682),sn=g(sn,nn,rn,an,tn[13],12,-40341101),an=g(an,sn,nn,rn,tn[14],17,-1502002290),nn=m$2(nn,rn=g(rn,an,sn,nn,tn[15],22,1236535329),an,sn,tn[1],5,-165796510),sn=m$2(sn,nn,rn,an,tn[6],9,-1069501632),an=m$2(an,sn,nn,rn,tn[11],14,643717713),rn=m$2(rn,an,sn,nn,tn[0],20,-373897302),nn=m$2(nn,rn,an,sn,tn[5],5,-701558691),sn=m$2(sn,nn,rn,an,tn[10],9,38016083),an=m$2(an,sn,nn,rn,tn[15],14,-660478335),rn=m$2(rn,an,sn,nn,tn[4],20,-405537848),nn=m$2(nn,rn,an,sn,tn[9],5,568446438),sn=m$2(sn,nn,rn,an,tn[14],9,-1019803690),an=m$2(an,sn,nn,rn,tn[3],14,-187363961),rn=m$2(rn,an,sn,nn,tn[8],20,1163531501),nn=m$2(nn,rn,an,sn,tn[13],5,-1444681467),sn=m$2(sn,nn,rn,an,tn[2],9,-51403784),an=m$2(an,sn,nn,rn,tn[7],14,1735328473),nn=v$1(nn,rn=m$2(rn,an,sn,nn,tn[12],20,-1926607734),an,sn,tn[5],4,-378558),sn=v$1(sn,nn,rn,an,tn[8],11,-2022574463),an=v$1(an,sn,nn,rn,tn[11],16,1839030562),rn=v$1(rn,an,sn,nn,tn[14],23,-35309556),nn=v$1(nn,rn,an,sn,tn[1],4,-1530992060),sn=v$1(sn,nn,rn,an,tn[4],11,1272893353),an=v$1(an,sn,nn,rn,tn[7],16,-155497632),rn=v$1(rn,an,sn,nn,tn[10],23,-1094730640),nn=v$1(nn,rn,an,sn,tn[13],4,681279174),sn=v$1(sn,nn,rn,an,tn[0],11,-358537222),an=v$1(an,sn,nn,rn,tn[3],16,-722521979),rn=v$1(rn,an,sn,nn,tn[6],23,76029189),nn=v$1(nn,rn,an,sn,tn[9],4,-640364487),sn=v$1(sn,nn,rn,an,tn[12],11,-421815835),an=v$1(an,sn,nn,rn,tn[15],16,530742520),nn=b(nn,rn=v$1(rn,an,sn,nn,tn[2],23,-995338651),an,sn,tn[0],6,-198630844),sn=b(sn,nn,rn,an,tn[7],10,1126891415),an=b(an,sn,nn,rn,tn[14],15,-1416354905),rn=b(rn,an,sn,nn,tn[5],21,-57434055),nn=b(nn,rn,an,sn,tn[12],6,1700485571),sn=b(sn,nn,rn,an,tn[3],10,-1894986606),an=b(an,sn,nn,rn,tn[10],15,-1051523),rn=b(rn,an,sn,nn,tn[1],21,-2054922799),nn=b(nn,rn,an,sn,tn[8],6,1873313359),sn=b(sn,nn,rn,an,tn[15],10,-30611744),an=b(an,sn,nn,rn,tn[6],15,-1560198380),rn=b(rn,an,sn,nn,tn[13],21,1309151649),nn=b(nn,rn,an,sn,tn[4],6,-145523070),sn=b(sn,nn,rn,an,tn[11],10,-1120210379),an=b(an,sn,nn,rn,tn[2],15,718787259),rn=b(rn,an,sn,nn,tn[9],21,-343485551),en[0]=_$1(nn,en[0]),en[1]=_$1(rn,en[1]),en[2]=_$1(an,en[2]),en[3]=_$1(sn,en[3])}function p$1(en,tn,nn,rn,an,sn){return tn=_$1(_$1(tn,en),_$1(rn,sn)),_$1(tn<>>32-an,nn)}function g(en,tn,nn,rn,an,sn,cn){return p$1(tn&nn|~tn&rn,en,tn,an,sn,cn)}function m$2(en,tn,nn,rn,an,sn,cn){return p$1(tn&rn|nn&~rn,en,tn,an,sn,cn)}function v$1(en,tn,nn,rn,an,sn,cn){return p$1(tn^nn^rn,en,tn,an,sn,cn)}function b(en,tn,nn,rn,an,sn,cn){return p$1(nn^(tn|~rn),en,tn,an,sn,cn)}function y$1(en){var tn,nn=en.length,rn=[1732584193,-271733879,-1732584194,271733878];for(tn=64;tn<=en.length;tn+=64)d(rn,w(en.substring(tn-64,tn)));en=en.substring(tn-64);var an=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(tn=0;tn>2]|=en.charCodeAt(tn)<<(tn%4<<3);if(an[tn>>2]|=128<<(tn%4<<3),tn>55)for(d(rn,an),tn=0;tn<16;tn++)an[tn]=0;return an[14]=8*nn,d(rn,an),rn}function w(en){var tn,nn=[];for(tn=0;tn<64;tn+=4)nn[tn>>2]=en.charCodeAt(tn)+(en.charCodeAt(tn+1)<<8)+(en.charCodeAt(tn+2)<<16)+(en.charCodeAt(tn+3)<<24);return nn}kl=wl.atob.bind(wl),Cl=wl.btoa.bind(wl);var Bl="0123456789abcdef".split("");function L(en){for(var tn="",nn=0;nn<4;nn++)tn+=Bl[en>>8*nn+4&15]+Bl[en>>8*nn&15];return tn}function A(en){return String.fromCharCode((255&en)>>0,(65280&en)>>8,(16711680&en)>>16,(4278190080&en)>>24)}function x(en){return y$1(en).map(A).join("")}var El="5d41402abc4b2a76b9719d911017c592"!=function(en){for(var tn=0;tn>16)+(tn>>16)+(nn>>16)<<16|65535&nn}return en+tn&4294967295} /** * @license * FPDF is released under a permissive license: there is no usage restriction. * You may embed it freely in your application (commercial or not), with or * without modifications. * * Reference: http://www.fpdf.org/en/script/script37.php */function P(en,tn){var nn,rn,an,sn;if(en!==nn){for(var cn=(an=en,sn=1+(256/en.length>>0),new Array(sn+1).join(an)),An=[],dn=0;dn<256;dn++)An[dn]=dn;var un=0;for(dn=0;dn<256;dn++){var pn=An[dn];un=(un+pn+cn.charCodeAt(dn))%256,An[dn]=An[un],An[un]=pn}nn=en,rn=An}else An=rn;var hn=tn.length,gn=0,_n=0,mn="";for(dn=0;dn€/\f©þdSiz";var sn=(tn+this.padding).substr(0,32),cn=(nn+this.padding).substr(0,32);this.O=this.processOwnerPassword(sn,cn),this.P=-(1+(255^an)),this.encryptionKey=x(sn+this.O+this.lsbFirstWord(this.P)+this.hexToBytes(rn)).substr(0,5),this.U=P(this.encryptionKey,this.padding)}function F(en){if(/[^\u0000-\u00ff]/.test(en))throw new Error("Invalid PDF Name Object: "+en+", Only accept ASCII characters.");for(var tn="",nn=en.length,rn=0;rn126?"#"+("0"+an.toString(16)).slice(-2):en[rn]}return tn}function C(en){if("object"!==_typeof$1(en))throw new Error("Invalid Context passed to initialize PubSub (jsPDF-module)");var tn={};this.subscribe=function(en,nn,rn){if(rn=rn||!1,"string"!=typeof en||"function"!=typeof nn||"boolean"!=typeof rn)throw new Error("Invalid arguments passed to PubSub.subscribe (jsPDF-module)");tn.hasOwnProperty(en)||(tn[en]={});var an=Math.random().toString(35);return tn[en][an]=[nn,!!rn],an},this.unsubscribe=function(en){for(var nn in tn)if(tn[nn][en])return delete tn[nn][en],0===Object.keys(tn[nn]).length&&delete tn[nn],!0;return!1},this.publish=function(nn){if(tn.hasOwnProperty(nn)){var rn=Array.prototype.slice.call(arguments,1),an=[];for(var sn in tn[nn]){var cn=tn[nn][sn];try{cn[0].apply(en,rn)}catch(nn){wl.console&&xl.error("jsPDF PubSub Error",nn.message,nn)}cn[1]&&an.push(sn)}an.length&&an.forEach(this.unsubscribe)}},this.getTopics=function(){return tn}}function j(en){if(!(this instanceof j))return new j(en);var tn="opacity,stroke-opacity".split(",");for(var nn in en)en.hasOwnProperty(nn)&&tn.indexOf(nn)>=0&&(this[nn]=en[nn]);this.id="",this.objectNumber=-1}function O$1(en,tn){this.gState=en,this.matrix=tn,this.id="",this.objectNumber=-1}function B(en,tn,nn,rn,an){if(!(this instanceof B))return new B(en,tn,nn,rn,an);this.type="axial"===en?2:3,this.coords=tn,this.colors=nn,O$1.call(this,rn,an)}function M(en,tn,nn,rn,an){if(!(this instanceof M))return new M(en,tn,nn,rn,an);this.boundingBox=en,this.xStep=tn,this.yStep=nn,this.stream="",this.cloneIndex=0,O$1.call(this,rn,an)}function E(en){var tn,nn="string"==typeof arguments[0]?arguments[0]:"p",rn=arguments[1],an=arguments[2],sn=arguments[3],cn=[],An=1,dn=16,un="S",pn=null;"object"===_typeof$1(en=en||{})&&(nn=en.orientation,rn=en.unit||rn,an=en.format||an,sn=en.compress||en.compressPdf||sn,null!==(pn=en.encryption||null)&&(pn.userPassword=pn.userPassword||"",pn.ownerPassword=pn.ownerPassword||"",pn.userPermissions=pn.userPermissions||[]),An="number"==typeof en.userUnit?Math.abs(en.userUnit):1,void 0!==en.precision&&(tn=en.precision),void 0!==en.floatPrecision&&(dn=en.floatPrecision),un=en.defaultPathOperation||"S"),cn=en.filters||(!0===sn?["FlateEncode"]:cn),rn=rn||"mm",nn=(""+(nn||"P")).toLowerCase();var hn=en.putOnlyUsedFonts||!1,gn={},_n={internal:{},__private__:{}};_n.__private__.PubSub=C;var mn="1.3",fn=_n.__private__.getPdfVersion=function(){return mn};_n.__private__.setPdfVersion=function(en){mn=en};var yn={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]};_n.__private__.getPageFormats=function(){return yn};var bn=_n.__private__.getPageFormat=function(en){return yn[en]};an=an||"a4";var vn={COMPAT:"compat",ADVANCED:"advanced"},wn=vn.COMPAT;function _(){this.saveGraphicsState(),$n(new po(Kr,0,0,-Kr,0,fi()*Kr).toString()+" cm"),this.setFontSize(this.getFontSize()/Kr),un="n",wn=vn.ADVANCED}function P(){this.restoreGraphicsState(),un="S",wn=vn.COMPAT}var xn=_n.__private__.combineFontStyleAndFontWeight=function(en,tn){if("bold"==en&&"normal"==tn||"bold"==en&&400==tn||"normal"==en&&"italic"==tn||"bold"==en&&"italic"==tn)throw new Error("Invalid Combination of fontweight and fontstyle");return tn&&(en=400==tn||"normal"===tn?"italic"===en?"italic":"normal":700!=tn&&"bold"!==tn||"normal"!==en?(700==tn?"bold":tn)+""+en:"bold"),en};_n.advancedAPI=function(en){var tn=wn===vn.COMPAT;return tn&&_.call(this),"function"!=typeof en||(en(this),tn&&P.call(this)),this},_n.compatAPI=function(en){var tn=wn===vn.ADVANCED;return tn&&P.call(this),"function"!=typeof en||(en(this),tn&&_.call(this)),this},_n.isAdvancedAPI=function(){return wn===vn.ADVANCED};var kn,q=function(en){if(wn!==vn.ADVANCED)throw new Error(en+" is only available in 'advanced' API mode. You need to call advancedAPI() first.")},Cn=_n.roundToPrecision=_n.__private__.roundToPrecision=function(en,nn){var rn=tn||nn;if(isNaN(en)||isNaN(rn))throw new Error("Invalid argument passed to jsPDF.roundToPrecision");return en.toFixed(rn).replace(/0+$/,"")};kn=_n.hpf=_n.__private__.hpf="number"==typeof dn?function(en){if(isNaN(en))throw new Error("Invalid argument passed to jsPDF.hpf");return Cn(en,dn)}:"smart"===dn?function(en){if(isNaN(en))throw new Error("Invalid argument passed to jsPDF.hpf");return Cn(en,en>-1&&en<1?16:5)}:function(en){if(isNaN(en))throw new Error("Invalid argument passed to jsPDF.hpf");return Cn(en,16)};var Sn=_n.f2=_n.__private__.f2=function(en){if(isNaN(en))throw new Error("Invalid argument passed to jsPDF.f2");return Cn(en,2)},Bn=_n.__private__.f3=function(en){if(isNaN(en))throw new Error("Invalid argument passed to jsPDF.f3");return Cn(en,3)},En=_n.scale=_n.__private__.scale=function(en){if(isNaN(en))throw new Error("Invalid argument passed to jsPDF.scale");return wn===vn.COMPAT?en*Kr:wn===vn.ADVANCED?en:void 0},z=function(en){return wn===vn.COMPAT?fi()-en:wn===vn.ADVANCED?en:void 0},H=function(en){return En(z(en))};_n.__private__.setPrecision=_n.setPrecision=function(en){"number"==typeof parseInt(en,10)&&(tn=parseInt(en,10))};var jn,Ln="00000000000000000000000000000000",Pn=_n.__private__.getFileId=function(){return Ln},Tn=_n.__private__.setFileId=function(en){return Ln=void 0!==en&&/^[a-fA-F0-9]{32}$/.test(en)?en.toUpperCase():Ln.split("").map((function(){return"ABCDEF0123456789".charAt(Math.floor(16*Math.random()))})).join(""),null!==pn&&(Ro=new I(pn.userPermissions,pn.userPassword,pn.ownerPassword,Ln)),Ln};_n.setFileId=function(en){return Tn(en),this},_n.getFileId=function(){return Pn()};var Fn=_n.__private__.convertDateToPDFDate=function(en){var tn=en.getTimezoneOffset(),nn=tn<0?"+":"-",rn=Math.floor(Math.abs(tn/60)),an=Math.abs(tn%60),sn=[nn,Rn(rn),"'",Rn(an),"'"].join("");return["D:",en.getFullYear(),Rn(en.getMonth()+1),Rn(en.getDate()),Rn(en.getHours()),Rn(en.getMinutes()),Rn(en.getSeconds()),sn].join("")},Un=_n.__private__.convertPDFDateToDate=function(en){var tn=parseInt(en.substr(2,4),10),nn=parseInt(en.substr(6,2),10)-1,rn=parseInt(en.substr(8,2),10),an=parseInt(en.substr(10,2),10),sn=parseInt(en.substr(12,2),10),cn=parseInt(en.substr(14,2),10);return new Date(tn,nn,rn,an,sn,cn,0)},Nn=_n.__private__.setCreationDate=function(en){var tn;if(void 0===en&&(en=new Date),en instanceof Date)tn=Fn(en);else{if(!/^D:(20[0-2][0-9]|203[0-7]|19[7-9][0-9])(0[0-9]|1[0-2])([0-2][0-9]|3[0-1])(0[0-9]|1[0-9]|2[0-3])(0[0-9]|[1-5][0-9])(0[0-9]|[1-5][0-9])(\+0[0-9]|\+1[0-4]|-0[0-9]|-1[0-1])'(0[0-9]|[1-5][0-9])'?$/.test(en))throw new Error("Invalid argument passed to jsPDF.setCreationDate");tn=en}return jn=tn},In=_n.__private__.getCreationDate=function(en){var tn=jn;return"jsDate"===en&&(tn=Un(jn)),tn};_n.setCreationDate=function(en){return Nn(en),this},_n.getCreationDate=function(en){return In(en)};var Mn,Rn=_n.__private__.padd2=function(en){return("0"+parseInt(en)).slice(-2)},On=_n.__private__.padd2Hex=function(en){return("00"+(en=en.toString())).substr(en.length)},Qn=0,qn=[],Vn=[],Gn=0,Dn=[],Hn=[],zn=!1,Kn=Vn,ut=function(){Qn=0,Gn=0,Vn=[],qn=[],Dn=[],yo=mo(),bo=mo()};_n.__private__.setCustomOutputDestination=function(en){zn=!0,Kn=en};var ht=function(en){zn||(Kn=en)};_n.__private__.resetCustomOutputDestination=function(){zn=!1,Kn=Vn};var $n=_n.__private__.out=function(en){return en=en.toString(),Gn+=en.length+1,Kn.push(en),Kn},Wn=_n.__private__.write=function(en){return $n(1===arguments.length?en.toString():Array.prototype.join.call(arguments," "))},Xn=_n.__private__.getArrayBuffer=function(en){for(var tn=en.length,nn=new ArrayBuffer(tn),rn=new Uint8Array(nn);tn--;)rn[tn]=en.charCodeAt(tn);return nn},Yn=[["Helvetica","helvetica","normal","WinAnsiEncoding"],["Helvetica-Bold","helvetica","bold","WinAnsiEncoding"],["Helvetica-Oblique","helvetica","italic","WinAnsiEncoding"],["Helvetica-BoldOblique","helvetica","bolditalic","WinAnsiEncoding"],["Courier","courier","normal","WinAnsiEncoding"],["Courier-Bold","courier","bold","WinAnsiEncoding"],["Courier-Oblique","courier","italic","WinAnsiEncoding"],["Courier-BoldOblique","courier","bolditalic","WinAnsiEncoding"],["Times-Roman","times","normal","WinAnsiEncoding"],["Times-Bold","times","bold","WinAnsiEncoding"],["Times-Italic","times","italic","WinAnsiEncoding"],["Times-BoldItalic","times","bolditalic","WinAnsiEncoding"],["ZapfDingbats","zapfdingbats","normal",null],["Symbol","symbol","normal",null]];_n.__private__.getStandardFonts=function(){return Yn};var Zn=en.fontSize||16;_n.__private__.setFontSize=_n.setFontSize=function(en){return Zn=wn===vn.ADVANCED?en/Kr:en,this};var Jn,Tr=_n.__private__.getFontSize=_n.getFontSize=function(){return wn===vn.COMPAT?Zn:Zn*Kr},Ur=en.R2L||!1;_n.__private__.setR2L=_n.setR2L=function(en){return Ur=en,this},_n.__private__.getR2L=_n.getR2L=function(){return Ur};var Rr,Qr=_n.__private__.setZoomMode=function(en){if(/^(?:\d+\.\d*|\d*\.\d+|\d+)%$/.test(en))Jn=en;else if(isNaN(en)){if(-1===[void 0,null,"fullwidth","fullheight","fullpage","original"].indexOf(en))throw new Error('zoom must be Integer (e.g. 2), a percentage Value (e.g. 300%) or fullwidth, fullheight, fullpage, original. "'+en+'" is not recognized.');Jn=en}else Jn=parseInt(en,10)};_n.__private__.getZoomMode=function(){return Jn};var Vr,Gr=_n.__private__.setPageMode=function(en){if(-1==[void 0,null,"UseNone","UseOutlines","UseThumbs","FullScreen"].indexOf(en))throw new Error('Page mode must be one of UseNone, UseOutlines, UseThumbs, or FullScreen. "'+en+'" is not recognized.');Rr=en};_n.__private__.getPageMode=function(){return Rr};var Dr=_n.__private__.setLayoutMode=function(en){if(-1==[void 0,null,"continuous","single","twoleft","tworight","two"].indexOf(en))throw new Error('Layout mode must be one of continuous, single, twoleft, tworight. "'+en+'" is not recognized.');Vr=en};_n.__private__.getLayoutMode=function(){return Vr},_n.__private__.setDisplayMode=_n.setDisplayMode=function(en,tn,nn){return Qr(en),Dr(tn),Gr(nn),this};var Hr={title:"",subject:"",author:"",keywords:"",creator:""};_n.__private__.getDocumentProperty=function(en){if(-1===Object.keys(Hr).indexOf(en))throw new Error("Invalid argument passed to jsPDF.getDocumentProperty");return Hr[en]},_n.__private__.getDocumentProperties=function(){return Hr},_n.__private__.setDocumentProperties=_n.setProperties=_n.setDocumentProperties=function(en){for(var tn in Hr)Hr.hasOwnProperty(tn)&&en[tn]&&(Hr[tn]=en[tn]);return this},_n.__private__.setDocumentProperty=function(en,tn){if(-1===Object.keys(Hr).indexOf(en))throw new Error("Invalid arguments passed to jsPDF.setDocumentProperty");return Hr[en]=tn};var zr,Kr,$r,Wr,Xr,Yr={},Zr={},Jr=[],eo={},to={},no={},ro={},oo=null,io=0,ao=[],so=new C(_n),lo=en.hotfixes||[],co={},Ao={},uo=[],po=function t(en,tn,nn,rn,an,sn){if(!(this instanceof t))return new t(en,tn,nn,rn,an,sn);isNaN(en)&&(en=1),isNaN(tn)&&(tn=0),isNaN(nn)&&(nn=0),isNaN(rn)&&(rn=1),isNaN(an)&&(an=0),isNaN(sn)&&(sn=0),this._matrix=[en,tn,nn,rn,an,sn]};Object.defineProperty(po.prototype,"sx",{get:function(){return this._matrix[0]},set:function(en){this._matrix[0]=en}}),Object.defineProperty(po.prototype,"shy",{get:function(){return this._matrix[1]},set:function(en){this._matrix[1]=en}}),Object.defineProperty(po.prototype,"shx",{get:function(){return this._matrix[2]},set:function(en){this._matrix[2]=en}}),Object.defineProperty(po.prototype,"sy",{get:function(){return this._matrix[3]},set:function(en){this._matrix[3]=en}}),Object.defineProperty(po.prototype,"tx",{get:function(){return this._matrix[4]},set:function(en){this._matrix[4]=en}}),Object.defineProperty(po.prototype,"ty",{get:function(){return this._matrix[5]},set:function(en){this._matrix[5]=en}}),Object.defineProperty(po.prototype,"a",{get:function(){return this._matrix[0]},set:function(en){this._matrix[0]=en}}),Object.defineProperty(po.prototype,"b",{get:function(){return this._matrix[1]},set:function(en){this._matrix[1]=en}}),Object.defineProperty(po.prototype,"c",{get:function(){return this._matrix[2]},set:function(en){this._matrix[2]=en}}),Object.defineProperty(po.prototype,"d",{get:function(){return this._matrix[3]},set:function(en){this._matrix[3]=en}}),Object.defineProperty(po.prototype,"e",{get:function(){return this._matrix[4]},set:function(en){this._matrix[4]=en}}),Object.defineProperty(po.prototype,"f",{get:function(){return this._matrix[5]},set:function(en){this._matrix[5]=en}}),Object.defineProperty(po.prototype,"rotation",{get:function(){return Math.atan2(this.shx,this.sx)}}),Object.defineProperty(po.prototype,"scaleX",{get:function(){return this.decompose().scale.sx}}),Object.defineProperty(po.prototype,"scaleY",{get:function(){return this.decompose().scale.sy}}),Object.defineProperty(po.prototype,"isIdentity",{get:function(){return 1===this.sx&&0===this.shy&&0===this.shx&&1===this.sy&&0===this.tx&&0===this.ty}}),po.prototype.join=function(en){return[this.sx,this.shy,this.shx,this.sy,this.tx,this.ty].map(kn).join(en)},po.prototype.multiply=function(en){var tn=en.sx*this.sx+en.shy*this.shx,nn=en.sx*this.shy+en.shy*this.sy,rn=en.shx*this.sx+en.sy*this.shx,an=en.shx*this.shy+en.sy*this.sy,sn=en.tx*this.sx+en.ty*this.shx+this.tx,cn=en.tx*this.shy+en.ty*this.sy+this.ty;return new po(tn,nn,rn,an,sn,cn)},po.prototype.decompose=function(){var en=this.sx,tn=this.shy,nn=this.shx,rn=this.sy,an=this.tx,sn=this.ty,cn=Math.sqrt(en*en+tn*tn),An=(en/=cn)*nn+(tn/=cn)*rn;nn-=en*An,rn-=tn*An;var dn=Math.sqrt(nn*nn+rn*rn);return An/=dn,en*(rn/=dn)>16&255,rn=dn>>8&255,an=255&dn}if(void 0===rn||void 0===sn&&nn===rn&&rn===an)tn="string"==typeof nn?nn+" "+cn[0]:2===en.precision?Sn(nn/255)+" "+cn[0]:Bn(nn/255)+" "+cn[0];else if(void 0===sn||"object"===_typeof$1(sn)){if(sn&&!isNaN(sn.a)&&0===sn.a)return["1.","1.","1.",cn[1]].join(" ");tn="string"==typeof nn?[nn,rn,an,cn[1]].join(" "):2===en.precision?[Sn(nn/255),Sn(rn/255),Sn(an/255),cn[1]].join(" "):[Bn(nn/255),Bn(rn/255),Bn(an/255),cn[1]].join(" ")}else tn="string"==typeof nn?[nn,rn,an,sn,cn[2]].join(" "):2===en.precision?[Sn(nn),Sn(rn),Sn(an),Sn(sn),cn[2]].join(" "):[Bn(nn),Bn(rn),Bn(an),Bn(sn),cn[2]].join(" ");return tn},xo=_n.__private__.getFilters=function(){return cn},ko=_n.__private__.putStream=function(en){var tn=(en=en||{}).data||"",nn=en.filters||xo(),rn=en.alreadyAppliedFilters||[],an=en.addLength1||!1,sn=tn.length,cn=en.objectId,s=function(en){return en};if(null!==pn&&void 0===cn)throw new Error("ObjectId must be passed to putStream for file encryption");null!==pn&&(s=Ro.encryptor(cn,0));var An={};!0===nn&&(nn=["FlateEncode"]);var dn=en.additionalKeyValues||[],un=(An=void 0!==E.API.processDataByFilters?E.API.processDataByFilters(tn,nn):{data:tn,reverseChain:[]}).reverseChain+(Array.isArray(rn)?rn.join(" "):rn.toString());if(0!==An.data.length&&(dn.push({key:"Length",value:An.data.length}),!0===an&&dn.push({key:"Length1",value:sn})),0!=un.length)if(un.split("/").length-1==1)dn.push({key:"Filter",value:un});else{dn.push({key:"Filter",value:"["+un+"]"});for(var hn=0;hn>"),0!==An.data.length&&($n("stream"),$n(s(An.data)),$n("endstream"))},Co=_n.__private__.putPage=function(en){var tn=en.number,nn=en.data,rn=en.objId,an=en.contentsObjId;Zt(rn,!0),$n("<>"),$n("endobj");var sn=nn.join("\n");return wn===vn.ADVANCED&&(sn+="\nQ"),Zt(an,!0),ko({data:sn,filters:xo(),objectId:an}),$n("endobj"),rn},So=_n.__private__.putPages=function(){var en,tn,nn=[];for(en=1;en<=io;en++)ao[en].objId=mo(),ao[en].contentsObjId=mo();for(en=1;en<=io;en++)nn.push(Co({number:en,data:Hn[en],objId:ao[en].objId,contentsObjId:ao[en].contentsObjId,mediaBox:ao[en].mediaBox,cropBox:ao[en].cropBox,bleedBox:ao[en].bleedBox,trimBox:ao[en].trimBox,artBox:ao[en].artBox,userUnit:ao[en].userUnit,rootDictionaryObjId:yo,resourceDictionaryObjId:bo}));Zt(yo,!0),$n("<>"),$n("endobj"),so.publish("postPutPages")},se=function(en){so.publish("putFont",{font:en,out:$n,newObject:_o,putStream:ko}),!0!==en.isAlreadyPutted&&(en.objectNumber=_o(),$n("<<"),$n("/Type /Font"),$n("/BaseFont /"+F(en.postScriptName)),$n("/Subtype /Type1"),"string"==typeof en.encoding&&$n("/Encoding /"+en.encoding),$n("/FirstChar 32"),$n("/LastChar 255"),$n(">>"),$n("endobj"))},ce=function(){for(var en in Yr)Yr.hasOwnProperty(en)&&(!1===hn||!0===hn&&gn.hasOwnProperty(en))&&se(Yr[en])},ue=function(en){en.objectNumber=_o();var tn=[];tn.push({key:"Type",value:"/XObject"}),tn.push({key:"Subtype",value:"/Form"}),tn.push({key:"BBox",value:"["+[kn(en.x),kn(en.y),kn(en.x+en.width),kn(en.y+en.height)].join(" ")+"]"}),tn.push({key:"Matrix",value:"["+en.matrix.toString()+"]"});var nn=en.pages[1].join("\n");ko({data:nn,additionalKeyValues:tn,objectId:en.objectNumber}),$n("endobj")},he=function(){for(var en in co)co.hasOwnProperty(en)&&ue(co[en])},le=function(en,tn){var nn,rn=[],an=1/(tn-1);for(nn=0;nn<1;nn+=an)rn.push(nn);if(rn.push(1),0!=en[0].offset){var sn={offset:0,color:en[0].color};en.unshift(sn)}if(1!=en[en.length-1].offset){var cn={offset:1,color:en[en.length-1].color};en.push(cn)}for(var An="",dn=0,un=0;unen[dn+1].offset;)dn++;var pn=en[dn].offset,hn=(nn-pn)/(en[dn+1].offset-pn),gn=en[dn].color,_n=en[dn+1].color;An+=On(Math.round((1-hn)*gn[0]+hn*_n[0]).toString(16))+On(Math.round((1-hn)*gn[1]+hn*_n[1]).toString(16))+On(Math.round((1-hn)*gn[2]+hn*_n[2]).toString(16))}return An.trim()},fe=function(en,tn){tn||(tn=21);var nn=_o(),rn=le(en.colors,tn),an=[];an.push({key:"FunctionType",value:"0"}),an.push({key:"Domain",value:"[0.0 1.0]"}),an.push({key:"Size",value:"["+tn+"]"}),an.push({key:"BitsPerSample",value:"8"}),an.push({key:"Range",value:"[0.0 1.0 0.0 1.0 0.0 1.0]"}),an.push({key:"Decode",value:"[0.0 1.0 0.0 1.0 0.0 1.0]"}),ko({data:rn,additionalKeyValues:an,alreadyAppliedFilters:["/ASCIIHexDecode"],objectId:nn}),$n("endobj"),en.objectNumber=_o(),$n("<< /ShadingType "+en.type),$n("/ColorSpace /DeviceRGB");var sn="/Coords ["+kn(parseFloat(en.coords[0]))+" "+kn(parseFloat(en.coords[1]))+" ";2===en.type?sn+=kn(parseFloat(en.coords[2]))+" "+kn(parseFloat(en.coords[3])):sn+=kn(parseFloat(en.coords[2]))+" "+kn(parseFloat(en.coords[3]))+" "+kn(parseFloat(en.coords[4]))+" "+kn(parseFloat(en.coords[5])),$n(sn+="]"),en.matrix&&$n("/Matrix ["+en.matrix.toString()+"]"),$n("/Function "+nn+" 0 R"),$n("/Extend [true true]"),$n(">>"),$n("endobj")},de=function(en,tn){var nn=mo(),rn=_o();tn.push({resourcesOid:nn,objectOid:rn}),en.objectNumber=rn;var an=[];an.push({key:"Type",value:"/Pattern"}),an.push({key:"PatternType",value:"1"}),an.push({key:"PaintType",value:"1"}),an.push({key:"TilingType",value:"1"}),an.push({key:"BBox",value:"["+en.boundingBox.map(kn).join(" ")+"]"}),an.push({key:"XStep",value:kn(en.xStep)}),an.push({key:"YStep",value:kn(en.yStep)}),an.push({key:"Resources",value:nn+" 0 R"}),en.matrix&&an.push({key:"Matrix",value:"["+en.matrix.toString()+"]"}),ko({data:en.stream,additionalKeyValues:an,objectId:en.objectNumber}),$n("endobj")},pe=function(en){var tn;for(tn in eo)eo.hasOwnProperty(tn)&&(eo[tn]instanceof B?fe(eo[tn]):eo[tn]instanceof M&&de(eo[tn],en))},ge=function(en){for(var tn in en.objectNumber=_o(),$n("<<"),en)switch(tn){case"opacity":$n("/ca "+Sn(en[tn]));break;case"stroke-opacity":$n("/CA "+Sn(en[tn]))}$n(">>"),$n("endobj")},me=function(){var en;for(en in no)no.hasOwnProperty(en)&&ge(no[en])},ve=function(){for(var en in $n("/XObject <<"),co)co.hasOwnProperty(en)&&co[en].objectNumber>=0&&$n("/"+en+" "+co[en].objectNumber+" 0 R");so.publish("putXobjectDict"),$n(">>")},be=function(){Ro.oid=_o(),$n("<<"),$n("/Filter /Standard"),$n("/V "+Ro.v),$n("/R "+Ro.r),$n("/U <"+Ro.toHexString(Ro.U)+">"),$n("/O <"+Ro.toHexString(Ro.O)+">"),$n("/P "+Ro.P),$n(">>"),$n("endobj")},ye=function(){for(var en in $n("/Font <<"),Yr)Yr.hasOwnProperty(en)&&(!1===hn||!0===hn&&gn.hasOwnProperty(en))&&$n("/"+en+" "+Yr[en].objectNumber+" 0 R");$n(">>")},we=function(){if(Object.keys(eo).length>0){for(var en in $n("/Shading <<"),eo)eo.hasOwnProperty(en)&&eo[en]instanceof B&&eo[en].objectNumber>=0&&$n("/"+en+" "+eo[en].objectNumber+" 0 R");so.publish("putShadingPatternDict"),$n(">>")}},Ne=function(en){if(Object.keys(eo).length>0){for(var tn in $n("/Pattern <<"),eo)eo.hasOwnProperty(tn)&&eo[tn]instanceof _n.TilingPattern&&eo[tn].objectNumber>=0&&eo[tn].objectNumber>")}},Le=function(){if(Object.keys(no).length>0){var en;for(en in $n("/ExtGState <<"),no)no.hasOwnProperty(en)&&no[en].objectNumber>=0&&$n("/"+en+" "+no[en].objectNumber+" 0 R");so.publish("putGStateDict"),$n(">>")}},Ae=function(en){Zt(en.resourcesOid,!0),$n("<<"),$n("/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]"),ye(),we(),Ne(en.objectOid),Le(),ve(),$n(">>"),$n("endobj")},xe=function(){var en=[];ce(),me(),he(),pe(en),so.publish("putResources"),en.forEach(Ae),Ae({resourcesOid:bo,objectOid:Number.MAX_SAFE_INTEGER}),so.publish("postPutResources")},Se=function(){so.publish("putAdditionalObjects");for(var en=0;en>8&&(dn=!0);en=An.join("")}for(nn=en.length;void 0===dn&&0!==nn;)en.charCodeAt(nn-1)>>8&&(dn=!0),nn--;if(!dn)return en;for(An=tn.noBOM?[]:[254,255],nn=0,rn=en.length;nn>8)>>8)throw new Error("Character at position "+nn+" of string '"+en+"' exceeds 16bits. Cannot be encoded into UCS-2 BE");An.push(pn),An.push(un-(pn<<8))}return String.fromCharCode.apply(void 0,An)},Bo=_n.__private__.pdfEscape=_n.pdfEscape=function(en,tn){return Fe(en,tn).replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},Eo=_n.__private__.beginPage=function(en){Hn[++io]=[],ao[io]={objId:0,contentsObjId:0,userUnit:Number(An),artBox:null,bleedBox:null,cropBox:null,trimBox:null,mediaBox:{bottomLeftX:0,bottomLeftY:0,topRightX:Number(en[0]),topRightY:Number(en[1])}},Me(io),ht(Hn[Mn])},Oe=function(en,tn){var rn,sn,cn;switch(nn=tn||nn,"string"==typeof en&&(rn=bn(en.toLowerCase()),Array.isArray(rn)&&(sn=rn[0],cn=rn[1])),Array.isArray(en)&&(sn=en[0]*Kr,cn=en[1]*Kr),isNaN(sn)&&(sn=an[0],cn=an[1]),(sn>14400||cn>14400)&&(xl.warn("A page in a PDF can not be wider or taller than 14400 userUnit. jsPDF limits the width/height to 14400"),sn=Math.min(14400,sn),cn=Math.min(14400,cn)),an=[sn,cn],nn.substr(0,1)){case"l":cn>sn&&(an=[cn,sn]);break;case"p":sn>cn&&(an=[cn,sn])}Eo(an),Jo(Yo),$n(si),0!==pi&&$n(pi+" J"),0!==hi&&$n(hi+" j"),so.publish("addPage",{pageNumber:io})},Be=function(en){en>0&&en<=io&&(Hn.splice(en,1),ao.splice(en,1),io--,Mn>io&&(Mn=io),this.setPage(Mn))},Me=function(en){en>0&&en<=io&&(Mn=en)},jo=_n.__private__.getNumberOfPages=_n.getNumberOfPages=function(){return Hn.length-1},qe=function(en,tn,nn){var rn,an=void 0;return nn=nn||{},en=void 0!==en?en:Yr[zr].fontName,tn=void 0!==tn?tn:Yr[zr].fontStyle,rn=en.toLowerCase(),void 0!==Zr[rn]&&void 0!==Zr[rn][tn]?an=Zr[rn][tn]:void 0!==Zr[en]&&void 0!==Zr[en][tn]?an=Zr[en][tn]:!1===nn.disableWarning&&xl.warn("Unable to look up font label for font '"+en+"', '"+tn+"'. Refer to getFontList() for available fonts."),an||nn.noFallback||null==(an=Zr.times[tn])&&(an=Zr.times.normal),an},Lo=_n.__private__.putInfo=function(){var en=_o(),e=function(en){return en};for(var tn in null!==pn&&(e=Ro.encryptor(en,0)),$n("<<"),$n("/Producer ("+Bo(e("jsPDF "+E.version))+")"),Hr)Hr.hasOwnProperty(tn)&&Hr[tn]&&$n("/"+tn.substr(0,1).toUpperCase()+tn.substr(1)+" ("+Bo(e(Hr[tn]))+")");$n("/CreationDate ("+Bo(e(jn))+")"),$n(">>"),$n("endobj")},Po=_n.__private__.putCatalog=function(en){var tn=(en=en||{}).rootDictionaryObjId||yo;switch(_o(),$n("<<"),$n("/Type /Catalog"),$n("/Pages "+tn+" 0 R"),Jn||(Jn="fullwidth"),Jn){case"fullwidth":$n("/OpenAction [3 0 R /FitH null]");break;case"fullheight":$n("/OpenAction [3 0 R /FitV null]");break;case"fullpage":$n("/OpenAction [3 0 R /Fit]");break;case"original":$n("/OpenAction [3 0 R /XYZ null null 1]");break;default:var nn=""+Jn;"%"===nn.substr(nn.length-1)&&(Jn=parseInt(Jn)/100),"number"==typeof Jn&&$n("/OpenAction [3 0 R /XYZ null null "+Sn(Jn)+"]")}switch(Vr||(Vr="continuous"),Vr){case"continuous":$n("/PageLayout /OneColumn");break;case"single":$n("/PageLayout /SinglePage");break;case"two":case"twoleft":$n("/PageLayout /TwoColumnLeft");break;case"tworight":$n("/PageLayout /TwoColumnRight")}Rr&&$n("/PageMode /"+Rr),so.publish("putCatalog"),$n(">>"),$n("endobj")},To=_n.__private__.putTrailer=function(){$n("trailer"),$n("<<"),$n("/Size "+(Qn+1)),$n("/Root "+Qn+" 0 R"),$n("/Info "+(Qn-1)+" 0 R"),null!==pn&&$n("/Encrypt "+Ro.oid+" 0 R"),$n("/ID [ <"+Ln+"> <"+Ln+"> ]"),$n(">>")},Fo=_n.__private__.putHeader=function(){$n("%PDF-"+mn),$n("%ºß¬à")},Uo=_n.__private__.putXRef=function(){var en="0000000000";$n("xref"),$n("0 "+(Qn+1)),$n("0000000000 65535 f ");for(var tn=1;tn<=Qn;tn++)"function"==typeof qn[tn]?$n((en+qn[tn]()).slice(-10)+" 00000 n "):void 0!==qn[tn]?$n((en+qn[tn]).slice(-10)+" 00000 n "):$n("0000000000 00000 n ")},No=_n.__private__.buildDocument=function(){ut(),ht(Vn),so.publish("buildDocument"),Fo(),So(),Se(),xe(),null!==pn&&be(),Lo(),Po();var en=Gn;return Uo(),To(),$n("startxref"),$n(""+en),$n("%%EOF"),ht(Hn[Mn]),Vn.join("\n")},Io=_n.__private__.getBlob=function(en){return new Blob([Xn(en)],{type:"application/pdf"})},Mo=_n.output=_n.__private__.output=Ie((function(en,tn){switch("string"==typeof(tn=tn||{})?tn={filename:tn}:tn.filename=tn.filename||"generated.pdf",en){case void 0:return No();case"save":_n.save(tn.filename);break;case"arraybuffer":return Xn(No());case"blob":return Io(No());case"bloburi":case"bloburl":if(void 0!==wl.URL&&"function"==typeof wl.URL.createObjectURL)return wl.URL&&wl.URL.createObjectURL(Io(No()))||void 0;xl.warn("bloburl is not supported by your system, because URL.createObjectURL is not supported by your browser.");break;case"datauristring":case"dataurlstring":var nn="",rn=No();try{nn=Cl(rn)}catch(en){nn=Cl(unescape(encodeURIComponent(rn)))}return"data:application/pdf;filename="+tn.filename+";base64,"+nn;case"pdfobjectnewwindow":if("[object Window]"===Object.prototype.toString.call(wl)){var an="https://cdnjs.cloudflare.com/ajax/libs/pdfobject/2.1.1/pdfobject.min.js",sn=' integrity="sha512-4ze/a9/4jqu+tX9dfOqJYSvyYd5M6qum/3HpCLr+/Jqf0whc37VUbkpNGHR7/8pSnCFw47T1fmIpwBV7UySh3g==" crossorigin="anonymous"';tn.pdfObjectUrl&&(an=tn.pdfObjectUrl,sn="");var cn='