var e=()=>document.getElementById(`etch-iframe`);async function t(){let t=e();if(!t){console.error(`[Omni Icon] Etch iframe not found`);return}console.log(`[Omni Icon] Finding omni-icon web component script...`);let n=!1,r=setTimeout(()=>{n=!0},45e3),i=[];for(;!n;){let e=document.querySelectorAll(`script`);if(i=Array.from(e).filter(e=>{let t=e.getAttribute(`id`),n=e.getAttribute(`src`);return t&&(t.includes(`omni-icon:web-component`)||t.startsWith(`vite-client`))||n&&n.includes(`omni-icon`)}),i.length>0){clearTimeout(r);break}await new Promise(e=>setTimeout(e,100))}if(n){console.error(`[Omni Icon] Timeout! Failed to find omni-icon web component script`);return}console.log(`[Omni Icon] Found omni-icon web component script`,i);let a=t.contentWindow,o=t.contentDocument||a?.document;if(!a||!o){console.error(`[Omni Icon] Cannot access iframe content`);return}for(;!o.head;)await new Promise(e=>setTimeout(e,300));console.log(`[Omni Icon] Injecting omni-icon web component into iframe...`);let s=o.querySelectorAll(`script`);if(Array.from(s).some(e=>{let t=e.getAttribute(`id`),n=e.getAttribute(`src`);return t&&t.includes(`omni-icon:web-component`)||n&&n.includes(`omni-icon`)}))console.log(`[Omni Icon] Web component already injected, skipping...`);else{console.log(`[Omni Icon] Starting injection process...`),i.forEach(e=>{let t=e.getAttribute(`id`),n=o.createElement(`script`);Array.from(e.attributes).forEach(e=>{n.setAttribute(e.name,e.value)}),!e.src&&e.textContent&&(n.textContent=e.textContent),t&&(t.includes(`metadata`)||t.startsWith(`vite-client`))?o.head.appendChild(n):o.body.appendChild(n)});let e=o.createElement(`script`);e.textContent=`
			window.omniIconConfig = {
				restUrl: '${window.omniIconEtch?.restUrl||``}',
				nonce: '${window.omniIconEtch?.nonce||``}'
			};
		`,o.head.appendChild(e),console.log(`[Omni Icon] Web component injected successfully`)}t.dataset.omniIconInjected=`true`}new MutationObserver(()=>{let n=e();n&&!n.dataset.omniIconInjected&&setTimeout(()=>{n.dataset.omniIconInjected||t()},100)}).observe(document,{subtree:!0,childList:!0}),console.log(`[Omni Icon] Web component injector module loaded`);