import { b9 as p, U as c, ba as h, bv as a, bB as y, dN as g, dE as f, V as t, P as m, bh as C, bi as i, bj as s, a0 as l, bg as b, bl as x, bn as S, bo as V, bG as $ } from "./684d2f28.js";
import { useContext as d } from "react";
import "react-dom";
const F = p.div`
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: ${(o) => o.$style.borderWidth ? o.$style.borderWidth : "1px"} solid ${(o) => o.$style.border};
  border-radius: calc(min(${(o) => o.$style.radius}, 20px));

  iframe {
    border: 0;
    width: 100%;
    height: 100%;
    display: block;
    background-color: ${(o) => o.$style.background};
  }
`, u = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_+.~#?&/=]*)/g;
let n = new c({
  url: h,
  allowDownload: a,
  allowSubmitForm: a,
  allowMicrophone: a,
  allowCamera: a,
  allowPopup: a,
  style: y(g)
}, (o) => {
  const e = ["allow-scripts", "allow-same-origin"];
  o.allowSubmitForm && e.push("allow-forms"), o.allowDownload && e.push("allow-downloads"), o.allowPopup && e.push("allow-popups");
  const r = [];
  o.allowCamera && r.push("camera"), o.allowMicrophone && r.push("microphone");
  const w = u.test(o.url) ? o.url : "about:blank";
  return f.log(o.url, u.test(o.url) ? o.url : "about:blank", w), /* @__PURE__ */ t(F, {
    $style: o.style,
    children: /* @__PURE__ */ t("iframe", {
      src: w,
      sandbox: e.join(" "),
      allow: r.join(";")
    })
  });
}).setPropertyViewFn((o) => /* @__PURE__ */ m(C, {
  children: [/* @__PURE__ */ t(i, {
    name: s.basic,
    children: o.url.propertyView({
      label: "Source URL",
      placeholder: "https://example.com",
      tooltip: l("iframe.URLDesc")
    })
  }), ["logic", "both"].includes(d(b).editorModeStatus) && /* @__PURE__ */ m(i, {
    name: s.interaction,
    children: [x(o), o.allowDownload.propertyView({
      label: l("iframe.allowDownload")
    }), o.allowSubmitForm.propertyView({
      label: l("iframe.allowSubmitForm")
    }), o.allowMicrophone.propertyView({
      label: l("iframe.allowMicrophone")
    }), o.allowCamera.propertyView({
      label: l("iframe.allowCamera")
    }), o.allowPopup.propertyView({
      label: l("iframe.allowPopup")
    })]
  }), ["layout", "both"].includes(d(b).editorModeStatus) && /* @__PURE__ */ t(i, {
    name: s.style,
    children: o.style.getPropertyView()
  })]
})).build();
n = class extends n {
  autoHeight() {
    return !1;
  }
};
const j = S(n, [new V("url", l("iframe.URLDesc")), $]);
export {
  j as IFrameComp
};
