import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';

const KlevuUtilSsrProvider$1 = /*@__PURE__*/ proxyCustomElement(class KlevuUtilSsrProvider extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.__attachShadow();
    this.html = undefined;
    this.packed = undefined;
    this.identifier = undefined;
  }
  /**
   * packed parameter returned by KlevuSSRFetch function
   *
   * @param packed
   */
  async setPacked(packed) {
    this.packed = JSON.stringify(packed).replace(/"/g, "'");
  }
  /**
   *
   * @returns packed parameter returned by KlevuSSRFetch function for KlevuSSRHydrate function
   */
  async getPacked() {
    return JSON.parse(this.packed || "{}").replace(/'/g, '"');
  }
  render() {
    if (this.html) {
      return (h(Host, null, h("div", { innerHTML: this.html })));
    }
    return (h(Host, null, h("slot", null)));
  }
}, [1, "klevu-util-ssr-provider", {
    "html": [1],
    "packed": [1537],
    "identifier": [1537],
    "setPacked": [64],
    "getPacked": [64]
  }]);
function defineCustomElement$1() {
  if (typeof customElements === "undefined") {
    return;
  }
  const components = ["klevu-util-ssr-provider"];
  components.forEach(tagName => { switch (tagName) {
    case "klevu-util-ssr-provider":
      if (!customElements.get(tagName)) {
        customElements.define(tagName, KlevuUtilSsrProvider$1);
      }
      break;
  } });
}
defineCustomElement$1();

const KlevuUtilSsrProvider = KlevuUtilSsrProvider$1;
const defineCustomElement = defineCustomElement$1;

export { KlevuUtilSsrProvider, defineCustomElement };

//# sourceMappingURL=klevu-util-ssr-provider.js.map