/** * @file ext-eyedropper.js * * @license MIT * * @copyright 2010 Jeff Schiller * @copyright 2021 OptimistikSAS * */ const e="eyedropper",loadExtensionTranslation=async function(t){let a;const s=t.configObj.pref("lang");try{a=await function __variableDynamicImportRuntime0__(e){switch(e){case"./locale/en.js":return Promise.resolve().then((function(){return o}));case"./locale/fr.js":return Promise.resolve().then((function(){return r}));case"./locale/tr.js":return Promise.resolve().then((function(){return n}));case"./locale/zh-CN.js":return Promise.resolve().then((function(){return i}));default:return new Promise((function(t,o){("function"==typeof queueMicrotask?queueMicrotask:setTimeout)(o.bind(null,new Error("Unknown variable dynamic import: "+e)))}))}}("./locale/".concat(s,".js"))}catch(t){console.warn("Missing translation (".concat(s,") for ").concat(e," - using 'en'")),a=await Promise.resolve().then((function(){return o}))}t.i18next.addResourceBundle(s,e,a.default)};var t={name:e,async init(){const t=this,{svgCanvas:o}=t;await loadExtensionTranslation(t);const{ChangeElementCommand:r}=o.history,n={fillPaint:"red",fillOpacity:1,strokePaint:"black",strokeOpacity:1,strokeWidth:5,strokeDashArray:null,opacity:1,strokeLinecap:"butt",strokeLinejoin:"miter"},{$id:i,$click:a}=o,getStyle=e=>{if("eyedropper"===o.getMode())return;const t=i("tool_eyedropper");let r=null;e.multiselected||!e.elems[0]||["svg","g","use"].includes(e.elems[0].nodeName)?t.classList.add("disabled"):(r=e.elems[0],t.classList.remove("disabled"),n.fillPaint=r.getAttribute("fill")||"black",n.fillOpacity=r.getAttribute("fill-opacity")||1,n.strokePaint=r.getAttribute("stroke"),n.strokeOpacity=r.getAttribute("stroke-opacity")||1,n.strokeWidth=r.getAttribute("stroke-width"),n.strokeDashArray=r.getAttribute("stroke-dasharray"),n.strokeLinecap=r.getAttribute("stroke-linecap"),n.strokeLinejoin=r.getAttribute("stroke-linejoin"),n.opacity=r.getAttribute("opacity")||1)};return{name:t.i18next.t("".concat(e,":name")),callback(){const t="".concat(e,":buttons.0.title"),r="".concat(e,":buttons.0.key"),n='\n