import { a as D } from "./chunks/url.Cj9cIQXJ.js";
import { R as st, U as rt, c as ot, b as at, i as nt, t as it } from "./chunks/url.Cj9cIQXJ.js";
import { e as ct, f as ut, g as ft, c as ht, i as mt, a as dt, d as gt, m as pt, b as wt, r as xt, t as Ct } from "./chunks/toast.D3AW3RWv.js";
import { e as Dt, a as At, f as Tt, g as yt, d as St, b as Mt, c as Lt, i as It, p as vt, s as Rt } from "./chunks/browser.BHOCIF_A.js";
import { d as bt, C as kt, e as Ft, H as Ot, R as Nt, c as Xt, h as Pt, f as _t, g as Bt, l as Ht, p as Ut, a as Gt, b as Yt } from "./chunks/color.vLD2sNTs.js";
import { a as zt, b as qt, g as Zt } from "./chunks/modal.U1QltQKe.js";
import { a as Jt, p as $t, c as Qt, b as Kt, s as te } from "./chunks/animate.El-MpOws.js";
import { t as se } from "./chunks/converters.DkDtLstb.js";
import { c as oe } from "./chunks/custom-element.L4WJXn1j.js";
import { d as ne } from "./chunks/debounce.DaHuiSGU.js";
import { d as le } from "./chunks/default-value.COZopaet.js";
import { d as ue } from "./chunks/drag.DXEXVXPv.js";
import { w as he } from "./chunks/event.mFzZi4sr.js";
import { f as A } from "./chunks/form.Ch1cwYzO.js";
import { F as de, c as ge, v as pe, a as we } from "./chunks/form.Ch1cwYzO.js";
import { L as Ce, r as Ee } from "./chunks/i18n.BABe9hN4.js";
import { c as Ae } from "./chunks/math.DqTA6ya4.js";
import { g as ye, l as Se, s as Me, u as Le } from "./chunks/scroll.xtO5yojm.js";
import { j as x } from "./chunks/dom.0RpWet6y.js";
import { c as ve, d as Re, k as Ve, a as be, g as ke, h as Fe, b as Oe, f as Ne, i as Xe, e as Pe, l as _e, s as Be } from "./chunks/dom.0RpWet6y.js";
import { H as Ue, a as Ge, g as Ye } from "./chunks/slot.j5oheLJC.js";
import { g as ze, a as qe } from "./chunks/tabbable.CcMz3mIL.js";
import { i as je } from "./chunks/user-agent.D9aPuOyL.js";
import { w as $e } from "./chunks/watch.BCJD77bD.js";
import { f as Ke } from "./chunks/content-builder.CcgZciZN.js";
import { c as es, f as ss, e as rs, b as os, g as as, d as ns, i as is, r as ls, a as cs } from "./chunks/image.o1b1mD-J.js";
import { a as fs, b as hs, c as ms, e as ds, d as gs, f as ps, g as ws, r as xs, s as Cs } from "./chunks/number.Dp6Prh44.js";
import { s as Ds } from "./chunks/parse.Cu5nBDTb.js";
import { g as Ts, a as ys } from "./chunks/responsive.Oz9HWjyQ.js";
import { c as Ms, b as Ls, e as Is, f as vs, l as Rs, g as Vs, j as bs, p as ks, v as Fs, r as Os, a as Ns, d as Xs, s as Ps, k as _s, o as Bs, m as Hs, n as Us, q as Gs, t as Ys, u as Ws } from "./chunks/string.DUgD4c9f.js";
import { g as qs, a as Zs } from "./chunks/template.ClovJacp.js";
import { c as Js, a as $s, f as Qs, g as Ks } from "./chunks/time.CfxDkxSY.js";
import { b as er } from "./chunks/transformation.Cqz3hPaQ.js";
function b(t) {
  if (!this.ownerDocument.defaultView?.Matrix3 || !t)
    return;
  const e = this.ownerDocument.defaultView?.location.origin;
  e && this.ownerDocument?.defaultView?.postMessage(
    {
      detail: { assetId: t, mode: "Details" },
      type: "cx-cms5-view-asset"
    },
    e
  );
}
function k(t) {
  if (!this.ownerDocument.defaultView?.Matrix3 || !t)
    return;
  const e = this.ownerDocument.defaultView?.location.origin;
  e && this.ownerDocument?.defaultView?.postMessage(
    {
      detail: { assetId: t, mode: "Container" },
      type: "cx-cms5-view-asset"
    },
    e
  );
}
function F(t, e = void 0) {
  !this.ownerDocument.defaultView?.Matrix3 || !t || this.ownerDocument.defaultView?.open(
    D(t, "https://", !0),
    e ?? "_blank"
  );
}
function O(t) {
  if (!this.ownerDocument.defaultView?.Matrix3 || !t)
    return;
  const e = this.ownerDocument.defaultView?.location.origin;
  e && this.ownerDocument?.defaultView?.postMessage(
    {
      detail: { assetIds: [t] },
      type: "cx-cms5-share-assets"
    },
    e
  );
}
function N(t, e) {
  if (!this.ownerDocument.defaultView?.Matrix3 || !t || !e)
    return;
  const s = this.ownerDocument.defaultView?.location.origin;
  s && this.ownerDocument?.defaultView?.postMessage(
    { detail: { assetIds: t, formats: e }, type: "cx-cms5-download-assets" },
    s
  );
}
class X {
  constructor(e) {
    this.currentZIndex = x(), (this.host = e).addController(this);
  }
  hostConnected() {
  }
  hostDisconnected() {
  }
  async activatePopup() {
    this.currentZIndex = x();
  }
}
class P {
  constructor(e, s = {}) {
    this.element = e, this.noChildDrag = s.noChildDrag ?? !1, this.dragThreshold = s.dragThreshold ?? 5, this.isDragging = !1, this.hasDragged = !1, this.startX = 0, this.startY = 0, this.lastClientX = 0, this.lastClientY = 0, this.onMouseDown = this.onMouseDown.bind(this), this.onMouseMove = this.onMouseMove.bind(this), this.onMouseUp = this.onMouseUp.bind(this), this.onClick = this.onClick.bind(this), this.attach();
  }
  attach() {
    this.element.addEventListener("mousedown", this.onMouseDown), window.addEventListener("mouseup", this.onMouseUp), window.addEventListener("mousemove", this.onMouseMove), this.element.addEventListener("click", this.onClick, !0);
  }
  detach() {
    this.element.removeEventListener("mousedown", this.onMouseDown), window.removeEventListener("mouseup", this.onMouseUp), window.removeEventListener("mousemove", this.onMouseMove), this.element.removeEventListener("click", this.onClick, !0);
  }
  onMouseDown(e) {
    this.noChildDrag && e.target !== this.element || (this.isDragging = !0, this.hasDragged = !1, this.startX = e.clientX, this.startY = e.clientY, this.lastClientX = e.clientX, this.lastClientY = e.clientY, e.preventDefault());
  }
  onMouseMove(e) {
    if (!this.isDragging)
      return;
    const s = e.clientX - this.lastClientX, r = e.clientY - this.lastClientY;
    !this.hasDragged && (Math.abs(e.clientX - this.startX) > this.dragThreshold || Math.abs(e.clientY - this.startY) > this.dragThreshold) && (this.hasDragged = !0), this.element.scrollLeft -= s, this.element.scrollTop -= r, this.lastClientX = e.clientX, this.lastClientY = e.clientY;
  }
  onMouseUp() {
    this.isDragging = !1;
  }
  onClick(e) {
    this.hasDragged && (e.stopImmediatePropagation(), e.preventDefault());
  }
}
const _ = (t) => t.ctrlKey || t.metaKey;
function C(t, e) {
  if (!t?.document)
    return !1;
  const s = "mmmmmmmmmmwwwwwww", r = "32px", a = t.document.createElement("canvas").getContext("2d"), n = (l) => a ? (a.font = `${r} ${l}, monospace`, a.measureText(s).width) : 0, i = n("monospace");
  return n(e) !== i;
}
function B(t, e) {
  if (!t?.document.fonts)
    return !1;
  let s = !1;
  return t.document.fonts.forEach((r) => {
    r.family.replace(/['"]/g, "").toLowerCase() === e.toLowerCase() && (s = !0);
  }), s ? !0 : C(t, e);
}
function T(t) {
  const e = /\bitalic\b/i, s = /\b(semi[-\s]?condensed|condensed)\b/i, r = (o) => {
    const a = o.fontFamily.toLowerCase(), n = o.fontStyle.toLowerCase(), i = e.test(n), f = s.test(a);
    let l = 0;
    return i && (l = 1), f && (l = i ? 3 : 2), {
      family: o.fontFamily,
      styleRank: l,
      weight: Number(o.fontWeight)
    };
  };
  return [...t].sort((o, a) => {
    const n = r(o), i = r(a);
    return n.weight !== i.weight ? n.weight - i.weight : n.styleRank !== i.styleRank ? n.styleRank - i.styleRank : n.family.localeCompare(i.family);
  });
}
function H(t, e, s = [300, 400, 500, 700, 900], r = ["normal", "italic"]) {
  const o = [];
  if (C(t, e))
    for (const a of s)
      for (const n of r)
        o.push({
          fontFamily: e,
          fontStyle: n,
          fontWeight: a.toString(),
          src: ""
        });
  return T(o);
}
function U(t) {
  const e = new FormData(t), s = {};
  return e.forEach((r, o) => {
    if (Reflect.has(s, o)) {
      const a = s[o];
      Array.isArray(a) ? a.push(r) : s[o] = [s[o], r];
    } else
      s[o] = r;
  }), s;
}
function y(t) {
  const s = [...t.getRootNode().querySelectorAll("*")], r = [...t.elements], o = A.get(t), a = o ? Array.from(o) : [];
  return [...r, ...a].sort(
    (n, i) => s.indexOf(n) < s.indexOf(i) ? -1 : s.indexOf(n) > s.indexOf(i) ? 1 : 0
  );
}
function G(t) {
  return y(t).some(
    (s) => s.hasAttribute("data-user-valid") || s.hasAttribute("data-user-invalid")
  );
}
class Y {
  constructor(e = null) {
    this.history = e !== null ? [e] : [], this.redoStack = [];
  }
  add(e) {
    this.history.push(e), this.redoStack = [];
  }
  undo() {
    if (this.history.length > 1) {
      const e = this.history.pop();
      return this.redoStack.push(e), this.getCurrent();
    }
    return null;
  }
  redo() {
    if (this.redoStack.length > 0) {
      const e = this.redoStack.pop();
      return this.history.push(e), e;
    }
    return null;
  }
  getCurrent() {
    return this.history[this.history.length - 1] || null;
  }
  clear() {
    this.history = [], this.redoStack = [];
  }
  canUndo() {
    return this.history.length > 1;
  }
  canRedo() {
    return this.redoStack.length > 0;
  }
  getHistory() {
    return [...this.history];
  }
}
var S = /* @__PURE__ */ ((t) => (t.ArrowDown = "ArrowDown", t.ArrowLeft = "ArrowLeft", t.ArrowRight = "ArrowRight", t.ArrowUp = "ArrowUp", t.Enter = "Enter", t.Escape = "Escape", t.Tab = "Tab", t))(S || {});
function W(t, e) {
  const s = {}, r = new Set(e);
  return Object.keys(t).forEach((o) => {
    r.has(o) || (s[o] = t[o]);
  }), s;
}
function z(t, e) {
  const s = {};
  return e.forEach((r) => {
    r in t && (s[r] = t[r]);
  }), s;
}
function q(t) {
  if (!t)
    return {};
  let e;
  try {
    e = JSON.parse(t);
  } catch {
    return {};
  }
  return typeof e != "object" ? {} : e;
}
function Z(t, e = !0) {
  if (!t)
    return [];
  let s;
  try {
    s = JSON.parse(t);
  } catch {
    return [];
  }
  return Array.isArray(s) ? e ? s.filter((r) => typeof r == "string") : s : [];
}
function j(t, e) {
  return typeof Storage < "u" && localStorage.getItem(t) !== null ? localStorage.getItem(t) : e;
}
function J(t, e) {
  typeof Storage < "u" && localStorage.setItem(t, e.toString());
}
const M = 10;
function $(t, e) {
  let s = 0, r = t.length;
  for (; s < r; ) {
    const o = Math.floor((s + r) / 2);
    t[o].time < e.time ? s = o + 1 : r = o;
  }
  t.splice(s, 0, e);
}
function L(t, e, s) {
  return t.find(
    (r) => r.col === e && r.row === s
  ) ?? null;
}
function I(t, e, s) {
  return new Promise((r) => {
    if (e > 0 && Math.abs(t.currentTime - e) < 1e-3) {
      r();
      return;
    }
    if (e === 0) {
      const o = () => {
        t.removeEventListener("seeked", o);
        const a = () => {
          t.removeEventListener("seeked", a), r();
        };
        t.addEventListener("seeked", a), t.currentTime = 0;
      };
      t.addEventListener("seeked", o), t.currentTime = s;
    } else {
      const o = () => {
        t.removeEventListener("seeked", o), r();
      };
      t.addEventListener("seeked", o), t.currentTime = e;
    }
  });
}
async function* Q({
  cache: t,
  canvas: e,
  duration: s,
  maxInterval: r,
  src: o,
  video: a
}) {
  if (!e)
    throw new Error("Canvas is required");
  if (!a)
    throw new Error("Video is required");
  const { columns: n, frameHeight: i, frameWidth: f, rows: l, spriteCtx: E } = e;
  try {
    for (let c = 0; c < l; c++)
      for (let u = 0; u < n; u++) {
        const m = c * n + u, h = m * r;
        if (h >= s)
          continue;
        const d = u * f, g = c * i, p = L(t[o] ?? [], u, c), w = u === n - 1 && c === l - 1 || h + r >= s;
        p ? yield { ...p, isLastFrame: w } : (await I(a, h, r), E.drawImage(
          a,
          d,
          g,
          f,
          i
        ), yield {
          col: u,
          columns: n,
          frameHeight: i,
          frameWidth: f,
          index: m,
          isLastFrame: w,
          row: c,
          rows: l,
          time: Number(h.toFixed(M)),
          x: d,
          y: g
        }), await new Promise(requestAnimationFrame);
      }
  } catch {
  }
}
function K({
  duration: t,
  frameWidth: e,
  playbackSpeed: s,
  scale: r
}) {
  let o = e * s / r;
  return o > t && (o = t / 2), o;
}
export {
  bt as CMYK_VALIDATION_REGEX,
  kt as ColorType,
  X as CortexPopupController,
  P as DragScroll,
  de as FormControlController,
  Ft as HEX_ALPHA_VALIDATION_REGEX,
  Ot as HEX_VALIDATION_REGEX,
  Ue as HasSlotController,
  Y as HistoryManager,
  S as KeyboardKey,
  Ce as LocalizeController,
  M as PRECISION,
  st as RELATIVE_URL_REGEX,
  Nt as RGB_VALIDATION_REGEX,
  rt as URL_DOMAIN_VALIDATION_REGEX,
  ot as URL_PROTOCOL_VALIDATION_REGEX,
  at as URL_VALIDATION_REGEX,
  zt as activeElements,
  ct as adjustRelativeValues,
  Jt as animateTo,
  D as appendProtocol,
  er as buildTransformationString,
  es as calculateAspectRatioFit,
  Ae as clamp,
  ss as cleanImageFileName,
  Js as clearZeroDurationParts,
  Xt as convertColor,
  fs as convertDataUnits,
  hs as convertDurationToMilliseconds,
  ms as convertPixelsToAspectRatio,
  rs as convertSrcToBlob,
  os as cropImage,
  ve as cssValueToPx,
  oe as customElement,
  ge as customErrorValidityState,
  ne as debounce,
  le as defaultValue,
  N as downloadAsset,
  ue as drag,
  Ms as emptyToSpace,
  Pt as extractColor,
  Ls as extractExtension,
  Q as extractFrames,
  Is as extractRootData,
  ds as extractValueAndUnit,
  Ke as fetchCortexApi,
  Dt as findAncestorWithBuggyStyle,
  At as findContainingBlock,
  Tt as findCuttingAncestor,
  L as findFrameByColAndRow,
  ut as findIndexByProp,
  A as formCollections,
  gs as formatAspectRatioString,
  $s as formatDurationPartsManually,
  ps as formatNumberWithGrouping,
  vs as formatSecondsToTime,
  Rs as formatTimeToSeconds,
  Qs as formatWithIntlDurationFormat,
  ws as gcd,
  Re as getActiveElement,
  qt as getActiveModals,
  Ts as getBreakpointsFromCSS,
  H as getBrowserFontVariants,
  _t as getColorType,
  as as getContainedImageSize,
  Ve as getCortexPopupLayer,
  x as getCurrentZIndex,
  Zt as getDeepestActiveElement,
  ys as getDeviceType,
  Ks as getDurationPartsByUnitsFormat,
  be as getElementFromHTMLString,
  ke as getElementFromTemplate,
  y as getFormControls,
  qs as getHighlightedTitle,
  Zs as getHighlightedTitleHtml,
  Ge as getInnerHTML,
  K as getInterval,
  Bt as getLightDarkCssString,
  ns as getNaturalWidthHeight,
  Fe as getNeededPaddingForBoxShadow,
  yt as getNextAncestor,
  ye as getOffset,
  Oe as getRelativeClickPercentage,
  Vs as getRootIDString,
  ze as getTabbableBoundary,
  qe as getTabbableElements,
  Ye as getTextContent,
  ft as groupBy,
  ht as insertAtIndex,
  $ as insertFrameToCache,
  mt as insertMultipleAtIndex,
  St as isChrome,
  je as isCortexAdobePlugin,
  Ne as isDomElement,
  Xe as isElementInHorizontalView,
  Mt as isFirefox,
  B as isFontFamilyAvailable,
  G as isFormInteracted,
  bs as isGalleryItemCardType,
  Lt as isIOS,
  Pe as isInElement,
  _ as isModKey,
  It as isSafari,
  is as isSaveSrcValid,
  nt as isValidUrl,
  _e as loadScript,
  Se as lockBodyScrolling,
  Ht as luminanceTextColor,
  dt as moveMultipleToIndex,
  gt as moveToIndex,
  pt as multiSelectTo,
  W as omit,
  b as openAssetOverview,
  k as openFolderOverview,
  F as openLink,
  ks as padPath,
  Fs as parseBooleanString,
  Ut as parseBorder,
  $t as parseDuration,
  q as parseJsonString,
  Gt as parseLightDark,
  Z as parseListString,
  Yt as parseShadow,
  z as pick,
  vt as popoverSupported,
  Qt as prefersReducedMotion,
  j as readLocalStorageValue,
  Os as reducePathToDirectChild,
  Ee as registerTranslation,
  wt as removeAtIndex,
  xt as removeMultipleAtIndex,
  ls as resizeImage,
  xs as rotateBox,
  cs as rotateImage,
  Ns as safeExtension,
  Xs as safeString,
  Ps as sanitizeHTML,
  Cs as sanitizeRotation,
  Me as scrollIntoView,
  U as serialize,
  O as shareAsset,
  Kt as shimKeyframesHeightAuto,
  Be as sortByTopPosition,
  T as sortTypefaceVariants,
  Ds as splitBoxValues,
  _s as splitCamelCaseFormatted,
  te as stopAnimations,
  Rt as supportHLS,
  C as testFontAvailability,
  se as timecodeConverter,
  Bs as toCamelCase,
  Hs as toKebabCase,
  Us as toPascalCase,
  it as toRelativeUrl,
  Gs as toTitleCase,
  Ct as toast,
  Ys as truncateTextMiddle,
  Le as unlockBodyScrolling,
  Ws as upperFirst,
  pe as validValidityState,
  we as valueMissingValidityState,
  he as waitForEvent,
  $e as watch,
  J as writeLocalStorageValue
};
