import { N as d, a as h, o as x, p as g, b as m, q as b, e as k, j as e, M as A, S as j, i as M, T as v } from "./index-c65ca4a4.mjs";
import { F as y } from "./Form-f4ced0f0.mjs";
import { I as S } from "./IntegrationHeader-a0a2e0a4.mjs";
const P = d.create(() => {
  const { updateRoute: s } = h(), { settings: o } = x(), [n] = g(o, ["amp"]), [l] = g(o, ["amp_gtag_id"]), p = d.useModal(), [t, r] = m(!1), [i, c] = m(""), { mutateAsync: u } = b();
  k(() => {
    r(n || !1), c(l || "");
  }, [n, l]);
  const f = async () => {
    await u([
      { key: "amp", value: t },
      { key: "amp_gtag_id", value: i }
    ]);
  };
  return /* @__PURE__ */ e.jsxs(
    A,
    {
      afterClose: () => {
        s("integrations");
      },
      okColor: "black",
      okLabel: "Save & close",
      testId: "amp-modal",
      title: "",
      onOk: async () => {
        await f(), p.remove(), s("integrations");
      },
      children: [
        /* @__PURE__ */ e.jsx(
          S,
          {
            detail: "Accelerated Mobile Pages",
            icon: /* @__PURE__ */ e.jsx(j, { className: "h-14 w-14" }),
            title: "AMP"
          }
        ),
        /* @__PURE__ */ e.jsx("div", { className: "mt-7", children: /* @__PURE__ */ e.jsxs(y, { marginBottom: !1, title: "AMP configuration", grouped: !0, children: [
          /* @__PURE__ */ e.jsx(
            M,
            {
              checked: t,
              direction: "rtl",
              hint: /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
                "Enable ",
                /* @__PURE__ */ e.jsx("a", { className: "text-green", href: "https://amp.dev", rel: "noopener noreferrer", target: "_blank", children: "Google Accelerated Mobile Pages" }),
                " for your posts"
              ] }),
              label: "Enable AMP",
              onChange: (a) => {
                r(a.target.checked);
              }
            }
          ),
          t && /* @__PURE__ */ e.jsx(
            v,
            {
              hint: "Tracks AMP traffic in Google Analytics",
              placeholder: "UA-XXXXXXX-X",
              title: "Google Analytics Tracking ID",
              value: i,
              onChange: (a) => {
                c(a.target.value);
              }
            }
          )
        ] }) })
      ]
    }
  );
});
export {
  P as default
};
//# sourceMappingURL=AmpModal-8826ffb1.mjs.map
