import { Q as U, S as q, b as A, s as D, f as g, c as N, e as H, t as p, g as m, k as Q, l as G, m as L, x as I, H as J, d as K, R as C, F as v, u as O, h as P, j as V, o as k, T as X, p as y, v as h, A as x, E as Y } from "./CashierConfirmModal-CNzEOcOZ.js";
function S(n, { delay: t = 0, duration: e = 400, easing: i = U } = {}) {
  const o = +getComputedStyle(n).opacity;
  return {
    delay: t,
    duration: e,
    easing: i,
    css: (l) => `opacity: ${l * o}`
  };
}
function Z(n) {
  N(n, "svelte-pil2bm", "*,*::before,*::after{margin:0;padding:0;box-sizing:border-box}.ModalWindow{display:flex;position:absolute;align-items:center;justify-content:center;width:100%;height:100%;z-index:4;top:0;left:0;background-color:var(--mmw--color-black-transparency-10, rgba(0, 0, 0, 0.1));container-type:inline-size;container-name:modal-window;border-radius:6px}.ModalContainer{background:var(--emw--color-white, #fff);border-radius:var(--emw--border-radius-medium, 4px);padding:var(--emw--spacing-large, 20px);width:400px}.ModalCloseBtn{position:absolute;display:flex;align-items:center;justify-content:center;top:10px;right:10px;padding:var(--emw--spacing-small-minus, 10px);border-radius:50%;color:var(--emw--color-white, #fff);background:var(--mmw--color-gray-transparency-85, rgba(255, 255, 255, 0.85));cursor:pointer;transition:all 150ms ease-in-out}.ModalCloseBtn svg{width:32px;height:32px}.ModalCloseBtn:hover{background:var(--emw--color-gray-transparency-20, rgba(255, 255, 255, 0.2))}@container modal-window (max-width:750px){.ModalWindow .ModalContainer{width:90%;max-width:400px}}");
}
const $ = (n) => ({}), E = (n) => ({});
function z(n) {
  let t, e, i, o, l, d;
  const f = (
    /*#slots*/
    n[9].content
  ), r = K(
    f,
    n,
    /*$$scope*/
    n[8],
    E
  );
  return {
    c() {
      t = y("div"), e = y("div"), i = y("div"), r && r.c(), h(i, "class", "ModalContainer"), h(i, "part", "ModalContainer"), h(e, "class", "ModalWindow"), h(e, "part", "ModalWindow"), h(e, "id", "Modal"), v(() => (
        /*div1_elementresize_handler*/
        n[11].call(e)
      )), h(t, "part", "CustomStylingContainer");
    },
    m(a, c) {
      L(a, t, c), k(t, e), k(e, i), r && r.m(i, null), n[10](e), o = X(
        e,
        /*div1_elementresize_handler*/
        n[11].bind(e)
      ), n[12](t), d = !0;
    },
    p(a, c) {
      n = a, r && r.p && (!d || c & /*$$scope*/
      256) && O(
        r,
        f,
        n,
        /*$$scope*/
        n[8],
        d ? V(
          f,
          /*$$scope*/
          n[8],
          c,
          $
        ) : P(
          /*$$scope*/
          n[8]
        ),
        E
      );
    },
    i(a) {
      d || (m(r, a), a && v(() => {
        d && (l || (l = C(
          e,
          S,
          /*duration*/
          n[2],
          !0
        )), l.run(1));
      }), d = !0);
    },
    o(a) {
      p(r, a), a && (l || (l = C(
        e,
        S,
        /*duration*/
        n[2],
        !1
      )), l.run(0)), d = !1;
    },
    d(a) {
      a && H(t), r && r.d(a), n[10](null), o(), a && l && l.end(), n[12](null);
    }
  };
}
function tt(n) {
  let t, e, i = (
    /*show*/
    n[5] && z(n)
  );
  return {
    c() {
      i && i.c(), t = I();
    },
    m(o, l) {
      i && i.m(o, l), L(o, t, l), e = !0;
    },
    p(o, [l]) {
      /*show*/
      o[5] ? i ? (i.p(o, l), l & /*show*/
      32 && m(i, 1)) : (i = z(o), i.c(), m(i, 1), i.m(t.parentNode, t)) : i && (Q(), p(i, 1, 1, () => {
        i = null;
      }), G());
    },
    i(o) {
      e || (m(i), e = !0);
    },
    o(o) {
      p(i), e = !1;
    },
    d(o) {
      o && H(t), i && i.d(o);
    }
  };
}
function et(n, t, e) {
  let { $$slots: i = {}, $$scope: o } = t, { clientstyling: l = "" } = t, { clientstylingurl: d = "" } = t, { duration: f = 200 } = t, { width: r } = t, { height: a } = t, c, u, w = !1;
  const W = () => {
    e(5, w = !1), window.postMessage({ type: "ClosedCashierModal" }, window.location.href), window.postMessage({ type: "EnableScroll" }, window.location.href);
  }, b = (s) => {
    s.data.type == "ShowCashierModal" && (e(5, w = !0), window.postMessage({ type: "DisableScroll" }, window.location.href)), s.data.type == "HideCashierModal" && W();
  }, T = () => {
    let s = document.createElement("style");
    s.innerHTML = l, u.appendChild(s);
  }, j = () => {
    let s = new URL(d), M = document.createElement("style");
    fetch(s.href).then((_) => _.text()).then((_) => {
      M.innerHTML = _, setTimeout(
        () => {
          u.appendChild(M);
        },
        1
      );
    });
  };
  J(() => (window.addEventListener("message", b, !1), () => {
    window.removeEventListener("message", b);
  }));
  function B(s) {
    x[s ? "unshift" : "push"](() => {
      c = s, e(4, c);
    });
  }
  function R() {
    r = this.clientWidth, a = this.clientHeight, e(0, r), e(1, a);
  }
  function F(s) {
    x[s ? "unshift" : "push"](() => {
      u = s, e(3, u);
    });
  }
  return n.$$set = (s) => {
    "clientstyling" in s && e(6, l = s.clientstyling), "clientstylingurl" in s && e(7, d = s.clientstylingurl), "duration" in s && e(2, f = s.duration), "width" in s && e(0, r = s.width), "height" in s && e(1, a = s.height), "$$scope" in s && e(8, o = s.$$scope);
  }, n.$$.update = () => {
    n.$$.dirty & /*clientstyling, customStylingContainer*/
    72 && l && u && T(), n.$$.dirty & /*clientstylingurl, customStylingContainer*/
    136 && d && u && j();
  }, [
    r,
    a,
    f,
    u,
    c,
    w,
    l,
    d,
    o,
    i,
    B,
    R,
    F
  ];
}
class nt extends q {
  constructor(t) {
    super(), A(
      this,
      t,
      et,
      tt,
      D,
      {
        clientstyling: 6,
        clientstylingurl: 7,
        duration: 2,
        width: 0,
        height: 1
      },
      Z
    );
  }
  get clientstyling() {
    return this.$$.ctx[6];
  }
  set clientstyling(t) {
    this.$$set({ clientstyling: t }), g();
  }
  get clientstylingurl() {
    return this.$$.ctx[7];
  }
  set clientstylingurl(t) {
    this.$$set({ clientstylingurl: t }), g();
  }
  get duration() {
    return this.$$.ctx[2];
  }
  set duration(t) {
    this.$$set({ duration: t }), g();
  }
  get width() {
    return this.$$.ctx[0];
  }
  set width(t) {
    this.$$set({ width: t }), g();
  }
  get height() {
    return this.$$.ctx[1];
  }
  set height(t) {
    this.$$set({ height: t }), g();
  }
}
Y(nt, { clientstyling: {}, clientstylingurl: {}, duration: {}, width: {}, height: {} }, ["content"], [], !0);
export {
  nt as default
};
