import { R as F, S as O, b as D, f as g, c as G, a as N, d as P, x as A, k as L, t as m, p, q as I, v as j, G as J, e as K, g as y, j as h, F as M, l as v, T as Q, u as V, m as X, o as Y, U as k, B as Z, C as S } from "./CashierConfirmModal-B0WZGuf5.js";
function x(n, { delay: t = 0, duration: e = 400, easing: i = F } = {}) {
  const l = +getComputedStyle(n).opacity;
  return {
    delay: t,
    duration: e,
    easing: i,
    css: (o) => `opacity: ${o * l}`
  };
}
function $(n) {
  P(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 tt = (n) => ({}), z = (n) => ({});
function E(n) {
  let t, e, i, l, o, d;
  const f = (
    /*#slots*/
    n[9].content
  ), r = K(
    f,
    n,
    /*$$scope*/
    n[8],
    z
  );
  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"), M(() => (
        /*div1_elementresize_handler*/
        n[11].call(e)
      )), h(t, "part", "CustomStylingContainer");
    },
    m(a, c) {
      L(a, t, c), v(t, e), v(e, i), r && r.m(i, null), n[10](e), l = Q(
        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) && V(
        r,
        f,
        n,
        /*$$scope*/
        n[8],
        d ? Y(
          f,
          /*$$scope*/
          n[8],
          c,
          tt
        ) : X(
          /*$$scope*/
          n[8]
        ),
        z
      );
    },
    i(a) {
      d || (m(r, a), a && M(() => {
        d && (o || (o = k(
          e,
          x,
          /*duration*/
          n[2],
          !0
        )), o.run(1));
      }), d = !0);
    },
    o(a) {
      p(r, a), a && (o || (o = k(
        e,
        x,
        /*duration*/
        n[2],
        !1
      )), o.run(0)), d = !1;
    },
    d(a) {
      a && j(t), r && r.d(a), n[10](null), l(), a && o && o.end(), n[12](null);
    }
  };
}
function et(n) {
  let t, e, i = (
    /*show*/
    n[5] && E(n)
  );
  return {
    c() {
      i && i.c(), t = A();
    },
    m(l, o) {
      i && i.m(l, o), L(l, t, o), e = !0;
    },
    p(l, [o]) {
      /*show*/
      l[5] ? i ? (i.p(l, o), o & /*show*/
      32 && m(i, 1)) : (i = E(l), i.c(), m(i, 1), i.m(t.parentNode, t)) : i && (Z(), p(i, 1, 1, () => {
        i = null;
      }), I());
    },
    i(l) {
      e || (m(i), e = !0);
    },
    o(l) {
      p(i), e = !1;
    },
    d(l) {
      l && j(t), i && i.d(l);
    }
  };
}
function nt(n, t, e) {
  let { $$slots: i = {}, $$scope: l } = t, { clientstyling: o = "" } = t, { clientstylingurl: d = "" } = t, { duration: f = 200 } = t, { width: r } = t, { height: a } = t, c, u, _ = !1;
  const T = () => {
    e(5, _ = !1), window.postMessage({ type: "ClosedCashierModal" }, window.location.href), window.postMessage({ type: "EnableScroll" }, window.location.href);
  }, b = (s) => {
    s.data.type == "ShowCashierModal" && (e(5, _ = !0), window.postMessage({ type: "DisableScroll" }, window.location.href)), s.data.type == "HideCashierModal" && T();
  }, W = () => {
    let s = document.createElement("style");
    s.innerHTML = o, u.appendChild(s);
  }, B = () => {
    let s = new URL(d), C = document.createElement("style");
    fetch(s.href).then((w) => w.text()).then((w) => {
      C.innerHTML = w, setTimeout(
        () => {
          u.appendChild(C);
        },
        1
      );
    });
  };
  J(() => (window.addEventListener("message", b, !1), () => {
    window.removeEventListener("message", b);
  }));
  function R(s) {
    S[s ? "unshift" : "push"](() => {
      c = s, e(4, c);
    });
  }
  function U() {
    r = this.clientWidth, a = this.clientHeight, e(0, r), e(1, a);
  }
  function q(s) {
    S[s ? "unshift" : "push"](() => {
      u = s, e(3, u);
    });
  }
  return n.$$set = (s) => {
    "clientstyling" in s && e(6, o = 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, l = s.$$scope);
  }, n.$$.update = () => {
    n.$$.dirty & /*clientstyling, customStylingContainer*/
    72 && o && u && W(), n.$$.dirty & /*clientstylingurl, customStylingContainer*/
    136 && d && u && B();
  }, [
    r,
    a,
    f,
    u,
    c,
    _,
    o,
    d,
    l,
    i,
    R,
    U,
    q
  ];
}
class H extends O {
  constructor(t) {
    super(), D(
      this,
      t,
      nt,
      et,
      N,
      {
        clientstyling: 6,
        clientstylingurl: 7,
        duration: 2,
        width: 0,
        height: 1
      },
      $
    );
  }
  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();
  }
}
G(H, { clientstyling: {}, clientstylingurl: {}, duration: {}, width: {}, height: {} }, ["content"], [], !0);
const st = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  default: H
}, Symbol.toStringTag, { value: "Module" }));
export {
  st as C,
  x as f
};
