import { n as r, C as d } from "./lib-cortex-element.CVMmyPMC.js";
import { c as h } from "./component.styles.CRO4Odto.js";
import { c as y } from "./custom-element.L4WJXn1j.js";
import { L as u } from "./i18n.BABe9hN4.js";
import { w as g } from "./watch.BCJD77bD.js";
import { i as v, x as p } from "./lit-element.jLBm65_O.js";
import { e as b } from "./query.BBf1UFkC.js";
import { e as x } from "./class-map.BiVq-cVR.js";
import { o as f } from "./if-defined.BRoBj_Rp.js";
import { n as w } from "./when.Dr1es41R.js";
var m = /* @__PURE__ */ ((o) => (o.Eager = "eager", o.Lazy = "lazy", o))(m || {});
const _ = v`:host{--background-color:#f5f5f5;width:100%;height:var(--height,500px);isolation:isolate;display:block}.iframe{width:100%;height:100%;display:block;position:relative}.iframe--empty:before{color:#fff;content:attr(data-empty-text);font-family:var(--cx-font-sans);font-size:var(--cx-font-size-large);font-weight:var(--cx-font-weight-semibold);text-align:center;text-shadow:.05em .05em .1em #000;vertical-align:middle;z-index:1;background-color:#000;justify-content:center;align-items:center;width:100%;height:100%;line-height:1;display:flex;position:absolute}.iframe__overlay{z-index:1;background-color:#0000;width:100%;height:100%;display:none;position:absolute;top:0;left:0}.iframe__view{background-color:var(--background-color);border-radius:var(--cx-border-radius-small);border:none;width:100%;height:100%;display:block}.iframe__spinner{--track-width:6px;z-index:2;font-size:4rem;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}`;
var z = Object.defineProperty, $ = Object.getOwnPropertyDescriptor, t = (o, a, s, l) => {
  for (var i = l > 1 ? void 0 : l ? $(a, s) : a, n = o.length - 1, c; n >= 0; n--)
    (c = o[n]) && (i = (l ? c(a, s, i) : c(i)) || i);
  return l && i && z(a, s, i), i;
};
let e = class extends d {
  constructor() {
    super(...arguments), this.localize = new u(this), this.src = "", this.iframeTitle = "Embedded content", this.iframeLoading = m.Lazy, this.allow = "", this.sandbox = "", this.referrerPolicy = "", this.canFullscreen = !1, this.loading = !1;
  }
  async handleCanFullscreenChange() {
    await this.updateComplete, this.iframe && (this.iframe.src = "", this.iframe.src = this.src);
  }
  render() {
    return p`<div part="base" data-empty-text=${this.localize.term("noSourceUrlProvided")} class=${x({
      iframe: !0,
      "iframe--empty": !this.src && !this.loading
    })}>${w(
      this.loading,
      () => p`<cx-spinner class="iframe__spinner"></cx-spinner>`
    )}<div part="overlay" class="iframe__overlay" aria-hidden="true"></div><iframe part="view" class="iframe__view" allow=${f(this.allow || void 0)} loading=${this.iframeLoading} referrerpolicy=${f(this.referrerPolicy || void 0)} sandbox=${f(this.sandbox || void 0)} src=${this.src} title=${this.iframeTitle} ?allowfullscreen=${this.canFullscreen}></iframe></div>`;
  }
};
e.styles = [h, _];
e.dependencies = {};
t([
  b("iframe")
], e.prototype, "iframe", 2);
t([
  r({ reflect: !0, type: String })
], e.prototype, "src", 2);
t([
  r({ attribute: "iframe-title", reflect: !0, type: String })
], e.prototype, "iframeTitle", 2);
t([
  r({ attribute: "iframe-loading", reflect: !0, type: String })
], e.prototype, "iframeLoading", 2);
t([
  r({ reflect: !0, type: String })
], e.prototype, "allow", 2);
t([
  r({ reflect: !0, type: String })
], e.prototype, "sandbox", 2);
t([
  r({ attribute: "referrer-policy", reflect: !0, type: String })
], e.prototype, "referrerPolicy", 2);
t([
  r({ attribute: "can-fullscreen", reflect: !0, type: Boolean })
], e.prototype, "canFullscreen", 2);
t([
  r({ reflect: !0, type: Boolean })
], e.prototype, "loading", 2);
t([
  g("canFullscreen")
], e.prototype, "handleCanFullscreenChange", 1);
e = t([
  y("cx-iframe")
], e);
export {
  e as C,
  m as a
};
