text: import{html,PolymerElement}from"../../../../../@polymer/polymer/polymer-element.js";import{afterNextRender}from"../../../../../@polymer/polymer/lib/utils/render-status.js";import{stylesFromTemplate}from"../../../../../@polymer/polymer/lib/utils/style-gather.js";import{HAXCMSTheme}from"../HAXCMSThemeWiring.js";import"../../ui-components/templates/basic-template.js";import"../../../../simple-colors/simple-colors.js";class HAXCMSCustomTheme extends HAXCMSTheme(PolymerElement){async getCSS(){return await fetch("theme/theme.css").then(response=>{return response.text()}).then(response=>{const evt=new CustomEvent("haxcms-custom-theme-template-ready",{bubbles:!0,composed:!0,cancelable:!1,detail:{css:response}});this.dispatchEvent(evt);return response})}async getHTML(){return await fetch("theme/theme.html").then(response=>{return response.text()}).then(response=>{const evt=new CustomEvent("haxcms-custom-theme-template-ready",{bubbles:!0,composed:!0,cancelable:!1,detail:{html:response}});this.dispatchEvent(evt);return response})}constructor(){super();this.__counter=0;this.getCSS();this.getHTML();window.addEventListener("haxcms-custom-theme-template-ready",this.templateReady.bind(this))}connectedCallback(){super.connectedCallback();afterNextRender(this,function(){this.contentContainer=this.shadowRoot.querySelector("#contentcontainer")})}static get template(){return html`
        <div id="contentcontainer">
          <div id="slot">
            <slot></slot>
          </div>
        </div>
      `}templateReady(e){this.__counter++;if(e.detail.css){this._css=e.detail.css}if(e.detail.html){this._html=e.detail.html}if(2===this.__counter){let t=document.createElement("template");t.innerHTML=`
        <style include="simple-colors">
          /**
           * Hide the slotted content during edit mode. This must be here to work.
           */
          :host([edit-mode]) #slot {
            display: none;
          }
          ${this._css}
        </style>
        ${this._html}`;const styles=stylesFromTemplate(t);while(this.shadowRoot.firstChild){this.shadowRoot.removeChild(this.shadowRoot.firstChild)}for(var i in styles){t.innerHTML=styles[i].outerHTML+t.innerHTML}this.__instance=this._stampTemplate(t);this.shadowRoot.appendChild(this.__instance)}}}window.customElements.define("haxcms-custom-theme",HAXCMSCustomTheme);export{HAXCMSCustomTheme};