import{include_styles_default as t}from"./chunk.NNBOLKWI.js";import{requestInclude as r}from"./chunk.XNEONNEJ.js";import{watch as e}from"./chunk.C7FWPEOY.js";import{ShoelaceElement as s}from"./chunk.Z7XDKKOD.js";import{__decorateClass as o}from"./chunk.6M63UXML.js";import{html as i}from"../../../../lit/index.js";import{property as c}from"../../../../lit/decorators.js";var a=class extends s{constructor(){super(...arguments),this.mode="cors",this.allowScripts=!1}executeScript(t){const r=document.createElement("script");[...t.attributes].forEach((t=>r.setAttribute(t.name,t.value))),r.textContent=t.textContent,t.parentNode.replaceChild(r,t)}async handleSrcChange(){try{const t=this.src,e=await r(t,this.mode);if(t!==this.src)return;if(!e.ok)return void this.emit("sl-error",{detail:{status:e.status}});this.innerHTML=e.html,this.allowScripts&&[...this.querySelectorAll("script")].forEach((t=>this.executeScript(t))),this.emit("sl-load")}catch(t){this.emit("sl-error",{detail:{status:-1}})}}render(){return i`<slot></slot>`}};a.styles=t,o([c()],a.prototype,"src",2),o([c()],a.prototype,"mode",2),o([c({attribute:"allow-scripts",type:Boolean})],a.prototype,"allowScripts",2),o([e("src")],a.prototype,"handleSrcChange",1);export{a as SlInclude};