!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("ig-ui",[],t):"object"==typeof exports?exports["ig-ui"]=t():e["ig-ui"]=t()}(this,(()=>(()=>{"use strict";var e={p:"./dist/"};e.p;const t=(e,t)=>new Promise((n=>{setTimeout((()=>n(t)),e)})),n=(e,t)=>{_webview.addEvent(e,t)},o=(e,t,n=!1)=>{if(t instanceof FileList&&!n)return console.info("🔵 Calling webview.postMessageWithAdditionalObjects(): ",e,t),void window.chrome.webview?.postMessageWithAdditionalObjects({name:e,data:null},t);const o=n?JSON.stringify(t):t;console.info("🔵 Calling webview.postMessage(): ",e,o),window.chrome.webview?.postMessage({name:e,data:o})};class l{static load(){for(const e in _page.lang){if(!Object.prototype.hasOwnProperty.call(_page.lang,e))continue;const t=_page.lang[e];queryAll(`[lang-text="${e}"]`,null,!0).forEach((e=>{e.innerText=t})),queryAll(`[lang-title="${e}"]`,null,!0).forEach((e=>{e.title=t})),queryAll(`[lang-html="${e}"]`,null,!0).forEach((e=>{let n=t;for(let t=0;t<e.childElementCount;t++)n=n.replaceAll(`{${t}}`,e.children.item(t).outerHTML);e.innerHTML=n}))}}static loadForEl(e){[e,...queryAll("[lang-text]",e)].forEach((e=>{const t=e.getAttribute("lang-text")||"",n=_page.lang[t]||"";n&&(e.innerText=n)}));[e,...queryAll("[lang-title]",e)].forEach((e=>{const t=e.getAttribute("lang-title")||"",n=_page.lang[t]||"";n&&(e.title=n)}));[e,...queryAll("[lang-html]",e)].forEach((e=>{const t=e.getAttribute("lang-html")||"",n=_page.lang[t]||"";if(n){let t=n;for(let n=0;n<e.childElementCount;n++)t=t.replaceAll(`{${n}}`,e.children.item(n).outerHTML);e.innerHTML=t}}))}static loadFor(e){const t=query(e);l.loadForEl(t)}}window._webview=new class{eventHandlers={};addEvent(e,t){this.eventHandlers[e]=t}removeEvent(e){delete this.eventHandlers[e]}startListening(){window.chrome.webview?.addEventListener("message",(({data:e})=>{const t=e?.Name??"",n=e?.Data??"",o=this.eventHandlers[t],l=void 0!==o;console.info(`🔵 Received event '${t}' (handler=${l}) with data:`,"string"==typeof n?`${n.substring(0,100)}...`:n),l&&o(t,n)}))}},_webview.startListening(),window.query=(e,t=null,n=!1)=>{try{const o=(t??document).querySelector(e);return o||n||console.warn(`🟠 query() returns NULL with selector '${e}'`),o}catch{}return null},window.queryAll=(e,t=null,n=!1)=>{try{const o=t??document,l=Array.from(o.querySelectorAll(e));return 0!==l.length||n||console.info(`🔵 queryAll() returns ZERO elements with selector '${e}'`),l}catch{}return[]},window.on=n,window.post=o,window.postAsync=async(e,l,r=!1)=>{let i=!1,a=null;for(n(e,((t,n)=>{t===e&&(i=!0,a=n,_webview.removeEvent(e))})),o(e,l,r);!i;)await t(100);return a},window._page||(window._page={lang:{},theme:"",isWindows10:!1}),_page.loadLanguage=l.load,t(1e3).then((()=>{document.documentElement.style.setProperty("--transitionMs","300ms")}));const r=e=>{let t=e.key.toLowerCase();const n=e.ctrlKey||"control"===t?"ctrl":"",o=e.shiftKey||"shift"===t?"shift":"",l=e.altKey||"alt"===t?"alt":"",r={control:"",shift:"",alt:"",arrowleft:"left",arrowright:"right",arrowup:"up",arrowdown:"down",backspace:"back"," ":"space"};void 0!==r[t]&&(t=r[t]);return[n,o,l,t].filter(Boolean).join("+")};window.onkeydown=e=>{const t=r(e);"escape"===t&&document.querySelector("dialog[open]")||t&&o("KEYDOWN",t)},window.onkeyup=e=>{const t=r(e);t&&o("KEYUP",t)};const i=e=>{e.preventDefault(),e.stopPropagation();const t=e.target;post(t.id)};return query("#BtnImageGlassStore").addEventListener("click",i,!1),query("#BtnUpdate").addEventListener("click",i,!1),query("#BtnClose").addEventListener("click",i,!1),query("#BtnUpdate").focus(),window._page.loadData=(e={})=>{console.info("🔵 Loading data",e),query("#Lbl_CurrentVersion").innerText=e.CurrentVersion||"",query("#LbL_LatestVersion").innerText=e.LatestVersion||"",query("#Lbl_PublishedDate").innerText=e.PublishedDate||"",query("#Lnk_ReleaseLink").innerText=e.ReleaseTitle||"",query("#Lnk_ReleaseLink").setAttribute("href",e.ReleaseLink||""),query("#Section_ReleaseDetails").innerHTML=e.ReleaseDetails||""},{}})()));
//# sourceMappingURL=FrmUpdate.js.map