# gutenberg/trunk/build/routes/media-editor/content.js

Gutenberg, version trunk. 38,612 lines.

- Page: https://pluginprobe.com/plugins/gutenberg/trunk/code/build/routes/media-editor/content.js
- Raw: https://pluginprobe.com/plugins/gutenberg/trunk/raw/build/routes/media-editor/content.js
- Modified: 2026-09-30T09:29:30+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/gutenberg/trunk/code/build/routes/media-editor/content.js#L10-L20`.

```javascript
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __commonJS = (cb, mod) => function __require() {
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));

// package-external:@wordpress/i18n
var require_i18n = __commonJS({
  "package-external:@wordpress/i18n"(exports, module) {
    module.exports = window.wp.i18n;
  }
});

// package-external:@wordpress/element
var require_element = __commonJS({
  "package-external:@wordpress/element"(exports, module) {
    module.exports = window.wp.element;
  }
});

// vendor-external:react
var require_react = __commonJS({
  "vendor-external:react"(exports, module) {
    module.exports = window.React;
  }
});

// vendor-external:react/jsx-runtime
var require_jsx_runtime = __commonJS({
  "vendor-external:react/jsx-runtime"(exports, module) {
    module.exports = window.ReactJSXRuntime;
  }
});

// vendor-external:react-dom
var require_react_dom = __commonJS({
  "vendor-external:react-dom"(exports, module) {
    module.exports = window.ReactDOM;
  }
});

// node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js
var require_use_sync_external_store_shim_development = __commonJS({
  "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"(exports) {
    "use strict";
    (function() {
      function is(x2, y2) {
        return x2 === y2 && (0 !== x2 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2;
      }
      function useSyncExternalStore$2(subscribe2, getSnapshot2) {
        didWarnOld18Alpha || void 0 === React119.startTransition || (didWarnOld18Alpha = true, console.error(
          "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
        ));
        var value = getSnapshot2();
        if (!didWarnUncachedGetSnapshot) {
          var cachedValue = getSnapshot2();
          objectIs(value, cachedValue) || (console.error(
            "The result of getSnapshot should be cached to avoid an infinite loop"
          ), didWarnUncachedGetSnapshot = true);
        }
        cachedValue = useState48({
          inst: { value, getSnapshot: getSnapshot2 }
        });
        var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
        useLayoutEffect7(
          function() {
            inst.value = value;
            inst.getSnapshot = getSnapshot2;
            checkIfSnapshotChanged(inst) && forceUpdate({ inst });
          },
          [subscribe2, value, getSnapshot2]
        );
        useEffect41(
          function() {
            checkIfSnapshotChanged(inst) && forceUpdate({ inst });
            return subscribe2(function() {
              checkIfSnapshotChanged(inst) && forceUpdate({ inst });
            });
          },
          [subscribe2]
        );
        useDebugValue2(value);
        return value;
      }
      function checkIfSnapshotChanged(inst) {
        var latestGetSnapshot = inst.getSnapshot;
        inst = inst.value;
        try {
          var nextValue = latestGetSnapshot();
          return !objectIs(inst, nextValue);
        } catch (error2) {
          return true;
        }
      }
      function useSyncExternalStore$1(subscribe2, getSnapshot2) {
        return getSnapshot2();
      }
      "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
      var React119 = require_react(), objectIs = "function" === typeof Object.is ? Object.is : is, useState48 = React119.useState, useEffect41 = React119.useEffect, useLayoutEffect7 = React119.useLayoutEffect, useDebugValue2 = React119.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
      exports.useSyncExternalStore = void 0 !== React119.useSyncExternalStore ? React119.useSyncExternalStore : shim;
      "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
    })();
  }
});

// node_modules/use-sync-external-store/shim/index.js
var require_shim = __commonJS({
  "node_modules/use-sync-external-store/shim/index.js"(exports, module) {
    "use strict";
    if (false) {
      module.exports = null;
    } else {
      module.exports = require_use_sync_external_store_shim_development();
    }
  }
});

// node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js
var require_with_selector_development = __commonJS({
  "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js"(exports) {
    "use strict";
    (function() {
      function is(x2, y2) {
        return x2 === y2 && (0 !== x2 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2;
      }
      "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
      var React119 = require_react(), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore4 = shim.useSyncExternalStore, useRef71 = React119.useRef, useEffect41 = React119.useEffect, useMemo54 = React119.useMemo, useDebugValue2 = React119.useDebugValue;
      exports.useSyncExternalStoreWithSelector = function(subscribe2, getSnapshot2, getServerSnapshot2, selector, isEqual) {
        var instRef = useRef71(null);
        if (null === instRef.current) {
          var inst = { hasValue: false, value: null };
          instRef.current = inst;
        } else inst = instRef.current;
        instRef = useMemo54(
          function() {
            function memoizedSelector(nextSnapshot) {
              if (!hasMemo) {
                hasMemo = true;
                memoizedSnapshot = nextSnapshot;
                nextSnapshot = selector(nextSnapshot);
                if (void 0 !== isEqual && inst.hasValue) {
                  var currentSelection = inst.value;
                  if (isEqual(currentSelection, nextSnapshot))
                    return memoizedSelection = currentSelection;
                }
                return memoizedSelection = nextSnapshot;
              }
              currentSelection = memoizedSelection;
              if (objectIs(memoizedSnapshot, nextSnapshot))
                return currentSelection;
              var nextSelection = selector(nextSnapshot);
              if (void 0 !== isEqual && isEqual(currentSelection, nextSelection))
                return memoizedSnapshot = nextSnapshot, currentSelection;
              memoizedSnapshot = nextSnapshot;
              return memoizedSelection = nextSelection;
            }
            var hasMemo = false, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot2 ? null : getServerSnapshot2;
            return [
              function() {
                return memoizedSelector(getSnapshot2());
              },
              null === maybeGetServerSnapshot ? void 0 : function() {
                return memoizedSelector(maybeGetServerSnapshot());
              }
            ];
          },
          [getSnapshot2, getServerSnapshot2, selector, isEqual]
        );
        var value = useSyncExternalStore4(subscribe2, instRef[0], instRef[1]);
        useEffect41(
          function() {
            inst.hasValue = true;
            inst.value = value;
          },
          [value]
        );
        useDebugValue2(value);
        return value;
      };
      "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
    })();
  }
});

// node_modules/use-sync-external-store/shim/with-selector.js
var require_with_selector = __commonJS({
  "node_modules/use-sync-external-store/shim/with-selector.js"(exports, module) {
    "use strict";
    if (false) {
      module.exports = null;
    } else {
      module.exports = require_with_selector_development();
    }
  }
});

// package-external:@wordpress/compose
var require_compose = __commonJS({
  "package-external:@wordpress/compose"(exports, module) {
    module.exports = window.wp.compose;
  }
});

// package-external:@wordpress/theme
var require_theme = __commonJS({
  "package-external:@wordpress/theme"(exports, module) {
    module.exports = window.wp.theme;
  }
});

// package-external:@wordpress/private-apis
var require_private_apis = __commonJS({
  "package-external:@wordpress/private-apis"(exports, module) {
    module.exports = window.wp.privateApis;
  }
});

// package-external:@wordpress/primitives
var require_primitives = __commonJS({
  "package-external:@wordpress/primitives"(exports, module) {
    module.exports = window.wp.primitives;
  }
});

// package-external:@wordpress/components
var require_components = __commonJS({
  "package-external:@wordpress/components"(exports, module) {
    module.exports = window.wp.components;
  }
});

// package-external:@wordpress/core-data
var require_core_data = __commonJS({
  "package-external:@wordpress/core-data"(exports, module) {
    module.exports = window.wp.coreData;
  }
});

// package-external:@wordpress/data
var require_data = __commonJS({
  "package-external:@wordpress/data"(exports, module) {
    module.exports = window.wp.data;
  }
});

// package-external:@wordpress/editor
var require_editor = __commonJS({
  "package-external:@wordpress/editor"(exports, module) {
    module.exports = window.wp.editor;
  }
});

// package-external:@wordpress/html-entities
var require_html_entities = __commonJS({
  "package-external:@wordpress/html-entities"(exports, module) {
    module.exports = window.wp.htmlEntities;
  }
});

// package-external:@wordpress/keycodes
var require_keycodes = __commonJS({
  "package-external:@wordpress/keycodes"(exports, module) {
    module.exports = window.wp.keycodes;
  }
});

// node_modules/fast-deep-equal/es6/index.js
var require_es6 = __commonJS({
  "node_modules/fast-deep-equal/es6/index.js"(exports, module) {
    "use strict";
    module.exports = function equal(a, b) {
      if (a === b) return true;
      if (a && b && typeof a == "object" && typeof b == "object") {
        if (a.constructor !== b.constructor) return false;
        var length2, i, keys;
        if (Array.isArray(a)) {
          length2 = a.length;
          if (length2 != b.length) return false;
          for (i = length2; i-- !== 0; )
            if (!equal(a[i], b[i])) return false;
          return true;
        }
        if (a instanceof Map && b instanceof Map) {
          if (a.size !== b.size) return false;
          for (i of a.entries())
            if (!b.has(i[0])) return false;
          for (i of a.entries())
            if (!equal(i[1], b.get(i[0]))) return false;
          return true;
        }
        if (a instanceof Set && b instanceof Set) {
          if (a.size !== b.size) return false;
          for (i of a.entries())
            if (!b.has(i[0])) return false;
          return true;
        }
        if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
          length2 = a.length;
          if (length2 != b.length) return false;
          for (i = length2; i-- !== 0; )
            if (a[i] !== b[i]) return false;
          return true;
        }
        if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
        if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
        if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
        keys = Object.keys(a);
        length2 = keys.length;
        if (length2 !== Object.keys(b).length) return false;
        for (i = length2; i-- !== 0; )
          if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
        for (i = length2; i-- !== 0; ) {
          var key = keys[i];
          if (!equal(a[key], b[key])) return false;
        }
        return true;
      }
      return a !== a && b !== b;
    };
  }
});

// package-external:@wordpress/date
var require_date = __commonJS({
  "package-external:@wordpress/date"(exports, module) {
    module.exports = window.wp.date;
  }
});

// node_modules/deepmerge/dist/cjs.js
var require_cjs = __commonJS({
  "node_modules/deepmerge/dist/cjs.js"(exports, module) {
    "use strict";
    var isMergeableObject = function isMergeableObject2(value) {
      return isNonNullObject(value) && !isSpecial(value);
    };
    function isNonNullObject(value) {
      return !!value && typeof value === "object";
    }
    function isSpecial(value) {
      var stringValue = Object.prototype.toString.call(value);
      return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
    }
    var canUseSymbol = typeof Symbol === "function" && Symbol.for;
    var REACT_ELEMENT_TYPE = canUseSymbol ? /* @__PURE__ */ Symbol.for("react.element") : 60103;
    function isReactElement(value) {
      return value.$$typeof === REACT_ELEMENT_TYPE;
    }
    function emptyTarget(val) {
      return Array.isArray(val) ? [] : {};
    }
    function cloneUnlessOtherwiseSpecified(value, options) {
      return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
    }
    function defaultArrayMerge(target, source, options) {
      return target.concat(source).map(function(element) {
        return cloneUnlessOtherwiseSpecified(element, options);
      });
    }
    function getMergeFunction(key, options) {
      if (!options.customMerge) {
        return deepmerge;
      }
      var customMerge = options.customMerge(key);
      return typeof customMerge === "function" ? customMerge : deepmerge;
    }
    function getEnumerableOwnPropertySymbols(target) {
      return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
        return Object.propertyIsEnumerable.call(target, symbol);
      }) : [];
    }
    function getKeys(target) {
      return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
    }
    function propertyIsOnObject(object, property) {
      try {
        return property in object;
      } catch (_) {
        return false;
      }
    }
    function propertyIsUnsafe(target, key) {
      return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
    }
    function mergeObject(target, source, options) {
      var destination = {};
      if (options.isMergeableObject(target)) {
        getKeys(target).forEach(function(key) {
          destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
        });
      }
      getKeys(source).forEach(function(key) {
        if (propertyIsUnsafe(target, key)) {
          return;
        }
        if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
          destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
        } else {
          destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
        }
      });
      return destination;
    }
    function deepmerge(target, source, options) {
      options = options || {};
      options.arrayMerge = options.arrayMerge || defaultArrayMerge;
      options.isMergeableObject = options.isMergeableObject || isMergeableObject;
      options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
      var sourceIsArray = Array.isArray(source);
      var targetIsArray = Array.isArray(target);
      var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
      if (!sourceAndTargetTypesMatch) {
        return cloneUnlessOtherwiseSpecified(source, options);
      } else if (sourceIsArray) {
        return options.arrayMerge(target, source, options);
      } else {
        return mergeObject(target, source, options);
      }
    }
    deepmerge.all = function deepmergeAll(array, options) {
      if (!Array.isArray(array)) {
        throw new Error("first argument should be an array");
      }
      return array.reduce(function(prev, next) {
        return deepmerge(prev, next, options);
      }, {});
    };
    var deepmerge_1 = deepmerge;
    module.exports = deepmerge_1;
  }
});

// package-external:@wordpress/keyboard-shortcuts
var require_keyboard_shortcuts = __commonJS({
  "package-external:@wordpress/keyboard-shortcuts"(exports, module) {
    module.exports = window.wp.keyboardShortcuts;
  }
});

// package-external:@wordpress/notices
var require_notices = __commonJS({
  "package-external:@wordpress/notices"(exports, module) {
    module.exports = window.wp.notices;
  }
});

// package-external:@wordpress/api-fetch
var require_api_fetch = __commonJS({
  "package-external:@wordpress/api-fetch"(exports, module) {
    module.exports = window.wp.apiFetch;
  }
});

// packages/admin-ui/build-module/breadcrumbs/index.mjs
var import_i18n9 = __toESM(require_i18n(), 1);
import { Link as RouterLink } from "@wordpress/route";

// node_modules/clsx/dist/clsx.mjs
function r(e) {
  var t, f, n = "";
  if ("string" == typeof e || "number" == typeof e) n += e;
  else if ("object" == typeof e) if (Array.isArray(e)) {
    var o = e.length;
    for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
  } else for (f in e) e[f] && (n && (n += " "), n += f);
  return n;
}
function clsx() {
  for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
  return n;
}
var clsx_default = clsx;

// packages/ui/build-module/badge/badge.mjs
var import_element11 = __toESM(require_element(), 1);

// node_modules/@base-ui/utils/useControlled.mjs
var React = __toESM(require_react(), 1);

// node_modules/@base-ui/utils/createLogOnce.mjs
var loggedMessages;
if (true) {
  loggedMessages = /* @__PURE__ */ new Set();
}
function createLogOnce(severity, prefix) {
  return function logOnce(...messages) {
    if (true) {
      const message2 = messages.join(" ");
      const output = prefix ? `${prefix}: ${message2}` : message2;
      const key = `${severity}:${output}`;
      if (!loggedMessages.has(key)) {
        loggedMessages.add(key);
        if (severity === "warn") {
          console.warn(output);
        } else {
          console.error(output);
        }
      }
    }
  };
}

// node_modules/@base-ui/utils/error.mjs
var error = createLogOnce("error", "Base UI");

// node_modules/@base-ui/utils/useControlled.mjs
function useControlled({
  controlled,
  default: defaultProp,
  name,
  state = "value"
}) {
  const {
    current: isControlled
  } = React.useRef(controlled !== void 0);
  const [valueState, setValue] = React.useState(defaultProp);
  const value = isControlled && controlled !== void 0 ? controlled : valueState;
  if (true) {
    React.useEffect(() => {
      if (isControlled !== (controlled !== void 0)) {
        error([`A component is changing the ${isControlled ? "" : "un"}controlled ${state} state of ${name} to be ${isControlled ? "un" : ""}controlled.`, "Elements should not switch from uncontrolled to controlled (or vice versa).", `Decide between using a controlled or uncontrolled ${name} element for the lifetime of the component.`, "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", "More info: https://fb.me/react-controlled-components"].join("\n"));
      }
    }, [state, name, controlled]);
    const {
      current: defaultValue
    } = React.useRef(defaultProp);
    React.useEffect(() => {
      if (!isControlled && serializeToDevModeString(defaultValue) !== serializeToDevModeString(defaultProp)) {
        error([`A component is changing the default ${state} state of an uncontrolled ${name} after being initialized. To suppress this warning opt to use a controlled ${name}.`].join("\n"));
      }
    }, [defaultProp]);
  }
  const setValueIfUncontrolled = React.useCallback((newValue) => {
    if (!isControlled) {
      setValue(newValue);
    }
  }, []);
  return [value, setValueIfUncontrolled];
}
function serializeToDevModeString(input) {
  let nextId = 0;
  const seen = /* @__PURE__ */ new WeakMap();
  try {
    const result = JSON.stringify(input, function replacer(key, value) {
      if (key === "_owner" && this != null && typeof this === "object" && "$$typeof" in this) {
        return void 0;
      }
      if (typeof value === "bigint") {
        return `__bigint__:${value}`;
      }
      if (value !== null && typeof value === "object") {
        const id = seen.get(value);
        if (id !== void 0) {
          return `__object__:${id}`;
        }
        seen.set(value, nextId);
        nextId += 1;
      }
      return value;
    });
    return result ?? `__top__:${typeof input}`;
  } catch {
    return "__unserializable__";
  }
}

// node_modules/@base-ui/utils/safeReact.mjs
var React2 = __toESM(require_react(), 1);
var SafeReact = {
  ...React2
};

// node_modules/@base-ui/utils/useRefWithInit.mjs
var React3 = __toESM(require_react(), 1);
var UNINITIALIZED = {};
function useRefWithInit(init, initArg) {
  const ref = React3.useRef(UNINITIALIZED);
  if (ref.current === UNINITIALIZED) {
    ref.current = init(initArg);
  }
  return ref;
}

// node_modules/@base-ui/utils/useStableCallback.mjs
var useInsertionEffect = SafeReact.useInsertionEffect;
var useSafeInsertionEffect = (
  // React 17 doesn't have useInsertionEffect.
  useInsertionEffect && // Preact replaces useInsertionEffect with useLayoutEffect and fires too late.
  useInsertionEffect !== SafeReact.useLayoutEffect ? useInsertionEffect : (fn) => fn()
);
function useStableCallback(callback) {
  const stable = useRefWithInit(createStableCallback).current;
  stable.next = callback;
  useSafeInsertionEffect(stable.effect);
  return stable.trampoline;
}
function createStableCallback() {
  const stable = {
    next: void 0,
    callback: assertNotCalled,
    trampoline: (...args) => stable.callback?.(...args),
    effect: () => {
      stable.callback = stable.next;
    }
  };
  return stable;
}
function assertNotCalled() {
  if (true) {
    throw (
      /* minify-error-disabled */
      new Error("Base UI: Cannot call an event handler while rendering.")
    );
  }
}

// node_modules/@base-ui/utils/warn.mjs
var warn = createLogOnce("warn", "Base UI");

// node_modules/@base-ui/utils/empty.mjs
function NOOP() {
}
var EMPTY_ARRAY = Object.freeze([]);
var EMPTY_OBJECT = Object.freeze({});

// node_modules/@base-ui/react/internals/composite/list/CompositeList.mjs
var React6 = __toESM(require_react(), 1);

// node_modules/@base-ui/utils/useIsoLayoutEffect.mjs
var React4 = __toESM(require_react(), 1);
var noop = () => {
};
var useIsoLayoutEffect = typeof document !== "undefined" ? React4.useLayoutEffect : noop;

// node_modules/@base-ui/react/internals/composite/list/CompositeListContext.mjs
var React5 = __toESM(require_react(), 1);
var CompositeListContext = /* @__PURE__ */ React5.createContext({
  register: () => {
  },
  unregister: () => {
  },
  subscribeMapChange: () => () => {
  },
  nextIndexRef: {
    current: 0
  }
});
if (true) CompositeListContext.displayName = "CompositeListContext";
function useCompositeListContext() {
  return React5.useContext(CompositeListContext);
}

// node_modules/@base-ui/react/internals/composite/list/CompositeList.mjs
var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
function CompositeList(props) {
  const {
    children,
    elementsRef,
    labelsRef,
    onMapChange: onMapChangeProp
  } = props;
  const onMapChange = useStableCallback(onMapChangeProp);
  const [, setMapTick] = React6.useState(false);
  const listeners = useRefWithInit(createListeners).current;
  const map = useRefWithInit(createMap).current;
  const nextIndexRef = React6.useRef(0);
  const isDirtyRef = React6.useRef(true);
  const itemsRef = React6.useRef(null);
  const mutationObserverRef = React6.useRef(null);
  const scheduleMapUpdate = useStableCallback(() => {
    if (isDirtyRef.current) {
      return;
    }
    isDirtyRef.current = true;
    setMapTick((tick) => !tick);
  });
  const register3 = useStableCallback((node, registration) => {
    map.set(node, registration);
    scheduleMapUpdate();
  });
  const unregister = useStableCallback((node) => {
    map.delete(node);
    scheduleMapUpdate();
  });
  const syncRefs = useStableCallback((items) => {
    const nextMap = /* @__PURE__ */ new Map();
    elementsRef.current.length = 0;
    if (labelsRef) {
      labelsRef.current.length = 0;
    }
    items.forEach((item) => {
      nextMap.set(item.element, {
        ...item.registration.metadata ?? {},
        index: item.index
      });
      elementsRef.current[item.index] = item.element;
      if (labelsRef) {
        labelsRef.current[item.index] = item.registration.label !== void 0 ? item.registration.label : item.registration.textRef?.current?.textContent ?? item.element.textContent;
      }
    });
    nextIndexRef.current = elementsRef.current.length;
    return nextMap;
  });
  function observe(sortedNodes) {
    mutationObserverRef.current?.disconnect();
    mutationObserverRef.current = null;
    if (typeof MutationObserver !== "function" || sortedNodes.length < 2) {
      return;
    }
    const mutationObserver = new MutationObserver((entries) => {
      if (!hasMovedNode(entries)) {
        return;
      }
      let previousConnectedNode = null;
      for (const node of sortedNodes) {
        if (!node.isConnected) {
          continue;
        }
        if (previousConnectedNode && sortByDocumentPosition(previousConnectedNode, node) > 0) {
          mutationObserver.disconnect();
          scheduleMapUpdate();
          return;
        }
        previousConnectedNode = node;
      }
    });
    mutationObserverRef.current = mutationObserver;
    const roots = /* @__PURE__ */ new Set();
    for (let i = 1; i < sortedNodes.length; i += 1) {
      const root = getCommonAncestor(sortedNodes[i - 1], sortedNodes[i]);
      if (root) {
        roots.add(root);
      }
    }
    roots.forEach((root) => mutationObserver.observe(root, {
      childList: true
    }));
  }
  const flush = useStableCallback(() => {
    const [items, automaticNodes] = getCompositeListSnapshot(map);
    const nextMap = syncRefs(items);
    const previousItems = itemsRef.current;
    const changed = !previousItems || previousItems.length !== items.length || items.some((item, index3) => {
      const previousItem = previousItems[index3];
      return item.index !== previousItem.index || item.element !== previousItem.element || item.registration.index !== previousItem.registration.index || item.registration.metadata !== previousItem.registration.metadata;
    });
    observe(automaticNodes);
    itemsRef.current = items;
    isDirtyRef.current = false;
    if (!changed) {
      return;
    }
    listeners.forEach((listener) => listener(nextMap));
    onMapChange(nextMap);
  });
  useIsoLayoutEffect(() => {
    if (!isDirtyRef.current && itemsRef.current) {
      syncRefs(itemsRef.current);
    }
    return () => {
      elementsRef.current = [];
      if (labelsRef) {
        labelsRef.current = [];
      }
    };
  }, [elementsRef, labelsRef, syncRefs]);
  useIsoLayoutEffect(() => {
    if (isDirtyRef.current) {
      flush();
    }
  });
  useIsoLayoutEffect(() => {
    return () => {
      mutationObserverRef.current?.disconnect();
      isDirtyRef.current = true;
    };
  }, []);
  const subscribeMapChange = useStableCallback((fn) => {
    listeners.add(fn);
    return () => {
      listeners.delete(fn);
    };
  });
  const contextValue = React6.useMemo(() => ({
    register: register3,
    unregister,
    subscribeMapChange,
    nextIndexRef
  }), [register3, unregister, subscribeMapChange, nextIndexRef]);
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CompositeListContext.Provider, {
    value: contextValue,
    children
  });
}
function createMap() {
  return /* @__PURE__ */ new Map();
}
function createListeners() {
  return /* @__PURE__ */ new Set();
}
function getCompositeListSnapshot(map) {
  const reservedIndices = /* @__PURE__ */ new Set();
  const items = [];
  const automaticItems = [];
  map.forEach((registration, node) => {
    if (!node.isConnected) {
      return;
    }
    const index3 = registration.index;
    const item = {
      index: index3 ?? -1,
      element: node,
      registration
    };
    if (index3 === null) {
      automaticItems.push(item);
    } else if (index3 >= 0) {
      reservedIndices.add(index3);
      items.push(item);
    }
  });
  let nextAutomaticIndex = 0;
  automaticItems.sort((a, b) => sortByDocumentPosition(a.element, b.element));
  automaticItems.forEach((item) => {
    while (reservedIndices.has(nextAutomaticIndex)) {
      nextAutomaticIndex += 1;
    }
    item.index = nextAutomaticIndex;
    items.push(item);
    nextAutomaticIndex += 1;
  });
  if (reservedIndices.size > 0) {
    items.sort((a, b) => a.index - b.index);
  }
  return [items, automaticItems.map((item) => item.element)];
}
function getCommonAncestor(firstNode, lastNode) {
  let ancestor = firstNode.parentElement;
  while (ancestor && !ancestor.contains(lastNode)) {
    ancestor = ancestor.parentElement;
  }
  return ancestor;
}
function hasMovedNode(entries) {
  for (const entry of entries) {
    for (let i = 0; i < entry.removedNodes.length; i += 1) {
      if (entry.removedNodes[i].isConnected) {
        return true;
      }
    }
  }
  return false;
}
function sortByDocumentPosition(a, b) {
  return a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;
}

// node_modules/@base-ui/react/internals/useRenderElement.mjs
var React9 = __toESM(require_react(), 1);

// node_modules/@base-ui/utils/useMergedRefs.mjs
function useMergedRefs(a, b, c2, d) {
  const forkRef = useRefWithInit(createForkRef).current;
  if (didChange(forkRef, a, b, c2, d)) {
    update(forkRef, [a, b, c2, d]);
  }
  return forkRef.callback;
}
function useMergedRefsN(refs) {
  const forkRef = useRefWithInit(createForkRef).current;
  if (didChangeN(forkRef, refs)) {
    update(forkRef, refs);
  }
  return forkRef.callback;
}
function createForkRef() {
  return {
    callback: null,
    cleanup: null,
    refs: []
  };
}
function didChange(forkRef, a, b, c2, d) {
  return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c2 || forkRef.refs[3] !== d;
}
function didChangeN(forkRef, newRefs) {
  return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index3) => ref !== newRefs[index3]);
}
function update(forkRef, refs) {
  forkRef.refs = refs;
  if (refs.every((ref) => ref == null)) {
    forkRef.callback = null;
    return;
  }
  forkRef.callback = (instance) => {
    if (forkRef.cleanup) {
      forkRef.cleanup();
      forkRef.cleanup = null;
    }
    if (instance != null) {
      const cleanupCallbacks = Array(refs.length).fill(null);
      for (let i = 0; i < refs.length; i += 1) {
        const ref = refs[i];
        if (ref == null) {
          continue;
        }
        switch (typeof ref) {
          case "function": {
            const refCleanup = ref(instance);
            if (typeof refCleanup === "function") {
              cleanupCallbacks[i] = refCleanup;
            }
            break;
          }
          case "object": {
            ref.current = instance;
            break;
          }
          default:
        }
      }
      forkRef.cleanup = () => {
        for (let i = 0; i < refs.length; i += 1) {
          const ref = refs[i];
          if (ref == null) {
            continue;
          }
          switch (typeof ref) {
            case "function": {
              const cleanupCallback = cleanupCallbacks[i];
              if (typeof cleanupCallback === "function") {
                cleanupCallback();
              } else {
                void ref(null);
              }
              break;
            }
            case "object": {
              ref.current = null;
              break;
            }
            default:
          }
        }
      };
    }
  };
}

// node_modules/@base-ui/utils/getReactElementRef.mjs
var React8 = __toESM(require_react(), 1);

// node_modules/@base-ui/utils/reactVersion.mjs
var React7 = __toESM(require_react(), 1);
var majorVersion = parseInt(React7.version, 10);
function isReactVersionAtLeast(reactVersionToCheck) {
  return majorVersion >= reactVersionToCheck;
}

// node_modules/@base-ui/utils/getReactElementRef.mjs
function getReactElementRef(element) {
  if (!/* @__PURE__ */ React8.isValidElement(element)) {
    return null;
  }
  const reactElement = element;
  const propsWithRef = reactElement.props;
  return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null;
}

// node_modules/@base-ui/utils/mergeObjects.mjs
function mergeObjects(a, b) {
  if (a && !b) {
    return a;
  }
  if (!a && b) {
    return b;
  }
  if (a || b) {
    return {
      ...a,
      ...b
    };
  }
  return void 0;
}

// node_modules/@base-ui/react/internals/getStateAttributesProps.mjs
function getStateAttributesProps(state, customMapping) {
  const props = {};
  for (const key in state) {
    const value = state[key];
    if (customMapping?.hasOwnProperty(key)) {
      const customProps = customMapping[key](value);
      if (customProps != null) {
        Object.assign(props, customProps);
      }
      continue;
    }
    if (value === true) {
      props[`data-${key.toLowerCase()}`] = "";
    } else if (value) {
      props[`data-${key.toLowerCase()}`] = value.toString();
    }
  }
  return props;
}

// node_modules/@base-ui/react/utils/resolveClassName.mjs
function resolveClassName(className, state) {
  return typeof className === "function" ? className(state) : className;
}

// node_modules/@base-ui/react/utils/resolveStyle.mjs
function resolveStyle(style, state) {
  return typeof style === "function" ? style(state) : style;
}

// node_modules/@base-ui/react/merge-props/mergeProps.mjs
var EMPTY_PROPS = {};
function mergeProps(a, b, c2, d, e) {
  if (!c2 && !d && !e && !a) {
    return createInitialMergedProps(b);
  }
  let merged = createInitialMergedProps(a);
  if (b) {
    merged = mergeInto(merged, b);
  }
  if (c2) {
    merged = mergeInto(merged, c2);
  }
  if (d) {
    merged = mergeInto(merged, d);
  }
  if (e) {
    merged = mergeInto(merged, e);
  }
  return merged;
}
function mergePropsN(props) {
  if (props.length === 0) {
    return EMPTY_PROPS;
  }
  if (props.length === 1) {
    return createInitialMergedProps(props[0]);
  }
  let merged = createInitialMergedProps(props[0]);
  for (let i = 1; i < props.length; i += 1) {
    merged = mergeInto(merged, props[i]);
  }
  return merged;
}
function createInitialMergedProps(inputProps) {
  if (isPropsGetter(inputProps)) {
    return {
      ...resolvePropsGetter(inputProps, EMPTY_PROPS)
    };
  }
  return copyInitialProps(inputProps);
}
function mergeInto(merged, inputProps) {
  if (isPropsGetter(inputProps)) {
    return resolvePropsGetter(inputProps, merged);
  }
  return mutablyMergeInto(merged, inputProps);
}
function copyInitialProps(inputProps) {
  const copiedProps = {
    ...inputProps
  };
  for (const propName in copiedProps) {
    const propValue = copiedProps[propName];
    if (isEventHandler(propName, propValue)) {
      copiedProps[propName] = wrapEventHandler(propValue);
    }
  }
  return copiedProps;
}
function mutablyMergeInto(mergedProps, externalProps) {
  if (!externalProps) {
    return mergedProps;
  }
  for (const propName in externalProps) {
    const externalPropValue = externalProps[propName];
    switch (propName) {
      case "style": {
        mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue);
        break;
      }
      case "className": {
        mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue);
        break;
      }
      default: {
        if (isEventHandler(propName, externalPropValue)) {
          mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue);
        } else {
          mergedProps[propName] = externalPropValue;
        }
      }
    }
  }
  return mergedProps;
}
function isEventHandler(key, value) {
  const code0 = key.charCodeAt(0);
  const code1 = key.charCodeAt(1);
  const code2 = key.charCodeAt(2);
  return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined");
}
function isPropsGetter(inputProps) {
  return typeof inputProps === "function";
}
function resolvePropsGetter(inputProps, previousProps) {
  if (isPropsGetter(inputProps)) {
    return inputProps(previousProps);
  }
  return inputProps ?? EMPTY_PROPS;
}
function mergeEventHandlers(ourHandler, theirHandler) {
  if (!theirHandler) {
    return ourHandler;
  }
  if (!ourHandler) {
    return wrapEventHandler(theirHandler);
  }
  return (...args) => {
    const event = args[0];
    if (isSyntheticEvent(event)) {
      const baseUIEvent = event;
      makeEventPreventable(baseUIEvent);
      const result2 = theirHandler(...args);
      if (!baseUIEvent.baseUIHandlerPrevented) {
        ourHandler?.(...args);
      }
      return result2;
    }
    const result = theirHandler(...args);
    ourHandler?.(...args);
    return result;
  };
}
function wrapEventHandler(handler) {
  if (!handler) {
    return handler;
  }
  return (...args) => {
    const event = args[0];
    if (isSyntheticEvent(event)) {
      makeEventPreventable(event);
    }
    return handler(...args);
  };
}
function makeEventPreventable(event) {
  event.preventBaseUIHandler = () => {
    event.baseUIHandlerPrevented = true;
  };
  return event;
}
function mergeClassNames(ourClassName, theirClassName) {
  if (theirClassName) {
    if (ourClassName) {
      return theirClassName + " " + ourClassName;
    }
    return theirClassName;
  }
  return ourClassName;
}
function isSyntheticEvent(event) {
  return event != null && typeof event === "object" && "nativeEvent" in event;
}

// node_modules/@base-ui/react/internals/useRenderElement.mjs
var import_react = __toESM(require_react(), 1);
function useRenderElement(element, componentProps, params = {}) {
  let renderProp = componentProps.render;
  if (params.enabled !== false) {
    renderProp = unwrapLazyRenderProp(renderProp);
  }
  const outProps = useRenderElementProps(componentProps, params, renderProp);
  if (params.enabled === false) {
    return null;
  }
  const state = params.state ?? EMPTY_OBJECT;
  return evaluateRenderProp(element, renderProp, outProps, state);
}
function useRenderElementProps(componentProps, params, renderProp) {
  const {
    className: classNameProp,
    style: styleProp
  } = componentProps;
  const {
    state = EMPTY_OBJECT,
    ref,
    props,
    stateAttributesMapping: stateAttributesMapping5,
    enabled = true
  } = params;
  const className = enabled ? resolveClassName(classNameProp, state) : void 0;
  const style = enabled ? resolveStyle(styleProp, state) : void 0;
  const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping5) : EMPTY_OBJECT;
  const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : void 0;
  const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT;
  if (typeof document !== "undefined") {
    if (!enabled) {
      void useMergedRefs(null, null);
    } else if (Array.isArray(ref)) {
      outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]);
    } else {
      outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref);
    }
  }
  if (!enabled) {
    return EMPTY_OBJECT;
  }
  if (className !== void 0) {
    outProps.className = mergeClassNames(outProps.className, className);
  }
  if (style !== void 0) {
    outProps.style = mergeObjects(outProps.style, style);
  }
  return outProps;
}
function resolveRenderFunctionProps(props) {
  if (Array.isArray(props)) {
    return mergePropsN(props);
  }
  return mergeProps(void 0, props);
}
var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
var COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/;
var LOWERCASE_CHARACTER_PATTERN = /[a-z]/;
function unwrapLazyRenderProp(render4) {
  if (render4?.$$typeof !== REACT_LAZY_TYPE) {
    return render4;
  }
  const unwrapped = React9.Children.toArray(render4)[0];
  return /* @__PURE__ */ React9.isValidElement(unwrapped) ? unwrapped : render4;
}
function evaluateRenderProp(element, render4, props, state) {
  if (render4) {
    if (typeof render4 === "function") {
      if (true) {
        warnIfRenderPropLooksLikeComponent(render4);
      }
      return render4(props, state);
    }
    const mergedProps = mergeProps(props, render4.props);
    mergedProps.ref = props.ref;
    if (true) {
      if (!/* @__PURE__ */ React9.isValidElement(render4)) {
        throw new Error(["Base UI: The `render` prop was provided an invalid React element as `React.isValidElement(render)` is `false`.", "A valid React element must be provided to the `render` prop because it is cloned with props to replace the default element.", "https://base-ui.com/r/invalid-render-prop"].join("\n"));
      }
    }
    return /* @__PURE__ */ React9.cloneElement(render4, mergedProps);
  }
  if (element) {
    if (typeof element === "string") {
      return renderTag(element, props);
    }
  }
  throw new Error(true ? "Base UI: Render element or function are not defined." : formatErrorMessage_default(8));
}
function warnIfRenderPropLooksLikeComponent(renderFn) {
  const functionName = renderFn.name;
  if (functionName.length === 0) {
    return;
  }
  if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) {
    return;
  }
  if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) {
    return;
  }
  warn(`The \`render\` prop received a function named \`${functionName}\` that starts with an uppercase letter.`, "This usually means a React component was passed directly as `render={Component}`.", "Base UI calls `render` as a plain function, which can break the Rules of Hooks during reconciliation.", "If this is an intentional render callback, rename it to start with a lowercase letter.", "Use `render={<Component />}` or `render={(props) => <Component {...props} />}` instead.", "https://base-ui.com/r/invalid-render-prop");
}
function renderTag(Tag, props) {
  if (Tag === "button") {
    return /* @__PURE__ */ (0, import_react.createElement)("button", {
      type: "button",
      ...props,
      key: props.key
    });
  }
  if (Tag === "img") {
    return /* @__PURE__ */ (0, import_react.createElement)("img", {
      alt: "",
      ...props,
      key: props.key
    });
  }
  return /* @__PURE__ */ React9.createElement(Tag, props);
}

// node_modules/@base-ui/utils/useId.mjs
var React10 = __toESM(require_react(), 1);
var globalId = 0;
function useGlobalId(idOverride, prefix = "mui") {
  const [defaultId, setDefaultId] = React10.useState(idOverride);
  const id = idOverride || defaultId;
  React10.useEffect(() => {
    if (defaultId == null) {
      globalId += 1;
      setDefaultId(`${prefix}-${globalId}`);
    }
  }, [defaultId, prefix]);
  return id;
}
var maybeReactUseId = SafeReact.useId;
function useId(idOverride, prefix) {
  if (maybeReactUseId !== void 0) {
    const reactId = maybeReactUseId();
    return idOverride ?? (prefix ? `${prefix}-${reactId}` : reactId);
  }
  return useGlobalId(idOverride, prefix);
}

// node_modules/@base-ui/react/internals/useBaseUiId.mjs
function useBaseUiId(idOverride) {
  return useId(idOverride, "base-ui");
}

// node_modules/@base-ui/react/collapsible/root/useCollapsibleRoot.mjs
var React13 = __toESM(require_react(), 1);

// node_modules/@base-ui/react/internals/reason-parts.mjs
var reason_parts_exports = {};
__export(reason_parts_exports, {
  cancelOpen: () => cancelOpen,
  chipRemovePress: () => chipRemovePress,
  clearPress: () => clearPress,
  closePress: () => closePress,
  closeWatcher: () => closeWatcher,
  decrementPress: () => decrementPress,
  disabled: () => disabled,
  drag: () => drag,
  escapeKey: () => escapeKey,
  focusOut: () => focusOut,
  imperativeAction: () => imperativeAction,
  incrementPress: () => incrementPress,
  initial: () => initial,
  inputBlur: () => inputBlur,
  inputChange: () => inputChange,
  inputClear: () => inputClear,
  inputPaste: () => inputPaste,
  inputPress: () => inputPress,
  itemPress: () => itemPress,
  keyboard: () => keyboard,
  linkPress: () => linkPress,
  listNavigation: () => listNavigation,
  missing: () => missing,
  none: () => none,
  outsidePress: () => outsidePress,
  pointer: () => pointer,
  scrub: () => scrub,
  siblingOpen: () => siblingOpen,
  swipe: () => swipe,
  trackPress: () => trackPress,
  triggerFocus: () => triggerFocus,
  triggerHover: () => triggerHover,
  triggerPress: () => triggerPress,
  wheel: () => wheel,
  windowResize: () => windowResize
});
var none = "none";
var triggerPress = "trigger-press";
var triggerHover = "trigger-hover";
var triggerFocus = "trigger-focus";
var outsidePress = "outside-press";
var itemPress = "item-press";
var closePress = "close-press";
var linkPress = "link-press";
var clearPress = "clear-press";
var chipRemovePress = "chip-remove-press";
var trackPress = "track-press";
var incrementPress = "increment-press";
var decrementPress = "decrement-press";
var inputChange = "input-change";
var inputClear = "input-clear";
var inputBlur = "input-blur";
var inputPaste = "input-paste";
var inputPress = "input-press";
var focusOut = "focus-out";
var escapeKey = "escape-key";
var closeWatcher = "close-watcher";
var listNavigation = "list-navigation";
var keyboard = "keyboard";
var pointer = "pointer";
var drag = "drag";
var wheel = "wheel";
var scrub = "scrub";
var cancelOpen = "cancel-open";
var siblingOpen = "sibling-open";
var disabled = "disabled";
var missing = "missing";
var initial = "initial";
var imperativeAction = "imperative-action";
var swipe = "swipe";
var windowResize = "window-resize";

// node_modules/@base-ui/react/internals/createBaseUIEventDetails.mjs
function createChangeEventDetails(reason, event, trigger, customProperties) {
  let canceled = false;
  let allowPropagation = false;
  const custom = customProperties ?? EMPTY_OBJECT;
  const details = {
    reason,
    event: event ?? new Event("base-ui"),
    cancel() {
      canceled = true;
    },
    allowPropagation() {
      allowPropagation = true;
    },
    get isCanceled() {
      return canceled;
    },
    get isPropagationAllowed() {
      return allowPropagation;
    },
    trigger,
    ...custom
  };
  return details;
}

// node_modules/@base-ui/react/internals/useTransitionStatus.mjs
var React12 = __toESM(require_react(), 1);

// node_modules/@base-ui/utils/useOnMount.mjs
var React11 = __toESM(require_react(), 1);
function useOnMount(fn) {
  React11.useEffect(fn, EMPTY_ARRAY);
}

// node_modules/@base-ui/utils/useAnimationFrame.mjs
var EMPTY = null;
var LAST_RAF = globalThis.requestAnimationFrame;
var Scheduler = class {
  /* This implementation uses an array as a backing data-structure for frame callbacks.
   * It allows `O(1)` callback cancelling by inserting a `null` in the array, though it
   * never calls the native `cancelAnimationFrame` if there are no frames left. This can
   * be much more efficient if there is a call pattern that alterns as
   * "request-cancel-request-cancel-…".
   * But in the case of "request-request-…-cancel-cancel-…", it leaves the final animation
   * frame to run anyway. We turn that frame into a `O(1)` no-op via `callbacksCount`. */
  callbacks = [];
  callbacksCount = 0;
  nextId = 1;
  startId = 1;
  isScheduled = false;
  tick = (timestamp) => {
    this.isScheduled = false;
    const currentCallbacks = this.callbacks;
    const currentCallbacksCount = this.callbacksCount;
    this.callbacks = [];
    this.callbacksCount = 0;
    this.startId = this.nextId;
    if (currentCallbacksCount > 0) {
      for (let i = 0; i < currentCallbacks.length; i += 1) {
        currentCallbacks[i]?.(timestamp);
      }
    }
  };
  request(fn) {
    const id = this.nextId;
    this.nextId += 1;
    this.callbacks.push(fn);
    this.callbacksCount += 1;
    const didRAFChange = LAST_RAF !== requestAnimationFrame && (LAST_RAF = requestAnimationFrame, true);
    if (!this.isScheduled || didRAFChange) {
      requestAnimationFrame(this.tick);
      this.isScheduled = true;
    }
    return id;
  }
  cancel(id) {
    const index3 = id - this.startId;
    if (index3 < 0 || index3 >= this.callbacks.length) {
      return;
    }
    if (this.callbacks[index3] === null) {
      return;
    }
    this.callbacks[index3] = null;
    this.callbacksCount -= 1;
  }
};
var scheduler = new Scheduler();
var AnimationFrame = class _AnimationFrame {
  static create() {
    return new _AnimationFrame();
  }
  static request(fn) {
    return scheduler.request(fn);
  }
  static cancel(id) {
    return scheduler.cancel(id);
  }
  currentId = EMPTY;
  /**
   * Executes `fn` after `delay`, clearing any previously scheduled call.
   */
  request(fn) {
    this.cancel();
    this.currentId = scheduler.request(() => {
      this.currentId = EMPTY;
      fn();
    });
  }
  cancel = () => {
    if (this.currentId !== EMPTY) {
      scheduler.cancel(this.currentId);
      this.currentId = EMPTY;
    }
  };
  disposeEffect = () => {
    return this.cancel;
  };
};
function useAnimationFrame() {
  const timeout = useRefWithInit(AnimationFrame.create).current;
  useOnMount(timeout.disposeEffect);
  return timeout;
}

// node_modules/@base-ui/react/internals/useTransitionStatus.mjs
function useTransitionStatus(open3, enableIdleState = false, deferEndingState = false, animateInitialOpen = false) {
  const [transitionStatus, setTransitionStatus] = React12.useState(open3 && enableIdleState ? "idle" : void 0);
  const [mounted, setMounted] = React12.useState(open3 && !animateInitialOpen);
  if (open3 && !mounted) {
    setMounted(true);
    setTransitionStatus("starting");
  }
  if (!open3 && mounted && transitionStatus !== "ending" && !deferEndingState) {
    setTransitionStatus("ending");
  }
  if (!open3 && !mounted && transitionStatus === "ending") {
    setTransitionStatus(void 0);
  }
  useIsoLayoutEffect(() => {
    if (!open3 && mounted && transitionStatus !== "ending" && deferEndingState) {
      const frame = AnimationFrame.request(() => {
        setTransitionStatus("ending");
      });
      return () => {
        AnimationFrame.cancel(frame);
      };
    }
    return void 0;
  }, [open3, mounted, transitionStatus, deferEndingState]);
  useIsoLayoutEffect(() => {
    if (!open3 || enableIdleState) {
      return void 0;
    }
    const frame = AnimationFrame.request(() => {
      setTransitionStatus(void 0);
    });
    return () => {
      AnimationFrame.cancel(frame);
    };
  }, [enableIdleState, open3]);
  useIsoLayoutEffect(() => {
    if (!open3 || !enableIdleState) {
      return void 0;
    }
    if (open3 && mounted && transitionStatus !== "idle") {
      setTransitionStatus("starting");
    }
    const frame = AnimationFrame.request(() => {
      setTransitionStatus("idle");
    });
    return () => {
      AnimationFrame.cancel(frame);
    };
  }, [enableIdleState, open3, mounted, transitionStatus]);
  return {
    mounted,
    setMounted,
    transitionStatus
  };
}

// node_modules/@base-ui/react/collapsible/root/useCollapsibleRoot.mjs
function useCollapsibleRoot(parameters) {
  const {
    open: openParam,
    defaultOpen = false,
    onOpenChange,
    disabled: disabled2
  } = parameters;
  const [open3, setOpen] = useControlled({
    controlled: openParam,
    default: defaultOpen,
    name: "Collapsible",
    state: "open"
  });
  const {
    mounted,
    setMounted,
    transitionStatus
  } = useTransitionStatus(open3, true, true);
  const defaultPanelId = useBaseUiId();
  const [registeredPanelId, setPanelIdState] = React13.useState();
  const panelId = registeredPanelId === null ? void 0 : registeredPanelId ?? defaultPanelId;
  const handleTrigger = useStableCallback((event) => {
    const nextOpen = !open3;
    const eventDetails = createChangeEventDetails(reason_parts_exports.triggerPress, event.nativeEvent);
    onOpenChange(nextOpen, eventDetails);
    if (eventDetails.isCanceled) {
      return;
    }
    setOpen(nextOpen);
  });
  return React13.useMemo(() => ({
    defaultPanelId,
    disabled: disabled2,
    handleTrigger,
    mounted,
    open: open3,
    panelId,
    setMounted,
    setOpen,
    setPanelIdState,
    transitionStatus
  }), [defaultPanelId, disabled2, handleTrigger, mounted, open3, panelId, setMounted, setOpen, setPanelIdState, transitionStatus]);
}

// node_modules/@base-ui/react/collapsible/root/CollapsibleRootContext.mjs
var React14 = __toESM(require_react(), 1);
var CollapsibleRootContext = /* @__PURE__ */ React14.createContext(void 0);
if (true) CollapsibleRootContext.displayName = "CollapsibleRootContext";
function useCollapsibleRootContext() {
  const context = React14.useContext(CollapsibleRootContext);
  if (context === void 0) {
    throw new Error(true ? "Base UI: CollapsibleRootContext is missing. Collapsible parts must be placed within <Collapsible.Root>." : formatErrorMessage_default(15));
  }
  return context;
}

// node_modules/@base-ui/react/internals/composite/list/useCompositeListItem.mjs
var React15 = __toESM(require_react(), 1);
function useCompositeListItem(params = {}) {
  const {
    guess,
    label,
    metadata,
    textRef,
    index: externalIndex
  } = params;
  const {
    register: register3,
    unregister,
    subscribeMapChange,
    nextIndexRef
  } = useCompositeListContext();
  const indexRef = React15.useRef(-1);
  const [internalIndex, setInternalIndex] = React15.useState(externalIndex == null && guess ? () => {
    if (indexRef.current === -1) {
      const newIndex = nextIndexRef.current;
      nextIndexRef.current += 1;
      indexRef.current = newIndex;
    }
    return indexRef.current;
  } : -1);
  const index3 = externalIndex ?? internalIndex;
  const componentRef = React15.useRef(null);
  const ref = React15.useCallback((node) => {
    const previousNode = componentRef.current;
    if (previousNode) {
      unregister(previousNode);
    }
    componentRef.current = node;
    if (node) {
      register3(node, {
        metadata: metadata ?? null,
        index: externalIndex ?? null,
        label,
        textRef
      });
    }
  }, [externalIndex, register3, unregister, metadata, label, textRef]);
  useIsoLayoutEffect(() => {
    if (externalIndex != null) {
      return void 0;
    }
    return subscribeMapChange((map) => {
      const i = componentRef.current ? map.get(componentRef.current)?.index : null;
      if (i != null) {
        setInternalIndex(i);
      }
    });
  }, [externalIndex, subscribeMapChange]);
  return {
    ref,
    index: index3
  };
}

// node_modules/@base-ui/react/internals/TransitionStatusDataAttributes.mjs
var TransitionStatusDataAttributes_exports = {};
__export(TransitionStatusDataAttributes_exports, {
  endingStyle: () => endingStyle,
  startingStyle: () => startingStyle
});
var startingStyle = "data-starting-style";
var endingStyle = "data-ending-style";

// node_modules/@base-ui/react/internals/stateAttributesMapping.mjs
var STARTING_HOOK = {
  [startingStyle]: ""
};
var ENDING_HOOK = {
  [endingStyle]: ""
};
var transitionStatusMapping = {
  transitionStatus(value) {
    if (value === "starting") {
      return STARTING_HOOK;
    }
    if (value === "ending") {
      return ENDING_HOOK;
    }
    return null;
  }
};

// node_modules/@base-ui/react/collapsible/panel/CollapsiblePanelDataAttributes.mjs
var open = "data-open";
var closed = "data-closed";
var startingStyle2 = TransitionStatusDataAttributes_exports.startingStyle;
var endingStyle2 = TransitionStatusDataAttributes_exports.endingStyle;

// node_modules/@base-ui/react/collapsible/trigger/CollapsibleTriggerDataAttributes.mjs
var panelOpen = "data-panel-open";

// node_modules/@base-ui/react/utils/collapsibleOpenStateMapping.mjs
var PANEL_OPEN_HOOK = {
  [open]: ""
};
var PANEL_CLOSED_HOOK = {
  [closed]: ""
};
var triggerOpenStateMapping = {
  open(value) {
    if (value) {
      return {
        [panelOpen]: ""
      };
    }
    return null;
  }
};
var collapsibleOpenStateMapping = {
  open(value) {
    if (value) {
      return PANEL_OPEN_HOOK;
    }
    return PANEL_CLOSED_HOOK;
  }
};

// node_modules/@base-ui/react/internals/use-button/useButton.mjs
var React18 = __toESM(require_react(), 1);

// node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
function hasWindow() {
  return typeof window !== "undefined";
}
function getNodeName(node) {
  if (isNode(node)) {
    return (node.nodeName || "").toLowerCase();
  }
  return "#document";
}
function getWindow(node) {
  var _node$ownerDocument;
  return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
}
function getDocumentElement(node) {
  var _ref;
  return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
}
function isNode(value) {
  if (!hasWindow()) {
    return false;
  }
  return value instanceof Node || value instanceof getWindow(value).Node;
}
function isElement(value) {
  if (!hasWindow()) {
    return false;
  }
  return value instanceof Element || value instanceof getWindow(value).Element;
}
function isHTMLElement(value) {
  if (!hasWindow()) {
    return false;
  }
  return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
}
function isShadowRoot(value) {
  if (!hasWindow() || typeof ShadowRoot === "undefined") {
    return false;
  }
  return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
}
function isOverflowElement(element) {
  const {
    overflow,
    overflowX,
    overflowY,
    display
  } = getComputedStyle2(element);
  return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents";
}
function isTableElement(element) {
  return /^(table|td|th)$/.test(getNodeName(element));
}
function isTopLayer(element) {
  try {
    if (element.matches(":popover-open")) {
      return true;
    }
  } catch (_e) {
  }
  try {
    return element.matches(":modal");
  } catch (_e) {
    return false;
  }
}
var willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
var containRe = /paint|layout|strict|content/;
var isNotNone = (value) => !!value && value !== "none";
var isWebKitValue;
function isContainingBlock(elementOrCss) {
  const css = isElement(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss;
  return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || "") || containRe.test(css.contain || "");
}
function getContainingBlock(element) {
  let currentNode = getParentNode(element);
  while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
    if (isContainingBlock(currentNode)) {
      return currentNode;
    } else if (isTopLayer(currentNode)) {
      return null;
    }
    currentNode = getParentNode(currentNode);
  }
  return null;
}
function isWebKit() {
  if (isWebKitValue == null) {
    isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none");
  }
  return isWebKitValue;
}
function isLastTraversableNode(node) {
  return /^(html|body|#document)$/.test(getNodeName(node));
}
function getComputedStyle2(element) {
  return getWindow(element).getComputedStyle(element);
}
function getNodeScroll(element) {
  if (isElement(element)) {
    return {
      scrollLeft: element.scrollLeft,
      scrollTop: element.scrollTop
    };
  }
  return {
    scrollLeft: element.scrollX,
    scrollTop: element.scrollY
  };
}
function getParentNode(node) {
  if (getNodeName(node) === "html") {
    return node;
  }
  const result = (
    // Step into the shadow DOM of the parent of a slotted node.
    node.assignedSlot || // DOM Element detected.
    node.parentNode || // ShadowRoot detected.
    isShadowRoot(node) && node.host || // Fallback.
    getDocumentElement(node)
  );
  return isShadowRoot(result) ? result.host : result;
}
function getNearestOverflowAncestor(node) {
  const parentNode = getParentNode(node);
  if (isLastTraversableNode(parentNode)) {
    return (node.ownerDocument || node).body;
  }
  if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
    return parentNode;
  }
  return getNearestOverflowAncestor(parentNode);
}
function getOverflowAncestors(node, list, traverseIframes) {
  var _node$ownerDocument2;
  if (list === void 0) {
    list = [];
  }
  if (traverseIframes === void 0) {
    traverseIframes = true;
  }
  const scrollableAncestor = getNearestOverflowAncestor(node);
  const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
  const win = getWindow(scrollableAncestor);
  if (isBody) {
    const frameElement = getFrameElement(win);
    return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
  } else {
    return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
  }
}
function getFrameElement(win) {
  return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
}

// node_modules/@base-ui/react/internals/composite/root/CompositeRootContext.mjs
var React16 = __toESM(require_react(), 1);
var CompositeRootContext = /* @__PURE__ */ React16.createContext(void 0);
if (true) CompositeRootContext.displayName = "CompositeRootContext";
function useCompositeRootContext(optional = false) {
  const context = React16.useContext(CompositeRootContext);
  if (context === void 0 && !optional) {
    throw new Error(true ? "Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>." : formatErrorMessage_default(16));
  }
  return context;
}

// node_modules/@base-ui/react/utils/useFocusableWhenDisabled.mjs
var React17 = __toESM(require_react(), 1);
function useFocusableWhenDisabled(parameters) {
  const {
    focusableWhenDisabled,
    disabled: disabled2,
    composite = false,
    tabIndex: tabIndexProp = 0,
    isNativeButton
  } = parameters;
  const isFocusableComposite = composite && focusableWhenDisabled !== false;
  const isNonFocusableComposite = composite && focusableWhenDisabled === false;
  const props = React17.useMemo(() => {
    const additionalProps = {
      // allow Tabbing away from focusableWhenDisabled elements
      onKeyDown(event) {
        if (disabled2 && focusableWhenDisabled && event.key !== "Tab") {
          event.preventDefault();
        }
      }
    };
    if (!composite) {
      additionalProps.tabIndex = tabIndexProp;
      if (!isNativeButton && disabled2) {
        additionalProps.tabIndex = focusableWhenDisabled ? tabIndexProp : -1;
      }
    }
    if (isNativeButton && (focusableWhenDisabled || isFocusableComposite) || !isNativeButton && disabled2) {
      additionalProps["aria-disabled"] = disabled2;
    }
    if (isNativeButton && (!focusableWhenDisabled || isNonFocusableComposite)) {
      additionalProps.disabled = disabled2;
    }
    return additionalProps;
  }, [composite, disabled2, focusableWhenDisabled, isFocusableComposite, isNonFocusableComposite, isNativeButton, tabIndexProp]);
  return {
    props
  };
}

// node_modules/@base-ui/utils/owner.mjs
function ownerDocument(node) {
  return node?.ownerDocument || document;
}

// node_modules/@base-ui/react/utils/dispatchClickWithModifiers.mjs
function dispatchClickWithModifiers(target, sourceEvent, {
  detail = 0
} = {}) {
  target.dispatchEvent(new (getWindow(target)).PointerEvent("click", {
    bubbles: true,
    cancelable: true,
    composed: true,
    detail,
    shiftKey: sourceEvent.shiftKey,
    ctrlKey: sourceEvent.ctrlKey,
    altKey: sourceEvent.altKey,
    metaKey: sourceEvent.metaKey
  }));
}

// node_modules/@base-ui/react/internals/use-button/useButton.mjs
function useButton(parameters = {}) {
  const {
    disabled: disabled2 = false,
    focusableWhenDisabled,
    tabIndex = 0,
    native: isNativeButton = true,
    composite: compositeProp
  } = parameters;
  const elementRef = React18.useRef(null);
  const compositeRootContext = useCompositeRootContext(true);
  const isCompositeItem = compositeProp ?? compositeRootContext !== void 0;
  const {
    props: focusableWhenDisabledProps
  } = useFocusableWhenDisabled({
    focusableWhenDisabled,
    disabled: disabled2,
    composite: isCompositeItem,
    tabIndex,
    isNativeButton
  });
  if (true) {
    React18.useEffect(() => {
      if (!elementRef.current) {
        return;
      }
      const isButtonTag = isButtonElement(elementRef.current);
      if (isNativeButton) {
        if (!isButtonTag) {
          const ownerStackMessage = SafeReact.captureOwnerStack?.() || "";
          const message2 = "A component that acts as a button expected a native <button> because the `nativeButton` prop is true. Rendering a non-<button> removes native button semantics, which can impact forms and accessibility. Use a real <button> in the `render` prop, or set `nativeButton` to `false`.";
          error(`${message2}${ownerStackMessage}`);
        }
      } else if (isButtonTag) {
        const ownerStackMessage = SafeReact.captureOwnerStack?.() || "";
        const message2 = "A component that acts as a button expected a non-<button> because the `nativeButton` prop is false. Rendering a <button> keeps native behavior while Base UI applies non-native attributes and handlers, which can add unintended extra attributes (such as `role` or `aria-disabled`). Use a non-<button> in the `render` prop, or set `nativeButton` to `true`.";
        error(`${message2}${ownerStackMessage}`);
      }
    }, [isNativeButton]);
  }
  const updateDisabled = React18.useCallback(() => {
    const element = elementRef.current;
    if (!isButtonElement(element)) {
      return;
    }
    if (isCompositeItem && disabled2 && focusableWhenDisabledProps.disabled === void 0 && element.disabled) {
      element.disabled = false;
    }
  }, [disabled2, focusableWhenDisabledProps.disabled, isCompositeItem]);
  useIsoLayoutEffect(updateDisabled, [updateDisabled]);
  const getButtonProps = React18.useCallback((externalProps = {}) => {
    const {
      onClick: externalOnClick,
      onMouseDown: externalOnMouseDown,
      onKeyUp: externalOnKeyUp,
      onKeyDown: externalOnKeyDown,
      onPointerDown: externalOnPointerDown,
      ...otherExternalProps
    } = externalProps;
    return mergeProps({
      onClick(event) {
        if (disabled2) {
          event.preventDefault();
          return;
        }
        externalOnClick?.(event);
      },
      onMouseDown(event) {
        if (!disabled2) {
          externalOnMouseDown?.(event);
        }
      },
      onKeyDown(event) {
        if (disabled2) {
          return;
        }
        makeEventPreventable(event);
        externalOnKeyDown?.(event);
        if (event.baseUIHandlerPrevented) {
          return;
        }
        const isCurrentTarget = event.target === event.currentTarget;
        const currentTarget = event.currentTarget;
        const isButton = isButtonElement(currentTarget);
        const isLink = !isNativeButton && isValidLinkElement(currentTarget);
        const shouldClick = isCurrentTarget && (isNativeButton ? isButton : !isLink);
        const isEnterKey = event.key === "Enter";
        const isSpaceKey = event.key === " ";
        const role = currentTarget.getAttribute("role");
        const isTextNavigationRole = role?.startsWith("menuitem") || role === "option" || role === "gridcell";
        if (isCurrentTarget && isCompositeItem && isSpaceKey) {
          if (event.defaultPrevented && isTextNavigationRole) {
            return;
          }
          event.preventDefault();
          if (!isNativeButton || isButton) {
            event.preventBaseUIHandler();
            dispatchClickWithModifiers(currentTarget, event);
          }
          return;
        }
        if (!shouldClick || isNativeButton || !isSpaceKey && !isEnterKey) {
          if (isCurrentTarget && isLink && isSpaceKey) {
            event.preventDefault();
          }
          return;
        }
        if (event.defaultPrevented) {
          return;
        }
        event.preventDefault();
        if (isEnterKey) {
          event.preventBaseUIHandler();
          dispatchClickWithModifiers(currentTarget, event);
        }
      },
      onKeyUp(event) {
        if (disabled2) {
          return;
        }
        makeEventPreventable(event);
        externalOnKeyUp?.(event);
        if (event.target === event.currentTarget && isNativeButton && isCompositeItem && isButtonElement(event.currentTarget) && event.key === " ") {
          event.preventDefault();
          return;
        }
        if (event.baseUIHandlerPrevented) {
          return;
        }
        if (event.target === event.currentTarget && !isNativeButton && !isCompositeItem && !event.defaultPrevented && event.key === " ") {
          event.preventBaseUIHandler();
          dispatchClickWithModifiers(event.currentTarget, event);
        }
      },
      onPointerDown(event) {
        if (disabled2) {
          event.preventDefault();
          return;
        }
        externalOnPointerDown?.(event);
      }
    }, isNativeButton ? {
      type: "button"
    } : {
      role: "button"
    }, focusableWhenDisabledProps, otherExternalProps);
  }, [disabled2, focusableWhenDisabledProps, isCompositeItem, isNativeButton]);
  const buttonRef = useStableCallback((element) => {
    elementRef.current = element;
    updateDisabled();
  });
  return {
    getButtonProps,
    buttonRef
  };
}
function isButtonElement(elem) {
  return isHTMLElement(elem) && elem.tagName === "BUTTON";
}
function isValidLinkElement(elem) {
  return isHTMLElement(elem) && elem.tagName === "A" && Boolean(elem.href);
}

// node_modules/@base-ui/react/collapsible/panel/useCollapsiblePanel.mjs
var React20 = __toESM(require_react(), 1);

// node_modules/@base-ui/utils/addEventListener.mjs
function addEventListener(target, type, listener, options) {
  target.addEventListener(type, listener, options);
  return () => {
    target.removeEventListener(type, listener, options);
  };
}

// node_modules/@base-ui/utils/useValueAsRef.mjs
function useValueAsRef(value) {
  const latest = useRefWithInit(createLatestRef, value).current;
  latest.next = value;
  useIsoLayoutEffect(latest.effect);
  return latest;
}
function createLatestRef(value) {
  const latest = {
    current: value,
    next: value,
    effect: () => {
      latest.current = latest.next;
    }
  };
  return latest;
}

// node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs
var React19 = __toESM(require_react(), 1);

// node_modules/@base-ui/react/internals/useAnimationsFinished.mjs
var ReactDOM = __toESM(require_react_dom(), 1);

// node_modules/@base-ui/react/utils/resolveRef.mjs
function resolveRef(maybeRef) {
  if (maybeRef == null) {
    return maybeRef;
  }
  return "current" in maybeRef ? maybeRef.current : maybeRef;
}

// node_modules/@base-ui/react/internals/useAnimationsFinished.mjs
var pendingCallbacks = null;
function flushBeforePaint(fn) {
  if (!pendingCallbacks) {
    const callbacks = [];
    pendingCallbacks = callbacks;
    queueMicrotask(() => {
      pendingCallbacks = null;
      ReactDOM.flushSync(() => {
        for (const callback of callbacks) {
          callback();
        }
      });
    });
  }
  pendingCallbacks.push(fn);
}
function useAnimationsFinished(elementOrRef, waitForStartingStyleRemoved = false, batch = false) {
  const frame = useAnimationFrame();
  return useStableCallback((fnToExecute, signal = null) => {
    frame.cancel();
    const element = resolveRef(elementOrRef);
    if (element == null) {
      return;
    }
    const resolvedElement = element;
    const done = () => {
      if (!batch) {
        ReactDOM.flushSync(fnToExecute);
        return;
      }
      flushBeforePaint(() => {
        if (!signal?.aborted) {
          fnToExecute();
        }
      });
    };
    if (typeof resolvedElement.getAnimations !== "function" || globalThis.BASE_UI_ANIMATIONS_DISABLED) {
      fnToExecute();
      return;
    }
    function exec() {
      Promise.all(resolvedElement.getAnimations().map((animation) => animation.finished)).then(() => {
        if (!signal?.aborted) {
          done();
        }
      }, () => {
        if (signal?.aborted) {
          return;
        }
        const currentAnimations = resolvedElement.getAnimations();
        if (currentAnimations.some((animation) => animation.pending || animation.playState !== "finished")) {
          exec();
          return;
        }
        done();
      });
    }
    if (waitForStartingStyleRemoved) {
      const startingStyleAttribute = startingStyle;
      if (!resolvedElement.hasAttribute(startingStyleAttribute)) {
        frame.request(exec);
        return;
      }
      const attributeObserver = new MutationObserver(() => {
        if (!resolvedElement.hasAttribute(startingStyleAttribute)) {
          attributeObserver.disconnect();
          exec();
        }
      });
      attributeObserver.observe(resolvedElement, {
        attributes: true,
        attributeFilter: [startingStyleAttribute]
      });
      signal?.addEventListener("abort", () => attributeObserver.disconnect(), {
        once: true
      });
      return;
    }
    frame.request(exec);
  });
}

// node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs
function useOpenChangeComplete(parameters) {
  const {
    enabled = true,
    open: open3,
    ref,
    batch = false,
    onComplete: onCompleteParam
  } = parameters;
  const onComplete = useStableCallback(onCompleteParam);
  const runOnceAnimationsFinish = useAnimationsFinished(ref, open3, batch);
  React19.useEffect(() => {
    if (!enabled) {
      return void 0;
    }
    const abortController = new AbortController();
    runOnceAnimationsFinish(onComplete, abortController.signal);
    return () => {
      abortController.abort();
    };
  }, [enabled, open3, onComplete, runOnceAnimationsFinish]);
}

// node_modules/@base-ui/react/collapsible/panel/useCollapsiblePanel.mjs
var EMPTY_DIMENSIONS = {
  height: void 0,
  width: void 0
};
function useCollapsiblePanel(parameters) {
  const {
    externalRef,
    hiddenUntilFound,
    id: idParam,
    keepMounted,
    mounted,
    onOpenChange,
    open: open3,
    setMounted,
    setOpen,
    transitionStatus
  } = parameters;
  const panelRef = React20.useRef(null);
  const animationTypeRef = React20.useRef(null);
  const [dimensions, setDimensionsUnwrapped] = React20.useState(EMPTY_DIMENSIONS);
  const lastMeasuredDimensionsRef = React20.useRef(EMPTY_DIMENSIONS);
  const shouldSkipNextOpenRef = React20.useRef(false);
  const shouldPreventMountAnimationRef = React20.useRef(open3);
  const shouldPreventActivityResumeAnimationRef = React20.useRef(false);
  const [forcePanelIdle, setForcePanelIdle] = React20.useState(false);
  const pendingTemporaryStyleRestoreRef = React20.useRef(null);
  const mergedPanelRef = useMergedRefs(externalRef, panelRef);
  const latestOpenRef = useValueAsRef(open3);
  const runOnceCloseAnimationsFinish = useAnimationsFinished(panelRef);
  const hidden = !open3 && !mounted;
  const panelTransitionStatus = forcePanelIdle ? "idle" : transitionStatus;
  const shouldPreventOpenAnimation = open3 && // These 2 refs are safe to read in render, they are only written from committed
  // layout/effect paths and gate one-shot motion suppression for the next open
  // lifecycle. They intentionally expose the last committed motion snapshot.
  (shouldPreventMountAnimationRef.current || shouldPreventActivityResumeAnimationRef.current);
  const renderedDimensions = !open3 && mounted && // These 2 refs are also safe to read in render, both hold the last committed
  // animation mode and measurement. This fallback only restores a previously
  // measured pixel size after the live dimensions state has been reset back to `auto`.
  animationTypeRef.current === "css-animation" && dimensions.height === void 0 && dimensions.width === void 0 ? lastMeasuredDimensionsRef.current : dimensions;
  const shouldPersistHiddenTransitionStyles = hiddenUntilFound && hidden && animationTypeRef.current !== "css-animation";
  const setDimensions = useStableCallback((nextDimensions, shouldCacheMeasurement = true) => {
    if (shouldCacheMeasurement) {
      lastMeasuredDimensionsRef.current = nextDimensions;
    }
    setDimensionsUnwrapped(nextDimensions);
  });
  const restorePendingTemporaryStyle = useStableCallback(() => {
    pendingTemporaryStyleRestoreRef.current?.();
    pendingTemporaryStyleRestoreRef.current = null;
  });
  const setPendingTemporaryStyleRestore = useStableCallback((restore) => {
    restorePendingTemporaryStyle();
    pendingTemporaryStyleRestoreRef.current = () => {
      pendingTemporaryStyleRestoreRef.current = null;
      restore();
    };
  });
  const markActivityResumeAnimationSuppressed = useStableCallback(() => {
    if (open3 && mounted && animationTypeRef.current === "css-animation") {
      shouldPreventActivityResumeAnimationRef.current = true;
    }
  });
  useIsoLayoutEffect(() => {
    if (!forcePanelIdle || transitionStatus === "starting") {
      return;
    }
    setForcePanelIdle(false);
  }, [forcePanelIdle, transitionStatus]);
  React20.useEffect(() => {
    return () => {
      markActivityResumeAnimationSuppressed();
      restorePendingTemporaryStyle();
    };
  }, [markActivityResumeAnimationSuppressed, restorePendingTemporaryStyle]);
  useIsoLayoutEffect(() => {
    const panel = panelRef.current;
    if (!panel) {
      return void 0;
    }
    if (!open3 && pendingTemporaryStyleRestoreRef.current) {
      restorePendingTemporaryStyle();
    }
    const animationType = getAnimationType(panel, shouldPreventOpenAnimation);
    animationTypeRef.current = animationType;
    if (open3 && transitionStatus === "idle" && shouldPreventMountAnimationRef.current && animationType === "css-animation") {
      lastMeasuredDimensionsRef.current = getDimensions(panel);
      return void 0;
    }
    if (open3 && transitionStatus === "starting") {
      const skipNextOpen = shouldSkipNextOpenRef.current;
      shouldSkipNextOpenRef.current = false;
      if (animationType === "none") {
        setDimensions(getDimensions(panel));
        setForcePanelIdle(true);
        return void 0;
      }
      if (animationType === "css-transition") {
        const restoreLayoutStyles = resetLayoutStyles(panel);
        setDimensions(getDimensions(panel));
        if (!skipNextOpen) {
          return restoreLayoutStyles;
        }
        const restoreTransitionDuration = setTemporaryStyle(panel, "transition-duration", "0s");
        setPendingTemporaryStyleRestore(restoreTransitionDuration);
        setForcePanelIdle(true);
        return restoreLayoutStyles;
      }
      setDimensions(getDimensions(panel));
      const restoreAnimationName = setTemporaryStyle(panel, "animation-name", "none");
      if (!skipNextOpen) {
        restoreAnimationName();
        return void 0;
      }
      const restoreAnimationDuration = setTemporaryStyle(panel, "animation-duration", "0s");
      restoreAnimationName();
      setPendingTemporaryStyleRestore(restoreAnimationDuration);
      setForcePanelIdle(true);
      return void 0;
    }
    if (!open3 && mounted && (transitionStatus === "idle" || transitionStatus === "starting")) {
      shouldPreventMountAnimationRef.current = false;
      shouldPreventActivityResumeAnimationRef.current = false;
      if (animationType === "none") {
        setDimensions(EMPTY_DIMENSIONS, false);
        setMounted(false);
        return void 0;
      }
      setDimensions(getDimensions(panel));
      return void 0;
    }
    if (transitionStatus !== "ending") {
      return void 0;
    }
    if (animationType === "none") {
      setMounted(false);
      return void 0;
    }
    const nextDimensions = getDimensions(panel);
    const hasMeasuredSize = nextDimensions.height > 0 || nextDimensions.width > 0;
    if (!hasMeasuredSize) {
      setMounted(false);
      return void 0;
    }
    setDimensions(nextDimensions);
    if (animationType === "css-animation") {
      const restoreAnimationName = setTemporaryStyle(panel, "animation-name", "none");
      restoreAnimationName();
    }
    return void 0;
  }, [mounted, open3, restorePendingTemporaryStyle, setDimensions, setMounted, setPendingTemporaryStyleRestore, shouldPreventOpenAnimation, transitionStatus]);
  useOpenChangeComplete({
    enabled: open3 && mounted && panelTransitionStatus === "idle",
    open: true,
    ref: panelRef,
    onComplete() {
      if (!open3) {
        return;
      }
      setDimensions(EMPTY_DIMENSIONS, false);
    }
  });
  React20.useEffect(() => {
    if (open3 || !mounted || panelTransitionStatus !== "ending") {
      return void 0;
    }
    const panel = panelRef.current;
    if (!panel) {
      return void 0;
    }
    const abortController = new AbortController();
    let endingStyleFrame = -1;
    function handleComplete() {
      if (latestOpenRef.current) {
        return;
      }
      setMounted(false);
      setDimensions(EMPTY_DIMENSIONS, false);
    }
    endingStyleFrame = AnimationFrame.request(() => {
      runOnceCloseAnimationsFinish(handleComplete, abortController.signal);
    });
    return () => {
      AnimationFrame.cancel(endingStyleFrame);
      abortController.abort();
    };
  }, [latestOpenRef, mounted, open3, panelTransitionStatus, runOnceCloseAnimationsFinish, setDimensions, setMounted]);
  useIsoLayoutEffect(() => {
    const panel = panelRef.current;
    if (!panel || !hiddenUntilFound || !hidden) {
      return;
    }
    panel.setAttribute("hidden", "until-found");
  }, [hidden, hiddenUntilFound]);
  React20.useEffect(function registerBeforeMatchListener() {
    const panel = panelRef.current;
    if (!panel) {
      return void 0;
    }
    function handleBeforeMatch(event) {
      const eventDetails = createChangeEventDetails(reason_parts_exports.none, event);
      onOpenChange(true, eventDetails);
      if (eventDetails.isCanceled) {
        return;
      }
      shouldSkipNextOpenRef.current = true;
      setOpen(true);
    }
    return addEventListener(panel, "beforematch", handleBeforeMatch);
  }, [onOpenChange, setOpen]);
  const shouldRender = keepMounted || hiddenUntilFound || mounted || open3;
  return {
    height: renderedDimensions.height,
    props: {
      ...shouldPersistHiddenTransitionStyles ? {
        [startingStyle2]: ""
      } : void 0,
      hidden,
      id: idParam
    },
    ref: mergedPanelRef,
    shouldPreventOpenAnimation,
    shouldRender,
    transitionStatus: panelTransitionStatus,
    width: renderedDimensions.width
  };
}
function getDimensions(element) {
  return {
    height: element.scrollHeight,
    width: element.scrollWidth
  };
}
function getAnimationType(element, hasSuppressedMountAnimation) {
  const panelStyles = getWindow(element).getComputedStyle(element);
  const hasAnimation = (panelStyles.animationName.split(",").map((name) => name.trim()).some((name) => name !== "" && name !== "none") || hasSuppressedMountAnimation) && hasNonZeroDuration(panelStyles.animationDuration);
  const hasTransition = hasNonZeroDuration(panelStyles.transitionDuration);
  if (hasAnimation && hasTransition) {
    if (true) {
      warn("CSS transitions and CSS animations both detected on Collapsible or Accordion panel.", "Only one of either animation type should be used.");
    }
    return "css-transition";
  }
  if (hasTransition) {
    return "css-transition";
  }
  if (hasAnimation) {
    return "css-animation";
  }
  return "none";
}
function hasNonZeroDuration(value) {
  return value.split(",").map((part) => part.trim()).some((part) => part !== "" && Number.parseFloat(part) > 0);
}
function setTemporaryStyle(element, property, value) {
  const previousValue = element.style.getPropertyValue(property);
  const previousPriority = element.style.getPropertyPriority(property);
  element.style.setProperty(property, value);
  return () => {
    if (previousValue === "") {
      element.style.removeProperty(property);
      return;
    }
    element.style.setProperty(property, previousValue, previousPriority);
  };
}
function resetLayoutStyles(element) {
  const originalLayoutStyles = {
    "justify-content": element.style.justifyContent,
    "align-items": element.style.alignItems,
    "align-content": element.style.alignContent,
    "justify-items": element.style.justifyItems
  };
  Object.keys(originalLayoutStyles).forEach((key) => {
    element.style.setProperty(key, "initial", "important");
  });
  function restoreLayoutStyles() {
    Object.entries(originalLayoutStyles).forEach(([key, value]) => {
      if (value === "") {
        element.style.removeProperty(key);
        return;
      }
      element.style.setProperty(key, value);
    });
  }
  const frame = AnimationFrame.request(restoreLayoutStyles);
  return () => {
    AnimationFrame.cancel(frame);
    restoreLayoutStyles();
  };
}

// node_modules/@base-ui/utils/platform/parts.mjs
var parts_exports = {};
__export(parts_exports, {
  engine: () => engine_exports,
  env: () => env_exports,
  mediaQuery: () => media_query_exports,
  os: () => os_exports,
  screenReader: () => screen_reader_exports
});

// node_modules/@base-ui/utils/platform/os.mjs
var os_exports = {};
__export(os_exports, {
  android: () => android,
  apple: () => apple,
  ios: () => ios,
  linux: () => linux,
  mac: () => mac,
  windows: () => windows
});

// node_modules/@base-ui/utils/platform/shared.mjs
function readRawData() {
  if (typeof navigator === "undefined") {
    return {
      userAgent: "",
      platform: "",
      maxTouchPoints: 0
    };
  }
  if (true) {
    const uaData = navigator.userAgentData;
    if (uaData && Array.isArray(uaData.brands)) {
      return {
        userAgent: uaData.brands.map(({
          brand,
          version: version2
        }) => `${brand}/${version2}`).join(" "),
        platform: uaData.platform ?? navigator.platform ?? "",
        maxTouchPoints: navigator.maxTouchPoints ?? 0
      };
    }
  }
  return {
    userAgent: navigator.userAgent,
    platform: navigator.platform ?? "",
    maxTouchPoints: navigator.maxTouchPoints ?? 0
  };
}
var {
  userAgent,
  platform,
  maxTouchPoints
} = readRawData();
var lowerUserAgent = userAgent.toLowerCase();
var lowerPlatform = platform.toLowerCase();

// node_modules/@base-ui/utils/platform/os.mjs
var ios = /^i(os$|p)/.test(lowerPlatform) || lowerPlatform === "macintel" && maxTouchPoints > 1;
var ANDROID_STRING = "android";
var android = lowerPlatform === ANDROID_STRING || lowerUserAgent.includes(ANDROID_STRING);
var mac = !ios && lowerPlatform.startsWith("mac");
var windows = lowerPlatform.startsWith("win");
var linux = !android && /^(linux|chrome os)/.test(lowerPlatform);
var apple = mac || ios;

// node_modules/@base-ui/utils/platform/engine.mjs
var engine_exports = {};
__export(engine_exports, {
  blink: () => blink,
  gecko: () => gecko,
  webkit: () => webkit
});
var webkit = typeof CSS !== "undefined" && !!CSS.supports?.("-webkit-backdrop-filter:none");
var gecko = !webkit && lowerUserAgent.includes("firefox");
var blink = !webkit && lowerUserAgent.includes("chrom");

// node_modules/@base-ui/utils/platform/screen-reader.mjs
var screen_reader_exports = {};
__export(screen_reader_exports, {
  voiceOver: () => voiceOver
});
var voiceOver = apple;

// node_modules/@base-ui/utils/platform/env.mjs
var env_exports = {};
__export(env_exports, {
  jsdom: () => jsdom
});
var jsdom = /jsdom|happydom/.test(lowerUserAgent);

// node_modules/@base-ui/utils/platform/media-query.mjs
var media_query_exports = {};
__export(media_query_exports, {
  iOS: () => iOS
});
var iOS = "@supports (-webkit-touch-callout: none)";

// node_modules/@base-ui/utils/useTimeout.mjs
var EMPTY2 = 0;
var Timeout = class _Timeout {
  static create() {
    return new _Timeout();
  }
  currentId = EMPTY2;
  /**
   * Executes `fn` after `delay`, clearing any previously scheduled call.
   */
  start(delay, fn) {
    this.clear();
    this.currentId = setTimeout(() => {
      this.currentId = EMPTY2;
      fn();
    }, delay);
  }
  isStarted() {
    return this.currentId !== EMPTY2;
  }
  clear = () => {
    if (this.currentId !== EMPTY2) {
      clearTimeout(this.currentId);
      this.currentId = EMPTY2;
    }
  };
  disposeEffect = () => {
    return this.clear;
  };
};
function useTimeout() {
  const timeout = useRefWithInit(Timeout.create).current;
  useOnMount(timeout.disposeEffect);
  return timeout;
}

// node_modules/@base-ui/react/floating-ui-react/components/FloatingDelayGroup.mjs
var React21 = __toESM(require_react(), 1);

// node_modules/@base-ui/react/floating-ui-react/utils/event.mjs
function isReactEvent(event) {
  return "nativeEvent" in event;
}
function isVirtualClick(event) {
  if (event.pointerType === "" && event.isTrusted) {
    return true;
  }
  if (parts_exports.os.android && event.pointerType) {
    return event.type === "click" && event.buttons === 1;
  }
  return event.detail === 0 && !event.pointerType;
}
function isMouseLikePointerType(pointerType, strict) {
  const values = ["mouse", "pen"];
  if (!strict) {
    values.push("", void 0);
  }
  return values.includes(pointerType);
}
function isClickLikeEvent(event) {
  const type = event.type;
  return type === "click" || type === "mousedown" || type === "keydown" || type === "keyup";
}

// node_modules/@base-ui/utils/shadowDom.mjs
function activeElement(doc) {
  let element = doc.activeElement;
  while (element?.shadowRoot?.activeElement != null) {
    element = element.shadowRoot.activeElement;
  }
  return element;
}
function contains(parent, child) {
  if (!parent || !child) {
    return false;
  }
  const rootNode = child.getRootNode?.();
  if (parent.contains(child)) {
    return true;
  }
  if (rootNode && isShadowRoot(rootNode)) {
    let next = child;
    while (next) {
      if (parent === next) {
        return true;
      }
      next = next.parentNode || next.host;
    }
  }
  return false;
}
function getTarget(event) {
  if ("composedPath" in event) {
    return event.composedPath()[0] ?? event.target;
  }
  return event.target;
}

// node_modules/@base-ui/react/floating-ui-react/utils/constants.mjs
var FOCUSABLE_ATTRIBUTE = "data-base-ui-focusable";
var TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";

// node_modules/@base-ui/react/utils/CommonPopupDataAttributes.mjs
var open2 = "data-open";
var closed2 = "data-closed";
var anchorHidden = "data-anchor-hidden";

// node_modules/@base-ui/react/utils/CommonTriggerDataAttributes.mjs
var CommonTriggerDataAttributes_exports = {};
__export(CommonTriggerDataAttributes_exports, {
  popupOpen: () => popupOpen,
  pressed: () => pressed
});
var popupOpen = "data-popup-open";
var pressed = "data-pressed";

// node_modules/@base-ui/react/utils/popupStateMapping.mjs
var TRIGGER_HOOK = {
  [popupOpen]: ""
};
var PRESSABLE_TRIGGER_HOOK = {
  [popupOpen]: "",
  [pressed]: ""
};
var POPUP_OPEN_HOOK = {
  [open2]: ""
};
var POPUP_CLOSED_HOOK = {
  [closed2]: ""
};
var ANCHOR_HIDDEN_HOOK = {
  [anchorHidden]: ""
};
var triggerOpenStateMapping2 = {
  open(value) {
    if (value) {
      return TRIGGER_HOOK;
    }
    return null;
  }
};
var popupStateMapping = {
  open(value) {
    if (value) {
      return POPUP_OPEN_HOOK;
    }
    return POPUP_CLOSED_HOOK;
  },
  anchorHidden(value) {
    if (value) {
      return ANCHOR_HIDDEN_HOOK;
    }
    return null;
  }
};
var popupTransitionStateMapping = {
  ...popupStateMapping,
  ...transitionStatusMapping
};

// node_modules/@base-ui/react/tooltip/trigger/TooltipTriggerDataAttributes.mjs
var popupOpen2 = CommonTriggerDataAttributes_exports.popupOpen;
var triggerDisabled = "data-trigger-disabled";

// node_modules/@base-ui/react/floating-ui-react/utils/element.mjs
function isTargetInsideEnabledTrigger(target, triggerElements) {
  if (!isElement(target)) {
    return false;
  }
  const targetElement = target;
  if (triggerElements.hasElement(targetElement)) {
    return !targetElement.hasAttribute(triggerDisabled);
  }
  for (const [, trigger] of triggerElements.entries()) {
    if (contains(trigger, targetElement)) {
      return !trigger.hasAttribute(triggerDisabled);
    }
  }
  return false;
}
function isEventTargetWithin(event, node) {
  if (node == null) {
    return false;
  }
  if ("composedPath" in event) {
    return event.composedPath().includes(node);
  }
  const eventAgain = event;
  return eventAgain.target != null && node.contains(eventAgain.target);
}
function isRootElement(element) {
  return element.matches("html,body");
}
function isTypeableElement(element) {
  return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR);
}
function isInteractiveElement(element) {
  return element?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${TYPEABLE_SELECTOR}`) != null;
}
function matchesFocusVisible(element) {
  if (!element || parts_exports.env.jsdom) {
    return true;
  }
  try {
    return element.matches(":focus-visible");
  } catch (_e) {
    return true;
  }
}

// node_modules/@base-ui/react/floating-ui-react/hooks/useHoverShared.mjs
function resolveValue(value, pointerType) {
  if (pointerType != null && !isMouseLikePointerType(pointerType)) {
    return 0;
  }
  if (typeof value === "function") {
    return value();
  }
  return value;
}
function getDelay(value, prop, pointerType) {
  const result = resolveValue(value, pointerType);
  if (typeof result === "number") {
    return result;
  }
  return result?.[prop];
}
function getRestMs(value) {
  if (typeof value === "function") {
    return value();
  }
  return value;
}
function isClickLikeOpenEvent(openEventType, interactedInside) {
  return interactedInside || openEventType === "click" || openEventType === "mousedown";
}
function isHoverOpenEvent(openEventType) {
  return openEventType?.includes("mouse") && openEventType !== "mousedown";
}

// node_modules/@base-ui/react/floating-ui-react/components/FloatingDelayGroup.mjs
var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
var FloatingDelayGroupContext = /* @__PURE__ */ React21.createContext({
  hasProvider: false,
  timeoutMs: 0,
  delayRef: {
    current: 0
  },
  initialDelayRef: {
    current: 0
  },
  timeout: new Timeout(),
  currentIdRef: {
    current: null
  },
  currentContextRef: {
    current: null
  }
});
if (true) FloatingDelayGroupContext.displayName = "FloatingDelayGroupContext";
function resetDelayRef(delayRef, initialDelayRef) {
  delayRef.current = initialDelayRef.current;
}
function FloatingDelayGroup(props) {
  const {
    children,
    delay,
    timeoutMs = 0
  } = props;
  const delayRef = React21.useRef(delay);
  const initialDelayRef = React21.useRef(delay);
  const currentIdRef = React21.useRef(null);
  const currentContextRef = React21.useRef(null);
  const timeout = useTimeout();
  useIsoLayoutEffect(() => {
    initialDelayRef.current = delay;
    if (!currentIdRef.current) {
      delayRef.current = delay;
      return;
    }
    delayRef.current = {
      open: getDelay(delayRef.current, "open"),
      close: getDelay(delay, "close")
    };
  }, [delay, currentIdRef, delayRef, initialDelayRef]);
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(FloatingDelayGroupContext.Provider, {
    value: React21.useMemo(() => ({
      hasProvider: true,
      delayRef,
      initialDelayRef,
      currentIdRef,
      timeoutMs,
      currentContextRef,
      timeout
    }), [timeoutMs, timeout]),
    children
  });
}
function useDelayGroup(context, options = {
  open: false
}) {
  const {
    open: open3
  } = options;
  const store2 = "rootStore" in context ? context.rootStore : context;
  const floatingId = store2.useState("floatingId");
  const groupContext = React21.useContext(FloatingDelayGroupContext);
  const {
    currentIdRef,
    delayRef,
    timeoutMs,
    initialDelayRef,
    currentContextRef,
    hasProvider,
    timeout
  } = groupContext;
  const [isInstantPhase, setIsInstantPhase] = React21.useState(false);
  const openRef = React21.useRef(open3);
  useIsoLayoutEffect(() => {
    openRef.current = open3;
  }, [open3]);
  useIsoLayoutEffect(() => {
    function unset() {
      currentContextRef.current?.setIsInstantPhase(false);
      currentIdRef.current = null;
      currentContextRef.current = null;
      delayRef.current = initialDelayRef.current;
      timeout.clear();
    }
    if (!currentIdRef.current) {
      return void 0;
    }
    if (!open3 && currentIdRef.current === floatingId) {
      setIsInstantPhase(false);
      if (timeoutMs) {
        const closingId = floatingId;
        timeout.start(timeoutMs, () => {
          if (store2.select("open") || currentIdRef.current && currentIdRef.current !== closingId) {
            return;
          }
          unset();
        });
        return () => {
          if (openRef.current || currentIdRef.current !== closingId) {
            timeout.clear();
          }
        };
      }
      unset();
    }
    return void 0;
  }, [open3, floatingId, currentIdRef, delayRef, timeoutMs, initialDelayRef, currentContextRef, timeout, store2]);
  useIsoLayoutEffect(() => {
    if (!open3) {
      return;
    }
    const prevContext = currentContextRef.current;
    const prevId = currentIdRef.current;
    timeout.clear();
    currentContextRef.current = {
      onOpenChange: store2.setOpen,
      setIsInstantPhase
    };
    currentIdRef.current = floatingId;
    delayRef.current = {
      open: 0,
      close: getDelay(initialDelayRef.current, "close")
    };
    if (prevId !== null && prevId !== floatingId) {
      setIsInstantPhase(true);
      prevContext?.setIsInstantPhase(true);
      prevContext?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.none));
    } else {
      setIsInstantPhase(false);
      prevContext?.setIsInstantPhase(false);
    }
  }, [open3, floatingId, store2, currentIdRef, delayRef, initialDelayRef, currentContextRef, timeout]);
  useIsoLayoutEffect(() => {
    return () => {
      if (currentIdRef.current === floatingId) {
        currentContextRef.current = null;
        if (!openRef.current) {
          return;
        }
        currentIdRef.current = null;
        resetDelayRef(delayRef, initialDelayRef);
        timeout.clear();
      }
    };
  }, [currentContextRef, currentIdRef, delayRef, floatingId, initialDelayRef, timeout]);
  return React21.useMemo(() => ({
    activeIdRef: currentIdRef,
    hasProvider,
    delayRef,
    isInstantPhase
  }), [currentIdRef, hasProvider, delayRef, isInstantPhase]);
}

// node_modules/@base-ui/utils/mergeCleanups.mjs
function mergeCleanups(...cleanups) {
  return () => {
    for (let i = 0; i < cleanups.length; i += 1) {
      const cleanup = cleanups[i];
      if (cleanup) {
        cleanup();
      }
    }
  };
}

// node_modules/@base-ui/react/utils/FocusGuard.mjs
var React22 = __toESM(require_react(), 1);

// node_modules/@base-ui/utils/visuallyHidden.mjs
var visuallyHiddenBase = {
  clipPath: "inset(50%)",
  overflow: "hidden",
  whiteSpace: "nowrap",
  border: 0,
  padding: 0,
  width: 1,
  height: 1,
  margin: -1
};
var visuallyHidden = {
  ...visuallyHiddenBase,
  position: "fixed",
  top: 0,
  left: 0
};
var visuallyHiddenInput = {
  ...visuallyHiddenBase,
  position: "absolute"
};

// node_modules/@base-ui/react/utils/FocusGuard.mjs
var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
var FocusGuard = /* @__PURE__ */ React22.forwardRef(function FocusGuard2(props, ref) {
  const [role, setRole] = React22.useState();
  useIsoLayoutEffect(() => {
    if (parts_exports.screenReader.voiceOver && parts_exports.engine.webkit) {
      setRole("button");
    }
  }, []);
  const restProps = {
    tabIndex: 0,
    // Role is only for VoiceOver
    role
  };
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", {
    ...props,
    ref,
    style: visuallyHidden,
    "aria-hidden": role ? void 0 : true,
    ...restProps,
    "data-base-ui-focus-guard": ""
  });
});
if (true) FocusGuard.displayName = "FocusGuard";

// node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
var min = Math.min;
var max = Math.max;
var round = Math.round;
var floor = Math.floor;
var createCoords = (v2) => ({
  x: v2,
  y: v2
});
var oppositeSideMap = {
  left: "right",
  right: "left",
  bottom: "top",
  top: "bottom"
};
function clamp(start, value, end) {
  return max(start, min(value, end));
}
function evaluate(value, param) {
  return typeof value === "function" ? value(param) : value;
}
function getSide(placement) {
  return placement.split("-")[0];
}
function getAlignment(placement) {
  return placement.split("-")[1];
}
function getOppositeAxis(axis) {
  return axis === "x" ? "y" : "x";
}
function getAxisLength(axis) {
  return axis === "y" ? "height" : "width";
}
function getSideAxis(placement) {
  const firstChar = placement[0];
  return firstChar === "t" || firstChar === "b" ? "y" : "x";
}
function getAlignmentAxis(placement) {
  return getOppositeAxis(getSideAxis(placement));
}
function getAlignmentSides(placement, rects, rtl) {
  if (rtl === void 0) {
    rtl = false;
  }
  const alignment = getAlignment(placement);
  const alignmentAxis = getAlignmentAxis(placement);
  const length2 = getAxisLength(alignmentAxis);
  let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
  if (rects.reference[length2] > rects.floating[length2]) {
    mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
  }
  return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
}
function getExpandedPlacements(placement) {
  const oppositePlacement = getOppositePlacement(placement);
  return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
}
function getOppositeAlignmentPlacement(placement) {
  return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start");
}
var lrPlacement = ["left", "right"];
var rlPlacement = ["right", "left"];
var tbPlacement = ["top", "bottom"];
var btPlacement = ["bottom", "top"];
function getSideList(side, isStart, rtl) {
  switch (side) {
    case "top":
    case "bottom":
      if (rtl) return isStart ? rlPlacement : lrPlacement;
      return isStart ? lrPlacement : rlPlacement;
    case "left":
    case "right":
      return isStart ? tbPlacement : btPlacement;
    default:
      return [];
  }
}
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
  const alignment = getAlignment(placement);
  let list = getSideList(getSide(placement), direction === "start", rtl);
  if (alignment) {
    list = list.map((side) => side + "-" + alignment);
    if (flipAlignment) {
      list = list.concat(list.map(getOppositeAlignmentPlacement));
    }
  }
  return list;
}
function getOppositePlacement(placement) {
  const side = getSide(placement);
  return oppositeSideMap[side] + placement.slice(side.length);
}
function expandPaddingObject(padding) {
  var _padding$top, _padding$right, _padding$bottom, _padding$left;
  return {
    top: (_padding$top = padding.top) != null ? _padding$top : 0,
    right: (_padding$right = padding.right) != null ? _padding$right : 0,
    bottom: (_padding$bottom = padding.bottom) != null ? _padding$bottom : 0,
    left: (_padding$left = padding.left) != null ? _padding$left : 0
  };
}
function getPaddingObject(padding) {
  return typeof padding !== "number" ? expandPaddingObject(padding) : {
    top: padding,
    right: padding,
    bottom: padding,
    left: padding
  };
}
function rectToClientRect(rect) {
  const {
    x: x2,
    y: y2,
    width,
    height
  } = rect;
  return {
    width,
    height,
    top: y2,
    left: x2,
    right: x2 + width,
    bottom: y2 + height,
    x: x2,
    y: y2
  };
}

// node_modules/@base-ui/react/floating-ui-react/utils/composite.mjs
function isIndexOutOfListBounds(list, index3) {
  return index3 < 0 || index3 >= list.length;
}
function getMinListIndex(listRef, disabledIndices) {
  return findNonDisabledListIndex(listRef.current, {
    disabledIndices
  });
}
function getMaxListIndex(listRef, disabledIndices) {
  return findNonDisabledListIndex(listRef.current, {
    decrement: true,
    startingIndex: listRef.current.length,
    disabledIndices
  });
}
function findNonDisabledListIndex(list, {
  startingIndex = -1,
  decrement = false,
  disabledIndices,
  amount = 1
} = {}) {
  let index3 = startingIndex;
  do {
    index3 += decrement ? -amount : amount;
  } while (index3 >= 0 && index3 <= list.length - 1 && isListIndexDisabled(list, index3, disabledIndices));
  return index3;
}
function isListIndexDisabled(list, index3, disabledIndices) {
  const isExplicitlyDisabled = typeof disabledIndices === "function" ? disabledIndices(index3) : disabledIndices?.includes(index3) ?? false;
  if (isExplicitlyDisabled) {
    return true;
  }
  const element = list[index3];
  if (!element) {
    return false;
  }
  if (!isElementVisible(element)) {
    return true;
  }
  if (element.matches(":disabled")) {
    return true;
  }
  return !disabledIndices && (element.hasAttribute("disabled") || element.getAttribute("aria-disabled") === "true");
}
function isHiddenByStyles(styles) {
  return styles.visibility === "hidden" || styles.visibility === "collapse";
}
function isElementVisible(element, styles = element ? getComputedStyle2(element) : null) {
  if (!element || !element.isConnected || !styles || isHiddenByStyles(styles)) {
    return false;
  }
  if (typeof element.checkVisibility === "function") {
    return element.checkVisibility();
  }
  return styles.display !== "none" && styles.display !== "contents";
}

// node_modules/@base-ui/react/floating-ui-react/utils/tabbable.mjs
var CANDIDATE_SELECTOR = 'a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';
function getParentElement(element) {
  const assignedSlot = element.assignedSlot;
  if (assignedSlot) {
    return assignedSlot;
  }
  if (element.parentElement) {
    return element.parentElement;
  }
  const rootNode = element.getRootNode();
  return isShadowRoot(rootNode) ? rootNode.host : null;
}
function getDetailsSummary(details) {
  for (const child of Array.from(details.children)) {
    if (getNodeName(child) === "summary") {
      return child;
    }
  }
  return null;
}
function isWithinOpenDetailsSummary(element, details) {
  const summary = getDetailsSummary(details);
  return !!summary && (element === summary || contains(summary, element));
}
function isFocusableCandidate(element) {
  const nodeName = element ? getNodeName(element) : "";
  return element != null && element.matches(CANDIDATE_SELECTOR) && (nodeName !== "summary" || element.parentElement != null && getNodeName(element.parentElement) === "details" && getDetailsSummary(element.parentElement) === element) && (nodeName !== "details" || getDetailsSummary(element) == null) && (nodeName !== "input" || element.type !== "hidden");
}
function isFocusableElement(element) {
  if (!isFocusableCandidate(element) || !element.isConnected || element.matches(":disabled")) {
    return false;
  }
  for (let current = element; current; current = getParentElement(current)) {
    const isAncestor = current !== element;
    const isSlot = getNodeName(current) === "slot";
    if (current.hasAttribute("inert")) {
      return false;
    }
    if (isAncestor && getNodeName(current) === "details" && !current.open && !isWithinOpenDetailsSummary(element, current) || current.hasAttribute("hidden") || !isSlot && !isVisibleInTabbableTree(current, isAncestor)) {
      return false;
    }
  }
  return true;
}
function isVisibleInTabbableTree(element, isAncestor) {
  const styles = getComputedStyle2(element);
  if (!isAncestor) {
    return isElementVisible(element, styles);
  }
  return styles.display !== "none";
}
function getTabIndex(element) {
  const tabIndex = element.tabIndex;
  if (tabIndex < 0) {
    const nodeName = getNodeName(element);
    if (nodeName === "details" || nodeName === "audio" || nodeName === "video" || isHTMLElement(element) && element.isContentEditable) {
      return 0;
    }
  }
  return tabIndex;
}
function getNamedRadioInput(element) {
  if (getNodeName(element) !== "input") {
    return null;
  }
  const input = element;
  return input.type === "radio" && input.name !== "" ? input : null;
}
function isTabbableRadio(element, candidates) {
  const input = getNamedRadioInput(element);
  if (!input) {
    return true;
  }
  const checkedRadio = candidates.find((candidate) => {
    const radio = getNamedRadioInput(candidate);
    return radio?.name === input.name && radio.form === input.form && radio.checked;
  });
  if (checkedRadio) {
    return checkedRadio === input;
  }
  return candidates.find((candidate) => {
    const radio = getNamedRadioInput(candidate);
    return radio?.name === input.name && radio.form === input.form;
  }) === input;
}
function getComposedChildren(container) {
  if (isHTMLElement(container) && getNodeName(container) === "slot") {
    const assignedElements = container.assignedElements({
      flatten: true
    });
    if (assignedElements.length > 0) {
      return assignedElements;
    }
  }
  if (isHTMLElement(container) && container.shadowRoot) {
    return Array.from(container.shadowRoot.children);
  }
  return Array.from(container.children);
}
function appendCandidates(container, list) {
  getComposedChildren(container).forEach((child) => {
    if (isFocusableCandidate(child)) {
      list.push(child);
    }
    appendCandidates(child, list);
  });
}
function appendMatchingElements(container, selector, list) {
  getComposedChildren(container).forEach((child) => {
    if (isHTMLElement(child) && child.matches(selector)) {
      list.push(child);
    }
    appendMatchingElements(child, selector, list);
  });
}
function focusable(container) {
  const candidates = [];
  appendCandidates(container, candidates);
  return candidates.filter(isFocusableElement);
}
function tabbable(container) {
  const candidates = focusable(container);
  return candidates.filter((element) => getTabIndex(element) >= 0 && isTabbableRadio(element, candidates));
}
function getTabbableIn(container, dir) {
  const list = tabbable(container);
  const len2 = list.length;
  if (len2 === 0) {
    return void 0;
  }
  const active = activeElement(ownerDocument(container));
  const index3 = list.indexOf(active);
  const nextIndex = index3 === -1 ? dir === 1 ? 0 : len2 - 1 : index3 + dir;
  return list[nextIndex];
}
function getNextTabbable(referenceElement) {
  return getTabbableIn(ownerDocument(referenceElement).body, 1) || referenceElement;
}
function getPreviousTabbable(referenceElement) {
  return getTabbableIn(ownerDocument(referenceElement).body, -1) || referenceElement;
}
function isOutsideEvent(event, container) {
  const containerElement = container || event.currentTarget;
  const relatedTarget = event.relatedTarget;
  return !relatedTarget || !contains(containerElement, relatedTarget);
}
function disableFocusInside(container) {
  const tabbableElements = tabbable(container);
  tabbableElements.forEach((element) => {
    element.dataset.tabindex = element.getAttribute("tabindex") || "";
    element.setAttribute("tabindex", "-1");
  });
}
function enableFocusInside(container) {
  const elements = [];
  appendMatchingElements(container, "[data-tabindex]", elements);
  elements.forEach((element) => {
    const tabindex = element.dataset.tabindex;
    delete element.dataset.tabindex;
    if (tabindex) {
      element.setAttribute("tabindex", tabindex);
    } else {
      element.removeAttribute("tabindex");
    }
  });
}

// node_modules/@base-ui/react/floating-ui-react/utils/nodes.mjs
function getNodeChildren(nodes, id, onlyOpenChildren = true) {
  const directChildren = nodes.filter((node) => node.parentId === id);
  return directChildren.flatMap((child) => [...!onlyOpenChildren || child.context?.open ? [child] : [], ...getNodeChildren(nodes, child.id, onlyOpenChildren)]);
}

// node_modules/@base-ui/react/floating-ui-react/utils/createAttribute.mjs
function createAttribute(name) {
  return `data-base-ui-${name}`;
}

// node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs
var React23 = __toESM(require_react(), 1);
var ReactDOM2 = __toESM(require_react_dom(), 1);

// node_modules/@base-ui/react/internals/constants.mjs
var DISABLED_TRANSITIONS_STYLE = {
  style: {
    transition: "none"
  }
};
var BASE_UI_SWIPE_IGNORE_ATTRIBUTE = "data-base-ui-swipe-ignore";
var LEGACY_SWIPE_IGNORE_ATTRIBUTE = "data-swipe-ignore";
var BASE_UI_SWIPE_IGNORE_SELECTOR = `[${BASE_UI_SWIPE_IGNORE_ATTRIBUTE}]`;
var LEGACY_SWIPE_IGNORE_SELECTOR = `[${LEGACY_SWIPE_IGNORE_ATTRIBUTE}]`;
var POPUP_COLLISION_AVOIDANCE = {
  fallbackAxisSide: "end"
};
var ownerVisuallyHidden = {
  clipPath: "inset(50%)",
  position: "fixed",
  top: 0,
  left: 0
};

// node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs
var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
var PortalContext = /* @__PURE__ */ React23.createContext(null);
if (true) PortalContext.displayName = "PortalContext";
var usePortalContext = () => React23.useContext(PortalContext);
var attr = createAttribute("portal");
function useFloatingPortalNode(props = {}) {
  const {
    ref,
    container: containerProp,
    componentProps = EMPTY_OBJECT,
    elementProps
  } = props;
  const uniqueId = useId();
  const portalContext = usePortalContext();
  const parentPortalNode = portalContext?.portalNode;
  const [containerElement, setContainerElement] = React23.useState(null);
  const [portalNode, setPortalNode] = React23.useState(null);
  const setPortalNodeRef = useStableCallback((node) => {
    if (node !== null) {
      setPortalNode(node);
    }
  });
  const containerRef = React23.useRef(null);
  useIsoLayoutEffect(() => {
    if (containerProp === null) {
      if (containerRef.current) {
        containerRef.current = null;
        setPortalNode(null);
        setContainerElement(null);
      }
      return;
    }
    const resolvedContainer = (containerProp && (isNode(containerProp) ? containerProp : containerProp.current)) ?? parentPortalNode ?? document.body;
    if (resolvedContainer == null) {
      if (containerRef.current) {
        containerRef.current = null;
        setPortalNode(null);
        setContainerElement(null);
      }
      return;
    }
    if (containerRef.current !== resolvedContainer) {
      containerRef.current = resolvedContainer;
      setPortalNode(null);
      setContainerElement(resolvedContainer);
    }
  }, [containerProp, parentPortalNode]);
  const portalElement = useRenderElement("div", componentProps, {
    ref: [ref, setPortalNodeRef],
    props: [{
      id: uniqueId,
      [attr]: ""
    }, elementProps]
  });
  const portalSubtree = containerElement && portalElement ? /* @__PURE__ */ ReactDOM2.createPortal(portalElement, containerElement) : null;
  return {
    node: portalNode,
    // `id` and `render` props can override or remove the generated ID. Use the exact
    // rendered value so `aria-owns` never points at an ID absent from the DOM.
    nodeId: /* @__PURE__ */ React23.isValidElement(portalElement) ? portalElement.props.id : void 0,
    subtree: portalSubtree
  };
}
var FloatingPortal = /* @__PURE__ */ React23.forwardRef(function FloatingPortal2(componentProps, forwardedRef) {
  const {
    render: render4,
    className,
    style,
    children,
    container,
    portalOwnerRole,
    ...elementProps
  } = componentProps;
  const {
    node: portalNode,
    nodeId: portalNodeId,
    subtree: portalSubtree
  } = useFloatingPortalNode({
    container,
    ref: forwardedRef,
    componentProps,
    elementProps
  });
  const beforeOutsideRef = React23.useRef(null);
  const afterOutsideRef = React23.useRef(null);
  const beforeInsideRef = React23.useRef(null);
  const afterInsideRef = React23.useRef(null);
  const [focusManagerState, setFocusManagerState] = React23.useState(null);
  const focusInsideDisabledRef = React23.useRef(false);
  const modal = focusManagerState?.modal;
  const open3 = focusManagerState?.open;
  const shouldRenderGuards = !!focusManagerState && !focusManagerState.modal && focusManagerState.open && !!portalNode;
  React23.useEffect(() => {
    if (!portalNode || modal) {
      return void 0;
    }
    function onFocus(event) {
      if (portalNode && event.relatedTarget && isOutsideEvent(event)) {
        if (event.type === "focusin") {
          if (focusInsideDisabledRef.current) {
            enableFocusInside(portalNode);
            focusInsideDisabledRef.current = false;
          }
        } else {
          disableFocusInside(portalNode);
          focusInsideDisabledRef.current = true;
        }
      }
    }
    return mergeCleanups(addEventListener(portalNode, "focusin", onFocus, true), addEventListener(portalNode, "focusout", onFocus, true));
  }, [portalNode, modal]);
  useIsoLayoutEffect(() => {
    if (!portalNode || open3 !== true || !focusInsideDisabledRef.current) {
      return;
    }
    enableFocusInside(portalNode);
    focusInsideDisabledRef.current = false;
  }, [open3, portalNode]);
  const portalContextValue = React23.useMemo(() => ({
    beforeOutsideRef,
    afterOutsideRef,
    beforeInsideRef,
    afterInsideRef,
    portalNode,
    setFocusManagerState
  }), [portalNode]);
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(React23.Fragment, {
    children: [portalSubtree, /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(PortalContext.Provider, {
      value: portalContextValue,
      children: [shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FocusGuard, {
        "data-type": "outside",
        ref: beforeOutsideRef,
        onFocus: (event) => {
          if (isOutsideEvent(event, portalNode)) {
            beforeInsideRef.current?.focus();
          } else {
            const domReference = focusManagerState ? focusManagerState.domReference : null;
            const prevTabbable = getPreviousTabbable(domReference);
            prevTabbable?.focus();
          }
        }
      }), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", {
        role: portalOwnerRole,
        "aria-owns": portalNodeId,
        style: ownerVisuallyHidden
      }), portalNode && /* @__PURE__ */ ReactDOM2.createPortal(children, portalNode), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FocusGuard, {
        "data-type": "outside",
        ref: afterOutsideRef,
        onFocus: (event) => {
          if (isOutsideEvent(event, portalNode)) {
            afterInsideRef.current?.focus();
          } else {
            const domReference = focusManagerState ? focusManagerState.domReference : null;
            const nextTabbable = getNextTabbable(domReference);
            nextTabbable?.focus();
            if (focusManagerState?.closeOnFocusOut) {
              focusManagerState?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.focusOut, event.nativeEvent));
            }
          }
        }
      })]
    })]
  });
});
if (true) FloatingPortal.displayName = "FloatingPortal";

// node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs
var React24 = __toESM(require_react(), 1);

// node_modules/@base-ui/react/floating-ui-react/utils/createEventEmitter.mjs
function createEventEmitter() {
  const map = /* @__PURE__ */ new Map();
  return {
    emit(event, data) {
      map.get(event)?.forEach((listener) => listener(data));
    },
    on(event, listener) {
      if (!map.has(event)) {
        map.set(event, /* @__PURE__ */ new Set());
      }
      map.get(event).add(listener);
    },
    off(event, listener) {
      map.get(event)?.delete(listener);
    }
  };
}

// node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs
var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
var FloatingNodeContext = /* @__PURE__ */ React24.createContext(null);
if (true) FloatingNodeContext.displayName = "FloatingNodeContext";
var FloatingTreeContext = /* @__PURE__ */ React24.createContext(null);
if (true) FloatingTreeContext.displayName = "FloatingTreeContext";
var useFloatingParentNodeId = () => React24.useContext(FloatingNodeContext)?.id || null;
var useFloatingTree = (externalTree) => {
  const contextTree = React24.useContext(FloatingTreeContext);
  return externalTree ?? contextTree;
};

// node_modules/@base-ui/react/floating-ui-react/hooks/useClientPoint.mjs
var React25 = __toESM(require_react(), 1);
function createVirtualElement(domElement, data) {
  let offsetX = null;
  let offsetY = null;
  let isAutoUpdateEvent = false;
  return {
    contextElement: domElement || void 0,
    getBoundingClientRect() {
      const domRect = domElement?.getBoundingClientRect() || {
        width: 0,
        height: 0,
        x: 0,
        y: 0
      };
      const isXAxis = data.axis === "x" || data.axis === "both";
      const isYAxis = data.axis === "y" || data.axis === "both";
      const canTrackCursorOnAutoUpdate = ["mouseenter", "mousemove"].includes(data.dataRef.current.openEvent?.type || "") && data.pointerType !== "touch";
      let width = domRect.width;
      let height = domRect.height;
      let x2 = domRect.x;
      let y2 = domRect.y;
      if (offsetX == null && data.x && isXAxis) {
        offsetX = domRect.x - data.x;
      }
      if (offsetY == null && data.y && isYAxis) {
        offsetY = domRect.y - data.y;
      }
      x2 -= offsetX || 0;
      y2 -= offsetY || 0;
      width = 0;
      height = 0;
      if (!isAutoUpdateEvent || canTrackCursorOnAutoUpdate) {
        width = data.axis === "y" ? domRect.width : 0;
        height = data.axis === "x" ? domRect.height : 0;
        x2 = isXAxis && data.x != null ? data.x : x2;
        y2 = isYAxis && data.y != null ? data.y : y2;
      } else if (isAutoUpdateEvent && !canTrackCursorOnAutoUpdate) {
        height = data.axis === "x" ? domRect.height : height;
        width = data.axis === "y" ? domRect.width : width;
      }
      isAutoUpdateEvent = true;
      return {
        width,
        height,
        x: x2,
        y: y2,
        top: y2,
        right: x2 + width,
        bottom: y2 + height,
        left: x2
      };
    }
  };
}
function isMouseBasedEvent(event) {
  return event != null && event.clientX != null;
}
function useClientPoint(context, props = {}) {
  const {
    enabled = true,
    axis = "both"
  } = props;
  const store2 = "rootStore" in context ? context.rootStore : context;
  const open3 = store2.useState("open");
  const floating = store2.useState("floatingElement");
  const domReference = store2.useState("domReferenceElement");
  const dataRef = store2.context.dataRef;
  const initialRef = React25.useRef(false);
  const cleanupListenerRef = React25.useRef(null);
  const [pointerType, setPointerType] = React25.useState();
  const [reactive, setReactive] = React25.useState([]);
  const resetReference = useStableCallback((reference2) => {
    store2.set("positionReference", reference2);
  });
  const setReference = useStableCallback((newX, newY, referenceElement) => {
    if (initialRef.current) {
      return;
    }
    if (dataRef.current.openEvent && !isMouseBasedEvent(dataRef.current.openEvent)) {
      return;
    }
    store2.set("positionReference", createVirtualElement(referenceElement ?? domReference, {
      x: newX,
      y: newY,
      axis,
      dataRef,
      pointerType
    }));
  });
  const handleReferenceEnterOrMove = useStableCallback((event) => {
    if (!open3) {
      setReference(event.clientX, event.clientY, event.currentTarget);
    } else if (!cleanupListenerRef.current) {
      setReference(event.clientX, event.clientY, event.currentTarget);
      setReactive([]);
    }
  });
  const openCheck = isMouseLikePointerType(pointerType) ? floating : open3;
  React25.useEffect(() => {
    if (!enabled) {
      resetReference(domReference);
      return void 0;
    }
    if (!openCheck) {
      return void 0;
    }
    function cleanupListener() {
      cleanupListenerRef.current?.();
      cleanupListenerRef.current = null;
    }
    const win = getWindow(floating);
    function handleMouseMove(event) {
      const target = getTarget(event);
      if (!contains(floating, target)) {
        setReference(event.clientX, event.clientY);
      } else {
        cleanupListener();
      }
    }
    if (!dataRef.current.openEvent || isMouseBasedEvent(dataRef.current.openEvent)) {
      cleanupListenerRef.current = addEventListener(win, "mousemove", handleMouseMove);
    } else {
      resetReference(domReference);
    }
    return cleanupListener;
  }, [openCheck, enabled, floating, dataRef, domReference, store2, setReference, resetReference, reactive]);
  React25.useEffect(() => () => {
    store2.set("positionReference", null);
  }, [store2]);
  React25.useEffect(() => {
    if (enabled && !floating) {
      initialRef.current = false;
    }
  }, [enabled, floating]);
  React25.useEffect(() => {
    if (!enabled && open3) {
      initialRef.current = true;
    }
  }, [enabled, open3]);
  const reference = React25.useMemo(() => {
    function setPointerTypeRef(event) {
      setPointerType(event.pointerType);
    }
    return {
      onPointerDown: setPointerTypeRef,
      onPointerEnter: setPointerTypeRef,
      onMouseMove: handleReferenceEnterOrMove,
      onMouseEnter: handleReferenceEnterOrMove
    };
  }, [handleReferenceEnterOrMove]);
  return React25.useMemo(() => enabled ? {
    reference,
    trigger: reference
  } : {}, [enabled, reference]);
}

// node_modules/@base-ui/react/floating-ui-react/hooks/useDismiss.mjs
var React26 = __toESM(require_react(), 1);
function alwaysFalse() {
  return false;
}
function normalizeProp(normalizable) {
  return {
    escapeKey: typeof normalizable === "boolean" ? normalizable : normalizable?.escapeKey ?? false,
    outsidePress: typeof normalizable === "boolean" ? normalizable : normalizable?.outsidePress ?? true
  };
}
function useDismiss(context, props = {}) {
  const {
    enabled = true,
    escapeKey: escapeKey2 = true,
    outsidePress: outsidePressProp = true,
    outsidePressEvent = "sloppy",
    referencePress = alwaysFalse,
    bubbles,
    externalTree
  } = props;
  const store2 = "rootStore" in context ? context.rootStore : context;
  const open3 = store2.useState("open");
  const floatingElement = store2.useState("floatingElement");
  const {
    dataRef,
    events
  } = store2.context;
  const tree = useFloatingTree(externalTree);
  const outsidePressFn = useStableCallback(typeof outsidePressProp === "function" ? outsidePressProp : () => false);
  const outsidePress2 = typeof outsidePressProp === "function" ? outsidePressFn : outsidePressProp;
  const outsidePressEnabled = outsidePress2 !== false;
  const getOutsidePressEventProp = useStableCallback(() => outsidePressEvent);
  const {
    escapeKey: escapeKeyBubbles,
    outsidePress: outsidePressBubbles
  } = normalizeProp(bubbles);
  const pressStartedInsideRef = React26.useRef(false);
  const pressStartPreventedRef = React26.useRef(false);
  const suppressNextOutsideClickRef = React26.useRef(false);
  const sawPressWhileOpenRef = React26.useRef(false);
  const isComposingRef = React26.useRef(false);
  const currentPointerTypeRef = React26.useRef("");
  const touchStateRef = React26.useRef(null);
  const cancelDismissOnEndTimeout = useTimeout();
  const clearInsideReactTreeTimeout = useTimeout();
  const clearInsideReactTree = useStableCallback(() => {
    clearInsideReactTreeTimeout.clear();
    dataRef.current.insideReactTree = false;
  });
  const hasBlockingChild = useStableCallback((bubbleKey) => {
    const nodeId = dataRef.current.floatingContext?.nodeId;
    const children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : [];
    return children.some((child) => child.context?.open && !child.context.dataRef.current[bubbleKey]);
  });
  const isEventWithinOwnElements = useStableCallback((event) => {
    return isEventTargetWithin(event, store2.select("floatingElement")) || isEventTargetWithin(event, store2.select("domReferenceElement"));
  });
  const closeOnReferencePress = useStableCallback((event) => {
    if (!referencePress()) {
      return;
    }
    store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerPress, event.nativeEvent));
  });
  const closeOnEscapeKeyDown = useStableCallback((event) => {
    if (!open3 || !enabled || !escapeKey2 || event.key !== "Escape") {
      return;
    }
    if (isComposingRef.current) {
      return;
    }
    if (!escapeKeyBubbles && hasBlockingChild("__escapeKeyBubbles")) {
      return;
    }
    const native = isReactEvent(event) ? event.nativeEvent : event;
    const eventDetails = createChangeEventDetails(reason_parts_exports.escapeKey, native);
    store2.setOpen(false, eventDetails);
    if (!eventDetails.isCanceled) {
      event.preventDefault();
    }
    if (!escapeKeyBubbles && !eventDetails.isPropagationAllowed) {
      event.stopPropagation();
    }
  });
  const markInsideReactTree = useStableCallback(() => {
    dataRef.current.insideReactTree = true;
    clearInsideReactTreeTimeout.start(0, clearInsideReactTree);
  });
  const markPressStartedInsideReactTree = useStableCallback((event) => {
    if (!open3 || !enabled || event.button !== 0) {
      return;
    }
    const target = getTarget(event.nativeEvent);
    if (!contains(store2.select("floatingElement"), target)) {
      return;
    }
    if (!pressStartedInsideRef.current) {
      pressStartedInsideRef.current = true;
      pressStartPreventedRef.current = false;
    }
  });
  const markInsidePressStartPrevented = useStableCallback((event) => {
    if (!open3 || !enabled) {
      return;
    }
    if (!(event.defaultPrevented || event.nativeEvent.defaultPrevented)) {
      return;
    }
    if (pressStartedInsideRef.current) {
      pressStartPreventedRef.current = true;
    }
  });
  React26.useEffect(() => {
    function handleOpenChange(details) {
      if (!details.open) {
        sawPressWhileOpenRef.current = false;
      }
    }
    events.on("openchange", handleOpenChange);
    return () => {
      events.off("openchange", handleOpenChange);
    };
  }, [events]);
  React26.useEffect(() => {
    if (!open3 || !enabled) {
      if (!open3) {
        sawPressWhileOpenRef.current = false;
      }
      return clearInsideReactTree;
    }
    dataRef.current.__escapeKeyBubbles = escapeKeyBubbles;
    dataRef.current.__outsidePressBubbles = outsidePressBubbles;
    const compositionTimeout = new Timeout();
    const preventedPressSuppressionTimeout = new Timeout();
    const doc = ownerDocument(floatingElement);
    function handleCompositionStart() {
      compositionTimeout.clear();
      isComposingRef.current = true;
    }
    function handleCompositionEnd() {
      compositionTimeout.start(
        // 0ms or 1ms don't work in Safari. 5ms appears to consistently work.
        // Only apply to WebKit for the test to remain 0ms.
        parts_exports.engine.webkit ? 5 : 0,
        () => {
          isComposingRef.current = false;
        }
      );
    }
    function suppressImmediateOutsideClickAfterPreventedStart() {
      suppressNextOutsideClickRef.current = true;
      preventedPressSuppressionTimeout.start(0, () => {
        suppressNextOutsideClickRef.current = false;
      });
    }
    function resetPressStartState() {
      pressStartedInsideRef.current = false;
      pressStartPreventedRef.current = false;
    }
    function getOutsidePressEvent() {
      const type = currentPointerTypeRef.current;
      const computedType = type === "pen" || !type ? "mouse" : type;
      const outsidePressEventValue = getOutsidePressEventProp();
      const resolved = typeof outsidePressEventValue === "function" ? outsidePressEventValue() : outsidePressEventValue;
      if (typeof resolved === "string") {
        return resolved;
      }
      return resolved[computedType];
    }
    function shouldIgnoreEvent(event) {
      const computedOutsidePressEvent = getOutsidePressEvent();
      return computedOutsidePressEvent === "intentional" && event.type !== "click" || computedOutsidePressEvent === "sloppy" && event.type === "click";
    }
    function isEventWithinFloatingTree(event) {
      const nodeId = dataRef.current.floatingContext?.nodeId;
      const targetIsInsideChildren = tree && getNodeChildren(tree.nodesRef.current, nodeId).some((node) => isEventTargetWithin(event, node.context?.elements.floating));
      return isEventWithinOwnElements(event) || targetIsInsideChildren;
    }
    function closeOnPressOutside(event) {
      if (shouldIgnoreEvent(event)) {
        if (event.type !== "click" && !isEventWithinOwnElements(event)) {
          preventedPressSuppressionTimeout.clear();
          suppressNextOutsideClickRef.current = false;
        }
        clearInsideReactTree();
        return;
      }
      if (dataRef.current.insideReactTree) {
        clearInsideReactTree();
        return;
      }
      const target = getTarget(event);
      const inertSelector = `[${createAttribute("inert")}]`;
      const targetRoot = isElement(target) ? target.getRootNode() : null;
      const markers = Array.from((isShadowRoot(targetRoot) ? targetRoot : ownerDocument(store2.select("floatingElement"))).querySelectorAll(inertSelector));
      const triggers = store2.context.triggerElements;
      if (target && (triggers.hasElement(target) || triggers.hasMatchingElement((trigger) => contains(trigger, target)))) {
        return;
      }
      let targetRootAncestor = isElement(target) ? target : null;
      while (targetRootAncestor && !isLastTraversableNode(targetRootAncestor)) {
        const nextParent = getParentNode(targetRootAncestor);
        if (isLastTraversableNode(nextParent) || !isElement(nextParent)) {
          break;
        }
        targetRootAncestor = nextParent;
      }
      if (markers.length && isElement(target) && !isRootElement(target) && // Clicked on a direct ancestor (e.g. FloatingOverlay).
      !contains(target, store2.select("floatingElement")) && // If the target root element contains none of the markers, then the
      // element was injected after the floating element rendered.
      markers.every((marker) => !contains(targetRootAncestor, marker))) {
        return;
      }
      if (isHTMLElement(target) && !("touches" in event)) {
        const lastTraversableNode = isLastTraversableNode(target);
        const style = getComputedStyle2(target);
        const scrollRe = /auto|scroll/;
        const isScrollableX = lastTraversableNode || scrollRe.test(style.overflowX);
        const isScrollableY = lastTraversableNode || scrollRe.test(style.overflowY);
        const canScrollX = isScrollableX && target.clientWidth > 0 && target.scrollWidth > target.clientWidth;
        const canScrollY = isScrollableY && target.clientHeight > 0 && target.scrollHeight > target.clientHeight;
        const isRTL6 = style.direction === "rtl";
        const pressedVerticalScrollbar = canScrollY && (isRTL6 ? event.offsetX <= target.offsetWidth - target.clientWidth : event.offsetX > target.clientWidth);
        const pressedHorizontalScrollbar = canScrollX && event.offsetY > target.clientHeight;
        if (pressedVerticalScrollbar || pressedHorizontalScrollbar) {
          return;
        }
      }
      if (isEventWithinFloatingTree(event)) {
        return;
      }
      if (getOutsidePressEvent() === "intentional") {
        if (event.detail !== 0 && !isVirtualClick(event) && !sawPressWhileOpenRef.current) {
          return;
        }
        if (suppressNextOutsideClickRef.current) {
          preventedPressSuppressionTimeout.clear();
          suppressNextOutsideClickRef.current = false;
          return;
        }
      }
      if (typeof outsidePress2 === "function" && !outsidePress2(event)) {
        return;
      }
      if (hasBlockingChild("__outsidePressBubbles")) {
        return;
      }
      store2.setOpen(false, createChangeEventDetails(reason_parts_exports.outsidePress, event));
      clearInsideReactTree();
    }
    function handlePointerDown(event) {
      if (getOutsidePressEvent() !== "sloppy" || event.pointerType === "touch" || !store2.select("open") || !enabled || isEventWithinOwnElements(event)) {
        return;
      }
      closeOnPressOutside(event);
    }
    function handleTouchStart(event) {
      if (getOutsidePressEvent() !== "sloppy" || !store2.select("open") || !enabled || isEventWithinOwnElements(event)) {
        return;
      }
      const touch = event.touches[0];
      if (touch) {
        touchStateRef.current = {
          startTime: Date.now(),
          startX: touch.clientX,
          startY: touch.clientY,
          dismissOnTouchEnd: false,
          dismissOnMouseDown: true
        };
        cancelDismissOnEndTimeout.start(1e3, () => {
          if (touchStateRef.current) {
            touchStateRef.current.dismissOnTouchEnd = false;
            touchStateRef.current.dismissOnMouseDown = false;
          }
        });
      }
    }
    function addTargetEventListenerOnce(event, listener) {
      const target = getTarget(event);
      if (!target) {
        return;
      }
      const unsubscribe2 = addEventListener(target, event.type, () => {
        listener(event);
        unsubscribe2();
      });
    }
    function handleTouchStartCapture(event) {
      currentPointerTypeRef.current = "touch";
      addTargetEventListenerOnce(event, handleTouchStart);
    }
    function closeOnPressOutsideCapture(event) {
      cancelDismissOnEndTimeout.clear();
      if (event.type === "pointerdown") {
        if (event.button === 0) {
          sawPressWhileOpenRef.current = true;
        }
        currentPointerTypeRef.current = event.pointerType;
      }
      if (event.type === "mousedown" && touchStateRef.current && !touchStateRef.current.dismissOnMouseDown) {
        return;
      }
      addTargetEventListenerOnce(event, (targetEvent) => {
        if (targetEvent.type === "pointerdown") {
          handlePointerDown(targetEvent);
        } else {
          closeOnPressOutside(targetEvent);
        }
      });
    }
    function handlePressEndCapture(event) {
      if (event.type === "pointercancel") {
        sawPressWhileOpenRef.current = false;
      }
      if (!pressStartedInsideRef.current) {
        return;
      }
      const pressStartedInsideDefaultPrevented = pressStartPreventedRef.current;
      resetPressStartState();
      if (getOutsidePressEvent() !== "intentional") {
        return;
      }
      if (event.type === "pointercancel") {
        if (pressStartedInsideDefaultPrevented) {
          suppressImmediateOutsideClickAfterPreventedStart();
        }
        return;
      }
      if (isEventWithinFloatingTree(event)) {
        return;
      }
      if (pressStartedInsideDefaultPrevented) {
        suppressImmediateOutsideClickAfterPreventedStart();
        return;
      }
      if (typeof outsidePress2 === "function" && !outsidePress2(event)) {
        return;
      }
      preventedPressSuppressionTimeout.clear();
      suppressNextOutsideClickRef.current = true;
      clearInsideReactTree();
    }
    function handleTouchMove(event) {
      if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) {
        return;
      }
      const touch = event.touches[0];
      if (!touch) {
        return;
      }
      const deltaX = Math.abs(touch.clientX - touchStateRef.current.startX);
      const deltaY = Math.abs(touch.clientY - touchStateRef.current.startY);
      const distance2 = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
      if (distance2 > 5) {
        touchStateRef.current.dismissOnTouchEnd = true;
      }
      if (distance2 > 10) {
        closeOnPressOutside(event);
        cancelDismissOnEndTimeout.clear();
        touchStateRef.current = null;
      }
    }
    function handleTouchMoveCapture(event) {
      addTargetEventListenerOnce(event, handleTouchMove);
    }
    function handleTouchEnd(event) {
      if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) {
        return;
      }
      if (touchStateRef.current.dismissOnTouchEnd) {
        closeOnPressOutside(event);
      }
      cancelDismissOnEndTimeout.clear();
      touchStateRef.current = null;
    }
    function handleTouchEndCapture(event) {
      addTargetEventListenerOnce(event, handleTouchEnd);
    }
    const unsubscribe = mergeCleanups(escapeKey2 && mergeCleanups(addEventListener(doc, "keydown", closeOnEscapeKeyDown), addEventListener(doc, "compositionstart", handleCompositionStart), addEventListener(doc, "compositionend", handleCompositionEnd)), outsidePressEnabled && mergeCleanups(addEventListener(doc, "click", closeOnPressOutsideCapture, true), addEventListener(doc, "pointerdown", closeOnPressOutsideCapture, true), addEventListener(doc, "pointerup", handlePressEndCapture, true), addEventListener(doc, "pointercancel", handlePressEndCapture, true), addEventListener(doc, "mousedown", closeOnPressOutsideCapture, true), addEventListener(doc, "mouseup", handlePressEndCapture, true), addEventListener(doc, "touchstart", handleTouchStartCapture, {
      capture: true,
      passive: true
    }), addEventListener(doc, "touchmove", handleTouchMoveCapture, {
      capture: true,
      passive: true
    }), addEventListener(doc, "touchend", handleTouchEndCapture, {
      capture: true,
      passive: true
    })));
    return () => {
      unsubscribe();
      compositionTimeout.clear();
      preventedPressSuppressionTimeout.clear();
      resetPressStartState();
      suppressNextOutsideClickRef.current = false;
      clearInsideReactTree();
    };
  }, [dataRef, floatingElement, escapeKey2, outsidePressEnabled, outsidePress2, open3, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, clearInsideReactTree, getOutsidePressEventProp, hasBlockingChild, isEventWithinOwnElements, tree, store2, cancelDismissOnEndTimeout]);
  const reference = React26.useMemo(() => ({
    onKeyDown: closeOnEscapeKeyDown,
    onPointerDown: closeOnReferencePress,
    onClick: closeOnReferencePress
  }), [closeOnEscapeKeyDown, closeOnReferencePress]);
  const floating = React26.useMemo(() => ({
    onKeyDown: closeOnEscapeKeyDown,
    // `onMouseDown` may be blocked if `event.preventDefault()` is called in
    // `onPointerDown`, such as with <NumberField.ScrubArea>.
    // See https://github.com/mui/base-ui/pull/3379
    onPointerDown: markInsidePressStartPrevented,
    onMouseDown: markInsidePressStartPrevented,
    onClickCapture: markInsideReactTree,
    onMouseDownCapture(event) {
      markInsideReactTree();
      markPressStartedInsideReactTree(event);
    },
    onPointerDownCapture(event) {
      markInsideReactTree();
      markPressStartedInsideReactTree(event);
    },
    onMouseUpCapture: markInsideReactTree,
    onTouchEndCapture: markInsideReactTree,
    onTouchMoveCapture: markInsideReactTree
  }), [closeOnEscapeKeyDown, markInsideReactTree, markPressStartedInsideReactTree, markInsidePressStartPrevented]);
  return React26.useMemo(() => enabled ? {
    reference,
    floating,
    trigger: reference
  } : {}, [enabled, reference, floating]);
}

// node_modules/@base-ui/react/floating-ui-react/hooks/useFloating.mjs
var React35 = __toESM(require_react(), 1);

// node_modules/@floating-ui/core/dist/floating-ui.core.mjs
function computeCoordsFromPlacement(_ref, placement, rtl) {
  let {
    reference,
    floating
  } = _ref;
  const sideAxis = getSideAxis(placement);
  const alignmentAxis = getAlignmentAxis(placement);
  const alignLength = getAxisLength(alignmentAxis);
  const side = getSide(placement);
  const isVertical = sideAxis === "y";
  const commonX = reference.x + reference.width / 2 - floating.width / 2;
  const commonY = reference.y + reference.height / 2 - floating.height / 2;
  const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
  let coords;
  switch (side) {
    case "top":
      coords = {
        x: commonX,
        y: reference.y - floating.height
      };
      break;
    case "bottom":
      coords = {
        x: commonX,
        y: reference.y + reference.height
      };
      break;
    case "right":
      coords = {
        x: reference.x + reference.width,
        y: commonY
      };
      break;
    case "left":
      coords = {
        x: reference.x - floating.width,
        y: commonY
      };
      break;
    default:
      coords = {
        x: reference.x,
        y: reference.y
      };
  }
  const alignment = getAlignment(placement);
  if (alignment) {
    coords[alignmentAxis] += commonAlign * (alignment === "end" ? 1 : -1) * (rtl && isVertical ? -1 : 1);
  }
  return coords;
}
async function detectOverflow(state, options) {
  var _await$platform$isEle;
  if (options === void 0) {
    options = {};
  }
  const {
    x: x2,
    y: y2,
    platform: platform3,
    rects,
    elements,
    strategy
  } = state;
  const {
    boundary = "clippingAncestors",
    rootBoundary = "viewport",
    elementContext = "floating",
    altBoundary = false,
    padding = 0
  } = evaluate(options, state);
  const paddingObject = getPaddingObject(padding);
  const altContext = elementContext === "floating" ? "reference" : "floating";
  const element = elements[altBoundary ? altContext : elementContext];
  const clippingClientRect = rectToClientRect(await platform3.getClippingRect({
    element: ((_await$platform$isEle = await (platform3.isElement == null ? void 0 : platform3.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform3.getDocumentElement == null ? void 0 : platform3.getDocumentElement(elements.floating)),
    boundary,
    rootBoundary,
    strategy
  }));
  const rect = elementContext === "floating" ? {
    x: x2,
    y: y2,
    width: rects.floating.width,
    height: rects.floating.height
  } : rects.reference;
  const offsetParent = await (platform3.getOffsetParent == null ? void 0 : platform3.getOffsetParent(elements.floating));
  const offsetScale = await (platform3.isElement == null ? void 0 : platform3.isElement(offsetParent)) && await (platform3.getScale == null ? void 0 : platform3.getScale(offsetParent)) || {
    x: 1,
    y: 1
  };
  const elementClientRect = rectToClientRect(platform3.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform3.convertOffsetParentRelativeRectToViewportRelativeRect({
    elements,
    rect,
    offsetParent,
    strategy
  }) : rect);
  return {
    top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
    bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
    left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
    right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
  };
}
var MAX_RESET_COUNT = 50;
var computePosition = async (reference, floating, config) => {
  const {
    placement = "bottom",
    strategy = "absolute",
    middleware = [],
    platform: platform3
  } = config;
  const platformWithDetectOverflow = platform3.detectOverflow ? platform3 : {
    ...platform3,
    detectOverflow
  };
  const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(floating));
  let rects = await platform3.getElementRects({
    reference,
    floating,
    strategy
  });
  let {
    x: x2,
    y: y2
  } = computeCoordsFromPlacement(rects, placement, rtl);
  let statefulPlacement = placement;
  let resetCount = 0;
  const middlewareData = {};
  for (let i = 0; i < middleware.length; i++) {
    const currentMiddleware = middleware[i];
    if (!currentMiddleware) {
      continue;
    }
    const {
      name,
      fn
    } = currentMiddleware;
    const {
      x: nextX,
      y: nextY,
      data,
      reset
    } = await fn({
      x: x2,
      y: y2,
      initialPlacement: placement,
      placement: statefulPlacement,
      strategy,
      middlewareData,
      rects,
      platform: platformWithDetectOverflow,
      elements: {
        reference,
        floating
      }
    });
    x2 = nextX != null ? nextX : x2;
    y2 = nextY != null ? nextY : y2;
    middlewareData[name] = {
      ...middlewareData[name],
      ...data
    };
    if (reset && resetCount < MAX_RESET_COUNT) {
      resetCount++;
      if (typeof reset === "object") {
        if (reset.placement) {
          statefulPlacement = reset.placement;
        }
        if (reset.rects) {
          rects = reset.rects === true ? await platform3.getElementRects({
            reference,
            floating,
            strategy
          }) : reset.rects;
        }
        ({
          x: x2,
          y: y2
        } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
      }
      i = -1;
    }
  }
  return {
    x: x2,
    y: y2,
    placement: statefulPlacement,
    strategy,
    middlewareData
  };
};
var flip = function(options) {
  if (options === void 0) {
    options = {};
  }
  return {
    name: "flip",
    options,
    async fn(state) {
      var _middlewareData$arrow, _middlewareData$flip;
      const {
        placement,
        middlewareData,
        rects,
        initialPlacement,
        platform: platform3,
        elements
      } = state;
      const {
        mainAxis: checkMainAxis = true,
        crossAxis: checkCrossAxis = true,
        fallbackPlacements: specifiedFallbackPlacements,
        fallbackStrategy = "bestFit",
        fallbackAxisSideDirection = "none",
        flipAlignment = true,
        ...detectOverflowOptions
      } = evaluate(options, state);
      if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
        return {};
      }
      const side = getSide(placement);
      const initialSideAxis = getSideAxis(initialPlacement);
      const isBasePlacement = getSide(initialPlacement) === initialPlacement;
      const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating));
      const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
      const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
      if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
        fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
      }
      const placements2 = [initialPlacement, ...fallbackPlacements];
      const overflow = await platform3.detectOverflow(state, detectOverflowOptions);
      const overflows = [];
      let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
      if (checkMainAxis) {
        overflows.push(overflow[side]);
      }
      if (checkCrossAxis) {
        const sides2 = getAlignmentSides(placement, rects, rtl);
        overflows.push(overflow[sides2[0]], overflow[sides2[1]]);
      }
      overflowsData = [...overflowsData, {
        placement,
        overflows
      }];
      if (!overflows.every((side2) => side2 <= 0)) {
        var _middlewareData$flip2, _overflowsData$filter;
        const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
        const nextPlacement = placements2[nextIndex];
        if (nextPlacement) {
          const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false;
          if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis
          // overflows the main axis.
          overflowsData.every((d) => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
            return {
              data: {
                index: nextIndex,
                overflows: overflowsData
              },
              reset: {
                placement: nextPlacement
              }
            };
          }
        }
        let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
        if (!resetPlacement) {
          switch (fallbackStrategy) {
            case "bestFit": {
              var _overflowsData$filter2;
              const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => {
                if (hasFallbackAxisSideDirection) {
                  const currentSideAxis = getSideAxis(d.placement);
                  return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal
                  // reading directions favoring greater width.
                  currentSideAxis === "y";
                }
                return true;
              }).map((d) => [d.placement, d.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
              if (placement2) {
                resetPlacement = placement2;
              }
              break;
            }
            case "initialPlacement":
              resetPlacement = initialPlacement;
              break;
          }
        }
        if (placement !== resetPlacement) {
          return {
            reset: {
              placement: resetPlacement
            }
          };
        }
      }
      return {};
    }
  };
};
var originSides = /* @__PURE__ */ new Set(["left", "top"]);
async function convertValueToCoords(state, options) {
  const {
    placement,
    platform: platform3,
    elements
  } = state;
  const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating));
  const side = getSide(placement);
  const alignment = getAlignment(placement);
  const isVertical = getSideAxis(placement) === "y";
  const mainAxisMulti = originSides.has(side) ? -1 : 1;
  const crossAxisMulti = rtl && isVertical ? -1 : 1;
  const rawValue = evaluate(options, state);
  let {
    mainAxis,
    crossAxis,
    alignmentAxis
  } = typeof rawValue === "number" ? {
    mainAxis: rawValue,
    crossAxis: 0,
    alignmentAxis: null
  } : {
    mainAxis: rawValue.mainAxis || 0,
    crossAxis: rawValue.crossAxis || 0,
    alignmentAxis: rawValue.alignmentAxis
  };
  if (alignment && typeof alignmentAxis === "number") {
    crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
  }
  return isVertical ? {
    x: crossAxis * crossAxisMulti,
    y: mainAxis * mainAxisMulti
  } : {
    x: mainAxis * mainAxisMulti,
    y: crossAxis * crossAxisMulti
  };
}
var offset = function(options) {
  if (options === void 0) {
    options = 0;
  }
  return {
    name: "offset",
    options,
    async fn(state) {
      var _middlewareData$offse, _middlewareData$arrow;
      const {
        x: x2,
        y: y2,
        placement,
        middlewareData
      } = state;
      const diffCoords = await convertValueToCoords(state, options);
      if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
        return {};
      }
      return {
        x: x2 + diffCoords.x,
        y: y2 + diffCoords.y,
        data: {
          ...diffCoords,
          placement
        }
      };
    }
  };
};
var shift = function(options) {
  if (options === void 0) {
    options = {};
  }
  return {
    name: "shift",
    options,
    async fn(state) {
      const {
        x: x2,
        y: y2,
        placement,
        platform: platform3
      } = state;
      const {
        mainAxis: checkMainAxis = true,
        crossAxis: checkCrossAxis = false,
        limiter = {
          fn: (_ref) => {
            let {
              x: x3,
              y: y3
            } = _ref;
            return {
              x: x3,
              y: y3
            };
          }
        },
        ...detectOverflowOptions
      } = evaluate(options, state);
      const coords = {
        x: x2,
        y: y2
      };
      const overflow = await platform3.detectOverflow(state, detectOverflowOptions);
      const crossAxis = getSideAxis(placement);
      const mainAxis = getOppositeAxis(crossAxis);
      let mainAxisCoord = coords[mainAxis];
      let crossAxisCoord = coords[crossAxis];
      const clampCoord = (axis, coord) => clamp(coord + overflow[axis === "y" ? "top" : "left"], coord, coord - overflow[axis === "y" ? "bottom" : "right"]);
      if (checkMainAxis) {
        mainAxisCoord = clampCoord(mainAxis, mainAxisCoord);
      }
      if (checkCrossAxis) {
        crossAxisCoord = clampCoord(crossAxis, crossAxisCoord);
      }
      const limitedCoords = limiter.fn({
        ...state,
        [mainAxis]: mainAxisCoord,
        [crossAxis]: crossAxisCoord
      });
      return {
        ...limitedCoords,
        data: {
          x: limitedCoords.x - x2,
          y: limitedCoords.y - y2,
          enabled: {
            [mainAxis]: checkMainAxis,
            [crossAxis]: checkCrossAxis
          }
        }
      };
    }
  };
};
var limitShift = function(options) {
  if (options === void 0) {
    options = {};
  }
  return {
    options,
    fn(state) {
      var _rawOffset$mainAxis, _rawOffset$crossAxis;
      const {
        x: x2,
        y: y2,
        placement,
        rects,
        middlewareData
      } = state;
      const {
        offset: offset4 = 0,
        mainAxis: checkMainAxis = true,
        crossAxis: checkCrossAxis = true
      } = evaluate(options, state);
      const coords = {
        x: x2,
        y: y2
      };
      const crossAxis = getSideAxis(placement);
      const mainAxis = getOppositeAxis(crossAxis);
      let mainAxisCoord = coords[mainAxis];
      let crossAxisCoord = coords[crossAxis];
      const rawOffset = evaluate(offset4, state);
      const computedOffset = typeof rawOffset === "number" ? {
        mainAxis: rawOffset,
        crossAxis: 0
      } : {
        mainAxis: (_rawOffset$mainAxis = rawOffset.mainAxis) != null ? _rawOffset$mainAxis : 0,
        crossAxis: (_rawOffset$crossAxis = rawOffset.crossAxis) != null ? _rawOffset$crossAxis : 0
      };
      if (checkMainAxis) {
        const len2 = mainAxis === "y" ? "height" : "width";
        const limitMin = rects.reference[mainAxis] - rects.floating[len2] + computedOffset.mainAxis;
        const limitMax = rects.reference[mainAxis] + rects.reference[len2] - computedOffset.mainAxis;
        if (mainAxisCoord < limitMin) {
          mainAxisCoord = limitMin;
        } else if (mainAxisCoord > limitMax) {
          mainAxisCoord = limitMax;
        }
      }
      if (checkCrossAxis) {
        var _middlewareData$offse, _middlewareData$offse2;
        const len2 = mainAxis === "y" ? "width" : "height";
        const isOriginSide = originSides.has(getSide(placement));
        const limitMin = rects.reference[crossAxis] - rects.floating[len2] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
        const limitMax = rects.reference[crossAxis] + rects.reference[len2] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
        if (crossAxisCoord < limitMin) {
          crossAxisCoord = limitMin;
        } else if (crossAxisCoord > limitMax) {
          crossAxisCoord = limitMax;
        }
      }
      return {
        [mainAxis]: mainAxisCoord,
        [crossAxis]: crossAxisCoord
      };
    }
  };
};
var size = function(options) {
  if (options === void 0) {
    options = {};
  }
  return {
    name: "size",
    options,
    async fn(state) {
      const {
        placement,
        rects,
        platform: platform3,
        elements
      } = state;
      const {
        apply = () => {
        },
        ...detectOverflowOptions
      } = evaluate(options, state);
      const overflow = await platform3.detectOverflow(state, detectOverflowOptions);
      const side = getSide(placement);
      const alignment = getAlignment(placement);
      const isYAxis = getSideAxis(placement) === "y";
      const {
        width,
        height
      } = rects.floating;
      let heightSide;
      let widthSide;
      if (side === "top" || side === "bottom") {
        heightSide = side;
        widthSide = alignment === (await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right";
      } else {
        widthSide = side;
        heightSide = alignment === "end" ? "top" : "bottom";
      }
      const maximumClippingHeight = height - overflow.top - overflow.bottom;
      const maximumClippingWidth = width - overflow.left - overflow.right;
      const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
      const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
      const shiftData = state.middlewareData.shift;
      const noShift = !shiftData;
      let availableHeight2 = overflowAvailableHeight;
      let availableWidth2 = overflowAvailableWidth;
      if (shiftData != null && shiftData.enabled.x) {
        availableWidth2 = maximumClippingWidth;
      }
      if (shiftData != null && shiftData.enabled.y) {
        availableHeight2 = maximumClippingHeight;
      }
      if (noShift && !alignment) {
        if (isYAxis) {
          availableWidth2 = width - 2 * max(overflow.left, overflow.right);
        } else {
          availableHeight2 = height - 2 * max(overflow.top, overflow.bottom);
        }
      }
      await apply({
        ...state,
        availableWidth: availableWidth2,
        availableHeight: availableHeight2
      });
      const nextDimensions = await platform3.getDimensions(elements.floating);
      if (width !== nextDimensions.width || height !== nextDimensions.height) {
        return {
          reset: {
            rects: true
          }
        };
      }
      return {};
    }
  };
};

// node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs
function getCssDimensions(element) {
  const css = getComputedStyle2(element);
  let width = parseFloat(css.width) || 0;
  let height = parseFloat(css.height) || 0;
  const hasOffset = isHTMLElement(element);
  const offsetWidth = hasOffset ? element.offsetWidth : width;
  const offsetHeight = hasOffset ? element.offsetHeight : height;
  const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
  if (shouldFallback) {
    width = offsetWidth;
    height = offsetHeight;
  }
  return {
    width,
    height,
    $: shouldFallback
  };
}
function unwrapElement(element) {
  return !isElement(element) ? element.contextElement : element;
}
function getScale(element) {
  const domElement = unwrapElement(element);
  if (!isHTMLElement(domElement)) {
    return createCoords(1);
  }
  const rect = domElement.getBoundingClientRect();
  const {
    width,
    height,
    $: $2
  } = getCssDimensions(domElement);
  let x2 = ($2 ? round(rect.width) : rect.width) / width;
  let y2 = ($2 ? round(rect.height) : rect.height) / height;
  if (!x2 || !Number.isFinite(x2)) {
    x2 = 1;
  }
  if (!y2 || !Number.isFinite(y2)) {
    y2 = 1;
  }
  return {
    x: x2,
    y: y2
  };
}
var noOffsets = /* @__PURE__ */ createCoords(0);
function getVisualOffsets(element) {
  const win = getWindow(element);
  if (!isWebKit() || !win.visualViewport) {
    return noOffsets;
  }
  return {
    x: win.visualViewport.offsetLeft,
    y: win.visualViewport.offsetTop
  };
}
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
  if (isFixed === void 0) {
    isFixed = false;
  }
  return !!floatingOffsetParent && isFixed && floatingOffsetParent === getWindow(element);
}
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
  if (includeScale === void 0) {
    includeScale = false;
  }
  if (isFixedStrategy === void 0) {
    isFixedStrategy = false;
  }
  const clientRect = element.getBoundingClientRect();
  const domElement = unwrapElement(element);
  let scale3 = createCoords(1);
  if (includeScale) {
    if (offsetParent) {
      if (isElement(offsetParent)) {
        scale3 = getScale(offsetParent);
      }
    } else {
      scale3 = getScale(element);
    }
  }
  const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
  let x2 = (clientRect.left + visualOffsets.x) / scale3.x;
  let y2 = (clientRect.top + visualOffsets.y) / scale3.y;
  let width = clientRect.width / scale3.x;
  let height = clientRect.height / scale3.y;
  if (domElement && offsetParent) {
    const win = getWindow(domElement);
    const offsetWin = isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
    let currentWin = win;
    let currentIFrame = getFrameElement(currentWin);
    while (currentIFrame && offsetWin !== currentWin) {
      const iframeScale = getScale(currentIFrame);
      const iframeRect = currentIFrame.getBoundingClientRect();
      const css = getComputedStyle2(currentIFrame);
      const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
      const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
      x2 *= iframeScale.x;
      y2 *= iframeScale.y;
      width *= iframeScale.x;
      height *= iframeScale.y;
      x2 += left;
      y2 += top;
      currentWin = getWindow(currentIFrame);
      currentIFrame = getFrameElement(currentWin);
    }
  }
  return rectToClientRect({
    width,
    height,
    x: x2,
    y: y2
  });
}
function getWindowScrollBarX(element, rect) {
  const leftScroll = getNodeScroll(element).scrollLeft;
  if (!rect) {
    return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
  }
  return rect.left + leftScroll;
}
function getHTMLOffset(documentElement, scroll) {
  const htmlRect = documentElement.getBoundingClientRect();
  const x2 = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
  const y2 = htmlRect.top + scroll.scrollTop;
  return {
    x: x2,
    y: y2
  };
}
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
  let {
    elements,
    rect,
    offsetParent,
    strategy
  } = _ref;
  const isFixed = strategy === "fixed";
  const documentElement = getDocumentElement(offsetParent);
  const topLayer = elements ? isTopLayer(elements.floating) : false;
  if (offsetParent === documentElement || topLayer && isFixed) {
    return rect;
  }
  let scroll = {
    scrollLeft: 0,
    scrollTop: 0
  };
  let scale3 = createCoords(1);
  const offsets = createCoords(0);
  const isOffsetParentAnElement = isHTMLElement(offsetParent);
  if (isOffsetParentAnElement || !isFixed) {
    if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
      scroll = getNodeScroll(offsetParent);
    }
    if (isOffsetParentAnElement) {
      const offsetRect = getBoundingClientRect(offsetParent);
      scale3 = getScale(offsetParent);
      offsets.x = offsetRect.x + offsetParent.clientLeft;
      offsets.y = offsetRect.y + offsetParent.clientTop;
    }
  }
  const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
  return {
    width: rect.width * scale3.x,
    height: rect.height * scale3.y,
    x: rect.x * scale3.x - scroll.scrollLeft * scale3.x + offsets.x + htmlOffset.x,
    y: rect.y * scale3.y - scroll.scrollTop * scale3.y + offsets.y + htmlOffset.y
  };
}
function getClientRects(element) {
  return element.getClientRects ? Array.from(element.getClientRects()) : [];
}
function getDocumentRect(html) {
  const scroll = getNodeScroll(html);
  const body = html.ownerDocument.body;
  const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
  const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
  let x2 = -scroll.scrollLeft + getWindowScrollBarX(html);
  const y2 = -scroll.scrollTop;
  if (getComputedStyle2(body).direction === "rtl") {
    x2 += max(html.clientWidth, body.clientWidth) - width;
  }
  return {
    width,
    height,
    x: x2,
    y: y2
  };
}
var SCROLLBAR_MAX = 25;
function getViewportRect(element, strategy, rootBoundary) {
  if (rootBoundary === void 0) {
    rootBoundary = "viewport";
  }
  const isLayoutViewport = rootBoundary === "layoutViewport";
  const win = getWindow(element);
  const html = getDocumentElement(element);
  const visualViewport = win.visualViewport;
  let width = html.clientWidth;
  let height = html.clientHeight;
  let x2 = 0;
  let y2 = 0;
  if (visualViewport) {
    const layoutRelativeClientCoords = !isWebKit() || strategy === "fixed";
    if (isLayoutViewport) {
      if (!layoutRelativeClientCoords) {
        x2 = -visualViewport.offsetLeft;
        y2 = -visualViewport.offsetTop;
      }
    } else {
      width = visualViewport.width;
      height = visualViewport.height;
      if (layoutRelativeClientCoords) {
        x2 = visualViewport.offsetLeft;
        y2 = visualViewport.offsetTop;
      }
    }
  }
  const windowScrollbarX = getWindowScrollBarX(html);
  if (windowScrollbarX <= 0) {
    const doc = html.ownerDocument;
    const body = doc.body;
    const bodyStyles = getComputedStyle(body);
    const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
    const reservedWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
    const gutter = getComputedStyle(html).scrollbarGutter === "stable both-edges" ? reservedWidth / 2 : reservedWidth;
    if (gutter <= SCROLLBAR_MAX) {
      width -= gutter;
    }
  }
  return {
    width,
    height,
    x: x2,
    y: y2
  };
}
function getInnerBoundingClientRect(element, strategy) {
  const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
  const top = clientRect.top + element.clientTop;
  const left = clientRect.left + element.clientLeft;
  const scale3 = getScale(element);
  const width = element.clientWidth * scale3.x;
  const height = element.clientHeight * scale3.y;
  const x2 = left * scale3.x;
  const y2 = top * scale3.y;
  return {
    width,
    height,
    x: x2,
    y: y2
  };
}
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
  let rect;
  if (clippingAncestor === "viewport" || clippingAncestor === "layoutViewport") {
    rect = getViewportRect(element, strategy, clippingAncestor);
  } else if (clippingAncestor === "document") {
    rect = getDocumentRect(getDocumentElement(element));
  } else if (isElement(clippingAncestor)) {
    rect = getInnerBoundingClientRect(clippingAncestor, strategy);
  } else {
    const visualOffsets = getVisualOffsets(element);
    rect = {
      x: clippingAncestor.x - visualOffsets.x,
      y: clippingAncestor.y - visualOffsets.y,
      width: clippingAncestor.width,
      height: clippingAncestor.height
    };
  }
  return rectToClientRect(rect);
}
function getClippingElementAncestors(element, cache) {
  const cachedResult = cache.get(element);
  if (cachedResult) {
    return cachedResult;
  }
  let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
  let lastKeptComputedStyle = null;
  const elementIsFixed = getComputedStyle2(element).position === "fixed";
  let currentNode = elementIsFixed ? getParentNode(element) : element;
  while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
    const computedStyle = getComputedStyle2(currentNode);
    const currentNodeIsContaining = isContainingBlock(currentNode);
    const lastPosition = lastKeptComputedStyle ? lastKeptComputedStyle.position : elementIsFixed ? "fixed" : "";
    const shouldDropCurrentNode = !currentNodeIsContaining && (lastPosition === "fixed" || lastPosition === "absolute" && computedStyle.position === "static");
    if (shouldDropCurrentNode) {
      result = result.filter((ancestor) => ancestor !== currentNode);
    } else {
      lastKeptComputedStyle = computedStyle;
    }
    currentNode = getParentNode(currentNode);
  }
  cache.set(element, result);
  return result;
}
function getClippingRect(_ref) {
  let {
    element,
    boundary,
    rootBoundary,
    strategy
  } = _ref;
  const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
  const clippingAncestors = [...elementClippingAncestors, rootBoundary];
  const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
  let top = firstRect.top;
  let right = firstRect.right;
  let bottom = firstRect.bottom;
  let left = firstRect.left;
  for (let i = 1; i < clippingAncestors.length; i++) {
    const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
    top = max(rect.top, top);
    right = min(rect.right, right);
    bottom = min(rect.bottom, bottom);
    left = max(rect.left, left);
  }
  return {
    width: right - left,
    height: bottom - top,
    x: left,
    y: top
  };
}
function getDimensions2(element) {
  const {
    width,
    height
  } = getCssDimensions(element);
  return {
    width,
    height
  };
}
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
  const isOffsetParentAnElement = isHTMLElement(offsetParent);
  const documentElement = getDocumentElement(offsetParent);
  const isFixed = strategy === "fixed";
  const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
  let scroll = {
    scrollLeft: 0,
    scrollTop: 0
  };
  const offsets = createCoords(0);
  if (isOffsetParentAnElement || !isFixed) {
    if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
      scroll = getNodeScroll(offsetParent);
    }
    if (isOffsetParentAnElement) {
      const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
      offsets.x = offsetRect.x + offsetParent.clientLeft;
      offsets.y = offsetRect.y + offsetParent.clientTop;
    }
  }
  if (!isOffsetParentAnElement && documentElement) {
    offsets.x = getWindowScrollBarX(documentElement);
  }
  const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
  const x2 = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
  const y2 = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
  return {
    x: x2,
    y: y2,
    width: rect.width,
    height: rect.height
  };
}
function isStaticPositioned(element) {
  return getComputedStyle2(element).position === "static";
}
function getTrueOffsetParent(element, polyfill) {
  if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") {
    return null;
  }
  if (polyfill) {
    return polyfill(element);
  }
  let rawOffsetParent = element.offsetParent;
  if (getDocumentElement(element) === rawOffsetParent) {
    rawOffsetParent = rawOffsetParent.ownerDocument.body;
  }
  return rawOffsetParent;
}
function getOffsetParent(element, polyfill) {
  const win = getWindow(element);
  if (isTopLayer(element)) {
    return win;
  }
  if (!isHTMLElement(element)) {
    let svgOffsetParent = getParentNode(element);
    while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
      if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
        return svgOffsetParent;
      }
      svgOffsetParent = getParentNode(svgOffsetParent);
    }
    return win;
  }
  let offsetParent = getTrueOffsetParent(element, polyfill);
  while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
    offsetParent = getTrueOffsetParent(offsetParent, polyfill);
  }
  if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
    return win;
  }
  return offsetParent || getContainingBlock(element) || win;
}
var getElementRects = async function(data) {
  const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
  const getDimensionsFn = this.getDimensions;
  const floatingDimensions = await getDimensionsFn(data.floating);
  return {
    reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
    floating: {
      x: 0,
      y: 0,
      width: floatingDimensions.width,
      height: floatingDimensions.height
    }
  };
};
function isRTL(element) {
  return getComputedStyle2(element).direction === "rtl";
}
var platform2 = {
  convertOffsetParentRelativeRectToViewportRelativeRect,
  getDocumentElement,
  getClippingRect,
  getOffsetParent,
  getElementRects,
  getClientRects,
  getDimensions: getDimensions2,
  getScale,
  isElement,
  isRTL
};
function rectsAreEqual(a, b) {
  return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
}
function observeMove(element, onMove, ancestorResize) {
  let io = null;
  let timeoutId;
  const root = getDocumentElement(element);
  function cleanup() {
    var _io;
    clearTimeout(timeoutId);
    (_io = io) == null || _io.disconnect();
    io = null;
  }
  function refresh(skip, threshold) {
    if (skip === void 0) {
      skip = false;
    }
    if (threshold === void 0) {
      threshold = 1;
    }
    cleanup();
    const elementRectForRootMargin = element.getBoundingClientRect();
    const {
      left,
      top,
      width,
      height
    } = elementRectForRootMargin;
    if (!skip) {
      onMove();
    }
    if (!width || !height) {
      return;
    }
    const insetTop = floor(top);
    const insetRight = floor(root.clientWidth - (left + width));
    const insetBottom = floor(root.clientHeight - (top + height));
    const insetLeft = floor(left);
    const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
    const options = {
      rootMargin,
      threshold: max(0, min(1, threshold)) || 1
    };
    let isFirstUpdate = true;
    function handleObserve(entries) {
      const ratio = entries[0].intersectionRatio;
      if (!rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
        return refresh();
      }
      if (ratio !== threshold) {
        if (!isFirstUpdate) {
          return refresh();
        }
        if (!ratio) {
          timeoutId = setTimeout(() => {
            refresh(false, 1e-7);
          }, 1e3);
        } else {
          refresh(false, ratio);
        }
      }
      isFirstUpdate = false;
    }
    try {
      io = new IntersectionObserver(handleObserve, {
        ...options,
        // Handle <iframe>s
        root: root.ownerDocument
      });
    } catch (_e) {
      io = new IntersectionObserver(handleObserve, options);
    }
    io.observe(element);
  }
  const win = getWindow(element);
  const handleResize = () => refresh(ancestorResize);
  win.addEventListener("resize", handleResize);
  refresh(true);
  return () => {
    win.removeEventListener("resize", handleResize);
    cleanup();
  };
}
function autoUpdate(reference, floating, update2, options) {
  if (options === void 0) {
    options = {};
  }
  const {
    ancestorScroll = true,
    ancestorResize = true,
    elementResize = typeof ResizeObserver === "function",
    layoutShift = typeof IntersectionObserver === "function",
    animationFrame = false
  } = options;
  const referenceEl = unwrapElement(reference);
  const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : [];
  ancestors.forEach((ancestor) => {
    ancestorScroll && ancestor.addEventListener("scroll", update2);
    ancestorResize && ancestor.addEventListener("resize", update2);
  });
  const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update2, ancestorResize) : null;
  let reobserveFrame = -1;
  let resizeObserver = null;
  if (elementResize) {
    resizeObserver = new ResizeObserver((_ref) => {
      let [firstEntry] = _ref;
      if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
        resizeObserver.unobserve(floating);
        cancelAnimationFrame(reobserveFrame);
        reobserveFrame = requestAnimationFrame(() => {
          var _resizeObserver;
          (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
        });
      }
      update2();
    });
    if (referenceEl && !animationFrame) {
      resizeObserver.observe(referenceEl);
    }
    if (floating) {
      resizeObserver.observe(floating);
    }
  }
  let frameId;
  let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
  if (animationFrame) {
    frameLoop();
  }
  function frameLoop() {
    const nextRefRect = getBoundingClientRect(reference);
    if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
      update2();
    }
    prevRefRect = nextRefRect;
    frameId = requestAnimationFrame(frameLoop);
  }
  update2();
  return () => {
    var _resizeObserver2;
    ancestors.forEach((ancestor) => {
      ancestorScroll && ancestor.removeEventListener("scroll", update2);
      ancestorResize && ancestor.removeEventListener("resize", update2);
    });
    cleanupIo == null || cleanupIo();
    (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
    resizeObserver = null;
    if (animationFrame) {
      cancelAnimationFrame(frameId);
    }
  };
}
var offset2 = offset;
var shift2 = shift;
var flip2 = flip;
var size2 = size;
var limitShift2 = limitShift;
var computePosition2 = (reference, floating, options) => {
  const cache = /* @__PURE__ */ new Map();
  const mergedOptions = options != null ? options : {};
  const platformWithCache = {
    ...platform2,
    ...mergedOptions.platform,
    _c: cache
  };
  return computePosition(reference, floating, {
    ...mergedOptions,
    platform: platformWithCache
  });
};

// node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs
var React27 = __toESM(require_react(), 1);
var import_react2 = __toESM(require_react(), 1);
var ReactDOM3 = __toESM(require_react_dom(), 1);
var isClient = typeof document !== "undefined";
var noop2 = function noop3() {
};
var index = isClient ? import_react2.useLayoutEffect : noop2;
function deepEqual(a, b) {
  if (a === b) {
    return true;
  }
  if (typeof a !== typeof b) {
    return false;
  }
  if (typeof a === "function" && a.toString() === b.toString()) {
    return true;
  }
  let length2;
  let i;
  let keys;
  if (a && b && typeof a === "object") {
    if (Array.isArray(a)) {
      length2 = a.length;
      if (length2 !== b.length) return false;
      for (i = length2; i-- !== 0; ) {
        if (!deepEqual(a[i], b[i])) {
          return false;
        }
      }
      return true;
    }
    keys = Object.keys(a);
    length2 = keys.length;
    if (length2 !== Object.keys(b).length) {
      return false;
    }
    for (i = length2; i-- !== 0; ) {
      if (!{}.hasOwnProperty.call(b, keys[i])) {
        return false;
      }
    }
    for (i = length2; i-- !== 0; ) {
      const key = keys[i];
      if (key === "_owner" && a.$$typeof) {
        continue;
      }
      if (!deepEqual(a[key], b[key])) {
        return false;
      }
    }
    return true;
  }
  return a !== a && b !== b;
}
function getDPR(element) {
  if (typeof window === "undefined") {
    return 1;
  }
  const win = element.ownerDocument.defaultView || window;
  return win.devicePixelRatio || 1;
}
function roundByDPR(element, value) {
  const dpr = getDPR(element);
  return Math.round(value * dpr) / dpr;
}
function useLatestRef(value) {
  const ref = React27.useRef(value);
  index(() => {
    ref.current = value;
  });
  return ref;
}
function useFloating(options) {
  if (options === void 0) {
    options = {};
  }
  const {
    placement = "bottom",
    strategy = "absolute",
    middleware = [],
    platform: platform3,
    elements: {
      reference: externalReference,
      floating: externalFloating
    } = {},
    transform = true,
    whileElementsMounted,
    open: open3
  } = options;
  const [data, setData] = React27.useState({
    x: 0,
    y: 0,
    strategy,
    placement,
    middlewareData: {},
    isPositioned: false
  });
  const [latestMiddleware, setLatestMiddleware] = React27.useState(middleware);
  if (!deepEqual(latestMiddleware, middleware)) {
    setLatestMiddleware(middleware);
  }
  const [_reference, _setReference] = React27.useState(null);
  const [_floating, _setFloating] = React27.useState(null);
  const setReference = React27.useCallback((node) => {
    if (node !== referenceRef.current) {
      referenceRef.current = node;
      _setReference(node);
    }
  }, []);
  const setFloating = React27.useCallback((node) => {
    if (node !== floatingRef.current) {
      floatingRef.current = node;
      _setFloating(node);
    }
  }, []);
  const referenceEl = externalReference || _reference;
  const floatingEl = externalFloating || _floating;
  const referenceRef = React27.useRef(null);
  const floatingRef = React27.useRef(null);
  const dataRef = React27.useRef(data);
  const hasWhileElementsMounted = whileElementsMounted != null;
  const whileElementsMountedRef = useLatestRef(whileElementsMounted);
  const platformRef = useLatestRef(platform3);
  const openRef = useLatestRef(open3);
  const update2 = React27.useCallback(() => {
    if (!referenceRef.current || !floatingRef.current) {
      return;
    }
    const config = {
      placement,
      strategy,
      middleware: latestMiddleware
    };
    if (platformRef.current) {
      config.platform = platformRef.current;
    }
    computePosition2(referenceRef.current, floatingRef.current, config).then((data2) => {
      const fullData = {
        ...data2,
        // The floating element's position may be recomputed while it's closed
        // but still mounted (such as when transitioning out). To ensure
        // `isPositioned` will be `false` initially on the next open, avoid
        // setting it to `true` when `open === false` (must be specified).
        isPositioned: openRef.current !== false
      };
      if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
        dataRef.current = fullData;
        ReactDOM3.flushSync(() => {
          setData(fullData);
        });
      }
    });
  }, [latestMiddleware, placement, strategy, platformRef, openRef]);
  index(() => {
    if (open3 === false && dataRef.current.isPositioned) {
      dataRef.current.isPositioned = false;
      setData((data2) => ({
        ...data2,
        isPositioned: false
      }));
    }
  }, [open3]);
  const isMountedRef = React27.useRef(false);
  index(() => {
    isMountedRef.current = true;
    return () => {
      isMountedRef.current = false;
    };
  }, []);
  index(() => {
    if (referenceEl) referenceRef.current = referenceEl;
    if (floatingEl) floatingRef.current = floatingEl;
    if (referenceEl && floatingEl) {
      if (whileElementsMountedRef.current) {
        return whileElementsMountedRef.current(referenceEl, floatingEl, update2);
      }
      update2();
    }
  }, [referenceEl, floatingEl, update2, whileElementsMountedRef, hasWhileElementsMounted]);
  const refs = React27.useMemo(() => ({
    reference: referenceRef,
    floating: floatingRef,
    setReference,
    setFloating
  }), [setReference, setFloating]);
  const elements = React27.useMemo(() => ({
    reference: referenceEl,
    floating: floatingEl
  }), [referenceEl, floatingEl]);
  const floatingStyles = React27.useMemo(() => {
    const initialStyles = {
      position: strategy,
      left: 0,
      top: 0
    };
    if (!elements.floating) {
      return initialStyles;
    }
    const x2 = roundByDPR(elements.floating, data.x);
    const y2 = roundByDPR(elements.floating, data.y);
    if (transform) {
      return {
        ...initialStyles,
        transform: "translate(" + x2 + "px, " + y2 + "px)",
        ...getDPR(elements.floating) >= 1.5 && {
          willChange: "transform"
        }
      };
    }
    return {
      position: strategy,
      left: x2,
      top: y2
    };
  }, [strategy, transform, elements.floating, data.x, data.y]);
  return React27.useMemo(() => ({
    ...data,
    update: update2,
    refs,
    elements,
    floatingStyles
  }), [data, update2, refs, elements, floatingStyles]);
}
var offset3 = (options, deps) => {
  const result = offset2(options);
  return {
    name: result.name,
    fn: result.fn,
    options: [options, deps]
  };
};
var shift3 = (options, deps) => {
  const result = shift2(options);
  return {
    name: result.name,
    fn: result.fn,
    options: [options, deps]
  };
};
var limitShift3 = (options, deps) => {
  const result = limitShift2(options);
  return {
    fn: result.fn,
    options: [options, deps]
  };
};
var flip3 = (options, deps) => {
  const result = flip2(options);
  return {
    name: result.name,
    fn: result.fn,
    options: [options, deps]
  };
};
var size3 = (options, deps) => {
  const result = size2(options);
  return {
    name: result.name,
    fn: result.fn,
    options: [options, deps]
  };
};

// node_modules/@base-ui/react/utils/popups/popupHandle.mjs
var BasePopupHandle = class {
  /**
   * Stores of every root currently using this handle, in attach order. A handle is meant to be used
   * by a single mounted root, but roots can transiently overlap (e.g. during an animated route
   * transition), so this stack lets `attachStore`'s cleanup restore the previous root instead of
   * leaving a still-mounted root uncontrollable when a newer overlapping root detaches first.
   */
  attachedStores = [];
  /**
   * Store of the root that currently controls the handle: the most recently attached one still
   * mounted, or `null` when no root is attached. Imperative methods are no-ops while this is `null`.
   */
  attachedStoreValue = null;
  /**
   * Listeners notified when `attachedStore` changes, so detached triggers can follow the store pointer.
   */
  storeListeners = /* @__PURE__ */ new Set();
  /**
   * Creates a handle backed by the store used while no root is attached.
   *
   * @param fallbackStore Inert, closed store handed to detached triggers while no root is attached,
   * so they can render and register without a mounted root. Triggers register into whichever store
   * `store` currently resolves to, so while detached they live in this store's trigger map and
   * migrate themselves to the root's store (and back) as it attaches/detaches.
   * @param componentName Component name used to prefix dev warnings, e.g. `'Menu'` produces
   * `MenuHandle.open()` in warning text.
   * @param throwOnMissingTrigger Whether `open(triggerId)` throws when no trigger with that id is
   * registered. Anchored popups (Menu, Popover, Tooltip, PreviewCard) need a trigger to anchor to,
   * so they throw; Dialog is not anchored and instead opens unassociated with a dev warning.
   */
  constructor(fallbackStore, componentName, throwOnMissingTrigger = true) {
    this.fallbackStore = fallbackStore;
    this.componentName = componentName;
    this.throwOnMissingTrigger = throwOnMissingTrigger;
  }
  get attachedStore() {
    return this.attachedStoreValue;
  }
  /**
   * Store that detached triggers read from: the attached root's store, or an inert fallback store
   * used while no root is attached.
   * @internal
   */
  get store() {
    return this.attachedStoreValue ?? this.fallbackStore;
  }
  /**
   * Stable fallback store used for server rendering and hydration. Root stores cannot be recorded on
   * the handle during render because a handle can be shared by concurrent server-rendered requests.
   * @internal
   */
  get serverStore() {
    return this.fallbackStore;
  }
  /**
   * Subscribes to changes of the attached store pointer so detached triggers re-render and re-bind
   * when a root attaches or detaches. Returns a function that removes the listener.
   * @internal
   */
  subscribeStore(listener) {
    this.storeListeners.add(listener);
    return () => {
      this.storeListeners.delete(listener);
    };
  }
  /**
   * Points the handle at a root's store and notifies subscribers so detached triggers re-render and
   * re-register into it (their registration effect migrates them when the store pointer changes).
   * Returns a cleanup function that detaches the store again.
   * @internal
   */
  attachStore(newStore) {
    this.attachedStores.push(newStore);
    this.setActiveStore(newStore);
    if (true) {
      if (this.attachedStores.length > 1) {
        const dev = this;
        (dev.overlapWarningFrame ??= AnimationFrame.create()).request(() => {
          if (this.attachedStores.length > 1) {
            console.warn("Base UI: A handle is attached to more than one mounted root at the same time. The most recently mounted root takes over and the previous one stops being controlled by the handle. A handle should be used by a single root that stays mounted for the lifetime of the handle.");
          }
        });
      }
    }
    return () => {
      const index3 = this.attachedStores.lastIndexOf(newStore);
      if (index3 !== -1) {
        this.attachedStores.splice(index3, 1);
      }
      this.setActiveStore(this.attachedStores[this.attachedStores.length - 1] ?? null);
    };
  }
  /**
   * Sets the store that currently controls the handle and notifies subscribers when it changes, so
   * detached triggers re-render and migrate their registration to the new store.
   */
  setActiveStore(store2) {
    if (this.attachedStoreValue !== store2) {
      this.attachedStoreValue = store2;
      this.storeListeners.forEach((listener) => {
        listener();
      });
    }
  }
  /**
   * Opens the attached root's store and associates it with the trigger with the given id, or a
   * no-op (with a dev warning) while no root is attached. Shared by every concrete handle's public
   * `open()` method, which only narrows the parameter type.
   *
   * When a trigger id is given but no matching trigger is registered, anchored popups throw (see
   * `throwOnMissingTrigger`); Dialog opens unassociated with a dev warning instead.
   *
   * This method should only be called in an event handler or an effect (not during rendering).
   *
   * @param triggerId ID of the trigger to associate with the popup, or `null`/`undefined` to open
   * without associating any trigger.
   */
  openByTrigger(triggerId) {
    const attachedStore = this.attachedStore;
    if (attachedStore === null) {
      if (true) {
        console.warn(`Base UI: ${this.componentName}Handle.open() was called while no root using this handle is mounted. The call was ignored; mount a root with this handle before opening it imperatively.`);
      }
      return;
    }
    let triggerElement;
    if (triggerId) {
      for (let i = this.attachedStores.length - 1; i >= 0 && !triggerElement; i -= 1) {
        triggerElement = this.attachedStores[i].context.triggerElements.getById(triggerId);
      }
      triggerElement ??= this.fallbackStore.context.triggerElements.getById(triggerId);
    }
    if (triggerId && !triggerElement) {
      if (this.throwOnMissingTrigger) {
        throw new Error(true ? `Base UI: ${this.componentName}Handle.open() was called with the trigger id "${triggerId}", but no matching trigger is registered with this handle. An anchored popup cannot open without a trigger to anchor to. Pass the id of a mounted ${this.componentName}.Trigger that has this handle set on its "handle" prop.` : formatErrorMessage_default(99, this.componentName, triggerId, this.componentName));
      }
      if (true) {
        console.warn(`Base UI: ${this.componentName}Handle.open: No trigger found with id "${triggerId}". The popup will open, but the trigger will not be associated with it.`);
      }
    }
    attachedStore.setOpen(true, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, triggerElement));
  }
  /**
   * Closes the popup by setting the attached root's store to closed, or a no-op (with a dev warning)
   * while no root is attached. Shared by every concrete handle's public `close()` method.
   *
   * This method should only be called in an event handler or an effect (not during rendering).
   */
  closePopup() {
    const attachedStore = this.attachedStore;
    if (attachedStore === null) {
      if (true) {
        console.warn(`Base UI: ${this.componentName}Handle.close() was called while no root using this handle is mounted. The call was ignored.`);
      }
      return;
    }
    attachedStore.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction));
  }
};

// node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs
var React33 = __toESM(require_react(), 1);
var ReactDOM4 = __toESM(require_react_dom(), 1);

// node_modules/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.mjs
var React32 = __toESM(require_react(), 1);

// node_modules/@base-ui/utils/store/useStore.mjs
var React29 = __toESM(require_react(), 1);
var import_shim = __toESM(require_shim(), 1);
var import_with_selector = __toESM(require_with_selector(), 1);

// node_modules/@base-ui/utils/fastHooks.mjs
var React28 = __toESM(require_react(), 1);
var hooks = [];
var currentInstance = void 0;
function getInstance() {
  return currentInstance;
}
function register(hook) {
  hooks.push(hook);
}
function fastComponent(fn) {
  const FastComponent = (props, forwardedRef) => {
    const instance = useRefWithInit(createInstance).current;
    let result;
    try {
      currentInstance = instance;
      for (const hook of hooks) {
        hook.before(instance);
      }
      result = fn(props, forwardedRef);
      for (const hook of hooks) {
        hook.after(instance);
      }
      instance.didInitialize = true;
    } finally {
      currentInstance = void 0;
    }
    return result;
  };
  FastComponent.displayName = fn.displayName || fn.name;
  return FastComponent;
}
function fastComponentRef(fn) {
  return /* @__PURE__ */ React28.forwardRef(fastComponent(fn));
}
function createInstance() {
  return {
    didInitialize: false
  };
}

// node_modules/@base-ui/utils/store/useStore.mjs
var canUseRawUseSyncExternalStore = isReactVersionAtLeast(19);
var useStoreImplementation = canUseRawUseSyncExternalStore ? useStoreFast : useStoreLegacy;
function useStore(store2, selector, a1, a2, a3) {
  return useStoreImplementation(store2, selector, a1, a2, a3);
}
function useStoreR19(store2, selector, a1, a2, a3) {
  const getSelection = React29.useCallback(() => selector(store2.getSnapshot(), a1, a2, a3), [store2, selector, a1, a2, a3]);
  return (0, import_shim.useSyncExternalStore)(store2.subscribe, getSelection, getSelection);
}
register({
  before(instance) {
    instance.syncIndex = 0;
    if (!instance.didInitialize) {
      instance.syncTick = 1;
      instance.syncHooks = [];
      instance.didChangeStore = true;
      instance.getSnapshot = () => {
        let didChange2 = false;
        for (let i = 0; i < instance.syncHooks.length; i += 1) {
          const hook = instance.syncHooks[i];
          const value = hook.selector(hook.store.state, hook.a1, hook.a2, hook.a3);
          if (!Object.is(hook.value, value)) {
            didChange2 = true;
            hook.value = value;
          }
        }
        if (didChange2) {
          instance.syncTick += 1;
        }
        return instance.syncTick;
      };
    }
  },
  after(instance) {
    if (instance.syncHooks.length > 0) {
      if (instance.didChangeStore) {
        instance.didChangeStore = false;
        instance.subscribe = (onStoreChange) => {
          const stores = /* @__PURE__ */ new Set();
          for (const hook of instance.syncHooks) {
            stores.add(hook.store);
          }
          const unsubscribes = [];
          for (const store2 of stores) {
            unsubscribes.push(store2.subscribe(onStoreChange));
          }
          return () => {
            for (const unsubscribe of unsubscribes) {
              unsubscribe();
            }
          };
        };
      }
      (0, import_shim.useSyncExternalStore)(instance.subscribe, instance.getSnapshot, instance.getSnapshot);
    }
  }
});
function useStoreFast(store2, selector, a1, a2, a3) {
  const instance = getInstance();
  if (!instance) {
    return useStoreR19(store2, selector, a1, a2, a3);
  }
  const index3 = instance.syncIndex;
  instance.syncIndex += 1;
  let hook;
  if (!instance.didInitialize) {
    hook = {
      store: store2,
      selector,
      a1,
      a2,
      a3,
      value: selector(store2.getSnapshot(), a1, a2, a3)
    };
    instance.syncHooks.push(hook);
  } else {
    hook = instance.syncHooks[index3];
    if (hook.store !== store2 || hook.selector !== selector || !Object.is(hook.a1, a1) || !Object.is(hook.a2, a2) || !Object.is(hook.a3, a3)) {
      if (hook.store !== store2) {
        instance.didChangeStore = true;
      }
      hook.store = store2;
      hook.selector = selector;
      hook.a1 = a1;
      hook.a2 = a2;
      hook.a3 = a3;
      hook.value = selector(store2.getSnapshot(), a1, a2, a3);
    }
  }
  return hook.value;
}
function useStoreLegacy(store2, selector, a1, a2, a3) {
  return (0, import_with_selector.useSyncExternalStoreWithSelector)(store2.subscribe, store2.getSnapshot, store2.getSnapshot, (state) => selector(state, a1, a2, a3));
}

// node_modules/@base-ui/utils/store/Store.mjs
var Store = class {
  /**
   * Creates a store with the given initial state, constructing the class it is called on.
   * Calling it on a generic base class (e.g. `ReactStore.create(...)`) constructs that
   * class but degrades the inferred instance type to `Store`; use `new` there instead.
   */
  static create(state) {
    return new this(state);
  }
  /**
   * The current state of the store.
   * This property is updated immediately when the state changes as a result of calling {@link setState}, {@link update}, or {@link set}.
   * To subscribe to state changes, use the {@link useState} method. The value returned by {@link useState} is updated after the component renders (similarly to React's useState).
   * The values can be used directly (to avoid subscribing to the store) in effects or event handlers.
   *
   * Do not modify properties in state directly. Instead, use the provided methods to ensure proper state management and listener notification.
   */
  // Internal state to handle recursive `setState()` calls
  constructor(state) {
    this.state = state;
    this.listeners = /* @__PURE__ */ new Set();
    this.updateTick = 0;
  }
  /**
   * Registers a listener that will be called whenever the store's state changes.
   *
   * @param fn The listener function to be called on state changes.
   * @returns A function to unsubscribe the listener.
   */
  subscribe = (fn) => {
    this.listeners.add(fn);
    return () => {
      this.listeners.delete(fn);
    };
  };
  /**
   * Returns the current state of the store.
   */
  getSnapshot = () => {
    return this.state;
  };
  /**
   * Updates the entire store's state and notifies all registered listeners.
   *
   * @param newState The new state to set for the store.
   */
  setState(newState) {
    if (this.state === newState) {
      return;
    }
    this.state = newState;
    this.updateTick += 1;
    const currentTick = this.updateTick;
    for (const listener of this.listeners) {
      if (currentTick !== this.updateTick) {
        return;
      }
      listener(newState);
    }
  }
  /**
   * Merges the provided changes into the current state and notifies listeners if there are changes.
   * Each value must match its state key. Pass an exact known subset rather than a broad
   * `Partial<State>`, which may contain `undefined` for required state fields.
   *
   * @param changes An object containing the changes to apply to the current state.
   */
  update(changes) {
    for (const key in changes) {
      if (!Object.is(this.state[key], changes[key])) {
        this.setState({
          ...this.state,
          ...changes
        });
        return;
      }
    }
  }
  /**
   * Sets a specific key in the store's state to a new value and notifies listeners if the value has changed.
   *
   * @param key The key in the store's state to update.
   * @param value The new value to set for the specified key.
   */
  set(key, value) {
    if (!Object.is(this.state[key], value)) {
      this.setState({
        ...this.state,
        [key]: value
      });
    }
  }
  /**
   * Gives the state a new reference and updates all registered listeners.
   */
  notifyAll() {
    const newState = {
      ...this.state
    };
    this.setState(newState);
  }
  use(selector, a1, a2, a3) {
    return useStore(this, selector, a1, a2, a3);
  }
};

// node_modules/@base-ui/utils/store/ReactStore.mjs
var React30 = __toESM(require_react(), 1);
var ReactStore = class extends Store {
  /**
   * Creates a new ReactStore instance.
   *
   * @param state Initial state of the store.
   * @param context Non-reactive context values.
   * @param selectors Optional selectors for use with `useState`.
   */
  constructor(state, context = {}, selectors3) {
    super(state);
    this.context = context;
    this.selectors = selectors3;
  }
  /**
   * Non-reactive values such as refs, callbacks, etc.
   */
  /**
   * Synchronizes a single external value into the store.
   *
   * Note that the while the value in `state` is updated immediately, the value returned
   * by `useState` is updated before the next render (similarly to React's `useState`).
   */
  useSyncedValue(key, value) {
    React30.useDebugValue(key);
    const store2 = this;
    useIsoLayoutEffect(() => {
      if (store2.state[key] !== value) {
        store2.set(key, value);
      }
    }, [store2, key, value]);
  }
  /**
   * Synchronizes a single external value into the store and
   * cleans it up (sets to `undefined`) on unmount.
   *
   * Note that the while the value in `state` is updated immediately, the value returned
   * by `useState` is updated before the next render (similarly to React's `useState`).
   */
  useSyncedValueWithCleanup(key, value) {
    const store2 = this;
    useIsoLayoutEffect(() => {
      if (store2.state[key] !== value) {
        store2.set(key, value);
      }
      return () => {
        store2.set(key, void 0);
      };
    }, [store2, key, value]);
  }
  /**
   * Synchronizes multiple external values into the store.
   * Each value must match its state key. Pass an exact known subset rather than a broad
   * `Partial<State>`, which may contain `undefined` for required state fields.
   *
   * Note that the while the values in `state` are updated immediately, the values returned
   * by `useState` are updated before the next render (similarly to React's `useState`).
   *
   * @param statePart An exact subset of state fields to synchronize. Unknown keys are not accepted.
   */
  useSyncedValues(statePart) {
    const store2 = this;
    if (true) {
      React30.useDebugValue(statePart, (p2) => Object.keys(p2));
      const keys = React30.useRef(Object.keys(statePart)).current;
      const nextKeys = Object.keys(statePart);
      if (keys.length !== nextKeys.length || keys.some((key, index3) => key !== nextKeys[index3])) {
        console.error("ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable.");
      }
    }
    const dependencies = Object.values(statePart);
    useIsoLayoutEffect(() => {
      store2.update(statePart);
    }, [store2, ...dependencies]);
  }
  /**
   * Registers a controllable prop pair (`controlled`, `defaultValue`) for a specific key. If `controlled`
   * is non-undefined, the store's state at `key` is updated to match `controlled`.
   */
  useControlledProp(key, controlled) {
    React30.useDebugValue(key);
    const store2 = this;
    const isControlled = controlled !== void 0;
    useIsoLayoutEffect(() => {
      if (isControlled && !Object.is(store2.state[key], controlled)) {
        store2.setState({
          ...store2.state,
          [key]: controlled
        });
      }
    }, [store2, key, controlled, isControlled]);
    if (true) {
      const cache = this.controlledValues ??= /* @__PURE__ */ new Map();
      if (!cache.has(key)) {
        cache.set(key, isControlled);
      }
      const previouslyControlled = cache.get(key);
      if (previouslyControlled !== void 0 && previouslyControlled !== isControlled) {
        console.error(`A component is changing the ${isControlled ? "" : "un"}controlled state of ${key.toString()} to be ${isControlled ? "un" : ""}controlled. Elements should not switch from uncontrolled to controlled (or vice versa).`);
      }
    }
  }
  /** Gets the current value from the store using a selector with the provided key.
   *
   * @param key Key of the selector to use.
   */
  select(key, a1, a2, a3) {
    const selector = this.selectors[key];
    return selector(this.state, a1, a2, a3);
  }
  /**
   * Returns a value from the store's state using a selector function.
   * Used to subscribe to specific parts of the state.
   * This methods causes a rerender whenever the selected state changes.
   *
   * @param key Key of the selector to use.
   */
  useState(key, a1, a2, a3) {
    React30.useDebugValue(key);
    return useStore(this, this.selectors[key], a1, a2, a3);
  }
  /**
   * Wraps a function with `useStableCallback` to ensure it has a stable reference
   * and assigns it to the context.
   *
   * @param key Key of the event callback. Must be a function in the context.
   * @param fn Function to assign.
   */
  useContextCallback(key, fn) {
    React30.useDebugValue(key);
    const stableFunction = useStableCallback(fn ?? NOOP);
    this.context[key] = stableFunction;
  }
  /**
   * Returns a stable setter function for a specific key in the store's state.
   * It's commonly used to pass as a ref callback to React elements.
   *
   * @param key Key of the state to set.
   */
  useStateSetter(key) {
    const ref = React30.useRef(void 0);
    if (ref.current === void 0) {
      ref.current = (value) => {
        this.set(key, value);
      };
    }
    return ref.current;
  }
  /**
   * Observes changes derived from the store's selectors and calls the listener when the selected value changes.
   *
   * @param key Key of the selector to observe.
   * @param listener Listener function called when the selector result changes.
   */
  observe(selector, listener) {
    let selectFn;
    if (typeof selector === "function") {
      selectFn = selector;
    } else {
      selectFn = this.selectors[selector];
    }
    let prevValue = selectFn(this.state);
    listener(prevValue, prevValue, this);
    return this.subscribe((nextState) => {
      const nextValue = selectFn(nextState);
      if (!Object.is(prevValue, nextValue)) {
        const oldValue = prevValue;
        prevValue = nextValue;
        listener(nextValue, oldValue, this);
      }
    });
  }
};

// node_modules/@base-ui/utils/useForcedRerendering.mjs
var React31 = __toESM(require_react(), 1);
function useForcedRerendering() {
  const [, setState] = React31.useState({});
  return React31.useCallback(() => {
    setState({});
  }, []);
}

// node_modules/@base-ui/react/floating-ui-react/components/FloatingRootStore.mjs
var selectors = {
  open: (state) => state.open,
  transitionStatus: (state) => state.transitionStatus,
  domReferenceElement: (state) => state.domReferenceElement,
  referenceElement: (state) => state.positionReference ?? state.referenceElement,
  floatingElement: (state) => state.floatingElement,
  floatingId: (state) => state.floatingId
};
var FloatingRootStore = class extends ReactStore {
  constructor(options) {
    const {
      syncOnly,
      nested,
      onOpenChange,
      triggerElements,
      ...initialState
    } = options;
    super({
      ...initialState,
      positionReference: initialState.referenceElement,
      domReferenceElement: initialState.referenceElement
    }, {
      onOpenChange,
      dataRef: {
        current: {}
      },
      events: createEventEmitter(),
      nested,
      triggerElements
    }, selectors);
    this.syncOnly = syncOnly;
  }
  /**
   * Syncs the event used by hover logic to distinguish hover-open from click-like interaction.
   */
  syncOpenEvent = (newOpen, event) => {
    if (!newOpen || !this.state.open || // Prevent a pending hover-open from overwriting a click-open event, while allowing
    // click events to upgrade a hover-open.
    event != null && isClickLikeEvent(event)) {
      this.context.dataRef.current.openEvent = newOpen ? event : void 0;
    }
  };
  /**
   * Runs the root-owned side effects for an open state change.
   */
  dispatchOpenChange = (newOpen, eventDetails) => {
    this.syncOpenEvent(newOpen, eventDetails.event);
    const details = {
      open: newOpen,
      reason: eventDetails.reason,
      nativeEvent: eventDetails.event,
      nested: this.context.nested,
      triggerElement: eventDetails.trigger
    };
    this.context.events.emit("openchange", details);
  };
  /**
   * Emits the `openchange` event through the internal event emitter and calls the `onOpenChange` handler with the provided arguments.
   *
   * @param newOpen The new open state.
   * @param eventDetails Details about the event that triggered the open state change.
   */
  setOpen = (newOpen, eventDetails) => {
    if (this.syncOnly) {
      this.context.onOpenChange?.(newOpen, eventDetails);
      return;
    }
    this.dispatchOpenChange(newOpen, eventDetails);
    this.context.onOpenChange?.(newOpen, eventDetails);
  };
};

// node_modules/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.mjs
function useSyncedFloatingRootContext(options) {
  const {
    popupStore,
    treatPopupAsFloatingElement = false,
    floatingRootContext: floatingRootContextProp,
    floatingId,
    nested,
    onOpenChange
  } = options;
  const open3 = popupStore.useState("open");
  const referenceElement = popupStore.useState("activeTriggerElement");
  const floatingElement = popupStore.useState(treatPopupAsFloatingElement ? "popupElement" : "positionerElement");
  const triggerElements = popupStore.context.triggerElements;
  const handleOpenChange = onOpenChange;
  const internalStoreRef = React32.useRef(null);
  if (floatingRootContextProp === void 0 && internalStoreRef.current === null) {
    internalStoreRef.current = new FloatingRootStore({
      open: open3,
      transitionStatus: void 0,
      referenceElement,
      floatingElement,
      triggerElements,
      onOpenChange: handleOpenChange,
      floatingId,
      syncOnly: true,
      nested
    });
  }
  const store2 = floatingRootContextProp ?? internalStoreRef.current;
  popupStore.useSyncedValue("floatingId", floatingId);
  useIsoLayoutEffect(() => {
    const valuesToSync = {
      open: open3,
      floatingId,
      referenceElement,
      floatingElement
    };
    if (isElement(referenceElement)) {
      valuesToSync.domReferenceElement = referenceElement;
    }
    if (store2.state.positionReference === store2.state.referenceElement) {
      valuesToSync.positionReference = referenceElement;
    }
    store2.update(valuesToSync);
  }, [open3, floatingId, referenceElement, floatingElement, store2]);
  store2.context.onOpenChange = handleOpenChange;
  store2.context.nested = nested;
  return store2;
}

// node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs
var FOCUSABLE_POPUP_PROPS = {
  tabIndex: -1,
  [FOCUSABLE_ATTRIBUTE]: ""
};
function usePopupRootStore(createStore, treatPopupAsFloatingElement = false) {
  const floatingId = useId();
  const nested = useFloatingParentNodeId() != null;
  const store2 = useRefWithInit(() => createStore(floatingId, nested)).current;
  useSyncedFloatingRootContext({
    popupStore: store2,
    treatPopupAsFloatingElement,
    floatingRootContext: store2.state.floatingRootContext,
    floatingId,
    nested,
    onOpenChange: store2.setOpen
  });
  return store2;
}
function PopupHandleAttachment({
  handle,
  store: store2
}) {
  useIsoLayoutEffect(() => {
    return handle.attachStore(store2);
  }, [handle, store2]);
  return null;
}
function syncTriggerCount(store2) {
  const triggerCount = store2.context.triggerElements.size;
  if (store2.select("open") && store2.state.triggerCount !== triggerCount) {
    store2.set("triggerCount", triggerCount);
  }
}
function useTriggerRegistration(id, store2) {
  const registrationRef = React33.useRef(null);
  return useStableCallback((element) => {
    const registration = registrationRef.current;
    if (registration !== null) {
      if (registration.element === element && registration.store === store2 && registration.id === id) {
        return;
      }
      registrationRef.current = null;
      const registeredStore = registration.store;
      if (registeredStore.context.triggerElements.getById(registration.id) === registration.element) {
        registeredStore.context.triggerElements.delete(registration.id);
        syncTriggerCount(registeredStore);
      }
    }
    if (element !== null && id !== void 0) {
      registrationRef.current = {
        store: store2,
        id,
        element
      };
      store2.context.triggerElements.add(id, element);
      syncTriggerCount(store2);
    }
  });
}
function createPopupOpenState(state, open3, trigger, preventUnmountOnClose = false) {
  let preventUnmountingOnClose = state.preventUnmountingOnClose;
  if (open3) {
    preventUnmountingOnClose = false;
  } else if (preventUnmountOnClose) {
    preventUnmountingOnClose = true;
  }
  const triggerId = trigger?.id ?? null;
  let activeTriggerId = state.activeTriggerId;
  let activeTriggerElement = state.activeTriggerElement;
  if (triggerId || open3) {
    activeTriggerId = triggerId;
    activeTriggerElement = trigger ?? null;
  }
  return {
    open: open3,
    preventUnmountingOnClose,
    activeTriggerId,
    activeTriggerElement
  };
}
function attachPreventUnmountOnClose(eventDetails) {
  let preventUnmountOnClose = false;
  eventDetails.preventUnmountOnClose = () => {
    preventUnmountOnClose = true;
  };
  return () => preventUnmountOnClose;
}
function applyPopupOpenChange(store2, nextOpen, eventDetails, options = {}) {
  const reason = eventDetails.reason;
  const isHover = reason === reason_parts_exports.triggerHover;
  const isFocusOpen = nextOpen && reason === reason_parts_exports.triggerFocus;
  const isDismissClose = !nextOpen && (reason === reason_parts_exports.triggerPress || reason === reason_parts_exports.escapeKey);
  const shouldPreventUnmountOnClose = attachPreventUnmountOnClose(eventDetails);
  store2.context.onOpenChange?.(nextOpen, eventDetails);
  if (eventDetails.isCanceled) {
    return;
  }
  options.onBeforeDispatch?.();
  store2.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails);
  const changeState = () => {
    const popupOpenState = createPopupOpenState(store2.state, nextOpen, eventDetails.trigger, shouldPreventUnmountOnClose());
    const updatedState = {
      ...options.extraState,
      ...popupOpenState
    };
    if (isFocusOpen) {
      updatedState.instantType = "focus";
    } else if (isDismissClose) {
      updatedState.instantType = "dismiss";
    } else if (isHover) {
      updatedState.instantType = void 0;
    }
    store2.update(updatedState);
  };
  if (isHover) {
    ReactDOM4.flushSync(changeState);
  } else {
    changeState();
  }
}
function useTriggerDataForwarding(triggerId, triggerElementRef, store2, stateUpdates) {
  const isMountedByThisTrigger = store2.useState("isMountedByTrigger", triggerId);
  const baseRegisterTrigger = useTriggerRegistration(triggerId, store2);
  const applyTriggerData = useStableCallback((element) => {
    const open3 = store2.select("open");
    const activeTriggerId = store2.select("activeTriggerId");
    if (activeTriggerId === triggerId) {
      const changes = {
        activeTriggerElement: element,
        ...open3 ? stateUpdates : null
      };
      store2.update(changes);
      return;
    }
    if (activeTriggerId == null && open3) {
      const changes = {
        activeTriggerId: triggerId ?? null,
        activeTriggerElement: element,
        ...stateUpdates
      };
      store2.update(changes);
    }
  });
  const registerTrigger = useStableCallback((element) => {
    baseRegisterTrigger(element);
    if (element) {
      applyTriggerData(element);
    }
  });
  useIsoLayoutEffect(() => {
    registerTrigger(triggerElementRef.current);
    return () => registerTrigger(null);
  }, [registerTrigger, triggerElementRef, store2, triggerId]);
  useIsoLayoutEffect(() => {
    if (isMountedByThisTrigger) {
      const changes = {
        activeTriggerElement: triggerElementRef.current,
        ...stateUpdates
      };
      store2.update(changes);
    }
  }, [isMountedByThisTrigger, store2, triggerElementRef, ...Object.values(stateUpdates)]);
  return {
    registerTrigger,
    isMountedByThisTrigger
  };
}
function useImplicitActiveTrigger(store2, options = {}) {
  const {
    closeOnActiveTriggerUnmount = false
  } = options;
  const resolvedActiveTriggerIdRef = React33.useRef(null);
  const open3 = store2.useState("open");
  const reactiveTriggerCount = store2.useState("triggerCount");
  const activeTriggerId = store2.useState("activeTriggerId");
  const reactiveActiveTriggerElement = store2.useState("activeTriggerElement");
  useIsoLayoutEffect(() => {
    if (!open3) {
      resolvedActiveTriggerIdRef.current = null;
      if (store2.state.triggerCount !== 0) {
        store2.set("triggerCount", 0);
      }
      return;
    }
    const triggerCount = store2.context.triggerElements.size;
    const stateUpdates = {};
    if (store2.state.triggerCount !== triggerCount) {
      stateUpdates.triggerCount = triggerCount;
    }
    const currentActiveTriggerId = store2.select("activeTriggerId");
    let lostActiveTriggerId = null;
    if (currentActiveTriggerId) {
      const activeTriggerElement = store2.context.triggerElements.getById(currentActiveTriggerId);
      if (!activeTriggerElement) {
        for (const [triggerId, triggerElement] of store2.context.triggerElements.entries()) {
          if (triggerElement === store2.state.activeTriggerElement) {
            stateUpdates.activeTriggerId = triggerId;
            stateUpdates.activeTriggerElement = triggerElement;
            resolvedActiveTriggerIdRef.current = triggerId;
            break;
          }
        }
        if (stateUpdates.activeTriggerId === void 0) {
          if (resolvedActiveTriggerIdRef.current === currentActiveTriggerId) {
            lostActiveTriggerId = currentActiveTriggerId;
          } else {
            resolvedActiveTriggerIdRef.current = null;
          }
        }
      } else {
        resolvedActiveTriggerIdRef.current = currentActiveTriggerId;
        if (activeTriggerElement !== store2.state.activeTriggerElement) {
          stateUpdates.activeTriggerElement = activeTriggerElement;
        }
      }
    } else {
      resolvedActiveTriggerIdRef.current = null;
    }
    if (!lostActiveTriggerId && !currentActiveTriggerId && triggerCount === 1) {
      const iteratorResult = store2.context.triggerElements.entries().next();
      if (!iteratorResult.done) {
        const [implicitTriggerId, implicitTriggerElement] = iteratorResult.value;
        stateUpdates.activeTriggerId = implicitTriggerId;
        stateUpdates.activeTriggerElement = implicitTriggerElement;
        resolvedActiveTriggerIdRef.current = implicitTriggerId;
      }
    }
    if (stateUpdates.triggerCount !== void 0 || stateUpdates.activeTriggerId !== void 0 || stateUpdates.activeTriggerElement !== void 0) {
      store2.update(stateUpdates);
    }
    if (lostActiveTriggerId) {
      if (closeOnActiveTriggerUnmount) {
        queueMicrotask(() => {
          if (store2.select("open") && store2.select("activeTriggerId") === lostActiveTriggerId && !store2.context.triggerElements.getById(lostActiveTriggerId)) {
            const eventDetails = createChangeEventDetails(reason_parts_exports.none);
            store2.setOpen(false, eventDetails);
            if (!eventDetails.isCanceled) {
              store2.update({
                activeTriggerId: null,
                activeTriggerElement: null
              });
            }
          }
        });
      }
    }
  }, [open3, store2, reactiveTriggerCount, activeTriggerId, reactiveActiveTriggerElement, closeOnActiveTriggerUnmount]);
}
function useOpenStateTransitions(open3, store2, onUnmount, animateInitialOpen) {
  const {
    mounted,
    setMounted,
    transitionStatus
  } = useTransitionStatus(open3, false, false, animateInitialOpen);
  const preventUnmountingOnClose = store2.useState("preventUnmountingOnClose");
  const syncedPreventUnmountingOnClose = open3 ? false : preventUnmountingOnClose;
  store2.useSyncedValues({
    mounted,
    transitionStatus,
    preventUnmountingOnClose: syncedPreventUnmountingOnClose
  });
  const forceUnmount = useStableCallback(() => {
    setMounted(false);
    store2.update({
      activeTriggerId: null,
      activeTriggerElement: null,
      mounted: false,
      preventUnmountingOnClose: false
    });
    onUnmount?.();
    store2.context.onOpenChangeComplete?.(false);
  });
  useOpenChangeComplete({
    enabled: mounted && !open3 && !syncedPreventUnmountingOnClose,
    open: open3,
    ref: store2.context.popupRef,
    onComplete() {
      if (!open3) {
        forceUnmount();
      }
    }
  });
  return {
    forceUnmount,
    transitionStatus
  };
}
function usePopupInteractionProps(store2, statePart) {
  store2.useSyncedValues(statePart);
  useIsoLayoutEffect(() => () => {
    store2.update({
      activeTriggerProps: EMPTY_OBJECT,
      inactiveTriggerProps: EMPTY_OBJECT,
      popupProps: EMPTY_OBJECT
    });
  }, [store2]);
}

// node_modules/@base-ui/react/utils/popups/popupTriggerMap.mjs
var devElementIdsByMap;
function getDevElementIds(map) {
  devElementIdsByMap ??= /* @__PURE__ */ new WeakMap();
  let elementIds = devElementIdsByMap.get(map);
  if (!elementIds) {
    elementIds = /* @__PURE__ */ new WeakMap();
    devElementIdsByMap.set(map, elementIds);
  }
  return elementIds;
}
var PopupTriggerMap = class {
  constructor() {
    this.idMap = /* @__PURE__ */ new Map();
  }
  /**
   * Adds a trigger element with the given ID.
   *
   * Note: The provided element is assumed to not be registered under multiple IDs.
   */
  add(id, element) {
    if (true) {
      const elementIds = getDevElementIds(this);
      const existingId = elementIds.get(element);
      if (existingId !== void 0 && existingId !== id) {
        throw new Error("Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap.");
      }
      const previousElement = this.idMap.get(id);
      if (previousElement !== void 0 && previousElement !== element) {
        elementIds.delete(previousElement);
      }
      elementIds.set(element, id);
    }
    this.idMap.set(id, element);
  }
  /**
   * Removes the trigger element with the given ID.
   */
  delete(id) {
    if (true) {
      const element = this.idMap.get(id);
      if (element !== void 0) {
        devElementIdsByMap?.get(this)?.delete(element);
      }
    }
    this.idMap.delete(id);
  }
  /**
   * Whether the given element is registered as a trigger.
   */
  hasElement(element) {
    for (const registered of this.idMap.values()) {
      if (registered === element) {
        return true;
      }
    }
    return false;
  }
  /**
   * Whether there is a registered trigger element matching the given predicate.
   */
  hasMatchingElement(predicate) {
    for (const element of this.idMap.values()) {
      if (predicate(element)) {
        return true;
      }
    }
    return false;
  }
  /**
   * Returns the trigger element associated with the given ID, or undefined if no such element exists.
   */
  getById(id) {
    return this.idMap.get(id);
  }
  /**
   * Returns an iterable of all registered trigger entries, where each entry is a tuple of [id, element].
   */
  entries() {
    return this.idMap.entries();
  }
  /**
   * Returns an iterable of all registered trigger elements.
   */
  elements() {
    return this.idMap.values();
  }
  /**
   * Returns the number of registered trigger elements.
   */
  get size() {
    return this.idMap.size;
  }
};

// node_modules/@base-ui/react/utils/popups/store.mjs
function createInitialPopupStoreState(triggerElements, floatingId, nested = false) {
  return {
    open: false,
    openProp: void 0,
    mounted: false,
    transitionStatus: void 0,
    floatingRootContext: new FloatingRootStore({
      open: false,
      transitionStatus: void 0,
      floatingElement: null,
      referenceElement: null,
      triggerElements,
      floatingId,
      syncOnly: true,
      nested,
      onOpenChange: void 0
    }),
    floatingId,
    triggerCount: 0,
    preventUnmountingOnClose: false,
    payload: void 0,
    activeTriggerId: null,
    activeTriggerElement: null,
    triggerIdProp: void 0,
    popupElement: null,
    positionerElement: null,
    activeTriggerProps: EMPTY_OBJECT,
    inactiveTriggerProps: EMPTY_OBJECT,
    popupProps: EMPTY_OBJECT
  };
}
var activeTriggerIdSelector = (state) => state.triggerIdProp ?? state.activeTriggerId;
var openSelector = (state) => state.openProp ?? state.open;
var popupIdSelector = (state) => {
  const popupId = state.popupElement?.id ?? state.floatingId;
  return popupId || void 0;
};
function triggerOwnsOpenPopup(state, triggerId) {
  return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) === triggerId;
}
function triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) {
  if (triggerOwnsOpenPopup(state, triggerId)) {
    return true;
  }
  return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) == null && state.triggerCount === 1;
}
var popupStoreSelectors = {
  open: openSelector,
  mounted: (state) => state.mounted,
  transitionStatus: (state) => state.transitionStatus,
  floatingRootContext: (state) => state.floatingRootContext,
  triggerCount: (state) => state.triggerCount,
  preventUnmountingOnClose: (state) => state.preventUnmountingOnClose,
  payload: (state) => state.payload,
  activeTriggerId: activeTriggerIdSelector,
  activeTriggerElement: (state) => state.mounted ? state.activeTriggerElement : null,
  popupId: popupIdSelector,
  /**
   * Whether the trigger with the given ID was used to open the popup.
   */
  isTriggerActive: (state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId,
  /**
   * Whether the popup is open and was activated by a trigger with the given ID.
   */
  isOpenedByTrigger: (state, triggerId) => triggerOwnsOpenPopup(state, triggerId),
  /**
   * Whether the popup is mounted and was activated by a trigger with the given ID.
   */
  isMountedByTrigger: (state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId && state.mounted,
  triggerProps: (state, isActive) => isActive ? state.activeTriggerProps : state.inactiveTriggerProps,
  /**
   * Popup id for the trigger that currently owns the open popup.
   */
  triggerPopupId: (state, triggerId) => triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) ? popupIdSelector(state) : void 0,
  popupProps: (state) => state.popupProps,
  popupElement: (state) => state.popupElement,
  positionerElement: (state) => state.positionerElement
};

// node_modules/@base-ui/react/utils/popups/usePopupHandleStore.mjs
var React34 = __toESM(require_react(), 1);
var import_shim2 = __toESM(require_shim(), 1);
function usePopupHandleStore(handle) {
  const subscribe2 = React34.useCallback((listener) => {
    if (handle === void 0) {
      return NOOP;
    }
    return handle.subscribeStore(listener);
  }, [handle]);
  const getSnapshot2 = React34.useCallback(() => {
    return handle === void 0 ? void 0 : handle.store;
  }, [handle]);
  return (0, import_shim2.useSyncExternalStore)(subscribe2, getSnapshot2, () => handle?.serverStore);
}

// node_modules/@base-ui/react/floating-ui-react/hooks/useFloating.mjs
function useBaseUIFloating(options) {
  return useFloatingWithStore(options, options.rootContext);
}
function useFloatingWithStore(options, store2) {
  const {
    nodeId,
    externalTree
  } = options;
  const referenceElement = store2.useState("referenceElement");
  const floatingElement = store2.useState("floatingElement");
  const domReferenceElement = store2.useState("domReferenceElement");
  const open3 = store2.useState("open");
  const floatingId = store2.useState("floatingId");
  const [positionReference, setPositionReferenceRaw] = React35.useState(null);
  const [localDomReference, setLocalDomReference] = React35.useState(void 0);
  const [localFloatingElement, setLocalFloatingElement] = React35.useState(void 0);
  const domReferenceRef = React35.useRef(null);
  const tree = useFloatingTree(externalTree);
  const storeElements = React35.useMemo(() => ({
    reference: referenceElement,
    floating: floatingElement,
    domReference: domReferenceElement
  }), [referenceElement, floatingElement, domReferenceElement]);
  const position = useFloating({
    ...options,
    elements: {
      ...storeElements,
      ...positionReference && {
        reference: positionReference
      }
    }
  });
  const localDomReferenceElement = isElement(localDomReference) ? localDomReference : null;
  const syncedFloatingElement = localFloatingElement === void 0 ? store2.state.floatingElement : localFloatingElement;
  store2.useSyncedValue("referenceElement", localDomReference ?? null);
  store2.useSyncedValue("domReferenceElement", localDomReference === void 0 ? domReferenceElement : localDomReferenceElement);
  store2.useSyncedValue("floatingElement", syncedFloatingElement);
  const setPositionReference = React35.useCallback((node) => {
    const computedPositionReference = isElement(node) ? {
      getBoundingClientRect: () => node.getBoundingClientRect(),
      getClientRects: () => node.getClientRects(),
      contextElement: node
    } : node;
    setPositionReferenceRaw(computedPositionReference);
    position.refs.setReference(computedPositionReference);
  }, [position.refs]);
  const setReference = React35.useCallback((node) => {
    if (isElement(node) || node === null) {
      domReferenceRef.current = node;
      setLocalDomReference(node);
    }
    if (isElement(position.refs.reference.current) || position.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
    // `null` to support `positionReference` + an unstable `reference`
    // callback ref.
    node !== null && !isElement(node)) {
      position.refs.setReference(node);
    }
  }, [position.refs, setLocalDomReference]);
  const setFloating = React35.useCallback((node) => {
    setLocalFloatingElement(node);
    position.refs.setFloating(node);
  }, [position.refs]);
  const refs = React35.useMemo(() => ({
    ...position.refs,
    setReference,
    setFloating,
    setPositionReference,
    domReference: domReferenceRef
  }), [position.refs, setReference, setFloating, setPositionReference]);
  const elements = React35.useMemo(() => ({
    ...position.elements,
    domReference: domReferenceElement
  }), [position.elements, domReferenceElement]);
  const context = React35.useMemo(() => ({
    ...position,
    dataRef: store2.context.dataRef,
    open: open3,
    onOpenChange: store2.setOpen,
    events: store2.context.events,
    floatingId,
    refs,
    elements,
    nodeId,
    rootStore: store2
  }), [position, refs, elements, nodeId, store2, open3, floatingId]);
  useIsoLayoutEffect(() => {
    if (domReferenceElement) {
      domReferenceRef.current = domReferenceElement;
    }
  }, [domReferenceElement]);
  useIsoLayoutEffect(() => {
    store2.context.dataRef.current.floatingContext = context;
    const node = tree?.nodesRef.current.find((n) => n.id === nodeId);
    if (node) {
      node.context = context;
    }
  });
  return React35.useMemo(() => ({
    ...position,
    context,
    refs,
    elements,
    rootStore: store2
  }), [position, refs, elements, context, store2]);
}

// node_modules/@base-ui/react/floating-ui-react/hooks/useFocus.mjs
var React36 = __toESM(require_react(), 1);
var isMacSafari = parts_exports.os.mac && parts_exports.engine.webkit;
function useFocus(context, props = {}) {
  const {
    enabled = true,
    delay
  } = props;
  const store2 = "rootStore" in context ? context.rootStore : context;
  const {
    events,
    dataRef
  } = store2.context;
  const blockFocusRef = React36.useRef(false);
  const blockedReferenceRef = React36.useRef(null);
  const keyboardModalityRef = React36.useRef(true);
  const timeout = useTimeout();
  React36.useEffect(() => {
    const domReference = store2.select("domReferenceElement");
    if (!enabled) {
      return void 0;
    }
    const win = getWindow(domReference);
    function onBlur() {
      const currentDomReference = store2.select("domReferenceElement");
      if (!store2.select("open") && isHTMLElement(currentDomReference) && currentDomReference === activeElement(ownerDocument(currentDomReference))) {
        blockFocusRef.current = true;
        blockedReferenceRef.current = currentDomReference;
      }
    }
    function onKeyDown() {
      keyboardModalityRef.current = true;
    }
    function onPointerDown() {
      keyboardModalityRef.current = false;
    }
    return mergeCleanups(addEventListener(win, "blur", onBlur), isMacSafari && addEventListener(win, "keydown", onKeyDown, true), isMacSafari && addEventListener(win, "pointerdown", onPointerDown, true));
  }, [store2, enabled]);
  React36.useEffect(() => {
    if (!enabled) {
      return void 0;
    }
    function onOpenChangeLocal(details) {
      if (details.reason === reason_parts_exports.triggerPress || details.reason === reason_parts_exports.escapeKey) {
        const referenceElement = store2.select("domReferenceElement");
        if (isElement(referenceElement)) {
          blockedReferenceRef.current = referenceElement;
          blockFocusRef.current = true;
        }
      }
    }
    events.on("openchange", onOpenChangeLocal);
    return () => {
      events.off("openchange", onOpenChangeLocal);
    };
  }, [events, enabled, store2]);
  const reference = React36.useMemo(() => {
    function resetBlockedFocus() {
      blockFocusRef.current = false;
      blockedReferenceRef.current = null;
    }
    return {
      onMouseLeave() {
        resetBlockedFocus();
      },
      onFocus(event) {
        const focusTarget = event.currentTarget;
        if (blockFocusRef.current) {
          if (blockedReferenceRef.current === focusTarget) {
            return;
          }
          resetBlockedFocus();
        }
        const target = getTarget(event.nativeEvent);
        if (isElement(target)) {
          if (isMacSafari && !event.relatedTarget) {
            if (!keyboardModalityRef.current && !isTypeableElement(target)) {
              return;
            }
          } else if (!matchesFocusVisible(target)) {
            return;
          }
        }
        const movedFromOtherEnabledTrigger = isTargetInsideEnabledTrigger(event.relatedTarget, store2.context.triggerElements);
        const {
          nativeEvent,
          currentTarget
        } = event;
        const delayValue = typeof delay === "function" ? delay() : delay;
        if (store2.select("open") && movedFromOtherEnabledTrigger || delayValue === 0 || delayValue === void 0) {
          store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget));
          return;
        }
        timeout.start(delayValue, () => {
          if (blockFocusRef.current) {
            return;
          }
          store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget));
        });
      },
      onBlur(event) {
        resetBlockedFocus();
        const relatedTarget = event.relatedTarget;
        const nativeEvent = event.nativeEvent;
        const movedToFocusGuard = isElement(relatedTarget) && relatedTarget.hasAttribute(createAttribute("focus-guard")) && relatedTarget.getAttribute("data-type") === "outside";
        timeout.start(0, () => {
          const domReference = store2.select("domReferenceElement");
          const activeEl = activeElement(ownerDocument(domReference));
          if (!relatedTarget && activeEl === domReference) {
            return;
          }
          if (contains(dataRef.current.floatingContext?.refs.floating.current, activeEl) || contains(domReference, activeEl) || movedToFocusGuard) {
            return;
          }
          const nextFocusedElement = relatedTarget ?? activeEl;
          if (isTargetInsideEnabledTrigger(nextFocusedElement, store2.context.triggerElements)) {
            return;
          }
          store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent));
        });
      }
    };
  }, [dataRef, delay, store2, timeout]);
  return React36.useMemo(() => enabled ? {
    reference,
    trigger: reference
  } : {}, [enabled, reference]);
}

// node_modules/@base-ui/react/floating-ui-react/hooks/useHoverFloatingInteraction.mjs
var React37 = __toESM(require_react(), 1);

// node_modules/@base-ui/react/floating-ui-react/hooks/useHoverInteractionSharedState.mjs
var HoverInteraction = class _HoverInteraction {
  constructor() {
    this.pointerType = void 0;
    this.interactedInside = false;
    this.handler = void 0;
    this.blockMouseMove = true;
    this.performedPointerEventsMutation = false;
    this.pointerEventsScopeElement = null;
    this.pointerEventsReferenceElement = null;
    this.pointerEventsFloatingElement = null;
    this.restTimeoutPending = false;
    this.openChangeTimeout = new Timeout();
    this.restTimeout = new Timeout();
    this.handleCloseOptions = void 0;
  }
  static create() {
    return new _HoverInteraction();
  }
  dispose = () => {
    this.openChangeTimeout.clear();
    this.restTimeout.clear();
  };
  disposeEffect = () => {
    return this.dispose;
  };
};
var pointerEventsMutationOwnerByScopeElement = /* @__PURE__ */ new WeakMap();
function clearSafePolygonPointerEventsMutation(instance) {
  if (!instance.performedPointerEventsMutation) {
    return;
  }
  const scopeElement = instance.pointerEventsScopeElement;
  if (scopeElement && pointerEventsMutationOwnerByScopeElement.get(scopeElement) === instance) {
    instance.pointerEventsScopeElement?.style.removeProperty("pointer-events");
    instance.pointerEventsReferenceElement?.style.removeProperty("pointer-events");
    instance.pointerEventsFloatingElement?.style.removeProperty("pointer-events");
    pointerEventsMutationOwnerByScopeElement.delete(scopeElement);
  }
  instance.performedPointerEventsMutation = false;
  instance.pointerEventsScopeElement = null;
  instance.pointerEventsReferenceElement = null;
  instance.pointerEventsFloatingElement = null;
}
function applySafePolygonPointerEventsMutation(instance, options) {
  const {
    scopeElement,
    referenceElement,
    floatingElement
  } = options;
  const existingOwner = pointerEventsMutationOwnerByScopeElement.get(scopeElement);
  if (existingOwner && existingOwner !== instance) {
    clearSafePolygonPointerEventsMutation(existingOwner);
  }
  clearSafePolygonPointerEventsMutation(instance);
  instance.performedPointerEventsMutation = true;
  instance.pointerEventsScopeElement = scopeElement;
  instance.pointerEventsReferenceElement = referenceElement;
  instance.pointerEventsFloatingElement = floatingElement;
  pointerEventsMutationOwnerByScopeElement.set(scopeElement, instance);
  scopeElement.style.pointerEvents = "none";
  referenceElement.style.pointerEvents = "auto";
  floatingElement.style.pointerEvents = "auto";
}
function useHoverInteractionSharedState(store2) {
  const data = store2.context.dataRef.current;
  const instance = useRefWithInit(() => data.hoverInteractionState ?? HoverInteraction.create()).current;
  if (!data.hoverInteractionState) {
    data.hoverInteractionState = instance;
  }
  useOnMount(data.hoverInteractionState.disposeEffect);
  return data.hoverInteractionState;
}

// node_modules/@base-ui/react/floating-ui-react/hooks/useHoverFloatingInteraction.mjs
function useHoverFloatingInteraction(context, parameters = {}) {
  const {
    enabled = true,
    closeDelay: closeDelayProp = 0,
    nodeId: nodeIdProp
  } = parameters;
  const store2 = "rootStore" in context ? context.rootStore : context;
  const open3 = store2.useState("open");
  const floatingElement = store2.useState("floatingElement");
  const domReferenceElement = store2.useState("domReferenceElement");
  const {
    dataRef
  } = store2.context;
  const tree = useFloatingTree();
  const parentId = useFloatingParentNodeId();
  const instance = useHoverInteractionSharedState(store2);
  const childClosedTimeout = useTimeout();
  const isClickLikeOpenEvent2 = useStableCallback(() => {
    return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside);
  });
  const isHoverOpen = useStableCallback(() => {
    return isHoverOpenEvent(dataRef.current.openEvent?.type);
  });
  const clearPointerEvents = useStableCallback(() => {
    clearSafePolygonPointerEventsMutation(instance);
  });
  useIsoLayoutEffect(() => {
    if (!open3) {
      instance.pointerType = void 0;
      instance.restTimeoutPending = false;
      instance.interactedInside = false;
      clearPointerEvents();
    }
  }, [open3, instance, clearPointerEvents]);
  React37.useEffect(() => {
    return clearPointerEvents;
  }, [clearPointerEvents]);
  useIsoLayoutEffect(() => {
    if (!enabled) {
      return void 0;
    }
    if (open3 && instance.handleCloseOptions?.blockPointerEvents && isHoverOpen() && isElement(domReferenceElement) && floatingElement) {
      const ref = domReferenceElement;
      const floatingEl = floatingElement;
      const doc = ownerDocument(floatingElement);
      const parentFloating = tree?.nodesRef.current.find((node) => node.id === parentId)?.context?.elements.floating;
      if (parentFloating) {
        parentFloating.style.pointerEvents = "";
      }
      const cachedScopeElement = instance.pointerEventsScopeElement !== floatingEl ? instance.pointerEventsScopeElement : null;
      const parentScopeElement = parentFloating !== floatingEl ? parentFloating : null;
      const scopeElement = instance.handleCloseOptions?.getScope?.() ?? cachedScopeElement ?? parentScopeElement ?? ref.closest("[data-rootownerid]") ?? doc.body;
      applySafePolygonPointerEventsMutation(instance, {
        scopeElement,
        referenceElement: ref,
        floatingElement: floatingEl
      });
      return () => {
        clearPointerEvents();
      };
    }
    return void 0;
  }, [enabled, open3, domReferenceElement, floatingElement, instance, isHoverOpen, tree, parentId, clearPointerEvents]);
  React37.useEffect(() => {
    if (!enabled) {
      return void 0;
    }
    function hasParentChildren() {
      return !!(tree && parentId && getNodeChildren(tree.nodesRef.current, parentId).length > 0);
    }
    function closeWithDelay(event) {
      const closeDelay = getDelay(closeDelayProp, "close", instance.pointerType);
      const close = () => {
        store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
        tree?.events.emit("floating.closed", event);
      };
      if (closeDelay) {
        instance.openChangeTimeout.start(closeDelay, close);
      } else {
        instance.openChangeTimeout.clear();
        close();
      }
    }
    function handleInteractInside(event) {
      const target = getTarget(event);
      if (!isInteractiveElement(target)) {
        instance.interactedInside = false;
        return;
      }
      instance.interactedInside = target?.closest("[aria-haspopup]") != null;
    }
    function onFloatingMouseEnter() {
      instance.openChangeTimeout.clear();
      childClosedTimeout.clear();
      tree?.events.off("floating.closed", onNodeClosed);
      clearPointerEvents();
    }
    function onFloatingMouseLeave(event) {
      if (hasParentChildren() && tree) {
        tree.events.on("floating.closed", onNodeClosed);
        return;
      }
      if (isTargetInsideEnabledTrigger(event.relatedTarget, store2.context.triggerElements)) {
        return;
      }
      const currentNodeId = dataRef.current.floatingContext?.nodeId ?? nodeIdProp;
      const relatedTarget = event.relatedTarget;
      const isMovingIntoDescendantFloating = tree && currentNodeId && isElement(relatedTarget) && getNodeChildren(tree.nodesRef.current, currentNodeId, false).some((node) => contains(node.context?.elements.floating, relatedTarget));
      if (isMovingIntoDescendantFloating) {
        return;
      }
      if (instance.handler) {
        instance.handler(event);
        return;
      }
      clearPointerEvents();
      if (isHoverOpen() && !isClickLikeOpenEvent2()) {
        closeWithDelay(event);
      }
    }
    function onNodeClosed(event) {
      if (!tree || !parentId || hasParentChildren()) {
        return;
      }
      childClosedTimeout.start(0, () => {
        tree.events.off("floating.closed", onNodeClosed);
        store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
        tree.events.emit("floating.closed", event);
      });
    }
    const floating = floatingElement;
    return mergeCleanups(floating && addEventListener(floating, "mouseenter", onFloatingMouseEnter), floating && addEventListener(floating, "mouseleave", onFloatingMouseLeave), floating && addEventListener(floating, "pointerdown", handleInteractInside, true), () => {
      tree?.events.off("floating.closed", onNodeClosed);
    });
  }, [enabled, floatingElement, store2, dataRef, closeDelayProp, nodeIdProp, isHoverOpen, isClickLikeOpenEvent2, clearPointerEvents, instance, tree, parentId, childClosedTimeout]);
}

// node_modules/@base-ui/react/floating-ui-react/hooks/useHoverReferenceInteraction.mjs
var React38 = __toESM(require_react(), 1);
var ReactDOM5 = __toESM(require_react_dom(), 1);
var EMPTY_REF = {
  current: null
};
function useHoverReferenceInteraction(context, props = {}) {
  const {
    enabled = true,
    delay = 0,
    handleClose = null,
    mouseOnly = false,
    restMs = 0,
    move = true,
    triggerElementRef = EMPTY_REF,
    externalTree,
    isActiveTrigger = true,
    getHandleCloseContext,
    isClosing,
    shouldOpen: shouldOpenProp,
    guardStaleOpen = false
  } = props;
  const store2 = "rootStore" in context ? context.rootStore : context;
  const {
    dataRef,
    events
  } = store2.context;
  const tree = useFloatingTree(externalTree);
  const instance = useHoverInteractionSharedState(store2);
  const isHoverCloseActiveRef = React38.useRef(false);
  const handleCloseRef = useValueAsRef(handleClose);
  const delayRef = useValueAsRef(delay);
  const restMsRef = useValueAsRef(restMs);
  const enabledRef = useValueAsRef(enabled);
  const shouldOpenRef = useValueAsRef(shouldOpenProp);
  const isClosingRef = useValueAsRef(isClosing);
  const isClickLikeOpenEvent2 = useStableCallback(() => {
    return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside);
  });
  const checkShouldOpen = useStableCallback(() => {
    return shouldOpenRef.current?.() !== false;
  });
  const isOverInactiveTrigger = useStableCallback((currentDomReference, currentTarget, target) => {
    const allTriggers = store2.context.triggerElements;
    if (allTriggers.hasElement(currentTarget)) {
      return !currentDomReference || !contains(currentDomReference, currentTarget);
    }
    if (!isElement(target)) {
      return false;
    }
    const targetElement = target;
    return allTriggers.hasMatchingElement((trigger) => contains(trigger, targetElement)) && (!currentDomReference || !contains(currentDomReference, targetElement));
  });
  const cleanupMouseMoveHandler = useStableCallback(() => {
    if (!instance.handler) {
      return;
    }
    const doc = ownerDocument(store2.select("domReferenceElement"));
    doc.removeEventListener("mousemove", instance.handler);
    instance.handler = void 0;
  });
  const clearPointerEvents = useStableCallback(() => {
    clearSafePolygonPointerEventsMutation(instance);
  });
  if (isActiveTrigger) {
    instance.handleCloseOptions = handleClose?.__options;
  }
  React38.useEffect(() => cleanupMouseMoveHandler, [cleanupMouseMoveHandler]);
  React38.useEffect(() => {
    if (!enabled) {
      return void 0;
    }
    function onOpenChangeLocal(details) {
      if (!details.open) {
        isHoverCloseActiveRef.current = details.reason === reason_parts_exports.triggerHover;
        cleanupMouseMoveHandler();
        instance.openChangeTimeout.clear();
        instance.restTimeout.clear();
        instance.blockMouseMove = true;
        instance.restTimeoutPending = false;
      } else {
        isHoverCloseActiveRef.current = false;
      }
    }
    events.on("openchange", onOpenChangeLocal);
    return () => {
      events.off("openchange", onOpenChangeLocal);
    };
  }, [enabled, events, instance, cleanupMouseMoveHandler]);
  React38.useEffect(() => {
    if (!enabled) {
      return void 0;
    }
    function closeWithDelay(event, runElseBranch = true) {
      const closeDelay = getDelay(delayRef.current, "close", instance.pointerType);
      if (closeDelay) {
        instance.openChangeTimeout.start(closeDelay, () => {
          store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
          tree?.events.emit("floating.closed", event);
        });
      } else if (runElseBranch) {
        instance.openChangeTimeout.clear();
        store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
        tree?.events.emit("floating.closed", event);
      }
    }
    const trigger = triggerElementRef.current ?? (isActiveTrigger ? store2.select("domReferenceElement") : null);
    if (!isElement(trigger)) {
      return void 0;
    }
    function onMouseEnter(event) {
      instance.openChangeTimeout.clear();
      instance.blockMouseMove = false;
      if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) {
        return;
      }
      const restMsValue = getRestMs(restMsRef.current);
      const openDelay = getDelay(delayRef.current, "open", instance.pointerType);
      const eventTarget = getTarget(event);
      const currentTarget = event.currentTarget ?? null;
      const currentDomReference = store2.select("domReferenceElement");
      let triggerNode = currentTarget;
      if (isElement(eventTarget) && !store2.context.triggerElements.hasElement(eventTarget)) {
        for (const triggerElement of store2.context.triggerElements.elements()) {
          if (contains(triggerElement, eventTarget)) {
            triggerNode = triggerElement;
            break;
          }
        }
      }
      if (isElement(currentTarget) && isElement(currentDomReference) && !store2.context.triggerElements.hasElement(currentTarget) && contains(currentTarget, currentDomReference)) {
        triggerNode = currentDomReference;
      }
      const isOverInactive = triggerNode == null ? false : isOverInactiveTrigger(currentDomReference, triggerNode, eventTarget);
      const isOpen2 = store2.select("open");
      const isInClosingTransition = isClosingRef.current?.() ?? store2.select("transitionStatus") === "ending";
      const isHoverCloseTransition = !isOpen2 && isInClosingTransition && isHoverCloseActiveRef.current;
      const isReenteringSameTriggerDuringCloseTransition = !isOverInactive && isElement(triggerNode) && isElement(currentDomReference) && contains(currentDomReference, triggerNode) && isHoverCloseTransition;
      const isRestOnlyDelay = restMsValue > 0 && !openDelay;
      const shouldOpenImmediately = isOverInactive && (isOpen2 || isHoverCloseTransition) || isReenteringSameTriggerDuringCloseTransition;
      const shouldOpen = !isOpen2 || isOverInactive;
      if (shouldOpenImmediately) {
        if (checkShouldOpen()) {
          store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode));
        }
        return;
      }
      if (isRestOnlyDelay) {
        return;
      }
      if (openDelay) {
        instance.openChangeTimeout.start(openDelay, () => {
          if (shouldOpen && checkShouldOpen()) {
            store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode));
          }
        });
      } else if (shouldOpen) {
        if (checkShouldOpen()) {
          store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode));
        }
      }
    }
    function onMouseLeave(event) {
      if (isClickLikeOpenEvent2()) {
        clearPointerEvents();
        return;
      }
      cleanupMouseMoveHandler();
      const domReferenceElement = store2.select("domReferenceElement");
      const doc = ownerDocument(domReferenceElement);
      instance.restTimeout.clear();
      instance.restTimeoutPending = false;
      const handleCloseContextBase = dataRef.current.floatingContext ?? getHandleCloseContext?.();
      if (isTargetInsideEnabledTrigger(event.relatedTarget, store2.context.triggerElements)) {
        return;
      }
      if (handleCloseRef.current && handleCloseContextBase) {
        if (!store2.select("open")) {
          instance.openChangeTimeout.clear();
        }
        const currentTrigger = triggerElementRef.current;
        instance.handler = handleCloseRef.current({
          ...handleCloseContextBase,
          tree,
          x: event.clientX,
          y: event.clientY,
          onClose() {
            clearPointerEvents();
            cleanupMouseMoveHandler();
            if (enabledRef.current && !isClickLikeOpenEvent2() && currentTrigger === store2.select("domReferenceElement")) {
              closeWithDelay(event, true);
            }
          }
        });
        doc.addEventListener("mousemove", instance.handler);
        instance.handler(event);
        return;
      }
      const shouldClose = instance.pointerType === "touch" ? !contains(store2.select("floatingElement"), event.relatedTarget) : true;
      if (shouldClose) {
        closeWithDelay(event);
      }
    }
    function onMouseOut(event) {
      if (contains(trigger, event.relatedTarget)) {
        return;
      }
      instance.openChangeTimeout.clear();
      instance.restTimeout.clear();
      instance.restTimeoutPending = false;
    }
    const staleOpenGuard = guardStaleOpen ? addEventListener(trigger, "mouseout", onMouseOut) : void 0;
    if (move) {
      return mergeCleanups(addEventListener(trigger, "mousemove", onMouseEnter, {
        once: true
      }), addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave), staleOpenGuard);
    }
    return mergeCleanups(addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave), staleOpenGuard);
  }, [cleanupMouseMoveHandler, clearPointerEvents, dataRef, delayRef, store2, enabled, handleCloseRef, instance, isActiveTrigger, isOverInactiveTrigger, isClickLikeOpenEvent2, mouseOnly, move, restMsRef, triggerElementRef, tree, enabledRef, getHandleCloseContext, isClosingRef, checkShouldOpen, guardStaleOpen]);
  return React38.useMemo(() => {
    if (!enabled) {
      return void 0;
    }
    function setPointerRef(event) {
      instance.pointerType = event.pointerType;
    }
    return {
      onPointerDown: setPointerRef,
      onPointerEnter: setPointerRef,
      onMouseMove(event) {
        const {
          nativeEvent
        } = event;
        const trigger = event.currentTarget;
        const currentDomReference = store2.select("domReferenceElement");
        const currentOpen = store2.select("open");
        const isOverInactive = isOverInactiveTrigger(currentDomReference, trigger, event.target);
        if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) {
          return;
        }
        if (currentOpen && isOverInactive && instance.handleCloseOptions?.blockPointerEvents) {
          const floatingElement = store2.select("floatingElement");
          if (floatingElement) {
            const scopeElement = instance.handleCloseOptions?.getScope?.() ?? trigger.ownerDocument.body;
            applySafePolygonPointerEventsMutation(instance, {
              scopeElement,
              referenceElement: trigger,
              floatingElement
            });
          }
        }
        const restMsValue = getRestMs(restMsRef.current);
        if (currentOpen && !isOverInactive || restMsValue === 0) {
          return;
        }
        if (!isOverInactive && instance.restTimeoutPending && event.movementX ** 2 + event.movementY ** 2 < 2) {
          return;
        }
        instance.restTimeout.clear();
        function handleMouseMove() {
          instance.restTimeoutPending = false;
          if (isClickLikeOpenEvent2()) {
            return;
          }
          const latestOpen = store2.select("open");
          if (!instance.blockMouseMove && (!latestOpen || isOverInactive) && checkShouldOpen()) {
            store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, nativeEvent, trigger));
          }
        }
        if (instance.pointerType === "touch") {
          ReactDOM5.flushSync(() => {
            handleMouseMove();
          });
        } else if (isOverInactive && currentOpen) {
          handleMouseMove();
        } else {
          instance.restTimeoutPending = true;
          instance.restTimeout.start(restMsValue, handleMouseMove);
        }
      }
    };
  }, [enabled, instance, isClickLikeOpenEvent2, isOverInactiveTrigger, mouseOnly, store2, restMsRef, checkShouldOpen]);
}

// node_modules/@base-ui/react/floating-ui-react/safePolygon.mjs
var CURSOR_SPEED_THRESHOLD = 0.1;
var CURSOR_SPEED_THRESHOLD_SQUARED = CURSOR_SPEED_THRESHOLD * CURSOR_SPEED_THRESHOLD;
var POLYGON_BUFFER = 0.5;
function hasIntersectingEdge(pointX, pointY, xi, yi, xj, yj) {
  return yi >= pointY !== yj >= pointY && pointX <= (xj - xi) * (pointY - yi) / (yj - yi) + xi;
}
function isPointInQuadrilateral(pointX, pointY, x1, y1, x2, y2, x3, y3, x4, y4) {
  let isInsideValue = false;
  if (hasIntersectingEdge(pointX, pointY, x1, y1, x2, y2)) {
    isInsideValue = !isInsideValue;
  }
  if (hasIntersectingEdge(pointX, pointY, x2, y2, x3, y3)) {
    isInsideValue = !isInsideValue;
  }
  if (hasIntersectingEdge(pointX, pointY, x3, y3, x4, y4)) {
    isInsideValue = !isInsideValue;
  }
  if (hasIntersectingEdge(pointX, pointY, x4, y4, x1, y1)) {
    isInsideValue = !isInsideValue;
  }
  return isInsideValue;
}
function isInsideRect(pointX, pointY, rect) {
  return pointX >= rect.x && pointX <= rect.x + rect.width && pointY >= rect.y && pointY <= rect.y + rect.height;
}
function isInsideAxisAlignedRect(pointX, pointY, x1, y1, x2, y2) {
  const minX = Math.min(x1, x2);
  const maxX = Math.max(x1, x2);
  const minY = Math.min(y1, y2);
  const maxY = Math.max(y1, y2);
  return pointX >= minX && pointX <= maxX && pointY >= minY && pointY <= maxY;
}
function safePolygon(options = {}) {
  const {
    blockPointerEvents = false
  } = options;
  const timeout = new Timeout();
  const fn = ({
    x: x2,
    y: y2,
    placement,
    elements,
    onClose,
    nodeId,
    tree
  }) => {
    const side = placement?.split("-")[0];
    let hasLanded = false;
    let lastX = null;
    let lastY = null;
    let lastCursorTime = typeof performance !== "undefined" ? performance.now() : 0;
    function isCursorMovingSlowly(nextX, nextY) {
      const currentTime = performance.now();
      const elapsedTime = currentTime - lastCursorTime;
      if (lastX === null || lastY === null || elapsedTime === 0) {
        lastX = nextX;
        lastY = nextY;
        lastCursorTime = currentTime;
        return false;
      }
      const deltaX = nextX - lastX;
      const deltaY = nextY - lastY;
      const distanceSquared = deltaX * deltaX + deltaY * deltaY;
      const thresholdSquared = elapsedTime * elapsedTime * CURSOR_SPEED_THRESHOLD_SQUARED;
      lastX = nextX;
      lastY = nextY;
      lastCursorTime = currentTime;
      return distanceSquared < thresholdSquared;
    }
    function close() {
      timeout.clear();
      onClose();
    }
    return function onMouseMove(event) {
      timeout.clear();
      const domReference = elements.domReference;
      const floating = elements.floating;
      if (!domReference || !floating || side == null || x2 == null || y2 == null) {
        return void 0;
      }
      const {
        clientX,
        clientY
      } = event;
      const target = getTarget(event);
      const isLeave = event.type === "mouseleave";
      const isOverFloatingEl = contains(floating, target);
      const isOverReferenceEl = contains(domReference, target);
      if (isOverFloatingEl) {
        hasLanded = true;
        if (!isLeave) {
          return void 0;
        }
      }
      if (isOverReferenceEl) {
        hasLanded = false;
        if (!isLeave) {
          hasLanded = true;
          return void 0;
        }
      }
      if (isLeave && isElement(event.relatedTarget) && contains(floating, event.relatedTarget)) {
        return void 0;
      }
      function hasOpenChildNode() {
        return Boolean(tree && getNodeChildren(tree.nodesRef.current, nodeId).length > 0);
      }
      function closeIfNoOpenChild() {
        if (!hasOpenChildNode()) {
          close();
        }
      }
      if (hasOpenChildNode()) {
        return void 0;
      }
      const refRect = domReference.getBoundingClientRect();
      const rect = floating.getBoundingClientRect();
      const cursorLeaveFromRight = x2 > rect.right - rect.width / 2;
      const cursorLeaveFromBottom = y2 > rect.bottom - rect.height / 2;
      const isFloatingWider = rect.width > refRect.width;
      const isFloatingTaller = rect.height > refRect.height;
      const left = (isFloatingWider ? refRect : rect).left;
      const right = (isFloatingWider ? refRect : rect).right;
      const top = (isFloatingTaller ? refRect : rect).top;
      const bottom = (isFloatingTaller ? refRect : rect).bottom;
      if (side === "top" && y2 >= refRect.bottom - 1 || side === "bottom" && y2 <= refRect.top + 1 || side === "left" && x2 >= refRect.right - 1 || side === "right" && x2 <= refRect.left + 1) {
        closeIfNoOpenChild();
        return void 0;
      }
      let isInsideTroughRect = false;
      switch (side) {
        case "top":
          isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, refRect.top + 1, right, rect.bottom - 1);
          break;
        case "bottom":
          isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, rect.top + 1, right, refRect.bottom - 1);
          break;
        case "left":
          isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, rect.right - 1, bottom, refRect.left + 1, top);
          break;
        case "right":
          isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, refRect.right - 1, bottom, rect.left + 1, top);
          break;
        default:
      }
      if (isInsideTroughRect) {
        return void 0;
      }
      if (hasLanded && !isInsideRect(clientX, clientY, refRect)) {
        closeIfNoOpenChild();
        return void 0;
      }
      if (!isLeave && isCursorMovingSlowly(clientX, clientY)) {
        closeIfNoOpenChild();
        return void 0;
      }
      let isInsidePolygon = false;
      switch (side) {
        case "top": {
          const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;
          const cursorPointOneX = isFloatingWider ? x2 + cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset;
          const cursorPointTwoX = isFloatingWider ? x2 - cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset;
          const cursorPointY = y2 + POLYGON_BUFFER + 1;
          const commonYLeft = cursorLeaveFromRight ? rect.bottom - POLYGON_BUFFER : isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top;
          const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top : rect.bottom - POLYGON_BUFFER;
          isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight);
          break;
        }
        case "bottom": {
          const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;
          const cursorPointOneX = isFloatingWider ? x2 + cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset;
          const cursorPointTwoX = isFloatingWider ? x2 - cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset;
          const cursorPointY = y2 - POLYGON_BUFFER;
          const commonYLeft = cursorLeaveFromRight ? rect.top + POLYGON_BUFFER : isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom;
          const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom : rect.top + POLYGON_BUFFER;
          isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight);
          break;
        }
        case "left": {
          const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;
          const cursorPointOneY = isFloatingTaller ? y2 + cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset;
          const cursorPointTwoY = isFloatingTaller ? y2 - cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset;
          const cursorPointX = x2 + POLYGON_BUFFER + 1;
          const commonXTop = cursorLeaveFromBottom ? rect.right - POLYGON_BUFFER : isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left;
          const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left : rect.right - POLYGON_BUFFER;
          isInsidePolygon = isPointInQuadrilateral(clientX, clientY, commonXTop, rect.top, commonXBottom, rect.bottom, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY);
          break;
        }
        case "right": {
          const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;
          const cursorPointOneY = isFloatingTaller ? y2 + cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset;
          const cursorPointTwoY = isFloatingTaller ? y2 - cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset;
          const cursorPointX = x2 - POLYGON_BUFFER;
          const commonXTop = cursorLeaveFromBottom ? rect.left + POLYGON_BUFFER : isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right;
          const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right : rect.left + POLYGON_BUFFER;
          isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY, commonXTop, rect.top, commonXBottom, rect.bottom);
          break;
        }
        default:
      }
      if (!isInsidePolygon) {
        closeIfNoOpenChild();
      } else if (!hasLanded) {
        timeout.start(40, closeIfNoOpenChild);
      }
      return void 0;
    };
  };
  fn.__options = {
    ...options,
    blockPointerEvents
  };
  return fn;
}

// node_modules/@base-ui/react/utils/NullStore.mjs
var NullStore = class extends ReactStore {
  // `update`/`set`/`notifyAll` funnel through `setState` in the base `Store`, so overriding
  // `setState` alone would neutralize them today. They are overridden explicitly so the store stays
  // inert even if a future base-class change stops routing a mutator through `setState`.
  setState(_newState) {
  }
  update(_changes) {
  }
  set(_key, _value) {
  }
  notifyAll() {
  }
};

// node_modules/@base-ui/react/internals/composite/composite.mjs
var ARROW_UP = "ArrowUp";
var ARROW_DOWN = "ArrowDown";
var ARROW_LEFT = "ArrowLeft";
var ARROW_RIGHT = "ArrowRight";
var HOME = "Home";
var END = "End";
var COMPOSITE_KEYS = /* @__PURE__ */ new Set([ARROW_UP, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT, HOME, END]);
var SHIFT = "Shift";
var MODIFIER_KEYS = [SHIFT, "Control", "Alt", "Meta"];
function isInputElement(element) {
  return isHTMLElement(element) && element.tagName === "INPUT";
}
function isNativeInput(element) {
  if (isInputElement(element) && element.selectionStart != null) {
    return true;
  }
  if (isHTMLElement(element) && element.tagName === "TEXTAREA") {
    return true;
  }
  return false;
}
function scrollIntoViewIfNeeded(scrollContainer, element, direction, orientation) {
  if (!scrollContainer || !element || !element.scrollTo) {
    return;
  }
  let targetX = scrollContainer.scrollLeft;
  let targetY = scrollContainer.scrollTop;
  const isOverflowingX = scrollContainer.clientWidth < scrollContainer.scrollWidth;
  const isOverflowingY = scrollContainer.clientHeight < scrollContainer.scrollHeight;
  if (isOverflowingX && orientation !== "vertical") {
    const elementOffsetLeft = getOffset(scrollContainer, element, "left");
    const containerStyles = getStyles(scrollContainer);
    const elementStyles = getStyles(element);
    if (direction === "ltr") {
      if (elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight > scrollContainer.scrollLeft + scrollContainer.clientWidth - containerStyles.scrollPaddingRight) {
        targetX = elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight - scrollContainer.clientWidth + containerStyles.scrollPaddingRight;
      } else if (elementOffsetLeft - elementStyles.scrollMarginLeft < scrollContainer.scrollLeft + containerStyles.scrollPaddingLeft) {
        targetX = elementOffsetLeft - elementStyles.scrollMarginLeft - containerStyles.scrollPaddingLeft;
      }
    }
    if (direction === "rtl") {
      if (elementOffsetLeft - elementStyles.scrollMarginLeft < scrollContainer.scrollLeft + containerStyles.scrollPaddingLeft) {
        targetX = elementOffsetLeft - elementStyles.scrollMarginLeft - containerStyles.scrollPaddingLeft;
      } else if (elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight > scrollContainer.scrollLeft + scrollContainer.clientWidth - containerStyles.scrollPaddingRight) {
        targetX = elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight - scrollContainer.clientWidth + containerStyles.scrollPaddingRight;
      }
    }
  }
  if (isOverflowingY && orientation !== "horizontal") {
    const elementOffsetTop = getOffset(scrollContainer, element, "top");
    const containerStyles = getStyles(scrollContainer);
    const elementStyles = getStyles(element);
    if (elementOffsetTop - elementStyles.scrollMarginTop < scrollContainer.scrollTop + containerStyles.scrollPaddingTop) {
      targetY = elementOffsetTop - elementStyles.scrollMarginTop - containerStyles.scrollPaddingTop;
    } else if (elementOffsetTop + element.offsetHeight + elementStyles.scrollMarginBottom > scrollContainer.scrollTop + scrollContainer.clientHeight - containerStyles.scrollPaddingBottom) {
      targetY = elementOffsetTop + element.offsetHeight + elementStyles.scrollMarginBottom - scrollContainer.clientHeight + containerStyles.scrollPaddingBottom;
    }
  }
  scrollContainer.scrollTo({
    left: targetX,
    top: targetY,
    behavior: "auto"
  });
}
function getOffset(ancestor, element, side) {
  const propName = side === "left" ? "offsetLeft" : "offsetTop";
  let result = 0;
  while (element.offsetParent) {
    result += element[propName];
    if (element.offsetParent === ancestor) {
      break;
    }
    element = element.offsetParent;
  }
  return result;
}
function getStyles(element) {
  const styles = getComputedStyle(element);
  return {
    scrollMarginTop: parseFloat(styles.scrollMarginTop) || 0,
    scrollMarginRight: parseFloat(styles.scrollMarginRight) || 0,
    scrollMarginBottom: parseFloat(styles.scrollMarginBottom) || 0,
    scrollMarginLeft: parseFloat(styles.scrollMarginLeft) || 0,
    scrollPaddingTop: parseFloat(styles.scrollPaddingTop) || 0,
    scrollPaddingRight: parseFloat(styles.scrollPaddingRight) || 0,
    scrollPaddingBottom: parseFloat(styles.scrollPaddingBottom) || 0,
    scrollPaddingLeft: parseFloat(styles.scrollPaddingLeft) || 0
  };
}

// node_modules/@base-ui/utils/inertValue.mjs
function inertValue(value) {
  if (isReactVersionAtLeast(19)) {
    return value;
  }
  return value ? "true" : void 0;
}

// node_modules/@base-ui/react/internals/useValueChanged.mjs
var React39 = __toESM(require_react(), 1);
function useValueChanged(value, onChange) {
  const valueRef = React39.useRef(value);
  const onChangeCallback = useStableCallback(onChange);
  useIsoLayoutEffect(() => {
    if (valueRef.current !== value) {
      onChangeCallback(valueRef.current);
    }
    valueRef.current = value;
  }, [value, onChangeCallback]);
}

// node_modules/@base-ui/react/internals/field-root-context/FieldRootContext.mjs
var React40 = __toESM(require_react(), 1);

// node_modules/@base-ui/react/field/control/FieldControlDataAttributes.mjs
var valid = "data-valid";
var invalid = "data-invalid";

// node_modules/@base-ui/react/internals/field-constants/constants.mjs
var DEFAULT_VALIDITY_STATE = {
  badInput: false,
  customError: false,
  patternMismatch: false,
  rangeOverflow: false,
  rangeUnderflow: false,
  stepMismatch: false,
  tooLong: false,
  tooShort: false,
  typeMismatch: false,
  valid: null,
  valueMissing: false
};
var DEFAULT_FIELD_STATE_ATTRIBUTES = {
  valid: null,
  touched: false,
  dirty: false,
  filled: false,
  focused: false
};
var DEFAULT_FIELD_ROOT_STATE = {
  disabled: false,
  ...DEFAULT_FIELD_STATE_ATTRIBUTES
};
var fieldValidityMapping = {
  valid(value) {
    if (value === null) {
      return null;
    }
    if (value) {
      return {
        [valid]: ""
      };
    }
    return {
      [invalid]: ""
    };
  }
};

// node_modules/@base-ui/react/internals/field-root-context/FieldRootContext.mjs
var DEFAULT_FIELD_ROOT_CONTEXT = {
  invalid: void 0,
  name: void 0,
  validityData: {
    state: DEFAULT_VALIDITY_STATE,
    errors: [],
    error: "",
    value: "",
    initialValue: null
  },
  setValidityData: NOOP,
  disabled: void 0,
  setTouched: NOOP,
  setDirty: NOOP,
  setFilled: NOOP,
  setFocused: NOOP,
  validationMode: "onSubmit",
  shouldValidateOnChange: () => false,
  state: DEFAULT_FIELD_ROOT_STATE,
  registerFieldControl: NOOP,
  validation: {
    getValidationProps: (_disabled, props = EMPTY_OBJECT) => props,
    inputRef: {
      current: null
    },
    registeredInputs: /* @__PURE__ */ new Map(),
    registerInput: NOOP,
    getInputControl: () => null,
    commit: async () => {
    },
    change: NOOP
  }
};
var FieldRootContext = /* @__PURE__ */ React40.createContext(DEFAULT_FIELD_ROOT_CONTEXT);
if (true) FieldRootContext.displayName = "FieldRootContext";
function useFieldRootContext(optional = true) {
  const context = React40.useContext(FieldRootContext);
  if (context.setValidityData === NOOP && !optional) {
    throw new Error(true ? "Base UI: FieldRootContext is missing. Field parts must be placed within <Field.Root>." : formatErrorMessage_default(28));
  }
  return context;
}

// node_modules/@base-ui/react/internals/field-register-control/useRegisterFieldControl.mjs
function useRegisterFieldControl(controlRef, id, value, getFormValueOverride, enabled = true, name) {
  const {
    registerFieldControl
  } = useFieldRootContext();
  const sourceRef = useRefWithInit(() => /* @__PURE__ */ Symbol());
  useIsoLayoutEffect(() => {
    const source = sourceRef.current;
    if (!enabled) {
      registerFieldControl(source, void 0);
      return;
    }
    const registration = {
      controlRef,
      getValue: getFormValueOverride,
      id,
      name,
      value
    };
    registerFieldControl(source, registration);
  }, [controlRef, enabled, getFormValueOverride, id, name, registerFieldControl, sourceRef, value]);
  useIsoLayoutEffect(() => {
    const source = sourceRef.current;
    return () => {
      registerFieldControl(source, void 0);
    };
  }, [registerFieldControl, sourceRef]);
}

// node_modules/@base-ui/react/internals/form-context/FormContext.mjs
var React41 = __toESM(require_react(), 1);
var FormContext = /* @__PURE__ */ React41.createContext({
  elementRef: {
    current: null
  },
  formRef: {
    current: {
      fields: /* @__PURE__ */ new Map()
    }
  },
  errors: {},
  clearErrors: NOOP,
  validationMode: "onSubmit",
  submitCountRef: {
    current: 0
  }
});
if (true) FormContext.displayName = "FormContext";
function useFormContext() {
  return React41.useContext(FormContext);
}

// node_modules/@base-ui/react/internals/labelable-provider/useLabelableId.mjs
var React43 = __toESM(require_react(), 1);

// node_modules/@base-ui/react/internals/labelable-provider/LabelableContext.mjs
var React42 = __toESM(require_react(), 1);
var LabelableContext = /* @__PURE__ */ React42.createContext({
  controlId: void 0,
  registerControlId: NOOP,
  resetControlId: NOOP,
  labelId: void 0,
  setLabelId: NOOP,
  messageIds: [],
  setMessageIds: NOOP,
  getDescriptionProps: (externalProps) => externalProps
});
if (true) LabelableContext.displayName = "LabelableContext";
function useLabelableContext() {
  return React42.useContext(LabelableContext);
}

// node_modules/@base-ui/react/internals/labelable-provider/useLabelableId.mjs
function useLabelableId(params = {}) {
  const {
    id,
    enabled = true
  } = params;
  const {
    controlId,
    registerControlId,
    resetControlId
  } = useLabelableContext();
  const defaultId = useBaseUiId();
  const controlSourceRef = useRefWithInit(() => /* @__PURE__ */ Symbol());
  const hasRegisteredRef = React43.useRef(false);
  const hadExplicitIdRef = React43.useRef(false);
  const unregisterControlId = useStableCallback(() => {
    if (!hasRegisteredRef.current || registerControlId === NOOP) {
      return;
    }
    hasRegisteredRef.current = false;
    registerControlId(controlSourceRef.current, void 0);
  });
  useIsoLayoutEffect(() => {
    if (!enabled || registerControlId === NOOP) {
      unregisterControlId();
      return void 0;
    }
    let nextId;
    if (id !== void 0) {
      hadExplicitIdRef.current = true;
      nextId = id;
    } else if (hadExplicitIdRef.current) {
      nextId = defaultId;
    } else {
      resetControlId();
      return void 0;
    }
    if (nextId === void 0) {
      unregisterControlId();
      return void 0;
    }
    hasRegisteredRef.current = true;
    registerControlId(controlSourceRef.current, nextId);
    return void 0;
  }, [id, enabled, registerControlId, resetControlId, defaultId, controlSourceRef, unregisterControlId]);
  useIsoLayoutEffect(() => {
    return unregisterControlId;
  }, [unregisterControlId]);
  return (enabled ? controlId : void 0) ?? id ?? defaultId;
}

// node_modules/@base-ui/react/internals/direction-context/DirectionContext.mjs
var React44 = __toESM(require_react(), 1);
var DirectionContext = /* @__PURE__ */ React44.createContext(void 0);
if (true) DirectionContext.displayName = "DirectionContext";
function useDirection() {
  const context = React44.useContext(DirectionContext);
  return context?.direction ?? "ltr";
}

// node_modules/@base-ui/react/internals/useAnchorPositioning.mjs
var React45 = __toESM(require_react(), 1);

// node_modules/@base-ui/react/floating-ui-react/middleware/arrow.mjs
var baseArrow = (options) => ({
  name: "arrow",
  options,
  async fn(state) {
    const {
      x: x2,
      y: y2,
      placement,
      rects,
      platform: platform3,
      elements,
      middlewareData
    } = state;
    const {
      element,
      padding = 0,
      offsetParent = "real"
    } = evaluate(options, state) || {};
    if (element == null) {
      return {};
    }
    const paddingObject = getPaddingObject(padding);
    const coords = {
      x: x2,
      y: y2
    };
    const axis = getAlignmentAxis(placement);
    const length2 = getAxisLength(axis);
    const arrowDimensions = await platform3.getDimensions(element);
    const isYAxis = axis === "y";
    const minProp = isYAxis ? "top" : "left";
    const maxProp = isYAxis ? "bottom" : "right";
    const clientProp = isYAxis ? "clientHeight" : "clientWidth";
    const endDiff = rects.reference[length2] + rects.reference[axis] - coords[axis] - rects.floating[length2];
    const startDiff = coords[axis] - rects.reference[axis];
    const arrowOffsetParent = offsetParent === "real" ? await platform3.getOffsetParent?.(element) : elements.floating;
    let clientSize = elements.floating[clientProp] || rects.floating[length2];
    if (!clientSize || !await platform3.isElement?.(arrowOffsetParent)) {
      clientSize = elements.floating[clientProp] || rects.floating[length2];
    }
    const centerToReference = endDiff / 2 - startDiff / 2;
    const largestPossiblePadding = clientSize / 2 - arrowDimensions[length2] / 2 - 1;
    const minPadding = Math.min(paddingObject[minProp], largestPossiblePadding);
    const maxPadding = Math.min(paddingObject[maxProp], largestPossiblePadding);
    const min4 = minPadding;
    const max4 = clientSize - arrowDimensions[length2] - maxPadding;
    const center = clientSize / 2 - arrowDimensions[length2] / 2 + centerToReference;
    const offset4 = clamp(min4, center, max4);
    const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset4 && rects.reference[length2] / 2 - (center < min4 ? minPadding : maxPadding) - arrowDimensions[length2] / 2 < 0;
    const alignmentOffset = shouldAddOffset ? center < min4 ? center - min4 : center - max4 : 0;
    return {
      [axis]: coords[axis] + alignmentOffset,
      data: {
        [axis]: offset4,
        centerOffset: center - offset4 - alignmentOffset,
        ...shouldAddOffset && {
          alignmentOffset
        }
      },
      reset: shouldAddOffset
    };
  }
});
var arrow4 = (options, deps) => {
  const {
    name,
    fn
  } = baseArrow(options);
  return {
    name,
    fn,
    options: [options, deps]
  };
};

// node_modules/@base-ui/react/utils/hideMiddleware.mjs
var hide4 = {
  name: "hide",
  async fn(state) {
    const {
      width,
      height,
      x: x2,
      y: y2
    } = state.rects.reference;
    const anchorHidden2 = width === 0 && height === 0 && x2 === 0 && y2 === 0;
    const overflow = await state.platform.detectOverflow(state, {
      elementContext: "reference"
    });
    const referenceHidden = overflow.top - height >= 0 || overflow.right - width >= 0 || overflow.bottom - height >= 0 || overflow.left - width >= 0;
    return {
      data: {
        referenceHidden: referenceHidden || anchorHidden2
      }
    };
  }
};

// node_modules/@base-ui/react/utils/adaptiveOriginConstants.mjs
var DEFAULT_SIDES = {
  sideX: "left",
  sideY: "top"
};

// node_modules/@base-ui/react/utils/CommonPositionerCssVars.mjs
var availableWidth = "--available-width";
var availableHeight = "--available-height";
var anchorWidth = "--anchor-width";
var anchorHeight = "--anchor-height";
var transformOrigin = "--transform-origin";
var positionerWidth = "--positioner-width";
var positionerHeight = "--positioner-height";

// node_modules/@base-ui/react/internals/useAnchorPositioning.mjs
var AVAILABLE_WIDTH_VAR = availableWidth;
var AVAILABLE_HEIGHT_VAR = availableHeight;
function getLogicalSide(sideParam, renderedSide, isRtl) {
  const isLogicalSideParam = sideParam === "inline-start" || sideParam === "inline-end";
  const logicalRight = isRtl ? "inline-start" : "inline-end";
  const logicalLeft = isRtl ? "inline-end" : "inline-start";
  return {
    top: "top",
    right: isLogicalSideParam ? logicalRight : "right",
    bottom: "bottom",
    left: isLogicalSideParam ? logicalLeft : "left"
  }[renderedSide];
}
function getOffsetData(state, sideParam, isRtl) {
  const {
    rects,
    placement
  } = state;
  const data = {
    side: getLogicalSide(sideParam, getSide(placement), isRtl),
    align: getAlignment(placement) || "center",
    anchor: {
      width: rects.reference.width,
      height: rects.reference.height
    },
    positioner: {
      width: rects.floating.width,
      height: rects.floating.height
    }
  };
  return data;
}
function useAnchorPositioning(params) {
  return useAnchorPositioningWithHook(params, useBaseUIFloating);
}
function useAnchorPositioningWithHook(params, useFloatingHook) {
  const {
    // Public parameters
    anchor,
    positionMethod = "absolute",
    side: sideParam = "bottom",
    sideOffset = 0,
    align = "center",
    alignOffset = 0,
    collisionBoundary,
    collisionPadding: collisionPaddingParam = 5,
    sticky = false,
    arrowPadding = 5,
    disableAnchorTracking = false,
    inline: inlineMiddleware,
    // Private parameters
    keepMounted = false,
    floatingRootContext,
    mounted,
    collisionAvoidance,
    shift: shift4,
    nodeId,
    adaptiveOrigin: adaptiveOrigin2,
    lazyFlip = false,
    externalTree
  } = params;
  const [mountSide, setMountSide] = React45.useState(null);
  if (!mounted && mountSide !== null) {
    setMountSide(null);
  }
  const collisionAvoidanceSide = collisionAvoidance.side || "flip";
  const collisionAvoidanceAlign = collisionAvoidance.align || "flip";
  const collisionAvoidanceFallbackAxisSide = collisionAvoidance.fallbackAxisSide || "end";
  const shiftCrossAxis = shift4?.crossAxis ?? false;
  const shiftRootBoundary = shift4?.rootBoundary;
  const anchorFn = typeof anchor === "function" ? anchor : void 0;
  const anchorFnCallback = useStableCallback(anchorFn);
  const anchorDep = anchorFn ? anchorFnCallback : anchor;
  const anchorValueRef = useValueAsRef(anchor);
  const mountedRef = useValueAsRef(mounted);
  const direction = useDirection();
  const isRtl = direction === "rtl";
  const side = mountSide || {
    top: "top",
    right: "right",
    bottom: "bottom",
    left: "left",
    "inline-end": isRtl ? "left" : "right",
    "inline-start": isRtl ? "right" : "left"
  }[sideParam];
  const placement = align === "center" ? side : `${side}-${align}`;
  let collisionPadding = collisionPaddingParam;
  if (typeof collisionPadding === "number") {
    collisionPadding = {
      top: collisionPadding,
      right: collisionPadding,
      bottom: collisionPadding,
      left: collisionPadding
    };
  } else if (collisionPadding) {
    collisionPadding = {
      top: collisionPadding.top || 0,
      right: collisionPadding.right || 0,
      bottom: collisionPadding.bottom || 0,
      left: collisionPadding.left || 0
    };
  }
  const bias = 1;
  const biasTop = sideParam === "bottom" ? bias : 0;
  const biasBottom = sideParam === "top" ? bias : 0;
  const biasLeft = sideParam === "right" ? bias : 0;
  const biasRight = sideParam === "left" ? bias : 0;
  const commonCollisionProps = {
    boundary: collisionBoundary === "clipping-ancestors" ? "clippingAncestors" : collisionBoundary,
    padding: collisionPadding
  };
  const arrowRef = React45.useRef(null);
  const sideOffsetRef = useValueAsRef(sideOffset);
  const alignOffsetRef = useValueAsRef(alignOffset);
  const sideOffsetDep = typeof sideOffset !== "function" ? sideOffset : 0;
  const alignOffsetDep = typeof alignOffset !== "function" ? alignOffset : 0;
  const middleware = [];
  if (inlineMiddleware) {
    middleware.push(inlineMiddleware);
  }
  middleware.push(offset3((state) => {
    const data = getOffsetData(state, sideParam, isRtl);
    const sideAxis = typeof sideOffsetRef.current === "function" ? sideOffsetRef.current(data) : sideOffsetRef.current;
    const alignAxis = typeof alignOffsetRef.current === "function" ? alignOffsetRef.current(data) : alignOffsetRef.current;
    return {
      mainAxis: sideAxis,
      crossAxis: alignAxis,
      alignmentAxis: alignAxis
    };
  }, [sideOffsetDep, alignOffsetDep, isRtl, sideParam]));
  const shiftDisabled = collisionAvoidanceAlign === "none" && collisionAvoidanceSide !== "shift";
  const crossAxisShiftEnabled = !shiftDisabled && (sticky || shiftCrossAxis || collisionAvoidanceSide === "shift");
  const flipMiddleware = collisionAvoidanceSide === "none" ? null : flip3({
    ...commonCollisionProps,
    // Ensure the popup flips if it's been limited by its --available-height and it resizes.
    // Since the size() padding is smaller than the flip() padding, flip() will take precedence.
    padding: {
      top: collisionPadding.top + bias + biasTop,
      right: collisionPadding.right + bias + biasRight,
      bottom: collisionPadding.bottom + bias + biasBottom,
      left: collisionPadding.left + bias + biasLeft
    },
    mainAxis: !shiftCrossAxis && collisionAvoidanceSide === "flip",
    crossAxis: collisionAvoidanceAlign === "flip" ? "alignment" : false,
    fallbackAxisSideDirection: collisionAvoidanceFallbackAxisSide
  });
  const shiftMiddleware = shiftDisabled ? null : shift3({
    ...commonCollisionProps,
    // Use the Layout Viewport to avoid shifting around when pinch-zooming.
    rootBoundary: shiftRootBoundary,
    mainAxis: collisionAvoidanceAlign !== "none",
    crossAxis: crossAxisShiftEnabled,
    limiter: sticky || shiftCrossAxis ? void 0 : limitShift3((limitData) => {
      if (!arrowRef.current) {
        return {};
      }
      const {
        width,
        height
      } = arrowRef.current.getBoundingClientRect();
      const sideAxis = getSideAxis(getSide(limitData.placement));
      const arrowSize = sideAxis === "y" ? width : height;
      const offsetAmount = sideAxis === "y" ? collisionPadding.left + collisionPadding.right : collisionPadding.top + collisionPadding.bottom;
      return {
        offset: arrowSize / 2 + offsetAmount / 2
      };
    })
  }, [commonCollisionProps, sticky, shiftCrossAxis, shiftRootBoundary, collisionPadding, collisionAvoidanceAlign]);
  if (collisionAvoidanceSide === "shift" || collisionAvoidanceAlign === "shift" || align === "center") {
    middleware.push(shiftMiddleware, flipMiddleware);
  } else {
    middleware.push(flipMiddleware, shiftMiddleware);
  }
  middleware.push(size3({
    ...commonCollisionProps,
    apply({
      elements: {
        floating
      },
      availableWidth: availableWidth2,
      availableHeight: availableHeight2,
      rects
    }) {
      if (!mountedRef.current) {
        return;
      }
      const floatingStyle = floating.style;
      floatingStyle.setProperty(AVAILABLE_WIDTH_VAR, `${availableWidth2}px`);
      floatingStyle.setProperty(AVAILABLE_HEIGHT_VAR, `${availableHeight2}px`);
      const dpr = getWindow(floating).devicePixelRatio || 1;
      const {
        x: x3,
        y: y3,
        width,
        height
      } = rects.reference;
      const anchorWidth2 = (Math.round((x3 + width) * dpr) - Math.round(x3 * dpr)) / dpr;
      const anchorHeight2 = (Math.round((y3 + height) * dpr) - Math.round(y3 * dpr)) / dpr;
      floatingStyle.setProperty(anchorWidth, `${anchorWidth2}px`);
      floatingStyle.setProperty(anchorHeight, `${anchorHeight2}px`);
    }
  }), arrow4((state) => ({
    // `transform-origin` calculations rely on an element existing. If the arrow hasn't been set,
    // we'll create a fake element.
    element: arrowRef.current || ownerDocument(state.elements.floating).createElement("div"),
    // No padding for the fake arrow: it would displace aligned popups on narrow anchors.
    padding: arrowRef.current ? arrowPadding : 0,
    offsetParent: "floating"
  }), [arrowPadding]), {
    name: "transformOrigin",
    fn(state) {
      const {
        elements: {
          floating
        },
        middlewareData: middlewareData2,
        placement: renderedPlacement2,
        platform: platform3,
        rects,
        y: y3
      } = state;
      const renderedSide2 = getSide(renderedPlacement2);
      const renderedAlign2 = getAlignment(renderedPlacement2);
      const isVertical = getSideAxis(renderedSide2) === "y";
      const arrowEl = arrowRef.current;
      const sideOffsetValue = typeof sideOffset === "function" ? sideOffset(getOffsetData(state, sideParam, isRtl)) : sideOffset;
      let crossOrigin;
      if (!arrowEl && renderedAlign2 && Math.abs(isVertical ? middlewareData2.shift?.x || 0 : middlewareData2.shift?.y || 0) <= 1) {
        crossOrigin = renderedAlign2 === "start" === (isVertical && platform3.isRTL?.(floating) === true) ? "100%" : "0%";
      } else {
        const arrowOffset = isVertical ? middlewareData2.arrow?.x || 0 : middlewareData2.arrow?.y || 0;
        const arrowSize = isVertical ? arrowEl?.clientWidth || 0 : arrowEl?.clientHeight || 0;
        crossOrigin = `${arrowOffset + arrowSize / 2}px`;
      }
      let sideOrigin = renderedSide2 === "top" || renderedSide2 === "left" ? `calc(100% + ${sideOffsetValue}px)` : `${-sideOffsetValue}px`;
      if (crossAxisShiftEnabled && isVertical && Math.abs(middlewareData2.shift?.y || 0) > sideOffsetValue) {
        sideOrigin = `${rects.reference.y + rects.reference.height / 2 - y3}px`;
      }
      floating.style.setProperty(transformOrigin, isVertical ? `${crossOrigin} ${sideOrigin}` : `${sideOrigin} ${crossOrigin}`);
      return {};
    }
  }, hide4, adaptiveOrigin2);
  useIsoLayoutEffect(() => {
    if (!mounted && floatingRootContext) {
      floatingRootContext.update({
        referenceElement: null,
        floatingElement: null,
        domReferenceElement: null,
        positionReference: null
      });
    }
  }, [mounted, floatingRootContext]);
  const autoUpdateOptions = React45.useMemo(() => ({
    ancestorScroll: !disableAnchorTracking,
    elementResize: !disableAnchorTracking && typeof ResizeObserver !== "undefined",
    layoutShift: !disableAnchorTracking && typeof IntersectionObserver !== "undefined"
  }), [disableAnchorTracking]);
  const {
    refs,
    elements,
    x: x2,
    y: y2,
    middlewareData,
    update: update2,
    placement: renderedPlacement,
    context,
    isPositioned,
    floatingStyles: originalFloatingStyles
  } = useFloatingHook({
    rootContext: floatingRootContext,
    open: keepMounted ? mounted : void 0,
    placement,
    middleware,
    strategy: positionMethod,
    whileElementsMounted: keepMounted ? void 0 : (...args) => autoUpdate(...args, autoUpdateOptions),
    nodeId,
    externalTree
  });
  const {
    sideX,
    sideY
  } = middlewareData.adaptiveOrigin || DEFAULT_SIDES;
  const resolvedPosition = isPositioned ? positionMethod : "fixed";
  const floatingStyles = React45.useMemo(() => {
    let base;
    if (!isPositioned) {
      base = {
        position: resolvedPosition,
        top: 0,
        left: 0
      };
    } else if (adaptiveOrigin2) {
      base = {
        position: resolvedPosition,
        [sideX]: x2,
        [sideY]: y2
      };
    } else {
      base = {
        ...originalFloatingStyles,
        position: resolvedPosition
      };
    }
    base[AVAILABLE_WIDTH_VAR] = "100vw";
    base[AVAILABLE_HEIGHT_VAR] = "100vh";
    if (!isPositioned) {
      base.opacity = 0;
    }
    return base;
  }, [adaptiveOrigin2, resolvedPosition, sideX, x2, sideY, y2, originalFloatingStyles, isPositioned]);
  const registeredPositionReferenceRef = React45.useRef(null);
  useIsoLayoutEffect(() => {
    if (!mounted) {
      return;
    }
    const anchorValue = anchorValueRef.current;
    const resolvedAnchor = typeof anchorValue === "function" ? anchorValue() : anchorValue;
    const unwrappedElement = (isRef(resolvedAnchor) ? resolvedAnchor.current : resolvedAnchor) || null;
    const finalAnchor = unwrappedElement || null;
    if (finalAnchor !== registeredPositionReferenceRef.current) {
      refs.setPositionReference(finalAnchor);
      registeredPositionReferenceRef.current = finalAnchor;
    }
  }, [mounted, refs, anchorDep, anchorValueRef]);
  React45.useEffect(() => {
    if (!mounted) {
      return;
    }
    const anchorValue = anchorValueRef.current;
    if (typeof anchorValue === "function") {
      return;
    }
    if (isRef(anchorValue) && anchorValue.current !== registeredPositionReferenceRef.current) {
      refs.setPositionReference(anchorValue.current);
      registeredPositionReferenceRef.current = anchorValue.current;
    }
  }, [mounted, refs, anchorDep, anchorValueRef]);
  React45.useEffect(() => {
    if (keepMounted && mounted && elements.reference && elements.floating) {
      return autoUpdate(elements.reference, elements.floating, update2, autoUpdateOptions);
    }
    return void 0;
  }, [keepMounted, mounted, elements, update2, autoUpdateOptions]);
  const renderedSide = getSide(renderedPlacement);
  const logicalRenderedSide = getLogicalSide(sideParam, renderedSide, isRtl);
  const renderedAlign = getAlignment(renderedPlacement) || "center";
  const anchorHidden2 = Boolean(middlewareData.hide?.referenceHidden);
  useIsoLayoutEffect(() => {
    if (lazyFlip && mounted && isPositioned && renderedSide !== side) {
      setMountSide(renderedSide);
    }
  }, [lazyFlip, mounted, isPositioned, renderedSide, side]);
  const arrowStyles = React45.useMemo(() => ({
    position: "absolute",
    top: middlewareData.arrow?.y,
    left: middlewareData.arrow?.x
  }), [middlewareData.arrow]);
  const arrowUncentered = middlewareData.arrow?.centerOffset !== 0;
  return React45.useMemo(() => ({
    positionerStyles: floatingStyles,
    arrowStyles,
    arrowRef,
    arrowUncentered,
    side: logicalRenderedSide,
    align: renderedAlign,
    physicalSide: renderedSide,
    anchorHidden: anchorHidden2,
    refs,
    context,
    isPositioned,
    update: update2
  }), [floatingStyles, arrowStyles, arrowRef, arrowUncentered, logicalRenderedSide, renderedAlign, renderedSide, anchorHidden2, refs, context, isPositioned, update2]);
}
function isRef(param) {
  return param != null && "current" in param;
}

// node_modules/@base-ui/react/internals/getDisabledMountTransitionStyles.mjs
function getDisabledMountTransitionStyles(transitionStatus) {
  return transitionStatus === "starting" ? DISABLED_TRANSITIONS_STYLE : EMPTY_OBJECT;
}

// node_modules/@base-ui/react/utils/usePositioner.mjs
function usePositioner(componentProps, state, {
  styles,
  transitionStatus,
  props,
  refs,
  hidden,
  inert = false
}) {
  const style = {
    ...styles
  };
  if (inert) {
    style.pointerEvents = "none";
  }
  return useRenderElement("div", componentProps, {
    state,
    ref: refs,
    props: [{
      role: "presentation",
      hidden,
      style
    }, getDisabledMountTransitionStyles(transitionStatus), props],
    stateAttributesMapping: popupStateMapping
  });
}

// node_modules/@base-ui/react/button/Button.mjs
var React46 = __toESM(require_react(), 1);
var Button = /* @__PURE__ */ React46.forwardRef(function Button2(componentProps, forwardedRef) {
  const {
    render: render4,
    className,
    disabled: disabled2 = false,
    focusableWhenDisabled = false,
    nativeButton = true,
    style,
    ...elementProps
  } = componentProps;
  const {
    getButtonProps,
    buttonRef
  } = useButton({
    disabled: disabled2,
    focusableWhenDisabled,
    native: nativeButton
  });
  const state = {
    disabled: disabled2
  };
  return useRenderElement("button", componentProps, {
    state,
    ref: [forwardedRef, buttonRef],
    props: [elementProps, getButtonProps]
  });
});
if (true) Button.displayName = "Button";

// node_modules/@base-ui/react/field/item/FieldItemContext.mjs
var React47 = __toESM(require_react(), 1);
var FieldItemContext = /* @__PURE__ */ React47.createContext({
  disabled: false
});
if (true) FieldItemContext.displayName = "FieldItemContext";
function useFieldItemContext() {
  const context = React47.useContext(FieldItemContext);
  return context;
}

// node_modules/@base-ui/react/field/root/useFieldValidation.mjs
var React48 = __toESM(require_react(), 1);

// node_modules/@base-ui/react/field/utils/getCombinedFieldValidityData.mjs
function getCombinedFieldValidityData(validityData, invalid2) {
  return {
    ...validityData,
    state: {
      ...validityData.state,
      valid: !invalid2 && validityData.state.valid
    }
  };
}

// node_modules/@base-ui/react/field/root/useFieldValidation.mjs
var validityKeys = Object.keys(DEFAULT_VALIDITY_STATE);
function isEligibleInput(input, formElement) {
  if (input.matches(":disabled")) {
    return false;
  }
  if (!formElement || input.form === formElement) {
    return true;
  }
  return input.form === null && !input.hasAttribute("form");
}
function findRepresentativeInput(inputs, formElement) {
  let fallback = null;
  for (const input of inputs.keys()) {
    if (!isEligibleInput(input, formElement)) {
      continue;
    }
    if (!input.validity.valid) {
      return input;
    }
    fallback ??= input;
  }
  return fallback;
}
function makeState(customError) {
  return {
    ...DEFAULT_VALIDITY_STATE,
    valid: !customError,
    customError
  };
}
function getNativeErrors(element) {
  return element && element.validationMessage ? [element.validationMessage] : [];
}
function useFieldValidation(params) {
  const {
    elementRef,
    formRef
  } = useFormContext();
  const {
    setValidityData,
    validate,
    validityData,
    validationDebounceTime,
    invalid: invalid2,
    markedDirtyRef,
    state,
    shouldValidateOnChange,
    validationMode,
    registeredFieldIdRef
  } = params;
  const {
    controlId,
    getDescriptionProps
  } = useLabelableContext();
  const timeout = useTimeout();
  const inputRef = React48.useRef(null);
  const registeredInputs = useRefWithInit(() => /* @__PURE__ */ new Map()).current;
  const validationCommitIdRef = React48.useRef(0);
  const customValidityRef = React48.useRef(null);
  const registerInput = React48.useCallback((element, registration) => {
    registeredInputs.set(element, registration);
    return () => {
      registeredInputs.delete(element);
    };
  }, [registeredInputs]);
  const getInputControl = useStableCallback(() => {
    const element = findRepresentativeInput(registeredInputs, elementRef.current);
    return element && registeredInputs.get(element)?.controlRef.current || null;
  });
  const commit = useStableCallback(async (value, revalidate = false) => {
    validationCommitIdRef.current += 1;
    const validationCommitId = validationCommitIdRef.current;
    function updateRegisteredFieldValidity(nextValidityData, externalInvalid = invalid2) {
      const fieldId = registeredFieldIdRef.current ?? controlId;
      if (fieldId == null) {
        return;
      }
      const currentFieldData = formRef.current.fields.get(fieldId);
      if (!currentFieldData) {
        return;
      }
      const validityDataWithFormErrors = getCombinedFieldValidityData(nextValidityData, externalInvalid);
      formRef.current.fields.set(fieldId, {
        ...currentFieldData,
        validityData: validityDataWithFormErrors
      });
    }
    function makeValidityData(validityState, errorMessages) {
      const errors = validityState.valid === false ? errorMessages : [];
      return {
        value,
        state: validityState,
        error: errors[0] ?? "",
        errors,
        initialValue: validityData.initialValue
      };
    }
    function setCustomValidity(element2, message2) {
      const displaced = element2.validity.customError ? element2.validationMessage : "";
      const ownedMessage = message2.replace(/\r\n?/g, "\n");
      element2.setCustomValidity(ownedMessage);
      customValidityRef.current = [element2, ownedMessage, displaced];
    }
    function clearCustomValidity() {
      const record = customValidityRef.current;
      customValidityRef.current = null;
      if (record && (!record[0].willValidate || record[0].validationMessage === record[1])) {
        record[0].setCustomValidity(record[2]);
      }
    }
    function publish(validityState, errorMessages, externalInvalid) {
      const nextValidityData = makeValidityData(validityState, errorMessages);
      updateRegisteredFieldValidity(nextValidityData, externalInvalid);
      setValidityData(nextValidityData);
    }
    function getState(el) {
      const computedState = validityKeys.reduce((acc, key) => {
        acc[key] = el.validity[key];
        return acc;
      }, {});
      let hasOnlyValueMissingError = false;
      for (const key of validityKeys) {
        if (key === "valid") {
          continue;
        }
        if (key === "valueMissing" && computedState[key]) {
          hasOnlyValueMissingError = true;
        } else if (computedState[key]) {
          return computedState;
        }
      }
      if (hasOnlyValueMissingError && !markedDirtyRef.current) {
        computedState.valid = true;
        computedState.valueMissing = false;
      }
      return computedState;
    }
    function resolveRepresentativeInput() {
      return registeredInputs.size > 0 ? findRepresentativeInput(registeredInputs, elementRef.current) : inputRef.current;
    }
    let element = resolveRepresentativeInput();
    function refreshState() {
      element = resolveRepresentativeInput();
      return element?.willValidate ? getState(element) : makeState(false);
    }
    if (revalidate) {
      if (state.valid !== false || !element) {
        return;
      }
      if (!element.validity.valueMissing) {
        clearCustomValidity();
        const currentElement = resolveRepresentativeInput();
        const foreign = currentElement?.validity.customError ? getNativeErrors(currentElement) : [];
        publish(makeState(foreign.length > 0), foreign, false);
        return;
      }
      for (const key of validityKeys) {
        if (key !== "valid" && key !== "valueMissing" && key !== "customError" && element.validity[key]) {
          return;
        }
      }
    }
    timeout.clear();
    clearCustomValidity();
    let nextState = refreshState();
    let validationErrors = getNativeErrors(element);
    const isValidatingOnChange = shouldValidateOnChange();
    if (validationErrors.length === 0 || isValidatingOnChange) {
      const formValues = Array.from(formRef.current.fields.values()).reduce((acc, field) => {
        if (field.name) {
          acc[field.name] = field.getValue();
        }
        return acc;
      }, {});
      const resultOrPromise = validate(value, formValues);
      let result;
      if (typeof resultOrPromise === "object" && resultOrPromise !== null && "then" in resultOrPromise) {
        if (nextState.valid === false) {
          publish(nextState, validationErrors);
        } else if (validationMode === "onSubmit" || !validityData.state.customError) {
          nextState.valid = null;
          publish(nextState, validationErrors);
        }
        result = await resultOrPromise;
        if (validationCommitId !== validationCommitIdRef.current) {
          return;
        }
        nextState = refreshState();
      } else {
        result = resultOrPromise;
      }
      validationErrors = result ? [].concat(result).filter(Boolean) : [];
      if (validationErrors.length > 0) {
        nextState.valid = false;
        nextState.customError = true;
        if (element?.willValidate) {
          setCustomValidity(element, validationErrors.join("\n"));
        }
      } else {
        validationErrors = getNativeErrors(element);
      }
    }
    publish(nextState, validationErrors);
  });
  const change = useStableCallback((value, cancelPending = false) => {
    timeout.clear();
    validationCommitIdRef.current += 1;
    if (cancelPending) {
      return;
    }
    const validateOnChange = shouldValidateOnChange();
    if (validateOnChange && value !== "" && validationDebounceTime) {
      timeout.start(validationDebounceTime, () => {
        commit(value);
      });
    } else {
      commit(value, !validateOnChange);
    }
  });
  const getValidationProps = React48.useCallback((disabled2, externalProps = {}) => mergeProps(getDescriptionProps(externalProps), state.valid === false && !state.disabled && !disabled2 ? {
    "aria-invalid": true
  } : EMPTY_OBJECT), [getDescriptionProps, state.disabled, state.valid]);
  return React48.useMemo(() => ({
    getValidationProps,
    inputRef,
    registeredInputs,
    registerInput,
    getInputControl,
    commit,
    change
  }), [getValidationProps, registeredInputs, registerInput, getInputControl, commit, change]);
}

// node_modules/@base-ui/react/collapsible/index.parts.mjs
var index_parts_exports = {};
__export(index_parts_exports, {
  Panel: () => CollapsiblePanel,
  Root: () => CollapsibleRoot,
  Trigger: () => CollapsibleTrigger
});

// node_modules/@base-ui/react/collapsible/root/CollapsibleRoot.mjs
var React49 = __toESM(require_react(), 1);

// node_modules/@base-ui/react/collapsible/root/stateAttributesMapping.mjs
var collapsibleStateAttributesMapping = {
  ...collapsibleOpenStateMapping,
  ...transitionStatusMapping
};

// node_modules/@base-ui/react/collapsible/root/CollapsibleRoot.mjs
var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1);
var CollapsibleRoot = /* @__PURE__ */ React49.forwardRef(function CollapsibleRoot2(componentProps, forwardedRef) {
  const {
    render: render4,
    className,
    defaultOpen = false,
    disabled: disabled2 = false,
    onOpenChange: onOpenChangeProp,
    open: open3,
    style,
    ...elementProps
  } = componentProps;
  const onOpenChange = useStableCallback(onOpenChangeProp);
  const collapsible = useCollapsibleRoot({
    open: open3,
    defaultOpen,
    onOpenChange,
    disabled: disabled2
  });
  const state = React49.useMemo(() => ({
    open: collapsible.open,
    disabled: collapsible.disabled,
    transitionStatus: collapsible.transitionStatus
  }), [collapsible.open, collapsible.disabled, collapsible.transitionStatus]);
  const contextValue = React49.useMemo(() => ({
    ...collapsible,
    onOpenChange,
    state
  }), [collapsible, onOpenChange, state]);
  const element = useRenderElement("div", componentProps, {
    state,
    ref: forwardedRef,
    props: elementProps,
    stateAttributesMapping: collapsibleStateAttributesMapping
  });
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(CollapsibleRootContext.Provider, {
    value: contextValue,
    children: element
  });
});
if (true) CollapsibleRoot.displayName = "CollapsibleRoot";

// node_modules/@base-ui/react/collapsible/trigger/CollapsibleTrigger.mjs
var React50 = __toESM(require_react(), 1);
var stateAttributesMapping = {
  ...triggerOpenStateMapping,
  ...transitionStatusMapping
};
var CollapsibleTrigger = /* @__PURE__ */ React50.forwardRef(function CollapsibleTrigger2(componentProps, forwardedRef) {
  const {
    panelId,
    open: open3,
    handleTrigger,
    state,
    disabled: contextDisabled
  } = useCollapsibleRootContext();
  const {
    className,
    disabled: disabled2 = contextDisabled,
    render: render4,
    nativeButton = true,
    style,
    ...elementProps
  } = componentProps;
  const {
    getButtonProps,
    buttonRef
  } = useButton({
    disabled: disabled2,
    focusableWhenDisabled: true,
    native: nativeButton
  });
  const element = useRenderElement("button", componentProps, {
    state,
    ref: [forwardedRef, buttonRef],
    props: [{
      "aria-controls": open3 ? panelId : void 0,
      "aria-expanded": open3,
      onClick: handleTrigger
    }, elementProps, getButtonProps],
    stateAttributesMapping
  });
  return element;
});
if (true) CollapsibleTrigger.displayName = "CollapsibleTrigger";

// node_modules/@base-ui/react/collapsible/panel/CollapsiblePanel.mjs
var React51 = __toESM(require_react(), 1);

// node_modules/@base-ui/react/collapsible/panel/CollapsiblePanelCssVars.mjs
var collapsiblePanelHeight = "--collapsible-panel-height";
var collapsiblePanelWidth = "--collapsible-panel-width";

// node_modules/@base-ui/react/collapsible/panel/CollapsiblePanel.mjs
var CollapsiblePanel = /* @__PURE__ */ React51.forwardRef(function CollapsiblePanel2(componentProps, forwardedRef) {
  const {
    className,
    hiddenUntilFound: hiddenUntilFoundProp,
    keepMounted: keepMountedProp,
    render: render4,
    id: idProp,
    style,
    ...elementProps
  } = componentProps;
  if (true) {
    React51.useEffect(() => {
      if (hiddenUntilFoundProp && keepMountedProp === false) {
        warn("The `keepMounted={false}` prop on `Collapsible.Panel` is ignored when `hiddenUntilFound` is enabled, since the panel must remain mounted while closed.");
      }
    }, [hiddenUntilFoundProp, keepMountedProp]);
  }
  const {
    defaultPanelId,
    mounted,
    onOpenChange,
    open: open3,
    setMounted,
    setPanelIdState,
    setOpen,
    state,
    transitionStatus
  } = useCollapsibleRootContext();
  const hiddenUntilFound = hiddenUntilFoundProp ?? false;
  const keepMounted = keepMountedProp ?? false;
  const registeredId = idProp || void 0;
  const id = registeredId ?? defaultPanelId;
  useIsoLayoutEffect(() => {
    setPanelIdState((currentId) => registeredId ?? (currentId === null ? void 0 : currentId));
    return () => {
      setPanelIdState((currentId) => currentId === registeredId ? null : currentId);
    };
  }, [registeredId, setPanelIdState]);
  const {
    height,
    props,
    ref,
    shouldPreventOpenAnimation,
    shouldRender,
    transitionStatus: panelTransitionStatus,
    width
  } = useCollapsiblePanel({
    externalRef: forwardedRef,
    hiddenUntilFound,
    id,
    keepMounted,
    mounted,
    onOpenChange,
    open: open3,
    setMounted,
    setOpen,
    transitionStatus
  });
  const panelState = {
    ...state,
    transitionStatus: panelTransitionStatus
  };
  const resolvedStyle = resolveStyle(style, panelState);
  const element = useRenderElement("div", {
    ...componentProps,
    style: void 0
  }, {
    state: panelState,
    ref,
    props: [
      props,
      {
        style: {
          [collapsiblePanelHeight]: height === void 0 ? "auto" : `${height}px`,
          [collapsiblePanelWidth]: width === void 0 ? "auto" : `${width}px`
        }
      },
      elementProps,
      resolvedStyle ? {
        style: resolvedStyle
      } : void 0,
      // Resolve the public `style` prop so temporary `animationName: 'none'`
      // can still win after user's inline styles have been merged.
      shouldPreventOpenAnimation ? {
        style: {
          animationName: "none"
        }
      } : void 0
    ],
    stateAttributesMapping: collapsibleStateAttributesMapping
  });
  if (!shouldRender) {
    return null;
  }
  return element;
});
if (true) CollapsiblePanel.displayName = "CollapsiblePanel";

// node_modules/@base-ui/react/utils/useRegisteredLabelId.mjs
function useRegisteredLabelId(idProp, setLabelId) {
  const id = useBaseUiId(idProp);
  useIsoLayoutEffect(() => {
    setLabelId(id);
    return () => {
      setLabelId((currentId) => currentId === id ? void 0 : currentId);
    };
  }, [id, setLabelId]);
  return id;
}

// node_modules/@base-ui/react/internals/labelable-provider/useLabel.mjs
function useLabel(params = {}) {
  const {
    id: idProp,
    fallbackControlId,
    native = false,
    setLabelId: setLabelIdProp,
    focusControl: focusControlProp
  } = params;
  const {
    controlId: contextControlId,
    setLabelId: setContextLabelId
  } = useLabelableContext();
  const syncLabelId = useStableCallback((nextLabelId) => {
    setContextLabelId(nextLabelId);
    setLabelIdProp?.(nextLabelId);
  });
  const id = useRegisteredLabelId(idProp, syncLabelId);
  const resolvedControlId = contextControlId ?? fallbackControlId;
  function focusControl(event) {
    if (focusControlProp) {
      focusControlProp(event, resolvedControlId);
      return;
    }
    if (!resolvedControlId) {
      return;
    }
    const controlElement = ownerDocument(event.currentTarget).getElementById(resolvedControlId);
    if (isHTMLElement(controlElement)) {
      focusElementWithVisible(controlElement);
    }
  }
  function handleInteraction(event) {
    const target = getTarget(event.nativeEvent);
    if (target?.closest("button,input,select,textarea")) {
      return;
    }
    if (!event.defaultPrevented && event.detail > 1) {
      event.preventDefault();
    }
    if (native) {
      return;
    }
    focusControl(event);
  }
  return native ? {
    id,
    htmlFor: resolvedControlId,
    onMouseDown: handleInteraction
  } : {
    id,
    onClick: handleInteraction,
    onPointerDown(event) {
      event.preventDefault();
    }
  };
}
function focusElementWithVisible(element) {
  element.focus({
    // Available from Chrome 144+ (January 2026).
    // Safari and Firefox already support it.
    focusVisible: true
  });
}

// node_modules/@base-ui/react/internals/composite/item/useCompositeItem.mjs
var React52 = __toESM(require_react(), 1);
function useCompositeItem(params = {}) {
  const {
    highlightItemOnHover,
    highlightedIndex,
    onHighlightedIndexChange
  } = useCompositeRootContext();
  const {
    ref,
    index: index3
  } = useCompositeListItem(params);
  const isHighlighted = highlightedIndex === index3;
  const itemRef = React52.useRef(null);
  const mergedRef = useMergedRefs(ref, itemRef);
  const compositeProps = {
    tabIndex: isHighlighted ? 0 : -1,
    onFocus() {
      onHighlightedIndexChange(index3);
    },
    onMouseMove() {
      const item = itemRef.current;
      if (!highlightItemOnHover || !item) {
        return;
      }
      const disabled2 = item.hasAttribute("disabled") || item.ariaDisabled === "true";
      if (!isHighlighted && !disabled2) {
        item.focus();
      }
    }
  };
  return {
    compositeProps,
    compositeRef: mergedRef,
    index: index3
  };
}

// node_modules/@base-ui/react/utils/usePopupViewport.mjs
var React56 = __toESM(require_react(), 1);
var ReactDOM6 = __toESM(require_react_dom(), 1);

// node_modules/@base-ui/utils/usePreviousValue.mjs
var React53 = __toESM(require_react(), 1);
function usePreviousValue(value) {
  const [state, setState] = React53.useState({
    current: value,
    previous: null
  });
  if (!Object.is(value, state.current)) {
    setState({
      current: value,
      previous: state.current
    });
  }
  return state.previous;
}

// node_modules/@base-ui/react/utils/usePopupAutoResize.mjs
var React54 = __toESM(require_react(), 1);

// node_modules/@base-ui/react/utils/getCssDimensions.mjs
function getCssDimensions2(element) {
  const css = getComputedStyle2(element);
  let width = parseFloat(css.width) || 0;
  let height = parseFloat(css.height) || 0;
  const hasOffset = isHTMLElement(element);
  const offsetWidth = hasOffset ? element.offsetWidth : width;
  const offsetHeight = hasOffset ? element.offsetHeight : height;
  const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
  if (shouldFallback) {
    width = offsetWidth;
    height = offsetHeight;
  }
  return {
    width,
    height
  };
}

// node_modules/@base-ui/react/utils/CommonPopupCssVars.mjs
var popupWidth = "--popup-width";
var popupHeight = "--popup-height";

// node_modules/@base-ui/react/utils/usePopupAutoResize.mjs
function usePopupAutoResize(parameters) {
  const {
    popupElement,
    positionerElement,
    content,
    mounted,
    onMeasureLayout: onMeasureLayoutParam,
    onMeasureLayoutComplete: onMeasureLayoutCompleteParam,
    side,
    direction
  } = parameters;
  const runOnceAnimationsFinish = useAnimationsFinished(popupElement, true);
  const animationFrame = useAnimationFrame();
  const committedDimensionsRef = React54.useRef(null);
  const isInitialRenderRef = React54.useRef(true);
  const restoreAnchoringStylesRef = React54.useRef(NOOP);
  const onMeasureLayout = useStableCallback(onMeasureLayoutParam);
  const onMeasureLayoutComplete = useStableCallback(onMeasureLayoutCompleteParam);
  const anchoringStyles = React54.useMemo(() => getPopupAnchoringStyles(side, direction), [side, direction]);
  useIsoLayoutEffect(() => {
    if (!mounted) {
      restoreAnchoringStylesRef.current = NOOP;
      isInitialRenderRef.current = true;
      committedDimensionsRef.current = null;
      return void 0;
    }
    if (!popupElement || !positionerElement) {
      return void 0;
    }
    restoreAnchoringStylesRef.current = applyElementStyles(popupElement, anchoringStyles);
    setPopupCssSize(popupElement, "auto");
    const restorePopupPosition = overrideElementStyle(popupElement, "position", "static");
    const restorePopupTransform = overrideElementStyle(popupElement, "transform", "none");
    const restorePopupScale = overrideElementStyle(popupElement, "scale", "1");
    const restorePositionerAvailableSize = applyElementStyles(positionerElement, {
      [availableWidth]: "max-content",
      [availableHeight]: "max-content"
    });
    function restoreMeasurementOverrides() {
      restorePopupPosition();
      restorePopupTransform();
      restorePositionerAvailableSize();
    }
    function restoreMeasurementOverridesIncludingScale() {
      restoreMeasurementOverrides();
      restorePopupScale();
    }
    onMeasureLayout?.();
    if (isInitialRenderRef.current || committedDimensionsRef.current === null) {
      setPositionerCssSize(positionerElement, "max-content");
      const dimensions = getCssDimensions2(popupElement);
      committedDimensionsRef.current = dimensions;
      setPositionerCssSize(positionerElement, dimensions);
      restoreMeasurementOverridesIncludingScale();
      onMeasureLayoutComplete?.(null, dimensions);
      isInitialRenderRef.current = false;
      return () => {
        restoreAnchoringStylesRef.current();
        restoreAnchoringStylesRef.current = NOOP;
      };
    }
    setPositionerCssSize(positionerElement, "max-content");
    const previousDimensions = committedDimensionsRef.current;
    const newDimensions = getCssDimensions2(popupElement);
    committedDimensionsRef.current = newDimensions;
    setPopupCssSize(popupElement, previousDimensions);
    restoreMeasurementOverridesIncludingScale();
    onMeasureLayoutComplete?.(previousDimensions, newDimensions);
    setPositionerCssSize(positionerElement, newDimensions);
    const abortController = new AbortController();
    animationFrame.request(() => {
      setPopupCssSize(popupElement, newDimensions);
      runOnceAnimationsFinish(() => {
        popupElement.style.setProperty(popupWidth, "auto");
        popupElement.style.setProperty(popupHeight, "auto");
      }, abortController.signal);
    });
    return () => {
      abortController.abort();
      animationFrame.cancel();
      restoreAnchoringStylesRef.current();
      restoreAnchoringStylesRef.current = NOOP;
    };
  }, [content, popupElement, positionerElement, runOnceAnimationsFinish, animationFrame, mounted, onMeasureLayout, onMeasureLayoutComplete, anchoringStyles]);
}
function getPopupAnchoringStyles(side, direction) {
  const isPhysicalTop = side === "top";
  const isPhysicalLeft = side === "left" || side === (direction === "rtl" ? "inline-end" : "inline-start");
  if (!isPhysicalTop && !isPhysicalLeft) {
    return EMPTY_OBJECT;
  }
  return {
    position: "absolute",
    [isPhysicalTop ? "bottom" : "top"]: "0",
    [isPhysicalLeft ? "right" : "left"]: "0"
  };
}
function overrideElementStyle(element, property, value) {
  const originalValue = element.style.getPropertyValue(property);
  element.style.setProperty(property, value);
  return () => {
    element.style.setProperty(property, originalValue);
  };
}
function applyElementStyles(element, styles) {
  const restorers = [];
  for (const [key, value] of Object.entries(styles)) {
    restorers.push(overrideElementStyle(element, key, value));
  }
  return restorers.length ? () => {
    restorers.forEach((restore) => restore());
  } : NOOP;
}
function setPopupCssSize(popupElement, size4) {
  const width = size4 === "auto" ? "auto" : `${size4.width}px`;
  const height = size4 === "auto" ? "auto" : `${size4.height}px`;
  popupElement.style.setProperty(popupWidth, width);
  popupElement.style.setProperty(popupHeight, height);
}
function setPositionerCssSize(positionerElement, size4) {
  const width = size4 === "max-content" ? "max-content" : `${size4.width}px`;
  const height = size4 === "max-content" ? "max-content" : `${size4.height}px`;
  positionerElement.style.setProperty(positionerWidth, width);
  positionerElement.style.setProperty(positionerHeight, height);
}

// node_modules/@base-ui/react/direction-provider/DirectionProvider.mjs
var React55 = __toESM(require_react(), 1);
var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1);
var DirectionProvider = function DirectionProvider2(props) {
  const {
    direction = "ltr"
  } = props;
  const contextValue = React55.useMemo(() => ({
    direction
  }), [direction]);
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DirectionContext.Provider, {
    value: contextValue,
    children: props.children
  });
};
if (true) DirectionProvider.displayName = "DirectionProvider";

// node_modules/@base-ui/react/utils/adaptiveOriginMiddleware.mjs
var adaptiveOrigin = {
  name: "adaptiveOrigin",
  async fn(state) {
    const {
      x: rawX,
      y: rawY,
      rects: {
        floating: floatRect
      },
      elements: {
        floating
      },
      platform: platform3,
      strategy,
      placement
    } = state;
    const win = getWindow(floating);
    const styles = win.getComputedStyle(floating);
    const hasTransition = styles.transitionDuration !== "0s" && styles.transitionDuration !== "";
    if (!hasTransition) {
      return {
        x: rawX,
        y: rawY,
        data: DEFAULT_SIDES
      };
    }
    const offsetParent = await platform3.getOffsetParent?.(floating);
    let offsetDimensions = {
      width: 0,
      height: 0
    };
    if (strategy === "fixed" && win?.visualViewport) {
      offsetDimensions = {
        width: win.visualViewport.width,
        height: win.visualViewport.height
      };
    } else if (offsetParent === win) {
      const doc = ownerDocument(floating);
      offsetDimensions = {
        width: doc.documentElement.clientWidth,
        height: doc.documentElement.clientHeight
      };
    } else if (await platform3.isElement?.(offsetParent)) {
      offsetDimensions = await platform3.getDimensions(offsetParent);
    }
    const currentSide = getSide(placement);
    let x2 = rawX;
    let y2 = rawY;
    if (currentSide === "left") {
      x2 = offsetDimensions.width - (rawX + floatRect.width);
    }
    if (currentSide === "top") {
      y2 = offsetDimensions.height - (rawY + floatRect.height);
    }
    const sideX = currentSide === "left" ? "right" : DEFAULT_SIDES.sideX;
    const sideY = currentSide === "top" ? "bottom" : DEFAULT_SIDES.sideY;
    return {
      x: x2,
      y: y2,
      data: {
        sideX,
        sideY
      }
    };
  }
};

// node_modules/@base-ui/react/utils/CommonViewportDataAttributes.mjs
var activationDirection = "data-activation-direction";

// node_modules/@base-ui/react/utils/usePopupViewport.mjs
var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
var popupViewportStateMapping = {
  activationDirection: (value) => value ? {
    [activationDirection]: value
  } : null
};
function usePopupViewport(parameters) {
  const {
    store: store2,
    side,
    children
  } = parameters;
  const direction = useDirection();
  const activeTrigger = store2.useState("activeTriggerElement");
  const activeTriggerId = store2.useState("activeTriggerId");
  const open3 = store2.useState("open");
  const payload = store2.useState("payload");
  const mounted = store2.useState("mounted");
  const popupElement = store2.useState("popupElement");
  const positionerElement = store2.useState("positionerElement");
  const previousActiveTrigger = usePreviousValue(open3 ? activeTrigger : null);
  const currentContentKey = usePopupContentKey(activeTriggerId, payload);
  const capturedNodeRef = React56.useRef(null);
  const [previousContentNode, setPreviousContentNode] = React56.useState(null);
  const [newTriggerOffset, setNewTriggerOffset] = React56.useState(null);
  const currentContainerRef = React56.useRef(null);
  const previousContainerRef = React56.useRef(null);
  const onAnimationsFinished = useAnimationsFinished(currentContainerRef, true);
  const cleanupFrame = useAnimationFrame();
  const cleanupControllerRef = React56.useRef(null);
  const [previousContentDimensions, setPreviousContentDimensions] = React56.useState(null);
  const [showStartingStyleAttribute, setShowStartingStyleAttribute] = React56.useState(false);
  useIsoLayoutEffect(() => {
    store2.set("adaptiveOrigin", adaptiveOrigin);
    return () => {
      store2.set("adaptiveOrigin", void 0);
    };
  }, [store2]);
  const handleMeasureLayout = useStableCallback(() => {
    currentContainerRef.current?.style.setProperty("animation", "none");
    currentContainerRef.current?.style.setProperty("transition", "none");
    previousContainerRef.current?.style.setProperty("display", "none");
  });
  const handleMeasureLayoutComplete = useStableCallback((previousDimensions) => {
    currentContainerRef.current?.style.removeProperty("animation");
    currentContainerRef.current?.style.removeProperty("transition");
    previousContainerRef.current?.style.removeProperty("display");
    if (previousDimensions) {
      setPreviousContentDimensions(previousDimensions);
    }
  });
  const armViewportCleanup = useStableCallback(() => {
    cleanupControllerRef.current?.abort();
    const controller = new AbortController();
    cleanupControllerRef.current = controller;
    onAnimationsFinished(() => {
      setPreviousContentNode(null);
      setPreviousContentDimensions(null);
      capturedNodeRef.current = null;
    }, controller.signal);
  });
  const lastHandledTriggerRef = React56.useRef(null);
  useIsoLayoutEffect(() => {
    if (!open3 || !mounted) {
      lastHandledTriggerRef.current = null;
    }
  }, [open3, mounted]);
  useIsoLayoutEffect(() => {
    if (activeTrigger && previousActiveTrigger && activeTrigger !== previousActiveTrigger && lastHandledTriggerRef.current !== activeTrigger && capturedNodeRef.current) {
      setPreviousContentNode(capturedNodeRef.current);
      setShowStartingStyleAttribute(true);
      const offset4 = calculateRelativePosition(previousActiveTrigger, activeTrigger);
      setNewTriggerOffset(offset4);
      lastHandledTriggerRef.current = activeTrigger;
    }
  }, [activeTrigger, previousActiveTrigger]);
  useIsoLayoutEffect(() => {
    if (previousContentNode == null) {
      return;
    }
    cleanupControllerRef.current?.abort();
    setShowStartingStyleAttribute(true);
    cleanupFrame.request(() => {
      ReactDOM6.flushSync(() => {
        setShowStartingStyleAttribute(false);
      });
      armViewportCleanup();
    });
  }, [currentContentKey, previousContentNode, armViewportCleanup, cleanupFrame]);
  useIsoLayoutEffect(() => {
    const source = currentContainerRef.current;
    if (!source) {
      return;
    }
    const wrapper = ownerDocument(source).createElement("div");
    for (const child of Array.from(source.childNodes)) {
      wrapper.appendChild(child.cloneNode(true));
    }
    capturedNodeRef.current = wrapper;
  });
  const isTransitioning = previousContentNode != null;
  let childrenToRender;
  if (!isTransitioning) {
    childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", {
      "data-current": true,
      ref: currentContainerRef,
      children
    }, currentContentKey);
  } else {
    childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(React56.Fragment, {
      children: [/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", {
        "data-previous": true,
        inert: inertValue(true),
        ref: previousContainerRef,
        style: {
          ...previousContentDimensions ? {
            [popupWidth]: `${previousContentDimensions.width}px`,
            [popupHeight]: `${previousContentDimensions.height}px`
          } : null,
          position: "absolute"
        },
        "data-ending-style": showStartingStyleAttribute ? void 0 : ""
      }, "previous"), /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", {
        "data-current": true,
        ref: currentContainerRef,
        "data-starting-style": showStartingStyleAttribute ? "" : void 0,
        children
      }, currentContentKey)]
    });
  }
  useIsoLayoutEffect(() => {
    const container = previousContainerRef.current;
    if (!container || !previousContentNode) {
      return;
    }
    container.replaceChildren(...Array.from(previousContentNode.childNodes));
  }, [previousContentNode]);
  usePopupAutoResize({
    popupElement,
    positionerElement,
    mounted,
    content: payload,
    onMeasureLayout: handleMeasureLayout,
    onMeasureLayoutComplete: handleMeasureLayoutComplete,
    side,
    direction
  });
  const state = {
    activationDirection: getActivationDirection(newTriggerOffset),
    transitioning: isTransitioning
  };
  return {
    children: childrenToRender,
    state
  };
}
function getActivationDirection(offset4) {
  if (!offset4) {
    return void 0;
  }
  return `${getValueWithTolerance(offset4.horizontal, 5, "right", "left")} ${getValueWithTolerance(offset4.vertical, 5, "down", "up")}`;
}
function getValueWithTolerance(value, tolerance, positiveLabel, negativeLabel) {
  if (value > tolerance) {
    return positiveLabel;
  }
  if (value < -tolerance) {
    return negativeLabel;
  }
  return "";
}
function calculateRelativePosition(from, to) {
  const fromRect = from.getBoundingClientRect();
  const toRect = to.getBoundingClientRect();
  const fromCenter = {
    x: fromRect.left + fromRect.width / 2,
    y: fromRect.top + fromRect.height / 2
  };
  const toCenter = {
    x: toRect.left + toRect.width / 2,
    y: toRect.top + toRect.height / 2
  };
  return {
    horizontal: toCenter.x - fromCenter.x,
    vertical: toCenter.y - fromCenter.y
  };
}
function usePopupContentKey(activeTriggerId, payload) {
  const [contentKey, setContentKey] = React56.useState(0);
  const previousActiveTriggerIdRef = React56.useRef(activeTriggerId);
  const previousPayloadRef = React56.useRef(payload);
  const pendingPayloadUpdateRef = React56.useRef(false);
  useIsoLayoutEffect(() => {
    const previousActiveTriggerId = previousActiveTriggerIdRef.current;
    const previousPayload = previousPayloadRef.current;
    const triggerIdChanged = activeTriggerId !== previousActiveTriggerId;
    const payloadChanged = payload !== previousPayload;
    if (triggerIdChanged) {
      setContentKey((value) => value + 1);
      pendingPayloadUpdateRef.current = !payloadChanged;
    } else if (pendingPayloadUpdateRef.current && payloadChanged) {
      setContentKey((value) => value + 1);
      pendingPayloadUpdateRef.current = false;
    }
    previousActiveTriggerIdRef.current = activeTriggerId;
    previousPayloadRef.current = payload;
  }, [activeTriggerId, payload]);
  return `${activeTriggerId ?? "current"}-${contentKey}`;
}

// node_modules/@base-ui/utils/isElementDisabled.mjs
function isElementDisabled(element) {
  return element == null || element.hasAttribute("disabled") || element.getAttribute("aria-disabled") === "true";
}

// node_modules/@base-ui/react/internals/csp-context/CSPContext.mjs
var React57 = __toESM(require_react(), 1);
var CSPContext = /* @__PURE__ */ React57.createContext(void 0);
if (true) CSPContext.displayName = "CSPContext";
var DEFAULT_CSP_CONTEXT_VALUE = {
  disableStyleElements: false
};
function useCSPContext() {
  return React57.useContext(CSPContext) ?? DEFAULT_CSP_CONTEXT_VALUE;
}

// node_modules/@base-ui/react/utils/getElementTransform.mjs
function getElementTransform(element, computedStyle) {
  const transform = (computedStyle ?? getWindow(element).getComputedStyle(element)).transform;
  let translateX = 0;
  let translateY = 0;
  let scale3 = 1;
  if (transform && transform !== "none") {
    const matrix = transform.match(/matrix(?:3d)?\(([^)]+)\)/);
    if (matrix) {
      const values = matrix[1].split(", ").map(parseFloat);
      if (values.length === 6) {
        translateX = values[4];
        translateY = values[5];
        scale3 = Math.sqrt(values[0] * values[0] + values[1] * values[1]);
      } else if (values.length === 16) {
        translateX = values[12];
        translateY = values[13];
        scale3 = values[0];
      }
    }
  }
  return {
    x: translateX,
    y: translateY,
    scale: scale3
  };
}

// node_modules/@base-ui/react/field/index.parts.mjs
var index_parts_exports2 = {};
__export(index_parts_exports2, {
  Control: () => FieldControl,
  Description: () => FieldDescription,
  Error: () => FieldError,
  Item: () => FieldItem,
  Label: () => FieldLabel,
  Root: () => FieldRoot,
  Validity: () => FieldValidity
});

// node_modules/@base-ui/react/field/root/FieldRoot.mjs
var React61 = __toESM(require_react(), 1);

// node_modules/@base-ui/react/fieldset/root/FieldsetRootContext.mjs
var React58 = __toESM(require_react(), 1);
var FieldsetRootContext = /* @__PURE__ */ React58.createContext(void 0);
if (true) FieldsetRootContext.displayName = "FieldsetRootContext";
function useFieldsetRootContext(optional = false) {
  const context = React58.useContext(FieldsetRootContext);
  if (!context && !optional) {
    throw new Error(true ? "Base UI: FieldsetRootContext is missing. Fieldset parts must be placed within <Fieldset.Root>." : formatErrorMessage_default(86));
  }
  return context;
}

// node_modules/@base-ui/react/internals/labelable-provider/LabelableProvider.mjs
var React59 = __toESM(require_react(), 1);
var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
var LabelableProvider = function LabelableProvider2(props) {
  const defaultId = useBaseUiId();
  const [controlIdState, setControlIdState] = React59.useState(defaultId);
  const [labelId, setLabelId] = React59.useState();
  const [messageIds, setMessageIds] = React59.useState([]);
  const controlId = controlIdState === void 0 ? defaultId : controlIdState;
  const registrationsRef = useRefWithInit(() => /* @__PURE__ */ new Map());
  const {
    messageIds: parentMessageIds
  } = useLabelableContext();
  const registerControlId = useStableCallback((source, nextId) => {
    const registrations = registrationsRef.current;
    if (nextId === void 0) {
      registrations.delete(source);
    } else {
      registrations.set(source, nextId);
    }
    setControlIdState((prev) => {
      if (registrations.size === 0) {
        return prev;
      }
      let nextControlId;
      for (const id of registrations.values()) {
        if (id === prev) {
          return prev;
        }
        if (nextControlId === void 0) {
          nextControlId = id;
        }
      }
      return nextControlId;
    });
  });
  const resetControlId = useStableCallback(() => {
    if (registrationsRef.current.size === 0) {
      setControlIdState(defaultId);
    }
  });
  const getDescriptionProps = React59.useCallback((externalProps) => {
    const ids = externalProps["aria-describedby"] ? externalProps["aria-describedby"].split(" ") : [];
    ids.push(...parentMessageIds, ...messageIds);
    return {
      ...externalProps,
      "aria-describedby": Array.from(new Set(ids)).join(" ") || void 0
    };
  }, [parentMessageIds, messageIds]);
  const contextValue = React59.useMemo(() => ({
    controlId,
    registerControlId,
    resetControlId,
    labelId,
    setLabelId,
    messageIds,
    setMessageIds,
    getDescriptionProps
  }), [controlId, registerControlId, resetControlId, labelId, setLabelId, messageIds, setMessageIds, getDescriptionProps]);
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(LabelableContext.Provider, {
    value: contextValue,
    children: props.children
  });
};
if (true) LabelableProvider.displayName = "LabelableProvider";

// node_modules/@base-ui/react/internals/field-register-control/useFieldControlRegistration.mjs
var React60 = __toESM(require_react(), 1);
function useFieldControlRegistration(params) {
  const {
    change,
    commit,
    invalid: invalid2,
    markedDirtyRef,
    name,
    setRegisteredFieldName,
    registeredFieldIdRef,
    setValidityData,
    validityData
  } = params;
  const {
    formRef
  } = useFormContext();
  const activeFieldControlSourceRef = React60.useRef(null);
  const registrationRef = React60.useRef(null);
  const initialValueCapturedRef = React60.useRef(false);
  const getValueForForm = useStableCallback(() => {
    const registration = registrationRef.current;
    if (!registration) {
      return void 0;
    }
    if (registration.getValue) {
      return registration.getValue();
    }
    return registration.value;
  });
  function getRegistrationValue(registration) {
    return registration.value === void 0 ? getValueForForm() : registration.value;
  }
  const validate = useStableCallback(() => {
    const registration = registrationRef.current;
    markedDirtyRef.current = true;
    if (!registration) {
      commit(validityData.value);
      return;
    }
    commit(getRegistrationValue(registration));
  });
  function refreshRegistration() {
    const registration = registrationRef.current;
    if (!registration || !registration.id) {
      return;
    }
    formRef.current.fields.set(registration.id, {
      getValue: getValueForForm,
      name: name ?? registration.name,
      controlRef: registration.controlRef,
      validityData: getCombinedFieldValidityData(validityData, invalid2),
      validate
    });
  }
  function deleteRegistration(id = registrationRef.current?.id) {
    if (id) {
      formRef.current.fields.delete(id);
    }
  }
  function captureInitialValue(registration) {
    if (initialValueCapturedRef.current) {
      return;
    }
    initialValueCapturedRef.current = true;
    const initialValue = getRegistrationValue(registration);
    setValidityData((prev) => prev.initialValue === initialValue ? prev : {
      ...prev,
      initialValue
    });
  }
  useIsoLayoutEffect(() => {
    const registration = registrationRef.current;
    if (!registration || !registration.id) {
      return;
    }
    setRegisteredFieldName(name ? void 0 : registration.name);
    formRef.current.fields.set(registration.id, {
      getValue: getValueForForm,
      name: name ?? registration.name,
      controlRef: registration.controlRef,
      validityData: getCombinedFieldValidityData(validityData, invalid2),
      validate
    });
  }, [formRef, getValueForForm, invalid2, name, setRegisteredFieldName, validate, validityData]);
  useIsoLayoutEffect(() => {
    const fields = formRef.current.fields;
    return () => {
      const id = registrationRef.current?.id;
      if (id) {
        fields.delete(id);
      }
    };
  }, [formRef]);
  const register3 = useStableCallback((source, registration) => {
    if (!registration) {
      if (activeFieldControlSourceRef.current === source) {
        activeFieldControlSourceRef.current = null;
        change(void 0, true);
        deleteRegistration();
        registrationRef.current = null;
        setRegisteredFieldName(void 0);
        registeredFieldIdRef.current = void 0;
      }
      return;
    }
    const previousId = registrationRef.current?.id;
    const previousSource = activeFieldControlSourceRef.current;
    if (previousSource && previousSource !== source) {
      change(void 0, true);
    }
    activeFieldControlSourceRef.current = source;
    registrationRef.current = registration;
    if (!name) {
      setRegisteredFieldName(registration.name);
    }
    registeredFieldIdRef.current = registration.id;
    if (previousId && previousId !== registration.id) {
      deleteRegistration(previousId);
    }
    captureInitialValue(registration);
    refreshRegistration();
  });
  return [validate, register3];
}

// node_modules/@base-ui/react/field/root/FieldRoot.mjs
var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
var FieldRootInner = /* @__PURE__ */ React61.forwardRef(function FieldRootInner2(componentProps, forwardedRef) {
  const {
    errors,
    validationMode: formValidationMode,
    submitCountRef
  } = useFormContext();
  const {
    render: render4,
    className,
    validate: validateProp,
    validationDebounceTime = 0,
    validationMode = formValidationMode,
    name,
    disabled: disabledProp = false,
    invalid: invalidProp,
    dirty: dirtyProp,
    touched: touchedProp,
    actionsRef,
    style,
    ...elementProps
  } = componentProps;
  const disabledFieldset = useFieldsetRootContext(true)?.disabled;
  const validate = useStableCallback(validateProp || (() => null));
  const disabled2 = disabledFieldset || disabledProp;
  const [touchedState, setTouchedUnwrapped] = React61.useState(false);
  const [dirtyState, setDirtyUnwrapped] = React61.useState(false);
  const [filled, setFilled] = React61.useState(false);
  const [focused, setFocused] = React61.useState(false);
  const dirty = dirtyProp ?? dirtyState;
  const touched = touchedProp ?? touchedState;
  const markedDirtyRef = React61.useRef(dirty);
  const registeredFieldIdRef = React61.useRef(void 0);
  const [registeredFieldName, setRegisteredFieldName] = React61.useState();
  const effectiveName = name ?? registeredFieldName;
  useIsoLayoutEffect(() => {
    if (dirtyProp !== void 0) {
      markedDirtyRef.current = dirtyProp;
    }
  }, [dirtyProp]);
  const setDirty = useStableCallback((value) => {
    if (dirtyProp !== void 0) {
      return;
    }
    if (value) {
      markedDirtyRef.current = true;
    }
    setDirtyUnwrapped(value);
  });
  const setTouched = useStableCallback((value) => {
    if (touchedProp !== void 0) {
      return;
    }
    setTouchedUnwrapped(value);
  });
  const shouldValidateOnChange = useStableCallback(() => validationMode === "onChange" || validationMode === "onSubmit" && submitCountRef.current > 0);
  const formError = effectiveName && Object.hasOwn(errors, effectiveName) ? errors[effectiveName] : null;
  const hasFormError = !!(Array.isArray(formError) ? formError.length : formError);
  const invalid2 = invalidProp === true || hasFormError;
  const [validityData, setValidityData] = React61.useState({
    state: DEFAULT_VALIDITY_STATE,
    error: "",
    errors: [],
    value: null,
    initialValue: null
  });
  const valid2 = !invalid2 && (disabled2 ? null : validityData.state.valid);
  const state = React61.useMemo(() => ({
    disabled: disabled2,
    touched,
    dirty,
    valid: valid2,
    filled,
    focused
  }), [disabled2, touched, dirty, valid2, filled, focused]);
  const validation = useFieldValidation({
    setValidityData,
    validate,
    validityData,
    validationDebounceTime,
    invalid: invalid2,
    markedDirtyRef,
    state,
    shouldValidateOnChange,
    validationMode,
    registeredFieldIdRef
  });
  const [validateFieldControl, registerFieldControl] = useFieldControlRegistration({
    change: validation.change,
    commit: validation.commit,
    invalid: invalid2,
    markedDirtyRef,
    name,
    setRegisteredFieldName,
    registeredFieldIdRef,
    setValidityData,
    validityData
  });
  React61.useImperativeHandle(actionsRef, () => ({
    validate: validateFieldControl
  }), [validateFieldControl]);
  const contextValue = React61.useMemo(() => ({
    invalid: invalid2,
    name: effectiveName,
    validityData,
    setValidityData,
    disabled: disabled2,
    setTouched,
    setDirty,
    setFilled,
    setFocused,
    validationMode,
    shouldValidateOnChange,
    state,
    registerFieldControl,
    validation
  }), [invalid2, effectiveName, validityData, disabled2, setTouched, setDirty, setFilled, setFocused, validationMode, shouldValidateOnChange, state, registerFieldControl, validation]);
  const element = useRenderElement("div", componentProps, {
    ref: forwardedRef,
    state,
    props: elementProps,
    stateAttributesMapping: fieldValidityMapping
  });
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FieldRootContext.Provider, {
    value: contextValue,
    children: element
  });
});
if (true) FieldRootInner.displayName = "FieldRootInner";
var FieldRoot = /* @__PURE__ */ React61.forwardRef(function FieldRoot2(componentProps, forwardedRef) {
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(LabelableProvider, {
    children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FieldRootInner, {
      ...componentProps,
      ref: forwardedRef
    })
  });
});
if (true) FieldRoot.displayName = "FieldRoot";

// node_modules/@base-ui/react/field/label/FieldLabel.mjs
var React62 = __toESM(require_react(), 1);
var FieldLabel = /* @__PURE__ */ React62.forwardRef(function FieldLabel2(componentProps, forwardedRef) {
  const {
    render: render4,
    className,
    style,
    id: idProp,
    nativeLabel = true,
    ...elementProps
  } = componentProps;
  const fieldRootContext = useFieldRootContext(false);
  const fieldItemContext = useFieldItemContext();
  const {
    labelId
  } = useLabelableContext();
  const state = {
    ...fieldRootContext.state,
    disabled: fieldRootContext.disabled || fieldItemContext.disabled
  };
  const labelRef = React62.useRef(null);
  const labelProps = useLabel({
    id: labelId ?? idProp,
    native: nativeLabel
  });
  if (true) {
    React62.useEffect(() => {
      if (!labelRef.current) {
        return;
      }
      const isLabelTag = labelRef.current.tagName === "LABEL";
      if (nativeLabel) {
        if (!isLabelTag) {
          const ownerStackMessage = SafeReact.captureOwnerStack?.() || "";
          const message2 = "<Field.Label> expected a <label> element because the `nativeLabel` prop is true. Rendering a non-<label> disables native label association, so `htmlFor` will not work. Use a real <label> in the `render` prop, or set `nativeLabel` to `false`.";
          error(`${message2}${ownerStackMessage}`);
        }
      } else if (isLabelTag) {
        const ownerStackMessage = SafeReact.captureOwnerStack?.() || "";
        const message2 = "<Field.Label> expected a non-<label> element because the `nativeLabel` prop is false. Rendering a <label> assumes native label behavior while Base UI treats it as non-native, which can cause unexpected pointer behavior. Use a non-<label> in the `render` prop, or set `nativeLabel` to `true`.";
        error(`${message2}${ownerStackMessage}`);
      }
    }, [nativeLabel]);
  }
  const element = useRenderElement("label", componentProps, {
    ref: [forwardedRef, labelRef],
    state,
    props: [labelProps, elementProps],
    stateAttributesMapping: fieldValidityMapping
  });
  return element;
});
if (true) FieldLabel.displayName = "FieldLabel";

// node_modules/@base-ui/react/field/error/FieldError.mjs
var React63 = __toESM(require_react(), 1);
var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
var stateAttributesMapping2 = {
  ...fieldValidityMapping,
  ...transitionStatusMapping
};
var FieldError = /* @__PURE__ */ React63.forwardRef(function FieldError2(componentProps, forwardedRef) {
  const {
    render: render4,
    id: idProp,
    className,
    match: match2,
    style,
    ...elementProps
  } = componentProps;
  const id = useBaseUiId(idProp);
  const {
    validityData,
    state: fieldState,
    name
  } = useFieldRootContext(false);
  const {
    setMessageIds
  } = useLabelableContext();
  const {
    errors
  } = useFormContext();
  const formError = name && Object.hasOwn(errors, name) ? errors[name] : null;
  const hasFormError = !!(Array.isArray(formError) ? formError.length : formError);
  const hasSpecificMatch = typeof match2 === "string";
  let rendered = false;
  if (match2 === true) {
    rendered = true;
  } else if (fieldState.disabled) {
    rendered = false;
  } else if (hasSpecificMatch) {
    rendered = Boolean(validityData.state[match2]);
  } else {
    rendered = hasFormError || validityData.state.valid === false;
  }
  const {
    mounted,
    transitionStatus,
    setMounted
  } = useTransitionStatus(rendered);
  useIsoLayoutEffect(() => {
    if (!rendered || !id) {
      return void 0;
    }
    setMessageIds((v2) => v2.concat(id));
    return () => {
      setMessageIds((v2) => v2.filter((item) => item !== id));
    };
  }, [rendered, id, setMessageIds]);
  const errorRef = React63.useRef(null);
  const [lastRenderedMessage, setLastRenderedMessage] = React63.useState(null);
  const [lastRenderedMessageKey, setLastRenderedMessageKey] = React63.useState(null);
  let error2 = validityData.error;
  if (!hasSpecificMatch && hasFormError) {
    error2 = formError;
  } else if (validityData.errors.length > 1) {
    error2 = validityData.errors;
  }
  let errorMessage = error2;
  if (Array.isArray(error2)) {
    errorMessage = error2.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("ul", {
      children: error2.map((message2) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("li", {
        children: message2
      }, message2))
    }) : error2[0];
  }
  const errorKey = Array.isArray(error2) ? JSON.stringify(error2) : error2;
  if (rendered && errorKey !== lastRenderedMessageKey) {
    setLastRenderedMessageKey(errorKey);
    setLastRenderedMessage(errorMessage);
  }
  useOpenChangeComplete({
    open: rendered,
    ref: errorRef,
    onComplete() {
      if (!rendered) {
        setMounted(false);
      }
    }
  });
  const state = {
    ...fieldState,
    transitionStatus
  };
  const element = useRenderElement("div", componentProps, {
    ref: [forwardedRef, errorRef],
    state,
    props: [{
      id,
      children: rendered ? errorMessage : lastRenderedMessage
    }, elementProps],
    stateAttributesMapping: stateAttributesMapping2,
    enabled: mounted
  });
  if (!mounted) {
    return null;
  }
  return element;
});
if (true) FieldError.displayName = "FieldError";

// node_modules/@base-ui/react/field/description/FieldDescription.mjs
var React64 = __toESM(require_react(), 1);
var FieldDescription = /* @__PURE__ */ React64.forwardRef(function FieldDescription2(componentProps, forwardedRef) {
  const {
    render: render4,
    id: idProp,
    className,
    style,
    ...elementProps
  } = componentProps;
  const id = useBaseUiId(idProp);
  const fieldRootContext = useFieldRootContext(false);
  const fieldItemContext = useFieldItemContext();
  const {
    setMessageIds
  } = useLabelableContext();
  const state = {
    ...fieldRootContext.state,
    disabled: fieldRootContext.disabled || fieldItemContext.disabled
  };
  useIsoLayoutEffect(() => {
    if (!id) {
      return void 0;
    }
    setMessageIds((v2) => v2.concat(id));
    return () => {
      setMessageIds((v2) => v2.filter((item) => item !== id));
    };
  }, [id, setMessageIds]);
  const element = useRenderElement("p", componentProps, {
    ref: forwardedRef,
    state,
    props: [{
      id
    }, elementProps],
    stateAttributesMapping: fieldValidityMapping
  });
  return element;
});
if (true) FieldDescription.displayName = "FieldDescription";

// node_modules/@base-ui/react/field/control/FieldControl.mjs
var React65 = __toESM(require_react(), 1);
var FieldControl = /* @__PURE__ */ React65.forwardRef(function FieldControl2(componentProps, forwardedRef) {
  const {
    render: render4,
    className,
    id: idProp,
    name: nameProp,
    value: valueProp,
    disabled: disabledProp = false,
    onValueChange,
    defaultValue,
    autoFocus = false,
    style,
    ...elementProps
  } = componentProps;
  const {
    state: fieldState,
    name: fieldName,
    disabled: fieldDisabled,
    setTouched,
    setDirty,
    validityData,
    setFocused,
    setFilled,
    validationMode,
    validation
  } = useFieldRootContext();
  const {
    clearErrors,
    elementRef: formElementRef,
    submitCountRef
  } = useFormContext();
  const disabled2 = fieldDisabled || disabledProp;
  const name = fieldName ?? nameProp;
  const state = {
    ...fieldState,
    disabled: disabled2
  };
  const {
    labelId
  } = useLabelableContext();
  const id = useLabelableId({
    id: idProp
  });
  const [valueUnwrapped] = useControlled({
    controlled: valueProp,
    default: defaultValue,
    name: "FieldControl",
    state: "value"
  });
  const isControlled = valueProp !== void 0;
  const value = isControlled ? valueUnwrapped : void 0;
  const serializedValue = value == null ? void 0 : String(value);
  const getValueFromInput = useStableCallback(() => validation.inputRef.current?.value);
  useRegisterFieldControl(validation.inputRef, id, serializedValue, getValueFromInput, !disabled2, nameProp);
  useIsoLayoutEffect(() => {
    const currentValue = serializedValue ?? validation.inputRef.current?.value;
    if (currentValue !== void 0) {
      setFilled(currentValue !== "");
    }
  }, [serializedValue, validation.inputRef, setFilled]);
  useValueChanged(serializedValue, () => {
    if (serializedValue === void 0) {
      return;
    }
    clearErrors(name);
    setDirty(serializedValue !== (validityData.initialValue ?? ""));
    validation.change(serializedValue);
  });
  const inputRef = React65.useRef(null);
  const enterValidationTimeout = useTimeout();
  useIsoLayoutEffect(() => {
    if (autoFocus && inputRef.current === activeElement(ownerDocument(inputRef.current))) {
      setFocused(true);
    }
  }, [autoFocus, setFocused]);
  const element = useRenderElement("input", componentProps, {
    ref: [forwardedRef, inputRef],
    state,
    props: [{
      id,
      disabled: disabled2,
      name,
      ref: validation.inputRef,
      "aria-labelledby": labelId,
      autoFocus,
      ...isControlled ? {
        value
      } : {
        defaultValue
      },
      onChange(event) {
        const inputValue = event.currentTarget.value;
        const details = createChangeEventDetails(reason_parts_exports.none, event.nativeEvent);
        onValueChange?.(inputValue, details);
        if (isControlled) {
          return;
        }
        setDirty(inputValue !== (validityData.initialValue ?? ""));
        setFilled(inputValue !== "");
        if (!event.nativeEvent.defaultPrevented && !details.isCanceled) {
          clearErrors(name);
          validation.change(inputValue);
        }
      },
      onFocus() {
        setFocused(true);
      },
      onBlur(event) {
        setTouched(true);
        setFocused(false);
        if (validationMode === "onBlur") {
          const inputValue = event.currentTarget.value;
          validation.commit(inputValue);
          if (isControlled) {
            queueMicrotask(() => {
              const nextValue = validation.inputRef.current?.value;
              if (nextValue !== void 0 && nextValue !== inputValue && nextValue !== (validityData.initialValue ?? "")) {
                validation.commit(nextValue);
              }
            });
          }
        }
      },
      onKeyDown(event) {
        if (event.currentTarget.tagName === "INPUT" && event.key === "Enter") {
          setTouched(true);
          const value2 = event.currentTarget.value;
          const form = event.currentTarget.form;
          if (form && form === formElementRef.current && !event.defaultPrevented) {
            const input = event.currentTarget;
            const submitCount = submitCountRef.current;
            enterValidationTimeout.start(0, () => {
              if (submitCountRef.current === submitCount) {
                validation.commit(input.value);
              }
            });
          } else {
            validation.commit(value2);
          }
        }
      }
    }, elementProps, (props) => validation.getValidationProps(disabled2, props)],
    stateAttributesMapping: fieldValidityMapping
  });
  return element;
});
if (true) FieldControl.displayName = "FieldControl";

// node_modules/@base-ui/react/field/validity/FieldValidity.mjs
var React66 = __toESM(require_react(), 1);
var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
var FieldValidity = function FieldValidity2(props) {
  const {
    children
  } = props;
  const {
    validityData,
    invalid: invalid2
  } = useFieldRootContext(false);
  const combinedFieldValidityData = React66.useMemo(() => getCombinedFieldValidityData(validityData, invalid2), [validityData, invalid2]);
  const isInvalid = combinedFieldValidityData.state.valid === false;
  const {
    transitionStatus
  } = useTransitionStatus(isInvalid);
  const fieldValidityState = React66.useMemo(() => {
    return {
      ...combinedFieldValidityData,
      validity: combinedFieldValidityData.state,
      transitionStatus
    };
  }, [combinedFieldValidityData, transitionStatus]);
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(React66.Fragment, {
    children: children(fieldValidityState)
  });
};
if (true) FieldValidity.displayName = "FieldValidity";

// node_modules/@base-ui/react/field/item/FieldItem.mjs
var React67 = __toESM(require_react(), 1);
var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
var FieldItem = /* @__PURE__ */ React67.forwardRef(function FieldItem2(componentProps, forwardedRef) {
  const {
    render: render4,
    className,
    style,
    disabled: disabledProp = false,
    ...elementProps
  } = componentProps;
  const {
    state: fieldState,
    disabled: rootDisabled
  } = useFieldRootContext(false);
  const disabled2 = rootDisabled || disabledProp;
  const state = {
    ...fieldState,
    disabled: disabled2
  };
  const fieldItemContext = React67.useMemo(() => ({
    disabled: disabled2
  }), [disabled2]);
  const element = useRenderElement("div", componentProps, {
    ref: forwardedRef,
    state,
    props: elementProps,
    stateAttributesMapping: fieldValidityMapping
  });
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(LabelableProvider, {
    children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(FieldItemContext.Provider, {
      value: fieldItemContext,
      children: element
    })
  });
});
if (true) FieldItem.displayName = "FieldItem";

// node_modules/@base-ui/react/input/Input.mjs
var React68 = __toESM(require_react(), 1);
var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
var Input = /* @__PURE__ */ React68.forwardRef(function Input2(props, forwardedRef) {
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(index_parts_exports2.Control, {
    ref: forwardedRef,
    ...props
  });
});
if (true) Input.displayName = "Input";

// node_modules/@base-ui/react/internals/composite/root/CompositeRoot.mjs
var React70 = __toESM(require_react(), 1);

// node_modules/@base-ui/react/internals/composite/root/useCompositeRoot.mjs
var React69 = __toESM(require_react(), 1);

// node_modules/@base-ui/react/internals/composite/constants.mjs
var ACTIVE_COMPOSITE_ITEM = "data-composite-item-active";

// node_modules/@base-ui/react/internals/composite/root/useCompositeRoot.mjs
function useCompositeRoot(params) {
  const {
    loopFocus = true,
    orientation = "both",
    grid,
    onLoop,
    direction,
    highlightedIndex: externalHighlightedIndex,
    onHighlightedIndexChange: externalSetHighlightedIndex,
    rootRef: externalRef,
    enableHomeAndEndKeys = false,
    stopEventPropagation,
    disabledIndices,
    modifierKeys = EMPTY_ARRAY
  } = params;
  const [internalHighlightedIndex, internalSetHighlightedIndex] = React69.useState(0);
  const isGrid = grid != null;
  const rootRef = React69.useRef(null);
  const mergedRef = useMergedRefs(rootRef, externalRef);
  const elementsRef = React69.useRef([]);
  const hasSetDefaultIndexRef = React69.useRef(false);
  const highlightedElementRef = React69.useRef(null);
  const highlightedIndex = externalHighlightedIndex ?? internalHighlightedIndex;
  const onHighlightedIndexChange = useStableCallback((index3, shouldScrollIntoView = false) => {
    highlightedElementRef.current = elementsRef.current[index3] ?? null;
    (externalSetHighlightedIndex ?? internalSetHighlightedIndex)(index3);
    if (shouldScrollIntoView) {
      const newActiveItem = elementsRef.current[index3];
      scrollIntoViewIfNeeded(rootRef.current, newActiveItem, direction, orientation);
    }
  });
  const onMapChange = useStableCallback((map) => {
    if (map.size === 0) {
      return;
    }
    if (hasSetDefaultIndexRef.current) {
      const elements = elementsRef.current;
      const nextIndex = elements.indexOf(highlightedElementRef.current);
      if (nextIndex === -1) {
        const replacement = elements[highlightedIndex];
        if (!replacement || isListIndexDisabled(elements, highlightedIndex, disabledIndices)) {
          onHighlightedIndexChange(getFallbackIndex(elements, disabledIndices));
        } else {
          highlightedElementRef.current = replacement;
        }
      } else if (nextIndex !== highlightedIndex) {
        onHighlightedIndexChange(nextIndex);
      }
      return;
    }
    hasSetDefaultIndexRef.current = true;
    const sortedElements = Array.from(map.keys());
    const activeItem = sortedElements.find((compositeElement) => compositeElement?.hasAttribute(ACTIVE_COMPOSITE_ITEM)) ?? null;
    const activeIndex = activeItem ? map.get(activeItem)?.index ?? -1 : -1;
    if (activeIndex !== -1) {
      onHighlightedIndexChange(activeIndex);
    } else if (isListIndexDisabled(sortedElements, highlightedIndex, disabledIndices)) {
      const firstEnabledIndex = findNonDisabledListIndex(sortedElements, {
        disabledIndices
      });
      if (!isIndexOutOfListBounds(sortedElements, firstEnabledIndex)) {
        onHighlightedIndexChange(firstEnabledIndex);
      }
    }
    scrollIntoViewIfNeeded(rootRef.current, activeItem, direction, orientation);
  });
  useIsoLayoutEffect(() => {
    if (disabledIndices == null || externalHighlightedIndex != null || !hasSetDefaultIndexRef.current) {
      return;
    }
    const elements = elementsRef.current;
    if (isListIndexDisabled(elements, highlightedIndex, disabledIndices)) {
      const firstEnabledIndex = findNonDisabledListIndex(elements, {
        disabledIndices
      });
      if (!isIndexOutOfListBounds(elements, firstEnabledIndex)) {
        onHighlightedIndexChange(firstEnabledIndex);
      }
    }
  }, [disabledIndices, externalHighlightedIndex, highlightedIndex, elementsRef, onHighlightedIndexChange]);
  const wrappedOnLoop = useStableCallback((event, prevIndex, nextIndex) => {
    if (!onLoop) {
      return nextIndex;
    }
    return onLoop(event, prevIndex, nextIndex, elementsRef);
  });
  const onKeyDown = useStableCallback((event) => {
    const isHomeOrEnd = event.key === HOME || event.key === END;
    if (!COMPOSITE_KEYS.has(event.key) || !enableHomeAndEndKeys && isHomeOrEnd) {
      return;
    }
    if (isModifierKeySet(event, modifierKeys)) {
      return;
    }
    const element = rootRef.current;
    if (!element) {
      return;
    }
    const isRtl = direction === "rtl";
    const horizontalForwardKey = isRtl ? ARROW_LEFT : ARROW_RIGHT;
    const horizontalBackwardKey = isRtl ? ARROW_RIGHT : ARROW_LEFT;
    const forwardKey = orientation === "vertical" ? ARROW_DOWN : horizontalForwardKey;
    const backwardKey = orientation === "vertical" ? ARROW_UP : horizontalBackwardKey;
    const target = getTarget(event.nativeEvent);
    if (target != null && isNativeInput(target) && !isElementDisabled(target)) {
      const selectionStart = target.selectionStart;
      const selectionEnd = target.selectionEnd;
      const textContent = target.value;
      if (selectionStart == null || event.shiftKey || selectionStart !== selectionEnd) {
        return;
      }
      if (event.key !== backwardKey && selectionStart < textContent.length) {
        return;
      }
      if (event.key !== forwardKey && selectionStart > 0) {
        return;
      }
    }
    let nextIndex = highlightedIndex;
    const minIndex = getMinListIndex(elementsRef, disabledIndices);
    const maxIndex = getMaxListIndex(elementsRef, disabledIndices);
    if (grid != null) {
      nextIndex = grid({
        disabledIndices,
        elementsRef,
        event,
        highlightedIndex,
        loopFocus,
        maxIndex,
        minIndex,
        onLoop: wrappedOnLoop,
        orientation,
        rtl: isRtl
      });
    }
    const isForwardKey = orientation !== "vertical" && event.key === horizontalForwardKey || orientation !== "horizontal" && event.key === ARROW_DOWN;
    const isBackwardKey = orientation !== "vertical" && event.key === horizontalBackwardKey || orientation !== "horizontal" && event.key === ARROW_UP;
    if (enableHomeAndEndKeys) {
      if (event.key === HOME) {
        nextIndex = minIndex;
      } else if (event.key === END) {
        nextIndex = maxIndex;
      }
    }
    if (nextIndex === highlightedIndex && (isForwardKey || isBackwardKey)) {
      if (loopFocus && nextIndex === maxIndex && isForwardKey) {
        nextIndex = minIndex;
        if (onLoop) {
          nextIndex = onLoop(event, highlightedIndex, nextIndex, elementsRef);
        }
      } else if (loopFocus && nextIndex === minIndex && isBackwardKey) {
        nextIndex = maxIndex;
        if (onLoop) {
          nextIndex = onLoop(event, highlightedIndex, nextIndex, elementsRef);
        }
      } else {
        nextIndex = findNonDisabledListIndex(elementsRef.current, {
          startingIndex: nextIndex,
          decrement: isBackwardKey,
          disabledIndices
        });
      }
    }
    if (nextIndex !== highlightedIndex && !isIndexOutOfListBounds(elementsRef.current, nextIndex)) {
      if (stopEventPropagation) {
        event.stopPropagation();
      }
      if (isGrid || isHomeOrEnd || isForwardKey || isBackwardKey) {
        event.preventDefault();
      }
      onHighlightedIndexChange(nextIndex, true);
      queueMicrotask(() => {
        elementsRef.current[nextIndex]?.focus();
      });
    }
  });
  const props = {
    ref: mergedRef,
    onFocus(event) {
      const element = rootRef.current;
      const target = getTarget(event.nativeEvent);
      if (!element || target == null || !isNativeInput(target)) {
        return;
      }
      target.setSelectionRange(0, target.value.length);
    },
    onKeyDown
  };
  return {
    props,
    highlightedIndex,
    onHighlightedIndexChange,
    elementsRef,
    onMapChange,
    relayKeyboardEvent: onKeyDown
  };
}
function getFallbackIndex(elements, disabledIndices) {
  let fallbackIndex = -1;
  for (let index3 = 0; index3 < elements.length; index3 += 1) {
    const element = elements[index3];
    if (!element || isListIndexDisabled(elements, index3, disabledIndices)) {
      continue;
    }
    if (element.hasAttribute(ACTIVE_COMPOSITE_ITEM)) {
      return index3;
    }
    if (fallbackIndex === -1) {
      fallbackIndex = index3;
    }
  }
  return Math.max(fallbackIndex, 0);
}
function isModifierKeySet(event, ignoredModifierKeys) {
  for (const key of MODIFIER_KEYS) {
    if (ignoredModifierKeys.includes(key)) {
      continue;
    }
    if (event.getModifierState(key)) {
      return true;
    }
  }
  return false;
}

// node_modules/@base-ui/react/internals/composite/root/CompositeRoot.mjs
var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
function CompositeRoot(componentProps) {
  const {
    render: render4,
    className,
    style,
    refs = EMPTY_ARRAY,
    props = EMPTY_ARRAY,
    state = EMPTY_OBJECT,
    stateAttributesMapping: stateAttributesMapping5,
    highlightedIndex: highlightedIndexProp,
    onHighlightedIndexChange: onHighlightedIndexChangeProp,
    orientation,
    grid,
    loopFocus,
    onLoop,
    enableHomeAndEndKeys,
    onMapChange: onMapChangeProp,
    stopEventPropagation = true,
    rootRef,
    disabledIndices,
    modifierKeys,
    highlightItemOnHover = false,
    tag = "div",
    ...elementProps
  } = componentProps;
  const direction = useDirection();
  const {
    props: defaultProps,
    highlightedIndex,
    onHighlightedIndexChange,
    elementsRef,
    onMapChange: onMapChangeUnwrapped,
    relayKeyboardEvent
  } = useCompositeRoot({
    grid,
    loopFocus,
    onLoop,
    orientation,
    highlightedIndex: highlightedIndexProp,
    onHighlightedIndexChange: onHighlightedIndexChangeProp,
    rootRef,
    stopEventPropagation,
    enableHomeAndEndKeys,
    direction,
    disabledIndices,
    modifierKeys
  });
  const element = useRenderElement(tag, componentProps, {
    state,
    ref: refs,
    props: [defaultProps, ...props, elementProps],
    stateAttributesMapping: stateAttributesMapping5
  });
  const contextValue = React70.useMemo(() => ({
    highlightedIndex,
    onHighlightedIndexChange,
    highlightItemOnHover,
    relayKeyboardEvent
  }), [highlightedIndex, onHighlightedIndexChange, highlightItemOnHover, relayKeyboardEvent]);
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CompositeRootContext.Provider, {
    value: contextValue,
    children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CompositeList, {
      elementsRef,
      onMapChange: (newMap) => {
        onMapChangeProp?.(newMap);
        onMapChangeUnwrapped(newMap);
      },
      children: element
    })
  });
}

// node_modules/@base-ui/react/utils/FloatingPortalLite.mjs
var React71 = __toESM(require_react(), 1);
var ReactDOM7 = __toESM(require_react_dom(), 1);
var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1);
var FloatingPortalLite = /* @__PURE__ */ React71.forwardRef(function FloatingPortalLite2(componentProps, forwardedRef) {
  const {
    children,
    container,
    className,
    render: render4,
    style,
    ...elementProps
  } = componentProps;
  const {
    node: portalNode,
    subtree: portalSubtree
  } = useFloatingPortalNode({
    container,
    ref: forwardedRef,
    componentProps,
    elementProps
  });
  if (!portalSubtree && !portalNode) {
    return null;
  }
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(React71.Fragment, {
    children: [portalSubtree, portalNode && /* @__PURE__ */ ReactDOM7.createPortal(children, portalNode)]
  });
});
if (true) FloatingPortalLite.displayName = "FloatingPortalLite";

// node_modules/@base-ui/react/internals/prehydrationScript.stub.mjs
var script = "";

// node_modules/@base-ui/react/utils/useIsHydrating.mjs
var import_shim3 = __toESM(require_shim(), 1);
function subscribe() {
  return NOOP;
}
function getSnapshot() {
  return false;
}
function getServerSnapshot() {
  return true;
}
function useIsHydrating() {
  return (0, import_shim3.useSyncExternalStore)(subscribe, getSnapshot, getServerSnapshot);
}

// node_modules/@base-ui/react/internals/PrehydrationScript.mjs
var React72 = __toESM(require_react(), 1);
var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1);
function PrehydrationScript(props) {
  const {
    script: script2
  } = props;
  const {
    nonce
  } = useCSPContext();
  const isHydrating = useIsHydrating();
  if (!isHydrating) {
    return null;
  }
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("script", {
    nonce,
    dangerouslySetInnerHTML: {
      __html: script2
    },
    suppressHydrationWarning: true
  });
}

// node_modules/@base-ui/react/tabs/index.parts.mjs
var index_parts_exports3 = {};
__export(index_parts_exports3, {
  Indicator: () => TabsIndicator,
  List: () => TabsList,
  Panel: () => TabsPanel,
  Root: () => TabsRoot,
  Tab: () => TabsTab
});

// node_modules/@base-ui/react/tabs/root/TabsRoot.mjs
var React74 = __toESM(require_react(), 1);

// node_modules/@base-ui/react/tabs/root/TabsRootContext.mjs
var React73 = __toESM(require_react(), 1);
var TabsRootContext = /* @__PURE__ */ React73.createContext(void 0);
if (true) TabsRootContext.displayName = "TabsRootContext";
function useTabsRootContext() {
  const context = React73.useContext(TabsRootContext);
  if (context === void 0) {
    throw new Error(true ? "Base UI: TabsRootContext is missing. Tabs parts must be placed within <Tabs.Root>." : formatErrorMessage_default(64));
  }
  return context;
}

// node_modules/@base-ui/react/tabs/root/TabsRootDataAttributes.mjs
var activationDirection2 = "data-activation-direction";

// node_modules/@base-ui/react/tabs/root/stateAttributesMapping.mjs
var tabsStateAttributesMapping = {
  tabActivationDirection: (dir) => ({
    [activationDirection2]: dir
  })
};

// node_modules/@base-ui/react/tabs/root/TabsRoot.mjs
var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1);
var TabsRoot = /* @__PURE__ */ React74.forwardRef(function TabsRoot2(componentProps, forwardedRef) {
  const {
    className,
    defaultValue: defaultValueProp = 0,
    onValueChange: onValueChangeProp,
    orientation = "horizontal",
    render: render4,
    value: valueProp,
    style,
    ...elementProps
  } = componentProps;
  const hasExplicitDefaultValueProp = componentProps.defaultValue !== void 0;
  const tabPanelRefs = React74.useRef([]);
  const [mountedTabPanels, setMountedTabPanels] = React74.useState(() => /* @__PURE__ */ new Map());
  const [value, setValue] = useControlled({
    controlled: valueProp,
    default: defaultValueProp,
    name: "Tabs",
    state: "value"
  });
  const isControlled = valueProp !== void 0;
  const [tabMap, setTabMap] = React74.useState(() => /* @__PURE__ */ new Map());
  const lastKnownTabElementRef = React74.useRef(void 0);
  const getTabElementBySelectedValue = React74.useCallback((selectedValue) => findTabElement(tabMap, selectedValue), [tabMap]);
  const [activationDirectionState, setActivationDirectionState] = React74.useState(() => ({
    previousValue: value,
    tabActivationDirection: "none"
  }));
  const {
    previousValue,
    tabActivationDirection: committedTabActivationDirection
  } = activationDirectionState;
  let tabActivationDirection = committedTabActivationDirection;
  let directionComputationIncomplete = false;
  if (previousValue !== value) {
    tabActivationDirection = computeActivationDirection(previousValue, value, orientation, tabMap);
    directionComputationIncomplete = previousValue != null && value != null && getTabElementBySelectedValue(value) == null;
  }
  const nextPreviousValue = directionComputationIncomplete ? previousValue : value;
  const shouldSyncActivationDirectionState = previousValue !== nextPreviousValue || committedTabActivationDirection !== tabActivationDirection;
  useIsoLayoutEffect(() => {
    if (!shouldSyncActivationDirectionState) {
      return;
    }
    setActivationDirectionState({
      previousValue: nextPreviousValue,
      tabActivationDirection
    });
  }, [nextPreviousValue, shouldSyncActivationDirectionState, tabActivationDirection]);
  const onValueChange = useStableCallback((newValue, eventDetails) => {
    const activationDirection3 = computeActivationDirection(value, newValue, orientation, tabMap);
    eventDetails.activationDirection = activationDirection3;
    onValueChangeProp?.(newValue, eventDetails);
    if (eventDetails.isCanceled) {
      return;
    }
    setValue(newValue);
  });
  const notifyAutomaticValueChange = useStableCallback((nextValue, reason) => {
    onValueChangeProp?.(nextValue, createChangeEventDetails(reason, void 0, void 0, {
      activationDirection: "none"
    }));
  });
  const registerMountedTabPanel = useStableCallback((panelValue, panelId) => {
    setMountedTabPanels((prev) => {
      const next = new Map(prev);
      next.set(panelValue, panelId);
      return next;
    });
    return () => {
      setMountedTabPanels((prev) => {
        if (prev.get(panelValue) !== panelId) {
          return prev;
        }
        const next = new Map(prev);
        next.delete(panelValue);
        return next;
      });
    };
  });
  const getTabPanelIdByValue = React74.useCallback((tabValue) => {
    return mountedTabPanels.get(tabValue);
  }, [mountedTabPanels]);
  const getTabIdByPanelValue = React74.useCallback((tabPanelValue) => {
    for (const tabMetadata of tabMap.values()) {
      if (tabPanelValue === tabMetadata.value) {
        return tabMetadata.id;
      }
    }
    return void 0;
  }, [tabMap]);
  const tabsContextValue = React74.useMemo(() => ({
    getTabElementBySelectedValue,
    getTabIdByPanelValue,
    getTabPanelIdByValue,
    onValueChange,
    orientation,
    registerMountedTabPanel,
    setTabMap,
    tabActivationDirection,
    value
  }), [getTabElementBySelectedValue, getTabIdByPanelValue, getTabPanelIdByValue, onValueChange, orientation, registerMountedTabPanel, setTabMap, tabActivationDirection, value]);
  const selectedTabMetadata = React74.useMemo(() => {
    for (const tabMetadata of tabMap.values()) {
      if (tabMetadata.value === value) {
        return tabMetadata;
      }
    }
    return void 0;
  }, [tabMap, value]);
  const firstEnabledTabValue = React74.useMemo(() => {
    for (const tabMetadata of tabMap.values()) {
      if (!tabMetadata.disabled) {
        return tabMetadata.value;
      }
    }
    return void 0;
  }, [tabMap]);
  const shouldNotifyInitialValueChangeRef = React74.useRef(!hasExplicitDefaultValueProp);
  const initialDefaultValueRef = React74.useRef(defaultValueProp);
  const shouldHonorDisabledDefaultValueRef = React74.useRef(hasExplicitDefaultValueProp);
  const didRegisterTabsRef = React74.useRef(false);
  useIsoLayoutEffect(() => {
    if (isControlled) {
      return;
    }
    function commitAutomaticValueChange(fallbackValue, fallbackReason) {
      setValue(fallbackValue);
      setActivationDirectionState({
        previousValue: fallbackValue,
        tabActivationDirection: "none"
      });
      notifyAutomaticValueChange(fallbackValue, fallbackReason);
      shouldNotifyInitialValueChangeRef.current = false;
    }
    if (tabMap.size === 0) {
      if (didRegisterTabsRef.current && value !== null && !lastKnownTabElementRef.current?.isConnected) {
        commitAutomaticValueChange(null, reason_parts_exports.missing);
      }
      return;
    }
    didRegisterTabsRef.current = true;
    lastKnownTabElementRef.current = tabMap.keys().next().value;
    const selectionIsDisabled = selectedTabMetadata?.disabled;
    const selectionIsMissing = selectedTabMetadata == null && value !== null;
    if (!selectionIsDisabled && value === initialDefaultValueRef.current) {
      shouldHonorDisabledDefaultValueRef.current = false;
    }
    if (shouldHonorDisabledDefaultValueRef.current && selectionIsDisabled && value === initialDefaultValueRef.current) {
      return;
    }
    const shouldNotifyInitialValueChange = shouldNotifyInitialValueChangeRef.current;
    if (selectionIsDisabled || selectionIsMissing) {
      const fallbackValue = firstEnabledTabValue ?? null;
      if (value === fallbackValue) {
        shouldNotifyInitialValueChangeRef.current = false;
        return;
      }
      let fallbackReason = reason_parts_exports.missing;
      if (shouldNotifyInitialValueChange) {
        fallbackReason = reason_parts_exports.initial;
      } else if (selectionIsDisabled) {
        fallbackReason = reason_parts_exports.disabled;
      }
      commitAutomaticValueChange(fallbackValue, fallbackReason);
      return;
    }
    if (shouldNotifyInitialValueChange && selectedTabMetadata != null) {
      notifyAutomaticValueChange(value, reason_parts_exports.initial);
      shouldNotifyInitialValueChangeRef.current = false;
    }
  }, [firstEnabledTabValue, isControlled, notifyAutomaticValueChange, selectedTabMetadata, setValue, tabMap, value]);
  const state = {
    orientation,
    tabActivationDirection
  };
  const element = useRenderElement("div", componentProps, {
    state,
    ref: forwardedRef,
    props: elementProps,
    stateAttributesMapping: tabsStateAttributesMapping
  });
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TabsRootContext.Provider, {
    value: tabsContextValue,
    children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(CompositeList, {
      elementsRef: tabPanelRefs,
      children: element
    })
  });
});
if (true) TabsRoot.displayName = "TabsRoot";
function findTabElement(tabMap, value) {
  for (const [tabElement, tabMetadata] of tabMap.entries()) {
    if (value === tabMetadata.value) {
      return tabElement;
    }
  }
  return null;
}
function computeActivationDirection(oldValue, newValue, orientation, tabMap) {
  if (oldValue == null || newValue == null) {
    return "none";
  }
  const [positionProp, backward, forward] = orientation === "horizontal" ? ["left", "left", "right"] : ["top", "up", "down"];
  const oldTab = findTabElement(tabMap, oldValue);
  const newTab = findTabElement(tabMap, newValue);
  if (oldTab == null || newTab == null) {
    if (oldTab !== newTab && (typeof oldValue === "number" || typeof oldValue === "string") && typeof oldValue === typeof newValue) {
      return newValue > oldValue ? forward : backward;
    }
    return "none";
  }
  const oldPosition = oldTab.getBoundingClientRect()[positionProp];
  const newPosition = newTab.getBoundingClientRect()[positionProp];
  if (newPosition < oldPosition) {
    return backward;
  }
  if (newPosition > oldPosition) {
    return forward;
  }
  return "none";
}

// node_modules/@base-ui/react/tabs/tab/TabsTab.mjs
var React76 = __toESM(require_react(), 1);

// node_modules/@base-ui/react/tabs/list/TabsListContext.mjs
var React75 = __toESM(require_react(), 1);
var TabsListContext = /* @__PURE__ */ React75.createContext(void 0);
if (true) TabsListContext.displayName = "TabsListContext";
function useTabsListContext() {
  const context = React75.useContext(TabsListContext);
  if (context === void 0) {
    throw new Error(true ? "Base UI: TabsListContext is missing. TabsList parts must be placed within <Tabs.List>." : formatErrorMessage_default(65));
  }
  return context;
}

// node_modules/@base-ui/react/tabs/tab/TabsTab.mjs
var TabsTab = /* @__PURE__ */ React76.forwardRef(function TabsTab2(componentProps, forwardedRef) {
  const {
    className,
    disabled: disabled2 = false,
    render: render4,
    value,
    id: idProp,
    nativeButton = true,
    style,
    ...elementProps
  } = componentProps;
  const {
    value: activeTabValue,
    getTabPanelIdByValue,
    onValueChange,
    orientation,
    tabActivationDirection
  } = useTabsRootContext();
  const {
    activateOnFocus,
    registerTabResizeObserverElement,
    tabsListElement
  } = useTabsListContext();
  const {
    highlightedIndex,
    onHighlightedIndexChange
  } = useCompositeRootContext();
  const id = useBaseUiId(idProp);
  const tabMetadata = React76.useMemo(() => ({
    disabled: disabled2,
    id,
    value
  }), [disabled2, id, value]);
  const {
    compositeProps,
    compositeRef,
    index: index3
    // hook is used instead of the CompositeItem component
    // because the index is needed for Tab internals
  } = useCompositeItem({
    metadata: tabMetadata
  });
  const active = value === activeTabValue;
  const isNavigatingRef = React76.useRef(false);
  const unobserveTabElementRef = React76.useRef(null);
  const observeTabElement = useStableCallback((element2) => {
    unobserveTabElementRef.current?.();
    unobserveTabElementRef.current = element2 ? registerTabResizeObserverElement(element2) : null;
  });
  useIsoLayoutEffect(() => {
    if (isNavigatingRef.current) {
      isNavigatingRef.current = false;
      return;
    }
    if (!(active && index3 > -1 && highlightedIndex !== index3)) {
      return;
    }
    const listElement = tabsListElement;
    if (listElement != null) {
      const activeEl = activeElement(ownerDocument(listElement));
      if (activeEl && contains(listElement, activeEl)) {
        return;
      }
    }
    if (!disabled2) {
      onHighlightedIndexChange(index3);
    }
  }, [active, index3, highlightedIndex, onHighlightedIndexChange, disabled2, tabsListElement]);
  const {
    getButtonProps,
    buttonRef
  } = useButton({
    disabled: disabled2,
    native: nativeButton,
    focusableWhenDisabled: true
  });
  const tabPanelId = getTabPanelIdByValue(value);
  const isPressingRef = React76.useRef(false);
  const isMainButtonRef = React76.useRef(false);
  function activate(event) {
    onValueChange(value, createChangeEventDetails(reason_parts_exports.none, event.nativeEvent, void 0, {
      activationDirection: "none"
    }));
  }
  function onClick(event) {
    if (active || disabled2) {
      return;
    }
    activate(event);
  }
  function onFocus(event) {
    if (active || disabled2) {
      return;
    }
    if (activateOnFocus && (!isPressingRef.current || // keyboard or touch focus
    isMainButtonRef.current)) {
      activate(event);
    }
  }
  function onPointerDown(event) {
    if (active || disabled2) {
      return;
    }
    isPressingRef.current = true;
    isMainButtonRef.current = event.button === 0;
    const doc = ownerDocument(event.currentTarget);
    function handlePointerEnd() {
      isPressingRef.current = false;
      isMainButtonRef.current = false;
      doc.removeEventListener("pointerup", handlePointerEnd);
      doc.removeEventListener("pointercancel", handlePointerEnd);
    }
    doc.addEventListener("pointerup", handlePointerEnd);
    doc.addEventListener("pointercancel", handlePointerEnd);
  }
  const state = {
    disabled: disabled2,
    active,
    orientation,
    tabActivationDirection
  };
  const element = useRenderElement("button", componentProps, {
    state,
    ref: [forwardedRef, buttonRef, compositeRef, observeTabElement],
    props: [compositeProps, {
      role: "tab",
      "aria-controls": tabPanelId,
      "aria-selected": active,
      id,
      onClick,
      onFocus,
      onPointerDown,
      [ACTIVE_COMPOSITE_ITEM]: active ? "" : void 0,
      onKeyDownCapture() {
        isNavigatingRef.current = true;
      }
    }, elementProps, getButtonProps],
    stateAttributesMapping: tabsStateAttributesMapping
  });
  return element;
});
if (true) TabsTab.displayName = "TabsTab";

// node_modules/@base-ui/react/tabs/indicator/TabsIndicator.mjs
var React77 = __toESM(require_react(), 1);

// node_modules/@base-ui/react/tabs/indicator/TabsIndicatorCssVars.mjs
var activeTabLeft = "--active-tab-left";
var activeTabRight = "--active-tab-right";
var activeTabTop = "--active-tab-top";
var activeTabBottom = "--active-tab-bottom";
var activeTabWidth = "--active-tab-width";
var activeTabHeight = "--active-tab-height";

// node_modules/@base-ui/react/tabs/indicator/TabsIndicator.mjs
var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1);
var _PrehydrationScript;
var stateAttributesMapping3 = {
  ...tabsStateAttributesMapping,
  activeTabPosition: () => null,
  activeTabSize: () => null
};
var MAX_LAYOUT_ROUNDING_ERROR = 2;
var TabsIndicator = /* @__PURE__ */ React77.forwardRef(function TabsIndicator2(componentProps, forwardedRef) {
  const {
    className,
    render: render4,
    renderBeforeHydration = false,
    style: styleProp,
    ...elementProps
  } = componentProps;
  const {
    getTabElementBySelectedValue,
    orientation,
    tabActivationDirection,
    value
  } = useTabsRootContext();
  const {
    tabsListElement,
    registerIndicatorUpdateListener
  } = useTabsListContext();
  const rerender = useForcedRerendering();
  React77.useEffect(() => {
    return registerIndicatorUpdateListener(rerender);
  }, [registerIndicatorUpdateListener, rerender]);
  let left = 0;
  let right = 0;
  let top = 0;
  let bottom = 0;
  let width = 0;
  let height = 0;
  let isTabSelected = false;
  if (value != null && tabsListElement != null) {
    const activeTab = getTabElementBySelectedValue(value);
    if (activeTab != null) {
      isTabSelected = true;
      const {
        width: computedWidth,
        height: computedHeight
      } = getCssDimensions2(activeTab);
      const {
        width: tabListWidth,
        height: tabListHeight
      } = getCssDimensions2(tabsListElement);
      const tabRect = activeTab.getBoundingClientRect();
      const tabsListRect = tabsListElement.getBoundingClientRect();
      const scaleX = tabListWidth > 0 ? tabsListRect.width / tabListWidth : 1;
      const scaleY = tabListHeight > 0 ? tabsListRect.height / tabListHeight : 1;
      const layoutOffset = getLayoutOffset(activeTab, tabsListElement);
      left = layoutOffset.left;
      top = layoutOffset.top;
      const rectLeft = (tabRect.left - tabsListRect.left) / scaleX + tabsListElement.scrollLeft - tabsListElement.clientLeft;
      const rectTop = (tabRect.top - tabsListRect.top) / scaleY + tabsListElement.scrollTop - tabsListElement.clientTop;
      const tabTranslation = getActiveTabTranslation(activeTab);
      if (Math.abs(rectLeft - tabTranslation.x - left) <= MAX_LAYOUT_ROUNDING_ERROR && Math.abs(rectTop - tabTranslation.y - top) <= MAX_LAYOUT_ROUNDING_ERROR) {
        left = rectLeft;
        top = rectTop;
      }
      width = computedWidth;
      height = computedHeight;
      right = tabsListElement.scrollWidth - left - width;
      bottom = tabsListElement.scrollHeight - top - height;
    }
  }
  const activeTabPosition = isTabSelected ? {
    left,
    right,
    top,
    bottom
  } : null;
  const activeTabSize = isTabSelected ? {
    width,
    height
  } : null;
  const style = isTabSelected ? {
    [activeTabLeft]: `${left}px`,
    [activeTabRight]: `${right}px`,
    [activeTabTop]: `${top}px`,
    [activeTabBottom]: `${bottom}px`,
    [activeTabWidth]: `${width}px`,
    [activeTabHeight]: `${height}px`
  } : void 0;
  const displayIndicator = isTabSelected && width > 0 && height > 0;
  const state = {
    orientation,
    activeTabPosition,
    activeTabSize,
    tabActivationDirection
  };
  const element = useRenderElement("span", componentProps, {
    state,
    ref: forwardedRef,
    props: [{
      role: "presentation",
      style,
      hidden: !displayIndicator
      // do not display the indicator before the layout is settled
    }, elementProps, {
      suppressHydrationWarning: true
    }],
    stateAttributesMapping: stateAttributesMapping3
  });
  if (value == null) {
    return null;
  }
  return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(React77.Fragment, {
    children: [element, renderBeforeHydration && (_PrehydrationScript || (_PrehydrationScript = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(PrehydrationScript, {
      script
    })))]
  });
});
if (true) TabsIndicator.displayName = "TabsIndicator";
function getLayoutOffset(element, ancestor) {
  const elementOffset = getCumulativeOffset(element);
  const ancestorOffset = getCumulativeOffset(ancestor);
  let left = elementOffset.left - ancestorOffset.left - ancestor.clientLeft;
  let top = elementOffset.top - ancestorOffset.top - ancestor.clientTop;
  let node = getParentNode(element);
  while (isHTMLElement(node) && node !== ancestor && !isLastTraversableNode(node)) {
    left -= node.scrollLeft;
    top -= node.scrollTop;
    node = getParentNode(node);
  }
  return {
    left,
    top
  };
}
function getCumulativeOffset(element) {
  let left = 0;
  let top = 0;
  let currentElement = element;
  while (currentElement != null) {
    left += currentElement.offsetLeft;
    top += currentElement.offsetTop;
    const offsetParent = currentElement.offsetParent;
    if (offsetParent != null) {
      left += offsetParent.clientLeft;
      top += offsetParent.clientTop;
    }
    currentElement = offsetParent;
  }
  return {
    left,
    top
  };
}
function getActiveTabTranslation(element) {
  const computedStyle = getWindow(element).getComputedStyle(element);
  const {
    x: x2,
    y: y2
  } = getElementTransform(element, computedStyle);
  let translateX = x2;
  let translateY = y2;
  const {
    translate: translate2
  } = computedStyle;
  if (translate2 && translate2 !== "none") {
    const parts = translate2.split(" ");
    translateX += resolveTranslateLength(parts[0], element.offsetWidth);
    translateY += resolveTranslateLength(parts[1], element.offsetHeight);
  }
  return {
    x: translateX,
    y: translateY
  };
}
function resolveTranslateLength(value, referenceSize) {
  if (!value) {
    return 0;
  }
  const numeric = parseFloat(value);
  if (!Number.isFinite(numeric)) {
    return 0;
  }
  return value.endsWith("%") ? numeric / 100 * referenceSize : numeric;
}

// node_modules/@base-ui/react/tabs/panel/TabsPanel.mjs
var React78 = __toESM(require_react(), 1);

// node_modules/@base-ui/react/tabs/panel/TabsPanelDataAttributes.mjs
var index2 = "data-index";
var startingStyle3 = TransitionStatusDataAttributes_exports.startingStyle;
var endingStyle3 = TransitionStatusDataAttributes_exports.endingStyle;

// node_modules/@base-ui/react/tabs/panel/TabsPanel.mjs
var stateAttributesMapping4 = {
  ...tabsStateAttributesMapping,
  ...transitionStatusMapping
};
var TabsPanel = /* @__PURE__ */ React78.forwardRef(function TabsPanel2(componentProps, forwardedRef) {
  const {
    className,
    value,
    render: render4,
    keepMounted = false,
    style,
    ...elementProps
  } = componentProps;
  const {
    value: selectedValue,
    getTabIdByPanelValue,
    orientation,
    tabActivationDirection,
    registerMountedTabPanel
  } = useTabsRootContext();
  const id = useBaseUiId();
  const {
    ref: listItemRef,
    index: index3
  } = useCompositeListItem();
  const open3 = value === selectedValue;
  const {
    mounted,
    transitionStatus,
    setMounted
  } = useTransitionStatus(open3);
  const hidden = !mounted;
  const correspondingTabId = getTabIdByPanelValue(value);
  const state = {
    hidden,
    orientation,
    tabActivationDirection,
    transitionStatus
  };
  const panelRef = React78.useRef(null);
  const element = useRenderElement("div", componentProps, {
    state,
    ref: [forwardedRef, listItemRef, panelRef],
    props: [{
      "aria-labelledby": correspondingTabId,
      hidden,
      id,
      role: "tabpanel",
      tabIndex: open3 ? 0 : -1,
      inert: inertValue(!open3),
      // Computed key: a plain literal key fails the DOM-props excess property check.
      [index2]: index3
    }, elementProps],
    stateAttributesMapping: stateAttributesMapping4
  });
  useOpenChangeComplete({
    open: open3,
    ref: panelRef,
    onComplete() {
      if (!open3) {
        setMounted(false);
      }
    }
  });
  useIsoLayoutEffect(() => {
    if (id == null || hidden && !keepMounted) {
      return void 0;
    }
    return registerMountedTabPanel(value, id);
  }, [hidden, keepMounted, value, id, registerMountedTabPanel]);
  const shouldRender = keepMounted || mounted;
  if (!shouldRender) {
    return null;
  }
  return element;
});
if (true) TabsPanel.displayName = "TabsPanel";

// node_modules/@base-ui/react/tabs/list/TabsList.mjs
var React79 = __toESM(require_react(), 1);
var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1);
var TabsList = /* @__PURE__ */ React79.forwardRef(function TabsList2(componentProps, forwardedRef) {
  const {
    activateOnFocus = false,
    className,
    loopFocus = true,
    render: render4,
    style,
    ...elementProps
  } = componentProps;
  const {
    orientation,
    setTabMap,
    tabActivationDirection
  } = useTabsRootContext();
  const [highlightedTabIndex, setHighlightedTabIndex] = React79.useState(0);
  const [tabsListElement, setTabsListElement] = React79.useState(null);
  const indicatorUpdateListenersRef = React79.useRef(/* @__PURE__ */ new Set());
  const tabResizeObserverElementsRef = React79.useRef(/* @__PURE__ */ new Set());
  const resizeObserverRef = React79.useRef(null);
  useIsoLayoutEffect(() => {
    if (typeof ResizeObserver === "undefined") {
      return void 0;
    }
    const resizeObserver = new ResizeObserver(() => {
      indicatorUpdateListenersRef.current.forEach((listener) => {
        listener();
      });
    });
    resizeObserverRef.current = resizeObserver;
    if (tabsListElement) {
      resizeObserver.observe(tabsListElement);
    }
    tabResizeObserverElementsRef.current.forEach((element) => {
      resizeObserver.observe(element);
    });
    return () => {
      resizeObserver.disconnect();
      resizeObserverRef.current = null;
    };
  }, [tabsListElement]);
  const registerIndicatorUpdateListener = useStableCallback((listener) => {
    indicatorUpdateListenersRef.current.add(listener);
    return () => {
      indicatorUpdateListenersRef.current.delete(listener);
    };
  });
  const registerTabResizeObserverElement = useStableCallback((element) => {
    tabResizeObserverElementsRef.current.add(element);
    resizeObserverRef.current?.observe(element);
    return () => {
      tabResizeObserverElementsRef.current.delete(element);
      resizeObserverRef.current?.unobserve(element);
    };
  });
  const state = {
    orientation,
    tabActivationDirection
  };
  const defaultProps = {
    "aria-orientation": orientation === "vertical" ? "vertical" : void 0,
    role: "tablist"
  };
  const tabsListContextValue = React79.useMemo(() => ({
    activateOnFocus,
    registerIndicatorUpdateListener,
    registerTabResizeObserverElement,
    tabsListElement
  }), [activateOnFocus, registerIndicatorUpdateListener, registerTabResizeObserverElement, tabsListElement]);
  return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TabsListContext.Provider, {
    value: tabsListContextValue,
    children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CompositeRoot, {
      render: render4,
      className,
      style,
      state,
      refs: [forwardedRef, setTabsListElement],
      props: [defaultProps, elementProps],
      stateAttributesMapping: tabsStateAttributesMapping,
      highlightedIndex: highlightedTabIndex,
      enableHomeAndEndKeys: true,
      loopFocus,
      orientation,
      onHighlightedIndexChange: setHighlightedTabIndex,
      onMapChange: setTabMap,
      disabledIndices: EMPTY_ARRAY
    })
  });
});
if (true) TabsList.displayName = "TabsList";

// node_modules/@base-ui/react/tooltip/index.parts.mjs
var index_parts_exports4 = {};
__export(index_parts_exports4, {
  Arrow: () => TooltipArrow,
  Handle: () => TooltipHandle,
  Popup: () => TooltipPopup,
  Portal: () => TooltipPortal,
  Positioner: () => TooltipPositioner,
  Provider: () => TooltipProvider,
  Root: () => TooltipRoot,
  Trigger: () => TooltipTrigger,
  Viewport: () => TooltipViewport,
  createHandle: () => createTooltipHandle
});

// node_modules/@base-ui/react/tooltip/root/TooltipRoot.mjs
var React82 = __toESM(require_react(), 1);

// node_modules/@base-ui/react/tooltip/root/TooltipRootContext.mjs
var React80 = __toESM(require_react(), 1);
var TooltipRootContext = /* @__PURE__ */ React80.createContext(void 0);
if (true) TooltipRootContext.displayName = "TooltipRootContext";
function useTooltipRootContext(optional) {
  const context = React80.useContext(TooltipRootContext);
  if (context === void 0 && !optional) {
    throw new Error(true ? "Base UI: TooltipRootContext is missing. Tooltip parts must be placed within <Tooltip.Root>." : formatErrorMessage_default(72));
  }
  return context;
}

// node_modules/@base-ui/react/tooltip/store/TooltipStore.mjs
var React81 = __toESM(require_react(), 1);
var selectors2 = {
  ...popupStoreSelectors,
  disabled: (state) => state.disabled,
  instantType: (state) => state.instantType,
  isInstantPhase: (state) => state.isInstantPhase,
  trackCursorAxis: (state) => state.trackCursorAxis,
  disableHoverablePopup: (state) => state.disableHoverablePopup,
  lastOpenChangeReason: (state) => state.openChangeReason,
  closeOnClick: (state) => state.closeOnClick,
  closeDelay: (state) => state.closeDelay,
  adaptiveOrigin: (state) => state.adaptiveOrigin
};
var TooltipStore = class extends ReactStore {
  constructor(initialState, floatingId, nested) {
    const triggerElements = new PopupTriggerMap();
    super(createInitialState(initialState, triggerElements, floatingId, nested), createInitialContext(triggerElements), selectors2);
  }
  setOpen = (nextOpen, eventDetails) => {
    applyPopupOpenChange(this, nextOpen, eventDetails, {
      extraState: {
        openChangeReason: eventDetails.reason
      }
    });
  };
  // Used by trigger clicks to clear a delayed hover open without reporting a public open-state change.
  cancelPendingOpen(event) {
    this.state.floatingRootContext.dispatchOpenChange(false, createChangeEventDetails(reason_parts_exports.triggerPress, event));
  }
};
function createNullTooltipStore() {
  const triggerElements = new PopupTriggerMap();
  const store2 = new NullStore(Object.freeze(createInitialState(void 0, triggerElements)), Object.freeze(createInitialContext(triggerElements)), selectors2);
  return Object.assign(store2, {
    setOpen: NOOP,
    cancelPendingOpen: NOOP
  });
}
function createInitialState(initialState, triggerElements, floatingId, nested = false) {
  const state = {
    ...createInitialPopupStoreState(triggerElements, floatingId, nested),
    disabled: false,
    instantType: void 0,
    isInstantPhase: false,
    trackCursorAxis: "none",
    disableHoverablePopup: false,
    openChangeReason: null,
    closeOnClick: true,
    closeDelay: 0,
    adaptiveOrigin: void 0,
    ...initialState
  };
  return state;
}
function createInitialContext(triggerElements) {
  return {
    popupRef: /* @__PURE__ */ React81.createRef(),
    onOpenChange: void 0,
    onOpenChangeComplete: void 0,
    triggerElements
  };
}

// node_modules/@base-ui/react/tooltip/root/TooltipRoot.mjs
var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1);
var TooltipRoot = fastComponent(function TooltipRoot2(props) {
  const {
    disabled: disabled2 = false,
    defaultOpen = false,
    open: openProp,
    disableHoverablePopup = false,
    trackCursorAxis = "none",
    actionsRef,
    onOpenChange,
    onOpenChangeComplete,
    handle,
    triggerId: triggerIdProp,
    defaultTriggerId: defaultTriggerIdProp = null,
    children
  } = props;
  const store2 = usePopupRootStore((floatingId, nested) => new TooltipStore({
    open: defaultOpen,
    openProp,
    activeTriggerId: defaultTriggerIdProp,
    triggerIdProp
  }, floatingId, nested));
  store2.useControlledProp("openProp", openProp);
  store2.useControlledProp("triggerIdProp", triggerIdProp);
  store2.useContextCallback("onOpenChange", onOpenChange);
  store2.useContextCallback("onOpenChangeComplete", onOpenChangeComplete);
  const openState = store2.useState("open");
  const open3 = !disabled2 && openState;
  const activeTriggerId = store2.useState("activeTriggerId");
  const mounted = store2.useState("mounted");
  const payload = store2.useState("payload");
  store2.useSyncedValues({
    trackCursorAxis,
    disableHoverablePopup,
    disabled: disabled2
  });
  useImplicitActiveTrigger(store2, {
    closeOnActiveTriggerUnmount: true
  });
  const {
    forceUnmount,
    transitionStatus
  } = useOpenStateTransitions(open3, store2);
  const isInstantPhase = store2.useState("isInstantPhase");
  const instantType = store2.useState("instantType");
  const lastOpenChangeReason = store2.useState("lastOpenChangeReason");
  const previousInstantTypeRef = React82.useRef(null);
  useIsoLayoutEffect(() => {
    if (openState && disabled2) {
      store2.setOpen(false, createChangeEventDetails(reason_parts_exports.disabled));
    }
  }, [openState, disabled2, store2]);
  useIsoLayoutEffect(() => {
    if (transitionStatus === "ending" && lastOpenChangeReason === reason_parts_exports.none || transitionStatus !== "ending" && isInstantPhase) {
      if (instantType !== "delay") {
        previousInstantTypeRef.current = instantType;
      }
      store2.set("instantType", "delay");
    } else if (previousInstantTypeRef.current !== null) {
      store2.set("instantType", previousInstantTypeRef.current);
      previousInstantTypeRef.current = null;
    }
  }, [transitionStatus, isInstantPhase, lastOpenChangeReason, instantType, store2]);
  useIsoLayoutEffect(() => {
    if (open3) {
      if (activeTriggerId == null) {
        store2.set("payload", void 0);
      }
    }
  }, [store2, activeTriggerId, open3]);
  React82.useImperativeHandle(actionsRef, () => ({
    unmount: forceUnmount,
    close: () => store2.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction))
  }), [forceUnmount, store2]);
  const shouldRenderInteractions = open3 || mounted || !disabled2 && trackCursorAxis !== "none";
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(TooltipRootContext.Provider, {
    value: store2,
    children: [handle && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(PopupHandleAttachment, {
      handle,
      store: store2
    }), shouldRenderInteractions && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipInteractions, {
      store: store2,
      disabled: disabled2,
      trackCursorAxis
    }), typeof children === "function" ? children({
      payload
    }) : children]
  });
});
if (true) TooltipRoot.displayName = "TooltipRoot";
function TooltipInteractions({
  store: store2,
  disabled: disabled2,
  trackCursorAxis
}) {
  const floatingRootContext = store2.useState("floatingRootContext");
  const dismiss = useDismiss(floatingRootContext, {
    enabled: !disabled2,
    referencePress: () => store2.select("closeOnClick")
  });
  const clientPoint = useClientPoint(floatingRootContext, {
    enabled: !disabled2 && trackCursorAxis !== "none",
    axis: trackCursorAxis === "none" ? void 0 : trackCursorAxis
  });
  const triggerProps = React82.useMemo(() => mergeProps(clientPoint.reference, dismiss.reference), [clientPoint.reference, dismiss.reference]);
  usePopupInteractionProps(store2, {
    activeTriggerProps: triggerProps,
    inactiveTriggerProps: triggerProps,
    popupProps: dismiss.floating ?? EMPTY_OBJECT
  });
  return null;
}

// node_modules/@base-ui/react/tooltip/trigger/TooltipTrigger.mjs
var React84 = __toESM(require_react(), 1);

// node_modules/@base-ui/react/tooltip/provider/TooltipProviderContext.mjs
var React83 = __toESM(require_react(), 1);
var TooltipProviderContext = /* @__PURE__ */ React83.createContext(void 0);
if (true) TooltipProviderContext.displayName = "TooltipProviderContext";
function useTooltipProviderContext() {
  return React83.useContext(TooltipProviderContext);
}

// node_modules/@base-ui/react/tooltip/utils/constants.mjs
var OPEN_DELAY = 600;

// node_modules/@base-ui/react/tooltip/trigger/TooltipTrigger.mjs
var TOOLTIP_TRIGGER_IDENTIFIER = "data-base-ui-tooltip-trigger";
function getTargetElement(event) {
  if ("composedPath" in event) {
    const path = event.composedPath();
    for (let i = 0; i < path.length; i += 1) {
      const element = path[i];
      if (isElement(element)) {
        return element;
      }
    }
  }
  const target = event.target;
  if (isElement(target)) {
    return target;
  }
  return null;
}
function closestEnabledTooltipTrigger(element) {
  let current = element;
  while (current) {
    const trigger = current.closest(`[${TOOLTIP_TRIGGER_IDENTIFIER}]`);
    if (trigger) {
      return trigger;
    }
    const root = current.getRootNode();
    current = "host" in root && isElement(root.host) ? root.host : null;
  }
  return null;
}
var TooltipTrigger = fastComponentRef(function TooltipTrigger2(componentProps, forwardedRef) {
  const {
    render: render4,
    className,
    style,
    handle,
    payload,
    disabled: disabledProp,
    delay,
    closeOnClick = true,
    closeDelay,
    id: idProp,
    ...elementProps
  } = componentProps;
  const rootContext = useTooltipRootContext(true);
  const handleStore = usePopupHandleStore(handle);
  const store2 = handleStore ?? rootContext;
  if (!store2) {
    throw new Error(true ? "Base UI: <Tooltip.Trigger> must be either used within a <Tooltip.Root> component or provided with a handle." : formatErrorMessage_default(82));
  }
  const thisTriggerId = useBaseUiId(idProp);
  const isTriggerActive = store2.useState("isTriggerActive", thisTriggerId);
  const isOpenedByThisTrigger = store2.useState("isOpenedByTrigger", thisTriggerId);
  const floatingRootContext = store2.useState("floatingRootContext");
  const triggerElementRef = React84.useRef(null);
  const closeDelayWithDefault = closeDelay ?? 0;
  const {
    registerTrigger,
    isMountedByThisTrigger
  } = useTriggerDataForwarding(thisTriggerId, triggerElementRef, store2, {
    payload,
    closeOnClick,
    closeDelay: closeDelayWithDefault
  });
  const providerDelay = useTooltipProviderContext();
  const {
    activeIdRef,
    delayRef,
    isInstantPhase,
    hasProvider
  } = useDelayGroup(floatingRootContext, {
    open: isOpenedByThisTrigger
  });
  const hoverInteraction = useHoverInteractionSharedState(floatingRootContext);
  store2.useSyncedValue("isInstantPhase", isInstantPhase);
  const rootDisabled = store2.useState("disabled");
  const disabled2 = disabledProp ?? rootDisabled;
  const disabledRef = useValueAsRef(disabled2);
  const trackCursorAxis = store2.useState("trackCursorAxis");
  const disableHoverablePopup = store2.useState("disableHoverablePopup");
  const isNestedTriggerHoveredRef = React84.useRef(false);
  const nestedTriggerOpenTimeout = useTimeout();
  const pointerTypeRef = React84.useRef(void 0);
  function getOpenDelay() {
    if (hasProvider && activeIdRef.current != null) {
      return 0;
    }
    return delay ?? providerDelay ?? OPEN_DELAY;
  }
  function isEnabledNestedTriggerTarget(target) {
    const triggerEl = triggerElementRef.current;
    if (!triggerEl || !target) {
      return false;
    }
    const nearestTrigger = closestEnabledTooltipTrigger(target);
    return nearestTrigger !== null && nearestTrigger !== triggerEl && contains(triggerEl, nearestTrigger);
  }
  function detectNestedTriggerHover(target) {
    const nestedTriggerHovered = isEnabledNestedTriggerTarget(target);
    isNestedTriggerHoveredRef.current = nestedTriggerHovered;
    if (nestedTriggerHovered) {
      hoverInteraction.openChangeTimeout.clear();
      hoverInteraction.restTimeout.clear();
      hoverInteraction.restTimeoutPending = false;
      nestedTriggerOpenTimeout.clear();
    }
    return nestedTriggerHovered;
  }
  const hoverProps = useHoverReferenceInteraction(floatingRootContext, {
    enabled: !disabled2,
    mouseOnly: true,
    move: false,
    handleClose: !disableHoverablePopup && trackCursorAxis !== "both" ? safePolygon() : null,
    restMs: getOpenDelay,
    delay() {
      if (closeDelay == null && hasProvider) {
        return {
          close: getDelay(delayRef.current, "close")
        };
      }
      return {
        close: closeDelayWithDefault
      };
    },
    triggerElementRef,
    isActiveTrigger: isTriggerActive,
    isClosing: () => store2.select("transitionStatus") === "ending",
    shouldOpen() {
      return !isNestedTriggerHoveredRef.current;
    }
  });
  const focusProps = useFocus(floatingRootContext, {
    enabled: !disabled2
  }).reference;
  const handleNestedTriggerHover = (event) => {
    const wasNestedTriggerHovered = isNestedTriggerHoveredRef.current;
    const target = getTargetElement(event);
    const nestedTriggerHovered = detectNestedTriggerHover(target);
    const triggerEl = triggerElementRef.current;
    const targetInsideTrigger = triggerEl && target && contains(triggerEl, target);
    if (nestedTriggerHovered && store2.select("open") && store2.select("lastOpenChangeReason") === reason_parts_exports.triggerHover) {
      store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
      return;
    }
    if (wasNestedTriggerHovered && !nestedTriggerHovered && targetInsideTrigger && !disabledRef.current && !store2.select("open") && triggerEl && // Match the hover hook's non-strict mouse fallback for mouse-only event sequences.
    isMouseLikePointerType(pointerTypeRef.current)) {
      const open3 = () => {
        if (!isNestedTriggerHoveredRef.current && !disabledRef.current && !store2.select("open")) {
          store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerEl));
        }
      };
      const openDelay = getOpenDelay();
      if (openDelay === 0) {
        nestedTriggerOpenTimeout.clear();
        open3();
      } else {
        nestedTriggerOpenTimeout.start(openDelay, open3);
      }
    }
  };
  const rootTriggerProps = store2.useState("triggerProps", isMountedByThisTrigger);
  const shouldApplyRootTriggerProps = isMountedByThisTrigger || trackCursorAxis !== "none";
  const state = {
    open: isOpenedByThisTrigger
  };
  const element = useRenderElement("button", componentProps, {
    state,
    ref: [forwardedRef, registerTrigger, triggerElementRef],
    props: [hoverProps, focusProps, shouldApplyRootTriggerProps ? rootTriggerProps : void 0, {
      onMouseOver(event) {
        handleNestedTriggerHover(event.nativeEvent);
      },
      onFocus(event) {
        if (isEnabledNestedTriggerTarget(getTargetElement(event.nativeEvent))) {
          event.preventBaseUIHandler();
        }
      },
      onMouseLeave() {
        isNestedTriggerHoveredRef.current = false;
        nestedTriggerOpenTimeout.clear();
        pointerTypeRef.current = void 0;
      },
      onPointerEnter(event) {
        pointerTypeRef.current = event.pointerType;
      },
      onPointerDown(event) {
        pointerTypeRef.current = event.pointerType;
        store2.set("closeOnClick", closeOnClick);
        if (closeOnClick && !store2.select("open")) {
          store2.cancelPendingOpen(event.nativeEvent);
        }
      },
      onClick(event) {
        if (closeOnClick && !store2.select("open")) {
          store2.cancelPendingOpen(event.nativeEvent);
        }
      },
      id: thisTriggerId,
      [triggerDisabled]: disabled2 ? "" : void 0,
      [TOOLTIP_TRIGGER_IDENTIFIER]: disabled2 ? void 0 : ""
    }, elementProps],
    stateAttributesMapping: triggerOpenStateMapping2
  });
  return element;
});
if (true) TooltipTrigger.displayName = "TooltipTrigger";

// node_modules/@base-ui/react/tooltip/portal/TooltipPortal.mjs
var React86 = __toESM(require_react(), 1);

// node_modules/@base-ui/react/tooltip/portal/TooltipPortalContext.mjs
var React85 = __toESM(require_react(), 1);
var TooltipPortalContext = /* @__PURE__ */ React85.createContext(void 0);
if (true) TooltipPortalContext.displayName = "TooltipPortalContext";
function useTooltipPortalContext() {
  const value = React85.useContext(TooltipPortalContext);
  if (value === void 0) {
    throw new Error(true ? "Base UI: <Tooltip.Portal> is missing." : formatErrorMessage_default(70));
  }
  return value;
}

// node_modules/@base-ui/react/tooltip/portal/TooltipPortal.mjs
var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1);
var TooltipPortal = /* @__PURE__ */ React86.forwardRef(function TooltipPortal2(props, forwardedRef) {
  const {
    keepMounted = false,
    ...portalProps
  } = props;
  const store2 = useTooltipRootContext();
  const mounted = store2.useState("mounted");
  const shouldRender = mounted || keepMounted;
  if (!shouldRender) {
    return null;
  }
  return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipPortalContext.Provider, {
    value: keepMounted,
    children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FloatingPortalLite, {
      ref: forwardedRef,
      ...portalProps
    })
  });
});
if (true) TooltipPortal.displayName = "TooltipPortal";

// node_modules/@base-ui/react/tooltip/positioner/TooltipPositioner.mjs
var React88 = __toESM(require_react(), 1);

// node_modules/@base-ui/react/tooltip/positioner/TooltipPositionerContext.mjs
var React87 = __toESM(require_react(), 1);
var TooltipPositionerContext = /* @__PURE__ */ React87.createContext(void 0);
if (true) TooltipPositionerContext.displayName = "TooltipPositionerContext";
function useTooltipPositionerContext() {
  const context = React87.useContext(TooltipPositionerContext);
  if (context === void 0) {
    throw new Error(true ? "Base UI: TooltipPositionerContext is missing. TooltipPositioner parts must be placed within <Tooltip.Positioner>." : formatErrorMessage_default(71));
  }
  return context;
}

// node_modules/@base-ui/react/tooltip/positioner/TooltipPositioner.mjs
var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1);
var TooltipPositioner = /* @__PURE__ */ React88.forwardRef(function TooltipPositioner2(componentProps, forwardedRef) {
  const {
    render: render4,
    className,
    anchor,
    positionMethod = "absolute",
    side = "top",
    align = "center",
    sideOffset = 0,
    alignOffset = 0,
    collisionBoundary = "clipping-ancestors",
    collisionPadding = 5,
    arrowPadding = 5,
    sticky = false,
    disableAnchorTracking = false,
    collisionAvoidance = POPUP_COLLISION_AVOIDANCE,
    style,
    ...elementProps
  } = componentProps;
  const store2 = useTooltipRootContext();
  const keepMounted = useTooltipPortalContext();
  const open3 = store2.useState("open");
  const mounted = store2.useState("mounted");
  const trackCursorAxis = store2.useState("trackCursorAxis");
  const disableHoverablePopup = store2.useState("disableHoverablePopup");
  const floatingRootContext = store2.useState("floatingRootContext");
  const instantType = store2.useState("instantType");
  const transitionStatus = store2.useState("transitionStatus");
  const adaptiveOrigin2 = store2.useState("adaptiveOrigin");
  const positioning = useAnchorPositioning({
    anchor,
    positionMethod,
    floatingRootContext,
    mounted,
    side,
    sideOffset,
    align,
    alignOffset,
    collisionBoundary,
    collisionPadding,
    sticky,
    arrowPadding,
    disableAnchorTracking,
    keepMounted,
    collisionAvoidance,
    adaptiveOrigin: adaptiveOrigin2
  });
  const state = React88.useMemo(() => ({
    open: open3,
    side: positioning.side,
    align: positioning.align,
    anchorHidden: positioning.anchorHidden,
    instant: trackCursorAxis !== "none" ? "tracking-cursor" : instantType
  }), [open3, positioning.side, positioning.align, positioning.anchorHidden, trackCursorAxis, instantType]);
  const element = usePositioner(componentProps, state, {
    styles: positioning.positionerStyles,
    transitionStatus,
    props: elementProps,
    refs: [forwardedRef, store2.useStateSetter("positionerElement")],
    hidden: !mounted,
    inert: !open3 || trackCursorAxis === "both" || disableHoverablePopup
  });
  return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TooltipPositionerContext.Provider, {
    value: positioning,
    children: element
  });
});
if (true) TooltipPositioner.displayName = "TooltipPositioner";

// node_modules/@base-ui/react/tooltip/popup/TooltipPopup.mjs
var React89 = __toESM(require_react(), 1);
var TooltipPopup = /* @__PURE__ */ React89.forwardRef(function TooltipPopup2(componentProps, forwardedRef) {
  const {
    render: render4,
    className,
    style,
    ...elementProps
  } = componentProps;
  const store2 = useTooltipRootContext();
  const {
    side,
    align
  } = useTooltipPositionerContext();
  const open3 = store2.useState("open");
  const instantType = store2.useState("instantType");
  const transitionStatus = store2.useState("transitionStatus");
  const popupProps = store2.useState("popupProps");
  const floatingContext = store2.useState("floatingRootContext");
  const disabled2 = store2.useState("disabled");
  const closeDelay = store2.useState("closeDelay");
  useOpenChangeComplete({
    open: open3,
    ref: store2.context.popupRef,
    onComplete() {
      if (open3) {
        store2.context.onOpenChangeComplete?.(true);
      }
    }
  });
  useHoverFloatingInteraction(floatingContext, {
    enabled: !disabled2,
    closeDelay
  });
  const setPopupElement = store2.useStateSetter("popupElement");
  const state = {
    open: open3,
    side,
    align,
    instant: instantType,
    transitionStatus
  };
  const element = useRenderElement("div", componentProps, {
    state,
    ref: [forwardedRef, store2.context.popupRef, setPopupElement],
    props: [FOCUSABLE_POPUP_PROPS, popupProps, getDisabledMountTransitionStyles(transitionStatus), elementProps],
    stateAttributesMapping: popupTransitionStateMapping
  });
  return element;
});
if (true) TooltipPopup.displayName = "TooltipPopup";

// node_modules/@base-ui/react/tooltip/arrow/TooltipArrow.mjs
var React90 = __toESM(require_react(), 1);
var TooltipArrow = /* @__PURE__ */ React90.forwardRef(function TooltipArrow2(componentProps, forwardedRef) {
  const {
    render: render4,
    className,
    style,
    ...elementProps
  } = componentProps;
  const store2 = useTooltipRootContext();
  const {
    arrowRef,
    side,
    align,
    arrowUncentered,
    arrowStyles
  } = useTooltipPositionerContext();
  const open3 = store2.useState("open");
  const instantType = store2.useState("instantType");
  const state = {
    open: open3,
    side,
    align,
    uncentered: arrowUncentered,
    instant: instantType
  };
  const element = useRenderElement("div", componentProps, {
    state,
    ref: [forwardedRef, arrowRef],
    props: [{
      style: arrowStyles,
      "aria-hidden": true
    }, elementProps],
    stateAttributesMapping: popupStateMapping
  });
  return element;
});
if (true) TooltipArrow.displayName = "TooltipArrow";

// node_modules/@base-ui/react/tooltip/provider/TooltipProvider.mjs
var React91 = __toESM(require_react(), 1);
var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1);
var TooltipProvider = function TooltipProvider2(props) {
  const {
    delay,
    closeDelay,
    timeout = 400
  } = props;
  const delayValue = React91.useMemo(() => ({
    open: delay,
    close: closeDelay
  }), [delay, closeDelay]);
  return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TooltipProviderContext.Provider, {
    value: delay,
    children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(FloatingDelayGroup, {
      delay: delayValue,
      timeoutMs: timeout,
      children: props.children
    })
  });
};
if (true) TooltipProvider.displayName = "TooltipProvider";

// node_modules/@base-ui/react/tooltip/viewport/TooltipViewport.mjs
var React92 = __toESM(require_react(), 1);
var TooltipViewport = /* @__PURE__ */ React92.forwardRef(function TooltipViewport2(componentProps, forwardedRef) {
  const {
    render: render4,
    className,
    style,
    children,
    ...elementProps
  } = componentProps;
  const store2 = useTooltipRootContext();
  const positioner = useTooltipPositionerContext();
  const instantType = store2.useState("instantType");
  const {
    children: childrenToRender,
    state: viewportState
  } = usePopupViewport({
    store: store2,
    side: positioner.side,
    children
  });
  const state = {
    activationDirection: viewportState.activationDirection,
    transitioning: viewportState.transitioning,
    instant: instantType
  };
  return useRenderElement("div", componentProps, {
    state,
    ref: forwardedRef,
    props: [elementProps, {
      children: childrenToRender
    }],
    stateAttributesMapping: popupViewportStateMapping
  });
});
if (true) TooltipViewport.displayName = "TooltipViewport";

// node_modules/@base-ui/react/tooltip/store/TooltipHandle.mjs
var TooltipHandle = class extends BasePopupHandle {
  constructor() {
    super(createNullTooltipStore(), "Tooltip");
  }
  /**
   * Opens the tooltip and associates it with the trigger with the given id.
   *
   * This method should only be called in an event handler or an effect (not during rendering).
   *
   * @param triggerId ID of the trigger to associate with the tooltip. The trigger must be a matching
   * `Tooltip.Trigger` with this handle passed as a prop.
   */
  open(triggerId) {
    this.openByTrigger(triggerId);
  }
  /**
   * Closes the tooltip.
   *
   * This method should only be called in an event handler or an effect (not during rendering).
   */
  close() {
    this.closePopup();
  }
  /**
   * Whether the tooltip is currently open. Returns `false` while no root is attached to the handle.
   */
  get isOpen() {
    return this.attachedStore?.select("open") ?? false;
  }
};
function createTooltipHandle() {
  return new TooltipHandle();
}

// node_modules/@base-ui/react/use-render/useRender.mjs
function useRender(params) {
  return useRenderElement(params.defaultTagName ?? "div", params, params);
}

// packages/ui/build-module/text/text.mjs
var import_element10 = __toESM(require_element(), 1);
var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
function getRuntime() {
  const globalScope = globalThis;
  if (globalScope.__wpStyleRuntime) {
    return globalScope.__wpStyleRuntime;
  }
  globalScope.__wpStyleRuntime = {
    documents: /* @__PURE__ */ new Map(),
    styles: /* @__PURE__ */ new Map(),
    injectedStyles: /* @__PURE__ */ new WeakMap()
  };
  if (typeof document !== "undefined") {
    registerDocument(document);
  }
  return globalScope.__wpStyleRuntime;
}
function documentContainsStyleHash(targetDocument, hash) {
  if (!targetDocument.head) {
    return false;
  }
  for (const style of targetDocument.head.querySelectorAll(
    `style[${STYLE_HASH_ATTRIBUTE}]`
  )) {
    if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {
      return true;
    }
  }
  return false;
}
function injectStyle(targetDocument, hash, css) {
  if (!targetDocument.head) {
    return;
  }
  const runtime = getRuntime();
  let injectedStyles = runtime.injectedStyles.get(targetDocument);
  if (!injectedStyles) {
    injectedStyles = /* @__PURE__ */ new Set();
    runtime.injectedStyles.set(targetDocument, injectedStyles);
  }
  if (injectedStyles.has(hash)) {
    return;
  }
  if (documentContainsStyleHash(targetDocument, hash)) {
    injectedStyles.add(hash);
    return;
  }
  const style = targetDocument.createElement("style");
  style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);
  style.appendChild(targetDocument.createTextNode(css));
  targetDocument.head.appendChild(style);
  injectedStyles.add(hash);
}
function registerDocument(targetDocument) {
  const runtime = getRuntime();
  runtime.documents.set(
    targetDocument,
    (runtime.documents.get(targetDocument) ?? 0) + 1
  );
  for (const [hash, css] of runtime.styles) {
    injectStyle(targetDocument, hash, css);
  }
  return () => {
    const count = runtime.documents.get(targetDocument);
    if (count === void 0) {
      return;
    }
    if (count <= 1) {
      runtime.documents.delete(targetDocument);
      return;
    }
    runtime.documents.set(targetDocument, count - 1);
  };
}
function registerStyle(hash, css) {
  const runtime = getRuntime();
  runtime.styles.set(hash, css);
  for (const targetDocument of runtime.documents.keys()) {
    injectStyle(targetDocument, hash, css);
  }
}
if (typeof process === "undefined" || true) {
  registerStyle("3167e7d116", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._83ed8a8da5dd50ea__text{text-wrap:pretty;margin:0}._14437cfb77831647__heading-2xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-2xl,32px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-2xl,32px);--_gcd-p-line-height:var(--wpds-typography-line-height-2xl,40px);font-size:var(--wpds-typography-font-size-2xl,32px);line-height:var(--wpds-typography-line-height-2xl,40px)}._14437cfb77831647__heading-2xl,._3c78b7fa9b4072dd__heading-xl{font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-emphasis,600)}._3c78b7fa9b4072dd__heading-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-p-line-height:var(--wpds-typography-line-height-md,24px);font-size:var(--wpds-typography-font-size-xl,20px);line-height:var(--wpds-typography-line-height-md,24px)}.aa58f227716bcde2__heading-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-lg,15px)}.aa58f227716bcde2__heading-lg,.fc4da56d8dfe52c4__heading-md{font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wpds-typography-line-height-sm,20px)}.fc4da56d8dfe52c4__heading-md{--_gcd-heading-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-md,13px)}.a9b78c7c82e8dff7__heading-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-xs,11px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-xs,11px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wpds-typography-line-height-xs,16px);text-transform:uppercase}._305ff559e52180d5__body-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-p-line-height:var(--wpds-typography-line-height-xl,32px);font-size:var(--wpds-typography-font-size-xl,20px);line-height:var(--wpds-typography-line-height-xl,32px)}._305ff559e52180d5__body-xl,.ca1aa3fc2029e958__body-lg{font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-default,400)}.ca1aa3fc2029e958__body-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-p-line-height:var(--wpds-typography-line-height-md,24px);font-size:var(--wpds-typography-font-size-lg,15px);line-height:var(--wpds-typography-line-height-md,24px)}._131101940be12424__body-md{--_gcd-heading-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-line-height-sm,20px)}._0e8d87a42c1f75fa__body-sm,._131101940be12424__body-md{font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-default,400)}._0e8d87a42c1f75fa__body-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);font-size:var(--wpds-typography-font-size-sm,12px);line-height:var(--wpds-typography-line-height-xs,16px)}}}');
}
var style_default = { "text": "_83ed8a8da5dd50ea__text", "heading-2xl": "_14437cfb77831647__heading-2xl", "heading-xl": "_3c78b7fa9b4072dd__heading-xl", "heading-lg": "aa58f227716bcde2__heading-lg", "heading-md": "fc4da56d8dfe52c4__heading-md", "heading-sm": "a9b78c7c82e8dff7__heading-sm", "body-xl": "_305ff559e52180d5__body-xl", "body-lg": "ca1aa3fc2029e958__body-lg", "body-md": "_131101940be12424__body-md", "body-sm": "_0e8d87a42c1f75fa__body-sm" };
if (typeof process === "undefined" || true) {
  registerStyle("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}");
}
var global_css_defense_default = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" };
var Text = (0, import_element10.forwardRef)(function Text2({ variant = "body-md", render: render4, className, ...props }, ref) {
  const element = useRender({
    render: render4,
    defaultTagName: "span",
    ref,
    props: mergeProps(props, {
      className: clsx_default(
        style_default.text,
        global_css_defense_default.heading,
        global_css_defense_default.p,
        style_default[variant],
        className
      )
    })
  });
  return element;
});

// packages/ui/build-module/badge/badge.mjs
var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1);
var STYLE_HASH_ATTRIBUTE2 = "data-wp-hash";
function getRuntime2() {
  const globalScope = globalThis;
  if (globalScope.__wpStyleRuntime) {
    return globalScope.__wpStyleRuntime;
  }
  globalScope.__wpStyleRuntime = {
    documents: /* @__PURE__ */ new Map(),
    styles: /* @__PURE__ */ new Map(),
    injectedStyles: /* @__PURE__ */ new WeakMap()
  };
  if (typeof document !== "undefined") {
    registerDocument2(document);
  }
  return globalScope.__wpStyleRuntime;
}
function documentContainsStyleHash2(targetDocument, hash) {
  if (!targetDocument.head) {
    return false;
  }
  for (const style of targetDocument.head.querySelectorAll(
    `style[${STYLE_HASH_ATTRIBUTE2}]`
  )) {
    if (style.getAttribute(STYLE_HASH_ATTRIBUTE2) === hash) {
      return true;
    }
  }
  return false;
}
function injectStyle2(targetDocument, hash, css) {
  if (!targetDocument.head) {
    return;
  }
  const runtime = getRuntime2();
  let injectedStyles = runtime.injectedStyles.get(targetDocument);
  if (!injectedStyles) {
    injectedStyles = /* @__PURE__ */ new Set();
    runtime.injectedStyles.set(targetDocument, injectedStyles);
  }
  if (injectedStyles.has(hash)) {
    return;
  }
  if (documentContainsStyleHash2(targetDocument, hash)) {
    injectedStyles.add(hash);
    return;
  }
  const style = targetDocument.createElement("style");
  style.setAttribute(STYLE_HASH_ATTRIBUTE2, hash);
  style.appendChild(targetDocument.createTextNode(css));
  targetDocument.head.appendChild(style);
  injectedStyles.add(hash);
}
function registerDocument2(targetDocument) {
  const runtime = getRuntime2();
  runtime.documents.set(
    targetDocument,
    (runtime.documents.get(targetDocument) ?? 0) + 1
  );
  for (const [hash, css] of runtime.styles) {
    injectStyle2(targetDocument, hash, css);
  }
  return () => {
    const count = runtime.documents.get(targetDocument);
    if (count === void 0) {
      return;
    }
    if (count <= 1) {
      runtime.documents.delete(targetDocument);
      return;
    }
    runtime.documents.set(targetDocument, count - 1);
  };
}
function registerStyle2(hash, css) {
  const runtime = getRuntime2();
  runtime.styles.set(hash, css);
  for (const targetDocument of runtime.documents.keys()) {
    injectStyle2(targetDocument, hash, css);
  }
}
if (typeof process === "undefined" || true) {
  registerStyle2("40ea4a6382", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._96e6251aad1a6136__badge{border-radius:var(--wpds-border-radius-lg,8px);padding-block:var(--wpds-dimension-padding-xs,4px);padding-inline:var(--wpds-dimension-padding-sm,8px)}._99f7158cb520f750__is-high-intent{background-color:var(--wpds-color-background-surface-error,#fae5e1);color:var(--wpds-color-foreground-content-error,#470000)}.c20ebef2365bc8b7__is-medium-intent{background-color:var(--wpds-color-background-surface-warning,#fde6be);color:var(--wpds-color-foreground-content-warning,#2e1900)}._365e1626c6202e52__is-low-intent{background-color:var(--wpds-color-background-surface-caution,#fee995);color:var(--wpds-color-foreground-content-caution,#281d00)}._33f8198127ddf4ef__is-stable-intent{background-color:var(--wpds-color-background-surface-success,#c2f8ca);color:var(--wpds-color-foreground-content-success,#002900)}._04c1aca8fc449412__is-informational-intent{background-color:var(--wpds-color-background-surface-info,#deebfa);color:var(--wpds-color-foreground-content-info,#001b4f)}._90726e69d495ec19__is-draft-intent{background-color:var(--wpds-color-background-surface-neutral-weak,#f4f4f4);color:var(--wpds-color-foreground-content-neutral,#1e1e1e)}._898f4a544993bd39__is-none-intent{background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);padding-block:calc(var(--wpds-dimension-padding-xs, 4px) - var(--wpds-border-width-xs, 1px));padding-inline:calc(var(--wpds-dimension-padding-sm, 8px) - var(--wpds-border-width-xs, 1px))}}}");
}
var style_default2 = { "badge": "_96e6251aad1a6136__badge", "is-high-intent": "_99f7158cb520f750__is-high-intent", "is-medium-intent": "c20ebef2365bc8b7__is-medium-intent", "is-low-intent": "_365e1626c6202e52__is-low-intent", "is-stable-intent": "_33f8198127ddf4ef__is-stable-intent", "is-informational-intent": "_04c1aca8fc449412__is-informational-intent", "is-draft-intent": "_90726e69d495ec19__is-draft-intent", "is-none-intent": "_898f4a544993bd39__is-none-intent" };
var Badge = (0, import_element11.forwardRef)(function Badge2({ intent = "none", className, ...props }, ref) {
  return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
    Text,
    {
      ref,
      className: clsx_default(
        style_default2.badge,
        style_default2[`is-${intent}-intent`],
        className
      ),
      ...props,
      variant: "body-sm"
    }
  );
});

// packages/ui/build-module/tooltip/popup.mjs
var import_element15 = __toESM(require_element(), 1);

// packages/ui/build-module/tooltip/portal.mjs
var import_element12 = __toESM(require_element(), 1);

// packages/ui/build-module/utils/wp-compat-overlay-slot.mjs
var STYLE_HASH_ATTRIBUTE3 = "data-wp-hash";
function getRuntime3() {
  const globalScope = globalThis;
  if (globalScope.__wpStyleRuntime) {
    return globalScope.__wpStyleRuntime;
  }
  globalScope.__wpStyleRuntime = {
    documents: /* @__PURE__ */ new Map(),
    styles: /* @__PURE__ */ new Map(),
    injectedStyles: /* @__PURE__ */ new WeakMap()
  };
  if (typeof document !== "undefined") {
    registerDocument3(document);
  }
  return globalScope.__wpStyleRuntime;
}
function documentContainsStyleHash3(targetDocument, hash) {
  if (!targetDocument.head) {
    return false;
  }
  for (const style of targetDocument.head.querySelectorAll(
    `style[${STYLE_HASH_ATTRIBUTE3}]`
  )) {
    if (style.getAttribute(STYLE_HASH_ATTRIBUTE3) === hash) {
      return true;
    }
  }
  return false;
}
function injectStyle3(targetDocument, hash, css) {
  if (!targetDocument.head) {
    return;
  }
  const runtime = getRuntime3();
  let injectedStyles = runtime.injectedStyles.get(targetDocument);
  if (!injectedStyles) {
    injectedStyles = /* @__PURE__ */ new Set();
    runtime.injectedStyles.set(targetDocument, injectedStyles);
  }
  if (injectedStyles.has(hash)) {
    return;
  }
  if (documentContainsStyleHash3(targetDocument, hash)) {
    injectedStyles.add(hash);
    return;
  }
  const style = targetDocument.createElement("style");
  style.setAttribute(STYLE_HASH_ATTRIBUTE3, hash);
  style.appendChild(targetDocument.createTextNode(css));
  targetDocument.head.appendChild(style);
  injectedStyles.add(hash);
}
function registerDocument3(targetDocument) {
  const runtime = getRuntime3();
  runtime.documents.set(
    targetDocument,
    (runtime.documents.get(targetDocument) ?? 0) + 1
  );
  for (const [hash, css] of runtime.styles) {
    injectStyle3(targetDocument, hash, css);
  }
  return () => {
    const count = runtime.documents.get(targetDocument);
    if (count === void 0) {
      return;
    }
    if (count <= 1) {
      runtime.documents.delete(targetDocument);
      return;
    }
    runtime.documents.set(targetDocument, count - 1);
  };
}
function registerStyle3(hash, css) {
  const runtime = getRuntime3();
  runtime.styles.set(hash, css);
  for (const targetDocument of runtime.documents.keys()) {
    injectStyle3(targetDocument, hash, css);
  }
}
if (typeof process === "undefined" || true) {
  registerStyle3("be37f31c1e", "._11fc52b637ff8a7e__slot{inset:0;isolation:isolate;pointer-events:none;position:fixed;z-index:1000000003}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._11fc52b637ff8a7e__slot>*{pointer-events:auto}}}");
}
var wp_compat_overlay_slot_default = { "slot": "_11fc52b637ff8a7e__slot" };
var WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE = "data-wp-compat-overlay-slot";
function resolveOwnerDocument() {
  return typeof document === "undefined" ? null : document;
}
function isInWordPressEnvironment() {
  let topWp;
  try {
    topWp = window.top?.wp;
  } catch {
  }
  const wp = topWp ?? window.wp;
  return typeof wp?.components === "object" && wp.components !== null;
}
var cachedSlot = null;
function ensureSlotIsAccessible(element) {
  element.setAttribute("aria-hidden", "false");
  return element;
}
function createSlot(ownerDocument2) {
  const element = ownerDocument2.createElement("div");
  element.setAttribute(WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE, "");
  if (wp_compat_overlay_slot_default.slot) {
    element.classList.add(wp_compat_overlay_slot_default.slot);
  }
  ownerDocument2.body.appendChild(element);
  return element;
}
function getWpCompatOverlaySlot() {
  if (typeof window === "undefined") {
    return void 0;
  }
  if (!isInWordPressEnvironment() && window.__wpUiCompatOverlaySlotEnabled !== true) {
    return void 0;
  }
  const ownerDocument2 = resolveOwnerDocument();
  if (!ownerDocument2 || !ownerDocument2.body) {
    return void 0;
  }
  if (cachedSlot && cachedSlot.ownerDocument === ownerDocument2 && cachedSlot.isConnected) {
    return ensureSlotIsAccessible(cachedSlot);
  }
  const existing = ownerDocument2.querySelector(
    `[${WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE}]`
  );
  if (existing instanceof HTMLDivElement) {
    cachedSlot = ensureSlotIsAccessible(existing);
    return cachedSlot;
  }
  if (cachedSlot?.isConnected) {
    cachedSlot.remove();
  }
  cachedSlot = ensureSlotIsAccessible(createSlot(ownerDocument2));
  return cachedSlot;
}

// packages/ui/build-module/tooltip/portal.mjs
var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1);
var Portal = (0, import_element12.forwardRef)(
  function TooltipPortal3({ container, ...restProps }, ref) {
    return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
      index_parts_exports4.Portal,
      {
        container: container ?? getWpCompatOverlaySlot(),
        ...restProps,
        ref
      }
    );
  }
);

// packages/ui/build-module/tooltip/positioner.mjs
var import_element13 = __toESM(require_element(), 1);
var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1);
var STYLE_HASH_ATTRIBUTE4 = "data-wp-hash";
function getRuntime4() {
  const globalScope = globalThis;
  if (globalScope.__wpStyleRuntime) {
    return globalScope.__wpStyleRuntime;
  }
  globalScope.__wpStyleRuntime = {
    documents: /* @__PURE__ */ new Map(),
    styles: /* @__PURE__ */ new Map(),
    injectedStyles: /* @__PURE__ */ new WeakMap()
  };
  if (typeof document !== "undefined") {
    registerDocument4(document);
  }
  return globalScope.__wpStyleRuntime;
}
function documentContainsStyleHash4(targetDocument, hash) {
  if (!targetDocument.head) {
    return false;
  }
  for (const style of targetDocument.head.querySelectorAll(
    `style[${STYLE_HASH_ATTRIBUTE4}]`
  )) {
    if (style.getAttribute(STYLE_HASH_ATTRIBUTE4) === hash) {
      return true;
    }
  }
  return false;
}
function injectStyle4(targetDocument, hash, css) {
  if (!targetDocument.head) {
    return;
  }
  const runtime = getRuntime4();
  let injectedStyles = runtime.injectedStyles.get(targetDocument);
  if (!injectedStyles) {
    injectedStyles = /* @__PURE__ */ new Set();
    runtime.injectedStyles.set(targetDocument, injectedStyles);
  }
  if (injectedStyles.has(hash)) {
    return;
  }
  if (documentContainsStyleHash4(targetDocument, hash)) {
    injectedStyles.add(hash);
    return;
  }
  const style = targetDocument.createElement("style");
  style.setAttribute(STYLE_HASH_ATTRIBUTE4, hash);
  style.appendChild(targetDocument.createTextNode(css));
  targetDocument.head.appendChild(style);
  injectedStyles.add(hash);
}
function registerDocument4(targetDocument) {
  const runtime = getRuntime4();
  runtime.documents.set(
    targetDocument,
    (runtime.documents.get(targetDocument) ?? 0) + 1
  );
  for (const [hash, css] of runtime.styles) {
    injectStyle4(targetDocument, hash, css);
  }
  return () => {
    const count = runtime.documents.get(targetDocument);
    if (count === void 0) {
      return;
    }
    if (count <= 1) {
      runtime.documents.delete(targetDocument);
      return;
    }
    runtime.documents.set(targetDocument, count - 1);
  };
}
function registerStyle4(hash, css) {
  const runtime = getRuntime4();
  runtime.styles.set(hash, css);
  for (const targetDocument of runtime.documents.keys()) {
    injectStyle4(targetDocument, hash, css);
  }
}
if (typeof process === "undefined" || true) {
  registerStyle4("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}");
}
var resets_default = { "box-sizing": "_336cd3e4e743482f__box-sizing" };
if (typeof process === "undefined" || true) {
  registerStyle4("19fcc06039", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._480b748dd3510e64__positioner{z-index:var(--wp-ui-tooltip-z-index,initial)}._50096b232db7709d__popup{--_wp-ui-elevation-sm:0 1px 2px rgba(0,0,0,.05),0 2px 3px rgba(0,0,0,.04),0 6px 6px rgba(0,0,0,.03),0 8px 8px rgba(0,0,0,.02);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-elevation-sm);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-sm,12px);line-height:1.4;padding:var(--wpds-dimension-padding-xs,4px) var(--wpds-dimension-padding-sm,8px);@media (forced-colors:active){border-bottom-color:CanvasText;border-bottom-style:solid;border-bottom-width:1px;border-left-color:CanvasText;border-left-style:solid;border-left-width:1px;border-right-color:CanvasText;border-right-style:solid;border-right-width:1px;border-top-color:CanvasText;border-top-style:solid;border-top-width:1px}}}}');
}
var style_default3 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" };
var Positioner = (0, import_element13.forwardRef)(
  function TooltipPositioner3({ align = "center", className, side = "top", sideOffset = 4, ...props }, ref) {
    return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
      index_parts_exports4.Positioner,
      {
        ref,
        align,
        side,
        sideOffset,
        ...props,
        className: clsx_default(
          resets_default["box-sizing"],
          style_default3.positioner,
          className
        )
      }
    );
  }
);

// packages/ui/build-module/utils/render-slot-with-children.mjs
var import_element14 = __toESM(require_element(), 1);
function renderSlotWithChildren(slot, defaultSlot, children) {
  return (0, import_element14.cloneElement)(slot ?? defaultSlot, { children });
}

// packages/ui/build-module/utils/theme-provider.mjs
var theme = __toESM(require_theme(), 1);

// packages/ui/build-module/lock-unlock.mjs
var import_private_apis = __toESM(require_private_apis(), 1);
var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
  "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
  "@wordpress/ui"
);

// packages/ui/build-module/utils/theme-provider.mjs
function getThemeProvider() {
  const themePackage = theme;
  if (themePackage.ThemeProvider) {
    return themePackage.ThemeProvider;
  }
  if (!themePackage.privateApis) {
    throw new Error(
      "@wordpress/ui: @wordpress/theme must expose `ThemeProvider` or `privateApis.ThemeProvider`."
    );
  }
  return unlock(
    themePackage.privateApis
  ).ThemeProvider;
}
var ThemeProvider = getThemeProvider();

// packages/ui/build-module/tooltip/popup.mjs
var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1);
var STYLE_HASH_ATTRIBUTE5 = "data-wp-hash";
function getRuntime5() {
  const globalScope = globalThis;
  if (globalScope.__wpStyleRuntime) {
    return globalScope.__wpStyleRuntime;
  }
  globalScope.__wpStyleRuntime = {
    documents: /* @__PURE__ */ new Map(),
    styles: /* @__PURE__ */ new Map(),
    injectedStyles: /* @__PURE__ */ new WeakMap()
  };
  if (typeof document !== "undefined") {
    registerDocument5(document);
  }
  return globalScope.__wpStyleRuntime;
}
function documentContainsStyleHash5(targetDocument, hash) {
  if (!targetDocument.head) {
    return false;
  }
  for (const style of targetDocument.head.querySelectorAll(
    `style[${STYLE_HASH_ATTRIBUTE5}]`
  )) {
    if (style.getAttribute(STYLE_HASH_ATTRIBUTE5) === hash) {
      return true;
    }
  }
  return false;
}
function injectStyle5(targetDocument, hash, css) {
  if (!targetDocument.head) {
    return;
  }
  const runtime = getRuntime5();
  let injectedStyles = runtime.injectedStyles.get(targetDocument);
  if (!injectedStyles) {
    injectedStyles = /* @__PURE__ */ new Set();
    runtime.injectedStyles.set(targetDocument, injectedStyles);
  }
  if (injectedStyles.has(hash)) {
    return;
  }
  if (documentContainsStyleHash5(targetDocument, hash)) {
    injectedStyles.add(hash);
    return;
  }
  const style = targetDocument.createElement("style");
  style.setAttribute(STYLE_HASH_ATTRIBUTE5, hash);
  style.appendChild(targetDocument.createTextNode(css));
  targetDocument.head.appendChild(style);
  injectedStyles.add(hash);
}
function registerDocument5(targetDocument) {
  const runtime = getRuntime5();
  runtime.documents.set(
    targetDocument,
    (runtime.documents.get(targetDocument) ?? 0) + 1
  );
  for (const [hash, css] of runtime.styles) {
    injectStyle5(targetDocument, hash, css);
  }
  return () => {
    const count = runtime.documents.get(targetDocument);
    if (count === void 0) {
      return;
    }
    if (count <= 1) {
      runtime.documents.delete(targetDocument);
      return;
    }
    runtime.documents.set(targetDocument, count - 1);
  };
}
function registerStyle5(hash, css) {
  const runtime = getRuntime5();
  runtime.styles.set(hash, css);
  for (const targetDocument of runtime.documents.keys()) {
    injectStyle5(targetDocument, hash, css);
  }
}
if (typeof process === "undefined" || true) {
  registerStyle5("19fcc06039", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._480b748dd3510e64__positioner{z-index:var(--wp-ui-tooltip-z-index,initial)}._50096b232db7709d__popup{--_wp-ui-elevation-sm:0 1px 2px rgba(0,0,0,.05),0 2px 3px rgba(0,0,0,.04),0 6px 6px rgba(0,0,0,.03),0 8px 8px rgba(0,0,0,.02);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-elevation-sm);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-sm,12px);line-height:1.4;padding:var(--wpds-dimension-padding-xs,4px) var(--wpds-dimension-padding-sm,8px);@media (forced-colors:active){border-bottom-color:CanvasText;border-bottom-style:solid;border-bottom-width:1px;border-left-color:CanvasText;border-left-style:solid;border-left-width:1px;border-right-color:CanvasText;border-right-style:solid;border-right-width:1px;border-top-color:CanvasText;border-top-style:solid;border-top-width:1px}}}}');
}
var style_default4 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" };
var POPUP_COLOR = { background: "#1e1e1e" };
var Popup = (0, import_element15.forwardRef)(function TooltipPopup3({ portal, positioner, children, className, ...props }, ref) {
  const popupContent = /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ThemeProvider, { color: POPUP_COLOR, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
    index_parts_exports4.Popup,
    {
      ref,
      className: clsx_default(style_default4.popup, className),
      ...props,
      children
    }
  ) });
  const positionedPopup = renderSlotWithChildren(
    positioner,
    /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Positioner, {}),
    popupContent
  );
  return renderSlotWithChildren(portal, /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Portal, {}), positionedPopup);
});

// packages/ui/build-module/tooltip/trigger.mjs
var import_element16 = __toESM(require_element(), 1);
var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1);
var Trigger = (0, import_element16.forwardRef)(
  function TooltipTrigger3(props, ref) {
    return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(index_parts_exports4.Trigger, { ref, ...props });
  }
);

// packages/ui/build-module/utils/direction-provider.mjs
var import_i18n = __toESM(require_i18n(), 1);
var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1);
function DirectionProvider3({ children }) {
  return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DirectionProvider, { direction: (0, import_i18n.isRTL)() ? "rtl" : "ltr", children });
}

// packages/ui/build-module/tooltip/root.mjs
var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1);
function Root(props) {
  return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DirectionProvider3, { children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(index_parts_exports4.Root, { ...props }) });
}

// packages/ui/build-module/link/link.mjs
var import_element17 = __toESM(require_element(), 1);
var import_i18n2 = __toESM(require_i18n(), 1);
var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1);
var STYLE_HASH_ATTRIBUTE6 = "data-wp-hash";
function getRuntime6() {
  const globalScope = globalThis;
  if (globalScope.__wpStyleRuntime) {
    return globalScope.__wpStyleRuntime;
  }
  globalScope.__wpStyleRuntime = {
    documents: /* @__PURE__ */ new Map(),
    styles: /* @__PURE__ */ new Map(),
    injectedStyles: /* @__PURE__ */ new WeakMap()
  };
  if (typeof document !== "undefined") {
    registerDocument6(document);
  }
  return globalScope.__wpStyleRuntime;
}
function documentContainsStyleHash6(targetDocument, hash) {
  if (!targetDocument.head) {
    return false;
  }
  for (const style of targetDocument.head.querySelectorAll(
    `style[${STYLE_HASH_ATTRIBUTE6}]`
  )) {
    if (style.getAttribute(STYLE_HASH_ATTRIBUTE6) === hash) {
      return true;
    }
  }
  return false;
}
function injectStyle6(targetDocument, hash, css) {
  if (!targetDocument.head) {
    return;
  }
  const runtime = getRuntime6();
  let injectedStyles = runtime.injectedStyles.get(targetDocument);
  if (!injectedStyles) {
    injectedStyles = /* @__PURE__ */ new Set();
    runtime.injectedStyles.set(targetDocument, injectedStyles);
  }
  if (injectedStyles.has(hash)) {
    return;
  }
  if (documentContainsStyleHash6(targetDocument, hash)) {
    injectedStyles.add(hash);
    return;
  }
  const style = targetDocument.createElement("style");
  style.setAttribute(STYLE_HASH_ATTRIBUTE6, hash);
  style.appendChild(targetDocument.createTextNode(css));
  targetDocument.head.appendChild(style);
  injectedStyles.add(hash);
}
function registerDocument6(targetDocument) {
  const runtime = getRuntime6();
  runtime.documents.set(
    targetDocument,
    (runtime.documents.get(targetDocument) ?? 0) + 1
  );
  for (const [hash, css] of runtime.styles) {
    injectStyle6(targetDocument, hash, css);
  }
  return () => {
    const count = runtime.documents.get(targetDocument);
    if (count === void 0) {
      return;
    }
    if (count <= 1) {
      runtime.documents.delete(targetDocument);
      return;
    }
    runtime.documents.set(targetDocument, count - 1);
  };
}
function registerStyle6(hash, css) {
  const runtime = getRuntime6();
  runtime.styles.set(hash, css);
  for (const targetDocument of runtime.documents.keys()) {
    injectStyle6(targetDocument, hash, css);
  }
}
if (typeof process === "undefined" || true) {
  registerStyle6("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}");
}
var resets_default2 = { "box-sizing": "_336cd3e4e743482f__box-sizing" };
if (typeof process === "undefined" || true) {
  registerStyle6("08122b3d53", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{.af79fb116edb0dd7__outset-ring--focus:focus,.dfcfdc28396e5d98__outset-ring--focus-visible:focus-visible,.e5cd9ee879f6403a__outset-ring--focus-within:focus-within,:focus-visible ._81935a08e952f267__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within,.abc777e9713fa711__outset-ring--focus-except-active:focus{outline:none}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.abc777e9713fa711__outset-ring--focus-except-active:focus:not(:active){--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}}");
}
var focus_module_default = { "outset-ring--focus": "af79fb116edb0dd7__outset-ring--focus", "outset-ring--focus-visible": "dfcfdc28396e5d98__outset-ring--focus-visible", "outset-ring--focus-within": "e5cd9ee879f6403a__outset-ring--focus-within", "outset-ring--focus-parent-visible": "_81935a08e952f267__outset-ring--focus-parent-visible", "outset-ring--focus-except-active": "abc777e9713fa711__outset-ring--focus-except-active", "outset-ring--focus-within-except-active": "_3c9f5ee9fc9c136d__outset-ring--focus-within-except-active" };
if (typeof process === "undefined" || true) {
  registerStyle6("e8e6a9be37", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.d4250949359b05ce__link{text-decoration-thickness:from-font;text-underline-offset:.2em}.c6055659b8e2cd2c__is-brand,.c6055659b8e2cd2c__is-brand:visited{--_gcd-a-color:var(--wpds-color-foreground-interactive-brand,var(--wp-admin-theme-color,#3858e9));color:var(--wpds-color-foreground-interactive-brand,var(--wp-admin-theme-color,#3858e9))}.c6055659b8e2cd2c__is-brand:active,.c6055659b8e2cd2c__is-brand:hover{--_gcd-a-color:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000));color:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000))}._92e0dfcaeee15b88__is-neutral,._92e0dfcaeee15b88__is-neutral:visited{--_gcd-a-color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);text-decoration-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d)}._92e0dfcaeee15b88__is-neutral:active,._92e0dfcaeee15b88__is-neutral:hover{--_gcd-a-color:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e);color:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e)}.cf122a9bf1035d42__is-unstyled{--_gcd-a-color:inherit;color:inherit;text-decoration:none}._0cb411afac4c86c7__link-icon{display:inline-block;font-weight:var(--wpds-typography-font-weight-default,400);line-height:1;margin-inline-start:var(--wpds-dimension-padding-xs,4px);text-decoration:none}._0cb411afac4c86c7__link-icon:after{content:"\\2197"}._0cb411afac4c86c7__link-icon:dir(rtl):after{content:"\\2196"}}}');
}
var style_default5 = { "link": "d4250949359b05ce__link", "is-brand": "c6055659b8e2cd2c__is-brand", "is-neutral": "_92e0dfcaeee15b88__is-neutral", "is-unstyled": "cf122a9bf1035d42__is-unstyled", "link-icon": "_0cb411afac4c86c7__link-icon" };
if (typeof process === "undefined" || true) {
  registerStyle6("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}");
}
var global_css_defense_default2 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" };
var Link = (0, import_element17.forwardRef)(function Link2({
  children,
  variant = "default",
  tone = "brand",
  openInNewTab = false,
  target,
  render: render4,
  className,
  ...props
}, ref) {
  const shouldShowNewTabIndicator = openInNewTab || /^_blank$/i.test(target ?? "");
  const element = useRender({
    render: render4,
    defaultTagName: "a",
    ref,
    props: mergeProps(props, {
      className: clsx_default(
        global_css_defense_default2.a,
        resets_default2["box-sizing"],
        focus_module_default["outset-ring--focus-except-active"],
        variant !== "unstyled" && style_default5.link,
        variant !== "unstyled" && style_default5[`is-${tone}`],
        variant === "unstyled" && style_default5["is-unstyled"],
        className
      ),
      target: target ?? (openInNewTab ? "_blank" : void 0),
      children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
        children,
        shouldShowNewTabIndicator && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
          "span",
          {
            className: style_default5["link-icon"],
            role: "img",
            "aria-label": (
              /* translators: accessibility text appended to link text */
              (0, import_i18n2.__)("(opens in a new tab)")
            )
          }
        )
      ] })
    })
  });
  return element;
});

// packages/icons/build-module/library/aspect-ratio.mjs
var import_primitives = __toESM(require_primitives(), 1);
var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1);
var aspect_ratio_default = /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_primitives.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_primitives.Path, { d: "M7.25 12V9.25H10M16.75 12V14.75H14M5.5 17.75H18.5C19.1904 17.75 19.75 17.1904 19.75 16.5V7.5C19.75 6.80964 19.1904 6.25 18.5 6.25H5.5C4.80964 6.25 4.25 6.80964 4.25 7.5V16.5C4.25 17.1904 4.80964 17.75 5.5 17.75Z", vectorEffect: "non-scaling-stroke" }) });

// packages/icons/build-module/library/check.mjs
var import_primitives2 = __toESM(require_primitives(), 1);
var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1);
var check_default = /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_primitives2.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_primitives2.Path, { d: "M7 12L10 15L17 8", vectorEffect: "non-scaling-stroke" }) });

// packages/icons/build-module/library/chevron-down.mjs
var import_primitives3 = __toESM(require_primitives(), 1);
var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1);
var chevron_down_default = /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_primitives3.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_primitives3.Path, { d: "M7 11L12 15L17 11", vectorEffect: "non-scaling-stroke" }) });

// packages/icons/build-module/library/chevron-left.mjs
var import_primitives4 = __toESM(require_primitives(), 1);
var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1);
var chevron_left_default = /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_primitives4.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_primitives4.Path, { d: "M14 6.5L9 12L14 17.5", vectorEffect: "non-scaling-stroke" }) });

// packages/icons/build-module/library/chevron-right.mjs
var import_primitives5 = __toESM(require_primitives(), 1);
var import_jsx_runtime37 = __toESM(require_jsx_runtime(), 1);
var chevron_right_default = /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_primitives5.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_primitives5.Path, { d: "M10 6.5L15 12L10 17.5", vectorEffect: "non-scaling-stroke" }) });

// packages/icons/build-module/library/close-small.mjs
var import_primitives6 = __toESM(require_primitives(), 1);
var import_jsx_runtime38 = __toESM(require_jsx_runtime(), 1);
var close_small_default = /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_primitives6.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_primitives6.Path, { d: "M7.75 16.25L16.25 7.75M16.25 16.25L7.75 7.75", vectorEffect: "non-scaling-stroke" }) });

// packages/icons/build-module/library/close.mjs
var import_primitives7 = __toESM(require_primitives(), 1);
var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1);
var close_default = /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_primitives7.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_primitives7.Path, { d: "M5 19L19 5M19 19L5 5", vectorEffect: "non-scaling-stroke" }) });

// packages/icons/build-module/library/drawer-right.mjs
var import_primitives8 = __toESM(require_primitives(), 1);
var import_jsx_runtime40 = __toESM(require_jsx_runtime(), 1);
var drawer_right_default = /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_primitives8.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_primitives8.Path, { d: "M14.25 19.25L18 19.25C18.6904 19.25 19.25 18.6904 19.25 18L19.25 6C19.25 5.30964 18.6904 4.75 18 4.75L14.25 4.75M14.25 19.25L6 19.25C5.30964 19.25 4.75 18.6904 4.75 18L4.75 6C4.75 5.30964 5.30965 4.75 6 4.75L14.25 4.75M14.25 19.25L14.25 4.75", vectorEffect: "non-scaling-stroke" }) });

// packages/icons/build-module/library/envelope.mjs
var import_primitives9 = __toESM(require_primitives(), 1);
var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1);
var envelope_default = /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_primitives9.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_primitives9.Path, { d: "M20.25 8.5V7C20.25 6.30964 19.6904 5.75 19 5.75H5C4.30964 5.75 3.75 6.30964 3.75 7V8.5M20.25 8.5V17C20.25 17.6904 19.6904 18.25 19 18.25H5C4.30964 18.25 3.75 17.6904 3.75 17V8.5M20.25 8.5L12 14.5L3.75 8.5", vectorEffect: "non-scaling-stroke" }) });

// packages/icons/build-module/library/error.mjs
var import_primitives10 = __toESM(require_primitives(), 1);
var import_jsx_runtime42 = __toESM(require_jsx_runtime(), 1);
var error_default = /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_primitives10.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_primitives10.Path, { d: "M12 9L12 14M12 15.5V17M11.1284 5.04947L3.83827 18.0097C3.46331 18.6763 3.94502 19.5 4.70985 19.5H19.2902C20.055 19.5 20.5367 18.6763 20.1617 18.0097L12.8716 5.04947C12.4893 4.36982 11.5107 4.36982 11.1284 5.04947Z", vectorEffect: "non-scaling-stroke" }) });

// packages/icons/build-module/library/flip-horizontal.mjs
var import_primitives11 = __toESM(require_primitives(), 1);
var import_jsx_runtime43 = __toESM(require_jsx_runtime(), 1);
var flip_horizontal_default = /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_primitives11.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_primitives11.Path, { d: "M9 19.25H6C5.30964 19.25 4.75 18.6904 4.75 18V6C4.75 5.30964 5.30964 4.75 6 4.75H9M15 4.75L16.5 4.75M15 19.25H16.5M12 22V2M19.25 16.5V14.5M19.25 13V11M19.25 9.5V7.5M18 4.75C18.6904 4.75 19.25 5.30964 19.25 6M18 19.25C18.6904 19.25 19.25 18.6904 19.25 18", vectorEffect: "non-scaling-stroke" }) });

// packages/icons/build-module/library/flip-vertical.mjs
var import_primitives12 = __toESM(require_primitives(), 1);
var import_jsx_runtime44 = __toESM(require_jsx_runtime(), 1);
var flip_vertical_default = /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_primitives12.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_primitives12.Path, { d: "M4.75 9L4.75 6C4.75 5.30964 5.30964 4.75 6 4.75L18 4.75C18.6904 4.75 19.25 5.30964 19.25 6L19.25 9M19.25 15L19.25 16.5M4.75 15L4.75 16.5M2 12L22 12M7.5 19.25L9.5 19.25M11 19.25L13 19.25M14.5 19.25L16.5 19.25M19.25 18C19.25 18.6904 18.6904 19.25 18 19.25M4.75 18C4.75 18.6904 5.30964 19.25 6 19.25", vectorEffect: "non-scaling-stroke" }) });

// packages/icons/build-module/library/keyboard.mjs
var import_primitives13 = __toESM(require_primitives(), 1);
var import_jsx_runtime45 = __toESM(require_jsx_runtime(), 1);
var keyboard_default = /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_primitives13.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_primitives13.Path, { d: "M6.5 9H8.5M8 15H16M6.5 12H8.5M9.5 9H11.5M9.5 12H11.5M12.5 9H14.5M12.5 12H14.5M15.5 9H17.5M15.5 12H17.5M5 18.25H19C19.6904 18.25 20.25 17.6904 20.25 17V7C20.25 6.30964 19.6904 5.75 19 5.75H5C4.30964 5.75 3.75 6.30964 3.75 7V17C3.75 17.6904 4.30964 18.25 5 18.25Z", vectorEffect: "non-scaling-stroke" }) });

// packages/icons/build-module/library/line-solid.mjs
var import_primitives14 = __toESM(require_primitives(), 1);
var import_jsx_runtime46 = __toESM(require_jsx_runtime(), 1);
var line_solid_default = /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_primitives14.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_primitives14.Path, { d: "M5 12H19", vectorEffect: "non-scaling-stroke" }) });

// packages/icons/build-module/library/link.mjs
var import_primitives15 = __toESM(require_primitives(), 1);
var import_jsx_runtime47 = __toESM(require_jsx_runtime(), 1);
var link_default = /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_primitives15.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_primitives15.Path, { d: "M9.5 12L14.5 12M10 7.75H8.25C5.90279 7.75 4 9.65279 4 12C4 14.3472 5.90279 16.25 8.25 16.25H10M14 16.25H15.75C18.0972 16.25 20 14.3472 20 12C20 9.65279 18.0972 7.75 15.75 7.75L14 7.75", vectorEffect: "non-scaling-stroke" }) });

// packages/icons/build-module/library/mobile.mjs
var import_primitives16 = __toESM(require_primitives(), 1);
var import_jsx_runtime48 = __toESM(require_jsx_runtime(), 1);
var mobile_default = /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_primitives16.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_primitives16.Path, { d: "M11 16.5H13M16.25 18V6C16.25 5.30964 15.6904 4.75 15 4.75H9C8.30964 4.75 7.75 5.30964 7.75 6L7.75 18C7.75 18.6904 8.30964 19.25 9 19.25H15C15.6904 19.25 16.25 18.6904 16.25 18Z", vectorEffect: "non-scaling-stroke" }) });

// packages/icons/build-module/library/pencil.mjs
var import_primitives17 = __toESM(require_primitives(), 1);
var import_jsx_runtime49 = __toESM(require_jsx_runtime(), 1);
var pencil_default = /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_primitives17.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [
  /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_primitives17.Path, { d: "M5 19.25H12", vectorEffect: "non-scaling-stroke" }),
  /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_primitives17.Path, { d: "M10 15L7.5 15.5L8 13L16 5L18 7L10 15Z", fill: "currentColor", vectorEffect: "non-scaling-stroke" })
] });

// packages/icons/build-module/library/plus.mjs
var import_primitives18 = __toESM(require_primitives(), 1);
var import_jsx_runtime50 = __toESM(require_jsx_runtime(), 1);
var plus_default = /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_primitives18.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_primitives18.Path, { d: "M12 18V6M18 12H6", vectorEffect: "non-scaling-stroke" }) });

// packages/icons/build-module/library/published.mjs
var import_primitives19 = __toESM(require_primitives(), 1);
var import_jsx_runtime51 = __toESM(require_jsx_runtime(), 1);
var published_default = /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_primitives19.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [
  /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_primitives19.Path, { d: "M12 19.25C16.0041 19.25 19.25 16.0041 19.25 12C19.25 7.99594 16.0041 4.75 12 4.75C7.99594 4.75 4.75 7.99594 4.75 12C4.75 16.0041 7.99594 19.25 12 19.25Z", strokeLinejoin: "round", vectorEffect: "non-scaling-stroke" }),
  /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_primitives19.Path, { d: "M9 12L11 14L15 10", vectorEffect: "non-scaling-stroke" })
] });

// packages/icons/build-module/library/redo.mjs
var import_primitives20 = __toESM(require_primitives(), 1);
var import_jsx_runtime52 = __toESM(require_jsx_runtime(), 1);
var redo_default = /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_primitives20.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_primitives20.Path, { d: "M15 15L18.5 11L15 7M18.5 11H8C5 11 4.75 13.8 4.75 17", vectorEffect: "non-scaling-stroke" }) });

// packages/icons/build-module/library/rotate-left.mjs
var import_primitives21 = __toESM(require_primitives(), 1);
var import_jsx_runtime53 = __toESM(require_jsx_runtime(), 1);
var rotate_left_default = /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_primitives21.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [
  /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_primitives21.Path, { d: "M12 19.25C16.0041 19.25 19.25 16.0041 19.25 12C19.25 7.99594 16.0041 4.75 12 4.75L10 4.75M12 2L10 4.75L12 7.5", vectorEffect: "non-scaling-stroke" }),
  /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_primitives21.Path, { d: "M14.7745 18.6981C11.0752 20.2304 6.83418 18.4737 5.30189 14.7745C4.27391 12.2927 4.72622 9.56712 6.25229 7.57918", strokeLinejoin: "round", vectorEffect: "non-scaling-stroke" })
] });

// packages/icons/build-module/library/rotate-right.mjs
var import_primitives22 = __toESM(require_primitives(), 1);
var import_jsx_runtime54 = __toESM(require_jsx_runtime(), 1);
var rotate_right_default = /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_primitives22.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [
  /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_primitives22.Path, { d: "M12 19.25C7.99593 19.25 4.75 16.0041 4.75 12C4.75 7.99594 7.99593 4.75 12 4.75L14 4.75M12 2L14 4.75L12 7.5", vectorEffect: "non-scaling-stroke" }),
  /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_primitives22.Path, { d: "M9.22553 18.6981C12.9248 20.2304 17.1658 18.4737 18.6981 14.7745C19.7261 12.2927 19.2738 9.56712 17.7477 7.57918", strokeLinejoin: "round", vectorEffect: "non-scaling-stroke" })
] });

// packages/icons/build-module/library/seen.mjs
var import_primitives23 = __toESM(require_primitives(), 1);
var import_jsx_runtime55 = __toESM(require_jsx_runtime(), 1);
var seen_default = /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_primitives23.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [
  /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_primitives23.Path, { d: "M20.0645 13C18.5918 10.0366 15.5337 8 12 8C8.46631 8 5.40825 10.0366 3.93555 13", vectorEffect: "non-scaling-stroke" }),
  /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_primitives23.Circle, { cx: "12", cy: "12.5", r: "3", fill: "currentColor", vectorEffect: "non-scaling-stroke" })
] });

// packages/icons/build-module/library/undo.mjs
var import_primitives24 = __toESM(require_primitives(), 1);
var import_jsx_runtime56 = __toESM(require_jsx_runtime(), 1);
var undo_default = /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_primitives24.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_primitives24.Path, { d: "M8.25 15L4.75 11L8.25 7M4.75 11H15.25C18.25 11 18.5 13.8 18.5 17", vectorEffect: "non-scaling-stroke" }) });

// packages/icons/build-module/library/unseen.mjs
var import_primitives25 = __toESM(require_primitives(), 1);
var import_jsx_runtime57 = __toESM(require_jsx_runtime(), 1);
var unseen_default = /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_primitives25.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [
  /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_primitives25.Path, { d: "M8 21L10.6587 15.1842M13.1523 9.72929L13.8553 8.19144L16 3.5M20.0645 13C19.2118 11.2841 17.8276 9.87898 16.1272 9M3.93555 13C5.40825 10.0366 8.46631 8 12 8C12.636 8 13.2566 8.06597 13.8553 8.19144M13.1523 9.72929C12.7975 9.58156 12.4083 9.5 12 9.5C10.3431 9.5 9 10.8431 9 12.5C9 13.6747 9.67519 14.6917 10.6587 15.1842M13.1523 9.72929L10.6587 15.1842M13.1755 15.261C14.2481 14.8037 15 13.7397 15 12.5C15 12.1819 14.9505 11.8753 14.8587 11.5876", vectorEffect: "non-scaling-stroke" }),
  /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_primitives25.Path, { d: "M12 9.5C10.3431 9.5 9 10.8431 9 12.5C9 13.6747 9.67519 14.6917 10.6587 15.1842L13.1523 9.72929C12.7975 9.58156 12.4083 9.5 12 9.5Z", fill: "currentColor", vectorEffect: "non-scaling-stroke" })
] });

// packages/ui/build-module/icon/icon.mjs
var import_element18 = __toESM(require_element(), 1);
var import_primitives26 = __toESM(require_primitives(), 1);
var import_jsx_runtime58 = __toESM(require_jsx_runtime(), 1);
var Icon = (0, import_element18.forwardRef)(function Icon2({ icon, size: size4 = 24, style, ...restProps }, ref) {
  const mergedStyle = icon.props.style || style ? { ...icon.props.style, ...style } : void 0;
  return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
    import_primitives26.SVG,
    {
      ref,
      ...icon.props,
      ...restProps,
      ...mergedStyle ? { style: mergedStyle } : {},
      width: size4,
      height: size4
    }
  );
});

// packages/ui/build-module/utils/keyboard-shortcut.mjs
var import_element20 = __toESM(require_element(), 1);
var import_i18n3 = __toESM(require_i18n(), 1);

// packages/ui/build-module/visually-hidden/visually-hidden.mjs
var import_element19 = __toESM(require_element(), 1);
var STYLE_HASH_ATTRIBUTE7 = "data-wp-hash";
function getRuntime7() {
  const globalScope = globalThis;
  if (globalScope.__wpStyleRuntime) {
    return globalScope.__wpStyleRuntime;
  }
  globalScope.__wpStyleRuntime = {
    documents: /* @__PURE__ */ new Map(),
    styles: /* @__PURE__ */ new Map(),
    injectedStyles: /* @__PURE__ */ new WeakMap()
  };
  if (typeof document !== "undefined") {
    registerDocument7(document);
  }
  return globalScope.__wpStyleRuntime;
}
function documentContainsStyleHash7(targetDocument, hash) {
  if (!targetDocument.head) {
    return false;
  }
  for (const style of targetDocument.head.querySelectorAll(
    `style[${STYLE_HASH_ATTRIBUTE7}]`
  )) {
    if (style.getAttribute(STYLE_HASH_ATTRIBUTE7) === hash) {
      return true;
    }
  }
  return false;
}
function injectStyle7(targetDocument, hash, css) {
  if (!targetDocument.head) {
    return;
  }
  const runtime = getRuntime7();
  let injectedStyles = runtime.injectedStyles.get(targetDocument);
  if (!injectedStyles) {
    injectedStyles = /* @__PURE__ */ new Set();
    runtime.injectedStyles.set(targetDocument, injectedStyles);
  }
  if (injectedStyles.has(hash)) {
    return;
  }
  if (documentContainsStyleHash7(targetDocument, hash)) {
    injectedStyles.add(hash);
    return;
  }
  const style = targetDocument.createElement("style");
  style.setAttribute(STYLE_HASH_ATTRIBUTE7, hash);
  style.appendChild(targetDocument.createTextNode(css));
  targetDocument.head.appendChild(style);
  injectedStyles.add(hash);
}
function registerDocument7(targetDocument) {
  const runtime = getRuntime7();
  runtime.documents.set(
    targetDocument,
    (runtime.documents.get(targetDocument) ?? 0) + 1
  );
  for (const [hash, css] of runtime.styles) {
    injectStyle7(targetDocument, hash, css);
  }
  return () => {
    const count = runtime.documents.get(targetDocument);
    if (count === void 0) {
      return;
    }
    if (count <= 1) {
      runtime.documents.delete(targetDocument);
      return;
    }
    runtime.documents.set(targetDocument, count - 1);
  };
}
function registerStyle7(hash, css) {
  const runtime = getRuntime7();
  runtime.styles.set(hash, css);
  for (const targetDocument of runtime.documents.keys()) {
    injectStyle7(targetDocument, hash, css);
  }
}
if (typeof process === "undefined" || true) {
  registerStyle7("f4df7461e9", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.f37b9e2e191ebd66__visually-hidden{border:0;clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;overflow-wrap:normal;padding:0;position:absolute;width:1px;word-break:normal}}}");
}
var style_default6 = { "visually-hidden": "f37b9e2e191ebd66__visually-hidden" };
var VisuallyHidden = (0, import_element19.forwardRef)(
  function VisuallyHidden2({ render: render4, ...restProps }, ref) {
    const element = useRender({
      render: render4,
      ref,
      props: mergeProps(
        { className: style_default6["visually-hidden"] },
        restProps,
        {
          // @ts-expect-error Arbitrary data-* attributes aren't indexable on the typed div props. Kept hardcoded so consumers can't change or remove it.
          "data-visually-hidden": ""
        }
      )
    });
    return element;
  }
);

// packages/ui/build-module/utils/keyboard-shortcut.mjs
var import_jsx_runtime59 = __toESM(require_jsx_runtime(), 1);
function useKeyboardShortcutProps({
  "aria-describedby": ariaDescribedBy,
  "aria-keyshortcuts": ariaKeyShortcuts,
  shortcut
}) {
  const generatedDescriptionId = (0, import_element20.useId)();
  const descriptionId = shortcut ? generatedDescriptionId : void 0;
  const describedBy = [ariaDescribedBy, descriptionId].filter(Boolean).join(" ");
  return {
    descriptionId,
    targetProps: {
      "aria-describedby": describedBy || void 0,
      "aria-keyshortcuts": shortcut?.ariaKeyShortcut ?? ariaKeyShortcuts
    }
  };
}
var KeyboardShortcutDescription = (0, import_element20.forwardRef)(function KeyboardShortcutDescription2({ descriptionId, shortcut }, ref) {
  return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
    VisuallyHidden,
    {
      id: descriptionId,
      "aria-hidden": "true",
      render: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { ref }),
      children: (0, import_i18n3.sprintf)(
        /* translators: %s: keyboard shortcut. */
        (0, import_i18n3.__)("Keyboard shortcut: %s"),
        shortcut.label ?? shortcut.ariaKeyShortcut
      )
    }
  );
});
var KeyboardShortcutDisplay = (0, import_element20.forwardRef)(function KeyboardShortcutDisplay2({ className, shortcut }, ref) {
  return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { ref, "aria-hidden": "true", className, dir: "ltr", children: shortcut.displayShortcut });
});

// packages/ui/build-module/button/button.mjs
var import_element21 = __toESM(require_element(), 1);
var import_i18n4 = __toESM(require_i18n(), 1);
var import_jsx_runtime60 = __toESM(require_jsx_runtime(), 1);
import { speak } from "@wordpress/a11y";
var STYLE_HASH_ATTRIBUTE8 = "data-wp-hash";
function getRuntime8() {
  const globalScope = globalThis;
  if (globalScope.__wpStyleRuntime) {
    return globalScope.__wpStyleRuntime;
  }
  globalScope.__wpStyleRuntime = {
    documents: /* @__PURE__ */ new Map(),
    styles: /* @__PURE__ */ new Map(),
    injectedStyles: /* @__PURE__ */ new WeakMap()
  };
  if (typeof document !== "undefined") {
    registerDocument8(document);
  }
  return globalScope.__wpStyleRuntime;
}
function documentContainsStyleHash8(targetDocument, hash) {
  if (!targetDocument.head) {
    return false;
  }
  for (const style of targetDocument.head.querySelectorAll(
    `style[${STYLE_HASH_ATTRIBUTE8}]`
  )) {
    if (style.getAttribute(STYLE_HASH_ATTRIBUTE8) === hash) {
      return true;
    }
  }
  return false;
}
function injectStyle8(targetDocument, hash, css) {
  if (!targetDocument.head) {
    return;
  }
  const runtime = getRuntime8();
  let injectedStyles = runtime.injectedStyles.get(targetDocument);
  if (!injectedStyles) {
    injectedStyles = /* @__PURE__ */ new Set();
    runtime.injectedStyles.set(targetDocument, injectedStyles);
  }
  if (injectedStyles.has(hash)) {
    return;
  }
  if (documentContainsStyleHash8(targetDocument, hash)) {
    injectedStyles.add(hash);
    return;
  }
  const style = targetDocument.createElement("style");
  style.setAttribute(STYLE_HASH_ATTRIBUTE8, hash);
  style.appendChild(targetDocument.createTextNode(css));
  targetDocument.head.appendChild(style);
  injectedStyles.add(hash);
}
function registerDocument8(targetDocument) {
  const runtime = getRuntime8();
  runtime.documents.set(
    targetDocument,
    (runtime.documents.get(targetDocument) ?? 0) + 1
  );
  for (const [hash, css] of runtime.styles) {
    injectStyle8(targetDocument, hash, css);
  }
  return () => {
    const count = runtime.documents.get(targetDocument);
    if (count === void 0) {
      return;
    }
    if (count <= 1) {
      runtime.documents.delete(targetDocument);
      return;
    }
    runtime.documents.set(targetDocument, count - 1);
  };
}
function registerStyle8(hash, css) {
  const runtime = getRuntime8();
  runtime.styles.set(hash, css);
  for (const targetDocument of runtime.documents.keys()) {
    injectStyle8(targetDocument, hash, css);
  }
}
if (typeof process === "undefined" || true) {
  registerStyle8("effc4e3032", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._97b0fc33c028be1a__button,.abbb272e2ce49bd6__is-unstyled{appearance:none;padding:0}._97b0fc33c028be1a__button{--wp-ui-button-font-weight:var(--wpds-typography-font-weight-emphasis,600);--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-strong,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-brand-strong-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 93%,#000));--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-brand-strong-disabled,#e6e6e6);--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-brand-strong,#fff);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-brand-strong-active,#fff);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-brand-strong-disabled,#8d8d8d);--wp-ui-button-padding-block:var(--wpds-dimension-padding-xs,4px);--wp-ui-button-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-button-height:var(--wpds-dimension-size-lg,40px);--wp-ui-button-aspect-ratio:auto;--wp-ui-button-font-size:var(--wpds-typography-font-size-md,13px);--wp-ui-button-min-width:calc(4ch + var(--wp-ui-button-padding-inline)*2);--wp-ui-button-icon-margin:calc((var(--wpds-dimension-size-2xs, 16px) - var(--wpds-dimension-size-sm, 24px))/2);--wp-ui-button-border-color:var(--wp-ui-button-background-color);--wp-ui-button-border-color-active:var(--wp-ui-button-background-color-active);--wp-ui-button-border-color-disabled:var(--wp-ui-button-background-color-disabled);--_gcd-button-font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);--_gcd-button-font-size:var(--wp-ui-button-font-size);--_gcd-button-font-weight:var(--wp-ui-button-font-weight);align-items:center;aspect-ratio:var(--wp-ui-button-aspect-ratio);background-clip:border-box;background-color:var(--wp-ui-button-background-color);border-color:var(--wp-ui-button-border-color);border-radius:var(--wpds-border-radius-sm,2px);border-style:solid;border-width:1px;color:var(--wp-ui-button-foreground-color);display:inline-flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wp-ui-button-font-size);font-weight:var(--wp-ui-button-font-weight);gap:var(--wpds-dimension-gap-sm,8px);justify-content:center;line-height:var(--wpds-typography-line-height-sm,20px);max-width:100%;min-height:var(--wp-ui-button-height);min-width:var(--wp-ui-button-min-width);overflow-wrap:anywhere;padding-block:var(--wp-ui-button-padding-block);padding-inline:var(--wp-ui-button-padding-inline);position:relative;text-align:center;text-decoration:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}@media not (prefers-reduced-motion){transition:color .1s ease-out;*{transition:opacity .1s ease-out}}&[href]{cursor:pointer}[href]{color:inherit;text-decoration:inherit}&:not([data-disabled]):is(:hover,:active,:focus){background-color:var(--wp-ui-button-background-color-active);border-color:var(--wp-ui-button-border-color-active);color:var(--wp-ui-button-foreground-color-active)}&[data-disabled]:not(._914b42f315c0e580__is-loading){background-color:var(--wp-ui-button-background-color-disabled);border-color:var(--wp-ui-button-border-color-disabled);color:var(--wp-ui-button-foreground-color-disabled);@media (forced-colors:active){border-bottom-color:GrayText;border-left-color:GrayText;border-right-color:GrayText;border-top-color:GrayText;color:GrayText}}&:before{aspect-ratio:1;border:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid;border-block-end-color:transparent;border-block-start-color:var(--wp-ui-button-foreground-color);border-inline-end-color:var(--wp-ui-button-foreground-color);border-inline-start-color:transparent;border-radius:50%;box-sizing:border-box;content:"";display:block;height:var(--wp-ui-button-font-size);left:50%;opacity:0;pointer-events:none;position:absolute;top:50%;transform:translate(-50%,-50%);@media not (prefers-reduced-motion){transition:opacity .1s ease-out}@media (forced-colors:active){border-block-end-style:none;border-bottom-color:ButtonText;border-inline-start-style:none;border-left-color:ButtonText;border-right-color:ButtonText;border-top-color:ButtonText}}}._908205475f9f2a92__is-small{--wp-ui-button-padding-block:0px;--wp-ui-button-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-button-height:var(--wpds-dimension-size-sm,24px)}._9f6fc6553aeb36fe__icon{margin:var(--wp-ui-button-icon-margin)}.dd460c965226cc77__is-brand{&._62d5a778b7b258ee__is-outline,&.ad0619a3217c6a5b__is-minimal{--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-brand,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000));--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-brand-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline{--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);--wp-ui-button-border-color:var(--wpds-color-stroke-interactive-brand,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-border-color-active:var(--wpds-color-stroke-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 85%,#000));--wp-ui-button-border-color-disabled:var(--wpds-color-stroke-interactive-brand-disabled,#dbdbdb)}&.ad0619a3217c6a5b__is-minimal{--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-brand-weak-disabled,#0000)}}.e722a8f96726aa99__is-neutral{&.ad0619a3217c6a5b__is-minimal[aria-pressed=true],&.b50b3358c5fb4d0b__is-solid{--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-strong,#2d2d2d);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-strong-active,#1e1e1e);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-strong-disabled,#e6e6e6);--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-neutral-strong,#f0f0f0);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-neutral-strong-active,#f0f0f0);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-neutral-strong-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline,&.ad0619a3217c6a5b__is-minimal:not([aria-pressed=true]){--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline{--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-weak-disabled,#0000);--wp-ui-button-border-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d);--wp-ui-button-border-color-active:var(--wpds-color-stroke-interactive-neutral-active,#6e6e6e);--wp-ui-button-border-color-disabled:var(--wpds-color-stroke-interactive-neutral-disabled,#dbdbdb)}&.ad0619a3217c6a5b__is-minimal:not([aria-pressed=true]){--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-weak-disabled,#0000)}}.abbb272e2ce49bd6__is-unstyled{background:none;border:none;min-width:unset}.cf59cf1b69629838__is-compact{--wp-ui-button-height:var(--wpds-dimension-size-md,32px)}._914b42f315c0e580__is-loading:not(.abbb272e2ce49bd6__is-unstyled){color:transparent;&:not([data-disabled]):is(:hover,:active,:focus){color:transparent}@media (forced-colors:active){color:ButtonFace}*{opacity:0}&:before{opacity:1;transition-delay:.05s;@media not (prefers-reduced-motion){animation:_5a1d53da6f830c8d__loading-animation 1s linear infinite}}}}@keyframes _5a1d53da6f830c8d__loading-animation{0%{transform:translate(-50%,-50%) rotate(0deg)}to{transform:translate(-50%,-50%) rotate(1turn)}}}');
}
var style_default7 = { "button": "_97b0fc33c028be1a__button", "is-unstyled": "abbb272e2ce49bd6__is-unstyled", "is-loading": "_914b42f315c0e580__is-loading", "is-small": "_908205475f9f2a92__is-small", "icon": "_9f6fc6553aeb36fe__icon", "is-brand": "dd460c965226cc77__is-brand", "is-outline": "_62d5a778b7b258ee__is-outline", "is-minimal": "ad0619a3217c6a5b__is-minimal", "is-neutral": "e722a8f96726aa99__is-neutral", "is-solid": "b50b3358c5fb4d0b__is-solid", "is-compact": "cf59cf1b69629838__is-compact", "loading-animation": "_5a1d53da6f830c8d__loading-animation" };
if (typeof process === "undefined" || true) {
  registerStyle8("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}");
}
var resets_default3 = { "box-sizing": "_336cd3e4e743482f__box-sizing" };
if (typeof process === "undefined" || true) {
  registerStyle8("08122b3d53", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{.af79fb116edb0dd7__outset-ring--focus:focus,.dfcfdc28396e5d98__outset-ring--focus-visible:focus-visible,.e5cd9ee879f6403a__outset-ring--focus-within:focus-within,:focus-visible ._81935a08e952f267__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within,.abc777e9713fa711__outset-ring--focus-except-active:focus{outline:none}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.abc777e9713fa711__outset-ring--focus-except-active:focus:not(:active){--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}}");
}
var focus_module_default2 = { "outset-ring--focus": "af79fb116edb0dd7__outset-ring--focus", "outset-ring--focus-visible": "dfcfdc28396e5d98__outset-ring--focus-visible", "outset-ring--focus-within": "e5cd9ee879f6403a__outset-ring--focus-within", "outset-ring--focus-parent-visible": "_81935a08e952f267__outset-ring--focus-parent-visible", "outset-ring--focus-except-active": "abc777e9713fa711__outset-ring--focus-except-active", "outset-ring--focus-within-except-active": "_3c9f5ee9fc9c136d__outset-ring--focus-within-except-active" };
if (typeof process === "undefined" || true) {
  registerStyle8("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}");
}
var global_css_defense_default3 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" };
var Button3 = (0, import_element21.forwardRef)(
  function Button22({
    tone = "brand",
    variant = "solid",
    size: size4 = "default",
    className,
    focusableWhenDisabled = true,
    disabled: disabled2,
    loading,
    loadingAnnouncement = (0, import_i18n4.__)("Loading"),
    children,
    ...props
  }, ref) {
    const mergedClassName = clsx_default(
      global_css_defense_default3.button,
      resets_default3["box-sizing"],
      focus_module_default2["outset-ring--focus-except-active"],
      variant !== "unstyled" && style_default7.button,
      style_default7[`is-${tone}`],
      style_default7[`is-${variant}`],
      style_default7[`is-${size4}`],
      loading && style_default7["is-loading"],
      className
    );
    (0, import_element21.useEffect)(() => {
      if (loading && loadingAnnouncement) {
        speak(loadingAnnouncement);
      }
    }, [loading, loadingAnnouncement]);
    return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
      Button,
      {
        ref,
        className: mergedClassName,
        focusableWhenDisabled,
        disabled: disabled2 ?? loading,
        ...props,
        children
      }
    );
  }
);

// packages/ui/build-module/button/icon.mjs
var import_element22 = __toESM(require_element(), 1);
var import_jsx_runtime61 = __toESM(require_jsx_runtime(), 1);
var STYLE_HASH_ATTRIBUTE9 = "data-wp-hash";
function getRuntime9() {
  const globalScope = globalThis;
  if (globalScope.__wpStyleRuntime) {
    return globalScope.__wpStyleRuntime;
  }
  globalScope.__wpStyleRuntime = {
    documents: /* @__PURE__ */ new Map(),
    styles: /* @__PURE__ */ new Map(),
    injectedStyles: /* @__PURE__ */ new WeakMap()
  };
  if (typeof document !== "undefined") {
    registerDocument9(document);
  }
  return globalScope.__wpStyleRuntime;
}
function documentContainsStyleHash9(targetDocument, hash) {
  if (!targetDocument.head) {
    return false;
  }
  for (const style of targetDocument.head.querySelectorAll(
    `style[${STYLE_HASH_ATTRIBUTE9}]`
  )) {
    if (style.getAttribute(STYLE_HASH_ATTRIBUTE9) === hash) {
      return true;
    }
  }
  return false;
}
function injectStyle9(targetDocument, hash, css) {
  if (!targetDocument.head) {
    return;
  }
  const runtime = getRuntime9();
  let injectedStyles = runtime.injectedStyles.get(targetDocument);
  if (!injectedStyles) {
    injectedStyles = /* @__PURE__ */ new Set();
    runtime.injectedStyles.set(targetDocument, injectedStyles);
  }
  if (injectedStyles.has(hash)) {
    return;
  }
  if (documentContainsStyleHash9(targetDocument, hash)) {
    injectedStyles.add(hash);
    return;
  }
  const style = targetDocument.createElement("style");
  style.setAttribute(STYLE_HASH_ATTRIBUTE9, hash);
  style.appendChild(targetDocument.createTextNode(css));
  targetDocument.head.appendChild(style);
  injectedStyles.add(hash);
}
function registerDocument9(targetDocument) {
  const runtime = getRuntime9();
  runtime.documents.set(
    targetDocument,
    (runtime.documents.get(targetDocument) ?? 0) + 1
  );
  for (const [hash, css] of runtime.styles) {
    injectStyle9(targetDocument, hash, css);
  }
  return () => {
    const count = runtime.documents.get(targetDocument);
    if (count === void 0) {
      return;
    }
    if (count <= 1) {
      runtime.documents.delete(targetDocument);
      return;
    }
    runtime.documents.set(targetDocument, count - 1);
  };
}
function registerStyle9(hash, css) {
  const runtime = getRuntime9();
  runtime.styles.set(hash, css);
  for (const targetDocument of runtime.documents.keys()) {
    injectStyle9(targetDocument, hash, css);
  }
}
if (typeof process === "undefined" || true) {
  registerStyle9("effc4e3032", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._97b0fc33c028be1a__button,.abbb272e2ce49bd6__is-unstyled{appearance:none;padding:0}._97b0fc33c028be1a__button{--wp-ui-button-font-weight:var(--wpds-typography-font-weight-emphasis,600);--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-strong,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-brand-strong-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 93%,#000));--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-brand-strong-disabled,#e6e6e6);--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-brand-strong,#fff);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-brand-strong-active,#fff);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-brand-strong-disabled,#8d8d8d);--wp-ui-button-padding-block:var(--wpds-dimension-padding-xs,4px);--wp-ui-button-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-button-height:var(--wpds-dimension-size-lg,40px);--wp-ui-button-aspect-ratio:auto;--wp-ui-button-font-size:var(--wpds-typography-font-size-md,13px);--wp-ui-button-min-width:calc(4ch + var(--wp-ui-button-padding-inline)*2);--wp-ui-button-icon-margin:calc((var(--wpds-dimension-size-2xs, 16px) - var(--wpds-dimension-size-sm, 24px))/2);--wp-ui-button-border-color:var(--wp-ui-button-background-color);--wp-ui-button-border-color-active:var(--wp-ui-button-background-color-active);--wp-ui-button-border-color-disabled:var(--wp-ui-button-background-color-disabled);--_gcd-button-font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);--_gcd-button-font-size:var(--wp-ui-button-font-size);--_gcd-button-font-weight:var(--wp-ui-button-font-weight);align-items:center;aspect-ratio:var(--wp-ui-button-aspect-ratio);background-clip:border-box;background-color:var(--wp-ui-button-background-color);border-color:var(--wp-ui-button-border-color);border-radius:var(--wpds-border-radius-sm,2px);border-style:solid;border-width:1px;color:var(--wp-ui-button-foreground-color);display:inline-flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wp-ui-button-font-size);font-weight:var(--wp-ui-button-font-weight);gap:var(--wpds-dimension-gap-sm,8px);justify-content:center;line-height:var(--wpds-typography-line-height-sm,20px);max-width:100%;min-height:var(--wp-ui-button-height);min-width:var(--wp-ui-button-min-width);overflow-wrap:anywhere;padding-block:var(--wp-ui-button-padding-block);padding-inline:var(--wp-ui-button-padding-inline);position:relative;text-align:center;text-decoration:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}@media not (prefers-reduced-motion){transition:color .1s ease-out;*{transition:opacity .1s ease-out}}&[href]{cursor:pointer}[href]{color:inherit;text-decoration:inherit}&:not([data-disabled]):is(:hover,:active,:focus){background-color:var(--wp-ui-button-background-color-active);border-color:var(--wp-ui-button-border-color-active);color:var(--wp-ui-button-foreground-color-active)}&[data-disabled]:not(._914b42f315c0e580__is-loading){background-color:var(--wp-ui-button-background-color-disabled);border-color:var(--wp-ui-button-border-color-disabled);color:var(--wp-ui-button-foreground-color-disabled);@media (forced-colors:active){border-bottom-color:GrayText;border-left-color:GrayText;border-right-color:GrayText;border-top-color:GrayText;color:GrayText}}&:before{aspect-ratio:1;border:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid;border-block-end-color:transparent;border-block-start-color:var(--wp-ui-button-foreground-color);border-inline-end-color:var(--wp-ui-button-foreground-color);border-inline-start-color:transparent;border-radius:50%;box-sizing:border-box;content:"";display:block;height:var(--wp-ui-button-font-size);left:50%;opacity:0;pointer-events:none;position:absolute;top:50%;transform:translate(-50%,-50%);@media not (prefers-reduced-motion){transition:opacity .1s ease-out}@media (forced-colors:active){border-block-end-style:none;border-bottom-color:ButtonText;border-inline-start-style:none;border-left-color:ButtonText;border-right-color:ButtonText;border-top-color:ButtonText}}}._908205475f9f2a92__is-small{--wp-ui-button-padding-block:0px;--wp-ui-button-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-button-height:var(--wpds-dimension-size-sm,24px)}._9f6fc6553aeb36fe__icon{margin:var(--wp-ui-button-icon-margin)}.dd460c965226cc77__is-brand{&._62d5a778b7b258ee__is-outline,&.ad0619a3217c6a5b__is-minimal{--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-brand,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000));--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-brand-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline{--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);--wp-ui-button-border-color:var(--wpds-color-stroke-interactive-brand,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-border-color-active:var(--wpds-color-stroke-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 85%,#000));--wp-ui-button-border-color-disabled:var(--wpds-color-stroke-interactive-brand-disabled,#dbdbdb)}&.ad0619a3217c6a5b__is-minimal{--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-brand-weak-disabled,#0000)}}.e722a8f96726aa99__is-neutral{&.ad0619a3217c6a5b__is-minimal[aria-pressed=true],&.b50b3358c5fb4d0b__is-solid{--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-strong,#2d2d2d);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-strong-active,#1e1e1e);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-strong-disabled,#e6e6e6);--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-neutral-strong,#f0f0f0);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-neutral-strong-active,#f0f0f0);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-neutral-strong-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline,&.ad0619a3217c6a5b__is-minimal:not([aria-pressed=true]){--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline{--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-weak-disabled,#0000);--wp-ui-button-border-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d);--wp-ui-button-border-color-active:var(--wpds-color-stroke-interactive-neutral-active,#6e6e6e);--wp-ui-button-border-color-disabled:var(--wpds-color-stroke-interactive-neutral-disabled,#dbdbdb)}&.ad0619a3217c6a5b__is-minimal:not([aria-pressed=true]){--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-weak-disabled,#0000)}}.abbb272e2ce49bd6__is-unstyled{background:none;border:none;min-width:unset}.cf59cf1b69629838__is-compact{--wp-ui-button-height:var(--wpds-dimension-size-md,32px)}._914b42f315c0e580__is-loading:not(.abbb272e2ce49bd6__is-unstyled){color:transparent;&:not([data-disabled]):is(:hover,:active,:focus){color:transparent}@media (forced-colors:active){color:ButtonFace}*{opacity:0}&:before{opacity:1;transition-delay:.05s;@media not (prefers-reduced-motion){animation:_5a1d53da6f830c8d__loading-animation 1s linear infinite}}}}@keyframes _5a1d53da6f830c8d__loading-animation{0%{transform:translate(-50%,-50%) rotate(0deg)}to{transform:translate(-50%,-50%) rotate(1turn)}}}');
}
var style_default8 = { "button": "_97b0fc33c028be1a__button", "is-unstyled": "abbb272e2ce49bd6__is-unstyled", "is-loading": "_914b42f315c0e580__is-loading", "is-small": "_908205475f9f2a92__is-small", "icon": "_9f6fc6553aeb36fe__icon", "is-brand": "dd460c965226cc77__is-brand", "is-outline": "_62d5a778b7b258ee__is-outline", "is-minimal": "ad0619a3217c6a5b__is-minimal", "is-neutral": "e722a8f96726aa99__is-neutral", "is-solid": "b50b3358c5fb4d0b__is-solid", "is-compact": "cf59cf1b69629838__is-compact", "loading-animation": "_5a1d53da6f830c8d__loading-animation" };
var ButtonIcon = (0, import_element22.forwardRef)(
  function ButtonIcon2({ className, icon, ...props }, ref) {
    return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
      Icon,
      {
        ref,
        icon,
        className: clsx_default(style_default8.icon, className),
        size: 24,
        ...props
      }
    );
  }
);

// packages/ui/build-module/button/index.mjs
ButtonIcon.displayName = "Button.Icon";
var Button4 = Object.assign(Button3, {
  /**
   * An icon component specifically designed to work well when rendered inside
   * a `Button` component.
   */
  Icon: ButtonIcon
});

// node_modules/@date-fns/tz/tzName/index.js
function tzName(timeZone, date, format7 = "long") {
  return new Intl.DateTimeFormat("en-US", {
    // Enforces engine to render the time. Without the option JavaScriptCore omits it.
    hour: "numeric",
    timeZone,
    timeZoneName: format7
  }).format(date).split(/\s/g).slice(2).join(" ");
}

// node_modules/@date-fns/tz/tzOffset/index.js
var offsetFormatCache = {};
var offsetCache = {};
function tzOffset(timeZone, date) {
  try {
    const format7 = offsetFormatCache[timeZone] ||= new Intl.DateTimeFormat("en-US", {
      timeZone,
      timeZoneName: "longOffset"
    }).format;
    const offsetStr = format7(date).split("GMT")[1];
    if (offsetStr in offsetCache) return offsetCache[offsetStr];
    return calcOffset(offsetStr, offsetStr.split(":"));
  } catch {
    if (timeZone in offsetCache) return offsetCache[timeZone];
    const captures = timeZone?.match(offsetRe);
    if (captures) return calcOffset(timeZone, captures.slice(1));
    return NaN;
  }
}
var offsetRe = /([+-]\d\d):?(\d\d)?/;
function calcOffset(cacheStr, values) {
  const hours = +(values[0] || 0);
  const minutes = +(values[1] || 0);
  const seconds = +(values[2] || 0) / 60;
  return offsetCache[cacheStr] = hours * 60 + minutes > 0 ? hours * 60 + minutes + seconds : hours * 60 - minutes - seconds;
}

// node_modules/@date-fns/tz/date/mini.js
var TZDateMini = class _TZDateMini extends Date {
  //#region static
  constructor(...args) {
    super();
    if (args.length > 1 && typeof args[args.length - 1] === "string") {
      this.timeZone = args.pop();
    }
    this.internal = /* @__PURE__ */ new Date();
    if (isNaN(tzOffset(this.timeZone, this))) {
      this.setTime(NaN);
    } else {
      if (!args.length) {
        this.setTime(Date.now());
      } else if (typeof args[0] === "number" && (args.length === 1 || args.length === 2 && typeof args[1] !== "number")) {
        this.setTime(args[0]);
      } else if (typeof args[0] === "string") {
        this.setTime(+new Date(args[0]));
      } else if (args[0] instanceof Date) {
        this.setTime(+args[0]);
      } else {
        this.setTime(+new Date(...args));
        adjustToSystemTZ(this, args);
      }
    }
  }
  static tz(tz, ...args) {
    return args.length ? new _TZDateMini(...args, tz) : new _TZDateMini(Date.now(), tz);
  }
  //#endregion
  //#region time zone
  withTimeZone(timeZone) {
    return new _TZDateMini(+this, timeZone);
  }
  getTimezoneOffset() {
    const offset4 = -tzOffset(this.timeZone, this);
    return offset4 > 0 ? Math.floor(offset4) : Math.ceil(offset4);
  }
  //#endregion
  //#region time
  setTime(_time) {
    Date.prototype.setTime.apply(this, arguments);
    syncToInternal(this);
    return +this;
  }
  //#endregion
  //#region date-fns integration
  [/* @__PURE__ */ Symbol.for("constructDateFrom")](date) {
    return new _TZDateMini(+new Date(date), this.timeZone);
  }
  //#endregion
};
var re = /^(get|set)(?!UTC)/;
Object.getOwnPropertyNames(Date.prototype).forEach((method) => {
  if (!re.test(method)) return;
  const utcMethod = method.replace(re, "$1UTC");
  if (!TZDateMini.prototype[utcMethod]) return;
  if (method.startsWith("get")) {
    TZDateMini.prototype[method] = function() {
      return this.internal[utcMethod]();
    };
  } else {
    TZDateMini.prototype[method] = function() {
      Date.prototype[utcMethod].apply(this.internal, arguments);
      syncFromInternal(this);
      return +this;
    };
    TZDateMini.prototype[utcMethod] = function() {
      Date.prototype[utcMethod].apply(this, arguments);
      syncToInternal(this);
      return +this;
    };
  }
});
function syncToInternal(date) {
  date.internal.setTime(+date);
  date.internal.setUTCSeconds(date.internal.getUTCSeconds() - // Round after converting minutes to seconds to avoid fractional offset
  // precision errors from historical offsets.
  Math.round(-tzOffset(date.timeZone, date) * 60));
}
function syncFromInternal(date) {
  Date.prototype.setFullYear.call(date, date.internal.getUTCFullYear(), date.internal.getUTCMonth(), date.internal.getUTCDate());
  Date.prototype.setHours.call(date, date.internal.getUTCHours(), date.internal.getUTCMinutes(), date.internal.getUTCSeconds(), date.internal.getUTCMilliseconds());
  adjustToSystemTZ(date);
}
function adjustToSystemTZ(date, constructorArgs) {
  const expectedInternalTime = Array.isArray(constructorArgs) ? constructorArgsToInternalTime(constructorArgs) : +date.internal;
  const offsetWithSeconds = tzOffset(date.timeZone, date);
  const offset4 = offsetWithSeconds > 0 ? Math.floor(offsetWithSeconds) : Math.ceil(offsetWithSeconds);
  const prevHour = /* @__PURE__ */ new Date(+date);
  prevHour.setUTCHours(prevHour.getUTCHours() - 1);
  const systemOffset = -(/* @__PURE__ */ new Date(+date)).getTimezoneOffset();
  const prevHourSystemOffset = -(/* @__PURE__ */ new Date(+prevHour)).getTimezoneOffset();
  const systemDSTChange = systemOffset - prevHourSystemOffset;
  let systemOffsetForDiff = systemOffset;
  if (systemDSTChange && systemOffset !== offset4) {
    const systemHour = Date.prototype.getHours.apply(date);
    const expectedHour = Array.isArray(constructorArgs) ? constructorArgs[3] || 0 : date.internal.getUTCHours();
    if (systemHour !== expectedHour) {
      const testDate = /* @__PURE__ */ new Date(+date);
      const testOffsetDiff = systemOffset - offset4;
      if (testOffsetDiff) testDate.setUTCMinutes(testDate.getUTCMinutes() + testOffsetDiff);
      const testOffsetWithSeconds = tzOffset(date.timeZone, testDate);
      const testOffset = testOffsetWithSeconds > 0 ? Math.floor(testOffsetWithSeconds) : Math.ceil(testOffsetWithSeconds);
      if (testOffset === offset4) systemOffsetForDiff = prevHourSystemOffset;
    }
  }
  const offsetDiff = systemOffsetForDiff - offset4;
  if (offsetDiff)
    Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetDiff);
  const systemDate = /* @__PURE__ */ new Date(+date);
  systemDate.setUTCSeconds(0);
  const systemSecondsOffset = systemOffset > 0 ? systemDate.getSeconds() : (systemDate.getSeconds() - 60) % 60;
  const secondsOffset = Math.round(-(tzOffset(date.timeZone, date) * 60)) % 60;
  if (secondsOffset || systemSecondsOffset)
    Date.prototype.setUTCSeconds.call(date, Date.prototype.getUTCSeconds.call(date) + secondsOffset + systemSecondsOffset);
  const postOffsetWithSeconds = tzOffset(date.timeZone, date);
  const postOffset = postOffsetWithSeconds > 0 ? Math.floor(postOffsetWithSeconds) : Math.ceil(postOffsetWithSeconds);
  const postSystemOffset = -(/* @__PURE__ */ new Date(+date)).getTimezoneOffset();
  const postOffsetDiff = postSystemOffset - postOffset;
  const offsetChanged = postOffset !== offset4;
  const postDiff = postOffsetDiff - offsetDiff;
  const targetDSTShift = postOffset - offset4;
  const postOffsetCandidate = expectedInternalTime - postOffset * 60 * 1e3;
  const normalizedTargetDSTGap = targetDSTShift > 0 && targetInternalTime(date) - expectedInternalTime === targetDSTShift * 60 * 1e3 && targetInternalTime(date, postOffsetCandidate) !== expectedInternalTime;
  if (offsetChanged && postDiff && !normalizedTargetDSTGap) {
    Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + postDiff);
    const newOffsetWithSeconds = tzOffset(date.timeZone, date);
    const newOffset = newOffsetWithSeconds > 0 ? Math.floor(newOffsetWithSeconds) : Math.ceil(newOffsetWithSeconds);
    const offsetChange = postOffset - newOffset;
    if (offsetChange && postDiff < 0) {
      Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetChange);
    }
  }
  syncToInternal(date);
  const expectedTime = constructorArgs ? expectedInternalTime : expectedInternalTime + secondsOffset * 1e3;
  const drift = expectedTime - +date.internal;
  if (drift && Math.abs(drift) < 30 * 60 * 1e3) {
    Date.prototype.setTime.call(date, +date + drift);
    syncToInternal(date);
  }
}
function constructorArgsToInternalTime(args) {
  return Date.UTC(args[0], args.length > 1 ? args[1] : 0, args.length > 2 ? args[2] : 1, ...args.slice(3));
}
function targetInternalTime(date, time) {
  const internal = new Date(time ?? +date);
  internal.setUTCSeconds(internal.getUTCSeconds() - Math.round(-tzOffset(date.timeZone, internal) * 60));
  return +internal;
}

// node_modules/@date-fns/tz/date/index.js
var TZDate = class _TZDate extends TZDateMini {
  //#region static
  static tz(tz, ...args) {
    return args.length ? new _TZDate(...args, tz) : new _TZDate(Date.now(), tz);
  }
  //#endregion
  //#region representation
  toISOString() {
    const [sign, hours, minutes] = this.tzComponents();
    const tz = `${sign}${hours}:${minutes}`;
    return this.internal.toISOString().slice(0, -1) + tz;
  }
  toString() {
    return `${this.toDateString()} ${this.toTimeString()}`;
  }
  toDateString() {
    const [day, date, month, year] = this.internal.toUTCString().split(" ");
    return `${day?.slice(0, -1)} ${month} ${date} ${year}`;
  }
  toTimeString() {
    const time = this.internal.toUTCString().split(" ")[4];
    const [sign, hours, minutes] = this.tzComponents();
    return `${time} GMT${sign}${hours}${minutes} (${tzName(this.timeZone, this)})`;
  }
  toLocaleString(locales, options) {
    return Date.prototype.toLocaleString.call(this, locales, {
      ...options,
      timeZone: options?.timeZone || this.timeZone
    });
  }
  toLocaleDateString(locales, options) {
    return Date.prototype.toLocaleDateString.call(this, locales, {
      ...options,
      timeZone: options?.timeZone || this.timeZone
    });
  }
  toLocaleTimeString(locales, options) {
    return Date.prototype.toLocaleTimeString.call(this, locales, {
      ...options,
      timeZone: options?.timeZone || this.timeZone
    });
  }
  //#endregion
  //#region private
  tzComponents() {
    const offset4 = this.getTimezoneOffset();
    const sign = offset4 > 0 ? "-" : "+";
    const hours = String(Math.floor(Math.abs(offset4) / 60)).padStart(2, "0");
    const minutes = String(Math.abs(offset4) % 60).padStart(2, "0");
    return [sign, hours, minutes];
  }
  //#endregion
  withTimeZone(timeZone) {
    return new _TZDate(+this, timeZone);
  }
  //#region date-fns integration
  [/* @__PURE__ */ Symbol.for("constructDateFrom")](date) {
    return new _TZDate(+new Date(date), this.timeZone);
  }
  //#endregion
};

// node_modules/date-fns/constants.js
var daysInYear = 365.2425;
var maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1e3;
var minTime = -maxTime;
var millisecondsInWeek = 6048e5;
var millisecondsInDay = 864e5;
var millisecondsInMinute = 6e4;
var millisecondsInHour = 36e5;
var millisecondsInSecond = 1e3;
var secondsInHour = 3600;
var secondsInDay = secondsInHour * 24;
var secondsInWeek = secondsInDay * 7;
var secondsInYear = secondsInDay * daysInYear;
var secondsInMonth = secondsInYear / 12;
var secondsInQuarter = secondsInMonth * 3;
var constructFromSymbol = /* @__PURE__ */ Symbol.for("constructDateFrom");

// node_modules/date-fns/constructFrom.js
function constructFrom(date, value) {
  if (typeof date === "function") return date(value);
  if (date && typeof date === "object" && constructFromSymbol in date)
    return date[constructFromSymbol](value);
  if (date instanceof Date) return new date.constructor(value);
  return new Date(value);
}

// node_modules/date-fns/toDate.js
function toDate(argument, context) {
  return constructFrom(context || argument, argument);
}

// node_modules/date-fns/addDays.js
function addDays(date, amount, options) {
  const _date = toDate(date, options?.in);
  if (isNaN(amount)) return constructFrom(options?.in || date, NaN);
  if (!amount) return _date;
  _date.setDate(_date.getDate() + amount);
  return _date;
}

// node_modules/date-fns/addMonths.js
function addMonths(date, amount, options) {
  const _date = toDate(date, options?.in);
  if (isNaN(amount)) return constructFrom(options?.in || date, NaN);
  if (!amount) {
    return _date;
  }
  const dayOfMonth = _date.getDate();
  const endOfDesiredMonth = constructFrom(options?.in || date, _date.getTime());
  endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0);
  const daysInMonth = endOfDesiredMonth.getDate();
  if (dayOfMonth >= daysInMonth) {
    return endOfDesiredMonth;
  } else {
    _date.setFullYear(
      endOfDesiredMonth.getFullYear(),
      endOfDesiredMonth.getMonth(),
      dayOfMonth
    );
    return _date;
  }
}

// node_modules/date-fns/_lib/defaultOptions.js
var defaultOptions = {};
function getDefaultOptions() {
  return defaultOptions;
}

// node_modules/date-fns/startOfWeek.js
function startOfWeek(date, options) {
  const defaultOptions2 = getDefaultOptions();
  const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
  const _date = toDate(date, options?.in);
  const day = _date.getDay();
  const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
  _date.setDate(_date.getDate() - diff);
  _date.setHours(0, 0, 0, 0);
  return _date;
}

// node_modules/date-fns/startOfISOWeek.js
function startOfISOWeek(date, options) {
  return startOfWeek(date, { ...options, weekStartsOn: 1 });
}

// node_modules/date-fns/getISOWeekYear.js
function getISOWeekYear(date, options) {
  const _date = toDate(date, options?.in);
  const year = _date.getFullYear();
  const fourthOfJanuaryOfNextYear = constructFrom(_date, 0);
  fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
  fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
  const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);
  const fourthOfJanuaryOfThisYear = constructFrom(_date, 0);
  fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);
  fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);
  const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);
  if (_date.getTime() >= startOfNextYear.getTime()) {
    return year + 1;
  } else if (_date.getTime() >= startOfThisYear.getTime()) {
    return year;
  } else {
    return year - 1;
  }
}

// node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js
function getTimezoneOffsetInMilliseconds(date) {
  const _date = toDate(date);
  const utcDate = new Date(
    Date.UTC(
      _date.getFullYear(),
      _date.getMonth(),
      _date.getDate(),
      _date.getHours(),
      _date.getMinutes(),
      _date.getSeconds(),
      _date.getMilliseconds()
    )
  );
  utcDate.setUTCFullYear(_date.getFullYear());
  return +date - +utcDate;
}

// node_modules/date-fns/_lib/normalizeDates.js
function normalizeDates(context, ...dates) {
  const normalize2 = constructFrom.bind(
    null,
    context || dates.find((date) => typeof date === "object")
  );
  return dates.map(normalize2);
}

// node_modules/date-fns/startOfDay.js
function startOfDay(date, options) {
  const _date = toDate(date, options?.in);
  _date.setHours(0, 0, 0, 0);
  return _date;
}

// node_modules/date-fns/differenceInCalendarDays.js
function differenceInCalendarDays(laterDate, earlierDate, options) {
  const [laterDate_, earlierDate_] = normalizeDates(
    options?.in,
    laterDate,
    earlierDate
  );
  const laterStartOfDay = startOfDay(laterDate_);
  const earlierStartOfDay = startOfDay(earlierDate_);
  const laterTimestamp = +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay);
  const earlierTimestamp = +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay);
  return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay);
}

// node_modules/date-fns/startOfISOWeekYear.js
function startOfISOWeekYear(date, options) {
  const year = getISOWeekYear(date, options);
  const fourthOfJanuary = constructFrom(options?.in || date, 0);
  fourthOfJanuary.setFullYear(year, 0, 4);
  fourthOfJanuary.setHours(0, 0, 0, 0);
  return startOfISOWeek(fourthOfJanuary);
}

// node_modules/date-fns/addWeeks.js
function addWeeks(date, amount, options) {
  return addDays(date, amount * 7, options);
}

// node_modules/date-fns/addYears.js
function addYears(date, amount, options) {
  return addMonths(date, amount * 12, options);
}

// node_modules/date-fns/areIntervalsOverlapping.js
function areIntervalsOverlapping(intervalLeft, intervalRight, options) {
  const [leftStartTime, leftEndTime] = [
    +toDate(intervalLeft.start, options?.in),
    +toDate(intervalLeft.end, options?.in)
  ].sort((a, b) => a - b);
  const [rightStartTime, rightEndTime] = [
    +toDate(intervalRight.start, options?.in),
    +toDate(intervalRight.end, options?.in)
  ].sort((a, b) => a - b);
  if (options?.inclusive)
    return leftStartTime <= rightEndTime && rightStartTime <= leftEndTime;
  return leftStartTime < rightEndTime && rightStartTime < leftEndTime;
}

// node_modules/date-fns/max.js
function max2(dates, options) {
  let result;
  let context = options?.in;
  dates.forEach((date) => {
    if (!context && typeof date === "object")
      context = constructFrom.bind(null, date);
    const date_ = toDate(date, context);
    if (!result || result < date_ || isNaN(+date_)) result = date_;
  });
  return constructFrom(context, result || NaN);
}

// node_modules/date-fns/min.js
function min2(dates, options) {
  let result;
  let context = options?.in;
  dates.forEach((date) => {
    if (!context && typeof date === "object")
      context = constructFrom.bind(null, date);
    const date_ = toDate(date, context);
    if (!result || result > date_ || isNaN(+date_)) result = date_;
  });
  return constructFrom(context, result || NaN);
}

// node_modules/date-fns/isSameDay.js
function isSameDay(laterDate, earlierDate, options) {
  const [dateLeft_, dateRight_] = normalizeDates(
    options?.in,
    laterDate,
    earlierDate
  );
  return +startOfDay(dateLeft_) === +startOfDay(dateRight_);
}

// node_modules/date-fns/isDate.js
function isDate(value) {
  return value instanceof Date || typeof value === "object" && Object.prototype.toString.call(value) === "[object Date]";
}

// node_modules/date-fns/isValid.js
function isValid(date) {
  return !(!isDate(date) && typeof date !== "number" || isNaN(+toDate(date)));
}

// node_modules/date-fns/differenceInCalendarMonths.js
function differenceInCalendarMonths(laterDate, earlierDate, options) {
  const [laterDate_, earlierDate_] = normalizeDates(
    options?.in,
    laterDate,
    earlierDate
  );
  const yearsDiff = laterDate_.getFullYear() - earlierDate_.getFullYear();
  const monthsDiff = laterDate_.getMonth() - earlierDate_.getMonth();
  return yearsDiff * 12 + monthsDiff;
}

// node_modules/date-fns/endOfMonth.js
function endOfMonth(date, options) {
  const _date = toDate(date, options?.in);
  const month = _date.getMonth();
  _date.setFullYear(_date.getFullYear(), month + 1, 0);
  _date.setHours(23, 59, 59, 999);
  return _date;
}

// node_modules/date-fns/_lib/normalizeInterval.js
function normalizeInterval(context, interval) {
  const [start, end] = normalizeDates(context, interval.start, interval.end);
  return { start, end };
}

// node_modules/date-fns/eachMonthOfInterval.js
function eachMonthOfInterval(interval, options) {
  const { start, end } = normalizeInterval(options?.in, interval);
  let reversed = +start > +end;
  const endTime = reversed ? +start : +end;
  const date = reversed ? end : start;
  date.setHours(0, 0, 0, 0);
  date.setDate(1);
  let step = options?.step ?? 1;
  if (!step) return [];
  if (step < 0) {
    step = -step;
    reversed = !reversed;
  }
  const dates = [];
  while (+date <= endTime) {
    dates.push(constructFrom(start, date));
    date.setMonth(date.getMonth() + step);
  }
  return reversed ? dates.reverse() : dates;
}

// node_modules/date-fns/startOfMonth.js
function startOfMonth(date, options) {
  const _date = toDate(date, options?.in);
  _date.setDate(1);
  _date.setHours(0, 0, 0, 0);
  return _date;
}

// node_modules/date-fns/endOfYear.js
function endOfYear(date, options) {
  const _date = toDate(date, options?.in);
  const year = _date.getFullYear();
  _date.setFullYear(year + 1, 0, 0);
  _date.setHours(23, 59, 59, 999);
  return _date;
}

// node_modules/date-fns/startOfYear.js
function startOfYear(date, options) {
  const date_ = toDate(date, options?.in);
  date_.setFullYear(date_.getFullYear(), 0, 1);
  date_.setHours(0, 0, 0, 0);
  return date_;
}

// node_modules/date-fns/eachYearOfInterval.js
function eachYearOfInterval(interval, options) {
  const { start, end } = normalizeInterval(options?.in, interval);
  let reversed = +start > +end;
  const endTime = reversed ? +start : +end;
  const date = reversed ? end : start;
  date.setHours(0, 0, 0, 0);
  date.setMonth(0, 1);
  let step = options?.step ?? 1;
  if (!step) return [];
  if (step < 0) {
    step = -step;
    reversed = !reversed;
  }
  const dates = [];
  while (+date <= endTime) {
    dates.push(constructFrom(start, date));
    date.setFullYear(date.getFullYear() + step);
  }
  return reversed ? dates.reverse() : dates;
}

// node_modules/date-fns/endOfWeek.js
function endOfWeek(date, options) {
  const defaultOptions2 = getDefaultOptions();
  const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
  const _date = toDate(date, options?.in);
  const day = _date.getDay();
  const diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn);
  _date.setDate(_date.getDate() + diff);
  _date.setHours(23, 59, 59, 999);
  return _date;
}

// node_modules/date-fns/endOfISOWeek.js
function endOfISOWeek(date, options) {
  return endOfWeek(date, { ...options, weekStartsOn: 1 });
}

// node_modules/date-fns/locale/en-US/_lib/formatDistance.js
var formatDistanceLocale = {
  lessThanXSeconds: {
    one: "less than a second",
    other: "less than {{count}} seconds"
  },
  xSeconds: {
    one: "1 second",
    other: "{{count}} seconds"
  },
  halfAMinute: "half a minute",
  lessThanXMinutes: {
    one: "less than a minute",
    other: "less than {{count}} minutes"
  },
  xMinutes: {
    one: "1 minute",
    other: "{{count}} minutes"
  },
  aboutXHours: {
    one: "about 1 hour",
    other: "about {{count}} hours"
  },
  xHours: {
    one: "1 hour",
    other: "{{count}} hours"
  },
  xDays: {
    one: "1 day",
    other: "{{count}} days"
  },
  aboutXWeeks: {
    one: "about 1 week",
    other: "about {{count}} weeks"
  },
  xWeeks: {
    one: "1 week",
    other: "{{count}} weeks"
  },
  aboutXMonths: {
    one: "about 1 month",
    other: "about {{count}} months"
  },
  xMonths: {
    one: "1 month",
    other: "{{count}} months"
  },
  aboutXYears: {
    one: "about 1 year",
    other: "about {{count}} years"
  },
  xYears: {
    one: "1 year",
    other: "{{count}} years"
  },
  overXYears: {
    one: "over 1 year",
    other: "over {{count}} years"
  },
  almostXYears: {
    one: "almost 1 year",
    other: "almost {{count}} years"
  }
};
var formatDistance = (token, count, options) => {
  let result;
  const tokenValue = formatDistanceLocale[token];
  if (typeof tokenValue === "string") {
    result = tokenValue;
  } else if (count === 1) {
    result = tokenValue.one;
  } else {
    result = tokenValue.other.replace("{{count}}", count.toString());
  }
  if (options?.addSuffix) {
    if (options.comparison && options.comparison > 0) {
      return "in " + result;
    } else {
      return result + " ago";
    }
  }
  return result;
};

// node_modules/date-fns/locale/_lib/buildFormatLongFn.js
function buildFormatLongFn(args) {
  return (options = {}) => {
    const width = options.width ? String(options.width) : args.defaultWidth;
    const format7 = args.formats[width] || args.formats[args.defaultWidth];
    return format7;
  };
}

// node_modules/date-fns/locale/en-US/_lib/formatLong.js
var dateFormats = {
  full: "EEEE, MMMM do, y",
  long: "MMMM do, y",
  medium: "MMM d, y",
  short: "MM/dd/yyyy"
};
var timeFormats = {
  full: "h:mm:ss a zzzz",
  long: "h:mm:ss a z",
  medium: "h:mm:ss a",
  short: "h:mm a"
};
var dateTimeFormats = {
  full: "{{date}} 'at' {{time}}",
  long: "{{date}} 'at' {{time}}",
  medium: "{{date}}, {{time}}",
  short: "{{date}}, {{time}}"
};
var formatLong = {
  date: buildFormatLongFn({
    formats: dateFormats,
    defaultWidth: "full"
  }),
  time: buildFormatLongFn({
    formats: timeFormats,
    defaultWidth: "full"
  }),
  dateTime: buildFormatLongFn({
    formats: dateTimeFormats,
    defaultWidth: "full"
  })
};

// node_modules/date-fns/locale/en-US/_lib/formatRelative.js
var formatRelativeLocale = {
  lastWeek: "'last' eeee 'at' p",
  yesterday: "'yesterday at' p",
  today: "'today at' p",
  tomorrow: "'tomorrow at' p",
  nextWeek: "eeee 'at' p",
  other: "P"
};
var formatRelative = (token, _date, _baseDate, _options) => formatRelativeLocale[token];

// node_modules/date-fns/locale/_lib/buildLocalizeFn.js
function buildLocalizeFn(args) {
  return (value, options) => {
    const context = options?.context ? String(options.context) : "standalone";
    let valuesArray;
    if (context === "formatting" && args.formattingValues) {
      const defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
      const width = options?.width ? String(options.width) : defaultWidth;
      valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
    } else {
      const defaultWidth = args.defaultWidth;
      const width = options?.width ? String(options.width) : args.defaultWidth;
      valuesArray = args.values[width] || args.values[defaultWidth];
    }
    const index3 = args.argumentCallback ? args.argumentCallback(value) : value;
    return valuesArray[index3];
  };
}

// node_modules/date-fns/locale/en-US/_lib/localize.js
var eraValues = {
  narrow: ["B", "A"],
  abbreviated: ["BC", "AD"],
  wide: ["Before Christ", "Anno Domini"]
};
var quarterValues = {
  narrow: ["1", "2", "3", "4"],
  abbreviated: ["Q1", "Q2", "Q3", "Q4"],
  wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
};
var monthValues = {
  narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
  abbreviated: [
    "Jan",
    "Feb",
    "Mar",
    "Apr",
    "May",
    "Jun",
    "Jul",
    "Aug",
    "Sep",
    "Oct",
    "Nov",
    "Dec"
  ],
  wide: [
    "January",
    "February",
    "March",
    "April",
    "May",
    "June",
    "July",
    "August",
    "September",
    "October",
    "November",
    "December"
  ]
};
var dayValues = {
  narrow: ["S", "M", "T", "W", "T", "F", "S"],
  short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
  abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
  wide: [
    "Sunday",
    "Monday",
    "Tuesday",
    "Wednesday",
    "Thursday",
    "Friday",
    "Saturday"
  ]
};
var dayPeriodValues = {
  narrow: {
    am: "a",
    pm: "p",
    midnight: "mi",
    noon: "n",
    morning: "morning",
    afternoon: "afternoon",
    evening: "evening",
    night: "night"
  },
  abbreviated: {
    am: "AM",
    pm: "PM",
    midnight: "midnight",
    noon: "noon",
    morning: "morning",
    afternoon: "afternoon",
    evening: "evening",
    night: "night"
  },
  wide: {
    am: "a.m.",
    pm: "p.m.",
    midnight: "midnight",
    noon: "noon",
    morning: "morning",
    afternoon: "afternoon",
    evening: "evening",
    night: "night"
  }
};
var formattingDayPeriodValues = {
  narrow: {
    am: "a",
    pm: "p",
    midnight: "mi",
    noon: "n",
    morning: "in the morning",
    afternoon: "in the afternoon",
    evening: "in the evening",
    night: "at night"
  },
  abbreviated: {
    am: "AM",
    pm: "PM",
    midnight: "midnight",
    noon: "noon",
    morning: "in the morning",
    afternoon: "in the afternoon",
    evening: "in the evening",
    night: "at night"
  },
  wide: {
    am: "a.m.",
    pm: "p.m.",
    midnight: "midnight",
    noon: "noon",
    morning: "in the morning",
    afternoon: "in the afternoon",
    evening: "in the evening",
    night: "at night"
  }
};
var ordinalNumber = (dirtyNumber, _options) => {
  const number = Number(dirtyNumber);
  const rem100 = number % 100;
  if (rem100 > 20 || rem100 < 10) {
    switch (rem100 % 10) {
      case 1:
        return number + "st";
      case 2:
        return number + "nd";
      case 3:
        return number + "rd";
    }
  }
  return number + "th";
};
var localize = {
  ordinalNumber,
  era: buildLocalizeFn({
    values: eraValues,
    defaultWidth: "wide"
  }),
  quarter: buildLocalizeFn({
    values: quarterValues,
    defaultWidth: "wide",
    argumentCallback: (quarter) => quarter - 1
  }),
  month: buildLocalizeFn({
    values: monthValues,
    defaultWidth: "wide"
  }),
  day: buildLocalizeFn({
    values: dayValues,
    defaultWidth: "wide"
  }),
  dayPeriod: buildLocalizeFn({
    values: dayPeriodValues,
    defaultWidth: "wide",
    formattingValues: formattingDayPeriodValues,
    defaultFormattingWidth: "wide"
  })
};

// node_modules/date-fns/locale/_lib/buildMatchFn.js
function buildMatchFn(args) {
  return (string, options = {}) => {
    const width = options.width;
    const matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
    const matchResult = string.match(matchPattern);
    if (!matchResult) {
      return null;
    }
    const matchedString = matchResult[0];
    const parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
    const key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString)) : (
      // [TODO] -- I challenge you to fix the type
      findKey(parsePatterns, (pattern) => pattern.test(matchedString))
    );
    let value;
    value = args.valueCallback ? args.valueCallback(key) : key;
    value = options.valueCallback ? (
      // [TODO] -- I challenge you to fix the type
      options.valueCallback(value)
    ) : value;
    const rest = string.slice(matchedString.length);
    return { value, rest };
  };
}
function findKey(object, predicate) {
  for (const key in object) {
    if (Object.prototype.hasOwnProperty.call(object, key) && predicate(object[key])) {
      return key;
    }
  }
  return void 0;
}
function findIndex(array, predicate) {
  for (let key = 0; key < array.length; key++) {
    if (predicate(array[key])) {
      return key;
    }
  }
  return void 0;
}

// node_modules/date-fns/locale/_lib/buildMatchPatternFn.js
function buildMatchPatternFn(args) {
  return (string, options = {}) => {
    const matchResult = string.match(args.matchPattern);
    if (!matchResult) return null;
    const matchedString = matchResult[0];
    const parseResult = string.match(args.parsePattern);
    if (!parseResult) return null;
    let value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
    value = options.valueCallback ? options.valueCallback(value) : value;
    const rest = string.slice(matchedString.length);
    return { value, rest };
  };
}

// node_modules/date-fns/locale/en-US/_lib/match.js
var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
var parseOrdinalNumberPattern = /\d+/i;
var matchEraPatterns = {
  narrow: /^(b|a)/i,
  abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
  wide: /^(before christ|before common era|anno domini|common era)/i
};
var parseEraPatterns = {
  any: [/^b/i, /^(a|c)/i]
};
var matchQuarterPatterns = {
  narrow: /^[1234]/i,
  abbreviated: /^q[1234]/i,
  wide: /^[1234](th|st|nd|rd)? quarter/i
};
var parseQuarterPatterns = {
  any: [/1/i, /2/i, /3/i, /4/i]
};
var matchMonthPatterns = {
  narrow: /^[jfmasond]/i,
  abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
  wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
};
var parseMonthPatterns = {
  narrow: [
    /^j/i,
    /^f/i,
    /^m/i,
    /^a/i,
    /^m/i,
    /^j/i,
    /^j/i,
    /^a/i,
    /^s/i,
    /^o/i,
    /^n/i,
    /^d/i
  ],
  any: [
    /^ja/i,
    /^f/i,
    /^mar/i,
    /^ap/i,
    /^may/i,
    /^jun/i,
    /^jul/i,
    /^au/i,
    /^s/i,
    /^o/i,
    /^n/i,
    /^d/i
  ]
};
var matchDayPatterns = {
  narrow: /^[smtwf]/i,
  short: /^(su|mo|tu|we|th|fr|sa)/i,
  abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
  wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
};
var parseDayPatterns = {
  narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
  any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
};
var matchDayPeriodPatterns = {
  narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
  any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
};
var parseDayPeriodPatterns = {
  any: {
    am: /^a/i,
    pm: /^p/i,
    midnight: /^mi/i,
    noon: /^no/i,
    morning: /morning/i,
    afternoon: /afternoon/i,
    evening: /evening/i,
    night: /night/i
  }
};
var match = {
  ordinalNumber: buildMatchPatternFn({
    matchPattern: matchOrdinalNumberPattern,
    parsePattern: parseOrdinalNumberPattern,
    valueCallback: (value) => parseInt(value, 10)
  }),
  era: buildMatchFn({
    matchPatterns: matchEraPatterns,
    defaultMatchWidth: "wide",
    parsePatterns: parseEraPatterns,
    defaultParseWidth: "any"
  }),
  quarter: buildMatchFn({
    matchPatterns: matchQuarterPatterns,
    defaultMatchWidth: "wide",
    parsePatterns: parseQuarterPatterns,
    defaultParseWidth: "any",
    valueCallback: (index3) => index3 + 1
  }),
  month: buildMatchFn({
    matchPatterns: matchMonthPatterns,
    defaultMatchWidth: "wide",
    parsePatterns: parseMonthPatterns,
    defaultParseWidth: "any"
  }),
  day: buildMatchFn({
    matchPatterns: matchDayPatterns,
    defaultMatchWidth: "wide",
    parsePatterns: parseDayPatterns,
    defaultParseWidth: "any"
  }),
  dayPeriod: buildMatchFn({
    matchPatterns: matchDayPeriodPatterns,
    defaultMatchWidth: "any",
    parsePatterns: parseDayPeriodPatterns,
    defaultParseWidth: "any"
  })
};

// node_modules/date-fns/locale/en-US.js
var enUS = {
  code: "en-US",
  formatDistance,
  formatLong,
  formatRelative,
  localize,
  match,
  options: {
    weekStartsOn: 0,
    firstWeekContainsDate: 1
  }
};

// node_modules/date-fns/getDayOfYear.js
function getDayOfYear(date, options) {
  const _date = toDate(date, options?.in);
  const diff = differenceInCalendarDays(_date, startOfYear(_date));
  const dayOfYear = diff + 1;
  return dayOfYear;
}

// node_modules/date-fns/getISOWeek.js
function getISOWeek(date, options) {
  const _date = toDate(date, options?.in);
  const diff = +startOfISOWeek(_date) - +startOfISOWeekYear(_date);
  return Math.round(diff / millisecondsInWeek) + 1;
}

// node_modules/date-fns/getWeekYear.js
function getWeekYear(date, options) {
  const _date = toDate(date, options?.in);
  const year = _date.getFullYear();
  const defaultOptions2 = getDefaultOptions();
  const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
  const firstWeekOfNextYear = constructFrom(options?.in || date, 0);
  firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate);
  firstWeekOfNextYear.setHours(0, 0, 0, 0);
  const startOfNextYear = startOfWeek(firstWeekOfNextYear, options);
  const firstWeekOfThisYear = constructFrom(options?.in || date, 0);
  firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate);
  firstWeekOfThisYear.setHours(0, 0, 0, 0);
  const startOfThisYear = startOfWeek(firstWeekOfThisYear, options);
  if (+_date >= +startOfNextYear) {
    return year + 1;
  } else if (+_date >= +startOfThisYear) {
    return year;
  } else {
    return year - 1;
  }
}

// node_modules/date-fns/startOfWeekYear.js
function startOfWeekYear(date, options) {
  const defaultOptions2 = getDefaultOptions();
  const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
  const year = getWeekYear(date, options);
  const firstWeek = constructFrom(options?.in || date, 0);
  firstWeek.setFullYear(year, 0, firstWeekContainsDate);
  firstWeek.setHours(0, 0, 0, 0);
  const _date = startOfWeek(firstWeek, options);
  return _date;
}

// node_modules/date-fns/getWeek.js
function getWeek(date, options) {
  const _date = toDate(date, options?.in);
  const diff = +startOfWeek(_date, options) - +startOfWeekYear(_date, options);
  return Math.round(diff / millisecondsInWeek) + 1;
}

// node_modules/date-fns/_lib/addLeadingZeros.js
function addLeadingZeros(number, targetLength) {
  const sign = number < 0 ? "-" : "";
  const output = Math.abs(number).toString().padStart(targetLength, "0");
  return sign + output;
}

// node_modules/date-fns/_lib/format/lightFormatters.js
var lightFormatters = {
  // Year
  y(date, token) {
    const signedYear = date.getFullYear();
    const year = signedYear > 0 ? signedYear : 1 - signedYear;
    return addLeadingZeros(token === "yy" ? year % 100 : year, token.length);
  },
  // Month
  M(date, token) {
    const month = date.getMonth();
    return token === "M" ? String(month + 1) : addLeadingZeros(month + 1, 2);
  },
  // Day of the month
  d(date, token) {
    return addLeadingZeros(date.getDate(), token.length);
  },
  // AM or PM
  a(date, token) {
    const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? "pm" : "am";
    switch (token) {
      case "a":
      case "aa":
        return dayPeriodEnumValue.toUpperCase();
      case "aaa":
        return dayPeriodEnumValue;
      case "aaaaa":
        return dayPeriodEnumValue[0];
      case "aaaa":
      default:
        return dayPeriodEnumValue === "am" ? "a.m." : "p.m.";
    }
  },
  // Hour [1-12]
  h(date, token) {
    return addLeadingZeros(date.getHours() % 12 || 12, token.length);
  },
  // Hour [0-23]
  H(date, token) {
    return addLeadingZeros(date.getHours(), token.length);
  },
  // Minute
  m(date, token) {
    return addLeadingZeros(date.getMinutes(), token.length);
  },
  // Second
  s(date, token) {
    return addLeadingZeros(date.getSeconds(), token.length);
  },
  // Fraction of second
  S(date, token) {
    const numberOfDigits = token.length;
    const milliseconds = date.getMilliseconds();
    const fractionalSeconds = Math.trunc(
      milliseconds * Math.pow(10, numberOfDigits - 3)
    );
    return addLeadingZeros(fractionalSeconds, token.length);
  }
};

// node_modules/date-fns/_lib/format/formatters.js
var dayPeriodEnum = {
  am: "am",
  pm: "pm",
  midnight: "midnight",
  noon: "noon",
  morning: "morning",
  afternoon: "afternoon",
  evening: "evening",
  night: "night"
};
var formatters = {
  // Era
  G: function(date, token, localize2) {
    const era = date.getFullYear() > 0 ? 1 : 0;
    switch (token) {
      // AD, BC
      case "G":
      case "GG":
      case "GGG":
        return localize2.era(era, { width: "abbreviated" });
      // A, B
      case "GGGGG":
        return localize2.era(era, { width: "narrow" });
      // Anno Domini, Before Christ
      case "GGGG":
      default:
        return localize2.era(era, { width: "wide" });
    }
  },
  // Year
  y: function(date, token, localize2) {
    if (token === "yo") {
      const signedYear = date.getFullYear();
      const year = signedYear > 0 ? signedYear : 1 - signedYear;
      return localize2.ordinalNumber(year, { unit: "year" });
    }
    return lightFormatters.y(date, token);
  },
  // Local week-numbering year
  Y: function(date, token, localize2, options) {
    const signedWeekYear = getWeekYear(date, options);
    const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
    if (token === "YY") {
      const twoDigitYear = weekYear % 100;
      return addLeadingZeros(twoDigitYear, 2);
    }
    if (token === "Yo") {
      return localize2.ordinalNumber(weekYear, { unit: "year" });
    }
    return addLeadingZeros(weekYear, token.length);
  },
  // ISO week-numbering year
  R: function(date, token) {
    const isoWeekYear = getISOWeekYear(date);
    return addLeadingZeros(isoWeekYear, token.length);
  },
  // Extended year. This is a single number designating the year of this calendar system.
  // The main difference between `y` and `u` localizers are B.C. years:
  // | Year | `y` | `u` |
  // |------|-----|-----|
  // | AC 1 |   1 |   1 |
  // | BC 1 |   1 |   0 |
  // | BC 2 |   2 |  -1 |
  // Also `yy` always returns the last two digits of a year,
  // while `uu` pads single digit years to 2 characters and returns other years unchanged.
  u: function(date, token) {
    const year = date.getFullYear();
    return addLeadingZeros(year, token.length);
  },
  // Quarter
  Q: function(date, token, localize2) {
    const quarter = Math.ceil((date.getMonth() + 1) / 3);
    switch (token) {
      // 1, 2, 3, 4
      case "Q":
        return String(quarter);
      // 01, 02, 03, 04
      case "QQ":
        return addLeadingZeros(quarter, 2);
      // 1st, 2nd, 3rd, 4th
      case "Qo":
        return localize2.ordinalNumber(quarter, { unit: "quarter" });
      // Q1, Q2, Q3, Q4
      case "QQQ":
        return localize2.quarter(quarter, {
          width: "abbreviated",
          context: "formatting"
        });
      // 1, 2, 3, 4 (narrow quarter; could be not numerical)
      case "QQQQQ":
        return localize2.quarter(quarter, {
          width: "narrow",
          context: "formatting"
        });
      // 1st quarter, 2nd quarter, ...
      case "QQQQ":
      default:
        return localize2.quarter(quarter, {
          width: "wide",
          context: "formatting"
        });
    }
  },
  // Stand-alone quarter
  q: function(date, token, localize2) {
    const quarter = Math.ceil((date.getMonth() + 1) / 3);
    switch (token) {
      // 1, 2, 3, 4
      case "q":
        return String(quarter);
      // 01, 02, 03, 04
      case "qq":
        return addLeadingZeros(quarter, 2);
      // 1st, 2nd, 3rd, 4th
      case "qo":
        return localize2.ordinalNumber(quarter, { unit: "quarter" });
      // Q1, Q2, Q3, Q4
      case "qqq":
        return localize2.quarter(quarter, {
          width: "abbreviated",
          context: "standalone"
        });
      // 1, 2, 3, 4 (narrow quarter; could be not numerical)
      case "qqqqq":
        return localize2.quarter(quarter, {
          width: "narrow",
          context: "standalone"
        });
      // 1st quarter, 2nd quarter, ...
      case "qqqq":
      default:
        return localize2.quarter(quarter, {
          width: "wide",
          context: "standalone"
        });
    }
  },
  // Month
  M: function(date, token, localize2) {
    const month = date.getMonth();
    switch (token) {
      case "M":
      case "MM":
        return lightFormatters.M(date, token);
      // 1st, 2nd, ..., 12th
      case "Mo":
        return localize2.ordinalNumber(month + 1, { unit: "month" });
      // Jan, Feb, ..., Dec
      case "MMM":
        return localize2.month(month, {
          width: "abbreviated",
          context: "formatting"
        });
      // J, F, ..., D
      case "MMMMM":
        return localize2.month(month, {
          width: "narrow",
          context: "formatting"
        });
      // January, February, ..., December
      case "MMMM":
      default:
        return localize2.month(month, { width: "wide", context: "formatting" });
    }
  },
  // Stand-alone month
  L: function(date, token, localize2) {
    const month = date.getMonth();
    switch (token) {
      // 1, 2, ..., 12
      case "L":
        return String(month + 1);
      // 01, 02, ..., 12
      case "LL":
        return addLeadingZeros(month + 1, 2);
      // 1st, 2nd, ..., 12th
      case "Lo":
        return localize2.ordinalNumber(month + 1, { unit: "month" });
      // Jan, Feb, ..., Dec
      case "LLL":
        return localize2.month(month, {
          width: "abbreviated",
          context: "standalone"
        });
      // J, F, ..., D
      case "LLLLL":
        return localize2.month(month, {
          width: "narrow",
          context: "standalone"
        });
      // January, February, ..., December
      case "LLLL":
      default:
        return localize2.month(month, { width: "wide", context: "standalone" });
    }
  },
  // Local week of year
  w: function(date, token, localize2, options) {
    const week = getWeek(date, options);
    if (token === "wo") {
      return localize2.ordinalNumber(week, { unit: "week" });
    }
    return addLeadingZeros(week, token.length);
  },
  // ISO week of year
  I: function(date, token, localize2) {
    const isoWeek = getISOWeek(date);
    if (token === "Io") {
      return localize2.ordinalNumber(isoWeek, { unit: "week" });
    }
    return addLeadingZeros(isoWeek, token.length);
  },
  // Day of the month
  d: function(date, token, localize2) {
    if (token === "do") {
      return localize2.ordinalNumber(date.getDate(), { unit: "date" });
    }
    return lightFormatters.d(date, token);
  },
  // Day of year
  D: function(date, token, localize2) {
    const dayOfYear = getDayOfYear(date);
    if (token === "Do") {
      return localize2.ordinalNumber(dayOfYear, { unit: "dayOfYear" });
    }
    return addLeadingZeros(dayOfYear, token.length);
  },
  // Day of week
  E: function(date, token, localize2) {
    const dayOfWeek = date.getDay();
    switch (token) {
      // Tue
      case "E":
      case "EE":
      case "EEE":
        return localize2.day(dayOfWeek, {
          width: "abbreviated",
          context: "formatting"
        });
      // T
      case "EEEEE":
        return localize2.day(dayOfWeek, {
          width: "narrow",
          context: "formatting"
        });
      // Tu
      case "EEEEEE":
        return localize2.day(dayOfWeek, {
          width: "short",
          context: "formatting"
        });
      // Tuesday
      case "EEEE":
      default:
        return localize2.day(dayOfWeek, {
          width: "wide",
          context: "formatting"
        });
    }
  },
  // Local day of week
  e: function(date, token, localize2, options) {
    const dayOfWeek = date.getDay();
    const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
    switch (token) {
      // Numerical value (Nth day of week with current locale or weekStartsOn)
      case "e":
        return String(localDayOfWeek);
      // Padded numerical value
      case "ee":
        return addLeadingZeros(localDayOfWeek, 2);
      // 1st, 2nd, ..., 7th
      case "eo":
        return localize2.ordinalNumber(localDayOfWeek, { unit: "day" });
      case "eee":
        return localize2.day(dayOfWeek, {
          width: "abbreviated",
          context: "formatting"
        });
      // T
      case "eeeee":
        return localize2.day(dayOfWeek, {
          width: "narrow",
          context: "formatting"
        });
      // Tu
      case "eeeeee":
        return localize2.day(dayOfWeek, {
          width: "short",
          context: "formatting"
        });
      // Tuesday
      case "eeee":
      default:
        return localize2.day(dayOfWeek, {
          width: "wide",
          context: "formatting"
        });
    }
  },
  // Stand-alone local day of week
  c: function(date, token, localize2, options) {
    const dayOfWeek = date.getDay();
    const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
    switch (token) {
      // Numerical value (same as in `e`)
      case "c":
        return String(localDayOfWeek);
      // Padded numerical value
      case "cc":
        return addLeadingZeros(localDayOfWeek, token.length);
      // 1st, 2nd, ..., 7th
      case "co":
        return localize2.ordinalNumber(localDayOfWeek, { unit: "day" });
      case "ccc":
        return localize2.day(dayOfWeek, {
          width: "abbreviated",
          context: "standalone"
        });
      // T
      case "ccccc":
        return localize2.day(dayOfWeek, {
          width: "narrow",
          context: "standalone"
        });
      // Tu
      case "cccccc":
        return localize2.day(dayOfWeek, {
          width: "short",
          context: "standalone"
        });
      // Tuesday
      case "cccc":
      default:
        return localize2.day(dayOfWeek, {
          width: "wide",
          context: "standalone"
        });
    }
  },
  // ISO day of week
  i: function(date, token, localize2) {
    const dayOfWeek = date.getDay();
    const isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
    switch (token) {
      // 2
      case "i":
        return String(isoDayOfWeek);
      // 02
      case "ii":
        return addLeadingZeros(isoDayOfWeek, token.length);
      // 2nd
      case "io":
        return localize2.ordinalNumber(isoDayOfWeek, { unit: "day" });
      // Tue
      case "iii":
        return localize2.day(dayOfWeek, {
          width: "abbreviated",
          context: "formatting"
        });
      // T
      case "iiiii":
        return localize2.day(dayOfWeek, {
          width: "narrow",
          context: "formatting"
        });
      // Tu
      case "iiiiii":
        return localize2.day(dayOfWeek, {
          width: "short",
          context: "formatting"
        });
      // Tuesday
      case "iiii":
      default:
        return localize2.day(dayOfWeek, {
          width: "wide",
          context: "formatting"
        });
    }
  },
  // AM or PM
  a: function(date, token, localize2) {
    const hours = date.getHours();
    const dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
    switch (token) {
      case "a":
      case "aa":
        return localize2.dayPeriod(dayPeriodEnumValue, {
          width: "abbreviated",
          context: "formatting"
        });
      case "aaa":
        return localize2.dayPeriod(dayPeriodEnumValue, {
          width: "abbreviated",
          context: "formatting"
        }).toLowerCase();
      case "aaaaa":
        return localize2.dayPeriod(dayPeriodEnumValue, {
          width: "narrow",
          context: "formatting"
        });
      case "aaaa":
      default:
        return localize2.dayPeriod(dayPeriodEnumValue, {
          width: "wide",
          context: "formatting"
        });
    }
  },
  // AM, PM, midnight, noon
  b: function(date, token, localize2) {
    const hours = date.getHours();
    let dayPeriodEnumValue;
    if (hours === 12) {
      dayPeriodEnumValue = dayPeriodEnum.noon;
    } else if (hours === 0) {
      dayPeriodEnumValue = dayPeriodEnum.midnight;
    } else {
      dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
    }
    switch (token) {
      case "b":
      case "bb":
        return localize2.dayPeriod(dayPeriodEnumValue, {
          width: "abbreviated",
          context: "formatting"
        });
      case "bbb":
        return localize2.dayPeriod(dayPeriodEnumValue, {
          width: "abbreviated",
          context: "formatting"
        }).toLowerCase();
      case "bbbbb":
        return localize2.dayPeriod(dayPeriodEnumValue, {
          width: "narrow",
          context: "formatting"
        });
      case "bbbb":
      default:
        return localize2.dayPeriod(dayPeriodEnumValue, {
          width: "wide",
          context: "formatting"
        });
    }
  },
  // in the morning, in the afternoon, in the evening, at night
  B: function(date, token, localize2) {
    const hours = date.getHours();
    let dayPeriodEnumValue;
    if (hours >= 17) {
      dayPeriodEnumValue = dayPeriodEnum.evening;
    } else if (hours >= 12) {
      dayPeriodEnumValue = dayPeriodEnum.afternoon;
    } else if (hours >= 4) {
      dayPeriodEnumValue = dayPeriodEnum.morning;
    } else {
      dayPeriodEnumValue = dayPeriodEnum.night;
    }
    switch (token) {
      case "B":
      case "BB":
      case "BBB":
        return localize2.dayPeriod(dayPeriodEnumValue, {
          width: "abbreviated",
          context: "formatting"
        });
      case "BBBBB":
        return localize2.dayPeriod(dayPeriodEnumValue, {
          width: "narrow",
          context: "formatting"
        });
      case "BBBB":
      default:
        return localize2.dayPeriod(dayPeriodEnumValue, {
          width: "wide",
          context: "formatting"
        });
    }
  },
  // Hour [1-12]
  h: function(date, token, localize2) {
    if (token === "ho") {
      let hours = date.getHours() % 12;
      if (hours === 0) hours = 12;
      return localize2.ordinalNumber(hours, { unit: "hour" });
    }
    return lightFormatters.h(date, token);
  },
  // Hour [0-23]
  H: function(date, token, localize2) {
    if (token === "Ho") {
      return localize2.ordinalNumber(date.getHours(), { unit: "hour" });
    }
    return lightFormatters.H(date, token);
  },
  // Hour [0-11]
  K: function(date, token, localize2) {
    const hours = date.getHours() % 12;
    if (token === "Ko") {
      return localize2.ordinalNumber(hours, { unit: "hour" });
    }
    return addLeadingZeros(hours, token.length);
  },
  // Hour [1-24]
  k: function(date, token, localize2) {
    let hours = date.getHours();
    if (hours === 0) hours = 24;
    if (token === "ko") {
      return localize2.ordinalNumber(hours, { unit: "hour" });
    }
    return addLeadingZeros(hours, token.length);
  },
  // Minute
  m: function(date, token, localize2) {
    if (token === "mo") {
      return localize2.ordinalNumber(date.getMinutes(), { unit: "minute" });
    }
    return lightFormatters.m(date, token);
  },
  // Second
  s: function(date, token, localize2) {
    if (token === "so") {
      return localize2.ordinalNumber(date.getSeconds(), { unit: "second" });
    }
    return lightFormatters.s(date, token);
  },
  // Fraction of second
  S: function(date, token) {
    return lightFormatters.S(date, token);
  },
  // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
  X: function(date, token, _localize) {
    const timezoneOffset = date.getTimezoneOffset();
    if (timezoneOffset === 0) {
      return "Z";
    }
    switch (token) {
      // Hours and optional minutes
      case "X":
        return formatTimezoneWithOptionalMinutes(timezoneOffset);
      // Hours, minutes and optional seconds without `:` delimiter
      // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
      // so this token always has the same output as `XX`
      case "XXXX":
      case "XX":
        return formatTimezone(timezoneOffset);
      // Hours, minutes and optional seconds with `:` delimiter
      // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
      // so this token always has the same output as `XXX`
      case "XXXXX":
      case "XXX":
      // Hours and minutes with `:` delimiter
      default:
        return formatTimezone(timezoneOffset, ":");
    }
  },
  // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
  x: function(date, token, _localize) {
    const timezoneOffset = date.getTimezoneOffset();
    switch (token) {
      // Hours and optional minutes
      case "x":
        return formatTimezoneWithOptionalMinutes(timezoneOffset);
      // Hours, minutes and optional seconds without `:` delimiter
      // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
      // so this token always has the same output as `xx`
      case "xxxx":
      case "xx":
        return formatTimezone(timezoneOffset);
      // Hours, minutes and optional seconds with `:` delimiter
      // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
      // so this token always has the same output as `xxx`
      case "xxxxx":
      case "xxx":
      // Hours and minutes with `:` delimiter
      default:
        return formatTimezone(timezoneOffset, ":");
    }
  },
  // Timezone (GMT)
  O: function(date, token, _localize) {
    const timezoneOffset = date.getTimezoneOffset();
    switch (token) {
      // Short
      case "O":
      case "OO":
      case "OOO":
        return "GMT" + formatTimezoneShort(timezoneOffset, ":");
      // Long
      case "OOOO":
      default:
        return "GMT" + formatTimezone(timezoneOffset, ":");
    }
  },
  // Timezone (specific non-location)
  z: function(date, token, _localize) {
    const timezoneOffset = date.getTimezoneOffset();
    switch (token) {
      // Short
      case "z":
      case "zz":
      case "zzz":
        return "GMT" + formatTimezoneShort(timezoneOffset, ":");
      // Long
      case "zzzz":
      default:
        return "GMT" + formatTimezone(timezoneOffset, ":");
    }
  },
  // Seconds timestamp
  t: function(date, token, _localize) {
    const timestamp = Math.trunc(+date / 1e3);
    return addLeadingZeros(timestamp, token.length);
  },
  // Milliseconds timestamp
  T: function(date, token, _localize) {
    return addLeadingZeros(+date, token.length);
  }
};
function formatTimezoneShort(offset4, delimiter = "") {
  const sign = offset4 > 0 ? "-" : "+";
  const absOffset = Math.abs(offset4);
  const hours = Math.trunc(absOffset / 60);
  const minutes = absOffset % 60;
  if (minutes === 0) {
    return sign + String(hours);
  }
  return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
}
function formatTimezoneWithOptionalMinutes(offset4, delimiter) {
  if (offset4 % 60 === 0) {
    const sign = offset4 > 0 ? "-" : "+";
    return sign + addLeadingZeros(Math.abs(offset4) / 60, 2);
  }
  return formatTimezone(offset4, delimiter);
}
function formatTimezone(offset4, delimiter = "") {
  const sign = offset4 > 0 ? "-" : "+";
  const absOffset = Math.abs(offset4);
  const hours = addLeadingZeros(Math.trunc(absOffset / 60), 2);
  const minutes = addLeadingZeros(absOffset % 60, 2);
  return sign + hours + delimiter + minutes;
}

// node_modules/date-fns/_lib/format/longFormatters.js
var dateLongFormatter = (pattern, formatLong2) => {
  switch (pattern) {
    case "P":
      return formatLong2.date({ width: "short" });
    case "PP":
      return formatLong2.date({ width: "medium" });
    case "PPP":
      return formatLong2.date({ width: "long" });
    case "PPPP":
    default:
      return formatLong2.date({ width: "full" });
  }
};
var timeLongFormatter = (pattern, formatLong2) => {
  switch (pattern) {
    case "p":
      return formatLong2.time({ width: "short" });
    case "pp":
      return formatLong2.time({ width: "medium" });
    case "ppp":
      return formatLong2.time({ width: "long" });
    case "pppp":
    default:
      return formatLong2.time({ width: "full" });
  }
};
var dateTimeLongFormatter = (pattern, formatLong2) => {
  const matchResult = pattern.match(/(P+)(p+)?/) || [];
  const datePattern = matchResult[1];
  const timePattern = matchResult[2];
  if (!timePattern) {
    return dateLongFormatter(pattern, formatLong2);
  }
  let dateTimeFormat;
  switch (datePattern) {
    case "P":
      dateTimeFormat = formatLong2.dateTime({ width: "short" });
      break;
    case "PP":
      dateTimeFormat = formatLong2.dateTime({ width: "medium" });
      break;
    case "PPP":
      dateTimeFormat = formatLong2.dateTime({ width: "long" });
      break;
    case "PPPP":
    default:
      dateTimeFormat = formatLong2.dateTime({ width: "full" });
      break;
  }
  return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong2)).replace("{{time}}", timeLongFormatter(timePattern, formatLong2));
};
var longFormatters = {
  p: timeLongFormatter,
  P: dateTimeLongFormatter
};

// node_modules/date-fns/_lib/protectedTokens.js
var dayOfYearTokenRE = /^D+$/;
var weekYearTokenRE = /^Y+$/;
var throwTokens = ["D", "DD", "YY", "YYYY"];
function isProtectedDayOfYearToken(token) {
  return dayOfYearTokenRE.test(token);
}
function isProtectedWeekYearToken(token) {
  return weekYearTokenRE.test(token);
}
function warnOrThrowProtectedError(token, format7, input) {
  const _message = message(token, format7, input);
  console.warn(_message);
  if (throwTokens.includes(token)) throw new RangeError(_message);
}
function message(token, format7, input) {
  const subject = token[0] === "Y" ? "years" : "days of the month";
  return `Use \`${token.toLowerCase()}\` instead of \`${token}\` (in \`${format7}\`) for formatting ${subject} to the input \`${input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
}

// node_modules/date-fns/format.js
var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
var escapedStringRegExp = /^'([^]*?)'?$/;
var doubleQuoteRegExp = /''/g;
var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
function format(date, formatStr, options) {
  const defaultOptions2 = getDefaultOptions();
  const locale = options?.locale ?? defaultOptions2.locale ?? enUS;
  const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
  const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
  const originalDate = toDate(date, options?.in);
  if (!isValid(originalDate)) {
    throw new RangeError("Invalid time value");
  }
  let parts = formatStr.match(longFormattingTokensRegExp).map((substring) => {
    const firstCharacter = substring[0];
    if (firstCharacter === "p" || firstCharacter === "P") {
      const longFormatter = longFormatters[firstCharacter];
      return longFormatter(substring, locale.formatLong);
    }
    return substring;
  }).join("").match(formattingTokensRegExp).map((substring) => {
    if (substring === "''") {
      return { isToken: false, value: "'" };
    }
    const firstCharacter = substring[0];
    if (firstCharacter === "'") {
      return { isToken: false, value: cleanEscapedString(substring) };
    }
    if (formatters[firstCharacter]) {
      return { isToken: true, value: substring };
    }
    if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
      throw new RangeError(
        "Format string contains an unescaped latin alphabet character `" + firstCharacter + "`"
      );
    }
    return { isToken: false, value: substring };
  });
  if (locale.localize.preprocessor) {
    parts = locale.localize.preprocessor(originalDate, parts);
  }
  const formatterOptions = {
    firstWeekContainsDate,
    weekStartsOn,
    locale
  };
  return parts.map((part) => {
    if (!part.isToken) return part.value;
    const token = part.value;
    if (!options?.useAdditionalWeekYearTokens && isProtectedWeekYearToken(token) || !options?.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(token)) {
      warnOrThrowProtectedError(token, formatStr, String(date));
    }
    const formatter = formatters[token[0]];
    return formatter(originalDate, token, locale.localize, formatterOptions);
  }).join("");
}
function cleanEscapedString(input) {
  const matched = input.match(escapedStringRegExp);
  if (!matched) {
    return input;
  }
  return matched[1].replace(doubleQuoteRegExp, "'");
}

// node_modules/date-fns/getDaysInMonth.js
function getDaysInMonth(date, options) {
  const _date = toDate(date, options?.in);
  const year = _date.getFullYear();
  const monthIndex = _date.getMonth();
  const lastDayOfMonth = constructFrom(_date, 0);
  lastDayOfMonth.setFullYear(year, monthIndex + 1, 0);
  lastDayOfMonth.setHours(0, 0, 0, 0);
  return lastDayOfMonth.getDate();
}

// node_modules/date-fns/getDefaultOptions.js
function getDefaultOptions2() {
  return Object.assign({}, getDefaultOptions());
}

// node_modules/date-fns/getISODay.js
function getISODay(date, options) {
  const day = toDate(date, options?.in).getDay();
  return day === 0 ? 7 : day;
}

// node_modules/date-fns/getMonth.js
function getMonth(date, options) {
  return toDate(date, options?.in).getMonth();
}

// node_modules/date-fns/getYear.js
function getYear(date, options) {
  return toDate(date, options?.in).getFullYear();
}

// node_modules/date-fns/isAfter.js
function isAfter(date, dateToCompare) {
  return +toDate(date) > +toDate(dateToCompare);
}

// node_modules/date-fns/isBefore.js
function isBefore(date, dateToCompare) {
  return +toDate(date) < +toDate(dateToCompare);
}

// node_modules/date-fns/transpose.js
function transpose(date, constructor) {
  const date_ = isConstructor(constructor) ? new constructor(0) : constructFrom(constructor, 0);
  date_.setFullYear(date.getFullYear(), date.getMonth(), date.getDate());
  date_.setHours(
    date.getHours(),
    date.getMinutes(),
    date.getSeconds(),
    date.getMilliseconds()
  );
  return date_;
}
function isConstructor(constructor) {
  return typeof constructor === "function" && constructor.prototype?.constructor === constructor;
}

// node_modules/date-fns/parse/_lib/Setter.js
var TIMEZONE_UNIT_PRIORITY = 10;
var Setter = class {
  subPriority = 0;
  validate(_utcDate, _options) {
    return true;
  }
};
var ValueSetter = class extends Setter {
  constructor(value, validateValue, setValue, priority, subPriority) {
    super();
    this.value = value;
    this.validateValue = validateValue;
    this.setValue = setValue;
    this.priority = priority;
    if (subPriority) {
      this.subPriority = subPriority;
    }
  }
  validate(date, options) {
    return this.validateValue(date, this.value, options);
  }
  set(date, flags, options) {
    return this.setValue(date, flags, this.value, options);
  }
};
var DateTimezoneSetter = class extends Setter {
  priority = TIMEZONE_UNIT_PRIORITY;
  subPriority = -1;
  constructor(context, reference) {
    super();
    this.context = context || ((date) => constructFrom(reference, date));
  }
  set(date, flags) {
    if (flags.timestampIsSet) return date;
    return constructFrom(date, transpose(date, this.context));
  }
};

// node_modules/date-fns/parse/_lib/Parser.js
var Parser = class {
  run(dateString, token, match2, options) {
    const result = this.parse(dateString, token, match2, options);
    if (!result) {
      return null;
    }
    return {
      setter: new ValueSetter(
        result.value,
        this.validate,
        this.set,
        this.priority,
        this.subPriority
      ),
      rest: result.rest
    };
  }
  validate(_utcDate, _value, _options) {
    return true;
  }
};

// node_modules/date-fns/parse/_lib/parsers/EraParser.js
var EraParser = class extends Parser {
  priority = 140;
  parse(dateString, token, match2) {
    switch (token) {
      // AD, BC
      case "G":
      case "GG":
      case "GGG":
        return match2.era(dateString, { width: "abbreviated" }) || match2.era(dateString, { width: "narrow" });
      // A, B
      case "GGGGG":
        return match2.era(dateString, { width: "narrow" });
      // Anno Domini, Before Christ
      case "GGGG":
      default:
        return match2.era(dateString, { width: "wide" }) || match2.era(dateString, { width: "abbreviated" }) || match2.era(dateString, { width: "narrow" });
    }
  }
  set(date, flags, value) {
    flags.era = value;
    date.setFullYear(value, 0, 1);
    date.setHours(0, 0, 0, 0);
    return date;
  }
  incompatibleTokens = ["R", "u", "t", "T"];
};

// node_modules/date-fns/parse/_lib/constants.js
var numericPatterns = {
  month: /^(1[0-2]|0?\d)/,
  // 0 to 12
  date: /^(3[0-1]|[0-2]?\d)/,
  // 0 to 31
  dayOfYear: /^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,
  // 0 to 366
  week: /^(5[0-3]|[0-4]?\d)/,
  // 0 to 53
  hour23h: /^(2[0-3]|[0-1]?\d)/,
  // 0 to 23
  hour24h: /^(2[0-4]|[0-1]?\d)/,
  // 0 to 24
  hour11h: /^(1[0-1]|0?\d)/,
  // 0 to 11
  hour12h: /^(1[0-2]|0?\d)/,
  // 0 to 12
  minute: /^[0-5]?\d/,
  // 0 to 59
  second: /^[0-5]?\d/,
  // 0 to 59
  singleDigit: /^\d/,
  // 0 to 9
  twoDigits: /^\d{1,2}/,
  // 0 to 99
  threeDigits: /^\d{1,3}/,
  // 0 to 999
  fourDigits: /^\d{1,4}/,
  // 0 to 9999
  anyDigitsSigned: /^-?\d+/,
  singleDigitSigned: /^-?\d/,
  // 0 to 9, -0 to -9
  twoDigitsSigned: /^-?\d{1,2}/,
  // 0 to 99, -0 to -99
  threeDigitsSigned: /^-?\d{1,3}/,
  // 0 to 999, -0 to -999
  fourDigitsSigned: /^-?\d{1,4}/
  // 0 to 9999, -0 to -9999
};
var timezonePatterns = {
  basicOptionalMinutes: /^([+-])(\d{2})(\d{2})?|Z/,
  basic: /^([+-])(\d{2})(\d{2})|Z/,
  basicOptionalSeconds: /^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,
  extended: /^([+-])(\d{2}):(\d{2})|Z/,
  extendedOptionalSeconds: /^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/
};

// node_modules/date-fns/parse/_lib/utils.js
function mapValue(parseFnResult, mapFn) {
  if (!parseFnResult) {
    return parseFnResult;
  }
  return {
    value: mapFn(parseFnResult.value),
    rest: parseFnResult.rest
  };
}
function parseNumericPattern(pattern, dateString) {
  const matchResult = dateString.match(pattern);
  if (!matchResult) {
    return null;
  }
  return {
    value: parseInt(matchResult[0], 10),
    rest: dateString.slice(matchResult[0].length)
  };
}
function parseTimezonePattern(pattern, dateString) {
  const matchResult = dateString.match(pattern);
  if (!matchResult) {
    return null;
  }
  if (matchResult[0] === "Z") {
    return {
      value: 0,
      rest: dateString.slice(1)
    };
  }
  const sign = matchResult[1] === "+" ? 1 : -1;
  const hours = matchResult[2] ? parseInt(matchResult[2], 10) : 0;
  const minutes = matchResult[3] ? parseInt(matchResult[3], 10) : 0;
  const seconds = matchResult[5] ? parseInt(matchResult[5], 10) : 0;
  return {
    value: sign * (hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * millisecondsInSecond),
    rest: dateString.slice(matchResult[0].length)
  };
}
function parseAnyDigitsSigned(dateString) {
  return parseNumericPattern(numericPatterns.anyDigitsSigned, dateString);
}
function parseNDigits(n, dateString) {
  switch (n) {
    case 1:
      return parseNumericPattern(numericPatterns.singleDigit, dateString);
    case 2:
      return parseNumericPattern(numericPatterns.twoDigits, dateString);
    case 3:
      return parseNumericPattern(numericPatterns.threeDigits, dateString);
    case 4:
      return parseNumericPattern(numericPatterns.fourDigits, dateString);
    default:
      return parseNumericPattern(new RegExp("^\\d{1," + n + "}"), dateString);
  }
}
function parseNDigitsSigned(n, dateString) {
  switch (n) {
    case 1:
      return parseNumericPattern(numericPatterns.singleDigitSigned, dateString);
    case 2:
      return parseNumericPattern(numericPatterns.twoDigitsSigned, dateString);
    case 3:
      return parseNumericPattern(numericPatterns.threeDigitsSigned, dateString);
    case 4:
      return parseNumericPattern(numericPatterns.fourDigitsSigned, dateString);
    default:
      return parseNumericPattern(new RegExp("^-?\\d{1," + n + "}"), dateString);
  }
}
function dayPeriodEnumToHours(dayPeriod) {
  switch (dayPeriod) {
    case "morning":
      return 4;
    case "evening":
      return 17;
    case "pm":
    case "noon":
    case "afternoon":
      return 12;
    case "am":
    case "midnight":
    case "night":
    default:
      return 0;
  }
}
function normalizeTwoDigitYear(twoDigitYear, currentYear) {
  const isCommonEra = currentYear > 0;
  const absCurrentYear = isCommonEra ? currentYear : 1 - currentYear;
  let result;
  if (absCurrentYear <= 50) {
    result = twoDigitYear || 100;
  } else {
    const rangeEnd = absCurrentYear + 50;
    const rangeEndCentury = Math.trunc(rangeEnd / 100) * 100;
    const isPreviousCentury = twoDigitYear >= rangeEnd % 100;
    result = twoDigitYear + rangeEndCentury - (isPreviousCentury ? 100 : 0);
  }
  return isCommonEra ? result : 1 - result;
}
function isLeapYearIndex(year) {
  return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
}

// node_modules/date-fns/parse/_lib/parsers/YearParser.js
var YearParser = class extends Parser {
  priority = 130;
  incompatibleTokens = ["Y", "R", "u", "w", "I", "i", "e", "c", "t", "T"];
  parse(dateString, token, match2) {
    const valueCallback = (year) => ({
      year,
      isTwoDigitYear: token === "yy"
    });
    switch (token) {
      case "y":
        return mapValue(parseNDigits(4, dateString), valueCallback);
      case "yo":
        return mapValue(
          match2.ordinalNumber(dateString, {
            unit: "year"
          }),
          valueCallback
        );
      default:
        return mapValue(parseNDigits(token.length, dateString), valueCallback);
    }
  }
  validate(_date, value) {
    return value.isTwoDigitYear || value.year > 0;
  }
  set(date, flags, value) {
    const currentYear = date.getFullYear();
    if (value.isTwoDigitYear) {
      const normalizedTwoDigitYear = normalizeTwoDigitYear(
        value.year,
        currentYear
      );
      date.setFullYear(normalizedTwoDigitYear, 0, 1);
      date.setHours(0, 0, 0, 0);
      return date;
    }
    const year = !("era" in flags) || flags.era === 1 ? value.year : 1 - value.year;
    date.setFullYear(year, 0, 1);
    date.setHours(0, 0, 0, 0);
    return date;
  }
};

// node_modules/date-fns/parse/_lib/parsers/LocalWeekYearParser.js
var LocalWeekYearParser = class extends Parser {
  priority = 130;
  parse(dateString, token, match2) {
    const valueCallback = (year) => ({
      year,
      isTwoDigitYear: token === "YY"
    });
    switch (token) {
      case "Y":
        return mapValue(parseNDigits(4, dateString), valueCallback);
      case "Yo":
        return mapValue(
          match2.ordinalNumber(dateString, {
            unit: "year"
          }),
          valueCallback
        );
      default:
        return mapValue(parseNDigits(token.length, dateString), valueCallback);
    }
  }
  validate(_date, value) {
    return value.isTwoDigitYear || value.year > 0;
  }
  set(date, flags, value, options) {
    const currentYear = getWeekYear(date, options);
    if (value.isTwoDigitYear) {
      const normalizedTwoDigitYear = normalizeTwoDigitYear(
        value.year,
        currentYear
      );
      date.setFullYear(
        normalizedTwoDigitYear,
        0,
        options.firstWeekContainsDate
      );
      date.setHours(0, 0, 0, 0);
      return startOfWeek(date, options);
    }
    const year = !("era" in flags) || flags.era === 1 ? value.year : 1 - value.year;
    date.setFullYear(year, 0, options.firstWeekContainsDate);
    date.setHours(0, 0, 0, 0);
    return startOfWeek(date, options);
  }
  incompatibleTokens = [
    "y",
    "R",
    "u",
    "Q",
    "q",
    "M",
    "L",
    "I",
    "d",
    "D",
    "i",
    "t",
    "T"
  ];
};

// node_modules/date-fns/parse/_lib/parsers/ISOWeekYearParser.js
var ISOWeekYearParser = class extends Parser {
  priority = 130;
  parse(dateString, token) {
    if (token === "R") {
      return parseNDigitsSigned(4, dateString);
    }
    return parseNDigitsSigned(token.length, dateString);
  }
  set(date, _flags, value) {
    const firstWeekOfYear = constructFrom(date, 0);
    firstWeekOfYear.setFullYear(value, 0, 4);
    firstWeekOfYear.setHours(0, 0, 0, 0);
    return startOfISOWeek(firstWeekOfYear);
  }
  incompatibleTokens = [
    "G",
    "y",
    "Y",
    "u",
    "Q",
    "q",
    "M",
    "L",
    "w",
    "d",
    "D",
    "e",
    "c",
    "t",
    "T"
  ];
};

// node_modules/date-fns/parse/_lib/parsers/ExtendedYearParser.js
var ExtendedYearParser = class extends Parser {
  priority = 130;
  parse(dateString, token) {
    if (token === "u") {
      return parseNDigitsSigned(4, dateString);
    }
    return parseNDigitsSigned(token.length, dateString);
  }
  set(date, _flags, value) {
    date.setFullYear(value, 0, 1);
    date.setHours(0, 0, 0, 0);
    return date;
  }
  incompatibleTokens = ["G", "y", "Y", "R", "w", "I", "i", "e", "c", "t", "T"];
};

// node_modules/date-fns/parse/_lib/parsers/QuarterParser.js
var QuarterParser = class extends Parser {
  priority = 120;
  parse(dateString, token, match2) {
    switch (token) {
      // 1, 2, 3, 4
      case "Q":
      case "QQ":
        return parseNDigits(token.length, dateString);
      // 1st, 2nd, 3rd, 4th
      case "Qo":
        return match2.ordinalNumber(dateString, { unit: "quarter" });
      // Q1, Q2, Q3, Q4
      case "QQQ":
        return match2.quarter(dateString, {
          width: "abbreviated",
          context: "formatting"
        }) || match2.quarter(dateString, {
          width: "narrow",
          context: "formatting"
        });
      // 1, 2, 3, 4 (narrow quarter; could be not numerical)
      case "QQQQQ":
        return match2.quarter(dateString, {
          width: "narrow",
          context: "formatting"
        });
      // 1st quarter, 2nd quarter, ...
      case "QQQQ":
      default:
        return match2.quarter(dateString, {
          width: "wide",
          context: "formatting"
        }) || match2.quarter(dateString, {
          width: "abbreviated",
          context: "formatting"
        }) || match2.quarter(dateString, {
          width: "narrow",
          context: "formatting"
        });
    }
  }
  validate(_date, value) {
    return value >= 1 && value <= 4;
  }
  set(date, _flags, value) {
    date.setMonth((value - 1) * 3, 1);
    date.setHours(0, 0, 0, 0);
    return date;
  }
  incompatibleTokens = [
    "Y",
    "R",
    "q",
    "M",
    "L",
    "w",
    "I",
    "d",
    "D",
    "i",
    "e",
    "c",
    "t",
    "T"
  ];
};

// node_modules/date-fns/parse/_lib/parsers/StandAloneQuarterParser.js
var StandAloneQuarterParser = class extends Parser {
  priority = 120;
  parse(dateString, token, match2) {
    switch (token) {
      // 1, 2, 3, 4
      case "q":
      case "qq":
        return parseNDigits(token.length, dateString);
      // 1st, 2nd, 3rd, 4th
      case "qo":
        return match2.ordinalNumber(dateString, { unit: "quarter" });
      // Q1, Q2, Q3, Q4
      case "qqq":
        return match2.quarter(dateString, {
          width: "abbreviated",
          context: "standalone"
        }) || match2.quarter(dateString, {
          width: "narrow",
          context: "standalone"
        });
      // 1, 2, 3, 4 (narrow quarter; could be not numerical)
      case "qqqqq":
        return match2.quarter(dateString, {
          width: "narrow",
          context: "standalone"
        });
      // 1st quarter, 2nd quarter, ...
      case "qqqq":
      default:
        return match2.quarter(dateString, {
          width: "wide",
          context: "standalone"
        }) || match2.quarter(dateString, {
          width: "abbreviated",
          context: "standalone"
        }) || match2.quarter(dateString, {
          width: "narrow",
          context: "standalone"
        });
    }
  }
  validate(_date, value) {
    return value >= 1 && value <= 4;
  }
  set(date, _flags, value) {
    date.setMonth((value - 1) * 3, 1);
    date.setHours(0, 0, 0, 0);
    return date;
  }
  incompatibleTokens = [
    "Y",
    "R",
    "Q",
    "M",
    "L",
    "w",
    "I",
    "d",
    "D",
    "i",
    "e",
    "c",
    "t",
    "T"
  ];
};

// node_modules/date-fns/parse/_lib/parsers/MonthParser.js
var MonthParser = class extends Parser {
  incompatibleTokens = [
    "Y",
    "R",
    "q",
    "Q",
    "L",
    "w",
    "I",
    "D",
    "i",
    "e",
    "c",
    "t",
    "T"
  ];
  priority = 110;
  parse(dateString, token, match2) {
    const valueCallback = (value) => value - 1;
    switch (token) {
      // 1, 2, ..., 12
      case "M":
        return mapValue(
          parseNumericPattern(numericPatterns.month, dateString),
          valueCallback
        );
      // 01, 02, ..., 12
      case "MM":
        return mapValue(parseNDigits(2, dateString), valueCallback);
      // 1st, 2nd, ..., 12th
      case "Mo":
        return mapValue(
          match2.ordinalNumber(dateString, {
            unit: "month"
          }),
          valueCallback
        );
      // Jan, Feb, ..., Dec
      case "MMM":
        return match2.month(dateString, {
          width: "abbreviated",
          context: "formatting"
        }) || match2.month(dateString, { width: "narrow", context: "formatting" });
      // J, F, ..., D
      case "MMMMM":
        return match2.month(dateString, {
          width: "narrow",
          context: "formatting"
        });
      // January, February, ..., December
      case "MMMM":
      default:
        return match2.month(dateString, { width: "wide", context: "formatting" }) || match2.month(dateString, {
          width: "abbreviated",
          context: "formatting"
        }) || match2.month(dateString, { width: "narrow", context: "formatting" });
    }
  }
  validate(_date, value) {
    return value >= 0 && value <= 11;
  }
  set(date, _flags, value) {
    date.setMonth(value, 1);
    date.setHours(0, 0, 0, 0);
    return date;
  }
};

// node_modules/date-fns/parse/_lib/parsers/StandAloneMonthParser.js
var StandAloneMonthParser = class extends Parser {
  priority = 110;
  parse(dateString, token, match2) {
    const valueCallback = (value) => value - 1;
    switch (token) {
      // 1, 2, ..., 12
      case "L":
        return mapValue(
          parseNumericPattern(numericPatterns.month, dateString),
          valueCallback
        );
      // 01, 02, ..., 12
      case "LL":
        return mapValue(parseNDigits(2, dateString), valueCallback);
      // 1st, 2nd, ..., 12th
      case "Lo":
        return mapValue(
          match2.ordinalNumber(dateString, {
            unit: "month"
          }),
          valueCallback
        );
      // Jan, Feb, ..., Dec
      case "LLL":
        return match2.month(dateString, {
          width: "abbreviated",
          context: "standalone"
        }) || match2.month(dateString, { width: "narrow", context: "standalone" });
      // J, F, ..., D
      case "LLLLL":
        return match2.month(dateString, {
          width: "narrow",
          context: "standalone"
        });
      // January, February, ..., December
      case "LLLL":
      default:
        return match2.month(dateString, { width: "wide", context: "standalone" }) || match2.month(dateString, {
          width: "abbreviated",
          context: "standalone"
        }) || match2.month(dateString, { width: "narrow", context: "standalone" });
    }
  }
  validate(_date, value) {
    return value >= 0 && value <= 11;
  }
  set(date, _flags, value) {
    date.setMonth(value, 1);
    date.setHours(0, 0, 0, 0);
    return date;
  }
  incompatibleTokens = [
    "Y",
    "R",
    "q",
    "Q",
    "M",
    "w",
    "I",
    "D",
    "i",
    "e",
    "c",
    "t",
    "T"
  ];
};

// node_modules/date-fns/setWeek.js
function setWeek(date, week, options) {
  const date_ = toDate(date, options?.in);
  const diff = getWeek(date_, options) - week;
  date_.setDate(date_.getDate() - diff * 7);
  return toDate(date_, options?.in);
}

// node_modules/date-fns/parse/_lib/parsers/LocalWeekParser.js
var LocalWeekParser = class extends Parser {
  priority = 100;
  parse(dateString, token, match2) {
    switch (token) {
      case "w":
        return parseNumericPattern(numericPatterns.week, dateString);
      case "wo":
        return match2.ordinalNumber(dateString, { unit: "week" });
      default:
        return parseNDigits(token.length, dateString);
    }
  }
  validate(_date, value) {
    return value >= 1 && value <= 53;
  }
  set(date, _flags, value, options) {
    return startOfWeek(setWeek(date, value, options), options);
  }
  incompatibleTokens = [
    "y",
    "R",
    "u",
    "q",
    "Q",
    "M",
    "L",
    "I",
    "d",
    "D",
    "i",
    "t",
    "T"
  ];
};

// node_modules/date-fns/setISOWeek.js
function setISOWeek(date, week, options) {
  const _date = toDate(date, options?.in);
  const diff = getISOWeek(_date, options) - week;
  _date.setDate(_date.getDate() - diff * 7);
  return _date;
}

// node_modules/date-fns/parse/_lib/parsers/ISOWeekParser.js
var ISOWeekParser = class extends Parser {
  priority = 100;
  parse(dateString, token, match2) {
    switch (token) {
      case "I":
        return parseNumericPattern(numericPatterns.week, dateString);
      case "Io":
        return match2.ordinalNumber(dateString, { unit: "week" });
      default:
        return parseNDigits(token.length, dateString);
    }
  }
  validate(_date, value) {
    return value >= 1 && value <= 53;
  }
  set(date, _flags, value) {
    return startOfISOWeek(setISOWeek(date, value));
  }
  incompatibleTokens = [
    "y",
    "Y",
    "u",
    "q",
    "Q",
    "M",
    "L",
    "w",
    "d",
    "D",
    "e",
    "c",
    "t",
    "T"
  ];
};

// node_modules/date-fns/parse/_lib/parsers/DateParser.js
var DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
var DAYS_IN_MONTH_LEAP_YEAR = [
  31,
  29,
  31,
  30,
  31,
  30,
  31,
  31,
  30,
  31,
  30,
  31
];
var DateParser = class extends Parser {
  priority = 90;
  subPriority = 1;
  parse(dateString, token, match2) {
    switch (token) {
      case "d":
        return parseNumericPattern(numericPatterns.date, dateString);
      case "do":
        return match2.ordinalNumber(dateString, { unit: "date" });
      default:
        return parseNDigits(token.length, dateString);
    }
  }
  validate(date, value) {
    const year = date.getFullYear();
    const isLeapYear = isLeapYearIndex(year);
    const month = date.getMonth();
    if (isLeapYear) {
      return value >= 1 && value <= DAYS_IN_MONTH_LEAP_YEAR[month];
    } else {
      return value >= 1 && value <= DAYS_IN_MONTH[month];
    }
  }
  set(date, _flags, value) {
    date.setDate(value);
    date.setHours(0, 0, 0, 0);
    return date;
  }
  incompatibleTokens = [
    "Y",
    "R",
    "q",
    "Q",
    "w",
    "I",
    "D",
    "i",
    "e",
    "c",
    "t",
    "T"
  ];
};

// node_modules/date-fns/parse/_lib/parsers/DayOfYearParser.js
var DayOfYearParser = class extends Parser {
  priority = 90;
  subpriority = 1;
  parse(dateString, token, match2) {
    switch (token) {
      case "D":
      case "DD":
        return parseNumericPattern(numericPatterns.dayOfYear, dateString);
      case "Do":
        return match2.ordinalNumber(dateString, { unit: "date" });
      default:
        return parseNDigits(token.length, dateString);
    }
  }
  validate(date, value) {
    const year = date.getFullYear();
    const isLeapYear = isLeapYearIndex(year);
    if (isLeapYear) {
      return value >= 1 && value <= 366;
    } else {
      return value >= 1 && value <= 365;
    }
  }
  set(date, _flags, value) {
    date.setMonth(0, value);
    date.setHours(0, 0, 0, 0);
    return date;
  }
  incompatibleTokens = [
    "Y",
    "R",
    "q",
    "Q",
    "M",
    "L",
    "w",
    "I",
    "d",
    "E",
    "i",
    "e",
    "c",
    "t",
    "T"
  ];
};

// node_modules/date-fns/setDay.js
function setDay(date, day, options) {
  const defaultOptions2 = getDefaultOptions();
  const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
  const date_ = toDate(date, options?.in);
  const currentDay = date_.getDay();
  const remainder = day % 7;
  const dayIndex = (remainder + 7) % 7;
  const delta = 7 - weekStartsOn;
  const diff = day < 0 || day > 6 ? day - (currentDay + delta) % 7 : (dayIndex + delta) % 7 - (currentDay + delta) % 7;
  return addDays(date_, diff, options);
}

// node_modules/date-fns/parse/_lib/parsers/DayParser.js
var DayParser = class extends Parser {
  priority = 90;
  parse(dateString, token, match2) {
    switch (token) {
      // Tue
      case "E":
      case "EE":
      case "EEE":
        return match2.day(dateString, {
          width: "abbreviated",
          context: "formatting"
        }) || match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
      // T
      case "EEEEE":
        return match2.day(dateString, {
          width: "narrow",
          context: "formatting"
        });
      // Tu
      case "EEEEEE":
        return match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
      // Tuesday
      case "EEEE":
      default:
        return match2.day(dateString, { width: "wide", context: "formatting" }) || match2.day(dateString, {
          width: "abbreviated",
          context: "formatting"
        }) || match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
    }
  }
  validate(_date, value) {
    return value >= 0 && value <= 6;
  }
  set(date, _flags, value, options) {
    date = setDay(date, value, options);
    date.setHours(0, 0, 0, 0);
    return date;
  }
  incompatibleTokens = ["D", "i", "e", "c", "t", "T"];
};

// node_modules/date-fns/parse/_lib/parsers/LocalDayParser.js
var LocalDayParser = class extends Parser {
  priority = 90;
  parse(dateString, token, match2, options) {
    const valueCallback = (value) => {
      const wholeWeekDays = Math.floor((value - 1) / 7) * 7;
      return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;
    };
    switch (token) {
      // 3
      case "e":
      case "ee":
        return mapValue(parseNDigits(token.length, dateString), valueCallback);
      // 3rd
      case "eo":
        return mapValue(
          match2.ordinalNumber(dateString, {
            unit: "day"
          }),
          valueCallback
        );
      // Tue
      case "eee":
        return match2.day(dateString, {
          width: "abbreviated",
          context: "formatting"
        }) || match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
      // T
      case "eeeee":
        return match2.day(dateString, {
          width: "narrow",
          context: "formatting"
        });
      // Tu
      case "eeeeee":
        return match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
      // Tuesday
      case "eeee":
      default:
        return match2.day(dateString, { width: "wide", context: "formatting" }) || match2.day(dateString, {
          width: "abbreviated",
          context: "formatting"
        }) || match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
    }
  }
  validate(_date, value) {
    return value >= 0 && value <= 6;
  }
  set(date, _flags, value, options) {
    date = setDay(date, value, options);
    date.setHours(0, 0, 0, 0);
    return date;
  }
  incompatibleTokens = [
    "y",
    "R",
    "u",
    "q",
    "Q",
    "M",
    "L",
    "I",
    "d",
    "D",
    "E",
    "i",
    "c",
    "t",
    "T"
  ];
};

// node_modules/date-fns/parse/_lib/parsers/StandAloneLocalDayParser.js
var StandAloneLocalDayParser = class extends Parser {
  priority = 90;
  parse(dateString, token, match2, options) {
    const valueCallback = (value) => {
      const wholeWeekDays = Math.floor((value - 1) / 7) * 7;
      return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;
    };
    switch (token) {
      // 3
      case "c":
      case "cc":
        return mapValue(parseNDigits(token.length, dateString), valueCallback);
      // 3rd
      case "co":
        return mapValue(
          match2.ordinalNumber(dateString, {
            unit: "day"
          }),
          valueCallback
        );
      // Tue
      case "ccc":
        return match2.day(dateString, {
          width: "abbreviated",
          context: "standalone"
        }) || match2.day(dateString, { width: "short", context: "standalone" }) || match2.day(dateString, { width: "narrow", context: "standalone" });
      // T
      case "ccccc":
        return match2.day(dateString, {
          width: "narrow",
          context: "standalone"
        });
      // Tu
      case "cccccc":
        return match2.day(dateString, { width: "short", context: "standalone" }) || match2.day(dateString, { width: "narrow", context: "standalone" });
      // Tuesday
      case "cccc":
      default:
        return match2.day(dateString, { width: "wide", context: "standalone" }) || match2.day(dateString, {
          width: "abbreviated",
          context: "standalone"
        }) || match2.day(dateString, { width: "short", context: "standalone" }) || match2.day(dateString, { width: "narrow", context: "standalone" });
    }
  }
  validate(_date, value) {
    return value >= 0 && value <= 6;
  }
  set(date, _flags, value, options) {
    date = setDay(date, value, options);
    date.setHours(0, 0, 0, 0);
    return date;
  }
  incompatibleTokens = [
    "y",
    "R",
    "u",
    "q",
    "Q",
    "M",
    "L",
    "I",
    "d",
    "D",
    "E",
    "i",
    "e",
    "t",
    "T"
  ];
};

// node_modules/date-fns/setISODay.js
function setISODay(date, day, options) {
  const date_ = toDate(date, options?.in);
  const currentDay = getISODay(date_, options);
  const diff = day - currentDay;
  return addDays(date_, diff, options);
}

// node_modules/date-fns/parse/_lib/parsers/ISODayParser.js
var ISODayParser = class extends Parser {
  priority = 90;
  parse(dateString, token, match2) {
    const valueCallback = (value) => {
      if (value === 0) {
        return 7;
      }
      return value;
    };
    switch (token) {
      // 2
      case "i":
      case "ii":
        return parseNDigits(token.length, dateString);
      // 2nd
      case "io":
        return match2.ordinalNumber(dateString, { unit: "day" });
      // Tue
      case "iii":
        return mapValue(
          match2.day(dateString, {
            width: "abbreviated",
            context: "formatting"
          }) || match2.day(dateString, {
            width: "short",
            context: "formatting"
          }) || match2.day(dateString, {
            width: "narrow",
            context: "formatting"
          }),
          valueCallback
        );
      // T
      case "iiiii":
        return mapValue(
          match2.day(dateString, {
            width: "narrow",
            context: "formatting"
          }),
          valueCallback
        );
      // Tu
      case "iiiiii":
        return mapValue(
          match2.day(dateString, {
            width: "short",
            context: "formatting"
          }) || match2.day(dateString, {
            width: "narrow",
            context: "formatting"
          }),
          valueCallback
        );
      // Tuesday
      case "iiii":
      default:
        return mapValue(
          match2.day(dateString, {
            width: "wide",
            context: "formatting"
          }) || match2.day(dateString, {
            width: "abbreviated",
            context: "formatting"
          }) || match2.day(dateString, {
            width: "short",
            context: "formatting"
          }) || match2.day(dateString, {
            width: "narrow",
            context: "formatting"
          }),
          valueCallback
        );
    }
  }
  validate(_date, value) {
    return value >= 1 && value <= 7;
  }
  set(date, _flags, value) {
    date = setISODay(date, value);
    date.setHours(0, 0, 0, 0);
    return date;
  }
  incompatibleTokens = [
    "y",
    "Y",
    "u",
    "q",
    "Q",
    "M",
    "L",
    "w",
    "d",
    "D",
    "E",
    "e",
    "c",
    "t",
    "T"
  ];
};

// node_modules/date-fns/parse/_lib/parsers/AMPMParser.js
var AMPMParser = class extends Parser {
  priority = 80;
  parse(dateString, token, match2) {
    switch (token) {
      case "a":
      case "aa":
      case "aaa":
        return match2.dayPeriod(dateString, {
          width: "abbreviated",
          context: "formatting"
        }) || match2.dayPeriod(dateString, {
          width: "narrow",
          context: "formatting"
        });
      case "aaaaa":
        return match2.dayPeriod(dateString, {
          width: "narrow",
          context: "formatting"
        });
      case "aaaa":
      default:
        return match2.dayPeriod(dateString, {
          width: "wide",
          context: "formatting"
        }) || match2.dayPeriod(dateString, {
          width: "abbreviated",
          context: "formatting"
        }) || match2.dayPeriod(dateString, {
          width: "narrow",
          context: "formatting"
        });
    }
  }
  set(date, _flags, value) {
    date.setHours(dayPeriodEnumToHours(value), 0, 0, 0);
    return date;
  }
  incompatibleTokens = ["b", "B", "H", "k", "t", "T"];
};

// node_modules/date-fns/parse/_lib/parsers/AMPMMidnightParser.js
var AMPMMidnightParser = class extends Parser {
  priority = 80;
  parse(dateString, token, match2) {
    switch (token) {
      case "b":
      case "bb":
      case "bbb":
        return match2.dayPeriod(dateString, {
          width: "abbreviated",
          context: "formatting"
        }) || match2.dayPeriod(dateString, {
          width: "narrow",
          context: "formatting"
        });
      case "bbbbb":
        return match2.dayPeriod(dateString, {
          width: "narrow",
          context: "formatting"
        });
      case "bbbb":
      default:
        return match2.dayPeriod(dateString, {
          width: "wide",
          context: "formatting"
        }) || match2.dayPeriod(dateString, {
          width: "abbreviated",
          context: "formatting"
        }) || match2.dayPeriod(dateString, {
          width: "narrow",
          context: "formatting"
        });
    }
  }
  set(date, _flags, value) {
    date.setHours(dayPeriodEnumToHours(value), 0, 0, 0);
    return date;
  }
  incompatibleTokens = ["a", "B", "H", "k", "t", "T"];
};

// node_modules/date-fns/parse/_lib/parsers/DayPeriodParser.js
var DayPeriodParser = class extends Parser {
  priority = 80;
  parse(dateString, token, match2) {
    switch (token) {
      case "B":
      case "BB":
      case "BBB":
        return match2.dayPeriod(dateString, {
          width: "abbreviated",
          context: "formatting"
        }) || match2.dayPeriod(dateString, {
          width: "narrow",
          context: "formatting"
        });
      case "BBBBB":
        return match2.dayPeriod(dateString, {
          width: "narrow",
          context: "formatting"
        });
      case "BBBB":
      default:
        return match2.dayPeriod(dateString, {
          width: "wide",
          context: "formatting"
        }) || match2.dayPeriod(dateString, {
          width: "abbreviated",
          context: "formatting"
        }) || match2.dayPeriod(dateString, {
          width: "narrow",
          context: "formatting"
        });
    }
  }
  set(date, _flags, value) {
    date.setHours(dayPeriodEnumToHours(value), 0, 0, 0);
    return date;
  }
  incompatibleTokens = ["a", "b", "t", "T"];
};

// node_modules/date-fns/parse/_lib/parsers/Hour1to12Parser.js
var Hour1to12Parser = class extends Parser {
  priority = 70;
  parse(dateString, token, match2) {
    switch (token) {
      case "h":
        return parseNumericPattern(numericPatterns.hour12h, dateString);
      case "ho":
        return match2.ordinalNumber(dateString, { unit: "hour" });
      default:
        return parseNDigits(token.length, dateString);
    }
  }
  validate(_date, value) {
    return value >= 1 && value <= 12;
  }
  set(date, _flags, value) {
    const isPM = date.getHours() >= 12;
    if (isPM && value < 12) {
      date.setHours(value + 12, 0, 0, 0);
    } else if (!isPM && value === 12) {
      date.setHours(0, 0, 0, 0);
    } else {
      date.setHours(value, 0, 0, 0);
    }
    return date;
  }
  incompatibleTokens = ["H", "K", "k", "t", "T"];
};

// node_modules/date-fns/parse/_lib/parsers/Hour0to23Parser.js
var Hour0to23Parser = class extends Parser {
  priority = 70;
  parse(dateString, token, match2) {
    switch (token) {
      case "H":
        return parseNumericPattern(numericPatterns.hour23h, dateString);
      case "Ho":
        return match2.ordinalNumber(dateString, { unit: "hour" });
      default:
        return parseNDigits(token.length, dateString);
    }
  }
  validate(_date, value) {
    return value >= 0 && value <= 23;
  }
  set(date, _flags, value) {
    date.setHours(value, 0, 0, 0);
    return date;
  }
  incompatibleTokens = ["a", "b", "h", "K", "k", "t", "T"];
};

// node_modules/date-fns/parse/_lib/parsers/Hour0To11Parser.js
var Hour0To11Parser = class extends Parser {
  priority = 70;
  parse(dateString, token, match2) {
    switch (token) {
      case "K":
        return parseNumericPattern(numericPatterns.hour11h, dateString);
      case "Ko":
        return match2.ordinalNumber(dateString, { unit: "hour" });
      default:
        return parseNDigits(token.length, dateString);
    }
  }
  validate(_date, value) {
    return value >= 0 && value <= 11;
  }
  set(date, _flags, value) {
    const isPM = date.getHours() >= 12;
    if (isPM && value < 12) {
      date.setHours(value + 12, 0, 0, 0);
    } else {
      date.setHours(value, 0, 0, 0);
    }
    return date;
  }
  incompatibleTokens = ["h", "H", "k", "t", "T"];
};

// node_modules/date-fns/parse/_lib/parsers/Hour1To24Parser.js
var Hour1To24Parser = class extends Parser {
  priority = 70;
  parse(dateString, token, match2) {
    switch (token) {
      case "k":
        return parseNumericPattern(numericPatterns.hour24h, dateString);
      case "ko":
        return match2.ordinalNumber(dateString, { unit: "hour" });
      default:
        return parseNDigits(token.length, dateString);
    }
  }
  validate(_date, value) {
    return value >= 1 && value <= 24;
  }
  set(date, _flags, value) {
    const hours = value <= 24 ? value % 24 : value;
    date.setHours(hours, 0, 0, 0);
    return date;
  }
  incompatibleTokens = ["a", "b", "h", "H", "K", "t", "T"];
};

// node_modules/date-fns/parse/_lib/parsers/MinuteParser.js
var MinuteParser = class extends Parser {
  priority = 60;
  parse(dateString, token, match2) {
    switch (token) {
      case "m":
        return parseNumericPattern(numericPatterns.minute, dateString);
      case "mo":
        return match2.ordinalNumber(dateString, { unit: "minute" });
      default:
        return parseNDigits(token.length, dateString);
    }
  }
  validate(_date, value) {
    return value >= 0 && value <= 59;
  }
  set(date, _flags, value) {
    date.setMinutes(value, 0, 0);
    return date;
  }
  incompatibleTokens = ["t", "T"];
};

// node_modules/date-fns/parse/_lib/parsers/SecondParser.js
var SecondParser = class extends Parser {
  priority = 50;
  parse(dateString, token, match2) {
    switch (token) {
      case "s":
        return parseNumericPattern(numericPatterns.second, dateString);
      case "so":
        return match2.ordinalNumber(dateString, { unit: "second" });
      default:
        return parseNDigits(token.length, dateString);
    }
  }
  validate(_date, value) {
    return value >= 0 && value <= 59;
  }
  set(date, _flags, value) {
    date.setSeconds(value, 0);
    return date;
  }
  incompatibleTokens = ["t", "T"];
};

// node_modules/date-fns/parse/_lib/parsers/FractionOfSecondParser.js
var FractionOfSecondParser = class extends Parser {
  priority = 30;
  parse(dateString, token) {
    const valueCallback = (value) => Math.trunc(value * Math.pow(10, -token.length + 3));
    return mapValue(parseNDigits(token.length, dateString), valueCallback);
  }
  set(date, _flags, value) {
    date.setMilliseconds(value);
    return date;
  }
  incompatibleTokens = ["t", "T"];
};

// node_modules/date-fns/parse/_lib/parsers/ISOTimezoneWithZParser.js
var ISOTimezoneWithZParser = class extends Parser {
  priority = 10;
  parse(dateString, token) {
    switch (token) {
      case "X":
        return parseTimezonePattern(
          timezonePatterns.basicOptionalMinutes,
          dateString
        );
      case "XX":
        return parseTimezonePattern(timezonePatterns.basic, dateString);
      case "XXXX":
        return parseTimezonePattern(
          timezonePatterns.basicOptionalSeconds,
          dateString
        );
      case "XXXXX":
        return parseTimezonePattern(
          timezonePatterns.extendedOptionalSeconds,
          dateString
        );
      case "XXX":
      default:
        return parseTimezonePattern(timezonePatterns.extended, dateString);
    }
  }
  set(date, flags, value) {
    if (flags.timestampIsSet) return date;
    return constructFrom(
      date,
      date.getTime() - getTimezoneOffsetInMilliseconds(date) - value
    );
  }
  incompatibleTokens = ["t", "T", "x"];
};

// node_modules/date-fns/parse/_lib/parsers/ISOTimezoneParser.js
var ISOTimezoneParser = class extends Parser {
  priority = 10;
  parse(dateString, token) {
    switch (token) {
      case "x":
        return parseTimezonePattern(
          timezonePatterns.basicOptionalMinutes,
          dateString
        );
      case "xx":
        return parseTimezonePattern(timezonePatterns.basic, dateString);
      case "xxxx":
        return parseTimezonePattern(
          timezonePatterns.basicOptionalSeconds,
          dateString
        );
      case "xxxxx":
        return parseTimezonePattern(
          timezonePatterns.extendedOptionalSeconds,
          dateString
        );
      case "xxx":
      default:
        return parseTimezonePattern(timezonePatterns.extended, dateString);
    }
  }
  set(date, flags, value) {
    if (flags.timestampIsSet) return date;
    return constructFrom(
      date,
      date.getTime() - getTimezoneOffsetInMilliseconds(date) - value
    );
  }
  incompatibleTokens = ["t", "T", "X"];
};

// node_modules/date-fns/parse/_lib/parsers/TimestampSecondsParser.js
var TimestampSecondsParser = class extends Parser {
  priority = 40;
  parse(dateString) {
    return parseAnyDigitsSigned(dateString);
  }
  set(date, _flags, value) {
    return [constructFrom(date, value * 1e3), { timestampIsSet: true }];
  }
  incompatibleTokens = "*";
};

// node_modules/date-fns/parse/_lib/parsers/TimestampMillisecondsParser.js
var TimestampMillisecondsParser = class extends Parser {
  priority = 20;
  parse(dateString) {
    return parseAnyDigitsSigned(dateString);
  }
  set(date, _flags, value) {
    return [constructFrom(date, value), { timestampIsSet: true }];
  }
  incompatibleTokens = "*";
};

// node_modules/date-fns/parse/_lib/parsers.js
var parsers = {
  G: new EraParser(),
  y: new YearParser(),
  Y: new LocalWeekYearParser(),
  R: new ISOWeekYearParser(),
  u: new ExtendedYearParser(),
  Q: new QuarterParser(),
  q: new StandAloneQuarterParser(),
  M: new MonthParser(),
  L: new StandAloneMonthParser(),
  w: new LocalWeekParser(),
  I: new ISOWeekParser(),
  d: new DateParser(),
  D: new DayOfYearParser(),
  E: new DayParser(),
  e: new LocalDayParser(),
  c: new StandAloneLocalDayParser(),
  i: new ISODayParser(),
  a: new AMPMParser(),
  b: new AMPMMidnightParser(),
  B: new DayPeriodParser(),
  h: new Hour1to12Parser(),
  H: new Hour0to23Parser(),
  K: new Hour0To11Parser(),
  k: new Hour1To24Parser(),
  m: new MinuteParser(),
  s: new SecondParser(),
  S: new FractionOfSecondParser(),
  X: new ISOTimezoneWithZParser(),
  x: new ISOTimezoneParser(),
  t: new TimestampSecondsParser(),
  T: new TimestampMillisecondsParser()
};

// node_modules/date-fns/parse.js
var formattingTokensRegExp2 = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
var longFormattingTokensRegExp2 = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
var escapedStringRegExp2 = /^'([^]*?)'?$/;
var doubleQuoteRegExp2 = /''/g;
var notWhitespaceRegExp = /\S/;
var unescapedLatinCharacterRegExp2 = /[a-zA-Z]/;
function parse(dateStr, formatStr, referenceDate, options) {
  const invalidDate = () => constructFrom(options?.in || referenceDate, NaN);
  const defaultOptions2 = getDefaultOptions2();
  const locale = options?.locale ?? defaultOptions2.locale ?? enUS;
  const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
  const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
  if (!formatStr)
    return dateStr ? invalidDate() : toDate(referenceDate, options?.in);
  const subFnOptions = {
    firstWeekContainsDate,
    weekStartsOn,
    locale
  };
  const setters = [new DateTimezoneSetter(options?.in, referenceDate)];
  const tokens = formatStr.match(longFormattingTokensRegExp2).map((substring) => {
    const firstCharacter = substring[0];
    if (firstCharacter in longFormatters) {
      const longFormatter = longFormatters[firstCharacter];
      return longFormatter(substring, locale.formatLong);
    }
    return substring;
  }).join("").match(formattingTokensRegExp2);
  const usedTokens = [];
  for (let token of tokens) {
    if (!options?.useAdditionalWeekYearTokens && isProtectedWeekYearToken(token)) {
      warnOrThrowProtectedError(token, formatStr, dateStr);
    }
    if (!options?.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(token)) {
      warnOrThrowProtectedError(token, formatStr, dateStr);
    }
    const firstCharacter = token[0];
    const parser = parsers[firstCharacter];
    if (parser) {
      const { incompatibleTokens } = parser;
      if (Array.isArray(incompatibleTokens)) {
        const incompatibleToken = usedTokens.find(
          (usedToken) => incompatibleTokens.includes(usedToken.token) || usedToken.token === firstCharacter
        );
        if (incompatibleToken) {
          throw new RangeError(
            `The format string mustn't contain \`${incompatibleToken.fullToken}\` and \`${token}\` at the same time`
          );
        }
      } else if (parser.incompatibleTokens === "*" && usedTokens.length > 0) {
        throw new RangeError(
          `The format string mustn't contain \`${token}\` and any other token at the same time`
        );
      }
      usedTokens.push({ token: firstCharacter, fullToken: token });
      const parseResult = parser.run(
        dateStr,
        token,
        locale.match,
        subFnOptions
      );
      if (!parseResult) {
        return invalidDate();
      }
      setters.push(parseResult.setter);
      dateStr = parseResult.rest;
    } else {
      if (firstCharacter.match(unescapedLatinCharacterRegExp2)) {
        throw new RangeError(
          "Format string contains an unescaped latin alphabet character `" + firstCharacter + "`"
        );
      }
      if (token === "''") {
        token = "'";
      } else if (firstCharacter === "'") {
        token = cleanEscapedString2(token);
      }
      if (dateStr.indexOf(token) === 0) {
        dateStr = dateStr.slice(token.length);
      } else {
        return invalidDate();
      }
    }
  }
  if (dateStr.length > 0 && notWhitespaceRegExp.test(dateStr)) {
    return invalidDate();
  }
  const uniquePrioritySetters = setters.map((setter) => setter.priority).sort((a, b) => b - a).filter((priority, index3, array) => array.indexOf(priority) === index3).map(
    (priority) => setters.filter((setter) => setter.priority === priority).sort((a, b) => b.subPriority - a.subPriority)
  ).map((setterArray) => setterArray[0]);
  let date = toDate(referenceDate, options?.in);
  if (isNaN(+date)) return invalidDate();
  const flags = {};
  for (const setter of uniquePrioritySetters) {
    if (!setter.validate(date, subFnOptions)) {
      return invalidDate();
    }
    const result = setter.set(date, flags, subFnOptions);
    if (Array.isArray(result)) {
      date = result[0];
      Object.assign(flags, result[1]);
    } else {
      date = result;
    }
  }
  return date;
}
function cleanEscapedString2(input) {
  return input.match(escapedStringRegExp2)[1].replace(doubleQuoteRegExp2, "'");
}

// node_modules/date-fns/isSameMonth.js
function isSameMonth(laterDate, earlierDate, options) {
  const [laterDate_, earlierDate_] = normalizeDates(
    options?.in,
    laterDate,
    earlierDate
  );
  return laterDate_.getFullYear() === earlierDate_.getFullYear() && laterDate_.getMonth() === earlierDate_.getMonth();
}

// node_modules/date-fns/isSameYear.js
function isSameYear(laterDate, earlierDate, options) {
  const [laterDate_, earlierDate_] = normalizeDates(
    options?.in,
    laterDate,
    earlierDate
  );
  return laterDate_.getFullYear() === earlierDate_.getFullYear();
}

// node_modules/date-fns/subDays.js
function subDays(date, amount, options) {
  return addDays(date, -amount, options);
}

// node_modules/date-fns/parseISO.js
function parseISO(argument, options) {
  const invalidDate = () => constructFrom(options?.in, NaN);
  const additionalDigits = options?.additionalDigits ?? 2;
  const dateStrings = splitDateString(argument);
  let date;
  if (dateStrings.date) {
    const parseYearResult = parseYear(dateStrings.date, additionalDigits);
    date = parseDate(parseYearResult.restDateString, parseYearResult.year);
  }
  if (!date || isNaN(+date)) return invalidDate();
  const timestamp = +date;
  let time = 0;
  let offset4;
  if (dateStrings.time) {
    time = parseTime(dateStrings.time);
    if (isNaN(time)) return invalidDate();
  }
  if (dateStrings.timezone) {
    offset4 = parseTimezone(dateStrings.timezone);
    if (isNaN(offset4)) return invalidDate();
  } else {
    const tmpDate = new Date(timestamp + time);
    const result = toDate(0, options?.in);
    result.setFullYear(
      tmpDate.getUTCFullYear(),
      tmpDate.getUTCMonth(),
      tmpDate.getUTCDate()
    );
    result.setHours(
      tmpDate.getUTCHours(),
      tmpDate.getUTCMinutes(),
      tmpDate.getUTCSeconds(),
      tmpDate.getUTCMilliseconds()
    );
    return result;
  }
  return toDate(timestamp + time + offset4, options?.in);
}
var patterns = {
  dateTimeDelimiter: /[T ]/,
  timeZoneDelimiter: /[Z ]/i,
  timezone: /([Z+-].*)$/
};
var dateRegex = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/;
var timeRegex = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/;
var timezoneRegex = /^([+-])(\d{2})(?::?(\d{2}))?$/;
function splitDateString(dateString) {
  const dateStrings = {};
  const array = dateString.split(patterns.dateTimeDelimiter);
  let timeString;
  if (array.length > 2) {
    return dateStrings;
  }
  if (/:/.test(array[0])) {
    timeString = array[0];
  } else {
    dateStrings.date = array[0];
    timeString = array[1];
    if (patterns.timeZoneDelimiter.test(dateStrings.date)) {
      dateStrings.date = dateString.split(patterns.timeZoneDelimiter)[0];
      timeString = dateString.substr(
        dateStrings.date.length,
        dateString.length
      );
    }
  }
  if (timeString) {
    const token = patterns.timezone.exec(timeString);
    if (token) {
      dateStrings.time = timeString.replace(token[1], "");
      dateStrings.timezone = token[1];
    } else {
      dateStrings.time = timeString;
    }
  }
  return dateStrings;
}
function parseYear(dateString, additionalDigits) {
  const regex = new RegExp(
    "^(?:(\\d{4}|[+-]\\d{" + (4 + additionalDigits) + "})|(\\d{2}|[+-]\\d{" + (2 + additionalDigits) + "})$)"
  );
  const captures = dateString.match(regex);
  if (!captures) return { year: NaN, restDateString: "" };
  const year = captures[1] ? parseInt(captures[1]) : null;
  const century = captures[2] ? parseInt(captures[2]) : null;
  return {
    year: century === null ? year : century * 100,
    restDateString: dateString.slice((captures[1] || captures[2]).length)
  };
}
function parseDate(dateString, year) {
  if (year === null) return /* @__PURE__ */ new Date(NaN);
  const captures = dateString.match(dateRegex);
  if (!captures) return /* @__PURE__ */ new Date(NaN);
  const isWeekDate = !!captures[4];
  const dayOfYear = parseDateUnit(captures[1]);
  const month = parseDateUnit(captures[2]) - 1;
  const day = parseDateUnit(captures[3]);
  const week = parseDateUnit(captures[4]);
  const dayOfWeek = parseDateUnit(captures[5]) - 1;
  if (isWeekDate) {
    if (!validateWeekDate(year, week, dayOfWeek)) {
      return /* @__PURE__ */ new Date(NaN);
    }
    return dayOfISOWeekYear(year, week, dayOfWeek);
  } else {
    const date = /* @__PURE__ */ new Date(0);
    if (!validateDate(year, month, day) || !validateDayOfYearDate(year, dayOfYear)) {
      return /* @__PURE__ */ new Date(NaN);
    }
    date.setUTCFullYear(year, month, Math.max(dayOfYear, day));
    return date;
  }
}
function parseDateUnit(value) {
  return value ? parseInt(value) : 1;
}
function parseTime(timeString) {
  const captures = timeString.match(timeRegex);
  if (!captures) return NaN;
  const hours = parseTimeUnit(captures[1]);
  const minutes = parseTimeUnit(captures[2]);
  const seconds = parseTimeUnit(captures[3]);
  if (!validateTime(hours, minutes, seconds)) {
    return NaN;
  }
  return hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * 1e3;
}
function parseTimeUnit(value) {
  return value && parseFloat(value.replace(",", ".")) || 0;
}
function parseTimezone(timezoneString) {
  if (timezoneString === "Z") return 0;
  const captures = timezoneString.match(timezoneRegex);
  if (!captures) return 0;
  const sign = captures[1] === "+" ? -1 : 1;
  const hours = parseInt(captures[2]);
  const minutes = captures[3] && parseInt(captures[3]) || 0;
  if (!validateTimezone(hours, minutes)) {
    return NaN;
  }
  return sign * (hours * millisecondsInHour + minutes * millisecondsInMinute);
}
function dayOfISOWeekYear(isoWeekYear, week, day) {
  const date = /* @__PURE__ */ new Date(0);
  date.setUTCFullYear(isoWeekYear, 0, 4);
  const fourthOfJanuaryDay = date.getUTCDay() || 7;
  const diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay;
  date.setUTCDate(date.getUTCDate() + diff);
  return date;
}
var daysInMonths = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
function isLeapYearIndex2(year) {
  return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
}
function validateDate(year, month, date) {
  return month >= 0 && month <= 11 && date >= 1 && date <= (daysInMonths[month] || (isLeapYearIndex2(year) ? 29 : 28));
}
function validateDayOfYearDate(year, dayOfYear) {
  return dayOfYear >= 1 && dayOfYear <= (isLeapYearIndex2(year) ? 366 : 365);
}
function validateWeekDate(_year, week, day) {
  return week >= 1 && week <= 53 && day >= 0 && day <= 6;
}
function validateTime(hours, minutes, seconds) {
  if (hours === 24) {
    return minutes === 0 && seconds === 0;
  }
  return seconds >= 0 && seconds < 60 && minutes >= 0 && minutes < 60 && hours >= 0 && hours < 25;
}
function validateTimezone(_hours, minutes) {
  return minutes >= 0 && minutes <= 59;
}

// node_modules/date-fns/setMonth.js
function setMonth(date, month, options) {
  const _date = toDate(date, options?.in);
  const year = _date.getFullYear();
  const day = _date.getDate();
  const midMonth = constructFrom(options?.in || date, 0);
  midMonth.setFullYear(year, month, 15);
  midMonth.setHours(0, 0, 0, 0);
  const daysInMonth = getDaysInMonth(midMonth);
  _date.setMonth(month, Math.min(day, daysInMonth));
  return _date;
}

// node_modules/date-fns/setYear.js
function setYear(date, year, options) {
  const date_ = toDate(date, options?.in);
  if (isNaN(+date_)) return constructFrom(options?.in || date, NaN);
  date_.setFullYear(year);
  return date_;
}

// node_modules/date-fns/subMonths.js
function subMonths(date, amount, options) {
  return addMonths(date, -amount, options);
}

// node_modules/date-fns/subWeeks.js
function subWeeks(date, amount, options) {
  return addWeeks(date, -amount, options);
}

// node_modules/date-fns/subYears.js
function subYears(date, amount, options) {
  return addYears(date, -amount, options);
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getBroadcastWeeksInMonth.js
var FIVE_WEEKS = 5;
var FOUR_WEEKS = 4;
function getBroadcastWeeksInMonth(month, dateLib) {
  const firstDayOfMonth = dateLib.startOfMonth(month);
  const firstDayOfWeek = firstDayOfMonth.getDay() > 0 ? firstDayOfMonth.getDay() : 7;
  const broadcastStartDate = dateLib.addDays(month, -firstDayOfWeek + 1);
  const lastDateOfLastWeek = dateLib.addDays(broadcastStartDate, FIVE_WEEKS * 7 - 1);
  const numberOfWeeks = dateLib.getMonth(month) === dateLib.getMonth(lastDateOfLastWeek) ? FIVE_WEEKS : FOUR_WEEKS;
  return numberOfWeeks;
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/startOfBroadcastWeek.js
function startOfBroadcastWeek(date, dateLib) {
  const firstOfMonth = dateLib.startOfMonth(date);
  const dayOfWeek = firstOfMonth.getDay();
  if (dayOfWeek === 1) {
    return firstOfMonth;
  } else if (dayOfWeek === 0) {
    return dateLib.addDays(firstOfMonth, -1 * 6);
  } else {
    return dateLib.addDays(firstOfMonth, -1 * (dayOfWeek - 1));
  }
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/endOfBroadcastWeek.js
function endOfBroadcastWeek(date, dateLib) {
  const startDate = startOfBroadcastWeek(date, dateLib);
  const numberOfWeeks = getBroadcastWeeksInMonth(date, dateLib);
  const endDate = dateLib.addDays(startDate, numberOfWeeks * 7 - 1);
  return endDate;
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/locale/en-US.js
var enUS2 = {
  ...enUS,
  labels: {
    labelDayButton: (date, modifiers, options, dateLib) => {
      let formatDate2;
      if (dateLib && typeof dateLib.format === "function") {
        formatDate2 = dateLib.format.bind(dateLib);
      } else {
        formatDate2 = (d, pattern) => format(d, pattern, { locale: enUS, ...options });
      }
      let label = formatDate2(date, "PPPP");
      if (modifiers.today)
        label = `Today, ${label}`;
      if (modifiers.selected)
        label = `${label}, selected`;
      return label;
    },
    labelMonthDropdown: "Choose the Month",
    labelNext: "Go to the Next Month",
    labelPrevious: "Go to the Previous Month",
    labelWeekNumber: (weekNumber) => `Week ${weekNumber}`,
    labelYearDropdown: "Choose the Year",
    labelGrid: (date, options, dateLib) => {
      let formatDate2;
      if (dateLib && typeof dateLib.format === "function") {
        formatDate2 = dateLib.format.bind(dateLib);
      } else {
        formatDate2 = (d, pattern) => format(d, pattern, { locale: enUS, ...options });
      }
      return formatDate2(date, "LLLL yyyy");
    },
    labelGridcell: (date, modifiers, options, dateLib) => {
      let formatDate2;
      if (dateLib && typeof dateLib.format === "function") {
        formatDate2 = dateLib.format.bind(dateLib);
      } else {
        formatDate2 = (d, pattern) => format(d, pattern, { locale: enUS, ...options });
      }
      let label = formatDate2(date, "PPPP");
      if (modifiers?.today) {
        label = `Today, ${label}`;
      }
      return label;
    },
    labelNav: "Navigation bar",
    labelWeekNumberHeader: "Week Number",
    labelWeekday: (date, options, dateLib) => {
      let formatDate2;
      if (dateLib && typeof dateLib.format === "function") {
        formatDate2 = dateLib.format.bind(dateLib);
      } else {
        formatDate2 = (d, pattern) => format(d, pattern, { locale: enUS, ...options });
      }
      return formatDate2(date, "cccc");
    }
  }
};

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/classes/DateLib.js
var DateLib = class _DateLib {
  /**
   * Creates an instance of `DateLib`.
   *
   * @param options Configuration options for the date library.
   * @param overrides Custom overrides for the date library functions.
   */
  constructor(options, overrides) {
    this.today = () => {
      if (this.overrides?.today) {
        return this.overrides.today();
      }
      if (this.options.timeZone) {
        return TZDate.tz(this.options.timeZone);
      }
      const DateCtor = this.options.Date ?? Date;
      return new DateCtor();
    };
    this.newDate = (year, monthIndex, date) => {
      if (this.overrides?.newDate) {
        return this.overrides.newDate(year, monthIndex, date);
      }
      if (this.options.timeZone) {
        return new TZDate(year, monthIndex, date, this.options.timeZone);
      }
      return new Date(year, monthIndex, date);
    };
    this.addDays = (date, amount) => {
      return this.overrides?.addDays ? this.overrides.addDays(date, amount) : addDays(date, amount);
    };
    this.addMonths = (date, amount) => {
      return this.overrides?.addMonths ? this.overrides.addMonths(date, amount) : addMonths(date, amount);
    };
    this.addWeeks = (date, amount) => {
      return this.overrides?.addWeeks ? this.overrides.addWeeks(date, amount) : addWeeks(date, amount);
    };
    this.addYears = (date, amount) => {
      return this.overrides?.addYears ? this.overrides.addYears(date, amount) : addYears(date, amount);
    };
    this.differenceInCalendarDays = (dateLeft, dateRight) => {
      return this.overrides?.differenceInCalendarDays ? this.overrides.differenceInCalendarDays(dateLeft, dateRight) : differenceInCalendarDays(dateLeft, dateRight);
    };
    this.differenceInCalendarMonths = (dateLeft, dateRight) => {
      return this.overrides?.differenceInCalendarMonths ? this.overrides.differenceInCalendarMonths(dateLeft, dateRight) : differenceInCalendarMonths(dateLeft, dateRight);
    };
    this.eachMonthOfInterval = (interval) => {
      return this.overrides?.eachMonthOfInterval ? this.overrides.eachMonthOfInterval(interval) : eachMonthOfInterval(interval);
    };
    this.eachYearOfInterval = (interval) => {
      const years = this.overrides?.eachYearOfInterval ? this.overrides.eachYearOfInterval(interval) : eachYearOfInterval(interval);
      const uniqueYears = new Set(years.map((d) => this.getYear(d)));
      if (uniqueYears.size === years.length) {
        return years;
      }
      const yearsArray = [];
      uniqueYears.forEach((y2) => {
        yearsArray.push(new Date(y2, 0, 1));
      });
      return yearsArray;
    };
    this.endOfBroadcastWeek = (date) => {
      return this.overrides?.endOfBroadcastWeek ? this.overrides.endOfBroadcastWeek(date) : endOfBroadcastWeek(date, this);
    };
    this.endOfISOWeek = (date) => {
      return this.overrides?.endOfISOWeek ? this.overrides.endOfISOWeek(date) : endOfISOWeek(date);
    };
    this.endOfMonth = (date) => {
      return this.overrides?.endOfMonth ? this.overrides.endOfMonth(date) : endOfMonth(date);
    };
    this.endOfWeek = (date, options2) => {
      return this.overrides?.endOfWeek ? this.overrides.endOfWeek(date, options2) : endOfWeek(date, this.options);
    };
    this.endOfYear = (date) => {
      return this.overrides?.endOfYear ? this.overrides.endOfYear(date) : endOfYear(date);
    };
    this.format = (date, formatStr, _options) => {
      const formatted = this.overrides?.format ? this.overrides.format(date, formatStr, this.options) : format(date, formatStr, this.options);
      if (this.options.numerals && this.options.numerals !== "latn") {
        return this.replaceDigits(formatted);
      }
      return formatted;
    };
    this.getISOWeek = (date) => {
      return this.overrides?.getISOWeek ? this.overrides.getISOWeek(date) : getISOWeek(date);
    };
    this.getMonth = (date, _options) => {
      return this.overrides?.getMonth ? this.overrides.getMonth(date, this.options) : getMonth(date, this.options);
    };
    this.getYear = (date, _options) => {
      return this.overrides?.getYear ? this.overrides.getYear(date, this.options) : getYear(date, this.options);
    };
    this.getWeek = (date, _options) => {
      return this.overrides?.getWeek ? this.overrides.getWeek(date, this.options) : getWeek(date, this.options);
    };
    this.isAfter = (date, dateToCompare) => {
      return this.overrides?.isAfter ? this.overrides.isAfter(date, dateToCompare) : isAfter(date, dateToCompare);
    };
    this.isBefore = (date, dateToCompare) => {
      return this.overrides?.isBefore ? this.overrides.isBefore(date, dateToCompare) : isBefore(date, dateToCompare);
    };
    this.isDate = (value) => {
      return this.overrides?.isDate ? this.overrides.isDate(value) : isDate(value);
    };
    this.isSameDay = (dateLeft, dateRight) => {
      return this.overrides?.isSameDay ? this.overrides.isSameDay(dateLeft, dateRight) : isSameDay(dateLeft, dateRight);
    };
    this.isSameMonth = (dateLeft, dateRight) => {
      return this.overrides?.isSameMonth ? this.overrides.isSameMonth(dateLeft, dateRight) : isSameMonth(dateLeft, dateRight);
    };
    this.isSameYear = (dateLeft, dateRight) => {
      return this.overrides?.isSameYear ? this.overrides.isSameYear(dateLeft, dateRight) : isSameYear(dateLeft, dateRight);
    };
    this.max = (dates) => {
      return this.overrides?.max ? this.overrides.max(dates) : max2(dates);
    };
    this.min = (dates) => {
      return this.overrides?.min ? this.overrides.min(dates) : min2(dates);
    };
    this.setMonth = (date, month) => {
      return this.overrides?.setMonth ? this.overrides.setMonth(date, month) : setMonth(date, month);
    };
    this.setYear = (date, year) => {
      return this.overrides?.setYear ? this.overrides.setYear(date, year) : setYear(date, year);
    };
    this.startOfBroadcastWeek = (date, _dateLib) => {
      return this.overrides?.startOfBroadcastWeek ? this.overrides.startOfBroadcastWeek(date, this) : startOfBroadcastWeek(date, this);
    };
    this.startOfDay = (date) => {
      return this.overrides?.startOfDay ? this.overrides.startOfDay(date) : startOfDay(date);
    };
    this.startOfISOWeek = (date) => {
      return this.overrides?.startOfISOWeek ? this.overrides.startOfISOWeek(date) : startOfISOWeek(date);
    };
    this.startOfMonth = (date) => {
      return this.overrides?.startOfMonth ? this.overrides.startOfMonth(date) : startOfMonth(date);
    };
    this.startOfWeek = (date, _options) => {
      return this.overrides?.startOfWeek ? this.overrides.startOfWeek(date, this.options) : startOfWeek(date, this.options);
    };
    this.startOfYear = (date) => {
      return this.overrides?.startOfYear ? this.overrides.startOfYear(date) : startOfYear(date);
    };
    this.options = { locale: enUS2, ...options };
    this.overrides = overrides;
  }
  /**
   * Generates a mapping of Arabic digits (0-9) to the target numbering system
   * digits.
   *
   * @since 9.5.0
   * @returns A record mapping Arabic digits to the target numerals.
   */
  getDigitMap() {
    const { numerals = "latn" } = this.options;
    const formatter = new Intl.NumberFormat("en-US", {
      numberingSystem: numerals
    });
    const digitMap = {};
    for (let i = 0; i < 10; i++) {
      digitMap[i.toString()] = formatter.format(i);
    }
    return digitMap;
  }
  /**
   * Replaces Arabic digits in a string with the target numbering system digits.
   *
   * @since 9.5.0
   * @param input The string containing Arabic digits.
   * @returns The string with digits replaced.
   */
  replaceDigits(input) {
    const digitMap = this.getDigitMap();
    return input.replace(/\d/g, (digit) => digitMap[digit] || digit);
  }
  /**
   * Formats a number using the configured numbering system.
   *
   * @since 9.5.0
   * @param value The number to format.
   * @returns The formatted number as a string.
   */
  formatNumber(value) {
    return this.replaceDigits(value.toString());
  }
  /**
   * Returns the preferred ordering for month and year labels for the current
   * locale.
   */
  getMonthYearOrder() {
    const code = this.options.locale?.code;
    if (!code) {
      return "month-first";
    }
    return _DateLib.yearFirstLocales.has(code) ? "year-first" : "month-first";
  }
  /**
   * Formats the month/year pair respecting locale conventions.
   *
   * @since 9.11.0
   */
  formatMonthYear(date) {
    const { locale, timeZone, numerals } = this.options;
    const localeCode = locale?.code;
    if (localeCode && _DateLib.yearFirstLocales.has(localeCode)) {
      try {
        const intl = new Intl.DateTimeFormat(localeCode, {
          month: "long",
          year: "numeric",
          timeZone,
          numberingSystem: numerals
        });
        const formatted = intl.format(date);
        return formatted;
      } catch {
      }
    }
    const pattern = this.getMonthYearOrder() === "year-first" ? "y LLLL" : "LLLL y";
    return this.format(date, pattern);
  }
};
DateLib.yearFirstLocales = /* @__PURE__ */ new Set([
  "eu",
  "hu",
  "ja",
  "ja-Hira",
  "ja-JP",
  "ko",
  "ko-KR",
  "lt",
  "lt-LT",
  "lv",
  "lv-LV",
  "mn",
  "mn-MN",
  "zh",
  "zh-CN",
  "zh-HK",
  "zh-TW"
]);
var defaultDateLib = new DateLib();

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/classes/CalendarDay.js
var CalendarDay = class {
  constructor(date, displayMonth, dateLib = defaultDateLib) {
    this.date = date;
    this.displayMonth = displayMonth;
    this.outside = Boolean(displayMonth && !dateLib.isSameMonth(date, displayMonth));
    this.dateLib = dateLib;
    this.isoDate = dateLib.format(date, "yyyy-MM-dd");
    this.displayMonthId = dateLib.format(displayMonth, "yyyy-MM");
    this.dateMonthId = dateLib.format(date, "yyyy-MM");
  }
  /**
   * Checks if this day is equal to another `CalendarDay`, considering both the
   * date and the displayed month.
   *
   * @param day The `CalendarDay` to compare with.
   * @returns `true` if the days are equal, otherwise `false`.
   */
  isEqualTo(day) {
    return this.dateLib.isSameDay(day.date, this.date) && this.dateLib.isSameMonth(day.displayMonth, this.displayMonth);
  }
};

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/classes/CalendarMonth.js
var CalendarMonth = class {
  constructor(month, weeks) {
    this.date = month;
    this.weeks = weeks;
  }
};

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/classes/CalendarWeek.js
var CalendarWeek = class {
  constructor(weekNumber, days) {
    this.days = days;
    this.weekNumber = weekNumber;
  }
};

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/custom-components.js
var custom_components_exports = {};
__export(custom_components_exports, {
  CaptionLabel: () => CaptionLabel,
  Chevron: () => Chevron,
  Day: () => Day,
  DayButton: () => DayButton,
  Dropdown: () => Dropdown,
  DropdownNav: () => DropdownNav,
  Footer: () => Footer,
  Month: () => Month,
  MonthCaption: () => MonthCaption,
  MonthGrid: () => MonthGrid,
  Months: () => Months,
  MonthsDropdown: () => MonthsDropdown,
  Nav: () => Nav,
  NextMonthButton: () => NextMonthButton,
  Option: () => Option,
  PreviousMonthButton: () => PreviousMonthButton,
  Root: () => Root2,
  Select: () => Select,
  Week: () => Week,
  WeekNumber: () => WeekNumber,
  WeekNumberHeader: () => WeekNumberHeader,
  Weekday: () => Weekday,
  Weekdays: () => Weekdays,
  Weeks: () => Weeks,
  YearsDropdown: () => YearsDropdown
});

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/CaptionLabel.js
var import_react6 = __toESM(require_react(), 1);
function CaptionLabel(props) {
  return import_react6.default.createElement("span", { ...props });
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Chevron.js
var import_react7 = __toESM(require_react(), 1);
function Chevron(props) {
  const { size: size4 = 24, orientation = "left", className, style } = props;
  return import_react7.default.createElement(
    "svg",
    { className, style, width: size4, height: size4, viewBox: "0 0 24 24" },
    orientation === "up" && import_react7.default.createElement("polygon", { points: "6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28" }),
    orientation === "down" && import_react7.default.createElement("polygon", { points: "6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72" }),
    orientation === "left" && import_react7.default.createElement("polygon", { points: "16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20" }),
    orientation === "right" && import_react7.default.createElement("polygon", { points: "8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20" })
  );
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Day.js
var import_react8 = __toESM(require_react(), 1);
function Day(props) {
  const { day, modifiers, ...tdProps } = props;
  return import_react8.default.createElement("td", { ...tdProps });
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/DayButton.js
var import_react9 = __toESM(require_react(), 1);
function DayButton(props) {
  const { day, modifiers, ...buttonProps } = props;
  const ref = import_react9.default.useRef(null);
  import_react9.default.useEffect(() => {
    if (modifiers.focused)
      ref.current?.focus();
  }, [modifiers.focused]);
  return import_react9.default.createElement("button", { ref, ...buttonProps });
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Dropdown.js
var import_react11 = __toESM(require_react(), 1);

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/UI.js
var UI;
(function(UI2) {
  UI2["Root"] = "root";
  UI2["Chevron"] = "chevron";
  UI2["Day"] = "day";
  UI2["DayButton"] = "day_button";
  UI2["CaptionLabel"] = "caption_label";
  UI2["Dropdowns"] = "dropdowns";
  UI2["Dropdown"] = "dropdown";
  UI2["DropdownRoot"] = "dropdown_root";
  UI2["Footer"] = "footer";
  UI2["MonthGrid"] = "month_grid";
  UI2["MonthCaption"] = "month_caption";
  UI2["MonthsDropdown"] = "months_dropdown";
  UI2["Month"] = "month";
  UI2["Months"] = "months";
  UI2["Nav"] = "nav";
  UI2["NextMonthButton"] = "button_next";
  UI2["PreviousMonthButton"] = "button_previous";
  UI2["Week"] = "week";
  UI2["Weeks"] = "weeks";
  UI2["Weekday"] = "weekday";
  UI2["Weekdays"] = "weekdays";
  UI2["WeekNumber"] = "week_number";
  UI2["WeekNumberHeader"] = "week_number_header";
  UI2["YearsDropdown"] = "years_dropdown";
})(UI || (UI = {}));
var DayFlag;
(function(DayFlag2) {
  DayFlag2["disabled"] = "disabled";
  DayFlag2["hidden"] = "hidden";
  DayFlag2["outside"] = "outside";
  DayFlag2["focused"] = "focused";
  DayFlag2["today"] = "today";
})(DayFlag || (DayFlag = {}));
var SelectionState;
(function(SelectionState2) {
  SelectionState2["range_end"] = "range_end";
  SelectionState2["range_middle"] = "range_middle";
  SelectionState2["range_start"] = "range_start";
  SelectionState2["selected"] = "selected";
})(SelectionState || (SelectionState = {}));
var Animation;
(function(Animation2) {
  Animation2["weeks_before_enter"] = "weeks_before_enter";
  Animation2["weeks_before_exit"] = "weeks_before_exit";
  Animation2["weeks_after_enter"] = "weeks_after_enter";
  Animation2["weeks_after_exit"] = "weeks_after_exit";
  Animation2["caption_after_enter"] = "caption_after_enter";
  Animation2["caption_after_exit"] = "caption_after_exit";
  Animation2["caption_before_enter"] = "caption_before_enter";
  Animation2["caption_before_exit"] = "caption_before_exit";
})(Animation || (Animation = {}));

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/useDayPicker.js
var import_react10 = __toESM(require_react(), 1);
var dayPickerContext = (0, import_react10.createContext)(void 0);
function useDayPicker() {
  const context = (0, import_react10.useContext)(dayPickerContext);
  if (context === void 0) {
    throw new Error("useDayPicker() must be used within a custom component.");
  }
  return context;
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Dropdown.js
function Dropdown(props) {
  const { options, className, ...selectProps } = props;
  const { classNames, components, styles } = useDayPicker();
  const cssClassSelect = [classNames[UI.Dropdown], className].join(" ");
  const selectedOption = options?.find(({ value }) => value === selectProps.value);
  return import_react11.default.createElement(
    "span",
    { "data-disabled": selectProps.disabled, className: classNames[UI.DropdownRoot], style: styles?.[UI.DropdownRoot] },
    import_react11.default.createElement(components.Select, { className: cssClassSelect, ...selectProps }, options?.map(({ value, label, disabled: disabled2 }) => import_react11.default.createElement(components.Option, { key: value, value, disabled: disabled2 }, label))),
    import_react11.default.createElement(
      "span",
      { className: classNames[UI.CaptionLabel], style: styles?.[UI.CaptionLabel], "aria-hidden": true },
      selectedOption?.label,
      import_react11.default.createElement(components.Chevron, { orientation: "down", size: 18, className: classNames[UI.Chevron], style: styles?.[UI.Chevron] })
    )
  );
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/DropdownNav.js
var import_react12 = __toESM(require_react(), 1);
function DropdownNav(props) {
  return import_react12.default.createElement("div", { ...props });
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Footer.js
var import_react13 = __toESM(require_react(), 1);
function Footer(props) {
  return import_react13.default.createElement("div", { ...props });
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Month.js
var import_react14 = __toESM(require_react(), 1);
function Month(props) {
  const { calendarMonth, displayIndex, ...divProps } = props;
  return import_react14.default.createElement("div", { ...divProps }, props.children);
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/MonthCaption.js
var import_react15 = __toESM(require_react(), 1);
function MonthCaption(props) {
  const { calendarMonth, displayIndex, ...divProps } = props;
  return import_react15.default.createElement("div", { ...divProps });
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/MonthGrid.js
var import_react16 = __toESM(require_react(), 1);
function MonthGrid(props) {
  return import_react16.default.createElement("table", { ...props });
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Months.js
var import_react17 = __toESM(require_react(), 1);
function Months(props) {
  return import_react17.default.createElement("div", { ...props });
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/MonthsDropdown.js
var import_react18 = __toESM(require_react(), 1);
function MonthsDropdown(props) {
  const { components } = useDayPicker();
  return import_react18.default.createElement(components.Dropdown, { ...props });
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Nav.js
var import_react19 = __toESM(require_react(), 1);
function Nav(props) {
  const { onPreviousClick, onNextClick, previousMonth, nextMonth, ...navProps } = props;
  const { components, classNames, styles, labels: { labelPrevious: labelPrevious2, labelNext: labelNext2 } } = useDayPicker();
  const handleNextClick = (0, import_react19.useCallback)((e) => {
    if (nextMonth) {
      onNextClick?.(e);
    }
  }, [nextMonth, onNextClick]);
  const handlePreviousClick = (0, import_react19.useCallback)((e) => {
    if (previousMonth) {
      onPreviousClick?.(e);
    }
  }, [previousMonth, onPreviousClick]);
  return import_react19.default.createElement(
    "nav",
    { ...navProps },
    import_react19.default.createElement(
      components.PreviousMonthButton,
      { type: "button", className: classNames[UI.PreviousMonthButton], style: styles?.[UI.PreviousMonthButton], tabIndex: previousMonth ? void 0 : -1, "aria-disabled": previousMonth ? void 0 : true, "aria-label": labelPrevious2(previousMonth), onClick: handlePreviousClick },
      import_react19.default.createElement(components.Chevron, { disabled: previousMonth ? void 0 : true, className: classNames[UI.Chevron], style: styles?.[UI.Chevron], orientation: "left" })
    ),
    import_react19.default.createElement(
      components.NextMonthButton,
      { type: "button", className: classNames[UI.NextMonthButton], style: styles?.[UI.NextMonthButton], tabIndex: nextMonth ? void 0 : -1, "aria-disabled": nextMonth ? void 0 : true, "aria-label": labelNext2(nextMonth), onClick: handleNextClick },
      import_react19.default.createElement(components.Chevron, { disabled: nextMonth ? void 0 : true, orientation: "right", className: classNames[UI.Chevron], style: styles?.[UI.Chevron] })
    )
  );
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/NextMonthButton.js
var import_react20 = __toESM(require_react(), 1);
function NextMonthButton(props) {
  return import_react20.default.createElement("button", { ...props });
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Option.js
var import_react21 = __toESM(require_react(), 1);
function Option(props) {
  return import_react21.default.createElement("option", { ...props });
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/PreviousMonthButton.js
var import_react22 = __toESM(require_react(), 1);
function PreviousMonthButton(props) {
  return import_react22.default.createElement("button", { ...props });
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Root.js
var import_react23 = __toESM(require_react(), 1);
function Root2(props) {
  const { rootRef, ...rest } = props;
  return import_react23.default.createElement("div", { ...rest, ref: rootRef });
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Select.js
var import_react24 = __toESM(require_react(), 1);
function Select(props) {
  return import_react24.default.createElement("select", { ...props });
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Week.js
var import_react25 = __toESM(require_react(), 1);
function Week(props) {
  const { week, ...trProps } = props;
  return import_react25.default.createElement("tr", { ...trProps });
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Weekday.js
var import_react26 = __toESM(require_react(), 1);
function Weekday(props) {
  return import_react26.default.createElement("th", { ...props });
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Weekdays.js
var import_react27 = __toESM(require_react(), 1);
function Weekdays(props) {
  return import_react27.default.createElement(
    "thead",
    { "aria-hidden": true },
    import_react27.default.createElement("tr", { ...props })
  );
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/WeekNumber.js
var import_react28 = __toESM(require_react(), 1);
function WeekNumber(props) {
  const { week, ...thProps } = props;
  return import_react28.default.createElement("th", { ...thProps });
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/WeekNumberHeader.js
var import_react29 = __toESM(require_react(), 1);
function WeekNumberHeader(props) {
  return import_react29.default.createElement("th", { ...props });
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Weeks.js
var import_react30 = __toESM(require_react(), 1);
function Weeks(props) {
  return import_react30.default.createElement("tbody", { ...props });
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/YearsDropdown.js
var import_react31 = __toESM(require_react(), 1);
function YearsDropdown(props) {
  const { components } = useDayPicker();
  return import_react31.default.createElement(components.Dropdown, { ...props });
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/DayPicker.js
var import_react36 = __toESM(require_react(), 1);

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/rangeIncludesDate.js
function rangeIncludesDate(range, date, excludeEnds = false, dateLib = defaultDateLib) {
  let { from, to } = range;
  const { differenceInCalendarDays: differenceInCalendarDays2, isSameDay: isSameDay2 } = dateLib;
  if (from && to) {
    const isRangeInverted = differenceInCalendarDays2(to, from) < 0;
    if (isRangeInverted) {
      [from, to] = [to, from];
    }
    const isInRange = differenceInCalendarDays2(date, from) >= (excludeEnds ? 1 : 0) && differenceInCalendarDays2(to, date) >= (excludeEnds ? 1 : 0);
    return isInRange;
  }
  if (!excludeEnds && to) {
    return isSameDay2(to, date);
  }
  if (!excludeEnds && from) {
    return isSameDay2(from, date);
  }
  return false;
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/typeguards.js
function isDateInterval(matcher) {
  return Boolean(matcher && typeof matcher === "object" && "before" in matcher && "after" in matcher);
}
function isDateRange(value) {
  return Boolean(value && typeof value === "object" && "from" in value);
}
function isDateAfterType(value) {
  return Boolean(value && typeof value === "object" && "after" in value);
}
function isDateBeforeType(value) {
  return Boolean(value && typeof value === "object" && "before" in value);
}
function isDayOfWeekType(value) {
  return Boolean(value && typeof value === "object" && "dayOfWeek" in value);
}
function isDatesArray(value, dateLib) {
  return Array.isArray(value) && value.every(dateLib.isDate);
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/dateMatchModifiers.js
function dateMatchModifiers(date, matchers, dateLib = defaultDateLib) {
  const matchersArr = !Array.isArray(matchers) ? [matchers] : matchers;
  const { isSameDay: isSameDay2, differenceInCalendarDays: differenceInCalendarDays2, isAfter: isAfter2 } = dateLib;
  return matchersArr.some((matcher) => {
    if (typeof matcher === "boolean") {
      return matcher;
    }
    if (dateLib.isDate(matcher)) {
      return isSameDay2(date, matcher);
    }
    if (isDatesArray(matcher, dateLib)) {
      return matcher.some((matcherDate) => isSameDay2(date, matcherDate));
    }
    if (isDateRange(matcher)) {
      return rangeIncludesDate(matcher, date, false, dateLib);
    }
    if (isDayOfWeekType(matcher)) {
      if (!Array.isArray(matcher.dayOfWeek)) {
        return matcher.dayOfWeek === date.getDay();
      }
      return matcher.dayOfWeek.includes(date.getDay());
    }
    if (isDateInterval(matcher)) {
      const diffBefore = differenceInCalendarDays2(matcher.before, date);
      const diffAfter = differenceInCalendarDays2(matcher.after, date);
      const isDayBefore = diffBefore > 0;
      const isDayAfter = diffAfter < 0;
      const isClosedInterval = isAfter2(matcher.before, matcher.after);
      if (isClosedInterval) {
        return isDayAfter && isDayBefore;
      } else {
        return isDayBefore || isDayAfter;
      }
    }
    if (isDateAfterType(matcher)) {
      return differenceInCalendarDays2(date, matcher.after) > 0;
    }
    if (isDateBeforeType(matcher)) {
      return differenceInCalendarDays2(matcher.before, date) > 0;
    }
    if (typeof matcher === "function") {
      return matcher(date);
    }
    return false;
  });
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/createGetModifiers.js
function createGetModifiers(days, props, navStart, navEnd, dateLib) {
  const { disabled: disabled2, hidden, modifiers, showOutsideDays, broadcastCalendar, today = dateLib.today() } = props;
  const { isSameDay: isSameDay2, isSameMonth: isSameMonth2, startOfMonth: startOfMonth2, isBefore: isBefore2, endOfMonth: endOfMonth2, isAfter: isAfter2 } = dateLib;
  const computedNavStart = navStart && startOfMonth2(navStart);
  const computedNavEnd = navEnd && endOfMonth2(navEnd);
  const internalModifiersMap = {
    [DayFlag.focused]: [],
    [DayFlag.outside]: [],
    [DayFlag.disabled]: [],
    [DayFlag.hidden]: [],
    [DayFlag.today]: []
  };
  const customModifiersMap = {};
  for (const day of days) {
    const { date, displayMonth } = day;
    const isOutside = Boolean(displayMonth && !isSameMonth2(date, displayMonth));
    const isBeforeNavStart = Boolean(computedNavStart && isBefore2(date, computedNavStart));
    const isAfterNavEnd = Boolean(computedNavEnd && isAfter2(date, computedNavEnd));
    const isDisabled = Boolean(disabled2 && dateMatchModifiers(date, disabled2, dateLib));
    const isHidden = Boolean(hidden && dateMatchModifiers(date, hidden, dateLib)) || isBeforeNavStart || isAfterNavEnd || // Broadcast calendar will show outside days as default
    !broadcastCalendar && !showOutsideDays && isOutside || broadcastCalendar && showOutsideDays === false && isOutside;
    const isToday = isSameDay2(date, today);
    if (isOutside)
      internalModifiersMap.outside.push(day);
    if (isDisabled)
      internalModifiersMap.disabled.push(day);
    if (isHidden)
      internalModifiersMap.hidden.push(day);
    if (isToday)
      internalModifiersMap.today.push(day);
    if (modifiers) {
      Object.keys(modifiers).forEach((name) => {
        const modifierValue = modifiers?.[name];
        const isMatch = modifierValue ? dateMatchModifiers(date, modifierValue, dateLib) : false;
        if (!isMatch)
          return;
        if (customModifiersMap[name]) {
          customModifiersMap[name].push(day);
        } else {
          customModifiersMap[name] = [day];
        }
      });
    }
  }
  return (day) => {
    const dayFlags = {
      [DayFlag.focused]: false,
      [DayFlag.disabled]: false,
      [DayFlag.hidden]: false,
      [DayFlag.outside]: false,
      [DayFlag.today]: false
    };
    const customModifiers = {};
    for (const name in internalModifiersMap) {
      const days2 = internalModifiersMap[name];
      dayFlags[name] = days2.some((d) => d === day);
    }
    for (const name in customModifiersMap) {
      customModifiers[name] = customModifiersMap[name].some((d) => d === day);
    }
    return {
      ...dayFlags,
      // custom modifiers should override all the previous ones
      ...customModifiers
    };
  };
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getClassNamesForModifiers.js
function getClassNamesForModifiers(modifiers, classNames, modifiersClassNames = {}) {
  const modifierClassNames = Object.entries(modifiers).filter(([, active]) => active === true).reduce((previousValue, [key]) => {
    if (modifiersClassNames[key]) {
      previousValue.push(modifiersClassNames[key]);
    } else if (classNames[DayFlag[key]]) {
      previousValue.push(classNames[DayFlag[key]]);
    } else if (classNames[SelectionState[key]]) {
      previousValue.push(classNames[SelectionState[key]]);
    }
    return previousValue;
  }, [classNames[UI.Day]]);
  return modifierClassNames;
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getComponents.js
function getComponents(customComponents) {
  return {
    ...custom_components_exports,
    ...customComponents
  };
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getDataAttributes.js
function getDataAttributes(props) {
  const dataAttributes = {
    "data-mode": props.mode ?? void 0,
    "data-required": "required" in props ? props.required : void 0,
    "data-multiple-months": props.numberOfMonths && props.numberOfMonths > 1 || void 0,
    "data-week-numbers": props.showWeekNumber || void 0,
    "data-broadcast-calendar": props.broadcastCalendar || void 0,
    "data-nav-layout": props.navLayout || void 0
  };
  Object.entries(props).forEach(([key, val]) => {
    if (key.startsWith("data-")) {
      dataAttributes[key] = val;
    }
  });
  return dataAttributes;
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getDefaultClassNames.js
function getDefaultClassNames() {
  const classNames = {};
  for (const key in UI) {
    classNames[UI[key]] = `rdp-${UI[key]}`;
  }
  for (const key in DayFlag) {
    classNames[DayFlag[key]] = `rdp-${DayFlag[key]}`;
  }
  for (const key in SelectionState) {
    classNames[SelectionState[key]] = `rdp-${SelectionState[key]}`;
  }
  for (const key in Animation) {
    classNames[Animation[key]] = `rdp-${Animation[key]}`;
  }
  return classNames;
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/formatters/index.js
var formatters_exports = {};
__export(formatters_exports, {
  formatCaption: () => formatCaption,
  formatDay: () => formatDay,
  formatMonthDropdown: () => formatMonthDropdown,
  formatWeekNumber: () => formatWeekNumber,
  formatWeekNumberHeader: () => formatWeekNumberHeader,
  formatWeekdayName: () => formatWeekdayName,
  formatYearDropdown: () => formatYearDropdown
});

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/formatters/formatCaption.js
function formatCaption(month, options, dateLib) {
  const lib = dateLib ?? new DateLib(options);
  return lib.formatMonthYear(month);
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/formatters/formatDay.js
function formatDay(date, options, dateLib) {
  return (dateLib ?? new DateLib(options)).format(date, "d");
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/formatters/formatMonthDropdown.js
function formatMonthDropdown(month, dateLib = defaultDateLib) {
  return dateLib.format(month, "LLLL");
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/formatters/formatWeekdayName.js
function formatWeekdayName(weekday, options, dateLib) {
  return (dateLib ?? new DateLib(options)).format(weekday, "cccccc");
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/formatters/formatWeekNumber.js
function formatWeekNumber(weekNumber, dateLib = defaultDateLib) {
  if (weekNumber < 10) {
    return dateLib.formatNumber(`0${weekNumber.toLocaleString()}`);
  }
  return dateLib.formatNumber(`${weekNumber.toLocaleString()}`);
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/formatters/formatWeekNumberHeader.js
function formatWeekNumberHeader() {
  return ``;
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/formatters/formatYearDropdown.js
function formatYearDropdown(year, dateLib = defaultDateLib) {
  return dateLib.format(year, "yyyy");
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getFormatters.js
function getFormatters(customFormatters) {
  return {
    ...formatters_exports,
    ...customFormatters
  };
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/index.js
var labels_exports = {};
__export(labels_exports, {
  labelDayButton: () => labelDayButton,
  labelGrid: () => labelGrid,
  labelGridcell: () => labelGridcell,
  labelMonthDropdown: () => labelMonthDropdown,
  labelNav: () => labelNav,
  labelNext: () => labelNext,
  labelPrevious: () => labelPrevious,
  labelWeekNumber: () => labelWeekNumber,
  labelWeekNumberHeader: () => labelWeekNumberHeader,
  labelWeekday: () => labelWeekday,
  labelYearDropdown: () => labelYearDropdown
});

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelDayButton.js
function labelDayButton(date, modifiers, options, dateLib) {
  let label = (dateLib ?? new DateLib(options)).format(date, "PPPP");
  if (modifiers.today)
    label = `Today, ${label}`;
  if (modifiers.selected)
    label = `${label}, selected`;
  return label;
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelGrid.js
function labelGrid(date, options, dateLib) {
  const lib = dateLib ?? new DateLib(options);
  return lib.formatMonthYear(date);
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelGridcell.js
function labelGridcell(date, modifiers, options, dateLib) {
  let label = (dateLib ?? new DateLib(options)).format(date, "PPPP");
  if (modifiers?.today) {
    label = `Today, ${label}`;
  }
  return label;
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelMonthDropdown.js
function labelMonthDropdown(_options) {
  return "Choose the Month";
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelNav.js
function labelNav() {
  return "";
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelNext.js
var defaultLabel = "Go to the Next Month";
function labelNext(_month, _options) {
  return defaultLabel;
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelPrevious.js
function labelPrevious(_month) {
  return "Go to the Previous Month";
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelWeekday.js
function labelWeekday(date, options, dateLib) {
  return (dateLib ?? new DateLib(options)).format(date, "cccc");
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelWeekNumber.js
function labelWeekNumber(weekNumber, _options) {
  return `Week ${weekNumber}`;
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelWeekNumberHeader.js
function labelWeekNumberHeader(_options) {
  return "Week Number";
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelYearDropdown.js
function labelYearDropdown(_options) {
  return "Choose the Year";
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getLabels.js
var resolveLabel = (defaultLabel2, customLabel, localeLabel) => {
  if (customLabel)
    return customLabel;
  if (localeLabel) {
    return typeof localeLabel === "function" ? localeLabel : (..._args) => localeLabel;
  }
  return defaultLabel2;
};
function getLabels(customLabels, options) {
  const localeLabels = options.locale?.labels ?? {};
  return {
    ...labels_exports,
    ...customLabels ?? {},
    labelDayButton: resolveLabel(labelDayButton, customLabels?.labelDayButton, localeLabels.labelDayButton),
    labelMonthDropdown: resolveLabel(labelMonthDropdown, customLabels?.labelMonthDropdown, localeLabels.labelMonthDropdown),
    labelNext: resolveLabel(labelNext, customLabels?.labelNext, localeLabels.labelNext),
    labelPrevious: resolveLabel(labelPrevious, customLabels?.labelPrevious, localeLabels.labelPrevious),
    labelWeekNumber: resolveLabel(labelWeekNumber, customLabels?.labelWeekNumber, localeLabels.labelWeekNumber),
    labelYearDropdown: resolveLabel(labelYearDropdown, customLabels?.labelYearDropdown, localeLabels.labelYearDropdown),
    labelGrid: resolveLabel(labelGrid, customLabels?.labelGrid, localeLabels.labelGrid),
    labelGridcell: resolveLabel(labelGridcell, customLabels?.labelGridcell, localeLabels.labelGridcell),
    labelNav: resolveLabel(labelNav, customLabels?.labelNav, localeLabels.labelNav),
    labelWeekNumberHeader: resolveLabel(labelWeekNumberHeader, customLabels?.labelWeekNumberHeader, localeLabels.labelWeekNumberHeader),
    labelWeekday: resolveLabel(labelWeekday, customLabels?.labelWeekday, localeLabels.labelWeekday)
  };
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getMonthOptions.js
function getMonthOptions(displayMonth, navStart, navEnd, formatters2, dateLib) {
  const { startOfMonth: startOfMonth2, startOfYear: startOfYear2, endOfYear: endOfYear2, eachMonthOfInterval: eachMonthOfInterval2, getMonth: getMonth2 } = dateLib;
  const months = eachMonthOfInterval2({
    start: startOfYear2(displayMonth),
    end: endOfYear2(displayMonth)
  });
  const options = months.map((month) => {
    const label = formatters2.formatMonthDropdown(month, dateLib);
    const value = getMonth2(month);
    const disabled2 = navStart && month < startOfMonth2(navStart) || navEnd && month > startOfMonth2(navEnd) || false;
    return { value, label, disabled: disabled2 };
  });
  return options;
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getStyleForModifiers.js
function getStyleForModifiers(dayModifiers, styles = {}, modifiersStyles = {}) {
  let style = { ...styles?.[UI.Day] };
  Object.entries(dayModifiers).filter(([, active]) => active === true).forEach(([modifier]) => {
    style = {
      ...style,
      ...modifiersStyles?.[modifier]
    };
  });
  return style;
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getWeekdays.js
function getWeekdays(dateLib, ISOWeek, broadcastCalendar, today) {
  const referenceToday = today ?? dateLib.today();
  const start = broadcastCalendar ? dateLib.startOfBroadcastWeek(referenceToday, dateLib) : ISOWeek ? dateLib.startOfISOWeek(referenceToday) : dateLib.startOfWeek(referenceToday);
  const days = [];
  for (let i = 0; i < 7; i++) {
    const day = dateLib.addDays(start, i);
    days.push(day);
  }
  return days;
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getYearOptions.js
function getYearOptions(navStart, navEnd, formatters2, dateLib, reverse = false) {
  if (!navStart)
    return void 0;
  if (!navEnd)
    return void 0;
  const { startOfYear: startOfYear2, endOfYear: endOfYear2, eachYearOfInterval: eachYearOfInterval2, getYear: getYear2 } = dateLib;
  const firstNavYear = startOfYear2(navStart);
  const lastNavYear = endOfYear2(navEnd);
  const years = eachYearOfInterval2({ start: firstNavYear, end: lastNavYear });
  if (reverse)
    years.reverse();
  return years.map((year) => {
    const label = formatters2.formatYearDropdown(year, dateLib);
    return {
      value: getYear2(year),
      label,
      disabled: false
    };
  });
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/noonDateLib.js
function createNoonOverrides(timeZone, options = {}) {
  const { weekStartsOn, locale } = options;
  const fallbackWeekStartsOn = weekStartsOn ?? locale?.options?.weekStartsOn ?? 0;
  const toNoonTZDate = (date) => {
    const normalizedDate = typeof date === "number" || typeof date === "string" ? new Date(date) : date;
    return new TZDate(normalizedDate.getFullYear(), normalizedDate.getMonth(), normalizedDate.getDate(), 12, 0, 0, timeZone);
  };
  const toCalendarDate2 = (date) => {
    const zoned = toNoonTZDate(date);
    return new Date(zoned.getFullYear(), zoned.getMonth(), zoned.getDate(), 0, 0, 0, 0);
  };
  return {
    today: () => {
      return toNoonTZDate(TZDate.tz(timeZone));
    },
    newDate: (year, monthIndex, date) => {
      return new TZDate(year, monthIndex, date, 12, 0, 0, timeZone);
    },
    startOfDay: (date) => {
      return toNoonTZDate(date);
    },
    startOfWeek: (date, options2) => {
      const base = toNoonTZDate(date);
      const weekStartsOnValue = options2?.weekStartsOn ?? fallbackWeekStartsOn;
      const diff = (base.getDay() - weekStartsOnValue + 7) % 7;
      base.setDate(base.getDate() - diff);
      return base;
    },
    startOfISOWeek: (date) => {
      const base = toNoonTZDate(date);
      const diff = (base.getDay() - 1 + 7) % 7;
      base.setDate(base.getDate() - diff);
      return base;
    },
    startOfMonth: (date) => {
      const base = toNoonTZDate(date);
      base.setDate(1);
      return base;
    },
    startOfYear: (date) => {
      const base = toNoonTZDate(date);
      base.setMonth(0, 1);
      return base;
    },
    endOfWeek: (date, options2) => {
      const base = toNoonTZDate(date);
      const weekStartsOnValue = options2?.weekStartsOn ?? fallbackWeekStartsOn;
      const endDow = (weekStartsOnValue + 6) % 7;
      const diff = (endDow - base.getDay() + 7) % 7;
      base.setDate(base.getDate() + diff);
      return base;
    },
    endOfISOWeek: (date) => {
      const base = toNoonTZDate(date);
      const diff = (7 - base.getDay()) % 7;
      base.setDate(base.getDate() + diff);
      return base;
    },
    endOfMonth: (date) => {
      const base = toNoonTZDate(date);
      base.setMonth(base.getMonth() + 1, 0);
      return base;
    },
    endOfYear: (date) => {
      const base = toNoonTZDate(date);
      base.setMonth(11, 31);
      return base;
    },
    eachMonthOfInterval: (interval) => {
      const start = toNoonTZDate(interval.start);
      const end = toNoonTZDate(interval.end);
      const result = [];
      const cursor = new TZDate(start.getFullYear(), start.getMonth(), 1, 12, 0, 0, timeZone);
      const endKey = end.getFullYear() * 12 + end.getMonth();
      while (cursor.getFullYear() * 12 + cursor.getMonth() <= endKey) {
        result.push(new TZDate(cursor, timeZone));
        cursor.setMonth(cursor.getMonth() + 1, 1);
      }
      return result;
    },
    // Normalize to noon once before arithmetic (avoid DST/midnight edge cases),
    // mutate the same TZDate, and return it.
    addDays: (date, amount) => {
      const base = toNoonTZDate(date);
      base.setDate(base.getDate() + amount);
      return base;
    },
    addWeeks: (date, amount) => {
      const base = toNoonTZDate(date);
      base.setDate(base.getDate() + amount * 7);
      return base;
    },
    addMonths: (date, amount) => {
      const base = toNoonTZDate(date);
      base.setMonth(base.getMonth() + amount);
      return base;
    },
    addYears: (date, amount) => {
      const base = toNoonTZDate(date);
      base.setFullYear(base.getFullYear() + amount);
      return base;
    },
    eachYearOfInterval: (interval) => {
      const start = toNoonTZDate(interval.start);
      const end = toNoonTZDate(interval.end);
      const years = [];
      const cursor = new TZDate(start.getFullYear(), 0, 1, 12, 0, 0, timeZone);
      while (cursor.getFullYear() <= end.getFullYear()) {
        years.push(new TZDate(cursor, timeZone));
        cursor.setFullYear(cursor.getFullYear() + 1, 0, 1);
      }
      return years;
    },
    getWeek: (date, options2) => {
      const base = toCalendarDate2(date);
      return getWeek(base, {
        weekStartsOn: options2?.weekStartsOn ?? fallbackWeekStartsOn,
        firstWeekContainsDate: options2?.firstWeekContainsDate ?? locale?.options?.firstWeekContainsDate ?? 1
      });
    },
    getISOWeek: (date) => {
      const base = toCalendarDate2(date);
      return getISOWeek(base);
    },
    differenceInCalendarDays: (dateLeft, dateRight) => {
      const left = toCalendarDate2(dateLeft);
      const right = toCalendarDate2(dateRight);
      return differenceInCalendarDays(left, right);
    },
    differenceInCalendarMonths: (dateLeft, dateRight) => {
      const left = toCalendarDate2(dateLeft);
      const right = toCalendarDate2(dateRight);
      return differenceInCalendarMonths(left, right);
    }
  };
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/useAnimation.js
var import_react32 = __toESM(require_react(), 1);
var asHtmlElement = (element) => {
  if (element instanceof HTMLElement)
    return element;
  return null;
};
var queryMonthEls = (element) => [
  ...element.querySelectorAll("[data-animated-month]") ?? []
];
var queryMonthEl = (element) => asHtmlElement(element.querySelector("[data-animated-month]"));
var queryCaptionEl = (element) => asHtmlElement(element.querySelector("[data-animated-caption]"));
var queryWeeksEl = (element) => asHtmlElement(element.querySelector("[data-animated-weeks]"));
var queryNavEl = (element) => asHtmlElement(element.querySelector("[data-animated-nav]"));
var queryWeekdaysEl = (element) => asHtmlElement(element.querySelector("[data-animated-weekdays]"));
function useAnimation(rootElRef, enabled, { classNames, months, focused, dateLib }) {
  const previousRootElSnapshotRef = (0, import_react32.useRef)(null);
  const previousMonthsRef = (0, import_react32.useRef)(months);
  const animatingRef = (0, import_react32.useRef)(false);
  (0, import_react32.useLayoutEffect)(() => {
    const previousMonths = previousMonthsRef.current;
    previousMonthsRef.current = months;
    if (!enabled || !rootElRef.current || // safety check because the ref can be set to anything by consumers
    !(rootElRef.current instanceof HTMLElement) || // validation required for the animation to work as expected
    months.length === 0 || previousMonths.length === 0 || months.length !== previousMonths.length) {
      return;
    }
    const isSameMonth2 = dateLib.isSameMonth(months[0].date, previousMonths[0].date);
    const isAfterPreviousMonth = dateLib.isAfter(months[0].date, previousMonths[0].date);
    const captionAnimationClass = isAfterPreviousMonth ? classNames[Animation.caption_after_enter] : classNames[Animation.caption_before_enter];
    const weeksAnimationClass = isAfterPreviousMonth ? classNames[Animation.weeks_after_enter] : classNames[Animation.weeks_before_enter];
    const previousRootElSnapshot = previousRootElSnapshotRef.current;
    const rootElSnapshot = rootElRef.current.cloneNode(true);
    if (rootElSnapshot instanceof HTMLElement) {
      const currentMonthElsSnapshot = queryMonthEls(rootElSnapshot);
      currentMonthElsSnapshot.forEach((currentMonthElSnapshot) => {
        if (!(currentMonthElSnapshot instanceof HTMLElement))
          return;
        const previousMonthElSnapshot = queryMonthEl(currentMonthElSnapshot);
        if (previousMonthElSnapshot && currentMonthElSnapshot.contains(previousMonthElSnapshot)) {
          currentMonthElSnapshot.removeChild(previousMonthElSnapshot);
        }
        const captionEl = queryCaptionEl(currentMonthElSnapshot);
        if (captionEl) {
          captionEl.classList.remove(captionAnimationClass);
        }
        const weeksEl = queryWeeksEl(currentMonthElSnapshot);
        if (weeksEl) {
          weeksEl.classList.remove(weeksAnimationClass);
        }
      });
      previousRootElSnapshotRef.current = rootElSnapshot;
    } else {
      previousRootElSnapshotRef.current = null;
    }
    if (animatingRef.current || isSameMonth2 || // skip animation if a day is focused because it can cause issues to the animation and is better for a11y
    focused) {
      return;
    }
    const previousMonthEls = previousRootElSnapshot instanceof HTMLElement ? queryMonthEls(previousRootElSnapshot) : [];
    const currentMonthEls = queryMonthEls(rootElRef.current);
    if (currentMonthEls?.every((el) => el instanceof HTMLElement) && previousMonthEls?.every((el) => el instanceof HTMLElement)) {
      animatingRef.current = true;
      const cleanUpFunctions = [];
      rootElRef.current.style.isolation = "isolate";
      const navEl = queryNavEl(rootElRef.current);
      if (navEl) {
        navEl.style.zIndex = "1";
      }
      currentMonthEls.forEach((currentMonthEl, index3) => {
        const previousMonthEl = previousMonthEls[index3];
        if (!previousMonthEl) {
          return;
        }
        currentMonthEl.style.position = "relative";
        currentMonthEl.style.overflow = "hidden";
        const captionEl = queryCaptionEl(currentMonthEl);
        if (captionEl) {
          captionEl.classList.add(captionAnimationClass);
        }
        const weeksEl = queryWeeksEl(currentMonthEl);
        if (weeksEl) {
          weeksEl.classList.add(weeksAnimationClass);
        }
        const cleanUp = () => {
          animatingRef.current = false;
          if (rootElRef.current) {
            rootElRef.current.style.isolation = "";
          }
          if (navEl) {
            navEl.style.zIndex = "";
          }
          if (captionEl) {
            captionEl.classList.remove(captionAnimationClass);
          }
          if (weeksEl) {
            weeksEl.classList.remove(weeksAnimationClass);
          }
          currentMonthEl.style.position = "";
          currentMonthEl.style.overflow = "";
          if (currentMonthEl.contains(previousMonthEl)) {
            currentMonthEl.removeChild(previousMonthEl);
          }
        };
        cleanUpFunctions.push(cleanUp);
        previousMonthEl.style.pointerEvents = "none";
        previousMonthEl.style.position = "absolute";
        previousMonthEl.style.overflow = "hidden";
        previousMonthEl.setAttribute("aria-hidden", "true");
        const previousWeekdaysEl = queryWeekdaysEl(previousMonthEl);
        if (previousWeekdaysEl) {
          previousWeekdaysEl.style.opacity = "0";
        }
        const previousCaptionEl = queryCaptionEl(previousMonthEl);
        if (previousCaptionEl) {
          previousCaptionEl.classList.add(isAfterPreviousMonth ? classNames[Animation.caption_before_exit] : classNames[Animation.caption_after_exit]);
          previousCaptionEl.addEventListener("animationend", cleanUp);
        }
        const previousWeeksEl = queryWeeksEl(previousMonthEl);
        if (previousWeeksEl) {
          previousWeeksEl.classList.add(isAfterPreviousMonth ? classNames[Animation.weeks_before_exit] : classNames[Animation.weeks_after_exit]);
        }
        currentMonthEl.insertBefore(previousMonthEl, currentMonthEl.firstChild);
      });
    }
  });
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/useCalendar.js
var import_react34 = __toESM(require_react(), 1);

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getDates.js
function getDates(displayMonths, maxDate, props, dateLib) {
  const firstMonth = displayMonths[0];
  const lastMonth = displayMonths[displayMonths.length - 1];
  const { ISOWeek, fixedWeeks, broadcastCalendar } = props ?? {};
  const { addDays: addDays2, differenceInCalendarDays: differenceInCalendarDays2, differenceInCalendarMonths: differenceInCalendarMonths2, endOfBroadcastWeek: endOfBroadcastWeek2, endOfISOWeek: endOfISOWeek2, endOfMonth: endOfMonth2, endOfWeek: endOfWeek2, isAfter: isAfter2, startOfBroadcastWeek: startOfBroadcastWeek2, startOfISOWeek: startOfISOWeek2, startOfWeek: startOfWeek2 } = dateLib;
  const startWeekFirstDate = broadcastCalendar ? startOfBroadcastWeek2(firstMonth, dateLib) : ISOWeek ? startOfISOWeek2(firstMonth) : startOfWeek2(firstMonth);
  const displayMonthsWeekEnd = broadcastCalendar ? endOfBroadcastWeek2(lastMonth) : ISOWeek ? endOfISOWeek2(endOfMonth2(lastMonth)) : endOfWeek2(endOfMonth2(lastMonth));
  const constraintWeekEnd = maxDate && (broadcastCalendar ? endOfBroadcastWeek2(maxDate) : ISOWeek ? endOfISOWeek2(maxDate) : endOfWeek2(maxDate));
  const gridEndDate = constraintWeekEnd && isAfter2(displayMonthsWeekEnd, constraintWeekEnd) ? constraintWeekEnd : displayMonthsWeekEnd;
  const nOfDays = differenceInCalendarDays2(gridEndDate, startWeekFirstDate);
  const nOfMonths = differenceInCalendarMonths2(lastMonth, firstMonth) + 1;
  const dates = [];
  for (let i = 0; i <= nOfDays; i++) {
    const date = addDays2(startWeekFirstDate, i);
    dates.push(date);
  }
  const nrOfDaysWithFixedWeeks = broadcastCalendar ? 35 : 42;
  const extraDates = nrOfDaysWithFixedWeeks * nOfMonths;
  if (fixedWeeks && dates.length < extraDates) {
    const daysToAdd = extraDates - dates.length;
    for (let i = 0; i < daysToAdd; i++) {
      const date = addDays2(dates[dates.length - 1], 1);
      dates.push(date);
    }
  }
  return dates;
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getDays.js
function getDays(calendarMonths) {
  const initialDays = [];
  return calendarMonths.reduce((days, month) => {
    const weekDays = month.weeks.reduce((weekDays2, week) => {
      return weekDays2.concat(week.days.slice());
    }, initialDays.slice());
    return days.concat(weekDays.slice());
  }, initialDays.slice());
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getDisplayMonths.js
function getDisplayMonths(firstDisplayedMonth, calendarEndMonth, props, dateLib) {
  const { numberOfMonths = 1 } = props;
  const months = [];
  for (let i = 0; i < numberOfMonths; i++) {
    const month = dateLib.addMonths(firstDisplayedMonth, i);
    if (calendarEndMonth && month > calendarEndMonth) {
      break;
    }
    months.push(month);
  }
  return months;
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getInitialMonth.js
function getInitialMonth(props, navStart, navEnd, dateLib) {
  const { month, defaultMonth, today = dateLib.today(), numberOfMonths = 1 } = props;
  let initialMonth = month || defaultMonth || today;
  const { differenceInCalendarMonths: differenceInCalendarMonths2, addMonths: addMonths2, startOfMonth: startOfMonth2 } = dateLib;
  if (navEnd && differenceInCalendarMonths2(navEnd, initialMonth) < numberOfMonths - 1) {
    const offset4 = -1 * (numberOfMonths - 1);
    initialMonth = addMonths2(navEnd, offset4);
  }
  if (navStart && differenceInCalendarMonths2(initialMonth, navStart) < 0) {
    initialMonth = navStart;
  }
  return startOfMonth2(initialMonth);
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getMonths.js
function getMonths(displayMonths, dates, props, dateLib) {
  const { addDays: addDays2, endOfBroadcastWeek: endOfBroadcastWeek2, endOfISOWeek: endOfISOWeek2, endOfMonth: endOfMonth2, endOfWeek: endOfWeek2, getISOWeek: getISOWeek2, getWeek: getWeek2, startOfBroadcastWeek: startOfBroadcastWeek2, startOfISOWeek: startOfISOWeek2, startOfWeek: startOfWeek2 } = dateLib;
  const dayPickerMonths = displayMonths.reduce((months, month) => {
    const firstDateOfFirstWeek = props.broadcastCalendar ? startOfBroadcastWeek2(month, dateLib) : props.ISOWeek ? startOfISOWeek2(month) : startOfWeek2(month);
    const lastDateOfLastWeek = props.broadcastCalendar ? endOfBroadcastWeek2(month) : props.ISOWeek ? endOfISOWeek2(endOfMonth2(month)) : endOfWeek2(endOfMonth2(month));
    const monthDates = dates.filter((date) => {
      return date >= firstDateOfFirstWeek && date <= lastDateOfLastWeek;
    });
    const nrOfDaysWithFixedWeeks = props.broadcastCalendar ? 35 : 42;
    if (props.fixedWeeks && monthDates.length < nrOfDaysWithFixedWeeks) {
      const extraDates = dates.filter((date) => {
        const daysToAdd = nrOfDaysWithFixedWeeks - monthDates.length;
        return date > lastDateOfLastWeek && date <= addDays2(lastDateOfLastWeek, daysToAdd);
      });
      monthDates.push(...extraDates);
    }
    const weeks = monthDates.reduce((weeks2, date) => {
      const weekNumber = props.ISOWeek ? getISOWeek2(date) : getWeek2(date);
      const week = weeks2.find((week2) => week2.weekNumber === weekNumber);
      const day = new CalendarDay(date, month, dateLib);
      if (!week) {
        weeks2.push(new CalendarWeek(weekNumber, [day]));
      } else {
        week.days.push(day);
      }
      return weeks2;
    }, []);
    const dayPickerMonth = new CalendarMonth(month, weeks);
    months.push(dayPickerMonth);
    return months;
  }, []);
  if (!props.reverseMonths) {
    return dayPickerMonths;
  } else {
    return dayPickerMonths.reverse();
  }
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getNavMonth.js
function getNavMonths(props, dateLib) {
  let { startMonth, endMonth } = props;
  const { startOfYear: startOfYear2, startOfDay: startOfDay2, startOfMonth: startOfMonth2, endOfMonth: endOfMonth2, addYears: addYears2, endOfYear: endOfYear2, today } = dateLib;
  const hasYearDropdown = props.captionLayout === "dropdown" || props.captionLayout === "dropdown-years";
  if (startMonth) {
    startMonth = startOfMonth2(startMonth);
  } else if (!startMonth && hasYearDropdown) {
    startMonth = startOfYear2(addYears2(props.today ?? today(), -100));
  }
  if (endMonth) {
    endMonth = endOfMonth2(endMonth);
  } else if (!endMonth && hasYearDropdown) {
    endMonth = endOfYear2(props.today ?? today());
  }
  return [
    startMonth ? startOfDay2(startMonth) : startMonth,
    endMonth ? startOfDay2(endMonth) : endMonth
  ];
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getNextMonth.js
function getNextMonth(firstDisplayedMonth, calendarEndMonth, options, dateLib) {
  if (options.disableNavigation) {
    return void 0;
  }
  const { pagedNavigation, numberOfMonths = 1 } = options;
  const { startOfMonth: startOfMonth2, addMonths: addMonths2, differenceInCalendarMonths: differenceInCalendarMonths2 } = dateLib;
  const offset4 = pagedNavigation ? numberOfMonths : 1;
  const month = startOfMonth2(firstDisplayedMonth);
  if (!calendarEndMonth) {
    return addMonths2(month, offset4);
  }
  const monthsDiff = differenceInCalendarMonths2(calendarEndMonth, firstDisplayedMonth);
  if (monthsDiff < numberOfMonths) {
    return void 0;
  }
  return addMonths2(month, offset4);
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getPreviousMonth.js
function getPreviousMonth(firstDisplayedMonth, calendarStartMonth, options, dateLib) {
  if (options.disableNavigation) {
    return void 0;
  }
  const { pagedNavigation, numberOfMonths } = options;
  const { startOfMonth: startOfMonth2, addMonths: addMonths2, differenceInCalendarMonths: differenceInCalendarMonths2 } = dateLib;
  const offset4 = pagedNavigation ? numberOfMonths ?? 1 : 1;
  const month = startOfMonth2(firstDisplayedMonth);
  if (!calendarStartMonth) {
    return addMonths2(month, -offset4);
  }
  const monthsDiff = differenceInCalendarMonths2(month, calendarStartMonth);
  if (monthsDiff <= 0) {
    return void 0;
  }
  return addMonths2(month, -offset4);
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getWeeks.js
function getWeeks(months) {
  const initialWeeks = [];
  return months.reduce((weeks, month) => {
    return weeks.concat(month.weeks.slice());
  }, initialWeeks.slice());
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/useControlledValue.js
var import_react33 = __toESM(require_react(), 1);
function useControlledValue(defaultValue, controlledValue) {
  const [uncontrolledValue, setValue] = (0, import_react33.useState)(defaultValue);
  const value = controlledValue === void 0 ? uncontrolledValue : controlledValue;
  return [value, setValue];
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/useCalendar.js
function useCalendar(props, dateLib) {
  const [navStart, navEnd] = getNavMonths(props, dateLib);
  const { startOfMonth: startOfMonth2, endOfMonth: endOfMonth2 } = dateLib;
  const initialMonth = getInitialMonth(props, navStart, navEnd, dateLib);
  const [firstMonth, setFirstMonth] = useControlledValue(
    initialMonth,
    // initialMonth is always computed from props.month if provided
    props.month ? initialMonth : void 0
  );
  (0, import_react34.useEffect)(() => {
    const newInitialMonth = getInitialMonth(props, navStart, navEnd, dateLib);
    setFirstMonth(newInitialMonth);
  }, [props.timeZone]);
  const { months, weeks, days, previousMonth, nextMonth } = (0, import_react34.useMemo)(() => {
    const displayMonths = getDisplayMonths(firstMonth, navEnd, { numberOfMonths: props.numberOfMonths }, dateLib);
    const dates = getDates(displayMonths, props.endMonth ? endOfMonth2(props.endMonth) : void 0, {
      ISOWeek: props.ISOWeek,
      fixedWeeks: props.fixedWeeks,
      broadcastCalendar: props.broadcastCalendar
    }, dateLib);
    const months2 = getMonths(displayMonths, dates, {
      broadcastCalendar: props.broadcastCalendar,
      fixedWeeks: props.fixedWeeks,
      ISOWeek: props.ISOWeek,
      reverseMonths: props.reverseMonths
    }, dateLib);
    const weeks2 = getWeeks(months2);
    const days2 = getDays(months2);
    const previousMonth2 = getPreviousMonth(firstMonth, navStart, props, dateLib);
    const nextMonth2 = getNextMonth(firstMonth, navEnd, props, dateLib);
    return {
      months: months2,
      weeks: weeks2,
      days: days2,
      previousMonth: previousMonth2,
      nextMonth: nextMonth2
    };
  }, [
    dateLib,
    firstMonth.getTime(),
    navEnd?.getTime(),
    navStart?.getTime(),
    props.disableNavigation,
    props.broadcastCalendar,
    props.endMonth?.getTime(),
    props.fixedWeeks,
    props.ISOWeek,
    props.numberOfMonths,
    props.pagedNavigation,
    props.reverseMonths
  ]);
  const { disableNavigation, onMonthChange } = props;
  const isDayInCalendar = (day) => weeks.some((week) => week.days.some((d) => d.isEqualTo(day)));
  const goToMonth = (date) => {
    if (disableNavigation) {
      return;
    }
    let newMonth = startOfMonth2(date);
    if (navStart && newMonth < startOfMonth2(navStart)) {
      newMonth = startOfMonth2(navStart);
    }
    if (navEnd && newMonth > startOfMonth2(navEnd)) {
      newMonth = startOfMonth2(navEnd);
    }
    setFirstMonth(newMonth);
    onMonthChange?.(newMonth);
  };
  const goToDay = (day) => {
    if (isDayInCalendar(day)) {
      return;
    }
    goToMonth(day.date);
  };
  const calendar = {
    months,
    weeks,
    days,
    navStart,
    navEnd,
    previousMonth,
    nextMonth,
    goToMonth,
    goToDay
  };
  return calendar;
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/useFocus.js
var import_react35 = __toESM(require_react(), 1);

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/calculateFocusTarget.js
var FocusTargetPriority;
(function(FocusTargetPriority2) {
  FocusTargetPriority2[FocusTargetPriority2["Today"] = 0] = "Today";
  FocusTargetPriority2[FocusTargetPriority2["Selected"] = 1] = "Selected";
  FocusTargetPriority2[FocusTargetPriority2["LastFocused"] = 2] = "LastFocused";
  FocusTargetPriority2[FocusTargetPriority2["FocusedModifier"] = 3] = "FocusedModifier";
})(FocusTargetPriority || (FocusTargetPriority = {}));
function isFocusableDay(modifiers) {
  return !modifiers[DayFlag.disabled] && !modifiers[DayFlag.hidden] && !modifiers[DayFlag.outside];
}
function calculateFocusTarget(days, getModifiers, isSelected, lastFocused) {
  let focusTarget;
  let foundFocusTargetPriority = -1;
  for (const day of days) {
    const modifiers = getModifiers(day);
    if (isFocusableDay(modifiers)) {
      if (modifiers[DayFlag.focused] && foundFocusTargetPriority < FocusTargetPriority.FocusedModifier) {
        focusTarget = day;
        foundFocusTargetPriority = FocusTargetPriority.FocusedModifier;
      } else if (lastFocused?.isEqualTo(day) && foundFocusTargetPriority < FocusTargetPriority.LastFocused) {
        focusTarget = day;
        foundFocusTargetPriority = FocusTargetPriority.LastFocused;
      } else if (isSelected(day.date) && foundFocusTargetPriority < FocusTargetPriority.Selected) {
        focusTarget = day;
        foundFocusTargetPriority = FocusTargetPriority.Selected;
      } else if (modifiers[DayFlag.today] && foundFocusTargetPriority < FocusTargetPriority.Today) {
        focusTarget = day;
        foundFocusTargetPriority = FocusTargetPriority.Today;
      }
    }
  }
  if (!focusTarget) {
    focusTarget = days.find((day) => isFocusableDay(getModifiers(day)));
  }
  return focusTarget;
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getFocusableDate.js
function getFocusableDate(moveBy, moveDir, refDate, navStart, navEnd, props, dateLib) {
  const { ISOWeek, broadcastCalendar } = props;
  const { addDays: addDays2, addMonths: addMonths2, addWeeks: addWeeks2, addYears: addYears2, endOfBroadcastWeek: endOfBroadcastWeek2, endOfISOWeek: endOfISOWeek2, endOfWeek: endOfWeek2, max: max4, min: min4, startOfBroadcastWeek: startOfBroadcastWeek2, startOfISOWeek: startOfISOWeek2, startOfWeek: startOfWeek2 } = dateLib;
  const moveFns = {
    day: addDays2,
    week: addWeeks2,
    month: addMonths2,
    year: addYears2,
    startOfWeek: (date) => broadcastCalendar ? startOfBroadcastWeek2(date, dateLib) : ISOWeek ? startOfISOWeek2(date) : startOfWeek2(date),
    endOfWeek: (date) => broadcastCalendar ? endOfBroadcastWeek2(date) : ISOWeek ? endOfISOWeek2(date) : endOfWeek2(date)
  };
  let focusableDate = moveFns[moveBy](refDate, moveDir === "after" ? 1 : -1);
  if (moveDir === "before" && navStart) {
    focusableDate = max4([navStart, focusableDate]);
  } else if (moveDir === "after" && navEnd) {
    focusableDate = min4([navEnd, focusableDate]);
  }
  return focusableDate;
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getNextFocus.js
function getNextFocus(moveBy, moveDir, refDay, calendarStartMonth, calendarEndMonth, props, dateLib, attempt = 0) {
  if (attempt > 365) {
    return void 0;
  }
  const focusableDate = getFocusableDate(moveBy, moveDir, refDay.date, calendarStartMonth, calendarEndMonth, props, dateLib);
  const isDisabled = Boolean(props.disabled && dateMatchModifiers(focusableDate, props.disabled, dateLib));
  const isHidden = Boolean(props.hidden && dateMatchModifiers(focusableDate, props.hidden, dateLib));
  const targetMonth = focusableDate;
  const focusDay = new CalendarDay(focusableDate, targetMonth, dateLib);
  if (!isDisabled && !isHidden) {
    return focusDay;
  }
  return getNextFocus(moveBy, moveDir, focusDay, calendarStartMonth, calendarEndMonth, props, dateLib, attempt + 1);
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/useFocus.js
function useFocus2(props, calendar, getModifiers, isSelected, dateLib) {
  const { autoFocus } = props;
  const [lastFocused, setLastFocused] = (0, import_react35.useState)();
  const focusTarget = calculateFocusTarget(calendar.days, getModifiers, isSelected || (() => false), lastFocused);
  const [focusedDay, setFocused] = (0, import_react35.useState)(autoFocus ? focusTarget : void 0);
  const blur = () => {
    setLastFocused(focusedDay);
    setFocused(void 0);
  };
  const moveFocus = (moveBy, moveDir) => {
    if (!focusedDay)
      return;
    const nextFocus = getNextFocus(moveBy, moveDir, focusedDay, calendar.navStart, calendar.navEnd, props, dateLib);
    if (!nextFocus)
      return;
    if (props.disableNavigation) {
      const isNextInCalendar = calendar.days.some((day) => day.isEqualTo(nextFocus));
      if (!isNextInCalendar) {
        return;
      }
    }
    calendar.goToDay(nextFocus);
    setFocused(nextFocus);
  };
  const isFocusTarget = (day) => {
    return Boolean(focusTarget?.isEqualTo(day));
  };
  const useFocus3 = {
    isFocusTarget,
    setFocused,
    focused: focusedDay,
    blur,
    moveFocus
  };
  return useFocus3;
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/selection/useMulti.js
function useMulti(props, dateLib) {
  const { selected: initiallySelected, required, onSelect } = props;
  const [internallySelected, setSelected] = useControlledValue(initiallySelected, onSelect ? initiallySelected : void 0);
  const selected = !onSelect ? internallySelected : initiallySelected;
  const { isSameDay: isSameDay2 } = dateLib;
  const isSelected = (date) => {
    return selected?.some((d) => isSameDay2(d, date)) ?? false;
  };
  const { min: min4, max: max4 } = props;
  const select = (triggerDate, modifiers, e) => {
    let newDates = [...selected ?? []];
    if (isSelected(triggerDate)) {
      if (selected?.length === min4) {
        return;
      }
      if (required && selected?.length === 1) {
        return;
      }
      newDates = selected?.filter((d) => !isSameDay2(d, triggerDate));
    } else {
      if (selected?.length === max4) {
        newDates = [triggerDate];
      } else {
        newDates = [...newDates, triggerDate];
      }
    }
    if (!onSelect) {
      setSelected(newDates);
    }
    onSelect?.(newDates, triggerDate, modifiers, e);
    return newDates;
  };
  return {
    selected,
    select,
    isSelected
  };
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/addToRange.js
function addToRange(date, initialRange, min4 = 0, max4 = 0, required = false, dateLib = defaultDateLib) {
  const { from, to } = initialRange || {};
  const { isSameDay: isSameDay2, isAfter: isAfter2, isBefore: isBefore2 } = dateLib;
  let range;
  if (!from && !to) {
    range = { from: date, to: min4 > 0 ? void 0 : date };
  } else if (from && !to) {
    if (isSameDay2(from, date)) {
      if (min4 === 0) {
        range = { from, to: date };
      } else if (required) {
        range = { from, to: void 0 };
      } else {
        range = void 0;
      }
    } else if (isBefore2(date, from)) {
      range = { from: date, to: from };
    } else {
      range = { from, to: date };
    }
  } else if (from && to) {
    if (isSameDay2(from, date) && isSameDay2(to, date)) {
      if (required) {
        range = { from, to };
      } else {
        range = void 0;
      }
    } else if (isSameDay2(from, date)) {
      range = { from, to: min4 > 0 ? void 0 : date };
    } else if (isSameDay2(to, date)) {
      range = { from: date, to: min4 > 0 ? void 0 : date };
    } else if (isBefore2(date, from)) {
      range = { from: date, to };
    } else if (isAfter2(date, from)) {
      range = { from, to: date };
    } else if (isAfter2(date, to)) {
      range = { from, to: date };
    } else {
      throw new Error("Invalid range");
    }
  }
  if (range?.from && range?.to) {
    const diff = dateLib.differenceInCalendarDays(range.to, range.from);
    if (max4 > 0 && diff > max4) {
      range = { from: date, to: void 0 };
    } else if (min4 > 1 && diff < min4) {
      range = { from: date, to: void 0 };
    }
  }
  return range;
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/rangeContainsDayOfWeek.js
function rangeContainsDayOfWeek(range, dayOfWeek, dateLib = defaultDateLib) {
  const dayOfWeekArr = !Array.isArray(dayOfWeek) ? [dayOfWeek] : dayOfWeek;
  let date = range.from;
  const totalDays = dateLib.differenceInCalendarDays(range.to, range.from);
  const totalDaysLimit = Math.min(totalDays, 6);
  for (let i = 0; i <= totalDaysLimit; i++) {
    if (dayOfWeekArr.includes(date.getDay())) {
      return true;
    }
    date = dateLib.addDays(date, 1);
  }
  return false;
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/rangeOverlaps.js
function rangeOverlaps(rangeLeft, rangeRight, dateLib = defaultDateLib) {
  return rangeIncludesDate(rangeLeft, rangeRight.from, false, dateLib) || rangeIncludesDate(rangeLeft, rangeRight.to, false, dateLib) || rangeIncludesDate(rangeRight, rangeLeft.from, false, dateLib) || rangeIncludesDate(rangeRight, rangeLeft.to, false, dateLib);
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/rangeContainsModifiers.js
function rangeContainsModifiers(range, modifiers, dateLib = defaultDateLib) {
  const matchers = Array.isArray(modifiers) ? modifiers : [modifiers];
  const nonFunctionMatchers = matchers.filter((matcher) => typeof matcher !== "function");
  const nonFunctionMatchersResult = nonFunctionMatchers.some((matcher) => {
    if (typeof matcher === "boolean")
      return matcher;
    if (dateLib.isDate(matcher)) {
      return rangeIncludesDate(range, matcher, false, dateLib);
    }
    if (isDatesArray(matcher, dateLib)) {
      return matcher.some((date) => rangeIncludesDate(range, date, false, dateLib));
    }
    if (isDateRange(matcher)) {
      if (matcher.from && matcher.to) {
        return rangeOverlaps(range, { from: matcher.from, to: matcher.to }, dateLib);
      }
      return false;
    }
    if (isDayOfWeekType(matcher)) {
      return rangeContainsDayOfWeek(range, matcher.dayOfWeek, dateLib);
    }
    if (isDateInterval(matcher)) {
      const isClosedInterval = dateLib.isAfter(matcher.before, matcher.after);
      if (isClosedInterval) {
        return rangeOverlaps(range, {
          from: dateLib.addDays(matcher.after, 1),
          to: dateLib.addDays(matcher.before, -1)
        }, dateLib);
      }
      return dateMatchModifiers(range.from, matcher, dateLib) || dateMatchModifiers(range.to, matcher, dateLib);
    }
    if (isDateAfterType(matcher) || isDateBeforeType(matcher)) {
      return dateMatchModifiers(range.from, matcher, dateLib) || dateMatchModifiers(range.to, matcher, dateLib);
    }
    return false;
  });
  if (nonFunctionMatchersResult) {
    return true;
  }
  const functionMatchers = matchers.filter((matcher) => typeof matcher === "function");
  if (functionMatchers.length) {
    let date = range.from;
    const totalDays = dateLib.differenceInCalendarDays(range.to, range.from);
    for (let i = 0; i <= totalDays; i++) {
      if (functionMatchers.some((matcher) => matcher(date))) {
        return true;
      }
      date = dateLib.addDays(date, 1);
    }
  }
  return false;
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/selection/useRange.js
function useRange(props, dateLib) {
  const { disabled: disabled2, excludeDisabled, resetOnSelect, selected: initiallySelected, required, onSelect } = props;
  const [internallySelected, setSelected] = useControlledValue(initiallySelected, onSelect ? initiallySelected : void 0);
  const selected = !onSelect ? internallySelected : initiallySelected;
  const isSelected = (date) => selected && rangeIncludesDate(selected, date, false, dateLib);
  const select = (triggerDate, modifiers, e) => {
    const { min: min4, max: max4 } = props;
    let newRange;
    if (triggerDate) {
      const selectedFrom = selected?.from;
      const selectedTo = selected?.to;
      const hasFullRange = !!selectedFrom && !!selectedTo;
      const isClickingSingleDayRange = !!selectedFrom && !!selectedTo && dateLib.isSameDay(selectedFrom, selectedTo) && dateLib.isSameDay(triggerDate, selectedFrom);
      if (resetOnSelect && (hasFullRange || !selected?.from)) {
        if (!required && isClickingSingleDayRange) {
          newRange = void 0;
        } else {
          newRange = { from: triggerDate, to: void 0 };
        }
      } else {
        newRange = addToRange(triggerDate, selected, min4, max4, required, dateLib);
      }
    }
    if (excludeDisabled && disabled2 && newRange?.from && newRange.to) {
      if (rangeContainsModifiers({ from: newRange.from, to: newRange.to }, disabled2, dateLib)) {
        newRange.from = triggerDate;
        newRange.to = void 0;
      }
    }
    if (!onSelect) {
      setSelected(newRange);
    }
    onSelect?.(newRange, triggerDate, modifiers, e);
    return newRange;
  };
  return {
    selected,
    select,
    isSelected
  };
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/selection/useSingle.js
function useSingle(props, dateLib) {
  const { selected: initiallySelected, required, onSelect } = props;
  const [internallySelected, setSelected] = useControlledValue(initiallySelected, onSelect ? initiallySelected : void 0);
  const selected = !onSelect ? internallySelected : initiallySelected;
  const { isSameDay: isSameDay2 } = dateLib;
  const isSelected = (compareDate) => {
    return selected ? isSameDay2(selected, compareDate) : false;
  };
  const select = (triggerDate, modifiers, e) => {
    let newDate = triggerDate;
    if (!required && selected && selected && isSameDay2(triggerDate, selected)) {
      newDate = void 0;
    }
    if (!onSelect) {
      setSelected(newDate);
    }
    if (required) {
      onSelect?.(newDate, triggerDate, modifiers, e);
    } else {
      onSelect?.(newDate, triggerDate, modifiers, e);
    }
    return newDate;
  };
  return {
    selected,
    select,
    isSelected
  };
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/useSelection.js
function useSelection(props, dateLib) {
  const single = useSingle(props, dateLib);
  const multi = useMulti(props, dateLib);
  const range = useRange(props, dateLib);
  switch (props.mode) {
    case "single":
      return single;
    case "multiple":
      return multi;
    case "range":
      return range;
    default:
      return void 0;
  }
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/toTimeZone.js
function toTimeZone(date, timeZone) {
  if (date instanceof TZDate && date.timeZone === timeZone) {
    return date;
  }
  return new TZDate(date, timeZone);
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/convertMatchersToTimeZone.js
function toZoneNoon(date, timeZone, noonSafe) {
  if (!noonSafe)
    return toTimeZone(date, timeZone);
  const zoned = toTimeZone(date, timeZone);
  const noonZoned = new TZDate(zoned.getFullYear(), zoned.getMonth(), zoned.getDate(), 12, 0, 0, timeZone);
  return new Date(noonZoned.getTime());
}
function convertMatcher(matcher, timeZone, noonSafe) {
  if (typeof matcher === "boolean" || typeof matcher === "function") {
    return matcher;
  }
  if (matcher instanceof Date) {
    return toZoneNoon(matcher, timeZone, noonSafe);
  }
  if (Array.isArray(matcher)) {
    return matcher.map((value) => value instanceof Date ? toZoneNoon(value, timeZone, noonSafe) : value);
  }
  if (isDateRange(matcher)) {
    return {
      ...matcher,
      from: matcher.from ? toTimeZone(matcher.from, timeZone) : matcher.from,
      to: matcher.to ? toTimeZone(matcher.to, timeZone) : matcher.to
    };
  }
  if (isDateInterval(matcher)) {
    return {
      before: toZoneNoon(matcher.before, timeZone, noonSafe),
      after: toZoneNoon(matcher.after, timeZone, noonSafe)
    };
  }
  if (isDateAfterType(matcher)) {
    return {
      after: toZoneNoon(matcher.after, timeZone, noonSafe)
    };
  }
  if (isDateBeforeType(matcher)) {
    return {
      before: toZoneNoon(matcher.before, timeZone, noonSafe)
    };
  }
  return matcher;
}
function convertMatchersToTimeZone(matchers, timeZone, noonSafe) {
  if (!matchers) {
    return matchers;
  }
  if (Array.isArray(matchers)) {
    return matchers.map((matcher) => convertMatcher(matcher, timeZone, noonSafe));
  }
  return convertMatcher(matchers, timeZone, noonSafe);
}

// node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/DayPicker.js
function DayPicker(initialProps) {
  let props = initialProps;
  const timeZone = props.timeZone;
  if (timeZone) {
    props = {
      ...initialProps,
      timeZone
    };
    if (props.today) {
      props.today = toTimeZone(props.today, timeZone);
    }
    if (props.month) {
      props.month = toTimeZone(props.month, timeZone);
    }
    if (props.defaultMonth) {
      props.defaultMonth = toTimeZone(props.defaultMonth, timeZone);
    }
    if (props.startMonth) {
      props.startMonth = toTimeZone(props.startMonth, timeZone);
    }
    if (props.endMonth) {
      props.endMonth = toTimeZone(props.endMonth, timeZone);
    }
    if (props.mode === "single" && props.selected) {
      props.selected = toTimeZone(props.selected, timeZone);
    } else if (props.mode === "multiple" && props.selected) {
      props.selected = props.selected?.map((date) => toTimeZone(date, timeZone));
    } else if (props.mode === "range" && props.selected) {
      props.selected = {
        from: props.selected.from ? toTimeZone(props.selected.from, timeZone) : props.selected.from,
        to: props.selected.to ? toTimeZone(props.selected.to, timeZone) : props.selected.to
      };
    }
    if (props.disabled !== void 0) {
      props.disabled = convertMatchersToTimeZone(props.disabled, timeZone);
    }
    if (props.hidden !== void 0) {
      props.hidden = convertMatchersToTimeZone(props.hidden, timeZone);
    }
    if (props.modifiers) {
      const nextModifiers = {};
      Object.keys(props.modifiers).forEach((key) => {
        nextModifiers[key] = convertMatchersToTimeZone(props.modifiers?.[key], timeZone);
      });
      props.modifiers = nextModifiers;
    }
  }
  const { components, formatters: formatters2, labels, dateLib, locale, classNames } = (0, import_react36.useMemo)(() => {
    const locale2 = { ...enUS2, ...props.locale };
    const weekStartsOn = props.broadcastCalendar ? 1 : props.weekStartsOn;
    const noonOverrides = props.noonSafe && props.timeZone ? createNoonOverrides(props.timeZone, {
      weekStartsOn,
      locale: locale2
    }) : void 0;
    const overrides = props.dateLib && noonOverrides ? { ...noonOverrides, ...props.dateLib } : props.dateLib ?? noonOverrides;
    const dateLib2 = new DateLib({
      locale: locale2,
      weekStartsOn,
      firstWeekContainsDate: props.firstWeekContainsDate,
      useAdditionalWeekYearTokens: props.useAdditionalWeekYearTokens,
      useAdditionalDayOfYearTokens: props.useAdditionalDayOfYearTokens,
      timeZone: props.timeZone,
      numerals: props.numerals
    }, overrides);
    return {
      dateLib: dateLib2,
      components: getComponents(props.components),
      formatters: getFormatters(props.formatters),
      labels: getLabels(props.labels, dateLib2.options),
      locale: locale2,
      classNames: { ...getDefaultClassNames(), ...props.classNames }
    };
  }, [
    props.locale,
    props.broadcastCalendar,
    props.weekStartsOn,
    props.firstWeekContainsDate,
    props.useAdditionalWeekYearTokens,
    props.useAdditionalDayOfYearTokens,
    props.timeZone,
    props.numerals,
    props.dateLib,
    props.noonSafe,
    props.components,
    props.formatters,
    props.labels,
    props.classNames
  ]);
  if (!props.today) {
    props = { ...props, today: dateLib.today() };
  }
  const { captionLayout, mode, navLayout, numberOfMonths = 1, onDayBlur, onDayClick, onDayFocus, onDayKeyDown, onDayMouseEnter, onDayMouseLeave, onNextClick, onPrevClick, showWeekNumber, styles } = props;
  const { formatCaption: formatCaption2, formatDay: formatDay2, formatMonthDropdown: formatMonthDropdown2, formatWeekNumber: formatWeekNumber2, formatWeekNumberHeader: formatWeekNumberHeader2, formatWeekdayName: formatWeekdayName2, formatYearDropdown: formatYearDropdown2 } = formatters2;
  const calendar = useCalendar(props, dateLib);
  const { days, months, navStart, navEnd, previousMonth, nextMonth, goToMonth } = calendar;
  const getModifiers = createGetModifiers(days, props, navStart, navEnd, dateLib);
  const { isSelected, select, selected: selectedValue } = useSelection(props, dateLib) ?? {};
  const { blur, focused, isFocusTarget, moveFocus, setFocused } = useFocus2(props, calendar, getModifiers, isSelected ?? (() => false), dateLib);
  const { labelDayButton: labelDayButton2, labelGridcell: labelGridcell2, labelGrid: labelGrid2, labelMonthDropdown: labelMonthDropdown2, labelNav: labelNav2, labelPrevious: labelPrevious2, labelNext: labelNext2, labelWeekday: labelWeekday2, labelWeekNumber: labelWeekNumber2, labelWeekNumberHeader: labelWeekNumberHeader2, labelYearDropdown: labelYearDropdown2 } = labels;
  const weekdays = (0, import_react36.useMemo)(() => getWeekdays(dateLib, props.ISOWeek, props.broadcastCalendar, props.today), [dateLib, props.ISOWeek, props.broadcastCalendar, props.today]);
  const isInteractive = mode !== void 0 || onDayClick !== void 0;
  const handlePreviousClick = (0, import_react36.useCallback)(() => {
    if (!previousMonth)
      return;
    goToMonth(previousMonth);
    onPrevClick?.(previousMonth);
  }, [previousMonth, goToMonth, onPrevClick]);
  const handleNextClick = (0, import_react36.useCallback)(() => {
    if (!nextMonth)
      return;
    goToMonth(nextMonth);
    onNextClick?.(nextMonth);
  }, [goToMonth, nextMonth, onNextClick]);
  const handleDayClick = (0, import_react36.useCallback)((day, m2) => (e) => {
    e.preventDefault();
    e.stopPropagation();
    setFocused(day);
    if (m2.disabled) {
      return;
    }
    select?.(day.date, m2, e);
    onDayClick?.(day.date, m2, e);
  }, [select, onDayClick, setFocused]);
  const handleDayFocus = (0, import_react36.useCallback)((day, m2) => (e) => {
    setFocused(day);
    onDayFocus?.(day.date, m2, e);
  }, [onDayFocus, setFocused]);
  const handleDayBlur = (0, import_react36.useCallback)((day, m2) => (e) => {
    blur();
    onDayBlur?.(day.date, m2, e);
  }, [blur, onDayBlur]);
  const handleDayKeyDown = (0, import_react36.useCallback)((day, modifiers) => (e) => {
    const keyMap = {
      ArrowLeft: [
        e.shiftKey ? "month" : "day",
        props.dir === "rtl" ? "after" : "before"
      ],
      ArrowRight: [
        e.shiftKey ? "month" : "day",
        props.dir === "rtl" ? "before" : "after"
      ],
      ArrowDown: [e.shiftKey ? "year" : "week", "after"],
      ArrowUp: [e.shiftKey ? "year" : "week", "before"],
      PageUp: [e.shiftKey ? "year" : "month", "before"],
      PageDown: [e.shiftKey ? "year" : "month", "after"],
      Home: ["startOfWeek", "before"],
      End: ["endOfWeek", "after"]
    };
    if (keyMap[e.key]) {
      e.preventDefault();
      e.stopPropagation();
      const [moveBy, moveDir] = keyMap[e.key];
      moveFocus(moveBy, moveDir);
    }
    onDayKeyDown?.(day.date, modifiers, e);
  }, [moveFocus, onDayKeyDown, props.dir]);
  const handleDayMouseEnter = (0, import_react36.useCallback)((day, modifiers) => (e) => {
    onDayMouseEnter?.(day.date, modifiers, e);
  }, [onDayMouseEnter]);
  const handleDayMouseLeave = (0, import_react36.useCallback)((day, modifiers) => (e) => {
    onDayMouseLeave?.(day.date, modifiers, e);
  }, [onDayMouseLeave]);
  const handleMonthChange = (0, import_react36.useCallback)((date, monthOffset) => (e) => {
    const selectedMonth = Number(e.target.value);
    const month = dateLib.setMonth(dateLib.startOfMonth(date), selectedMonth);
    goToMonth(dateLib.addMonths(month, -monthOffset));
  }, [dateLib, goToMonth]);
  const handleYearChange = (0, import_react36.useCallback)((date, monthOffset) => (e) => {
    const selectedYear = Number(e.target.value);
    const month = dateLib.setYear(dateLib.startOfMonth(date), selectedYear);
    goToMonth(dateLib.addMonths(month, -monthOffset));
  }, [dateLib, goToMonth]);
  const { className, style } = (0, import_react36.useMemo)(() => ({
    className: [classNames[UI.Root], props.className].filter(Boolean).join(" "),
    style: { ...styles?.[UI.Root], ...props.style }
  }), [classNames, props.className, props.style, styles]);
  const dataAttributes = getDataAttributes(props);
  const getDropdownStyle = (dropdown) => {
    const dropdownStyle = styles?.[UI.Dropdown];
    const specificDropdownStyle = styles?.[dropdown];
    if (!dropdownStyle && !specificDropdownStyle) {
      return void 0;
    }
    return {
      ...dropdownStyle,
      ...specificDropdownStyle
    };
  };
  const rootElRef = (0, import_react36.useRef)(null);
  useAnimation(rootElRef, Boolean(props.animate), {
    classNames,
    months,
    focused,
    dateLib
  });
  const contextValue = {
    dayPickerProps: props,
    selected: selectedValue,
    select,
    isSelected,
    months,
    nextMonth,
    previousMonth,
    goToMonth,
    getModifiers,
    components,
    classNames,
    styles,
    labels,
    formatters: formatters2
  };
  return import_react36.default.createElement(
    dayPickerContext.Provider,
    { value: contextValue },
    import_react36.default.createElement(
      components.Root,
      { rootRef: props.animate ? rootElRef : void 0, className, style, dir: props.dir, id: props.id, lang: props.lang ?? locale.code, nonce: props.nonce, title: props.title, role: props.role, "aria-label": props["aria-label"], "aria-labelledby": props["aria-labelledby"], ...dataAttributes },
      import_react36.default.createElement(
        components.Months,
        { className: classNames[UI.Months], style: styles?.[UI.Months] },
        !props.hideNavigation && !navLayout && import_react36.default.createElement(components.Nav, { "data-animated-nav": props.animate ? "true" : void 0, className: classNames[UI.Nav], style: styles?.[UI.Nav], "aria-label": labelNav2(), onPreviousClick: handlePreviousClick, onNextClick: handleNextClick, previousMonth, nextMonth }),
        months.map((calendarMonth, displayIndex) => {
          const monthOffset = props.reverseMonths ? months.length - 1 - displayIndex : displayIndex;
          return import_react36.default.createElement(
            components.Month,
            {
              "data-animated-month": props.animate ? "true" : void 0,
              className: classNames[UI.Month],
              style: styles?.[UI.Month],
              // biome-ignore lint/suspicious/noArrayIndexKey: breaks animation
              key: displayIndex,
              displayIndex,
              calendarMonth
            },
            navLayout === "around" && !props.hideNavigation && displayIndex === 0 && import_react36.default.createElement(
              components.PreviousMonthButton,
              { type: "button", className: classNames[UI.PreviousMonthButton], style: styles?.[UI.PreviousMonthButton], tabIndex: previousMonth ? void 0 : -1, "aria-disabled": previousMonth ? void 0 : true, "aria-label": labelPrevious2(previousMonth), onClick: handlePreviousClick, "data-animated-button": props.animate ? "true" : void 0 },
              import_react36.default.createElement(components.Chevron, { disabled: previousMonth ? void 0 : true, className: classNames[UI.Chevron], style: styles?.[UI.Chevron], orientation: props.dir === "rtl" ? "right" : "left" })
            ),
            import_react36.default.createElement(components.MonthCaption, { "data-animated-caption": props.animate ? "true" : void 0, className: classNames[UI.MonthCaption], style: styles?.[UI.MonthCaption], calendarMonth, displayIndex }, captionLayout?.startsWith("dropdown") ? import_react36.default.createElement(
              components.DropdownNav,
              { className: classNames[UI.Dropdowns], style: styles?.[UI.Dropdowns] },
              (() => {
                const monthControl = captionLayout === "dropdown" || captionLayout === "dropdown-months" ? import_react36.default.createElement(components.MonthsDropdown, { key: "month", className: classNames[UI.MonthsDropdown], "aria-label": labelMonthDropdown2(), disabled: Boolean(props.disableNavigation), onChange: handleMonthChange(calendarMonth.date, monthOffset), options: getMonthOptions(calendarMonth.date, navStart, navEnd, formatters2, dateLib), style: getDropdownStyle(UI.MonthsDropdown), value: dateLib.getMonth(calendarMonth.date) }) : import_react36.default.createElement("span", { key: "month" }, formatMonthDropdown2(calendarMonth.date, dateLib));
                const yearControl = captionLayout === "dropdown" || captionLayout === "dropdown-years" ? import_react36.default.createElement(components.YearsDropdown, { key: "year", className: classNames[UI.YearsDropdown], "aria-label": labelYearDropdown2(dateLib.options), disabled: Boolean(props.disableNavigation), onChange: handleYearChange(calendarMonth.date, monthOffset), options: getYearOptions(navStart, navEnd, formatters2, dateLib, Boolean(props.reverseYears)), style: getDropdownStyle(UI.YearsDropdown), value: dateLib.getYear(calendarMonth.date) }) : import_react36.default.createElement("span", { key: "year" }, formatYearDropdown2(calendarMonth.date, dateLib));
                const controls = dateLib.getMonthYearOrder() === "year-first" ? [yearControl, monthControl] : [monthControl, yearControl];
                return controls;
              })(),
              import_react36.default.createElement("span", { role: "status", "aria-live": "polite", style: {
                border: 0,
                clip: "rect(0 0 0 0)",
                height: "1px",
                margin: "-1px",
                overflow: "hidden",
                padding: 0,
                position: "absolute",
                width: "1px",
                whiteSpace: "nowrap",
                wordWrap: "normal"
              } }, formatCaption2(calendarMonth.date, dateLib.options, dateLib))
            ) : import_react36.default.createElement(components.CaptionLabel, { className: classNames[UI.CaptionLabel], style: styles?.[UI.CaptionLabel], role: "status", "aria-live": "polite" }, formatCaption2(calendarMonth.date, dateLib.options, dateLib))),
            navLayout === "around" && !props.hideNavigation && displayIndex === numberOfMonths - 1 && import_react36.default.createElement(
              components.NextMonthButton,
              { type: "button", className: classNames[UI.NextMonthButton], style: styles?.[UI.NextMonthButton], tabIndex: nextMonth ? void 0 : -1, "aria-disabled": nextMonth ? void 0 : true, "aria-label": labelNext2(nextMonth), onClick: handleNextClick, "data-animated-button": props.animate ? "true" : void 0 },
              import_react36.default.createElement(components.Chevron, { disabled: nextMonth ? void 0 : true, className: classNames[UI.Chevron], style: styles?.[UI.Chevron], orientation: props.dir === "rtl" ? "left" : "right" })
            ),
            displayIndex === numberOfMonths - 1 && navLayout === "after" && !props.hideNavigation && import_react36.default.createElement(components.Nav, { "data-animated-nav": props.animate ? "true" : void 0, className: classNames[UI.Nav], style: styles?.[UI.Nav], "aria-label": labelNav2(), onPreviousClick: handlePreviousClick, onNextClick: handleNextClick, previousMonth, nextMonth }),
            import_react36.default.createElement(
              components.MonthGrid,
              { role: "grid", "aria-multiselectable": mode === "multiple" || mode === "range", "aria-label": labelGrid2(calendarMonth.date, dateLib.options, dateLib) || void 0, className: classNames[UI.MonthGrid], style: styles?.[UI.MonthGrid] },
              !props.hideWeekdays && import_react36.default.createElement(
                components.Weekdays,
                { "data-animated-weekdays": props.animate ? "true" : void 0, className: classNames[UI.Weekdays], style: styles?.[UI.Weekdays] },
                showWeekNumber && import_react36.default.createElement(components.WeekNumberHeader, { "aria-label": labelWeekNumberHeader2(dateLib.options), className: classNames[UI.WeekNumberHeader], style: styles?.[UI.WeekNumberHeader], scope: "col" }, formatWeekNumberHeader2()),
                weekdays.map((weekday) => import_react36.default.createElement(components.Weekday, { "aria-label": labelWeekday2(weekday, dateLib.options, dateLib), className: classNames[UI.Weekday], key: String(weekday), style: styles?.[UI.Weekday], scope: "col" }, formatWeekdayName2(weekday, dateLib.options, dateLib)))
              ),
              import_react36.default.createElement(components.Weeks, { "data-animated-weeks": props.animate ? "true" : void 0, className: classNames[UI.Weeks], style: styles?.[UI.Weeks] }, calendarMonth.weeks.map((week) => {
                return import_react36.default.createElement(
                  components.Week,
                  { className: classNames[UI.Week], key: week.weekNumber, style: styles?.[UI.Week], week },
                  showWeekNumber && import_react36.default.createElement(components.WeekNumber, { week, style: styles?.[UI.WeekNumber], "aria-label": labelWeekNumber2(week.weekNumber, {
                    locale
                  }), className: classNames[UI.WeekNumber], scope: "row", role: "rowheader" }, formatWeekNumber2(week.weekNumber, dateLib)),
                  week.days.map((day) => {
                    const { date } = day;
                    const modifiers = getModifiers(day);
                    modifiers[DayFlag.focused] = !modifiers.hidden && Boolean(focused?.isEqualTo(day));
                    modifiers[SelectionState.selected] = isSelected?.(date) || modifiers.selected;
                    if (isDateRange(selectedValue)) {
                      const { from, to } = selectedValue;
                      modifiers[SelectionState.range_start] = Boolean(from && to && dateLib.isSameDay(date, from));
                      modifiers[SelectionState.range_end] = Boolean(from && to && dateLib.isSameDay(date, to));
                      modifiers[SelectionState.range_middle] = rangeIncludesDate(selectedValue, date, true, dateLib);
                    }
                    const style2 = getStyleForModifiers(modifiers, styles, props.modifiersStyles);
                    const className2 = getClassNamesForModifiers(modifiers, classNames, props.modifiersClassNames);
                    const ariaLabel = !isInteractive && !modifiers.hidden ? labelGridcell2(date, modifiers, dateLib.options, dateLib) : void 0;
                    return import_react36.default.createElement(components.Day, { key: `${day.isoDate}_${day.displayMonthId}`, day, modifiers, className: className2.join(" "), style: style2, role: "gridcell", "aria-selected": modifiers.selected || void 0, "aria-label": ariaLabel, "data-day": day.isoDate, "data-month": day.outside ? day.dateMonthId : void 0, "data-selected": modifiers.selected || void 0, "data-disabled": modifiers.disabled || void 0, "data-hidden": modifiers.hidden || void 0, "data-outside": day.outside || void 0, "data-focused": modifiers.focused || void 0, "data-today": modifiers.today || void 0 }, !modifiers.hidden && isInteractive ? import_react36.default.createElement(components.DayButton, { className: classNames[UI.DayButton], style: styles?.[UI.DayButton], type: "button", day, modifiers, disabled: !modifiers.focused && modifiers.disabled || void 0, "aria-disabled": modifiers.focused && modifiers.disabled || void 0, tabIndex: isFocusTarget(day) ? 0 : -1, "aria-label": labelDayButton2(date, modifiers, dateLib.options, dateLib), onClick: handleDayClick(day, modifiers), onBlur: handleDayBlur(day, modifiers), onFocus: handleDayFocus(day, modifiers), onKeyDown: handleDayKeyDown(day, modifiers), onMouseEnter: handleDayMouseEnter(day, modifiers), onMouseLeave: handleDayMouseLeave(day, modifiers) }, formatDay2(date, dateLib.options, dateLib)) : !modifiers.hidden && formatDay2(day.date, dateLib.options, dateLib));
                  })
                );
              }))
            )
          );
        })
      ),
      props.footer && import_react36.default.createElement(components.Footer, { className: classNames[UI.Footer], style: styles?.[UI.Footer], role: "status", "aria-live": "polite" }, props.footer)
    )
  );
}

// packages/ui/build-module/calendar/calendar.mjs
var import_element29 = __toESM(require_element(), 1);

// packages/ui/build-module/calendar/utils/components.mjs
var import_element25 = __toESM(require_element(), 1);
var import_compose = __toESM(require_compose(), 1);
var import_i18n5 = __toESM(require_i18n(), 1);

// packages/ui/build-module/icon-button/icon-button.mjs
var import_element23 = __toESM(require_element(), 1);
var import_jsx_runtime62 = __toESM(require_jsx_runtime(), 1);
var STYLE_HASH_ATTRIBUTE10 = "data-wp-hash";
function getRuntime10() {
  const globalScope = globalThis;
  if (globalScope.__wpStyleRuntime) {
    return globalScope.__wpStyleRuntime;
  }
  globalScope.__wpStyleRuntime = {
    documents: /* @__PURE__ */ new Map(),
    styles: /* @__PURE__ */ new Map(),
    injectedStyles: /* @__PURE__ */ new WeakMap()
  };
  if (typeof document !== "undefined") {
    registerDocument10(document);
  }
  return globalScope.__wpStyleRuntime;
}
function documentContainsStyleHash10(targetDocument, hash) {
  if (!targetDocument.head) {
    return false;
  }
  for (const style of targetDocument.head.querySelectorAll(
    `style[${STYLE_HASH_ATTRIBUTE10}]`
  )) {
    if (style.getAttribute(STYLE_HASH_ATTRIBUTE10) === hash) {
      return true;
    }
  }
  return false;
}
function injectStyle10(targetDocument, hash, css) {
  if (!targetDocument.head) {
    return;
  }
  const runtime = getRuntime10();
  let injectedStyles = runtime.injectedStyles.get(targetDocument);
  if (!injectedStyles) {
    injectedStyles = /* @__PURE__ */ new Set();
    runtime.injectedStyles.set(targetDocument, injectedStyles);
  }
  if (injectedStyles.has(hash)) {
    return;
  }
  if (documentContainsStyleHash10(targetDocument, hash)) {
    injectedStyles.add(hash);
    return;
  }
  const style = targetDocument.createElement("style");
  style.setAttribute(STYLE_HASH_ATTRIBUTE10, hash);
  style.appendChild(targetDocument.createTextNode(css));
  targetDocument.head.appendChild(style);
  injectedStyles.add(hash);
}
function registerDocument10(targetDocument) {
  const runtime = getRuntime10();
  runtime.documents.set(
    targetDocument,
    (runtime.documents.get(targetDocument) ?? 0) + 1
  );
  for (const [hash, css] of runtime.styles) {
    injectStyle10(targetDocument, hash, css);
  }
  return () => {
    const count = runtime.documents.get(targetDocument);
    if (count === void 0) {
      return;
    }
    if (count <= 1) {
      runtime.documents.delete(targetDocument);
      return;
    }
    runtime.documents.set(targetDocument, count - 1);
  };
}
function registerStyle10(hash, css) {
  const runtime = getRuntime10();
  runtime.styles.set(hash, css);
  for (const targetDocument of runtime.documents.keys()) {
    injectStyle10(targetDocument, hash, css);
  }
}
if (typeof process === "undefined" || true) {
  registerStyle10("c5cdafb1bc", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer compositions{._28cfdc260e755391__icon-button{--wp-ui-button-aspect-ratio:1;--wp-ui-button-padding-inline:0px;--wp-ui-button-min-width:unset}.f1c70d719989a85a__icon{margin:-1px}}}");
}
var style_default9 = { "icon-button": "_28cfdc260e755391__icon-button", "icon": "f1c70d719989a85a__icon" };
var IconButton = (0, import_element23.forwardRef)(
  function IconButton2({
    label,
    className,
    // Prevent accidental forwarding of `children`
    children: _children,
    disabled: disabled2,
    focusableWhenDisabled = true,
    icon,
    size: size4,
    shortcut,
    positioner,
    "aria-describedby": ariaDescribedBy,
    "aria-keyshortcuts": ariaKeyShortcuts,
    ...restProps
  }, ref) {
    const classes = clsx_default(style_default9["icon-button"], className);
    const { descriptionId, targetProps } = useKeyboardShortcutProps({
      "aria-describedby": ariaDescribedBy,
      "aria-keyshortcuts": ariaKeyShortcuts,
      shortcut
    });
    return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Root, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
        Trigger,
        {
          ref,
          ...targetProps,
          disabled: disabled2 && !focusableWhenDisabled,
          render: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
            Button4,
            {
              ...restProps,
              size: size4,
              "aria-label": label,
              disabled: disabled2,
              focusableWhenDisabled
            }
          ),
          className: classes,
          children: [
            /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Icon, { icon, size: 24, className: style_default9.icon }),
            shortcut && descriptionId && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
              KeyboardShortcutDescription,
              {
                descriptionId,
                shortcut
              }
            )
          ]
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Popup, { positioner, children: [
        label,
        shortcut && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
          " ",
          /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(KeyboardShortcutDisplay, { shortcut })
        ] })
      ] })
    ] });
  }
);

// packages/ui/build-module/calendar/utils/root-context.mjs
var import_element24 = __toESM(require_element(), 1);
var RootContext = (0, import_element24.createContext)({});

// packages/ui/build-module/calendar/utils/components.mjs
var import_jsx_runtime63 = __toESM(require_jsx_runtime(), 1);
var PreviewDashStartAndEnd = () => {
  return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
    "svg",
    {
      viewBox: "0 0 32 32",
      xmlns: "http://www.w3.org/2000/svg",
      fill: "none",
      stroke: "currentColor",
      strokeDasharray: "3.7677",
      strokeDashoffset: "3.2",
      strokeWidth: "1",
      children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("path", { d: "M29.5,0.5 h-27 a2,2 0 0 0 -2,2 v27 a2,2 0 0 0 2,2 h27 a2,2 0 0 0 2,-2 v-27 a2,2 0 0 0 -2,-2" })
    }
  );
};
var PreviewDashStart = () => {
  return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
    "svg",
    {
      viewBox: "0 0 32 32",
      xmlns: "http://www.w3.org/2000/svg",
      fill: "none",
      stroke: "currentColor",
      strokeDasharray: "3.84516",
      strokeDashoffset: "1.9226",
      strokeWidth: "1",
      children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("path", { d: "M32,0.5 h-29.5 a2,2 0 0 0 -2,2 v27 a2,2 0 0 0 2,2 h30" })
    }
  );
};
var PreviewDashMiddle = () => {
  return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
    "svg",
    {
      viewBox: "0 0 32 32",
      xmlns: "http://www.w3.org/2000/svg",
      fill: "none",
      stroke: "currentColor",
      strokeDasharray: "3.9 4",
      strokeDashoffset: "2",
      strokeWidth: "1",
      children: [
        /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("line", { x1: "0", y1: "0.5", x2: "100", y2: "0.5" }),
        /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("line", { x1: "0", y1: "31.5", x2: "100", y2: "31.5" })
      ]
    }
  );
};
var PreviewDashEnd = () => {
  return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
    "svg",
    {
      viewBox: "0 0 32 32",
      xmlns: "http://www.w3.org/2000/svg",
      fill: "none",
      stroke: "currentColor",
      strokeDasharray: "3.84516",
      strokeDashoffset: "1.9226",
      strokeWidth: "1",
      children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("path", { d: "M0,0.5 h29.5 a2,2 0 0 1 2,2 v27 a2,2 0 0 1 -2,2 h-29.5" })
    }
  );
};
function Day2(props) {
  const { day, modifiers, children, ...tdProps } = props;
  let PreviewDash;
  if (modifiers.preview_start && modifiers.preview_end) {
    PreviewDash = PreviewDashStartAndEnd;
  } else if (modifiers.preview_start) {
    PreviewDash = PreviewDashStart;
  } else if (modifiers.preview_end) {
    PreviewDash = PreviewDashEnd;
  } else if (modifiers.preview) {
    PreviewDash = PreviewDashMiddle;
  }
  return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("td", { ...tdProps, children: [
    PreviewDash && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(PreviewDash, {}),
    children
  ] });
}
function Root3({ rootRef, ...props }) {
  const { render: render4, ref, role, defaultAriaLabel } = (0, import_element25.useContext)(RootContext);
  const { months, labels } = useDayPicker();
  const hasExplicitLabel = props["aria-label"] !== void 0 || props["aria-labelledby"] !== void 0;
  let ariaLabel = props["aria-label"];
  if (!hasExplicitLabel && defaultAriaLabel && role === "application") {
    const currentMonth = months[0];
    ariaLabel = currentMonth ? (0, import_i18n5.sprintf)(
      // translators: 1: Calendar type. 2: Current month and year.
      (0, import_i18n5.__)("%1$s, %2$s"),
      defaultAriaLabel,
      labels.labelGrid(currentMonth.date)
    ) : defaultAriaLabel;
  }
  const mergedRef = (0, import_compose.useMergeRefs)([rootRef ?? null, ref ?? null]);
  return useRender({
    render: render4,
    defaultTagName: "div",
    ref: mergedRef,
    props: { ...props, role, "aria-label": ariaLabel }
  });
}
function NavButton({
  icon,
  className,
  children: _children,
  "aria-label": label,
  "aria-disabled": ariaDisabled,
  ...props
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
    IconButton,
    {
      ...props,
      className,
      label,
      icon,
      variant: "minimal",
      tone: "neutral",
      size: "compact",
      disabled: ariaDisabled === true || ariaDisabled === "true",
      focusableWhenDisabled: true
    }
  );
}
function PreviousMonthButton2(props) {
  return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(NavButton, { ...props, icon: chevron_left_default });
}
function NextMonthButton2(props) {
  return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(NavButton, { ...props, icon: chevron_right_default });
}

// packages/ui/build-module/calendar/utils/constants.mjs
var STYLE_HASH_ATTRIBUTE11 = "data-wp-hash";
function getRuntime11() {
  const globalScope = globalThis;
  if (globalScope.__wpStyleRuntime) {
    return globalScope.__wpStyleRuntime;
  }
  globalScope.__wpStyleRuntime = {
    documents: /* @__PURE__ */ new Map(),
    styles: /* @__PURE__ */ new Map(),
    injectedStyles: /* @__PURE__ */ new WeakMap()
  };
  if (typeof document !== "undefined") {
    registerDocument11(document);
  }
  return globalScope.__wpStyleRuntime;
}
function documentContainsStyleHash11(targetDocument, hash) {
  if (!targetDocument.head) {
    return false;
  }
  for (const style of targetDocument.head.querySelectorAll(
    `style[${STYLE_HASH_ATTRIBUTE11}]`
  )) {
    if (style.getAttribute(STYLE_HASH_ATTRIBUTE11) === hash) {
      return true;
    }
  }
  return false;
}
function injectStyle11(targetDocument, hash, css) {
  if (!targetDocument.head) {
    return;
  }
  const runtime = getRuntime11();
  let injectedStyles = runtime.injectedStyles.get(targetDocument);
  if (!injectedStyles) {
    injectedStyles = /* @__PURE__ */ new Set();
    runtime.injectedStyles.set(targetDocument, injectedStyles);
  }
  if (injectedStyles.has(hash)) {
    return;
  }
  if (documentContainsStyleHash11(targetDocument, hash)) {
    injectedStyles.add(hash);
    return;
  }
  const style = targetDocument.createElement("style");
  style.setAttribute(STYLE_HASH_ATTRIBUTE11, hash);
  style.appendChild(targetDocument.createTextNode(css));
  targetDocument.head.appendChild(style);
  injectedStyles.add(hash);
}
function registerDocument11(targetDocument) {
  const runtime = getRuntime11();
  runtime.documents.set(
    targetDocument,
    (runtime.documents.get(targetDocument) ?? 0) + 1
  );
  for (const [hash, css] of runtime.styles) {
    injectStyle11(targetDocument, hash, css);
  }
  return () => {
    const count = runtime.documents.get(targetDocument);
    if (count === void 0) {
      return;
    }
    if (count <= 1) {
      runtime.documents.delete(targetDocument);
      return;
    }
    runtime.documents.set(targetDocument, count - 1);
  };
}
function registerStyle11(hash, css) {
  const runtime = getRuntime11();
  runtime.styles.set(hash, css);
  for (const targetDocument of runtime.documents.keys()) {
    injectStyle11(targetDocument, hash, css);
  }
}
if (typeof process === "undefined" || true) {
  registerStyle11("9d2212290a", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._2c7ac60ba97b3411__root{--wp-ui-calendar-cell-size:var(--wpds-dimension-size-md,32px);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);display:inline-block;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);font-weight:var(--wpds-typography-font-weight-default,400);position:relative;z-index:0}._172c492625235710__day{color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);padding:0;position:relative;&:has(._1b64226e315835f8__day-button:disabled){color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d)}&:has(._1b64226e315835f8__day-button:focus-visible),&:has(._1b64226e315835f8__day-button:hover:not(:disabled)){color:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e)}}._1b64226e315835f8__day-button{align-items:center;background:none;border:none;border-radius:var(--wpds-border-radius-sm,2px);color:inherit;cursor:var(--wpds-cursor-control,pointer);display:flex;font:inherit;font-variant-numeric:tabular-nums;height:var(--wp-ui-calendar-cell-size);justify-content:center;margin:0;padding:0;position:relative;width:var(--wp-ui-calendar-cell-size);&:before{background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);border:none;border-radius:var(--wpds-border-radius-sm,2px);z-index:-1}&:after,&:before{content:"";inset:0;position:absolute}&:after{pointer-events:none;z-index:1}&:disabled{cursor:revert;&:before{background-color:var(--wpds-color-background-interactive-neutral-weak-disabled,#0000)}@media (forced-colors:active){text-decoration:line-through}}&:focus-visible:before,&:hover:not(:disabled):before{background-color:var(--wpds-color-background-interactive-neutral-weak-active,#ededed)}}._66b9a8120581fd4b__caption-label{align-items:center;border:0;display:inline-flex;position:relative;text-transform:capitalize;white-space:nowrap;z-index:1}._2c7ac60ba97b3411__root[dir=rtl] ._395a75bb1930f57e__nav-button{transform:rotate(180deg);transform-origin:50%}._337e5337d49b7f3d__month-caption{align-content:center;display:flex;height:var(--wp-ui-calendar-cell-size);justify-content:center;margin-bottom:var(--wpds-dimension-gap-md,12px)}._110e46230c68e498__months{display:flex;flex-wrap:wrap;gap:var(--wpds-dimension-gap-lg,16px);justify-content:center;max-width:fit-content;position:relative}._92915239fedb1fea__month-grid{border-collapse:separate;border-spacing:0 var(--wpds-dimension-gap-xs,4px)}._66b1d4a7b488b496__nav{align-items:center;display:flex;height:var(--wp-ui-calendar-cell-size);inset-block-start:0;inset-inline-end:0;inset-inline-start:0;justify-content:space-between;position:absolute}._7207199709ca5776__weekday{color:var(--wpds-color-foreground-content-neutral-weak,#707070);font-weight:var(--wpds-typography-font-weight-default,400);height:var(--wp-ui-calendar-cell-size);padding:0;text-align:center;text-transform:uppercase;width:var(--wp-ui-calendar-cell-size)}._058175f0f9c495e0__today:after{border:2px solid;border-radius:50%;content:"";height:0;inset-block-start:2px;inset-inline-end:2px;position:absolute;width:0;z-index:1}.acb642920fb0bef5__selected:not(._165d91a726feca9c__range-middle){&:has(._1b64226e315835f8__day-button,._1b64226e315835f8__day-button:hover:not(:disabled)){color:var(--wpds-color-foreground-interactive-neutral-strong,#f0f0f0)}&:has(._1b64226e315835f8__day-button:disabled){color:var(--wpds-color-foreground-interactive-neutral-strong-disabled,#8d8d8d)}._1b64226e315835f8__day-button{&:before{background-color:var(--wpds-color-background-interactive-neutral-strong,#2d2d2d);border:1px solid transparent}&:disabled:before{background-color:var(--wpds-color-background-interactive-neutral-strong-disabled,#e6e6e6)}&:hover:not(:disabled):before{background-color:var(--wpds-color-background-interactive-neutral-strong-active,#1e1e1e)}}}.c259c5c255fda10f__outside{color:var(--wpds-color-foreground-interactive-neutral-weak,#707070)}._4d8957a0ca4ec8f0__hidden{visibility:hidden}.f2523033db055ffe__range-start:not(.c04a453de7b11520__range-end) ._1b64226e315835f8__day-button{&,&:before{border-end-end-radius:0;border-start-end-radius:0}}._165d91a726feca9c__range-middle ._1b64226e315835f8__day-button{&:before{background-color:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);border-color:transparent;border-radius:0;border-style:solid;border-width:1px 0}}.c04a453de7b11520__range-end:not(.f2523033db055ffe__range-start) ._1b64226e315835f8__day-button{&,&:before{border-end-start-radius:0;border-start-start-radius:0}}._81b244e7c541d95e__preview svg{color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d);inset:0;pointer-events:none;position:absolute;@media (forced-colors:active){color:inherit}}._81b244e7c541d95e__preview.acb642920fb0bef5__selected:not(._165d91a726feca9c__range-middle) svg{display:none}._2c7ac60ba97b3411__root[dir=rtl] ._81b244e7c541d95e__preview svg{transform:scaleX(-1)}._81b244e7c541d95e__preview._165d91a726feca9c__range-middle ._1b64226e315835f8__day-button:before{border:none}@keyframes _255a1a462a5377db__slide-in-left{0%{transform:translateX(-100%)}to{transform:translateX(0)}}@keyframes c21e45f616d6db39__slide-in-right{0%{transform:translateX(100%)}to{transform:translateX(0)}}@keyframes aed80001de9ae226__slide-out-left{0%{transform:translateX(0)}to{transform:translateX(-100%)}}@keyframes _7d4779a7f29408f2__slide-out-right{0%{transform:translateX(0)}to{transform:translateX(100%)}}@keyframes _83ba6321b055d687__fade-in{0%{opacity:0}to{opacity:1}}@keyframes _96fbead71248d210__fade-out{0%{opacity:1}to{opacity:0}}._1563bccb09e39c30__caption-after-enter,._60ac2a7fc3208801__weeks-before-exit,._735dacf9052adecd__caption-before-exit,._7f73a6ab85101202__weeks-after-exit,._805d698b56ba4a29__weeks-after-enter,._9721326fbc23a5fb__weeks-before-enter,.c7a3082839155d29__caption-after-exit,.cb8a5ec82ad0885e__caption-before-enter{animation-duration:0s;animation-fill-mode:forwards;animation-timing-function:var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1));@media not (prefers-reduced-motion){animation-duration:var(--wpds-motion-duration-lg,.3s)}}._2c7ac60ba97b3411__root[dir=rtl] ._805d698b56ba4a29__weeks-after-enter,._9721326fbc23a5fb__weeks-before-enter{animation-name:_255a1a462a5377db__slide-in-left}._2c7ac60ba97b3411__root[dir=rtl] ._7f73a6ab85101202__weeks-after-exit,._60ac2a7fc3208801__weeks-before-exit{animation-name:aed80001de9ae226__slide-out-left}._2c7ac60ba97b3411__root[dir=rtl] ._9721326fbc23a5fb__weeks-before-enter,._805d698b56ba4a29__weeks-after-enter{animation-name:c21e45f616d6db39__slide-in-right}._2c7ac60ba97b3411__root[dir=rtl] ._60ac2a7fc3208801__weeks-before-exit,._7f73a6ab85101202__weeks-after-exit{animation-name:_7d4779a7f29408f2__slide-out-right}._1563bccb09e39c30__caption-after-enter,.cb8a5ec82ad0885e__caption-before-enter{animation-name:_83ba6321b055d687__fade-in}._735dacf9052adecd__caption-before-exit,.c7a3082839155d29__caption-after-exit{animation-name:_96fbead71248d210__fade-out}}}');
}
var style_default10 = { "root": "_2c7ac60ba97b3411__root", "day": "_172c492625235710__day", "day-button": "_1b64226e315835f8__day-button", "caption-label": "_66b9a8120581fd4b__caption-label", "nav-button": "_395a75bb1930f57e__nav-button", "month-caption": "_337e5337d49b7f3d__month-caption", "months": "_110e46230c68e498__months", "month-grid": "_92915239fedb1fea__month-grid", "nav": "_66b1d4a7b488b496__nav", "weekday": "_7207199709ca5776__weekday", "today": "_058175f0f9c495e0__today", "selected": "acb642920fb0bef5__selected", "range-middle": "_165d91a726feca9c__range-middle", "outside": "c259c5c255fda10f__outside", "hidden": "_4d8957a0ca4ec8f0__hidden", "range-start": "f2523033db055ffe__range-start", "range-end": "c04a453de7b11520__range-end", "preview": "_81b244e7c541d95e__preview", "weeks-before-enter": "_9721326fbc23a5fb__weeks-before-enter", "weeks-before-exit": "_60ac2a7fc3208801__weeks-before-exit", "weeks-after-enter": "_805d698b56ba4a29__weeks-after-enter", "weeks-after-exit": "_7f73a6ab85101202__weeks-after-exit", "caption-after-enter": "_1563bccb09e39c30__caption-after-enter", "caption-after-exit": "c7a3082839155d29__caption-after-exit", "caption-before-enter": "cb8a5ec82ad0885e__caption-before-enter", "caption-before-exit": "_735dacf9052adecd__caption-before-exit", "slide-in-left": "_255a1a462a5377db__slide-in-left", "slide-out-left": "aed80001de9ae226__slide-out-left", "slide-in-right": "c21e45f616d6db39__slide-in-right", "slide-out-right": "_7d4779a7f29408f2__slide-out-right", "fade-in": "_83ba6321b055d687__fade-in", "fade-out": "_96fbead71248d210__fade-out" };
if (typeof process === "undefined" || true) {
  registerStyle11("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}");
}
var resets_default4 = { "box-sizing": "_336cd3e4e743482f__box-sizing" };
if (typeof process === "undefined" || true) {
  registerStyle11("08122b3d53", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{.af79fb116edb0dd7__outset-ring--focus:focus,.dfcfdc28396e5d98__outset-ring--focus-visible:focus-visible,.e5cd9ee879f6403a__outset-ring--focus-within:focus-within,:focus-visible ._81935a08e952f267__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within,.abc777e9713fa711__outset-ring--focus-except-active:focus{outline:none}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.abc777e9713fa711__outset-ring--focus-except-active:focus:not(:active){--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}}");
}
var focus_module_default3 = { "outset-ring--focus": "af79fb116edb0dd7__outset-ring--focus", "outset-ring--focus-visible": "dfcfdc28396e5d98__outset-ring--focus-visible", "outset-ring--focus-within": "e5cd9ee879f6403a__outset-ring--focus-within", "outset-ring--focus-parent-visible": "_81935a08e952f267__outset-ring--focus-parent-visible", "outset-ring--focus-except-active": "abc777e9713fa711__outset-ring--focus-except-active", "outset-ring--focus-within-except-active": "_3c9f5ee9fc9c136d__outset-ring--focus-within-except-active" };
if (typeof process === "undefined" || true) {
  registerStyle11("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}");
}
var global_css_defense_default4 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" };
var CLASSNAMES = {
  root: clsx_default(style_default10.root, resets_default4["box-sizing"]),
  day: style_default10.day,
  day_button: clsx_default(
    style_default10["day-button"],
    global_css_defense_default4.button,
    focus_module_default3["outset-ring--focus-visible"]
  ),
  outside: style_default10.outside,
  caption_label: style_default10["caption-label"],
  button_next: style_default10["nav-button"],
  button_previous: style_default10["nav-button"],
  nav: style_default10.nav,
  month_caption: style_default10["month-caption"],
  months: style_default10.months,
  month_grid: style_default10["month-grid"],
  weekday: style_default10.weekday,
  today: style_default10.today,
  selected: style_default10.selected,
  /*
   * Disabled days are styled through `:has(.day-button:disabled)` rather than
   * a modifier class on the cell, because the two are not equivalent: the
   * focused day keeps its button enabled so it stays reachable. Mapped to
   * `undefined` on purpose, so `@daypicker/react` doesn't fall back to its
   * own `rdp-disabled` class for a modifier we don't style.
   */
  disabled: void 0,
  hidden: style_default10.hidden,
  range_start: style_default10["range-start"],
  range_end: style_default10["range-end"],
  range_middle: style_default10["range-middle"],
  weeks_before_enter: style_default10["weeks-before-enter"],
  weeks_before_exit: style_default10["weeks-before-exit"],
  weeks_after_enter: style_default10["weeks-after-enter"],
  weeks_after_exit: style_default10["weeks-after-exit"],
  caption_after_enter: style_default10["caption-after-enter"],
  caption_after_exit: style_default10["caption-after-exit"],
  caption_before_enter: style_default10["caption-before-enter"],
  caption_before_exit: style_default10["caption-before-exit"]
};
var MODIFIER_CLASSNAMES = {
  preview: style_default10.preview
};
var COMMON_PROPS = {
  animate: true,
  // Only show days in the current month
  showOutsideDays: false,
  // Hide week number column
  showWeekNumber: false,
  // Show weekdays row
  hideWeekdays: false,
  // Month and year caption are not interactive
  captionLayout: "label",
  // Show a variable number of weeks depending on the month
  fixedWeeks: false,
  // Show navigation buttons
  hideNavigation: false,
  // Class names
  classNames: CLASSNAMES,
  components: {
    Day: Day2,
    Root: Root3,
    PreviousMonthButton: PreviousMonthButton2,
    NextMonthButton: NextMonthButton2
  }
};

// packages/ui/build-module/calendar/utils/misc.mjs
function clampNumberOfMonths(numberOfMonths) {
  return Math.min(3, Math.max(1, numberOfMonths));
}

// packages/ui/build-module/calendar/utils/use-controlled-value.mjs
var import_element26 = __toESM(require_element(), 1);
function useControlledValue2({
  defaultValue,
  onChange,
  value: valueProp
}) {
  const hasValue = typeof valueProp !== "undefined";
  const initialValue = hasValue ? valueProp : defaultValue;
  const [state, setState] = (0, import_element26.useState)(initialValue);
  const value = hasValue ? valueProp : state;
  const uncontrolledSetValue = (0, import_element26.useCallback)(
    (nextValue, ...args) => {
      setState(nextValue);
      onChange?.(nextValue, ...args);
    },
    [onChange]
  );
  let setValue;
  if (hasValue && typeof onChange === "function") {
    setValue = onChange;
  } else if (!hasValue && typeof onChange === "function") {
    setValue = uncontrolledSetValue;
  } else {
    setValue = setState;
  }
  return [value, setValue];
}

// packages/ui/build-module/calendar/utils/use-localization-props.mjs
var import_i18n6 = __toESM(require_i18n(), 1);
var import_element27 = __toESM(require_element(), 1);
function isLocaleRTL(locale) {
  const direction = (locale.getTextInfo?.() ?? locale.textInfo)?.direction;
  if (direction) {
    return direction === "rtl";
  }
  return [
    "ar",
    // Arabic
    "he",
    // Hebrew
    "fa",
    // Persian (Farsi)
    "ur",
    // Urdu
    "ps",
    // Pashto
    "syr",
    // Syriac
    "dv",
    // Divehi
    "ku",
    // Kurdish (Sorani)
    "ckb",
    // Central Kurdish (Sorani)
    "ug",
    // Uyghur
    "yi"
    // Yiddish
  ].includes(locale.language);
}
function getSupportedLocaleCode(localeCode) {
  if (!localeCode) {
    return;
  }
  let supportedLocaleCode;
  try {
    supportedLocaleCode = Intl.DateTimeFormat.supportedLocalesOf([
      localeCode
    ])[0];
  } catch {
  }
  return supportedLocaleCode;
}
function getWeekStartsOn(locale) {
  const firstDay = (locale.getWeekInfo?.() ?? locale.weekInfo)?.firstDay;
  if (firstDay === void 0 || firstDay < 1 || firstDay > 7) {
    return;
  }
  return firstDay % 7;
}
var useLocalizationProps = ({
  locale,
  timeZone,
  mode
}) => {
  return (0, import_element27.useMemo)(() => {
    const isLocaleString = typeof locale === "string";
    const dateFnsLocale = isLocaleString || locale === void 0 ? enUS : locale;
    const supportedLocaleCode = getSupportedLocaleCode(
      isLocaleString ? locale : locale?.code
    );
    const localeCode = supportedLocaleCode ?? "en-US";
    const intlLocale = new Intl.Locale(localeCode);
    const isRightToLeft = supportedLocaleCode !== void 0 ? isLocaleRTL(intlLocale) : (0, import_i18n6.isRTL)();
    const weekStartsOn = isLocaleString || supportedLocaleCode !== void 0 ? getWeekStartsOn(intlLocale) : void 0;
    const monthNameFormatter = new Intl.DateTimeFormat(localeCode, {
      calendar: "gregory",
      year: "numeric",
      month: "long",
      timeZone
    });
    const weekdayNarrowFormatter = new Intl.DateTimeFormat(localeCode, {
      calendar: "gregory",
      weekday: "narrow",
      timeZone
    });
    const weekdayLongFormatter = new Intl.DateTimeFormat(localeCode, {
      calendar: "gregory",
      weekday: "long",
      timeZone
    });
    const fullDateFormatter = new Intl.DateTimeFormat(localeCode, {
      calendar: "gregory",
      weekday: "long",
      year: "numeric",
      month: "long",
      day: "numeric",
      timeZone
    });
    const dayNumberFormatter = new Intl.DateTimeFormat(localeCode, {
      calendar: "gregory",
      day: "numeric",
      timeZone
    });
    return {
      "aria-label": mode === "single" ? (0, import_i18n6.__)("Date calendar") : (0, import_i18n6.__)("Date range calendar"),
      labels: {
        /** The label for the navigation toolbar. */
        labelNav: () => (0, import_i18n6.__)("Navigation bar"),
        /**
         * The label for the month grid.
         * @param date
         */
        labelGrid: monthNameFormatter.format,
        /**
         * The label for the gridcell, when the calendar is not interactive.
         * @param date
         * @param modifiers
         */
        labelGridcell: (date, modifiers) => {
          const formattedDate = fullDateFormatter.format(date);
          let label = formattedDate;
          if (modifiers?.today) {
            label = (0, import_i18n6.sprintf)(
              // translators: %s is the full date (e.g. "Monday, April 29, 2025")
              (0, import_i18n6.__)("Today, %s"),
              formattedDate
            );
          }
          return label;
        },
        /** The label for the "next month" button. */
        labelNext: () => (0, import_i18n6.__)("Next month"),
        /** The label for the "previous month" button. */
        labelPrevious: () => (0, import_i18n6.__)("Previous month"),
        /**
         * The label for the day button.
         * @param date
         * @param modifiers
         */
        labelDayButton: (date, modifiers) => {
          const formattedDate = fullDateFormatter.format(date);
          let label = formattedDate;
          if (modifiers?.today && modifiers?.selected) {
            return (0, import_i18n6.sprintf)(
              // translators: %s is the full date (e.g. "Monday, April 29, 2025")
              (0, import_i18n6.__)("Today, %s, selected"),
              formattedDate
            );
          }
          if (modifiers?.today) {
            label = (0, import_i18n6.sprintf)(
              // translators: %s is the full date (e.g. "Monday, April 29, 2025")
              (0, import_i18n6.__)("Today, %s"),
              formattedDate
            );
          }
          if (modifiers?.selected) {
            label = (0, import_i18n6.sprintf)(
              // translators: %s is the full date (e.g. "Monday, April 29, 2025")
              (0, import_i18n6.__)("%s, selected"),
              formattedDate
            );
          }
          return label;
        },
        /**
         * The label for the weekday.
         * @param date
         */
        labelWeekday: weekdayLongFormatter.format
      },
      locale: dateFnsLocale,
      lang: localeCode,
      dir: isRightToLeft ? "rtl" : "ltr",
      ...weekStartsOn === void 0 ? {} : { weekStartsOn },
      formatters: {
        formatDay: dayNumberFormatter.format,
        formatWeekdayName: weekdayNarrowFormatter.format,
        formatCaption: monthNameFormatter.format
      },
      timeZone
    };
  }, [locale, timeZone, mode]);
};

// packages/ui/build-module/calendar/utils/use-preserve-day-focus.mjs
var import_compose2 = __toESM(require_compose(), 1);
var import_element28 = __toESM(require_element(), 1);
function usePreserveDayFocus(forwardedRef, month) {
  const rootRef = (0, import_element28.useRef)(null);
  const hadDayFocusRef = (0, import_element28.useRef)(false);
  const mergedRef = (0, import_compose2.useMergeRefs)([rootRef, forwardedRef]);
  const monthIndex = month ? month.getFullYear() * 12 + month.getMonth() : void 0;
  const onDayFocus = (0, import_element28.useCallback)(() => {
    hadDayFocusRef.current = true;
  }, []);
  const onDayBlur = (0, import_element28.useCallback)(() => {
    hadDayFocusRef.current = false;
  }, []);
  (0, import_element28.useEffect)(() => {
    if (!hadDayFocusRef.current) {
      return;
    }
    const root = rootRef.current;
    if (!root) {
      return;
    }
    const { activeElement: activeElement2, body } = root.ownerDocument;
    if (activeElement2 !== body) {
      const grid = activeElement2?.closest('[role="grid"]');
      hadDayFocusRef.current = !!grid && root.contains(grid);
      return;
    }
    hadDayFocusRef.current = false;
    const focusTarget = root.querySelector(
      '[role="grid"] button[tabindex="0"]:not(:disabled)'
    );
    const enabledControl = root.querySelector(
      'button:not(:disabled):not([aria-disabled="true"])'
    );
    const focusableControl = root.querySelector(
      "button:not(:disabled)"
    );
    (focusTarget ?? enabledControl ?? focusableControl)?.focus();
  }, [monthIndex]);
  return { ref: mergedRef, onDayFocus, onDayBlur };
}

// packages/ui/build-module/calendar/calendar.mjs
var import_jsx_runtime64 = __toESM(require_jsx_runtime(), 1);
var Calendar = (0, import_element29.forwardRef)(
  function Calendar2({
    defaultValue,
    value: valueProp,
    onValueChange,
    numberOfMonths = 1,
    locale,
    timeZone,
    month,
    render: render4,
    role = "application",
    "aria-label": ariaLabel,
    labels: customLabels,
    ...props
  }, ref) {
    const { "aria-label": defaultAriaLabel, ...localizationProps } = useLocalizationProps({
      locale,
      timeZone,
      mode: "single"
    });
    const labels = (0, import_element29.useMemo)(
      () => customLabels ? { ...localizationProps.labels, ...customLabels } : localizationProps.labels,
      [localizationProps.labels, customLabels]
    );
    const onChange = (0, import_element29.useCallback)(
      (selected2, triggerDate, modifiers, e) => {
        onValueChange?.(
          selected2 ?? null,
          triggerDate,
          modifiers,
          e
        );
      },
      [onValueChange]
    );
    const [selected, setSelected] = useControlledValue2({
      defaultValue,
      value: valueProp,
      onChange
    });
    const dayFocusProps = usePreserveDayFocus(ref, month);
    const rootContextValue = (0, import_element29.useMemo)(
      () => ({
        render: render4,
        ref: dayFocusProps.ref,
        role,
        defaultAriaLabel
      }),
      [render4, dayFocusProps.ref, role, defaultAriaLabel]
    );
    return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(RootContext.Provider, { value: rootContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
      DayPicker,
      {
        ...COMMON_PROPS,
        ...localizationProps,
        ...props,
        "aria-label": ariaLabel,
        mode: "single",
        month,
        numberOfMonths: clampNumberOfMonths(numberOfMonths),
        labels,
        selected: selected ?? void 0,
        onSelect: setSelected,
        onDayFocus: dayFocusProps.onDayFocus,
        onDayBlur: dayFocusProps.onDayBlur
      }
    ) });
  }
);

// packages/ui/build-module/calendar/range-calendar.mjs
var import_element30 = __toESM(require_element(), 1);
var import_jsx_runtime65 = __toESM(require_jsx_runtime(), 1);
function usePreviewRange({
  value,
  hoveredDate,
  excludeDisabled,
  resetOnSelect,
  min: min4,
  max: max4,
  disabled: disabled2
}) {
  return (0, import_element30.useMemo)(() => {
    if (!hoveredDate || !value?.from) {
      return;
    }
    if (resetOnSelect && value.to) {
      return {
        from: hoveredDate,
        to: hoveredDate
      };
    }
    let previewHighlight;
    let potentialNewRange;
    if (hoveredDate < value.from) {
      previewHighlight = {
        from: hoveredDate,
        to: value.from
      };
      potentialNewRange = {
        from: hoveredDate,
        to: value.to ?? value.from
      };
    } else if (value.to && hoveredDate > value.from && hoveredDate < value.to) {
      previewHighlight = {
        from: value.from,
        to: hoveredDate
      };
      potentialNewRange = {
        from: value.from,
        to: hoveredDate
      };
    } else if (hoveredDate > value.from) {
      previewHighlight = {
        from: value.to ?? value.from,
        to: hoveredDate
      };
      potentialNewRange = {
        from: value.from,
        to: hoveredDate
      };
    }
    if (min4 !== void 0 && min4 > 0 && potentialNewRange && differenceInCalendarDays(
      potentialNewRange.to,
      potentialNewRange.from
    ) < min4) {
      previewHighlight = {
        from: hoveredDate,
        to: hoveredDate
      };
    }
    if (max4 !== void 0 && max4 > 0 && potentialNewRange && differenceInCalendarDays(
      potentialNewRange.to,
      potentialNewRange.from
    ) > max4) {
      previewHighlight = {
        from: hoveredDate,
        to: hoveredDate
      };
    }
    if (excludeDisabled && disabled2 && potentialNewRange && rangeContainsModifiers(potentialNewRange, disabled2)) {
      previewHighlight = {
        from: hoveredDate,
        to: hoveredDate
      };
    }
    return previewHighlight;
  }, [
    value,
    hoveredDate,
    excludeDisabled,
    resetOnSelect,
    min4,
    max4,
    disabled2
  ]);
}
var RangeCalendar = (0, import_element30.forwardRef)(
  function RangeCalendar2({
    defaultValue,
    value: valueProp,
    onValueChange,
    numberOfMonths = 1,
    excludeDisabled,
    resetOnSelect = true,
    min: min4,
    max: max4,
    disabled: disabled2,
    locale,
    timeZone,
    month,
    render: render4,
    role = "application",
    "aria-label": ariaLabel,
    labels: customLabels,
    ...props
  }, ref) {
    const { "aria-label": defaultAriaLabel, ...localizationProps } = useLocalizationProps({
      locale,
      timeZone,
      mode: "range"
    });
    const labels = (0, import_element30.useMemo)(
      () => customLabels ? { ...localizationProps.labels, ...customLabels } : localizationProps.labels,
      [localizationProps.labels, customLabels]
    );
    const onChange = (0, import_element30.useCallback)(
      (selected2, triggerDate, modifiers2, e) => {
        onValueChange?.(
          selected2 ?? null,
          triggerDate,
          modifiers2,
          e
        );
      },
      [onValueChange]
    );
    const [selected, setSelected] = useControlledValue2({
      defaultValue,
      value: valueProp,
      onChange
    });
    const dayFocusProps = usePreserveDayFocus(ref, month);
    const [hoveredDate, setHoveredDate] = (0, import_element30.useState)(
      void 0
    );
    const previewRange = usePreviewRange({
      value: selected,
      hoveredDate,
      excludeDisabled,
      resetOnSelect,
      min: min4,
      max: max4,
      disabled: disabled2
    });
    const modifiers = (0, import_element30.useMemo)(() => {
      return {
        preview: previewRange,
        preview_start: previewRange?.from,
        preview_end: previewRange?.to
      };
    }, [previewRange]);
    const rootContextValue = (0, import_element30.useMemo)(
      () => ({
        render: render4,
        ref: dayFocusProps.ref,
        role,
        defaultAriaLabel
      }),
      [render4, dayFocusProps.ref, role, defaultAriaLabel]
    );
    return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(RootContext.Provider, { value: rootContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
      DayPicker,
      {
        ...COMMON_PROPS,
        ...localizationProps,
        ...props,
        "aria-label": ariaLabel,
        mode: "range",
        month,
        numberOfMonths: clampNumberOfMonths(numberOfMonths),
        disabled: disabled2,
        excludeDisabled,
        resetOnSelect,
        min: min4,
        max: max4,
        labels,
        selected: selected ?? void 0,
        onSelect: setSelected,
        onDayFocus: dayFocusProps.onDayFocus,
        onDayBlur: dayFocusProps.onDayBlur,
        onDayMouseEnter: (date) => setHoveredDate(date),
        onDayMouseLeave: () => setHoveredDate(void 0),
        modifiers,
        modifiersClassNames: MODIFIER_CLASSNAMES
      }
    ) });
  }
);

// packages/ui/build-module/card/index.mjs
var card_exports = {};
__export(card_exports, {
  Content: () => Content,
  FullBleed: () => FullBleed,
  Header: () => Header,
  Root: () => Root4,
  Title: () => Title
});

// packages/ui/build-module/card/root.mjs
var import_element31 = __toESM(require_element(), 1);
var STYLE_HASH_ATTRIBUTE12 = "data-wp-hash";
function getRuntime12() {
  const globalScope = globalThis;
  if (globalScope.__wpStyleRuntime) {
    return globalScope.__wpStyleRuntime;
  }
  globalScope.__wpStyleRuntime = {
    documents: /* @__PURE__ */ new Map(),
    styles: /* @__PURE__ */ new Map(),
    injectedStyles: /* @__PURE__ */ new WeakMap()
  };
  if (typeof document !== "undefined") {
    registerDocument12(document);
  }
  return globalScope.__wpStyleRuntime;
}
function documentContainsStyleHash12(targetDocument, hash) {
  if (!targetDocument.head) {
    return false;
  }
  for (const style of targetDocument.head.querySelectorAll(
    `style[${STYLE_HASH_ATTRIBUTE12}]`
  )) {
    if (style.getAttribute(STYLE_HASH_ATTRIBUTE12) === hash) {
      return true;
    }
  }
  return false;
}
function injectStyle12(targetDocument, hash, css) {
  if (!targetDocument.head) {
    return;
  }
  const runtime = getRuntime12();
  let injectedStyles = runtime.injectedStyles.get(targetDocument);
  if (!injectedStyles) {
    injectedStyles = /* @__PURE__ */ new Set();
    runtime.injectedStyles.set(targetDocument, injectedStyles);
  }
  if (injectedStyles.has(hash)) {
    return;
  }
  if (documentContainsStyleHash12(targetDocument, hash)) {
    injectedStyles.add(hash);
    return;
  }
  const style = targetDocument.createElement("style");
  style.setAttribute(STYLE_HASH_ATTRIBUTE12, hash);
  style.appendChild(targetDocument.createTextNode(css));
  targetDocument.head.appendChild(style);
  injectedStyles.add(hash);
}
function registerDocument12(targetDocument) {
  const runtime = getRuntime12();
  runtime.documents.set(
    targetDocument,
    (runtime.documents.get(targetDocument) ?? 0) + 1
  );
  for (const [hash, css] of runtime.styles) {
    injectStyle12(targetDocument, hash, css);
  }
  return () => {
    const count = runtime.documents.get(targetDocument);
    if (count === void 0) {
      return;
    }
    if (count <= 1) {
      runtime.documents.delete(targetDocument);
      return;
    }
    runtime.documents.set(targetDocument, count - 1);
  };
}
function registerStyle12(hash, css) {
  const runtime = getRuntime12();
  runtime.styles.set(hash, css);
  for (const targetDocument of runtime.documents.keys()) {
    injectStyle12(targetDocument, hash, css);
  }
}
if (typeof process === "undefined" || true) {
  registerStyle12("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}");
}
var resets_default5 = { "box-sizing": "_336cd3e4e743482f__box-sizing" };
if (typeof process === "undefined" || true) {
  registerStyle12("cb866dcef6", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._02872bf298eadc43__root{--wp-ui-card-padding:var(--wpds-dimension-padding-2xl,24px);--wp-ui-card-header-content-gap:var(--wpds-dimension-gap-xl,24px);--wp-ui-card-header-content-margin:calc(var(--wp-ui-card-header-content-gap) - var(--wp-ui-card-padding));background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:1px solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-lg,8px);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);display:flex;flex-direction:column;overflow:clip}._5dffdaf2a6e669ac__content,.bbccc92e6ba5662d__header{padding:var(--wp-ui-card-padding);&:not(:first-child):not(:last-child){padding-block-end:0}}.bbccc92e6ba5662d__header+._5dffdaf2a6e669ac__content{margin-block-start:var(--wp-ui-card-header-content-margin);padding-block-start:0}.c1fa192587e1b4a6__fullbleed{margin-inline:calc(var(--wp-ui-card-padding)*-1);width:calc(100% + var(--wp-ui-card-padding)*2)}._02872bf298eadc43__root>:is(.bbccc92e6ba5662d__header,._5dffdaf2a6e669ac__content):first-child>.c1fa192587e1b4a6__fullbleed:first-child{margin-block-start:calc(var(--wp-ui-card-padding)*-1)}:is(.bbccc92e6ba5662d__header,._5dffdaf2a6e669ac__content):last-child>.c1fa192587e1b4a6__fullbleed:last-child{margin-block-end:calc(var(--wp-ui-card-padding)*-1)}}}");
}
var style_default11 = { "root": "_02872bf298eadc43__root", "header": "bbccc92e6ba5662d__header", "content": "_5dffdaf2a6e669ac__content", "fullbleed": "c1fa192587e1b4a6__fullbleed" };
var Root4 = (0, import_element31.forwardRef)(function Card({ render: render4, ...restProps }, ref) {
  const mergedClassName = clsx_default(style_default11.root, resets_default5["box-sizing"]);
  const element = useRender({
    defaultTagName: "div",
    render: render4,
    ref,
    props: mergeProps({ className: mergedClassName }, restProps)
  });
  return element;
});

// packages/ui/build-module/card/header.mjs
var import_element32 = __toESM(require_element(), 1);
var STYLE_HASH_ATTRIBUTE13 = "data-wp-hash";
function getRuntime13() {
  const globalScope = globalThis;
  if (globalScope.__wpStyleRuntime) {
    return globalScope.__wpStyleRuntime;
  }
  globalScope.__wpStyleRuntime = {
    documents: /* @__PURE__ */ new Map(),
    styles: /* @__PURE__ */ new Map(),
    injectedStyles: /* @__PURE__ */ new WeakMap()
  };
  if (typeof document !== "undefined") {
    registerDocument13(document);
  }
  return globalScope.__wpStyleRuntime;
}
function documentContainsStyleHash13(targetDocument, hash) {
  if (!targetDocument.head) {
    return false;
  }
  for (const style of targetDocument.head.querySelectorAll(
    `style[${STYLE_HASH_ATTRIBUTE13}]`
  )) {
    if (style.getAttribute(STYLE_HASH_ATTRIBUTE13) === hash) {
      return true;
    }
  }
  return false;
}
function injectStyle13(targetDocument, hash, css) {
  if (!targetDocument.head) {
    return;
  }
  const runtime = getRuntime13();
  let injectedStyles = runtime.injectedStyles.get(targetDocument);
  if (!injectedStyles) {
    injectedStyles = /* @__PURE__ */ new Set();
    runtime.injectedStyles.set(targetDocument, injectedStyles);
  }
  if (injectedStyles.has(hash)) {
    return;
  }
  if (documentContainsStyleHash13(targetDocument, hash)) {
    injectedStyles.add(hash);
    return;
  }
  const style = targetDocument.createElement("style");
  style.setAttribute(STYLE_HASH_ATTRIBUTE13, hash);
  style.appendChild(targetDocument.createTextNode(css));
  targetDocument.head.appendChild(style);
  injectedStyles.add(hash);
}
function registerDocument13(targetDocument) {
  const runtime = getRuntime13();
  runtime.documents.set(
    targetDocument,
    (runtime.documents.get(targetDocument) ?? 0) + 1
  );
  for (const [hash, css] of runtime.styles) {
    injectStyle13(targetDocument, hash, css);
  }
  return () => {
    const count = runtime.documents.get(targetDocument);
    if (count === void 0) {
      return;
    }
    if (count <= 1) {
      runtime.documents.delete(targetDocument);
      return;
    }
    runtime.documents.set(targetDocument, count - 1);
  };
}
function registerStyle13(hash, css) {
  const runtime = getRuntime13();
  runtime.styles.set(hash, css);
  for (const targetDocument of runtime.documents.keys()) {
    injectStyle13(targetDocument, hash, css);
  }
}
if (typeof process === "undefined" || true) {
  registerStyle13("cb866dcef6", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._02872bf298eadc43__root{--wp-ui-card-padding:var(--wpds-dimension-padding-2xl,24px);--wp-ui-card-header-content-gap:var(--wpds-dimension-gap-xl,24px);--wp-ui-card-header-content-margin:calc(var(--wp-ui-card-header-content-gap) - var(--wp-ui-card-padding));background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:1px solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-lg,8px);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);display:flex;flex-direction:column;overflow:clip}._5dffdaf2a6e669ac__content,.bbccc92e6ba5662d__header{padding:var(--wp-ui-card-padding);&:not(:first-child):not(:last-child){padding-block-end:0}}.bbccc92e6ba5662d__header+._5dffdaf2a6e669ac__content{margin-block-start:var(--wp-ui-card-header-content-margin);padding-block-start:0}.c1fa192587e1b4a6__fullbleed{margin-inline:calc(var(--wp-ui-card-padding)*-1);width:calc(100% + var(--wp-ui-card-padding)*2)}._02872bf298eadc43__root>:is(.bbccc92e6ba5662d__header,._5dffdaf2a6e669ac__content):first-child>.c1fa192587e1b4a6__fullbleed:first-child{margin-block-start:calc(var(--wp-ui-card-padding)*-1)}:is(.bbccc92e6ba5662d__header,._5dffdaf2a6e669ac__content):last-child>.c1fa192587e1b4a6__fullbleed:last-child{margin-block-end:calc(var(--wp-ui-card-padding)*-1)}}}");
}
var style_default12 = { "root": "_02872bf298eadc43__root", "header": "bbccc92e6ba5662d__header", "content": "_5dffdaf2a6e669ac__content", "fullbleed": "c1fa192587e1b4a6__fullbleed" };
var Header = (0, import_element32.forwardRef)(
  function CardHeader({ render: render4, ...props }, ref) {
    const element = useRender({
      defaultTagName: "div",
      render: render4,
      ref,
      props: mergeProps({ className: style_default12.header }, props)
    });
    return element;
  }
);

// packages/ui/build-module/card/content.mjs
var import_element33 = __toESM(require_element(), 1);
var STYLE_HASH_ATTRIBUTE14 = "data-wp-hash";
function getRuntime14() {
  const globalScope = globalThis;
  if (globalScope.__wpStyleRuntime) {
    return globalScope.__wpStyleRuntime;
  }
  globalScope.__wpStyleRuntime = {
    documents: /* @__PURE__ */ new Map(),
    styles: /* @__PURE__ */ new Map(),
    injectedStyles: /* @__PURE__ */ new WeakMap()
  };
  if (typeof document !== "undefined") {
    registerDocument14(document);
  }
  return globalScope.__wpStyleRuntime;
}
function documentContainsStyleHash14(targetDocument, hash) {
  if (!targetDocument.head) {
    return false;
  }
  for (const style of targetDocument.head.querySelectorAll(
    `style[${STYLE_HASH_ATTRIBUTE14}]`
  )) {
    if (style.getAttribute(STYLE_HASH_ATTRIBUTE14) === hash) {
      return true;
    }
  }
  return false;
}
function injectStyle14(targetDocument, hash, css) {
  if (!targetDocument.head) {
    return;
  }
  const runtime = getRuntime14();
  let injectedStyles = runtime.injectedStyles.get(targetDocument);
  if (!injectedStyles) {
    injectedStyles = /* @__PURE__ */ new Set();
    runtime.injectedStyles.set(targetDocument, injectedStyles);
  }
  if (injectedStyles.has(hash)) {
    return;
  }
  if (documentContainsStyleHash14(targetDocument, hash)) {
    injectedStyles.add(hash);
    return;
  }
  const style = targetDocument.createElement("style");
  style.setAttribute(STYLE_HASH_ATTRIBUTE14, hash);
  style.appendChild(targetDocument.createTextNode(css));
  targetDocument.head.appendChild(style);
  injectedStyles.add(hash);
}
function registerDocument14(targetDocument) {
  const runtime = getRuntime14();
  runtime.documents.set(
    targetDocument,
    (runtime.documents.get(targetDocument) ?? 0) + 1
  );
  for (const [hash, css] of runtime.styles) {
    injectStyle14(targetDocument, hash, css);
  }
  return () => {
    const count = runtime.documents.get(targetDocument);
    if (count === void 0) {
      return;
    }
    if (count <= 1) {
      runtime.documents.delete(targetDocument);
      return;
    }
    runtime.documents.set(targetDocument, count - 1);
  };
}
function registerStyle14(hash, css) {
  const runtime = getRuntime14();
  runtime.styles.set(hash, css);
  for (const targetDocument of runtime.documents.keys()) {
    injectStyle14(targetDocument, hash, css);
  }
}
if (typeof process === "undefined" || true) {
  registerStyle14("cb866dcef6", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._02872bf298eadc43__root{--wp-ui-card-padding:var(--wpds-dimension-padding-2xl,24px);--wp-ui-card-header-content-gap:var(--wpds-dimension-gap-xl,24px);--wp-ui-card-header-content-margin:calc(var(--wp-ui-card-header-content-gap) - var(--wp-ui-card-padding));background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:1px solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-lg,8px);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);display:flex;flex-direction:column;overflow:clip}._5dffdaf2a6e669ac__content,.bbccc92e6ba5662d__header{padding:var(--wp-ui-card-padding);&:not(:first-child):not(:last-child){padding-block-end:0}}.bbccc92e6ba5662d__header+._5dffdaf2a6e669ac__content{margin-block-start:var(--wp-ui-card-header-content-margin);padding-block-start:0}.c1fa192587e1b4a6__fullbleed{margin-inline:calc(var(--wp-ui-card-padding)*-1);width:calc(100% + var(--wp-ui-card-padding)*2)}._02872bf298eadc43__root>:is(.bbccc92e6ba5662d__header,._5dffdaf2a6e669ac__content):first-child>.c1fa192587e1b4a6__fullbleed:first-child{margin-block-start:calc(var(--wp-ui-card-padding)*-1)}:is(.bbccc92e6ba5662d__header,._5dffdaf2a6e669ac__content):last-child>.c1fa192587e1b4a6__fullbleed:last-child{margin-block-end:calc(var(--wp-ui-card-padding)*-1)}}}");
}
var style_default13 = { "root": "_02872bf298eadc43__root", "header": "bbccc92e6ba5662d__header", "content": "_5dffdaf2a6e669ac__content", "fullbleed": "c1fa192587e1b4a6__fullbleed" };
var Content = (0, import_element33.forwardRef)(
  function CardContent({ render: render4, ...props }, ref) {
    const element = useRender({
      defaultTagName: "div",
      render: render4,
      ref,
      props: mergeProps({ className: style_default13.content }, props)
    });
    return element;
  }
);

// packages/ui/build-module/card/full-bleed.mjs
var import_element34 = __toESM(require_element(), 1);
var STYLE_HASH_ATTRIBUTE15 = "data-wp-hash";
function getRuntime15() {
  const globalScope = globalThis;
  if (globalScope.__wpStyleRuntime) {
    return globalScope.__wpStyleRuntime;
  }
  globalScope.__wpStyleRuntime = {
    documents: /* @__PURE__ */ new Map(),
    styles: /* @__PURE__ */ new Map(),
    injectedStyles: /* @__PURE__ */ new WeakMap()
  };
  if (typeof document !== "undefined") {
    registerDocument15(document);
  }
  return globalScope.__wpStyleRuntime;
}
function documentContainsStyleHash15(targetDocument, hash) {
  if (!targetDocument.head) {
    return false;
  }
  for (const style of targetDocument.head.querySelectorAll(
    `style[${STYLE_HASH_ATTRIBUTE15}]`
  )) {
    if (style.getAttribute(STYLE_HASH_ATTRIBUTE15) === hash) {
      return true;
    }
  }
  return false;
}
function injectStyle15(targetDocument, hash, css) {
  if (!targetDocument.head) {
    return;
  }
  const runtime = getRuntime15();
  let injectedStyles = runtime.injectedStyles.get(targetDocument);
  if (!injectedStyles) {
    injectedStyles = /* @__PURE__ */ new Set();
    runtime.injectedStyles.set(targetDocument, injectedStyles);
  }
  if (injectedStyles.has(hash)) {
    return;
  }
  if (documentContainsStyleHash15(targetDocument, hash)) {
    injectedStyles.add(hash);
    return;
  }
  const style = targetDocument.createElement("style");
  style.setAttribute(STYLE_HASH_ATTRIBUTE15, hash);
  style.appendChild(targetDocument.createTextNode(css));
  targetDocument.head.appendChild(style);
  injectedStyles.add(hash);
}
function registerDocument15(targetDocument) {
  const runtime = getRuntime15();
  runtime.documents.set(
    targetDocument,
    (runtime.documents.get(targetDocument) ?? 0) + 1
  );
  for (const [hash, css] of runtime.styles) {
    injectStyle15(targetDocument, hash, css);
  }
  return () => {
    const count = runtime.documents.get(targetDocument);
    if (count === void 0) {
      return;
    }
    if (count <= 1) {
      runtime.documents.delete(targetDocument);
      return;
    }
    runtime.documents.set(targetDocument, count - 1);
  };
}
function registerStyle15(hash, css) {
  const runtime = getRuntime15();
  runtime.styles.set(hash, css);
  for (const targetDocument of runtime.documents.keys()) {
    injectStyle15(targetDocument, hash, css);
  }
}
if (typeof process === "undefined" || true) {
  registerStyle15("cb866dcef6", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._02872bf298eadc43__root{--wp-ui-card-padding:var(--wpds-dimension-padding-2xl,24px);--wp-ui-card-header-content-gap:var(--wpds-dimension-gap-xl,24px);--wp-ui-card-header-content-margin:calc(var(--wp-ui-card-header-content-gap) - var(--wp-ui-card-padding));background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:1px solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-lg,8px);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);display:flex;flex-direction:column;overflow:clip}._5dffdaf2a6e669ac__content,.bbccc92e6ba5662d__header{padding:var(--wp-ui-card-padding);&:not(:first-child):not(:last-child){padding-block-end:0}}.bbccc92e6ba5662d__header+._5dffdaf2a6e669ac__content{margin-block-start:var(--wp-ui-card-header-content-margin);padding-block-start:0}.c1fa192587e1b4a6__fullbleed{margin-inline:calc(var(--wp-ui-card-padding)*-1);width:calc(100% + var(--wp-ui-card-padding)*2)}._02872bf298eadc43__root>:is(.bbccc92e6ba5662d__header,._5dffdaf2a6e669ac__content):first-child>.c1fa192587e1b4a6__fullbleed:first-child{margin-block-start:calc(var(--wp-ui-card-padding)*-1)}:is(.bbccc92e6ba5662d__header,._5dffdaf2a6e669ac__content):last-child>.c1fa192587e1b4a6__fullbleed:last-child{margin-block-end:calc(var(--wp-ui-card-padding)*-1)}}}");
}
var style_default14 = { "root": "_02872bf298eadc43__root", "header": "bbccc92e6ba5662d__header", "content": "_5dffdaf2a6e669ac__content", "fullbleed": "c1fa192587e1b4a6__fullbleed" };
var FullBleed = (0, import_element34.forwardRef)(
  function CardFullBleed({ render: render4, ...props }, ref) {
    const element = useRender({
      defaultTagName: "div",
      render: render4,
      ref,
      props: mergeProps(
        { className: style_default14.fullbleed },
        props
      )
    });
    return element;
  }
);

// packages/ui/build-module/card/title.mjs
var import_element35 = __toESM(require_element(), 1);
var import_jsx_runtime66 = __toESM(require_jsx_runtime(), 1);
var DEFAULT_TAG = /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", {});
var Title = (0, import_element35.forwardRef)(
  function CardTitle({ render: render4 = DEFAULT_TAG, children, ...props }, ref) {
    return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
      Text,
      {
        ref,
        variant: "heading-lg",
        render: render4,
        ...props,
        children
      }
    );
  }
);

// packages/ui/build-module/collapsible/panel.mjs
var import_element36 = __toESM(require_element(), 1);
var import_jsx_runtime67 = __toESM(require_jsx_runtime(), 1);
var Panel = (0, import_element36.forwardRef)(
  function CollapsiblePanel3(props, forwardedRef) {
    return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(index_parts_exports.Panel, { ref: forwardedRef, ...props });
  }
);

// packages/ui/build-module/collapsible/root.mjs
var import_element37 = __toESM(require_element(), 1);
var import_jsx_runtime68 = __toESM(require_jsx_runtime(), 1);
var Root5 = (0, import_element37.forwardRef)(
  function CollapsibleRoot3(props, forwardedRef) {
    return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(index_parts_exports.Root, { ref: forwardedRef, ...props });
  }
);

// packages/ui/build-module/collapsible/trigger.mjs
var import_element38 = __toESM(require_element(), 1);
var import_jsx_runtime69 = __toESM(require_jsx_runtime(), 1);
var Trigger2 = (0, import_element38.forwardRef)(
  function CollapsibleTrigger3(props, forwardedRef) {
    return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(index_parts_exports.Trigger, { ref: forwardedRef, ...props });
  }
);

// packages/ui/build-module/collapsible-card/index.mjs
var collapsible_card_exports = {};
__export(collapsible_card_exports, {
  Content: () => Content2,
  Header: () => Header2,
  HeaderDescription: () => HeaderDescription,
  Root: () => Root32
});

// packages/ui/build-module/collapsible-card/root.mjs
var import_element39 = __toESM(require_element(), 1);
var import_jsx_runtime70 = __toESM(require_jsx_runtime(), 1);
var Root32 = (0, import_element39.forwardRef)(
  function CollapsibleCardRoot({ render: render4, ...restProps }, ref) {
    return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
      Root5,
      {
        ref,
        render: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Root4, { render: render4 }),
        ...restProps
      }
    );
  }
);

// packages/ui/build-module/collapsible-card/header.mjs
var import_compose3 = __toESM(require_compose(), 1);
var import_element41 = __toESM(require_element(), 1);

// packages/ui/build-module/collapsible-card/context.mjs
var import_element40 = __toESM(require_element(), 1);
var HeaderDescriptionIdContext = (0, import_element40.createContext)(null);

// packages/ui/build-module/collapsible-card/header.mjs
var import_jsx_runtime71 = __toESM(require_jsx_runtime(), 1);
var STYLE_HASH_ATTRIBUTE16 = "data-wp-hash";
function getRuntime16() {
  const globalScope = globalThis;
  if (globalScope.__wpStyleRuntime) {
    return globalScope.__wpStyleRuntime;
  }
  globalScope.__wpStyleRuntime = {
    documents: /* @__PURE__ */ new Map(),
    styles: /* @__PURE__ */ new Map(),
    injectedStyles: /* @__PURE__ */ new WeakMap()
  };
  if (typeof document !== "undefined") {
    registerDocument16(document);
  }
  return globalScope.__wpStyleRuntime;
}
function documentContainsStyleHash16(targetDocument, hash) {
  if (!targetDocument.head) {
    return false;
  }
  for (const style of targetDocument.head.querySelectorAll(
    `style[${STYLE_HASH_ATTRIBUTE16}]`
  )) {
    if (style.getAttribute(STYLE_HASH_ATTRIBUTE16) === hash) {
      return true;
    }
  }
  return false;
}
function injectStyle16(targetDocument, hash, css) {
  if (!targetDocument.head) {
    return;
  }
  const runtime = getRuntime16();
  let injectedStyles = runtime.injectedStyles.get(targetDocument);
  if (!injectedStyles) {
    injectedStyles = /* @__PURE__ */ new Set();
    runtime.injectedStyles.set(targetDocument, injectedStyles);
  }
  if (injectedStyles.has(hash)) {
    return;
  }
  if (documentContainsStyleHash16(targetDocument, hash)) {
    injectedStyles.add(hash);
    return;
  }
  const style = targetDocument.createElement("style");
  style.setAttribute(STYLE_HASH_ATTRIBUTE16, hash);
  style.appendChild(targetDocument.createTextNode(css));
  targetDocument.head.appendChild(style);
  injectedStyles.add(hash);
}
function registerDocument16(targetDocument) {
  const runtime = getRuntime16();
  runtime.documents.set(
    targetDocument,
    (runtime.documents.get(targetDocument) ?? 0) + 1
  );
  for (const [hash, css] of runtime.styles) {
    injectStyle16(targetDocument, hash, css);
  }
  return () => {
    const count = runtime.documents.get(targetDocument);
    if (count === void 0) {
      return;
    }
    if (count <= 1) {
      runtime.documents.delete(targetDocument);
      return;
    }
    runtime.documents.set(targetDocument, count - 1);
  };
}
function registerStyle16(hash, css) {
  const runtime = getRuntime16();
  runtime.styles.set(hash, css);
  for (const targetDocument of runtime.documents.keys()) {
    injectStyle16(targetDocument, hash, css);
  }
}
if (typeof process === "undefined" || true) {
  registerStyle16("64bdb4d46e", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._626190151275d6d3__heading-wrapper{--_gcd-heading-color:inherit;--_gcd-heading-font-size:inherit;--_gcd-heading-font-weight:inherit;--_gcd-heading-margin:0;font-family:inherit;line-height:inherit}.cab17c7a373cb60d__header-content{flex:1;min-width:0}._92ebbaa30c8a1d05__header-description{color:var(--wpds-color-foreground-content-neutral-weak,#707070)}.dd89d27c4f15912d__header-trigger-positioner{align-self:flex-start;flex-shrink:0;margin-block-start:calc(var(--wpds-typography-line-height-sm, 20px)/2);max-height:0;overflow:visible}.bcfab5f2448bafef__header-trigger-wrapper{border-radius:var(--wpds-border-radius-sm,2px);display:flex;translate:0 -50%}._3106f8d2b0330faa__header-trigger{@media not (prefers-reduced-motion){transition:rotate .15s ease-out}}._5d2dfcb4085c6d0f__header[data-panel-open] ._3106f8d2b0330faa__header-trigger{rotate:180deg}._5d2dfcb4085c6d0f__header[data-disabled] ._3106f8d2b0330faa__header-trigger{color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d)}.e34cf37ccd0d81e0__content{height:var(--collapsible-panel-height);margin-block-start:var(--wp-ui-card-header-content-margin);overflow:hidden;&._03cfdbcd710393c9__overflow-visible{overflow:visible}&[hidden]:not([hidden=until-found]){display:none}&[data-ending-style],&[data-starting-style]{height:0}@media not (prefers-reduced-motion){transition:all .15s ease-out}}}@layer compositions{._41bfdbf7b6c087c2__content-inner{padding-block-start:0}._5d2dfcb4085c6d0f__header{align-items:stretch;display:flex;flex-direction:row;gap:var(--wpds-dimension-gap-sm,8px);outline:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}}}}");
}
var style_default15 = { "heading-wrapper": "_626190151275d6d3__heading-wrapper", "header-content": "cab17c7a373cb60d__header-content", "header-description": "_92ebbaa30c8a1d05__header-description", "header-trigger-positioner": "dd89d27c4f15912d__header-trigger-positioner", "header-trigger-wrapper": "bcfab5f2448bafef__header-trigger-wrapper", "header-trigger": "_3106f8d2b0330faa__header-trigger", "header": "_5d2dfcb4085c6d0f__header", "content": "e34cf37ccd0d81e0__content", "overflow-visible": "_03cfdbcd710393c9__overflow-visible", "content-inner": "_41bfdbf7b6c087c2__content-inner" };
if (typeof process === "undefined" || true) {
  registerStyle16("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}");
}
var global_css_defense_default5 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" };
if (typeof process === "undefined" || true) {
  registerStyle16("08122b3d53", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{.af79fb116edb0dd7__outset-ring--focus:focus,.dfcfdc28396e5d98__outset-ring--focus-visible:focus-visible,.e5cd9ee879f6403a__outset-ring--focus-within:focus-within,:focus-visible ._81935a08e952f267__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within,.abc777e9713fa711__outset-ring--focus-except-active:focus{outline:none}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.abc777e9713fa711__outset-ring--focus-except-active:focus:not(:active){--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}}");
}
var focus_module_default4 = { "outset-ring--focus": "af79fb116edb0dd7__outset-ring--focus", "outset-ring--focus-visible": "dfcfdc28396e5d98__outset-ring--focus-visible", "outset-ring--focus-within": "e5cd9ee879f6403a__outset-ring--focus-within", "outset-ring--focus-parent-visible": "_81935a08e952f267__outset-ring--focus-parent-visible", "outset-ring--focus-except-active": "abc777e9713fa711__outset-ring--focus-except-active", "outset-ring--focus-within-except-active": "_3c9f5ee9fc9c136d__outset-ring--focus-within-except-active" };
var Header2 = (0, import_element41.forwardRef)(
  function CollapsibleCardHeader({
    children,
    className,
    render: render4,
    "aria-describedby": ariaDescribedByProp,
    ...restProps
  }, ref) {
    const [descriptionIds, setDescriptionIds] = (0, import_element41.useState)(
      []
    );
    const [orderedDescriptionIds, setOrderedDescriptionIds] = (0, import_element41.useState)([]);
    const headerContentRef = (0, import_element41.useRef)(null);
    const registerDescriptionId = (0, import_element41.useCallback)((id) => {
      setDescriptionIds((currentDescriptionIds) => {
        if (currentDescriptionIds.includes(id)) {
          return currentDescriptionIds;
        }
        return [...currentDescriptionIds, id];
      });
      return () => {
        setDescriptionIds(
          (currentDescriptionIds) => currentDescriptionIds.filter(
            (descriptionId) => descriptionId !== id
          )
        );
      };
    }, []);
    const contextValue = (0, import_element41.useMemo)(
      () => ({ registerDescriptionId }),
      [registerDescriptionId]
    );
    (0, import_compose3.useIsomorphicLayoutEffect)(() => {
      const registeredDescriptionIds = new Set(descriptionIds);
      const nextDescriptionIds = Array.from(
        headerContentRef.current?.querySelectorAll("[id]") ?? []
      ).map((element) => element.id).filter((id) => registeredDescriptionIds.has(id));
      setOrderedDescriptionIds((currentDescriptionIds) => {
        if (currentDescriptionIds.length === nextDescriptionIds.length && currentDescriptionIds.every(
          (id, index3) => id === nextDescriptionIds[index3]
        )) {
          return currentDescriptionIds;
        }
        return nextDescriptionIds;
      });
    });
    const ariaDescribedBy = Array.from(
      /* @__PURE__ */ new Set([
        ...ariaDescribedByProp?.split(/\s+/).filter(Boolean) ?? [],
        ...orderedDescriptionIds
      ])
    ).join(" ") || void 0;
    return useRender({
      defaultTagName: "div",
      render: render4,
      ref,
      props: mergeProps(restProps, {
        className: clsx_default(
          global_css_defense_default5.heading,
          style_default15["heading-wrapper"],
          className
        ),
        children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(HeaderDescriptionIdContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
          Trigger2,
          {
            className: style_default15.header,
            render: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Header, {}),
            nativeButton: false,
            "aria-describedby": ariaDescribedBy,
            children: [
              /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
                "div",
                {
                  ref: headerContentRef,
                  className: style_default15["header-content"],
                  children
                }
              ),
              /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
                "div",
                {
                  className: clsx_default(
                    style_default15["header-trigger-positioner"]
                  ),
                  children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
                    "div",
                    {
                      className: clsx_default(
                        style_default15["header-trigger-wrapper"],
                        global_css_defense_default5.div,
                        // While the interactive trigger element is the whole header,
                        // the focus ring will be displayed only on the icon to visually
                        // emulate it being the button.
                        focus_module_default4["outset-ring--focus-parent-visible"]
                      ),
                      children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
                        Icon,
                        {
                          icon: chevron_down_default,
                          className: style_default15["header-trigger"]
                        }
                      )
                    }
                  )
                }
              )
            ]
          }
        ) })
      })
    });
  }
);

// packages/ui/build-module/collapsible-card/header-description.mjs
var import_element42 = __toESM(require_element(), 1);
var import_jsx_runtime72 = __toESM(require_jsx_runtime(), 1);
var STYLE_HASH_ATTRIBUTE17 = "data-wp-hash";
function getRuntime17() {
  const globalScope = globalThis;
  if (globalScope.__wpStyleRuntime) {
    return globalScope.__wpStyleRuntime;
  }
  globalScope.__wpStyleRuntime = {
    documents: /* @__PURE__ */ new Map(),
    styles: /* @__PURE__ */ new Map(),
    injectedStyles: /* @__PURE__ */ new WeakMap()
  };
  if (typeof document !== "undefined") {
    registerDocument17(document);
  }
  return globalScope.__wpStyleRuntime;
}
function documentContainsStyleHash17(targetDocument, hash) {
  if (!targetDocument.head) {
    return false;
  }
  for (const style of targetDocument.head.querySelectorAll(
    `style[${STYLE_HASH_ATTRIBUTE17}]`
  )) {
    if (style.getAttribute(STYLE_HASH_ATTRIBUTE17) === hash) {
      return true;
    }
  }
  return false;
}
function injectStyle17(targetDocument, hash, css) {
  if (!targetDocument.head) {
    return;
  }
  const runtime = getRuntime17();
  let injectedStyles = runtime.injectedStyles.get(targetDocument);
  if (!injectedStyles) {
    injectedStyles = /* @__PURE__ */ new Set();
    runtime.injectedStyles.set(targetDocument, injectedStyles);
  }
  if (injectedStyles.has(hash)) {
    return;
  }
  if (documentContainsStyleHash17(targetDocument, hash)) {
    injectedStyles.add(hash);
    return;
  }
  const style = targetDocument.createElement("style");
  style.setAttribute(STYLE_HASH_ATTRIBUTE17, hash);
  style.appendChild(targetDocument.createTextNode(css));
  targetDocument.head.appendChild(style);
  injectedStyles.add(hash);
}
function registerDocument17(targetDocument) {
  const runtime = getRuntime17();
  runtime.documents.set(
    targetDocument,
    (runtime.documents.get(targetDocument) ?? 0) + 1
  );
  for (const [hash, css] of runtime.styles) {
    injectStyle17(targetDocument, hash, css);
  }
  return () => {
    const count = runtime.documents.get(targetDocument);
    if (count === void 0) {
      return;
    }
    if (count <= 1) {
      runtime.documents.delete(targetDocument);
      return;
    }
    runtime.documents.set(targetDocument, count - 1);
  };
}
function registerStyle17(hash, css) {
  const runtime = getRuntime17();
  runtime.styles.set(hash, css);
  for (const targetDocument of runtime.documents.keys()) {
    injectStyle17(targetDocument, hash, css);
  }
}
if (typeof process === "undefined" || true) {
  registerStyle17("64bdb4d46e", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._626190151275d6d3__heading-wrapper{--_gcd-heading-color:inherit;--_gcd-heading-font-size:inherit;--_gcd-heading-font-weight:inherit;--_gcd-heading-margin:0;font-family:inherit;line-height:inherit}.cab17c7a373cb60d__header-content{flex:1;min-width:0}._92ebbaa30c8a1d05__header-description{color:var(--wpds-color-foreground-content-neutral-weak,#707070)}.dd89d27c4f15912d__header-trigger-positioner{align-self:flex-start;flex-shrink:0;margin-block-start:calc(var(--wpds-typography-line-height-sm, 20px)/2);max-height:0;overflow:visible}.bcfab5f2448bafef__header-trigger-wrapper{border-radius:var(--wpds-border-radius-sm,2px);display:flex;translate:0 -50%}._3106f8d2b0330faa__header-trigger{@media not (prefers-reduced-motion){transition:rotate .15s ease-out}}._5d2dfcb4085c6d0f__header[data-panel-open] ._3106f8d2b0330faa__header-trigger{rotate:180deg}._5d2dfcb4085c6d0f__header[data-disabled] ._3106f8d2b0330faa__header-trigger{color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d)}.e34cf37ccd0d81e0__content{height:var(--collapsible-panel-height);margin-block-start:var(--wp-ui-card-header-content-margin);overflow:hidden;&._03cfdbcd710393c9__overflow-visible{overflow:visible}&[hidden]:not([hidden=until-found]){display:none}&[data-ending-style],&[data-starting-style]{height:0}@media not (prefers-reduced-motion){transition:all .15s ease-out}}}@layer compositions{._41bfdbf7b6c087c2__content-inner{padding-block-start:0}._5d2dfcb4085c6d0f__header{align-items:stretch;display:flex;flex-direction:row;gap:var(--wpds-dimension-gap-sm,8px);outline:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}}}}");
}
var style_default16 = { "heading-wrapper": "_626190151275d6d3__heading-wrapper", "header-content": "cab17c7a373cb60d__header-content", "header-description": "_92ebbaa30c8a1d05__header-description", "header-trigger-positioner": "dd89d27c4f15912d__header-trigger-positioner", "header-trigger-wrapper": "bcfab5f2448bafef__header-trigger-wrapper", "header-trigger": "_3106f8d2b0330faa__header-trigger", "header": "_5d2dfcb4085c6d0f__header", "content": "e34cf37ccd0d81e0__content", "overflow-visible": "_03cfdbcd710393c9__overflow-visible", "content-inner": "_41bfdbf7b6c087c2__content-inner" };
var DEFAULT_TAG2 = /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", {});
var HeaderDescription = (0, import_element42.forwardRef)(function CollapsibleCardHeaderDescription({ children, className, id: idProp, render: render4 = DEFAULT_TAG2, ...restProps }, ref) {
  const generatedId = (0, import_element42.useId)();
  const descriptionId = idProp ?? generatedId;
  const context = (0, import_element42.useContext)(HeaderDescriptionIdContext);
  if (!context) {
    throw new Error(
      "CollapsibleCard.HeaderDescription: Missing parent <CollapsibleCard.Header>. Render <CollapsibleCard.HeaderDescription> inside <CollapsibleCard.Header>."
    );
  }
  (0, import_element42.useEffect)(() => {
    return context?.registerDescriptionId(descriptionId);
  }, [context, descriptionId]);
  return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
    Text,
    {
      ref,
      variant: "body-md",
      render: render4,
      id: descriptionId,
      "aria-hidden": "true",
      className: clsx_default(style_default16["header-description"], className),
      ...restProps,
      children
    }
  );
});

// packages/ui/build-module/collapsible-card/content.mjs
var import_element43 = __toESM(require_element(), 1);
var import_jsx_runtime73 = __toESM(require_jsx_runtime(), 1);
var STYLE_HASH_ATTRIBUTE18 = "data-wp-hash";
function getRuntime18() {
  const globalScope = globalThis;
  if (globalScope.__wpStyleRuntime) {
    return globalScope.__wpStyleRuntime;
  }
  globalScope.__wpStyleRuntime = {
    documents: /* @__PURE__ */ new Map(),
    styles: /* @__PURE__ */ new Map(),
    injectedStyles: /* @__PURE__ */ new WeakMap()
  };
  if (typeof document !== "undefined") {
    registerDocument18(document);
  }
  return globalScope.__wpStyleRuntime;
}
function documentContainsStyleHash18(targetDocument, hash) {
  if (!targetDocument.head) {
    return false;
  }
  for (const style of targetDocument.head.querySelectorAll(
    `style[${STYLE_HASH_ATTRIBUTE18}]`
  )) {
    if (style.getAttribute(STYLE_HASH_ATTRIBUTE18) === hash) {
      return true;
    }
  }
  return false;
}
function injectStyle18(targetDocument, hash, css) {
  if (!targetDocument.head) {
    return;
  }
  const runtime = getRuntime18();
  let injectedStyles = runtime.injectedStyles.get(targetDocument);
  if (!injectedStyles) {
    injectedStyles = /* @__PURE__ */ new Set();
    runtime.injectedStyles.set(targetDocument, injectedStyles);
  }
  if (injectedStyles.has(hash)) {
    return;
  }
  if (documentContainsStyleHash18(targetDocument, hash)) {
    injectedStyles.add(hash);
    return;
  }
  const style = targetDocument.createElement("style");
  style.setAttribute(STYLE_HASH_ATTRIBUTE18, hash);
  style.appendChild(targetDocument.createTextNode(css));
  targetDocument.head.appendChild(style);
  injectedStyles.add(hash);
}
function registerDocument18(targetDocument) {
  const runtime = getRuntime18();
  runtime.documents.set(
    targetDocument,
    (runtime.documents.get(targetDocument) ?? 0) + 1
  );
  for (const [hash, css] of runtime.styles) {
    injectStyle18(targetDocument, hash, css);
  }
  return () => {
    const count = runtime.documents.get(targetDocument);
    if (count === void 0) {
      return;
    }
    if (count <= 1) {
      runtime.documents.delete(targetDocument);
      return;
    }
    runtime.documents.set(targetDocument, count - 1);
  };
}
function registerStyle18(hash, css) {
  const runtime = getRuntime18();
  runtime.styles.set(hash, css);
  for (const targetDocument of runtime.documents.keys()) {
    injectStyle18(targetDocument, hash, css);
  }
}
if (typeof process === "undefined" || true) {
  registerStyle18("64bdb4d46e", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._626190151275d6d3__heading-wrapper{--_gcd-heading-color:inherit;--_gcd-heading-font-size:inherit;--_gcd-heading-font-weight:inherit;--_gcd-heading-margin:0;font-family:inherit;line-height:inherit}.cab17c7a373cb60d__header-content{flex:1;min-width:0}._92ebbaa30c8a1d05__header-description{color:var(--wpds-color-foreground-content-neutral-weak,#707070)}.dd89d27c4f15912d__header-trigger-positioner{align-self:flex-start;flex-shrink:0;margin-block-start:calc(var(--wpds-typography-line-height-sm, 20px)/2);max-height:0;overflow:visible}.bcfab5f2448bafef__header-trigger-wrapper{border-radius:var(--wpds-border-radius-sm,2px);display:flex;translate:0 -50%}._3106f8d2b0330faa__header-trigger{@media not (prefers-reduced-motion){transition:rotate .15s ease-out}}._5d2dfcb4085c6d0f__header[data-panel-open] ._3106f8d2b0330faa__header-trigger{rotate:180deg}._5d2dfcb4085c6d0f__header[data-disabled] ._3106f8d2b0330faa__header-trigger{color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d)}.e34cf37ccd0d81e0__content{height:var(--collapsible-panel-height);margin-block-start:var(--wp-ui-card-header-content-margin);overflow:hidden;&._03cfdbcd710393c9__overflow-visible{overflow:visible}&[hidden]:not([hidden=until-found]){display:none}&[data-ending-style],&[data-starting-style]{height:0}@media not (prefers-reduced-motion){transition:all .15s ease-out}}}@layer compositions{._41bfdbf7b6c087c2__content-inner{padding-block-start:0}._5d2dfcb4085c6d0f__header{align-items:stretch;display:flex;flex-direction:row;gap:var(--wpds-dimension-gap-sm,8px);outline:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}}}}");
}
var style_default17 = { "heading-wrapper": "_626190151275d6d3__heading-wrapper", "header-content": "cab17c7a373cb60d__header-content", "header-description": "_92ebbaa30c8a1d05__header-description", "header-trigger-positioner": "dd89d27c4f15912d__header-trigger-positioner", "header-trigger-wrapper": "bcfab5f2448bafef__header-trigger-wrapper", "header-trigger": "_3106f8d2b0330faa__header-trigger", "header": "_5d2dfcb4085c6d0f__header", "content": "e34cf37ccd0d81e0__content", "overflow-visible": "_03cfdbcd710393c9__overflow-visible", "content-inner": "_41bfdbf7b6c087c2__content-inner" };
var Content2 = (0, import_element43.forwardRef)(
  function CollapsibleCardContent({ className, render: render4, children, hiddenUntilFound = true, ...restProps }, ref) {
    return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
      Panel,
      {
        ref,
        className: (state) => clsx_default(
          style_default17.content,
          state.open && state.transitionStatus === "idle" && style_default17["overflow-visible"],
          className
        ),
        hiddenUntilFound,
        ...restProps,
        children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
          Content,
          {
            className: style_default17["content-inner"],
            render: render4,
            children
          }
        )
      }
    );
  }
);

// packages/ui/build-module/stack/stack.mjs
var import_element44 = __toESM(require_element(), 1);
var STYLE_HASH_ATTRIBUTE19 = "data-wp-hash";
function getRuntime19() {
  const globalScope = globalThis;
  if (globalScope.__wpStyleRuntime) {
    return globalScope.__wpStyleRuntime;
  }
  globalScope.__wpStyleRuntime = {
    documents: /* @__PURE__ */ new Map(),
    styles: /* @__PURE__ */ new Map(),
    injectedStyles: /* @__PURE__ */ new WeakMap()
  };
  if (typeof document !== "undefined") {
    registerDocument19(document);
  }
  return globalScope.__wpStyleRuntime;
}
function documentContainsStyleHash19(targetDocument, hash) {
  if (!targetDocument.head) {
    return false;
  }
  for (const style of targetDocument.head.querySelectorAll(
    `style[${STYLE_HASH_ATTRIBUTE19}]`
  )) {
    if (style.getAttribute(STYLE_HASH_ATTRIBUTE19) === hash) {
      return true;
    }
  }
  return false;
}
function injectStyle19(targetDocument, hash, css) {
  if (!targetDocument.head) {
    return;
  }
  const runtime = getRuntime19();
  let injectedStyles = runtime.injectedStyles.get(targetDocument);
  if (!injectedStyles) {
    injectedStyles = /* @__PURE__ */ new Set();
    runtime.injectedStyles.set(targetDocument, injectedStyles);
  }
  if (injectedStyles.has(hash)) {
    return;
  }
  if (documentContainsStyleHash19(targetDocument, hash)) {
    injectedStyles.add(hash);
    return;
  }
  const style = targetDocument.createElement("style");
  style.setAttribute(STYLE_HASH_ATTRIBUTE19, hash);
  style.appendChild(targetDocument.createTextNode(css));
  targetDocument.head.appendChild(style);
  injectedStyles.add(hash);
}
function registerDocument19(targetDocument) {
  const runtime = getRuntime19();
  runtime.documents.set(
    targetDocument,
    (runtime.documents.get(targetDocument) ?? 0) + 1
  );
  for (const [hash, css] of runtime.styles) {
    injectStyle19(targetDocument, hash, css);
  }
  return () => {
    const count = runtime.documents.get(targetDocument);
    if (count === void 0) {
      return;
    }
    if (count <= 1) {
      runtime.documents.delete(targetDocument);
      return;
    }
    runtime.documents.set(targetDocument, count - 1);
  };
}
function registerStyle19(hash, css) {
  const runtime = getRuntime19();
  runtime.styles.set(hash, css);
  for (const targetDocument of runtime.documents.keys()) {
    injectStyle19(targetDocument, hash, css);
  }
}
if (typeof process === "undefined" || true) {
  registerStyle19("32aba35fe1", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._19ce0419607e1896__stack{display:flex}}}");
}
var style_default18 = { "stack": "_19ce0419607e1896__stack" };
var gapTokens = {
  xs: "var(--wpds-dimension-gap-xs, 4px)",
  sm: "var(--wpds-dimension-gap-sm, 8px)",
  md: "var(--wpds-dimension-gap-md, 12px)",
  lg: "var(--wpds-dimension-gap-lg, 16px)",
  xl: "var(--wpds-dimension-gap-xl, 24px)",
  "2xl": "var(--wpds-dimension-gap-2xl, 32px)",
  "3xl": "var(--wpds-dimension-gap-3xl, 40px)"
};
var Stack = (0, import_element44.forwardRef)(function Stack2({ direction, gap, align, justify, wrap, render: render4, ...props }, ref) {
  const style = {
    gap: gap && gapTokens[gap],
    alignItems: align,
    justifyContent: justify,
    flexDirection: direction,
    flexWrap: wrap
  };
  const element = useRender({
    render: render4,
    ref,
    props: mergeProps(props, { style, className: style_default18.stack })
  });
  return element;
});

// packages/ui/build-module/utils/use-schedule-validation.mjs
var import_compose4 = __toESM(require_compose(), 1);
var import_element45 = __toESM(require_element(), 1);
function useScheduleValidation(validate) {
  const validateEvent = (0, import_compose4.useEvent)(validate);
  const timerRef = (0, import_element45.useRef)(null);
  const unmountedRef = (0, import_element45.useRef)(false);
  const scheduleValidation = (0, import_element45.useCallback)(() => {
    if (unmountedRef.current) {
      return;
    }
    if (timerRef.current) {
      clearTimeout(timerRef.current);
    }
    timerRef.current = setTimeout(() => {
      validateEvent();
      timerRef.current = null;
    }, 0);
  }, [validateEvent]);
  (0, import_element45.useEffect)(() => {
    unmountedRef.current = false;
    return () => {
      unmountedRef.current = true;
      if (timerRef.current) {
        clearTimeout(timerRef.current);
      }
    };
  }, []);
  return scheduleValidation;
}

// packages/ui/build-module/form/primitives/input/input.mjs
var import_element48 = __toESM(require_element(), 1);

// packages/ui/build-module/form/primitives/input-layout/input-layout.mjs
var import_element46 = __toESM(require_element(), 1);
var import_jsx_runtime74 = __toESM(require_jsx_runtime(), 1);
var STYLE_HASH_ATTRIBUTE20 = "data-wp-hash";
function getRuntime20() {
  const globalScope = globalThis;
  if (globalScope.__wpStyleRuntime) {
    return globalScope.__wpStyleRuntime;
  }
  globalScope.__wpStyleRuntime = {
    documents: /* @__PURE__ */ new Map(),
    styles: /* @__PURE__ */ new Map(),
    injectedStyles: /* @__PURE__ */ new WeakMap()
  };
  if (typeof document !== "undefined") {
    registerDocument20(document);
  }
  return globalScope.__wpStyleRuntime;
}
function documentContainsStyleHash20(targetDocument, hash) {
  if (!targetDocument.head) {
    return false;
  }
  for (const style of targetDocument.head.querySelectorAll(
    `style[${STYLE_HASH_ATTRIBUTE20}]`
  )) {
    if (style.getAttribute(STYLE_HASH_ATTRIBUTE20) === hash) {
      return true;
    }
  }
  return false;
}
function injectStyle20(targetDocument, hash, css) {
  if (!targetDocument.head) {
    return;
  }
  const runtime = getRuntime20();
  let injectedStyles = runtime.injectedStyles.get(targetDocument);
  if (!injectedStyles) {
    injectedStyles = /* @__PURE__ */ new Set();
    runtime.injectedStyles.set(targetDocument, injectedStyles);
  }
  if (injectedStyles.has(hash)) {
    return;
  }
  if (documentContainsStyleHash20(targetDocument, hash)) {
    injectedStyles.add(hash);
    return;
  }
  const style = targetDocument.createElement("style");
  style.setAttribute(STYLE_HASH_ATTRIBUTE20, hash);
  style.appendChild(targetDocument.createTextNode(css));
  targetDocument.head.appendChild(style);
  injectedStyles.add(hash);
}
function registerDocument20(targetDocument) {
  const runtime = getRuntime20();
  runtime.documents.set(
    targetDocument,
    (runtime.documents.get(targetDocument) ?? 0) + 1
  );
  for (const [hash, css] of runtime.styles) {
    injectStyle20(targetDocument, hash, css);
  }
  return () => {
    const count = runtime.documents.get(targetDocument);
    if (count === void 0) {
      return;
    }
    if (count <= 1) {
      runtime.documents.delete(targetDocument);
      return;
    }
    runtime.documents.set(targetDocument, count - 1);
  };
}
function registerStyle20(hash, css) {
  const runtime = getRuntime20();
  runtime.styles.set(hash, css);
  for (const targetDocument of runtime.documents.keys()) {
    injectStyle20(targetDocument, hash, css);
  }
}
if (typeof process === "undefined" || true) {
  registerStyle20("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}");
}
var global_css_defense_default6 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" };
if (typeof process === "undefined" || true) {
  registerStyle20("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}");
}
var resets_default6 = { "box-sizing": "_336cd3e4e743482f__box-sizing" };
if (typeof process === "undefined" || true) {
  registerStyle20("e4f4f9600b", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.cb2baafdc08746bb__input-layout{--wp-ui-input-layout-padding-inline:var(--wpds-dimension-padding-md,12px);background-color:var(--wpds-color-background-interactive-neutral,var(--wpds-color-background-surface-neutral-strong,#fff));border-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d);border-radius:var(--wpds-border-radius-sm,2px);border-style:solid;border-width:var(--wpds-border-width-xs,1px);color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);display:flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:max(var(--wpds-typography-font-size-md,13px),16px);height:var(--wpds-dimension-size-lg,40px);line-height:1;@media (min-width:600px){font-size:var(--wpds-typography-font-size-md,13px)}&._0c807a84cbb94e0c__is-size-compact{height:var(--wpds-dimension-size-md,32px)}&._0c807a84cbb94e0c__is-size-compact,&.ed67cda122dc1e7b__is-size-small{--wp-ui-input-layout-padding-inline:var(--wpds-dimension-padding-sm,8px)}&.ed67cda122dc1e7b__is-size-small{height:var(--wpds-dimension-size-sm,24px)}&._6fb7104732387680__is-disabled,&:has([data-can-disable-input-layout][data-disabled]){color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}&:not(._8097270636ca6100__is-borderless){background-color:var(--wpds-color-background-interactive-neutral-disabled,var(--wpds-color-background-surface-neutral-strong,#fff));border-color:var(--wpds-color-stroke-interactive-neutral-disabled,#dbdbdb);@media (forced-colors:active){border-bottom-color:GrayText;border-left-color:GrayText;border-right-color:GrayText;border-top-color:GrayText}}}&._8097270636ca6100__is-borderless{background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);border-color:transparent}&:has(._0d7afad74a057888__input-layout-slot:focus-within){--_gcd-div-outline:none;outline:none}&:hover:not(._6fb7104732387680__is-disabled,:has([data-can-disable-input-layout][data-disabled]),._8097270636ca6100__is-borderless){background-color:var(--wpds-color-background-interactive-neutral-active,var(--wpds-color-background-surface-neutral-strong,#fff));border-color:var(--wpds-color-stroke-interactive-neutral-active,#6e6e6e)}&:has(:invalid[data-validity-visible]){--focus-color:var(--wpds-color-stroke-interactive-error,#cc1818);border-color:var(--wpds-color-stroke-interactive-error,#cc1818);&:hover{border-color:var(--wpds-color-stroke-interactive-error-active,#9d0000)}}}.c192b41a12b4387b__slot-wrapper{display:contents}._0d7afad74a057888__input-layout-slot{align-items:center;display:flex;&._0c952682762ca288__is-padding-minimal{--wp-ui-input-layout-prefix-padding-start:calc(var(--wp-ui-input-layout-padding-inline) - var(--wpds-dimension-padding-xs, 4px));--wp-ui-input-layout-suffix-padding-end:calc(var(--wp-ui-input-layout-padding-inline) - var(--wpds-dimension-padding-xs, 4px))}[data-slot-type=prefix] &{padding-inline-start:var(--wp-ui-input-layout-prefix-padding-start,var(--wp-ui-input-layout-padding-inline))}[data-slot-type=suffix] &{padding-inline-end:var(--wp-ui-input-layout-suffix-padding-end,var(--wp-ui-input-layout-padding-inline))}}}}');
}
var style_default19 = { "input-layout": "cb2baafdc08746bb__input-layout", "is-size-compact": "_0c807a84cbb94e0c__is-size-compact", "is-size-small": "ed67cda122dc1e7b__is-size-small", "is-disabled": "_6fb7104732387680__is-disabled", "is-borderless": "_8097270636ca6100__is-borderless", "input-layout-slot": "_0d7afad74a057888__input-layout-slot", "slot-wrapper": "c192b41a12b4387b__slot-wrapper", "is-padding-minimal": "_0c952682762ca288__is-padding-minimal" };
var InputLayout = (0, import_element46.forwardRef)(
  function InputLayout2({
    className,
    children,
    visuallyDisabled,
    size: size4 = "default",
    isBorderless,
    prefix,
    suffix,
    ...restProps
  }, ref) {
    return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
      "div",
      {
        ref,
        className: clsx_default(
          global_css_defense_default6.div,
          resets_default6["box-sizing"],
          style_default19["input-layout"],
          style_default19[`is-size-${size4}`],
          visuallyDisabled && style_default19["is-disabled"],
          isBorderless && style_default19["is-borderless"],
          className
        ),
        ...restProps,
        children: [
          import_element46.Children.count(prefix) > 0 && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
            "div",
            {
              className: style_default19["slot-wrapper"],
              "data-slot-type": "prefix",
              children: prefix
            }
          ),
          children,
          import_element46.Children.count(suffix) > 0 && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
            "div",
            {
              className: style_default19["slot-wrapper"],
              "data-slot-type": "suffix",
              children: suffix
            }
          )
        ]
      }
    );
  }
);

// packages/ui/build-module/form/primitives/input-layout/slot.mjs
var import_element47 = __toESM(require_element(), 1);
var import_jsx_runtime75 = __toESM(require_jsx_runtime(), 1);
var STYLE_HASH_ATTRIBUTE21 = "data-wp-hash";
function getRuntime21() {
  const globalScope = globalThis;
  if (globalScope.__wpStyleRuntime) {
    return globalScope.__wpStyleRuntime;
  }
  globalScope.__wpStyleRuntime = {
    documents: /* @__PURE__ */ new Map(),
    styles: /* @__PURE__ */ new Map(),
    injectedStyles: /* @__PURE__ */ new WeakMap()
  };
  if (typeof document !== "undefined") {
    registerDocument21(document);
  }
  return globalScope.__wpStyleRuntime;
}
function documentContainsStyleHash21(targetDocument, hash) {
  if (!targetDocument.head) {
    return false;
  }
  for (const style of targetDocument.head.querySelectorAll(
    `style[${STYLE_HASH_ATTRIBUTE21}]`
  )) {
    if (style.getAttribute(STYLE_HASH_ATTRIBUTE21) === hash) {
      return true;
    }
  }
  return false;
}
function injectStyle21(targetDocument, hash, css) {
  if (!targetDocument.head) {
    return;
  }
  const runtime = getRuntime21();
  let injectedStyles = runtime.injectedStyles.get(targetDocument);
  if (!injectedStyles) {
    injectedStyles = /* @__PURE__ */ new Set();
    runtime.injectedStyles.set(targetDocument, injectedStyles);
  }
  if (injectedStyles.has(hash)) {
    return;
  }
  if (documentContainsStyleHash21(targetDocument, hash)) {
    injectedStyles.add(hash);
    return;
  }
  const style = targetDocument.createElement("style");
  style.setAttribute(STYLE_HASH_ATTRIBUTE21, hash);
  style.appendChild(targetDocument.createTextNode(css));
  targetDocument.head.appendChild(style);
  injectedStyles.add(hash);
}
function registerDocument21(targetDocument) {
  const runtime = getRuntime21();
  runtime.documents.set(
    targetDocument,
    (runtime.documents.get(targetDocument) ?? 0) + 1
  );
  for (const [hash, css] of runtime.styles) {
    injectStyle21(targetDocument, hash, css);
  }
  return () => {
    const count = runtime.documents.get(targetDocument);
    if (count === void 0) {
      return;
    }
    if (count <= 1) {
      runtime.documents.delete(targetDocument);
      return;
    }
    runtime.documents.set(targetDocument, count - 1);
  };
}
function registerStyle21(hash, css) {
  const runtime = getRuntime21();
  runtime.styles.set(hash, css);
  for (const targetDocument of runtime.documents.keys()) {
    injectStyle21(targetDocument, hash, css);
  }
}
if (typeof process === "undefined" || true) {
  registerStyle21("e4f4f9600b", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.cb2baafdc08746bb__input-layout{--wp-ui-input-layout-padding-inline:var(--wpds-dimension-padding-md,12px);background-color:var(--wpds-color-background-interactive-neutral,var(--wpds-color-background-surface-neutral-strong,#fff));border-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d);border-radius:var(--wpds-border-radius-sm,2px);border-style:solid;border-width:var(--wpds-border-width-xs,1px);color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);display:flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:max(var(--wpds-typography-font-size-md,13px),16px);height:var(--wpds-dimension-size-lg,40px);line-height:1;@media (min-width:600px){font-size:var(--wpds-typography-font-size-md,13px)}&._0c807a84cbb94e0c__is-size-compact{height:var(--wpds-dimension-size-md,32px)}&._0c807a84cbb94e0c__is-size-compact,&.ed67cda122dc1e7b__is-size-small{--wp-ui-input-layout-padding-inline:var(--wpds-dimension-padding-sm,8px)}&.ed67cda122dc1e7b__is-size-small{height:var(--wpds-dimension-size-sm,24px)}&._6fb7104732387680__is-disabled,&:has([data-can-disable-input-layout][data-disabled]){color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}&:not(._8097270636ca6100__is-borderless){background-color:var(--wpds-color-background-interactive-neutral-disabled,var(--wpds-color-background-surface-neutral-strong,#fff));border-color:var(--wpds-color-stroke-interactive-neutral-disabled,#dbdbdb);@media (forced-colors:active){border-bottom-color:GrayText;border-left-color:GrayText;border-right-color:GrayText;border-top-color:GrayText}}}&._8097270636ca6100__is-borderless{background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);border-color:transparent}&:has(._0d7afad74a057888__input-layout-slot:focus-within){--_gcd-div-outline:none;outline:none}&:hover:not(._6fb7104732387680__is-disabled,:has([data-can-disable-input-layout][data-disabled]),._8097270636ca6100__is-borderless){background-color:var(--wpds-color-background-interactive-neutral-active,var(--wpds-color-background-surface-neutral-strong,#fff));border-color:var(--wpds-color-stroke-interactive-neutral-active,#6e6e6e)}&:has(:invalid[data-validity-visible]){--focus-color:var(--wpds-color-stroke-interactive-error,#cc1818);border-color:var(--wpds-color-stroke-interactive-error,#cc1818);&:hover{border-color:var(--wpds-color-stroke-interactive-error-active,#9d0000)}}}.c192b41a12b4387b__slot-wrapper{display:contents}._0d7afad74a057888__input-layout-slot{align-items:center;display:flex;&._0c952682762ca288__is-padding-minimal{--wp-ui-input-layout-prefix-padding-start:calc(var(--wp-ui-input-layout-padding-inline) - var(--wpds-dimension-padding-xs, 4px));--wp-ui-input-layout-suffix-padding-end:calc(var(--wp-ui-input-layout-padding-inline) - var(--wpds-dimension-padding-xs, 4px))}[data-slot-type=prefix] &{padding-inline-start:var(--wp-ui-input-layout-prefix-padding-start,var(--wp-ui-input-layout-padding-inline))}[data-slot-type=suffix] &{padding-inline-end:var(--wp-ui-input-layout-suffix-padding-end,var(--wp-ui-input-layout-padding-inline))}}}}');
}
var style_default20 = { "input-layout": "cb2baafdc08746bb__input-layout", "is-size-compact": "_0c807a84cbb94e0c__is-size-compact", "is-size-small": "ed67cda122dc1e7b__is-size-small", "is-disabled": "_6fb7104732387680__is-disabled", "is-borderless": "_8097270636ca6100__is-borderless", "input-layout-slot": "_0d7afad74a057888__input-layout-slot", "slot-wrapper": "c192b41a12b4387b__slot-wrapper", "is-padding-minimal": "_0c952682762ca288__is-padding-minimal" };
var InputLayoutSlot = (0, import_element47.forwardRef)(function InputLayoutSlot2({ padding = "default", className, ...restProps }, ref) {
  return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
    "div",
    {
      ref,
      className: clsx_default(
        style_default20["input-layout-slot"],
        style_default20[`is-padding-${padding}`],
        className
      ),
      ...restProps
    }
  );
});
InputLayoutSlot.displayName = "InputLayout.Slot";

// packages/ui/build-module/form/primitives/input-layout/index.mjs
var InputLayout3 = Object.assign(InputLayout, {
  Slot: InputLayoutSlot
});

// packages/ui/build-module/form/primitives/input/input.mjs
var import_jsx_runtime76 = __toESM(require_jsx_runtime(), 1);
var STYLE_HASH_ATTRIBUTE22 = "data-wp-hash";
function getRuntime22() {
  const globalScope = globalThis;
  if (globalScope.__wpStyleRuntime) {
    return globalScope.__wpStyleRuntime;
  }
  globalScope.__wpStyleRuntime = {
    documents: /* @__PURE__ */ new Map(),
    styles: /* @__PURE__ */ new Map(),
    injectedStyles: /* @__PURE__ */ new WeakMap()
  };
  if (typeof document !== "undefined") {
    registerDocument22(document);
  }
  return globalScope.__wpStyleRuntime;
}
function documentContainsStyleHash22(targetDocument, hash) {
  if (!targetDocument.head) {
    return false;
  }
  for (const style of targetDocument.head.querySelectorAll(
    `style[${STYLE_HASH_ATTRIBUTE22}]`
  )) {
    if (style.getAttribute(STYLE_HASH_ATTRIBUTE22) === hash) {
      return true;
    }
  }
  return false;
}
function injectStyle22(targetDocument, hash, css) {
  if (!targetDocument.head) {
    return;
  }
  const runtime = getRuntime22();
  let injectedStyles = runtime.injectedStyles.get(targetDocument);
  if (!injectedStyles) {
    injectedStyles = /* @__PURE__ */ new Set();
    runtime.injectedStyles.set(targetDocument, injectedStyles);
  }
  if (injectedStyles.has(hash)) {
    return;
  }
  if (documentContainsStyleHash22(targetDocument, hash)) {
    injectedStyles.add(hash);
    return;
  }
  const style = targetDocument.createElement("style");
  style.setAttribute(STYLE_HASH_ATTRIBUTE22, hash);
  style.appendChild(targetDocument.createTextNode(css));
  targetDocument.head.appendChild(style);
  injectedStyles.add(hash);
}
function registerDocument22(targetDocument) {
  const runtime = getRuntime22();
  runtime.documents.set(
    targetDocument,
    (runtime.documents.get(targetDocument) ?? 0) + 1
  );
  for (const [hash, css] of runtime.styles) {
    injectStyle22(targetDocument, hash, css);
  }
  return () => {
    const count = runtime.documents.get(targetDocument);
    if (count === void 0) {
      return;
    }
    if (count <= 1) {
      runtime.documents.delete(targetDocument);
      return;
    }
    runtime.documents.set(targetDocument, count - 1);
  };
}
function registerStyle22(hash, css) {
  const runtime = getRuntime22();
  runtime.styles.set(hash, css);
  for (const targetDocument of runtime.documents.keys()) {
    injectStyle22(targetDocument, hash, css);
  }
}
if (typeof process === "undefined" || true) {
  registerStyle22("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}");
}
var global_css_defense_default7 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" };
if (typeof process === "undefined" || true) {
  registerStyle22("08122b3d53", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{.af79fb116edb0dd7__outset-ring--focus:focus,.dfcfdc28396e5d98__outset-ring--focus-visible:focus-visible,.e5cd9ee879f6403a__outset-ring--focus-within:focus-within,:focus-visible ._81935a08e952f267__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within,.abc777e9713fa711__outset-ring--focus-except-active:focus{outline:none}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.abc777e9713fa711__outset-ring--focus-except-active:focus:not(:active){--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}}");
}
var focus_module_default5 = { "outset-ring--focus": "af79fb116edb0dd7__outset-ring--focus", "outset-ring--focus-visible": "dfcfdc28396e5d98__outset-ring--focus-visible", "outset-ring--focus-within": "e5cd9ee879f6403a__outset-ring--focus-within", "outset-ring--focus-parent-visible": "_81935a08e952f267__outset-ring--focus-parent-visible", "outset-ring--focus-except-active": "abc777e9713fa711__outset-ring--focus-except-active", "outset-ring--focus-within-except-active": "_3c9f5ee9fc9c136d__outset-ring--focus-within-except-active" };
if (typeof process === "undefined" || true) {
  registerStyle22("1a25f6a232", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._2ae7be2fc1bb17a3__input{--_gcd-input-padding:var(--wp-ui-input-padding-block,0px) var(--wp-ui-input-layout-padding-inline,0px);background:transparent;border:none;color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);font-family:inherit;font-size:inherit;line-height:inherit;outline:none;padding-block:var(--wp-ui-input-padding-block,0);padding-inline:var(--wp-ui-input-layout-padding-inline,0);width:100%;&::placeholder{color:var(--wpds-color-foreground-interactive-neutral-weak,#707070)}&:disabled,&[aria-disabled=true]{--_gcd-input-placeholder-color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);&::placeholder{color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d)}@media (forced-colors:active){color:GrayText}}&[type=email],&[type=url]{direction:ltr}&[type=number]{appearance:textfield;&::-webkit-inner-spin-button,&::-webkit-outer-spin-button{appearance:none;margin:0}}}}}");
}
var style_default21 = { "input": "_2ae7be2fc1bb17a3__input" };
var Input3 = (0, import_element48.forwardRef)(function Input22({ className, size: size4 = "default", prefix, suffix, style, ...restProps }, ref) {
  return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
    InputLayout3,
    {
      className: clsx_default(
        focus_module_default5["outset-ring--focus-within"],
        className
      ),
      style,
      size: size4,
      visuallyDisabled: restProps.disabled,
      prefix,
      suffix,
      children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
        Input,
        {
          ref,
          className: clsx_default(global_css_defense_default7.input, style_default21.input),
          ...restProps
        }
      )
    }
  );
});

// packages/ui/build-module/form/primitives/control-with-error/control-with-error.mjs
var import_i18n7 = __toESM(require_i18n(), 1);
var import_element50 = __toESM(require_element(), 1);

// packages/ui/build-module/spinner/spinner.mjs
var import_element49 = __toESM(require_element(), 1);
var import_jsx_runtime77 = __toESM(require_jsx_runtime(), 1);
var STYLE_HASH_ATTRIBUTE23 = "data-wp-hash";
function getRuntime23() {
  const globalScope = globalThis;
  if (globalScope.__wpStyleRuntime) {
    return globalScope.__wpStyleRuntime;
  }
  globalScope.__wpStyleRuntime = {
    documents: /* @__PURE__ */ new Map(),
    styles: /* @__PURE__ */ new Map(),
    injectedStyles: /* @__PURE__ */ new WeakMap()
  };
  if (typeof document !== "undefined") {
    registerDocument23(document);
  }
  return globalScope.__wpStyleRuntime;
}
function documentContainsStyleHash23(targetDocument, hash) {
  if (!targetDocument.head) {
    return false;
  }
  for (const style of targetDocument.head.querySelectorAll(
    `style[${STYLE_HASH_ATTRIBUTE23}]`
  )) {
    if (style.getAttribute(STYLE_HASH_ATTRIBUTE23) === hash) {
      return true;
    }
  }
  return false;
}
function injectStyle23(targetDocument, hash, css) {
  if (!targetDocument.head) {
    return;
  }
  const runtime = getRuntime23();
  let injectedStyles = runtime.injectedStyles.get(targetDocument);
  if (!injectedStyles) {
    injectedStyles = /* @__PURE__ */ new Set();
    runtime.injectedStyles.set(targetDocument, injectedStyles);
  }
  if (injectedStyles.has(hash)) {
    return;
  }
  if (documentContainsStyleHash23(targetDocument, hash)) {
    injectedStyles.add(hash);
    return;
  }
  const style = targetDocument.createElement("style");
  style.setAttribute(STYLE_HASH_ATTRIBUTE23, hash);
  style.appendChild(targetDocument.createTextNode(css));
  targetDocument.head.appendChild(style);
  injectedStyles.add(hash);
}
function registerDocument23(targetDocument) {
  const runtime = getRuntime23();
  runtime.documents.set(
    targetDocument,
    (runtime.documents.get(targetDocument) ?? 0) + 1
  );
  for (const [hash, css] of runtime.styles) {
    injectStyle23(targetDocument, hash, css);
  }
  return () => {
    const count = runtime.documents.get(targetDocument);
    if (count === void 0) {
      return;
    }
    if (count <= 1) {
      runtime.documents.delete(targetDocument);
      return;
    }
    runtime.documents.set(targetDocument, count - 1);
  };
}
function registerStyle23(hash, css) {
  const runtime = getRuntime23();
  runtime.styles.set(hash, css);
  for (const targetDocument of runtime.documents.keys()) {
    injectStyle23(targetDocument, hash, css);
  }
}
if (typeof process === "undefined" || true) {
  registerStyle23("bbbecfe373", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.ab4d64c07c0ba587__spinner{background-color:transparent;display:inline-block;height:var(--wpds-dimension-size-2xs,16px);opacity:1;overflow:visible;position:relative;width:var(--wpds-dimension-size-2xs,16px)}.a7654e10245bb7d2__indicator,.dc51f80c84b35fe2__track{fill:transparent;stroke-width:1.5px}.dc51f80c84b35fe2__track{stroke:var(--wpds-color-background-track-neutral,#dbdbdb)}.a7654e10245bb7d2__indicator{stroke:var(--wpds-color-background-thumb-brand,var(--wp-admin-theme-color,#3858e9));stroke-linecap:round;animation:_02322d973909703c__spinner-spin 1.4s linear infinite both;transform-origin:50% 50%}@keyframes _02322d973909703c__spinner-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}}}");
}
var style_default22 = { "spinner": "ab4d64c07c0ba587__spinner", "track": "dc51f80c84b35fe2__track", "indicator": "a7654e10245bb7d2__indicator", "spinner-spin": "_02322d973909703c__spinner-spin" };
var Spinner = (0, import_element49.forwardRef)(
  function Spinner2({ className, ...props }, ref) {
    return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
      "svg",
      {
        className: clsx_default(style_default22.spinner, className),
        viewBox: "0 0 100 100",
        xmlns: "http://www.w3.org/2000/svg",
        role: "presentation",
        focusable: "false",
        ...props,
        ref,
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
            "circle",
            {
              className: style_default22.track,
              cx: "50",
              cy: "50",
              r: "50",
              vectorEffect: "non-scaling-stroke"
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
            "path",
            {
              className: style_default22.indicator,
              d: "m 50 0 a 50 50 0 0 1 50 50",
              vectorEffect: "non-scaling-stroke"
            }
          )
        ]
      }
    );
  }
);

// packages/ui/build-module/form/primitives/validity-indicator/validity-indicator.mjs
var import_jsx_runtime78 = __toESM(require_jsx_runtime(), 1);
var STYLE_HASH_ATTRIBUTE24 = "data-wp-hash";
function getRuntime24() {
  const globalScope = globalThis;
  if (globalScope.__wpStyleRuntime) {
    return globalScope.__wpStyleRuntime;
  }
  globalScope.__wpStyleRuntime = {
    documents: /* @__PURE__ */ new Map(),
    styles: /* @__PURE__ */ new Map(),
    injectedStyles: /* @__PURE__ */ new WeakMap()
  };
  if (typeof document !== "undefined") {
    registerDocument24(document);
  }
  return globalScope.__wpStyleRuntime;
}
function documentContainsStyleHash24(targetDocument, hash) {
  if (!targetDocument.head) {
    return false;
  }
  for (const style of targetDocument.head.querySelectorAll(
    `style[${STYLE_HASH_ATTRIBUTE24}]`
  )) {
    if (style.getAttribute(STYLE_HASH_ATTRIBUTE24) === hash) {
      return true;
    }
  }
  return false;
}
function injectStyle24(targetDocument, hash, css) {
  if (!targetDocument.head) {
    return;
  }
  const runtime = getRuntime24();
  let injectedStyles = runtime.injectedStyles.get(targetDocument);
  if (!injectedStyles) {
    injectedStyles = /* @__PURE__ */ new Set();
    runtime.injectedStyles.set(targetDocument, injectedStyles);
  }
  if (injectedStyles.has(hash)) {
    return;
  }
  if (documentContainsStyleHash24(targetDocument, hash)) {
    injectedStyles.add(hash);
    return;
  }
  const style = targetDocument.createElement("style");
  style.setAttribute(STYLE_HASH_ATTRIBUTE24, hash);
  style.appendChild(targetDocument.createTextNode(css));
  targetDocument.head.appendChild(style);
  injectedStyles.add(hash);
}
function registerDocument24(targetDocument) {
  const runtime = getRuntime24();
  runtime.documents.set(
    targetDocument,
    (runtime.documents.get(targetDocument) ?? 0) + 1
  );
  for (const [hash, css] of runtime.styles) {
    injectStyle24(targetDocument, hash, css);
  }
  return () => {
    const count = runtime.documents.get(targetDocument);
    if (count === void 0) {
      return;
    }
    if (count <= 1) {
      runtime.documents.delete(targetDocument);
      return;
    }
    runtime.documents.set(targetDocument, count - 1);
  };
}
function registerStyle24(hash, css) {
  const runtime = getRuntime24();
  runtime.styles.set(hash, css);
  for (const targetDocument of runtime.documents.keys()) {
    injectStyle24(targetDocument, hash, css);
  }
}
if (typeof process === "undefined" || true) {
  registerStyle24("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}");
}
var global_css_defense_default8 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" };
if (typeof process === "undefined" || true) {
  registerStyle24("d11816833c", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._7a7ac88e306348e7__indicator{--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);align-items:flex-start;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-sm,12px);gap:var(--wpds-dimension-gap-xs,4px);line-height:var(--wpds-typography-line-height-xs,16px);@media not (prefers-reduced-motion){animation:_48722cc5dd090ce4__indicator-jump var(--wpds-motion-duration-md,.2s) cubic-bezier(.68,-.55,.27,1.55)}}._57a3bbbfbe38a5c6__is-invalid{color:var(--wpds-color-foreground-content-error-weak,#cc1818)}._9e944dc198aac10b__is-valid{color:var(--wpds-color-foreground-content-success-weak,#008030)}.e482806667437c6a__indicator-icon{flex-shrink:0}._6e46434cc23019d2__indicator-spinner{height:var(--wpds-dimension-size-3xs,12px);margin:2px;width:var(--wpds-dimension-size-3xs,12px)}@keyframes _48722cc5dd090ce4__indicator-jump{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}}}');
}
var style_default23 = { "indicator": "_7a7ac88e306348e7__indicator", "indicator-jump": "_48722cc5dd090ce4__indicator-jump", "is-invalid": "_57a3bbbfbe38a5c6__is-invalid", "is-valid": "_9e944dc198aac10b__is-valid", "indicator-icon": "e482806667437c6a__indicator-icon", "indicator-spinner": "_6e46434cc23019d2__indicator-spinner" };
var ICON = {
  valid: published_default,
  invalid: error_default
};
function ValidityIndicator({
  id,
  type,
  message: message2
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
    "p",
    {
      id,
      className: clsx_default(
        global_css_defense_default8.p,
        style_default23.indicator,
        style_default23[`is-${type}`]
      ),
      children: [
        type === "validating" ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Spinner, { className: style_default23["indicator-spinner"] }) : /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
          Icon,
          {
            className: style_default23["indicator-icon"],
            icon: ICON[type],
            size: 16,
            fill: "currentColor"
          }
        ),
        message2
      ]
    }
  );
}

// packages/ui/build-module/form/primitives/control-with-error/control-with-error.mjs
var import_jsx_runtime79 = __toESM(require_jsx_runtime(), 1);
var DEFAULT_RENDER = (props) => /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Stack, { ...props, direction: "column", gap: "sm" });
function appendRequiredIndicator(label, required, markWhenOptional) {
  let suffix;
  if (required && !markWhenOptional) {
    suffix = `(${(0, import_i18n7.__)("Required")})`;
  } else if (!required && markWhenOptional) {
    suffix = `(${(0, import_i18n7.__)("Optional")})`;
  }
  if (!suffix) {
    return label;
  }
  if (typeof label === "string") {
    return `${label} ${suffix}`;
  }
  return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(import_jsx_runtime79.Fragment, { children: [
    label,
    " ",
    suffix
  ] });
}
var VALIDITY_VISIBLE_ATTRIBUTE = "data-validity-visible";
var ControlWithError = (0, import_element50.forwardRef)(function ControlWithError2({
  required,
  markWhenOptional,
  customValidity,
  getValidityTarget,
  children,
  render: render4 = DEFAULT_RENDER,
  ...restProps
}, forwardedRef) {
  const [errorMessage, setErrorMessage] = (0, import_element50.useState)();
  const [statusMessage, setStatusMessage] = (0, import_element50.useState)();
  const [showMessage, setShowMessage] = (0, import_element50.useState)(false);
  const [isTouched, setIsTouched] = (0, import_element50.useState)(false);
  const wrapperRef = (0, import_element50.useRef)(null);
  (0, import_element50.useEffect)(() => {
    const validityTarget = getValidityTarget();
    const handler = () => {
      if (customValidity?.type !== "validating") {
        setErrorMessage(validityTarget?.validationMessage);
      }
      setShowMessage(true);
      validityTarget?.setAttribute(VALIDITY_VISIBLE_ATTRIBUTE, "");
    };
    validityTarget?.addEventListener("invalid", handler);
    return () => validityTarget?.removeEventListener("invalid", handler);
  }, [customValidity?.type, getValidityTarget]);
  (0, import_element50.useEffect)(() => {
    const validityTarget = getValidityTarget();
    const suppressNativePopover = (event) => {
      event.preventDefault();
      if (!event.isTrusted) {
        return;
      }
      const target = event.target;
      const firstErrorInForm = Array.from(
        target.form?.elements ?? []
      ).find((el) => !el.validity.valid);
      if (!target.form || firstErrorInForm === target) {
        target.focus();
      }
    };
    const radioSiblings = validityTarget?.type === "radio" && validityTarget?.name ? Array.from(
      wrapperRef.current?.querySelectorAll(
        `input[type="radio"][name="${validityTarget?.name}"]`
      ) ?? []
    ).filter((sibling) => sibling !== validityTarget) : [];
    validityTarget?.addEventListener("invalid", suppressNativePopover);
    radioSiblings.forEach(
      (sibling) => sibling.addEventListener("invalid", suppressNativePopover)
    );
    return () => {
      validityTarget?.removeEventListener(
        "invalid",
        suppressNativePopover
      );
      radioSiblings.forEach(
        (sibling) => sibling.removeEventListener("invalid", suppressNativePopover)
      );
    };
  }, [getValidityTarget]);
  (0, import_element50.useEffect)(() => {
    const validityTarget = getValidityTarget();
    if (!customValidity?.type) {
      validityTarget?.setCustomValidity("");
      setErrorMessage(validityTarget?.validationMessage);
      setStatusMessage(void 0);
      return;
    }
    switch (customValidity.type) {
      case "validating": {
        validityTarget?.setCustomValidity("");
        setErrorMessage(void 0);
        setStatusMessage({
          type: "validating",
          message: customValidity.message
        });
        break;
      }
      case "valid": {
        validityTarget?.setCustomValidity("");
        setErrorMessage(validityTarget?.validationMessage);
        setStatusMessage({
          type: "valid",
          message: customValidity.message
        });
        break;
      }
      case "invalid": {
        validityTarget?.setCustomValidity(
          customValidity.message ?? ""
        );
        setErrorMessage(validityTarget?.validationMessage);
        setStatusMessage(void 0);
        break;
      }
    }
  }, [customValidity, getValidityTarget]);
  (0, import_element50.useEffect)(() => {
    if (!isTouched || showMessage) {
      return;
    }
    if (customValidity?.type === "validating") {
      const timer = setTimeout(() => {
        setShowMessage(true);
      }, 1e3);
      return () => clearTimeout(timer);
    }
    setShowMessage(true);
  }, [isTouched, customValidity?.type, showMessage]);
  const onBlur = (event) => {
    if (event.relatedTarget && event.currentTarget.contains(event.relatedTarget)) {
      return;
    }
    if (!isTouched) {
      setIsTouched(true);
      getValidityTarget()?.setAttribute(VALIDITY_VISIBLE_ATTRIBUTE, "");
    }
    const validityTarget = getValidityTarget();
    const isValidating = customValidity?.type === "validating";
    window.queueMicrotask(() => {
      if (!isValidating) {
        setErrorMessage(validityTarget?.validationMessage);
      }
    });
  };
  const messageId = (0, import_element50.useId)();
  const message2 = (() => {
    if (errorMessage) {
      return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
        ValidityIndicator,
        {
          id: messageId,
          type: "invalid",
          message: errorMessage
        }
      );
    }
    if (statusMessage?.type) {
      return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
        ValidityIndicator,
        {
          id: messageId,
          type: statusMessage.type,
          message: statusMessage.message
        }
      );
    }
    return null;
  })();
  const visibleMessage = showMessage ? message2 : null;
  (0, import_element50.useEffect)(() => {
    const target = getValidityTarget();
    if (!target) {
      return;
    }
    function setDescribedBy(el, shouldAdd) {
      const ids = (el.getAttribute("aria-describedby") ?? "").split(" ").filter((id) => id && id !== messageId);
      if (shouldAdd) {
        ids.push(messageId);
      }
      if (ids.length) {
        el.setAttribute("aria-describedby", ids.join(" "));
      } else {
        el.removeAttribute("aria-describedby");
      }
    }
    setDescribedBy(target, !!visibleMessage);
    return () => setDescribedBy(target, false);
  }, [visibleMessage, messageId, getValidityTarget]);
  return useRender({
    render: render4,
    ref: [forwardedRef, wrapperRef],
    props: mergeProps(restProps, {
      onBlur,
      children: /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(import_jsx_runtime79.Fragment, { children: [
        (0, import_element50.cloneElement)(children, {
          label: appendRequiredIndicator(
            children.props.label,
            required,
            markWhenOptional
          ),
          required
        }),
        visibleMessage
      ] })
    })
  });
});

// packages/ui/build-module/form/primitives/field/index.mjs
var field_exports = {};
__export(field_exports, {
  Control: () => Control,
  Description: () => Description,
  Details: () => Details,
  Item: () => Item,
  Label: () => Label,
  Root: () => Root6,
  VisualLabel: () => VisualLabel
});

// packages/ui/build-module/form/primitives/field/root.mjs
var import_element51 = __toESM(require_element(), 1);
var import_jsx_runtime80 = __toESM(require_jsx_runtime(), 1);
var STYLE_HASH_ATTRIBUTE25 = "data-wp-hash";
function getRuntime25() {
  const globalScope = globalThis;
  if (globalScope.__wpStyleRuntime) {
    return globalScope.__wpStyleRuntime;
  }
  globalScope.__wpStyleRuntime = {
    documents: /* @__PURE__ */ new Map(),
    styles: /* @__PURE__ */ new Map(),
    injectedStyles: /* @__PURE__ */ new WeakMap()
  };
  if (typeof document !== "undefined") {
    registerDocument25(document);
  }
  return globalScope.__wpStyleRuntime;
}
function documentContainsStyleHash25(targetDocument, hash) {
  if (!targetDocument.head) {
    return false;
  }
  for (const style of targetDocument.head.querySelectorAll(
    `style[${STYLE_HASH_ATTRIBUTE25}]`
  )) {
    if (style.getAttribute(STYLE_HASH_ATTRIBUTE25) === hash) {
      return true;
    }
  }
  return false;
}
function injectStyle25(targetDocument, hash, css) {
  if (!targetDocument.head) {
    return;
  }
  const runtime = getRuntime25();
  let injectedStyles = runtime.injectedStyles.get(targetDocument);
  if (!injectedStyles) {
    injectedStyles = /* @__PURE__ */ new Set();
    runtime.injectedStyles.set(targetDocument, injectedStyles);
  }
  if (injectedStyles.has(hash)) {
    return;
  }
  if (documentContainsStyleHash25(targetDocument, hash)) {
    injectedStyles.add(hash);
    return;
  }
  const style = targetDocument.createElement("style");
  style.setAttribute(STYLE_HASH_ATTRIBUTE25, hash);
  style.appendChild(targetDocument.createTextNode(css));
  targetDocument.head.appendChild(style);
  injectedStyles.add(hash);
}
function registerDocument25(targetDocument) {
  const runtime = getRuntime25();
  runtime.documents.set(
    targetDocument,
    (runtime.documents.get(targetDocument) ?? 0) + 1
  );
  for (const [hash, css] of runtime.styles) {
    injectStyle25(targetDocument, hash, css);
  }
  return () => {
    const count = runtime.documents.get(targetDocument);
    if (count === void 0) {
      return;
    }
    if (count <= 1) {
      runtime.documents.delete(targetDocument);
      return;
    }
    runtime.documents.set(targetDocument, count - 1);
  };
}
function registerStyle25(hash, css) {
  const runtime = getRuntime25();
  runtime.styles.set(hash, css);
  for (const targetDocument of runtime.documents.keys()) {
    injectStyle25(targetDocument, hash, css);
  }
}
if (typeof process === "undefined" || true) {
  registerStyle25("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}");
}
var resets_default7 = { "box-sizing": "_336cd3e4e743482f__box-sizing" };
var DEFAULT_RENDER2 = (props) => /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Stack, { ...props, direction: "column", gap: "sm" });
var Root6 = (0, import_element51.forwardRef)(function Root22({ className, render: render4 = DEFAULT_RENDER2, ...restProps }, ref) {
  return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
    index_parts_exports2.Root,
    {
      ref,
      className: clsx_default(resets_default7["box-sizing"], className),
      render: render4,
      ...restProps
    }
  );
});

// packages/ui/build-module/form/primitives/field/item.mjs
var import_element52 = __toESM(require_element(), 1);
var import_jsx_runtime81 = __toESM(require_jsx_runtime(), 1);
var Item = (0, import_element52.forwardRef)(function Item2(props, ref) {
  return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(index_parts_exports2.Item, { ref, ...props });
});

// packages/ui/build-module/form/primitives/field/label.mjs
var import_element53 = __toESM(require_element(), 1);
var import_jsx_runtime82 = __toESM(require_jsx_runtime(), 1);
var STYLE_HASH_ATTRIBUTE26 = "data-wp-hash";
function getRuntime26() {
  const globalScope = globalThis;
  if (globalScope.__wpStyleRuntime) {
    return globalScope.__wpStyleRuntime;
  }
  globalScope.__wpStyleRuntime = {
    documents: /* @__PURE__ */ new Map(),
    styles: /* @__PURE__ */ new Map(),
    injectedStyles: /* @__PURE__ */ new WeakMap()
  };
  if (typeof document !== "undefined") {
    registerDocument26(document);
  }
  return globalScope.__wpStyleRuntime;
}
function documentContainsStyleHash26(targetDocument, hash) {
  if (!targetDocument.head) {
    return false;
  }
  for (const style of targetDocument.head.querySelectorAll(
    `style[${STYLE_HASH_ATTRIBUTE26}]`
  )) {
    if (style.getAttribute(STYLE_HASH_ATTRIBUTE26) === hash) {
      return true;
    }
  }
  return false;
}
function injectStyle26(targetDocument, hash, css) {
  if (!targetDocument.head) {
    return;
  }
  const runtime = getRuntime26();
  let injectedStyles = runtime.injectedStyles.get(targetDocument);
  if (!injectedStyles) {
    injectedStyles = /* @__PURE__ */ new Set();
    runtime.injectedStyles.set(targetDocument, injectedStyles);
  }
  if (injectedStyles.has(hash)) {
    return;
  }
  if (documentContainsStyleHash26(targetDocument, hash)) {
    injectedStyles.add(hash);
    return;
  }
  const style = targetDocument.createElement("style");
  style.setAttribute(STYLE_HASH_ATTRIBUTE26, hash);
  style.appendChild(targetDocument.createTextNode(css));
  targetDocument.head.appendChild(style);
  injectedStyles.add(hash);
}
function registerDocument26(targetDocument) {
  const runtime = getRuntime26();
  runtime.documents.set(
    targetDocument,
    (runtime.documents.get(targetDocument) ?? 0) + 1
  );
  for (const [hash, css] of runtime.styles) {
    injectStyle26(targetDocument, hash, css);
  }
  return () => {
    const count = runtime.documents.get(targetDocument);
    if (count === void 0) {
      return;
    }
    if (count <= 1) {
      runtime.documents.delete(targetDocument);
      return;
    }
    runtime.documents.set(targetDocument, count - 1);
  };
}
function registerStyle26(hash, css) {
  const runtime = getRuntime26();
  runtime.styles.set(hash, css);
  for (const targetDocument of runtime.documents.keys()) {
    injectStyle26(targetDocument, hash, css);
  }
}
if (typeof process === "undefined" || true) {
  registerStyle26("df33c48b2d", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._2d5ad850b2f90964__label{--wp-ui-field-label-line-height:var(--wpds-typography-line-height-xs,16px);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wp-ui-field-label-line-height);text-transform:uppercase;&._17c4214649230bea__is-plain{font-size:var(--wpds-typography-font-size-md,13px);font-weight:var(--wpds-typography-font-weight-default,400);text-transform:none}}._08a3750500e0233f__description{--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);--_gcd-p-margin:0;text-wrap:pretty;color:var(--wpds-color-foreground-content-neutral-weak,#707070);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-sm,12px);line-height:var(--wpds-typography-line-height-xs,16px)}}}');
}
var field_default = { "label": "_2d5ad850b2f90964__label", "is-plain": "_17c4214649230bea__is-plain", "description": "_08a3750500e0233f__description" };
var Label = (0, import_element53.forwardRef)(
  function Label2({ className, hideFromVision, variant, ...restProps }, ref) {
    const label = /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
      index_parts_exports2.Label,
      {
        ref,
        className: clsx_default(
          field_default.label,
          variant && field_default[`is-${variant}`],
          className
        ),
        ...restProps
      }
    );
    if (hideFromVision) {
      return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(VisuallyHidden, { render: label });
    }
    return label;
  }
);

// packages/ui/build-module/form/primitives/field/description.mjs
var import_element54 = __toESM(require_element(), 1);
var import_jsx_runtime83 = __toESM(require_jsx_runtime(), 1);
var STYLE_HASH_ATTRIBUTE27 = "data-wp-hash";
function getRuntime27() {
  const globalScope = globalThis;
  if (globalScope.__wpStyleRuntime) {
    return globalScope.__wpStyleRuntime;
  }
  globalScope.__wpStyleRuntime = {
    documents: /* @__PURE__ */ new Map(),
    styles: /* @__PURE__ */ new Map(),
    injectedStyles: /* @__PURE__ */ new WeakMap()
  };
  if (typeof document !== "undefined") {
    registerDocument27(document);
  }
  return globalScope.__wpStyleRuntime;
}
function documentContainsStyleHash27(targetDocument, hash) {
  if (!targetDocument.head) {
    return false;
  }
  for (const style of targetDocument.head.querySelectorAll(
    `style[${STYLE_HASH_ATTRIBUTE27}]`
  )) {
    if (style.getAttribute(STYLE_HASH_ATTRIBUTE27) === hash) {
      return true;
    }
  }
  return false;
}
function injectStyle27(targetDocument, hash, css) {
  if (!targetDocument.head) {
    return;
  }
  const runtime = getRuntime27();
  let injectedStyles = runtime.injectedStyles.get(targetDocument);
  if (!injectedStyles) {
    injectedStyles = /* @__PURE__ */ new Set();
    runtime.injectedStyles.set(targetDocument, injectedStyles);
  }
  if (injectedStyles.has(hash)) {
    return;
  }
  if (documentContainsStyleHash27(targetDocument, hash)) {
    injectedStyles.add(hash);
    return;
  }
  const style = targetDocument.createElement("style");
  style.setAttribute(STYLE_HASH_ATTRIBUTE27, hash);
  style.appendChild(targetDocument.createTextNode(css));
  targetDocument.head.appendChild(style);
  injectedStyles.add(hash);
}
function registerDocument27(targetDocument) {
  const runtime = getRuntime27();
  runtime.documents.set(
    targetDocument,
    (runtime.documents.get(targetDocument) ?? 0) + 1
  );
  for (const [hash, css] of runtime.styles) {
    injectStyle27(targetDocument, hash, css);
  }
  return () => {
    const count = runtime.documents.get(targetDocument);
    if (count === void 0) {
      return;
    }
    if (count <= 1) {
      runtime.documents.delete(targetDocument);
      return;
    }
    runtime.documents.set(targetDocument, count - 1);
  };
}
function registerStyle27(hash, css) {
  const runtime = getRuntime27();
  runtime.styles.set(hash, css);
  for (const targetDocument of runtime.documents.keys()) {
    injectStyle27(targetDocument, hash, css);
  }
}
if (typeof process === "undefined" || true) {
  registerStyle27("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}");
}
var global_css_defense_default9 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" };
if (typeof process === "undefined" || true) {
  registerStyle27("df33c48b2d", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._2d5ad850b2f90964__label{--wp-ui-field-label-line-height:var(--wpds-typography-line-height-xs,16px);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wp-ui-field-label-line-height);text-transform:uppercase;&._17c4214649230bea__is-plain{font-size:var(--wpds-typography-font-size-md,13px);font-weight:var(--wpds-typography-font-weight-default,400);text-transform:none}}._08a3750500e0233f__description{--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);--_gcd-p-margin:0;text-wrap:pretty;color:var(--wpds-color-foreground-content-neutral-weak,#707070);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-sm,12px);line-height:var(--wpds-typography-line-height-xs,16px)}}}');
}
var field_default2 = { "label": "_2d5ad850b2f90964__label", "is-plain": "_17c4214649230bea__is-plain", "description": "_08a3750500e0233f__description" };
var Description = (0, import_element54.forwardRef)(function Description2({ className, ...restProps }, ref) {
  return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
    index_parts_exports2.Description,
    {
      ref,
      className: clsx_default(
        global_css_defense_default9.p,
        field_default2.description,
        className
      ),
      ...restProps
    }
  );
});

// packages/ui/build-module/form/primitives/field/details.mjs
var import_element55 = __toESM(require_element(), 1);
var import_i18n8 = __toESM(require_i18n(), 1);
var import_jsx_runtime84 = __toESM(require_jsx_runtime(), 1);
var STYLE_HASH_ATTRIBUTE28 = "data-wp-hash";
function getRuntime28() {
  const globalScope = globalThis;
  if (globalScope.__wpStyleRuntime) {
    return globalScope.__wpStyleRuntime;
  }
  globalScope.__wpStyleRuntime = {
    documents: /* @__PURE__ */ new Map(),
    styles: /* @__PURE__ */ new Map(),
    injectedStyles: /* @__PURE__ */ new WeakMap()
  };
  if (typeof document !== "undefined") {
    registerDocument28(document);
  }
  return globalScope.__wpStyleRuntime;
}
function documentContainsStyleHash28(targetDocument, hash) {
  if (!targetDocument.head) {
    return false;
  }
  for (const style of targetDocument.head.querySelectorAll(
    `style[${STYLE_HASH_ATTRIBUTE28}]`
  )) {
    if (style.getAttribute(STYLE_HASH_ATTRIBUTE28) === hash) {
      return true;
    }
  }
  return false;
}
function injectStyle28(targetDocument, hash, css) {
  if (!targetDocument.head) {
    return;
  }
  const runtime = getRuntime28();
  let injectedStyles = runtime.injectedStyles.get(targetDocument);
  if (!injectedStyles) {
    injectedStyles = /* @__PURE__ */ new Set();
    runtime.injectedStyles.set(targetDocument, injectedStyles);
  }
  if (injectedStyles.has(hash)) {
    return;
  }
  if (documentContainsStyleHash28(targetDocument, hash)) {
    injectedStyles.add(hash);
    return;
  }
  const style = targetDocument.createElement("style");
  style.setAttribute(STYLE_HASH_ATTRIBUTE28, hash);
  style.appendChild(targetDocument.createTextNode(css));
  targetDocument.head.appendChild(style);
  injectedStyles.add(hash);
}
function registerDocument28(targetDocument) {
  const runtime = getRuntime28();
  runtime.documents.set(
    targetDocument,
    (runtime.documents.get(targetDocument) ?? 0) + 1
  );
  for (const [hash, css] of runtime.styles) {
    injectStyle28(targetDocument, hash, css);
  }
  return () => {
    const count = runtime.documents.get(targetDocument);
    if (count === void 0) {
      return;
    }
    if (count <= 1) {
      runtime.documents.delete(targetDocument);
      return;
    }
    runtime.documents.set(targetDocument, count - 1);
  };
}
function registerStyle28(hash, css) {
  const runtime = getRuntime28();
  runtime.styles.set(hash, css);
  for (const targetDocument of runtime.documents.keys()) {
    injectStyle28(targetDocument, hash, css);
  }
}
if (typeof process === "undefined" || true) {
  registerStyle28("df33c48b2d", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._2d5ad850b2f90964__label{--wp-ui-field-label-line-height:var(--wpds-typography-line-height-xs,16px);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wp-ui-field-label-line-height);text-transform:uppercase;&._17c4214649230bea__is-plain{font-size:var(--wpds-typography-font-size-md,13px);font-weight:var(--wpds-typography-font-weight-default,400);text-transform:none}}._08a3750500e0233f__description{--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);--_gcd-p-margin:0;text-wrap:pretty;color:var(--wpds-color-foreground-content-neutral-weak,#707070);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-sm,12px);line-height:var(--wpds-typography-line-height-xs,16px)}}}');
}
var field_default3 = { "label": "_2d5ad850b2f90964__label", "is-plain": "_17c4214649230bea__is-plain", "description": "_08a3750500e0233f__description" };
var Details = (0, import_element55.forwardRef)(
  function Details2({ className, ...restProps }, ref) {
    return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(import_jsx_runtime84.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(VisuallyHidden, { render: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(index_parts_exports2.Description, {}), children: (0, import_i18n8.__)("More details follow the field.") }),
      /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
        "div",
        {
          ref,
          className: clsx_default(field_default3.description, className),
          ...restProps
        }
      )
    ] });
  }
);

// packages/ui/build-module/form/primitives/field/control.mjs
var import_element56 = __toESM(require_element(), 1);
var import_jsx_runtime85 = __toESM(require_jsx_runtime(), 1);
var Control = (0, import_element56.forwardRef)(
  function Control2(props, ref) {
    return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(index_parts_exports2.Control, { ref, ...props });
  }
);

// packages/ui/build-module/form/primitives/field/visual-label.mjs
var import_element57 = __toESM(require_element(), 1);
var STYLE_HASH_ATTRIBUTE29 = "data-wp-hash";
function getRuntime29() {
  const globalScope = globalThis;
  if (globalScope.__wpStyleRuntime) {
    return globalScope.__wpStyleRuntime;
  }
  globalScope.__wpStyleRuntime = {
    documents: /* @__PURE__ */ new Map(),
    styles: /* @__PURE__ */ new Map(),
    injectedStyles: /* @__PURE__ */ new WeakMap()
  };
  if (typeof document !== "undefined") {
    registerDocument29(document);
  }
  return globalScope.__wpStyleRuntime;
}
function documentContainsStyleHash29(targetDocument, hash) {
  if (!targetDocument.head) {
    return false;
  }
  for (const style of targetDocument.head.querySelectorAll(
    `style[${STYLE_HASH_ATTRIBUTE29}]`
  )) {
    if (style.getAttribute(STYLE_HASH_ATTRIBUTE29) === hash) {
      return true;
    }
  }
  return false;
}
function injectStyle29(targetDocument, hash, css) {
  if (!targetDocument.head) {
    return;
  }
  const runtime = getRuntime29();
  let injectedStyles = runtime.injectedStyles.get(targetDocument);
  if (!injectedStyles) {
    injectedStyles = /* @__PURE__ */ new Set();
    runtime.injectedStyles.set(targetDocument, injectedStyles);
  }
  if (injectedStyles.has(hash)) {
    return;
  }
  if (documentContainsStyleHash29(targetDocument, hash)) {
    injectedStyles.add(hash);
    return;
  }
  const style = targetDocument.createElement("style");
  style.setAttribute(STYLE_HASH_ATTRIBUTE29, hash);
  style.appendChild(targetDocument.createTextNode(css));
  targetDocument.head.appendChild(style);
  injectedStyles.add(hash);
}
function registerDocument29(targetDocument) {
  const runtime = getRuntime29();
  runtime.documents.set(
    targetDocument,
    (runtime.documents.get(targetDocument) ?? 0) + 1
  );
  for (const [hash, css] of runtime.styles) {
    injectStyle29(targetDocument, hash, css);
  }
  return () => {
    const count = runtime.documents.get(targetDocument);
    if (count === void 0) {
      return;
    }
    if (count <= 1) {
      runtime.documents.delete(targetDocument);
      return;
    }
    runtime.documents.set(targetDocument, count - 1);
  };
}
function registerStyle29(hash, css) {
  const runtime = getRuntime29();
  runtime.styles.set(hash, css);
  for (const targetDocument of runtime.documents.keys()) {
    injectStyle29(targetDocument, hash, css);
  }
}
if (typeof process === "undefined" || true) {
  registerStyle29("df33c48b2d", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._2d5ad850b2f90964__label{--wp-ui-field-label-line-height:var(--wpds-typography-line-height-xs,16px);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wp-ui-field-label-line-height);text-transform:uppercase;&._17c4214649230bea__is-plain{font-size:var(--wpds-typography-font-size-md,13px);font-weight:var(--wpds-typography-font-weight-default,400);text-transform:none}}._08a3750500e0233f__description{--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);--_gcd-p-margin:0;text-wrap:pretty;color:var(--wpds-color-foreground-content-neutral-weak,#707070);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-sm,12px);line-height:var(--wpds-typography-line-height-xs,16px)}}}');
}
var field_default4 = { "label": "_2d5ad850b2f90964__label", "is-plain": "_17c4214649230bea__is-plain", "description": "_08a3750500e0233f__description" };
var VisualLabel = (0, import_element57.forwardRef)(
  function VisualLabel2({ className, render: render4, variant, ...restProps }, ref) {
    return useRender({
      defaultTagName: "span",
      render: render4,
      ref,
      props: mergeProps(restProps, {
        className: clsx_default(
          field_default4.label,
          variant && field_default4[`is-${variant}`],
          className
        )
      })
    });
  }
);
VisualLabel.displayName = "Field.VisualLabel";

// packages/ui/build-module/form/primitives/textarea/textarea.mjs
var import_element58 = __toESM(require_element(), 1);
var import_jsx_runtime86 = __toESM(require_jsx_runtime(), 1);
var STYLE_HASH_ATTRIBUTE30 = "data-wp-hash";
function getRuntime30() {
  const globalScope = globalThis;
  if (globalScope.__wpStyleRuntime) {
    return globalScope.__wpStyleRuntime;
  }
  globalScope.__wpStyleRuntime = {
    documents: /* @__PURE__ */ new Map(),
    styles: /* @__PURE__ */ new Map(),
    injectedStyles: /* @__PURE__ */ new WeakMap()
  };
  if (typeof document !== "undefined") {
    registerDocument30(document);
  }
  return globalScope.__wpStyleRuntime;
}
function documentContainsStyleHash30(targetDocument, hash) {
  if (!targetDocument.head) {
    return false;
  }
  for (const style of targetDocument.head.querySelectorAll(
    `style[${STYLE_HASH_ATTRIBUTE30}]`
  )) {
    if (style.getAttribute(STYLE_HASH_ATTRIBUTE30) === hash) {
      return true;
    }
  }
  return false;
}
function injectStyle30(targetDocument, hash, css) {
  if (!targetDocument.head) {
    return;
  }
  const runtime = getRuntime30();
  let injectedStyles = runtime.injectedStyles.get(targetDocument);
  if (!injectedStyles) {
    injectedStyles = /* @__PURE__ */ new Set();
    runtime.injectedStyles.set(targetDocument, injectedStyles);
  }
  if (injectedStyles.has(hash)) {
    return;
  }
  if (documentContainsStyleHash30(targetDocument, hash)) {
    injectedStyles.add(hash);
    return;
  }
  const style = targetDocument.createElement("style");
  style.setAttribute(STYLE_HASH_ATTRIBUTE30, hash);
  style.appendChild(targetDocument.createTextNode(css));
  targetDocument.head.appendChild(style);
  injectedStyles.add(hash);
}
function registerDocument30(targetDocument) {
  const runtime = getRuntime30();
  runtime.documents.set(
    targetDocument,
    (runtime.documents.get(targetDocument) ?? 0) + 1
  );
  for (const [hash, css] of runtime.styles) {
    injectStyle30(targetDocument, hash, css);
  }
  return () => {
    const count = runtime.documents.get(targetDocument);
    if (count === void 0) {
      return;
    }
    if (count <= 1) {
      runtime.documents.delete(targetDocument);
      return;
    }
    runtime.documents.set(targetDocument, count - 1);
  };
}
function registerStyle30(hash, css) {
  const runtime = getRuntime30();
  runtime.styles.set(hash, css);
  for (const targetDocument of runtime.documents.keys()) {
    injectStyle30(targetDocument, hash, css);
  }
}
if (typeof process === "undefined" || true) {
  registerStyle30("1540cbc709", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._1e441c22c9dc5d28__wrapper{--wp-ui-textarea-min-height:var(--wpds-dimension-size-lg,40px)}._414844876c32ecee__textarea{min-height:calc(var(--wp-ui-textarea-min-height) - 2px);resize:block}}@layer compositions{._1e441c22c9dc5d28__wrapper{--wp-ui-input-padding-block:9.9px;height:auto;line-height:1.4}}}");
}
var style_default24 = { "wrapper": "_1e441c22c9dc5d28__wrapper", "textarea": "_414844876c32ecee__textarea" };
if (typeof process === "undefined" || true) {
  registerStyle30("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}");
}
var global_css_defense_default10 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" };
var wrappedRender = (render4, restProps) => {
  return function textareaRender(props) {
    return typeof render4 === "function" ? render4(mergeProps(props, restProps)) : (0, import_element58.cloneElement)(render4, mergeProps(props, restProps));
  };
};
var Textarea = (0, import_element58.forwardRef)(
  function Textarea2({
    className,
    defaultValue,
    disabled: disabled2,
    onValueChange,
    render: render4,
    rows = 4,
    style,
    value,
    ...restProps
  }, ref) {
    return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
      Input3,
      {
        className: clsx_default(style_default24.wrapper, className),
        style,
        render: wrappedRender(
          render4 || ((props) => /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("textarea", { ...props })),
          {
            className: clsx_default(
              global_css_defense_default10.textarea,
              style_default24.textarea
            ),
            ref,
            rows,
            ...restProps
          }
        ),
        value,
        defaultValue,
        onValueChange,
        disabled: disabled2
      }
    );
  }
);

// packages/ui/build-module/form/input-control/input-control.mjs
var import_element59 = __toESM(require_element(), 1);
var import_jsx_runtime87 = __toESM(require_jsx_runtime(), 1);
var STYLE_HASH_ATTRIBUTE31 = "data-wp-hash";
function getRuntime31() {
  const globalScope = globalThis;
  if (globalScope.__wpStyleRuntime) {
    return globalScope.__wpStyleRuntime;
  }
  globalScope.__wpStyleRuntime = {
    documents: /* @__PURE__ */ new Map(),
    styles: /* @__PURE__ */ new Map(),
    injectedStyles: /* @__PURE__ */ new WeakMap()
  };
  if (typeof document !== "undefined") {
    registerDocument31(document);
  }
  return globalScope.__wpStyleRuntime;
}
function documentContainsStyleHash31(targetDocument, hash) {
  if (!targetDocument.head) {
    return false;
  }
  for (const style of targetDocument.head.querySelectorAll(
    `style[${STYLE_HASH_ATTRIBUTE31}]`
  )) {
    if (style.getAttribute(STYLE_HASH_ATTRIBUTE31) === hash) {
      return true;
    }
  }
  return false;
}
function injectStyle31(targetDocument, hash, css) {
  if (!targetDocument.head) {
    return;
  }
  const runtime = getRuntime31();
  let injectedStyles = runtime.injectedStyles.get(targetDocument);
  if (!injectedStyles) {
    injectedStyles = /* @__PURE__ */ new Set();
    runtime.injectedStyles.set(targetDocument, injectedStyles);
  }
  if (injectedStyles.has(hash)) {
    return;
  }
  if (documentContainsStyleHash31(targetDocument, hash)) {
    injectedStyles.add(hash);
    return;
  }
  const style = targetDocument.createElement("style");
  style.setAttribute(STYLE_HASH_ATTRIBUTE31, hash);
  style.appendChild(targetDocument.createTextNode(css));
  targetDocument.head.appendChild(style);
  injectedStyles.add(hash);
}
function registerDocument31(targetDocument) {
  const runtime = getRuntime31();
  runtime.documents.set(
    targetDocument,
    (runtime.documents.get(targetDocument) ?? 0) + 1
  );
  for (const [hash, css] of runtime.styles) {
    injectStyle31(targetDocument, hash, css);
  }
  return () => {
    const count = runtime.documents.get(targetDocument);
    if (count === void 0) {
      return;
    }
    if (count <= 1) {
      runtime.documents.delete(targetDocument);
      return;
    }
    runtime.documents.set(targetDocument, count - 1);
  };
}
function registerStyle31(hash, css) {
  const runtime = getRuntime31();
  runtime.styles.set(hash, css);
  for (const targetDocument of runtime.documents.keys()) {
    injectStyle31(targetDocument, hash, css);
  }
}
if (typeof process === "undefined" || true) {
  registerStyle31("0c752c3d08", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer compositions{@supports (-webkit-hyphens:none) and (not (-moz-appearance:none)){.a9211a7e6af24bed__root input[type=date]:not([data-filled]):not(:focus),.a9211a7e6af24bed__root input[type=datetime-local]:not([data-filled]):not(:focus),.a9211a7e6af24bed__root input[type=time]:not([data-filled]):not(:focus){--_gcd-input-color:transparent;--_gcd-input-color-disabled:transparent;color:transparent;&:disabled::-webkit-datetime-edit-text{color:transparent}}}}}");
}
var style_default25 = { "root": "a9211a7e6af24bed__root" };
var InputControl = (0, import_element59.forwardRef)(
  function InputControl2({
    className,
    label,
    description,
    details,
    hideLabelFromVision,
    ...restProps
  }, ref) {
    return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(field_exports.Root, { className: clsx_default(style_default25.root, className), children: [
      /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(field_exports.Label, { hideFromVision: hideLabelFromVision, children: label }),
      /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Input3, { ref, ...restProps }),
      description && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(field_exports.Description, { children: description }),
      details && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(field_exports.Details, { children: details })
    ] });
  }
);

// packages/ui/build-module/form/textarea-control/textarea-control.mjs
var import_element60 = __toESM(require_element(), 1);
var import_jsx_runtime88 = __toESM(require_jsx_runtime(), 1);
var TextareaControl = (0, import_element60.forwardRef)(function TextareaControl2({
  className,
  label,
  description,
  details,
  hideLabelFromVision,
  ...restProps
}, ref) {
  return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(field_exports.Root, { className, children: [
    /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(field_exports.Label, { hideFromVision: hideLabelFromVision, children: label }),
    /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Textarea, { ref, ...restProps }),
    description && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(field_exports.Description, { children: description }),
    details && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(field_exports.Details, { children: details })
  ] });
});

// packages/ui/build-module/form/with-validation/validated-input-control/validated-input-control.mjs
var import_element61 = __toESM(require_element(), 1);
var import_compose5 = __toESM(require_compose(), 1);
var import_jsx_runtime89 = __toESM(require_jsx_runtime(), 1);
var ValidatedInputControl = (0, import_element61.forwardRef)(function ValidatedInputControl2({ required, markWhenOptional, customValidity, ...restProps }, forwardedRef) {
  const validityTargetRef = (0, import_element61.useRef)(null);
  const mergedRefs = (0, import_compose5.useMergeRefs)([forwardedRef, validityTargetRef]);
  return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
    ControlWithError,
    {
      required,
      markWhenOptional,
      customValidity,
      getValidityTarget: () => validityTargetRef.current,
      children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(InputControl, { ref: mergedRefs, ...restProps })
    }
  );
});

// packages/ui/build-module/form/with-validation/validated-textarea-control/validated-textarea-control.mjs
var import_element62 = __toESM(require_element(), 1);
var import_compose6 = __toESM(require_compose(), 1);
var import_jsx_runtime90 = __toESM(require_jsx_runtime(), 1);
var ValidatedTextareaControl = (0, import_element62.forwardRef)(function ValidatedTextareaControl2({ required, markWhenOptional, customValidity, ...restProps }, forwardedRef) {
  const validityTargetRef = (0, import_element62.useRef)(null);
  const mergedRefs = (0, import_compose6.useMergeRefs)([forwardedRef, validityTargetRef]);
  return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
    ControlWithError,
    {
      required,
      markWhenOptional,
      customValidity,
      getValidityTarget: () => validityTargetRef.current,
      children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(TextareaControl, { ref: mergedRefs, ...restProps })
    }
  );
});

// packages/ui/build-module/tabs/index.mjs
var tabs_exports = {};
__export(tabs_exports, {
  List: () => List,
  Panel: () => Panel2,
  Root: () => Root7,
  Tab: () => Tab
});

// packages/ui/build-module/tabs/list.mjs
var import_element63 = __toESM(require_element(), 1);
var import_compose7 = __toESM(require_compose(), 1);
var import_jsx_runtime91 = __toESM(require_jsx_runtime(), 1);
var STYLE_HASH_ATTRIBUTE32 = "data-wp-hash";
function getRuntime32() {
  const globalScope = globalThis;
  if (globalScope.__wpStyleRuntime) {
    return globalScope.__wpStyleRuntime;
  }
  globalScope.__wpStyleRuntime = {
    documents: /* @__PURE__ */ new Map(),
    styles: /* @__PURE__ */ new Map(),
    injectedStyles: /* @__PURE__ */ new WeakMap()
  };
  if (typeof document !== "undefined") {
    registerDocument32(document);
  }
  return globalScope.__wpStyleRuntime;
}
function documentContainsStyleHash32(targetDocument, hash) {
  if (!targetDocument.head) {
    return false;
  }
  for (const style of targetDocument.head.querySelectorAll(
    `style[${STYLE_HASH_ATTRIBUTE32}]`
  )) {
    if (style.getAttribute(STYLE_HASH_ATTRIBUTE32) === hash) {
      return true;
    }
  }
  return false;
}
function injectStyle32(targetDocument, hash, css) {
  if (!targetDocument.head) {
    return;
  }
  const runtime = getRuntime32();
  let injectedStyles = runtime.injectedStyles.get(targetDocument);
  if (!injectedStyles) {
    injectedStyles = /* @__PURE__ */ new Set();
    runtime.injectedStyles.set(targetDocument, injectedStyles);
  }
  if (injectedStyles.has(hash)) {
    return;
  }
  if (documentContainsStyleHash32(targetDocument, hash)) {
    injectedStyles.add(hash);
    return;
  }
  const style = targetDocument.createElement("style");
  style.setAttribute(STYLE_HASH_ATTRIBUTE32, hash);
  style.appendChild(targetDocument.createTextNode(css));
  targetDocument.head.appendChild(style);
  injectedStyles.add(hash);
}
function registerDocument32(targetDocument) {
  const runtime = getRuntime32();
  runtime.documents.set(
    targetDocument,
    (runtime.documents.get(targetDocument) ?? 0) + 1
  );
  for (const [hash, css] of runtime.styles) {
    injectStyle32(targetDocument, hash, css);
  }
  return () => {
    const count = runtime.documents.get(targetDocument);
    if (count === void 0) {
      return;
    }
    if (count <= 1) {
      runtime.documents.delete(targetDocument);
      return;
    }
    runtime.documents.set(targetDocument, count - 1);
  };
}
function registerStyle32(hash, css) {
  const runtime = getRuntime32();
  runtime.styles.set(hash, css);
  for (const targetDocument of runtime.documents.keys()) {
    injectStyle32(targetDocument, hash, css);
  }
}
if (typeof process === "undefined" || true) {
  registerStyle32("54ae3f4680", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._7313adbc8a112e90__tablist{--direction-start:left;--direction-end:right;align-items:stretch;display:flex;overflow-inline:auto;overscroll-behavior-inline:none;position:relative;&:dir(rtl){--direction-start:right;--direction-end:left}&[data-orientation=horizontal]{--fade-width:4rem;--fade-gradient-base:transparent 0%,#000 var(--fade-width);--fade-gradient-composed:var(--fade-gradient-base),#000 60%,transparent 50%;width:fit-content;&._9f2ac729c68a735a__is-overflowing-first{mask-image:linear-gradient(to var(--direction-end),var(--fade-gradient-base))}&._81c799c1f3cdd261__is-overflowing-last{mask-image:linear-gradient(to var(--direction-start),var(--fade-gradient-base))}&._9f2ac729c68a735a__is-overflowing-first._81c799c1f3cdd261__is-overflowing-last{mask-image:linear-gradient(to right,var(--fade-gradient-composed)),linear-gradient(to left,var(--fade-gradient-composed))}&._59228b5227f38a99__is-minimal-variant{gap:1rem}}&[data-orientation=vertical]{flex-direction:column}}._1c37dcfaa1ad8cda__indicator{@media not (prefers-reduced-motion){transition-duration:.2s;transition-property:translate,width,height,border-radius,border-block;transition-timing-function:ease-out}outline:2px solid transparent;outline-offset:-1px;pointer-events:none;position:absolute;&[data-orientation=horizontal]{background-color:var(--wpds-color-stroke-interactive-neutral-strong,#6e6e6e);bottom:0;height:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px));left:0;translate:var(--active-tab-left) 0;width:var(--active-tab-width);z-index:1}&[data-orientation=vertical]{background-color:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);border-radius:var(--wpds-border-radius-sm,2px);height:var(--active-tab-height);left:50%;top:0;translate:-50% var(--active-tab-top);width:100%;z-index:0}._7313adbc8a112e90__tablist[data-select-on-move=true]:has(:focus-visible)\n			&[data-orientation=vertical]{border:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));box-sizing:border-box}}.a5fd8814f195aa5e__tab{align-items:center;background:transparent;border:none;border-radius:0;box-shadow:none;color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);cursor:var(--wpds-cursor-control,pointer);display:flex;flex:1 0 auto;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);font-weight:400;line-height:1.2;outline:none;padding:0;position:relative;white-space:nowrap;z-index:1;&[data-disabled]{color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);cursor:default;@media (forced-colors:active){color:GrayText}}&:not([data-disabled]):is(:hover,:focus-visible){color:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e)}&:after{border-radius:var(--wpds-border-radius-sm,2px);opacity:0;outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));pointer-events:none;position:absolute;z-index:-1;@media not (prefers-reduced-motion){transition:opacity .1s linear}}&:focus-visible:after{opacity:1}[data-orientation=horizontal] &{height:48px;padding-inline:var(--wpds-dimension-padding-lg,16px);scroll-margin:24px;&:after{content:"";inset:var(--wpds-dimension-padding-md,12px)}}._59228b5227f38a99__is-minimal-variant[data-orientation=horizontal] &{padding-inline:0;&:after{inset-inline:round(up,var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)),1px)}}[data-orientation=vertical] &{min-height:var(--wpds-dimension-size-lg,40px);padding:var(--wpds-dimension-padding-sm,8px) var(--wpds-dimension-padding-md,12px)}[data-orientation=vertical][data-select-on-move=false] &:after{content:"";inset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}._5dfc77e6edd345d4__tab-children{align-items:center;display:flex;flex-grow:1;[data-orientation=horizontal] &{justify-content:center}[data-orientation=vertical] &{justify-content:start}}._4a20e969d15e5ac1__tab-chevron{flex-shrink:0;margin-inline-end:calc(var(--wpds-dimension-gap-xs, 4px)*-1);opacity:0;[data-orientation=horizontal] &{display:none}[role=tab]:is([aria-selected=true],:focus-visible,:hover) &{opacity:1}@media not (prefers-reduced-motion){[data-select-on-move=true]\n				[role=tab]:is([aria-selected=true])\n				&{transition:opacity .15s linear .15s}}&:dir(rtl){rotate:180deg}}}}');
}
var style_default26 = { "tablist": "_7313adbc8a112e90__tablist", "is-overflowing-first": "_9f2ac729c68a735a__is-overflowing-first", "is-overflowing-last": "_81c799c1f3cdd261__is-overflowing-last", "is-minimal-variant": "_59228b5227f38a99__is-minimal-variant", "indicator": "_1c37dcfaa1ad8cda__indicator", "tab": "a5fd8814f195aa5e__tab", "tab-children": "_5dfc77e6edd345d4__tab-children", "tab-chevron": "_4a20e969d15e5ac1__tab-chevron" };
var SCROLL_EPSILON = 1;
var List = (0, import_element63.forwardRef)(
  function TabList({
    children,
    variant = "default",
    className,
    activateOnFocus,
    ...otherProps
  }, forwardedRef) {
    const [listEl, setListEl] = (0, import_element63.useState)(null);
    const [overflow, setOverflow] = (0, import_element63.useState)({
      first: false,
      last: false,
      isScrolling: false
    });
    (0, import_element63.useEffect)(() => {
      if (!listEl) {
        return;
      }
      const measureOverflow = () => {
        const { scrollWidth, clientWidth, scrollLeft } = listEl;
        const maxScroll = Math.max(scrollWidth - clientWidth, 0);
        const direction = listEl.dir || (typeof window !== "undefined" ? window.getComputedStyle(listEl).direction : "ltr");
        const scrollFromStart = direction === "rtl" && scrollLeft < 0 ? (
          // In RTL layouts, scrollLeft is typically 0 at the visual "start"
          // (right edge) and becomes negative toward the "end" (left edge).
          // Normalize value for correct first/last detection logic.
          -scrollLeft
        ) : scrollLeft;
        const next = {
          first: scrollFromStart > SCROLL_EPSILON,
          last: scrollFromStart < maxScroll - SCROLL_EPSILON,
          isScrolling: scrollWidth > clientWidth
        };
        setOverflow(
          (prev) => prev.first === next.first && prev.last === next.last && prev.isScrolling === next.isScrolling ? prev : next
        );
      };
      const resizeObserver = new ResizeObserver(measureOverflow);
      const observeTabs = () => {
        resizeObserver.disconnect();
        resizeObserver.observe(listEl);
        listEl.querySelectorAll('[role="tab"]').forEach((tab) => resizeObserver.observe(tab));
      };
      const mutationObserver = new MutationObserver(observeTabs);
      mutationObserver.observe(listEl, {
        childList: true,
        subtree: true
      });
      let scrollTick = false;
      const throttleMeasureOverflowOnScroll = () => {
        if (!scrollTick) {
          requestAnimationFrame(() => {
            measureOverflow();
            scrollTick = false;
          });
          scrollTick = true;
        }
      };
      listEl.addEventListener(
        "scroll",
        throttleMeasureOverflowOnScroll,
        { passive: true }
      );
      observeTabs();
      measureOverflow();
      return () => {
        listEl.removeEventListener(
          "scroll",
          throttleMeasureOverflowOnScroll
        );
        resizeObserver.disconnect();
        mutationObserver.disconnect();
      };
    }, [listEl]);
    const mergedListRef = (0, import_compose7.useMergeRefs)([
      forwardedRef,
      (el) => setListEl(el)
    ]);
    return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
      index_parts_exports3.List,
      {
        ref: mergedListRef,
        activateOnFocus,
        "data-select-on-move": activateOnFocus ? "true" : "false",
        className: clsx_default(
          style_default26.tablist,
          overflow.first && style_default26["is-overflowing-first"],
          overflow.last && style_default26["is-overflowing-last"],
          style_default26[`is-${variant}-variant`],
          className
        ),
        ...otherProps,
        tabIndex: otherProps.tabIndex ?? (overflow.isScrolling ? -1 : void 0),
        children: [
          children,
          /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(index_parts_exports3.Indicator, { className: style_default26.indicator })
        ]
      }
    );
  }
);

// packages/ui/build-module/tabs/panel.mjs
var import_element65 = __toESM(require_element(), 1);

// packages/ui/build-module/tabs/context.mjs
var import_element64 = __toESM(require_element(), 1);
var import_jsx_runtime92 = __toESM(require_jsx_runtime(), 1);
var VALIDATION_ENABLED = true;
var TabsValidationContext = VALIDATION_ENABLED ? (0, import_element64.createContext)(null) : null;
function useRegisterTabDev() {
  const context = (0, import_element64.useContext)(TabsValidationContext);
  (0, import_element64.useEffect)(() => {
    if (context) {
      return context.registerTab();
    }
    return void 0;
  }, [context]);
}
function useRegisterTabProd() {
}
var useRegisterTab = VALIDATION_ENABLED ? useRegisterTabDev : useRegisterTabProd;
function useRegisterPanelDev() {
  const context = (0, import_element64.useContext)(TabsValidationContext);
  (0, import_element64.useEffect)(() => {
    if (context) {
      return context.registerPanel();
    }
    return void 0;
  }, [context]);
}
function useRegisterPanelProd() {
}
var useRegisterPanel = VALIDATION_ENABLED ? useRegisterPanelDev : useRegisterPanelProd;
function TabsValidationProviderDev({
  children
}) {
  const tabCountRef = (0, import_element64.useRef)(0);
  const panelCountRef = (0, import_element64.useRef)(0);
  const scheduleValidation = useScheduleValidation(() => {
    const tabCount = tabCountRef.current;
    const panelCount = panelCountRef.current;
    if (tabCount !== panelCount) {
      throw new Error(
        `Tabs: Tab/Panel count mismatch (${tabCount} Tabs, ${panelCount} Panels). Each Tab must be associated with exactly one Panel. Mismatched or missing associations can break screen reader navigation and violate WAI-ARIA Tabs pattern requirements.`
      );
    }
  });
  const registerTab = (0, import_element64.useCallback)(() => {
    tabCountRef.current += 1;
    scheduleValidation();
    return () => {
      tabCountRef.current -= 1;
      scheduleValidation();
    };
  }, [scheduleValidation]);
  const registerPanel = (0, import_element64.useCallback)(() => {
    panelCountRef.current += 1;
    scheduleValidation();
    return () => {
      panelCountRef.current -= 1;
      scheduleValidation();
    };
  }, [scheduleValidation]);
  const contextValue = (0, import_element64.useMemo)(
    () => ({
      registerTab,
      registerPanel
    }),
    [registerTab, registerPanel]
  );
  return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(TabsValidationContext.Provider, { value: contextValue, children });
}
function TabsValidationProviderProd({
  children
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_jsx_runtime92.Fragment, { children });
}
var TabsValidationProvider = VALIDATION_ENABLED ? TabsValidationProviderDev : TabsValidationProviderProd;

// packages/ui/build-module/tabs/panel.mjs
var import_jsx_runtime93 = __toESM(require_jsx_runtime(), 1);
var STYLE_HASH_ATTRIBUTE33 = "data-wp-hash";
function getRuntime33() {
  const globalScope = globalThis;
  if (globalScope.__wpStyleRuntime) {
    return globalScope.__wpStyleRuntime;
  }
  globalScope.__wpStyleRuntime = {
    documents: /* @__PURE__ */ new Map(),
    styles: /* @__PURE__ */ new Map(),
    injectedStyles: /* @__PURE__ */ new WeakMap()
  };
  if (typeof document !== "undefined") {
    registerDocument33(document);
  }
  return globalScope.__wpStyleRuntime;
}
function documentContainsStyleHash33(targetDocument, hash) {
  if (!targetDocument.head) {
    return false;
  }
  for (const style of targetDocument.head.querySelectorAll(
    `style[${STYLE_HASH_ATTRIBUTE33}]`
  )) {
    if (style.getAttribute(STYLE_HASH_ATTRIBUTE33) === hash) {
      return true;
    }
  }
  return false;
}
function injectStyle33(targetDocument, hash, css) {
  if (!targetDocument.head) {
    return;
  }
  const runtime = getRuntime33();
  let injectedStyles = runtime.injectedStyles.get(targetDocument);
  if (!injectedStyles) {
    injectedStyles = /* @__PURE__ */ new Set();
    runtime.injectedStyles.set(targetDocument, injectedStyles);
  }
  if (injectedStyles.has(hash)) {
    return;
  }
  if (documentContainsStyleHash33(targetDocument, hash)) {
    injectedStyles.add(hash);
    return;
  }
  const style = targetDocument.createElement("style");
  style.setAttribute(STYLE_HASH_ATTRIBUTE33, hash);
  style.appendChild(targetDocument.createTextNode(css));
  targetDocument.head.appendChild(style);
  injectedStyles.add(hash);
}
function registerDocument33(targetDocument) {
  const runtime = getRuntime33();
  runtime.documents.set(
    targetDocument,
    (runtime.documents.get(targetDocument) ?? 0) + 1
  );
  for (const [hash, css] of runtime.styles) {
    injectStyle33(targetDocument, hash, css);
  }
  return () => {
    const count = runtime.documents.get(targetDocument);
    if (count === void 0) {
      return;
    }
    if (count <= 1) {
      runtime.documents.delete(targetDocument);
      return;
    }
    runtime.documents.set(targetDocument, count - 1);
  };
}
function registerStyle33(hash, css) {
  const runtime = getRuntime33();
  runtime.styles.set(hash, css);
  for (const targetDocument of runtime.documents.keys()) {
    injectStyle33(targetDocument, hash, css);
  }
}
if (typeof process === "undefined" || true) {
  registerStyle33("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}");
}
var global_css_defense_default11 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" };
if (typeof process === "undefined" || true) {
  registerStyle33("08122b3d53", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{.af79fb116edb0dd7__outset-ring--focus:focus,.dfcfdc28396e5d98__outset-ring--focus-visible:focus-visible,.e5cd9ee879f6403a__outset-ring--focus-within:focus-within,:focus-visible ._81935a08e952f267__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within,.abc777e9713fa711__outset-ring--focus-except-active:focus{outline:none}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.abc777e9713fa711__outset-ring--focus-except-active:focus:not(:active){--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}}");
}
var focus_module_default6 = { "outset-ring--focus": "af79fb116edb0dd7__outset-ring--focus", "outset-ring--focus-visible": "dfcfdc28396e5d98__outset-ring--focus-visible", "outset-ring--focus-within": "e5cd9ee879f6403a__outset-ring--focus-within", "outset-ring--focus-parent-visible": "_81935a08e952f267__outset-ring--focus-parent-visible", "outset-ring--focus-except-active": "abc777e9713fa711__outset-ring--focus-except-active", "outset-ring--focus-within-except-active": "_3c9f5ee9fc9c136d__outset-ring--focus-within-except-active" };
var Panel2 = (0, import_element65.forwardRef)(
  function TabPanel({ className, ...otherProps }, forwardedRef) {
    useRegisterPanel();
    return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
      index_parts_exports3.Panel,
      {
        ref: forwardedRef,
        className: clsx_default(
          global_css_defense_default11.div,
          focus_module_default6["outset-ring--focus-visible"],
          className
        ),
        ...otherProps
      }
    );
  }
);

// packages/ui/build-module/tabs/root.mjs
var import_element66 = __toESM(require_element(), 1);
var import_jsx_runtime94 = __toESM(require_jsx_runtime(), 1);
var Root7 = (0, import_element66.forwardRef)(
  function TabsRoot3({ ...otherProps }, forwardedRef) {
    return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(DirectionProvider3, { children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(TabsValidationProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(index_parts_exports3.Root, { ref: forwardedRef, ...otherProps }) }) });
  }
);

// packages/ui/build-module/tabs/tab.mjs
var import_element67 = __toESM(require_element(), 1);
var import_jsx_runtime95 = __toESM(require_jsx_runtime(), 1);
var STYLE_HASH_ATTRIBUTE34 = "data-wp-hash";
function getRuntime34() {
  const globalScope = globalThis;
  if (globalScope.__wpStyleRuntime) {
    return globalScope.__wpStyleRuntime;
  }
  globalScope.__wpStyleRuntime = {
    documents: /* @__PURE__ */ new Map(),
    styles: /* @__PURE__ */ new Map(),
    injectedStyles: /* @__PURE__ */ new WeakMap()
  };
  if (typeof document !== "undefined") {
    registerDocument34(document);
  }
  return globalScope.__wpStyleRuntime;
}
function documentContainsStyleHash34(targetDocument, hash) {
  if (!targetDocument.head) {
    return false;
  }
  for (const style of targetDocument.head.querySelectorAll(
    `style[${STYLE_HASH_ATTRIBUTE34}]`
  )) {
    if (style.getAttribute(STYLE_HASH_ATTRIBUTE34) === hash) {
      return true;
    }
  }
  return false;
}
function injectStyle34(targetDocument, hash, css) {
  if (!targetDocument.head) {
    return;
  }
  const runtime = getRuntime34();
  let injectedStyles = runtime.injectedStyles.get(targetDocument);
  if (!injectedStyles) {
    injectedStyles = /* @__PURE__ */ new Set();
    runtime.injectedStyles.set(targetDocument, injectedStyles);
  }
  if (injectedStyles.has(hash)) {
    return;
  }
  if (documentContainsStyleHash34(targetDocument, hash)) {
    injectedStyles.add(hash);
    return;
  }
  const style = targetDocument.createElement("style");
  style.setAttribute(STYLE_HASH_ATTRIBUTE34, hash);
  style.appendChild(targetDocument.createTextNode(css));
  targetDocument.head.appendChild(style);
  injectedStyles.add(hash);
}
function registerDocument34(targetDocument) {
  const runtime = getRuntime34();
  runtime.documents.set(
    targetDocument,
    (runtime.documents.get(targetDocument) ?? 0) + 1
  );
  for (const [hash, css] of runtime.styles) {
    injectStyle34(targetDocument, hash, css);
  }
  return () => {
    const count = runtime.documents.get(targetDocument);
    if (count === void 0) {
      return;
    }
    if (count <= 1) {
      runtime.documents.delete(targetDocument);
      return;
    }
    runtime.documents.set(targetDocument, count - 1);
  };
}
function registerStyle34(hash, css) {
  const runtime = getRuntime34();
  runtime.styles.set(hash, css);
  for (const targetDocument of runtime.documents.keys()) {
    injectStyle34(targetDocument, hash, css);
  }
}
if (typeof process === "undefined" || true) {
  registerStyle34("54ae3f4680", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._7313adbc8a112e90__tablist{--direction-start:left;--direction-end:right;align-items:stretch;display:flex;overflow-inline:auto;overscroll-behavior-inline:none;position:relative;&:dir(rtl){--direction-start:right;--direction-end:left}&[data-orientation=horizontal]{--fade-width:4rem;--fade-gradient-base:transparent 0%,#000 var(--fade-width);--fade-gradient-composed:var(--fade-gradient-base),#000 60%,transparent 50%;width:fit-content;&._9f2ac729c68a735a__is-overflowing-first{mask-image:linear-gradient(to var(--direction-end),var(--fade-gradient-base))}&._81c799c1f3cdd261__is-overflowing-last{mask-image:linear-gradient(to var(--direction-start),var(--fade-gradient-base))}&._9f2ac729c68a735a__is-overflowing-first._81c799c1f3cdd261__is-overflowing-last{mask-image:linear-gradient(to right,var(--fade-gradient-composed)),linear-gradient(to left,var(--fade-gradient-composed))}&._59228b5227f38a99__is-minimal-variant{gap:1rem}}&[data-orientation=vertical]{flex-direction:column}}._1c37dcfaa1ad8cda__indicator{@media not (prefers-reduced-motion){transition-duration:.2s;transition-property:translate,width,height,border-radius,border-block;transition-timing-function:ease-out}outline:2px solid transparent;outline-offset:-1px;pointer-events:none;position:absolute;&[data-orientation=horizontal]{background-color:var(--wpds-color-stroke-interactive-neutral-strong,#6e6e6e);bottom:0;height:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px));left:0;translate:var(--active-tab-left) 0;width:var(--active-tab-width);z-index:1}&[data-orientation=vertical]{background-color:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);border-radius:var(--wpds-border-radius-sm,2px);height:var(--active-tab-height);left:50%;top:0;translate:-50% var(--active-tab-top);width:100%;z-index:0}._7313adbc8a112e90__tablist[data-select-on-move=true]:has(:focus-visible)\n			&[data-orientation=vertical]{border:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));box-sizing:border-box}}.a5fd8814f195aa5e__tab{align-items:center;background:transparent;border:none;border-radius:0;box-shadow:none;color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);cursor:var(--wpds-cursor-control,pointer);display:flex;flex:1 0 auto;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);font-weight:400;line-height:1.2;outline:none;padding:0;position:relative;white-space:nowrap;z-index:1;&[data-disabled]{color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);cursor:default;@media (forced-colors:active){color:GrayText}}&:not([data-disabled]):is(:hover,:focus-visible){color:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e)}&:after{border-radius:var(--wpds-border-radius-sm,2px);opacity:0;outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));pointer-events:none;position:absolute;z-index:-1;@media not (prefers-reduced-motion){transition:opacity .1s linear}}&:focus-visible:after{opacity:1}[data-orientation=horizontal] &{height:48px;padding-inline:var(--wpds-dimension-padding-lg,16px);scroll-margin:24px;&:after{content:"";inset:var(--wpds-dimension-padding-md,12px)}}._59228b5227f38a99__is-minimal-variant[data-orientation=horizontal] &{padding-inline:0;&:after{inset-inline:round(up,var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)),1px)}}[data-orientation=vertical] &{min-height:var(--wpds-dimension-size-lg,40px);padding:var(--wpds-dimension-padding-sm,8px) var(--wpds-dimension-padding-md,12px)}[data-orientation=vertical][data-select-on-move=false] &:after{content:"";inset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}._5dfc77e6edd345d4__tab-children{align-items:center;display:flex;flex-grow:1;[data-orientation=horizontal] &{justify-content:center}[data-orientation=vertical] &{justify-content:start}}._4a20e969d15e5ac1__tab-chevron{flex-shrink:0;margin-inline-end:calc(var(--wpds-dimension-gap-xs, 4px)*-1);opacity:0;[data-orientation=horizontal] &{display:none}[role=tab]:is([aria-selected=true],:focus-visible,:hover) &{opacity:1}@media not (prefers-reduced-motion){[data-select-on-move=true]\n				[role=tab]:is([aria-selected=true])\n				&{transition:opacity .15s linear .15s}}&:dir(rtl){rotate:180deg}}}}');
}
var style_default27 = { "tablist": "_7313adbc8a112e90__tablist", "is-overflowing-first": "_9f2ac729c68a735a__is-overflowing-first", "is-overflowing-last": "_81c799c1f3cdd261__is-overflowing-last", "is-minimal-variant": "_59228b5227f38a99__is-minimal-variant", "indicator": "_1c37dcfaa1ad8cda__indicator", "tab": "a5fd8814f195aa5e__tab", "tab-children": "_5dfc77e6edd345d4__tab-children", "tab-chevron": "_4a20e969d15e5ac1__tab-chevron" };
var Tab = (0, import_element67.forwardRef)(function Tab2({ className, children, ...otherProps }, forwardedRef) {
  useRegisterTab();
  return /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(
    index_parts_exports3.Tab,
    {
      ref: forwardedRef,
      className: clsx_default(style_default27.tab, className),
      ...otherProps,
      children: [
        /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("span", { className: style_default27["tab-children"], children }),
        /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(Icon, { icon: chevron_right_default, className: style_default27["tab-chevron"] })
      ]
    }
  );
});

// packages/admin-ui/build-module/breadcrumbs/index.mjs
var import_jsx_runtime96 = __toESM(require_jsx_runtime(), 1);
var STYLE_HASH_ATTRIBUTE35 = "data-wp-hash";
function getRuntime35() {
  const globalScope = globalThis;
  if (globalScope.__wpStyleRuntime) {
    return globalScope.__wpStyleRuntime;
  }
  globalScope.__wpStyleRuntime = {
    documents: /* @__PURE__ */ new Map(),
    styles: /* @__PURE__ */ new Map(),
    injectedStyles: /* @__PURE__ */ new WeakMap()
  };
  if (typeof document !== "undefined") {
    registerDocument35(document);
  }
  return globalScope.__wpStyleRuntime;
}
function documentContainsStyleHash35(targetDocument, hash) {
  if (!targetDocument.head) {
    return false;
  }
  for (const style of targetDocument.head.querySelectorAll(
    `style[${STYLE_HASH_ATTRIBUTE35}]`
  )) {
    if (style.getAttribute(STYLE_HASH_ATTRIBUTE35) === hash) {
      return true;
    }
  }
  return false;
}
function injectStyle35(targetDocument, hash, css) {
  if (!targetDocument.head) {
    return;
  }
  const runtime = getRuntime35();
  let injectedStyles = runtime.injectedStyles.get(targetDocument);
  if (!injectedStyles) {
    injectedStyles = /* @__PURE__ */ new Set();
    runtime.injectedStyles.set(targetDocument, injectedStyles);
  }
  if (injectedStyles.has(hash)) {
    return;
  }
  if (documentContainsStyleHash35(targetDocument, hash)) {
    injectedStyles.add(hash);
    return;
  }
  const style = targetDocument.createElement("style");
  style.setAttribute(STYLE_HASH_ATTRIBUTE35, hash);
  style.appendChild(targetDocument.createTextNode(css));
  targetDocument.head.appendChild(style);
  injectedStyles.add(hash);
}
function registerDocument35(targetDocument) {
  const runtime = getRuntime35();
  runtime.documents.set(
    targetDocument,
    (runtime.documents.get(targetDocument) ?? 0) + 1
  );
  for (const [hash, css] of runtime.styles) {
    injectStyle35(targetDocument, hash, css);
  }
  return () => {
    const count = runtime.documents.get(targetDocument);
    if (count === void 0) {
      return;
    }
    if (count <= 1) {
      runtime.documents.delete(targetDocument);
      return;
    }
    runtime.documents.set(targetDocument, count - 1);
  };
}
function registerStyle35(hash, css) {
  const runtime = getRuntime35();
  runtime.styles.set(hash, css);
  for (const targetDocument of runtime.documents.keys()) {
    injectStyle35(targetDocument, hash, css);
  }
}
if (typeof process === "undefined" || true) {
  registerStyle35("a90be4572a", "._5f4053eba32ce092__list{list-style:none;margin:0;padding:0}._5f4053eba32ce092__list>li{flex-shrink:0;margin:0}._5f4053eba32ce092__list>li:last-child{flex-shrink:1;min-width:0}.d1978551971a3360__current{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._6d9152063d443376__separator{color:var(--wpds-color-stroke-surface-neutral,#dbdbdb);margin:0 var(--wpds-dimension-gap-sm,8px);user-select:none}");
}
var style_default28 = { "list": "_5f4053eba32ce092__list", "current": "d1978551971a3360__current", "separator": "_6d9152063d443376__separator" };
var Breadcrumbs = ({ items }) => {
  if (!items.length) {
    return null;
  }
  const precedingItems = items.slice(0, -1);
  const lastItem = items[items.length - 1];
  if (true) {
    const invalidItem = precedingItems.find((item) => !item.to);
    if (invalidItem) {
      throw new Error(
        `Breadcrumbs: item "${invalidItem.label}" is missing a \`to\` prop. All items except the last one must have a \`to\` prop.`
      );
    }
  }
  return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("nav", { "aria-label": (0, import_i18n9._x)("Breadcrumbs", "area label"), children: /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(
    Stack,
    {
      render: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("ul", {}),
      direction: "row",
      align: "center",
      className: style_default28.list,
      children: [
        precedingItems.map((item, index3) => /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)("li", { children: [
          /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
            Text,
            {
              variant: "body-lg",
              render: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
                Link,
                {
                  tone: "neutral",
                  render: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(RouterLink, { to: item.to })
                }
              ),
              children: item.label
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
            Text,
            {
              variant: "body-lg",
              "aria-hidden": "true",
              className: style_default28.separator,
              children: "/"
            }
          )
        ] }, index3)),
        /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("li", { children: lastItem.to ? /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
          Text,
          {
            variant: "body-lg",
            render: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
              Link,
              {
                tone: "neutral",
                render: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(RouterLink, { to: lastItem.to })
              }
            ),
            children: lastItem.label
          }
        ) : /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
          Text,
          {
            variant: "heading-lg",
            render: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("h1", {}),
            className: style_default28.current,
            children: lastItem.label
          }
        ) })
      ]
    }
  ) });
};
var breadcrumbs_default = Breadcrumbs;

// packages/admin-ui/build-module/navigable-region/index.mjs
var import_element68 = __toESM(require_element(), 1);
var import_jsx_runtime97 = __toESM(require_jsx_runtime(), 1);
var NavigableRegion = (0, import_element68.forwardRef)(
  ({ children, className, ariaLabel, as: Tag = "div", ...props }, ref) => {
    return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
      Tag,
      {
        ref,
        className: clsx_default("admin-ui-navigable-region", className),
        "aria-label": ariaLabel,
        role: "region",
        tabIndex: "-1",
        ...props,
        children
      }
    );
  }
);
NavigableRegion.displayName = "NavigableRegion";
var navigable_region_default = NavigableRegion;

// packages/admin-ui/build-module/navigation/index.mjs
var import_i18n10 = __toESM(require_i18n(), 1);
var import_jsx_runtime98 = __toESM(require_jsx_runtime(), 1);
var STYLE_HASH_ATTRIBUTE36 = "data-wp-hash";
function getRuntime36() {
  const globalScope = globalThis;
  if (globalScope.__wpStyleRuntime) {
    return globalScope.__wpStyleRuntime;
  }
  globalScope.__wpStyleRuntime = {
    documents: /* @__PURE__ */ new Map(),
    styles: /* @__PURE__ */ new Map(),
    injectedStyles: /* @__PURE__ */ new WeakMap()
  };
  if (typeof document !== "undefined") {
    registerDocument36(document);
  }
  return globalScope.__wpStyleRuntime;
}
function documentContainsStyleHash36(targetDocument, hash) {
  if (!targetDocument.head) {
    return false;
  }
  for (const style of targetDocument.head.querySelectorAll(
    `style[${STYLE_HASH_ATTRIBUTE36}]`
  )) {
    if (style.getAttribute(STYLE_HASH_ATTRIBUTE36) === hash) {
      return true;
    }
  }
  return false;
}
function injectStyle36(targetDocument, hash, css) {
  if (!targetDocument.head) {
    return;
  }
  const runtime = getRuntime36();
  let injectedStyles = runtime.injectedStyles.get(targetDocument);
  if (!injectedStyles) {
    injectedStyles = /* @__PURE__ */ new Set();
    runtime.injectedStyles.set(targetDocument, injectedStyles);
  }
  if (injectedStyles.has(hash)) {
    return;
  }
  if (documentContainsStyleHash36(targetDocument, hash)) {
    injectedStyles.add(hash);
    return;
  }
  const style = targetDocument.createElement("style");
  style.setAttribute(STYLE_HASH_ATTRIBUTE36, hash);
  style.appendChild(targetDocument.createTextNode(css));
  targetDocument.head.appendChild(style);
  injectedStyles.add(hash);
}
function registerDocument36(targetDocument) {
  const runtime = getRuntime36();
  runtime.documents.set(
    targetDocument,
    (runtime.documents.get(targetDocument) ?? 0) + 1
  );
  for (const [hash, css] of runtime.styles) {
    injectStyle36(targetDocument, hash, css);
  }
  return () => {
    const count = runtime.documents.get(targetDocument);
    if (count === void 0) {
      return;
    }
    if (count <= 1) {
      runtime.documents.delete(targetDocument);
      return;
    }
    runtime.documents.set(targetDocument, count - 1);
  };
}
function registerStyle36(hash, css) {
  const runtime = getRuntime36();
  runtime.styles.set(hash, css);
  for (const targetDocument of runtime.documents.keys()) {
    injectStyle36(targetDocument, hash, css);
  }
}
if (typeof process === "undefined" || true) {
  registerStyle36("72ef022400", ".bfb5a2dd8cceebd3__list{--focus-ring-size:calc(var(--wpds-border-width-focus, var(--wp-admin-border-width-focus, 2px))*2);list-style:none;margin:calc(var(--focus-ring-size)*-1);overflow-x:auto;padding:var(--focus-ring-size);scroll-padding:var(--focus-ring-size)}.a4759b4cb2c8bd92__li{flex-shrink:0}._07da506d3f2d9afe__item{align-items:center;color:var(--wpds-color-foreground-interactive-neutral-weak,#707070);display:flex;font-weight:var(--wpds-typography-font-weight-default,400);min-block-size:44px;min-inline-size:44px;text-decoration:none}._07da506d3f2d9afe__item:hover,._07da506d3f2d9afe__item[aria-current=page]{color:var(--wpds-color-foreground-interactive-neutral-weak-active,#1e1e1e)}._07da506d3f2d9afe__item[aria-current=page]{font-weight:var(--wpds-typography-font-weight-emphasis,600)}");
}
var style_default29 = { "list": "bfb5a2dd8cceebd3__list", "li": "a4759b4cb2c8bd92__li", "item": "_07da506d3f2d9afe__item" };
var Navigation = ({
  items,
  currentHref,
  ariaLabel = (0, import_i18n10.__)("Sections"),
  linkComponent,
  className
}) => {
  if (!items.length) {
    return null;
  }
  const LinkComponent = linkComponent ?? "a";
  if (true) {
    const invalidItem = items.find(
      (item) => typeof item.href !== "string"
    );
    if (invalidItem) {
      throw new Error(
        `Navigation: item "${invalidItem.label}" is missing an \`href\` prop.`
      );
    }
    const duplicate = items.find(
      (item, index3) => items.findIndex((other) => other.href === item.href) !== index3
    );
    if (duplicate) {
      throw new Error(
        `Navigation: duplicate \`href\` "${duplicate.href}". Each item must have a unique \`href\` so a single item receives \`aria-current="page"\`.`
      );
    }
  }
  return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("nav", { "aria-label": ariaLabel, className, children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
    Stack,
    {
      render: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("ul", { role: "list" }),
      direction: "row",
      align: "center",
      gap: "md",
      className: style_default29.list,
      children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("li", { className: style_default29.li, children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
        Text,
        {
          variant: "body-md",
          className: style_default29.item,
          render: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
            Link,
            {
              variant: "unstyled",
              "aria-current": item.href === currentHref ? "page" : void 0,
              render: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(LinkComponent, { href: item.href })
            }
          ),
          children: item.label
        }
      ) }, item.href))
    }
  ) });
};
var navigation_default = Navigation;

// packages/admin-ui/build-module/page/sidebar-toggle-slot.mjs
var import_components2 = __toESM(require_components(), 1);
var { Fill: SidebarToggleFill, Slot: SidebarToggleSlot } = (0, import_components2.createSlotFill)("SidebarToggle");

// packages/admin-ui/build-module/page/header.mjs
var import_jsx_runtime99 = __toESM(require_jsx_runtime(), 1);
var STYLE_HASH_ATTRIBUTE37 = "data-wp-hash";
function getRuntime37() {
  const globalScope = globalThis;
  if (globalScope.__wpStyleRuntime) {
    return globalScope.__wpStyleRuntime;
  }
  globalScope.__wpStyleRuntime = {
    documents: /* @__PURE__ */ new Map(),
    styles: /* @__PURE__ */ new Map(),
    injectedStyles: /* @__PURE__ */ new WeakMap()
  };
  if (typeof document !== "undefined") {
    registerDocument37(document);
  }
  return globalScope.__wpStyleRuntime;
}
function documentContainsStyleHash37(targetDocument, hash) {
  if (!targetDocument.head) {
    return false;
  }
  for (const style of targetDocument.head.querySelectorAll(
    `style[${STYLE_HASH_ATTRIBUTE37}]`
  )) {
    if (style.getAttribute(STYLE_HASH_ATTRIBUTE37) === hash) {
      return true;
    }
  }
  return false;
}
function injectStyle37(targetDocument, hash, css) {
  if (!targetDocument.head) {
    return;
  }
  const runtime = getRuntime37();
  let injectedStyles = runtime.injectedStyles.get(targetDocument);
  if (!injectedStyles) {
    injectedStyles = /* @__PURE__ */ new Set();
    runtime.injectedStyles.set(targetDocument, injectedStyles);
  }
  if (injectedStyles.has(hash)) {
    return;
  }
  if (documentContainsStyleHash37(targetDocument, hash)) {
    injectedStyles.add(hash);
    return;
  }
  const style = targetDocument.createElement("style");
  style.setAttribute(STYLE_HASH_ATTRIBUTE37, hash);
  style.appendChild(targetDocument.createTextNode(css));
  targetDocument.head.appendChild(style);
  injectedStyles.add(hash);
}
function registerDocument37(targetDocument) {
  const runtime = getRuntime37();
  runtime.documents.set(
    targetDocument,
    (runtime.documents.get(targetDocument) ?? 0) + 1
  );
  for (const [hash, css] of runtime.styles) {
    injectStyle37(targetDocument, hash, css);
  }
  return () => {
    const count = runtime.documents.get(targetDocument);
    if (count === void 0) {
      return;
    }
    if (count <= 1) {
      runtime.documents.delete(targetDocument);
      return;
    }
    runtime.documents.set(targetDocument, count - 1);
  };
}
function registerStyle37(hash, css) {
  const runtime = getRuntime37();
  runtime.styles.set(hash, css);
  for (const targetDocument of runtime.documents.keys()) {
    injectStyle37(targetDocument, hash, css);
  }
}
if (typeof process === "undefined" || true) {
  registerStyle37("1f3750277d", "._956b6df0898efed0__page{text-wrap:pretty;background-color:var(--wpds-color-background-surface-neutral,#fcfcfc);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);display:flex;flex-flow:column;height:100%;position:relative;z-index:1}._0625b55e82a0d93d__header{background:var(--wpds-color-background-surface-neutral-strong,#fff);border-block-end:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);inset-block-start:0;padding:var(--wpds-dimension-padding-lg,16px) var(--wpds-dimension-padding-2xl,24px);position:sticky;z-index:1}.a43c44d5ae28b2e8__header-content{min-height:var(--wpds-dimension-size-md,32px)}.b7cb5b9daf3a3b25__header-actions{flex-shrink:0}._8bcd33103b451f30__header-lockup{min-width:0}._8113be94e7caf73c__header-title{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._9a776c7f70996f61__header-visual{display:grid;flex-shrink:0;grid-template-columns:1fr;grid-template-rows:1fr;height:var(--wpds-dimension-size-sm,24px);width:var(--wpds-dimension-size-sm,24px);>*{grid-column:1/-1;grid-row:1/-1;max-height:100%;max-width:100%}}.d5e0920cd15d35bc__sidebar-toggle-slot:empty{display:none}._60fea2f6bf5319cd__header-subtitle{color:var(--wpds-color-foreground-content-neutral-weak,#707070);padding-block-end:var(--wpds-dimension-padding-xs,4px)}._0625b55e82a0d93d__header._4b0f17e503d11619__has-navigation,._0625b55e82a0d93d__header._4b0f17e503d11619__has-navigation ._60fea2f6bf5319cd__header-subtitle{padding-block-end:0}._673c99dcbfb58211__header-navigation{margin-block-start:var(--wpds-dimension-gap-md,12px)}.be5e57d029ec4036__content{display:flex;flex-direction:column;flex-grow:1;overflow:auto;&._128806d0b26e3a50__has-padding{padding:var(--wpds-dimension-padding-lg,16px) var(--wpds-dimension-padding-2xl,24px)}}");
}
var style_default30 = { "page": "_956b6df0898efed0__page", "header": "_0625b55e82a0d93d__header", "header-content": "a43c44d5ae28b2e8__header-content", "header-actions": "b7cb5b9daf3a3b25__header-actions", "header-lockup": "_8bcd33103b451f30__header-lockup", "header-title": "_8113be94e7caf73c__header-title", "header-visual": "_9a776c7f70996f61__header-visual", "sidebar-toggle-slot": "d5e0920cd15d35bc__sidebar-toggle-slot", "header-subtitle": "_60fea2f6bf5319cd__header-subtitle", "has-navigation": "_4b0f17e503d11619__has-navigation", "header-navigation": "_673c99dcbfb58211__header-navigation", "content": "be5e57d029ec4036__content", "has-padding": "_128806d0b26e3a50__has-padding" };
function Header3({
  headingLevel = 1,
  breadcrumbs,
  badges,
  visual,
  title,
  subTitle,
  actions,
  navigation,
  components,
  showSidebarToggle = true
}) {
  const HeadingTag = `h${headingLevel}`;
  const hasNavigation = !!navigation?.items?.length;
  return /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(
    Stack,
    {
      direction: "column",
      className: clsx_default(
        style_default30.header,
        hasNavigation && style_default30["has-navigation"]
      ),
      children: [
        /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(
          Stack,
          {
            className: style_default30["header-content"],
            direction: "row",
            gap: "sm",
            justify: "space-between",
            children: [
              /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(
                Stack,
                {
                  direction: "row",
                  gap: "sm",
                  align: "center",
                  justify: "start",
                  className: style_default30["header-lockup"],
                  children: [
                    showSidebarToggle && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
                      SidebarToggleSlot,
                      {
                        bubblesVirtually: true,
                        className: style_default30["sidebar-toggle-slot"]
                      }
                    ),
                    visual && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
                      "div",
                      {
                        className: style_default30["header-visual"],
                        "aria-hidden": "true",
                        children: visual
                      }
                    ),
                    title && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
                      Text,
                      {
                        className: style_default30["header-title"],
                        render: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(HeadingTag, {}),
                        variant: "heading-lg",
                        children: title
                      }
                    ),
                    breadcrumbs,
                    badges
                  ]
                }
              ),
              actions && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
                Stack,
                {
                  align: "center",
                  className: style_default30["header-actions"],
                  direction: "row",
                  gap: "sm",
                  children: actions
                }
              )
            ]
          }
        ),
        subTitle && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
          Text,
          {
            render: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("p", {}),
            variant: "body-md",
            className: style_default30["header-subtitle"],
            children: subTitle
          }
        ),
        hasNavigation && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
          navigation_default,
          {
            ...navigation,
            linkComponent: components?.link,
            className: style_default30["header-navigation"]
          }
        )
      ]
    }
  );
}

// packages/admin-ui/build-module/page/index.mjs
var import_jsx_runtime100 = __toESM(require_jsx_runtime(), 1);
var STYLE_HASH_ATTRIBUTE38 = "data-wp-hash";
function getRuntime38() {
  const globalScope = globalThis;
  if (globalScope.__wpStyleRuntime) {
    return globalScope.__wpStyleRuntime;
  }
  globalScope.__wpStyleRuntime = {
    documents: /* @__PURE__ */ new Map(),
    styles: /* @__PURE__ */ new Map(),
    injectedStyles: /* @__PURE__ */ new WeakMap()
  };
  if (typeof document !== "undefined") {
    registerDocument38(document);
  }
  return globalScope.__wpStyleRuntime;
}
function documentContainsStyleHash38(targetDocument, hash) {
  if (!targetDocument.head) {
    return false;
  }
  for (const style of targetDocument.head.querySelectorAll(
    `style[${STYLE_HASH_ATTRIBUTE38}]`
  )) {
    if (style.getAttribute(STYLE_HASH_ATTRIBUTE38) === hash) {
      return true;
    }
  }
  return false;
}
function injectStyle38(targetDocument, hash, css) {
  if (!targetDocument.head) {
    return;
  }
  const runtime = getRuntime38();
  let injectedStyles = runtime.injectedStyles.get(targetDocument);
  if (!injectedStyles) {
    injectedStyles = /* @__PURE__ */ new Set();
    runtime.injectedStyles.set(targetDocument, injectedStyles);
  }
  if (injectedStyles.has(hash)) {
    return;
  }
  if (documentContainsStyleHash38(targetDocument, hash)) {
    injectedStyles.add(hash);
    return;
  }
  const style = targetDocument.createElement("style");
  style.setAttribute(STYLE_HASH_ATTRIBUTE38, hash);
  style.appendChild(targetDocument.createTextNode(css));
  targetDocument.head.appendChild(style);
  injectedStyles.add(hash);
}
function registerDocument38(targetDocument) {
  const runtime = getRuntime38();
  runtime.documents.set(
    targetDocument,
    (runtime.documents.get(targetDocument) ?? 0) + 1
  );
  for (const [hash, css] of runtime.styles) {
    injectStyle38(targetDocument, hash, css);
  }
  return () => {
    const count = runtime.documents.get(targetDocument);
    if (count === void 0) {
      return;
    }
    if (count <= 1) {
      runtime.documents.delete(targetDocument);
      return;
    }
    runtime.documents.set(targetDocument, count - 1);
  };
}
function registerStyle38(hash, css) {
  const runtime = getRuntime38();
  runtime.styles.set(hash, css);
  for (const targetDocument of runtime.documents.keys()) {
    injectStyle38(targetDocument, hash, css);
  }
}
if (typeof process === "undefined" || true) {
  registerStyle38("1f3750277d", "._956b6df0898efed0__page{text-wrap:pretty;background-color:var(--wpds-color-background-surface-neutral,#fcfcfc);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);display:flex;flex-flow:column;height:100%;position:relative;z-index:1}._0625b55e82a0d93d__header{background:var(--wpds-color-background-surface-neutral-strong,#fff);border-block-end:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);inset-block-start:0;padding:var(--wpds-dimension-padding-lg,16px) var(--wpds-dimension-padding-2xl,24px);position:sticky;z-index:1}.a43c44d5ae28b2e8__header-content{min-height:var(--wpds-dimension-size-md,32px)}.b7cb5b9daf3a3b25__header-actions{flex-shrink:0}._8bcd33103b451f30__header-lockup{min-width:0}._8113be94e7caf73c__header-title{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._9a776c7f70996f61__header-visual{display:grid;flex-shrink:0;grid-template-columns:1fr;grid-template-rows:1fr;height:var(--wpds-dimension-size-sm,24px);width:var(--wpds-dimension-size-sm,24px);>*{grid-column:1/-1;grid-row:1/-1;max-height:100%;max-width:100%}}.d5e0920cd15d35bc__sidebar-toggle-slot:empty{display:none}._60fea2f6bf5319cd__header-subtitle{color:var(--wpds-color-foreground-content-neutral-weak,#707070);padding-block-end:var(--wpds-dimension-padding-xs,4px)}._0625b55e82a0d93d__header._4b0f17e503d11619__has-navigation,._0625b55e82a0d93d__header._4b0f17e503d11619__has-navigation ._60fea2f6bf5319cd__header-subtitle{padding-block-end:0}._673c99dcbfb58211__header-navigation{margin-block-start:var(--wpds-dimension-gap-md,12px)}.be5e57d029ec4036__content{display:flex;flex-direction:column;flex-grow:1;overflow:auto;&._128806d0b26e3a50__has-padding{padding:var(--wpds-dimension-padding-lg,16px) var(--wpds-dimension-padding-2xl,24px)}}");
}
var style_default31 = { "page": "_956b6df0898efed0__page", "header": "_0625b55e82a0d93d__header", "header-content": "a43c44d5ae28b2e8__header-content", "header-actions": "b7cb5b9daf3a3b25__header-actions", "header-lockup": "_8bcd33103b451f30__header-lockup", "header-title": "_8113be94e7caf73c__header-title", "header-visual": "_9a776c7f70996f61__header-visual", "sidebar-toggle-slot": "d5e0920cd15d35bc__sidebar-toggle-slot", "header-subtitle": "_60fea2f6bf5319cd__header-subtitle", "has-navigation": "_4b0f17e503d11619__has-navigation", "header-navigation": "_673c99dcbfb58211__header-navigation", "content": "be5e57d029ec4036__content", "has-padding": "_128806d0b26e3a50__has-padding" };
function Page({
  headingLevel,
  breadcrumbs,
  badges,
  visual,
  title,
  subTitle,
  children,
  className,
  actions,
  navigation,
  components,
  ariaLabel,
  hasPadding = false,
  showSidebarToggle = true
}) {
  const classes = clsx_default(style_default31.page, className);
  const effectiveAriaLabel = ariaLabel ?? (typeof title === "string" ? title : "");
  return /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(navigable_region_default, { className: classes, ariaLabel: effectiveAriaLabel, children: [
    (title || breadcrumbs || badges || actions || visual || !!navigation?.items?.length) && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
      Header3,
      {
        headingLevel,
        breadcrumbs,
        badges,
        visual,
        title,
        subTitle,
        actions,
        navigation,
        components,
        showSidebarToggle
      }
    ),
    hasPadding ? /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
      "div",
      {
        className: clsx_default(
          style_default31.content,
          style_default31["has-padding"]
        ),
        children
      }
    ) : children
  ] });
}
Page.SidebarToggleFill = SidebarToggleFill;
var page_default = Page;

// routes/media-editor/stage.tsx
var import_core_data3 = __toESM(require_core_data());
var import_data5 = __toESM(require_data());
var import_editor = __toESM(require_editor());
var import_html_entities = __toESM(require_html_entities());
var import_i18n47 = __toESM(require_i18n());

// packages/media-editor/build-module/components/media-editor-provider/index.mjs
var import_element69 = __toESM(require_element(), 1);
var import_jsx_runtime101 = __toESM(require_jsx_runtime(), 1);
var MediaEditorContext = (0, import_element69.createContext)(
  void 0
);
function MediaEditorProvider({
  value,
  onChange,
  settings = {},
  children
}) {
  const contextValue = {
    media: value,
    onChange,
    fields: settings.fields || []
  };
  return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(MediaEditorContext.Provider, { value: contextValue, children });
}
function useMediaEditorContext() {
  const context = (0, import_element69.useContext)(MediaEditorContext);
  if (!context) {
    throw new Error(
      "useMediaEditorContext must be used within MediaEditorProvider"
    );
  }
  return context;
}

// packages/media-editor/build-module/components/media-preview/index.mjs
var import_components3 = __toESM(require_components(), 1);
var import_element70 = __toESM(require_element(), 1);
var import_i18n11 = __toESM(require_i18n(), 1);

// packages/media-editor/build-module/utils/get-media-type.mjs
function getMediaTypeFromMimeType(mimeType) {
  if (!mimeType) {
    return { type: "application" };
  }
  if (mimeType.startsWith("image/")) {
    return { type: "image" };
  }
  if (mimeType.startsWith("video/")) {
    return { type: "video" };
  }
  if (mimeType.startsWith("audio/")) {
    return { type: "audio" };
  }
  return { type: "application" };
}

// packages/media-editor/build-module/components/media-preview/index.mjs
var import_jsx_runtime102 = __toESM(require_jsx_runtime(), 1);
function MediaPreviewContent({
  mediaType,
  mediaUrl,
  altText,
  displayTitle,
  mimeType,
  onLoad,
  onError,
  loadingState
}) {
  switch (mediaType.type) {
    case "image":
      return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
        "img",
        {
          className: loadingState === "loaded" ? "loaded" : "",
          src: mediaUrl,
          alt: altText || "",
          onLoad,
          onError
        }
      );
    case "video":
      return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("video", { src: mediaUrl, controls: true, onError, children: displayTitle });
    case "audio":
      return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("audio", { src: mediaUrl, controls: true, onError, children: displayTitle });
    default:
      return /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: "media-editor-preview__file-info", children: [
        /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("p", { className: "media-editor-preview__file-name", children: displayTitle }),
        /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("p", { className: "media-editor-preview__mime-type", children: mimeType }),
        /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
          "a",
          {
            href: mediaUrl,
            target: "_blank",
            rel: "noopener",
            className: "media-editor-preview__download-link",
            children: (0, import_i18n11.__)("View file")
          }
        )
      ] });
  }
}
function MediaPreview(props) {
  const [loadingState, setLoadingState] = (0, import_element70.useState)("loading");
  const { media } = useMediaEditorContext();
  const {
    source_url: mediaUrl,
    mime_type: mimeType,
    alt_text: altText,
    title
  } = media || {};
  const mediaType = getMediaTypeFromMimeType(mimeType);
  if (!mediaUrl) {
    return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { className: "media-editor-preview media-editor-preview--empty", children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("p", { children: (0, import_i18n11.__)("No media file available.") }) });
  }
  if (loadingState === "error") {
    return /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: "media-editor-preview media-editor-preview--error", children: [
      /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("p", { children: (0, import_i18n11.__)("Failed to load media file.") }),
      /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("p", { className: "media-editor-preview__url", children: mediaUrl })
    ] });
  }
  const displayTitle = typeof title === "string" ? title : title?.rendered || title?.raw;
  return /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)(
    "div",
    {
      ...props,
      className: `media-editor-preview media-editor-preview--${mediaType.type}`,
      children: [
        mediaType.type === "image" && loadingState === "loading" && /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { className: "media-editor-preview__spinner", children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_components3.Spinner, {}) }),
        /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
          MediaPreviewContent,
          {
            mediaType,
            mediaUrl,
            altText,
            displayTitle,
            mimeType,
            onLoad: () => setLoadingState("loaded"),
            onError: () => setLoadingState("error"),
            loadingState
          }
        )
      ]
    }
  );
}

// packages/dataviews/build-module/constants.mjs
var import_i18n12 = __toESM(require_i18n(), 1);
var OPERATOR_IS_ANY = "isAny";
var OPERATOR_IS_NONE = "isNone";
var OPERATOR_IS_ALL = "isAll";
var OPERATOR_IS_NOT_ALL = "isNotAll";
var OPERATOR_BETWEEN = "between";
var OPERATOR_IN_THE_PAST = "inThePast";
var OPERATOR_OVER = "over";
var OPERATOR_IS = "is";
var OPERATOR_IS_NOT = "isNot";
var OPERATOR_LESS_THAN = "lessThan";
var OPERATOR_GREATER_THAN = "greaterThan";
var OPERATOR_LESS_THAN_OR_EQUAL = "lessThanOrEqual";
var OPERATOR_GREATER_THAN_OR_EQUAL = "greaterThanOrEqual";
var OPERATOR_BEFORE = "before";
var OPERATOR_AFTER = "after";
var OPERATOR_BEFORE_INC = "beforeInc";
var OPERATOR_AFTER_INC = "afterInc";
var OPERATOR_CONTAINS = "contains";
var OPERATOR_NOT_CONTAINS = "notContains";
var OPERATOR_STARTS_WITH = "startsWith";
var OPERATOR_ON = "on";
var OPERATOR_NOT_ON = "notOn";
var sortLabels = {
  asc: (0, import_i18n12.__)("Sort ascending"),
  desc: (0, import_i18n12.__)("Sort descending")
};

// packages/dataviews/build-module/hooks/use-elements.mjs
var import_element71 = __toESM(require_element(), 1);
var EMPTY_ARRAY2 = [];
function useElements({
  elements,
  getElements
}) {
  const staticElements = Array.isArray(elements) && elements.length > 0 ? elements : EMPTY_ARRAY2;
  const [records, setRecords] = (0, import_element71.useState)(staticElements);
  const [isLoading, setIsLoading] = (0, import_element71.useState)(false);
  (0, import_element71.useEffect)(() => {
    if (!getElements) {
      setRecords(staticElements);
      return;
    }
    let cancelled = false;
    setIsLoading(true);
    getElements().then((fetchedElements) => {
      if (!cancelled) {
        const dynamicElements = Array.isArray(fetchedElements) && fetchedElements.length > 0 ? fetchedElements : staticElements;
        setRecords(dynamicElements);
      }
    }).catch(() => {
      if (!cancelled) {
        setRecords(staticElements);
      }
    }).finally(() => {
      if (!cancelled) {
        setIsLoading(false);
      }
    });
    return () => {
      cancelled = true;
    };
  }, [getElements, staticElements]);
  return {
    elements: records,
    isLoading
  };
}

// packages/dataviews/build-module/utils/operators.mjs
var import_i18n13 = __toESM(require_i18n(), 1);
var import_element72 = __toESM(require_element(), 1);
var import_date2 = __toESM(require_date(), 1);

// packages/dataviews/build-module/field-types/utils/parse-time.mjs
var ZONE_DESIGNATOR = /(?:[Zz]|[+-](?:[01]\d|2[0-3]):?[0-5]\d)$/;
var TIME_FORMATS = ["HH:mm", "HH:mm:ss"];
var REFERENCE_DATE = new Date(2e3, 0, 1);
function parseTime2(value) {
  if (typeof value !== "string") {
    return null;
  }
  const time = value.trim().replace(ZONE_DESIGNATOR, "");
  for (const timeFormat of TIME_FORMATS) {
    const parsed = parse(time, timeFormat, REFERENCE_DATE);
    if (isValid(parsed)) {
      return parsed.getHours() * 3600 + parsed.getMinutes() * 60 + parsed.getSeconds();
    }
  }
  return null;
}

// packages/dataviews/build-module/utils/operators.mjs
var import_jsx_runtime103 = __toESM(require_jsx_runtime(), 1);
var filterTextWrappers = {
  Name: /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("span", { className: "dataviews-filters__summary-filter-text-name" }),
  Value: /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("span", { className: "dataviews-filters__summary-filter-text-value" })
};
function toComparableTemporals(fieldValue, filterValue) {
  const filterTime = parseTime2(filterValue);
  if (filterTime !== null) {
    return [parseTime2(fieldValue) ?? NaN, filterTime];
  }
  return [
    (0, import_date2.getDate)(fieldValue).getTime(),
    (0, import_date2.getDate)(filterValue).getTime()
  ];
}
function getRelativeDate(value, unit) {
  switch (unit) {
    case "days":
      return subDays(/* @__PURE__ */ new Date(), value);
    case "weeks":
      return subWeeks(/* @__PURE__ */ new Date(), value);
    case "months":
      return subMonths(/* @__PURE__ */ new Date(), value);
    case "years":
      return subYears(/* @__PURE__ */ new Date(), value);
    default:
      return /* @__PURE__ */ new Date();
  }
}
var isNoneOperatorDefinition = {
  /* translators: DataViews operator name */
  label: (0, import_i18n13.__)("Is none of"),
  filterText: (filter, activeElements) => (0, import_element72.createInterpolateElement)(
    (0, import_i18n13.sprintf)(
      /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is none of: Admin, Editor". */
      (0, import_i18n13.__)("<Name>%1$s is none of: </Name><Value>%2$s</Value>"),
      filter.name,
      activeElements.map((element) => element.label).join(", ")
    ),
    filterTextWrappers
  ),
  filter: ((item, field, filterValue) => {
    if (!filterValue?.length) {
      return true;
    }
    const fieldValue = field.getValue({ item });
    if (Array.isArray(fieldValue)) {
      return !filterValue.some(
        (fv) => fieldValue.includes(fv)
      );
    } else if (typeof fieldValue === "string" || typeof fieldValue === "number") {
      return !filterValue.includes(fieldValue);
    }
    return false;
  }),
  selection: "multi"
};
var OPERATORS = [
  {
    name: OPERATOR_IS_ANY,
    /* translators: DataViews operator name */
    label: (0, import_i18n13.__)("Includes"),
    filterText: (filter, activeElements) => (0, import_element72.createInterpolateElement)(
      (0, import_i18n13.sprintf)(
        /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is any: Admin, Editor". */
        (0, import_i18n13.__)("<Name>%1$s includes: </Name><Value>%2$s</Value>"),
        filter.name,
        activeElements.map((element) => element.label).join(", ")
      ),
      filterTextWrappers
    ),
    filter(item, field, filterValue) {
      if (!filterValue?.length) {
        return true;
      }
      const fieldValue = field.getValue({ item });
      if (Array.isArray(fieldValue)) {
        return filterValue.some(
          (fv) => fieldValue.includes(fv)
        );
      } else if (typeof fieldValue === "string" || typeof fieldValue === "number") {
        return filterValue.includes(fieldValue);
      }
      return false;
    },
    selection: "multi"
  },
  {
    name: OPERATOR_IS_NONE,
    ...isNoneOperatorDefinition
  },
  {
    name: OPERATOR_IS_ALL,
    /* translators: DataViews operator name */
    label: (0, import_i18n13.__)("Includes all"),
    filterText: (filter, activeElements) => (0, import_element72.createInterpolateElement)(
      (0, import_i18n13.sprintf)(
        /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author includes all: Admin, Editor". */
        (0, import_i18n13.__)("<Name>%1$s includes all: </Name><Value>%2$s</Value>"),
        filter.name,
        activeElements.map((element) => element.label).join(", ")
      ),
      filterTextWrappers
    ),
    filter(item, field, filterValue) {
      if (!filterValue?.length) {
        return true;
      }
      const fieldValue = field.getValue({ item });
      if (!Array.isArray(fieldValue)) {
        return false;
      }
      return filterValue.every(
        (value) => fieldValue.includes(value)
      );
    },
    selection: "multi"
  },
  {
    name: OPERATOR_IS_NOT_ALL,
    ...isNoneOperatorDefinition
  },
  {
    name: OPERATOR_BETWEEN,
    /* translators: DataViews operator name */
    label: (0, import_i18n13.__)("Between (inc)"),
    filterText: (filter, activeElements) => (0, import_element72.createInterpolateElement)(
      (0, import_i18n13.sprintf)(
        /* translators: 1: Filter name (e.g. "Item count"). 2: Filter value min. 3: Filter value max. e.g.: "Item count between (inc): 10 and 180". */
        (0, import_i18n13.__)(
          "<Name>%1$s between (inc): </Name><Value>%2$s and %3$s</Value>"
        ),
        filter.name,
        activeElements[0].label[0],
        activeElements[0].label[1]
      ),
      filterTextWrappers
    ),
    filter(item, field, filterValue) {
      if (!Array.isArray(filterValue) || filterValue.length !== 2 || // An unfilled bound is `undefined` from the controls, `''`
      // when it arrives from a persisted view, or `null` once
      // `undefined` round-trips through JSON persistence.
      filterValue.includes(void 0) || filterValue.includes("") || filterValue.includes(null)) {
        return true;
      }
      const fieldValue = field.getValue({ item });
      const [min4, max4] = filterValue.map(parseTime2);
      if (min4 !== null && max4 !== null) {
        const value = parseTime2(fieldValue);
        return value !== null && value >= min4 && value <= max4;
      }
      if (typeof fieldValue === "number" || fieldValue instanceof Date || typeof fieldValue === "string") {
        return fieldValue >= filterValue[0] && fieldValue <= filterValue[1];
      }
      return false;
    },
    selection: "custom"
  },
  {
    name: OPERATOR_IN_THE_PAST,
    /* translators: DataViews operator name */
    label: (0, import_i18n13.__)("In the past"),
    filterText: (filter, activeElements) => (0, import_element72.createInterpolateElement)(
      (0, import_i18n13.sprintf)(
        /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "7 days"): "Date is in the past: 7 days". */
        (0, import_i18n13.__)(
          "<Name>%1$s is in the past: </Name><Value>%2$s</Value>"
        ),
        filter.name,
        `${activeElements[0].value.value} ${activeElements[0].value.unit}`
      ),
      filterTextWrappers
    ),
    filter(item, field, filterValue) {
      if (filterValue?.value === void 0 || filterValue?.unit === void 0) {
        return true;
      }
      const targetDate = getRelativeDate(
        filterValue.value,
        filterValue.unit
      );
      const fieldValue = (0, import_date2.getDate)(field.getValue({ item }));
      return fieldValue >= targetDate && fieldValue <= /* @__PURE__ */ new Date();
    },
    selection: "custom"
  },
  {
    name: OPERATOR_OVER,
    /* translators: DataViews operator name */
    label: (0, import_i18n13.__)("Over"),
    filterText: (filter, activeElements) => (0, import_element72.createInterpolateElement)(
      (0, import_i18n13.sprintf)(
        /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "7 days"): "Date is over: 7 days". */
        (0, import_i18n13.__)("<Name>%1$s is over: </Name><Value>%2$s</Value>"),
        filter.name,
        `${activeElements[0].value.value} ${activeElements[0].value.unit}`
      ),
      filterTextWrappers
    ),
    filter(item, field, filterValue) {
      if (filterValue?.value === void 0 || filterValue?.unit === void 0) {
        return true;
      }
      const targetDate = getRelativeDate(
        filterValue.value,
        filterValue.unit
      );
      const fieldValue = (0, import_date2.getDate)(field.getValue({ item }));
      return fieldValue < targetDate;
    },
    selection: "custom"
  },
  {
    name: OPERATOR_IS,
    /* translators: DataViews operator name */
    label: (0, import_i18n13.__)("Is"),
    filterText: (filter, activeElements) => (0, import_element72.createInterpolateElement)(
      (0, import_i18n13.sprintf)(
        /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is: Admin". */
        (0, import_i18n13.__)("<Name>%1$s is: </Name><Value>%2$s</Value>"),
        filter.name,
        activeElements[0].label
      ),
      filterTextWrappers
    ),
    filter(item, field, filterValue) {
      return filterValue === field.getValue({ item }) || filterValue === void 0;
    },
    selection: "single"
  },
  {
    name: OPERATOR_IS_NOT,
    /* translators: DataViews operator name */
    label: (0, import_i18n13.__)("Is not"),
    filterText: (filter, activeElements) => (0, import_element72.createInterpolateElement)(
      (0, import_i18n13.sprintf)(
        /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is not: Admin". */
        (0, import_i18n13.__)("<Name>%1$s is not: </Name><Value>%2$s</Value>"),
        filter.name,
        activeElements[0].label
      ),
      filterTextWrappers
    ),
    filter(item, field, filterValue) {
      return filterValue !== field.getValue({ item });
    },
    selection: "single"
  },
  {
    name: OPERATOR_LESS_THAN,
    /* translators: DataViews operator name */
    label: (0, import_i18n13.__)("Less than"),
    filterText: (filter, activeElements) => (0, import_element72.createInterpolateElement)(
      (0, import_i18n13.sprintf)(
        /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is less than: 10". */
        (0, import_i18n13.__)("<Name>%1$s is less than: </Name><Value>%2$s</Value>"),
        filter.name,
        activeElements[0].label
      ),
      filterTextWrappers
    ),
    filter(item, field, filterValue) {
      if (filterValue === void 0) {
        return true;
      }
      const fieldValue = field.getValue({ item });
      return fieldValue < filterValue;
    },
    selection: "single"
  },
  {
    name: OPERATOR_GREATER_THAN,
    /* translators: DataViews operator name */
    label: (0, import_i18n13.__)("Greater than"),
    filterText: (filter, activeElements) => (0, import_element72.createInterpolateElement)(
      (0, import_i18n13.sprintf)(
        /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is greater than: 10". */
        (0, import_i18n13.__)(
          "<Name>%1$s is greater than: </Name><Value>%2$s</Value>"
        ),
        filter.name,
        activeElements[0].label
      ),
      filterTextWrappers
    ),
    filter(item, field, filterValue) {
      if (filterValue === void 0) {
        return true;
      }
      const fieldValue = field.getValue({ item });
      return fieldValue > filterValue;
    },
    selection: "single"
  },
  {
    name: OPERATOR_LESS_THAN_OR_EQUAL,
    /* translators: DataViews operator name */
    label: (0, import_i18n13.__)("Less than or equal"),
    filterText: (filter, activeElements) => (0, import_element72.createInterpolateElement)(
      (0, import_i18n13.sprintf)(
        /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is less than or equal to: 10". */
        (0, import_i18n13.__)(
          "<Name>%1$s is less than or equal to: </Name><Value>%2$s</Value>"
        ),
        filter.name,
        activeElements[0].label
      ),
      filterTextWrappers
    ),
    filter(item, field, filterValue) {
      if (filterValue === void 0) {
        return true;
      }
      const fieldValue = field.getValue({ item });
      return fieldValue <= filterValue;
    },
    selection: "single"
  },
  {
    name: OPERATOR_GREATER_THAN_OR_EQUAL,
    /* translators: DataViews operator name */
    label: (0, import_i18n13.__)("Greater than or equal"),
    filterText: (filter, activeElements) => (0, import_element72.createInterpolateElement)(
      (0, import_i18n13.sprintf)(
        /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is greater than or equal to: 10". */
        (0, import_i18n13.__)(
          "<Name>%1$s is greater than or equal to: </Name><Value>%2$s</Value>"
        ),
        filter.name,
        activeElements[0].label
      ),
      filterTextWrappers
    ),
    filter(item, field, filterValue) {
      if (filterValue === void 0) {
        return true;
      }
      const fieldValue = field.getValue({ item });
      return fieldValue >= filterValue;
    },
    selection: "single"
  },
  {
    name: OPERATOR_BEFORE,
    /* translators: DataViews operator name */
    label: (0, import_i18n13.__)("Before"),
    filterText: (filter, activeElements) => (0, import_element72.createInterpolateElement)(
      (0, import_i18n13.sprintf)(
        /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is before: 2024-01-01". */
        (0, import_i18n13.__)("<Name>%1$s is before: </Name><Value>%2$s</Value>"),
        filter.name,
        activeElements[0].label
      ),
      filterTextWrappers
    ),
    filter(item, field, filterValue) {
      if (filterValue === void 0) {
        return true;
      }
      const [fieldTemporal, filterTemporal] = toComparableTemporals(
        field.getValue({ item }),
        filterValue
      );
      return fieldTemporal < filterTemporal;
    },
    selection: "single"
  },
  {
    name: OPERATOR_AFTER,
    /* translators: DataViews operator name */
    label: (0, import_i18n13.__)("After"),
    filterText: (filter, activeElements) => (0, import_element72.createInterpolateElement)(
      (0, import_i18n13.sprintf)(
        /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is after: 2024-01-01". */
        (0, import_i18n13.__)("<Name>%1$s is after: </Name><Value>%2$s</Value>"),
        filter.name,
        activeElements[0].label
      ),
      filterTextWrappers
    ),
    filter(item, field, filterValue) {
      if (filterValue === void 0) {
        return true;
      }
      const [fieldTemporal, filterTemporal] = toComparableTemporals(
        field.getValue({ item }),
        filterValue
      );
      return fieldTemporal > filterTemporal;
    },
    selection: "single"
  },
  {
    name: OPERATOR_BEFORE_INC,
    /* translators: DataViews operator name */
    label: (0, import_i18n13.__)("Before (inc)"),
    filterText: (filter, activeElements) => (0, import_element72.createInterpolateElement)(
      (0, import_i18n13.sprintf)(
        /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is on or before: 2024-01-01". */
        (0, import_i18n13.__)(
          "<Name>%1$s is on or before: </Name><Value>%2$s</Value>"
        ),
        filter.name,
        activeElements[0].label
      ),
      filterTextWrappers
    ),
    filter(item, field, filterValue) {
      if (filterValue === void 0) {
        return true;
      }
      const [fieldTemporal, filterTemporal] = toComparableTemporals(
        field.getValue({ item }),
        filterValue
      );
      return fieldTemporal <= filterTemporal;
    },
    selection: "single"
  },
  {
    name: OPERATOR_AFTER_INC,
    /* translators: DataViews operator name */
    label: (0, import_i18n13.__)("After (inc)"),
    filterText: (filter, activeElements) => (0, import_element72.createInterpolateElement)(
      (0, import_i18n13.sprintf)(
        /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is on or after: 2024-01-01". */
        (0, import_i18n13.__)(
          "<Name>%1$s is on or after: </Name><Value>%2$s</Value>"
        ),
        filter.name,
        activeElements[0].label
      ),
      filterTextWrappers
    ),
    filter(item, field, filterValue) {
      if (filterValue === void 0) {
        return true;
      }
      const [fieldTemporal, filterTemporal] = toComparableTemporals(
        field.getValue({ item }),
        filterValue
      );
      return fieldTemporal >= filterTemporal;
    },
    selection: "single"
  },
  {
    name: OPERATOR_CONTAINS,
    /* translators: DataViews operator name */
    label: (0, import_i18n13.__)("Contains"),
    filterText: (filter, activeElements) => (0, import_element72.createInterpolateElement)(
      (0, import_i18n13.sprintf)(
        /* translators: 1: Filter name (e.g. "Title"). 2: Filter value (e.g. "Hello"): "Title contains: Hello". */
        (0, import_i18n13.__)("<Name>%1$s contains: </Name><Value>%2$s</Value>"),
        filter.name,
        activeElements[0].label
      ),
      filterTextWrappers
    ),
    filter(item, field, filterValue) {
      if (filterValue === void 0) {
        return true;
      }
      const fieldValue = field.getValue({ item });
      return typeof fieldValue === "string" && filterValue && fieldValue.toLowerCase().includes(String(filterValue).toLowerCase());
    },
    selection: "single"
  },
  {
    name: OPERATOR_NOT_CONTAINS,
    /* translators: DataViews operator name */
    label: (0, import_i18n13.__)("Doesn't contain"),
    filterText: (filter, activeElements) => (0, import_element72.createInterpolateElement)(
      (0, import_i18n13.sprintf)(
        /* translators: 1: Filter name (e.g. "Title"). 2: Filter value (e.g. "Hello"): "Title doesn't contain: Hello". */
        (0, import_i18n13.__)(
          "<Name>%1$s doesn't contain: </Name><Value>%2$s</Value>"
        ),
        filter.name,
        activeElements[0].label
      ),
      filterTextWrappers
    ),
    filter(item, field, filterValue) {
      if (filterValue === void 0) {
        return true;
      }
      const fieldValue = field.getValue({ item });
      return typeof fieldValue === "string" && filterValue && !fieldValue.toLowerCase().includes(String(filterValue).toLowerCase());
    },
    selection: "single"
  },
  {
    name: OPERATOR_STARTS_WITH,
    /* translators: DataViews operator name */
    label: (0, import_i18n13.__)("Starts with"),
    filterText: (filter, activeElements) => (0, import_element72.createInterpolateElement)(
      (0, import_i18n13.sprintf)(
        /* translators: 1: Filter name (e.g. "Title"). 2: Filter value (e.g. "Hello"): "Title starts with: Hello". */
        (0, import_i18n13.__)("<Name>%1$s starts with: </Name><Value>%2$s</Value>"),
        filter.name,
        activeElements[0].label
      ),
      filterTextWrappers
    ),
    filter(item, field, filterValue) {
      if (filterValue === void 0) {
        return true;
      }
      const fieldValue = field.getValue({ item });
      return typeof fieldValue === "string" && filterValue && fieldValue.toLowerCase().startsWith(String(filterValue).toLowerCase());
    },
    selection: "single"
  },
  {
    name: OPERATOR_ON,
    /* translators: DataViews operator name */
    label: (0, import_i18n13.__)("On"),
    filterText: (filter, activeElements) => (0, import_element72.createInterpolateElement)(
      (0, import_i18n13.sprintf)(
        /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is: 2024-01-01". */
        (0, import_i18n13.__)("<Name>%1$s is: </Name><Value>%2$s</Value>"),
        filter.name,
        activeElements[0].label
      ),
      filterTextWrappers
    ),
    filter(item, field, filterValue) {
      if (filterValue === void 0) {
        return true;
      }
      const [fieldTemporal, filterTemporal] = toComparableTemporals(
        field.getValue({ item }),
        filterValue
      );
      return fieldTemporal === filterTemporal;
    },
    selection: "single"
  },
  {
    name: OPERATOR_NOT_ON,
    /* translators: DataViews operator name */
    label: (0, import_i18n13.__)("Not on"),
    filterText: (filter, activeElements) => (0, import_element72.createInterpolateElement)(
      (0, import_i18n13.sprintf)(
        /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is not: 2024-01-01". */
        (0, import_i18n13.__)("<Name>%1$s is not: </Name><Value>%2$s</Value>"),
        filter.name,
        activeElements[0].label
      ),
      filterTextWrappers
    ),
    filter(item, field, filterValue) {
      if (filterValue === void 0) {
        return true;
      }
      const [fieldTemporal, filterTemporal] = toComparableTemporals(
        field.getValue({ item }),
        filterValue
      );
      return fieldTemporal !== filterTemporal;
    },
    selection: "single"
  }
];
var getOperatorByName = (name) => OPERATORS.find((op) => op.name === name);
var getAllOperatorNames = () => OPERATORS.map((op) => op.name);

// packages/dataviews/build-module/components/dataform-controls/checkbox.mjs
var import_element81 = __toESM(require_element(), 1);

// packages/dataviews/build-module/components/validated-form-controls/checkbox-control.mjs
var import_element73 = __toESM(require_element(), 1);
var import_compose8 = __toESM(require_compose(), 1);
var import_components4 = __toESM(require_components(), 1);
var import_jsx_runtime104 = __toESM(require_jsx_runtime(), 1);
var UnforwardedValidatedCheckboxControl = ({
  required,
  customValidity,
  markWhenOptional,
  ...restProps
}, forwardedRef) => {
  const validityTargetRef = (0, import_element73.useRef)(null);
  const mergedRefs = (0, import_compose8.useMergeRefs)([forwardedRef, validityTargetRef]);
  return /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
    ControlWithError,
    {
      className: "dataviews-validated-control",
      required,
      markWhenOptional,
      ref: mergedRefs,
      customValidity,
      getValidityTarget: () => validityTargetRef.current?.querySelector(
        'input[type="checkbox"]'
      ),
      children: /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
        import_components4.CheckboxControl,
        {
          ...restProps
        }
      )
    }
  );
};
var ValidatedCheckboxControl = (0, import_element73.forwardRef)(UnforwardedValidatedCheckboxControl);
ValidatedCheckboxControl.displayName = "ValidatedCheckboxControl";

// packages/dataviews/build-module/components/validated-form-controls/combobox-control.mjs
var import_element74 = __toESM(require_element(), 1);
var import_compose9 = __toESM(require_compose(), 1);
var import_components5 = __toESM(require_components(), 1);
var import_jsx_runtime105 = __toESM(require_jsx_runtime(), 1);
var UnforwardedValidatedComboboxControl = ({
  required,
  customValidity,
  markWhenOptional,
  ...restProps
}, forwardedRef) => {
  const validityTargetRef = (0, import_element74.useRef)(null);
  const mergedRefs = (0, import_compose9.useMergeRefs)([forwardedRef, validityTargetRef]);
  (0, import_element74.useEffect)(() => {
    const input = validityTargetRef.current?.querySelector(
      'input[role="combobox"]'
    );
    if (input) {
      input.required = required ?? false;
    }
  }, [required]);
  return (
    // TODO: Bug - Missing value error is not cleared immediately on change, waits for blur.
    /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
      ControlWithError,
      {
        className: "dataviews-validated-control",
        required,
        markWhenOptional,
        ref: mergedRefs,
        customValidity,
        getValidityTarget: () => validityTargetRef.current?.querySelector(
          'input[role="combobox"]'
        ),
        children: /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(import_components5.ComboboxControl, { ...restProps })
      }
    )
  );
};
var ValidatedComboboxControl = (0, import_element74.forwardRef)(UnforwardedValidatedComboboxControl);
ValidatedComboboxControl.displayName = "ValidatedComboboxControl";

// packages/dataviews/build-module/components/validated-form-controls/form-token-field.mjs
var import_element75 = __toESM(require_element(), 1);
var import_components6 = __toESM(require_components(), 1);
var import_jsx_runtime106 = __toESM(require_jsx_runtime(), 1);
var UnforwardedValidatedFormTokenField = ({
  required,
  customValidity,
  markWhenOptional,
  ...restProps
}, forwardedRef) => {
  const validityTargetRef = (0, import_element75.useRef)(null);
  return /* @__PURE__ */ (0, import_jsx_runtime106.jsxs)(
    "div",
    {
      className: "dataviews-validated-control__wrapper-with-error-delegate",
      ref: forwardedRef,
      children: [
        /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
          ControlWithError,
          {
            className: "dataviews-validated-control",
            required,
            markWhenOptional,
            customValidity,
            getValidityTarget: () => validityTargetRef.current,
            children: /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(import_components6.FormTokenField, { ...restProps })
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
          "input",
          {
            className: "dataviews-validated-control__error-delegate",
            type: "text",
            ref: validityTargetRef,
            required,
            value: restProps.value && restProps.value.length > 0 ? "hasvalue" : "",
            tabIndex: -1,
            onChange: () => {
            },
            onFocus: (e) => {
              e.target.previousElementSibling?.querySelector(
                'input[type="text"]'
              )?.focus();
            }
          }
        )
      ]
    }
  );
};
var ValidatedFormTokenField = (0, import_element75.forwardRef)(UnforwardedValidatedFormTokenField);
ValidatedFormTokenField.displayName = "ValidatedFormTokenField";

// packages/dataviews/build-module/components/validated-form-controls/number-control.mjs
var import_element76 = __toESM(require_element(), 1);
var import_compose10 = __toESM(require_compose(), 1);
var import_components7 = __toESM(require_components(), 1);
var import_jsx_runtime107 = __toESM(require_jsx_runtime(), 1);
var UnforwardedValidatedNumberControl = ({
  required,
  customValidity,
  markWhenOptional,
  ...restProps
}, forwardedRef) => {
  const validityTargetRef = (0, import_element76.useRef)(null);
  const mergedRefs = (0, import_compose10.useMergeRefs)([forwardedRef, validityTargetRef]);
  return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
    ControlWithError,
    {
      className: "dataviews-validated-control",
      required,
      markWhenOptional,
      customValidity,
      getValidityTarget: () => validityTargetRef.current,
      children: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(import_components7.__experimentalNumberControl, { ref: mergedRefs, ...restProps })
    }
  );
};
var ValidatedNumberControl = (0, import_element76.forwardRef)(UnforwardedValidatedNumberControl);
ValidatedNumberControl.displayName = "ValidatedNumberControl";

// packages/dataviews/build-module/components/validated-form-controls/radio-control.mjs
var import_element77 = __toESM(require_element(), 1);
var import_compose11 = __toESM(require_compose(), 1);
var import_components8 = __toESM(require_components(), 1);
var import_jsx_runtime108 = __toESM(require_jsx_runtime(), 1);
var UnforwardedValidatedRadioControl = ({
  required,
  customValidity,
  markWhenOptional,
  ...restProps
}, forwardedRef) => {
  const validityTargetRef = (0, import_element77.useRef)(null);
  const mergedRefs = (0, import_compose11.useMergeRefs)([forwardedRef, validityTargetRef]);
  return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
    ControlWithError,
    {
      className: "dataviews-validated-control",
      required,
      markWhenOptional,
      ref: mergedRefs,
      customValidity,
      getValidityTarget: () => validityTargetRef.current?.querySelector(
        'input[type="radio"]'
      ),
      children: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(import_components8.RadioControl, { ...restProps })
    }
  );
};
var ValidatedRadioControl = (0, import_element77.forwardRef)(UnforwardedValidatedRadioControl);
ValidatedRadioControl.displayName = "ValidatedRadioControl";

// packages/dataviews/build-module/components/validated-form-controls/select-control.mjs
var import_element78 = __toESM(require_element(), 1);
var import_compose12 = __toESM(require_compose(), 1);
var import_components9 = __toESM(require_components(), 1);
var import_jsx_runtime109 = __toESM(require_jsx_runtime(), 1);
var UnforwardedValidatedSelectControl = ({
  required,
  customValidity,
  markWhenOptional,
  ...restProps
}, forwardedRef) => {
  const validityTargetRef = (0, import_element78.useRef)(null);
  const mergedRefs = (0, import_compose12.useMergeRefs)([forwardedRef, validityTargetRef]);
  return /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
    ControlWithError,
    {
      className: "dataviews-validated-control",
      required,
      markWhenOptional,
      customValidity,
      getValidityTarget: () => validityTargetRef.current,
      children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
        import_components9.SelectControl,
        {
          ref: mergedRefs,
          // A runtime boolean cannot statically discriminate
          // SelectControl's single/multiple props union.
          ...restProps
        }
      )
    }
  );
};
var ValidatedSelectControl = (0, import_element78.forwardRef)(UnforwardedValidatedSelectControl);
ValidatedSelectControl.displayName = "ValidatedSelectControl";

// packages/dataviews/build-module/components/validated-form-controls/toggle-control.mjs
var import_element79 = __toESM(require_element(), 1);
var import_compose13 = __toESM(require_compose(), 1);
var import_components10 = __toESM(require_components(), 1);
var import_jsx_runtime110 = __toESM(require_jsx_runtime(), 1);
var UnforwardedValidatedToggleControl = ({
  required,
  customValidity,
  markWhenOptional,
  ...restProps
}, forwardedRef) => {
  const validityTargetRef = (0, import_element79.useRef)(null);
  const mergedRefs = (0, import_compose13.useMergeRefs)([forwardedRef, validityTargetRef]);
  return /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
    ControlWithError,
    {
      className: "dataviews-validated-control",
      required,
      markWhenOptional,
      customValidity,
      getValidityTarget: () => validityTargetRef.current,
      children: /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
        import_components10.ToggleControl,
        {
          ref: mergedRefs,
          required,
          ...restProps
        }
      )
    }
  );
};
var ValidatedToggleControl = (0, import_element79.forwardRef)(UnforwardedValidatedToggleControl);
ValidatedToggleControl.displayName = "ValidatedToggleControl";

// packages/dataviews/build-module/components/validated-form-controls/toggle-group-control.mjs
var import_element80 = __toESM(require_element(), 1);
var import_components11 = __toESM(require_components(), 1);
var import_jsx_runtime111 = __toESM(require_jsx_runtime(), 1);
var UnforwardedValidatedToggleGroupControl = ({
  required,
  customValidity,
  markWhenOptional,
  ...restProps
}, forwardedRef) => {
  const validityTargetRef = (0, import_element80.useRef)(null);
  const nameAttr = (0, import_element80.useId)();
  return /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)("div", { className: "dataviews-validated-control__wrapper-with-error-delegate", children: [
    /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
      ControlWithError,
      {
        className: "dataviews-validated-control",
        required,
        markWhenOptional,
        customValidity,
        getValidityTarget: () => validityTargetRef.current,
        children: /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(import_components11.__experimentalToggleGroupControl, { ref: forwardedRef, ...restProps })
      }
    ),
    /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
      "input",
      {
        className: "dataviews-validated-control__error-delegate",
        type: "radio",
        ref: validityTargetRef,
        required,
        checked: restProps.value !== void 0,
        tabIndex: -1,
        name: nameAttr,
        onChange: () => {
        },
        onFocus: (e) => {
          e.target.previousElementSibling?.querySelector(
            '[data-active-item="true"]'
          )?.focus();
        }
      }
    )
  ] });
};
var ValidatedToggleGroupControl = (0, import_element80.forwardRef)(UnforwardedValidatedToggleGroupControl);
ValidatedToggleGroupControl.displayName = "ValidatedToggleGroupControl";

// packages/dataviews/build-module/components/dataform-controls/utils/get-custom-validity.mjs
function getCustomValidity(isValid2, validity) {
  let customValidity;
  if (isValid2?.required && validity?.required) {
    customValidity = validity.required.message ? {
      type: validity.required.type,
      message: validity.required.message
    } : void 0;
  } else if (isValid2?.pattern && validity?.pattern) {
    customValidity = validity.pattern;
  } else if (isValid2?.min && validity?.min) {
    customValidity = validity.min;
  } else if (isValid2?.max && validity?.max) {
    customValidity = validity.max;
  } else if (isValid2?.minLength && validity?.minLength) {
    customValidity = validity.minLength;
  } else if (isValid2?.maxLength && validity?.maxLength) {
    customValidity = validity.maxLength;
  } else if (isValid2?.elements && validity?.elements) {
    customValidity = validity.elements;
  } else if (validity?.custom) {
    customValidity = validity.custom;
  }
  return customValidity;
}

// packages/dataviews/build-module/components/dataform-controls/checkbox.mjs
var import_jsx_runtime112 = __toESM(require_jsx_runtime(), 1);
function Checkbox({
  field,
  onChange,
  data,
  hideLabelFromVision,
  markWhenOptional,
  validity
}) {
  const { getValue, setValue, label, description, isValid: isValid2 } = field;
  const disabled2 = field.isDisabled({ item: data, field });
  const onChangeControl = (0, import_element81.useCallback)(() => {
    onChange(
      setValue({ item: data, value: !getValue({ item: data }) })
    );
  }, [data, getValue, onChange, setValue]);
  return /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
    ValidatedCheckboxControl,
    {
      required: !!field.isValid?.required,
      markWhenOptional,
      customValidity: getCustomValidity(isValid2, validity),
      hidden: hideLabelFromVision,
      label,
      help: description,
      checked: getValue({ item: data }),
      onChange: onChangeControl,
      disabled: disabled2
    }
  );
}

// packages/dataviews/build-module/components/dataform-controls/combobox.mjs
var import_components12 = __toESM(require_components(), 1);
var import_element82 = __toESM(require_element(), 1);
var import_jsx_runtime113 = __toESM(require_jsx_runtime(), 1);
function Combobox({
  data,
  field,
  onChange,
  hideLabelFromVision,
  validity
}) {
  const { label, description, placeholder, getValue, setValue, isValid: isValid2 } = field;
  const value = getValue({ item: data }) ?? "";
  const onChangeControl = (0, import_element82.useCallback)(
    (newValue) => onChange(setValue({ item: data, value: newValue ?? "" })),
    [data, onChange, setValue]
  );
  const { elements, isLoading } = useElements({
    elements: field.elements,
    getElements: field.getElements
  });
  if (isLoading) {
    return /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(import_components12.Spinner, {});
  }
  return /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
    ValidatedComboboxControl,
    {
      required: !!field.isValid?.required,
      customValidity: getCustomValidity(isValid2, validity),
      label,
      value,
      help: description,
      placeholder,
      options: elements,
      onChange: onChangeControl,
      hideLabelFromVision,
      allowReset: true,
      expandOnFocus: true
    }
  );
}

// packages/dataviews/build-module/components/dataform-controls/datetime.mjs
var import_components14 = __toESM(require_components(), 1);
var import_element85 = __toESM(require_element(), 1);
var import_i18n16 = __toESM(require_i18n(), 1);
var import_date5 = __toESM(require_date(), 1);
import { speak as speak2 } from "@wordpress/a11y";

// packages/dataviews/build-module/components/dataform-controls/utils/relative-date-control.mjs
var import_components13 = __toESM(require_components(), 1);
var import_element83 = __toESM(require_element(), 1);
var import_i18n14 = __toESM(require_i18n(), 1);
var import_jsx_runtime114 = __toESM(require_jsx_runtime(), 1);
var TIME_UNITS_OPTIONS = {
  [OPERATOR_IN_THE_PAST]: [
    { value: "days", label: (0, import_i18n14.__)("Days") },
    { value: "weeks", label: (0, import_i18n14.__)("Weeks") },
    { value: "months", label: (0, import_i18n14.__)("Months") },
    { value: "years", label: (0, import_i18n14.__)("Years") }
  ],
  [OPERATOR_OVER]: [
    { value: "days", label: (0, import_i18n14.__)("Days ago") },
    { value: "weeks", label: (0, import_i18n14.__)("Weeks ago") },
    { value: "months", label: (0, import_i18n14.__)("Months ago") },
    { value: "years", label: (0, import_i18n14.__)("Years ago") }
  ]
};
function RelativeDateControl({
  className,
  data,
  field,
  onChange,
  hideLabelFromVision,
  operator
}) {
  const options = TIME_UNITS_OPTIONS[operator === OPERATOR_IN_THE_PAST ? "inThePast" : "over"];
  const { id, label, description, getValue, setValue } = field;
  const disabled2 = field.isDisabled({ item: data, field });
  const fieldValue = getValue({ item: data });
  const { value: relValue = "", unit = options[0].value } = fieldValue && typeof fieldValue === "object" ? fieldValue : {};
  const onChangeValue = (0, import_element83.useCallback)(
    (newValue) => onChange(
      setValue({
        item: data,
        value: { value: Number(newValue), unit }
      })
    ),
    [onChange, setValue, data, unit]
  );
  const onChangeUnit = (0, import_element83.useCallback)(
    (newUnit) => onChange(
      setValue({
        item: data,
        value: { value: relValue, unit: newUnit }
      })
    ),
    [onChange, setValue, data, relValue]
  );
  return /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
    import_components13.BaseControl,
    {
      id,
      className: clsx_default(className, "dataviews-controls__relative-date"),
      label,
      hideLabelFromVision,
      help: description,
      children: /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)(Stack, { direction: "row", gap: "sm", children: [
        /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
          import_components13.__experimentalNumberControl,
          {
            className: "dataviews-controls__relative-date-number",
            spinControls: "none",
            min: 1,
            step: 1,
            value: relValue,
            onChange: onChangeValue,
            disabled: disabled2
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
          import_components13.SelectControl,
          {
            className: "dataviews-controls__relative-date-unit",
            label: (0, import_i18n14.__)("Unit"),
            value: unit,
            options,
            onChange: onChangeUnit,
            hideLabelFromVision: true,
            disabled: disabled2
          }
        )
      ] })
    }
  );
}

// packages/dataviews/build-module/components/dataform-controls/utils/to-calendar-date.mjs
function toCalendarDate(date, timeZone) {
  return timeZone ? new TZDate(date, timeZone) : date;
}

// packages/dataviews/build-module/components/dataform-controls/utils/use-disabled-date-matchers.mjs
var import_element84 = __toESM(require_element(), 1);
function useDisabledDateMatchers(isValid2, parseDateFn) {
  const minConstraint = typeof isValid2.min?.constraint === "string" ? isValid2.min.constraint : void 0;
  const maxConstraint = typeof isValid2.max?.constraint === "string" ? isValid2.max.constraint : void 0;
  const disabledMatchers = (0, import_element84.useMemo)(() => {
    const matchers = [];
    if (minConstraint) {
      const minDate = parseDateFn(minConstraint);
      if (minDate) {
        matchers.push({ before: minDate });
      }
    }
    if (maxConstraint) {
      const maxDate = parseDateFn(maxConstraint);
      if (maxDate) {
        matchers.push({ after: maxDate });
      }
    }
    return matchers.length > 0 ? matchers : void 0;
  }, [minConstraint, maxConstraint, parseDateFn]);
  return { minConstraint, maxConstraint, disabledMatchers };
}

// packages/dataviews/build-module/components/dataform-controls/utils/get-calendar-locale.mjs
var LANGUAGE_ALIASES = {
  ary: "ar-MA",
  // Moroccan Arabic.
  haz: "fa"
  // Hazaragi, a variety of Persian.
};
function getCalendarLocale(wpLocale) {
  const subtags = wpLocale?.trim().split(/[_-]/) ?? [];
  const language = subtags.shift()?.toLowerCase();
  if (!language) {
    return void 0;
  }
  const normalized = [LANGUAGE_ALIASES[language] ?? language];
  for (const subtag of subtags) {
    if (/^[a-z]{4}$/i.test(subtag) || /^([a-z]{2}|\d{3})$/i.test(subtag)) {
      normalized.push(subtag);
    }
  }
  return normalized.join("-");
}

// packages/dataviews/build-module/components/dataform-controls/utils/get-timezone-description.mjs
var import_date3 = __toESM(require_date(), 1);
var import_i18n15 = __toESM(require_i18n(), 1);
function getTimezoneDescription() {
  const { timezone } = (0, import_date3.getSettings)();
  const userTimezoneOffset = -1 * ((/* @__PURE__ */ new Date()).getTimezoneOffset() / 60);
  if (Number(timezone.offset) === userTimezoneOffset) {
    return void 0;
  }
  const offsetSymbol = Number(timezone.offset) >= 0 ? "+" : "";
  const zoneAbbr = "" !== timezone.abbr && isNaN(Number(timezone.abbr)) ? timezone.abbr : `UTC${offsetSymbol}${timezone.offsetFormatted}`;
  const prettyTimezoneString = timezone.string.replaceAll("_", " ");
  let timezoneDetail = zoneAbbr;
  if ("UTC" === timezone.string) {
    timezoneDetail = (0, import_i18n15.__)("Coordinated Universal Time");
  } else if (prettyTimezoneString.trim().length > 0) {
    timezoneDetail = `(${zoneAbbr}) ${prettyTimezoneString}`;
  }
  return (0, import_i18n15.sprintf)(
    /* translators: %s: timezone detail, e.g. "(CEST) Europe/Madrid" or "UTC+3". */
    (0, import_i18n15.__)("Timezone: %s"),
    timezoneDetail
  );
}

// packages/dataviews/build-module/field-types/utils/parse-date-time.mjs
var import_date4 = __toESM(require_date(), 1);
function parseDateTime(dateTimeString) {
  if (!dateTimeString) {
    return null;
  }
  const parsed = (0, import_date4.getDate)(dateTimeString);
  return parsed && isValid(parsed) ? parsed : null;
}

// packages/dataviews/build-module/components/dataform-controls/datetime.mjs
var import_jsx_runtime115 = __toESM(require_jsx_runtime(), 1);
var formatDateTime = (value) => {
  if (!value) {
    return "";
  }
  return (0, import_date5.dateI18n)("Y-m-d\\TH:i", (0, import_date5.getDate)(value));
};
function CalendarDateTimeControl({
  data,
  field,
  onChange,
  hideLabelFromVision,
  markWhenOptional,
  validity,
  config
}) {
  const { compact } = config || {};
  const { id, label, description, setValue, getValue, isValid: isValid2 } = field;
  const disabled2 = field.isDisabled({ item: data, field });
  const fieldValue = getValue({ item: data });
  const value = typeof fieldValue === "string" ? fieldValue : void 0;
  const { timezone } = (0, import_date5.getSettings)();
  const timeZone = timezone.string || (0, import_date5.dateI18n)("P");
  const [calendarMonth, setCalendarMonth] = (0, import_element85.useState)(() => {
    const parsedDate = parseDateTime(value);
    return toCalendarDate(parsedDate || /* @__PURE__ */ new Date(), timeZone);
  });
  (0, import_element85.useEffect)(() => {
    const parsedDate = parseDateTime(value);
    if (parsedDate) {
      const targetMonth = toCalendarDate(parsedDate, timeZone);
      setCalendarMonth(
        (currentMonth) => isSameMonth(
          targetMonth,
          toCalendarDate(currentMonth, timeZone)
        ) ? currentMonth : targetMonth
      );
    }
  }, [timeZone, value]);
  const inputControlRef = (0, import_element85.useRef)(null);
  const validationTimeoutRef = (0, import_element85.useRef)(void 0);
  const { minConstraint, maxConstraint, disabledMatchers } = useDisabledDateMatchers(isValid2, parseDateTime);
  const onChangeCallback = (0, import_element85.useCallback)(
    (newValue) => onChange(setValue({ item: data, value: newValue })),
    [data, onChange, setValue]
  );
  (0, import_element85.useEffect)(() => {
    return () => clearTimeout(validationTimeoutRef.current);
  }, []);
  const onSelectDate = (0, import_element85.useCallback)(
    (newDate) => {
      if (newDate) {
        const wpDate = (0, import_date5.dateI18n)("Y-m-d", newDate);
        const wpTime = value ? (0, import_date5.dateI18n)("H:i", (0, import_date5.getDate)(value)) : "00:00";
        const finalDateTime = (0, import_date5.getDate)(`${wpDate}T${wpTime}`);
        onChangeCallback(finalDateTime.toISOString());
      } else {
        onChangeCallback(void 0);
      }
      clearTimeout(validationTimeoutRef.current);
      validationTimeoutRef.current = setTimeout(() => {
        const input = inputControlRef.current;
        if (!input) {
          return;
        }
        input.dispatchEvent(
          new Event("invalid", { cancelable: true })
        );
        if (input.validationMessage) {
          speak2(input.validationMessage);
        }
      }, 0);
    },
    [onChangeCallback, value]
  );
  const handleManualDateTimeChange = (0, import_element85.useCallback)(
    (newValue) => {
      if (newValue) {
        const dateTime = (0, import_date5.getDate)(newValue);
        onChangeCallback(dateTime.toISOString());
        const parsedDate = parseDateTime(dateTime.toISOString());
        if (parsedDate) {
          setCalendarMonth(toCalendarDate(parsedDate, timeZone));
        }
      } else {
        onChangeCallback(void 0);
      }
    },
    [onChangeCallback, timeZone]
  );
  const { format: fieldFormat } = field;
  const weekStartsOn = fieldFormat.weekStartsOn ?? (0, import_date5.getSettings)().l10n.startOfWeek;
  const locale = getCalendarLocale((0, import_date5.getSettings)().l10n.locale);
  let displayLabel = label;
  if (isValid2?.required && !markWhenOptional && !hideLabelFromVision) {
    displayLabel = `${label} (${(0, import_i18n16.__)("Required")})`;
  } else if (!isValid2?.required && markWhenOptional && !hideLabelFromVision) {
    displayLabel = `${label} (${(0, import_i18n16.__)("Optional")})`;
  }
  return /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
    import_components14.BaseControl,
    {
      id,
      label: displayLabel,
      help: description,
      hideLabelFromVision,
      children: /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)(Stack, { direction: "column", gap: "lg", children: [
        /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
          ValidatedInputControl,
          {
            ref: inputControlRef,
            required: !!isValid2?.required,
            customValidity: getCustomValidity(isValid2, validity),
            type: "datetime-local",
            label: (0, import_i18n16.__)("Date time"),
            hideLabelFromVision: true,
            value: formatDateTime(value),
            onValueChange: handleManualDateTimeChange,
            disabled: disabled2,
            description: getTimezoneDescription(),
            min: minConstraint ? formatDateTime(minConstraint) : void 0,
            max: maxConstraint ? formatDateTime(maxConstraint) : void 0
          }
        ),
        !compact && /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
          Calendar,
          {
            style: { width: "100%" },
            value: value ? parseDateTime(value) : null,
            onValueChange: onSelectDate,
            month: calendarMonth,
            onMonthChange: setCalendarMonth,
            timeZone,
            locale,
            dir: (0, import_i18n16.isRTL)() ? "rtl" : "ltr",
            weekStartsOn,
            disabled: disabled2 || disabledMatchers
          }
        )
      ] })
    }
  );
}
function DateTime({
  data,
  field,
  onChange,
  hideLabelFromVision,
  markWhenOptional,
  operator,
  validity,
  config
}) {
  if (operator === OPERATOR_IN_THE_PAST || operator === OPERATOR_OVER) {
    return /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
      RelativeDateControl,
      {
        className: "dataviews-controls__datetime",
        data,
        field,
        onChange,
        hideLabelFromVision,
        operator
      }
    );
  }
  return /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
    CalendarDateTimeControl,
    {
      data,
      field,
      onChange,
      hideLabelFromVision,
      markWhenOptional,
      validity,
      config
    }
  );
}

// packages/dataviews/build-module/components/dataform-controls/date.mjs
var import_components15 = __toESM(require_components(), 1);
var import_element86 = __toESM(require_element(), 1);
var import_i18n17 = __toESM(require_i18n(), 1);
var import_date6 = __toESM(require_date(), 1);
import { speak as speak3 } from "@wordpress/a11y";
var import_jsx_runtime116 = __toESM(require_jsx_runtime(), 1);
var DATE_PRESETS = [
  {
    id: "today",
    label: (0, import_i18n17.__)("Today"),
    getValue: () => (0, import_date6.getDate)(null)
  },
  {
    id: "yesterday",
    label: (0, import_i18n17.__)("Yesterday"),
    getValue: () => {
      const today = (0, import_date6.getDate)(null);
      return subDays(today, 1);
    }
  },
  {
    id: "past-week",
    label: (0, import_i18n17.__)("Past week"),
    getValue: () => {
      const today = (0, import_date6.getDate)(null);
      return subDays(today, 7);
    }
  },
  {
    id: "past-month",
    label: (0, import_i18n17.__)("Past month"),
    getValue: () => {
      const today = (0, import_date6.getDate)(null);
      return subMonths(today, 1);
    }
  }
];
var DATE_RANGE_PRESETS = [
  {
    id: "last-7-days",
    label: (0, import_i18n17.__)("Last 7 days"),
    getValue: () => {
      const today = (0, import_date6.getDate)(null);
      return [subDays(today, 7), today];
    }
  },
  {
    id: "last-30-days",
    label: (0, import_i18n17.__)("Last 30 days"),
    getValue: () => {
      const today = (0, import_date6.getDate)(null);
      return [subDays(today, 30), today];
    }
  },
  {
    id: "month-to-date",
    label: (0, import_i18n17.__)("Month to date"),
    getValue: () => {
      const today = (0, import_date6.getDate)(null);
      return [startOfMonth(today), today];
    }
  },
  {
    id: "last-year",
    label: (0, import_i18n17.__)("Last year"),
    getValue: () => {
      const today = (0, import_date6.getDate)(null);
      return [subYears(today, 1), today];
    }
  },
  {
    id: "year-to-date",
    label: (0, import_i18n17.__)("Year to date"),
    getValue: () => {
      const today = (0, import_date6.getDate)(null);
      return [startOfYear(today), today];
    }
  }
];
var parseDate2 = (dateString) => {
  if (!dateString) {
    return null;
  }
  const parsed = parseISO(dateString);
  return isValid(parsed) ? parsed : null;
};
var formatDate = (date) => {
  if (!date) {
    return "";
  }
  return typeof date === "string" ? date : format(date, "yyyy-MM-dd");
};
function ValidatedDateControl({
  field,
  validity,
  inputRefs,
  isTouched,
  setIsTouched,
  children
}) {
  const { isValid: isValid2 } = field;
  const [customValidity, setCustomValidity] = (0, import_element86.useState)(void 0);
  const validateRefs = (0, import_element86.useCallback)(() => {
    const refs = Array.isArray(inputRefs) ? inputRefs : [inputRefs];
    for (const ref of refs) {
      const input = ref.current;
      if (input && !input.validity.valid) {
        setCustomValidity({
          type: "invalid",
          message: input.validationMessage
        });
        return;
      }
    }
    setCustomValidity(void 0);
  }, [inputRefs]);
  (0, import_element86.useEffect)(() => {
    const refs = Array.isArray(inputRefs) ? inputRefs : [inputRefs];
    const result = validity ? getCustomValidity(isValid2, validity) : void 0;
    for (const ref of refs) {
      const input = ref.current;
      if (input) {
        input.setCustomValidity(
          result?.type === "invalid" && result.message ? result.message : ""
        );
      }
    }
  }, [inputRefs, isValid2, validity]);
  (0, import_element86.useEffect)(() => {
    const refs = Array.isArray(inputRefs) ? inputRefs : [inputRefs];
    const handleInvalid = (event) => {
      event.preventDefault();
      setIsTouched(true);
    };
    for (const ref of refs) {
      ref.current?.addEventListener("invalid", handleInvalid);
    }
    return () => {
      for (const ref of refs) {
        ref.current?.removeEventListener("invalid", handleInvalid);
      }
    };
  }, [inputRefs, setIsTouched]);
  (0, import_element86.useEffect)(() => {
    if (!isTouched) {
      return;
    }
    const result = validity ? getCustomValidity(isValid2, validity) : void 0;
    if (result) {
      setCustomValidity(result);
    } else {
      validateRefs();
    }
  }, [isTouched, isValid2, validity, validateRefs]);
  (0, import_element86.useEffect)(() => {
    if (isTouched && customValidity?.message) {
      speak3(customValidity.message);
    }
  }, [isTouched, customValidity?.message]);
  const onBlur = (event) => {
    if (isTouched) {
      return;
    }
    if (!event.relatedTarget || !event.currentTarget.contains(event.relatedTarget)) {
      setIsTouched(true);
    }
  };
  return /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)(Stack, { direction: "column", gap: "sm", onBlur, children: [
    children,
    customValidity && /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
      ValidityIndicator,
      {
        type: customValidity.type,
        message: customValidity.message
      }
    )
  ] });
}
function CalendarDateControl({
  data,
  field,
  onChange,
  hideLabelFromVision,
  markWhenOptional,
  validity
}) {
  const {
    id,
    label,
    description,
    setValue,
    getValue,
    isValid: isValid2,
    format: fieldFormat
  } = field;
  const disabled2 = field.isDisabled({ item: data, field });
  const [selectedPresetId, setSelectedPresetId] = (0, import_element86.useState)(
    null
  );
  const weekStartsOn = fieldFormat.weekStartsOn ?? (0, import_date6.getSettings)().l10n.startOfWeek;
  const locale = getCalendarLocale((0, import_date6.getSettings)().l10n.locale);
  const fieldValue = getValue({ item: data });
  const value = typeof fieldValue === "string" ? fieldValue : void 0;
  const [calendarMonth, setCalendarMonth] = (0, import_element86.useState)(() => {
    const parsedDate = parseDate2(value);
    return parsedDate || /* @__PURE__ */ new Date();
  });
  (0, import_element86.useEffect)(() => {
    const parsedDate = parseDate2(value);
    if (parsedDate) {
      setCalendarMonth(
        (currentMonth) => isSameMonth(parsedDate, currentMonth) ? currentMonth : parsedDate
      );
    }
  }, [value]);
  const [isTouched, setIsTouched] = (0, import_element86.useState)(false);
  const validityTargetRef = (0, import_element86.useRef)(null);
  const { minConstraint, maxConstraint, disabledMatchers } = useDisabledDateMatchers(isValid2, parseDate2);
  const onChangeCallback = (0, import_element86.useCallback)(
    (newValue) => onChange(setValue({ item: data, value: newValue })),
    [data, onChange, setValue]
  );
  const onSelectDate = (0, import_element86.useCallback)(
    (newDate) => {
      const dateValue = newDate ? formatDate(newDate) : void 0;
      onChangeCallback(dateValue);
      setSelectedPresetId(null);
      setIsTouched(true);
    },
    [onChangeCallback]
  );
  const handlePresetClick = (0, import_element86.useCallback)(
    (preset) => {
      const presetDate = preset.getValue();
      const dateValue = formatDate(presetDate);
      setCalendarMonth(presetDate);
      onChangeCallback(dateValue);
      setSelectedPresetId(preset.id);
      setIsTouched(true);
    },
    [onChangeCallback]
  );
  const handleManualDateChange = (0, import_element86.useCallback)(
    (newValue) => {
      onChangeCallback(newValue);
      if (newValue) {
        const parsedDate = parseDate2(newValue);
        if (parsedDate) {
          setCalendarMonth(parsedDate);
        }
      }
      setSelectedPresetId(null);
      setIsTouched(true);
    },
    [onChangeCallback]
  );
  let displayLabel = label;
  if (isValid2?.required && !markWhenOptional) {
    displayLabel = `${label} (${(0, import_i18n17.__)("Required")})`;
  } else if (!isValid2?.required && markWhenOptional) {
    displayLabel = `${label} (${(0, import_i18n17.__)("Optional")})`;
  }
  return /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
    ValidatedDateControl,
    {
      field,
      validity,
      inputRefs: validityTargetRef,
      isTouched,
      setIsTouched,
      children: /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
        import_components15.BaseControl,
        {
          id,
          className: "dataviews-controls__date",
          label: displayLabel,
          help: description,
          hideLabelFromVision,
          children: /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)(Stack, { direction: "column", gap: "lg", children: [
            /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)(
              Stack,
              {
                direction: "row",
                gap: "sm",
                wrap: "wrap",
                justify: "flex-start",
                children: [
                  DATE_PRESETS.map((preset) => {
                    const isSelected = selectedPresetId === preset.id;
                    return /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
                      import_components15.Button,
                      {
                        className: "dataviews-controls__date-preset",
                        variant: "tertiary",
                        isPressed: isSelected,
                        size: "small",
                        disabled: disabled2,
                        accessibleWhenDisabled: true,
                        onClick: () => handlePresetClick(preset),
                        children: preset.label
                      },
                      preset.id
                    );
                  }),
                  /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
                    import_components15.Button,
                    {
                      className: "dataviews-controls__date-preset",
                      variant: "tertiary",
                      isPressed: !selectedPresetId,
                      size: "small",
                      disabled: !!selectedPresetId || disabled2,
                      accessibleWhenDisabled: true,
                      children: (0, import_i18n17.__)("Custom")
                    }
                  )
                ]
              }
            ),
            /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
              import_components15.__experimentalInputControl,
              {
                ref: validityTargetRef,
                type: "date",
                label: (0, import_i18n17.__)("Date"),
                hideLabelFromVision: true,
                value,
                onChange: handleManualDateChange,
                required: !!field.isValid?.required,
                disabled: disabled2,
                min: minConstraint,
                max: maxConstraint
              }
            ),
            /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
              Calendar,
              {
                style: { width: "100%" },
                value: value ? parseDate2(value) : null,
                onValueChange: onSelectDate,
                month: calendarMonth,
                onMonthChange: setCalendarMonth,
                locale,
                dir: (0, import_i18n17.isRTL)() ? "rtl" : "ltr",
                weekStartsOn,
                disabled: disabled2 || disabledMatchers,
                disableNavigation: disabled2
              }
            )
          ] })
        }
      )
    }
  );
}
function CalendarDateRangeControl({
  data,
  field,
  onChange,
  hideLabelFromVision,
  markWhenOptional,
  validity
}) {
  const {
    id,
    label,
    description,
    getValue,
    setValue,
    isValid: isValid2,
    format: fieldFormat
  } = field;
  const disabled2 = field.isDisabled({ item: data, field });
  let value;
  const fieldValue = getValue({ item: data });
  if (Array.isArray(fieldValue) && fieldValue.length === 2 && fieldValue.every((date) => typeof date === "string")) {
    value = fieldValue;
  }
  const weekStartsOn = fieldFormat.weekStartsOn ?? (0, import_date6.getSettings)().l10n.startOfWeek;
  const locale = getCalendarLocale((0, import_date6.getSettings)().l10n.locale);
  const { minConstraint, maxConstraint, disabledMatchers } = useDisabledDateMatchers(isValid2, parseDate2);
  const onChangeCallback = (0, import_element86.useCallback)(
    (newValue) => {
      onChange(
        setValue({
          item: data,
          value: newValue
        })
      );
    },
    [data, onChange, setValue]
  );
  const [selectedPresetId, setSelectedPresetId] = (0, import_element86.useState)(
    null
  );
  const selectedRange = (0, import_element86.useMemo)(() => {
    if (!value) {
      return null;
    }
    const [from, to] = value;
    return {
      from: parseDate2(from) || void 0,
      to: parseDate2(to) || void 0
    };
  }, [value]);
  const [calendarMonth, setCalendarMonth] = (0, import_element86.useState)(() => {
    return selectedRange?.from || /* @__PURE__ */ new Date();
  });
  const [fromValue, toValue] = value ?? [];
  (0, import_element86.useEffect)(() => {
    setCalendarMonth((currentMonth) => {
      const from = parseDate2(fromValue);
      const to = parseDate2(toValue);
      const targetMonth = from ?? to;
      const isRangeVisible = from && to ? areIntervalsOverlapping(
        { start: from, end: to },
        {
          start: startOfMonth(currentMonth),
          end: endOfMonth(currentMonth)
        },
        { inclusive: true }
      ) : [from, to].some(
        (date) => date && isSameMonth(date, currentMonth)
      );
      return targetMonth && !isRangeVisible ? targetMonth : currentMonth;
    });
  }, [fromValue, toValue]);
  const [isTouched, setIsTouched] = (0, import_element86.useState)(false);
  const fromInputRef = (0, import_element86.useRef)(null);
  const toInputRef = (0, import_element86.useRef)(null);
  const updateDateRange = (0, import_element86.useCallback)(
    (fromDate, toDate2) => {
      if (!fromDate && !toDate2) {
        onChangeCallback(void 0);
        return;
      }
      onChangeCallback([
        formatDate(fromDate),
        formatDate(toDate2)
      ]);
    },
    [onChangeCallback]
  );
  const onSelectCalendarRange = (0, import_element86.useCallback)(
    (newRange) => {
      updateDateRange(newRange?.from, newRange?.to);
      setSelectedPresetId(null);
      setIsTouched(true);
    },
    [updateDateRange]
  );
  const handlePresetClick = (0, import_element86.useCallback)(
    (preset) => {
      const [startDate, endDate] = preset.getValue();
      setCalendarMonth(startDate);
      updateDateRange(startDate, endDate);
      setSelectedPresetId(preset.id);
      setIsTouched(true);
    },
    [updateDateRange]
  );
  const handleManualDateChange = (0, import_element86.useCallback)(
    (fromOrTo, newValue) => {
      const [currentFrom, currentTo] = value || [
        void 0,
        void 0
      ];
      const updatedFrom = fromOrTo === "from" ? newValue : currentFrom;
      const updatedTo = fromOrTo === "to" ? newValue : currentTo;
      updateDateRange(updatedFrom, updatedTo);
      if (newValue) {
        const parsedDate = parseDate2(newValue);
        if (parsedDate) {
          setCalendarMonth(parsedDate);
        }
      }
      setSelectedPresetId(null);
      setIsTouched(true);
    },
    [value, updateDateRange]
  );
  let displayLabel = label;
  if (field.isValid?.required && !markWhenOptional) {
    displayLabel = `${label} (${(0, import_i18n17.__)("Required")})`;
  } else if (!field.isValid?.required && markWhenOptional) {
    displayLabel = `${label} (${(0, import_i18n17.__)("Optional")})`;
  }
  return /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
    ValidatedDateControl,
    {
      field,
      validity,
      inputRefs: [fromInputRef, toInputRef],
      isTouched,
      setIsTouched,
      children: /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
        import_components15.BaseControl,
        {
          id,
          className: "dataviews-controls__date",
          label: displayLabel,
          help: description,
          hideLabelFromVision,
          children: /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)(Stack, { direction: "column", gap: "lg", children: [
            /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)(
              Stack,
              {
                direction: "row",
                gap: "sm",
                wrap: "wrap",
                justify: "flex-start",
                children: [
                  DATE_RANGE_PRESETS.map((preset) => {
                    const isSelected = selectedPresetId === preset.id;
                    return /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
                      import_components15.Button,
                      {
                        className: "dataviews-controls__date-preset",
                        variant: "tertiary",
                        isPressed: isSelected,
                        size: "small",
                        disabled: disabled2,
                        accessibleWhenDisabled: true,
                        onClick: () => handlePresetClick(preset),
                        children: preset.label
                      },
                      preset.id
                    );
                  }),
                  /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
                    import_components15.Button,
                    {
                      className: "dataviews-controls__date-preset",
                      variant: "tertiary",
                      isPressed: !selectedPresetId,
                      size: "small",
                      accessibleWhenDisabled: true,
                      disabled: !!selectedPresetId || disabled2,
                      children: (0, import_i18n17.__)("Custom")
                    }
                  )
                ]
              }
            ),
            /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)(
              Stack,
              {
                direction: "row",
                gap: "sm",
                justify: "space-between",
                className: "dataviews-controls__date-range-inputs",
                children: [
                  /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
                    import_components15.__experimentalInputControl,
                    {
                      ref: fromInputRef,
                      type: "date",
                      label: (0, import_i18n17.__)("From"),
                      hideLabelFromVision: true,
                      value: value?.[0],
                      onChange: (newValue) => handleManualDateChange("from", newValue),
                      required: !!field.isValid?.required,
                      disabled: disabled2,
                      min: minConstraint,
                      max: maxConstraint
                    }
                  ),
                  /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
                    import_components15.__experimentalInputControl,
                    {
                      ref: toInputRef,
                      type: "date",
                      label: (0, import_i18n17.__)("To"),
                      hideLabelFromVision: true,
                      value: value?.[1],
                      onChange: (newValue) => handleManualDateChange("to", newValue),
                      required: !!field.isValid?.required,
                      disabled: disabled2,
                      min: minConstraint,
                      max: maxConstraint
                    }
                  )
                ]
              }
            ),
            /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
              RangeCalendar,
              {
                style: { width: "100%" },
                value: selectedRange,
                onValueChange: onSelectCalendarRange,
                month: calendarMonth,
                onMonthChange: setCalendarMonth,
                locale,
                dir: (0, import_i18n17.isRTL)() ? "rtl" : "ltr",
                weekStartsOn,
                disabled: disabled2 || disabledMatchers
              }
            )
          ] })
        }
      )
    }
  );
}
function DateControl({
  data,
  field,
  onChange,
  hideLabelFromVision,
  markWhenOptional,
  operator,
  validity
}) {
  if (operator === OPERATOR_IN_THE_PAST || operator === OPERATOR_OVER) {
    return /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
      RelativeDateControl,
      {
        className: "dataviews-controls__date",
        data,
        field,
        onChange,
        hideLabelFromVision,
        operator
      }
    );
  }
  if (operator === OPERATOR_BETWEEN) {
    return /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
      CalendarDateRangeControl,
      {
        data,
        field,
        onChange,
        hideLabelFromVision,
        markWhenOptional,
        validity
      }
    );
  }
  return /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
    CalendarDateControl,
    {
      data,
      field,
      onChange,
      hideLabelFromVision,
      markWhenOptional,
      validity
    }
  );
}

// packages/dataviews/build-module/components/dataform-controls/select.mjs
var import_components16 = __toESM(require_components(), 1);
var import_element87 = __toESM(require_element(), 1);
var import_jsx_runtime117 = __toESM(require_jsx_runtime(), 1);
function Select2({
  data,
  field,
  onChange,
  hideLabelFromVision,
  markWhenOptional,
  validity
}) {
  const { type, label, description, getValue, setValue, isValid: isValid2 } = field;
  const disabled2 = field.isDisabled({ item: data, field });
  const isMultiple = type === "array";
  const value = getValue({ item: data }) ?? (isMultiple ? [] : "");
  const onChangeControl = (0, import_element87.useCallback)(
    (newValue) => onChange(setValue({ item: data, value: newValue })),
    [data, onChange, setValue]
  );
  const { elements, isLoading } = useElements({
    elements: field.elements,
    getElements: field.getElements
  });
  if (isLoading) {
    return /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(import_components16.Spinner, {});
  }
  return /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
    ValidatedSelectControl,
    {
      required: !!field.isValid?.required,
      markWhenOptional,
      customValidity: getCustomValidity(isValid2, validity),
      label,
      value,
      help: description,
      options: elements,
      onChange: onChangeControl,
      hideLabelFromVision,
      multiple: isMultiple,
      disabled: disabled2
    }
  );
}

// packages/dataviews/build-module/components/dataform-controls/adaptive-select.mjs
var import_jsx_runtime118 = __toESM(require_jsx_runtime(), 1);
var ELEMENTS_THRESHOLD = 10;
function AdaptiveSelect(props) {
  const { field } = props;
  const { elements } = useElements({
    elements: field.elements,
    getElements: field.getElements
  });
  if (elements.length >= ELEMENTS_THRESHOLD) {
    return /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(Combobox, { ...props });
  }
  return /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(Select2, { ...props });
}

// packages/dataviews/build-module/components/dataform-controls/utils/validated-input.mjs
var import_element88 = __toESM(require_element(), 1);
var import_jsx_runtime119 = __toESM(require_jsx_runtime(), 1);
function ValidatedText({
  data,
  field,
  onChange,
  hideLabelFromVision,
  markWhenOptional,
  type,
  prefix,
  suffix,
  validity
}) {
  const { label, placeholder, description, getValue, setValue, isValid: isValid2 } = field;
  const value = getValue({ item: data });
  const disabled2 = field.isDisabled({ item: data, field });
  const onValueChangeControl = (0, import_element88.useCallback)(
    (newValue) => onChange(
      setValue({
        item: data,
        value: newValue
      })
    ),
    [data, setValue, onChange]
  );
  return /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
    ValidatedInputControl,
    {
      required: !!isValid2.required,
      markWhenOptional,
      customValidity: getCustomValidity(isValid2, validity),
      label,
      placeholder,
      value: value ?? "",
      description: typeof description === "string" ? description : void 0,
      details: typeof description === "string" ? void 0 : description,
      onValueChange: onValueChangeControl,
      hideLabelFromVision,
      type,
      prefix,
      suffix,
      disabled: disabled2,
      pattern: isValid2.pattern ? isValid2.pattern.constraint : void 0,
      minLength: isValid2.minLength ? isValid2.minLength.constraint : void 0,
      maxLength: isValid2.maxLength ? isValid2.maxLength.constraint : void 0
    }
  );
}

// packages/dataviews/build-module/components/dataform-controls/email.mjs
var import_jsx_runtime120 = __toESM(require_jsx_runtime(), 1);
function Email({
  data,
  field,
  onChange,
  hideLabelFromVision,
  markWhenOptional,
  validity
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
    ValidatedText,
    {
      ...{
        data,
        field,
        onChange,
        hideLabelFromVision,
        markWhenOptional,
        validity,
        type: "email",
        prefix: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(InputLayout3.Slot, { padding: "minimal", children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(Icon, { icon: envelope_default }) })
      }
    }
  );
}

// packages/dataviews/build-module/components/dataform-controls/telephone.mjs
var import_jsx_runtime121 = __toESM(require_jsx_runtime(), 1);
function Telephone({
  data,
  field,
  onChange,
  hideLabelFromVision,
  markWhenOptional,
  validity
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
    ValidatedText,
    {
      ...{
        data,
        field,
        onChange,
        hideLabelFromVision,
        markWhenOptional,
        validity,
        type: "tel",
        prefix: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(InputLayout3.Slot, { padding: "minimal", children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Icon, { icon: mobile_default }) })
      }
    }
  );
}

// packages/dataviews/build-module/components/dataform-controls/url.mjs
var import_jsx_runtime122 = __toESM(require_jsx_runtime(), 1);
function Url({
  data,
  field,
  onChange,
  hideLabelFromVision,
  markWhenOptional,
  validity
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
    ValidatedText,
    {
      ...{
        data,
        field,
        onChange,
        hideLabelFromVision,
        markWhenOptional,
        validity,
        type: "url",
        prefix: /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(InputLayout3.Slot, { padding: "minimal", children: /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(Icon, { icon: link_default }) })
      }
    }
  );
}

// packages/dataviews/build-module/components/dataform-controls/utils/validated-number.mjs
var import_components17 = __toESM(require_components(), 1);
var import_element89 = __toESM(require_element(), 1);
var import_i18n18 = __toESM(require_i18n(), 1);
var import_jsx_runtime123 = __toESM(require_jsx_runtime(), 1);
function toNumberOrEmpty(value) {
  if (value === "" || value === void 0) {
    return "";
  }
  const number = Number(value);
  return Number.isFinite(number) ? number : "";
}
function BetweenControls({
  value,
  onChange,
  hideLabelFromVision,
  step
}) {
  const [min4 = "", max4 = ""] = value;
  const onChangeMin = (0, import_element89.useCallback)(
    (newValue) => onChange([toNumberOrEmpty(newValue), max4]),
    [onChange, max4]
  );
  const onChangeMax = (0, import_element89.useCallback)(
    (newValue) => onChange([min4, toNumberOrEmpty(newValue)]),
    [onChange, min4]
  );
  return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
    import_components17.BaseControl,
    {
      help: (0, import_i18n18.__)("The max. value must be greater than the min. value."),
      children: /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(import_components17.Flex, { direction: "row", gap: 4, children: [
        /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
          import_components17.__experimentalNumberControl,
          {
            label: (0, import_i18n18.__)("Min."),
            value: min4,
            max: max4 ? Number(max4) - step : void 0,
            onChange: onChangeMin,
            hideLabelFromVision,
            step
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
          import_components17.__experimentalNumberControl,
          {
            label: (0, import_i18n18.__)("Max."),
            value: max4,
            min: min4 ? Number(min4) + step : void 0,
            onChange: onChangeMax,
            hideLabelFromVision,
            step
          }
        )
      ] })
    }
  );
}
function ValidatedNumber({
  data,
  field,
  onChange,
  hideLabelFromVision,
  markWhenOptional,
  operator,
  validity
}) {
  const decimals = field.format?.decimals ?? 0;
  const step = Math.pow(10, Math.abs(decimals) * -1);
  const { label, description, getValue, setValue, isValid: isValid2 } = field;
  const value = getValue({ item: data }) ?? "";
  const disabled2 = field.isDisabled({ item: data, field });
  const onChangeControl = (0, import_element89.useCallback)(
    (newValue) => {
      onChange(
        setValue({
          item: data,
          // Do not convert an empty string or undefined to a number,
          // otherwise there's a mismatch between the UI control (empty)
          // and the data relied by onChange (0).
          value: ["", void 0].includes(newValue) ? void 0 : Number(newValue)
        })
      );
    },
    [data, onChange, setValue]
  );
  const onChangeBetweenControls = (0, import_element89.useCallback)(
    (newValue) => {
      onChange(
        setValue({
          item: data,
          value: newValue
        })
      );
    },
    [data, onChange, setValue]
  );
  if (operator === OPERATOR_BETWEEN) {
    let valueBetween = ["", ""];
    if (Array.isArray(value) && value.length === 2 && value.every(
      (element) => typeof element === "number" || element === ""
    )) {
      valueBetween = value;
    }
    return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
      BetweenControls,
      {
        value: valueBetween,
        onChange: onChangeBetweenControls,
        hideLabelFromVision,
        step
      }
    );
  }
  return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
    ValidatedNumberControl,
    {
      required: !!isValid2.required,
      markWhenOptional,
      customValidity: getCustomValidity(isValid2, validity),
      label,
      help: description,
      value,
      onChange: onChangeControl,
      hideLabelFromVision,
      step,
      min: typeof isValid2.min?.constraint === "number" ? isValid2.min.constraint : void 0,
      max: typeof isValid2.max?.constraint === "number" ? isValid2.max.constraint : void 0,
      disabled: disabled2
    }
  );
}

// packages/dataviews/build-module/components/dataform-controls/integer.mjs
var import_jsx_runtime124 = __toESM(require_jsx_runtime(), 1);
function Integer(props) {
  return /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(ValidatedNumber, { ...props });
}

// packages/dataviews/build-module/components/dataform-controls/number.mjs
var import_jsx_runtime125 = __toESM(require_jsx_runtime(), 1);
function Number2(props) {
  return /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(ValidatedNumber, { ...props });
}

// packages/dataviews/build-module/components/dataform-controls/radio.mjs
var import_components18 = __toESM(require_components(), 1);
var import_element90 = __toESM(require_element(), 1);
var import_jsx_runtime126 = __toESM(require_jsx_runtime(), 1);
function Radio({
  data,
  field,
  onChange,
  hideLabelFromVision,
  markWhenOptional,
  validity
}) {
  const { label, description, getValue, setValue, isValid: isValid2 } = field;
  const disabled2 = field.isDisabled({ item: data, field });
  const { elements, isLoading } = useElements({
    elements: field.elements,
    getElements: field.getElements
  });
  const value = getValue({ item: data });
  const onChangeControl = (0, import_element90.useCallback)(
    (newValue) => onChange(setValue({ item: data, value: newValue })),
    [data, onChange, setValue]
  );
  if (isLoading) {
    return /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(import_components18.Spinner, {});
  }
  return /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
    ValidatedRadioControl,
    {
      required: !!field.isValid?.required,
      markWhenOptional,
      customValidity: getCustomValidity(isValid2, validity),
      label,
      help: description,
      onChange: onChangeControl,
      options: elements,
      selected: value,
      hideLabelFromVision,
      disabled: disabled2
    }
  );
}

// packages/dataviews/build-module/components/dataform-controls/text.mjs
var import_element91 = __toESM(require_element(), 1);
var import_jsx_runtime127 = __toESM(require_jsx_runtime(), 1);
function Text3({
  data,
  field,
  onChange,
  hideLabelFromVision,
  markWhenOptional,
  config,
  validity
}) {
  const { prefix, suffix } = config || {};
  return /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
    ValidatedText,
    {
      ...{
        data,
        field,
        onChange,
        hideLabelFromVision,
        markWhenOptional,
        validity,
        prefix: prefix ? (0, import_element91.createElement)(prefix) : void 0,
        suffix: suffix ? (0, import_element91.createElement)(suffix) : void 0
      }
    }
  );
}

// packages/dataviews/build-module/components/dataform-controls/time.mjs
var import_components19 = __toESM(require_components(), 1);
var import_element92 = __toESM(require_element(), 1);
var import_i18n19 = __toESM(require_i18n(), 1);
var import_jsx_runtime128 = __toESM(require_jsx_runtime(), 1);
function getStep(timeFormat, values) {
  const tokens = (timeFormat ?? "").replace(/\\./g, "");
  const hasSeconds = tokens.includes("s") || values.some((value) => (parseTime2(value) ?? 0) % 60 !== 0);
  return hasSeconds ? 1 : void 0;
}
function toInputValue(value) {
  const seconds = parseTime2(value);
  if (seconds === null) {
    return "";
  }
  const parts = [
    Math.floor(seconds / 3600),
    Math.floor(seconds % 3600 / 60)
  ];
  if (seconds % 60 !== 0) {
    parts.push(seconds % 60);
  }
  return parts.map((part) => String(part).padStart(2, "0")).join(":");
}
function BetweenControls2({
  value,
  onChange,
  hideLabelFromVision,
  disabled: disabled2,
  step,
  min: min4,
  max: max4
}) {
  const [from = "", to = ""] = value;
  const onChangeFrom = (0, import_element92.useCallback)(
    (newValue) => onChange([newValue ?? "", to]),
    [onChange, to]
  );
  const onChangeTo = (0, import_element92.useCallback)(
    (newValue) => onChange([from, newValue ?? ""]),
    [onChange, from]
  );
  return /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
    import_components19.BaseControl,
    {
      help: (0, import_i18n19.__)("The end time must be later than the start time."),
      children: /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)(Stack, { direction: "row", gap: "sm", justify: "space-between", children: [
        /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
          ValidatedInputControl,
          {
            type: "time",
            label: (0, import_i18n19.__)("From"),
            value: from,
            onValueChange: onChangeFrom,
            hideLabelFromVision,
            disabled: disabled2,
            step,
            min: min4,
            max: to || max4
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
          ValidatedInputControl,
          {
            type: "time",
            label: (0, import_i18n19.__)("To"),
            value: to,
            onValueChange: onChangeTo,
            hideLabelFromVision,
            disabled: disabled2,
            step,
            min: from || min4,
            max: max4
          }
        )
      ] })
    }
  );
}
function Time({
  data,
  field,
  onChange,
  hideLabelFromVision,
  markWhenOptional,
  operator,
  validity
}) {
  const { label, placeholder, description, getValue, setValue, isValid: isValid2 } = field;
  const value = getValue({ item: data });
  const disabled2 = field.isDisabled({ item: data, field });
  const timeFormat = field.format?.time;
  const min4 = typeof isValid2.min?.constraint === "string" ? isValid2.min.constraint : void 0;
  const max4 = typeof isValid2.max?.constraint === "string" ? isValid2.max.constraint : void 0;
  const onChangeControl = (0, import_element92.useCallback)(
    (newValue) => onChange(
      setValue({
        item: data,
        value: newValue === "" ? void 0 : newValue
      })
    ),
    [data, onChange, setValue]
  );
  const onChangeBetweenControls = (0, import_element92.useCallback)(
    ([from, to]) => onChange(
      setValue({
        item: data,
        // An unfilled bound is stored as `undefined`, which the
        // `between` operator reads as "do not apply the filter".
        value: [from || void 0, to || void 0]
      })
    ),
    [data, onChange, setValue]
  );
  if (operator === OPERATOR_BETWEEN) {
    let valueBetween = ["", ""];
    if (Array.isArray(value) && value.length === 2) {
      valueBetween = [
        toInputValue(value[0]),
        toInputValue(value[1])
      ];
    }
    return /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
      BetweenControls2,
      {
        value: valueBetween,
        onChange: onChangeBetweenControls,
        hideLabelFromVision,
        disabled: disabled2,
        step: getStep(timeFormat, valueBetween),
        min: min4,
        max: max4
      }
    );
  }
  return /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
    ValidatedInputControl,
    {
      required: !!isValid2.required,
      markWhenOptional,
      customValidity: getCustomValidity(isValid2, validity),
      type: "time",
      label,
      placeholder,
      description: typeof description === "string" ? description : void 0,
      details: typeof description === "string" ? void 0 : description,
      value: toInputValue(value),
      onValueChange: onChangeControl,
      hideLabelFromVision,
      disabled: disabled2,
      step: getStep(timeFormat, [value]),
      min: min4,
      max: max4
    }
  );
}

// packages/dataviews/build-module/components/dataform-controls/toggle.mjs
var import_element93 = __toESM(require_element(), 1);
var import_jsx_runtime129 = __toESM(require_jsx_runtime(), 1);
function Toggle({
  field,
  onChange,
  data,
  hideLabelFromVision,
  markWhenOptional,
  validity
}) {
  const { label, description, getValue, setValue, isValid: isValid2 } = field;
  const disabled2 = field.isDisabled({ item: data, field });
  const onChangeControl = (0, import_element93.useCallback)(() => {
    onChange(
      setValue({ item: data, value: !getValue({ item: data }) })
    );
  }, [onChange, setValue, data, getValue]);
  return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
    ValidatedToggleControl,
    {
      required: !!isValid2.required,
      markWhenOptional,
      customValidity: getCustomValidity(isValid2, validity),
      hidden: hideLabelFromVision,
      label,
      help: description,
      checked: getValue({ item: data }),
      onChange: onChangeControl,
      disabled: disabled2
    }
  );
}

// packages/dataviews/build-module/components/dataform-controls/textarea.mjs
var import_element94 = __toESM(require_element(), 1);
var import_jsx_runtime130 = __toESM(require_jsx_runtime(), 1);
function Textarea3({
  data,
  field,
  onChange,
  hideLabelFromVision,
  markWhenOptional,
  config,
  validity
}) {
  const { rows = 4 } = config || {};
  const disabled2 = field.isDisabled({ item: data, field });
  const { label, placeholder, description, setValue, isValid: isValid2 } = field;
  const value = field.getValue({ item: data });
  const onValueChangeControl = (0, import_element94.useCallback)(
    (newValue) => onChange(setValue({ item: data, value: newValue })),
    [data, onChange, setValue]
  );
  return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
    ValidatedTextareaControl,
    {
      required: !!isValid2.required,
      markWhenOptional,
      customValidity: getCustomValidity(isValid2, validity),
      label,
      placeholder,
      value: value ?? "",
      description: typeof description === "string" ? description : void 0,
      details: typeof description === "string" ? void 0 : description,
      onValueChange: onValueChangeControl,
      rows,
      disabled: disabled2,
      minLength: isValid2.minLength ? isValid2.minLength.constraint : void 0,
      maxLength: isValid2.maxLength ? isValid2.maxLength.constraint : void 0,
      hideLabelFromVision
    }
  );
}

// packages/dataviews/build-module/components/dataform-controls/toggle-group.mjs
var import_components20 = __toESM(require_components(), 1);
var import_element95 = __toESM(require_element(), 1);
var import_jsx_runtime131 = __toESM(require_jsx_runtime(), 1);
function ToggleGroup({
  data,
  field,
  onChange,
  hideLabelFromVision,
  markWhenOptional,
  validity
}) {
  const { getValue, setValue, isValid: isValid2 } = field;
  const disabled2 = field.isDisabled({ item: data, field });
  const value = getValue({ item: data });
  const onChangeControl = (0, import_element95.useCallback)(
    (newValue) => onChange(setValue({ item: data, value: newValue })),
    [data, onChange, setValue]
  );
  const { elements, isLoading } = useElements({
    elements: field.elements,
    getElements: field.getElements
  });
  if (isLoading) {
    return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_components20.Spinner, {});
  }
  if (elements.length === 0) {
    return null;
  }
  const selectedOption = elements.find((el) => el.value === value);
  return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
    ValidatedToggleGroupControl,
    {
      required: !!field.isValid?.required,
      markWhenOptional,
      customValidity: getCustomValidity(isValid2, validity),
      isBlock: true,
      label: field.label,
      help: selectedOption?.description || field.description,
      onChange: onChangeControl,
      value,
      hideLabelFromVision,
      children: elements.map((el) => /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
        import_components20.__experimentalToggleGroupControlOption,
        {
          label: el.label,
          value: el.value,
          disabled: disabled2
        },
        el.value
      ))
    }
  );
}

// packages/dataviews/build-module/components/dataform-controls/array.mjs
var import_components21 = __toESM(require_components(), 1);
var import_element96 = __toESM(require_element(), 1);
var import_jsx_runtime132 = __toESM(require_jsx_runtime(), 1);
function ArrayControl({
  data,
  field,
  onChange,
  hideLabelFromVision,
  markWhenOptional,
  validity
}) {
  const { label, placeholder, description, getValue, setValue, isValid: isValid2 } = field;
  const value = getValue({ item: data });
  const disabled2 = field.isDisabled({ item: data, field });
  const { elements, isLoading } = useElements({
    elements: field.elements,
    getElements: field.getElements
  });
  const arrayValueAsElements = (0, import_element96.useMemo)(
    () => Array.isArray(value) ? value.map((token) => {
      const element = elements?.find(
        (suggestion) => suggestion.value === token
      );
      return element || { value: token, label: token };
    }) : [],
    [value, elements]
  );
  const onChangeControl = (0, import_element96.useCallback)(
    (tokens) => {
      const valueTokens = tokens.map((token) => {
        if (typeof token === "object" && "value" in token) {
          return token.value;
        }
        return token;
      });
      onChange(setValue({ item: data, value: valueTokens }));
    },
    [onChange, setValue, data]
  );
  if (isLoading) {
    return /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(import_components21.Spinner, {});
  }
  return /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
    ValidatedFormTokenField,
    {
      required: !!isValid2?.required,
      markWhenOptional,
      customValidity: getCustomValidity(isValid2, validity),
      label: hideLabelFromVision ? void 0 : label,
      value: arrayValueAsElements,
      onChange: onChangeControl,
      placeholder,
      suggestions: elements?.map((element) => element.value),
      disabled: disabled2,
      __experimentalValidateInput: (token) => {
        if (field.isValid?.elements && elements) {
          return elements.some(
            (element) => element.value === token || element.label === token
          );
        }
        return true;
      },
      __experimentalExpandOnFocus: elements && elements.length > 0,
      help: description ?? (field.isValid?.elements ? "" : void 0),
      displayTransform: (token) => {
        if (typeof token === "object" && "label" in token) {
          return token.label;
        }
        if (typeof token === "string" && elements) {
          const element = elements.find(
            (el) => el.value === token
          );
          return element?.label || token;
        }
        return token;
      },
      __experimentalRenderItem: ({ item }) => {
        if (typeof item === "string" && elements) {
          const element = elements.find(
            (el) => el.value === item
          );
          return /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("span", { children: element?.label || item });
        }
        return /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("span", { children: item });
      }
    }
  );
}

// node_modules/colord/index.mjs
for (r2 = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, t = function(r3) {
  return "string" == typeof r3 ? r3.length > 0 : "number" == typeof r3;
}, n = function(r3, t2, n2) {
  return void 0 === t2 && (t2 = 0), void 0 === n2 && (n2 = Math.pow(10, t2)), Math.round(n2 * r3) / n2 + 0;
}, u = function(r3, t2, n2) {
  return void 0 === t2 && (t2 = 0), void 0 === n2 && (n2 = 1), r3 > n2 ? n2 : r3 > t2 ? r3 : t2;
}, e = function(r3) {
  return (r3 = isFinite(r3) ? r3 % 360 : 0) < 0 ? r3 + 360 : r3;
}, o = function(r3, t2) {
  return void 0 === t2 && (t2 = 0), n(r3, t2) % 360;
}, a = function(r3) {
  return { r: u(r3.r, 0, 255), g: u(r3.g, 0, 255), b: u(r3.b, 0, 255), a: u(r3.a) };
}, i = function(r3) {
  return { r: n(r3.r), g: n(r3.g), b: n(r3.b), a: n(r3.a, 3) };
}, s = /^#([0-9a-f]{3,8})$/i, d = function(r3, t2) {
  var n2 = r3.charCodeAt(t2);
  return (15 & n2) + 9 * (n2 >> 6);
}, h = function(r3, t2) {
  return d(r3, t2) << 4 | d(r3, t2 + 1);
}, b = [], f = 0; f < 256; f++) b.push((f < 16 ? "0" : "") + f.toString(16));
var r2;
var t;
var n;
var u;
var e;
var o;
var a;
var i;
var s;
var d;
var h;
var b;
var f;
var g = function(r2) {
  return b[u(r2, 0, 255)];
};
var c = function(r2) {
  var t = r2.r, n = r2.g, u = r2.b, e = r2.a, o = Math.max(t, n, u), a = o - Math.min(t, n, u), i = a ? o === t ? (n - u) / a : o === n ? 2 + (u - t) / a : 4 + (t - n) / a : 0;
  return { h: 60 * (i < 0 ? i + 6 : i), s: o ? a / o * 100 : 0, v: o / 255 * 100, a: e };
};
var v = function(r2) {
  var t = r2.h, n = r2.s, u = r2.v, e = r2.a;
  t = t / 360 * 6, n /= 100, u /= 100;
  var o = Math.floor(t), a = u * (1 - n), i = u * (1 - (t - o) * n), s = u * (1 - (1 - t + o) * n), d = o % 6;
  return { r: 255 * [u, i, a, a, s, u][d], g: 255 * [s, u, u, i, a, a][d], b: 255 * [a, a, s, u, u, i][d], a: e };
};
var l = function(r2) {
  return { h: e(r2.h), s: u(r2.s, 0, 100), l: u(r2.l, 0, 100), a: u(r2.a) };
};
var p = function(r2) {
  return { h: o(r2.h), s: n(r2.s), l: n(r2.l), a: n(r2.a, 3) };
};
var m = function(r2) {
  return v((n = (t = r2).s, { h: t.h, s: (n *= ((u = t.l) < 50 ? u : 100 - u) / 100) > 0 ? 2 * n / (u + n) * 100 : 0, v: u + n, a: t.a }));
  var t, n, u;
};
var y = function(r2) {
  return { h: (t = c(r2)).h, s: (e = (200 - (n = t.s)) * (u = t.v) / 100) > 0 && e < 200 ? n * u / 100 / (e <= 100 ? e : 200 - e) * 100 : 0, l: e / 2, a: t.a };
  var t, n, u, e;
};
var N = /^hsla?\(\s*([+-]?(?:\d*\.\d+|\d+))(deg|rad|grad|turn)?\s*,\s*([+-]?(?:\d*\.\d+|\d+))%\s*,\s*([+-]?(?:\d*\.\d+|\d+))%\s*(?:,\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*)?\)$/i;
var x = /^hsla?\(\s*([+-]?(?:\d*\.\d+|\d+))(deg|rad|grad|turn)?\s+([+-]?(?:\d*\.\d+|\d+))%\s+([+-]?(?:\d*\.\d+|\d+))%\s*(?:\/\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*)?\)$/i;
var M = /^rgba?\(\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*,\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*,\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*(?:,\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*)?\)$/i;
var H = /^rgba?\(\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s+([+-]?(?:\d*\.\d+|\d+))(%)?\s+([+-]?(?:\d*\.\d+|\d+))(%)?\s*(?:\/\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*)?\)$/i;
var $ = { string: [[function(r2) {
  if (!s.test(r2)) return null;
  var t = r2.length;
  return t <= 5 ? { r: 17 * d(r2, 1), g: 17 * d(r2, 2), b: 17 * d(r2, 3), a: 5 === t ? n(17 * d(r2, 4) / 255, 2) : 1 } : 7 === t || 9 === t ? { r: h(r2, 1), g: h(r2, 3), b: h(r2, 5), a: 9 === t ? n(h(r2, 7) / 255, 2) : 1 } : null;
}, "hex"], [function(r2) {
  var t = M.exec(r2) || H.exec(r2);
  return t ? t[2] !== t[4] || t[4] !== t[6] ? null : a({ r: Number(t[1]) / (t[2] ? 100 / 255 : 1), g: Number(t[3]) / (t[4] ? 100 / 255 : 1), b: Number(t[5]) / (t[6] ? 100 / 255 : 1), a: void 0 === t[7] ? 1 : Number(t[7]) / (t[8] ? 100 : 1) }) : null;
}, "rgb"], [function(t) {
  var n = N.exec(t) || x.exec(t);
  if (!n) return null;
  var u, e, o = l({ h: (u = n[1], e = n[2], void 0 === e && (e = "deg"), Number(u) * (r2[e] || 1)), s: Number(n[3]), l: Number(n[4]), a: void 0 === n[5] ? 1 : Number(n[5]) / (n[6] ? 100 : 1) });
  return m(o);
}, "hsl"]], object: [[function(r2) {
  var n = r2.r, u = r2.g, e = r2.b, o = r2.a, i = void 0 === o ? 1 : o;
  return t(n) && t(u) && t(e) ? a({ r: Number(n), g: Number(u), b: Number(e), a: Number(i) }) : null;
}, "rgb"], [function(r2) {
  var n = r2.h, u = r2.s, e = r2.l, o = r2.a, a = void 0 === o ? 1 : o;
  if (!t(n) || !t(u) || !t(e)) return null;
  var i = l({ h: Number(n), s: Number(u), l: Number(e), a: Number(a) });
  return m(i);
}, "hsl"], [function(r2) {
  var n = r2.h, o = r2.s, a = r2.v, i = r2.a, s = void 0 === i ? 1 : i;
  if (!t(n) || !t(o) || !t(a)) return null;
  var d = (function(r3) {
    return { h: e(r3.h), s: u(r3.s, 0, 100), v: u(r3.v, 0, 100), a: u(r3.a) };
  })({ h: Number(n), s: Number(o), v: Number(a), a: Number(s) });
  return v(d);
}, "hsv"]] };
var j = function(r2, t) {
  for (var n = 0; n < t.length; n++) {
    var u = t[n][0](r2);
    if (u) return [u, t[n][1]];
  }
  return [null, void 0];
};
var w = function(r2) {
  return "string" == typeof r2 ? j(r2.trim(), $.string) : "object" == typeof r2 && null !== r2 ? j(r2, $.object) : [null, void 0];
};
var k = function(r2, t) {
  var n = y(r2);
  return { h: n.h, s: u(n.s + 100 * t, 0, 100), l: n.l, a: n.a };
};
var E = function(r2) {
  return (299 * r2.r + 587 * r2.g + 114 * r2.b) / 1e3 / 255;
};
var R = function(r2, t) {
  var n = y(r2);
  return { h: n.h, s: n.s, l: u(n.l + 100 * t, 0, 100), a: n.a };
};
var q = (function() {
  function r2(r3) {
    this.parsed = w(r3)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 };
  }
  return r2.prototype.isValid = function() {
    return null !== this.parsed;
  }, r2.prototype.brightness = function() {
    return n(E(this.rgba), 2);
  }, r2.prototype.isDark = function() {
    return E(this.rgba) < 0.5;
  }, r2.prototype.isLight = function() {
    return E(this.rgba) >= 0.5;
  }, r2.prototype.toHex = function() {
    return r3 = i(this.rgba), t = r3.r, u = r3.g, e = r3.b, a = (o = r3.a) < 1 ? g(n(255 * o)) : "", "#" + g(t) + g(u) + g(e) + a;
    var r3, t, u, e, o, a;
  }, r2.prototype.toRgb = function() {
    return i(this.rgba);
  }, r2.prototype.toRgbString = function() {
    return r3 = i(this.rgba), t = r3.r, n = r3.g, u = r3.b, (e = r3.a) < 1 ? "rgba(" + t + ", " + n + ", " + u + ", " + e + ")" : "rgb(" + t + ", " + n + ", " + u + ")";
    var r3, t, n, u, e;
  }, r2.prototype.toHsl = function() {
    return p(y(this.rgba));
  }, r2.prototype.toHslString = function() {
    return r3 = p(y(this.rgba)), t = r3.h, n = r3.s, u = r3.l, (e = r3.a) < 1 ? "hsla(" + t + ", " + n + "%, " + u + "%, " + e + ")" : "hsl(" + t + ", " + n + "%, " + u + "%)";
    var r3, t, n, u, e;
  }, r2.prototype.toHsv = function() {
    return r3 = c(this.rgba), { h: o(r3.h), s: n(r3.s), v: n(r3.v), a: n(r3.a, 3) };
    var r3;
  }, r2.prototype.invert = function() {
    return A({ r: 255 - (r3 = this.rgba).r, g: 255 - r3.g, b: 255 - r3.b, a: r3.a });
    var r3;
  }, r2.prototype.saturate = function(r3) {
    return void 0 === r3 && (r3 = 0.1), A(k(this.rgba, r3));
  }, r2.prototype.desaturate = function(r3) {
    return void 0 === r3 && (r3 = 0.1), A(k(this.rgba, -r3));
  }, r2.prototype.grayscale = function() {
    return A(k(this.rgba, -1));
  }, r2.prototype.lighten = function(r3) {
    return void 0 === r3 && (r3 = 0.1), A(R(this.rgba, r3));
  }, r2.prototype.darken = function(r3) {
    return void 0 === r3 && (r3 = 0.1), A(R(this.rgba, -r3));
  }, r2.prototype.rotate = function(r3) {
    return void 0 === r3 && (r3 = 15), this.hue(y(this.rgba).h + r3);
  }, r2.prototype.alpha = function(r3) {
    return "number" == typeof r3 ? A({ r: (t = this.rgba).r, g: t.g, b: t.b, a: r3 }) : n(this.rgba.a, 3);
    var t;
  }, r2.prototype.hue = function(r3) {
    var t = y(this.rgba);
    return "number" == typeof r3 ? A({ h: r3, s: t.s, l: t.l, a: t.a }) : o(t.h);
  }, r2.prototype.isEqual = function(r3) {
    return this.toHex() === A(r3).toHex();
  }, r2;
})();
var A = function(r2) {
  return r2 instanceof q ? r2 : new q(r2);
};

// packages/dataviews/build-module/components/dataform-controls/color.mjs
var import_components22 = __toESM(require_components(), 1);
var import_element97 = __toESM(require_element(), 1);
var import_i18n20 = __toESM(require_i18n(), 1);
var import_jsx_runtime133 = __toESM(require_jsx_runtime(), 1);
var ColorPickerDropdown = ({
  color,
  onColorChange,
  disabled: disabled2
}) => {
  const validColor = color && A(color).isValid() ? color : "#ffffff";
  return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
    import_components22.Dropdown,
    {
      className: "dataviews-controls__color-picker-dropdown",
      popoverProps: { resize: false },
      renderToggle: ({ onToggle }) => /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
        import_components22.Button,
        {
          onClick: onToggle,
          "aria-label": (0, import_i18n20.__)("Open color picker"),
          size: "small",
          disabled: disabled2,
          accessibleWhenDisabled: true,
          icon: () => /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_components22.ColorIndicator, { colorValue: validColor })
        }
      ),
      renderContent: () => /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_components22.__experimentalDropdownContentWrapper, { paddingSize: "none", children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
        import_components22.ColorPicker,
        {
          color: validColor,
          onChange: onColorChange,
          enableAlpha: true
        }
      ) })
    }
  );
};
function Color({
  data,
  field,
  onChange,
  hideLabelFromVision,
  markWhenOptional,
  validity
}) {
  const { label, placeholder, description, setValue, isValid: isValid2 } = field;
  const disabled2 = field.isDisabled({ item: data, field });
  const value = field.getValue({ item: data }) || "";
  const handleColorChange = (0, import_element97.useCallback)(
    (newColor) => {
      onChange(setValue({ item: data, value: newColor }));
    },
    [data, onChange, setValue]
  );
  const handleInputChange = (0, import_element97.useCallback)(
    (newValue) => {
      onChange(setValue({ item: data, value: newValue || "" }));
    },
    [data, onChange, setValue]
  );
  return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
    ValidatedInputControl,
    {
      required: !!field.isValid?.required,
      markWhenOptional,
      customValidity: getCustomValidity(isValid2, validity),
      label,
      placeholder,
      value,
      description: typeof description === "string" ? description : void 0,
      details: typeof description === "string" ? void 0 : description,
      onValueChange: handleInputChange,
      hideLabelFromVision,
      type: "text",
      disabled: disabled2,
      prefix: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(InputLayout3.Slot, { padding: "minimal", children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
        ColorPickerDropdown,
        {
          color: value,
          onColorChange: handleColorChange,
          disabled: disabled2
        }
      ) })
    }
  );
}

// packages/dataviews/build-module/components/dataform-controls/password.mjs
var import_components23 = __toESM(require_components(), 1);
var import_element98 = __toESM(require_element(), 1);
var import_i18n21 = __toESM(require_i18n(), 1);
var import_jsx_runtime134 = __toESM(require_jsx_runtime(), 1);
function Password({
  data,
  field,
  onChange,
  hideLabelFromVision,
  markWhenOptional,
  validity
}) {
  const [isVisible, setIsVisible] = (0, import_element98.useState)(false);
  const disabled2 = field.isDisabled({ item: data, field });
  const toggleVisibility = (0, import_element98.useCallback)(() => {
    setIsVisible((prev) => !prev);
  }, []);
  return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
    ValidatedText,
    {
      ...{
        data,
        field,
        onChange,
        hideLabelFromVision,
        markWhenOptional,
        validity,
        type: isVisible ? "text" : "password",
        suffix: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(InputLayout3.Slot, { padding: "minimal", children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
          import_components23.Button,
          {
            icon: isVisible ? unseen_default : seen_default,
            onClick: toggleVisibility,
            size: "small",
            label: isVisible ? (0, import_i18n21.__)("Hide password") : (0, import_i18n21.__)("Show password"),
            disabled: disabled2,
            accessibleWhenDisabled: true
          }
        ) })
      }
    }
  );
}

// packages/dataviews/build-module/field-types/utils/has-elements.mjs
function hasElements(field) {
  return Array.isArray(field.elements) && field.elements.length > 0 || typeof field.getElements === "function";
}

// packages/dataviews/build-module/components/dataform-controls/index.mjs
var import_jsx_runtime135 = __toESM(require_jsx_runtime(), 1);
var FORM_CONTROLS = {
  adaptiveSelect: AdaptiveSelect,
  array: ArrayControl,
  checkbox: Checkbox,
  color: Color,
  combobox: Combobox,
  datetime: DateTime,
  date: DateControl,
  email: Email,
  telephone: Telephone,
  url: Url,
  integer: Integer,
  number: Number2,
  password: Password,
  radio: Radio,
  select: Select2,
  text: Text3,
  time: Time,
  toggle: Toggle,
  textarea: Textarea3,
  toggleGroup: ToggleGroup
};
function isEditConfig(value) {
  return value && typeof value === "object" && typeof value.control === "string";
}
function createConfiguredControl(config) {
  const { control, ...controlConfig } = config;
  const BaseControlType = getControlByType(control);
  if (BaseControlType === null) {
    return null;
  }
  return function ConfiguredControl(props) {
    return /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(BaseControlType, { ...props, config: controlConfig });
  };
}
function getControl(field, fallback) {
  if (typeof field.Edit === "function") {
    return field.Edit;
  }
  if (typeof field.Edit === "string") {
    return getControlByType(field.Edit);
  }
  if (isEditConfig(field.Edit)) {
    return createConfiguredControl(field.Edit);
  }
  if (hasElements(field) && field.type !== "array") {
    return getControlByType("adaptiveSelect");
  }
  if (fallback === null) {
    return null;
  }
  return getControlByType(fallback);
}
function getControlByType(type) {
  if (Object.keys(FORM_CONTROLS).includes(type)) {
    return FORM_CONTROLS[type];
  }
  return null;
}

// packages/dataviews/build-module/field-types/utils/get-filter-by.mjs
function getFilterBy(field, defaultOperators, validOperators) {
  if (field.filterBy === false) {
    return false;
  }
  const operators = field.filterBy?.operators?.filter(
    (op) => validOperators.includes(op)
  ) ?? defaultOperators;
  if (operators.length === 0) {
    return false;
  }
  return {
    isPrimary: !!field.filterBy?.isPrimary,
    operators
  };
}
var get_filter_by_default = getFilterBy;

// packages/dataviews/build-module/field-types/utils/get-value-from-id.mjs
var getValueFromId = (id) => ({ item }) => {
  const path = id.split(".");
  let value = item;
  for (const segment of path) {
    if (value.hasOwnProperty(segment)) {
      value = value[segment];
    } else {
      value = void 0;
    }
  }
  return value;
};
var get_value_from_id_default = getValueFromId;

// packages/dataviews/build-module/field-types/utils/set-value-from-id.mjs
var setValueFromId = (id) => ({ value }) => {
  const path = id.split(".");
  const result = {};
  let current = result;
  for (const segment of path.slice(0, -1)) {
    current[segment] = {};
    current = current[segment];
  }
  current[path.at(-1)] = value;
  return result;
};
var set_value_from_id_default = setValueFromId;

// packages/dataviews/build-module/field-types/email.mjs
var import_i18n22 = __toESM(require_i18n(), 1);

// packages/dataviews/build-module/field-types/utils/render-from-elements.mjs
function RenderFromElements({
  item,
  field
}) {
  const { elements, isLoading } = useElements({
    elements: field.elements,
    getElements: field.getElements
  });
  const value = field.getValue({ item });
  if (isLoading) {
    return value;
  }
  if (elements.length === 0) {
    return value;
  }
  return elements?.find((element) => element.value === value)?.label || field.getValue({ item });
}

// packages/dataviews/build-module/field-types/utils/render-default.mjs
var import_jsx_runtime136 = __toESM(require_jsx_runtime(), 1);
function render({
  item,
  field
}) {
  if (field.hasElements) {
    return /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(RenderFromElements, { item, field });
  }
  return field.getValueFormatted({ item, field });
}

// packages/dataviews/build-module/field-types/utils/sort-text.mjs
var sort_text_default = (a, b, direction) => {
  return direction === "asc" ? a.localeCompare(b) : b.localeCompare(a);
};

// packages/dataviews/build-module/field-types/utils/is-valid-required.mjs
function isValidRequired(item, field) {
  const value = field.getValue({ item });
  return ![void 0, "", null].includes(value);
}

// packages/dataviews/build-module/field-types/utils/is-valid-min-length.mjs
function isValidMinLength(item, field) {
  if (typeof field.isValid.minLength?.constraint !== "number") {
    return false;
  }
  const value = field.getValue({ item });
  if ([void 0, "", null].includes(value)) {
    return true;
  }
  return String(value).length >= field.isValid.minLength.constraint;
}

// packages/dataviews/build-module/field-types/utils/is-valid-max-length.mjs
function isValidMaxLength(item, field) {
  if (typeof field.isValid.maxLength?.constraint !== "number") {
    return false;
  }
  const value = field.getValue({ item });
  if ([void 0, "", null].includes(value)) {
    return true;
  }
  return String(value).length <= field.isValid.maxLength.constraint;
}

// packages/dataviews/build-module/field-types/utils/is-valid-pattern.mjs
function isValidPattern(item, field) {
  if (field.isValid.pattern?.constraint === void 0) {
    return true;
  }
  try {
    const regexp = new RegExp(field.isValid.pattern.constraint);
    const value = field.getValue({ item });
    if ([void 0, "", null].includes(value)) {
      return true;
    }
    return regexp.test(String(value));
  } catch {
    return false;
  }
}

// packages/dataviews/build-module/field-types/utils/is-valid-elements.mjs
function isValidElements(item, field) {
  const elements = field.elements ?? [];
  const validValues = elements.map((el) => el.value);
  if (validValues.length === 0) {
    return true;
  }
  const value = field.getValue({ item });
  return [].concat(value).every((v2) => validValues.includes(v2));
}

// packages/dataviews/build-module/field-types/utils/get-value-formatted-default.mjs
function getValueFormatted({
  item,
  field
}) {
  return field.getValue({ item });
}
var get_value_formatted_default_default = getValueFormatted;

// packages/dataviews/build-module/field-types/email.mjs
var emailRegex = /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
function isValidCustom(item, field) {
  const value = field.getValue({ item });
  if (![void 0, "", null].includes(value) && !emailRegex.test(value)) {
    return (0, import_i18n22.__)("Value must be a valid email address.");
  }
  return null;
}
var email_default = {
  type: "email",
  render,
  Edit: "email",
  sort: sort_text_default,
  enableSorting: true,
  enableGlobalSearch: false,
  defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE],
  validOperators: [
    OPERATOR_IS,
    OPERATOR_IS_NOT,
    OPERATOR_CONTAINS,
    OPERATOR_NOT_CONTAINS,
    OPERATOR_STARTS_WITH,
    // Multiple selection
    OPERATOR_IS_ANY,
    OPERATOR_IS_NONE,
    OPERATOR_IS_NOT_ALL
  ],
  format: {},
  getValueFormatted: get_value_formatted_default_default,
  validate: {
    required: isValidRequired,
    pattern: isValidPattern,
    minLength: isValidMinLength,
    maxLength: isValidMaxLength,
    elements: isValidElements,
    custom: isValidCustom
  }
};

// packages/dataviews/build-module/field-types/integer.mjs
var import_i18n23 = __toESM(require_i18n(), 1);

// packages/dataviews/build-module/field-types/utils/sort-number.mjs
var sort_number_default = (a, b, direction) => {
  return direction === "asc" ? a - b : b - a;
};

// packages/dataviews/build-module/field-types/utils/is-valid-min.mjs
function isValidMin(item, field) {
  if (typeof field.isValid.min?.constraint !== "number") {
    return false;
  }
  const value = field.getValue({ item });
  if ([void 0, "", null].includes(value)) {
    return true;
  }
  return Number(value) >= field.isValid.min.constraint;
}

// packages/dataviews/build-module/field-types/utils/is-valid-max.mjs
function isValidMax(item, field) {
  if (typeof field.isValid.max?.constraint !== "number") {
    return false;
  }
  const value = field.getValue({ item });
  if ([void 0, "", null].includes(value)) {
    return true;
  }
  return Number(value) <= field.isValid.max.constraint;
}

// packages/dataviews/build-module/field-types/integer.mjs
var format2 = {
  separatorThousand: ","
};
function getValueFormatted2({
  item,
  field
}) {
  let value = field.getValue({ item });
  if (value === null || value === void 0) {
    return "";
  }
  value = Number(value);
  if (!Number.isFinite(value)) {
    return String(value);
  }
  let formatInteger;
  if (field.type !== "integer") {
    formatInteger = format2;
  } else {
    formatInteger = field.format;
  }
  const { separatorThousand } = formatInteger;
  const integerValue = Math.trunc(value);
  if (!separatorThousand) {
    return String(integerValue);
  }
  return String(integerValue).replace(
    /\B(?=(\d{3})+(?!\d))/g,
    separatorThousand
  );
}
function isValidCustom2(item, field) {
  const value = field.getValue({ item });
  if (![void 0, "", null].includes(value) && !Number.isInteger(value)) {
    return (0, import_i18n23.__)("Value must be an integer.");
  }
  return null;
}
var integer_default = {
  type: "integer",
  render,
  Edit: "integer",
  sort: sort_number_default,
  enableSorting: true,
  enableGlobalSearch: false,
  defaultOperators: [
    OPERATOR_IS,
    OPERATOR_IS_NOT,
    OPERATOR_LESS_THAN,
    OPERATOR_GREATER_THAN,
    OPERATOR_LESS_THAN_OR_EQUAL,
    OPERATOR_GREATER_THAN_OR_EQUAL,
    OPERATOR_BETWEEN
  ],
  validOperators: [
    // Single-selection
    OPERATOR_IS,
    OPERATOR_IS_NOT,
    OPERATOR_LESS_THAN,
    OPERATOR_GREATER_THAN,
    OPERATOR_LESS_THAN_OR_EQUAL,
    OPERATOR_GREATER_THAN_OR_EQUAL,
    OPERATOR_BETWEEN,
    // Multiple-selection
    OPERATOR_IS_ANY,
    OPERATOR_IS_NONE,
    OPERATOR_IS_NOT_ALL
  ],
  format: format2,
  getValueFormatted: getValueFormatted2,
  validate: {
    required: isValidRequired,
    min: isValidMin,
    max: isValidMax,
    elements: isValidElements,
    custom: isValidCustom2
  }
};

// packages/dataviews/build-module/field-types/number.mjs
var import_i18n24 = __toESM(require_i18n(), 1);
var format3 = {
  separatorThousand: ",",
  separatorDecimal: ".",
  decimals: 2
};
function getValueFormatted3({
  item,
  field
}) {
  let value = field.getValue({ item });
  if (value === null || value === void 0) {
    return "";
  }
  value = Number(value);
  if (!Number.isFinite(value)) {
    return String(value);
  }
  let formatNumber;
  if (field.type !== "number") {
    formatNumber = format3;
  } else {
    formatNumber = field.format;
  }
  const { separatorThousand, separatorDecimal, decimals } = formatNumber;
  const fixedValue = value.toFixed(decimals);
  const [integerPart, decimalPart] = fixedValue.split(".");
  const formattedInteger = separatorThousand ? integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, separatorThousand) : integerPart;
  return decimals === 0 ? formattedInteger : formattedInteger + separatorDecimal + decimalPart;
}
function isEmpty(value) {
  return value === "" || value === void 0 || value === null;
}
function isValidCustom3(item, field) {
  const value = field.getValue({ item });
  if (!isEmpty(value) && !Number.isFinite(value)) {
    return (0, import_i18n24.__)("Value must be a number.");
  }
  return null;
}
var number_default = {
  type: "number",
  render,
  Edit: "number",
  sort: sort_number_default,
  enableSorting: true,
  enableGlobalSearch: false,
  defaultOperators: [
    OPERATOR_IS,
    OPERATOR_IS_NOT,
    OPERATOR_LESS_THAN,
    OPERATOR_GREATER_THAN,
    OPERATOR_LESS_THAN_OR_EQUAL,
    OPERATOR_GREATER_THAN_OR_EQUAL,
    OPERATOR_BETWEEN
  ],
  validOperators: [
    // Single-selection
    OPERATOR_IS,
    OPERATOR_IS_NOT,
    OPERATOR_LESS_THAN,
    OPERATOR_GREATER_THAN,
    OPERATOR_LESS_THAN_OR_EQUAL,
    OPERATOR_GREATER_THAN_OR_EQUAL,
    OPERATOR_BETWEEN,
    // Multiple-selection
    OPERATOR_IS_ANY,
    OPERATOR_IS_NONE,
    OPERATOR_IS_NOT_ALL
  ],
  format: format3,
  getValueFormatted: getValueFormatted3,
  validate: {
    required: isValidRequired,
    min: isValidMin,
    max: isValidMax,
    elements: isValidElements,
    custom: isValidCustom3
  }
};

// packages/dataviews/build-module/field-types/text.mjs
var text_default = {
  type: "text",
  render,
  Edit: "text",
  sort: sort_text_default,
  enableSorting: true,
  enableGlobalSearch: false,
  defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE],
  validOperators: [
    // Single selection
    OPERATOR_IS,
    OPERATOR_IS_NOT,
    OPERATOR_CONTAINS,
    OPERATOR_NOT_CONTAINS,
    OPERATOR_STARTS_WITH,
    // Multiple selection
    OPERATOR_IS_ANY,
    OPERATOR_IS_NONE,
    OPERATOR_IS_NOT_ALL
  ],
  format: {},
  getValueFormatted: get_value_formatted_default_default,
  validate: {
    required: isValidRequired,
    pattern: isValidPattern,
    minLength: isValidMinLength,
    maxLength: isValidMaxLength,
    elements: isValidElements
  }
};

// packages/dataviews/build-module/field-types/datetime.mjs
var import_date9 = __toESM(require_date(), 1);

// packages/dataviews/build-module/field-types/utils/is-valid-boundary.mjs
var import_date8 = __toESM(require_date(), 1);
function parseDateLike(value) {
  if (!isValid(new Date(value))) {
    return null;
  }
  const parsed = (0, import_date8.getDate)(value);
  return parsed && isValid(parsed) ? parsed.getTime() : null;
}
function validateBoundary(item, field, boundary, parse2) {
  const constraint = field.isValid[boundary]?.constraint;
  if (typeof constraint !== "string") {
    return false;
  }
  const value = field.getValue({ item });
  const boundaryValue = Array.isArray(value) ? value[boundary === "min" ? 0 : value.length - 1] : value;
  if (boundaryValue === void 0 || boundaryValue === null || boundaryValue === "") {
    return true;
  }
  const parsedConstraint = parse2(constraint);
  const parsedValue = parse2(String(boundaryValue));
  if (parsedConstraint === null || parsedValue === null) {
    return false;
  }
  return boundary === "min" ? parsedValue >= parsedConstraint : parsedValue <= parsedConstraint;
}
function isValidMinDate(item, field) {
  return validateBoundary(item, field, "min", parseDateLike);
}
function isValidMaxDate(item, field) {
  return validateBoundary(item, field, "max", parseDateLike);
}
function isValidMinTime(item, field) {
  return validateBoundary(item, field, "min", parseTime2);
}
function isValidMaxTime(item, field) {
  return validateBoundary(item, field, "max", parseTime2);
}

// packages/dataviews/build-module/field-types/datetime.mjs
var format4 = {
  datetime: (0, import_date9.getSettings)().formats.datetime,
  weekStartsOn: (0, import_date9.getSettings)().l10n.startOfWeek
};
function getValueFormatted4({
  item,
  field
}) {
  const value = field.getValue({ item });
  if (["", void 0, null].includes(value)) {
    return "";
  }
  let formatDatetime;
  if (field.type !== "datetime") {
    formatDatetime = format4;
  } else {
    formatDatetime = field.format;
  }
  return (0, import_date9.dateI18n)(formatDatetime.datetime, (0, import_date9.getDate)(value));
}
var sort = (a, b, direction) => {
  const timeA = new Date(a).getTime();
  const timeB = new Date(b).getTime();
  return direction === "asc" ? timeA - timeB : timeB - timeA;
};
var datetime_default = {
  type: "datetime",
  render,
  Edit: "datetime",
  sort,
  enableSorting: true,
  enableGlobalSearch: false,
  defaultOperators: [
    OPERATOR_ON,
    OPERATOR_NOT_ON,
    OPERATOR_BEFORE,
    OPERATOR_AFTER,
    OPERATOR_BEFORE_INC,
    OPERATOR_AFTER_INC,
    OPERATOR_IN_THE_PAST,
    OPERATOR_OVER
  ],
  validOperators: [
    OPERATOR_ON,
    OPERATOR_NOT_ON,
    OPERATOR_BEFORE,
    OPERATOR_AFTER,
    OPERATOR_BEFORE_INC,
    OPERATOR_AFTER_INC,
    OPERATOR_IN_THE_PAST,
    OPERATOR_OVER
  ],
  format: format4,
  getValueFormatted: getValueFormatted4,
  validate: {
    required: isValidRequired,
    elements: isValidElements,
    min: isValidMinDate,
    max: isValidMaxDate
  }
};

// packages/dataviews/build-module/field-types/date.mjs
var import_date10 = __toESM(require_date(), 1);
var format5 = {
  date: (0, import_date10.getSettings)().formats.date,
  weekStartsOn: (0, import_date10.getSettings)().l10n.startOfWeek
};
function getValueFormatted5({
  item,
  field
}) {
  const value = field.getValue({ item });
  if (["", void 0, null].includes(value)) {
    return "";
  }
  let formatDate2;
  if (field.type !== "date") {
    formatDate2 = format5;
  } else {
    formatDate2 = field.format;
  }
  return (0, import_date10.dateI18n)(formatDate2.date, (0, import_date10.getDate)(value));
}
var sort2 = (a, b, direction) => {
  const timeA = new Date(a).getTime();
  const timeB = new Date(b).getTime();
  return direction === "asc" ? timeA - timeB : timeB - timeA;
};
var date_default = {
  type: "date",
  render,
  Edit: "date",
  sort: sort2,
  enableSorting: true,
  enableGlobalSearch: false,
  defaultOperators: [
    OPERATOR_ON,
    OPERATOR_NOT_ON,
    OPERATOR_BEFORE,
    OPERATOR_AFTER,
    OPERATOR_BEFORE_INC,
    OPERATOR_AFTER_INC,
    OPERATOR_IN_THE_PAST,
    OPERATOR_OVER,
    OPERATOR_BETWEEN
  ],
  validOperators: [
    OPERATOR_ON,
    OPERATOR_NOT_ON,
    OPERATOR_BEFORE,
    OPERATOR_AFTER,
    OPERATOR_BEFORE_INC,
    OPERATOR_AFTER_INC,
    OPERATOR_IN_THE_PAST,
    OPERATOR_OVER,
    OPERATOR_BETWEEN
  ],
  format: format5,
  getValueFormatted: getValueFormatted5,
  validate: {
    required: isValidRequired,
    elements: isValidElements,
    min: isValidMinDate,
    max: isValidMaxDate
  }
};

// packages/dataviews/build-module/field-types/time.mjs
var import_date11 = __toESM(require_date(), 1);
var format6 = {
  time: (0, import_date11.getSettings)().formats.time
};
var ANCHOR_DATE = "2000-01-01";
function toAnchoredDate(secondsSinceMidnight) {
  const hours = Math.floor(secondsSinceMidnight / 3600);
  const minutes = Math.floor(secondsSinceMidnight % 3600 / 60);
  const seconds = secondsSinceMidnight % 60;
  const time = [hours, minutes, seconds].map((part) => String(part).padStart(2, "0")).join(":");
  return (0, import_date11.getDate)(`${ANCHOR_DATE}T${time}`);
}
function getValueFormatted6({
  item,
  field
}) {
  const secondsSinceMidnight = parseTime2(field.getValue({ item }));
  if (secondsSinceMidnight === null) {
    return "";
  }
  let formatTime;
  if (field.type !== "time") {
    formatTime = format6;
  } else {
    formatTime = field.format;
  }
  return (0, import_date11.dateI18n)(formatTime.time, toAnchoredDate(secondsSinceMidnight));
}
var sort3 = (a, b, direction) => {
  const timeA = parseTime2(a);
  const timeB = parseTime2(b);
  if (timeA === null || timeB === null) {
    if (timeA === timeB) {
      return 0;
    }
    return timeA === null ? 1 : -1;
  }
  return direction === "asc" ? timeA - timeB : timeB - timeA;
};
var time_default = {
  type: "time",
  render,
  Edit: "time",
  sort: sort3,
  enableSorting: true,
  enableGlobalSearch: false,
  defaultOperators: [
    OPERATOR_ON,
    OPERATOR_NOT_ON,
    OPERATOR_BEFORE,
    OPERATOR_AFTER,
    OPERATOR_BEFORE_INC,
    OPERATOR_AFTER_INC,
    OPERATOR_BETWEEN
  ],
  validOperators: [
    OPERATOR_ON,
    OPERATOR_NOT_ON,
    OPERATOR_BEFORE,
    OPERATOR_AFTER,
    OPERATOR_BEFORE_INC,
    OPERATOR_AFTER_INC,
    OPERATOR_BETWEEN
  ],
  format: format6,
  getValueFormatted: getValueFormatted6,
  validate: {
    required: isValidRequired,
    elements: isValidElements,
    min: isValidMinTime,
    max: isValidMaxTime
  }
};

// packages/dataviews/build-module/field-types/boolean.mjs
var import_i18n25 = __toESM(require_i18n(), 1);

// packages/dataviews/build-module/field-types/utils/is-valid-required-for-bool.mjs
function isValidRequiredForBool(item, field) {
  const value = field.getValue({ item });
  return value === true;
}

// packages/dataviews/build-module/field-types/boolean.mjs
function getValueFormatted7({
  item,
  field
}) {
  const value = field.getValue({ item });
  if (value === true) {
    return (0, import_i18n25.__)("True");
  }
  if (value === false) {
    return (0, import_i18n25.__)("False");
  }
  return "";
}
function isValidCustom4(item, field) {
  const value = field.getValue({ item });
  if (![void 0, "", null].includes(value) && ![true, false].includes(value)) {
    return (0, import_i18n25.__)("Value must be true, false, or undefined");
  }
  return null;
}
var sort4 = (a, b, direction) => {
  const boolA = Boolean(a);
  const boolB = Boolean(b);
  if (boolA === boolB) {
    return 0;
  }
  if (direction === "asc") {
    return boolA ? 1 : -1;
  }
  return boolA ? -1 : 1;
};
var boolean_default = {
  type: "boolean",
  render,
  Edit: "checkbox",
  sort: sort4,
  validate: {
    required: isValidRequiredForBool,
    elements: isValidElements,
    custom: isValidCustom4
  },
  enableSorting: true,
  enableGlobalSearch: false,
  defaultOperators: [OPERATOR_IS, OPERATOR_IS_NOT],
  validOperators: [OPERATOR_IS, OPERATOR_IS_NOT],
  format: {},
  getValueFormatted: getValueFormatted7
};

// packages/dataviews/build-module/field-types/media.mjs
var media_default = {
  type: "media",
  render: () => null,
  Edit: null,
  sort: () => 0,
  enableSorting: false,
  enableGlobalSearch: false,
  defaultOperators: [],
  validOperators: [],
  format: {},
  getValueFormatted: get_value_formatted_default_default,
  // cannot validate any constraint, so
  // the only available validation for the field author
  // would be providing a custom validator.
  validate: {}
};

// packages/dataviews/build-module/field-types/array.mjs
var import_i18n26 = __toESM(require_i18n(), 1);

// packages/dataviews/build-module/field-types/utils/is-valid-required-for-array.mjs
function isValidRequiredForArray(item, field) {
  const value = field.getValue({ item });
  return Array.isArray(value) && value.length > 0 && value.every(
    (element) => ![void 0, "", null].includes(element)
  );
}

// packages/dataviews/build-module/field-types/array.mjs
function getValueFormatted8({
  item,
  field
}) {
  const value = field.getValue({ item });
  const arr = Array.isArray(value) ? value : [];
  return arr.join(", ");
}
function render2({ item, field }) {
  return getValueFormatted8({ item, field });
}
function isValidCustom5(item, field) {
  const value = field.getValue({ item });
  if ([void 0, "", null].includes(value)) {
    return null;
  }
  if (!Array.isArray(value)) {
    return (0, import_i18n26.__)("Value must be an array.");
  }
  if (!value.every((v2) => typeof v2 === "string")) {
    return (0, import_i18n26.__)("Every value must be a string.");
  }
  return null;
}
var sort5 = (a, b, direction) => {
  const arrA = Array.isArray(a) ? a : [];
  const arrB = Array.isArray(b) ? b : [];
  if (arrA.length !== arrB.length) {
    return direction === "asc" ? arrA.length - arrB.length : arrB.length - arrA.length;
  }
  const joinedA = arrA.join(",");
  const joinedB = arrB.join(",");
  return direction === "asc" ? joinedA.localeCompare(joinedB) : joinedB.localeCompare(joinedA);
};
var array_default = {
  type: "array",
  render: render2,
  Edit: "array",
  sort: sort5,
  enableSorting: true,
  enableGlobalSearch: false,
  defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE],
  validOperators: [
    OPERATOR_IS_ANY,
    OPERATOR_IS_NONE,
    OPERATOR_IS_ALL,
    OPERATOR_IS_NOT_ALL
  ],
  format: {},
  getValueFormatted: getValueFormatted8,
  validate: {
    required: isValidRequiredForArray,
    elements: isValidElements,
    custom: isValidCustom5
  }
};

// packages/dataviews/build-module/field-types/password.mjs
function getValueFormatted9({
  item,
  field
}) {
  return field.getValue({ item }) ? "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" : "";
}
var password_default = {
  type: "password",
  render,
  Edit: "password",
  sort: () => 0,
  // Passwords should not be sortable for security reasons
  enableSorting: false,
  enableGlobalSearch: false,
  defaultOperators: [],
  validOperators: [],
  format: {},
  getValueFormatted: getValueFormatted9,
  validate: {
    required: isValidRequired,
    pattern: isValidPattern,
    minLength: isValidMinLength,
    maxLength: isValidMaxLength,
    elements: isValidElements
  }
};

// packages/dataviews/build-module/field-types/telephone.mjs
var telephone_default = {
  type: "telephone",
  render,
  Edit: "telephone",
  sort: sort_text_default,
  enableSorting: true,
  enableGlobalSearch: false,
  defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE],
  validOperators: [
    OPERATOR_IS,
    OPERATOR_IS_NOT,
    OPERATOR_CONTAINS,
    OPERATOR_NOT_CONTAINS,
    OPERATOR_STARTS_WITH,
    // Multiple selection
    OPERATOR_IS_ANY,
    OPERATOR_IS_NONE,
    OPERATOR_IS_NOT_ALL
  ],
  format: {},
  getValueFormatted: get_value_formatted_default_default,
  validate: {
    required: isValidRequired,
    pattern: isValidPattern,
    minLength: isValidMinLength,
    maxLength: isValidMaxLength,
    elements: isValidElements
  }
};

// packages/dataviews/build-module/field-types/color.mjs
var import_i18n27 = __toESM(require_i18n(), 1);
var import_jsx_runtime137 = __toESM(require_jsx_runtime(), 1);
function render3({ item, field }) {
  if (field.hasElements) {
    return /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(RenderFromElements, { item, field });
  }
  const value = get_value_formatted_default_default({ item, field });
  if (!value || !A(value).isValid()) {
    return value;
  }
  return /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
    /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(
      "div",
      {
        style: {
          width: "16px",
          height: "16px",
          borderRadius: "50%",
          backgroundColor: value,
          border: "1px solid #ddd",
          flexShrink: 0
        }
      }
    ),
    /* @__PURE__ */ (0, import_jsx_runtime137.jsx)("span", { children: value })
  ] });
}
function isValidCustom6(item, field) {
  const value = field.getValue({ item });
  if (![void 0, "", null].includes(value) && !A(value).isValid()) {
    return (0, import_i18n27.__)("Value must be a valid color.");
  }
  return null;
}
var sort6 = (a, b, direction) => {
  const colorA = A(a);
  const colorB = A(b);
  if (!colorA.isValid() && !colorB.isValid()) {
    return 0;
  }
  if (!colorA.isValid()) {
    return direction === "asc" ? 1 : -1;
  }
  if (!colorB.isValid()) {
    return direction === "asc" ? -1 : 1;
  }
  const hslA = colorA.toHsl();
  const hslB = colorB.toHsl();
  if (hslA.h !== hslB.h) {
    return direction === "asc" ? hslA.h - hslB.h : hslB.h - hslA.h;
  }
  if (hslA.s !== hslB.s) {
    return direction === "asc" ? hslA.s - hslB.s : hslB.s - hslA.s;
  }
  return direction === "asc" ? hslA.l - hslB.l : hslB.l - hslA.l;
};
var color_default = {
  type: "color",
  render: render3,
  Edit: "color",
  sort: sort6,
  enableSorting: true,
  enableGlobalSearch: false,
  defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE],
  validOperators: [
    OPERATOR_IS,
    OPERATOR_IS_NOT,
    OPERATOR_IS_ANY,
    OPERATOR_IS_NONE
  ],
  format: {},
  getValueFormatted: get_value_formatted_default_default,
  validate: {
    required: isValidRequired,
    elements: isValidElements,
    custom: isValidCustom6
  }
};

// packages/dataviews/build-module/field-types/url.mjs
var url_default = {
  type: "url",
  render,
  Edit: "url",
  sort: sort_text_default,
  enableSorting: true,
  enableGlobalSearch: false,
  defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE],
  validOperators: [
    OPERATOR_IS,
    OPERATOR_IS_NOT,
    OPERATOR_CONTAINS,
    OPERATOR_NOT_CONTAINS,
    OPERATOR_STARTS_WITH,
    // Multiple selection
    OPERATOR_IS_ANY,
    OPERATOR_IS_NONE,
    OPERATOR_IS_NOT_ALL
  ],
  format: {},
  getValueFormatted: get_value_formatted_default_default,
  validate: {
    required: isValidRequired,
    pattern: isValidPattern,
    minLength: isValidMinLength,
    maxLength: isValidMaxLength,
    elements: isValidElements
  }
};

// packages/dataviews/build-module/field-types/no-type.mjs
var sort7 = (a, b, direction) => {
  if (typeof a === "number" && typeof b === "number") {
    return sort_number_default(a, b, direction);
  }
  return sort_text_default(a, b, direction);
};
var no_type_default = {
  // type: no type for this one
  render,
  Edit: null,
  sort: sort7,
  enableSorting: true,
  enableGlobalSearch: false,
  defaultOperators: [OPERATOR_IS, OPERATOR_IS_NOT],
  validOperators: getAllOperatorNames(),
  format: {},
  getValueFormatted: get_value_formatted_default_default,
  validate: {
    required: isValidRequired,
    elements: isValidElements
  }
};

// packages/dataviews/build-module/field-types/utils/get-is-valid.mjs
function supportsNumericRangeConstraint(type) {
  return type === "integer" || type === "number";
}
function supportsStringRangeConstraint(type) {
  return type === "date" || type === "datetime" || type === "time";
}
function normalizeRangeRule(value, fieldType, key) {
  const validator = fieldType.validate[key];
  if (validator && (typeof value === "number" && supportsNumericRangeConstraint(fieldType.type) || typeof value === "string" && supportsStringRangeConstraint(fieldType.type))) {
    return { constraint: value, validate: validator };
  }
  return void 0;
}
function getIsValid(field, fieldType) {
  const rules = field.isValid;
  let required;
  if (rules?.required === true && fieldType.validate.required !== void 0) {
    required = {
      constraint: true,
      validate: fieldType.validate.required
    };
  }
  let elements;
  if ((rules?.elements === true || // elements is enabled unless the field opts-out
  rules?.elements === void 0 && (!!field.elements || !!field.getElements)) && fieldType.validate.elements !== void 0) {
    elements = {
      constraint: true,
      validate: fieldType.validate.elements
    };
  }
  const min4 = normalizeRangeRule(rules?.min, fieldType, "min");
  const max4 = normalizeRangeRule(rules?.max, fieldType, "max");
  const minLengthValue = rules?.minLength;
  let minLength;
  if (typeof minLengthValue === "number" && fieldType.validate.minLength !== void 0) {
    minLength = {
      constraint: minLengthValue,
      validate: fieldType.validate.minLength
    };
  }
  const maxLengthValue = rules?.maxLength;
  let maxLength;
  if (typeof maxLengthValue === "number" && fieldType.validate.maxLength !== void 0) {
    maxLength = {
      constraint: maxLengthValue,
      validate: fieldType.validate.maxLength
    };
  }
  const patternValue = rules?.pattern;
  let pattern;
  if (patternValue !== void 0 && fieldType.validate.pattern !== void 0) {
    pattern = {
      constraint: patternValue,
      validate: fieldType.validate.pattern
    };
  }
  const custom = rules?.custom ?? fieldType.validate.custom;
  return {
    required,
    elements,
    min: min4,
    max: max4,
    minLength,
    maxLength,
    pattern,
    custom
  };
}

// packages/dataviews/build-module/field-types/utils/get-filter.mjs
function getFilter(fieldType) {
  return fieldType.validOperators.reduce((accumulator, operator) => {
    const operatorObj = getOperatorByName(operator);
    if (operatorObj?.filter) {
      accumulator[operator] = operatorObj.filter;
    }
    return accumulator;
  }, {});
}

// packages/dataviews/build-module/field-types/utils/get-format.mjs
function getFormat(field, fieldType) {
  return {
    ...fieldType.format,
    ...field.format
  };
}
var get_format_default = getFormat;

// packages/dataviews/build-module/field-types/index.mjs
function getFieldTypeByName(type) {
  const found = [
    email_default,
    integer_default,
    number_default,
    text_default,
    datetime_default,
    date_default,
    time_default,
    boolean_default,
    media_default,
    array_default,
    password_default,
    telephone_default,
    color_default,
    url_default
  ].find((fieldType) => fieldType?.type === type);
  if (!!found) {
    return found;
  }
  return no_type_default;
}
function normalizeFields(fields) {
  return fields.map((field) => {
    const fieldType = getFieldTypeByName(field.type);
    const getValue = field.getValue || get_value_from_id_default(field.id);
    const sort8 = function(a, b, direction) {
      const aValue = getValue({ item: a });
      const bValue = getValue({ item: b });
      return field.sort ? field.sort(aValue, bValue, direction) : fieldType.sort(aValue, bValue, direction);
    };
    return {
      id: field.id,
      label: field.label || field.id,
      header: field.header || field.label || field.id,
      description: field.description,
      placeholder: field.placeholder,
      getValue,
      setValue: field.setValue || set_value_from_id_default(field.id),
      elements: field.elements,
      getElements: field.getElements,
      hasElements: hasElements(field),
      isVisible: field.isVisible,
      isDisabled: typeof field.isDisabled === "function" ? field.isDisabled : () => !!field.isDisabled,
      enableHiding: field.enableHiding ?? true,
      readOnly: field.readOnly ?? false,
      // The type provides defaults for the following props
      type: fieldType.type,
      render: field.render ?? fieldType.render,
      Edit: getControl(field, fieldType.Edit),
      sort: sort8,
      enableSorting: field.enableSorting ?? fieldType.enableSorting,
      enableGlobalSearch: field.enableGlobalSearch ?? fieldType.enableGlobalSearch,
      isValid: getIsValid(field, fieldType),
      filterBy: get_filter_by_default(
        field,
        fieldType.defaultOperators,
        fieldType.validOperators
      ),
      filter: getFilter(fieldType),
      format: get_format_default(field, fieldType),
      getValueFormatted: field.getValueFormatted ?? fieldType.getValueFormatted
    };
  });
}

// packages/dataviews/build-module/dataform/index.mjs
var import_element109 = __toESM(require_element(), 1);

// packages/dataviews/build-module/components/dataform-context/index.mjs
var import_element99 = __toESM(require_element(), 1);
var import_jsx_runtime138 = __toESM(require_jsx_runtime(), 1);
var DataFormContext = (0, import_element99.createContext)({
  fields: []
});
DataFormContext.displayName = "DataFormContext";
function DataFormProvider({
  fields,
  children
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(DataFormContext.Provider, { value: { fields }, children });
}
var dataform_context_default = DataFormContext;

// packages/dataviews/build-module/components/dataform-layouts/data-form-layout.mjs
var import_element108 = __toESM(require_element(), 1);

// packages/dataviews/build-module/components/dataform-layouts/regular/index.mjs
var import_element100 = __toESM(require_element(), 1);
var import_components24 = __toESM(require_components(), 1);

// packages/dataviews/build-module/components/dataform-layouts/can-render-field.mjs
function canRenderField(field) {
  return !!field && (field.readOnly === true || !!field.Edit);
}

// packages/dataviews/build-module/components/dataform-layouts/normalize-form.mjs
var import_i18n28 = __toESM(require_i18n(), 1);
var DEFAULT_LAYOUT = {
  type: "regular",
  labelPosition: "top"
};
var normalizeCardSummaryField = (sum) => {
  if (typeof sum === "string") {
    return [{ id: sum, visibility: "when-collapsed" }];
  }
  return sum.map((item) => {
    if (typeof item === "string") {
      return { id: item, visibility: "when-collapsed" };
    }
    return { id: item.id, visibility: item.visibility };
  });
};
function normalizeLayout(layout) {
  let normalizedLayout = DEFAULT_LAYOUT;
  if (layout?.type === "regular") {
    normalizedLayout = {
      type: "regular",
      labelPosition: layout?.labelPosition ?? "top"
    };
  } else if (layout?.type === "panel") {
    const summary = layout.summary ?? [];
    const normalizedSummary = Array.isArray(summary) ? summary : [summary];
    const openAs = layout?.openAs;
    let normalizedOpenAs;
    if (typeof openAs === "object" && openAs.type === "modal") {
      normalizedOpenAs = {
        type: "modal",
        applyLabel: openAs.applyLabel?.trim() || (0, import_i18n28.__)("Apply"),
        cancelLabel: openAs.cancelLabel?.trim() || (0, import_i18n28.__)("Cancel")
      };
    } else if (openAs === "modal") {
      normalizedOpenAs = {
        type: "modal",
        applyLabel: (0, import_i18n28.__)("Apply"),
        cancelLabel: (0, import_i18n28.__)("Cancel")
      };
    } else {
      normalizedOpenAs = { type: "dropdown" };
    }
    normalizedLayout = {
      type: "panel",
      labelPosition: layout?.labelPosition ?? "side",
      openAs: normalizedOpenAs,
      summary: normalizedSummary,
      editVisibility: layout?.editVisibility ?? "on-hover",
      showPlaceholderIfEmpty: layout?.showPlaceholderIfEmpty ?? false
    };
  } else if (layout?.type === "card") {
    if (layout.withHeader === false) {
      normalizedLayout = {
        type: "card",
        withHeader: false,
        isOpened: true,
        summary: [],
        isCollapsible: false
      };
    } else {
      const summary = layout.summary ?? [];
      normalizedLayout = {
        type: "card",
        withHeader: true,
        isOpened: typeof layout.isOpened === "boolean" ? layout.isOpened : true,
        summary: normalizeCardSummaryField(summary),
        isCollapsible: layout.isCollapsible === void 0 ? true : layout.isCollapsible
      };
    }
  } else if (layout?.type === "row") {
    normalizedLayout = {
      type: "row",
      alignment: layout?.alignment ?? "center",
      styles: layout?.styles ?? {}
    };
  } else if (layout?.type === "details") {
    normalizedLayout = {
      type: "details",
      summary: layout?.summary ?? ""
    };
  }
  return normalizedLayout;
}
function normalizeForm(form) {
  const normalizedFormLayout = normalizeLayout(form?.layout);
  const normalizedFields = (form.fields ?? []).map(
    (field) => {
      if (typeof field === "string") {
        return {
          id: field,
          layout: normalizedFormLayout
        };
      }
      const fieldLayout = field.layout ? normalizeLayout(field.layout) : normalizedFormLayout;
      return {
        id: field.id,
        layout: fieldLayout,
        ...!!field.label && { label: field.label },
        ...!!field.description && {
          description: field.description
        },
        ..."children" in field && Array.isArray(field.children) && {
          children: normalizeForm({
            fields: field.children,
            layout: DEFAULT_LAYOUT
          }).fields
        }
      };
    }
  );
  return {
    layout: normalizedFormLayout,
    fields: normalizedFields
  };
}
var normalize_form_default = normalizeForm;

// packages/dataviews/build-module/components/dataform-layouts/regular/index.mjs
var import_jsx_runtime139 = __toESM(require_jsx_runtime(), 1);
function Header4({ title }) {
  return /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
    Stack,
    {
      direction: "column",
      className: "dataforms-layouts-regular__header",
      gap: "lg",
      children: /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(Stack, { direction: "row", align: "center", children: /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(import_components24.__experimentalHeading, { level: 2, size: 13, children: title }) })
    }
  );
}
function FormRegularField({
  data,
  field,
  onChange,
  hideLabelFromVision,
  markWhenOptional,
  validity
}) {
  const { fields } = (0, import_element100.useContext)(dataform_context_default);
  const layout = field.layout;
  const form = (0, import_element100.useMemo)(
    () => ({
      layout: DEFAULT_LAYOUT,
      fields: !!field.children ? field.children : []
    }),
    [field]
  );
  if (!!field.children) {
    return /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)(import_jsx_runtime139.Fragment, { children: [
      !hideLabelFromVision && field.label && /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(Header4, { title: field.label }),
      /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
        DataFormLayout,
        {
          data,
          form,
          onChange,
          validity: validity?.children
        }
      )
    ] });
  }
  const labelPosition = layout.labelPosition;
  const fieldDefinition = fields.find(
    (fieldDef) => fieldDef.id === field.id
  );
  if (!canRenderField(fieldDefinition)) {
    return null;
  }
  if (labelPosition === "side") {
    return /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)(
      Stack,
      {
        direction: "row",
        className: "dataforms-layouts-regular__field",
        gap: "sm",
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
            "div",
            {
              className: clsx_default(
                "dataforms-layouts-regular__field-label",
                `dataforms-layouts-regular__field-label--label-position-${labelPosition}`
              ),
              children: /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(import_components24.BaseControl.VisualLabel, { children: fieldDefinition.label })
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime139.jsx)("div", { className: "dataforms-layouts-regular__field-control", children: fieldDefinition.readOnly === true ? /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
            fieldDefinition.render,
            {
              item: data,
              field: fieldDefinition
            }
          ) : fieldDefinition.Edit && /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
            fieldDefinition.Edit,
            {
              data,
              field: fieldDefinition,
              onChange,
              hideLabelFromVision: true,
              markWhenOptional,
              validity
            },
            fieldDefinition.id
          ) })
        ]
      }
    );
  }
  return /* @__PURE__ */ (0, import_jsx_runtime139.jsx)("div", { className: "dataforms-layouts-regular__field", children: fieldDefinition.readOnly === true ? /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(import_jsx_runtime139.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)(import_jsx_runtime139.Fragment, { children: [
    !hideLabelFromVision && labelPosition !== "none" && /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(import_components24.BaseControl.VisualLabel, { children: fieldDefinition.label }),
    /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
      fieldDefinition.render,
      {
        item: data,
        field: fieldDefinition
      }
    )
  ] }) }) : fieldDefinition.Edit && /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
    fieldDefinition.Edit,
    {
      data,
      field: fieldDefinition,
      onChange,
      hideLabelFromVision: labelPosition === "none" ? true : hideLabelFromVision,
      markWhenOptional,
      validity
    }
  ) });
}

// packages/dataviews/build-module/components/dataform-layouts/panel/modal.mjs
var import_deepmerge2 = __toESM(require_cjs(), 1);
var import_components27 = __toESM(require_components(), 1);
var import_element104 = __toESM(require_element(), 1);
var import_compose15 = __toESM(require_compose(), 1);

// packages/dataviews/build-module/components/dataform-layouts/panel/summary-button.mjs
var import_components26 = __toESM(require_components(), 1);
var import_i18n29 = __toESM(require_i18n(), 1);
var import_compose14 = __toESM(require_compose(), 1);

// packages/dataviews/build-module/components/dataform-layouts/panel/utils/get-label-classname.mjs
function getLabelClassName(labelPosition, showError) {
  return clsx_default(
    "dataforms-layouts-panel__field-label",
    `dataforms-layouts-panel__field-label--label-position-${labelPosition}`,
    { "has-error": showError }
  );
}
var get_label_classname_default = getLabelClassName;

// packages/dataviews/build-module/components/dataform-layouts/panel/field-label-content.mjs
var import_components25 = __toESM(require_components(), 1);
var import_jsx_runtime140 = __toESM(require_jsx_runtime(), 1);
function FieldLabelContent({
  showError,
  errorMessage,
  fieldLabel,
  errorId
}) {
  if (!showError) {
    return /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(import_jsx_runtime140.Fragment, { children: fieldLabel });
  }
  return /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)("span", { className: "dataforms-layouts-panel__field-label-error-content", children: [
    /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(import_components25.Icon, { icon: error_default, size: 16 }),
    /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(VisuallyHidden, { id: errorId, children: errorMessage }),
    fieldLabel
  ] });
}
var field_label_content_default = FieldLabelContent;

// packages/dataviews/build-module/components/dataform-layouts/panel/utils/get-first-validation-error.mjs
function getFirstValidationError(validity) {
  if (!validity) {
    return void 0;
  }
  const validityRules = Object.keys(validity).filter(
    (key) => key !== "children"
  );
  for (const key of validityRules) {
    const rule = validity[key];
    if (rule === void 0) {
      continue;
    }
    if (rule.type === "invalid") {
      if (rule.message) {
        return rule.message;
      }
      if (key === "required") {
        return "A required field is empty";
      }
      return "Unidentified validation error";
    }
  }
  if (validity.children) {
    for (const childValidity of Object.values(validity.children)) {
      const childError = getFirstValidationError(childValidity);
      if (childError) {
        return childError;
      }
    }
  }
  return void 0;
}
var get_first_validation_error_default = getFirstValidationError;

// packages/dataviews/build-module/components/dataform-layouts/panel/summary-button.mjs
var import_jsx_runtime141 = __toESM(require_jsx_runtime(), 1);
function SummaryValue({
  item,
  field,
  showPlaceholderIfEmpty
}) {
  if (showPlaceholderIfEmpty && field.placeholder && [void 0, null, ""].includes(field.getValue({ item }))) {
    return /* @__PURE__ */ (0, import_jsx_runtime141.jsx)("span", { className: "dataforms-layouts-panel__field-placeholder", children: field.placeholder });
  }
  return /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(field.render, { item, field });
}
function SummaryButton({
  data,
  field,
  fieldLabel,
  summaryFields,
  validity,
  touched,
  disabled: disabled2,
  isOpen: isOpen2,
  onClick
}) {
  const { labelPosition, editVisibility, showPlaceholderIfEmpty } = field.layout;
  const errorMessage = get_first_validation_error_default(validity);
  const showError = touched && !!errorMessage;
  const labelClassName = get_label_classname_default(labelPosition, showError);
  const className = clsx_default(
    "dataforms-layouts-panel__field-trigger",
    `dataforms-layouts-panel__field-trigger--label-${labelPosition}`,
    {
      "is-disabled": disabled2,
      "dataforms-layouts-panel__field-trigger--edit-always": editVisibility === "always"
    }
  );
  const controlId = (0, import_compose14.useInstanceId)(
    SummaryButton,
    "dataforms-layouts-panel__field-control"
  );
  const errorId = `${controlId}-error`;
  const ariaLabel = showError ? (0, import_i18n29.sprintf)(
    // translators: %s: Field name.
    (0, import_i18n29._x)("Edit %s (has errors)", "field"),
    fieldLabel || ""
  ) : (0, import_i18n29.sprintf)(
    // translators: %s: Field name.
    (0, import_i18n29._x)("Edit %s", "field"),
    fieldLabel || ""
  );
  return /* @__PURE__ */ (0, import_jsx_runtime141.jsxs)("div", { className, children: [
    labelPosition !== "none" && /* @__PURE__ */ (0, import_jsx_runtime141.jsx)("span", { className: labelClassName, children: /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
      field_label_content_default,
      {
        showError,
        errorMessage,
        fieldLabel,
        errorId
      }
    ) }),
    labelPosition === "none" && showError && /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
      field_label_content_default,
      {
        showError: true,
        errorMessage,
        errorId
      }
    ),
    /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
      "span",
      {
        id: `${controlId}`,
        className: "dataforms-layouts-panel__field-control",
        children: summaryFields.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
          "span",
          {
            style: {
              display: "flex",
              flexDirection: "column",
              alignItems: "flex-start",
              width: "100%",
              gap: "2px"
            },
            children: summaryFields.map((summaryField) => /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
              "span",
              {
                style: { width: "100%" },
                children: /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
                  SummaryValue,
                  {
                    item: data,
                    field: summaryField,
                    showPlaceholderIfEmpty
                  }
                )
              },
              summaryField.id
            ))
          }
        ) : summaryFields.map((summaryField) => /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
          SummaryValue,
          {
            item: data,
            field: summaryField,
            showPlaceholderIfEmpty
          },
          summaryField.id
        ))
      }
    ),
    !disabled2 && /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
      import_components26.Button,
      {
        className: "dataforms-layouts-panel__field-trigger-icon",
        label: ariaLabel,
        icon: pencil_default,
        size: "small",
        "aria-expanded": isOpen2,
        "aria-haspopup": "dialog",
        "aria-describedby": showError ? `${controlId} ${errorId}` : controlId,
        onClick
      }
    )
  ] });
}

// packages/dataviews/build-module/hooks/use-form-validity.mjs
var import_deepmerge = __toESM(require_cjs(), 1);
var import_es6 = __toESM(require_es6(), 1);
var import_element101 = __toESM(require_element(), 1);
var import_i18n30 = __toESM(require_i18n(), 1);
function isFormValid(formValidity) {
  if (!formValidity) {
    return true;
  }
  return Object.values(formValidity).every((fieldValidation) => {
    return Object.entries(fieldValidation).every(
      ([key, validation]) => {
        if (key === "children" && validation && typeof validation === "object") {
          return isFormValid(validation);
        }
        return validation.type !== "invalid" && validation.type !== "validating";
      }
    );
  });
}
function getFormFieldsToValidate(form, fields) {
  const normalizedForm = normalize_form_default(form);
  if (normalizedForm.fields.length === 0) {
    return [];
  }
  const fieldsMap = /* @__PURE__ */ new Map();
  fields.forEach((field) => {
    fieldsMap.set(field.id, field);
  });
  function processFormField(formField) {
    if ("children" in formField && Array.isArray(formField.children)) {
      const processedChildren = formField.children.map(processFormField).filter((child) => child !== null);
      if (processedChildren.length === 0) {
        return null;
      }
      return {
        id: formField.id,
        children: processedChildren
      };
    }
    const fieldDef = fieldsMap.get(formField.id);
    if (!fieldDef) {
      return null;
    }
    const [normalizedField] = normalizeFields([fieldDef]);
    return {
      id: formField.id,
      children: [],
      field: normalizedField
    };
  }
  const toValidate = normalizedForm.fields.map(processFormField).filter((field) => field !== null);
  return toValidate;
}
function setValidityAtPath(formValidity, fieldValidity, path) {
  if (!formValidity) {
    formValidity = {};
  }
  if (path.length === 0) {
    return formValidity;
  }
  const result = { ...formValidity };
  let current = result;
  for (let i = 0; i < path.length - 1; i++) {
    const segment = path[i];
    if (!current[segment]) {
      current[segment] = {};
    }
    current[segment] = { ...current[segment] };
    current = current[segment];
  }
  const finalKey = path[path.length - 1];
  current[finalKey] = {
    ...current[finalKey] || {},
    ...fieldValidity
  };
  return result;
}
function removeValidationProperty(formValidity, path, property) {
  if (!formValidity || path.length === 0) {
    return formValidity;
  }
  const result = { ...formValidity };
  let current = result;
  for (let i = 0; i < path.length - 1; i++) {
    const segment = path[i];
    if (!current[segment]) {
      return formValidity;
    }
    current[segment] = { ...current[segment] };
    current = current[segment];
  }
  const finalKey = path[path.length - 1];
  if (!current[finalKey]) {
    return formValidity;
  }
  const fieldValidity = { ...current[finalKey] };
  delete fieldValidity[property];
  if (Object.keys(fieldValidity).length === 0) {
    delete current[finalKey];
  } else {
    current[finalKey] = fieldValidity;
  }
  if (Object.keys(result).length === 0) {
    return void 0;
  }
  return result;
}
function handleElementsValidationAsync(promise, formField, promiseHandler) {
  const { elementsCounterRef, setFormValidity, path, item } = promiseHandler;
  const currentToken = (elementsCounterRef.current[formField.id] || 0) + 1;
  elementsCounterRef.current[formField.id] = currentToken;
  promise.then((result) => {
    if (currentToken !== elementsCounterRef.current[formField.id]) {
      return;
    }
    if (!Array.isArray(result)) {
      setFormValidity((prev) => {
        const newFormValidity = setValidityAtPath(
          prev,
          {
            elements: {
              type: "invalid",
              message: (0, import_i18n30.__)("Could not validate elements.")
            }
          },
          [...path, formField.id]
        );
        return newFormValidity;
      });
      return;
    }
    if (formField.field?.isValid.elements && !formField.field.isValid.elements.validate(item, {
      ...formField.field,
      elements: result
    })) {
      setFormValidity((prev) => {
        const newFormValidity = setValidityAtPath(
          prev,
          {
            elements: {
              type: "invalid",
              message: (0, import_i18n30.__)(
                "Value must be one of the elements."
              )
            }
          },
          [...path, formField.id]
        );
        return newFormValidity;
      });
    } else {
      setFormValidity((prev) => {
        return removeValidationProperty(
          prev,
          [...path, formField.id],
          "elements"
        );
      });
    }
  }).catch((error2) => {
    if (currentToken !== elementsCounterRef.current[formField.id]) {
      return;
    }
    let errorMessage;
    if (error2 instanceof Error) {
      errorMessage = error2.message;
    } else {
      errorMessage = String(error2) || (0, import_i18n30.__)(
        "Unknown error when running elements validation asynchronously."
      );
    }
    setFormValidity((prev) => {
      const newFormValidity = setValidityAtPath(
        prev,
        {
          elements: {
            type: "invalid",
            message: errorMessage
          }
        },
        [...path, formField.id]
      );
      return newFormValidity;
    });
  });
}
function handleCustomValidationAsync(promise, formField, promiseHandler) {
  const { customCounterRef, setFormValidity, path } = promiseHandler;
  const currentToken = (customCounterRef.current[formField.id] || 0) + 1;
  customCounterRef.current[formField.id] = currentToken;
  promise.then((result) => {
    if (currentToken !== customCounterRef.current[formField.id]) {
      return;
    }
    if (result === null) {
      setFormValidity((prev) => {
        return removeValidationProperty(
          prev,
          [...path, formField.id],
          "custom"
        );
      });
      return;
    }
    if (typeof result === "string") {
      setFormValidity((prev) => {
        const newFormValidity = setValidityAtPath(
          prev,
          {
            custom: {
              type: "invalid",
              message: result
            }
          },
          [...path, formField.id]
        );
        return newFormValidity;
      });
      return;
    }
    setFormValidity((prev) => {
      const newFormValidity = setValidityAtPath(
        prev,
        {
          custom: {
            type: "invalid",
            message: (0, import_i18n30.__)("Validation could not be processed.")
          }
        },
        [...path, formField.id]
      );
      return newFormValidity;
    });
  }).catch((error2) => {
    if (currentToken !== customCounterRef.current[formField.id]) {
      return;
    }
    let errorMessage;
    if (error2 instanceof Error) {
      errorMessage = error2.message;
    } else {
      errorMessage = String(error2) || (0, import_i18n30.__)(
        "Unknown error when running custom validation asynchronously."
      );
    }
    setFormValidity((prev) => {
      const newFormValidity = setValidityAtPath(
        prev,
        {
          custom: {
            type: "invalid",
            message: errorMessage
          }
        },
        [...path, formField.id]
      );
      return newFormValidity;
    });
  });
}
function isFormFieldHidden(formField, item) {
  return formField.children.length === 0 && !!formField.field?.isVisible && !formField.field.isVisible(item);
}
function validateFormField(item, formField, promiseHandler) {
  if (isFormFieldHidden(formField, item)) {
    const { customCounterRef, elementsCounterRef } = promiseHandler;
    if (customCounterRef.current[formField.id]) {
      customCounterRef.current[formField.id] += 1;
    }
    if (elementsCounterRef.current[formField.id]) {
      elementsCounterRef.current[formField.id] += 1;
    }
    return void 0;
  }
  if (formField.field?.isValid.required && !formField.field.isValid.required.validate(item, formField.field)) {
    return {
      required: { type: "invalid" }
    };
  }
  if (formField.field?.isValid.pattern && !formField.field.isValid.pattern.validate(item, formField.field)) {
    return {
      pattern: {
        type: "invalid",
        message: (0, import_i18n30.__)("Value does not match the required pattern.")
      }
    };
  }
  if (formField.field?.isValid.min && !formField.field.isValid.min.validate(item, formField.field)) {
    return {
      min: {
        type: "invalid",
        message: (0, import_i18n30.__)("Value is below the minimum.")
      }
    };
  }
  if (formField.field?.isValid.max && !formField.field.isValid.max.validate(item, formField.field)) {
    return {
      max: {
        type: "invalid",
        message: (0, import_i18n30.__)("Value is above the maximum.")
      }
    };
  }
  if (formField.field?.isValid.minLength && !formField.field.isValid.minLength.validate(item, formField.field)) {
    return {
      minLength: {
        type: "invalid",
        message: (0, import_i18n30.__)("Value is too short.")
      }
    };
  }
  if (formField.field?.isValid.maxLength && !formField.field.isValid.maxLength.validate(item, formField.field)) {
    return {
      maxLength: {
        type: "invalid",
        message: (0, import_i18n30.__)("Value is too long.")
      }
    };
  }
  if (formField.field?.isValid.elements && formField.field.hasElements && !formField.field.getElements && Array.isArray(formField.field.elements) && !formField.field.isValid.elements.validate(item, formField.field)) {
    return {
      elements: {
        type: "invalid",
        message: (0, import_i18n30.__)("Value must be one of the elements.")
      }
    };
  }
  let customError;
  if (!!formField.field && formField.field.isValid.custom) {
    try {
      const value = formField.field.getValue({ item });
      customError = formField.field.isValid.custom(
        (0, import_deepmerge.default)(
          item,
          formField.field.setValue({
            item,
            value
          })
        ),
        formField.field
      );
    } catch (error2) {
      let errorMessage;
      if (error2 instanceof Error) {
        errorMessage = error2.message;
      } else {
        errorMessage = String(error2) || (0, import_i18n30.__)("Unknown error when running custom validation.");
      }
      return {
        custom: {
          type: "invalid",
          message: errorMessage
        }
      };
    }
  }
  if (typeof customError === "string") {
    return {
      custom: {
        type: "invalid",
        message: customError
      }
    };
  }
  const fieldValidity = {};
  if (!!formField.field && formField.field.isValid.elements && formField.field.hasElements && typeof formField.field.getElements === "function") {
    handleElementsValidationAsync(
      formField.field.getElements(),
      formField,
      promiseHandler
    );
    fieldValidity.elements = {
      type: "validating",
      message: (0, import_i18n30.__)("Validating\u2026")
    };
  }
  if (customError instanceof Promise) {
    handleCustomValidationAsync(customError, formField, promiseHandler);
    fieldValidity.custom = {
      type: "validating",
      message: (0, import_i18n30.__)("Validating\u2026")
    };
  }
  if (Object.keys(fieldValidity).length > 0) {
    return fieldValidity;
  }
  if (formField.children.length > 0) {
    const result = {};
    formField.children.forEach((child) => {
      result[child.id] = validateFormField(item, child, {
        ...promiseHandler,
        path: [...promiseHandler.path, formField.id, "children"]
      });
    });
    const filteredResult = {};
    Object.entries(result).forEach(([key, value]) => {
      if (value !== void 0) {
        filteredResult[key] = value;
      }
    });
    if (Object.keys(filteredResult).length === 0) {
      return void 0;
    }
    return {
      children: filteredResult
    };
  }
  return void 0;
}
function getFormFieldValue(formField, item) {
  const fieldValue = formField?.field?.getValue({ item });
  const isHidden = isFormFieldHidden(formField, item);
  if (formField.children.length === 0) {
    return { value: fieldValue, isHidden };
  }
  const childrenValues = formField.children.map(
    (child) => getFormFieldValue(child, item)
  );
  return {
    value: fieldValue,
    isHidden,
    children: childrenValues
  };
}
function useFormValidity(item, fields, form) {
  const [formValidity, setFormValidity] = (0, import_element101.useState)();
  const customCounterRef = (0, import_element101.useRef)({});
  const elementsCounterRef = (0, import_element101.useRef)({});
  const previousValuesRef = (0, import_element101.useRef)({});
  const validate = (0, import_element101.useCallback)(() => {
    const promiseHandler = {
      customCounterRef,
      elementsCounterRef,
      setFormValidity,
      path: [],
      item
    };
    const formFieldsToValidate = getFormFieldsToValidate(form, fields);
    if (formFieldsToValidate.length === 0) {
      setFormValidity(void 0);
      return;
    }
    const newFormValidity = {};
    const untouchedFields = [];
    formFieldsToValidate.forEach((formField) => {
      const value = getFormFieldValue(formField, item);
      if (previousValuesRef.current.hasOwnProperty(formField.id) && (0, import_es6.default)(
        previousValuesRef.current[formField.id],
        value
      )) {
        untouchedFields.push(formField.id);
        return;
      }
      previousValuesRef.current[formField.id] = value;
      const fieldValidity = validateFormField(
        item,
        formField,
        promiseHandler
      );
      if (fieldValidity !== void 0) {
        newFormValidity[formField.id] = fieldValidity;
      }
    });
    setFormValidity((existingFormValidity) => {
      let validity = {
        ...existingFormValidity,
        ...newFormValidity
      };
      const fieldsToKeep = [
        ...untouchedFields,
        ...Object.keys(newFormValidity)
      ];
      Object.keys(validity).forEach((key) => {
        if (validity && !fieldsToKeep.includes(key)) {
          delete validity[key];
        }
      });
      if (Object.keys(validity).length === 0) {
        validity = void 0;
      }
      const areEqual = (0, import_es6.default)(existingFormValidity, validity);
      if (areEqual) {
        return existingFormValidity;
      }
      return validity;
    });
  }, [item, fields, form]);
  (0, import_element101.useEffect)(() => {
    validate();
  }, [validate]);
  return {
    validity: formValidity,
    isValid: isFormValid(formValidity)
  };
}
var use_form_validity_default = useFormValidity;

// packages/dataviews/build-module/hooks/use-reveal-validity.mjs
var import_element102 = __toESM(require_element(), 1);
function useRevealValidity(ref, shouldReveal) {
  const revealValidity = (0, import_element102.useCallback)(() => {
    const inputs = ref.current?.querySelectorAll("input, textarea, select");
    let revealedCount = 0;
    inputs?.forEach((input) => {
      if (input.willValidate && !input.validity.valid) {
        revealedCount++;
        input.dispatchEvent(
          new Event("invalid", { cancelable: true })
        );
      }
    });
    return revealedCount;
  }, [ref]);
  (0, import_element102.useEffect)(() => {
    if (shouldReveal) {
      revealValidity();
    }
  }, [shouldReveal, revealValidity]);
  return revealValidity;
}

// packages/dataviews/build-module/components/dataform-layouts/panel/utils/use-field-from-form-field.mjs
var import_element103 = __toESM(require_element(), 1);

// packages/dataviews/build-module/components/dataform-layouts/get-summary-fields.mjs
function extractSummaryIds(summary) {
  if (Array.isArray(summary)) {
    return summary.map(
      (item) => typeof item === "string" ? item : item.id
    );
  }
  return [];
}
var getSummaryFields = (summaryField, fields) => {
  if (Array.isArray(summaryField) && summaryField.length > 0) {
    const summaryIds = extractSummaryIds(summaryField);
    return summaryIds.map(
      (summaryId) => fields.find((_field) => _field.id === summaryId)
    ).filter((_field) => _field !== void 0);
  }
  return [];
};

// packages/dataviews/build-module/components/dataform-layouts/panel/utils/use-field-from-form-field.mjs
var getFieldDefinition = (field, fields) => {
  if (!!field.children) {
    const simpleChildren = field.children.filter(
      (child) => !child.children
    );
    if (simpleChildren.length === 0) {
      return void 0;
    }
    return fields.find(
      (_field) => _field.id === simpleChildren[0].id
    );
  }
  return fields.find((_field) => _field.id === field.id);
};
function useFieldFromFormField(field) {
  const { fields } = (0, import_element103.useContext)(dataform_context_default);
  const layout = field.layout;
  const summaryFields = getSummaryFields(layout.summary, fields);
  const fieldDefinition = getFieldDefinition(field, fields);
  const fieldLabel = !!field.children ? field.label : fieldDefinition?.label;
  if (summaryFields.length === 0) {
    return {
      summaryFields: fieldDefinition ? [fieldDefinition] : [],
      fieldDefinition,
      fieldLabel
    };
  }
  return {
    summaryFields,
    fieldDefinition,
    fieldLabel
  };
}
var use_field_from_form_field_default = useFieldFromFormField;

// packages/dataviews/build-module/components/dataform-layouts/panel/modal.mjs
var import_jsx_runtime142 = __toESM(require_jsx_runtime(), 1);
function ModalContent({
  data,
  field,
  onChange,
  fieldLabel,
  onClose,
  touched
}) {
  const { openAs } = field.layout;
  const { applyLabel, cancelLabel } = openAs;
  const { fields } = (0, import_element104.useContext)(dataform_context_default);
  const [changes, setChanges] = (0, import_element104.useState)({});
  const modalData = (0, import_element104.useMemo)(() => {
    return (0, import_deepmerge2.default)(data, changes, {
      arrayMerge: (target, source) => source
    });
  }, [data, changes]);
  const form = (0, import_element104.useMemo)(
    () => ({
      layout: DEFAULT_LAYOUT,
      fields: !!field.children ? field.children : (
        // If not explicit children return the field id itself.
        [{ id: field.id, layout: DEFAULT_LAYOUT }]
      )
    }),
    [field]
  );
  const fieldsAsFieldType = fields.map((f) => ({
    ...f,
    Edit: f.Edit === null ? void 0 : f.Edit,
    isValid: {
      required: f.isValid.required?.constraint,
      elements: f.isValid.elements?.constraint,
      min: f.isValid.min?.constraint,
      max: f.isValid.max?.constraint,
      pattern: f.isValid.pattern?.constraint,
      minLength: f.isValid.minLength?.constraint,
      maxLength: f.isValid.maxLength?.constraint
    }
  }));
  const { validity } = use_form_validity_default(modalData, fieldsAsFieldType, form);
  const onApply = () => {
    onChange(changes);
    onClose();
  };
  const handleOnChange = (newValue) => {
    setChanges(
      (prev) => (0, import_deepmerge2.default)(prev, newValue, {
        arrayMerge: (target, source) => source
      })
    );
  };
  const focusOnMountRef = (0, import_compose15.useFocusOnMount)("firstInputElement");
  const contentRef = (0, import_element104.useRef)(null);
  const mergedRef = (0, import_compose15.useMergeRefs)([focusOnMountRef, contentRef]);
  useRevealValidity(contentRef, touched);
  return /* @__PURE__ */ (0, import_jsx_runtime142.jsxs)(
    import_components27.Modal,
    {
      className: "dataforms-layouts-panel__modal",
      onRequestClose: onClose,
      isFullScreen: false,
      title: fieldLabel,
      size: "medium",
      children: [
        /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("div", { ref: mergedRef, children: /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
          DataFormLayout,
          {
            data: modalData,
            form,
            onChange: handleOnChange,
            validity,
            children: (FieldLayout, childField, childFieldValidity, markWhenOptional) => /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
              FieldLayout,
              {
                data: modalData,
                field: childField,
                onChange: handleOnChange,
                hideLabelFromVision: form.fields.length < 2,
                markWhenOptional,
                validity: childFieldValidity
              },
              childField.id
            )
          }
        ) }),
        /* @__PURE__ */ (0, import_jsx_runtime142.jsxs)(
          Stack,
          {
            direction: "row",
            className: "dataforms-layouts-panel__modal-footer",
            gap: "md",
            children: [
              /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(import_components27.__experimentalSpacer, { style: { flex: 1 } }),
              /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
                import_components27.Button,
                {
                  variant: "tertiary",
                  onClick: onClose,
                  __next40pxDefaultSize: true,
                  children: cancelLabel
                }
              ),
              /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
                import_components27.Button,
                {
                  variant: "primary",
                  onClick: onApply,
                  __next40pxDefaultSize: true,
                  children: applyLabel
                }
              )
            ]
          }
        )
      ]
    }
  );
}
function PanelModal({
  data,
  field,
  onChange,
  validity
}) {
  const [touched, setTouched] = (0, import_element104.useState)(false);
  const [isOpen2, setIsOpen] = (0, import_element104.useState)(false);
  const { fieldDefinition, fieldLabel, summaryFields } = use_field_from_form_field_default(field);
  if (!fieldDefinition) {
    return null;
  }
  const isDisabled = fieldDefinition.readOnly === true || fieldDefinition.isDisabled({ item: data, field: fieldDefinition });
  const handleClose = () => {
    setIsOpen(false);
    setTouched(true);
  };
  return /* @__PURE__ */ (0, import_jsx_runtime142.jsxs)(import_jsx_runtime142.Fragment, { children: [
    /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
      SummaryButton,
      {
        data,
        field,
        fieldLabel,
        summaryFields,
        validity,
        touched,
        disabled: isDisabled,
        onClick: () => setIsOpen(true),
        isOpen: isOpen2
      }
    ),
    isOpen2 && /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
      ModalContent,
      {
        data,
        field,
        onChange,
        fieldLabel: fieldLabel ?? "",
        onClose: handleClose,
        touched
      }
    )
  ] });
}
var modal_default = PanelModal;

// packages/dataviews/build-module/components/dataform-layouts/panel/dropdown.mjs
var import_components28 = __toESM(require_components(), 1);
var import_i18n31 = __toESM(require_i18n(), 1);
var import_element105 = __toESM(require_element(), 1);
var import_compose16 = __toESM(require_compose(), 1);
var import_jsx_runtime143 = __toESM(require_jsx_runtime(), 1);
function DropdownHeader({
  title,
  onClose
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(
    Stack,
    {
      direction: "column",
      className: "dataforms-layouts-panel__dropdown-header",
      gap: "lg",
      children: /* @__PURE__ */ (0, import_jsx_runtime143.jsxs)(Stack, { direction: "row", gap: "sm", align: "center", children: [
        title && /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(import_components28.__experimentalHeading, { level: 2, size: 13, children: title }),
        /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(import_components28.__experimentalSpacer, { style: { flex: 1 } }),
        onClose && /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(
          import_components28.Button,
          {
            label: (0, import_i18n31.__)("Close"),
            icon: close_small_default,
            onClick: onClose,
            size: "small"
          }
        )
      ] })
    }
  );
}
function DropdownContentWithValidation({
  touched,
  children
}) {
  const ref = (0, import_element105.useRef)(null);
  useRevealValidity(ref, touched);
  return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)("div", { ref, children });
}
function PanelDropdown({
  data,
  field,
  onChange,
  validity
}) {
  const [touched, setTouched] = (0, import_element105.useState)(false);
  const [popoverAnchor, setPopoverAnchor] = (0, import_element105.useState)(
    null
  );
  const popoverProps = (0, import_element105.useMemo)(
    () => ({
      // Anchor the popover to the middle of the entire row so that it doesn't
      // move around when the label changes.
      anchor: popoverAnchor,
      placement: "left-start",
      offset: 36,
      shift: true
    }),
    [popoverAnchor]
  );
  const [dialogRef, dialogProps] = (0, import_compose16.__experimentalUseDialog)({
    focusOnMount: "firstInputElement"
  });
  const form = (0, import_element105.useMemo)(
    () => ({
      layout: DEFAULT_LAYOUT,
      fields: !!field.children ? field.children : (
        // If not explicit children return the field id itself.
        [{ id: field.id, layout: DEFAULT_LAYOUT }]
      )
    }),
    [field]
  );
  const formValidity = (0, import_element105.useMemo)(() => {
    if (validity === void 0) {
      return void 0;
    }
    if (!!field.children) {
      return validity?.children;
    }
    return { [field.id]: validity };
  }, [validity, field]);
  const { fieldDefinition, fieldLabel, summaryFields } = use_field_from_form_field_default(field);
  if (!fieldDefinition) {
    return null;
  }
  const isDisabled = fieldDefinition.readOnly === true || fieldDefinition.isDisabled({ item: data, field: fieldDefinition });
  return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(
    "div",
    {
      ref: setPopoverAnchor,
      className: "dataforms-layouts-panel__field-dropdown-anchor",
      children: /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(
        import_components28.Dropdown,
        {
          contentClassName: "dataforms-layouts-panel__field-dropdown",
          popoverProps,
          focusOnMount: false,
          onToggle: (willOpen) => {
            if (!willOpen) {
              setTouched(true);
            }
          },
          renderToggle: ({ isOpen: isOpen2, onToggle }) => /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(
            SummaryButton,
            {
              data,
              field,
              fieldLabel,
              summaryFields,
              validity,
              touched,
              disabled: isDisabled,
              isOpen: isOpen2,
              onClick: onToggle
            }
          ),
          renderContent: ({ onClose }) => /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(DropdownContentWithValidation, { touched, children: /* @__PURE__ */ (0, import_jsx_runtime143.jsxs)("div", { ref: dialogRef, ...dialogProps, children: [
            /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(
              DropdownHeader,
              {
                title: fieldLabel,
                onClose
              }
            ),
            /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(
              DataFormLayout,
              {
                data,
                form,
                onChange,
                validity: formValidity,
                children: (FieldLayout, childField, childFieldValidity, markWhenOptional) => /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(
                  FieldLayout,
                  {
                    data,
                    field: childField,
                    onChange,
                    hideLabelFromVision: (form?.fields ?? []).length < 2,
                    markWhenOptional,
                    validity: childFieldValidity
                  },
                  childField.id
                )
              }
            )
          ] }) })
        }
      )
    }
  );
}
var dropdown_default = PanelDropdown;

// packages/dataviews/build-module/components/dataform-layouts/panel/index.mjs
var import_jsx_runtime144 = __toESM(require_jsx_runtime(), 1);
function FormPanelField({
  data,
  field,
  onChange,
  validity
}) {
  const layout = field.layout;
  if (layout.openAs.type === "modal") {
    return /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(
      modal_default,
      {
        data,
        field,
        onChange,
        validity
      }
    );
  }
  return /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(
    dropdown_default,
    {
      data,
      field,
      onChange,
      validity
    }
  );
}

// packages/dataviews/build-module/components/dataform-layouts/card/index.mjs
var import_element106 = __toESM(require_element(), 1);
var import_compose17 = __toESM(require_compose(), 1);
import { speak as speak4 } from "@wordpress/a11y";

// packages/dataviews/build-module/components/dataform-layouts/get-validation-message.mjs
var import_i18n32 = __toESM(require_i18n(), 1);
function countInvalidFields(validity) {
  if (!validity) {
    return 0;
  }
  let count = 0;
  const validityRules = Object.keys(validity).filter(
    (key) => key !== "children"
  );
  for (const key of validityRules) {
    const rule = validity[key];
    if (rule?.type === "invalid") {
      count++;
    }
  }
  if (validity.children) {
    for (const childValidity of Object.values(validity.children)) {
      count += countInvalidFields(childValidity);
    }
  }
  return count;
}
function getValidationMessage(validity) {
  const invalidCount = countInvalidFields(validity);
  if (invalidCount === 0) {
    return void 0;
  }
  return (0, import_i18n32.sprintf)(
    /* translators: %d: Number of fields that need attention */
    (0, import_i18n32._n)(
      "%d field needs attention",
      "%d fields need attention",
      invalidCount
    ),
    invalidCount
  );
}

// packages/dataviews/build-module/components/dataform-layouts/validation-badge.mjs
var import_jsx_runtime145 = __toESM(require_jsx_runtime(), 1);
function ValidationBadge({
  validity
}) {
  const message2 = getValidationMessage(validity);
  if (!message2) {
    return null;
  }
  return /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(Badge, { intent: "high", children: message2 });
}

// packages/dataviews/build-module/components/dataform-layouts/card/index.mjs
var import_jsx_runtime146 = __toESM(require_jsx_runtime(), 1);
function isSummaryFieldVisible(summaryField, summaryConfig, isOpen2) {
  if (!summaryConfig || Array.isArray(summaryConfig) && summaryConfig.length === 0) {
    return false;
  }
  const summaryConfigArray = Array.isArray(summaryConfig) ? summaryConfig : [summaryConfig];
  const fieldConfig = summaryConfigArray.find((config) => {
    if (typeof config === "string") {
      return config === summaryField.id;
    }
    if (typeof config === "object" && "id" in config) {
      return config.id === summaryField.id;
    }
    return false;
  });
  if (!fieldConfig) {
    return false;
  }
  if (typeof fieldConfig === "string") {
    return true;
  }
  if (typeof fieldConfig === "object" && "visibility" in fieldConfig) {
    return fieldConfig.visibility === "always" || fieldConfig.visibility === "when-collapsed" && !isOpen2;
  }
  return true;
}
function HeaderContent({
  data,
  fields,
  label,
  layout,
  isOpen: isOpen2,
  touched,
  validity
}) {
  const summaryFields = getSummaryFields(layout.summary, fields);
  const visibleSummaryFields = summaryFields.filter(
    (summaryField) => isSummaryFieldVisible(summaryField, layout.summary, isOpen2)
  );
  const hasBadge = touched && layout.isCollapsible;
  const hasSummary = visibleSummaryFields.length > 0 && layout.withHeader;
  return /* @__PURE__ */ (0, import_jsx_runtime146.jsxs)(
    Stack,
    {
      align: "center",
      justify: "space-between",
      className: "dataforms-layouts-card__field-header-content",
      children: [
        /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(card_exports.Title, { children: label }),
        (hasBadge || hasSummary) && /* @__PURE__ */ (0, import_jsx_runtime146.jsxs)(collapsible_card_exports.HeaderDescription, { className: "dataforms-layouts-card__field-header-content-description", children: [
          hasBadge && /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(ValidationBadge, { validity }),
          hasSummary && /* @__PURE__ */ (0, import_jsx_runtime146.jsx)("div", { className: "dataforms-layouts-card__field-summary", children: visibleSummaryFields.map((summaryField) => /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
            summaryField.render,
            {
              item: data,
              field: summaryField
            },
            summaryField.id
          )) })
        ] })
      ]
    }
  );
}
function BodyContent({
  data,
  field,
  form,
  onChange,
  hideLabelFromVision,
  markWhenOptional,
  validity,
  withHeader
}) {
  if (field.children) {
    return /* @__PURE__ */ (0, import_jsx_runtime146.jsxs)(import_jsx_runtime146.Fragment, { children: [
      field.description && /* @__PURE__ */ (0, import_jsx_runtime146.jsx)("div", { className: "dataforms-layouts-card__field-description", children: field.description }),
      /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
        DataFormLayout,
        {
          data,
          form,
          onChange,
          validity: validity?.children
        }
      )
    ] });
  }
  const SingleFieldLayout = getFormFieldLayout("regular")?.component;
  if (!SingleFieldLayout) {
    return null;
  }
  return /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
    SingleFieldLayout,
    {
      data,
      field,
      onChange,
      hideLabelFromVision: hideLabelFromVision || withHeader,
      markWhenOptional,
      validity
    }
  );
}
function FormCardField({
  data,
  field,
  onChange,
  hideLabelFromVision,
  markWhenOptional,
  validity
}) {
  const { fields } = (0, import_element106.useContext)(dataform_context_default);
  const layout = field.layout;
  const contentRef = (0, import_element106.useRef)(null);
  const hasFocusedContentRef = (0, import_element106.useRef)(false);
  const form = (0, import_element106.useMemo)(
    () => ({
      layout: DEFAULT_LAYOUT,
      fields: field.children ?? []
    }),
    [field]
  );
  const { isOpened, isCollapsible } = layout;
  const [isOpen2, setIsOpen] = (0, import_element106.useState)(isOpened);
  const [touched, setTouched] = (0, import_element106.useState)(false);
  (0, import_element106.useEffect)(() => {
    setIsOpen(isOpened);
  }, [isOpened]);
  const handleOpenChange = (0, import_element106.useCallback)((open3) => {
    if (!open3) {
      setTouched(true);
    }
    setIsOpen(open3);
  }, []);
  const revealValidity = useRevealValidity(
    contentRef,
    (isCollapsible ? isOpen2 : true) && touched
  );
  const handleContentFocus = (0, import_element106.useCallback)(() => {
    hasFocusedContentRef.current = true;
  }, []);
  const handleFocusOutside = (0, import_element106.useCallback)(() => {
    if (!hasFocusedContentRef.current) {
      return;
    }
    setTouched(true);
    if (isCollapsible && !isOpen2) {
      return;
    }
    const revealedCount = revealValidity();
    const message2 = getValidationMessage(validity);
    if (revealedCount > 0 && message2) {
      speak4(message2, "polite");
    }
  }, [isCollapsible, isOpen2, revealValidity, validity]);
  const focusOutsideProps = (0, import_compose17.__experimentalUseFocusOutside)(handleFocusOutside);
  let label = field.label;
  let withHeader;
  if (field.children) {
    withHeader = !!label && layout.withHeader;
  } else {
    const fieldDefinition = fields.find(
      (fieldDef) => fieldDef.id === field.id
    );
    if (!canRenderField(fieldDefinition)) {
      return null;
    }
    label = fieldDefinition.label;
    withHeader = !!label && layout.withHeader;
  }
  const bodyContent = /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
    BodyContent,
    {
      data,
      field,
      form,
      onChange,
      hideLabelFromVision,
      markWhenOptional,
      validity,
      withHeader
    }
  );
  const headerContent = /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
    HeaderContent,
    {
      data,
      fields,
      label,
      layout,
      isOpen: isCollapsible ? !!isOpen2 : true,
      touched,
      validity
    }
  );
  if (withHeader && isCollapsible) {
    return /* @__PURE__ */ (0, import_jsx_runtime146.jsxs)(
      collapsible_card_exports.Root,
      {
        className: "dataforms-layouts-card__field",
        open: isOpen2,
        onOpenChange: handleOpenChange,
        ...focusOutsideProps,
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(collapsible_card_exports.Header, { children: headerContent }),
          /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
            collapsible_card_exports.Content,
            {
              ref: contentRef,
              onFocus: handleContentFocus,
              children: bodyContent
            }
          )
        ]
      }
    );
  }
  return /* @__PURE__ */ (0, import_jsx_runtime146.jsxs)(
    card_exports.Root,
    {
      className: "dataforms-layouts-card__field",
      ...focusOutsideProps,
      children: [
        withHeader && /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(card_exports.Header, { children: headerContent }),
        /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(card_exports.Content, { ref: contentRef, onFocus: handleContentFocus, children: bodyContent })
      ]
    }
  );
}

// packages/dataviews/build-module/components/dataform-layouts/row/index.mjs
var import_components29 = __toESM(require_components(), 1);
var import_jsx_runtime147 = __toESM(require_jsx_runtime(), 1);
function Header5({ title }) {
  return /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
    Stack,
    {
      direction: "column",
      className: "dataforms-layouts-row__header",
      gap: "lg",
      children: /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(Stack, { direction: "row", align: "center", children: /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(import_components29.__experimentalHeading, { level: 2, size: 13, children: title }) })
    }
  );
}
var EMPTY_WRAPPER = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(import_jsx_runtime147.Fragment, { children });
function FormRowField({
  data,
  field,
  onChange,
  hideLabelFromVision,
  markWhenOptional,
  validity
}) {
  const layout = field.layout;
  if (!!field.children) {
    const form = {
      layout: DEFAULT_LAYOUT,
      fields: field.children
    };
    return /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "dataforms-layouts-row__field", children: [
      !hideLabelFromVision && field.label && /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(Header5, { title: field.label }),
      /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(Stack, { direction: "row", align: layout.alignment, gap: "lg", children: /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
        DataFormLayout,
        {
          data,
          form,
          onChange,
          validity: validity?.children,
          as: EMPTY_WRAPPER,
          children: (FieldLayout, childField, childFieldValidity) => /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
            "div",
            {
              className: "dataforms-layouts-row__field-control",
              style: layout.styles[childField.id],
              children: /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
                FieldLayout,
                {
                  data,
                  field: childField,
                  onChange,
                  hideLabelFromVision,
                  markWhenOptional,
                  validity: childFieldValidity
                }
              )
            },
            childField.id
          )
        }
      ) })
    ] });
  }
  const RegularLayout = getFormFieldLayout("regular")?.component;
  if (!RegularLayout) {
    return null;
  }
  return /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(import_jsx_runtime147.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: "dataforms-layouts-row__field-control", children: /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
    RegularLayout,
    {
      data,
      field,
      onChange,
      markWhenOptional,
      validity
    }
  ) }) });
}

// packages/dataviews/build-module/components/dataform-layouts/details/index.mjs
var import_element107 = __toESM(require_element(), 1);
var import_i18n33 = __toESM(require_i18n(), 1);
var import_compose18 = __toESM(require_compose(), 1);
import { speak as speak5 } from "@wordpress/a11y";
var import_jsx_runtime148 = __toESM(require_jsx_runtime(), 1);
function FormDetailsField({
  data,
  field,
  onChange,
  validity
}) {
  const { fields } = (0, import_element107.useContext)(dataform_context_default);
  const detailsRef = (0, import_element107.useRef)(null);
  const contentRef = (0, import_element107.useRef)(null);
  const hasFocusedContentRef = (0, import_element107.useRef)(false);
  const [touched, setTouched] = (0, import_element107.useState)(false);
  const [isOpen2, setIsOpen] = (0, import_element107.useState)(false);
  const form = (0, import_element107.useMemo)(
    () => ({
      layout: DEFAULT_LAYOUT,
      fields: field.children ?? []
    }),
    [field]
  );
  (0, import_element107.useEffect)(() => {
    const details = detailsRef.current;
    if (!details) {
      return;
    }
    const handleToggle = () => {
      const nowOpen = details.open;
      if (!nowOpen) {
        setTouched(true);
      }
      setIsOpen(nowOpen);
    };
    details.addEventListener("toggle", handleToggle);
    return () => {
      details.removeEventListener("toggle", handleToggle);
    };
  }, []);
  const revealValidity = useRevealValidity(contentRef, isOpen2 && touched);
  const handleContentFocus = (0, import_element107.useCallback)(() => {
    hasFocusedContentRef.current = true;
  }, []);
  const handleFocusOutside = (0, import_element107.useCallback)(() => {
    if (!hasFocusedContentRef.current) {
      return;
    }
    setTouched(true);
    if (!detailsRef.current?.open) {
      return;
    }
    const revealedCount = revealValidity();
    const message2 = getValidationMessage(validity);
    if (revealedCount > 0 && message2) {
      speak5(message2, "polite");
    }
  }, [revealValidity, validity]);
  const focusOutsideProps = (0, import_compose18.__experimentalUseFocusOutside)(handleFocusOutside);
  if (!field.children) {
    return null;
  }
  const summaryFieldId = field.layout.summary ?? "";
  const summaryField = summaryFieldId ? fields.find((fieldDef) => fieldDef.id === summaryFieldId) : void 0;
  let summaryContent;
  if (summaryField && summaryField.render) {
    summaryContent = /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(summaryField.render, { item: data, field: summaryField });
  } else {
    summaryContent = field.label || (0, import_i18n33.__)("More details");
  }
  return /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)(
    "details",
    {
      ref: detailsRef,
      className: "dataforms-layouts-details__details",
      ...focusOutsideProps,
      children: [
        /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("summary", { className: "dataforms-layouts-details__summary", children: /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)(
          Stack,
          {
            direction: "row",
            align: "center",
            gap: "md",
            className: "dataforms-layouts-details__summary-content",
            children: [
              summaryContent,
              touched && /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(ValidationBadge, { validity })
            ]
          }
        ) }),
        /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(
          "div",
          {
            ref: contentRef,
            className: "dataforms-layouts-details__content",
            onFocus: handleContentFocus,
            children: /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(
              DataFormLayout,
              {
                data,
                form,
                onChange,
                validity: validity?.children
              }
            )
          }
        )
      ]
    }
  );
}

// packages/dataviews/build-module/components/dataform-layouts/index.mjs
var import_jsx_runtime149 = __toESM(require_jsx_runtime(), 1);
var FORM_FIELD_LAYOUTS = [
  {
    type: "regular",
    component: FormRegularField,
    wrapper: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
      Stack,
      {
        direction: "column",
        className: "dataforms-layouts__wrapper",
        gap: "lg",
        children
      }
    )
  },
  {
    type: "panel",
    component: FormPanelField,
    wrapper: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
      Stack,
      {
        direction: "column",
        className: "dataforms-layouts__wrapper",
        gap: "md",
        children
      }
    )
  },
  {
    type: "card",
    component: FormCardField,
    wrapper: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
      Stack,
      {
        direction: "column",
        className: "dataforms-layouts__wrapper",
        gap: "xl",
        children
      }
    )
  },
  {
    type: "row",
    component: FormRowField,
    wrapper: ({
      children,
      layout
    }) => /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
      Stack,
      {
        direction: "column",
        className: "dataforms-layouts__wrapper",
        gap: "lg",
        children: /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("div", { className: "dataforms-layouts-row__field", children: /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
          Stack,
          {
            direction: "row",
            gap: "lg",
            align: layout.alignment,
            children
          }
        ) })
      }
    )
  },
  {
    type: "details",
    component: FormDetailsField
  }
];
function getFormFieldLayout(type) {
  return FORM_FIELD_LAYOUTS.find((layout) => layout.type === type);
}

// packages/dataviews/build-module/components/dataform-layouts/data-form-layout.mjs
var import_jsx_runtime150 = __toESM(require_jsx_runtime(), 1);
var DEFAULT_WRAPPER = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(Stack, { direction: "column", className: "dataforms-layouts__wrapper", gap: "lg", children });
function DataFormLayout({
  data,
  form,
  onChange,
  validity,
  children,
  as
}) {
  const { fields: fieldDefinitions } = (0, import_element108.useContext)(dataform_context_default);
  const markWhenOptional = (0, import_element108.useMemo)(() => {
    const requiredCount = fieldDefinitions.filter(
      (f) => !!f.isValid?.required
    ).length;
    const optionalCount = fieldDefinitions.length - requiredCount;
    return requiredCount > optionalCount;
  }, [fieldDefinitions]);
  function getFieldDefinition2(field) {
    return fieldDefinitions.find(
      (fieldDefinition) => fieldDefinition.id === field.id
    );
  }
  const Wrapper = as ?? getFormFieldLayout(form.layout.type)?.wrapper ?? DEFAULT_WRAPPER;
  return /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(Wrapper, { layout: form.layout, children: form.fields.map((formField) => {
    const FieldLayout = getFormFieldLayout(
      formField.layout.type
    )?.component;
    if (!FieldLayout) {
      return null;
    }
    const fieldDefinition = !formField.children ? getFieldDefinition2(formField) : void 0;
    if (fieldDefinition && fieldDefinition.isVisible && !fieldDefinition.isVisible(data)) {
      return null;
    }
    if (children) {
      return children(
        FieldLayout,
        formField,
        validity?.[formField.id],
        markWhenOptional
      );
    }
    return /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
      FieldLayout,
      {
        data,
        field: formField,
        onChange,
        markWhenOptional,
        validity: validity?.[formField.id]
      },
      formField.id
    );
  }) });
}

// packages/dataviews/build-module/dataform/index.mjs
var import_jsx_runtime151 = __toESM(require_jsx_runtime(), 1);
function DataForm({
  data,
  form,
  fields,
  onChange,
  validity
}) {
  const normalizedForm = (0, import_element109.useMemo)(() => normalize_form_default(form), [form]);
  const normalizedFields = (0, import_element109.useMemo)(
    () => normalizeFields(fields),
    [fields]
  );
  if (!form.fields) {
    return null;
  }
  return /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(DataFormProvider, { fields: normalizedFields, children: /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
    DataFormLayout,
    {
      data,
      form: normalizedForm,
      onChange,
      validity
    }
  ) });
}

// packages/media-editor/build-module/components/media-form/index.mjs
var import_components30 = __toESM(require_components(), 1);
var import_i18n34 = __toESM(require_i18n(), 1);
var import_jsx_runtime152 = __toESM(require_jsx_runtime(), 1);
function MediaForm({
  form: formOverrides,
  header
}) {
  const { media, fields, onChange } = useMediaEditorContext();
  if (!media || !onChange) {
    return /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("div", { className: "media-editor-form media-editor-form--loading", children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(import_components30.Spinner, {}) });
  }
  const regularFieldIds = ["title", "alt_text", "caption", "description"];
  const sortedFields = [
    ...fields.filter(
      (field) => regularFieldIds.includes(field.id)
    ),
    ...fields.filter(
      (field) => !regularFieldIds.includes(field.id)
    )
  ];
  const defaultForm = {
    layout: {
      type: "panel"
    },
    fields: sortedFields.map((field) => {
      if (regularFieldIds.includes(field.id)) {
        return {
          id: field.id,
          layout: {
            type: "regular",
            labelPosition: "top"
          }
        };
      }
      return field.id;
    })
  };
  const form = formOverrides || defaultForm;
  return /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("div", { className: "media-editor-form", children: /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(import_components30.__experimentalVStack, { spacing: 4, children: [
    /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(VisuallyHidden, { render: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("h2", {}), children: (0, import_i18n34.__)("Media details") }),
    header,
    /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
      DataForm,
      {
        data: media,
        fields,
        form,
        onChange
      }
    )
  ] }) });
}

// packages/media-editor/build-module/lock-unlock.mjs
var import_private_apis2 = __toESM(require_private_apis(), 1);
var { lock: lock2, unlock: unlock2 } = (0, import_private_apis2.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
  "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
  "@wordpress/media-editor"
);

// packages/media-editor/build-module/store/index.mjs
var import_data = __toESM(require_data(), 1);

// packages/media-editor/build-module/store/reducer.mjs
var DEFAULT_STATE = {
  isOpen: false,
  id: null,
  onUpdate: null,
  onClose: null
};
function reducer(state = DEFAULT_STATE, action) {
  switch (action.type) {
    case "OPEN_MEDIA_EDITOR_MODAL": {
      const { id, onUpdate, onClose } = action;
      return {
        isOpen: true,
        id,
        onUpdate,
        onClose
      };
    }
    case "CLOSE_MEDIA_EDITOR_MODAL":
      return DEFAULT_STATE;
  }
  return state;
}

// packages/media-editor/build-module/store/actions.mjs
var actions_exports = {};
__export(actions_exports, {
  closeMediaEditorModal: () => closeMediaEditorModal,
  openMediaEditorModal: () => openMediaEditorModal
});
function openMediaEditorModal({
  id,
  onUpdate,
  onClose
}) {
  return {
    type: "OPEN_MEDIA_EDITOR_MODAL",
    id,
    onUpdate: onUpdate ?? null,
    onClose: onClose ?? null
  };
}
function closeMediaEditorModal() {
  return { type: "CLOSE_MEDIA_EDITOR_MODAL" };
}

// packages/media-editor/build-module/store/selectors.mjs
var selectors_exports = {};
__export(selectors_exports, {
  getId: () => getId,
  getOnClose: () => getOnClose,
  getOnUpdate: () => getOnUpdate,
  isOpen: () => isOpen
});
function isOpen(state) {
  return state.isOpen;
}
function getId(state) {
  return state.id;
}
function getOnUpdate(state) {
  return state.onUpdate;
}
function getOnClose(state) {
  return state.onClose;
}

// packages/media-editor/build-module/store/constants.mjs
var STORE_NAME = "core/media-editor";

// packages/media-editor/build-module/store/index.mjs
var store = (0, import_data.createReduxStore)(STORE_NAME, {
  reducer,
  actions: actions_exports,
  selectors: selectors_exports
});
(0, import_data.register)(store);

// packages/media-editor/build-module/components/media-editor-modal/index.mjs
var import_components37 = __toESM(require_components(), 1);
var import_data4 = __toESM(require_data(), 1);
var import_i18n46 = __toESM(require_i18n(), 1);
var import_keyboard_shortcuts = __toESM(require_keyboard_shortcuts(), 1);
var import_notices3 = __toESM(require_notices(), 1);

// packages/media-editor/build-module/components/media-editor/index.mjs
var import_components36 = __toESM(require_components(), 1);
var import_compose19 = __toESM(require_compose(), 1);
var import_data3 = __toESM(require_data(), 1);
var import_core_data2 = __toESM(require_core_data(), 1);
var import_element127 = __toESM(require_element(), 1);
var import_i18n45 = __toESM(require_i18n(), 1);
var import_keycodes2 = __toESM(require_keycodes(), 1);
var import_notices2 = __toESM(require_notices(), 1);

// packages/media-editor/build-module/components/media-editor-canvas/index.mjs
var import_element120 = __toESM(require_element(), 1);
var import_components32 = __toESM(require_components(), 1);
var import_i18n39 = __toESM(require_i18n(), 1);

// packages/media-editor/build-module/image-editor/core/constants.mjs
var import_i18n35 = __toESM(require_i18n(), 1);
var MIN_ZOOM = 1;
var ABSOLUTE_MIN_ZOOM = 0.1;
var MAX_ZOOM = 10;
var MIN_CROP_PIXELS = 16;
var MIN_CROP_SCREEN_PX = 44;
var SETTLE_TARGET_CANVAS_FILL = 0.8;
var MAX_VIEW_SCALE = 8;
var PIXEL_SNAP_DISPLAY_SCALE = 1;
var DEFAULT_WHEEL_ZOOM_SPEED = 25e-4;
var DEFAULT_KEYBOARD_STEP = 0.01;
var KEYBOARD_SHIFT_STEP_MULTIPLIER = 10;
var MAX_ROTATION_OFFSET = 45;
var DEFAULT_CROP_RECT = {
  x: 0,
  y: 0,
  width: 1,
  height: 1
};
var DEFAULT_FLIP = {
  horizontal: false,
  vertical: false
};
var DEFAULT_PAN = {
  x: 0,
  y: 0
};
var DEFAULT_STATE2 = {
  image: null,
  pan: { ...DEFAULT_PAN },
  zoom: MIN_ZOOM,
  rotation: 0,
  basePan: { ...DEFAULT_PAN },
  baseZoom: MIN_ZOOM,
  baseRotation: 0,
  flip: { ...DEFAULT_FLIP },
  cropRect: { ...DEFAULT_CROP_RECT }
};
var ORIGINAL_ASPECT_RATIO = -1;
var DEFAULT_ASPECT_RATIOS = [
  { label: (0, import_i18n35.__)("Free"), value: 0 },
  { label: (0, import_i18n35.__)("Original"), value: ORIGINAL_ASPECT_RATIO },
  { label: (0, import_i18n35.__)("Square (1:1)"), value: 1 },
  { label: (0, import_i18n35.__)("Landscape (16:9)"), value: 16 / 9 },
  { label: (0, import_i18n35.__)("Portrait (9:16)"), value: 9 / 16 },
  { label: (0, import_i18n35.__)("Classic (4:3)"), value: 4 / 3 },
  { label: (0, import_i18n35.__)("Classic portrait (3:4)"), value: 3 / 4 },
  { label: (0, import_i18n35.__)("Photo (3:2)"), value: 3 / 2 },
  { label: (0, import_i18n35.__)("Photo portrait (2:3)"), value: 2 / 3 }
];

// node_modules/gl-matrix/esm/common.js
var EPSILON = 1e-6;
var ARRAY_TYPE = typeof Float32Array !== "undefined" ? Float32Array : Array;
var RANDOM = Math.random;
function round2(a) {
  if (a >= 0) return Math.round(a);
  return a % 0.5 === 0 ? Math.floor(a) : Math.round(a);
}
var degree = Math.PI / 180;
var radian = 180 / Math.PI;

// node_modules/gl-matrix/esm/mat2d.js
var mat2d_exports = {};
__export(mat2d_exports, {
  add: () => add,
  clone: () => clone,
  copy: () => copy,
  create: () => create,
  determinant: () => determinant,
  equals: () => equals,
  exactEquals: () => exactEquals,
  frob: () => frob,
  fromRotation: () => fromRotation,
  fromScaling: () => fromScaling,
  fromTranslation: () => fromTranslation,
  fromValues: () => fromValues,
  identity: () => identity,
  invert: () => invert,
  mul: () => mul,
  multiply: () => multiply,
  multiplyScalar: () => multiplyScalar,
  multiplyScalarAndAdd: () => multiplyScalarAndAdd,
  rotate: () => rotate,
  scale: () => scale,
  set: () => set,
  str: () => str,
  sub: () => sub,
  subtract: () => subtract,
  translate: () => translate
});
function create() {
  var out = new ARRAY_TYPE(6);
  if (ARRAY_TYPE != Float32Array) {
    out[1] = 0;
    out[2] = 0;
    out[4] = 0;
    out[5] = 0;
  }
  out[0] = 1;
  out[3] = 1;
  return out;
}
function clone(a) {
  var out = new ARRAY_TYPE(6);
  out[0] = a[0];
  out[1] = a[1];
  out[2] = a[2];
  out[3] = a[3];
  out[4] = a[4];
  out[5] = a[5];
  return out;
}
function copy(out, a) {
  out[0] = a[0];
  out[1] = a[1];
  out[2] = a[2];
  out[3] = a[3];
  out[4] = a[4];
  out[5] = a[5];
  return out;
}
function identity(out) {
  out[0] = 1;
  out[1] = 0;
  out[2] = 0;
  out[3] = 1;
  out[4] = 0;
  out[5] = 0;
  return out;
}
function fromValues(a, b, c2, d, tx, ty) {
  var out = new ARRAY_TYPE(6);
  out[0] = a;
  out[1] = b;
  out[2] = c2;
  out[3] = d;
  out[4] = tx;
  out[5] = ty;
  return out;
}
function set(out, a, b, c2, d, tx, ty) {
  out[0] = a;
  out[1] = b;
  out[2] = c2;
  out[3] = d;
  out[4] = tx;
  out[5] = ty;
  return out;
}
function invert(out, a) {
  var aa = a[0], ab = a[1], ac = a[2], ad = a[3];
  var atx = a[4], aty = a[5];
  var det = aa * ad - ab * ac;
  if (!det) {
    return null;
  }
  det = 1 / det;
  out[0] = ad * det;
  out[1] = -ab * det;
  out[2] = -ac * det;
  out[3] = aa * det;
  out[4] = (ac * aty - ad * atx) * det;
  out[5] = (ab * atx - aa * aty) * det;
  return out;
}
function determinant(a) {
  return a[0] * a[3] - a[1] * a[2];
}
function multiply(out, a, b) {
  var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5];
  var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3], b4 = b[4], b5 = b[5];
  out[0] = a0 * b0 + a2 * b1;
  out[1] = a1 * b0 + a3 * b1;
  out[2] = a0 * b2 + a2 * b3;
  out[3] = a1 * b2 + a3 * b3;
  out[4] = a0 * b4 + a2 * b5 + a4;
  out[5] = a1 * b4 + a3 * b5 + a5;
  return out;
}
function rotate(out, a, rad) {
  var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5];
  var s = Math.sin(rad);
  var c2 = Math.cos(rad);
  out[0] = a0 * c2 + a2 * s;
  out[1] = a1 * c2 + a3 * s;
  out[2] = a0 * -s + a2 * c2;
  out[3] = a1 * -s + a3 * c2;
  out[4] = a4;
  out[5] = a5;
  return out;
}
function scale(out, a, v2) {
  var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5];
  var v0 = v2[0], v1 = v2[1];
  out[0] = a0 * v0;
  out[1] = a1 * v0;
  out[2] = a2 * v1;
  out[3] = a3 * v1;
  out[4] = a4;
  out[5] = a5;
  return out;
}
function translate(out, a, v2) {
  var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5];
  var v0 = v2[0], v1 = v2[1];
  out[0] = a0;
  out[1] = a1;
  out[2] = a2;
  out[3] = a3;
  out[4] = a0 * v0 + a2 * v1 + a4;
  out[5] = a1 * v0 + a3 * v1 + a5;
  return out;
}
function fromRotation(out, rad) {
  var s = Math.sin(rad), c2 = Math.cos(rad);
  out[0] = c2;
  out[1] = s;
  out[2] = -s;
  out[3] = c2;
  out[4] = 0;
  out[5] = 0;
  return out;
}
function fromScaling(out, v2) {
  out[0] = v2[0];
  out[1] = 0;
  out[2] = 0;
  out[3] = v2[1];
  out[4] = 0;
  out[5] = 0;
  return out;
}
function fromTranslation(out, v2) {
  out[0] = 1;
  out[1] = 0;
  out[2] = 0;
  out[3] = 1;
  out[4] = v2[0];
  out[5] = v2[1];
  return out;
}
function str(a) {
  return "mat2d(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] + ", " + a[4] + ", " + a[5] + ")";
}
function frob(a) {
  return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + 1);
}
function add(out, a, b) {
  out[0] = a[0] + b[0];
  out[1] = a[1] + b[1];
  out[2] = a[2] + b[2];
  out[3] = a[3] + b[3];
  out[4] = a[4] + b[4];
  out[5] = a[5] + b[5];
  return out;
}
function subtract(out, a, b) {
  out[0] = a[0] - b[0];
  out[1] = a[1] - b[1];
  out[2] = a[2] - b[2];
  out[3] = a[3] - b[3];
  out[4] = a[4] - b[4];
  out[5] = a[5] - b[5];
  return out;
}
function multiplyScalar(out, a, b) {
  out[0] = a[0] * b;
  out[1] = a[1] * b;
  out[2] = a[2] * b;
  out[3] = a[3] * b;
  out[4] = a[4] * b;
  out[5] = a[5] * b;
  return out;
}
function multiplyScalarAndAdd(out, a, b, scale3) {
  out[0] = a[0] + b[0] * scale3;
  out[1] = a[1] + b[1] * scale3;
  out[2] = a[2] + b[2] * scale3;
  out[3] = a[3] + b[3] * scale3;
  out[4] = a[4] + b[4] * scale3;
  out[5] = a[5] + b[5] * scale3;
  return out;
}
function exactEquals(a, b) {
  return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5];
}
function equals(a, b) {
  var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5];
  var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3], b4 = b[4], b5 = b[5];
  return Math.abs(a0 - b0) <= EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5));
}
var mul = multiply;
var sub = subtract;

// node_modules/gl-matrix/esm/vec2.js
var vec2_exports = {};
__export(vec2_exports, {
  add: () => add2,
  angle: () => angle,
  ceil: () => ceil,
  clone: () => clone2,
  copy: () => copy2,
  create: () => create2,
  cross: () => cross,
  dist: () => dist,
  distance: () => distance,
  div: () => div,
  divide: () => divide,
  dot: () => dot,
  equals: () => equals2,
  exactEquals: () => exactEquals2,
  floor: () => floor2,
  forEach: () => forEach,
  fromValues: () => fromValues2,
  inverse: () => inverse,
  len: () => len,
  length: () => length,
  lerp: () => lerp,
  max: () => max3,
  min: () => min3,
  mul: () => mul2,
  multiply: () => multiply2,
  negate: () => negate,
  normalize: () => normalize,
  random: () => random,
  rotate: () => rotate2,
  round: () => round3,
  scale: () => scale2,
  scaleAndAdd: () => scaleAndAdd,
  set: () => set2,
  signedAngle: () => signedAngle,
  sqrDist: () => sqrDist,
  sqrLen: () => sqrLen,
  squaredDistance: () => squaredDistance,
  squaredLength: () => squaredLength,
  str: () => str2,
  sub: () => sub2,
  subtract: () => subtract2,
  transformMat2: () => transformMat2,
  transformMat2d: () => transformMat2d,
  transformMat3: () => transformMat3,
  transformMat4: () => transformMat4,
  zero: () => zero
});
function create2() {
  var out = new ARRAY_TYPE(2);
  if (ARRAY_TYPE != Float32Array) {
    out[0] = 0;
    out[1] = 0;
  }
  return out;
}
function clone2(a) {
  var out = new ARRAY_TYPE(2);
  out[0] = a[0];
  out[1] = a[1];
  return out;
}
function fromValues2(x2, y2) {
  var out = new ARRAY_TYPE(2);
  out[0] = x2;
  out[1] = y2;
  return out;
}
function copy2(out, a) {
  out[0] = a[0];
  out[1] = a[1];
  return out;
}
function set2(out, x2, y2) {
  out[0] = x2;
  out[1] = y2;
  return out;
}
function add2(out, a, b) {
  out[0] = a[0] + b[0];
  out[1] = a[1] + b[1];
  return out;
}
function subtract2(out, a, b) {
  out[0] = a[0] - b[0];
  out[1] = a[1] - b[1];
  return out;
}
function multiply2(out, a, b) {
  out[0] = a[0] * b[0];
  out[1] = a[1] * b[1];
  return out;
}
function divide(out, a, b) {
  out[0] = a[0] / b[0];
  out[1] = a[1] / b[1];
  return out;
}
function ceil(out, a) {
  out[0] = Math.ceil(a[0]);
  out[1] = Math.ceil(a[1]);
  return out;
}
function floor2(out, a) {
  out[0] = Math.floor(a[0]);
  out[1] = Math.floor(a[1]);
  return out;
}
function min3(out, a, b) {
  out[0] = Math.min(a[0], b[0]);
  out[1] = Math.min(a[1], b[1]);
  return out;
}
function max3(out, a, b) {
  out[0] = Math.max(a[0], b[0]);
  out[1] = Math.max(a[1], b[1]);
  return out;
}
function round3(out, a) {
  out[0] = round2(a[0]);
  out[1] = round2(a[1]);
  return out;
}
function scale2(out, a, b) {
  out[0] = a[0] * b;
  out[1] = a[1] * b;
  return out;
}
function scaleAndAdd(out, a, b, scale3) {
  out[0] = a[0] + b[0] * scale3;
  out[1] = a[1] + b[1] * scale3;
  return out;
}
function distance(a, b) {
  var x2 = b[0] - a[0], y2 = b[1] - a[1];
  return Math.sqrt(x2 * x2 + y2 * y2);
}
function squaredDistance(a, b) {
  var x2 = b[0] - a[0], y2 = b[1] - a[1];
  return x2 * x2 + y2 * y2;
}
function length(a) {
  var x2 = a[0], y2 = a[1];
  return Math.sqrt(x2 * x2 + y2 * y2);
}
function squaredLength(a) {
  var x2 = a[0], y2 = a[1];
  return x2 * x2 + y2 * y2;
}
function negate(out, a) {
  out[0] = -a[0];
  out[1] = -a[1];
  return out;
}
function inverse(out, a) {
  out[0] = 1 / a[0];
  out[1] = 1 / a[1];
  return out;
}
function normalize(out, a) {
  var x2 = a[0], y2 = a[1];
  var len2 = x2 * x2 + y2 * y2;
  if (len2 > 0) {
    len2 = 1 / Math.sqrt(len2);
  }
  out[0] = a[0] * len2;
  out[1] = a[1] * len2;
  return out;
}
function dot(a, b) {
  return a[0] * b[0] + a[1] * b[1];
}
function cross(out, a, b) {
  var z = a[0] * b[1] - a[1] * b[0];
  out[0] = out[1] = 0;
  out[2] = z;
  return out;
}
function lerp(out, a, b, t) {
  var ax = a[0], ay = a[1];
  out[0] = ax + t * (b[0] - ax);
  out[1] = ay + t * (b[1] - ay);
  return out;
}
function random(out, scale3) {
  scale3 = scale3 === void 0 ? 1 : scale3;
  var r2 = RANDOM() * 2 * Math.PI;
  out[0] = Math.cos(r2) * scale3;
  out[1] = Math.sin(r2) * scale3;
  return out;
}
function transformMat2(out, a, m2) {
  var x2 = a[0], y2 = a[1];
  out[0] = m2[0] * x2 + m2[2] * y2;
  out[1] = m2[1] * x2 + m2[3] * y2;
  return out;
}
function transformMat2d(out, a, m2) {
  var x2 = a[0], y2 = a[1];
  out[0] = m2[0] * x2 + m2[2] * y2 + m2[4];
  out[1] = m2[1] * x2 + m2[3] * y2 + m2[5];
  return out;
}
function transformMat3(out, a, m2) {
  var x2 = a[0], y2 = a[1];
  out[0] = m2[0] * x2 + m2[3] * y2 + m2[6];
  out[1] = m2[1] * x2 + m2[4] * y2 + m2[7];
  return out;
}
function transformMat4(out, a, m2) {
  var x2 = a[0];
  var y2 = a[1];
  out[0] = m2[0] * x2 + m2[4] * y2 + m2[12];
  out[1] = m2[1] * x2 + m2[5] * y2 + m2[13];
  return out;
}
function rotate2(out, a, b, rad) {
  var p0 = a[0] - b[0], p1 = a[1] - b[1], sinC = Math.sin(rad), cosC = Math.cos(rad);
  out[0] = p0 * cosC - p1 * sinC + b[0];
  out[1] = p0 * sinC + p1 * cosC + b[1];
  return out;
}
function angle(a, b) {
  var ax = a[0], ay = a[1], bx = b[0], by = b[1];
  return Math.abs(Math.atan2(ay * bx - ax * by, ax * bx + ay * by));
}
function signedAngle(a, b) {
  var ax = a[0], ay = a[1], bx = b[0], by = b[1];
  return Math.atan2(ax * by - ay * bx, ax * bx + ay * by);
}
function zero(out) {
  out[0] = 0;
  out[1] = 0;
  return out;
}
function str2(a) {
  return "vec2(" + a[0] + ", " + a[1] + ")";
}
function exactEquals2(a, b) {
  return a[0] === b[0] && a[1] === b[1];
}
function equals2(a, b) {
  var a0 = a[0], a1 = a[1];
  var b0 = b[0], b1 = b[1];
  return Math.abs(a0 - b0) <= EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1));
}
var len = length;
var sub2 = subtract2;
var mul2 = multiply2;
var div = divide;
var dist = distance;
var sqrDist = squaredDistance;
var sqrLen = squaredLength;
var forEach = (function() {
  var vec = create2();
  return function(a, stride, offset4, count, fn, arg) {
    var i, l2;
    if (!stride) {
      stride = 2;
    }
    if (!offset4) {
      offset4 = 0;
    }
    if (count) {
      l2 = Math.min(count * stride + offset4, a.length);
    } else {
      l2 = a.length;
    }
    for (i = offset4; i < l2; i += stride) {
      vec[0] = a[i];
      vec[1] = a[i + 1];
      fn(vec, vec, arg);
      a[i] = vec[0];
      a[i + 1] = vec[1];
    }
    return a;
  };
})();

// packages/media-editor/build-module/image-editor/core/math/rotation.mjs
function normalizeRotation(degrees) {
  if (degrees >= 0) {
    return degrees % 360;
  }
  return (360 + degrees % 360) % 360;
}
function degreesToRadians(degrees) {
  return degrees * Math.PI / 180;
}

// packages/media-editor/build-module/image-editor/core/math/sanitize.mjs
var MAX_SAFE_MAGNITUDE = 1e6;
function safeBoundedNumber(value, fallback) {
  if (!Number.isFinite(value)) {
    return fallback;
  }
  if (Math.abs(value) > MAX_SAFE_MAGNITUDE) {
    return fallback;
  }
  return value;
}
function isSafeNumber(value) {
  return Number.isFinite(value) && Math.abs(value) <= MAX_SAFE_MAGNITUDE;
}
function isValidSize(size4) {
  return Number.isFinite(size4.width) && Number.isFinite(size4.height) && size4.width >= Number.EPSILON && size4.height >= Number.EPSILON && size4.width <= MAX_SAFE_MAGNITUDE && size4.height <= MAX_SAFE_MAGNITUDE;
}
function sanitizeRect(rect) {
  const x2 = safeBoundedNumber(rect.x, 0);
  const y2 = safeBoundedNumber(rect.y, 0);
  const width = safeBoundedNumber(rect.width, 0);
  const height = safeBoundedNumber(rect.height, 0);
  if (x2 === rect.x && y2 === rect.y && width === rect.width && height === rect.height) {
    return rect;
  }
  return { x: x2, y: y2, width, height };
}
function sanitizeCropperState(state) {
  const panX = safeBoundedNumber(state.pan.x, 0);
  const panY = safeBoundedNumber(state.pan.y, 0);
  const basePanX = safeBoundedNumber(state.basePan.x, 0);
  const basePanY = safeBoundedNumber(state.basePan.y, 0);
  const rotation = safeBoundedNumber(state.rotation, 0);
  const baseRotation = safeBoundedNumber(state.baseRotation, 0);
  const rawZoom = safeBoundedNumber(state.zoom, 1);
  const zoom = rawZoom >= Number.EPSILON ? rawZoom : 1;
  const rawBaseZoom = safeBoundedNumber(state.baseZoom, 1);
  const baseZoom = rawBaseZoom >= Number.EPSILON ? rawBaseZoom : 1;
  const cropRect = sanitizeRect(state.cropRect);
  const panUnchanged = panX === state.pan.x && panY === state.pan.y;
  const basePanUnchanged = basePanX === state.basePan.x && basePanY === state.basePan.y;
  if (panUnchanged && basePanUnchanged && zoom === state.zoom && baseZoom === state.baseZoom && rotation === state.rotation && baseRotation === state.baseRotation && cropRect === state.cropRect) {
    return state;
  }
  return {
    ...state,
    pan: panUnchanged ? state.pan : { x: panX, y: panY },
    zoom,
    rotation,
    basePan: basePanUnchanged ? state.basePan : { x: basePanX, y: basePanY },
    baseZoom,
    baseRotation,
    cropRect
  };
}

// packages/media-editor/build-module/image-editor/core/camera.mjs
var _scratchMat = mat2d_exports.create();
var _scratchVec = vec2_exports.create();
function getRotatedBBox(width, height, rotation) {
  if (!isSafeNumber(width) || !isSafeNumber(height) || !isSafeNumber(rotation) || width <= 0 || height <= 0) {
    return { width: 0, height: 0 };
  }
  const rad = degreesToRadians(rotation);
  const cosR = Math.abs(Math.cos(rad));
  const sinR = Math.abs(Math.sin(rad));
  return {
    width: cosR * width + sinR * height,
    height: sinR * width + cosR * height
  };
}
function getImageFit(containerSize, imageSize, rotation) {
  if (!isValidSize(containerSize) || !isValidSize(imageSize)) {
    return {
      elementSize: { width: 0, height: 0 },
      visualSize: { width: 0, height: 0 }
    };
  }
  const safeRotation = safeBoundedNumber(rotation, 0);
  const snapRotation = Math.round(safeRotation / 90) * 90;
  const naturalBBox = getRotatedBBox(
    imageSize.width,
    imageSize.height,
    snapRotation
  );
  if (naturalBBox.width === 0 || naturalBBox.height === 0) {
    return {
      elementSize: { width: 0, height: 0 },
      visualSize: { width: 0, height: 0 }
    };
  }
  const fitScale = Math.min(
    containerSize.width / naturalBBox.width,
    containerSize.height / naturalBBox.height
  );
  const renderedW = imageSize.width * fitScale;
  const renderedH = imageSize.height * fitScale;
  const visualSize = getRotatedBBox(renderedW, renderedH, snapRotation);
  return {
    elementSize: { width: renderedW, height: renderedH },
    visualSize
  };
}
function getViewScale(cropRect, canvasSize, visualSize, targetFill, maxScale) {
  const cropScreenW = cropRect.width * visualSize.width;
  const cropScreenH = cropRect.height * visualSize.height;
  if (!isValidSize(canvasSize) || !isValidSize(visualSize) || !(cropScreenW > 0) || !(cropScreenH > 0) || !Number.isFinite(targetFill) || !Number.isFinite(maxScale) || !(targetFill > 0) || !(maxScale >= 1)) {
    return 1;
  }
  const kW = targetFill * canvasSize.width / cropScreenW;
  const kH = targetFill * canvasSize.height / cropScreenH;
  const k2 = Math.min(kW, kH);
  return Math.min(maxScale, Math.max(1, k2));
}
function createCamera(state, containerSize, imageSize) {
  const m2 = mat2d_exports.create();
  if (!isValidSize(containerSize) || !isValidSize(imageSize)) {
    return m2;
  }
  const safeState = sanitizeCropperState(state);
  const snapRotation = Math.round(safeState.rotation / 90) * 90;
  const naturalBBox = getRotatedBBox(
    imageSize.width,
    imageSize.height,
    snapRotation
  );
  if (naturalBBox.width === 0 || naturalBBox.height === 0) {
    return m2;
  }
  const fitScale = Math.min(
    containerSize.width / naturalBBox.width,
    containerSize.height / naturalBBox.height
  );
  const renderedW = imageSize.width * fitScale;
  const renderedH = imageSize.height * fitScale;
  const { width: visualW, height: visualH } = getRotatedBBox(
    renderedW,
    renderedH,
    snapRotation
  );
  mat2d_exports.translate(m2, m2, [
    containerSize.width / 2,
    containerSize.height / 2
  ]);
  mat2d_exports.translate(m2, m2, [
    safeState.pan.x * visualW,
    safeState.pan.y * visualH
  ]);
  mat2d_exports.scale(m2, m2, [
    safeState.flip.horizontal ? -1 : 1,
    safeState.flip.vertical ? -1 : 1
  ]);
  mat2d_exports.rotate(m2, m2, degreesToRadians(safeState.rotation));
  mat2d_exports.scale(m2, m2, [safeState.zoom, safeState.zoom]);
  mat2d_exports.translate(m2, m2, [-renderedW / 2, -renderedH / 2]);
  mat2d_exports.scale(m2, m2, [renderedW, renderedH]);
  return m2;
}
function aabb(camera, corners) {
  const screenCorners = corners.map((c2) => {
    const out = vec2_exports.create();
    vec2_exports.transformMat2d(out, c2, camera);
    return out;
  });
  let minX = screenCorners[0][0];
  let maxX = screenCorners[0][0];
  let minY = screenCorners[0][1];
  let maxY = screenCorners[0][1];
  for (let i = 1; i < screenCorners.length; i++) {
    const s = screenCorners[i];
    if (s[0] < minX) {
      minX = s[0];
    }
    if (s[0] > maxX) {
      maxX = s[0];
    }
    if (s[1] < minY) {
      minY = s[1];
    }
    if (s[1] > maxY) {
      maxY = s[1];
    }
  }
  return { left: minX, top: minY, width: maxX - minX, height: maxY - minY };
}
function getVisibleBounds(camera) {
  return aabb(camera, [
    [0, 0],
    [1, 0],
    [1, 1],
    [0, 1]
  ]);
}
function createExportCamera(state, imageSize, outputSize) {
  const m2 = mat2d_exports.create();
  if (!isValidSize(imageSize) || !isValidSize(outputSize)) {
    return m2;
  }
  const { rotation, flip: flip4, cropRect, zoom, pan } = sanitizeCropperState(state);
  const snapRotation = Math.round(rotation / 90) * 90;
  const { width: rotW, height: rotH } = getRotatedBBox(
    imageSize.width,
    imageSize.height,
    snapRotation
  );
  const naturalCropW = cropRect.width * rotW;
  const naturalCropH = cropRect.height * rotH;
  const outputScaleX = naturalCropW > 0 ? outputSize.width / naturalCropW : 1;
  const outputScaleY = naturalCropH > 0 ? outputSize.height / naturalCropH : 1;
  const cropOffsetX = cropRect.x * rotW + outputSize.width / 2 / outputScaleX;
  const cropOffsetY = cropRect.y * rotH + outputSize.height / 2 / outputScaleY;
  const visualCenterX = rotW / 2 + pan.x * rotW;
  const visualCenterY = rotH / 2 + pan.y * rotH;
  mat2d_exports.scale(m2, m2, [outputScaleX, outputScaleY]);
  mat2d_exports.translate(m2, m2, [
    visualCenterX - cropOffsetX + outputSize.width / 2 / outputScaleX,
    visualCenterY - cropOffsetY + outputSize.height / 2 / outputScaleY
  ]);
  mat2d_exports.scale(m2, m2, [flip4.horizontal ? -1 : 1, flip4.vertical ? -1 : 1]);
  mat2d_exports.rotate(m2, m2, degreesToRadians(rotation));
  mat2d_exports.scale(m2, m2, [zoom, zoom]);
  mat2d_exports.translate(m2, m2, [-imageSize.width / 2, -imageSize.height / 2]);
  return m2;
}

// packages/media-editor/build-module/image-editor/core/export/canvas-renderer.mjs
var DEFAULT_QUALITY = 0.92;
function loadImage(src) {
  return new Promise((resolve, reject) => {
    const image = new Image();
    image.addEventListener("load", () => resolve(image));
    image.addEventListener("error", (error2) => reject(error2));
    image.crossOrigin = "anonymous";
    image.src = src;
  });
}
function renderToCanvas(image, state) {
  const { naturalWidth, naturalHeight } = image;
  const { rotation, cropRect } = state;
  const imageSize = { width: naturalWidth, height: naturalHeight };
  const snapRotation = Math.round(rotation / 90) * 90;
  const rotBBox = getRotatedBBox(naturalWidth, naturalHeight, snapRotation);
  const outW = Math.round(cropRect.width * rotBBox.width);
  const outH = Math.round(cropRect.height * rotBBox.height);
  const canvas = document.createElement("canvas");
  canvas.width = outW;
  canvas.height = outH;
  const ctx = canvas.getContext("2d");
  if (!ctx) {
    throw new Error(
      "Could not obtain a 2D context for the export canvas."
    );
  }
  const camera = createExportCamera(state, imageSize, {
    width: outW,
    height: outH
  });
  ctx.setTransform(
    camera[0],
    camera[1],
    camera[2],
    camera[3],
    camera[4],
    camera[5]
  );
  ctx.drawImage(image, 0, 0);
  return canvas;
}
function canvasToBlob(canvas, mimeType = "image/png", quality = DEFAULT_QUALITY) {
  return new Promise((resolve, reject) => {
    canvas.toBlob(
      (blob) => {
        if (blob) {
          resolve(blob);
        } else {
          reject(new Error("Canvas toBlob returned null."));
        }
      },
      mimeType,
      quality
    );
  });
}
async function exportCroppedImage(src, state, mimeType = "image/png", quality = DEFAULT_QUALITY) {
  const image = await loadImage(src);
  const canvas = renderToCanvas(image, state);
  return canvasToBlob(canvas, mimeType, quality);
}

// packages/media-editor/build-module/image-editor/core/containment.mjs
var EPSILON2 = 1e-9;
function getVisualDimensions(rotation, imageAspectRatio) {
  const rad = degreesToRadians(rotation);
  const absC = Math.abs(Math.cos(rad));
  const absS = Math.abs(Math.sin(rad));
  const bbox = getRotatedBBox(imageAspectRatio, 1, rotation);
  return {
    visualW: bbox.width,
    visualH: bbox.height,
    absC,
    absS
  };
}
function getMinZoomForCover(rotation, imageAspectRatio, cropRect) {
  const aspectRatio = Math.max(imageAspectRatio, Number.EPSILON);
  const snapRotation = Math.round(rotation / 90) * 90;
  const { visualW: snapVisualW, visualH: snapVisualH } = getVisualDimensions(
    snapRotation,
    aspectRatio
  );
  const { absC, absS } = getVisualDimensions(rotation, aspectRatio);
  const cropHalfW = cropRect.width * snapVisualW / 2;
  const cropHalfH = cropRect.height * snapVisualH / 2;
  const spanAlpha = cropHalfW * absC + cropHalfH * absS;
  const spanBeta = cropHalfW * absS + cropHalfH * absC;
  const zoomFromAlpha = 2 * spanAlpha / aspectRatio;
  const zoomFromBeta = 2 * spanBeta;
  return Math.max(zoomFromAlpha, zoomFromBeta);
}
function getMinZoom(state) {
  if (!state.image) {
    return MIN_ZOOM;
  }
  const imageSize = {
    width: state.image.naturalWidth,
    height: state.image.naturalHeight
  };
  if (!isValidSize(imageSize)) {
    return MIN_ZOOM;
  }
  const safeState = sanitizeCropperState(state);
  const aspectRatio = imageSize.width / imageSize.height;
  return Math.max(
    ABSOLUTE_MIN_ZOOM,
    getMinZoomForCover(
      safeState.rotation,
      aspectRatio,
      safeState.cropRect
    )
  );
}
function getImageCropBounds(state, elementSize, visualSize) {
  if (!isValidSize(elementSize) || !isValidSize(visualSize)) {
    return { minX: 0, minY: 0, maxX: 1, maxY: 1 };
  }
  const safeState = sanitizeCropperState(state);
  const tx = safeState.pan.x * visualSize.width;
  const ty = safeState.pan.y * visualSize.height;
  const rad = degreesToRadians(safeState.rotation);
  const cos = Math.cos(rad);
  const sin = Math.sin(rad);
  const sx = safeState.flip.horizontal ? -1 : 1;
  const sy = safeState.flip.vertical ? -1 : 1;
  const z = safeState.zoom;
  const ma = sx * cos * z;
  const mb = sy * sin * z;
  const mc = -sx * sin * z;
  const md = sy * cos * z;
  const hw = elementSize.width / 2;
  const hh = elementSize.height / 2;
  const corners = [
    [-hw, -hh],
    [hw, -hh],
    [hw, hh],
    [-hw, hh]
  ];
  let imgMinX = Infinity;
  let imgMaxX = -Infinity;
  let imgMinY = Infinity;
  let imgMaxY = -Infinity;
  for (const [cx, cy] of corners) {
    const screenX = ma * cx + mc * cy + tx;
    const screenY = mb * cx + md * cy + ty;
    const nx = screenX / visualSize.width + 0.5;
    const ny = screenY / visualSize.height + 0.5;
    imgMinX = Math.min(imgMinX, nx);
    imgMaxX = Math.max(imgMaxX, nx);
    imgMinY = Math.min(imgMinY, ny);
    imgMaxY = Math.max(imgMaxY, ny);
  }
  return {
    minX: imgMinX,
    minY: imgMinY,
    maxX: imgMaxX,
    maxY: imgMaxY
  };
}
function restrictCropRect(cropRect, zoom, rotation, imageAspectRatio) {
  const safeRect = sanitizeRect(cropRect);
  const zoomCandidate = safeBoundedNumber(zoom, 1);
  const safeZoom = zoomCandidate >= Number.EPSILON ? zoomCandidate : 1;
  const safeRotation = safeBoundedNumber(rotation, 0);
  const safeAspect = safeBoundedNumber(imageAspectRatio, 1);
  const aspectRatio = Math.max(safeAspect, Number.EPSILON);
  const snapRotation = Math.round(safeRotation / 90) * 90;
  const { visualW, visualH } = getVisualDimensions(
    snapRotation,
    aspectRatio
  );
  const { absC, absS } = getVisualDimensions(safeRotation, aspectRatio);
  const W = safeRect.width;
  const H2 = safeRect.height;
  const cropWPx = W * visualW;
  const cropHPx = H2 * visualH;
  const spanAlpha = cropWPx * absC + cropHPx * absS;
  const spanBeta = cropWPx * absS + cropHPx * absC;
  const limitAlpha = aspectRatio * safeZoom;
  const limitBeta = safeZoom;
  let t = 1;
  if (spanAlpha > 0) {
    t = Math.min(t, limitAlpha / spanAlpha);
  }
  if (spanBeta > 0) {
    t = Math.min(t, limitBeta / spanBeta);
  }
  if (t >= 1 - EPSILON2) {
    return safeRect;
  }
  const newW = W * t;
  const newH = H2 * t;
  const centerX = safeRect.x + W / 2;
  const centerY = safeRect.y + H2 / 2;
  let newX = centerX - newW / 2;
  let newY = centerY - newH / 2;
  newX = Math.max(0, Math.min(newX, 1 - newW));
  newY = Math.max(0, Math.min(newY, 1 - newH));
  return { x: newX, y: newY, width: newW, height: newH };
}
var CANONICAL_CONTAINER = { width: 1e3, height: 1e3 };
var _scratchMat2 = mat2d_exports.create();
var _scratchVec2 = vec2_exports.create();
function restrictPanZoom(state, imageSize, cropRect) {
  const safeState = sanitizeCropperState(state);
  const safeCropRect = sanitizeRect(cropRect);
  const aspectRatio = isValidSize(imageSize) ? imageSize.width / imageSize.height : 1;
  const minZoom = Math.max(
    ABSOLUTE_MIN_ZOOM,
    getMinZoomForCover(safeState.rotation, aspectRatio, safeCropRect)
  );
  const zoom = Math.min(MAX_ZOOM, Math.max(safeState.zoom, minZoom));
  const candidateState = { ...safeState, zoom };
  const camera = createCamera(
    candidateState,
    CANONICAL_CONTAINER,
    imageSize
  );
  const snapRotation = Math.round(safeState.rotation / 90) * 90;
  const baseCamera = createCamera(
    {
      ...candidateState,
      pan: { x: 0, y: 0 },
      zoom: 1,
      rotation: snapRotation
    },
    CANONICAL_CONTAINER,
    imageSize
  );
  const visibleBounds = getVisibleBounds(baseCamera);
  const stencilCorners = [
    [
      visibleBounds.left + safeCropRect.x * visibleBounds.width,
      visibleBounds.top + safeCropRect.y * visibleBounds.height
    ],
    [
      visibleBounds.left + (safeCropRect.x + safeCropRect.width) * visibleBounds.width,
      visibleBounds.top + safeCropRect.y * visibleBounds.height
    ],
    [
      visibleBounds.left + (safeCropRect.x + safeCropRect.width) * visibleBounds.width,
      visibleBounds.top + (safeCropRect.y + safeCropRect.height) * visibleBounds.height
    ],
    [
      visibleBounds.left + safeCropRect.x * visibleBounds.width,
      visibleBounds.top + (safeCropRect.y + safeCropRect.height) * visibleBounds.height
    ]
  ];
  mat2d_exports.invert(_scratchMat2, camera);
  let minWx = Infinity;
  let maxWx = -Infinity;
  let minWy = Infinity;
  let maxWy = -Infinity;
  for (const corner of stencilCorners) {
    vec2_exports.transformMat2d(_scratchVec2, corner, _scratchMat2);
    const w2 = _scratchVec2;
    if (w2[0] < minWx) {
      minWx = w2[0];
    }
    if (w2[0] > maxWx) {
      maxWx = w2[0];
    }
    if (w2[1] < minWy) {
      minWy = w2[1];
    }
    if (w2[1] > maxWy) {
      maxWy = w2[1];
    }
  }
  if (minWx >= -EPSILON2 && maxWx <= 1 + EPSILON2 && minWy >= -EPSILON2 && maxWy <= 1 + EPSILON2) {
    return { pan: safeState.pan, zoom };
  }
  let dwx = 0;
  let dwy = 0;
  if (minWx < 0 && maxWx <= 1 + EPSILON2) {
    dwx = -minWx;
  } else if (maxWx > 1 && minWx >= -EPSILON2) {
    dwx = 1 - maxWx;
  } else if (minWx < 0 && maxWx > 1) {
    dwx = (1 - maxWx - minWx) / 2;
  }
  if (minWy < 0 && maxWy <= 1 + EPSILON2) {
    dwy = -minWy;
  } else if (maxWy > 1 && minWy >= -EPSILON2) {
    dwy = 1 - maxWy;
  } else if (minWy < 0 && maxWy > 1) {
    dwy = (1 - maxWy - minWy) / 2;
  }
  const dsx = camera[0] * dwx + camera[2] * dwy;
  const dsy = camera[1] * dwx + camera[3] * dwy;
  const newPanX = safeState.pan.x - (visibleBounds.width > 0 ? dsx / visibleBounds.width : 0);
  const newPanY = safeState.pan.y - (visibleBounds.height > 0 ? dsy / visibleBounds.height : 0);
  return {
    pan: { x: newPanX, y: newPanY },
    zoom
  };
}

// packages/media-editor/build-module/image-editor/core/state.mjs
var STATE_EPSILON = 1e-6;
function nearlyEqual(a, b) {
  return Math.abs(a - b) < STATE_EPSILON;
}
function areCropperStatesEqual(a, b) {
  const aImage = a.image;
  const bImage = b.image;
  return aImage?.src === bImage?.src && aImage?.naturalWidth === bImage?.naturalWidth && aImage?.naturalHeight === bImage?.naturalHeight && nearlyEqual(a.pan.x, b.pan.x) && nearlyEqual(a.pan.y, b.pan.y) && nearlyEqual(a.zoom, b.zoom) && nearlyEqual(a.rotation, b.rotation) && a.flip.horizontal === b.flip.horizontal && a.flip.vertical === b.flip.vertical && nearlyEqual(a.cropRect.x, b.cropRect.x) && nearlyEqual(a.cropRect.y, b.cropRect.y) && nearlyEqual(a.cropRect.width, b.cropRect.width) && nearlyEqual(a.cropRect.height, b.cropRect.height);
}
function clampRequestedZoom(state, zoom) {
  if (state.image) {
    return Math.min(MAX_ZOOM, Math.max(ABSOLUTE_MIN_ZOOM, zoom));
  }
  return Math.min(MAX_ZOOM, Math.max(MIN_ZOOM, zoom));
}
function operationToAction(state, op) {
  switch (op.type) {
    case "crop":
      return { type: "SET_CROP_RECT", payload: { ...op.rect } };
    case "rotate": {
      const singleFlip = state.flip.horizontal !== state.flip.vertical;
      const fieldDelta = singleFlip ? -op.degrees : op.degrees;
      return {
        type: "SET_ROTATION",
        payload: normalizeRotation(state.rotation + fieldDelta)
      };
    }
    case "flip":
      return {
        type: "SET_FLIP",
        payload: {
          ...state.flip,
          [op.direction]: !state.flip[op.direction]
        }
      };
    case "zoom":
      return { type: "SET_ZOOM", payload: op.factor };
  }
}
function enforceContainment(state) {
  if (!state.image) {
    return state;
  }
  const imageSize = {
    width: state.image.naturalWidth,
    height: state.image.naturalHeight
  };
  const imageAspectRatio = imageSize.width / imageSize.height;
  const { pan: panAfterZoom, zoom } = restrictPanZoom(
    state,
    imageSize,
    state.cropRect
  );
  const cropRect = restrictCropRect(
    state.cropRect,
    zoom,
    state.rotation,
    imageAspectRatio
  );
  let pan = panAfterZoom;
  if (cropRect !== state.cropRect) {
    ({ pan } = restrictPanZoom(
      { ...state, zoom, cropRect },
      imageSize,
      cropRect
    ));
  }
  if (pan.x === state.pan.x && pan.y === state.pan.y && zoom === state.zoom && cropRect === state.cropRect) {
    return state;
  }
  return { ...state, pan, zoom, cropRect };
}
function commitBase(next) {
  if (next.basePan.x === next.pan.x && next.basePan.y === next.pan.y && next.baseZoom === next.zoom && next.baseRotation === next.rotation) {
    return next;
  }
  return {
    ...next,
    basePan: { x: next.pan.x, y: next.pan.y },
    baseZoom: next.zoom,
    baseRotation: next.rotation
  };
}
function cropperReducer(state, action) {
  switch (action.type) {
    case "SET_IMAGE":
      return commitBase(
        enforceContainment({
          ...state,
          image: action.payload
        })
      );
    case "SET_PAN":
      return commitBase(
        enforceContainment({
          ...state,
          pan: action.payload
        })
      );
    case "SET_ZOOM": {
      const z = clampRequestedZoom(state, action.payload);
      return commitBase(
        enforceContainment({
          ...state,
          zoom: z
        })
      );
    }
    case "SET_ZOOM_AT_POINT": {
      const z = clampRequestedZoom(state, action.payload.zoom);
      return commitBase(
        enforceContainment({
          ...state,
          zoom: z,
          pan: action.payload.pan
        })
      );
    }
    case "SET_ROTATION": {
      const newRotation = normalizeRotation(action.payload);
      const singleFlip = state.flip.horizontal !== state.flip.vertical;
      const deltaRad = degreesToRadians(
        newRotation - state.baseRotation
      );
      const cos = Math.cos(deltaRad);
      const sin = Math.sin(deltaRad) * (singleFlip ? -1 : 1);
      const cropCx = state.cropRect.x + state.cropRect.width / 2;
      const cropCy = state.cropRect.y + state.cropRect.height / 2;
      const ox = cropCx - 0.5;
      const oy = cropCy - 0.5;
      const dx = state.basePan.x - ox;
      const dy = state.basePan.y - oy;
      return enforceContainment({
        ...state,
        rotation: newRotation,
        zoom: state.baseZoom,
        pan: {
          x: ox + cos * dx - sin * dy,
          y: oy + sin * dx + cos * dy
        }
      });
    }
    case "SNAP_ROTATE_90": {
      const rawDir = action.payload.direction;
      const singleFlip = state.flip.horizontal !== state.flip.vertical;
      const fieldDir = singleFlip ? -rawDir : rawDir;
      const rot90 = normalizeRotation(state.rotation + fieldDir * 90);
      const rect = state.cropRect;
      const cx = rect.x + rect.width / 2;
      const cy = rect.y + rect.height / 2;
      const newPanX = rawDir === 1 ? -state.pan.y : state.pan.y;
      const newPanY = rawDir === 1 ? state.pan.x : -state.pan.x;
      return commitBase(
        enforceContainment({
          ...state,
          rotation: rot90,
          zoom: state.baseZoom,
          pan: { x: newPanX, y: newPanY },
          cropRect: {
            x: cx - rect.height / 2,
            y: cy - rect.width / 2,
            width: rect.height,
            height: rect.width
          }
        })
      );
    }
    case "SET_FLIP": {
      const oldFlip = state.flip;
      const newFlip = action.payload;
      const flippedH = oldFlip.horizontal !== newFlip.horizontal;
      const flippedV = oldFlip.vertical !== newFlip.vertical;
      const rect = state.cropRect;
      return commitBase(
        enforceContainment({
          ...state,
          flip: newFlip,
          pan: {
            x: flippedH ? -state.pan.x : state.pan.x,
            y: flippedV ? -state.pan.y : state.pan.y
          },
          cropRect: {
            x: flippedH ? 1 - rect.x - rect.width : rect.x,
            y: flippedV ? 1 - rect.y - rect.height : rect.y,
            width: rect.width,
            height: rect.height
          }
        })
      );
    }
    case "SET_CROP_RECT":
      return commitBase(
        enforceContainment({
          ...state,
          cropRect: action.payload
        })
      );
    case "SETTLE_CROP": {
      const rect = state.cropRect;
      if (rect.width === 0 || rect.height === 0 || !state.image) {
        return state;
      }
      const fitScale = 1 / Math.max(rect.width, rect.height);
      const zoomCap = state.zoom > 0 ? MAX_ZOOM / state.zoom : fitScale;
      const s = Math.min(fitScale, zoomCap);
      const newW = rect.width * s;
      const newH = rect.height * s;
      const oldCx = rect.x + rect.width / 2;
      const oldCy = rect.y + rect.height / 2;
      return commitBase(
        enforceContainment({
          ...state,
          zoom: state.zoom * s,
          pan: {
            x: (state.pan.x - oldCx + 0.5) * s,
            y: (state.pan.y - oldCy + 0.5) * s
          },
          cropRect: {
            x: (1 - newW) / 2,
            y: (1 - newH) / 2,
            width: newW,
            height: newH
          }
        })
      );
    }
    case "APPLY_OPERATION":
      return cropperReducer(
        state,
        operationToAction(state, action.payload)
      );
    case "RESET":
      return commitBase(
        enforceContainment({
          ...DEFAULT_STATE2,
          image: state.image,
          ...action.payload
        })
      );
  }
}

// packages/media-editor/build-module/image-editor/core/setter-helpers.mjs
function buildFocalPointZoomAction(state, requestedZoom) {
  const clampedZoom = Math.min(
    MAX_ZOOM,
    Math.max(getMinZoom(state), requestedZoom)
  );
  if (clampedZoom === state.zoom) {
    return null;
  }
  const { cropRect } = state;
  const focalNormX = cropRect.x + cropRect.width / 2 - 0.5;
  const focalNormY = cropRect.y + cropRect.height / 2 - 0.5;
  const zoomRatio = 1 - clampedZoom / state.zoom;
  const newPanX = state.pan.x + (focalNormX - state.pan.x) * zoomRatio;
  const newPanY = state.pan.y + (focalNormY - state.pan.y) * zoomRatio;
  const imageSize = state.image ? {
    width: state.image.naturalWidth,
    height: state.image.naturalHeight
  } : { width: 1, height: 1 };
  const { pan: clampedPan } = restrictPanZoom(
    {
      ...state,
      zoom: clampedZoom,
      pan: { x: newPanX, y: newPanY }
    },
    imageSize,
    state.cropRect
  );
  return {
    type: "SET_ZOOM_AT_POINT",
    payload: { zoom: clampedZoom, pan: clampedPan }
  };
}

// packages/media-editor/build-module/image-editor/react/hooks/build-cropper-setters.mjs
function buildCropperSetters(dispatchCropperAction, getCropperState) {
  return {
    setPan: (pan) => dispatchCropperAction({ type: "SET_PAN", payload: pan }),
    setZoom: (zoom) => {
      const action = buildFocalPointZoomAction(getCropperState(), zoom);
      if (action) {
        dispatchCropperAction(action);
      }
    },
    setZoomAtPoint: (zoom, pan) => dispatchCropperAction({
      type: "SET_ZOOM_AT_POINT",
      payload: { zoom, pan }
    }),
    setRotation: (rotation) => dispatchCropperAction({
      type: "SET_ROTATION",
      payload: rotation
    }),
    setFlip: (flip4) => dispatchCropperAction({ type: "SET_FLIP", payload: flip4 }),
    toggleFlip: (direction) => {
      const { flip: flip4 } = getCropperState();
      dispatchCropperAction({
        type: "SET_FLIP",
        payload: { ...flip4, [direction]: !flip4[direction] }
      });
    },
    snapRotate90: (direction) => dispatchCropperAction({
      type: "SNAP_ROTATE_90",
      payload: { direction }
    }),
    setCropRect: (rect) => dispatchCropperAction({
      type: "SET_CROP_RECT",
      payload: rect
    }),
    settleCrop: () => dispatchCropperAction({ type: "SETTLE_CROP" }),
    applyOperation: (op) => dispatchCropperAction({
      type: "APPLY_OPERATION",
      payload: op
    })
  };
}

// packages/media-editor/build-module/image-editor/react/components/cropper.mjs
var import_element117 = __toESM(require_element(), 1);
var import_i18n38 = __toESM(require_i18n(), 1);

// packages/media-editor/build-module/image-editor/core/crop-rect.mjs
function computeInscribedRect(aspectRatio, visualSize) {
  let w2 = 1;
  let h = 1;
  if (aspectRatio && aspectRatio > 0 && visualSize.width > 0) {
    const normalizedRatio = aspectRatio * visualSize.height / visualSize.width;
    if (normalizedRatio <= 1) {
      w2 = normalizedRatio;
    } else {
      h = 1 / normalizedRatio;
    }
  }
  return {
    x: (1 - w2) / 2,
    y: (1 - h) / 2,
    width: w2,
    height: h
  };
}

// packages/media-editor/build-module/image-editor/core/stencil-math.mjs
function getMinCropPixels(displayScale) {
  if (displayScale <= 0) {
    return MIN_CROP_PIXELS;
  }
  return Math.max(MIN_CROP_PIXELS, MIN_CROP_SCREEN_PX / displayScale);
}
var DEFAULT_MIN_CROP_SIZE = { width: 0.05, height: 0.05 };
function computeFreeResizeRect(drag2, clientX, clientY, imageSize, bounds, minCropSize = DEFAULT_MIN_CROP_SIZE) {
  const dx = imageSize.width > 0 ? (clientX - drag2.startX) / imageSize.width : 0;
  const dy = imageSize.height > 0 ? (clientY - drag2.startY) / imageSize.height : 0;
  const s = drag2.startRect;
  const handle = drag2.handle;
  let edgeTop = s.y;
  let edgeBottom = s.y + s.height;
  let edgeLeft = s.x;
  let edgeRight = s.x + s.width;
  if (handle === "n" || handle === "nw" || handle === "ne") {
    edgeTop = Math.max(
      bounds.minY,
      Math.min(s.y + dy, edgeBottom - minCropSize.height)
    );
  }
  if (handle === "s" || handle === "sw" || handle === "se") {
    edgeBottom = Math.max(
      edgeTop + minCropSize.height,
      Math.min(s.y + s.height + dy, bounds.maxY)
    );
  }
  if (handle === "w" || handle === "nw" || handle === "sw") {
    edgeLeft = Math.max(
      bounds.minX,
      Math.min(s.x + dx, edgeRight - minCropSize.width)
    );
  }
  if (handle === "e" || handle === "ne" || handle === "se") {
    edgeRight = Math.max(
      edgeLeft + minCropSize.width,
      Math.min(s.x + s.width + dx, bounds.maxX)
    );
  }
  return {
    x: edgeLeft,
    y: edgeTop,
    width: edgeRight - edgeLeft,
    height: edgeBottom - edgeTop
  };
}
function computeLockedResizeRect(drag2, clientX, clientY, imageSize, bounds, normalizedRatio, minCropSize = DEFAULT_MIN_CROP_SIZE, driverAxis) {
  if (normalizedRatio <= 0 || imageSize.width <= 0 || imageSize.height <= 0) {
    return { ...drag2.startRect };
  }
  const dx = (clientX - drag2.startX) / imageSize.width;
  const dy = (clientY - drag2.startY) / imageSize.height;
  const s = drag2.startRect;
  const handle = drag2.handle;
  const anchorX = handle === "nw" || handle === "sw" ? s.x + s.width : s.x;
  const anchorY = handle === "nw" || handle === "ne" ? s.y + s.height : s.y;
  const dirX = handle === "nw" || handle === "sw" ? -1 : 1;
  const dirY = handle === "nw" || handle === "ne" ? -1 : 1;
  const draggedX = (handle === "nw" || handle === "sw" ? s.x : s.x + s.width) + dx;
  const draggedY = (handle === "nw" || handle === "ne" ? s.y : s.y + s.height) + dy;
  let distW = (draggedX - anchorX) * dirX;
  let distH = (draggedY - anchorY) * dirY;
  const minDistW = Math.max(
    minCropSize.width,
    minCropSize.height * normalizedRatio
  );
  const minDistH = minDistW / normalizedRatio;
  distW = Math.max(distW, minDistW);
  distH = Math.max(distH, minDistH);
  const pixelRatio = normalizedRatio * imageSize.width / imageSize.height;
  const isWidthDriver = driverAxis === "width" || !driverAxis && distW * imageSize.width / (distH * imageSize.height) > pixelRatio;
  if (isWidthDriver) {
    distH = distW / normalizedRatio;
  } else {
    distW = distH * normalizedRatio;
  }
  const maxW = dirX > 0 ? bounds.maxX - anchorX : anchorX - bounds.minX;
  const maxH = dirY > 0 ? bounds.maxY - anchorY : anchorY - bounds.minY;
  if (distW > maxW) {
    distW = maxW;
    distH = distW / normalizedRatio;
  }
  if (distH > maxH) {
    distH = maxH;
    distW = distH * normalizedRatio;
  }
  distW = Math.max(distW, minDistW);
  distH = Math.max(distH, minDistH);
  const newX = dirX > 0 ? anchorX : anchorX - distW;
  const newY = dirY > 0 ? anchorY : anchorY - distH;
  return { x: newX, y: newY, width: distW, height: distH };
}
function computeShiftLockedResizeRect(drag2, clientX, clientY, imageSize, bounds, minCropSize = DEFAULT_MIN_CROP_SIZE) {
  const s = drag2.startRect;
  const pixelW = s.width * imageSize.width;
  const pixelH = s.height * imageSize.height;
  if (pixelH <= 0 || pixelW <= 0) {
    return computeFreeResizeRect(
      drag2,
      clientX,
      clientY,
      imageSize,
      bounds,
      minCropSize
    );
  }
  const normalizedRatio = s.width / s.height;
  const handle = drag2.handle;
  if (handle === "nw" || handle === "ne" || handle === "sw" || handle === "se") {
    return computeLockedResizeRect(
      drag2,
      clientX,
      clientY,
      imageSize,
      bounds,
      normalizedRatio,
      minCropSize
    );
  }
  const free = computeFreeResizeRect(
    drag2,
    clientX,
    clientY,
    imageSize,
    bounds,
    minCropSize
  );
  if (handle === "n" || handle === "s") {
    let newHeight2 = free.height;
    let newWidth2 = newHeight2 * normalizedRatio;
    const centerX = s.x + s.width / 2;
    const maxWidth = Math.min(centerX - bounds.minX, bounds.maxX - centerX) * 2;
    if (newWidth2 > maxWidth) {
      newWidth2 = maxWidth;
      newHeight2 = newWidth2 / normalizedRatio;
    }
    const minHeight = Math.max(
      minCropSize.height,
      minCropSize.width / normalizedRatio
    );
    if (newHeight2 < minHeight) {
      newHeight2 = minHeight;
      newWidth2 = newHeight2 * normalizedRatio;
    }
    const newY = handle === "n" ? s.y + s.height - newHeight2 : s.y;
    return {
      x: centerX - newWidth2 / 2,
      y: newY,
      width: newWidth2,
      height: newHeight2
    };
  }
  let newWidth = free.width;
  let newHeight = newWidth / normalizedRatio;
  const centerY = s.y + s.height / 2;
  const maxHeight = Math.min(centerY - bounds.minY, bounds.maxY - centerY) * 2;
  if (newHeight > maxHeight) {
    newHeight = maxHeight;
    newWidth = newHeight * normalizedRatio;
  }
  const minWidth = Math.max(
    minCropSize.width,
    minCropSize.height * normalizedRatio
  );
  if (newWidth < minWidth) {
    newWidth = minWidth;
    newHeight = newWidth / normalizedRatio;
  }
  const newX = handle === "w" ? s.x + s.width - newWidth : s.x;
  return {
    x: newX,
    y: centerY - newHeight / 2,
    width: newWidth,
    height: newHeight
  };
}

// packages/media-editor/build-module/image-editor/react/hooks/use-interaction.mjs
var import_element110 = __toESM(require_element(), 1);

// packages/media-editor/build-module/image-editor/core/interaction-controller.mjs
var DOUBLE_TAP_TIME = 300;
var DOUBLE_TAP_DISTANCE = 30;
var ZOOM_ANIMATION_DURATION = 200;
function getImageSizeFromState(state) {
  return state.image ? { width: state.image.naturalWidth, height: state.image.naturalHeight } : { width: 1, height: 1 };
}
function getTouchDistance(t1, t2) {
  const dx = t1.clientX - t2.clientX;
  const dy = t1.clientY - t2.clientY;
  return Math.sqrt(dx * dx + dy * dy);
}
var InteractionController = class {
  options;
  /** Current drag/zoom status. */
  isDragging = false;
  isZooming = false;
  /** Active drag state during pointer interactions. */
  drag = null;
  /** Active touch state during touch interactions. */
  touch = null;
  /** Cleanup function for active touch listeners on document. */
  touchCleanup = null;
  /**
   * Cleanup function for active pointer-drag listeners on the
   * captured element. Set while a pointer drag is in progress so
   * `destroy()` can tear the drag down cleanly if the consumer
   * unmounts mid-drag. Cleared on pointerup/lostpointercapture.
   */
  pointerCleanup = null;
  /** Last tap info for double-tap detection. */
  lastTap = null;
  /** Timer for the zoom animation state (double-tap). */
  zoomTimer;
  /** Timer for wheel gesture debounce. */
  wheelGestureTimer;
  /** Whether a wheel gesture is currently active. */
  wheelGestureActive = false;
  /** Current requestAnimationFrame ID. */
  rafId = 0;
  constructor(options) {
    this.options = options;
  }
  /** Read minZoom lazily so option changes take effect immediately. */
  get minZoom() {
    return this.options.minZoom ?? MIN_ZOOM;
  }
  /** Read maxZoom lazily so option changes take effect immediately. */
  get maxZoom() {
    return this.options.maxZoom ?? MAX_ZOOM;
  }
  /** Read zoomSpeed lazily so option changes take effect immediately. */
  get zoomSpeed() {
    return this.options.zoomSpeed ?? DEFAULT_WHEEL_ZOOM_SPEED;
  }
  /** Read keyboardStep lazily so option changes take effect immediately. */
  get keyboardStep() {
    return this.options.keyboardStep ?? DEFAULT_KEYBOARD_STEP;
  }
  /**
   * Get the keyboard pan step, including modifier-based coarse movement.
   *
   * @param event The native KeyboardEvent.
   * @return The normalized pan step.
   */
  getKeyboardStep(event) {
    return event.shiftKey ? this.keyboardStep * KEYBOARD_SHIFT_STEP_MULTIPLIER : this.keyboardStep;
  }
  /** Read doubleTapZoom lazily so option changes take effect immediately. */
  get doubleTapZoom() {
    return this.options.doubleTapZoom ?? 2;
  }
  /**
   * Update the drag/zoom status and notify via callback if changed.
   *
   * @param update Partial status with isDragging and/or isZooming.
   */
  setStatus(update2) {
    let changed = false;
    if (update2.isDragging !== void 0 && update2.isDragging !== this.isDragging) {
      this.isDragging = update2.isDragging;
      changed = true;
    }
    if (update2.isZooming !== void 0 && update2.isZooming !== this.isZooming) {
      this.isZooming = update2.isZooming;
      changed = true;
    }
    if (changed) {
      this.options.onStatusChange?.({
        isDragging: this.isDragging,
        isZooming: this.isZooming
      });
    }
  }
  /**
   * Handle a pointer-down event on the container element.
   *
   * Initiates a drag (pan) interaction. Captures the pointer on the
   * provided element and registers pointermove/pointerup/lostpointercapture
   * listeners for the duration of the drag.
   *
   * @param e  The native PointerEvent.
   * @param el The DOM element to capture the pointer on.
   */
  handlePointerDown(e, el) {
    if (e.button !== 0) {
      return;
    }
    if (e.pointerType === "touch") {
      return;
    }
    e.preventDefault();
    const ownerDoc = el.ownerDocument;
    if (ownerDoc?.activeElement instanceof HTMLElement && ownerDoc.activeElement !== el) {
      ownerDoc.activeElement.blur();
    }
    el.focus();
    el.setPointerCapture(e.pointerId);
    this.setStatus({ isDragging: true });
    this.options.onGestureStart?.();
    const currentState = this.options.getState();
    this.drag = {
      startX: e.clientX,
      startY: e.clientY,
      startPanX: currentState.pan.x,
      startPanY: currentState.pan.y
    };
    const onPointerMove = (moveEvent) => {
      const drag2 = this.drag;
      if (!drag2) {
        return;
      }
      const pe = moveEvent;
      cancelAnimationFrame(this.rafId);
      this.rafId = requestAnimationFrame(() => {
        const s = this.options.getState();
        const imgSize = this.options.getImageSize();
        const containerSize = this.options.getContainerSize();
        const panSize = imgSize ?? containerSize;
        const deltaX = panSize.width > 0 ? (pe.clientX - drag2.startX) / panSize.width : 0;
        const deltaY = panSize.height > 0 ? (pe.clientY - drag2.startY) / panSize.height : 0;
        const { pan: newCrop } = restrictPanZoom(
          {
            ...s,
            pan: {
              x: drag2.startPanX + deltaX,
              y: drag2.startPanY + deltaY
            }
          },
          getImageSizeFromState(s),
          s.cropRect
        );
        this.options.actions.setPan(newCrop);
      });
    };
    const removeListeners = () => {
      el.removeEventListener("pointermove", onPointerMove);
      el.removeEventListener("pointerup", onPointerUp);
      el.removeEventListener("lostpointercapture", onPointerUp);
    };
    const onPointerUp = () => {
      this.setStatus({ isDragging: false });
      this.options.onGestureEnd?.();
      this.drag = null;
      cancelAnimationFrame(this.rafId);
      removeListeners();
      this.pointerCleanup = null;
    };
    el.addEventListener("pointermove", onPointerMove);
    el.addEventListener("pointerup", onPointerUp);
    el.addEventListener("lostpointercapture", onPointerUp);
    this.pointerCleanup = removeListeners;
  }
  /**
   * Handle a wheel event on the container element.
   *
   * Implements focal-point zoom: the point under the cursor stays
   * stationary on screen while the zoom level changes.
   *
   * Must be registered with `{ passive: false }` to allow preventDefault.
   *
   * @param e The native WheelEvent.
   */
  handleWheel(e) {
    e.preventDefault();
    if (this.drag) {
      return;
    }
    if (!this.wheelGestureActive) {
      this.wheelGestureActive = true;
      this.options.onGestureStart?.();
    }
    clearTimeout(this.wheelGestureTimer);
    this.wheelGestureTimer = setTimeout(() => {
      this.wheelGestureActive = false;
      this.options.onGestureEnd?.();
    }, DOUBLE_TAP_TIME);
    const s = this.options.getState();
    const delta = -e.deltaY * this.zoomSpeed;
    const newZoom = Math.min(
      this.maxZoom,
      Math.max(this.minZoom, s.zoom + delta)
    );
    if (newZoom === s.zoom) {
      return;
    }
    const containerSize = this.options.getContainerSize();
    const imgSize = this.options.getImageSize();
    const visSize = imgSize ?? containerSize;
    const target = e.currentTarget;
    const rect = target instanceof Element ? target.getBoundingClientRect() : void 0;
    if (visSize.width > 0 && visSize.height > 0 && rect) {
      const fx = e.clientX - rect.left - containerSize.width / 2;
      const fy = e.clientY - rect.top - containerSize.height / 2;
      const zoomRatio = 1 - newZoom / s.zoom;
      const focalNormX = fx / visSize.width;
      const focalNormY = fy / visSize.height;
      const newCropX = s.pan.x + (focalNormX - s.pan.x) * zoomRatio;
      const newCropY = s.pan.y + (focalNormY - s.pan.y) * zoomRatio;
      const { pan: clampedCrop } = restrictPanZoom(
        { ...s, zoom: newZoom, pan: { x: newCropX, y: newCropY } },
        getImageSizeFromState(s),
        s.cropRect
      );
      this.options.actions.setZoomAtPoint(newZoom, clampedCrop);
    } else {
      this.options.actions.setZoom(newZoom);
    }
  }
  /**
   * Handle a touch-start event on the container element.
   *
   * Supports single-finger pan, two-finger pinch zoom, and
   * double-tap to toggle between fit and 2x zoom. Registers
   * touchmove/touchend/touchcancel on the provided document for the
   * duration of the gesture.
   *
   * @param e             The native TouchEvent.
   * @param containerRect The bounding rect of the container element.
   * @param doc           The document to register move/end listeners on.
   *                      Defaults to globalThis.document. Pass the iframe's
   *                      contentDocument when running inside an iframe.
   */
  handleTouchStart(e, containerRect, doc = document) {
    if (this.touch && e.touches.length === 2) {
      const s = this.options.getState();
      const distance2 = getTouchDistance(e.touches[0], e.touches[1]);
      const midX = (e.touches[0].clientX + e.touches[1].clientX) / 2;
      const midY = (e.touches[0].clientY + e.touches[1].clientY) / 2;
      this.touch.didPinch = true;
      this.touch.startDistance = distance2;
      this.touch.startZoom = s.zoom;
      this.touch.startPanX = s.pan.x;
      this.touch.startPanY = s.pan.y;
      this.touch.startMidX = midX;
      this.touch.startMidY = midY;
      this.touch.containerRect = containerRect;
      this.setStatus({ isDragging: false });
      return;
    }
    if (e.touches.length === 1) {
      const tapX = e.touches[0].clientX;
      const tapY = e.touches[0].clientY;
      if (this.tryDoubleTap(e, tapX, tapY, containerRect)) {
        return;
      }
      const currentState = this.options.getState();
      this.touch = {
        startDistance: 0,
        startZoom: currentState.zoom,
        lastTouchX: e.touches[0].clientX,
        lastTouchY: e.touches[0].clientY,
        startPanX: currentState.pan.x,
        startPanY: currentState.pan.y,
        containerRect,
        startMidX: 0,
        startMidY: 0,
        didPinch: false,
        moved: false
      };
      this.options.onGestureStart?.();
    } else if (e.touches.length === 2) {
      const currentState = this.options.getState();
      const distance2 = getTouchDistance(e.touches[0], e.touches[1]);
      const midX = (e.touches[0].clientX + e.touches[1].clientX) / 2;
      const midY = (e.touches[0].clientY + e.touches[1].clientY) / 2;
      this.touch = {
        startDistance: distance2,
        startZoom: currentState.zoom,
        lastTouchX: 0,
        lastTouchY: 0,
        startPanX: currentState.pan.x,
        startPanY: currentState.pan.y,
        containerRect,
        startMidX: midX,
        startMidY: midY,
        didPinch: true,
        moved: false
      };
      this.options.onGestureStart?.();
    }
    const onTouchEnd = () => {
      this.touch = null;
      this.touchCleanup = null;
      cancelAnimationFrame(this.rafId);
      doc.removeEventListener("touchmove", this.handleTouchMove);
      doc.removeEventListener("touchend", onTouchEnd);
      doc.removeEventListener("touchcancel", onTouchEnd);
      this.setStatus({ isDragging: false });
      this.options.onGestureEnd?.();
    };
    this.touchCleanup?.();
    doc.addEventListener("touchmove", this.handleTouchMove, {
      passive: false
    });
    doc.addEventListener("touchend", onTouchEnd);
    doc.addEventListener("touchcancel", onTouchEnd);
    this.touchCleanup = onTouchEnd;
  }
  // Handle a touchmove event during an active touch gesture. Decides pinch
  // vs. pan based on current `moveEvent.touches.length`, so the gesture
  // can transition between modes without timing sensitivity (e.g. fingers
  // landing 0ms vs 200ms apart). Arrow-property binding so `this` stays
  // attached when used as an event listener.
  handleTouchMove = (moveEvent) => {
    const touch = this.touch;
    if (!touch) {
      return;
    }
    moveEvent.preventDefault();
    cancelAnimationFrame(this.rafId);
    this.rafId = requestAnimationFrame(() => {
      const s = this.options.getState();
      if (moveEvent.touches.length === 2) {
        if (!touch.didPinch) {
          touch.didPinch = true;
          touch.startDistance = getTouchDistance(
            moveEvent.touches[0],
            moveEvent.touches[1]
          );
          touch.startZoom = s.zoom;
          touch.startPanX = s.pan.x;
          touch.startPanY = s.pan.y;
          touch.startMidX = (moveEvent.touches[0].clientX + moveEvent.touches[1].clientX) / 2;
          touch.startMidY = (moveEvent.touches[0].clientY + moveEvent.touches[1].clientY) / 2;
          this.setStatus({ isDragging: false });
          return;
        }
        const latestContainerSize = this.options.getContainerSize();
        const latestImageSize = this.options.getImageSize();
        const t0 = moveEvent.touches[0];
        const t1 = moveEvent.touches[1];
        const currentDistance = getTouchDistance(t0, t1);
        const ratio = currentDistance / touch.startDistance;
        const newZoom = Math.min(
          this.maxZoom,
          Math.max(this.minZoom, touch.startZoom * ratio)
        );
        const visSize = latestImageSize ?? latestContainerSize;
        const rect = touch.containerRect;
        if (visSize.width > 0 && visSize.height > 0 && rect) {
          const mx = (t0.clientX + t1.clientX) / 2 - rect.left - latestContainerSize.width / 2;
          const my = (t0.clientY + t1.clientY) / 2 - rect.top - latestContainerSize.height / 2;
          const startMx = touch.startMidX - rect.left - latestContainerSize.width / 2;
          const startMy = touch.startMidY - rect.top - latestContainerSize.height / 2;
          const panDx = visSize.width > 0 ? (mx - startMx) / visSize.width : 0;
          const panDy = visSize.height > 0 ? (my - startMy) / visSize.height : 0;
          const zoomRatio = touch.startZoom !== 0 ? 1 - newZoom / touch.startZoom : 0;
          const startFocalNormX = startMx / visSize.width;
          const startFocalNormY = startMy / visSize.height;
          const newCropX = touch.startPanX + panDx + (startFocalNormX - touch.startPanX) * zoomRatio;
          const newCropY = touch.startPanY + panDy + (startFocalNormY - touch.startPanY) * zoomRatio;
          const { pan: clampedCrop } = restrictPanZoom(
            {
              ...s,
              zoom: newZoom,
              pan: { x: newCropX, y: newCropY }
            },
            getImageSizeFromState(s),
            s.cropRect
          );
          this.options.actions.setZoomAtPoint(newZoom, clampedCrop);
        } else if (newZoom !== s.zoom) {
          this.options.actions.setZoom(newZoom);
        }
      } else if (moveEvent.touches.length === 1 && !touch.didPinch) {
        if (!touch.moved) {
          touch.moved = true;
          this.setStatus({ isDragging: true });
        }
        const panImageSize = this.options.getImageSize();
        const panContainerSize = this.options.getContainerSize();
        const panSize = panImageSize ?? panContainerSize;
        const deltaX = panSize.width > 0 ? (moveEvent.touches[0].clientX - touch.lastTouchX) / panSize.width : 0;
        const deltaY = panSize.height > 0 ? (moveEvent.touches[0].clientY - touch.lastTouchY) / panSize.height : 0;
        const { pan: newCrop } = restrictPanZoom(
          {
            ...s,
            pan: {
              x: touch.startPanX + deltaX,
              y: touch.startPanY + deltaY
            }
          },
          getImageSizeFromState(s),
          s.cropRect
        );
        this.options.actions.setPan(newCrop);
      }
    });
  };
  // Handle double-tap-to-toggle-zoom. On a second tap within the configured
  // time/distance threshold, toggles zoom between `minZoom` and
  // `doubleTapZoom` around the tap point and dispatches. Returns `true` if
  // the tap was handled as a double-tap (caller should early-return),
  // `false` otherwise (caller proceeds with normal single-tap handling).
  // Either way, records the tap for next time.
  tryDoubleTap(e, tapX, tapY, containerRect) {
    const now = Date.now();
    const lastTap = this.lastTap;
    if (!lastTap) {
      this.lastTap = { time: now, x: tapX, y: tapY };
      return false;
    }
    const timeDelta = now - lastTap.time;
    const distDelta = Math.sqrt(
      (tapX - lastTap.x) ** 2 + (tapY - lastTap.y) ** 2
    );
    const isDoubleTap = timeDelta < DOUBLE_TAP_TIME && distDelta < DOUBLE_TAP_DISTANCE;
    if (!isDoubleTap) {
      this.lastTap = { time: now, x: tapX, y: tapY };
      return false;
    }
    e.preventDefault();
    this.lastTap = null;
    const currentState = this.options.getState();
    const containerSize = this.options.getContainerSize();
    const imgSize = this.options.getImageSize();
    const targetZoom = currentState.zoom > (this.minZoom + this.doubleTapZoom) / 2 ? this.minZoom : this.doubleTapZoom;
    const visSize = imgSize ?? containerSize;
    this.setStatus({ isZooming: true });
    clearTimeout(this.zoomTimer);
    this.zoomTimer = setTimeout(() => {
      this.setStatus({ isZooming: false });
    }, ZOOM_ANIMATION_DURATION);
    this.options.onGestureStart?.();
    if (visSize.width > 0 && visSize.height > 0) {
      const fx = tapX - containerRect.left - containerSize.width / 2;
      const fy = tapY - containerRect.top - containerSize.height / 2;
      const zoomRatio = 1 - targetZoom / currentState.zoom;
      const focalNormX = fx / visSize.width;
      const focalNormY = fy / visSize.height;
      const newCropX = currentState.pan.x + (focalNormX - currentState.pan.x) * zoomRatio;
      const newCropY = currentState.pan.y + (focalNormY - currentState.pan.y) * zoomRatio;
      const { pan: clampedCrop } = restrictPanZoom(
        {
          ...currentState,
          zoom: targetZoom,
          pan: { x: newCropX, y: newCropY }
        },
        getImageSizeFromState(currentState),
        currentState.cropRect
      );
      this.options.actions.setZoomAtPoint(targetZoom, clampedCrop);
    } else {
      this.options.actions.setZoom(targetZoom);
    }
    this.options.onGestureEnd?.();
    return true;
  }
  /**
   * Handle a keydown event on the container element.
   *
   * Supports arrow keys for panning, +/- for zoom, and r/R for rotation.
   *
   * @param e The native KeyboardEvent.
   */
  handleKeyDown(e) {
    const currentState = this.options.getState();
    switch (e.key) {
      case "ArrowUp": {
        e.preventDefault();
        const keyboardStep = this.getKeyboardStep(e);
        const { pan: newCrop } = restrictPanZoom(
          {
            ...currentState,
            pan: {
              x: currentState.pan.x,
              y: currentState.pan.y + keyboardStep
            }
          },
          getImageSizeFromState(currentState),
          currentState.cropRect
        );
        this.options.actions.setPan(newCrop);
        break;
      }
      case "ArrowDown": {
        e.preventDefault();
        const keyboardStep = this.getKeyboardStep(e);
        const { pan: newCrop } = restrictPanZoom(
          {
            ...currentState,
            pan: {
              x: currentState.pan.x,
              y: currentState.pan.y - keyboardStep
            }
          },
          getImageSizeFromState(currentState),
          currentState.cropRect
        );
        this.options.actions.setPan(newCrop);
        break;
      }
      case "ArrowLeft": {
        e.preventDefault();
        const keyboardStep = this.getKeyboardStep(e);
        const { pan: newCrop } = restrictPanZoom(
          {
            ...currentState,
            pan: {
              x: currentState.pan.x + keyboardStep,
              y: currentState.pan.y
            }
          },
          getImageSizeFromState(currentState),
          currentState.cropRect
        );
        this.options.actions.setPan(newCrop);
        break;
      }
      case "ArrowRight": {
        e.preventDefault();
        const keyboardStep = this.getKeyboardStep(e);
        const { pan: newCrop } = restrictPanZoom(
          {
            ...currentState,
            pan: {
              x: currentState.pan.x - keyboardStep,
              y: currentState.pan.y
            }
          },
          getImageSizeFromState(currentState),
          currentState.cropRect
        );
        this.options.actions.setPan(newCrop);
        break;
      }
      case "+":
      case "=": {
        e.preventDefault();
        const newZoom = Math.min(
          this.maxZoom,
          Math.max(this.minZoom, currentState.zoom + 0.5)
        );
        this.options.actions.setZoom(newZoom);
        break;
      }
      case "-":
      case "_": {
        e.preventDefault();
        const newZoom = Math.min(
          this.maxZoom,
          Math.max(this.minZoom, currentState.zoom - 0.5)
        );
        this.options.actions.setZoom(newZoom);
        break;
      }
      case "r":
      case "R": {
        if (e.metaKey || e.ctrlKey || e.altKey) {
          break;
        }
        e.preventDefault();
        this.options.actions.snapRotate90(e.shiftKey ? -1 : 1);
        break;
      }
      case "h":
      case "H": {
        if (e.metaKey || e.ctrlKey || e.altKey || e.shiftKey) {
          break;
        }
        e.preventDefault();
        this.options.actions.toggleFlip?.("horizontal");
        break;
      }
      case "v":
      case "V": {
        if (e.metaKey || e.ctrlKey || e.altKey || e.shiftKey) {
          break;
        }
        e.preventDefault();
        this.options.actions.toggleFlip?.("vertical");
        break;
      }
    }
  }
  /**
   * Clean up all timers, animation frames, and active touch listeners.
   *
   * Must be called when the controller is no longer needed (e.g., on
   * component unmount or element removal).
   */
  destroy() {
    cancelAnimationFrame(this.rafId);
    clearTimeout(this.zoomTimer);
    clearTimeout(this.wheelGestureTimer);
    this.touchCleanup?.();
    this.touchCleanup = null;
    this.pointerCleanup?.();
    this.pointerCleanup = null;
    this.drag = null;
    this.touch = null;
    this.lastTap = null;
    this.wheelGestureActive = false;
    this.isDragging = false;
    this.isZooming = false;
  }
};

// packages/media-editor/build-module/image-editor/react/hooks/use-interaction.mjs
var KEYBOARD_INTERACTION_IDLE_MS = 300;
function isHandledKeyboardPan(event) {
  switch (event.key) {
    case "ArrowUp":
    case "ArrowDown":
    case "ArrowLeft":
    case "ArrowRight":
      return true;
    default:
      return false;
  }
}
function isHandledKeyboardZoom(event) {
  switch (event.key) {
    case "+":
    case "=":
    case "-":
    case "_":
      return true;
    default:
      return false;
  }
}
function useInteraction(state, actions, containerSize, imageSize, options) {
  const [isDragging, setIsDragging] = (0, import_element110.useState)(false);
  const [isZooming, setIsZooming] = (0, import_element110.useState)(false);
  const [isGestureActive, setIsGestureActive] = (0, import_element110.useState)(false);
  const [isKeyboardPanning, setIsKeyboardPanning] = (0, import_element110.useState)(false);
  const keyboardInteractionTimerRef = (0, import_element110.useRef)();
  const isKeyboardGestureActiveRef = (0, import_element110.useRef)(false);
  const stateRef = (0, import_element110.useRef)(state);
  stateRef.current = state;
  const containerSizeRef = (0, import_element110.useRef)(containerSize);
  containerSizeRef.current = containerSize;
  const imageSizeRef = (0, import_element110.useRef)(imageSize);
  imageSizeRef.current = imageSize;
  const optionsRef = (0, import_element110.useRef)(options);
  optionsRef.current = options;
  const actionsRef = (0, import_element110.useRef)(actions);
  actionsRef.current = actions;
  const controllerRef = (0, import_element110.useRef)(null);
  const startPlacementGesture = (0, import_element110.useCallback)(() => {
    setIsGestureActive(true);
  }, []);
  const stopPlacementGesture = (0, import_element110.useCallback)(() => {
    setIsGestureActive(false);
  }, []);
  const signalKeyboardGesture = (0, import_element110.useCallback)(() => {
    if (!isKeyboardGestureActiveRef.current) {
      isKeyboardGestureActiveRef.current = true;
      optionsRef.current?.onGestureStart?.();
    }
    clearTimeout(keyboardInteractionTimerRef.current);
    keyboardInteractionTimerRef.current = setTimeout(() => {
      isKeyboardGestureActiveRef.current = false;
      setIsKeyboardPanning(false);
      optionsRef.current?.onGestureEnd?.();
    }, KEYBOARD_INTERACTION_IDLE_MS);
  }, []);
  (0, import_element110.useEffect)(() => {
    return () => {
      clearTimeout(keyboardInteractionTimerRef.current);
    };
  }, []);
  (0, import_element110.useEffect)(() => {
    const controller = new InteractionController({
      getState: () => stateRef.current,
      actions: {
        setPan: (pan) => actionsRef.current.setPan(pan),
        setZoom: (zoom) => actionsRef.current.setZoom(zoom),
        setZoomAtPoint: (zoom, pan) => actionsRef.current.setZoomAtPoint(zoom, pan),
        snapRotate90: (direction) => actionsRef.current.snapRotate90(direction),
        toggleFlip: (direction) => actionsRef.current.toggleFlip?.(direction)
      },
      getContainerSize: () => containerSizeRef.current,
      getImageSize: () => imageSizeRef.current,
      get minZoom() {
        return optionsRef.current?.minZoom;
      },
      get maxZoom() {
        return optionsRef.current?.maxZoom;
      },
      get zoomSpeed() {
        return optionsRef.current?.zoomSpeed;
      },
      get keyboardStep() {
        return optionsRef.current?.keyboardStep;
      },
      get doubleTapZoom() {
        return optionsRef.current?.doubleTapZoom;
      },
      onGestureStart: () => {
        startPlacementGesture();
        optionsRef.current?.onGestureStart?.();
      },
      onGestureEnd: () => {
        stopPlacementGesture();
        optionsRef.current?.onGestureEnd?.();
      },
      onStatusChange: (status) => {
        setIsDragging(status.isDragging);
        setIsZooming(status.isZooming);
      }
    });
    controllerRef.current = controller;
    return () => {
      controller.destroy();
      controllerRef.current = null;
    };
  }, [startPlacementGesture, stopPlacementGesture]);
  const isDisabled = options?.disabled ?? false;
  (0, import_element110.useEffect)(() => {
    if (!isDisabled) {
      return;
    }
    controllerRef.current?.destroy();
    setIsDragging(false);
    setIsZooming(false);
    setIsKeyboardPanning(false);
    const wasGestureOpen = isGestureActive || isKeyboardGestureActiveRef.current;
    if (isKeyboardGestureActiveRef.current) {
      isKeyboardGestureActiveRef.current = false;
      clearTimeout(keyboardInteractionTimerRef.current);
    }
    stopPlacementGesture();
    if (wasGestureOpen) {
      optionsRef.current?.onGestureEnd?.();
    }
  }, [isDisabled, isGestureActive, stopPlacementGesture]);
  const onPointerDown = (0, import_element110.useCallback)((e) => {
    if (optionsRef.current?.disabled) {
      return;
    }
    const el = e.currentTarget;
    controllerRef.current?.handlePointerDown(e.nativeEvent, el);
  }, []);
  const onTouchStart = (0, import_element110.useCallback)((e) => {
    if (optionsRef.current?.disabled) {
      return;
    }
    const el = e.currentTarget;
    const rect = el.getBoundingClientRect();
    controllerRef.current?.handleTouchStart(
      e.nativeEvent,
      rect,
      el.ownerDocument
    );
  }, []);
  const onKeyDown = (0, import_element110.useCallback)(
    (e) => {
      if (optionsRef.current?.disabled) {
        return;
      }
      if (isHandledKeyboardPan(e.nativeEvent)) {
        setIsKeyboardPanning(true);
        signalKeyboardGesture();
      } else if (isHandledKeyboardZoom(e.nativeEvent)) {
        signalKeyboardGesture();
      }
      controllerRef.current?.handleKeyDown(e.nativeEvent);
    },
    [signalKeyboardGesture]
  );
  const onWheelNative = (0, import_element110.useCallback)((e) => {
    if (optionsRef.current?.disabled) {
      return;
    }
    controllerRef.current?.handleWheel(e);
  }, []);
  return {
    handlers: {
      onPointerDown,
      onTouchStart,
      onKeyDown
    },
    onWheelNative,
    isDragging,
    isZooming,
    isPlacementActive: isGestureActive || isKeyboardPanning || isZooming
  };
}

// packages/media-editor/build-module/image-editor/react/hooks/use-transform-style.mjs
var import_element111 = __toESM(require_element(), 1);

// packages/media-editor/build-module/image-editor/core/transform-style.mjs
var IDENTITY_MATRIX_STYLE = "matrix(1, 0, 0, 1, 0, 0)";
function computeTransformStyle(state, imageSize) {
  if (!isValidSize(imageSize)) {
    return IDENTITY_MATRIX_STYLE;
  }
  const safeState = sanitizeCropperState(state);
  const translateX = safeState.pan.x * imageSize.width;
  const translateY = safeState.pan.y * imageSize.height;
  const rad = degreesToRadians(safeState.rotation);
  const cos = Math.cos(rad);
  const sin = Math.sin(rad);
  const sx = safeState.flip.horizontal ? -1 : 1;
  const sy = safeState.flip.vertical ? -1 : 1;
  const z = safeState.zoom;
  const a = sx * cos * z;
  const b = sy * sin * z;
  const c2 = -sx * sin * z;
  const d = sy * cos * z;
  return `matrix(${a}, ${b}, ${c2}, ${d}, ${translateX}, ${translateY})`;
}

// packages/media-editor/build-module/image-editor/react/hooks/use-transform-style.mjs
function useTransformStyle(state, imageSize) {
  return (0, import_element111.useMemo)(
    () => computeTransformStyle(state, imageSize),
    [state, imageSize]
  );
}

// packages/media-editor/build-module/image-editor/react/hooks/use-aria-announcer.mjs
var import_element112 = __toESM(require_element(), 1);
var import_i18n36 = __toESM(require_i18n(), 1);
import { speak as speak6 } from "@wordpress/a11y";

// packages/media-editor/build-module/image-editor/core/source-region.mjs
function getSourceRegion(state, imageSize) {
  const safeState = sanitizeCropperState(state);
  if (!isValidSize(imageSize)) {
    return {
      x: 0,
      y: 0,
      width: 0,
      height: 0,
      rotation: safeState.rotation,
      flip: { ...safeState.flip },
      zoom: safeState.zoom
    };
  }
  const syntheticContainer = { width: 1e3, height: 1e3 };
  const camera = createCamera(safeState, syntheticContainer, imageSize);
  const inv = mat2d_exports.create();
  mat2d_exports.invert(inv, camera);
  const baseCamera = createCamera(
    { ...safeState, pan: { x: 0, y: 0 }, zoom: 1 },
    syntheticContainer,
    imageSize
  );
  const visibleBounds = getVisibleBounds(baseCamera);
  const cropRect = safeState.cropRect;
  const cropCenterScreenX = visibleBounds.left + (cropRect.x + cropRect.width / 2) * visibleBounds.width;
  const cropCenterScreenY = visibleBounds.top + (cropRect.y + cropRect.height / 2) * visibleBounds.height;
  const srcCenter = vec2_exports.create();
  vec2_exports.transformMat2d(
    srcCenter,
    [cropCenterScreenX, cropCenterScreenY],
    inv
  );
  const snapRotation = Math.round(safeState.rotation / 90) * 90;
  const { width: rotW, height: rotH } = getRotatedBBox(
    imageSize.width,
    imageSize.height,
    snapRotation
  );
  const sourceW = cropRect.width * rotW / safeState.zoom;
  const sourceH = cropRect.height * rotH / safeState.zoom;
  return {
    x: srcCenter[0] * imageSize.width - sourceW / 2,
    y: srcCenter[1] * imageSize.height - sourceH / 2,
    width: sourceW,
    height: sourceH,
    rotation: safeState.rotation,
    flip: { ...safeState.flip },
    zoom: safeState.zoom
  };
}
function getCropRectFromSourceRegion(state, imageSize, region) {
  if (!isValidSize(imageSize) || region.width <= 0 || region.height <= 0) {
    return null;
  }
  const safeState = sanitizeCropperState(state);
  const syntheticContainer = { width: 1e3, height: 1e3 };
  const baseCamera = createCamera(
    { ...safeState, pan: { x: 0, y: 0 }, zoom: 1 },
    syntheticContainer,
    imageSize
  );
  const visibleBounds = getVisibleBounds(baseCamera);
  if (visibleBounds.width <= 0 || visibleBounds.height <= 0) {
    return null;
  }
  const sourceCenter = vec2_exports.fromValues(
    (region.x + region.width / 2) / imageSize.width,
    (region.y + region.height / 2) / imageSize.height
  );
  const screenCenter = vec2_exports.create();
  const camera = createCamera(safeState, syntheticContainer, imageSize);
  vec2_exports.transformMat2d(screenCenter, sourceCenter, camera);
  const snapRotation = Math.round(safeState.rotation / 90) * 90;
  const { width: rotW, height: rotH } = getRotatedBBox(
    imageSize.width,
    imageSize.height,
    snapRotation
  );
  if (rotW <= 0 || rotH <= 0) {
    return null;
  }
  const width = region.width * safeState.zoom / rotW;
  const height = region.height * safeState.zoom / rotH;
  const centerX = (screenCenter[0] - visibleBounds.left) / visibleBounds.width;
  const centerY = (screenCenter[1] - visibleBounds.top) / visibleBounds.height;
  return {
    x: centerX - width / 2,
    y: centerY - height / 2,
    width,
    height
  };
}
var CARDINAL_ROTATION_EPSILON = 1e-6;
function isCardinalRotation(rotation) {
  const normalizedRotation = normalizeRotation(rotation);
  const nearestCardinal = Math.round(normalizedRotation / 90) * 90;
  return Math.abs(normalizedRotation - nearestCardinal) < CARDINAL_ROTATION_EPSILON;
}
function snapCropRectToSourcePixels(state, imageSize, cropRect, handle) {
  const safeState = sanitizeCropperState(state);
  if (!isCardinalRotation(safeState.rotation)) {
    return cropRect;
  }
  return snapCropRectEdgesToSourcePixels(safeState, imageSize, cropRect, {
    left: handle.includes("w"),
    top: handle.includes("n"),
    right: handle.includes("e"),
    bottom: handle.includes("s")
  });
}
function snapCropRectToSourcePixelGrid(state, imageSize, cropRect) {
  return snapCropRectEdgesToSourcePixels(state, imageSize, cropRect, {
    left: true,
    top: true,
    right: true,
    bottom: true
  });
}
function snapCropRectEdgesToSourcePixels(state, imageSize, cropRect, edges) {
  if (!isValidSize(imageSize)) {
    return cropRect;
  }
  const stateWithCrop = sanitizeCropperState({ ...state, cropRect });
  const region = getSourceRegion(stateWithCrop, imageSize);
  const shouldSnapX = edges.left || edges.right;
  const shouldSnapY = edges.top || edges.bottom;
  const left = edges.left ? Math.round(region.x) : region.x;
  const top = edges.top ? Math.round(region.y) : region.y;
  const right = edges.right ? Math.round(region.x + region.width) : region.x + region.width;
  const bottom = edges.bottom ? Math.round(region.y + region.height) : region.y + region.height;
  if (right <= left || bottom <= top) {
    return cropRect;
  }
  const snappedCropRect = getCropRectFromSourceRegion(
    stateWithCrop,
    imageSize,
    {
      ...region,
      x: left,
      y: top,
      width: right - left,
      height: bottom - top
    }
  );
  if (!snappedCropRect) {
    return cropRect;
  }
  return {
    x: shouldSnapX ? snappedCropRect.x : cropRect.x,
    y: shouldSnapY ? snappedCropRect.y : cropRect.y,
    width: shouldSnapX ? snappedCropRect.width : cropRect.width,
    height: shouldSnapY ? snappedCropRect.height : cropRect.height
  };
}

// packages/media-editor/build-module/image-editor/react/hooks/use-aria-announcer.mjs
var ARIA_DEBOUNCE_MS = 300;
function getFlipAnnouncement(state, previousState) {
  if (!previousState || previousState.flip.horizontal === state.flip.horizontal && previousState.flip.vertical === state.flip.vertical) {
    return void 0;
  }
  const { horizontal, vertical } = state.flip;
  if (horizontal && vertical) {
    return (0, import_i18n36.__)("Flipped horizontally and vertically");
  }
  if (horizontal) {
    return (0, import_i18n36.__)("Flipped horizontally");
  }
  if (vertical) {
    return (0, import_i18n36.__)("Flipped vertically");
  }
  return (0, import_i18n36.__)("Flip removed");
}
function getRotationAnnouncement(state, previousState) {
  if (previousState && Math.round(previousState.rotation) === Math.round(state.rotation)) {
    return void 0;
  }
  const singleFlip = state.flip.horizontal !== state.flip.vertical;
  const visualDir = singleFlip ? -1 : 1;
  let visualRotation = Math.round(state.rotation) * visualDir % 360;
  if (visualRotation > 180) {
    visualRotation -= 360;
  }
  if (visualRotation <= -180) {
    visualRotation += 360;
  }
  if (visualRotation === 0) {
    return previousState ? (0, import_i18n36.__)("Rotation 0 degrees") : void 0;
  }
  if (visualRotation > 0) {
    return (0, import_i18n36.sprintf)(
      /* translators: %d: rotation angle in degrees. */
      (0, import_i18n36.__)("Rotated %d degrees clockwise"),
      visualRotation
    );
  }
  return (0, import_i18n36.sprintf)(
    /* translators: %d: rotation angle in degrees. */
    (0, import_i18n36.__)("Rotated %d degrees counterclockwise"),
    Math.abs(visualRotation)
  );
}
function getCropAnnouncement(state, previousState) {
  if (!state.image) {
    return void 0;
  }
  const imageSize = {
    width: state.image.naturalWidth,
    height: state.image.naturalHeight
  };
  const region = getSourceRegion(state, imageSize);
  if (previousState?.image) {
    const previousRegion = getSourceRegion(
      { ...state, cropRect: previousState.cropRect },
      imageSize
    );
    if (Math.round(previousRegion.width) === Math.round(region.width) && Math.round(previousRegion.height) === Math.round(region.height)) {
      return void 0;
    }
  }
  return (0, import_i18n36.sprintf)(
    /* translators: 1: crop width in pixels, 2: crop height in pixels. */
    (0, import_i18n36.__)("Crop %1$d by %2$d pixels"),
    Math.round(region.width),
    Math.round(region.height)
  );
}
function getZoomAnnouncement(state, previousState) {
  if (previousState && Math.round(previousState.zoom * 100) === Math.round(state.zoom * 100)) {
    return void 0;
  }
  return (0, import_i18n36.sprintf)(
    /* translators: %d: zoom level as a percentage. */
    (0, import_i18n36.__)("Zoom %d%%"),
    Math.round(state.zoom * 100)
  );
}
function buildAnnouncement(state, previousState) {
  const flip4 = getFlipAnnouncement(state, previousState);
  if (flip4) {
    return flip4;
  }
  const parts = [
    getRotationAnnouncement(state, previousState),
    getZoomAnnouncement(state, previousState),
    getCropAnnouncement(state, previousState)
  ].filter((part) => part !== void 0);
  return parts.join(", ");
}
function useAriaAnnouncer(state) {
  const timerRef = (0, import_element112.useRef)();
  const prevMessageRef = (0, import_element112.useRef)("");
  const prevStateRef = (0, import_element112.useRef)(null);
  const latestStateRef = (0, import_element112.useRef)(state);
  (0, import_element112.useLayoutEffect)(() => {
    latestStateRef.current = state;
  }, [state]);
  (0, import_element112.useEffect)(() => {
    clearTimeout(timerRef.current);
    timerRef.current = setTimeout(() => {
      const current = latestStateRef.current;
      const msg = buildAnnouncement(current, prevStateRef.current);
      prevStateRef.current = current;
      if (msg !== prevMessageRef.current) {
        prevMessageRef.current = msg;
        speak6(msg);
      }
    }, ARIA_DEBOUNCE_MS);
    return () => {
      clearTimeout(timerRef.current);
    };
  }, [
    state.zoom,
    state.rotation,
    state.cropRect.width,
    state.cropRect.height,
    state.flip.horizontal,
    state.flip.vertical
  ]);
}

// packages/media-editor/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs
var import_element113 = __toESM(require_element(), 1);
var import_i18n37 = __toESM(require_i18n(), 1);

// packages/media-editor/build-module/image-editor/react/visually-hidden-style.mjs
var VISUALLY_HIDDEN_STYLE = {
  position: "absolute",
  width: 1,
  height: 1,
  padding: 0,
  margin: -1,
  overflow: "hidden",
  clip: "rect(0, 0, 0, 0)",
  whiteSpace: "nowrap",
  border: 0
};

// packages/media-editor/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs
var import_jsx_runtime153 = __toESM(require_jsx_runtime(), 1);
var CORNER_POSITIONS = ["nw", "ne", "se", "sw"];
var ALL_POSITIONS = [
  "nw",
  "n",
  "ne",
  "e",
  "se",
  "s",
  "sw",
  "w"
];
function getHandleLabel(pos) {
  switch (pos) {
    case "n":
      return (0, import_i18n37.__)("Resize from top edge");
    case "s":
      return (0, import_i18n37.__)("Resize from bottom edge");
    case "e":
      return (0, import_i18n37.__)("Resize from right edge");
    case "w":
      return (0, import_i18n37.__)("Resize from left edge");
    case "nw":
      return (0, import_i18n37.__)("Resize from top-left corner");
    case "ne":
      return (0, import_i18n37.__)("Resize from top-right corner");
    case "sw":
      return (0, import_i18n37.__)("Resize from bottom-left corner");
    case "se":
      return (0, import_i18n37.__)("Resize from bottom-right corner");
  }
}
var KEYBOARD_SETTLE_DELAY = 500;
function RectangleStencil({
  cropRect,
  containerSize,
  imageSize,
  onCropChange,
  onResizeStart,
  onResizeEnd,
  aspectRatio,
  freeformCrop = false,
  isResizeDisabled = false,
  stencilTransition,
  cropBounds,
  onEscape,
  minCropSize,
  snapCropRect,
  keyboardResizeStep
}) {
  const boundsMinX = cropBounds?.minX ?? 0;
  const boundsMinY = cropBounds?.minY ?? 0;
  const boundsMaxX = cropBounds?.maxX ?? 1;
  const boundsMaxY = cropBounds?.maxY ?? 1;
  const bounds = (0, import_element113.useMemo)(
    () => ({
      minX: boundsMinX,
      minY: boundsMinY,
      maxX: boundsMaxX,
      maxY: boundsMaxY
    }),
    [boundsMinX, boundsMinY, boundsMaxX, boundsMaxY]
  );
  const keyboardSettleTimerRef = (0, import_element113.useRef)();
  const keyboardResizeActiveRef = (0, import_element113.useRef)(false);
  const resizeHandleDescriptionId = (0, import_element113.useId)();
  const hasLockedRatio = !!(aspectRatio && aspectRatio > 0);
  const activePointerResizeRef = (0, import_element113.useRef)(null);
  (0, import_element113.useEffect)(() => {
    return () => {
      clearTimeout(keyboardSettleTimerRef.current);
      keyboardResizeActiveRef.current = false;
      activePointerResizeRef.current?.cancel(false);
    };
  }, []);
  const latestHandlersRef = (0, import_element113.useRef)(null);
  const normalizedRatio = (0, import_element113.useMemo)(() => {
    if (!hasLockedRatio || imageSize.width === 0) {
      return 0;
    }
    return aspectRatio * imageSize.height / imageSize.width;
  }, [aspectRatio, hasLockedRatio, imageSize.width, imageSize.height]);
  const offsetX = (containerSize.width - imageSize.width) / 2;
  const offsetY = (containerSize.height - imageSize.height) / 2;
  const left = offsetX + cropRect.x * imageSize.width;
  const top = offsetY + cropRect.y * imageSize.height;
  const width = cropRect.width * imageSize.width;
  const height = cropRect.height * imageSize.height;
  const handlePointerDown = (0, import_element113.useCallback)(
    (handle, event) => {
      if (isResizeDisabled || event.pointerType === "touch" && event.isPrimary === false) {
        event.preventDefault();
        event.stopPropagation();
        return;
      }
      if (event.button !== 0) {
        return;
      }
      event.preventDefault();
      event.stopPropagation();
      const ownerDoc = event.currentTarget.ownerDocument;
      if (ownerDoc.activeElement instanceof HTMLElement) {
        ownerDoc.activeElement.blur();
      }
      const el = event.currentTarget;
      el.setPointerCapture(event.pointerId);
      const drag2 = {
        handle,
        startX: event.clientX,
        startY: event.clientY,
        startRect: { ...cropRect }
      };
      let rafId = 0;
      let latestX = event.clientX;
      let latestY = event.clientY;
      let latestShift = event.shiftKey;
      const onMove = (e) => {
        const pe = e;
        latestX = pe.clientX;
        latestY = pe.clientY;
        latestShift = pe.shiftKey;
        if (rafId) {
          return;
        }
        rafId = requestAnimationFrame(() => {
          rafId = 0;
          const h = latestHandlersRef.current;
          if (!h) {
            return;
          }
          let newRect;
          if (h.hasLockedRatio) {
            newRect = h.computeLockedRect(drag2, latestX, latestY);
          } else if (latestShift) {
            newRect = h.computeShiftLockedRect(
              drag2,
              latestX,
              latestY
            );
          } else {
            newRect = h.computeFreeRect(drag2, latestX, latestY);
            newRect = h.snapCropRect?.(newRect, drag2.handle) ?? newRect;
          }
          h.onCropChange(newRect);
        });
      };
      let ended = false;
      const endResize = (notifyResizeEnd = true, restoreFocus = true) => {
        if (ended) {
          return;
        }
        ended = true;
        if (rafId) {
          cancelAnimationFrame(rafId);
          rafId = 0;
        }
        el.removeEventListener("pointermove", onMove);
        el.removeEventListener("pointerup", onEnd);
        el.removeEventListener("lostpointercapture", onEnd);
        activePointerResizeRef.current = null;
        if (notifyResizeEnd) {
          latestHandlersRef.current?.onResizeEnd?.();
        }
        if (restoreFocus) {
          el.focus({ preventScroll: true });
        }
      };
      const cancelResize = (notifyResizeEnd = true) => endResize(notifyResizeEnd, false);
      const onEnd = () => endResize();
      el.addEventListener("pointermove", onMove);
      el.addEventListener("pointerup", onEnd);
      el.addEventListener("lostpointercapture", onEnd);
      activePointerResizeRef.current = { cancel: cancelResize };
      onResizeStart?.(handle);
      clearTimeout(keyboardSettleTimerRef.current);
      keyboardResizeActiveRef.current = false;
    },
    [cropRect, isResizeDisabled, onResizeStart]
  );
  const computeFreeRect = (0, import_element113.useCallback)(
    (drag2, clientX, clientY) => computeFreeResizeRect(
      drag2,
      clientX,
      clientY,
      imageSize,
      bounds,
      minCropSize
    ),
    [imageSize, bounds, minCropSize]
  );
  const computeLockedRect = (0, import_element113.useCallback)(
    (drag2, clientX, clientY, driverAxis) => computeLockedResizeRect(
      drag2,
      clientX,
      clientY,
      imageSize,
      bounds,
      normalizedRatio,
      minCropSize,
      driverAxis
    ),
    [imageSize, bounds, normalizedRatio, minCropSize]
  );
  const computeShiftLockedRect = (0, import_element113.useCallback)(
    (drag2, clientX, clientY) => computeShiftLockedResizeRect(
      drag2,
      clientX,
      clientY,
      imageSize,
      bounds,
      minCropSize
    ),
    [imageSize, bounds, minCropSize]
  );
  latestHandlersRef.current = {
    hasLockedRatio,
    computeLockedRect,
    computeFreeRect,
    computeShiftLockedRect,
    onCropChange,
    onResizeEnd,
    snapCropRect
  };
  (0, import_element113.useEffect)(() => {
    if (!isResizeDisabled) {
      return;
    }
    activePointerResizeRef.current?.cancel();
    if (keyboardResizeActiveRef.current) {
      clearTimeout(keyboardSettleTimerRef.current);
      keyboardResizeActiveRef.current = false;
      latestHandlersRef.current?.onResizeEnd?.();
    }
  }, [isResizeDisabled]);
  const handleKeyDown = (0, import_element113.useCallback)(
    (handle, event) => {
      const key = event.key;
      if (isResizeDisabled) {
        return;
      }
      if (key === "Escape") {
        event.preventDefault();
        event.stopPropagation();
        onEscape?.();
        return;
      }
      if (key !== "ArrowUp" && key !== "ArrowDown" && key !== "ArrowLeft" && key !== "ArrowRight") {
        return;
      }
      event.preventDefault();
      event.stopPropagation();
      if (!keyboardResizeActiveRef.current) {
        keyboardResizeActiveRef.current = true;
        onResizeStart?.(handle);
      }
      const scheduleKeyboardResizeEnd = () => {
        clearTimeout(keyboardSettleTimerRef.current);
        keyboardSettleTimerRef.current = setTimeout(() => {
          keyboardResizeActiveRef.current = false;
          onResizeEnd?.();
        }, KEYBOARD_SETTLE_DELAY);
      };
      const stepMultiplier = event.shiftKey ? KEYBOARD_SHIFT_STEP_MULTIPLIER : 1;
      const stepX = keyboardResizeStep?.width ?? DEFAULT_KEYBOARD_STEP;
      const stepY = keyboardResizeStep?.height ?? DEFAULT_KEYBOARD_STEP;
      const adjustedStepX = stepX * stepMultiplier;
      const adjustedStepY = stepY * stepMultiplier;
      let dx = 0;
      let dy = 0;
      if (key === "ArrowLeft") {
        dx = -adjustedStepX;
      }
      if (key === "ArrowRight") {
        dx = adjustedStepX;
      }
      if (key === "ArrowUp") {
        dy = -adjustedStepY;
      }
      if (key === "ArrowDown") {
        dy = adjustedStepY;
      }
      const keyboardDriverAxis = dx !== 0 ? "width" : "height";
      if (hasLockedRatio) {
        const syntheticDrag = {
          handle,
          startX: 0,
          startY: 0,
          startRect: { ...cropRect }
        };
        const clientX = dx * imageSize.width;
        const clientY = dy * imageSize.height;
        onCropChange(
          computeLockedRect(
            syntheticDrag,
            clientX,
            clientY,
            keyboardDriverAxis
          )
        );
        scheduleKeyboardResizeEnd();
      } else {
        const syntheticDrag = {
          handle,
          startX: 0,
          startY: 0,
          startRect: { ...cropRect }
        };
        const clientX = dx * imageSize.width;
        const clientY = dy * imageSize.height;
        const rect = computeFreeRect(syntheticDrag, clientX, clientY);
        onCropChange(snapCropRect?.(rect, handle) ?? rect);
        scheduleKeyboardResizeEnd();
      }
    },
    [
      cropRect,
      hasLockedRatio,
      imageSize.width,
      imageSize.height,
      computeLockedRect,
      computeFreeRect,
      onCropChange,
      onResizeStart,
      onResizeEnd,
      onEscape,
      keyboardResizeStep,
      snapCropRect,
      isResizeDisabled
    ]
  );
  if (containerSize.width === 0 || containerSize.height === 0) {
    return null;
  }
  const handles = hasLockedRatio ? CORNER_POSITIONS : ALL_POSITIONS;
  return /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)(
    "div",
    {
      className: "wp-media-editor-image-editor__stencil",
      "data-testid": "cropper-stencil",
      style: {
        left,
        top,
        width,
        height,
        transition: stencilTransition
      },
      children: [
        freeformCrop && /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
          "div",
          {
            id: resizeHandleDescriptionId,
            style: VISUALLY_HIDDEN_STYLE,
            children: (0, import_i18n37.__)(
              "Use arrow keys to resize the crop area. Hold Shift for larger steps."
            )
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
          "div",
          {
            className: "wp-media-editor-image-editor__stencil-rect",
            style: {
              width: "100%",
              height: "100%",
              top: 0,
              left: 0
            }
          }
        ),
        freeformCrop && handles.map((pos) => /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
          "button",
          {
            type: "button",
            className: `wp-media-editor-image-editor__handle wp-media-editor-image-editor__handle--${pos}`,
            onPointerDown: (event) => handlePointerDown(pos, event),
            onTouchStart: (event) => {
              if (event.touches.length < 2) {
                event.stopPropagation();
              }
            },
            onKeyDown: (event) => handleKeyDown(pos, event),
            disabled: isResizeDisabled,
            "aria-label": getHandleLabel(pos),
            "aria-describedby": resizeHandleDescriptionId
          },
          pos
        ))
      ]
    }
  );
}

// packages/media-editor/build-module/image-editor/react/components/overlays/dimming-overlay.mjs
var import_jsx_runtime154 = __toESM(require_jsx_runtime(), 1);
function DimmingOverlay({
  cropRect,
  containerSize,
  imageSize,
  transition
}) {
  if (containerSize.width === 0 || containerSize.height === 0) {
    return null;
  }
  const offsetX = (containerSize.width - imageSize.width) / 2;
  const offsetY = (containerSize.height - imageSize.height) / 2;
  const left = offsetX + cropRect.x * imageSize.width;
  const top = offsetY + cropRect.y * imageSize.height;
  const width = cropRect.width * imageSize.width;
  const height = cropRect.height * imageSize.height;
  const composedTransition = transition ? `${transition}, box-shadow 0.15s ease` : void 0;
  return /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
    "div",
    {
      className: "wp-media-editor-image-editor__dimming",
      "data-testid": "cropper-dimming",
      style: {
        left,
        top,
        width,
        height,
        transition: composedTransition
      }
    }
  );
}

// packages/media-editor/build-module/image-editor/react/components/overlays/grid-overlay.mjs
var import_jsx_runtime155 = __toESM(require_jsx_runtime(), 1);
function GridOverlay({
  cropRect,
  containerSize,
  imageSize
}) {
  if (containerSize.width === 0 || containerSize.height === 0) {
    return null;
  }
  const offsetX = (containerSize.width - imageSize.width) / 2;
  const offsetY = (containerSize.height - imageSize.height) / 2;
  const left = offsetX + cropRect.x * imageSize.width;
  const top = offsetY + cropRect.y * imageSize.height;
  const width = cropRect.width * imageSize.width;
  const height = cropRect.height * imageSize.height;
  const thirdW = width / 3;
  const thirdH = height / 3;
  return /* @__PURE__ */ (0, import_jsx_runtime155.jsxs)(
    "div",
    {
      className: "wp-media-editor-image-editor__grid",
      "data-testid": "cropper-grid",
      style: {
        left,
        top,
        width,
        height
      },
      children: [
        /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(
          "div",
          {
            className: "wp-media-editor-image-editor__grid-line wp-media-editor-image-editor__grid-line--horizontal",
            style: { top: thirdH }
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(
          "div",
          {
            className: "wp-media-editor-image-editor__grid-line wp-media-editor-image-editor__grid-line--horizontal",
            style: { top: thirdH * 2 }
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(
          "div",
          {
            className: "wp-media-editor-image-editor__grid-line wp-media-editor-image-editor__grid-line--vertical",
            style: { left: thirdW }
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(
          "div",
          {
            className: "wp-media-editor-image-editor__grid-line wp-media-editor-image-editor__grid-line--vertical",
            style: { left: thirdW * 2 }
          }
        )
      ]
    }
  );
}

// packages/media-editor/build-module/image-editor/react/components/overlays/dimensions-overlay.mjs
var import_element114 = __toESM(require_element(), 1);
var import_jsx_runtime156 = __toESM(require_jsx_runtime(), 1);
var HANDLE_GAP_PX = 12;
var TRANSLATE_PERCENT = {
  before: "-100%",
  center: "-50%",
  after: "0"
};
var GAP_DIRECTION = {
  before: -1,
  center: 0,
  after: 1
};
var OPPOSITE_SIDE = {
  before: "after",
  center: "center",
  after: "before"
};
function preferredAnchor(handle) {
  let x2 = "center";
  if (handle.includes("w")) {
    x2 = "before";
  } else if (handle.includes("e")) {
    x2 = "after";
  }
  let y2 = "center";
  if (handle.includes("n")) {
    y2 = "before";
  } else if (handle.includes("s")) {
    y2 = "after";
  }
  return { x: x2, y: y2 };
}
function sideStart(side, handlePos, length2) {
  if (side === "before") {
    return handlePos - HANDLE_GAP_PX - length2;
  }
  if (side === "after") {
    return handlePos + HANDLE_GAP_PX;
  }
  return handlePos - length2 / 2;
}
function fittingSide(preferred, handlePos, length2, containerLength) {
  const fits = (side) => {
    const start = sideStart(side, handlePos, length2);
    return start >= 0 && start + length2 <= containerLength;
  };
  if (fits(preferred)) {
    return preferred;
  }
  const opposite = OPPOSITE_SIDE[preferred];
  if (opposite !== preferred && fits(opposite)) {
    return opposite;
  }
  if (preferred !== "center" && fits("center")) {
    return "center";
  }
  const overflow = (side) => {
    const start = sideStart(side, handlePos, length2);
    return Math.max(0, -start) + Math.max(0, start + length2 - containerLength);
  };
  const candidates = [preferred, opposite, "center"];
  return candidates.reduce(
    (best, side) => overflow(side) < overflow(best) ? side : best
  );
}
function DimensionsOverlay({
  cropRect,
  containerSize,
  imageSize,
  activeHandle,
  outputWidth,
  outputHeight
}) {
  const tooltipRef = (0, import_element114.useRef)(null);
  const [tooltipSize, setTooltipSize] = (0, import_element114.useState)(null);
  (0, import_element114.useLayoutEffect)(() => {
    if (!tooltipRef.current) {
      return;
    }
    const rect = tooltipRef.current.getBoundingClientRect();
    setTooltipSize((prev) => {
      if (prev && prev.width === rect.width && prev.height === rect.height) {
        return prev;
      }
      return { width: rect.width, height: rect.height };
    });
  }, [outputWidth, outputHeight]);
  if (!activeHandle || containerSize.width === 0 || containerSize.height === 0) {
    return null;
  }
  const offsetX = (containerSize.width - imageSize.width) / 2;
  const offsetY = (containerSize.height - imageSize.height) / 2;
  const left = offsetX + cropRect.x * imageSize.width;
  const top = offsetY + cropRect.y * imageSize.height;
  const width = cropRect.width * imageSize.width;
  const height = cropRect.height * imageSize.height;
  let handleX = left + width / 2;
  if (activeHandle.includes("w")) {
    handleX = left;
  } else if (activeHandle.includes("e")) {
    handleX = left + width;
  }
  let handleY = top + height / 2;
  if (activeHandle.includes("n")) {
    handleY = top;
  } else if (activeHandle.includes("s")) {
    handleY = top + height;
  }
  const preferred = preferredAnchor(activeHandle);
  const anchor = tooltipSize ? {
    x: fittingSide(
      preferred.x,
      handleX,
      tooltipSize.width,
      containerSize.width
    ),
    y: fittingSide(
      preferred.y,
      handleY,
      tooltipSize.height,
      containerSize.height
    )
  } : preferred;
  return /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(
    "div",
    {
      ref: tooltipRef,
      className: "wp-media-editor-image-editor__dimensions-tooltip",
      "data-testid": "cropper-dimensions-tooltip",
      style: {
        left: handleX + GAP_DIRECTION[anchor.x] * HANDLE_GAP_PX,
        top: handleY + GAP_DIRECTION[anchor.y] * HANDLE_GAP_PX,
        transform: `translate(${TRANSLATE_PERCENT[anchor.x]}, ${TRANSLATE_PERCENT[anchor.y]})`
      },
      "aria-hidden": "true",
      children: `W: ${Math.round(outputWidth)}px H: ${Math.round(
        outputHeight
      )}px`
    }
  );
}

// packages/media-editor/build-module/image-editor/react/components/viewport-provider.mjs
var import_element116 = __toESM(require_element(), 1);

// packages/media-editor/build-module/image-editor/react/hooks/use-viewport-state.mjs
var import_element115 = __toESM(require_element(), 1);

// packages/media-editor/build-module/image-editor/core/viewport-state.mjs
var DEFAULT_VIEWPORT_STATE = {
  zoom: 1,
  pan: { x: 0, y: 0 }
};
function viewportReducer(state, action) {
  switch (action.type) {
    case "SET_VIEWPORT_ZOOM": {
      const zoom = Math.min(4, Math.max(0.1, action.payload));
      return zoom === state.zoom ? state : { ...state, zoom };
    }
    case "SET_VIEWPORT_PAN": {
      const { x: x2, y: y2 } = action.payload;
      return x2 === state.pan.x && y2 === state.pan.y ? state : { ...state, pan: action.payload };
    }
    case "RESET_VIEWPORT":
      return state.zoom === DEFAULT_VIEWPORT_STATE.zoom && state.pan.x === DEFAULT_VIEWPORT_STATE.pan.x && state.pan.y === DEFAULT_VIEWPORT_STATE.pan.y ? state : DEFAULT_VIEWPORT_STATE;
  }
}

// packages/media-editor/build-module/image-editor/react/hooks/use-viewport-state.mjs
function useViewportState() {
  const [viewport, dispatch] = (0, import_element115.useReducer)(
    viewportReducer,
    DEFAULT_VIEWPORT_STATE
  );
  const setViewportZoom = (0, import_element115.useCallback)((zoom) => {
    dispatch({ type: "SET_VIEWPORT_ZOOM", payload: zoom });
  }, []);
  const setViewportPan = (0, import_element115.useCallback)((pan) => {
    dispatch({ type: "SET_VIEWPORT_PAN", payload: pan });
  }, []);
  const resetViewport = (0, import_element115.useCallback)(() => {
    dispatch({ type: "RESET_VIEWPORT" });
  }, []);
  return (0, import_element115.useMemo)(
    () => ({ viewport, setViewportZoom, setViewportPan, resetViewport }),
    [viewport, setViewportZoom, setViewportPan, resetViewport]
  );
}

// packages/media-editor/build-module/image-editor/react/components/viewport-provider.mjs
var import_jsx_runtime157 = __toESM(require_jsx_runtime(), 1);
var ViewportContext = (0, import_element116.createContext)(null);
function ViewportProvider({
  children
}) {
  const viewportState = useViewportState();
  return /* @__PURE__ */ (0, import_jsx_runtime157.jsx)(ViewportContext.Provider, { value: viewportState, children });
}
function useViewport() {
  const context = (0, import_element116.useContext)(ViewportContext);
  if (!context) {
    throw new Error(
      "useViewport must be used within a ViewportProvider."
    );
  }
  return context;
}

// packages/media-editor/build-module/image-editor/react/components/cropper.mjs
var import_jsx_runtime158 = __toESM(require_jsx_runtime(), 1);
var CROP_RECT_EPSILON = 1e-6;
var CARDINAL_ROTATION_EPSILON2 = 1e-6;
var SETTLE_TRANSITION_DURATION_MS = 200;
var SETTLE_TRANSITION_FALLBACK_MS = SETTLE_TRANSITION_DURATION_MS + 100;
var SETTLE_TRANSFORM_TRANSITION = `transform ${SETTLE_TRANSITION_DURATION_MS}ms ease-out`;
var SETTLE_STENCIL_TRANSITION = [
  `left ${SETTLE_TRANSITION_DURATION_MS}ms ease-out`,
  `top ${SETTLE_TRANSITION_DURATION_MS}ms ease-out`,
  `width ${SETTLE_TRANSITION_DURATION_MS}ms ease-out`,
  `height ${SETTLE_TRANSITION_DURATION_MS}ms ease-out`
].join(", ");
function CropperInner({
  src,
  controller,
  stencil: StencilComponent = RectangleStencil,
  showGrid = false,
  isPlacementActive = false,
  showDimming = true,
  showDimensions = true,
  minZoom,
  maxZoom,
  aspectRatio,
  freeformCrop = false,
  focusOnMount = false,
  disabled: disabled2 = false,
  onImageLoaded,
  onStateChange,
  onGestureStart,
  onGestureEnd,
  className
}, ref) {
  const {
    state,
    setImage,
    setCropRect,
    settleCrop,
    setVisualSize,
    adjustCropRectForViewport
  } = controller;
  const {
    viewport: viewportState,
    setViewportPan,
    resetViewport
  } = useViewport();
  const canvasRef = (0, import_element117.useRef)(null);
  const cropAreaDescriptionId = (0, import_element117.useId)();
  const [isCropAreaFocused, setIsCropAreaFocused] = (0, import_element117.useState)(focusOnMount);
  const [isFocusVisible, setIsFocusVisible] = (0, import_element117.useState)(false);
  const [canvasSize, setCanvasSize] = (0, import_element117.useState)({
    width: 0,
    height: 0
  });
  (0, import_element117.useLayoutEffect)(() => {
    if (focusOnMount) {
      canvasRef.current?.focus({ preventScroll: true });
    }
  }, [focusOnMount]);
  const handleCropAreaFocus = (0, import_element117.useCallback)(
    (event) => {
      const target = event.target;
      if (target === event.currentTarget) {
        setIsCropAreaFocused(true);
      }
      if (event.relatedTarget !== null && target.matches(":focus-visible")) {
        setIsFocusVisible(true);
      }
    },
    []
  );
  const handleCropAreaBlur = (0, import_element117.useCallback)(
    (event) => {
      if (event.target === event.currentTarget) {
        setIsCropAreaFocused(false);
      }
      if (!event.currentTarget.contains(
        event.relatedTarget
      )) {
        setIsFocusVisible(false);
      }
    },
    []
  );
  (0, import_element117.useEffect)(() => {
    const element = canvasRef.current;
    if (!element) {
      return;
    }
    const observer = new ResizeObserver((entries) => {
      for (const entry of entries) {
        const { width, height } = entry.contentRect;
        setCanvasSize((prev) => {
          if (prev.width === width && prev.height === height) {
            return prev;
          }
          return { width, height };
        });
      }
    });
    observer.observe(element);
    return () => {
      observer.disconnect();
    };
  }, []);
  (0, import_element117.useEffect)(() => {
    onStateChange?.(state);
  }, [state, onStateChange]);
  useAriaAnnouncer(state);
  const naturalWidth = state.image?.naturalWidth ?? 0;
  const naturalHeight = state.image?.naturalHeight ?? 0;
  const { elementSize, visualSize } = (0, import_element117.useMemo)(
    () => getImageFit(
      canvasSize,
      { width: naturalWidth, height: naturalHeight },
      state.rotation
    ),
    [canvasSize, naturalWidth, naturalHeight, state.rotation]
  );
  (0, import_element117.useEffect)(() => {
    setVisualSize(visualSize);
  }, [visualSize, setVisualSize]);
  (0, import_element117.useEffect)(() => {
    if (freeformCrop || visualSize.width === 0 || visualSize.height === 0 || !aspectRatio || aspectRatio <= 0) {
      return;
    }
    const rect = computeInscribedRect(aspectRatio, visualSize);
    const current = state.cropRect;
    if (Math.abs(current.x - rect.x) < CROP_RECT_EPSILON && Math.abs(current.y - rect.y) < CROP_RECT_EPSILON && Math.abs(current.width - rect.width) < CROP_RECT_EPSILON && Math.abs(current.height - rect.height) < CROP_RECT_EPSILON) {
      return;
    }
    adjustCropRectForViewport(rect);
  }, [
    freeformCrop,
    aspectRatio,
    visualSize,
    adjustCropRectForViewport,
    state.cropRect
  ]);
  const prevAspectRatioRef = (0, import_element117.useRef)(aspectRatio);
  (0, import_element117.useEffect)(() => {
    if (prevAspectRatioRef.current === aspectRatio) {
      return;
    }
    prevAspectRatioRef.current = aspectRatio;
    if (!freeformCrop || visualSize.width === 0 || visualSize.height === 0 || !aspectRatio || aspectRatio <= 0) {
      return;
    }
    const rect = computeInscribedRect(aspectRatio, visualSize);
    const current = state.cropRect;
    if (Math.abs(current.x - rect.x) < CROP_RECT_EPSILON && Math.abs(current.y - rect.y) < CROP_RECT_EPSILON && Math.abs(current.width - rect.width) < CROP_RECT_EPSILON && Math.abs(current.height - rect.height) < CROP_RECT_EPSILON) {
      return;
    }
    adjustCropRectForViewport(rect);
  }, [
    aspectRatio,
    freeformCrop,
    visualSize,
    adjustCropRectForViewport,
    state.cropRect
  ]);
  const cropBounds = (0, import_element117.useMemo)(() => {
    if (!state.image || elementSize.width === 0) {
      return void 0;
    }
    return getImageCropBounds(state, elementSize, visualSize);
  }, [state, elementSize, visualSize]);
  const effectiveMinZoom = minZoom !== void 0 ? minZoom : getMinZoom(state);
  const [isResizing, setIsResizing] = (0, import_element117.useState)(false);
  const isResizingRef = (0, import_element117.useRef)(false);
  const isSettlingRef = (0, import_element117.useRef)(false);
  const [isTouchPinching, setIsTouchPinchingState] = (0, import_element117.useState)(false);
  const isTouchPinchingRef = (0, import_element117.useRef)(false);
  const setTouchPinching = (0, import_element117.useCallback)((isPinching) => {
    isTouchPinchingRef.current = isPinching;
    setIsTouchPinchingState(isPinching);
  }, []);
  const [activeHandle, setActiveHandle] = (0, import_element117.useState)(
    null
  );
  const viewScaleRest = (0, import_element117.useMemo)(
    () => getViewScale(
      state.cropRect,
      canvasSize,
      visualSize,
      SETTLE_TARGET_CANVAS_FILL,
      MAX_VIEW_SCALE
    ),
    [state.cropRect, canvasSize, visualSize]
  );
  const [frozenViewScale, setFrozenViewScale] = (0, import_element117.useState)(1);
  const viewScale = isResizing ? frozenViewScale : viewScaleRest;
  const scaledVisualSize = (0, import_element117.useMemo)(
    () => ({
      width: visualSize.width * viewScale,
      height: visualSize.height * viewScale
    }),
    [visualSize.width, visualSize.height, viewScale]
  );
  const displayScale = naturalWidth > 0 ? elementSize.width / naturalWidth * state.zoom * viewScale : 0;
  const keyboardResizeStep = (0, import_element117.useMemo)(() => {
    if (displayScale < PIXEL_SNAP_DISPLAY_SCALE || aspectRatio && aspectRatio > 0 || naturalWidth <= 0 || naturalHeight <= 0) {
      return void 0;
    }
    const snapRotation = Math.round(state.rotation / 90) * 90;
    if (Math.abs(state.rotation - snapRotation) >= CARDINAL_ROTATION_EPSILON2) {
      return void 0;
    }
    const bbox = getRotatedBBox(
      naturalWidth,
      naturalHeight,
      snapRotation
    );
    if (bbox.width <= 0 || bbox.height <= 0) {
      return void 0;
    }
    return {
      width: state.zoom / bbox.width,
      height: state.zoom / bbox.height
    };
  }, [
    displayScale,
    aspectRatio,
    naturalWidth,
    naturalHeight,
    state.rotation,
    state.zoom
  ]);
  const minCropSize = (0, import_element117.useMemo)(() => {
    if (naturalWidth <= 0 || naturalHeight <= 0) {
      return void 0;
    }
    const snapRotation = Math.round(state.rotation / 90) * 90;
    const bbox = getRotatedBBox(
      naturalWidth,
      naturalHeight,
      snapRotation
    );
    const minPixels = getMinCropPixels(displayScale);
    return {
      width: Math.min(1, minPixels * state.zoom / bbox.width),
      height: Math.min(1, minPixels * state.zoom / bbox.height)
    };
  }, [
    naturalWidth,
    naturalHeight,
    state.rotation,
    state.zoom,
    displayScale
  ]);
  const snapCropRect = (0, import_element117.useCallback)(
    (rect, handle) => {
      if (displayScale < PIXEL_SNAP_DISPLAY_SCALE || naturalWidth <= 0 || naturalHeight <= 0) {
        return rect;
      }
      return snapCropRectToSourcePixels(
        state,
        { width: naturalWidth, height: naturalHeight },
        rect,
        handle
      );
    },
    [displayScale, naturalWidth, naturalHeight, state]
  );
  const wasPixelSnapEnabledRef = (0, import_element117.useRef)(false);
  (0, import_element117.useEffect)(() => {
    const isPixelSnapEnabled = freeformCrop && (!aspectRatio || aspectRatio <= 0) && displayScale >= PIXEL_SNAP_DISPLAY_SCALE && naturalWidth > 0 && naturalHeight > 0;
    const wasPixelSnapEnabled = wasPixelSnapEnabledRef.current;
    wasPixelSnapEnabledRef.current = isPixelSnapEnabled;
    if (!isPixelSnapEnabled || wasPixelSnapEnabled) {
      return;
    }
    const snappedCropRect = snapCropRectToSourcePixelGrid(
      state,
      { width: naturalWidth, height: naturalHeight },
      state.cropRect
    );
    const currentCropRect = state.cropRect;
    if (Math.abs(currentCropRect.x - snappedCropRect.x) < CROP_RECT_EPSILON && Math.abs(currentCropRect.y - snappedCropRect.y) < CROP_RECT_EPSILON && Math.abs(currentCropRect.width - snappedCropRect.width) < CROP_RECT_EPSILON && Math.abs(currentCropRect.height - snappedCropRect.height) < CROP_RECT_EPSILON) {
      return;
    }
    setCropRect(snappedCropRect);
  }, [
    aspectRatio,
    displayScale,
    freeformCrop,
    naturalWidth,
    naturalHeight,
    setCropRect,
    state
  ]);
  const {
    handlers,
    onWheelNative,
    isDragging,
    isZooming,
    isPlacementActive: isInteractionPlacementActive
  } = useInteraction(state, controller, canvasSize, scaledVisualSize, {
    minZoom: effectiveMinZoom,
    maxZoom,
    onGestureStart,
    onGestureEnd,
    disabled: disabled2
  });
  const canvasHandlers = {
    ...handlers,
    onPointerDownCapture: () => {
      setIsFocusVisible(false);
    },
    onTouchStartCapture: (event) => {
      if (event.touches.length > 1) {
        setTouchPinching(true);
      }
    },
    onTouchMoveCapture: (event) => {
      if (event.touches.length > 1) {
        setTouchPinching(true);
      }
    },
    onTouchEndCapture: (event) => {
      if (event.touches.length === 0) {
        setTouchPinching(false);
      }
    },
    onTouchCancelCapture: (event) => {
      if (event.touches.length === 0) {
        setTouchPinching(false);
      }
    },
    onKeyDownCapture: (event) => {
      if (!["Shift", "Control", "Alt", "Meta"].includes(event.key)) {
        setIsFocusVisible(true);
      }
    },
    onPointerDown: (event) => {
      if (disabled2 || isResizingRef.current || isTouchPinchingRef.current || event.pointerType === "touch" && event.isPrimary === false) {
        event.preventDefault();
        return;
      }
      handlers.onPointerDown?.(event);
      setIsFocusVisible(false);
    }
  };
  (0, import_element117.useEffect)(() => {
    const el = canvasRef.current;
    if (!el) {
      return;
    }
    const handleWheel = (event) => {
      if (isResizingRef.current || isSettlingRef.current) {
        event.preventDefault();
        return;
      }
      onWheelNative(event);
    };
    el.addEventListener("wheel", handleWheel, {
      passive: false
    });
    return () => {
      el.removeEventListener("wheel", handleWheel);
    };
  }, [onWheelNative]);
  const transformString = useTransformStyle(state, visualSize);
  const handleImageLoad = (0, import_element117.useCallback)(
    (event) => {
      const img = event.currentTarget;
      const size4 = {
        width: img.naturalWidth,
        height: img.naturalHeight
      };
      setImage({
        src,
        naturalWidth: size4.width,
        naturalHeight: size4.height
      });
      onImageLoaded?.(size4);
    },
    [src, setImage, onImageLoaded]
  );
  const handleCropChange = (0, import_element117.useCallback)(
    (rect) => {
      if (isTouchPinchingRef.current) {
        return;
      }
      setCropRect(rect);
      if (isResizingRef.current && scaledVisualSize.width > 0 && scaledVisualSize.height > 0) {
        const offsetX = (canvasSize.width - scaledVisualSize.width) / 2;
        const offsetY = (canvasSize.height - scaledVisualSize.height) / 2;
        const rightOverflow = Math.max(
          0,
          offsetX + (rect.x + rect.width) * scaledVisualSize.width - canvasSize.width
        );
        const leftOverflow = Math.max(
          0,
          -(offsetX + rect.x * scaledVisualSize.width)
        );
        const bottomOverflow = Math.max(
          0,
          offsetY + (rect.y + rect.height) * scaledVisualSize.height - canvasSize.height
        );
        const topOverflow = Math.max(
          0,
          -(offsetY + rect.y * scaledVisualSize.height)
        );
        setViewportPan({
          x: -rightOverflow + leftOverflow,
          y: -bottomOverflow + topOverflow
        });
      }
    },
    [setCropRect, setViewportPan, canvasSize, scaledVisualSize]
  );
  const [settling, setSettling] = (0, import_element117.useState)(false);
  const settleTimerRef = (0, import_element117.useRef)();
  const finishSettling = (0, import_element117.useCallback)(() => {
    clearTimeout(settleTimerRef.current);
    isSettlingRef.current = false;
    setSettling(false);
  }, []);
  (0, import_element117.useEffect)(() => {
    return () => {
      clearTimeout(settleTimerRef.current);
    };
  }, []);
  const isInteractiveGrid = showGrid === "interactive";
  const showInteractiveGrid = isInteractiveGrid && (isInteractionPlacementActive || isResizing || isPlacementActive);
  const outputSize = (0, import_element117.useMemo)(() => {
    if (!showDimensions || !activeHandle || !state.image) {
      return null;
    }
    const region = getSourceRegion(state, {
      width: state.image.naturalWidth,
      height: state.image.naturalHeight
    });
    return { width: region.width, height: region.height };
  }, [showDimensions, activeHandle, state]);
  const handleEscape = (0, import_element117.useCallback)(() => {
    setIsFocusVisible(true);
    canvasRef.current?.focus({ preventScroll: true });
  }, []);
  const handleResizeStart = (0, import_element117.useCallback)(
    (handle) => {
      if (isTouchPinchingRef.current) {
        return;
      }
      setFrozenViewScale(viewScaleRest);
      isResizingRef.current = true;
      setIsResizing(true);
      setActiveHandle(handle ?? null);
      finishSettling();
      resetViewport();
      onGestureStart?.();
    },
    [finishSettling, onGestureStart, resetViewport, viewScaleRest]
  );
  const handleResizeEnd = (0, import_element117.useCallback)(() => {
    const isCancellingForPinch = isTouchPinchingRef.current;
    isResizingRef.current = false;
    setIsResizing(false);
    setActiveHandle(null);
    clearTimeout(settleTimerRef.current);
    if (isCancellingForPinch) {
      finishSettling();
      resetViewport();
      return;
    }
    isSettlingRef.current = true;
    setSettling(true);
    resetViewport();
    settleCrop();
    onGestureEnd?.();
    settleTimerRef.current = setTimeout(
      finishSettling,
      SETTLE_TRANSITION_FALLBACK_MS
    );
  }, [finishSettling, settleCrop, onGestureEnd, resetViewport]);
  const handleSettleTransitionEnd = (0, import_element117.useCallback)(
    (event) => {
      if (!isSettlingRef.current || event.propertyName !== "transform") {
        return;
      }
      finishSettling();
    },
    [finishSettling]
  );
  let imageTransition;
  if (settling) {
    imageTransition = SETTLE_TRANSFORM_TRANSITION;
  } else if (isZooming) {
    imageTransition = "transform 150ms linear";
  }
  const settleStencilTransition = settling ? SETTLE_STENCIL_TRANSITION : void 0;
  const imageStyle = (0, import_element117.useMemo)(() => {
    if (elementSize.width === 0 || elementSize.height === 0) {
      return {};
    }
    const centerX = (canvasSize.width - elementSize.width) / 2;
    const centerY = (canvasSize.height - elementSize.height) / 2;
    return {
      width: elementSize.width,
      height: elementSize.height,
      maxWidth: elementSize.width,
      maxHeight: elementSize.height,
      left: centerX,
      top: centerY,
      // Always lead with `scale()` (identity at rest) so the transform's
      // function list stays structurally constant across rest, resize, and
      // settle. A conditional that dropped `scale()` at viewScale === 1
      // would change the list shape exactly when the settle transition
      // crosses 1:1, forcing the browser to fall back to matrix-decomposition
      // interpolation instead of interpolating each function in turn.
      transform: `scale(${viewScale}) ${transformString}`,
      transition: imageTransition,
      imageRendering: displayScale > 1 ? "pixelated" : void 0
    };
  }, [
    canvasSize,
    elementSize,
    transformString,
    imageTransition,
    displayScale,
    viewScale
  ]);
  const settleTransition = settling ? SETTLE_TRANSFORM_TRANSITION : void 0;
  const willChange = isResizing || settling ? "transform" : void 0;
  let stageStyle;
  if (viewportState.pan.x !== 0 || viewportState.pan.y !== 0) {
    stageStyle = {
      transform: `translate(${viewportState.pan.x}px, ${viewportState.pan.y}px)`,
      transition: settleTransition,
      willChange
    };
  } else if (settling) {
    stageStyle = {
      transform: "translate(0px, 0px)",
      transition: settleTransition,
      willChange
    };
  }
  const setContainerRef = (0, import_element117.useCallback)(
    (element) => {
      if (typeof ref === "function") {
        ref(element);
      } else if (ref) {
        ref.current = element;
      }
    },
    [ref]
  );
  return /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
    "div",
    {
      ref: setContainerRef,
      className: clsx_default(
        "wp-media-editor-image-editor",
        isDragging && "wp-media-editor-image-editor--dragging",
        className
      ),
      children: /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(
        "div",
        {
          ref: canvasRef,
          className: clsx_default(
            "wp-media-editor-image-editor__canvas",
            isInteractiveGrid && "wp-media-editor-image-editor__canvas--grid-interactive",
            showInteractiveGrid && "wp-media-editor-image-editor__canvas--show-grid",
            settling && "wp-media-editor-image-editor__canvas--settling",
            // Marks the cropper as in keyboard-interaction mode.
            // CSS uses :focus on the canvas to show the stencil
            // outline and :focus on a handle to show its ring,
            // so the class applies whenever any cropper element
            // has keyboard focus.
            isFocusVisible && "wp-media-editor-image-editor__canvas--focus-visible"
          ),
          tabIndex: 0,
          role: "group",
          "aria-label": (0, import_i18n38.__)("Crop area"),
          "aria-describedby": isCropAreaFocused ? cropAreaDescriptionId : void 0,
          onFocus: handleCropAreaFocus,
          onBlur: handleCropAreaBlur,
          ...canvasHandlers,
          children: [
            /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
              "div",
              {
                id: cropAreaDescriptionId,
                style: VISUALLY_HIDDEN_STYLE,
                children: (0, import_i18n38.__)(
                  "When this area is focused, use arrow keys to move the image and plus or minus to zoom. Tab to resize handles and controls."
                )
              }
            ),
            /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(
              "div",
              {
                className: "wp-media-editor-image-editor__stage",
                "data-testid": "cropper-stage",
                style: stageStyle,
                onTransitionEnd: handleSettleTransitionEnd,
                children: [
                  /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
                    "img",
                    {
                      className: "wp-media-editor-image-editor__image",
                      "data-testid": "cropper-image",
                      src,
                      alt: "",
                      onLoad: handleImageLoad,
                      style: imageStyle,
                      draggable: false
                    }
                  ),
                  showDimming && /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
                    DimmingOverlay,
                    {
                      cropRect: state.cropRect,
                      containerSize: canvasSize,
                      imageSize: scaledVisualSize,
                      transition: settleStencilTransition
                    }
                  ),
                  /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
                    StencilComponent,
                    {
                      cropRect: state.cropRect,
                      containerSize: canvasSize,
                      imageSize: scaledVisualSize,
                      onCropChange: handleCropChange,
                      onResizeStart: handleResizeStart,
                      onResizeEnd: handleResizeEnd,
                      onEscape: handleEscape,
                      aspectRatio,
                      freeformCrop,
                      isResizeDisabled: isTouchPinching || disabled2,
                      stencilTransition: settleStencilTransition,
                      cropBounds,
                      minCropSize,
                      snapCropRect,
                      keyboardResizeStep
                    }
                  ),
                  (showGrid === true || isInteractiveGrid) && /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
                    GridOverlay,
                    {
                      cropRect: state.cropRect,
                      containerSize: canvasSize,
                      imageSize: scaledVisualSize
                    }
                  ),
                  activeHandle && outputSize && /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
                    DimensionsOverlay,
                    {
                      cropRect: state.cropRect,
                      containerSize: canvasSize,
                      imageSize: scaledVisualSize,
                      activeHandle,
                      outputWidth: outputSize.width,
                      outputHeight: outputSize.height
                    }
                  )
                ]
              }
            )
          ]
        }
      )
    }
  );
}
var CropperInnerWithRef = (0, import_element117.forwardRef)(
  CropperInner
);
var Cropper = (0, import_element117.forwardRef)(
  (props, ref) => /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(ViewportProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(CropperInnerWithRef, { ...props, ref }) })
);

// packages/media-editor/build-module/state/use-media-editor-state.mjs
var import_element118 = __toESM(require_element(), 1);

// packages/media-editor/build-module/state/types.mjs
var DEFAULT_CROP_OPTIONS = {
  aspectRatioValue: "0"
};

// packages/media-editor/build-module/state/composite-reducer.mjs
function mediaEditorReducer(state, action) {
  switch (action.type) {
    case "CROPPER": {
      const nextCropper = cropperReducer(state.cropper, action.action);
      if (nextCropper === state.cropper) {
        return state;
      }
      return { ...state, cropper: nextCropper };
    }
    case "SET_ASPECT_RATIO_VALUE": {
      const { presetKey, resolved, visualSize } = action.payload;
      const shouldReshape = resolved !== void 0 && resolved > 0 && visualSize.width > 0 && visualSize.height > 0;
      const nextCropOptions = {
        ...state.cropOptions,
        aspectRatioValue: presetKey
      };
      if (!shouldReshape) {
        if (state.cropOptions.aspectRatioValue === presetKey) {
          return state;
        }
        return { ...state, cropOptions: nextCropOptions };
      }
      const newCropRect = computeInscribedRect(resolved, visualSize);
      const nextCropper = cropperReducer(state.cropper, {
        type: "SET_CROP_RECT",
        payload: newCropRect
      });
      return {
        cropper: nextCropper,
        cropOptions: nextCropOptions
      };
    }
    case "RESET_CROP_OPTIONS": {
      if (state.cropOptions.aspectRatioValue === DEFAULT_CROP_OPTIONS.aspectRatioValue) {
        return state;
      }
      return {
        ...state,
        cropOptions: { ...DEFAULT_CROP_OPTIONS }
      };
    }
    case "RESTORE_SNAPSHOT":
      return action.payload;
    case "VIEWPORT_ADJUST_CROP_RECT": {
      const nextCropper = cropperReducer(state.cropper, {
        type: "SET_CROP_RECT",
        payload: action.payload
      });
      if (nextCropper === state.cropper) {
        return state;
      }
      return { ...state, cropper: nextCropper };
    }
  }
}
function areMediaEditorStatesEqual(a, b) {
  if (a === b) {
    return true;
  }
  return areCropperStatesEqual(a.cropper, b.cropper) && a.cropOptions.aspectRatioValue === b.cropOptions.aspectRatioValue;
}
function buildInitialMediaEditorState(initialCropper, initialOptions) {
  return {
    cropper: initialCropper,
    cropOptions: { ...DEFAULT_CROP_OPTIONS, ...initialOptions }
  };
}

// packages/media-editor/build-module/state/use-media-editor-state.mjs
function resolveAspectRatio(presetKey, cropperImage) {
  const num = parseFloat(presetKey);
  if (num === 0 || Number.isNaN(num)) {
    return void 0;
  }
  if (num === ORIGINAL_ASPECT_RATIO) {
    if (cropperImage && cropperImage.naturalWidth > 0 && cropperImage.naturalHeight > 0) {
      return cropperImage.naturalWidth / cropperImage.naturalHeight;
    }
    return void 0;
  }
  if (num > 0) {
    return num;
  }
  return void 0;
}
function areCropperImagesEqual(a, b) {
  return a?.src === b?.src && a?.naturalWidth === b?.naturalWidth && a?.naturalHeight === b?.naturalHeight;
}
function useMediaEditorState(initialState) {
  const [state, dispatch] = (0, import_element118.useReducer)(
    mediaEditorReducer,
    null,
    () => buildInitialMediaEditorState(
      enforceContainment({
        ...DEFAULT_STATE2,
        ...initialState?.cropper
      }),
      initialState?.cropOptions
    )
  );
  const [initialBaseline, setInitialBaseline] = (0, import_element118.useState)(() => state);
  const stateRef = (0, import_element118.useRef)(state);
  const visualSizeRef = (0, import_element118.useRef)({ width: 0, height: 0 });
  const historyRef = (0, import_element118.useRef)([]);
  const redoStackRef = (0, import_element118.useRef)([]);
  const [hasUndo, setHasUndo] = (0, import_element118.useState)(false);
  const [hasRedo, setHasRedo] = (0, import_element118.useState)(false);
  const isGestureOpenRef = (0, import_element118.useRef)(false);
  const gestureSnapshotRef = (0, import_element118.useRef)(null);
  const pushSnapshot = (0, import_element118.useCallback)((snapshot) => {
    const last = historyRef.current[historyRef.current.length - 1];
    if (last && areMediaEditorStatesEqual(last, snapshot)) {
      return;
    }
    historyRef.current = [...historyRef.current, snapshot];
    redoStackRef.current = [];
    setHasUndo(true);
    setHasRedo(false);
  }, []);
  const dispatchWithHistory = (0, import_element118.useCallback)(
    (action, recordHistory = true) => {
      const preState = stateRef.current;
      const postState = mediaEditorReducer(preState, action);
      if (recordHistory) {
        if (!areMediaEditorStatesEqual(preState, postState)) {
          if (isGestureOpenRef.current) {
            if (gestureSnapshotRef.current === null) {
              gestureSnapshotRef.current = preState;
            }
          } else {
            pushSnapshot(preState);
          }
        }
      }
      stateRef.current = postState;
      dispatch(action);
    },
    [pushSnapshot]
  );
  const beginGesture = (0, import_element118.useCallback)(() => {
    if (isGestureOpenRef.current) {
      return;
    }
    isGestureOpenRef.current = true;
    gestureSnapshotRef.current = null;
  }, []);
  const endGesture = (0, import_element118.useCallback)(() => {
    const snapshot = gestureSnapshotRef.current;
    if (snapshot && !areMediaEditorStatesEqual(snapshot, stateRef.current)) {
      pushSnapshot(snapshot);
    }
    gestureSnapshotRef.current = null;
    isGestureOpenRef.current = false;
  }, [pushSnapshot]);
  const dispatchCropperAction = (0, import_element118.useCallback)(
    (action) => {
      dispatchWithHistory({ type: "CROPPER", action });
    },
    [dispatchWithHistory]
  );
  const cropperSetters = (0, import_element118.useMemo)(
    () => buildCropperSetters(
      dispatchCropperAction,
      () => stateRef.current.cropper
    ),
    [dispatchCropperAction]
  );
  const setImage = (0, import_element118.useCallback)((image) => {
    if (areCropperImagesEqual(stateRef.current.cropper.image, image)) {
      return;
    }
    const action = {
      type: "CROPPER",
      action: { type: "SET_IMAGE", payload: image }
    };
    const next = mediaEditorReducer(stateRef.current, action);
    stateRef.current = next;
    dispatch(action);
    setInitialBaseline(next);
    isGestureOpenRef.current = false;
    gestureSnapshotRef.current = null;
    historyRef.current = [];
    redoStackRef.current = [];
    setHasUndo(false);
    setHasRedo(false);
  }, []);
  const reset = (0, import_element118.useCallback)(
    (resetState) => {
      dispatchWithHistory({
        type: "CROPPER",
        action: { type: "RESET", payload: resetState }
      });
    },
    [dispatchWithHistory]
  );
  const setAspectRatioValue = (0, import_element118.useCallback)(
    (presetKey) => {
      const resolved = resolveAspectRatio(
        presetKey,
        stateRef.current.cropper.image
      );
      dispatchWithHistory({
        type: "SET_ASPECT_RATIO_VALUE",
        payload: {
          presetKey,
          resolved,
          visualSize: visualSizeRef.current
        }
      });
    },
    [dispatchWithHistory]
  );
  const resetCropOptions = (0, import_element118.useCallback)(() => {
    dispatchWithHistory({ type: "RESET_CROP_OPTIONS" });
  }, [dispatchWithHistory]);
  const undo = (0, import_element118.useCallback)(() => {
    endGesture();
    const prev = historyRef.current[historyRef.current.length - 1];
    if (!prev) {
      return;
    }
    redoStackRef.current = [stateRef.current, ...redoStackRef.current];
    historyRef.current = historyRef.current.slice(0, -1);
    setHasUndo(historyRef.current.length > 0);
    setHasRedo(true);
    stateRef.current = prev;
    dispatch({ type: "RESTORE_SNAPSHOT", payload: prev });
  }, [endGesture]);
  const redo = (0, import_element118.useCallback)(() => {
    endGesture();
    const next = redoStackRef.current[0];
    if (!next) {
      return;
    }
    historyRef.current = [...historyRef.current, stateRef.current];
    redoStackRef.current = redoStackRef.current.slice(1);
    setHasUndo(true);
    setHasRedo(redoStackRef.current.length > 0);
    stateRef.current = next;
    dispatch({ type: "RESTORE_SNAPSHOT", payload: next });
  }, [endGesture]);
  const setVisualSize = (0, import_element118.useCallback)((size4) => {
    visualSizeRef.current = size4;
  }, []);
  const adjustCropRectForViewport = (0, import_element118.useCallback)(
    (rect) => {
      dispatchWithHistory(
        { type: "VIEWPORT_ADJUST_CROP_RECT", payload: rect },
        false
      );
    },
    [dispatchWithHistory]
  );
  const isDirty = !areMediaEditorStatesEqual(state, initialBaseline);
  const isCropperDirty = !areCropperStatesEqual(
    state.cropper,
    initialBaseline.cropper
  );
  const getCroppedImage = (0, import_element118.useCallback)(
    (mimeType, quality) => {
      if (!state.cropper.image) {
        return Promise.reject(
          new Error("No image loaded \u2014 call setImage first.")
        );
      }
      return exportCroppedImage(
        state.cropper.image.src,
        state.cropper,
        mimeType,
        quality
      );
    },
    [state.cropper]
  );
  const controller = (0, import_element118.useMemo)(
    () => ({
      // CropperController surface (state is the cropper slice so a
      // <Cropper> takes this controller as-is).
      ...cropperSetters,
      state: state.cropper,
      setImage,
      reset,
      isDirty,
      getCroppedImage,
      // Composite extensions
      cropOptions: state.cropOptions,
      setAspectRatioValue,
      resetCropOptions,
      isCropperDirty,
      hasUndo,
      hasRedo,
      undo,
      redo,
      beginGesture,
      endGesture,
      setVisualSize,
      adjustCropRectForViewport
    }),
    [
      cropperSetters,
      state.cropper,
      setImage,
      reset,
      isDirty,
      getCroppedImage,
      state.cropOptions,
      setAspectRatioValue,
      resetCropOptions,
      isCropperDirty,
      hasUndo,
      hasRedo,
      undo,
      redo,
      beginGesture,
      endGesture,
      setVisualSize,
      adjustCropRectForViewport
    ]
  );
  return controller;
}

// packages/media-editor/build-module/state/media-editor-state-provider.mjs
var import_element119 = __toESM(require_element(), 1);
var import_jsx_runtime159 = __toESM(require_jsx_runtime(), 1);
var MediaEditorStateContext = (0, import_element119.createContext)(
  null
);
function MediaEditorStateProvider({
  initialCropperState,
  initialCropOptions,
  children
}) {
  const controller = useMediaEditorState({
    cropper: initialCropperState,
    cropOptions: initialCropOptions
  });
  return /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(MediaEditorStateContext.Provider, { value: controller, children });
}
function useMediaEditor() {
  const context = (0, import_element119.useContext)(MediaEditorStateContext);
  if (!context) {
    throw new Error(
      "useMediaEditor must be used within a MediaEditorStateProvider."
    );
  }
  return context;
}

// packages/media-editor/build-module/components/media-editor-canvas/index.mjs
var import_jsx_runtime160 = __toESM(require_jsx_runtime(), 1);
function MediaEditorCanvas({
  isPlacementActive = false,
  onGestureStart,
  onGestureEnd,
  disabled: disabled2 = false
}) {
  const { media } = useMediaEditorContext();
  const controller = useMediaEditor();
  const { aspectRatioValue } = controller.cropOptions;
  const cropperImage = controller.state.image;
  const { beginGesture, endGesture, setImage } = controller;
  const [status, setStatus] = (0, import_element120.useState)(
    "loading"
  );
  const aspectRatio = (0, import_element120.useMemo)(
    () => resolveAspectRatio(aspectRatioValue, cropperImage),
    [aspectRatioValue, cropperImage]
  );
  const handleGestureStart = (0, import_element120.useCallback)(() => {
    beginGesture();
    onGestureStart?.();
  }, [beginGesture, onGestureStart]);
  const handleGestureEnd = (0, import_element120.useCallback)(() => {
    endGesture();
    onGestureEnd?.();
  }, [endGesture, onGestureEnd]);
  const mediaUrl = media?.source_url;
  const mediaType = getMediaTypeFromMimeType(media?.mime_type);
  const mediaWidth = Number(media?.media_details?.width);
  const mediaHeight = Number(media?.media_details?.height);
  (0, import_element120.useEffect)(() => {
    if (cropperImage || !mediaUrl || !Number.isFinite(mediaWidth) || !Number.isFinite(mediaHeight) || mediaWidth <= 0 || mediaHeight <= 0) {
      return;
    }
    setImage({
      src: mediaUrl,
      naturalWidth: mediaWidth,
      naturalHeight: mediaHeight
    });
  }, [cropperImage, mediaUrl, mediaWidth, mediaHeight, setImage]);
  const isImage = mediaType.type === "image";
  (0, import_element120.useEffect)(() => {
    if (!mediaUrl || !isImage) {
      return;
    }
    setStatus("loading");
    const probe = new window.Image();
    probe.onload = () => setStatus("loaded");
    probe.onerror = () => setStatus("error");
    probe.src = mediaUrl;
    if (probe.complete) {
      setStatus(probe.naturalWidth > 0 ? "loaded" : "error");
    }
    return () => {
      probe.onload = null;
      probe.onerror = null;
    };
  }, [mediaUrl, isImage]);
  if (!mediaUrl || !isImage) {
    return null;
  }
  if (status === "error") {
    return /* @__PURE__ */ (0, import_jsx_runtime160.jsx)("div", { className: "media-editor-canvas", children: /* @__PURE__ */ (0, import_jsx_runtime160.jsx)("div", { className: "media-editor-canvas__error", role: "alert", children: /* @__PURE__ */ (0, import_jsx_runtime160.jsx)("p", { children: (0, import_i18n39.__)("Failed to load image.") }) }) });
  }
  return /* @__PURE__ */ (0, import_jsx_runtime160.jsxs)("div", { className: "media-editor-canvas", children: [
    status === "loading" && /* @__PURE__ */ (0, import_jsx_runtime160.jsx)("div", { className: "media-editor-canvas__spinner", children: /* @__PURE__ */ (0, import_jsx_runtime160.jsx)(import_components32.Spinner, {}) }),
    /* @__PURE__ */ (0, import_jsx_runtime160.jsx)(
      "div",
      {
        className: clsx_default("media-editor-canvas__cropper", {
          "is-loaded": status === "loaded"
        }),
        children: /* @__PURE__ */ (0, import_jsx_runtime160.jsx)(
          Cropper,
          {
            src: mediaUrl,
            controller,
            aspectRatio,
            freeformCrop: true,
            showGrid: "interactive",
            isPlacementActive,
            onGestureStart: handleGestureStart,
            onGestureEnd: handleGestureEnd,
            disabled: disabled2
          }
        )
      }
    )
  ] });
}

// packages/media-editor/build-module/components/media-editor-fine-rotation/index.mjs
var import_i18n40 = __toESM(require_i18n(), 1);

// packages/media-editor/build-module/hooks/use-crop-gesture-handlers.mjs
var import_element121 = __toESM(require_element(), 1);
var CROP_CONTROL_ATTR = "data-crop-control";
var KEYBOARD_GESTURE_IDLE_MS = 300;
function useCropGestureHandlers(options = {}) {
  const { commitOnKeyUp = true } = options;
  const { beginGesture, endGesture } = useMediaEditor();
  const keyboardTimerRef = (0, import_element121.useRef)();
  const clearKeyboardTimer = (0, import_element121.useCallback)(() => {
    clearTimeout(keyboardTimerRef.current);
  }, []);
  const scheduleKeyboardEnd = (0, import_element121.useCallback)(() => {
    clearKeyboardTimer();
    keyboardTimerRef.current = setTimeout(() => {
      endGesture();
    }, KEYBOARD_GESTURE_IDLE_MS);
  }, [clearKeyboardTimer, endGesture]);
  (0, import_element121.useEffect)(() => clearKeyboardTimer, [clearKeyboardTimer]);
  const handlePointerDownCapture = (0, import_element121.useCallback)(() => {
    clearKeyboardTimer();
    beginGesture();
  }, [beginGesture, clearKeyboardTimer]);
  const handlePointerEnd = (0, import_element121.useCallback)(() => {
    clearKeyboardTimer();
    endGesture();
  }, [clearKeyboardTimer, endGesture]);
  const handleKeyDownCapture = (0, import_element121.useCallback)(() => {
    beginGesture();
    if (!commitOnKeyUp) {
      scheduleKeyboardEnd();
    }
  }, [beginGesture, commitOnKeyUp, scheduleKeyboardEnd]);
  const handleKeyUp = (0, import_element121.useCallback)(() => {
    if (commitOnKeyUp) {
      endGesture();
      return;
    }
    scheduleKeyboardEnd();
  }, [commitOnKeyUp, endGesture, scheduleKeyboardEnd]);
  return {
    [CROP_CONTROL_ATTR]: true,
    onPointerDownCapture: handlePointerDownCapture,
    onPointerUp: handlePointerEnd,
    onPointerCancel: handlePointerEnd,
    onKeyDownCapture: handleKeyDownCapture,
    onKeyUp: handleKeyUp
  };
}

// packages/media-editor/build-module/components/rotation-ruler/index.mjs
var import_element123 = __toESM(require_element(), 1);

// packages/media-editor/build-module/components/rotation-ruler/use-ruler-drag.mjs
var import_element122 = __toESM(require_element(), 1);
function pxToValueDelta(deltaPx, pixelsPerStep, step) {
  return -deltaPx / pixelsPerStep * step;
}
function clampValue(value, min4, max4) {
  if (value < min4) {
    return min4;
  }
  if (value > max4) {
    return max4;
  }
  return value;
}
function quantize(value, step) {
  return Math.round(value / step) * step;
}
function useRulerDrag(options) {
  const {
    value,
    onChange,
    min: min4,
    max: max4,
    step,
    pixelsPerStep,
    disabled: disabled2,
    onPointerDownStart
  } = options;
  const latestRef = (0, import_element122.useRef)({
    value,
    startX: 0,
    startValue: 0,
    activeStep: step,
    dragging: false,
    captureElement: null,
    capturePointerId: 0,
    windowPointerUp: null
  });
  (0, import_element122.useEffect)(() => {
    latestRef.current.value = value;
  }, [value]);
  const endDrag = (0, import_element122.useCallback)(() => {
    const state = latestRef.current;
    if (!state.dragging) {
      return;
    }
    state.dragging = false;
    if (state.captureElement && state.captureElement.hasPointerCapture(state.capturePointerId)) {
      state.captureElement.releasePointerCapture(
        state.capturePointerId
      );
    }
    state.captureElement = null;
    if (state.windowPointerUp) {
      window.removeEventListener("pointerup", state.windowPointerUp);
      window.removeEventListener(
        "pointercancel",
        state.windowPointerUp
      );
      state.windowPointerUp = null;
    }
  }, []);
  (0, import_element122.useEffect)(() => endDrag, [endDrag]);
  (0, import_element122.useEffect)(() => {
    if (disabled2) {
      endDrag();
    }
  }, [disabled2, endDrag]);
  const onPointerDown = (0, import_element122.useCallback)(
    (event) => {
      if (disabled2 || event.button !== 0) {
        return;
      }
      const state = latestRef.current;
      event.currentTarget.setPointerCapture(event.pointerId);
      state.captureElement = event.currentTarget;
      state.capturePointerId = event.pointerId;
      state.startX = event.clientX;
      state.startValue = state.value;
      state.activeStep = event.shiftKey ? step / 2 : step;
      state.dragging = true;
      onPointerDownStart?.();
      const onWindowUp = () => endDrag();
      state.windowPointerUp = onWindowUp;
      window.addEventListener("pointerup", onWindowUp);
      window.addEventListener("pointercancel", onWindowUp);
    },
    [disabled2, onPointerDownStart, endDrag, step]
  );
  const onPointerMove = (0, import_element122.useCallback)(
    (event) => {
      const state = latestRef.current;
      if (disabled2 || !state.dragging) {
        return;
      }
      const requestedStep = event.shiftKey ? step / 2 : step;
      if (requestedStep !== state.activeStep) {
        state.startX = event.clientX;
        state.startValue = state.value;
        state.activeStep = requestedStep;
      }
      const deltaPx = event.clientX - state.startX;
      const deltaValue = pxToValueDelta(
        deltaPx,
        pixelsPerStep,
        state.activeStep
      );
      const raw = state.startValue + deltaValue;
      const stepped = quantize(raw, state.activeStep);
      const next = clampValue(stepped, min4, max4);
      if (next !== state.value) {
        state.value = next;
        onChange(next);
      }
    },
    [disabled2, onChange, min4, max4, step, pixelsPerStep]
  );
  return {
    onPointerDown,
    onPointerMove,
    onPointerUp: endDrag,
    onPointerCancel: endDrag
  };
}

// packages/media-editor/build-module/components/rotation-ruler/index.mjs
var import_jsx_runtime161 = __toESM(require_jsx_runtime(), 1);
var STRIP_HEIGHT = 32;
var LABEL_BASELINE_Y = 11;
var MAJOR_INTERVAL = 15;
var TICK_HEIGHT_MINOR = 4;
var TICK_HEIGHT_MID = 8;
var TICK_HEIGHT_MAJOR = 14;
function useTicks(min4, max4) {
  return (0, import_element123.useMemo)(() => {
    const out = [];
    for (let v2 = Math.ceil(min4); v2 <= Math.floor(max4); v2 += 1) {
      let kind = "minor";
      let height = TICK_HEIGHT_MINOR;
      if (v2 % 15 === 0) {
        kind = "major";
        height = TICK_HEIGHT_MAJOR;
      } else if (v2 % 5 === 0) {
        kind = "mid";
        height = TICK_HEIGHT_MID;
      }
      out.push({ value: v2, kind, height });
    }
    return out;
  }, [min4, max4]);
}
function formatValue(value) {
  const rounded = Math.round(value * 10) / 10;
  return Number.isInteger(rounded) ? rounded.toFixed(0) : rounded.toFixed(1);
}
function RotationRuler(props) {
  const {
    value,
    onChange,
    min: min4 = -45,
    max: max4 = 45,
    step = 1,
    label,
    unit = "\xB0",
    pixelsPerStep = 6,
    className,
    id,
    disabled: disabled2 = false
  } = props;
  const inputRef = (0, import_element123.useRef)(null);
  const generatedId = (0, import_element123.useId)();
  const inputId = id ?? generatedId;
  const dragHandlers = useRulerDrag({
    value,
    onChange,
    min: min4,
    max: max4,
    step,
    pixelsPerStep,
    disabled: disabled2,
    onPointerDownStart: () => inputRef.current?.focus()
  });
  const handleKeyDown = (event) => {
    const isIncrement = event.key === "ArrowRight" || event.key === "ArrowUp";
    const isDecrement = event.key === "ArrowLeft" || event.key === "ArrowDown";
    if (!isIncrement && !isDecrement) {
      return;
    }
    event.preventDefault();
    if (disabled2) {
      return;
    }
    const direction = isIncrement ? 1 : -1;
    const magnitude = event.shiftKey ? step / 2 : step;
    const next = clampValue(value + direction * magnitude, min4, max4);
    if (next !== value) {
      onChange(next);
    }
  };
  const display = `${formatValue(value)}${unit}`;
  const ticks = useTicks(min4, max4);
  const pxPerUnit = pixelsPerStep / step;
  const stripStyle = (0, import_element123.useMemo)(() => {
    const offset4 = -value * pxPerUnit;
    return {
      transform: `translateX(calc(-50% + ${offset4}px))`
    };
  }, [value, pxPerUnit]);
  const closestMajor = Math.round(value / MAJOR_INTERVAL) * MAJOR_INTERVAL;
  const onMajor = Math.abs(value - closestMajor) < 0.01;
  const numberText = onMajor ? `${closestMajor}` : formatValue(value);
  const isNegative = numberText.startsWith("-");
  const digits = isNegative ? numberText.slice(1) : numberText;
  const majorTicks = ticks.filter((tick) => tick.kind === "major");
  return /* @__PURE__ */ (0, import_jsx_runtime161.jsxs)(
    "div",
    {
      className: clsx_default("rotation-ruler", className),
      role: "presentation",
      "data-testid": "rotation-ruler",
      "data-disabled": disabled2 || void 0,
      ...dragHandlers,
      children: [
        /* @__PURE__ */ (0, import_jsx_runtime161.jsx)(
          "input",
          {
            ref: inputRef,
            id: inputId,
            type: "range",
            className: "rotation-ruler__input",
            min: min4,
            max: max4,
            step: "any",
            value,
            disabled: disabled2,
            "aria-label": label,
            "aria-valuetext": display,
            onChange: (event) => onChange(
              clampValue(event.target.valueAsNumber, min4, max4)
            ),
            onKeyDown: handleKeyDown
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime161.jsx)("div", { className: "rotation-ruler__strip", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime161.jsxs)(
          "svg",
          {
            className: "rotation-ruler__ticks",
            style: stripStyle,
            width: (max4 - min4) * pxPerUnit,
            height: STRIP_HEIGHT,
            viewBox: `${min4 * pxPerUnit} 0 ${(max4 - min4) * pxPerUnit} ${STRIP_HEIGHT}`,
            preserveAspectRatio: "xMidYMid meet",
            children: [
              ticks.map((tick) => /* @__PURE__ */ (0, import_jsx_runtime161.jsx)(
                "line",
                {
                  x1: tick.value * pxPerUnit,
                  x2: tick.value * pxPerUnit,
                  y1: STRIP_HEIGHT - tick.height,
                  y2: STRIP_HEIGHT,
                  className: `rotation-ruler__tick rotation-ruler__tick--${tick.kind}`
                },
                tick.value
              )),
              majorTicks.map((tick) => /* @__PURE__ */ (0, import_jsx_runtime161.jsxs)(
                "text",
                {
                  x: tick.value * pxPerUnit,
                  y: LABEL_BASELINE_Y,
                  textAnchor: "middle",
                  className: "rotation-ruler__label",
                  children: [
                    tick.value,
                    unit
                  ]
                },
                tick.value
              ))
            ]
          }
        ) }),
        /* @__PURE__ */ (0, import_jsx_runtime161.jsx)("div", { className: "rotation-ruler__active-label", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime161.jsxs)("span", { className: "rotation-ruler__active-label-number", children: [
          isNegative && /* @__PURE__ */ (0, import_jsx_runtime161.jsx)("span", { className: "rotation-ruler__active-label-sign", children: "-" }),
          digits,
          /* @__PURE__ */ (0, import_jsx_runtime161.jsx)("span", { className: "rotation-ruler__active-label-unit", children: unit })
        ] }) }),
        /* @__PURE__ */ (0, import_jsx_runtime161.jsx)("div", { className: "rotation-ruler__pointer", "aria-hidden": "true" })
      ]
    }
  );
}

// packages/media-editor/build-module/components/media-editor-fine-rotation/index.mjs
var import_jsx_runtime162 = __toESM(require_jsx_runtime(), 1);
function MediaEditorFineRotation({
  onPlacementControlInteraction,
  disabled: disabled2 = false
}) {
  const { state, setRotation } = useMediaEditor();
  const rotationGestureHandlers = useCropGestureHandlers({
    commitOnKeyUp: false
  });
  const baseAngle = Math.round(state.rotation / 90) * 90;
  const singleFlip = state.flip.horizontal !== state.flip.vertical;
  const visualDir = singleFlip ? -1 : 1;
  const fineOffset = (state.rotation - baseAngle) * visualDir;
  const handleRotationSlider = (value) => {
    const EPS = 0.01;
    const clamped = Math.max(
      -MAX_ROTATION_OFFSET + EPS,
      Math.min(MAX_ROTATION_OFFSET - EPS, value)
    );
    onPlacementControlInteraction?.();
    setRotation(baseAngle + clamped * visualDir);
  };
  return /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(
    "div",
    {
      role: "presentation",
      className: "media-editor-fine-rotation",
      ...rotationGestureHandlers,
      children: /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(
        RotationRuler,
        {
          label: (0, import_i18n40.__)("Fine rotation"),
          min: -MAX_ROTATION_OFFSET,
          max: MAX_ROTATION_OFFSET,
          value: fineOffset,
          onChange: handleRotationSlider,
          disabled: disabled2
        }
      )
    }
  );
}

// packages/media-editor/build-module/components/media-editor-crop-panel/index.mjs
var import_components34 = __toESM(require_components(), 1);
var import_i18n42 = __toESM(require_i18n(), 1);

// packages/media-editor/build-module/components/media-editor-image-controls/index.mjs
var import_components33 = __toESM(require_components(), 1);
var import_i18n41 = __toESM(require_i18n(), 1);

// packages/media-editor/build-module/components/media-editor/use-crop-options.mjs
var import_element124 = __toESM(require_element(), 1);
function getAspectRatioOptions(aspectRatioPresets) {
  return [
    ...DEFAULT_ASPECT_RATIOS.filter((preset) => preset.value <= 0),
    ...aspectRatioPresets ?? DEFAULT_ASPECT_RATIOS.filter((preset) => preset.value > 0)
  ];
}
function useCropOptions({
  aspectRatioPresets
} = {}) {
  const controller = useMediaEditor();
  const { aspectRatioValue } = controller.cropOptions;
  const cropperImage = controller.state.image;
  const aspectRatioOptions = (0, import_element124.useMemo)(
    () => getAspectRatioOptions(aspectRatioPresets),
    [aspectRatioPresets]
  );
  const resolvedAspectRatio = (0, import_element124.useMemo)(
    () => resolveAspectRatio(aspectRatioValue, cropperImage),
    [aspectRatioValue, cropperImage]
  );
  return {
    aspectRatioValue,
    setAspectRatioValue: controller.setAspectRatioValue,
    aspectRatioOptions,
    resolvedAspectRatio,
    resetCropOptions: controller.resetCropOptions
  };
}

// packages/media-editor/build-module/components/media-editor-image-controls/index.mjs
var import_jsx_runtime163 = __toESM(require_jsx_runtime(), 1);
var DEFAULT_ZOOM_FACTOR = 1.2;
function MediaEditorImageControls({
  withLabels = false,
  showAspectRatioControl = false,
  aspectRatioPresets,
  zoomFactor = DEFAULT_ZOOM_FACTOR,
  disabled: disabled2 = false
}) {
  const { state, setFlip, snapRotate90, setZoom } = useMediaEditor();
  const { aspectRatioValue, setAspectRatioValue, aspectRatioOptions } = useCropOptions({ aspectRatioPresets });
  const hasAspectRatioControl = !withLabels && showAspectRatioControl;
  const minZoom = getMinZoom(state);
  const zoomByFactor = (factor) => {
    setZoom(
      Math.min(MAX_ZOOM, Math.max(minZoom, state.zoom * factor))
    );
  };
  const rotateButtons = /* @__PURE__ */ (0, import_jsx_runtime163.jsxs)(import_jsx_runtime163.Fragment, { children: [
    /* @__PURE__ */ (0, import_jsx_runtime163.jsx)(
      import_components33.Button,
      {
        size: "compact",
        icon: rotate_left_default,
        label: (0, import_i18n41.__)("Rotate 90\xB0 counter-clockwise"),
        showTooltip: true,
        disabled: disabled2,
        accessibleWhenDisabled: true,
        onClick: () => snapRotate90(-1)
      }
    ),
    /* @__PURE__ */ (0, import_jsx_runtime163.jsx)(
      import_components33.Button,
      {
        size: "compact",
        icon: rotate_right_default,
        label: (0, import_i18n41.__)("Rotate 90\xB0 clockwise"),
        showTooltip: true,
        disabled: disabled2,
        accessibleWhenDisabled: true,
        onClick: () => snapRotate90(1)
      }
    )
  ] });
  const flipButtons = /* @__PURE__ */ (0, import_jsx_runtime163.jsxs)(import_jsx_runtime163.Fragment, { children: [
    /* @__PURE__ */ (0, import_jsx_runtime163.jsx)(
      import_components33.Button,
      {
        size: "compact",
        icon: flip_horizontal_default,
        label: (0, import_i18n41.__)("Flip horizontal"),
        showTooltip: true,
        isPressed: state.flip.horizontal,
        disabled: disabled2,
        accessibleWhenDisabled: true,
        onClick: () => setFlip({
          horizontal: !state.flip.horizontal,
          vertical: state.flip.vertical
        })
      }
    ),
    /* @__PURE__ */ (0, import_jsx_runtime163.jsx)(
      import_components33.Button,
      {
        size: "compact",
        icon: flip_vertical_default,
        label: (0, import_i18n41.__)("Flip vertical"),
        showTooltip: true,
        isPressed: state.flip.vertical,
        disabled: disabled2,
        accessibleWhenDisabled: true,
        onClick: () => setFlip({
          horizontal: state.flip.horizontal,
          vertical: !state.flip.vertical
        })
      }
    )
  ] });
  const zoomButtons = /* @__PURE__ */ (0, import_jsx_runtime163.jsxs)(import_jsx_runtime163.Fragment, { children: [
    /* @__PURE__ */ (0, import_jsx_runtime163.jsx)(
      import_components33.Button,
      {
        size: "compact",
        icon: plus_default,
        label: (0, import_i18n41.__)("Zoom in"),
        showTooltip: true,
        disabled: disabled2 || state.zoom >= MAX_ZOOM,
        accessibleWhenDisabled: true,
        onClick: () => zoomByFactor(zoomFactor)
      }
    ),
    /* @__PURE__ */ (0, import_jsx_runtime163.jsx)(
      import_components33.Button,
      {
        size: "compact",
        icon: line_solid_default,
        label: (0, import_i18n41.__)("Zoom out"),
        showTooltip: true,
        disabled: disabled2 || state.zoom <= minZoom,
        accessibleWhenDisabled: true,
        onClick: () => zoomByFactor(1 / zoomFactor)
      }
    )
  ] });
  const aspectRatioDropdown = hasAspectRatioControl ? /* @__PURE__ */ (0, import_jsx_runtime163.jsx)(
    import_components33.DropdownMenu,
    {
      icon: aspect_ratio_default,
      label: (0, import_i18n41.__)("Aspect ratio"),
      popoverProps: { placement: "top" },
      toggleProps: { size: "compact", disabled: disabled2 },
      children: ({ onClose }) => /* @__PURE__ */ (0, import_jsx_runtime163.jsx)(import_components33.MenuGroup, { label: (0, import_i18n41.__)("Aspect ratio"), children: aspectRatioOptions.map((preset) => {
        const value = preset.value.toString();
        const isSelected = value === aspectRatioValue;
        return /* @__PURE__ */ (0, import_jsx_runtime163.jsx)(
          import_components33.MenuItem,
          {
            role: "menuitemradio",
            isSelected,
            icon: isSelected ? check_default : void 0,
            disabled: disabled2,
            onClick: () => {
              if (disabled2) {
                return;
              }
              setAspectRatioValue(value);
              onClose();
            },
            children: preset.label
          },
          value
        );
      }) })
    }
  ) : null;
  if (withLabels) {
    return /* @__PURE__ */ (0, import_jsx_runtime163.jsxs)("div", { className: "media-editor-image-controls is-stacked", children: [
      /* @__PURE__ */ (0, import_jsx_runtime163.jsxs)("div", { className: "media-editor-image-controls__transforms", children: [
        /* @__PURE__ */ (0, import_jsx_runtime163.jsxs)(
          "div",
          {
            className: "media-editor-image-controls__group",
            role: "group",
            "aria-label": (0, import_i18n41.__)("Rotate"),
            children: [
              /* @__PURE__ */ (0, import_jsx_runtime163.jsx)(
                "span",
                {
                  className: "media-editor-image-controls__label",
                  "aria-hidden": "true",
                  children: (0, import_i18n41.__)("Rotate")
                }
              ),
              /* @__PURE__ */ (0, import_jsx_runtime163.jsx)("div", { className: "media-editor-image-controls__buttons", children: rotateButtons })
            ]
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime163.jsxs)(
          "div",
          {
            className: "media-editor-image-controls__group",
            role: "group",
            "aria-label": (0, import_i18n41.__)("Flip"),
            children: [
              /* @__PURE__ */ (0, import_jsx_runtime163.jsx)(
                "span",
                {
                  className: "media-editor-image-controls__label",
                  "aria-hidden": "true",
                  children: (0, import_i18n41.__)("Flip")
                }
              ),
              /* @__PURE__ */ (0, import_jsx_runtime163.jsx)("div", { className: "media-editor-image-controls__buttons", children: flipButtons })
            ]
          }
        )
      ] }),
      /* @__PURE__ */ (0, import_jsx_runtime163.jsxs)(
        "div",
        {
          className: "media-editor-image-controls__group",
          role: "group",
          "aria-label": (0, import_i18n41.__)("Zoom"),
          children: [
            /* @__PURE__ */ (0, import_jsx_runtime163.jsx)(
              "span",
              {
                className: "media-editor-image-controls__label",
                "aria-hidden": "true",
                children: (0, import_i18n41.__)("Zoom")
              }
            ),
            /* @__PURE__ */ (0, import_jsx_runtime163.jsx)("div", { className: "media-editor-image-controls__buttons", children: zoomButtons })
          ]
        }
      )
    ] });
  }
  return /* @__PURE__ */ (0, import_jsx_runtime163.jsxs)("div", { className: "media-editor-image-controls", children: [
    rotateButtons,
    flipButtons,
    zoomButtons,
    aspectRatioDropdown
  ] });
}

// packages/media-editor/build-module/components/media-editor-crop-panel/index.mjs
var import_jsx_runtime164 = __toESM(require_jsx_runtime(), 1);
function MediaEditorCropPanel({
  aspectRatioValue,
  onAspectRatioChange,
  aspectRatioOptions,
  disabled: disabled2 = false
}) {
  return (
    // Tag the whole panel as a crop-control region so the modal's
    // Cmd+Z handler doesn't mistake the SelectControl input for a
    // metadata field (which would suppress undo).
    /* @__PURE__ */ (0, import_jsx_runtime164.jsxs)(
      Stack,
      {
        direction: "column",
        gap: "xl",
        ...{ [CROP_CONTROL_ATTR]: true },
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(VisuallyHidden, { render: /* @__PURE__ */ (0, import_jsx_runtime164.jsx)("h2", {}), children: (0, import_i18n42.__)("Crop options") }),
          /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(MediaEditorImageControls, { withLabels: true, disabled: disabled2 }),
          /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(
            import_components34.SelectControl,
            {
              label: (0, import_i18n42.__)("Aspect ratio"),
              value: aspectRatioValue,
              onChange: onAspectRatioChange,
              disabled: disabled2,
              options: aspectRatioOptions.map((preset) => ({
                label: preset.label,
                value: preset.value.toString()
              }))
            }
          )
        ]
      }
    )
  );
}

// packages/media-editor/build-module/components/media-editor-keyboard-shortcuts-modal/index.mjs
var import_components35 = __toESM(require_components(), 1);
var import_element125 = __toESM(require_element(), 1);
var import_i18n43 = __toESM(require_i18n(), 1);
var import_keycodes = __toESM(require_keycodes(), 1);
var import_jsx_runtime165 = __toESM(require_jsx_runtime(), 1);
var SHORTCUTS = [
  {
    description: (0, import_i18n43.__)("Undo"),
    keyCombination: { modifier: "primary", character: "z" }
  },
  {
    description: (0, import_i18n43.__)("Redo"),
    keyCombination: { modifier: "primaryShift", character: "z" }
  },
  {
    description: (0, import_i18n43.__)("Pan"),
    keyCombination: {
      character: ["\u2191", "\u2193", "\u2190", "\u2192"],
      ariaLabel: (0, import_i18n43.__)("Arrow keys")
    }
  },
  {
    description: (0, import_i18n43.__)("Zoom in"),
    keyCombination: { character: "+" }
  },
  {
    description: (0, import_i18n43.__)("Zoom out"),
    keyCombination: { character: "-" }
  },
  {
    description: (0, import_i18n43.__)("Rotate 90\xB0 clockwise"),
    keyCombination: { character: "R" }
  },
  {
    description: (0, import_i18n43.__)("Rotate 90\xB0 counter-clockwise"),
    keyCombination: { modifier: "shift", character: "R" }
  },
  {
    description: (0, import_i18n43.__)("Flip horizontal"),
    keyCombination: { character: "H" }
  },
  {
    description: (0, import_i18n43.__)("Flip vertical"),
    keyCombination: { character: "V" }
  },
  {
    description: (0, import_i18n43.__)("Pan or resize crop (large step)"),
    keyCombination: {
      modifier: "shift",
      character: ["\u2191", "\u2193", "\u2190", "\u2192"],
      ariaLabel: (0, import_i18n43.__)("Shift + Arrow keys")
    }
  }
];
function KeyCombinationDisplay({
  keyCombination
}) {
  const { modifier, character, ariaLabel } = keyCombination;
  let keys;
  if (Array.isArray(character)) {
    if (modifier) {
      const sample = import_keycodes.displayShortcutList[modifier](character[0]);
      keys = [...sample.slice(0, -1), ...character];
    } else {
      keys = character;
    }
  } else {
    keys = modifier ? import_keycodes.displayShortcutList[modifier](character) : [character];
  }
  const charString = Array.isArray(character) ? character.join("") : character;
  let label;
  if (ariaLabel) {
    label = ariaLabel;
  } else if (modifier) {
    label = import_keycodes.shortcutAriaLabel[modifier](charString);
  } else {
    label = charString;
  }
  return /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
    "kbd",
    {
      className: "media-editor-keyboard-shortcuts-modal__shortcut-term",
      "aria-label": label,
      children: keys.map(
        (key, index3) => key === "+" && modifier ? /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(import_element125.Fragment, { children: key }, index3) : /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
          "kbd",
          {
            className: "media-editor-keyboard-shortcuts-modal__shortcut-key",
            children: key
          },
          index3
        )
      )
    }
  );
}
function MediaEditorKeyboardShortcutsModal({
  onClose
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime165.jsxs)(
    import_components35.Modal,
    {
      className: "media-editor-keyboard-shortcuts-modal",
      title: (0, import_i18n43.__)("Keyboard shortcuts"),
      onRequestClose: onClose,
      children: [
        /* @__PURE__ */ (0, import_jsx_runtime165.jsx)("p", { className: "media-editor-keyboard-shortcuts-modal__note", children: (0, import_i18n43.__)(
          "These shortcuts work when the image editor has focus."
        ) }),
        /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
          "ul",
          {
            className: "media-editor-keyboard-shortcuts-modal__shortcut-list",
            role: "list",
            children: SHORTCUTS.map(({ description, keyCombination }, index3) => /* @__PURE__ */ (0, import_jsx_runtime165.jsxs)(
              "li",
              {
                className: "media-editor-keyboard-shortcuts-modal__shortcut",
                children: [
                  /* @__PURE__ */ (0, import_jsx_runtime165.jsx)("span", { className: "media-editor-keyboard-shortcuts-modal__shortcut-description", children: description }),
                  /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
                    KeyCombinationDisplay,
                    {
                      keyCombination
                    }
                  )
                ]
              },
              index3
            ))
          }
        )
      ]
    }
  );
}

// packages/media-editor/build-module/components/media-editor/use-save-media-editor.mjs
var import_api_fetch = __toESM(require_api_fetch(), 1);
var import_data2 = __toESM(require_data(), 1);
var import_core_data = __toESM(require_core_data(), 1);
var import_element126 = __toESM(require_element(), 1);
var import_i18n44 = __toESM(require_i18n(), 1);
var import_notices = __toESM(require_notices(), 1);

// packages/media-editor/build-module/components/media-editor-modal/build-modifiers.mjs
var CROP_TOLERANCE = 0.1;
function buildModifiers(state, imageSize) {
  const modifiers = [];
  if (imageSize.width === 0 || imageSize.height === 0) {
    return modifiers;
  }
  const { cropRect, pan, zoom, flip: flip4 } = state;
  const hasFlipH = flip4.horizontal;
  const hasFlipV = flip4.vertical;
  if (hasFlipH || hasFlipV) {
    modifiers.push({
      type: "flip",
      args: { flip: { horizontal: hasFlipH, vertical: hasFlipV } }
    });
  }
  const rawAngle = (state.rotation % 360 + 360) % 360;
  const singleAxisFlip = hasFlipH !== hasFlipV;
  const signedAngle2 = singleAxisFlip ? (360 - rawAngle) % 360 : rawAngle;
  if (signedAngle2 !== 0) {
    modifiers.push({ type: "rotate", args: { angle: signedAngle2 } });
  }
  const snapRotation = Math.round(state.rotation / 90) * 90;
  const { width: snapW, height: snapH } = getRotatedBBox(
    imageSize.width,
    imageSize.height,
    snapRotation
  );
  const { width: fullW, height: fullH } = getRotatedBBox(
    imageSize.width,
    imageSize.height,
    state.rotation
  );
  const imgLeft = 0.5 + pan.x - zoom / 2;
  const imgTop = 0.5 + pan.y - zoom / 2;
  const snapX = (cropRect.x - imgLeft) / zoom * snapW;
  const snapY = (cropRect.y - imgTop) / zoom * snapH;
  const widthPx = cropRect.width / zoom * snapW;
  const heightPx = cropRect.height / zoom * snapH;
  const offsetX = (fullW - snapW) / 2;
  const offsetY = (fullH - snapH) / 2;
  const fullX = snapX + offsetX;
  const fullY = snapY + offsetY;
  const leftPct = fullX / fullW * 100;
  const topPct = fullY / fullH * 100;
  const widthPct = widthPx / fullW * 100;
  const heightPct = heightPx / fullH * 100;
  const coversFullFrame = leftPct <= CROP_TOLERANCE && topPct <= CROP_TOLERANCE && widthPct >= 100 - CROP_TOLERANCE && heightPct >= 100 - CROP_TOLERANCE;
  if (!coversFullFrame) {
    modifiers.push({
      type: "crop",
      args: {
        left: leftPct,
        top: topPct,
        width: widthPct,
        height: heightPct
      }
    });
  }
  return modifiers;
}

// packages/media-editor/build-module/components/media-editor/use-save-media-editor.mjs
var METADATA_EDIT_KEYS = [
  "title",
  "caption",
  "description",
  "alt_text",
  "post"
];
var MEDIA_EDITOR_NOTICES_CONTEXT = "media-editor";
function getCropModifiers(cropper) {
  if (!cropper.isCropperDirty || !cropper.state.image) {
    return [];
  }
  return buildModifiers(cropper.state, {
    width: cropper.state.image.naturalWidth,
    height: cropper.state.image.naturalHeight
  });
}
function getMetadataEdits(pendingEdits, media) {
  const metadataEdits = {};
  for (const key of METADATA_EDIT_KEYS) {
    if (pendingEdits && key in pendingEdits) {
      metadataEdits[key] = pendingEdits[key];
    }
  }
  if (!("post" in metadataEdits) && media?.post !== void 0) {
    metadataEdits.post = media.post;
  }
  return metadataEdits;
}
function useSaveMediaEditor({
  cropper,
  id,
  isImage,
  media,
  onSaved
}) {
  const registry = (0, import_data2.useRegistry)();
  const {
    clearEntityRecordEdits,
    receiveEntityRecords,
    saveEditedEntityRecord
  } = (0, import_data2.useDispatch)(import_core_data.store);
  const { createErrorNotice, removeAllNotices } = (0, import_data2.useDispatch)(import_notices.store);
  const [isSaving, setIsSaving] = (0, import_element126.useState)(false);
  const save = (0, import_element126.useCallback)(async () => {
    removeAllNotices("snackbar", MEDIA_EDITOR_NOTICES_CONTEXT);
    setIsSaving(true);
    try {
      let saved;
      const modifiers = getCropModifiers(cropper);
      const previous = modifiers.length > 0 && media ? {
        id,
        url: media.source_url
      } : void 0;
      if (modifiers.length > 0) {
        const pendingEdits = registry.select(import_core_data.store).getEntityRecordNonTransientEdits(
          "postType",
          "attachment",
          id
        );
        const metadataEdits = getMetadataEdits(pendingEdits, media);
        saved = await (0, import_api_fetch.default)({
          path: `/wp/v2/media/${id}/edit`,
          method: "POST",
          data: {
            src: media?.source_url,
            modifiers,
            ...metadataEdits
          }
        });
        if (saved) {
          receiveEntityRecords(
            "postType",
            "attachment",
            saved,
            void 0,
            true
          );
        }
      } else {
        saved = await saveEditedEntityRecord(
          "postType",
          "attachment",
          id
        );
      }
      const next = saved ?? media;
      if (next && next.id !== id) {
        clearEntityRecordEdits("postType", "attachment", id);
      }
      if (next && next.id) {
        if (next.id === id) {
          cropper.reset();
        }
        onSaved?.({
          id: next.id,
          url: next.source_url,
          media: next,
          previous
        });
      }
    } catch (error2) {
      const message2 = error2 instanceof Error ? error2.message : error2?.message ?? (0, import_i18n44.__)("An unknown error occurred.");
      createErrorNotice(
        isImage ? (0, import_i18n44.sprintf)(
          /* translators: %s: Error message. */
          (0, import_i18n44.__)("Could not save image. %s"),
          message2
        ) : (0, import_i18n44.sprintf)(
          /* translators: %s: Error message. */
          (0, import_i18n44.__)("Could not save media. %s"),
          message2
        ),
        {
          type: "snackbar",
          context: MEDIA_EDITOR_NOTICES_CONTEXT
        }
      );
    } finally {
      setIsSaving(false);
    }
  }, [
    clearEntityRecordEdits,
    createErrorNotice,
    cropper,
    id,
    isImage,
    media,
    onSaved,
    receiveEntityRecords,
    registry,
    removeAllNotices,
    saveEditedEntityRecord
  ]);
  return { isSaving, save };
}

// packages/media-editor/build-module/components/media-editor/index.mjs
var import_jsx_runtime166 = __toESM(require_jsx_runtime(), 1);
var ATTACHMENT_EMBED_QUERY = { _embed: "author,wp:attached-to" };
var PLACEMENT_CONTROL_IDLE_MS = 300;
var DETAILS_PANEL = "details";
var CROP_PANEL = "crop";
function MediaEditorSidebar({
  tabs,
  activeTab,
  onSelectTab,
  disabled: disabled2 = false
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)(
    navigable_region_default,
    {
      className: "media-editor__sidebar",
      ariaLabel: (0, import_i18n45.__)("Media settings"),
      children: [
        /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(VisuallyHidden, { render: /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("h2", {}), children: (0, import_i18n45.__)("Media settings") }),
        /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)(
          tabs_exports.Root,
          {
            className: "media-editor__tabs",
            value: activeTab,
            onValueChange: onSelectTab,
            children: [
              /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("div", { className: "media-editor__tablist", children: /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(tabs_exports.List, { variant: "minimal", children: tabs.map((tab) => /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
                tabs_exports.Tab,
                {
                  value: tab.id,
                  disabled: disabled2,
                  children: tab.title
                },
                tab.id
              )) }) }),
              tabs.map((tab) => /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
                tabs_exports.Panel,
                {
                  value: tab.id,
                  tabIndex: -1,
                  className: "media-editor__panel",
                  children: /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(Stack, { direction: "column", gap: "lg", children: tab.render() })
                },
                tab.id
              ))
            ]
          }
        )
      ]
    }
  );
}
var MediaEditorFrameContext = (0, import_element127.createContext)(null);
function useMediaEditorFrameContext() {
  const context = (0, import_element127.useContext)(MediaEditorFrameContext);
  if (!context) {
    throw new Error(
      "useMediaEditorFrameContext must be used within MediaEditor"
    );
  }
  return context;
}
function HeaderActions({ showCloseButton = false }) {
  const { isImage, isSaving, onCancel, isWide, activePanel, onTogglePanel } = useMediaEditorFrameContext();
  const isPanelOpen = !!activePanel;
  const [isShortcutsModalOpen, setIsShortcutsModalOpen] = (0, import_element127.useState)(false);
  return /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)(
    Stack,
    {
      className: "media-editor__header-actions",
      justify: "flex-end",
      align: "center",
      gap: "sm",
      children: [
        isImage && /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
          import_components36.Button,
          {
            size: "compact",
            icon: keyboard_default,
            label: (0, import_i18n45.__)("Keyboard shortcuts"),
            onClick: () => setIsShortcutsModalOpen(true)
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
          import_components36.Button,
          {
            size: "compact",
            icon: drawer_right_default,
            label: (0, import_i18n45.__)("Media settings"),
            isPressed: isPanelOpen,
            "aria-expanded": isWide ? isPanelOpen : void 0,
            onClick: onTogglePanel
          }
        ),
        showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
          import_components36.Button,
          {
            size: "compact",
            icon: close_default,
            label: (0, import_i18n45.__)("Close"),
            onClick: onCancel,
            disabled: isSaving,
            accessibleWhenDisabled: true
          }
        ),
        isShortcutsModalOpen && /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
          MediaEditorKeyboardShortcutsModal,
          {
            onClose: () => setIsShortcutsModalOpen(false)
          }
        )
      ]
    }
  );
}
function HistoryActions() {
  const { isImage, isUndoRedoDisabled, onReset, isWide, activePanel } = useMediaEditorFrameContext();
  const {
    reset,
    isDirty,
    hasUndo,
    hasRedo,
    undo: undoCrop,
    redo: redoCrop,
    beginGesture,
    endGesture
  } = useMediaEditor();
  if (!isImage || !isWide && !!activePanel) {
    return null;
  }
  const handleUndo = () => {
    if (isUndoRedoDisabled) {
      return;
    }
    undoCrop();
  };
  const handleRedo = () => {
    if (isUndoRedoDisabled) {
      return;
    }
    redoCrop();
  };
  const handleReset = () => {
    if (isUndoRedoDisabled) {
      return;
    }
    beginGesture();
    reset();
    onReset();
    endGesture();
  };
  return /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)(
    Stack,
    {
      className: "media-editor__history-actions",
      align: "center",
      gap: "sm",
      children: [
        /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
          import_components36.Button,
          {
            size: "compact",
            variant: "tertiary",
            disabled: isUndoRedoDisabled || !isDirty,
            accessibleWhenDisabled: true,
            onClick: handleReset,
            children: (0, import_i18n45.__)("Reset")
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
          import_components36.Button,
          {
            size: "compact",
            icon: undo_default,
            label: (0, import_i18n45.__)("Undo"),
            showTooltip: true,
            shortcut: import_keycodes2.displayShortcut.primary("z"),
            disabled: isUndoRedoDisabled || !hasUndo,
            accessibleWhenDisabled: true,
            onClick: handleUndo
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
          import_components36.Button,
          {
            size: "compact",
            icon: redo_default,
            label: (0, import_i18n45.__)("Redo"),
            showTooltip: true,
            shortcut: (0, import_keycodes2.isAppleOS)() ? import_keycodes2.displayShortcut.primaryShift("z") : import_keycodes2.displayShortcut.primary("y"),
            disabled: isUndoRedoDisabled || !hasRedo,
            accessibleWhenDisabled: true,
            onClick: handleRedo
          }
        )
      ]
    }
  );
}
function SaveActions({ size: size4 = "default" }) {
  const { isSaving, hasMedia, hasChanges, onCancel, onSave } = useMediaEditorFrameContext();
  const saveDisabled = isSaving || !hasMedia || !hasChanges;
  return /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)(
    Stack,
    {
      className: "media-editor__save-actions",
      justify: "flex-end",
      align: "center",
      gap: "sm",
      children: [
        /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
          import_components36.Button,
          {
            __next40pxDefaultSize: true,
            size: size4,
            variant: "tertiary",
            onClick: onCancel,
            disabled: isSaving,
            accessibleWhenDisabled: true,
            children: (0, import_i18n45.__)("Cancel")
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
          import_components36.Button,
          {
            __next40pxDefaultSize: true,
            size: size4,
            variant: "primary",
            onClick: onSave,
            isBusy: isSaving,
            disabled: saveDisabled,
            accessibleWhenDisabled: true,
            children: (0, import_i18n45.__)("Save")
          }
        )
      ]
    }
  );
}
function MediaEditorContent({
  fields = [],
  id,
  aspectRatioPresets,
  onClose,
  onSaved,
  renderFrame,
  noticesClassName = "media-editor__snackbar",
  noticesPortalElement,
  shouldCloseOnEsc = false
}) {
  const cropper = useMediaEditor();
  const isWide = (0, import_compose19.useViewportMatch)("small");
  const [activePanel, setActivePanel] = (0, import_element127.useState)(
    isWide ? DETAILS_PANEL : null
  );
  const hasChosenPanelRef = (0, import_element127.useRef)(false);
  const lastPanelRef = (0, import_element127.useRef)(DETAILS_PANEL);
  const hasChosenTabRef = (0, import_element127.useRef)(false);
  const selectPanel = (0, import_element127.useCallback)((panel) => {
    hasChosenTabRef.current = true;
    lastPanelRef.current = panel;
    setActivePanel(panel);
  }, []);
  const togglePanel = (0, import_element127.useCallback)(() => {
    hasChosenPanelRef.current = true;
    setActivePanel((open3) => open3 ? null : lastPanelRef.current);
  }, []);
  const layout = isWide ? "wide" : "narrow";
  const { media, hasEdits } = (0, import_data3.useSelect)(
    (select) => {
      const {
        getEditedEntityRecord,
        getEntityRecord,
        hasEditsForEntityRecord
      } = select(import_core_data2.store);
      getEntityRecord(
        "postType",
        "attachment",
        id,
        ATTACHMENT_EMBED_QUERY
      );
      return {
        media: getEditedEntityRecord(
          "postType",
          "attachment",
          id
        ),
        hasEdits: hasEditsForEntityRecord(
          "postType",
          "attachment",
          id
        )
      };
    },
    [id]
  );
  const hasChanges = cropper.isCropperDirty || hasEdits;
  const { clearEntityRecordEdits, editEntityRecord, invalidateResolution } = (0, import_data3.useDispatch)(import_core_data2.store);
  const { removeAllNotices } = (0, import_data3.useDispatch)(import_notices2.store);
  const [isDiscardDialogOpen, setIsDiscardDialogOpen] = (0, import_element127.useState)(false);
  const [isPlacementActive, setIsPlacementActive] = (0, import_element127.useState)(false);
  const [isCanvasGestureActive, setIsCanvasGestureActive] = (0, import_element127.useState)(false);
  const placementControlTimerRef = (0, import_element127.useRef)();
  const signalPlacementControlInteraction = (0, import_element127.useCallback)(() => {
    setIsPlacementActive(true);
    clearTimeout(placementControlTimerRef.current);
    placementControlTimerRef.current = setTimeout(() => {
      setIsPlacementActive(false);
    }, PLACEMENT_CONTROL_IDLE_MS);
  }, []);
  const handleCanvasGestureStart = (0, import_element127.useCallback)(() => {
    setIsCanvasGestureActive(true);
  }, []);
  const handleCanvasGestureEnd = (0, import_element127.useCallback)(() => {
    setIsCanvasGestureActive(false);
  }, []);
  const isCropInteractionActive = isPlacementActive || isCanvasGestureActive;
  (0, import_element127.useEffect)(() => {
    return () => {
      clearTimeout(placementControlTimerRef.current);
    };
  }, []);
  (0, import_element127.useEffect)(() => {
    setIsPlacementActive(false);
    setIsCanvasGestureActive(false);
  }, [id]);
  (0, import_element127.useEffect)(() => {
    invalidateResolution("getEntityRecord", [
      "postType",
      "attachment",
      id,
      ATTACHMENT_EMBED_QUERY
    ]);
  }, [id, invalidateResolution]);
  const mediaType = getMediaTypeFromMimeType(media?.mime_type).type;
  const isImage = !!media && mediaType === "image";
  (0, import_element127.useEffect)(() => {
    if (hasChosenPanelRef.current && hasChosenTabRef.current) {
      return;
    }
    const defaultPanel = isWide && isImage ? CROP_PANEL : DETAILS_PANEL;
    if (!hasChosenTabRef.current) {
      lastPanelRef.current = defaultPanel;
    }
    if (!hasChosenPanelRef.current) {
      setActivePanel(isWide ? lastPanelRef.current : null);
    }
  }, [isWide, isImage]);
  const {
    aspectRatioValue,
    setAspectRatioValue,
    aspectRatioOptions,
    resetCropOptions
  } = useCropOptions({ aspectRatioPresets });
  const { isSaving, save: saveMediaEditor } = useSaveMediaEditor({
    cropper,
    id,
    isImage,
    media,
    onSaved
  });
  const handleChange = (updates) => {
    if (isSaving) {
      return;
    }
    editEntityRecord("postType", "attachment", id, updates);
  };
  const discardAndClose = () => {
    removeAllNotices("snackbar", MEDIA_EDITOR_NOTICES_CONTEXT);
    clearEntityRecordEdits("postType", "attachment", id);
    onClose?.();
  };
  const handleRequestClose = () => {
    if (isSaving) {
      return;
    }
    if (hasChanges) {
      setIsDiscardDialogOpen(true);
      return;
    }
    discardAndClose();
  };
  const handleKeyDown = (event) => {
    const isUndoShortcut = import_keycodes2.isKeyboardEvent.primary(event, "z");
    const isRedoShortcut = import_keycodes2.isKeyboardEvent.primaryShift(event, "z") || !(0, import_keycodes2.isAppleOS)() && import_keycodes2.isKeyboardEvent.primary(event, "y");
    if ((isUndoShortcut || isRedoShortcut) && isImage) {
      const target = event.target;
      const isMetadataField = (target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.isContentEditable) && !target.closest(`[${CROP_CONTROL_ATTR}]`);
      if (!isMetadataField) {
        event.preventDefault();
        if (isCropInteractionActive || isSaving) {
          return;
        }
        if (isRedoShortcut) {
          cropper.redo();
        } else {
          cropper.undo();
        }
      }
    }
    if (shouldCloseOnEsc) {
      if (event.code !== "Escape" && event.key !== "Escape") {
        return;
      }
      if (isSaving) {
        event.preventDefault();
        return;
      }
      if (hasChanges) {
        event.preventDefault();
        setIsDiscardDialogOpen(true);
      }
    }
  };
  const snackbar = /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
    import_notices2.SnackbarNotices,
    {
      className: noticesClassName,
      context: MEDIA_EDITOR_NOTICES_CONTEXT
    }
  );
  const imageControls = isImage && !isWide ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
    MediaEditorImageControls,
    {
      showAspectRatioControl: true,
      aspectRatioPresets,
      disabled: isSaving
    }
  ) : null;
  const tabs = [
    ...isImage ? [
      {
        id: CROP_PANEL,
        title: (0, import_i18n45.__)("Crop"),
        render: () => /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
          MediaEditorCropPanel,
          {
            aspectRatioValue,
            onAspectRatioChange: setAspectRatioValue,
            aspectRatioOptions,
            disabled: isSaving
          }
        )
      }
    ] : [],
    {
      id: DETAILS_PANEL,
      title: (0, import_i18n45.__)("Details"),
      render: () => /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(MediaForm, {})
    }
  ];
  const ruler = isImage ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
    MediaEditorFineRotation,
    {
      onPlacementControlInteraction: signalPlacementControlInteraction,
      disabled: isSaving
    }
  ) : null;
  const children = /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)(
    MediaEditorProvider,
    {
      value: media ?? void 0,
      onChange: handleChange,
      settings: {
        // Disable the fields while saving, so the guard in
        // `handleChange` is not silently swallowing typing.
        // `readOnly` would swap the field's layout mid-save;
        // disabled keeps it in place and greys it out.
        fields: isSaving ? fields.map((field) => ({
          ...field,
          isDisabled: true
        })) : fields
      },
      children: [
        /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("div", { className: "media-editor", children: !media ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("div", { className: "media-editor__loading", children: /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(import_components36.Spinner, {}) }) : /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)(
          "div",
          {
            className: clsx_default("media-editor__body", {
              "has-panel-open": !!activePanel
            }),
            children: [
              /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)(
                navigable_region_default,
                {
                  className: "media-editor__content",
                  ariaLabel: isImage ? (0, import_i18n45.__)("Image editor") : (0, import_i18n45.__)("Media preview"),
                  children: [
                    /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("div", { className: "media-editor__canvas-area", children: isImage ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
                      MediaEditorCanvas,
                      {
                        isPlacementActive,
                        onGestureStart: handleCanvasGestureStart,
                        onGestureEnd: handleCanvasGestureEnd,
                        disabled: isSaving
                      }
                    ) : /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(MediaPreview, {}) }),
                    isImage && /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "media-editor__canvas-toolbar", children: [
                      ruler,
                      imageControls
                    ] })
                  ]
                }
              ),
              !!activePanel && /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
                MediaEditorSidebar,
                {
                  tabs,
                  activeTab: tabs.some(
                    (tab) => tab.id === activePanel
                  ) ? activePanel : DETAILS_PANEL,
                  onSelectTab: selectPanel,
                  disabled: isSaving
                }
              )
            ]
          }
        ) }),
        /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
          import_components36.__experimentalConfirmDialog,
          {
            isOpen: isDiscardDialogOpen,
            confirmButtonText: (0, import_i18n45.__)("Discard"),
            cancelButtonText: (0, import_i18n45.__)("Keep editing"),
            onCancel: () => setIsDiscardDialogOpen(false),
            onConfirm: () => {
              setIsDiscardDialogOpen(false);
              discardAndClose();
            },
            children: (0, import_i18n45.__)(
              "Are you sure you want to discard your unsaved changes?"
            )
          }
        ),
        noticesPortalElement ? (0, import_element127.createPortal)(snackbar, noticesPortalElement) : snackbar
      ]
    }
  );
  const contextValue = {
    isImage,
    isSaving,
    hasMedia: !!media,
    hasChanges,
    // Saving freezes the whole edit surface: `save()` reads the
    // modifiers once and then awaits, so anything changed after that
    // would be silently dropped when the save resolves.
    isUndoRedoDisabled: isCropInteractionActive || isSaving,
    aspectRatioPresets,
    isWide,
    activePanel,
    onTogglePanel: togglePanel,
    onCancel: handleRequestClose,
    onSave: saveMediaEditor,
    onReset: resetCropOptions
  };
  return /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(MediaEditorFrameContext.Provider, { value: contextValue, children: renderFrame({
    children,
    isImage,
    layout,
    onRequestClose: handleRequestClose,
    onKeyDown: handleKeyDown,
    shouldCloseOnClickOutside: !hasChanges && !isSaving,
    isSaving,
    hasChanges,
    hasMedia: !!media
  }) });
}
function MediaEditor(props) {
  return /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(MediaEditorStateProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(MediaEditorContent, { ...props }) }, props.id);
}
MediaEditor.HeaderActions = HeaderActions;
MediaEditor.HistoryActions = HistoryActions;
MediaEditor.SaveActions = SaveActions;
var media_editor_default = MediaEditor;

// packages/media-editor/build-module/components/media-editor-modal/index.mjs
var import_jsx_runtime167 = __toESM(require_jsx_runtime(), 1);
function ModalFooter() {
  return /* @__PURE__ */ (0, import_jsx_runtime167.jsxs)(
    "div",
    {
      className: "media-editor-modal__footer",
      role: "region",
      "aria-label": (0, import_i18n46.__)("Editor actions"),
      children: [
        /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(media_editor_default.HistoryActions, {}),
        /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(media_editor_default.SaveActions, {})
      ]
    }
  );
}
function MediaEditorModal({
  fields = [],
  aspectRatioPresets
}) {
  const { isModalOpen, id, onUpdate, onClose } = (0, import_data4.useSelect)((select) => {
    const { isOpen: isOpen2, getId: getId2, getOnUpdate: getOnUpdate2, getOnClose: getOnClose2 } = select(store);
    return {
      isModalOpen: isOpen2(),
      id: getId2(),
      onUpdate: getOnUpdate2(),
      onClose: getOnClose2()
    };
  }, []);
  const { closeMediaEditorModal: closeMediaEditorModal2 } = (0, import_data4.useDispatch)(store);
  const { createSuccessNotice } = (0, import_data4.useDispatch)(import_notices3.store);
  if (!isModalOpen || !id) {
    return null;
  }
  const portalElement = typeof document === "undefined" ? null : document.body;
  const stopKeyDownPropagation = (event) => {
    event.stopPropagation();
  };
  const handleClose = () => {
    closeMediaEditorModal2();
    onClose?.();
  };
  return /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(
    media_editor_default,
    {
      id,
      fields,
      aspectRatioPresets,
      shouldCloseOnEsc: true,
      noticesClassName: "media-editor-modal__snackbar",
      noticesPortalElement: portalElement,
      onClose: handleClose,
      onSaved: ({ id: savedId, url, previous }) => {
        if (savedId && onUpdate) {
          const update2 = {
            id: savedId,
            url
          };
          onUpdate(update2);
        }
        handleClose();
        if (previous && savedId !== previous.id && onUpdate) {
          createSuccessNotice((0, import_i18n46.__)("Image edited."), {
            type: "snackbar",
            actions: [
              {
                label: (0, import_i18n46.__)("Undo"),
                onClick: () => {
                  onUpdate({
                    id: previous.id,
                    url: previous.url
                  });
                }
              }
            ]
          });
        }
      },
      renderFrame: ({
        children,
        onRequestClose,
        onKeyDown,
        shouldCloseOnClickOutside
      }) => /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(
        import_keyboard_shortcuts.ShortcutProvider,
        {
          className: "media-editor-modal__shortcut-scope",
          onKeyDown: stopKeyDownPropagation,
          children: /* @__PURE__ */ (0, import_jsx_runtime167.jsxs)(
            import_components37.Modal,
            {
              className: "media-editor-modal",
              title: (0, import_i18n46.__)("Edit media"),
              size: "fill",
              isDismissible: false,
              shouldCloseOnClickOutside,
              onKeyDown,
              onRequestClose,
              headerActions: /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(media_editor_default.HeaderActions, { showCloseButton: true }),
              children: [
                children,
                /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(ModalFooter, {})
              ]
            }
          )
        }
      )
    }
  );
}

// packages/media-editor/build-module/private-apis.mjs
var privateApis = {};
lock2(privateApis, {
  store,
  MediaEditor,
  MediaEditorModal
});

// routes/media-editor/stage.tsx
import { useNavigate, useParams } from "@wordpress/route";

// routes/lock-unlock/index.ts
var import_private_apis4 = __toESM(require_private_apis());
var { lock: lock3, unlock: unlock3 } = (0, import_private_apis4.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
  "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
  "@wordpress/routes"
);

// routes/media-editor/style.scss
if (typeof document !== "undefined" && (typeof process === "undefined" || true) && !document.head.querySelector("style[data-wp-hash='12da0bb9bd']")) {
  const style = document.createElement("style");
  style.setAttribute("data-wp-hash", "12da0bb9bd");
  style.appendChild(document.createTextNode('.media-editor-preview{align-items:center;box-sizing:border-box;display:flex;justify-content:center;min-height:100%;padding:32px;position:relative}.media-editor-preview__spinner{left:50%;position:absolute;top:50%;transform:translate(-50%,-50%)}.media-editor-preview--loading{height:100%;width:100%}.media-editor-preview--image img{height:auto;max-height:100%;max-width:100%;object-fit:contain;opacity:0;width:auto}@media not (prefers-reduced-motion){.media-editor-preview--image img.loaded{animation:__wp-base-styles-fade-in .08s linear 0s;animation-fill-mode:forwards}}.media-editor-preview--video video{height:auto;max-height:100%;max-width:100%;object-fit:contain;width:auto}.media-editor-preview--audio audio{max-width:100%}.media-editor-preview--file{text-align:center}.media-editor-preview__file-info{background:#f0f0f0;border-radius:2px;padding:24px}.media-editor-preview__file-name{font-weight:var(--wpds-typography-font-weight-emphasis,600);margin-bottom:8px}.media-editor-preview__mime-type{color:#757575;font-size:.9em;margin-bottom:16px}.media-editor-preview__download-link{display:inline-block;margin-top:8px}.media-editor-preview--empty,.media-editor-preview--error{color:#757575;text-align:center}.media-editor-preview__url{color:#949494;font-size:.9em;margin-top:8px;word-break:break-all}.wp-media-editor-image-editor{cursor:grab;height:100%;overflow:hidden;position:relative;touch-action:none;-webkit-user-select:none;user-select:none;width:100%}.wp-media-editor-image-editor__canvas{inset:24px;min-height:100px;min-width:100px;position:absolute}.wp-media-editor-image-editor__canvas:focus{outline:none}.wp-media-editor-image-editor__stage{inset:0;position:absolute}.wp-media-editor-image-editor--dragging{cursor:grabbing}.wp-media-editor-image-editor__image{left:0;position:absolute;top:0;transform-origin:center center;will-change:transform}.wp-media-editor-image-editor__stencil{pointer-events:none;position:absolute}.wp-media-editor-image-editor__dimming{box-shadow:0 0 0 9999px hsla(0,0%,88%,.6);pointer-events:none;position:absolute;transition:box-shadow .15s ease}.wp-media-editor-image-editor--dragging .wp-media-editor-image-editor__dimming{box-shadow:0 0 0 9999px hsla(0,0%,88%,.4)}.wp-media-editor-image-editor__grid{overflow:hidden;pointer-events:none;position:absolute;transition:opacity .15s ease}.wp-media-editor-image-editor__canvas--grid-interactive .wp-media-editor-image-editor__grid{opacity:0;transition-delay:.1s}.wp-media-editor-image-editor__canvas--show-grid .wp-media-editor-image-editor__grid{opacity:1;transition-delay:0s}.wp-media-editor-image-editor__canvas--settling .wp-media-editor-image-editor__grid{opacity:0;transition:none}.wp-media-editor-image-editor__grid-line{background:hsla(0,0%,100%,.4);position:absolute}.wp-media-editor-image-editor__grid-line--horizontal{height:1px;left:0;width:100%}.wp-media-editor-image-editor__grid-line--vertical{height:100%;top:0;width:1px}.wp-media-editor-image-editor__dimensions-tooltip{background:#fff;box-shadow:0 0 0 1px rgba(0,0,0,.06),0 1px 2px rgba(0,0,0,.08);color:#1e1e1e;font-size:11px;font-variant-numeric:tabular-nums;line-height:1.4;padding:2px 6px;pointer-events:none;position:absolute;white-space:nowrap;z-index:2}.wp-media-editor-image-editor__stencil-rect{border:1px solid #1e1e1e;box-sizing:border-box;pointer-events:none;position:absolute;transition:border-color .15s ease,box-shadow .15s ease}.wp-media-editor-image-editor__canvas--focus-visible:focus .wp-media-editor-image-editor__stencil-rect{border-color:var(--wp-image-editor-focus-color,var(--wp-admin-theme-color,#007cba));box-shadow:0 0 0 1px var(--wp-image-editor-focus-color,var(--wp-admin-theme-color,#007cba))}.wp-media-editor-image-editor__handle{appearance:none;background:#fff;border:1px solid var(--wp-admin-theme-color,#007cba);border-radius:50%;box-sizing:border-box;cursor:default;font:inherit;height:12px;margin:0;padding:0;pointer-events:auto;position:absolute;transition:background-color .15s ease,box-shadow .15s ease;width:12px}.wp-media-editor-image-editor__handle:focus{outline:none}.wp-media-editor-image-editor__canvas--focus-visible .wp-media-editor-image-editor__handle:focus{background:var(--wp-image-editor-focus-color,var(--wp-admin-theme-color,#007cba));border-color:transparent;box-shadow:0 0 0 2px #fff,0 0 0 4px var(--wp-image-editor-focus-color,var(--wp-admin-theme-color,#007cba))}.wp-media-editor-image-editor__handle:before{content:"";height:44px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:44px}.wp-media-editor-image-editor__handle--n{cursor:ns-resize;left:50%;margin-left:-6px;top:-6px}.wp-media-editor-image-editor__handle--s{bottom:-6px;cursor:ns-resize;left:50%;margin-left:-6px}.wp-media-editor-image-editor__handle--e{cursor:ew-resize;margin-top:-6px;right:-6px;top:50%}.wp-media-editor-image-editor__handle--w{cursor:ew-resize;left:-6px;margin-top:-6px;top:50%}.wp-media-editor-image-editor__handle--nw{cursor:nwse-resize;left:-6px;top:-6px}.wp-media-editor-image-editor__handle--ne{cursor:nesw-resize;right:-6px;top:-6px}.wp-media-editor-image-editor__handle--sw{bottom:-6px;cursor:nesw-resize;left:-6px}.wp-media-editor-image-editor__handle--se{bottom:-6px;cursor:nwse-resize;right:-6px}.media-editor{display:flex;flex:1;flex-direction:column;height:100%;min-height:0}.media-editor .media-editor__loading{align-items:center;display:flex;height:100%;justify-content:center}.media-editor .media-editor__body{container-name:media-editor-body;container-type:inline-size;display:flex;flex:1;min-height:0}.media-editor .media-editor__content{display:flex;flex:1;flex-direction:column;margin:24px 24px 8px;min-height:0;min-width:0}@media (min-width:600px){.media-editor .media-editor__content{margin:0 24px}}@container media-editor-body (min-width: 864px){.media-editor .media-editor__content{min-width:520px}}.media-editor .media-editor__canvas-toolbar{align-items:center;display:flex;flex:0 0 auto;flex-direction:column;gap:12px}.media-editor .media-editor__canvas-toolbar .media-editor-fine-rotation{align-self:stretch;background:#e0e0e0;border-radius:0 0 8px 8px;display:flex;justify-content:center;padding:8px 16px}.media-editor .media-editor__canvas-toolbar .media-editor-fine-rotation .rotation-ruler{flex:0 1 360px;min-width:0}.media-editor .media-editor__canvas-area{align-items:center;background:#e0e0e0;border-radius:8px;display:flex;flex:1;justify-content:center;min-height:0;overflow:auto}.media-editor .media-editor__canvas-area .media-editor-preview{height:100%}.media-editor .media-editor__canvas-area img,.media-editor .media-editor__canvas-area video{max-height:100%;max-width:100%;object-fit:contain}.media-editor .media-editor__sidebar{display:flex;flex:1;flex-direction:column;min-height:0;min-width:0;overflow:hidden}@media (min-width:600px){.media-editor .media-editor__sidebar{flex:none;width:var(--wpds-dimension-surface-width-sm,320px)}}.media-editor .media-editor__tabs{display:flex;flex:1;flex-direction:column;min-height:0}.media-editor .media-editor__tablist{background:#fff;border-bottom:1px solid #ddd;flex-shrink:0;margin-inline:24px}.media-editor .media-editor__panel{flex:1;min-height:0;overflow-y:auto;padding-block:24px;padding-inline:24px}.media-editor .media-editor__content:has(.media-editor-fine-rotation) .media-editor__canvas-area{border-end-end-radius:0;border-end-start-radius:0}.media-editor .media-editor__body.has-panel-open .media-editor__content{display:none}@media (min-width:600px){.media-editor .media-editor__body.has-panel-open .media-editor__content{display:flex;margin:0 0 0 24px}}.media-editor__snackbar{bottom:var(--wpds-dimension-size-md,32px);box-sizing:border-box;display:flex;flex-direction:column;left:0;padding-inline:16px;pointer-events:none;position:fixed;right:0}.media-editor__snackbar .components-snackbar{margin-inline:auto}.media-editor-form .dataforms-layouts-panel__field-control{text-wrap:pretty}.media-editor-modal.components-modal__frame .components-modal__content{display:flex;flex-direction:column;margin-bottom:0;min-height:0;padding:0}.media-editor-modal.components-modal__frame .components-modal__children-container{display:flex;flex:1;flex-direction:column;min-height:0}.media-editor-modal.components-modal__frame .media-editor-modal__footer{align-items:center;background:#fff;display:flex;flex-direction:row;flex-shrink:0;gap:16px;padding:24px}.media-editor-modal.components-modal__frame .media-editor-modal__footer .media-editor__save-actions{margin-left:auto}.media-editor-modal .media-editor__history-actions .components-button.has-icon:not([aria-disabled=true]){color:var(--wp-admin-theme-color)}.media-editor-modal,.media-editor-modal__snackbar{display:flex;flex-direction:column}.media-editor-modal__snackbar{bottom:var(--wpds-dimension-size-md,32px);box-sizing:border-box;left:0;padding-inline:16px;pointer-events:none;position:fixed;right:0}.media-editor-modal__snackbar .components-snackbar{margin-inline:auto}.media-editor-modal__snackbar{z-index:1000001}.media-editor-canvas{height:100%;position:relative;width:100%}.media-editor-canvas__cropper{height:100%;opacity:0;pointer-events:none;width:100%}.media-editor-canvas__cropper.is-loaded{opacity:1;pointer-events:auto}@keyframes __wp-base-styles-fade-in{0%{opacity:0}to{opacity:1}}@media not (prefers-reduced-motion){.media-editor-canvas__cropper.is-loaded{animation:__wp-base-styles-fade-in .2s linear 0s;animation-fill-mode:forwards}}.media-editor-canvas__spinner{left:50%;position:absolute;top:50%;transform:translate(-50%,-50%)}.media-editor-canvas__error{align-items:center;color:#757575;display:flex;height:100%;justify-content:center;text-align:center;width:100%}.media-editor-image-controls{align-items:center;display:flex;flex-wrap:nowrap;gap:8px}.media-editor-image-controls.is-stacked{align-items:flex-start;flex-direction:column;gap:24px}.media-editor-image-controls__transforms{display:flex;gap:48px}.media-editor-image-controls__group{display:flex;flex-direction:column;gap:4px}.media-editor-image-controls__label{font-size:11px;font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:1.4;text-transform:uppercase}.media-editor-image-controls__buttons{display:flex;gap:8px;padding-inline:2px 0}.media-editor-keyboard-shortcuts-modal{min-width:280px}.media-editor-keyboard-shortcuts-modal .media-editor-keyboard-shortcuts-modal__note{color:#757575;font-size:13px;margin:0 0 16px}.media-editor-keyboard-shortcuts-modal .media-editor-keyboard-shortcuts-modal__shortcut-list{list-style:none;margin:0;padding:0}.media-editor-keyboard-shortcuts-modal .media-editor-keyboard-shortcuts-modal__shortcut{align-items:baseline;border-top:1px solid #ddd;display:flex;margin-bottom:0;padding:.6rem 0}.media-editor-keyboard-shortcuts-modal .media-editor-keyboard-shortcuts-modal__shortcut:last-child{border-bottom:1px solid #ddd}.media-editor-keyboard-shortcuts-modal .media-editor-keyboard-shortcuts-modal__shortcut-description{flex:1;margin:0}.media-editor-keyboard-shortcuts-modal .media-editor-keyboard-shortcuts-modal__shortcut-term{background:none;font-weight:var(--wpds-typography-font-weight-emphasis,600);margin:0 0 0 1rem;padding:0;text-align:right}.media-editor-keyboard-shortcuts-modal .media-editor-keyboard-shortcuts-modal__shortcut-key{border-radius:8%;margin:0 .2rem;padding:.25rem .5rem}.media-editor-keyboard-shortcuts-modal .media-editor-keyboard-shortcuts-modal__shortcut-key:last-child{margin:0 0 0 .2rem}.rotation-ruler{box-sizing:border-box;color:#1e1e1e;container-type:inline-size;cursor:ew-resize;direction:ltr;font-family:-apple-system,system-ui,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;height:32px;min-width:180px;padding:0 8px;position:relative;touch-action:none;-webkit-user-select:none;user-select:none}.rotation-ruler[data-disabled]{cursor:default;opacity:.5;pointer-events:none}.rotation-ruler:has(.rotation-ruler__input:focus-visible){border-radius:4px;outline:2px solid var(--wp-admin-theme-color,#3858e9);outline-offset:2px}.rotation-ruler__input{border:0;clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}.rotation-ruler__pointer{background:var(--wp-admin-theme-color,#3858e9);border-radius:1px;bottom:0;height:18px;left:50%;pointer-events:none;position:absolute;transform:translateX(-50%);width:2px}.rotation-ruler__strip{inset:0;mask-image:linear-gradient(90deg,transparent 0,#000 8px,#000 calc(100% - 8px),transparent);-webkit-mask-image:linear-gradient(90deg,transparent 0,#000 8px,#000 calc(100% - 8px),transparent);overflow:hidden;position:absolute}.rotation-ruler__ticks{display:block;left:50%;overflow:visible;position:absolute;top:0}.rotation-ruler__tick{stroke:currentColor;stroke-width:1}.rotation-ruler__tick--minor{opacity:.35}.rotation-ruler__tick--mid{opacity:.6}.rotation-ruler__tick--major{opacity:1}.rotation-ruler__label{fill:currentColor;font-size:10px;font-weight:400;opacity:.45}.rotation-ruler__active-label{color:#1e1e1e;font-size:12px;font-weight:var(--wpds-typography-font-weight-emphasis,600);height:14px;left:50%;line-height:14px;pointer-events:none;position:absolute;top:0;transform:translateX(-50%)}.rotation-ruler__active-label:before{background:linear-gradient(90deg,transparent 0,#e0e0e0 12px,#e0e0e0 calc(100% - 12px),transparent);content:"";height:100%;left:50%;position:absolute;top:0;transform:translateX(-50%);width:60px}.rotation-ruler__active-label-number{display:inline-block;position:relative}.rotation-ruler__active-label-sign{position:absolute;right:100%;top:0}.rotation-ruler__active-label-unit{left:100%;position:absolute;top:0}@container (max-width: 220px){.rotation-ruler__tick--minor{opacity:0}}@media (prefers-reduced-motion:reduce){.rotation-ruler__ticks{transition:none}}.media-editor-route__shortcut-scope{display:contents}.media-editor-route__content{background-color:var(--wpds-color-background-surface-neutral-strong,#fff);display:flex;flex:1;min-height:0;overflow:hidden}.media-editor-route__content .media-editor__body{margin-bottom:0}@media (min-width:600px){.media-editor-route__content .media-editor__body{margin-bottom:24px}}.media-editor-route__toolbar{align-items:center;display:flex;flex-shrink:0;flex-wrap:wrap;gap:16px;justify-content:center;padding:16px 32px}.media-editor-route__toolbar:empty{display:none}'));
  document.head.appendChild(style);
}

// routes/media-editor/stage.tsx
var import_jsx_runtime168 = __toESM(require_jsx_runtime());
var { usePostFields } = unlock3(import_editor.privateApis);
var { MediaEditor: MediaEditor2 } = unlock3(privateApis);
var MEDIA_LIST_PATH = "/types/attachment/list/all";
var MEDIA_LIBRARY_ADMIN_PATH = "upload.php";
var MEDIA_EDITOR_ADMIN_PAGE = "media-editor-wp-admin";
function isMediaEditorAdminPage() {
  return typeof window !== "undefined" && new URLSearchParams(window.location.search).get("page") === MEDIA_EDITOR_ADMIN_PAGE;
}
function getMediaTitle(media) {
  const title = typeof media?.title === "string" ? media.title : media?.title?.rendered || media?.title?.raw;
  return title ? (0, import_html_entities.decodeEntities)(title) : (0, import_i18n47.__)("Edit media");
}
function MediaEditorRoute() {
  const { id } = useParams({ from: "/media-editor/$id" });
  const attachmentId = parseInt(id, 10);
  const navigate = useNavigate();
  const fields = usePostFields({ postType: "attachment" });
  const isStandaloneAdminPage = isMediaEditorAdminPage();
  const media = (0, import_data5.useSelect)(
    (select) => (
      /* The record of an attachment is always assignable to `Media`. */
      select(import_core_data3.store).getEditedEntityRecord(
        "postType",
        "attachment",
        attachmentId
      )
    ),
    [attachmentId]
  );
  const title = getMediaTitle(media || null);
  const navigateBack = () => {
    if (typeof window !== "undefined" && window.history.length > 1) {
      window.history.back();
      return;
    }
    if (isStandaloneAdminPage) {
      window.location.assign(MEDIA_LIBRARY_ADMIN_PATH);
      return;
    }
    navigate({ to: MEDIA_LIST_PATH });
  };
  return /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
    MediaEditor2,
    {
      id: attachmentId,
      fields,
      onClose: navigateBack,
      onSaved: ({ id: savedId }) => {
        if (savedId !== attachmentId) {
          navigate({ to: `/media-editor/${savedId}` });
        }
      },
      renderFrame: ({
        children,
        isImage,
        layout,
        onKeyDown
      }) => {
        const isNarrow = layout === "narrow";
        return (
          // The keydown handler covers the whole frame, not just the
          // canvas: undo/redo live in the header, so after clicking
          // one, focus sits outside the content region and the
          // keyboard shortcuts would no longer reach the handler.
          // `Page` takes no `onKeyDown`, hence the wrapper; it is
          // `display: contents`, so it adds no box to the layout.
          // eslint-disable-next-line jsx-a11y/no-static-element-interactions
          /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
            "div",
            {
              className: "media-editor-route__shortcut-scope",
              onKeyDown,
              children: /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)(
                page_default,
                {
                  className: "media-editor-route",
                  ariaLabel: title,
                  breadcrumbs: /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
                    breadcrumbs_default,
                    {
                      items: isStandaloneAdminPage ? [{ label: title }] : [
                        {
                          label: (0, import_i18n47.__)("Media"),
                          to: MEDIA_LIST_PATH
                        },
                        { label: title }
                      ]
                    }
                  ),
                  actions: /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)(import_jsx_runtime168.Fragment, { children: [
                    !isNarrow && /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(MediaEditor2.HistoryActions, {}),
                    /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(MediaEditor2.HeaderActions, {}),
                    /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(MediaEditor2.SaveActions, { size: "compact" })
                  ] }),
                  children: [
                    /* @__PURE__ */ (0, import_jsx_runtime168.jsx)("div", { className: "media-editor-route__content", children }),
                    isNarrow && isImage && /* @__PURE__ */ (0, import_jsx_runtime168.jsx)("div", { className: "media-editor-route__toolbar", children: /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(MediaEditor2.HistoryActions, {}) })
                  ]
                }
              )
            }
          )
        );
      }
    }
  );
}
var stage = MediaEditorRoute;
export {
  stage
};
/*! Bundled license information:

use-sync-external-store/cjs/use-sync-external-store-shim.development.js:
  (**
   * @license React
   * use-sync-external-store-shim.development.js
   *
   * Copyright (c) Meta Platforms, Inc. and affiliates.
   *
   * This source code is licensed under the MIT license found in the
   * LICENSE file in the root directory of this source tree.
   *)

use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js:
  (**
   * @license React
   * use-sync-external-store-shim/with-selector.development.js
   *
   * Copyright (c) Meta Platforms, Inc. and affiliates.
   *
   * This source code is licensed under the MIT license found in the
   * LICENSE file in the root directory of this source tree.
   *)
*/

```
