[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/js/dist/ -> media-utils.js (source)

   1  "use strict";
   2  var wp;
   3  (wp ||= {}).mediaUtils = (() => {
   4    var __create = Object.create;
   5    var __defProp = Object.defineProperty;
   6    var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
   7    var __getOwnPropNames = Object.getOwnPropertyNames;
   8    var __getProtoOf = Object.getPrototypeOf;
   9    var __hasOwnProp = Object.prototype.hasOwnProperty;
  10    var __commonJS = (cb, mod) => function __require() {
  11      return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
  12    };
  13    var __export = (target, all) => {
  14      for (var name in all)
  15        __defProp(target, name, { get: all[name], enumerable: true });
  16    };
  17    var __copyProps = (to, from, except, desc) => {
  18      if (from && typeof from === "object" || typeof from === "function") {
  19        for (let key of __getOwnPropNames(from))
  20          if (!__hasOwnProp.call(to, key) && key !== except)
  21            __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  22      }
  23      return to;
  24    };
  25    var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  26      // If the importer is in node compatibility mode or this is not an ESM
  27      // file that has been converted to a CommonJS file using a Babel-
  28      // compatible transform (i.e. "__esModule" has not been set), then set
  29      // "default" to the CommonJS "module.exports" for node compatibility.
  30      isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  31      mod
  32    ));
  33    var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
  34  
  35    // package-external:@wordpress/element
  36    var require_element = __commonJS({
  37      "package-external:@wordpress/element"(exports, module) {
  38        module.exports = window.wp.element;
  39      }
  40    });
  41  
  42    // package-external:@wordpress/i18n
  43    var require_i18n = __commonJS({
  44      "package-external:@wordpress/i18n"(exports, module) {
  45        module.exports = window.wp.i18n;
  46      }
  47    });
  48  
  49    // package-external:@wordpress/data
  50    var require_data = __commonJS({
  51      "package-external:@wordpress/data"(exports, module) {
  52        module.exports = window.wp.data;
  53      }
  54    });
  55  
  56    // package-external:@wordpress/core-data
  57    var require_core_data = __commonJS({
  58      "package-external:@wordpress/core-data"(exports, module) {
  59        module.exports = window.wp.coreData;
  60      }
  61    });
  62  
  63    // package-external:@wordpress/blob
  64    var require_blob = __commonJS({
  65      "package-external:@wordpress/blob"(exports, module) {
  66        module.exports = window.wp.blob;
  67      }
  68    });
  69  
  70    // package-external:@wordpress/api-fetch
  71    var require_api_fetch = __commonJS({
  72      "package-external:@wordpress/api-fetch"(exports, module) {
  73        module.exports = window.wp.apiFetch;
  74      }
  75    });
  76  
  77    // package-external:@wordpress/components
  78    var require_components = __commonJS({
  79      "package-external:@wordpress/components"(exports, module) {
  80        module.exports = window.wp.components;
  81      }
  82    });
  83  
  84    // package-external:@wordpress/primitives
  85    var require_primitives = __commonJS({
  86      "package-external:@wordpress/primitives"(exports, module) {
  87        module.exports = window.wp.primitives;
  88      }
  89    });
  90  
  91    // vendor-external:react/jsx-runtime
  92    var require_jsx_runtime = __commonJS({
  93      "vendor-external:react/jsx-runtime"(exports, module) {
  94        module.exports = window.ReactJSXRuntime;
  95      }
  96    });
  97  
  98    // package-external:@wordpress/compose
  99    var require_compose = __commonJS({
 100      "package-external:@wordpress/compose"(exports, module) {
 101        module.exports = window.wp.compose;
 102      }
 103    });
 104  
 105    // vendor-external:react
 106    var require_react = __commonJS({
 107      "vendor-external:react"(exports, module) {
 108        module.exports = window.React;
 109      }
 110    });
 111  
 112    // vendor-external:react-dom
 113    var require_react_dom = __commonJS({
 114      "vendor-external:react-dom"(exports, module) {
 115        module.exports = window.ReactDOM;
 116      }
 117    });
 118  
 119    // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js
 120    var require_use_sync_external_store_shim_development = __commonJS({
 121      "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"(exports) {
 122        "use strict";
 123        (function() {
 124          function is(x2, y2) {
 125            return x2 === y2 && (0 !== x2 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2;
 126          }
 127          function useSyncExternalStore$2(subscribe2, getSnapshot) {
 128            didWarnOld18Alpha || void 0 === React49.startTransition || (didWarnOld18Alpha = true, console.error(
 129              "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."
 130            ));
 131            var value = getSnapshot();
 132            if (!didWarnUncachedGetSnapshot) {
 133              var cachedValue = getSnapshot();
 134              objectIs(value, cachedValue) || (console.error(
 135                "The result of getSnapshot should be cached to avoid an infinite loop"
 136              ), didWarnUncachedGetSnapshot = true);
 137            }
 138            cachedValue = useState43({
 139              inst: { value, getSnapshot }
 140            });
 141            var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
 142            useLayoutEffect6(
 143              function() {
 144                inst.value = value;
 145                inst.getSnapshot = getSnapshot;
 146                checkIfSnapshotChanged(inst) && forceUpdate({ inst });
 147              },
 148              [subscribe2, value, getSnapshot]
 149            );
 150            useEffect37(
 151              function() {
 152                checkIfSnapshotChanged(inst) && forceUpdate({ inst });
 153                return subscribe2(function() {
 154                  checkIfSnapshotChanged(inst) && forceUpdate({ inst });
 155                });
 156              },
 157              [subscribe2]
 158            );
 159            useDebugValue2(value);
 160            return value;
 161          }
 162          function checkIfSnapshotChanged(inst) {
 163            var latestGetSnapshot = inst.getSnapshot;
 164            inst = inst.value;
 165            try {
 166              var nextValue = latestGetSnapshot();
 167              return !objectIs(inst, nextValue);
 168            } catch (error) {
 169              return true;
 170            }
 171          }
 172          function useSyncExternalStore$1(subscribe2, getSnapshot) {
 173            return getSnapshot();
 174          }
 175          "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
 176          var React49 = require_react(), objectIs = "function" === typeof Object.is ? Object.is : is, useState43 = React49.useState, useEffect37 = React49.useEffect, useLayoutEffect6 = React49.useLayoutEffect, useDebugValue2 = React49.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
 177          exports.useSyncExternalStore = void 0 !== React49.useSyncExternalStore ? React49.useSyncExternalStore : shim;
 178          "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
 179        })();
 180      }
 181    });
 182  
 183    // node_modules/use-sync-external-store/shim/index.js
 184    var require_shim = __commonJS({
 185      "node_modules/use-sync-external-store/shim/index.js"(exports, module) {
 186        "use strict";
 187        if (false) {
 188          module.exports = null;
 189        } else {
 190          module.exports = require_use_sync_external_store_shim_development();
 191        }
 192      }
 193    });
 194  
 195    // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js
 196    var require_with_selector_development = __commonJS({
 197      "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js"(exports) {
 198        "use strict";
 199        (function() {
 200          function is(x2, y2) {
 201            return x2 === y2 && (0 !== x2 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2;
 202          }
 203          "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
 204          var React49 = require_react(), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore3 = shim.useSyncExternalStore, useRef51 = React49.useRef, useEffect37 = React49.useEffect, useMemo43 = React49.useMemo, useDebugValue2 = React49.useDebugValue;
 205          exports.useSyncExternalStoreWithSelector = function(subscribe2, getSnapshot, getServerSnapshot, selector2, isEqual) {
 206            var instRef = useRef51(null);
 207            if (null === instRef.current) {
 208              var inst = { hasValue: false, value: null };
 209              instRef.current = inst;
 210            } else inst = instRef.current;
 211            instRef = useMemo43(
 212              function() {
 213                function memoizedSelector(nextSnapshot) {
 214                  if (!hasMemo) {
 215                    hasMemo = true;
 216                    memoizedSnapshot = nextSnapshot;
 217                    nextSnapshot = selector2(nextSnapshot);
 218                    if (void 0 !== isEqual && inst.hasValue) {
 219                      var currentSelection = inst.value;
 220                      if (isEqual(currentSelection, nextSnapshot))
 221                        return memoizedSelection = currentSelection;
 222                    }
 223                    return memoizedSelection = nextSnapshot;
 224                  }
 225                  currentSelection = memoizedSelection;
 226                  if (objectIs(memoizedSnapshot, nextSnapshot))
 227                    return currentSelection;
 228                  var nextSelection = selector2(nextSnapshot);
 229                  if (void 0 !== isEqual && isEqual(currentSelection, nextSelection))
 230                    return memoizedSnapshot = nextSnapshot, currentSelection;
 231                  memoizedSnapshot = nextSnapshot;
 232                  return memoizedSelection = nextSelection;
 233                }
 234                var hasMemo = false, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot;
 235                return [
 236                  function() {
 237                    return memoizedSelector(getSnapshot());
 238                  },
 239                  null === maybeGetServerSnapshot ? void 0 : function() {
 240                    return memoizedSelector(maybeGetServerSnapshot());
 241                  }
 242                ];
 243              },
 244              [getSnapshot, getServerSnapshot, selector2, isEqual]
 245            );
 246            var value = useSyncExternalStore3(subscribe2, instRef[0], instRef[1]);
 247            useEffect37(
 248              function() {
 249                inst.hasValue = true;
 250                inst.value = value;
 251              },
 252              [value]
 253            );
 254            useDebugValue2(value);
 255            return value;
 256          };
 257          "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
 258        })();
 259      }
 260    });
 261  
 262    // node_modules/use-sync-external-store/shim/with-selector.js
 263    var require_with_selector = __commonJS({
 264      "node_modules/use-sync-external-store/shim/with-selector.js"(exports, module) {
 265        "use strict";
 266        if (false) {
 267          module.exports = null;
 268        } else {
 269          module.exports = require_with_selector_development();
 270        }
 271      }
 272    });
 273  
 274    // package-external:@wordpress/a11y
 275    var require_a11y = __commonJS({
 276      "package-external:@wordpress/a11y"(exports, module) {
 277        module.exports = window.wp.a11y;
 278      }
 279    });
 280  
 281    // package-external:@wordpress/theme
 282    var require_theme = __commonJS({
 283      "package-external:@wordpress/theme"(exports, module) {
 284        module.exports = window.wp.theme;
 285      }
 286    });
 287  
 288    // package-external:@wordpress/private-apis
 289    var require_private_apis = __commonJS({
 290      "package-external:@wordpress/private-apis"(exports, module) {
 291        module.exports = window.wp.privateApis;
 292      }
 293    });
 294  
 295    // package-external:@wordpress/keycodes
 296    var require_keycodes = __commonJS({
 297      "package-external:@wordpress/keycodes"(exports, module) {
 298        module.exports = window.wp.keycodes;
 299      }
 300    });
 301  
 302    // node_modules/remove-accents/index.js
 303    var require_remove_accents = __commonJS({
 304      "node_modules/remove-accents/index.js"(exports, module) {
 305        var characterMap = {
 306          "\xC0": "A",
 307          "\xC1": "A",
 308          "\xC2": "A",
 309          "\xC3": "A",
 310          "\xC4": "A",
 311          "\xC5": "A",
 312          "\u1EA4": "A",
 313          "\u1EAE": "A",
 314          "\u1EB2": "A",
 315          "\u1EB4": "A",
 316          "\u1EB6": "A",
 317          "\xC6": "AE",
 318          "\u1EA6": "A",
 319          "\u1EB0": "A",
 320          "\u0202": "A",
 321          "\u1EA2": "A",
 322          "\u1EA0": "A",
 323          "\u1EA8": "A",
 324          "\u1EAA": "A",
 325          "\u1EAC": "A",
 326          "\xC7": "C",
 327          "\u1E08": "C",
 328          "\xC8": "E",
 329          "\xC9": "E",
 330          "\xCA": "E",
 331          "\xCB": "E",
 332          "\u1EBE": "E",
 333          "\u1E16": "E",
 334          "\u1EC0": "E",
 335          "\u1E14": "E",
 336          "\u1E1C": "E",
 337          "\u0206": "E",
 338          "\u1EBA": "E",
 339          "\u1EBC": "E",
 340          "\u1EB8": "E",
 341          "\u1EC2": "E",
 342          "\u1EC4": "E",
 343          "\u1EC6": "E",
 344          "\xCC": "I",
 345          "\xCD": "I",
 346          "\xCE": "I",
 347          "\xCF": "I",
 348          "\u1E2E": "I",
 349          "\u020A": "I",
 350          "\u1EC8": "I",
 351          "\u1ECA": "I",
 352          "\xD0": "D",
 353          "\xD1": "N",
 354          "\xD2": "O",
 355          "\xD3": "O",
 356          "\xD4": "O",
 357          "\xD5": "O",
 358          "\xD6": "O",
 359          "\xD8": "O",
 360          "\u1ED0": "O",
 361          "\u1E4C": "O",
 362          "\u1E52": "O",
 363          "\u020E": "O",
 364          "\u1ECE": "O",
 365          "\u1ECC": "O",
 366          "\u1ED4": "O",
 367          "\u1ED6": "O",
 368          "\u1ED8": "O",
 369          "\u1EDC": "O",
 370          "\u1EDE": "O",
 371          "\u1EE0": "O",
 372          "\u1EDA": "O",
 373          "\u1EE2": "O",
 374          "\xD9": "U",
 375          "\xDA": "U",
 376          "\xDB": "U",
 377          "\xDC": "U",
 378          "\u1EE6": "U",
 379          "\u1EE4": "U",
 380          "\u1EEC": "U",
 381          "\u1EEE": "U",
 382          "\u1EF0": "U",
 383          "\xDD": "Y",
 384          "\xE0": "a",
 385          "\xE1": "a",
 386          "\xE2": "a",
 387          "\xE3": "a",
 388          "\xE4": "a",
 389          "\xE5": "a",
 390          "\u1EA5": "a",
 391          "\u1EAF": "a",
 392          "\u1EB3": "a",
 393          "\u1EB5": "a",
 394          "\u1EB7": "a",
 395          "\xE6": "ae",
 396          "\u1EA7": "a",
 397          "\u1EB1": "a",
 398          "\u0203": "a",
 399          "\u1EA3": "a",
 400          "\u1EA1": "a",
 401          "\u1EA9": "a",
 402          "\u1EAB": "a",
 403          "\u1EAD": "a",
 404          "\xE7": "c",
 405          "\u1E09": "c",
 406          "\xE8": "e",
 407          "\xE9": "e",
 408          "\xEA": "e",
 409          "\xEB": "e",
 410          "\u1EBF": "e",
 411          "\u1E17": "e",
 412          "\u1EC1": "e",
 413          "\u1E15": "e",
 414          "\u1E1D": "e",
 415          "\u0207": "e",
 416          "\u1EBB": "e",
 417          "\u1EBD": "e",
 418          "\u1EB9": "e",
 419          "\u1EC3": "e",
 420          "\u1EC5": "e",
 421          "\u1EC7": "e",
 422          "\xEC": "i",
 423          "\xED": "i",
 424          "\xEE": "i",
 425          "\xEF": "i",
 426          "\u1E2F": "i",
 427          "\u020B": "i",
 428          "\u1EC9": "i",
 429          "\u1ECB": "i",
 430          "\xF0": "d",
 431          "\xF1": "n",
 432          "\xF2": "o",
 433          "\xF3": "o",
 434          "\xF4": "o",
 435          "\xF5": "o",
 436          "\xF6": "o",
 437          "\xF8": "o",
 438          "\u1ED1": "o",
 439          "\u1E4D": "o",
 440          "\u1E53": "o",
 441          "\u020F": "o",
 442          "\u1ECF": "o",
 443          "\u1ECD": "o",
 444          "\u1ED5": "o",
 445          "\u1ED7": "o",
 446          "\u1ED9": "o",
 447          "\u1EDD": "o",
 448          "\u1EDF": "o",
 449          "\u1EE1": "o",
 450          "\u1EDB": "o",
 451          "\u1EE3": "o",
 452          "\xF9": "u",
 453          "\xFA": "u",
 454          "\xFB": "u",
 455          "\xFC": "u",
 456          "\u1EE7": "u",
 457          "\u1EE5": "u",
 458          "\u1EED": "u",
 459          "\u1EEF": "u",
 460          "\u1EF1": "u",
 461          "\xFD": "y",
 462          "\xFF": "y",
 463          "\u0100": "A",
 464          "\u0101": "a",
 465          "\u0102": "A",
 466          "\u0103": "a",
 467          "\u0104": "A",
 468          "\u0105": "a",
 469          "\u0106": "C",
 470          "\u0107": "c",
 471          "\u0108": "C",
 472          "\u0109": "c",
 473          "\u010A": "C",
 474          "\u010B": "c",
 475          "\u010C": "C",
 476          "\u010D": "c",
 477          "C\u0306": "C",
 478          "c\u0306": "c",
 479          "\u010E": "D",
 480          "\u010F": "d",
 481          "\u0110": "D",
 482          "\u0111": "d",
 483          "\u0112": "E",
 484          "\u0113": "e",
 485          "\u0114": "E",
 486          "\u0115": "e",
 487          "\u0116": "E",
 488          "\u0117": "e",
 489          "\u0118": "E",
 490          "\u0119": "e",
 491          "\u011A": "E",
 492          "\u011B": "e",
 493          "\u011C": "G",
 494          "\u01F4": "G",
 495          "\u011D": "g",
 496          "\u01F5": "g",
 497          "\u011E": "G",
 498          "\u011F": "g",
 499          "\u0120": "G",
 500          "\u0121": "g",
 501          "\u0122": "G",
 502          "\u0123": "g",
 503          "\u0124": "H",
 504          "\u0125": "h",
 505          "\u0126": "H",
 506          "\u0127": "h",
 507          "\u1E2A": "H",
 508          "\u1E2B": "h",
 509          "\u0128": "I",
 510          "\u0129": "i",
 511          "\u012A": "I",
 512          "\u012B": "i",
 513          "\u012C": "I",
 514          "\u012D": "i",
 515          "\u012E": "I",
 516          "\u012F": "i",
 517          "\u0130": "I",
 518          "\u0131": "i",
 519          "\u0132": "IJ",
 520          "\u0133": "ij",
 521          "\u0134": "J",
 522          "\u0135": "j",
 523          "\u0136": "K",
 524          "\u0137": "k",
 525          "\u1E30": "K",
 526          "\u1E31": "k",
 527          "K\u0306": "K",
 528          "k\u0306": "k",
 529          "\u0139": "L",
 530          "\u013A": "l",
 531          "\u013B": "L",
 532          "\u013C": "l",
 533          "\u013D": "L",
 534          "\u013E": "l",
 535          "\u013F": "L",
 536          "\u0140": "l",
 537          "\u0141": "l",
 538          "\u0142": "l",
 539          "\u1E3E": "M",
 540          "\u1E3F": "m",
 541          "M\u0306": "M",
 542          "m\u0306": "m",
 543          "\u0143": "N",
 544          "\u0144": "n",
 545          "\u0145": "N",
 546          "\u0146": "n",
 547          "\u0147": "N",
 548          "\u0148": "n",
 549          "\u0149": "n",
 550          "N\u0306": "N",
 551          "n\u0306": "n",
 552          "\u014C": "O",
 553          "\u014D": "o",
 554          "\u014E": "O",
 555          "\u014F": "o",
 556          "\u0150": "O",
 557          "\u0151": "o",
 558          "\u0152": "OE",
 559          "\u0153": "oe",
 560          "P\u0306": "P",
 561          "p\u0306": "p",
 562          "\u0154": "R",
 563          "\u0155": "r",
 564          "\u0156": "R",
 565          "\u0157": "r",
 566          "\u0158": "R",
 567          "\u0159": "r",
 568          "R\u0306": "R",
 569          "r\u0306": "r",
 570          "\u0212": "R",
 571          "\u0213": "r",
 572          "\u015A": "S",
 573          "\u015B": "s",
 574          "\u015C": "S",
 575          "\u015D": "s",
 576          "\u015E": "S",
 577          "\u0218": "S",
 578          "\u0219": "s",
 579          "\u015F": "s",
 580          "\u0160": "S",
 581          "\u0161": "s",
 582          "\u0162": "T",
 583          "\u0163": "t",
 584          "\u021B": "t",
 585          "\u021A": "T",
 586          "\u0164": "T",
 587          "\u0165": "t",
 588          "\u0166": "T",
 589          "\u0167": "t",
 590          "T\u0306": "T",
 591          "t\u0306": "t",
 592          "\u0168": "U",
 593          "\u0169": "u",
 594          "\u016A": "U",
 595          "\u016B": "u",
 596          "\u016C": "U",
 597          "\u016D": "u",
 598          "\u016E": "U",
 599          "\u016F": "u",
 600          "\u0170": "U",
 601          "\u0171": "u",
 602          "\u0172": "U",
 603          "\u0173": "u",
 604          "\u0216": "U",
 605          "\u0217": "u",
 606          "V\u0306": "V",
 607          "v\u0306": "v",
 608          "\u0174": "W",
 609          "\u0175": "w",
 610          "\u1E82": "W",
 611          "\u1E83": "w",
 612          "X\u0306": "X",
 613          "x\u0306": "x",
 614          "\u0176": "Y",
 615          "\u0177": "y",
 616          "\u0178": "Y",
 617          "Y\u0306": "Y",
 618          "y\u0306": "y",
 619          "\u0179": "Z",
 620          "\u017A": "z",
 621          "\u017B": "Z",
 622          "\u017C": "z",
 623          "\u017D": "Z",
 624          "\u017E": "z",
 625          "\u017F": "s",
 626          "\u0192": "f",
 627          "\u01A0": "O",
 628          "\u01A1": "o",
 629          "\u01AF": "U",
 630          "\u01B0": "u",
 631          "\u01CD": "A",
 632          "\u01CE": "a",
 633          "\u01CF": "I",
 634          "\u01D0": "i",
 635          "\u01D1": "O",
 636          "\u01D2": "o",
 637          "\u01D3": "U",
 638          "\u01D4": "u",
 639          "\u01D5": "U",
 640          "\u01D6": "u",
 641          "\u01D7": "U",
 642          "\u01D8": "u",
 643          "\u01D9": "U",
 644          "\u01DA": "u",
 645          "\u01DB": "U",
 646          "\u01DC": "u",
 647          "\u1EE8": "U",
 648          "\u1EE9": "u",
 649          "\u1E78": "U",
 650          "\u1E79": "u",
 651          "\u01FA": "A",
 652          "\u01FB": "a",
 653          "\u01FC": "AE",
 654          "\u01FD": "ae",
 655          "\u01FE": "O",
 656          "\u01FF": "o",
 657          "\xDE": "TH",
 658          "\xFE": "th",
 659          "\u1E54": "P",
 660          "\u1E55": "p",
 661          "\u1E64": "S",
 662          "\u1E65": "s",
 663          "X\u0301": "X",
 664          "x\u0301": "x",
 665          "\u0403": "\u0413",
 666          "\u0453": "\u0433",
 667          "\u040C": "\u041A",
 668          "\u045C": "\u043A",
 669          "A\u030B": "A",
 670          "a\u030B": "a",
 671          "E\u030B": "E",
 672          "e\u030B": "e",
 673          "I\u030B": "I",
 674          "i\u030B": "i",
 675          "\u01F8": "N",
 676          "\u01F9": "n",
 677          "\u1ED2": "O",
 678          "\u1ED3": "o",
 679          "\u1E50": "O",
 680          "\u1E51": "o",
 681          "\u1EEA": "U",
 682          "\u1EEB": "u",
 683          "\u1E80": "W",
 684          "\u1E81": "w",
 685          "\u1EF2": "Y",
 686          "\u1EF3": "y",
 687          "\u0200": "A",
 688          "\u0201": "a",
 689          "\u0204": "E",
 690          "\u0205": "e",
 691          "\u0208": "I",
 692          "\u0209": "i",
 693          "\u020C": "O",
 694          "\u020D": "o",
 695          "\u0210": "R",
 696          "\u0211": "r",
 697          "\u0214": "U",
 698          "\u0215": "u",
 699          "B\u030C": "B",
 700          "b\u030C": "b",
 701          "\u010C\u0323": "C",
 702          "\u010D\u0323": "c",
 703          "\xCA\u030C": "E",
 704          "\xEA\u030C": "e",
 705          "F\u030C": "F",
 706          "f\u030C": "f",
 707          "\u01E6": "G",
 708          "\u01E7": "g",
 709          "\u021E": "H",
 710          "\u021F": "h",
 711          "J\u030C": "J",
 712          "\u01F0": "j",
 713          "\u01E8": "K",
 714          "\u01E9": "k",
 715          "M\u030C": "M",
 716          "m\u030C": "m",
 717          "P\u030C": "P",
 718          "p\u030C": "p",
 719          "Q\u030C": "Q",
 720          "q\u030C": "q",
 721          "\u0158\u0329": "R",
 722          "\u0159\u0329": "r",
 723          "\u1E66": "S",
 724          "\u1E67": "s",
 725          "V\u030C": "V",
 726          "v\u030C": "v",
 727          "W\u030C": "W",
 728          "w\u030C": "w",
 729          "X\u030C": "X",
 730          "x\u030C": "x",
 731          "Y\u030C": "Y",
 732          "y\u030C": "y",
 733          "A\u0327": "A",
 734          "a\u0327": "a",
 735          "B\u0327": "B",
 736          "b\u0327": "b",
 737          "\u1E10": "D",
 738          "\u1E11": "d",
 739          "\u0228": "E",
 740          "\u0229": "e",
 741          "\u0190\u0327": "E",
 742          "\u025B\u0327": "e",
 743          "\u1E28": "H",
 744          "\u1E29": "h",
 745          "I\u0327": "I",
 746          "i\u0327": "i",
 747          "\u0197\u0327": "I",
 748          "\u0268\u0327": "i",
 749          "M\u0327": "M",
 750          "m\u0327": "m",
 751          "O\u0327": "O",
 752          "o\u0327": "o",
 753          "Q\u0327": "Q",
 754          "q\u0327": "q",
 755          "U\u0327": "U",
 756          "u\u0327": "u",
 757          "X\u0327": "X",
 758          "x\u0327": "x",
 759          "Z\u0327": "Z",
 760          "z\u0327": "z",
 761          "\u0439": "\u0438",
 762          "\u0419": "\u0418",
 763          "\u0451": "\u0435",
 764          "\u0401": "\u0415"
 765        };
 766        var chars = Object.keys(characterMap).join("|");
 767        var allAccents = new RegExp(chars, "g");
 768        var firstAccent = new RegExp(chars, "");
 769        function matcher(match2) {
 770          return characterMap[match2];
 771        }
 772        var removeAccents2 = function(string) {
 773          return string.replace(allAccents, matcher);
 774        };
 775        var hasAccents = function(string) {
 776          return !!string.match(firstAccent);
 777        };
 778        module.exports = removeAccents2;
 779        module.exports.has = hasAccents;
 780        module.exports.remove = removeAccents2;
 781      }
 782    });
 783  
 784    // node_modules/fast-deep-equal/es6/index.js
 785    var require_es6 = __commonJS({
 786      "node_modules/fast-deep-equal/es6/index.js"(exports, module) {
 787        "use strict";
 788        module.exports = function equal(a2, b2) {
 789          if (a2 === b2) return true;
 790          if (a2 && b2 && typeof a2 == "object" && typeof b2 == "object") {
 791            if (a2.constructor !== b2.constructor) return false;
 792            var length, i2, keys;
 793            if (Array.isArray(a2)) {
 794              length = a2.length;
 795              if (length != b2.length) return false;
 796              for (i2 = length; i2-- !== 0; )
 797                if (!equal(a2[i2], b2[i2])) return false;
 798              return true;
 799            }
 800            if (a2 instanceof Map && b2 instanceof Map) {
 801              if (a2.size !== b2.size) return false;
 802              for (i2 of a2.entries())
 803                if (!b2.has(i2[0])) return false;
 804              for (i2 of a2.entries())
 805                if (!equal(i2[1], b2.get(i2[0]))) return false;
 806              return true;
 807            }
 808            if (a2 instanceof Set && b2 instanceof Set) {
 809              if (a2.size !== b2.size) return false;
 810              for (i2 of a2.entries())
 811                if (!b2.has(i2[0])) return false;
 812              return true;
 813            }
 814            if (ArrayBuffer.isView(a2) && ArrayBuffer.isView(b2)) {
 815              length = a2.length;
 816              if (length != b2.length) return false;
 817              for (i2 = length; i2-- !== 0; )
 818                if (a2[i2] !== b2[i2]) return false;
 819              return true;
 820            }
 821            if (a2.constructor === RegExp) return a2.source === b2.source && a2.flags === b2.flags;
 822            if (a2.valueOf !== Object.prototype.valueOf) return a2.valueOf() === b2.valueOf();
 823            if (a2.toString !== Object.prototype.toString) return a2.toString() === b2.toString();
 824            keys = Object.keys(a2);
 825            length = keys.length;
 826            if (length !== Object.keys(b2).length) return false;
 827            for (i2 = length; i2-- !== 0; )
 828              if (!Object.prototype.hasOwnProperty.call(b2, keys[i2])) return false;
 829            for (i2 = length; i2-- !== 0; ) {
 830              var key = keys[i2];
 831              if (!equal(a2[key], b2[key])) return false;
 832            }
 833            return true;
 834          }
 835          return a2 !== a2 && b2 !== b2;
 836        };
 837      }
 838    });
 839  
 840    // package-external:@wordpress/date
 841    var require_date = __commonJS({
 842      "package-external:@wordpress/date"(exports, module) {
 843        module.exports = window.wp.date;
 844      }
 845    });
 846  
 847    // package-external:@wordpress/warning
 848    var require_warning = __commonJS({
 849      "package-external:@wordpress/warning"(exports, module) {
 850        module.exports = window.wp.warning;
 851      }
 852    });
 853  
 854    // package-external:@wordpress/rich-text
 855    var require_rich_text = __commonJS({
 856      "package-external:@wordpress/rich-text"(exports, module) {
 857        module.exports = window.wp.richText;
 858      }
 859    });
 860  
 861    // package-external:@wordpress/preferences
 862    var require_preferences = __commonJS({
 863      "package-external:@wordpress/preferences"(exports, module) {
 864        module.exports = window.wp.preferences;
 865      }
 866    });
 867  
 868    // package-external:@wordpress/url
 869    var require_url = __commonJS({
 870      "package-external:@wordpress/url"(exports, module) {
 871        module.exports = window.wp.url;
 872      }
 873    });
 874  
 875    // package-external:@wordpress/notices
 876    var require_notices = __commonJS({
 877      "package-external:@wordpress/notices"(exports, module) {
 878        module.exports = window.wp.notices;
 879      }
 880    });
 881  
 882    // packages/media-utils/build-module/index.mjs
 883    var index_exports = {};
 884    __export(index_exports, {
 885      MediaUpload: () => media_upload_default,
 886      privateApis: () => privateApis12,
 887      transformAttachment: () => transformAttachment,
 888      uploadMedia: () => uploadMedia,
 889      validateFileSize: () => validateFileSize,
 890      validateMimeType: () => validateMimeType,
 891      validateMimeTypeForUser: () => validateMimeTypeForUser
 892    });
 893  
 894    // packages/media-utils/build-module/components/media-upload/index.mjs
 895    var import_element = __toESM(require_element(), 1);
 896    var import_i18n = __toESM(require_i18n(), 1);
 897    var import_data = __toESM(require_data(), 1);
 898  
 899    // packages/media-utils/build-module/utils/invalidate-attachment-resolutions.mjs
 900    var import_core_data = __toESM(require_core_data(), 1);
 901    function invalidateAttachmentResolutions(registry) {
 902      const resolvers = registry.select(import_core_data.store).getCachedResolvers();
 903      const entityRecordResolutions = resolvers.getEntityRecords;
 904      entityRecordResolutions?.forEach((_value, args) => {
 905        if (args[0] === "postType" && args[1] === "attachment") {
 906          registry.dispatch(import_core_data.store).invalidateResolution("getEntityRecords", args);
 907        }
 908      });
 909    }
 910  
 911    // packages/media-utils/build-module/components/media-upload/index.mjs
 912    var DEFAULT_EMPTY_GALLERY = [];
 913    var getFeaturedImageMediaFrame = () => {
 914      const { wp } = window;
 915      return wp.media.view.MediaFrame.Select.extend({
 916        /**
 917         * Enables the Set Featured Image Button.
 918         *
 919         * @param {Object} toolbar toolbar for featured image state
 920         * @return {void}
 921         */
 922        featuredImageToolbar(toolbar) {
 923          this.createSelectToolbar(toolbar, {
 924            text: wp.media.view.l10n.setFeaturedImage,
 925            state: this.options.state
 926          });
 927        },
 928        /**
 929         * Handle the edit state requirements of selected media item.
 930         *
 931         * @return {void}
 932         */
 933        editState() {
 934          const selection = this.state("featured-image").get("selection");
 935          const view = new wp.media.view.EditImage({
 936            model: selection.single(),
 937            controller: this
 938          }).render();
 939          this.content.set(view);
 940          view.loadEditor();
 941        },
 942        /**
 943         * Create the default states.
 944         *
 945         * @return {void}
 946         */
 947        createStates: function createStates() {
 948          this.on(
 949            "toolbar:create:featured-image",
 950            this.featuredImageToolbar,
 951            this
 952          );
 953          this.on("content:render:edit-image", this.editState, this);
 954          this.states.add([
 955            new wp.media.controller.FeaturedImage(),
 956            new wp.media.controller.EditImage({
 957              model: this.options.editImage
 958            })
 959          ]);
 960        }
 961      });
 962    };
 963    var getSingleMediaFrame = () => {
 964      const { wp } = window;
 965      return wp.media.view.MediaFrame.Select.extend({
 966        /**
 967         * Create the default states on the frame.
 968         */
 969        createStates() {
 970          const options = this.options;
 971          if (this.options.states) {
 972            return;
 973          }
 974          this.states.add([
 975            // Main states.
 976            new wp.media.controller.Library({
 977              library: wp.media.query(options.library),
 978              multiple: options.multiple,
 979              title: options.title,
 980              priority: 20,
 981              filterable: "uploaded"
 982              // Allow filtering by uploaded images.
 983            }),
 984            new wp.media.controller.EditImage({
 985              model: options.editImage
 986            })
 987          ]);
 988        }
 989      });
 990    };
 991    var getGalleryDetailsMediaFrame = () => {
 992      const { wp } = window;
 993      return wp.media.view.MediaFrame.Post.extend({
 994        /**
 995         * Set up gallery toolbar.
 996         *
 997         * @return {void}
 998         */
 999        galleryToolbar() {
1000          const editing = this.state().get("editing");
1001          this.toolbar.set(
1002            new wp.media.view.Toolbar({
1003              controller: this,
1004              items: {
1005                insert: {
1006                  style: "primary",
1007                  text: editing ? wp.media.view.l10n.updateGallery : wp.media.view.l10n.insertGallery,
1008                  priority: 80,
1009                  requires: { library: true },
1010                  /**
1011                   * @fires wp.media.controller.State#update
1012                   */
1013                  click() {
1014                    const controller = this.controller, state = controller.state();
1015                    controller.close();
1016                    state.trigger(
1017                      "update",
1018                      state.get("library")
1019                    );
1020                    controller.setState(controller.options.state);
1021                    controller.reset();
1022                  }
1023                }
1024              }
1025            })
1026          );
1027        },
1028        /**
1029         * Handle the edit state requirements of selected media item.
1030         *
1031         * @return {void}
1032         */
1033        editState() {
1034          const selection = this.state("gallery").get("selection");
1035          const view = new wp.media.view.EditImage({
1036            model: selection.single(),
1037            controller: this
1038          }).render();
1039          this.content.set(view);
1040          view.loadEditor();
1041        },
1042        /**
1043         * Create the default states.
1044         *
1045         * @return {void}
1046         */
1047        createStates: function createStates() {
1048          this.on("toolbar:create:main-gallery", this.galleryToolbar, this);
1049          this.on("content:render:edit-image", this.editState, this);
1050          this.states.add([
1051            new wp.media.controller.Library({
1052              id: "gallery",
1053              title: wp.media.view.l10n.createGalleryTitle,
1054              priority: 40,
1055              toolbar: "main-gallery",
1056              filterable: "uploaded",
1057              multiple: "add",
1058              editable: false,
1059              library: wp.media.query({
1060                type: "image",
1061                ...this.options.library
1062              })
1063            }),
1064            new wp.media.controller.EditImage({
1065              model: this.options.editImage
1066            }),
1067            new wp.media.controller.GalleryEdit({
1068              library: this.options.selection,
1069              editing: this.options.editing,
1070              menu: "gallery",
1071              displaySettings: false,
1072              multiple: true
1073            }),
1074            new wp.media.controller.GalleryAdd()
1075          ]);
1076        }
1077      });
1078    };
1079    var slimImageObject = (img) => {
1080      const attrSet = [
1081        "sizes",
1082        "mime",
1083        "type",
1084        "subtype",
1085        "id",
1086        "url",
1087        "alt",
1088        "link",
1089        "caption"
1090      ];
1091      return attrSet.reduce((result, key) => {
1092        if (img?.hasOwnProperty(key)) {
1093          result[key] = img[key];
1094        }
1095        return result;
1096      }, {});
1097    };
1098    var getAttachmentsCollection = (ids) => {
1099      const { wp } = window;
1100      return wp.media.query({
1101        order: "ASC",
1102        orderby: "post__in",
1103        post__in: ids,
1104        posts_per_page: -1,
1105        query: true,
1106        type: "image"
1107      });
1108    };
1109    var MediaUpload = class extends import_element.Component {
1110      constructor() {
1111        super(...arguments);
1112        this.openModal = this.openModal.bind(this);
1113        this.onOpen = this.onOpen.bind(this);
1114        this.onSelect = this.onSelect.bind(this);
1115        this.onUpdate = this.onUpdate.bind(this);
1116        this.onClose = this.onClose.bind(this);
1117      }
1118      initializeListeners() {
1119        this.frame.on("select", this.onSelect);
1120        this.frame.on("update", this.onUpdate);
1121        this.frame.on("open", this.onOpen);
1122        this.frame.on("close", this.onClose);
1123      }
1124      /**
1125       * Sets the Gallery frame and initializes listeners.
1126       *
1127       * @return {void}
1128       */
1129      buildAndSetGalleryFrame() {
1130        const {
1131          addToGallery = false,
1132          allowedTypes,
1133          multiple = false,
1134          value = DEFAULT_EMPTY_GALLERY
1135        } = this.props;
1136        if (value === this.lastGalleryValue) {
1137          return;
1138        }
1139        const { wp } = window;
1140        this.lastGalleryValue = value;
1141        if (this.frame) {
1142          this.frame.remove();
1143        }
1144        let currentState;
1145        if (addToGallery) {
1146          currentState = "gallery-library";
1147        } else {
1148          currentState = value && value.length ? "gallery-edit" : "gallery";
1149        }
1150        if (!this.GalleryDetailsMediaFrame) {
1151          this.GalleryDetailsMediaFrame = getGalleryDetailsMediaFrame();
1152        }
1153        const attachments = getAttachmentsCollection(value);
1154        const selection = new wp.media.model.Selection(attachments.models, {
1155          props: attachments.props.toJSON(),
1156          multiple
1157        });
1158        this.frame = new this.GalleryDetailsMediaFrame({
1159          mimeType: allowedTypes,
1160          state: currentState,
1161          multiple,
1162          selection,
1163          editing: !!value?.length
1164        });
1165        wp.media.frame = this.frame;
1166        this.initializeListeners();
1167      }
1168      /**
1169       * Initializes the Media Library requirements for the featured image flow.
1170       *
1171       * @return {void}
1172       */
1173      buildAndSetFeatureImageFrame() {
1174        const { wp } = window;
1175        const { value: featuredImageId, multiple, allowedTypes } = this.props;
1176        const featuredImageFrame = getFeaturedImageMediaFrame();
1177        const attachments = getAttachmentsCollection(featuredImageId);
1178        const selection = new wp.media.model.Selection(attachments.models, {
1179          props: attachments.props.toJSON()
1180        });
1181        this.frame = new featuredImageFrame({
1182          mimeType: allowedTypes,
1183          state: "featured-image",
1184          multiple,
1185          selection,
1186          editing: featuredImageId
1187        });
1188        wp.media.frame = this.frame;
1189        wp.media.view.settings.post = {
1190          ...wp.media.view.settings.post,
1191          featuredImageId: featuredImageId || -1
1192        };
1193      }
1194      /**
1195       * Initializes the Media Library requirements for the single image flow.
1196       *
1197       * @return {void}
1198       */
1199      buildAndSetSingleMediaFrame() {
1200        const { wp } = window;
1201        const {
1202          allowedTypes,
1203          multiple = false,
1204          title = (0, import_i18n.__)("Select or Upload Media"),
1205          value
1206        } = this.props;
1207        const frameConfig = {
1208          title,
1209          multiple
1210        };
1211        if (!!allowedTypes) {
1212          frameConfig.library = { type: allowedTypes };
1213        }
1214        if (this.frame) {
1215          this.frame.remove();
1216        }
1217        const singleImageFrame = getSingleMediaFrame();
1218        const attachments = getAttachmentsCollection(value);
1219        const selection = new wp.media.model.Selection(attachments.models, {
1220          props: attachments.props.toJSON()
1221        });
1222        this.frame = new singleImageFrame({
1223          mimeType: allowedTypes,
1224          multiple,
1225          selection,
1226          ...frameConfig
1227        });
1228        wp.media.frame = this.frame;
1229      }
1230      componentWillUnmount() {
1231        this.frame?.remove();
1232      }
1233      onUpdate(selections) {
1234        const { onSelect, multiple = false } = this.props;
1235        const state = this.frame.state();
1236        const selectedImages = selections || state.get("selection");
1237        if (!selectedImages || !selectedImages.models.length) {
1238          return;
1239        }
1240        if (multiple) {
1241          onSelect(
1242            selectedImages.models.map(
1243              (model) => slimImageObject(model.toJSON())
1244            )
1245          );
1246        } else {
1247          onSelect(slimImageObject(selectedImages.models[0].toJSON()));
1248        }
1249      }
1250      onSelect() {
1251        const { onSelect, multiple = false } = this.props;
1252        const attachment = this.frame.state().get("selection").toJSON();
1253        onSelect(multiple ? attachment : attachment[0]);
1254      }
1255      onOpen() {
1256        const { wp } = window;
1257        const { value } = this.props;
1258        this.updateCollection();
1259        if (this.props.mode) {
1260          this.frame.content.mode(this.props.mode);
1261        }
1262        const hasMedia = Array.isArray(value) ? !!value?.length : !!value;
1263        if (!hasMedia) {
1264          return;
1265        }
1266        const isGallery = this.props.gallery;
1267        const selection = this.frame.state().get("selection");
1268        const valueArray = Array.isArray(value) ? value : [value];
1269        if (!isGallery) {
1270          valueArray.forEach((id) => {
1271            selection.add(wp.media.attachment(id));
1272          });
1273        }
1274        const attachments = getAttachmentsCollection(valueArray);
1275        attachments.more().done(function() {
1276          if (isGallery && attachments?.models?.length) {
1277            selection.add(attachments.models);
1278          }
1279        });
1280      }
1281      onClose() {
1282        const { onClose } = this.props;
1283        if (onClose) {
1284          onClose();
1285        }
1286        invalidateAttachmentResolutions({ select: import_data.select, dispatch: import_data.dispatch });
1287        this.frame.detach();
1288      }
1289      updateCollection() {
1290        const frameContent = this.frame.content.get();
1291        if (frameContent && frameContent.collection) {
1292          const collection = frameContent.collection;
1293          collection.toArray().forEach((model) => model.trigger("destroy", model));
1294          collection.mirroring._hasMore = true;
1295          collection.more();
1296        }
1297      }
1298      openModal() {
1299        const {
1300          gallery = false,
1301          unstableFeaturedImageFlow = false,
1302          modalClass
1303        } = this.props;
1304        if (gallery) {
1305          this.buildAndSetGalleryFrame();
1306        } else {
1307          this.buildAndSetSingleMediaFrame();
1308        }
1309        if (modalClass) {
1310          this.frame.$el.addClass(modalClass);
1311        }
1312        if (unstableFeaturedImageFlow) {
1313          this.buildAndSetFeatureImageFrame();
1314        }
1315        this.initializeListeners();
1316        this.frame.open();
1317      }
1318      render() {
1319        return this.props.render({ open: this.openModal });
1320      }
1321    };
1322    var media_upload_default = MediaUpload;
1323  
1324    // packages/media-utils/build-module/utils/upload-media.mjs
1325    var import_i18n5 = __toESM(require_i18n(), 1);
1326    var import_blob = __toESM(require_blob(), 1);
1327  
1328    // packages/media-utils/build-module/utils/upload-to-server.mjs
1329    var import_api_fetch = __toESM(require_api_fetch(), 1);
1330  
1331    // packages/media-utils/build-module/utils/flatten-form-data.mjs
1332    function isPlainObject(data) {
1333      return data !== null && typeof data === "object" && Object.getPrototypeOf(data) === Object.prototype;
1334    }
1335    function flattenFormData(formData, key, data) {
1336      if (isPlainObject(data)) {
1337        for (const [name, value] of Object.entries(data)) {
1338          flattenFormData(formData, `$key}[$name}]`, value);
1339        }
1340      } else if (data !== void 0) {
1341        formData.append(key, String(data));
1342      }
1343    }
1344  
1345    // packages/media-utils/build-module/utils/transform-attachment.mjs
1346    function transformAttachment(attachment) {
1347      const { alt_text, source_url, ...savedMediaProps } = attachment;
1348      return {
1349        ...savedMediaProps,
1350        alt: attachment.alt_text,
1351        caption: attachment.caption?.raw ?? "",
1352        title: attachment.title.raw,
1353        url: attachment.source_url,
1354        poster: attachment._embedded?.["wp:featuredmedia"]?.[0]?.source_url || void 0
1355      };
1356    }
1357  
1358    // packages/media-utils/build-module/utils/upload-to-server.mjs
1359    async function uploadToServer(file, additionalData = {}, signal) {
1360      const data = new FormData();
1361      data.append("file", file, file.name || file.type.replace("/", "."));
1362      for (const [key, value] of Object.entries(additionalData)) {
1363        flattenFormData(
1364          data,
1365          key,
1366          value
1367        );
1368      }
1369      return transformAttachment(
1370        await (0, import_api_fetch.default)({
1371          // This allows the video block to directly get a video's poster image.
1372          path: "/wp/v2/media?_embed=wp:featuredmedia",
1373          body: data,
1374          method: "POST",
1375          signal
1376        })
1377      );
1378    }
1379  
1380    // packages/media-utils/build-module/utils/validate-mime-type.mjs
1381    var import_i18n2 = __toESM(require_i18n(), 1);
1382  
1383    // packages/media-utils/build-module/utils/upload-error.mjs
1384    var UploadError = class extends Error {
1385      code;
1386      file;
1387      constructor({ code, message: message2, file, cause }) {
1388        super(message2, { cause });
1389        Object.setPrototypeOf(this, new.target.prototype);
1390        this.code = code;
1391        this.file = file;
1392      }
1393    };
1394  
1395    // packages/media-utils/build-module/utils/validate-mime-type.mjs
1396    function validateMimeType(file, allowedTypes) {
1397      if (!allowedTypes || allowedTypes.includes("*")) {
1398        return;
1399      }
1400      const isAllowedType = allowedTypes.some((allowedType) => {
1401        if (allowedType.includes("/")) {
1402          return allowedType === file.type;
1403        }
1404        return file.type.startsWith(`$allowedType}/`);
1405      });
1406      if (file.type && !isAllowedType) {
1407        throw new UploadError({
1408          code: "MIME_TYPE_NOT_SUPPORTED",
1409          message: (0, import_i18n2.sprintf)(
1410            // translators: %s: file name.
1411            (0, import_i18n2.__)("%s: Sorry, this file type is not supported here."),
1412            file.name
1413          ),
1414          file
1415        });
1416      }
1417    }
1418  
1419    // packages/media-utils/build-module/utils/validate-mime-type-for-user.mjs
1420    var import_i18n3 = __toESM(require_i18n(), 1);
1421  
1422    // packages/media-utils/build-module/utils/get-mime-types-array.mjs
1423    function getMimeTypesArray(wpMimeTypesObject) {
1424      if (!wpMimeTypesObject) {
1425        return null;
1426      }
1427      return Object.entries(wpMimeTypesObject).flatMap(
1428        ([extensionsString, mime]) => {
1429          const [type] = mime.split("/");
1430          const extensions = extensionsString.split("|");
1431          return [
1432            mime,
1433            ...extensions.map(
1434              (extension) => `$type}/$extension}`
1435            )
1436          ];
1437        }
1438      );
1439    }
1440  
1441    // packages/media-utils/build-module/utils/validate-mime-type-for-user.mjs
1442    function validateMimeTypeForUser(file, wpAllowedMimeTypes) {
1443      const allowedMimeTypesForUser = getMimeTypesArray(wpAllowedMimeTypes);
1444      if (!allowedMimeTypesForUser) {
1445        return;
1446      }
1447      const isAllowedMimeTypeForUser = allowedMimeTypesForUser.includes(
1448        file.type
1449      );
1450      if (file.type && !isAllowedMimeTypeForUser) {
1451        throw new UploadError({
1452          code: "MIME_TYPE_NOT_ALLOWED_FOR_USER",
1453          message: (0, import_i18n3.sprintf)(
1454            // translators: %s: file name.
1455            (0, import_i18n3.__)(
1456              "%s: Sorry, you are not allowed to upload this file type."
1457            ),
1458            file.name
1459          ),
1460          file
1461        });
1462      }
1463    }
1464  
1465    // packages/media-utils/build-module/utils/validate-file-size.mjs
1466    var import_i18n4 = __toESM(require_i18n(), 1);
1467    function validateFileSize(file, maxUploadFileSize) {
1468      if (file.size <= 0) {
1469        throw new UploadError({
1470          code: "EMPTY_FILE",
1471          message: (0, import_i18n4.sprintf)(
1472            // translators: %s: file name.
1473            (0, import_i18n4.__)("%s: This file is empty."),
1474            file.name
1475          ),
1476          file
1477        });
1478      }
1479      if (maxUploadFileSize && file.size > maxUploadFileSize) {
1480        throw new UploadError({
1481          code: "SIZE_ABOVE_LIMIT",
1482          message: (0, import_i18n4.sprintf)(
1483            // translators: %s: file name.
1484            (0, import_i18n4.__)(
1485              "%s: This file exceeds the maximum upload size for this site."
1486            ),
1487            file.name
1488          ),
1489          file
1490        });
1491      }
1492    }
1493  
1494    // packages/media-utils/build-module/utils/upload-media.mjs
1495    function uploadMedia({
1496      wpAllowedMimeTypes,
1497      allowedTypes,
1498      additionalData = {},
1499      filesList,
1500      maxUploadFileSize,
1501      onError,
1502      onFileChange,
1503      signal,
1504      multiple = true
1505    }) {
1506      if (!multiple && filesList.length > 1) {
1507        onError?.(new Error((0, import_i18n5.__)("Only one file can be used here.")));
1508        return;
1509      }
1510      const validFiles = [];
1511      const filesSet = [];
1512      const setAndUpdateFiles = (index2, value) => {
1513        if (!window.__clientSideMediaProcessing) {
1514          if (filesSet[index2]?.url) {
1515            (0, import_blob.revokeBlobURL)(filesSet[index2].url);
1516          }
1517        }
1518        filesSet[index2] = value;
1519        onFileChange?.(
1520          filesSet.filter((attachment) => attachment !== null)
1521        );
1522      };
1523      for (const mediaFile of filesList) {
1524        try {
1525          validateMimeTypeForUser(mediaFile, wpAllowedMimeTypes);
1526        } catch (error) {
1527          onError?.(error);
1528          continue;
1529        }
1530        try {
1531          validateMimeType(mediaFile, allowedTypes);
1532        } catch (error) {
1533          onError?.(error);
1534          continue;
1535        }
1536        try {
1537          validateFileSize(mediaFile, maxUploadFileSize);
1538        } catch (error) {
1539          onError?.(error);
1540          continue;
1541        }
1542        validFiles.push(mediaFile);
1543        if (!window.__clientSideMediaProcessing) {
1544          filesSet.push({ url: (0, import_blob.createBlobURL)(mediaFile) });
1545          onFileChange?.(filesSet);
1546        }
1547      }
1548      validFiles.map(async (file, index2) => {
1549        try {
1550          const attachment = await uploadToServer(
1551            file,
1552            additionalData,
1553            signal
1554          );
1555          setAndUpdateFiles(index2, attachment);
1556        } catch (error) {
1557          setAndUpdateFiles(index2, null);
1558          let message2;
1559          if (typeof error === "object" && error !== null && "message" in error) {
1560            message2 = typeof error.message === "string" ? error.message : String(error.message);
1561          } else {
1562            message2 = (0, import_i18n5.sprintf)(
1563              // translators: %s: file name
1564              (0, import_i18n5.__)("Error while uploading file %s to the media library."),
1565              file.name
1566            );
1567          }
1568          onError?.(
1569            new UploadError({
1570              code: "GENERAL",
1571              message: message2,
1572              file,
1573              cause: error instanceof Error ? error : void 0
1574            })
1575          );
1576        }
1577      });
1578    }
1579  
1580    // packages/media-utils/build-module/utils/sideload-media.mjs
1581    var import_i18n6 = __toESM(require_i18n(), 1);
1582  
1583    // packages/media-utils/build-module/utils/sideload-to-server.mjs
1584    var import_api_fetch2 = __toESM(require_api_fetch(), 1);
1585    async function sideloadToServer(file, attachmentId, additionalData = {}, signal) {
1586      const data = new FormData();
1587      data.append("file", file, file.name || file.type.replace("/", "."));
1588      for (const [key, value] of Object.entries(additionalData)) {
1589        flattenFormData(
1590          data,
1591          key,
1592          value
1593        );
1594      }
1595      return (0, import_api_fetch2.default)({
1596        path: `/wp/v2/media/$attachmentId}/sideload`,
1597        body: data,
1598        method: "POST",
1599        signal
1600      });
1601    }
1602  
1603    // packages/media-utils/build-module/utils/sideload-media.mjs
1604    var noop = () => {
1605    };
1606    async function sideloadMedia({
1607      file,
1608      attachmentId,
1609      additionalData = {},
1610      signal,
1611      onSuccess,
1612      onError = noop
1613    }) {
1614      try {
1615        const subSizeData = await sideloadToServer(
1616          file,
1617          attachmentId,
1618          additionalData,
1619          signal
1620        );
1621        onSuccess?.(subSizeData);
1622      } catch (error) {
1623        let message2;
1624        if (error instanceof Error) {
1625          message2 = error.message;
1626        } else {
1627          message2 = (0, import_i18n6.sprintf)(
1628            // translators: %s: file name
1629            (0, import_i18n6.__)("Error while sideloading file %s to the server."),
1630            file.name
1631          );
1632        }
1633        onError(
1634          new UploadError({
1635            code: "GENERAL",
1636            message: message2,
1637            file,
1638            cause: error instanceof Error ? error : void 0
1639          })
1640        );
1641      }
1642    }
1643  
1644    // node_modules/clsx/dist/clsx.mjs
1645    function r(e2) {
1646      var t2, f2, n2 = "";
1647      if ("string" == typeof e2 || "number" == typeof e2) n2 += e2;
1648      else if ("object" == typeof e2) if (Array.isArray(e2)) {
1649        var o2 = e2.length;
1650        for (t2 = 0; t2 < o2; t2++) e2[t2] && (f2 = r(e2[t2])) && (n2 && (n2 += " "), n2 += f2);
1651      } else for (f2 in e2) e2[f2] && (n2 && (n2 += " "), n2 += f2);
1652      return n2;
1653    }
1654    function clsx() {
1655      for (var e2, t2, f2 = 0, n2 = "", o2 = arguments.length; f2 < o2; f2++) (e2 = arguments[f2]) && (t2 = r(e2)) && (n2 && (n2 += " "), n2 += t2);
1656      return n2;
1657    }
1658    var clsx_default = clsx;
1659  
1660    // packages/media-utils/build-module/components/media-upload-modal/index.mjs
1661    var import_element87 = __toESM(require_element(), 1);
1662    var import_i18n68 = __toESM(require_i18n(), 1);
1663    var import_core_data6 = __toESM(require_core_data(), 1);
1664    var import_data14 = __toESM(require_data(), 1);
1665    var import_components54 = __toESM(require_components(), 1);
1666  
1667    // packages/icons/build-module/library/arrow-down.mjs
1668    var import_primitives = __toESM(require_primitives(), 1);
1669    var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
1670    var arrow_down_default = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_primitives.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_primitives.Path, { d: "m16.5 13.5-3.7 3.7V4h-1.5v13.2l-3.8-3.7-1 1 5.5 5.6 5.5-5.6z" }) });
1671  
1672    // packages/icons/build-module/library/arrow-left.mjs
1673    var import_primitives2 = __toESM(require_primitives(), 1);
1674    var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
1675    var arrow_left_default = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives2.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives2.Path, { d: "M20 11.2H6.8l3.7-3.7-1-1L3.9 12l5.6 5.5 1-1-3.7-3.7H20z" }) });
1676  
1677    // packages/icons/build-module/library/arrow-right.mjs
1678    var import_primitives3 = __toESM(require_primitives(), 1);
1679    var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
1680    var arrow_right_default = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_primitives3.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_primitives3.Path, { d: "m14.5 6.5-1 1 3.7 3.7H4v1.6h13.2l-3.7 3.7 1 1 5.6-5.5z" }) });
1681  
1682    // packages/icons/build-module/library/arrow-up.mjs
1683    var import_primitives4 = __toESM(require_primitives(), 1);
1684    var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
1685    var arrow_up_default = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_primitives4.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_primitives4.Path, { d: "M12 3.9 6.5 9.5l1 1 3.8-3.7V20h1.5V6.8l3.7 3.7 1-1z" }) });
1686  
1687    // packages/icons/build-module/library/audio.mjs
1688    var import_primitives5 = __toESM(require_primitives(), 1);
1689    var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
1690    var audio_default = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_primitives5.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_primitives5.Path, { d: "M17.7 4.3c-1.2 0-2.8 0-3.8 1-.6.6-.9 1.5-.9 2.6V14c-.6-.6-1.5-1-2.5-1C8.6 13 7 14.6 7 16.5S8.6 20 10.5 20c1.5 0 2.8-1 3.3-2.3.5-.8.7-1.8.7-2.5V7.9c0-.7.2-1.2.5-1.6.6-.6 1.8-.6 2.8-.6h.3V4.3h-.4z" }) });
1691  
1692    // packages/icons/build-module/library/block-table.mjs
1693    var import_primitives6 = __toESM(require_primitives(), 1);
1694    var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1);
1695    var block_table_default = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_primitives6.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_primitives6.Path, { d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v3.5h-15V5c0-.3.2-.5.5-.5zm8 5.5h6.5v3.5H13V10zm-1.5 3.5h-7V10h7v3.5zm-7 5.5v-4h7v4.5H5c-.3 0-.5-.2-.5-.5zm14.5.5h-6V15h6.5v4c0 .3-.2.5-.5.5z" }) });
1696  
1697    // packages/icons/build-module/library/category.mjs
1698    var import_primitives7 = __toESM(require_primitives(), 1);
1699    var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1);
1700    var category_default = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_primitives7.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_primitives7.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M6 5.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM4 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2V6zm11-.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5h-3a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM13 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2h-3a2 2 0 01-2-2V6zm5 8.5h-3a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5zM15 13a2 2 0 00-2 2v3a2 2 0 002 2h3a2 2 0 002-2v-3a2 2 0 00-2-2h-3zm-9 1.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5v-3a.5.5 0 01.5-.5zM4 15a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2v-3z" }) });
1701  
1702    // packages/icons/build-module/library/check.mjs
1703    var import_primitives8 = __toESM(require_primitives(), 1);
1704    var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
1705    var check_default = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_primitives8.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_primitives8.Path, { d: "M16.5 7.5 10 13.9l-2.5-2.4-1 1 3.5 3.6 7.5-7.6z" }) });
1706  
1707    // packages/icons/build-module/library/chevron-down.mjs
1708    var import_primitives9 = __toESM(require_primitives(), 1);
1709    var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
1710    var chevron_down_default = /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_primitives9.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_primitives9.Path, { d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z" }) });
1711  
1712    // packages/icons/build-module/library/close-small.mjs
1713    var import_primitives10 = __toESM(require_primitives(), 1);
1714    var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
1715    var close_small_default = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_primitives10.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_primitives10.Path, { d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z" }) });
1716  
1717    // packages/icons/build-module/library/cog.mjs
1718    var import_primitives11 = __toESM(require_primitives(), 1);
1719    var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
1720    var cog_default = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_primitives11.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_primitives11.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M10.289 4.836A1 1 0 0111.275 4h1.306a1 1 0 01.987.836l.244 1.466c.787.26 1.503.679 2.108 1.218l1.393-.522a1 1 0 011.216.437l.653 1.13a1 1 0 01-.23 1.273l-1.148.944a6.025 6.025 0 010 2.435l1.149.946a1 1 0 01.23 1.272l-.653 1.13a1 1 0 01-1.216.437l-1.394-.522c-.605.54-1.32.958-2.108 1.218l-.244 1.466a1 1 0 01-.987.836h-1.306a1 1 0 01-.986-.836l-.244-1.466a5.995 5.995 0 01-2.108-1.218l-1.394.522a1 1 0 01-1.217-.436l-.653-1.131a1 1 0 01.23-1.272l1.149-.946a6.026 6.026 0 010-2.435l-1.148-.944a1 1 0 01-.23-1.272l.653-1.131a1 1 0 011.217-.437l1.393.522a5.994 5.994 0 012.108-1.218l.244-1.466zM14.929 12a3 3 0 11-6 0 3 3 0 016 0z" }) });
1721  
1722    // packages/icons/build-module/library/comment-author-avatar.mjs
1723    var import_primitives12 = __toESM(require_primitives(), 1);
1724    var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
1725    var comment_author_avatar_default = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives12.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives12.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M7.25 16.437a6.5 6.5 0 1 1 9.5 0V16A2.75 2.75 0 0 0 14 13.25h-4A2.75 2.75 0 0 0 7.25 16v.437Zm1.5 1.193a6.47 6.47 0 0 0 3.25.87 6.47 6.47 0 0 0 3.25-.87V16c0-.69-.56-1.25-1.25-1.25h-4c-.69 0-1.25.56-1.25 1.25v1.63ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm10-2a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z" }) });
1726  
1727    // packages/icons/build-module/library/envelope.mjs
1728    var import_primitives13 = __toESM(require_primitives(), 1);
1729    var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
1730    var envelope_default = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_primitives13.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_primitives13.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M3 7c0-1.1.9-2 2-2h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Zm2-.5h14c.3 0 .5.2.5.5v1L12 13.5 4.5 7.9V7c0-.3.2-.5.5-.5Zm-.5 3.3V17c0 .3.2.5.5.5h14c.3 0 .5-.2.5-.5V9.8L12 15.4 4.5 9.8Z" }) });
1731  
1732    // packages/icons/build-module/library/error.mjs
1733    var import_primitives14 = __toESM(require_primitives(), 1);
1734    var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
1735    var error_default = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_primitives14.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_primitives14.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M12.218 5.377a.25.25 0 0 0-.436 0l-7.29 12.96a.25.25 0 0 0 .218.373h14.58a.25.25 0 0 0 .218-.372l-7.29-12.96Zm-1.743-.735c.669-1.19 2.381-1.19 3.05 0l7.29 12.96a1.75 1.75 0 0 1-1.525 2.608H4.71a1.75 1.75 0 0 1-1.525-2.608l7.29-12.96ZM12.75 17.46h-1.5v-1.5h1.5v1.5Zm-1.5-3h1.5v-5h-1.5v5Z" }) });
1736  
1737    // packages/icons/build-module/library/file.mjs
1738    var import_primitives15 = __toESM(require_primitives(), 1);
1739    var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
1740    var file_default = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_primitives15.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_primitives15.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M12.848 8a1 1 0 0 1-.914-.594l-.723-1.63a.5.5 0 0 0-.447-.276H5a.5.5 0 0 0-.5.5v11.5a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5v-9A.5.5 0 0 0 19 8h-6.152Zm.612-1.5a.5.5 0 0 1-.462-.31l-.445-1.084A2 2 0 0 0 10.763 4H5a2 2 0 0 0-2 2v11.5a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-9a2 2 0 0 0-2-2h-5.54Z" }) });
1741  
1742    // packages/icons/build-module/library/format-list-bullets-rtl.mjs
1743    var import_primitives16 = __toESM(require_primitives(), 1);
1744    var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1);
1745    var format_list_bullets_rtl_default = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_primitives16.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_primitives16.Path, { d: "M4 8.8h8.9V7.2H4v1.6zm0 7h8.9v-1.5H4v1.5zM18 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z" }) });
1746  
1747    // packages/icons/build-module/library/format-list-bullets.mjs
1748    var import_primitives17 = __toESM(require_primitives(), 1);
1749    var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1);
1750    var format_list_bullets_default = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_primitives17.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_primitives17.Path, { d: "M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM6 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-7c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" }) });
1751  
1752    // packages/icons/build-module/library/funnel.mjs
1753    var import_primitives18 = __toESM(require_primitives(), 1);
1754    var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1);
1755    var funnel_default = /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_primitives18.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_primitives18.Path, { d: "M10 17.5H14V16H10V17.5ZM6 6V7.5H18V6H6ZM8 12.5H16V11H8V12.5Z" }) });
1756  
1757    // packages/icons/build-module/library/image.mjs
1758    var import_primitives19 = __toESM(require_primitives(), 1);
1759    var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1);
1760    var image_default = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_primitives19.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_primitives19.Path, { d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z" }) });
1761  
1762    // packages/icons/build-module/library/link.mjs
1763    var import_primitives20 = __toESM(require_primitives(), 1);
1764    var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1);
1765    var link_default = /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_primitives20.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_primitives20.Path, { d: "M10 17.389H8.444A5.194 5.194 0 1 1 8.444 7H10v1.5H8.444a3.694 3.694 0 0 0 0 7.389H10v1.5ZM14 7h1.556a5.194 5.194 0 0 1 0 10.39H14v-1.5h1.556a3.694 3.694 0 0 0 0-7.39H14V7Zm-4.5 6h5v-1.5h-5V13Z" }) });
1766  
1767    // packages/icons/build-module/library/mobile.mjs
1768    var import_primitives21 = __toESM(require_primitives(), 1);
1769    var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1);
1770    var mobile_default = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_primitives21.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_primitives21.Path, { d: "M15 4H9c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h6c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 14c0 .3-.2.5-.5.5H9c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h6c.3 0 .5.2.5.5v12zm-4.5-.5h2V16h-2v1.5z" }) });
1771  
1772    // packages/icons/build-module/library/more-vertical.mjs
1773    var import_primitives22 = __toESM(require_primitives(), 1);
1774    var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1);
1775    var more_vertical_default = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_primitives22.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_primitives22.Path, { d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" }) });
1776  
1777    // packages/icons/build-module/library/next.mjs
1778    var import_primitives23 = __toESM(require_primitives(), 1);
1779    var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1);
1780    var next_default = /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_primitives23.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_primitives23.Path, { d: "M6.6 6L5.4 7l4.5 5-4.5 5 1.1 1 5.5-6-5.4-6zm6 0l-1.1 1 4.5 5-4.5 5 1.1 1 5.5-6-5.5-6z" }) });
1781  
1782    // packages/icons/build-module/library/previous.mjs
1783    var import_primitives24 = __toESM(require_primitives(), 1);
1784    var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1);
1785    var previous_default = /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_primitives24.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_primitives24.Path, { d: "M11.6 7l-1.1-1L5 12l5.5 6 1.1-1L7 12l4.6-5zm6 0l-1.1-1-5.5 6 5.5 6 1.1-1-4.6-5 4.6-5z" }) });
1786  
1787    // packages/icons/build-module/library/scheduled.mjs
1788    var import_primitives25 = __toESM(require_primitives(), 1);
1789    var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1);
1790    var scheduled_default = /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_primitives25.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_primitives25.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm9 1V8h-1.5v3.5h-2V13H13Z" }) });
1791  
1792    // packages/icons/build-module/library/search.mjs
1793    var import_primitives26 = __toESM(require_primitives(), 1);
1794    var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1);
1795    var search_default = /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_primitives26.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_primitives26.Path, { d: "M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z" }) });
1796  
1797    // packages/icons/build-module/library/seen.mjs
1798    var import_primitives27 = __toESM(require_primitives(), 1);
1799    var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1);
1800    var seen_default = /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_primitives27.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_primitives27.Path, { d: "M3.99961 13C4.67043 13.3354 4.6703 13.3357 4.67017 13.3359L4.67298 13.3305C4.67621 13.3242 4.68184 13.3135 4.68988 13.2985C4.70595 13.2686 4.7316 13.2218 4.76695 13.1608C4.8377 13.0385 4.94692 12.8592 5.09541 12.6419C5.39312 12.2062 5.84436 11.624 6.45435 11.0431C7.67308 9.88241 9.49719 8.75 11.9996 8.75C14.502 8.75 16.3261 9.88241 17.5449 11.0431C18.1549 11.624 18.6061 12.2062 18.9038 12.6419C19.0523 12.8592 19.1615 13.0385 19.2323 13.1608C19.2676 13.2218 19.2933 13.2686 19.3093 13.2985C19.3174 13.3135 19.323 13.3242 19.3262 13.3305L19.3291 13.3359C19.3289 13.3357 19.3288 13.3354 19.9996 13C20.6704 12.6646 20.6703 12.6643 20.6701 12.664L20.6697 12.6632L20.6688 12.6614L20.6662 12.6563L20.6583 12.6408C20.6517 12.6282 20.6427 12.6108 20.631 12.5892C20.6078 12.5459 20.5744 12.4852 20.5306 12.4096C20.4432 12.2584 20.3141 12.0471 20.1423 11.7956C19.7994 11.2938 19.2819 10.626 18.5794 9.9569C17.1731 8.61759 14.9972 7.25 11.9996 7.25C9.00203 7.25 6.82614 8.61759 5.41987 9.9569C4.71736 10.626 4.19984 11.2938 3.85694 11.7956C3.68511 12.0471 3.55605 12.2584 3.4686 12.4096C3.42484 12.4852 3.39142 12.5459 3.36818 12.5892C3.35656 12.6108 3.34748 12.6282 3.34092 12.6408L3.33297 12.6563L3.33041 12.6614L3.32948 12.6632L3.32911 12.664C3.32894 12.6643 3.32879 12.6646 3.99961 13ZM11.9996 16C13.9326 16 15.4996 14.433 15.4996 12.5C15.4996 10.567 13.9326 9 11.9996 9C10.0666 9 8.49961 10.567 8.49961 12.5C8.49961 14.433 10.0666 16 11.9996 16Z" }) });
1801  
1802    // packages/icons/build-module/library/unseen.mjs
1803    var import_primitives28 = __toESM(require_primitives(), 1);
1804    var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1);
1805    var unseen_default = /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_primitives28.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_primitives28.Path, { d: "M20.7 12.7s0-.1-.1-.2c0-.2-.2-.4-.4-.6-.3-.5-.9-1.2-1.6-1.8-.7-.6-1.5-1.3-2.6-1.8l-.6 1.4c.9.4 1.6 1 2.1 1.5.6.6 1.1 1.2 1.4 1.6.1.2.3.4.3.5v.1l.7-.3.7-.3Zm-5.2-9.3-1.8 4c-.5-.1-1.1-.2-1.7-.2-3 0-5.2 1.4-6.6 2.7-.7.7-1.2 1.3-1.6 1.8-.2.3-.3.5-.4.6 0 0 0 .1-.1.2s0 0 .7.3l.7.3V13c0-.1.2-.3.3-.5.3-.4.7-1 1.4-1.6 1.2-1.2 3-2.3 5.5-2.3H13v.3c-.4 0-.8-.1-1.1-.1-1.9 0-3.5 1.6-3.5 3.5s.6 2.3 1.6 2.9l-2 4.4.9.4 7.6-16.2-.9-.4Zm-3 12.6c1.7-.2 3-1.7 3-3.5s-.2-1.4-.6-1.9L12.4 16Z" }) });
1806  
1807    // packages/icons/build-module/library/upload.mjs
1808    var import_primitives29 = __toESM(require_primitives(), 1);
1809    var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1);
1810    var upload_default = /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_primitives29.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_primitives29.Path, { d: "M18.5 15v3.5H13V6.7l4.5 4.1 1-1.1-6.2-5.8-5.8 5.8 1 1.1 4-4v11.7h-6V15H4v5h16v-5z" }) });
1811  
1812    // packages/icons/build-module/library/video.mjs
1813    var import_primitives30 = __toESM(require_primitives(), 1);
1814    var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1);
1815    var video_default = /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_primitives30.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_primitives30.Path, { d: "M18.7 3H5.3C4 3 3 4 3 5.3v13.4C3 20 4 21 5.3 21h13.4c1.3 0 2.3-1 2.3-2.3V5.3C21 4 20 3 18.7 3zm.8 15.7c0 .4-.4.8-.8.8H5.3c-.4 0-.8-.4-.8-.8V5.3c0-.4.4-.8.8-.8h13.4c.4 0 .8.4.8.8v13.4zM10 15l5-3-5-3v6z" }) });
1816  
1817    // node_modules/@base-ui/utils/safeReact.mjs
1818    var React = __toESM(require_react(), 1);
1819    var SafeReact = {
1820      ...React
1821    };
1822  
1823    // node_modules/@base-ui/utils/useRefWithInit.mjs
1824    var React2 = __toESM(require_react(), 1);
1825    var UNINITIALIZED = {};
1826    function useRefWithInit(init2, initArg) {
1827      const ref = React2.useRef(UNINITIALIZED);
1828      if (ref.current === UNINITIALIZED) {
1829        ref.current = init2(initArg);
1830      }
1831      return ref;
1832    }
1833  
1834    // node_modules/@base-ui/utils/useStableCallback.mjs
1835    var useInsertionEffect = SafeReact.useInsertionEffect;
1836    var useSafeInsertionEffect = (
1837      // React 17 doesn't have useInsertionEffect.
1838      useInsertionEffect && // Preact replaces useInsertionEffect with useLayoutEffect and fires too late.
1839      useInsertionEffect !== SafeReact.useLayoutEffect ? useInsertionEffect : (fn) => fn()
1840    );
1841    function useStableCallback(callback) {
1842      const stable = useRefWithInit(createStableCallback).current;
1843      stable.next = callback;
1844      useSafeInsertionEffect(stable.effect);
1845      return stable.trampoline;
1846    }
1847    function createStableCallback() {
1848      const stable = {
1849        next: void 0,
1850        callback: assertNotCalled,
1851        trampoline: (...args) => stable.callback?.(...args),
1852        effect: () => {
1853          stable.callback = stable.next;
1854        }
1855      };
1856      return stable;
1857    }
1858    function assertNotCalled() {
1859      if (true) {
1860        throw (
1861          /* minify-error-disabled */
1862          new Error("Base UI: Cannot call an event handler while rendering.")
1863        );
1864      }
1865    }
1866  
1867    // node_modules/@base-ui/utils/useIsoLayoutEffect.mjs
1868    var React3 = __toESM(require_react(), 1);
1869    var noop2 = () => {
1870    };
1871    var useIsoLayoutEffect = typeof document !== "undefined" ? React3.useLayoutEffect : noop2;
1872  
1873    // node_modules/@base-ui/utils/warn.mjs
1874    var set;
1875    if (true) {
1876      set = /* @__PURE__ */ new Set();
1877    }
1878    function warn(...messages) {
1879      if (true) {
1880        const messageKey = messages.join(" ");
1881        if (!set.has(messageKey)) {
1882          set.add(messageKey);
1883          console.warn(`Base UI: $messageKey}`);
1884        }
1885      }
1886    }
1887  
1888    // node_modules/@base-ui/react/internals/direction-context/DirectionContext.mjs
1889    var React4 = __toESM(require_react(), 1);
1890    var DirectionContext = /* @__PURE__ */ React4.createContext(void 0);
1891    if (true) DirectionContext.displayName = "DirectionContext";
1892    function useDirection() {
1893      const context = React4.useContext(DirectionContext);
1894      return context?.direction ?? "ltr";
1895    }
1896  
1897    // node_modules/@base-ui/react/internals/useRenderElement.mjs
1898    var React7 = __toESM(require_react(), 1);
1899  
1900    // node_modules/@base-ui/utils/useMergedRefs.mjs
1901    function useMergedRefs(a2, b2, c2, d2) {
1902      const forkRef = useRefWithInit(createForkRef).current;
1903      if (didChange(forkRef, a2, b2, c2, d2)) {
1904        update(forkRef, [a2, b2, c2, d2]);
1905      }
1906      return forkRef.callback;
1907    }
1908    function useMergedRefsN(refs) {
1909      const forkRef = useRefWithInit(createForkRef).current;
1910      if (didChangeN(forkRef, refs)) {
1911        update(forkRef, refs);
1912      }
1913      return forkRef.callback;
1914    }
1915    function createForkRef() {
1916      return {
1917        callback: null,
1918        cleanup: null,
1919        refs: []
1920      };
1921    }
1922    function didChange(forkRef, a2, b2, c2, d2) {
1923      return forkRef.refs[0] !== a2 || forkRef.refs[1] !== b2 || forkRef.refs[2] !== c2 || forkRef.refs[3] !== d2;
1924    }
1925    function didChangeN(forkRef, newRefs) {
1926      return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index2) => ref !== newRefs[index2]);
1927    }
1928    function update(forkRef, refs) {
1929      forkRef.refs = refs;
1930      if (refs.every((ref) => ref == null)) {
1931        forkRef.callback = null;
1932        return;
1933      }
1934      forkRef.callback = (instance) => {
1935        if (forkRef.cleanup) {
1936          forkRef.cleanup();
1937          forkRef.cleanup = null;
1938        }
1939        if (instance != null) {
1940          const cleanupCallbacks = Array(refs.length).fill(null);
1941          for (let i2 = 0; i2 < refs.length; i2 += 1) {
1942            const ref = refs[i2];
1943            if (ref == null) {
1944              continue;
1945            }
1946            switch (typeof ref) {
1947              case "function": {
1948                const refCleanup = ref(instance);
1949                if (typeof refCleanup === "function") {
1950                  cleanupCallbacks[i2] = refCleanup;
1951                }
1952                break;
1953              }
1954              case "object": {
1955                ref.current = instance;
1956                break;
1957              }
1958              default:
1959            }
1960          }
1961          forkRef.cleanup = () => {
1962            for (let i2 = 0; i2 < refs.length; i2 += 1) {
1963              const ref = refs[i2];
1964              if (ref == null) {
1965                continue;
1966              }
1967              switch (typeof ref) {
1968                case "function": {
1969                  const cleanupCallback = cleanupCallbacks[i2];
1970                  if (typeof cleanupCallback === "function") {
1971                    cleanupCallback();
1972                  } else {
1973                    ref(null);
1974                  }
1975                  break;
1976                }
1977                case "object": {
1978                  ref.current = null;
1979                  break;
1980                }
1981                default:
1982              }
1983            }
1984          };
1985        }
1986      };
1987    }
1988  
1989    // node_modules/@base-ui/utils/getReactElementRef.mjs
1990    var React6 = __toESM(require_react(), 1);
1991  
1992    // node_modules/@base-ui/utils/reactVersion.mjs
1993    var React5 = __toESM(require_react(), 1);
1994    var majorVersion = parseInt(React5.version, 10);
1995    function isReactVersionAtLeast(reactVersionToCheck) {
1996      return majorVersion >= reactVersionToCheck;
1997    }
1998  
1999    // node_modules/@base-ui/utils/getReactElementRef.mjs
2000    function getReactElementRef(element) {
2001      if (!/* @__PURE__ */ React6.isValidElement(element)) {
2002        return null;
2003      }
2004      const reactElement = element;
2005      const propsWithRef = reactElement.props;
2006      return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null;
2007    }
2008  
2009    // node_modules/@base-ui/utils/mergeObjects.mjs
2010    function mergeObjects(a2, b2) {
2011      if (a2 && !b2) {
2012        return a2;
2013      }
2014      if (!a2 && b2) {
2015        return b2;
2016      }
2017      if (a2 || b2) {
2018        return {
2019          ...a2,
2020          ...b2
2021        };
2022      }
2023      return void 0;
2024    }
2025  
2026    // node_modules/@base-ui/utils/empty.mjs
2027    function NOOP() {
2028    }
2029    var EMPTY_ARRAY = Object.freeze([]);
2030    var EMPTY_OBJECT = Object.freeze({});
2031  
2032    // node_modules/@base-ui/react/internals/getStateAttributesProps.mjs
2033    function getStateAttributesProps(state, customMapping) {
2034      const props = {};
2035      for (const key in state) {
2036        const value = state[key];
2037        if (customMapping?.hasOwnProperty(key)) {
2038          const customProps = customMapping[key](value);
2039          if (customProps != null) {
2040            Object.assign(props, customProps);
2041          }
2042          continue;
2043        }
2044        if (value === true) {
2045          props[`data-$key.toLowerCase()}`] = "";
2046        } else if (value) {
2047          props[`data-$key.toLowerCase()}`] = value.toString();
2048        }
2049      }
2050      return props;
2051    }
2052  
2053    // node_modules/@base-ui/react/utils/resolveClassName.mjs
2054    function resolveClassName(className, state) {
2055      return typeof className === "function" ? className(state) : className;
2056    }
2057  
2058    // node_modules/@base-ui/react/utils/resolveStyle.mjs
2059    function resolveStyle(style, state) {
2060      return typeof style === "function" ? style(state) : style;
2061    }
2062  
2063    // node_modules/@base-ui/react/merge-props/mergeProps.mjs
2064    var EMPTY_PROPS = {};
2065    function mergeProps(a2, b2, c2, d2, e2) {
2066      if (!c2 && !d2 && !e2 && !a2) {
2067        return createInitialMergedProps(b2);
2068      }
2069      let merged = createInitialMergedProps(a2);
2070      if (b2) {
2071        merged = mergeInto(merged, b2);
2072      }
2073      if (c2) {
2074        merged = mergeInto(merged, c2);
2075      }
2076      if (d2) {
2077        merged = mergeInto(merged, d2);
2078      }
2079      if (e2) {
2080        merged = mergeInto(merged, e2);
2081      }
2082      return merged;
2083    }
2084    function mergePropsN(props) {
2085      if (props.length === 0) {
2086        return EMPTY_PROPS;
2087      }
2088      if (props.length === 1) {
2089        return createInitialMergedProps(props[0]);
2090      }
2091      let merged = createInitialMergedProps(props[0]);
2092      for (let i2 = 1; i2 < props.length; i2 += 1) {
2093        merged = mergeInto(merged, props[i2]);
2094      }
2095      return merged;
2096    }
2097    function createInitialMergedProps(inputProps) {
2098      if (isPropsGetter(inputProps)) {
2099        return {
2100          ...resolvePropsGetter(inputProps, EMPTY_PROPS)
2101        };
2102      }
2103      return copyInitialProps(inputProps);
2104    }
2105    function mergeInto(merged, inputProps) {
2106      if (isPropsGetter(inputProps)) {
2107        return resolvePropsGetter(inputProps, merged);
2108      }
2109      return mutablyMergeInto(merged, inputProps);
2110    }
2111    function copyInitialProps(inputProps) {
2112      const copiedProps = {
2113        ...inputProps
2114      };
2115      for (const propName in copiedProps) {
2116        const propValue = copiedProps[propName];
2117        if (isEventHandler(propName, propValue)) {
2118          copiedProps[propName] = wrapEventHandler(propValue);
2119        }
2120      }
2121      return copiedProps;
2122    }
2123    function mutablyMergeInto(mergedProps, externalProps) {
2124      if (!externalProps) {
2125        return mergedProps;
2126      }
2127      for (const propName in externalProps) {
2128        const externalPropValue = externalProps[propName];
2129        switch (propName) {
2130          case "style": {
2131            mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue);
2132            break;
2133          }
2134          case "className": {
2135            mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue);
2136            break;
2137          }
2138          default: {
2139            if (isEventHandler(propName, externalPropValue)) {
2140              mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue);
2141            } else {
2142              mergedProps[propName] = externalPropValue;
2143            }
2144          }
2145        }
2146      }
2147      return mergedProps;
2148    }
2149    function isEventHandler(key, value) {
2150      const code0 = key.charCodeAt(0);
2151      const code1 = key.charCodeAt(1);
2152      const code2 = key.charCodeAt(2);
2153      return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined");
2154    }
2155    function isPropsGetter(inputProps) {
2156      return typeof inputProps === "function";
2157    }
2158    function resolvePropsGetter(inputProps, previousProps) {
2159      if (isPropsGetter(inputProps)) {
2160        return inputProps(previousProps);
2161      }
2162      return inputProps ?? EMPTY_PROPS;
2163    }
2164    function mergeEventHandlers(ourHandler, theirHandler) {
2165      if (!theirHandler) {
2166        return ourHandler;
2167      }
2168      if (!ourHandler) {
2169        return wrapEventHandler(theirHandler);
2170      }
2171      return (...args) => {
2172        const event = args[0];
2173        if (isSyntheticEvent(event)) {
2174          const baseUIEvent = event;
2175          makeEventPreventable(baseUIEvent);
2176          const result2 = theirHandler(...args);
2177          if (!baseUIEvent.baseUIHandlerPrevented) {
2178            ourHandler?.(...args);
2179          }
2180          return result2;
2181        }
2182        const result = theirHandler(...args);
2183        ourHandler?.(...args);
2184        return result;
2185      };
2186    }
2187    function wrapEventHandler(handler) {
2188      if (!handler) {
2189        return handler;
2190      }
2191      return (...args) => {
2192        const event = args[0];
2193        if (isSyntheticEvent(event)) {
2194          makeEventPreventable(event);
2195        }
2196        return handler(...args);
2197      };
2198    }
2199    function makeEventPreventable(event) {
2200      event.preventBaseUIHandler = () => {
2201        event.baseUIHandlerPrevented = true;
2202      };
2203      return event;
2204    }
2205    function mergeClassNames(ourClassName, theirClassName) {
2206      if (theirClassName) {
2207        if (ourClassName) {
2208          return theirClassName + " " + ourClassName;
2209        }
2210        return theirClassName;
2211      }
2212      return ourClassName;
2213    }
2214    function isSyntheticEvent(event) {
2215      return event != null && typeof event === "object" && "nativeEvent" in event;
2216    }
2217  
2218    // node_modules/@base-ui/react/internals/useRenderElement.mjs
2219    var import_react = __toESM(require_react(), 1);
2220    function useRenderElement(element, componentProps, params = {}) {
2221      const renderProp = componentProps.render;
2222      const outProps = useRenderElementProps(componentProps, params);
2223      if (params.enabled === false) {
2224        return null;
2225      }
2226      const state = params.state ?? EMPTY_OBJECT;
2227      return evaluateRenderProp(element, renderProp, outProps, state);
2228    }
2229    function useRenderElementProps(componentProps, params = {}) {
2230      const {
2231        className: classNameProp,
2232        style: styleProp,
2233        render: renderProp
2234      } = componentProps;
2235      const {
2236        state = EMPTY_OBJECT,
2237        ref,
2238        props,
2239        stateAttributesMapping: stateAttributesMapping3,
2240        enabled = true
2241      } = params;
2242      const className = enabled ? resolveClassName(classNameProp, state) : void 0;
2243      const style = enabled ? resolveStyle(styleProp, state) : void 0;
2244      const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping3) : EMPTY_OBJECT;
2245      const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : void 0;
2246      const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT;
2247      if (typeof document !== "undefined") {
2248        if (!enabled) {
2249          useMergedRefs(null, null);
2250        } else if (Array.isArray(ref)) {
2251          outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]);
2252        } else {
2253          outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref);
2254        }
2255      }
2256      if (!enabled) {
2257        return EMPTY_OBJECT;
2258      }
2259      if (className !== void 0) {
2260        outProps.className = mergeClassNames(outProps.className, className);
2261      }
2262      if (style !== void 0) {
2263        outProps.style = mergeObjects(outProps.style, style);
2264      }
2265      return outProps;
2266    }
2267    function resolveRenderFunctionProps(props) {
2268      if (Array.isArray(props)) {
2269        return mergePropsN(props);
2270      }
2271      return mergeProps(void 0, props);
2272    }
2273    var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
2274    var COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/;
2275    var LOWERCASE_CHARACTER_PATTERN = /[a-z]/;
2276    function evaluateRenderProp(element, render4, props, state) {
2277      if (render4) {
2278        if (typeof render4 === "function") {
2279          if (true) {
2280            warnIfRenderPropLooksLikeComponent(render4);
2281          }
2282          return render4(props, state);
2283        }
2284        const mergedProps = mergeProps(props, render4.props);
2285        mergedProps.ref = props.ref;
2286        let newElement = render4;
2287        if (newElement?.$$typeof === REACT_LAZY_TYPE) {
2288          const children = React7.Children.toArray(render4);
2289          newElement = children[0];
2290        }
2291        if (true) {
2292          if (!/* @__PURE__ */ React7.isValidElement(newElement)) {
2293            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"));
2294          }
2295        }
2296        return /* @__PURE__ */ React7.cloneElement(newElement, mergedProps);
2297      }
2298      if (element) {
2299        if (typeof element === "string") {
2300          return renderTag(element, props);
2301        }
2302      }
2303      throw new Error(true ? "Base UI: Render element or function are not defined." : formatErrorMessage_default(8));
2304    }
2305    function warnIfRenderPropLooksLikeComponent(renderFn) {
2306      const functionName = renderFn.name;
2307      if (functionName.length === 0) {
2308        return;
2309      }
2310      if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) {
2311        return;
2312      }
2313      if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) {
2314        return;
2315      }
2316      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");
2317    }
2318    function renderTag(Tag, props) {
2319      if (Tag === "button") {
2320        return /* @__PURE__ */ (0, import_react.createElement)("button", {
2321          type: "button",
2322          ...props,
2323          key: props.key
2324        });
2325      }
2326      if (Tag === "img") {
2327        return /* @__PURE__ */ (0, import_react.createElement)("img", {
2328          alt: "",
2329          ...props,
2330          key: props.key
2331        });
2332      }
2333      return /* @__PURE__ */ React7.createElement(Tag, props);
2334    }
2335  
2336    // node_modules/@base-ui/utils/useId.mjs
2337    var React8 = __toESM(require_react(), 1);
2338    var globalId = 0;
2339    function useGlobalId(idOverride, prefix = "mui") {
2340      const [defaultId, setDefaultId] = React8.useState(idOverride);
2341      const id = idOverride || defaultId;
2342      React8.useEffect(() => {
2343        if (defaultId == null) {
2344          globalId += 1;
2345          setDefaultId(`$prefix}-$globalId}`);
2346        }
2347      }, [defaultId, prefix]);
2348      return id;
2349    }
2350    var maybeReactUseId = SafeReact.useId;
2351    function useId(idOverride, prefix) {
2352      if (maybeReactUseId !== void 0) {
2353        const reactId = maybeReactUseId();
2354        return idOverride ?? (prefix ? `$prefix}-$reactId}` : reactId);
2355      }
2356      return useGlobalId(idOverride, prefix);
2357    }
2358  
2359    // node_modules/@base-ui/react/internals/useBaseUiId.mjs
2360    function useBaseUiId(idOverride) {
2361      return useId(idOverride, "base-ui");
2362    }
2363  
2364    // node_modules/@base-ui/react/internals/reason-parts.mjs
2365    var reason_parts_exports = {};
2366    __export(reason_parts_exports, {
2367      cancelOpen: () => cancelOpen,
2368      chipRemovePress: () => chipRemovePress,
2369      clearPress: () => clearPress,
2370      closePress: () => closePress,
2371      closeWatcher: () => closeWatcher,
2372      decrementPress: () => decrementPress,
2373      disabled: () => disabled,
2374      drag: () => drag,
2375      escapeKey: () => escapeKey,
2376      focusOut: () => focusOut,
2377      imperativeAction: () => imperativeAction,
2378      incrementPress: () => incrementPress,
2379      initial: () => initial,
2380      inputBlur: () => inputBlur,
2381      inputChange: () => inputChange,
2382      inputClear: () => inputClear,
2383      inputPaste: () => inputPaste,
2384      inputPress: () => inputPress,
2385      itemPress: () => itemPress,
2386      keyboard: () => keyboard,
2387      linkPress: () => linkPress,
2388      listNavigation: () => listNavigation,
2389      missing: () => missing,
2390      none: () => none,
2391      outsidePress: () => outsidePress,
2392      pointer: () => pointer,
2393      scrub: () => scrub,
2394      siblingOpen: () => siblingOpen,
2395      swipe: () => swipe,
2396      trackPress: () => trackPress,
2397      triggerFocus: () => triggerFocus,
2398      triggerHover: () => triggerHover,
2399      triggerPress: () => triggerPress,
2400      wheel: () => wheel,
2401      windowResize: () => windowResize
2402    });
2403    var none = "none";
2404    var triggerPress = "trigger-press";
2405    var triggerHover = "trigger-hover";
2406    var triggerFocus = "trigger-focus";
2407    var outsidePress = "outside-press";
2408    var itemPress = "item-press";
2409    var closePress = "close-press";
2410    var linkPress = "link-press";
2411    var clearPress = "clear-press";
2412    var chipRemovePress = "chip-remove-press";
2413    var trackPress = "track-press";
2414    var incrementPress = "increment-press";
2415    var decrementPress = "decrement-press";
2416    var inputChange = "input-change";
2417    var inputClear = "input-clear";
2418    var inputBlur = "input-blur";
2419    var inputPaste = "input-paste";
2420    var inputPress = "input-press";
2421    var focusOut = "focus-out";
2422    var escapeKey = "escape-key";
2423    var closeWatcher = "close-watcher";
2424    var listNavigation = "list-navigation";
2425    var keyboard = "keyboard";
2426    var pointer = "pointer";
2427    var drag = "drag";
2428    var wheel = "wheel";
2429    var scrub = "scrub";
2430    var cancelOpen = "cancel-open";
2431    var siblingOpen = "sibling-open";
2432    var disabled = "disabled";
2433    var missing = "missing";
2434    var initial = "initial";
2435    var imperativeAction = "imperative-action";
2436    var swipe = "swipe";
2437    var windowResize = "window-resize";
2438  
2439    // node_modules/@base-ui/react/internals/createBaseUIEventDetails.mjs
2440    function createChangeEventDetails(reason, event, trigger, customProperties) {
2441      let canceled = false;
2442      let allowPropagation = false;
2443      const custom = customProperties ?? EMPTY_OBJECT;
2444      const details = {
2445        reason,
2446        event: event ?? new Event("base-ui"),
2447        cancel() {
2448          canceled = true;
2449        },
2450        allowPropagation() {
2451          allowPropagation = true;
2452        },
2453        get isCanceled() {
2454          return canceled;
2455        },
2456        get isPropagationAllowed() {
2457          return allowPropagation;
2458        },
2459        trigger,
2460        ...custom
2461      };
2462      return details;
2463    }
2464  
2465    // node_modules/@base-ui/react/internals/useTransitionStatus.mjs
2466    var React10 = __toESM(require_react(), 1);
2467  
2468    // node_modules/@base-ui/utils/useOnMount.mjs
2469    var React9 = __toESM(require_react(), 1);
2470    var EMPTY = [];
2471    function useOnMount(fn) {
2472      React9.useEffect(fn, EMPTY);
2473    }
2474  
2475    // node_modules/@base-ui/utils/useAnimationFrame.mjs
2476    var EMPTY2 = null;
2477    var LAST_RAF = globalThis.requestAnimationFrame;
2478    var Scheduler = class {
2479      /* This implementation uses an array as a backing data-structure for frame callbacks.
2480       * It allows `O(1)` callback cancelling by inserting a `null` in the array, though it
2481       * never calls the native `cancelAnimationFrame` if there are no frames left. This can
2482       * be much more efficient if there is a call pattern that alterns as
2483       * "request-cancel-request-cancel-…".
2484       * But in the case of "request-request-…-cancel-cancel-…", it leaves the final animation
2485       * frame to run anyway. We turn that frame into a `O(1)` no-op via `callbacksCount`. */
2486      callbacks = [];
2487      callbacksCount = 0;
2488      nextId = 1;
2489      startId = 1;
2490      isScheduled = false;
2491      tick = (timestamp) => {
2492        this.isScheduled = false;
2493        const currentCallbacks = this.callbacks;
2494        const currentCallbacksCount = this.callbacksCount;
2495        this.callbacks = [];
2496        this.callbacksCount = 0;
2497        this.startId = this.nextId;
2498        if (currentCallbacksCount > 0) {
2499          for (let i2 = 0; i2 < currentCallbacks.length; i2 += 1) {
2500            currentCallbacks[i2]?.(timestamp);
2501          }
2502        }
2503      };
2504      request(fn) {
2505        const id = this.nextId;
2506        this.nextId += 1;
2507        this.callbacks.push(fn);
2508        this.callbacksCount += 1;
2509        const didRAFChange = LAST_RAF !== requestAnimationFrame && (LAST_RAF = requestAnimationFrame, true);
2510        if (!this.isScheduled || didRAFChange) {
2511          requestAnimationFrame(this.tick);
2512          this.isScheduled = true;
2513        }
2514        return id;
2515      }
2516      cancel(id) {
2517        const index2 = id - this.startId;
2518        if (index2 < 0 || index2 >= this.callbacks.length) {
2519          return;
2520        }
2521        this.callbacks[index2] = null;
2522        this.callbacksCount -= 1;
2523      }
2524    };
2525    var scheduler = new Scheduler();
2526    var AnimationFrame = class _AnimationFrame {
2527      static create() {
2528        return new _AnimationFrame();
2529      }
2530      static request(fn) {
2531        return scheduler.request(fn);
2532      }
2533      static cancel(id) {
2534        return scheduler.cancel(id);
2535      }
2536      currentId = EMPTY2;
2537      /**
2538       * Executes `fn` after `delay`, clearing any previously scheduled call.
2539       */
2540      request(fn) {
2541        this.cancel();
2542        this.currentId = scheduler.request(() => {
2543          this.currentId = EMPTY2;
2544          fn();
2545        });
2546      }
2547      cancel = () => {
2548        if (this.currentId !== EMPTY2) {
2549          scheduler.cancel(this.currentId);
2550          this.currentId = EMPTY2;
2551        }
2552      };
2553      disposeEffect = () => {
2554        return this.cancel;
2555      };
2556    };
2557    function useAnimationFrame() {
2558      const timeout = useRefWithInit(AnimationFrame.create).current;
2559      useOnMount(timeout.disposeEffect);
2560      return timeout;
2561    }
2562  
2563    // node_modules/@base-ui/react/internals/useTransitionStatus.mjs
2564    function useTransitionStatus(open, enableIdleState = false, deferEndingState = false) {
2565      const [transitionStatus, setTransitionStatus] = React10.useState(open && enableIdleState ? "idle" : void 0);
2566      const [mounted, setMounted] = React10.useState(open);
2567      if (open && !mounted) {
2568        setMounted(true);
2569        setTransitionStatus("starting");
2570      }
2571      if (!open && mounted && transitionStatus !== "ending" && !deferEndingState) {
2572        setTransitionStatus("ending");
2573      }
2574      if (!open && !mounted && transitionStatus === "ending") {
2575        setTransitionStatus(void 0);
2576      }
2577      useIsoLayoutEffect(() => {
2578        if (!open && mounted && transitionStatus !== "ending" && deferEndingState) {
2579          const frame = AnimationFrame.request(() => {
2580            setTransitionStatus("ending");
2581          });
2582          return () => {
2583            AnimationFrame.cancel(frame);
2584          };
2585        }
2586        return void 0;
2587      }, [open, mounted, transitionStatus, deferEndingState]);
2588      useIsoLayoutEffect(() => {
2589        if (!open || enableIdleState) {
2590          return void 0;
2591        }
2592        const frame = AnimationFrame.request(() => {
2593          setTransitionStatus(void 0);
2594        });
2595        return () => {
2596          AnimationFrame.cancel(frame);
2597        };
2598      }, [enableIdleState, open]);
2599      useIsoLayoutEffect(() => {
2600        if (!open || !enableIdleState) {
2601          return void 0;
2602        }
2603        if (open && mounted && transitionStatus !== "idle") {
2604          setTransitionStatus("starting");
2605        }
2606        const frame = AnimationFrame.request(() => {
2607          setTransitionStatus("idle");
2608        });
2609        return () => {
2610          AnimationFrame.cancel(frame);
2611        };
2612      }, [enableIdleState, open, mounted, transitionStatus]);
2613      return {
2614        mounted,
2615        setMounted,
2616        transitionStatus
2617      };
2618    }
2619  
2620    // node_modules/@base-ui/react/internals/stateAttributesMapping.mjs
2621    var TransitionStatusDataAttributes = /* @__PURE__ */ (function(TransitionStatusDataAttributes2) {
2622      TransitionStatusDataAttributes2["startingStyle"] = "data-starting-style";
2623      TransitionStatusDataAttributes2["endingStyle"] = "data-ending-style";
2624      return TransitionStatusDataAttributes2;
2625    })({});
2626    var STARTING_HOOK = {
2627      [TransitionStatusDataAttributes.startingStyle]: ""
2628    };
2629    var ENDING_HOOK = {
2630      [TransitionStatusDataAttributes.endingStyle]: ""
2631    };
2632    var transitionStatusMapping = {
2633      transitionStatus(value) {
2634        if (value === "starting") {
2635          return STARTING_HOOK;
2636        }
2637        if (value === "ending") {
2638          return ENDING_HOOK;
2639        }
2640        return null;
2641      }
2642    };
2643  
2644    // node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
2645    function hasWindow() {
2646      return typeof window !== "undefined";
2647    }
2648    function getNodeName(node) {
2649      if (isNode(node)) {
2650        return (node.nodeName || "").toLowerCase();
2651      }
2652      return "#document";
2653    }
2654    function getWindow(node) {
2655      var _node$ownerDocument;
2656      return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
2657    }
2658    function getDocumentElement(node) {
2659      var _ref;
2660      return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
2661    }
2662    function isNode(value) {
2663      if (!hasWindow()) {
2664        return false;
2665      }
2666      return value instanceof Node || value instanceof getWindow(value).Node;
2667    }
2668    function isElement(value) {
2669      if (!hasWindow()) {
2670        return false;
2671      }
2672      return value instanceof Element || value instanceof getWindow(value).Element;
2673    }
2674    function isHTMLElement(value) {
2675      if (!hasWindow()) {
2676        return false;
2677      }
2678      return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
2679    }
2680    function isShadowRoot(value) {
2681      if (!hasWindow() || typeof ShadowRoot === "undefined") {
2682        return false;
2683      }
2684      return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
2685    }
2686    function isOverflowElement(element) {
2687      const {
2688        overflow,
2689        overflowX,
2690        overflowY,
2691        display
2692      } = getComputedStyle2(element);
2693      return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents";
2694    }
2695    function isTableElement(element) {
2696      return /^(table|td|th)$/.test(getNodeName(element));
2697    }
2698    function isTopLayer(element) {
2699      try {
2700        if (element.matches(":popover-open")) {
2701          return true;
2702        }
2703      } catch (_e) {
2704      }
2705      try {
2706        return element.matches(":modal");
2707      } catch (_e) {
2708        return false;
2709      }
2710    }
2711    var willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
2712    var containRe = /paint|layout|strict|content/;
2713    var isNotNone = (value) => !!value && value !== "none";
2714    var isWebKitValue;
2715    function isContainingBlock(elementOrCss) {
2716      const css = isElement(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss;
2717      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 || "");
2718    }
2719    function getContainingBlock(element) {
2720      let currentNode = getParentNode(element);
2721      while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
2722        if (isContainingBlock(currentNode)) {
2723          return currentNode;
2724        } else if (isTopLayer(currentNode)) {
2725          return null;
2726        }
2727        currentNode = getParentNode(currentNode);
2728      }
2729      return null;
2730    }
2731    function isWebKit() {
2732      if (isWebKitValue == null) {
2733        isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none");
2734      }
2735      return isWebKitValue;
2736    }
2737    function isLastTraversableNode(node) {
2738      return /^(html|body|#document)$/.test(getNodeName(node));
2739    }
2740    function getComputedStyle2(element) {
2741      return getWindow(element).getComputedStyle(element);
2742    }
2743    function getNodeScroll(element) {
2744      if (isElement(element)) {
2745        return {
2746          scrollLeft: element.scrollLeft,
2747          scrollTop: element.scrollTop
2748        };
2749      }
2750      return {
2751        scrollLeft: element.scrollX,
2752        scrollTop: element.scrollY
2753      };
2754    }
2755    function getParentNode(node) {
2756      if (getNodeName(node) === "html") {
2757        return node;
2758      }
2759      const result = (
2760        // Step into the shadow DOM of the parent of a slotted node.
2761        node.assignedSlot || // DOM Element detected.
2762        node.parentNode || // ShadowRoot detected.
2763        isShadowRoot(node) && node.host || // Fallback.
2764        getDocumentElement(node)
2765      );
2766      return isShadowRoot(result) ? result.host : result;
2767    }
2768    function getNearestOverflowAncestor(node) {
2769      const parentNode = getParentNode(node);
2770      if (isLastTraversableNode(parentNode)) {
2771        return node.ownerDocument ? node.ownerDocument.body : node.body;
2772      }
2773      if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
2774        return parentNode;
2775      }
2776      return getNearestOverflowAncestor(parentNode);
2777    }
2778    function getOverflowAncestors(node, list, traverseIframes) {
2779      var _node$ownerDocument2;
2780      if (list === void 0) {
2781        list = [];
2782      }
2783      if (traverseIframes === void 0) {
2784        traverseIframes = true;
2785      }
2786      const scrollableAncestor = getNearestOverflowAncestor(node);
2787      const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
2788      const win = getWindow(scrollableAncestor);
2789      if (isBody) {
2790        const frameElement = getFrameElement(win);
2791        return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
2792      } else {
2793        return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
2794      }
2795    }
2796    function getFrameElement(win) {
2797      return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
2798    }
2799  
2800    // node_modules/@base-ui/utils/addEventListener.mjs
2801    function addEventListener(target, type, listener, options) {
2802      target.addEventListener(type, listener, options);
2803      return () => {
2804        target.removeEventListener(type, listener, options);
2805      };
2806    }
2807  
2808    // node_modules/@base-ui/utils/useValueAsRef.mjs
2809    function useValueAsRef(value) {
2810      const latest = useRefWithInit(createLatestRef, value).current;
2811      latest.next = value;
2812      useIsoLayoutEffect(latest.effect);
2813      return latest;
2814    }
2815    function createLatestRef(value) {
2816      const latest = {
2817        current: value,
2818        next: value,
2819        effect: () => {
2820          latest.current = latest.next;
2821        }
2822      };
2823      return latest;
2824    }
2825  
2826    // node_modules/@base-ui/utils/owner.mjs
2827    function ownerDocument(node) {
2828      return node?.ownerDocument || document;
2829    }
2830  
2831    // node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs
2832    var React11 = __toESM(require_react(), 1);
2833  
2834    // node_modules/@base-ui/react/internals/useAnimationsFinished.mjs
2835    var ReactDOM = __toESM(require_react_dom(), 1);
2836  
2837    // node_modules/@base-ui/react/utils/resolveRef.mjs
2838    function resolveRef(maybeRef) {
2839      if (maybeRef == null) {
2840        return maybeRef;
2841      }
2842      return "current" in maybeRef ? maybeRef.current : maybeRef;
2843    }
2844  
2845    // node_modules/@base-ui/react/internals/useAnimationsFinished.mjs
2846    function useAnimationsFinished(elementOrRef, waitForStartingStyleRemoved = false, treatAbortedAsFinished = true) {
2847      const frame = useAnimationFrame();
2848      return useStableCallback((fnToExecute, signal = null) => {
2849        frame.cancel();
2850        const element = resolveRef(elementOrRef);
2851        if (element == null) {
2852          return;
2853        }
2854        const resolvedElement = element;
2855        const done = () => {
2856          ReactDOM.flushSync(fnToExecute);
2857        };
2858        if (typeof resolvedElement.getAnimations !== "function" || globalThis.BASE_UI_ANIMATIONS_DISABLED) {
2859          fnToExecute();
2860          return;
2861        }
2862        function exec() {
2863          Promise.all(resolvedElement.getAnimations().map((animation) => animation.finished)).then(() => {
2864            if (!signal?.aborted) {
2865              done();
2866            }
2867          }).catch(() => {
2868            if (treatAbortedAsFinished) {
2869              if (!signal?.aborted) {
2870                done();
2871              }
2872              return;
2873            }
2874            const currentAnimations = resolvedElement.getAnimations();
2875            if (!signal?.aborted && currentAnimations.length > 0 && currentAnimations.some((animation) => animation.pending || animation.playState !== "finished")) {
2876              exec();
2877            }
2878          });
2879        }
2880        if (waitForStartingStyleRemoved) {
2881          const startingStyleAttribute = TransitionStatusDataAttributes.startingStyle;
2882          if (!resolvedElement.hasAttribute(startingStyleAttribute)) {
2883            frame.request(exec);
2884            return;
2885          }
2886          const attributeObserver = new MutationObserver(() => {
2887            if (!resolvedElement.hasAttribute(startingStyleAttribute)) {
2888              attributeObserver.disconnect();
2889              exec();
2890            }
2891          });
2892          attributeObserver.observe(resolvedElement, {
2893            attributes: true,
2894            attributeFilter: [startingStyleAttribute]
2895          });
2896          signal?.addEventListener("abort", () => attributeObserver.disconnect(), {
2897            once: true
2898          });
2899          return;
2900        }
2901        frame.request(exec);
2902      });
2903    }
2904  
2905    // node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs
2906    function useOpenChangeComplete(parameters) {
2907      const {
2908        enabled = true,
2909        open,
2910        ref,
2911        onComplete: onCompleteParam
2912      } = parameters;
2913      const onComplete = useStableCallback(onCompleteParam);
2914      const runOnceAnimationsFinish = useAnimationsFinished(ref, open, false);
2915      React11.useEffect(() => {
2916        if (!enabled) {
2917          return void 0;
2918        }
2919        const abortController = new AbortController();
2920        runOnceAnimationsFinish(onComplete, abortController.signal);
2921        return () => {
2922          abortController.abort();
2923        };
2924      }, [enabled, open, onComplete, runOnceAnimationsFinish]);
2925    }
2926  
2927    // node_modules/@base-ui/utils/useOnFirstRender.mjs
2928    var React12 = __toESM(require_react(), 1);
2929    function useOnFirstRender(fn) {
2930      const ref = React12.useRef(true);
2931      if (ref.current) {
2932        ref.current = false;
2933        fn();
2934      }
2935    }
2936  
2937    // node_modules/@base-ui/utils/platform/parts.mjs
2938    var parts_exports = {};
2939    __export(parts_exports, {
2940      engine: () => engine_exports,
2941      env: () => env_exports,
2942      os: () => os_exports,
2943      screenReader: () => screen_reader_exports
2944    });
2945  
2946    // node_modules/@base-ui/utils/platform/os.mjs
2947    var os_exports = {};
2948    __export(os_exports, {
2949      android: () => android,
2950      apple: () => apple,
2951      ios: () => ios,
2952      linux: () => linux,
2953      mac: () => mac,
2954      windows: () => windows
2955    });
2956  
2957    // node_modules/@base-ui/utils/platform/shared.mjs
2958    function readRawData() {
2959      if (typeof navigator === "undefined") {
2960        return {
2961          userAgent: "",
2962          platform: "",
2963          maxTouchPoints: 0
2964        };
2965      }
2966      if (true) {
2967        const uaData = navigator.userAgentData;
2968        if (uaData && Array.isArray(uaData.brands)) {
2969          return {
2970            userAgent: uaData.brands.map(({
2971              brand,
2972              version: version2
2973            }) => `$brand}/$version2}`).join(" "),
2974            platform: uaData.platform ?? navigator.platform ?? "",
2975            maxTouchPoints: navigator.maxTouchPoints ?? 0
2976          };
2977        }
2978      }
2979      return {
2980        userAgent: navigator.userAgent,
2981        platform: navigator.platform ?? "",
2982        maxTouchPoints: navigator.maxTouchPoints ?? 0
2983      };
2984    }
2985    var {
2986      userAgent,
2987      platform,
2988      maxTouchPoints
2989    } = readRawData();
2990    var lowerUserAgent = userAgent.toLowerCase();
2991    var lowerPlatform = platform.toLowerCase();
2992  
2993    // node_modules/@base-ui/utils/platform/os.mjs
2994    var ios = /^i(os$|p)/.test(lowerPlatform) || lowerPlatform === "macintel" && maxTouchPoints > 1;
2995    var ANDROID_STRING = "android";
2996    var android = lowerPlatform === ANDROID_STRING || lowerUserAgent.includes(ANDROID_STRING);
2997    var mac = !ios && lowerPlatform.startsWith("mac");
2998    var windows = lowerPlatform.startsWith("win");
2999    var linux = !android && /^(linux|chrome os)/.test(lowerPlatform);
3000    var apple = mac || ios;
3001  
3002    // node_modules/@base-ui/utils/platform/engine.mjs
3003    var engine_exports = {};
3004    __export(engine_exports, {
3005      blink: () => blink,
3006      gecko: () => gecko,
3007      webkit: () => webkit
3008    });
3009    var webkit = typeof CSS !== "undefined" && !!CSS.supports?.("-webkit-backdrop-filter:none");
3010    var gecko = !webkit && lowerUserAgent.includes("firefox");
3011    var blink = !webkit && lowerUserAgent.includes("chrom");
3012  
3013    // node_modules/@base-ui/utils/platform/screen-reader.mjs
3014    var screen_reader_exports = {};
3015    __export(screen_reader_exports, {
3016      voiceOver: () => voiceOver
3017    });
3018    var voiceOver = apple;
3019  
3020    // node_modules/@base-ui/utils/platform/env.mjs
3021    var env_exports = {};
3022    __export(env_exports, {
3023      jsdom: () => jsdom
3024    });
3025    var jsdom = /jsdom|happydom/.test(lowerUserAgent);
3026  
3027    // node_modules/@base-ui/utils/useTimeout.mjs
3028    var EMPTY3 = 0;
3029    var Timeout = class _Timeout {
3030      static create() {
3031        return new _Timeout();
3032      }
3033      currentId = EMPTY3;
3034      /**
3035       * Executes `fn` after `delay`, clearing any previously scheduled call.
3036       */
3037      start(delay, fn) {
3038        this.clear();
3039        this.currentId = setTimeout(() => {
3040          this.currentId = EMPTY3;
3041          fn();
3042        }, delay);
3043      }
3044      isStarted() {
3045        return this.currentId !== EMPTY3;
3046      }
3047      clear = () => {
3048        if (this.currentId !== EMPTY3) {
3049          clearTimeout(this.currentId);
3050          this.currentId = EMPTY3;
3051        }
3052      };
3053      disposeEffect = () => {
3054        return this.clear;
3055      };
3056    };
3057    function useTimeout() {
3058      const timeout = useRefWithInit(Timeout.create).current;
3059      useOnMount(timeout.disposeEffect);
3060      return timeout;
3061    }
3062  
3063    // node_modules/@base-ui/react/floating-ui-react/components/FloatingDelayGroup.mjs
3064    var React13 = __toESM(require_react(), 1);
3065  
3066    // node_modules/@base-ui/react/floating-ui-react/utils/event.mjs
3067    function isReactEvent(event) {
3068      return "nativeEvent" in event;
3069    }
3070    function isMouseLikePointerType(pointerType, strict) {
3071      const values = ["mouse", "pen"];
3072      if (!strict) {
3073        values.push("", void 0);
3074      }
3075      return values.includes(pointerType);
3076    }
3077    function isClickLikeEvent(event) {
3078      const type = event.type;
3079      return type === "click" || type === "mousedown" || type === "keydown" || type === "keyup";
3080    }
3081  
3082    // node_modules/@base-ui/react/floating-ui-react/utils/constants.mjs
3083    var FOCUSABLE_ATTRIBUTE = "data-base-ui-focusable";
3084    var TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";
3085  
3086    // node_modules/@base-ui/react/internals/shadowDom.mjs
3087    function activeElement(doc) {
3088      let element = doc.activeElement;
3089      while (element?.shadowRoot?.activeElement != null) {
3090        element = element.shadowRoot.activeElement;
3091      }
3092      return element;
3093    }
3094    function contains(parent, child) {
3095      if (!parent || !child) {
3096        return false;
3097      }
3098      const rootNode = child.getRootNode?.();
3099      if (parent.contains(child)) {
3100        return true;
3101      }
3102      if (rootNode && isShadowRoot(rootNode)) {
3103        let next = child;
3104        while (next) {
3105          if (parent === next) {
3106            return true;
3107          }
3108          next = next.parentNode || next.host;
3109        }
3110      }
3111      return false;
3112    }
3113    function getTarget(event) {
3114      if ("composedPath" in event) {
3115        return event.composedPath()[0];
3116      }
3117      return event.target;
3118    }
3119  
3120    // node_modules/@base-ui/react/floating-ui-react/utils/element.mjs
3121    function isTargetInsideEnabledTrigger(target, triggerElements) {
3122      if (!isElement(target)) {
3123        return false;
3124      }
3125      const targetElement = target;
3126      if (triggerElements.hasElement(targetElement)) {
3127        return !targetElement.hasAttribute("data-trigger-disabled");
3128      }
3129      for (const [, trigger] of triggerElements.entries()) {
3130        if (contains(trigger, targetElement)) {
3131          return !trigger.hasAttribute("data-trigger-disabled");
3132        }
3133      }
3134      return false;
3135    }
3136    function isEventTargetWithin(event, node) {
3137      if (node == null) {
3138        return false;
3139      }
3140      if ("composedPath" in event) {
3141        return event.composedPath().includes(node);
3142      }
3143      const eventAgain = event;
3144      return eventAgain.target != null && node.contains(eventAgain.target);
3145    }
3146    function isRootElement(element) {
3147      return element.matches("html,body");
3148    }
3149    function isTypeableElement(element) {
3150      return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR);
3151    }
3152    function isInteractiveElement(element) {
3153      return element?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),$TYPEABLE_SELECTOR}`) != null;
3154    }
3155    function matchesFocusVisible(element) {
3156      if (!element || parts_exports.env.jsdom) {
3157        return true;
3158      }
3159      try {
3160        return element.matches(":focus-visible");
3161      } catch (_e) {
3162        return true;
3163      }
3164    }
3165  
3166    // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverShared.mjs
3167    function resolveValue(value, pointerType) {
3168      if (pointerType != null && !isMouseLikePointerType(pointerType)) {
3169        return 0;
3170      }
3171      if (typeof value === "function") {
3172        return value();
3173      }
3174      return value;
3175    }
3176    function getDelay(value, prop, pointerType) {
3177      const result = resolveValue(value, pointerType);
3178      if (typeof result === "number") {
3179        return result;
3180      }
3181      return result?.[prop];
3182    }
3183    function getRestMs(value) {
3184      if (typeof value === "function") {
3185        return value();
3186      }
3187      return value;
3188    }
3189    function isClickLikeOpenEvent(openEventType, interactedInside) {
3190      return interactedInside || openEventType === "click" || openEventType === "mousedown";
3191    }
3192    function isHoverOpenEvent(openEventType) {
3193      return openEventType?.includes("mouse") && openEventType !== "mousedown";
3194    }
3195  
3196    // node_modules/@base-ui/react/floating-ui-react/components/FloatingDelayGroup.mjs
3197    var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1);
3198    var FloatingDelayGroupContext = /* @__PURE__ */ React13.createContext({
3199      hasProvider: false,
3200      timeoutMs: 0,
3201      delayRef: {
3202        current: 0
3203      },
3204      initialDelayRef: {
3205        current: 0
3206      },
3207      timeout: new Timeout(),
3208      currentIdRef: {
3209        current: null
3210      },
3211      currentContextRef: {
3212        current: null
3213      }
3214    });
3215    if (true) FloatingDelayGroupContext.displayName = "FloatingDelayGroupContext";
3216    function resetDelayRef(delayRef, initialDelayRef) {
3217      delayRef.current = initialDelayRef.current;
3218    }
3219    function FloatingDelayGroup(props) {
3220      const {
3221        children,
3222        delay,
3223        timeoutMs = 0
3224      } = props;
3225      const delayRef = React13.useRef(delay);
3226      const initialDelayRef = React13.useRef(delay);
3227      const currentIdRef = React13.useRef(null);
3228      const currentContextRef = React13.useRef(null);
3229      const timeout = useTimeout();
3230      useIsoLayoutEffect(() => {
3231        initialDelayRef.current = delay;
3232        if (!currentIdRef.current) {
3233          delayRef.current = delay;
3234          return;
3235        }
3236        delayRef.current = {
3237          open: getDelay(delayRef.current, "open"),
3238          close: getDelay(delay, "close")
3239        };
3240      }, [delay, currentIdRef, delayRef, initialDelayRef]);
3241      return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(FloatingDelayGroupContext.Provider, {
3242        value: React13.useMemo(() => ({
3243          hasProvider: true,
3244          delayRef,
3245          initialDelayRef,
3246          currentIdRef,
3247          timeoutMs,
3248          currentContextRef,
3249          timeout
3250        }), [timeoutMs, timeout]),
3251        children
3252      });
3253    }
3254    function useDelayGroup(context, options = {
3255      open: false
3256    }) {
3257      const {
3258        open
3259      } = options;
3260      const store = "rootStore" in context ? context.rootStore : context;
3261      const floatingId = store.useState("floatingId");
3262      const groupContext = React13.useContext(FloatingDelayGroupContext);
3263      const {
3264        currentIdRef,
3265        delayRef,
3266        timeoutMs,
3267        initialDelayRef,
3268        currentContextRef,
3269        hasProvider,
3270        timeout
3271      } = groupContext;
3272      const [isInstantPhase, setIsInstantPhase] = React13.useState(false);
3273      const openRef = React13.useRef(open);
3274      const isUnmountedRef = React13.useRef(false);
3275      useIsoLayoutEffect(() => {
3276        openRef.current = open;
3277      }, [open]);
3278      useIsoLayoutEffect(() => {
3279        return () => {
3280          isUnmountedRef.current = true;
3281        };
3282      }, []);
3283      useIsoLayoutEffect(() => {
3284        function unset() {
3285          if (!isUnmountedRef.current) {
3286            setIsInstantPhase(false);
3287          }
3288          currentContextRef.current?.setIsInstantPhase(false);
3289          currentIdRef.current = null;
3290          currentContextRef.current = null;
3291          delayRef.current = initialDelayRef.current;
3292          timeout.clear();
3293        }
3294        if (!currentIdRef.current) {
3295          return void 0;
3296        }
3297        if (!open && currentIdRef.current === floatingId) {
3298          setIsInstantPhase(false);
3299          if (timeoutMs) {
3300            const closingId = floatingId;
3301            timeout.start(timeoutMs, () => {
3302              if (store.select("open") || currentIdRef.current && currentIdRef.current !== closingId) {
3303                return;
3304              }
3305              unset();
3306            });
3307            return () => {
3308              if (openRef.current || currentIdRef.current !== closingId) {
3309                timeout.clear();
3310              }
3311            };
3312          }
3313          unset();
3314        }
3315        return void 0;
3316      }, [open, floatingId, currentIdRef, delayRef, timeoutMs, initialDelayRef, currentContextRef, timeout, store]);
3317      useIsoLayoutEffect(() => {
3318        if (!open) {
3319          return;
3320        }
3321        const prevContext = currentContextRef.current;
3322        const prevId = currentIdRef.current;
3323        timeout.clear();
3324        currentContextRef.current = {
3325          onOpenChange: store.setOpen,
3326          setIsInstantPhase
3327        };
3328        currentIdRef.current = floatingId;
3329        delayRef.current = {
3330          open: 0,
3331          close: getDelay(initialDelayRef.current, "close")
3332        };
3333        if (prevId !== null && prevId !== floatingId) {
3334          setIsInstantPhase(true);
3335          prevContext?.setIsInstantPhase(true);
3336          prevContext?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.none));
3337        } else {
3338          setIsInstantPhase(false);
3339          prevContext?.setIsInstantPhase(false);
3340        }
3341      }, [open, floatingId, store, currentIdRef, delayRef, initialDelayRef, currentContextRef, timeout]);
3342      useIsoLayoutEffect(() => {
3343        return () => {
3344          if (currentIdRef.current === floatingId) {
3345            currentContextRef.current = null;
3346            if (!openRef.current) {
3347              return;
3348            }
3349            currentIdRef.current = null;
3350            resetDelayRef(delayRef, initialDelayRef);
3351            timeout.clear();
3352          }
3353        };
3354      }, [currentContextRef, currentIdRef, delayRef, floatingId, initialDelayRef, timeout]);
3355      return React13.useMemo(() => ({
3356        hasProvider,
3357        delayRef,
3358        isInstantPhase
3359      }), [hasProvider, delayRef, isInstantPhase]);
3360    }
3361  
3362    // node_modules/@base-ui/utils/mergeCleanups.mjs
3363    function mergeCleanups(...cleanups) {
3364      return () => {
3365        for (let i2 = 0; i2 < cleanups.length; i2 += 1) {
3366          const cleanup = cleanups[i2];
3367          if (cleanup) {
3368            cleanup();
3369          }
3370        }
3371      };
3372    }
3373  
3374    // node_modules/@base-ui/react/utils/FocusGuard.mjs
3375    var React14 = __toESM(require_react(), 1);
3376  
3377    // node_modules/@base-ui/utils/visuallyHidden.mjs
3378    var visuallyHiddenBase = {
3379      clipPath: "inset(50%)",
3380      overflow: "hidden",
3381      whiteSpace: "nowrap",
3382      border: 0,
3383      padding: 0,
3384      width: 1,
3385      height: 1,
3386      margin: -1
3387    };
3388    var visuallyHidden = {
3389      ...visuallyHiddenBase,
3390      position: "fixed",
3391      top: 0,
3392      left: 0
3393    };
3394    var visuallyHiddenInput = {
3395      ...visuallyHiddenBase,
3396      position: "absolute"
3397    };
3398  
3399    // node_modules/@base-ui/react/utils/FocusGuard.mjs
3400    var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1);
3401    var FocusGuard = /* @__PURE__ */ React14.forwardRef(function FocusGuard2(props, ref) {
3402      const [role, setRole] = React14.useState();
3403      useIsoLayoutEffect(() => {
3404        if (parts_exports.screenReader.voiceOver && parts_exports.engine.webkit) {
3405          setRole("button");
3406        }
3407      }, []);
3408      const restProps = {
3409        tabIndex: 0,
3410        // Role is only for VoiceOver
3411        role
3412      };
3413      return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", {
3414        ...props,
3415        ref,
3416        style: visuallyHidden,
3417        "aria-hidden": role ? void 0 : true,
3418        ...restProps,
3419        "data-base-ui-focus-guard": ""
3420      });
3421    });
3422    if (true) FocusGuard.displayName = "FocusGuard";
3423  
3424    // node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
3425    var sides = ["top", "right", "bottom", "left"];
3426    var min = Math.min;
3427    var max = Math.max;
3428    var round = Math.round;
3429    var floor = Math.floor;
3430    var createCoords = (v2) => ({
3431      x: v2,
3432      y: v2
3433    });
3434    var oppositeSideMap = {
3435      left: "right",
3436      right: "left",
3437      bottom: "top",
3438      top: "bottom"
3439    };
3440    function clamp(start, value, end) {
3441      return max(start, min(value, end));
3442    }
3443    function evaluate(value, param) {
3444      return typeof value === "function" ? value(param) : value;
3445    }
3446    function getSide(placement) {
3447      return placement.split("-")[0];
3448    }
3449    function getAlignment(placement) {
3450      return placement.split("-")[1];
3451    }
3452    function getOppositeAxis(axis) {
3453      return axis === "x" ? "y" : "x";
3454    }
3455    function getAxisLength(axis) {
3456      return axis === "y" ? "height" : "width";
3457    }
3458    function getSideAxis(placement) {
3459      const firstChar = placement[0];
3460      return firstChar === "t" || firstChar === "b" ? "y" : "x";
3461    }
3462    function getAlignmentAxis(placement) {
3463      return getOppositeAxis(getSideAxis(placement));
3464    }
3465    function getAlignmentSides(placement, rects, rtl) {
3466      if (rtl === void 0) {
3467        rtl = false;
3468      }
3469      const alignment = getAlignment(placement);
3470      const alignmentAxis = getAlignmentAxis(placement);
3471      const length = getAxisLength(alignmentAxis);
3472      let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
3473      if (rects.reference[length] > rects.floating[length]) {
3474        mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
3475      }
3476      return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
3477    }
3478    function getExpandedPlacements(placement) {
3479      const oppositePlacement = getOppositePlacement(placement);
3480      return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
3481    }
3482    function getOppositeAlignmentPlacement(placement) {
3483      return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start");
3484    }
3485    var lrPlacement = ["left", "right"];
3486    var rlPlacement = ["right", "left"];
3487    var tbPlacement = ["top", "bottom"];
3488    var btPlacement = ["bottom", "top"];
3489    function getSideList(side, isStart, rtl) {
3490      switch (side) {
3491        case "top":
3492        case "bottom":
3493          if (rtl) return isStart ? rlPlacement : lrPlacement;
3494          return isStart ? lrPlacement : rlPlacement;
3495        case "left":
3496        case "right":
3497          return isStart ? tbPlacement : btPlacement;
3498        default:
3499          return [];
3500      }
3501    }
3502    function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
3503      const alignment = getAlignment(placement);
3504      let list = getSideList(getSide(placement), direction === "start", rtl);
3505      if (alignment) {
3506        list = list.map((side) => side + "-" + alignment);
3507        if (flipAlignment) {
3508          list = list.concat(list.map(getOppositeAlignmentPlacement));
3509        }
3510      }
3511      return list;
3512    }
3513    function getOppositePlacement(placement) {
3514      const side = getSide(placement);
3515      return oppositeSideMap[side] + placement.slice(side.length);
3516    }
3517    function expandPaddingObject(padding) {
3518      return {
3519        top: 0,
3520        right: 0,
3521        bottom: 0,
3522        left: 0,
3523        ...padding
3524      };
3525    }
3526    function getPaddingObject(padding) {
3527      return typeof padding !== "number" ? expandPaddingObject(padding) : {
3528        top: padding,
3529        right: padding,
3530        bottom: padding,
3531        left: padding
3532      };
3533    }
3534    function rectToClientRect(rect) {
3535      const {
3536        x: x2,
3537        y: y2,
3538        width,
3539        height
3540      } = rect;
3541      return {
3542        width,
3543        height,
3544        top: y2,
3545        left: x2,
3546        right: x2 + width,
3547        bottom: y2 + height,
3548        x: x2,
3549        y: y2
3550      };
3551    }
3552  
3553    // node_modules/@base-ui/react/floating-ui-react/utils/composite.mjs
3554    function isHiddenByStyles(styles) {
3555      return styles.visibility === "hidden" || styles.visibility === "collapse";
3556    }
3557    function isElementVisible(element, styles = element ? getComputedStyle2(element) : null) {
3558      if (!element || !element.isConnected || !styles || isHiddenByStyles(styles)) {
3559        return false;
3560      }
3561      if (typeof element.checkVisibility === "function") {
3562        return element.checkVisibility();
3563      }
3564      return styles.display !== "none" && styles.display !== "contents";
3565    }
3566  
3567    // node_modules/@base-ui/react/floating-ui-react/utils/tabbable.mjs
3568    var CANDIDATE_SELECTOR = 'a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';
3569    function getParentElement(element) {
3570      const assignedSlot = element.assignedSlot;
3571      if (assignedSlot) {
3572        return assignedSlot;
3573      }
3574      if (element.parentElement) {
3575        return element.parentElement;
3576      }
3577      const rootNode = element.getRootNode();
3578      return isShadowRoot(rootNode) ? rootNode.host : null;
3579    }
3580    function getDetailsSummary(details) {
3581      for (const child of Array.from(details.children)) {
3582        if (getNodeName(child) === "summary") {
3583          return child;
3584        }
3585      }
3586      return null;
3587    }
3588    function isWithinOpenDetailsSummary(element, details) {
3589      const summary = getDetailsSummary(details);
3590      return !!summary && (element === summary || contains(summary, element));
3591    }
3592    function isFocusableCandidate(element) {
3593      const nodeName = element ? getNodeName(element) : "";
3594      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");
3595    }
3596    function isFocusableElement(element) {
3597      if (!isFocusableCandidate(element) || !element.isConnected || element.matches(":disabled")) {
3598        return false;
3599      }
3600      for (let current = element; current; current = getParentElement(current)) {
3601        const isAncestor = current !== element;
3602        const isSlot = getNodeName(current) === "slot";
3603        if (current.hasAttribute("inert")) {
3604          return false;
3605        }
3606        if (isAncestor && getNodeName(current) === "details" && !current.open && !isWithinOpenDetailsSummary(element, current) || current.hasAttribute("hidden") || !isSlot && !isVisibleInTabbableTree(current, isAncestor)) {
3607          return false;
3608        }
3609      }
3610      return true;
3611    }
3612    function isVisibleInTabbableTree(element, isAncestor) {
3613      const styles = getComputedStyle2(element);
3614      if (!isAncestor) {
3615        return isElementVisible(element, styles);
3616      }
3617      return styles.display !== "none";
3618    }
3619    function getTabIndex(element) {
3620      const tabIndex = element.tabIndex;
3621      if (tabIndex < 0) {
3622        const nodeName = getNodeName(element);
3623        if (nodeName === "details" || nodeName === "audio" || nodeName === "video" || isHTMLElement(element) && element.isContentEditable) {
3624          return 0;
3625        }
3626      }
3627      return tabIndex;
3628    }
3629    function getNamedRadioInput(element) {
3630      if (getNodeName(element) !== "input") {
3631        return null;
3632      }
3633      const input = element;
3634      return input.type === "radio" && input.name !== "" ? input : null;
3635    }
3636    function isTabbableRadio(element, candidates) {
3637      const input = getNamedRadioInput(element);
3638      if (!input) {
3639        return true;
3640      }
3641      const checkedRadio = candidates.find((candidate) => {
3642        const radio = getNamedRadioInput(candidate);
3643        return radio?.name === input.name && radio.form === input.form && radio.checked;
3644      });
3645      if (checkedRadio) {
3646        return checkedRadio === input;
3647      }
3648      return candidates.find((candidate) => {
3649        const radio = getNamedRadioInput(candidate);
3650        return radio?.name === input.name && radio.form === input.form;
3651      }) === input;
3652    }
3653    function getComposedChildren(container) {
3654      if (isHTMLElement(container) && getNodeName(container) === "slot") {
3655        const assignedElements = container.assignedElements({
3656          flatten: true
3657        });
3658        if (assignedElements.length > 0) {
3659          return assignedElements;
3660        }
3661      }
3662      if (isHTMLElement(container) && container.shadowRoot) {
3663        return Array.from(container.shadowRoot.children);
3664      }
3665      return Array.from(container.children);
3666    }
3667    function appendCandidates(container, list) {
3668      getComposedChildren(container).forEach((child) => {
3669        if (isFocusableCandidate(child)) {
3670          list.push(child);
3671        }
3672        appendCandidates(child, list);
3673      });
3674    }
3675    function appendMatchingElements(container, selector2, list) {
3676      getComposedChildren(container).forEach((child) => {
3677        if (isHTMLElement(child) && child.matches(selector2)) {
3678          list.push(child);
3679        }
3680        appendMatchingElements(child, selector2, list);
3681      });
3682    }
3683    function focusable(container) {
3684      const candidates = [];
3685      appendCandidates(container, candidates);
3686      return candidates.filter(isFocusableElement);
3687    }
3688    function tabbable(container) {
3689      const candidates = focusable(container);
3690      return candidates.filter((element) => getTabIndex(element) >= 0 && isTabbableRadio(element, candidates));
3691    }
3692    function getTabbableIn(container, dir) {
3693      const list = tabbable(container);
3694      const len = list.length;
3695      if (len === 0) {
3696        return void 0;
3697      }
3698      const active = activeElement(ownerDocument(container));
3699      const index2 = list.indexOf(active);
3700      const nextIndex = index2 === -1 ? dir === 1 ? 0 : len - 1 : index2 + dir;
3701      return list[nextIndex];
3702    }
3703    function getNextTabbable(referenceElement) {
3704      return getTabbableIn(ownerDocument(referenceElement).body, 1) || referenceElement;
3705    }
3706    function getPreviousTabbable(referenceElement) {
3707      return getTabbableIn(ownerDocument(referenceElement).body, -1) || referenceElement;
3708    }
3709    function isOutsideEvent(event, container) {
3710      const containerElement = container || event.currentTarget;
3711      const relatedTarget = event.relatedTarget;
3712      return !relatedTarget || !contains(containerElement, relatedTarget);
3713    }
3714    function disableFocusInside(container) {
3715      const tabbableElements = tabbable(container);
3716      tabbableElements.forEach((element) => {
3717        element.dataset.tabindex = element.getAttribute("tabindex") || "";
3718        element.setAttribute("tabindex", "-1");
3719      });
3720    }
3721    function enableFocusInside(container) {
3722      const elements = [];
3723      appendMatchingElements(container, "[data-tabindex]", elements);
3724      elements.forEach((element) => {
3725        const tabindex = element.dataset.tabindex;
3726        delete element.dataset.tabindex;
3727        if (tabindex) {
3728          element.setAttribute("tabindex", tabindex);
3729        } else {
3730          element.removeAttribute("tabindex");
3731        }
3732      });
3733    }
3734  
3735    // node_modules/@base-ui/react/floating-ui-react/utils/nodes.mjs
3736    function getNodeChildren(nodes, id, onlyOpenChildren = true) {
3737      const directChildren = nodes.filter((node) => node.parentId === id);
3738      return directChildren.flatMap((child) => [...!onlyOpenChildren || child.context?.open ? [child] : [], ...getNodeChildren(nodes, child.id, onlyOpenChildren)]);
3739    }
3740  
3741    // node_modules/@base-ui/react/floating-ui-react/utils/createAttribute.mjs
3742    function createAttribute(name) {
3743      return `data-base-ui-$name}`;
3744    }
3745  
3746    // node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs
3747    var React15 = __toESM(require_react(), 1);
3748    var ReactDOM2 = __toESM(require_react_dom(), 1);
3749  
3750    // node_modules/@base-ui/react/internals/constants.mjs
3751    var DISABLED_TRANSITIONS_STYLE = {
3752      style: {
3753        transition: "none"
3754      }
3755    };
3756    var BASE_UI_SWIPE_IGNORE_ATTRIBUTE = "data-base-ui-swipe-ignore";
3757    var LEGACY_SWIPE_IGNORE_ATTRIBUTE = "data-swipe-ignore";
3758    var BASE_UI_SWIPE_IGNORE_SELECTOR = `[$BASE_UI_SWIPE_IGNORE_ATTRIBUTE}]`;
3759    var LEGACY_SWIPE_IGNORE_SELECTOR = `[$LEGACY_SWIPE_IGNORE_ATTRIBUTE}]`;
3760    var POPUP_COLLISION_AVOIDANCE = {
3761      fallbackAxisSide: "end"
3762    };
3763    var ownerVisuallyHidden = {
3764      clipPath: "inset(50%)",
3765      position: "fixed",
3766      top: 0,
3767      left: 0
3768    };
3769  
3770    // node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs
3771    var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1);
3772    var PortalContext = /* @__PURE__ */ React15.createContext(null);
3773    if (true) PortalContext.displayName = "PortalContext";
3774    var usePortalContext = () => React15.useContext(PortalContext);
3775    var attr = createAttribute("portal");
3776    function useFloatingPortalNode(props = {}) {
3777      const {
3778        ref,
3779        container: containerProp,
3780        componentProps = EMPTY_OBJECT,
3781        elementProps
3782      } = props;
3783      const uniqueId = useId();
3784      const portalContext = usePortalContext();
3785      const parentPortalNode = portalContext?.portalNode;
3786      const [containerElement, setContainerElement] = React15.useState(null);
3787      const [portalNode, setPortalNode] = React15.useState(null);
3788      const setPortalNodeRef = useStableCallback((node) => {
3789        if (node !== null) {
3790          setPortalNode(node);
3791        }
3792      });
3793      const containerRef = React15.useRef(null);
3794      useIsoLayoutEffect(() => {
3795        if (containerProp === null) {
3796          if (containerRef.current) {
3797            containerRef.current = null;
3798            setPortalNode(null);
3799            setContainerElement(null);
3800          }
3801          return;
3802        }
3803        if (uniqueId == null) {
3804          return;
3805        }
3806        const resolvedContainer = (containerProp && (isNode(containerProp) ? containerProp : containerProp.current)) ?? parentPortalNode ?? document.body;
3807        if (resolvedContainer == null) {
3808          if (containerRef.current) {
3809            containerRef.current = null;
3810            setPortalNode(null);
3811            setContainerElement(null);
3812          }
3813          return;
3814        }
3815        if (containerRef.current !== resolvedContainer) {
3816          containerRef.current = resolvedContainer;
3817          setPortalNode(null);
3818          setContainerElement(resolvedContainer);
3819        }
3820      }, [containerProp, parentPortalNode, uniqueId]);
3821      const portalElement = useRenderElement("div", componentProps, {
3822        ref: [ref, setPortalNodeRef],
3823        props: [{
3824          id: uniqueId,
3825          [attr]: ""
3826        }, elementProps]
3827      });
3828      const portalSubtree = containerElement && portalElement ? /* @__PURE__ */ ReactDOM2.createPortal(portalElement, containerElement) : null;
3829      return {
3830        portalNode,
3831        portalSubtree
3832      };
3833    }
3834    var FloatingPortal = /* @__PURE__ */ React15.forwardRef(function FloatingPortal2(componentProps, forwardedRef) {
3835      const {
3836        render: render4,
3837        className,
3838        style,
3839        children,
3840        container,
3841        renderGuards,
3842        ...elementProps
3843      } = componentProps;
3844      const {
3845        portalNode,
3846        portalSubtree
3847      } = useFloatingPortalNode({
3848        container,
3849        ref: forwardedRef,
3850        componentProps,
3851        elementProps
3852      });
3853      const beforeOutsideRef = React15.useRef(null);
3854      const afterOutsideRef = React15.useRef(null);
3855      const beforeInsideRef = React15.useRef(null);
3856      const afterInsideRef = React15.useRef(null);
3857      const [focusManagerState, setFocusManagerState] = React15.useState(null);
3858      const focusInsideDisabledRef = React15.useRef(false);
3859      const modal = focusManagerState?.modal;
3860      const open = focusManagerState?.open;
3861      const shouldRenderGuards = typeof renderGuards === "boolean" ? renderGuards : !!focusManagerState && !focusManagerState.modal && focusManagerState.open && !!portalNode;
3862      React15.useEffect(() => {
3863        if (!portalNode || modal) {
3864          return void 0;
3865        }
3866        function onFocus(event) {
3867          if (portalNode && event.relatedTarget && isOutsideEvent(event)) {
3868            if (event.type === "focusin") {
3869              if (focusInsideDisabledRef.current) {
3870                enableFocusInside(portalNode);
3871                focusInsideDisabledRef.current = false;
3872              }
3873            } else {
3874              disableFocusInside(portalNode);
3875              focusInsideDisabledRef.current = true;
3876            }
3877          }
3878        }
3879        return mergeCleanups(addEventListener(portalNode, "focusin", onFocus, true), addEventListener(portalNode, "focusout", onFocus, true));
3880      }, [portalNode, modal]);
3881      useIsoLayoutEffect(() => {
3882        if (!portalNode || open !== true || !focusInsideDisabledRef.current) {
3883          return;
3884        }
3885        enableFocusInside(portalNode);
3886        focusInsideDisabledRef.current = false;
3887      }, [open, portalNode]);
3888      const portalContextValue = React15.useMemo(() => ({
3889        beforeOutsideRef,
3890        afterOutsideRef,
3891        beforeInsideRef,
3892        afterInsideRef,
3893        portalNode,
3894        setFocusManagerState
3895      }), [portalNode]);
3896      return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(React15.Fragment, {
3897        children: [portalSubtree, /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(PortalContext.Provider, {
3898          value: portalContextValue,
3899          children: [shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(FocusGuard, {
3900            "data-type": "outside",
3901            ref: beforeOutsideRef,
3902            onFocus: (event) => {
3903              if (isOutsideEvent(event, portalNode)) {
3904                beforeInsideRef.current?.focus();
3905              } else {
3906                const domReference = focusManagerState ? focusManagerState.domReference : null;
3907                const prevTabbable = getPreviousTabbable(domReference);
3908                prevTabbable?.focus();
3909              }
3910            }
3911          }), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", {
3912            "aria-owns": portalNode.id,
3913            style: ownerVisuallyHidden
3914          }), portalNode && /* @__PURE__ */ ReactDOM2.createPortal(children, portalNode), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(FocusGuard, {
3915            "data-type": "outside",
3916            ref: afterOutsideRef,
3917            onFocus: (event) => {
3918              if (isOutsideEvent(event, portalNode)) {
3919                afterInsideRef.current?.focus();
3920              } else {
3921                const domReference = focusManagerState ? focusManagerState.domReference : null;
3922                const nextTabbable = getNextTabbable(domReference);
3923                nextTabbable?.focus();
3924                if (focusManagerState?.closeOnFocusOut) {
3925                  focusManagerState?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.focusOut, event.nativeEvent));
3926                }
3927              }
3928            }
3929          })]
3930        })]
3931      });
3932    });
3933    if (true) FloatingPortal.displayName = "FloatingPortal";
3934  
3935    // node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs
3936    var React16 = __toESM(require_react(), 1);
3937  
3938    // node_modules/@base-ui/react/floating-ui-react/utils/createEventEmitter.mjs
3939    function createEventEmitter() {
3940      const map = /* @__PURE__ */ new Map();
3941      return {
3942        emit(event, data) {
3943          map.get(event)?.forEach((listener) => listener(data));
3944        },
3945        on(event, listener) {
3946          if (!map.has(event)) {
3947            map.set(event, /* @__PURE__ */ new Set());
3948          }
3949          map.get(event).add(listener);
3950        },
3951        off(event, listener) {
3952          map.get(event)?.delete(listener);
3953        }
3954      };
3955    }
3956  
3957    // node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs
3958    var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1);
3959    var FloatingNodeContext = /* @__PURE__ */ React16.createContext(null);
3960    if (true) FloatingNodeContext.displayName = "FloatingNodeContext";
3961    var FloatingTreeContext = /* @__PURE__ */ React16.createContext(null);
3962    if (true) FloatingTreeContext.displayName = "FloatingTreeContext";
3963    var useFloatingParentNodeId = () => React16.useContext(FloatingNodeContext)?.id || null;
3964    var useFloatingTree = (externalTree) => {
3965      const contextTree = React16.useContext(FloatingTreeContext);
3966      return externalTree ?? contextTree;
3967    };
3968  
3969    // node_modules/@base-ui/react/floating-ui-react/hooks/useClientPoint.mjs
3970    var React17 = __toESM(require_react(), 1);
3971    function createVirtualElement(domElement, data) {
3972      let offsetX = null;
3973      let offsetY = null;
3974      let isAutoUpdateEvent = false;
3975      return {
3976        contextElement: domElement || void 0,
3977        getBoundingClientRect() {
3978          const domRect = domElement?.getBoundingClientRect() || {
3979            width: 0,
3980            height: 0,
3981            x: 0,
3982            y: 0
3983          };
3984          const isXAxis = data.axis === "x" || data.axis === "both";
3985          const isYAxis = data.axis === "y" || data.axis === "both";
3986          const canTrackCursorOnAutoUpdate = ["mouseenter", "mousemove"].includes(data.dataRef.current.openEvent?.type || "") && data.pointerType !== "touch";
3987          let width = domRect.width;
3988          let height = domRect.height;
3989          let x2 = domRect.x;
3990          let y2 = domRect.y;
3991          if (offsetX == null && data.x && isXAxis) {
3992            offsetX = domRect.x - data.x;
3993          }
3994          if (offsetY == null && data.y && isYAxis) {
3995            offsetY = domRect.y - data.y;
3996          }
3997          x2 -= offsetX || 0;
3998          y2 -= offsetY || 0;
3999          width = 0;
4000          height = 0;
4001          if (!isAutoUpdateEvent || canTrackCursorOnAutoUpdate) {
4002            width = data.axis === "y" ? domRect.width : 0;
4003            height = data.axis === "x" ? domRect.height : 0;
4004            x2 = isXAxis && data.x != null ? data.x : x2;
4005            y2 = isYAxis && data.y != null ? data.y : y2;
4006          } else if (isAutoUpdateEvent && !canTrackCursorOnAutoUpdate) {
4007            height = data.axis === "x" ? domRect.height : height;
4008            width = data.axis === "y" ? domRect.width : width;
4009          }
4010          isAutoUpdateEvent = true;
4011          return {
4012            width,
4013            height,
4014            x: x2,
4015            y: y2,
4016            top: y2,
4017            right: x2 + width,
4018            bottom: y2 + height,
4019            left: x2
4020          };
4021        }
4022      };
4023    }
4024    function isMouseBasedEvent(event) {
4025      return event != null && event.clientX != null;
4026    }
4027    function useClientPoint(context, props = {}) {
4028      const {
4029        enabled = true,
4030        axis = "both"
4031      } = props;
4032      const store = "rootStore" in context ? context.rootStore : context;
4033      const open = store.useState("open");
4034      const floating = store.useState("floatingElement");
4035      const domReference = store.useState("domReferenceElement");
4036      const dataRef = store.context.dataRef;
4037      const initialRef = React17.useRef(false);
4038      const cleanupListenerRef = React17.useRef(null);
4039      const [pointerType, setPointerType] = React17.useState();
4040      const [reactive, setReactive] = React17.useState([]);
4041      const resetReference = useStableCallback((reference2) => {
4042        store.set("positionReference", reference2);
4043      });
4044      const setReference = useStableCallback((newX, newY, referenceElement) => {
4045        if (initialRef.current) {
4046          return;
4047        }
4048        if (dataRef.current.openEvent && !isMouseBasedEvent(dataRef.current.openEvent)) {
4049          return;
4050        }
4051        store.set("positionReference", createVirtualElement(referenceElement ?? domReference, {
4052          x: newX,
4053          y: newY,
4054          axis,
4055          dataRef,
4056          pointerType
4057        }));
4058      });
4059      const handleReferenceEnterOrMove = useStableCallback((event) => {
4060        if (!open) {
4061          setReference(event.clientX, event.clientY, event.currentTarget);
4062        } else if (!cleanupListenerRef.current) {
4063          setReference(event.clientX, event.clientY, event.currentTarget);
4064          setReactive([]);
4065        }
4066      });
4067      const openCheck = isMouseLikePointerType(pointerType) ? floating : open;
4068      React17.useEffect(() => {
4069        if (!enabled) {
4070          resetReference(domReference);
4071          return void 0;
4072        }
4073        if (!openCheck) {
4074          return void 0;
4075        }
4076        function cleanupListener() {
4077          cleanupListenerRef.current?.();
4078          cleanupListenerRef.current = null;
4079        }
4080        const win = getWindow(floating);
4081        function handleMouseMove(event) {
4082          const target = getTarget(event);
4083          if (!contains(floating, target)) {
4084            setReference(event.clientX, event.clientY);
4085          } else {
4086            cleanupListener();
4087          }
4088        }
4089        if (!dataRef.current.openEvent || isMouseBasedEvent(dataRef.current.openEvent)) {
4090          cleanupListenerRef.current = addEventListener(win, "mousemove", handleMouseMove);
4091        } else {
4092          resetReference(domReference);
4093        }
4094        return cleanupListener;
4095      }, [openCheck, enabled, floating, dataRef, domReference, store, setReference, resetReference, reactive]);
4096      React17.useEffect(() => () => {
4097        store.set("positionReference", null);
4098      }, [store]);
4099      React17.useEffect(() => {
4100        if (enabled && !floating) {
4101          initialRef.current = false;
4102        }
4103      }, [enabled, floating]);
4104      React17.useEffect(() => {
4105        if (!enabled && open) {
4106          initialRef.current = true;
4107        }
4108      }, [enabled, open]);
4109      const reference = React17.useMemo(() => {
4110        function setPointerTypeRef(event) {
4111          setPointerType(event.pointerType);
4112        }
4113        return {
4114          onPointerDown: setPointerTypeRef,
4115          onPointerEnter: setPointerTypeRef,
4116          onMouseMove: handleReferenceEnterOrMove,
4117          onMouseEnter: handleReferenceEnterOrMove
4118        };
4119      }, [handleReferenceEnterOrMove]);
4120      return React17.useMemo(() => enabled ? {
4121        reference,
4122        trigger: reference
4123      } : {}, [enabled, reference]);
4124    }
4125  
4126    // node_modules/@base-ui/react/floating-ui-react/hooks/useDismiss.mjs
4127    var React18 = __toESM(require_react(), 1);
4128    function alwaysFalse() {
4129      return false;
4130    }
4131    function normalizeProp(normalizable) {
4132      return {
4133        escapeKey: typeof normalizable === "boolean" ? normalizable : normalizable?.escapeKey ?? false,
4134        outsidePress: typeof normalizable === "boolean" ? normalizable : normalizable?.outsidePress ?? true
4135      };
4136    }
4137    function useDismiss(context, props = {}) {
4138      const {
4139        enabled = true,
4140        escapeKey: escapeKey2 = true,
4141        outsidePress: outsidePressProp = true,
4142        outsidePressEvent = "sloppy",
4143        referencePress = alwaysFalse,
4144        bubbles,
4145        externalTree
4146      } = props;
4147      const store = "rootStore" in context ? context.rootStore : context;
4148      const open = store.useState("open");
4149      const floatingElement = store.useState("floatingElement");
4150      const {
4151        dataRef
4152      } = store.context;
4153      const tree = useFloatingTree(externalTree);
4154      const outsidePressFn = useStableCallback(typeof outsidePressProp === "function" ? outsidePressProp : () => false);
4155      const outsidePress2 = typeof outsidePressProp === "function" ? outsidePressFn : outsidePressProp;
4156      const outsidePressEnabled = outsidePress2 !== false;
4157      const getOutsidePressEventProp = useStableCallback(() => outsidePressEvent);
4158      const {
4159        escapeKey: escapeKeyBubbles,
4160        outsidePress: outsidePressBubbles
4161      } = normalizeProp(bubbles);
4162      const pressStartedInsideRef = React18.useRef(false);
4163      const pressStartPreventedRef = React18.useRef(false);
4164      const suppressNextOutsideClickRef = React18.useRef(false);
4165      const isComposingRef = React18.useRef(false);
4166      const currentPointerTypeRef = React18.useRef("");
4167      const touchStateRef = React18.useRef(null);
4168      const cancelDismissOnEndTimeout = useTimeout();
4169      const clearInsideReactTreeTimeout = useTimeout();
4170      const clearInsideReactTree = useStableCallback(() => {
4171        clearInsideReactTreeTimeout.clear();
4172        dataRef.current.insideReactTree = false;
4173      });
4174      const hasBlockingChild = useStableCallback((bubbleKey) => {
4175        const nodeId = dataRef.current.floatingContext?.nodeId;
4176        const children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : [];
4177        return children.some((child) => child.context?.open && !child.context.dataRef.current[bubbleKey]);
4178      });
4179      const isEventWithinOwnElements = useStableCallback((event) => {
4180        return isEventTargetWithin(event, store.select("floatingElement")) || isEventTargetWithin(event, store.select("domReferenceElement"));
4181      });
4182      const closeOnReferencePress = useStableCallback((event) => {
4183        if (!referencePress()) {
4184          return;
4185        }
4186        store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerPress, event.nativeEvent));
4187      });
4188      const closeOnEscapeKeyDown = useStableCallback((event) => {
4189        if (!open || !enabled || !escapeKey2 || event.key !== "Escape") {
4190          return;
4191        }
4192        if (isComposingRef.current) {
4193          return;
4194        }
4195        if (!escapeKeyBubbles && hasBlockingChild("__escapeKeyBubbles")) {
4196          return;
4197        }
4198        const native = isReactEvent(event) ? event.nativeEvent : event;
4199        const eventDetails = createChangeEventDetails(reason_parts_exports.escapeKey, native);
4200        store.setOpen(false, eventDetails);
4201        if (!eventDetails.isCanceled) {
4202          event.preventDefault();
4203        }
4204        if (!escapeKeyBubbles && !eventDetails.isPropagationAllowed) {
4205          event.stopPropagation();
4206        }
4207      });
4208      const markInsideReactTree = useStableCallback(() => {
4209        dataRef.current.insideReactTree = true;
4210        clearInsideReactTreeTimeout.start(0, clearInsideReactTree);
4211      });
4212      const markPressStartedInsideReactTree = useStableCallback((event) => {
4213        if (!open || !enabled || event.button !== 0) {
4214          return;
4215        }
4216        const target = getTarget(event.nativeEvent);
4217        if (!contains(store.select("floatingElement"), target)) {
4218          return;
4219        }
4220        if (!pressStartedInsideRef.current) {
4221          pressStartedInsideRef.current = true;
4222          pressStartPreventedRef.current = false;
4223        }
4224      });
4225      const markInsidePressStartPrevented = useStableCallback((event) => {
4226        if (!open || !enabled) {
4227          return;
4228        }
4229        if (!(event.defaultPrevented || event.nativeEvent.defaultPrevented)) {
4230          return;
4231        }
4232        if (pressStartedInsideRef.current) {
4233          pressStartPreventedRef.current = true;
4234        }
4235      });
4236      React18.useEffect(() => {
4237        if (!open || !enabled) {
4238          return void 0;
4239        }
4240        dataRef.current.__escapeKeyBubbles = escapeKeyBubbles;
4241        dataRef.current.__outsidePressBubbles = outsidePressBubbles;
4242        const compositionTimeout = new Timeout();
4243        const preventedPressSuppressionTimeout = new Timeout();
4244        function handleCompositionStart() {
4245          compositionTimeout.clear();
4246          isComposingRef.current = true;
4247        }
4248        function handleCompositionEnd() {
4249          compositionTimeout.start(
4250            // 0ms or 1ms don't work in Safari. 5ms appears to consistently work.
4251            // Only apply to WebKit for the test to remain 0ms.
4252            parts_exports.engine.webkit ? 5 : 0,
4253            () => {
4254              isComposingRef.current = false;
4255            }
4256          );
4257        }
4258        function suppressImmediateOutsideClickAfterPreventedStart() {
4259          suppressNextOutsideClickRef.current = true;
4260          preventedPressSuppressionTimeout.start(0, () => {
4261            suppressNextOutsideClickRef.current = false;
4262          });
4263        }
4264        function resetPressStartState() {
4265          pressStartedInsideRef.current = false;
4266          pressStartPreventedRef.current = false;
4267        }
4268        function getOutsidePressEvent() {
4269          const type = currentPointerTypeRef.current;
4270          const computedType = type === "pen" || !type ? "mouse" : type;
4271          const outsidePressEventValue = getOutsidePressEventProp();
4272          const resolved = typeof outsidePressEventValue === "function" ? outsidePressEventValue() : outsidePressEventValue;
4273          if (typeof resolved === "string") {
4274            return resolved;
4275          }
4276          return resolved[computedType];
4277        }
4278        function shouldIgnoreEvent(event) {
4279          const computedOutsidePressEvent = getOutsidePressEvent();
4280          return computedOutsidePressEvent === "intentional" && event.type !== "click" || computedOutsidePressEvent === "sloppy" && event.type === "click";
4281        }
4282        function isEventWithinFloatingTree(event) {
4283          const nodeId = dataRef.current.floatingContext?.nodeId;
4284          const targetIsInsideChildren = tree && getNodeChildren(tree.nodesRef.current, nodeId).some((node) => isEventTargetWithin(event, node.context?.elements.floating));
4285          return isEventWithinOwnElements(event) || targetIsInsideChildren;
4286        }
4287        function closeOnPressOutside(event) {
4288          if (shouldIgnoreEvent(event)) {
4289            if (event.type !== "click" && !isEventWithinOwnElements(event)) {
4290              preventedPressSuppressionTimeout.clear();
4291              suppressNextOutsideClickRef.current = false;
4292            }
4293            clearInsideReactTree();
4294            return;
4295          }
4296          if (dataRef.current.insideReactTree) {
4297            clearInsideReactTree();
4298            return;
4299          }
4300          const target = getTarget(event);
4301          const inertSelector = `[$createAttribute("inert")}]`;
4302          const targetRoot = isElement(target) ? target.getRootNode() : null;
4303          const markers = Array.from((isShadowRoot(targetRoot) ? targetRoot : ownerDocument(store.select("floatingElement"))).querySelectorAll(inertSelector));
4304          const triggers = store.context.triggerElements;
4305          if (target && (triggers.hasElement(target) || triggers.hasMatchingElement((trigger) => contains(trigger, target)))) {
4306            return;
4307          }
4308          let targetRootAncestor = isElement(target) ? target : null;
4309          while (targetRootAncestor && !isLastTraversableNode(targetRootAncestor)) {
4310            const nextParent = getParentNode(targetRootAncestor);
4311            if (isLastTraversableNode(nextParent) || !isElement(nextParent)) {
4312              break;
4313            }
4314            targetRootAncestor = nextParent;
4315          }
4316          if (markers.length && isElement(target) && !isRootElement(target) && // Clicked on a direct ancestor (e.g. FloatingOverlay).
4317          !contains(target, store.select("floatingElement")) && // If the target root element contains none of the markers, then the
4318          // element was injected after the floating element rendered.
4319          markers.every((marker) => !contains(targetRootAncestor, marker))) {
4320            return;
4321          }
4322          if (isHTMLElement(target) && !("touches" in event)) {
4323            const lastTraversableNode = isLastTraversableNode(target);
4324            const style = getComputedStyle2(target);
4325            const scrollRe = /auto|scroll/;
4326            const isScrollableX = lastTraversableNode || scrollRe.test(style.overflowX);
4327            const isScrollableY = lastTraversableNode || scrollRe.test(style.overflowY);
4328            const canScrollX = isScrollableX && target.clientWidth > 0 && target.scrollWidth > target.clientWidth;
4329            const canScrollY = isScrollableY && target.clientHeight > 0 && target.scrollHeight > target.clientHeight;
4330            const isRTL7 = style.direction === "rtl";
4331            const pressedVerticalScrollbar = canScrollY && (isRTL7 ? event.offsetX <= target.offsetWidth - target.clientWidth : event.offsetX > target.clientWidth);
4332            const pressedHorizontalScrollbar = canScrollX && event.offsetY > target.clientHeight;
4333            if (pressedVerticalScrollbar || pressedHorizontalScrollbar) {
4334              return;
4335            }
4336          }
4337          if (isEventWithinFloatingTree(event)) {
4338            return;
4339          }
4340          if (getOutsidePressEvent() === "intentional" && suppressNextOutsideClickRef.current) {
4341            preventedPressSuppressionTimeout.clear();
4342            suppressNextOutsideClickRef.current = false;
4343            return;
4344          }
4345          if (typeof outsidePress2 === "function" && !outsidePress2(event)) {
4346            return;
4347          }
4348          if (hasBlockingChild("__outsidePressBubbles")) {
4349            return;
4350          }
4351          store.setOpen(false, createChangeEventDetails(reason_parts_exports.outsidePress, event));
4352          clearInsideReactTree();
4353        }
4354        function handlePointerDown(event) {
4355          if (getOutsidePressEvent() !== "sloppy" || event.pointerType === "touch" || !store.select("open") || !enabled || isEventWithinOwnElements(event)) {
4356            return;
4357          }
4358          closeOnPressOutside(event);
4359        }
4360        function handleTouchStart(event) {
4361          if (getOutsidePressEvent() !== "sloppy" || !store.select("open") || !enabled || isEventWithinOwnElements(event)) {
4362            return;
4363          }
4364          const touch = event.touches[0];
4365          if (touch) {
4366            touchStateRef.current = {
4367              startTime: Date.now(),
4368              startX: touch.clientX,
4369              startY: touch.clientY,
4370              dismissOnTouchEnd: false,
4371              dismissOnMouseDown: true
4372            };
4373            cancelDismissOnEndTimeout.start(1e3, () => {
4374              if (touchStateRef.current) {
4375                touchStateRef.current.dismissOnTouchEnd = false;
4376                touchStateRef.current.dismissOnMouseDown = false;
4377              }
4378            });
4379          }
4380        }
4381        function addTargetEventListenerOnce(event, listener) {
4382          const target = getTarget(event);
4383          if (!target) {
4384            return;
4385          }
4386          const unsubscribe2 = addEventListener(target, event.type, () => {
4387            listener(event);
4388            unsubscribe2();
4389          });
4390        }
4391        function handleTouchStartCapture(event) {
4392          currentPointerTypeRef.current = "touch";
4393          addTargetEventListenerOnce(event, handleTouchStart);
4394        }
4395        function closeOnPressOutsideCapture(event) {
4396          cancelDismissOnEndTimeout.clear();
4397          if (event.type === "pointerdown") {
4398            currentPointerTypeRef.current = event.pointerType;
4399          }
4400          if (event.type === "mousedown" && touchStateRef.current && !touchStateRef.current.dismissOnMouseDown) {
4401            return;
4402          }
4403          addTargetEventListenerOnce(event, (targetEvent) => {
4404            if (targetEvent.type === "pointerdown") {
4405              handlePointerDown(targetEvent);
4406            } else {
4407              closeOnPressOutside(targetEvent);
4408            }
4409          });
4410        }
4411        function handlePressEndCapture(event) {
4412          if (!pressStartedInsideRef.current) {
4413            return;
4414          }
4415          const pressStartedInsideDefaultPrevented = pressStartPreventedRef.current;
4416          resetPressStartState();
4417          if (getOutsidePressEvent() !== "intentional") {
4418            return;
4419          }
4420          if (event.type === "pointercancel") {
4421            if (pressStartedInsideDefaultPrevented) {
4422              suppressImmediateOutsideClickAfterPreventedStart();
4423            }
4424            return;
4425          }
4426          if (isEventWithinFloatingTree(event)) {
4427            return;
4428          }
4429          if (pressStartedInsideDefaultPrevented) {
4430            suppressImmediateOutsideClickAfterPreventedStart();
4431            return;
4432          }
4433          if (typeof outsidePress2 === "function" && !outsidePress2(event)) {
4434            return;
4435          }
4436          preventedPressSuppressionTimeout.clear();
4437          suppressNextOutsideClickRef.current = true;
4438          clearInsideReactTree();
4439        }
4440        function handleTouchMove(event) {
4441          if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) {
4442            return;
4443          }
4444          const touch = event.touches[0];
4445          if (!touch) {
4446            return;
4447          }
4448          const deltaX = Math.abs(touch.clientX - touchStateRef.current.startX);
4449          const deltaY = Math.abs(touch.clientY - touchStateRef.current.startY);
4450          const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
4451          if (distance > 5) {
4452            touchStateRef.current.dismissOnTouchEnd = true;
4453          }
4454          if (distance > 10) {
4455            closeOnPressOutside(event);
4456            cancelDismissOnEndTimeout.clear();
4457            touchStateRef.current = null;
4458          }
4459        }
4460        function handleTouchMoveCapture(event) {
4461          addTargetEventListenerOnce(event, handleTouchMove);
4462        }
4463        function handleTouchEnd(event) {
4464          if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) {
4465            return;
4466          }
4467          if (touchStateRef.current.dismissOnTouchEnd) {
4468            closeOnPressOutside(event);
4469          }
4470          cancelDismissOnEndTimeout.clear();
4471          touchStateRef.current = null;
4472        }
4473        function handleTouchEndCapture(event) {
4474          addTargetEventListenerOnce(event, handleTouchEnd);
4475        }
4476        const doc = ownerDocument(floatingElement);
4477        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, true), addEventListener(doc, "touchmove", handleTouchMoveCapture, true), addEventListener(doc, "touchend", handleTouchEndCapture, true)));
4478        return () => {
4479          unsubscribe();
4480          compositionTimeout.clear();
4481          preventedPressSuppressionTimeout.clear();
4482          resetPressStartState();
4483          suppressNextOutsideClickRef.current = false;
4484        };
4485      }, [dataRef, floatingElement, escapeKey2, outsidePressEnabled, outsidePress2, open, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, clearInsideReactTree, getOutsidePressEventProp, hasBlockingChild, isEventWithinOwnElements, tree, store, cancelDismissOnEndTimeout]);
4486      React18.useEffect(clearInsideReactTree, [outsidePress2, clearInsideReactTree]);
4487      const reference = React18.useMemo(() => ({
4488        onKeyDown: closeOnEscapeKeyDown,
4489        onPointerDown: closeOnReferencePress,
4490        onClick: closeOnReferencePress
4491      }), [closeOnEscapeKeyDown, closeOnReferencePress]);
4492      const floating = React18.useMemo(() => ({
4493        onKeyDown: closeOnEscapeKeyDown,
4494        // `onMouseDown` may be blocked if `event.preventDefault()` is called in
4495        // `onPointerDown`, such as with <NumberField.ScrubArea>.
4496        // See https://github.com/mui/base-ui/pull/3379
4497        onPointerDown: markInsidePressStartPrevented,
4498        onMouseDown: markInsidePressStartPrevented,
4499        onClickCapture: markInsideReactTree,
4500        onMouseDownCapture(event) {
4501          markInsideReactTree();
4502          markPressStartedInsideReactTree(event);
4503        },
4504        onPointerDownCapture(event) {
4505          markInsideReactTree();
4506          markPressStartedInsideReactTree(event);
4507        },
4508        onMouseUpCapture: markInsideReactTree,
4509        onTouchEndCapture: markInsideReactTree,
4510        onTouchMoveCapture: markInsideReactTree
4511      }), [closeOnEscapeKeyDown, markInsideReactTree, markPressStartedInsideReactTree, markInsidePressStartPrevented]);
4512      return React18.useMemo(() => enabled ? {
4513        reference,
4514        floating,
4515        trigger: reference
4516      } : {}, [enabled, reference, floating]);
4517    }
4518  
4519    // node_modules/@base-ui/react/floating-ui-react/hooks/useFloating.mjs
4520    var React25 = __toESM(require_react(), 1);
4521  
4522    // node_modules/@floating-ui/core/dist/floating-ui.core.mjs
4523    function computeCoordsFromPlacement(_ref, placement, rtl) {
4524      let {
4525        reference,
4526        floating
4527      } = _ref;
4528      const sideAxis = getSideAxis(placement);
4529      const alignmentAxis = getAlignmentAxis(placement);
4530      const alignLength = getAxisLength(alignmentAxis);
4531      const side = getSide(placement);
4532      const isVertical = sideAxis === "y";
4533      const commonX = reference.x + reference.width / 2 - floating.width / 2;
4534      const commonY = reference.y + reference.height / 2 - floating.height / 2;
4535      const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
4536      let coords;
4537      switch (side) {
4538        case "top":
4539          coords = {
4540            x: commonX,
4541            y: reference.y - floating.height
4542          };
4543          break;
4544        case "bottom":
4545          coords = {
4546            x: commonX,
4547            y: reference.y + reference.height
4548          };
4549          break;
4550        case "right":
4551          coords = {
4552            x: reference.x + reference.width,
4553            y: commonY
4554          };
4555          break;
4556        case "left":
4557          coords = {
4558            x: reference.x - floating.width,
4559            y: commonY
4560          };
4561          break;
4562        default:
4563          coords = {
4564            x: reference.x,
4565            y: reference.y
4566          };
4567      }
4568      switch (getAlignment(placement)) {
4569        case "start":
4570          coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
4571          break;
4572        case "end":
4573          coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
4574          break;
4575      }
4576      return coords;
4577    }
4578    async function detectOverflow(state, options) {
4579      var _await$platform$isEle;
4580      if (options === void 0) {
4581        options = {};
4582      }
4583      const {
4584        x: x2,
4585        y: y2,
4586        platform: platform3,
4587        rects,
4588        elements,
4589        strategy
4590      } = state;
4591      const {
4592        boundary = "clippingAncestors",
4593        rootBoundary = "viewport",
4594        elementContext = "floating",
4595        altBoundary = false,
4596        padding = 0
4597      } = evaluate(options, state);
4598      const paddingObject = getPaddingObject(padding);
4599      const altContext = elementContext === "floating" ? "reference" : "floating";
4600      const element = elements[altBoundary ? altContext : elementContext];
4601      const clippingClientRect = rectToClientRect(await platform3.getClippingRect({
4602        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)),
4603        boundary,
4604        rootBoundary,
4605        strategy
4606      }));
4607      const rect = elementContext === "floating" ? {
4608        x: x2,
4609        y: y2,
4610        width: rects.floating.width,
4611        height: rects.floating.height
4612      } : rects.reference;
4613      const offsetParent = await (platform3.getOffsetParent == null ? void 0 : platform3.getOffsetParent(elements.floating));
4614      const offsetScale = await (platform3.isElement == null ? void 0 : platform3.isElement(offsetParent)) ? await (platform3.getScale == null ? void 0 : platform3.getScale(offsetParent)) || {
4615        x: 1,
4616        y: 1
4617      } : {
4618        x: 1,
4619        y: 1
4620      };
4621      const elementClientRect = rectToClientRect(platform3.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform3.convertOffsetParentRelativeRectToViewportRelativeRect({
4622        elements,
4623        rect,
4624        offsetParent,
4625        strategy
4626      }) : rect);
4627      return {
4628        top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
4629        bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
4630        left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
4631        right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
4632      };
4633    }
4634    var MAX_RESET_COUNT = 50;
4635    var computePosition = async (reference, floating, config) => {
4636      const {
4637        placement = "bottom",
4638        strategy = "absolute",
4639        middleware = [],
4640        platform: platform3
4641      } = config;
4642      const platformWithDetectOverflow = platform3.detectOverflow ? platform3 : {
4643        ...platform3,
4644        detectOverflow
4645      };
4646      const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(floating));
4647      let rects = await platform3.getElementRects({
4648        reference,
4649        floating,
4650        strategy
4651      });
4652      let {
4653        x: x2,
4654        y: y2
4655      } = computeCoordsFromPlacement(rects, placement, rtl);
4656      let statefulPlacement = placement;
4657      let resetCount = 0;
4658      const middlewareData = {};
4659      for (let i2 = 0; i2 < middleware.length; i2++) {
4660        const currentMiddleware = middleware[i2];
4661        if (!currentMiddleware) {
4662          continue;
4663        }
4664        const {
4665          name,
4666          fn
4667        } = currentMiddleware;
4668        const {
4669          x: nextX,
4670          y: nextY,
4671          data,
4672          reset
4673        } = await fn({
4674          x: x2,
4675          y: y2,
4676          initialPlacement: placement,
4677          placement: statefulPlacement,
4678          strategy,
4679          middlewareData,
4680          rects,
4681          platform: platformWithDetectOverflow,
4682          elements: {
4683            reference,
4684            floating
4685          }
4686        });
4687        x2 = nextX != null ? nextX : x2;
4688        y2 = nextY != null ? nextY : y2;
4689        middlewareData[name] = {
4690          ...middlewareData[name],
4691          ...data
4692        };
4693        if (reset && resetCount < MAX_RESET_COUNT) {
4694          resetCount++;
4695          if (typeof reset === "object") {
4696            if (reset.placement) {
4697              statefulPlacement = reset.placement;
4698            }
4699            if (reset.rects) {
4700              rects = reset.rects === true ? await platform3.getElementRects({
4701                reference,
4702                floating,
4703                strategy
4704              }) : reset.rects;
4705            }
4706            ({
4707              x: x2,
4708              y: y2
4709            } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
4710          }
4711          i2 = -1;
4712        }
4713      }
4714      return {
4715        x: x2,
4716        y: y2,
4717        placement: statefulPlacement,
4718        strategy,
4719        middlewareData
4720      };
4721    };
4722    var flip = function(options) {
4723      if (options === void 0) {
4724        options = {};
4725      }
4726      return {
4727        name: "flip",
4728        options,
4729        async fn(state) {
4730          var _middlewareData$arrow, _middlewareData$flip;
4731          const {
4732            placement,
4733            middlewareData,
4734            rects,
4735            initialPlacement,
4736            platform: platform3,
4737            elements
4738          } = state;
4739          const {
4740            mainAxis: checkMainAxis = true,
4741            crossAxis: checkCrossAxis = true,
4742            fallbackPlacements: specifiedFallbackPlacements,
4743            fallbackStrategy = "bestFit",
4744            fallbackAxisSideDirection = "none",
4745            flipAlignment = true,
4746            ...detectOverflowOptions
4747          } = evaluate(options, state);
4748          if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
4749            return {};
4750          }
4751          const side = getSide(placement);
4752          const initialSideAxis = getSideAxis(initialPlacement);
4753          const isBasePlacement = getSide(initialPlacement) === initialPlacement;
4754          const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating));
4755          const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
4756          const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
4757          if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
4758            fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
4759          }
4760          const placements2 = [initialPlacement, ...fallbackPlacements];
4761          const overflow = await platform3.detectOverflow(state, detectOverflowOptions);
4762          const overflows = [];
4763          let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
4764          if (checkMainAxis) {
4765            overflows.push(overflow[side]);
4766          }
4767          if (checkCrossAxis) {
4768            const sides2 = getAlignmentSides(placement, rects, rtl);
4769            overflows.push(overflow[sides2[0]], overflow[sides2[1]]);
4770          }
4771          overflowsData = [...overflowsData, {
4772            placement,
4773            overflows
4774          }];
4775          if (!overflows.every((side2) => side2 <= 0)) {
4776            var _middlewareData$flip2, _overflowsData$filter;
4777            const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
4778            const nextPlacement = placements2[nextIndex];
4779            if (nextPlacement) {
4780              const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false;
4781              if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis
4782              // overflows the main axis.
4783              overflowsData.every((d2) => getSideAxis(d2.placement) === initialSideAxis ? d2.overflows[0] > 0 : true)) {
4784                return {
4785                  data: {
4786                    index: nextIndex,
4787                    overflows: overflowsData
4788                  },
4789                  reset: {
4790                    placement: nextPlacement
4791                  }
4792                };
4793              }
4794            }
4795            let resetPlacement = (_overflowsData$filter = overflowsData.filter((d2) => d2.overflows[0] <= 0).sort((a2, b2) => a2.overflows[1] - b2.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
4796            if (!resetPlacement) {
4797              switch (fallbackStrategy) {
4798                case "bestFit": {
4799                  var _overflowsData$filter2;
4800                  const placement2 = (_overflowsData$filter2 = overflowsData.filter((d2) => {
4801                    if (hasFallbackAxisSideDirection) {
4802                      const currentSideAxis = getSideAxis(d2.placement);
4803                      return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal
4804                      // reading directions favoring greater width.
4805                      currentSideAxis === "y";
4806                    }
4807                    return true;
4808                  }).map((d2) => [d2.placement, d2.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a2, b2) => a2[1] - b2[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
4809                  if (placement2) {
4810                    resetPlacement = placement2;
4811                  }
4812                  break;
4813                }
4814                case "initialPlacement":
4815                  resetPlacement = initialPlacement;
4816                  break;
4817              }
4818            }
4819            if (placement !== resetPlacement) {
4820              return {
4821                reset: {
4822                  placement: resetPlacement
4823                }
4824              };
4825            }
4826          }
4827          return {};
4828        }
4829      };
4830    };
4831    function getSideOffsets(overflow, rect) {
4832      return {
4833        top: overflow.top - rect.height,
4834        right: overflow.right - rect.width,
4835        bottom: overflow.bottom - rect.height,
4836        left: overflow.left - rect.width
4837      };
4838    }
4839    function isAnySideFullyClipped(overflow) {
4840      return sides.some((side) => overflow[side] >= 0);
4841    }
4842    var hide = function(options) {
4843      if (options === void 0) {
4844        options = {};
4845      }
4846      return {
4847        name: "hide",
4848        options,
4849        async fn(state) {
4850          const {
4851            rects,
4852            platform: platform3
4853          } = state;
4854          const {
4855            strategy = "referenceHidden",
4856            ...detectOverflowOptions
4857          } = evaluate(options, state);
4858          switch (strategy) {
4859            case "referenceHidden": {
4860              const overflow = await platform3.detectOverflow(state, {
4861                ...detectOverflowOptions,
4862                elementContext: "reference"
4863              });
4864              const offsets = getSideOffsets(overflow, rects.reference);
4865              return {
4866                data: {
4867                  referenceHiddenOffsets: offsets,
4868                  referenceHidden: isAnySideFullyClipped(offsets)
4869                }
4870              };
4871            }
4872            case "escaped": {
4873              const overflow = await platform3.detectOverflow(state, {
4874                ...detectOverflowOptions,
4875                altBoundary: true
4876              });
4877              const offsets = getSideOffsets(overflow, rects.floating);
4878              return {
4879                data: {
4880                  escapedOffsets: offsets,
4881                  escaped: isAnySideFullyClipped(offsets)
4882                }
4883              };
4884            }
4885            default: {
4886              return {};
4887            }
4888          }
4889        }
4890      };
4891    };
4892    var originSides = /* @__PURE__ */ new Set(["left", "top"]);
4893    async function convertValueToCoords(state, options) {
4894      const {
4895        placement,
4896        platform: platform3,
4897        elements
4898      } = state;
4899      const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating));
4900      const side = getSide(placement);
4901      const alignment = getAlignment(placement);
4902      const isVertical = getSideAxis(placement) === "y";
4903      const mainAxisMulti = originSides.has(side) ? -1 : 1;
4904      const crossAxisMulti = rtl && isVertical ? -1 : 1;
4905      const rawValue = evaluate(options, state);
4906      let {
4907        mainAxis,
4908        crossAxis,
4909        alignmentAxis
4910      } = typeof rawValue === "number" ? {
4911        mainAxis: rawValue,
4912        crossAxis: 0,
4913        alignmentAxis: null
4914      } : {
4915        mainAxis: rawValue.mainAxis || 0,
4916        crossAxis: rawValue.crossAxis || 0,
4917        alignmentAxis: rawValue.alignmentAxis
4918      };
4919      if (alignment && typeof alignmentAxis === "number") {
4920        crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
4921      }
4922      return isVertical ? {
4923        x: crossAxis * crossAxisMulti,
4924        y: mainAxis * mainAxisMulti
4925      } : {
4926        x: mainAxis * mainAxisMulti,
4927        y: crossAxis * crossAxisMulti
4928      };
4929    }
4930    var offset = function(options) {
4931      if (options === void 0) {
4932        options = 0;
4933      }
4934      return {
4935        name: "offset",
4936        options,
4937        async fn(state) {
4938          var _middlewareData$offse, _middlewareData$arrow;
4939          const {
4940            x: x2,
4941            y: y2,
4942            placement,
4943            middlewareData
4944          } = state;
4945          const diffCoords = await convertValueToCoords(state, options);
4946          if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
4947            return {};
4948          }
4949          return {
4950            x: x2 + diffCoords.x,
4951            y: y2 + diffCoords.y,
4952            data: {
4953              ...diffCoords,
4954              placement
4955            }
4956          };
4957        }
4958      };
4959    };
4960    var shift = function(options) {
4961      if (options === void 0) {
4962        options = {};
4963      }
4964      return {
4965        name: "shift",
4966        options,
4967        async fn(state) {
4968          const {
4969            x: x2,
4970            y: y2,
4971            placement,
4972            platform: platform3
4973          } = state;
4974          const {
4975            mainAxis: checkMainAxis = true,
4976            crossAxis: checkCrossAxis = false,
4977            limiter = {
4978              fn: (_ref) => {
4979                let {
4980                  x: x3,
4981                  y: y3
4982                } = _ref;
4983                return {
4984                  x: x3,
4985                  y: y3
4986                };
4987              }
4988            },
4989            ...detectOverflowOptions
4990          } = evaluate(options, state);
4991          const coords = {
4992            x: x2,
4993            y: y2
4994          };
4995          const overflow = await platform3.detectOverflow(state, detectOverflowOptions);
4996          const crossAxis = getSideAxis(getSide(placement));
4997          const mainAxis = getOppositeAxis(crossAxis);
4998          let mainAxisCoord = coords[mainAxis];
4999          let crossAxisCoord = coords[crossAxis];
5000          if (checkMainAxis) {
5001            const minSide = mainAxis === "y" ? "top" : "left";
5002            const maxSide = mainAxis === "y" ? "bottom" : "right";
5003            const min2 = mainAxisCoord + overflow[minSide];
5004            const max2 = mainAxisCoord - overflow[maxSide];
5005            mainAxisCoord = clamp(min2, mainAxisCoord, max2);
5006          }
5007          if (checkCrossAxis) {
5008            const minSide = crossAxis === "y" ? "top" : "left";
5009            const maxSide = crossAxis === "y" ? "bottom" : "right";
5010            const min2 = crossAxisCoord + overflow[minSide];
5011            const max2 = crossAxisCoord - overflow[maxSide];
5012            crossAxisCoord = clamp(min2, crossAxisCoord, max2);
5013          }
5014          const limitedCoords = limiter.fn({
5015            ...state,
5016            [mainAxis]: mainAxisCoord,
5017            [crossAxis]: crossAxisCoord
5018          });
5019          return {
5020            ...limitedCoords,
5021            data: {
5022              x: limitedCoords.x - x2,
5023              y: limitedCoords.y - y2,
5024              enabled: {
5025                [mainAxis]: checkMainAxis,
5026                [crossAxis]: checkCrossAxis
5027              }
5028            }
5029          };
5030        }
5031      };
5032    };
5033    var limitShift = function(options) {
5034      if (options === void 0) {
5035        options = {};
5036      }
5037      return {
5038        options,
5039        fn(state) {
5040          const {
5041            x: x2,
5042            y: y2,
5043            placement,
5044            rects,
5045            middlewareData
5046          } = state;
5047          const {
5048            offset: offset4 = 0,
5049            mainAxis: checkMainAxis = true,
5050            crossAxis: checkCrossAxis = true
5051          } = evaluate(options, state);
5052          const coords = {
5053            x: x2,
5054            y: y2
5055          };
5056          const crossAxis = getSideAxis(placement);
5057          const mainAxis = getOppositeAxis(crossAxis);
5058          let mainAxisCoord = coords[mainAxis];
5059          let crossAxisCoord = coords[crossAxis];
5060          const rawOffset = evaluate(offset4, state);
5061          const computedOffset = typeof rawOffset === "number" ? {
5062            mainAxis: rawOffset,
5063            crossAxis: 0
5064          } : {
5065            mainAxis: 0,
5066            crossAxis: 0,
5067            ...rawOffset
5068          };
5069          if (checkMainAxis) {
5070            const len = mainAxis === "y" ? "height" : "width";
5071            const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
5072            const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
5073            if (mainAxisCoord < limitMin) {
5074              mainAxisCoord = limitMin;
5075            } else if (mainAxisCoord > limitMax) {
5076              mainAxisCoord = limitMax;
5077            }
5078          }
5079          if (checkCrossAxis) {
5080            var _middlewareData$offse, _middlewareData$offse2;
5081            const len = mainAxis === "y" ? "width" : "height";
5082            const isOriginSide = originSides.has(getSide(placement));
5083            const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
5084            const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
5085            if (crossAxisCoord < limitMin) {
5086              crossAxisCoord = limitMin;
5087            } else if (crossAxisCoord > limitMax) {
5088              crossAxisCoord = limitMax;
5089            }
5090          }
5091          return {
5092            [mainAxis]: mainAxisCoord,
5093            [crossAxis]: crossAxisCoord
5094          };
5095        }
5096      };
5097    };
5098    var size = function(options) {
5099      if (options === void 0) {
5100        options = {};
5101      }
5102      return {
5103        name: "size",
5104        options,
5105        async fn(state) {
5106          var _state$middlewareData, _state$middlewareData2;
5107          const {
5108            placement,
5109            rects,
5110            platform: platform3,
5111            elements
5112          } = state;
5113          const {
5114            apply = () => {
5115            },
5116            ...detectOverflowOptions
5117          } = evaluate(options, state);
5118          const overflow = await platform3.detectOverflow(state, detectOverflowOptions);
5119          const side = getSide(placement);
5120          const alignment = getAlignment(placement);
5121          const isYAxis = getSideAxis(placement) === "y";
5122          const {
5123            width,
5124            height
5125          } = rects.floating;
5126          let heightSide;
5127          let widthSide;
5128          if (side === "top" || side === "bottom") {
5129            heightSide = side;
5130            widthSide = alignment === (await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right";
5131          } else {
5132            widthSide = side;
5133            heightSide = alignment === "end" ? "top" : "bottom";
5134          }
5135          const maximumClippingHeight = height - overflow.top - overflow.bottom;
5136          const maximumClippingWidth = width - overflow.left - overflow.right;
5137          const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
5138          const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
5139          const noShift = !state.middlewareData.shift;
5140          let availableHeight = overflowAvailableHeight;
5141          let availableWidth = overflowAvailableWidth;
5142          if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {
5143            availableWidth = maximumClippingWidth;
5144          }
5145          if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {
5146            availableHeight = maximumClippingHeight;
5147          }
5148          if (noShift && !alignment) {
5149            const xMin = max(overflow.left, 0);
5150            const xMax = max(overflow.right, 0);
5151            const yMin = max(overflow.top, 0);
5152            const yMax = max(overflow.bottom, 0);
5153            if (isYAxis) {
5154              availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
5155            } else {
5156              availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
5157            }
5158          }
5159          await apply({
5160            ...state,
5161            availableWidth,
5162            availableHeight
5163          });
5164          const nextDimensions = await platform3.getDimensions(elements.floating);
5165          if (width !== nextDimensions.width || height !== nextDimensions.height) {
5166            return {
5167              reset: {
5168                rects: true
5169              }
5170            };
5171          }
5172          return {};
5173        }
5174      };
5175    };
5176  
5177    // node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs
5178    function getCssDimensions(element) {
5179      const css = getComputedStyle2(element);
5180      let width = parseFloat(css.width) || 0;
5181      let height = parseFloat(css.height) || 0;
5182      const hasOffset = isHTMLElement(element);
5183      const offsetWidth = hasOffset ? element.offsetWidth : width;
5184      const offsetHeight = hasOffset ? element.offsetHeight : height;
5185      const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
5186      if (shouldFallback) {
5187        width = offsetWidth;
5188        height = offsetHeight;
5189      }
5190      return {
5191        width,
5192        height,
5193        $: shouldFallback
5194      };
5195    }
5196    function unwrapElement(element) {
5197      return !isElement(element) ? element.contextElement : element;
5198    }
5199    function getScale(element) {
5200      const domElement = unwrapElement(element);
5201      if (!isHTMLElement(domElement)) {
5202        return createCoords(1);
5203      }
5204      const rect = domElement.getBoundingClientRect();
5205      const {
5206        width,
5207        height,
5208        $: $2
5209      } = getCssDimensions(domElement);
5210      let x2 = ($2 ? round(rect.width) : rect.width) / width;
5211      let y2 = ($2 ? round(rect.height) : rect.height) / height;
5212      if (!x2 || !Number.isFinite(x2)) {
5213        x2 = 1;
5214      }
5215      if (!y2 || !Number.isFinite(y2)) {
5216        y2 = 1;
5217      }
5218      return {
5219        x: x2,
5220        y: y2
5221      };
5222    }
5223    var noOffsets = /* @__PURE__ */ createCoords(0);
5224    function getVisualOffsets(element) {
5225      const win = getWindow(element);
5226      if (!isWebKit() || !win.visualViewport) {
5227        return noOffsets;
5228      }
5229      return {
5230        x: win.visualViewport.offsetLeft,
5231        y: win.visualViewport.offsetTop
5232      };
5233    }
5234    function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
5235      if (isFixed === void 0) {
5236        isFixed = false;
5237      }
5238      if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
5239        return false;
5240      }
5241      return isFixed;
5242    }
5243    function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
5244      if (includeScale === void 0) {
5245        includeScale = false;
5246      }
5247      if (isFixedStrategy === void 0) {
5248        isFixedStrategy = false;
5249      }
5250      const clientRect = element.getBoundingClientRect();
5251      const domElement = unwrapElement(element);
5252      let scale = createCoords(1);
5253      if (includeScale) {
5254        if (offsetParent) {
5255          if (isElement(offsetParent)) {
5256            scale = getScale(offsetParent);
5257          }
5258        } else {
5259          scale = getScale(element);
5260        }
5261      }
5262      const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
5263      let x2 = (clientRect.left + visualOffsets.x) / scale.x;
5264      let y2 = (clientRect.top + visualOffsets.y) / scale.y;
5265      let width = clientRect.width / scale.x;
5266      let height = clientRect.height / scale.y;
5267      if (domElement) {
5268        const win = getWindow(domElement);
5269        const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
5270        let currentWin = win;
5271        let currentIFrame = getFrameElement(currentWin);
5272        while (currentIFrame && offsetParent && offsetWin !== currentWin) {
5273          const iframeScale = getScale(currentIFrame);
5274          const iframeRect = currentIFrame.getBoundingClientRect();
5275          const css = getComputedStyle2(currentIFrame);
5276          const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
5277          const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
5278          x2 *= iframeScale.x;
5279          y2 *= iframeScale.y;
5280          width *= iframeScale.x;
5281          height *= iframeScale.y;
5282          x2 += left;
5283          y2 += top;
5284          currentWin = getWindow(currentIFrame);
5285          currentIFrame = getFrameElement(currentWin);
5286        }
5287      }
5288      return rectToClientRect({
5289        width,
5290        height,
5291        x: x2,
5292        y: y2
5293      });
5294    }
5295    function getWindowScrollBarX(element, rect) {
5296      const leftScroll = getNodeScroll(element).scrollLeft;
5297      if (!rect) {
5298        return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
5299      }
5300      return rect.left + leftScroll;
5301    }
5302    function getHTMLOffset(documentElement, scroll) {
5303      const htmlRect = documentElement.getBoundingClientRect();
5304      const x2 = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
5305      const y2 = htmlRect.top + scroll.scrollTop;
5306      return {
5307        x: x2,
5308        y: y2
5309      };
5310    }
5311    function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
5312      let {
5313        elements,
5314        rect,
5315        offsetParent,
5316        strategy
5317      } = _ref;
5318      const isFixed = strategy === "fixed";
5319      const documentElement = getDocumentElement(offsetParent);
5320      const topLayer = elements ? isTopLayer(elements.floating) : false;
5321      if (offsetParent === documentElement || topLayer && isFixed) {
5322        return rect;
5323      }
5324      let scroll = {
5325        scrollLeft: 0,
5326        scrollTop: 0
5327      };
5328      let scale = createCoords(1);
5329      const offsets = createCoords(0);
5330      const isOffsetParentAnElement = isHTMLElement(offsetParent);
5331      if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
5332        if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
5333          scroll = getNodeScroll(offsetParent);
5334        }
5335        if (isOffsetParentAnElement) {
5336          const offsetRect = getBoundingClientRect(offsetParent);
5337          scale = getScale(offsetParent);
5338          offsets.x = offsetRect.x + offsetParent.clientLeft;
5339          offsets.y = offsetRect.y + offsetParent.clientTop;
5340        }
5341      }
5342      const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
5343      return {
5344        width: rect.width * scale.x,
5345        height: rect.height * scale.y,
5346        x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
5347        y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
5348      };
5349    }
5350    function getClientRects(element) {
5351      return Array.from(element.getClientRects());
5352    }
5353    function getDocumentRect(element) {
5354      const html = getDocumentElement(element);
5355      const scroll = getNodeScroll(element);
5356      const body = element.ownerDocument.body;
5357      const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
5358      const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
5359      let x2 = -scroll.scrollLeft + getWindowScrollBarX(element);
5360      const y2 = -scroll.scrollTop;
5361      if (getComputedStyle2(body).direction === "rtl") {
5362        x2 += max(html.clientWidth, body.clientWidth) - width;
5363      }
5364      return {
5365        width,
5366        height,
5367        x: x2,
5368        y: y2
5369      };
5370    }
5371    var SCROLLBAR_MAX = 25;
5372    function getViewportRect(element, strategy) {
5373      const win = getWindow(element);
5374      const html = getDocumentElement(element);
5375      const visualViewport = win.visualViewport;
5376      let width = html.clientWidth;
5377      let height = html.clientHeight;
5378      let x2 = 0;
5379      let y2 = 0;
5380      if (visualViewport) {
5381        width = visualViewport.width;
5382        height = visualViewport.height;
5383        const visualViewportBased = isWebKit();
5384        if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
5385          x2 = visualViewport.offsetLeft;
5386          y2 = visualViewport.offsetTop;
5387        }
5388      }
5389      const windowScrollbarX = getWindowScrollBarX(html);
5390      if (windowScrollbarX <= 0) {
5391        const doc = html.ownerDocument;
5392        const body = doc.body;
5393        const bodyStyles = getComputedStyle(body);
5394        const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
5395        const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
5396        if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
5397          width -= clippingStableScrollbarWidth;
5398        }
5399      } else if (windowScrollbarX <= SCROLLBAR_MAX) {
5400        width += windowScrollbarX;
5401      }
5402      return {
5403        width,
5404        height,
5405        x: x2,
5406        y: y2
5407      };
5408    }
5409    function getInnerBoundingClientRect(element, strategy) {
5410      const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
5411      const top = clientRect.top + element.clientTop;
5412      const left = clientRect.left + element.clientLeft;
5413      const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
5414      const width = element.clientWidth * scale.x;
5415      const height = element.clientHeight * scale.y;
5416      const x2 = left * scale.x;
5417      const y2 = top * scale.y;
5418      return {
5419        width,
5420        height,
5421        x: x2,
5422        y: y2
5423      };
5424    }
5425    function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
5426      let rect;
5427      if (clippingAncestor === "viewport") {
5428        rect = getViewportRect(element, strategy);
5429      } else if (clippingAncestor === "document") {
5430        rect = getDocumentRect(getDocumentElement(element));
5431      } else if (isElement(clippingAncestor)) {
5432        rect = getInnerBoundingClientRect(clippingAncestor, strategy);
5433      } else {
5434        const visualOffsets = getVisualOffsets(element);
5435        rect = {
5436          x: clippingAncestor.x - visualOffsets.x,
5437          y: clippingAncestor.y - visualOffsets.y,
5438          width: clippingAncestor.width,
5439          height: clippingAncestor.height
5440        };
5441      }
5442      return rectToClientRect(rect);
5443    }
5444    function hasFixedPositionAncestor(element, stopNode) {
5445      const parentNode = getParentNode(element);
5446      if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
5447        return false;
5448      }
5449      return getComputedStyle2(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
5450    }
5451    function getClippingElementAncestors(element, cache) {
5452      const cachedResult = cache.get(element);
5453      if (cachedResult) {
5454        return cachedResult;
5455      }
5456      let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
5457      let currentContainingBlockComputedStyle = null;
5458      const elementIsFixed = getComputedStyle2(element).position === "fixed";
5459      let currentNode = elementIsFixed ? getParentNode(element) : element;
5460      while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
5461        const computedStyle = getComputedStyle2(currentNode);
5462        const currentNodeIsContaining = isContainingBlock(currentNode);
5463        if (!currentNodeIsContaining && computedStyle.position === "fixed") {
5464          currentContainingBlockComputedStyle = null;
5465        }
5466        const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === "absolute" || currentContainingBlockComputedStyle.position === "fixed") || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
5467        if (shouldDropCurrentNode) {
5468          result = result.filter((ancestor) => ancestor !== currentNode);
5469        } else {
5470          currentContainingBlockComputedStyle = computedStyle;
5471        }
5472        currentNode = getParentNode(currentNode);
5473      }
5474      cache.set(element, result);
5475      return result;
5476    }
5477    function getClippingRect(_ref) {
5478      let {
5479        element,
5480        boundary,
5481        rootBoundary,
5482        strategy
5483      } = _ref;
5484      const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
5485      const clippingAncestors = [...elementClippingAncestors, rootBoundary];
5486      const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
5487      let top = firstRect.top;
5488      let right = firstRect.right;
5489      let bottom = firstRect.bottom;
5490      let left = firstRect.left;
5491      for (let i2 = 1; i2 < clippingAncestors.length; i2++) {
5492        const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i2], strategy);
5493        top = max(rect.top, top);
5494        right = min(rect.right, right);
5495        bottom = min(rect.bottom, bottom);
5496        left = max(rect.left, left);
5497      }
5498      return {
5499        width: right - left,
5500        height: bottom - top,
5501        x: left,
5502        y: top
5503      };
5504    }
5505    function getDimensions(element) {
5506      const {
5507        width,
5508        height
5509      } = getCssDimensions(element);
5510      return {
5511        width,
5512        height
5513      };
5514    }
5515    function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
5516      const isOffsetParentAnElement = isHTMLElement(offsetParent);
5517      const documentElement = getDocumentElement(offsetParent);
5518      const isFixed = strategy === "fixed";
5519      const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
5520      let scroll = {
5521        scrollLeft: 0,
5522        scrollTop: 0
5523      };
5524      const offsets = createCoords(0);
5525      function setLeftRTLScrollbarOffset() {
5526        offsets.x = getWindowScrollBarX(documentElement);
5527      }
5528      if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
5529        if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
5530          scroll = getNodeScroll(offsetParent);
5531        }
5532        if (isOffsetParentAnElement) {
5533          const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
5534          offsets.x = offsetRect.x + offsetParent.clientLeft;
5535          offsets.y = offsetRect.y + offsetParent.clientTop;
5536        } else if (documentElement) {
5537          setLeftRTLScrollbarOffset();
5538        }
5539      }
5540      if (isFixed && !isOffsetParentAnElement && documentElement) {
5541        setLeftRTLScrollbarOffset();
5542      }
5543      const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
5544      const x2 = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
5545      const y2 = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
5546      return {
5547        x: x2,
5548        y: y2,
5549        width: rect.width,
5550        height: rect.height
5551      };
5552    }
5553    function isStaticPositioned(element) {
5554      return getComputedStyle2(element).position === "static";
5555    }
5556    function getTrueOffsetParent(element, polyfill) {
5557      if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") {
5558        return null;
5559      }
5560      if (polyfill) {
5561        return polyfill(element);
5562      }
5563      let rawOffsetParent = element.offsetParent;
5564      if (getDocumentElement(element) === rawOffsetParent) {
5565        rawOffsetParent = rawOffsetParent.ownerDocument.body;
5566      }
5567      return rawOffsetParent;
5568    }
5569    function getOffsetParent(element, polyfill) {
5570      const win = getWindow(element);
5571      if (isTopLayer(element)) {
5572        return win;
5573      }
5574      if (!isHTMLElement(element)) {
5575        let svgOffsetParent = getParentNode(element);
5576        while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
5577          if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
5578            return svgOffsetParent;
5579          }
5580          svgOffsetParent = getParentNode(svgOffsetParent);
5581        }
5582        return win;
5583      }
5584      let offsetParent = getTrueOffsetParent(element, polyfill);
5585      while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
5586        offsetParent = getTrueOffsetParent(offsetParent, polyfill);
5587      }
5588      if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
5589        return win;
5590      }
5591      return offsetParent || getContainingBlock(element) || win;
5592    }
5593    var getElementRects = async function(data) {
5594      const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
5595      const getDimensionsFn = this.getDimensions;
5596      const floatingDimensions = await getDimensionsFn(data.floating);
5597      return {
5598        reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
5599        floating: {
5600          x: 0,
5601          y: 0,
5602          width: floatingDimensions.width,
5603          height: floatingDimensions.height
5604        }
5605      };
5606    };
5607    function isRTL(element) {
5608      return getComputedStyle2(element).direction === "rtl";
5609    }
5610    var platform2 = {
5611      convertOffsetParentRelativeRectToViewportRelativeRect,
5612      getDocumentElement,
5613      getClippingRect,
5614      getOffsetParent,
5615      getElementRects,
5616      getClientRects,
5617      getDimensions,
5618      getScale,
5619      isElement,
5620      isRTL
5621    };
5622    function rectsAreEqual(a2, b2) {
5623      return a2.x === b2.x && a2.y === b2.y && a2.width === b2.width && a2.height === b2.height;
5624    }
5625    function observeMove(element, onMove) {
5626      let io = null;
5627      let timeoutId;
5628      const root = getDocumentElement(element);
5629      function cleanup() {
5630        var _io;
5631        clearTimeout(timeoutId);
5632        (_io = io) == null || _io.disconnect();
5633        io = null;
5634      }
5635      function refresh(skip, threshold) {
5636        if (skip === void 0) {
5637          skip = false;
5638        }
5639        if (threshold === void 0) {
5640          threshold = 1;
5641        }
5642        cleanup();
5643        const elementRectForRootMargin = element.getBoundingClientRect();
5644        const {
5645          left,
5646          top,
5647          width,
5648          height
5649        } = elementRectForRootMargin;
5650        if (!skip) {
5651          onMove();
5652        }
5653        if (!width || !height) {
5654          return;
5655        }
5656        const insetTop = floor(top);
5657        const insetRight = floor(root.clientWidth - (left + width));
5658        const insetBottom = floor(root.clientHeight - (top + height));
5659        const insetLeft = floor(left);
5660        const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
5661        const options = {
5662          rootMargin,
5663          threshold: max(0, min(1, threshold)) || 1
5664        };
5665        let isFirstUpdate = true;
5666        function handleObserve(entries) {
5667          const ratio = entries[0].intersectionRatio;
5668          if (ratio !== threshold) {
5669            if (!isFirstUpdate) {
5670              return refresh();
5671            }
5672            if (!ratio) {
5673              timeoutId = setTimeout(() => {
5674                refresh(false, 1e-7);
5675              }, 1e3);
5676            } else {
5677              refresh(false, ratio);
5678            }
5679          }
5680          if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
5681            refresh();
5682          }
5683          isFirstUpdate = false;
5684        }
5685        try {
5686          io = new IntersectionObserver(handleObserve, {
5687            ...options,
5688            // Handle <iframe>s
5689            root: root.ownerDocument
5690          });
5691        } catch (_e) {
5692          io = new IntersectionObserver(handleObserve, options);
5693        }
5694        io.observe(element);
5695      }
5696      refresh(true);
5697      return cleanup;
5698    }
5699    function autoUpdate(reference, floating, update2, options) {
5700      if (options === void 0) {
5701        options = {};
5702      }
5703      const {
5704        ancestorScroll = true,
5705        ancestorResize = true,
5706        elementResize = typeof ResizeObserver === "function",
5707        layoutShift = typeof IntersectionObserver === "function",
5708        animationFrame = false
5709      } = options;
5710      const referenceEl = unwrapElement(reference);
5711      const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : [];
5712      ancestors.forEach((ancestor) => {
5713        ancestorScroll && ancestor.addEventListener("scroll", update2, {
5714          passive: true
5715        });
5716        ancestorResize && ancestor.addEventListener("resize", update2);
5717      });
5718      const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update2) : null;
5719      let reobserveFrame = -1;
5720      let resizeObserver = null;
5721      if (elementResize) {
5722        resizeObserver = new ResizeObserver((_ref) => {
5723          let [firstEntry] = _ref;
5724          if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
5725            resizeObserver.unobserve(floating);
5726            cancelAnimationFrame(reobserveFrame);
5727            reobserveFrame = requestAnimationFrame(() => {
5728              var _resizeObserver;
5729              (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
5730            });
5731          }
5732          update2();
5733        });
5734        if (referenceEl && !animationFrame) {
5735          resizeObserver.observe(referenceEl);
5736        }
5737        if (floating) {
5738          resizeObserver.observe(floating);
5739        }
5740      }
5741      let frameId;
5742      let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
5743      if (animationFrame) {
5744        frameLoop();
5745      }
5746      function frameLoop() {
5747        const nextRefRect = getBoundingClientRect(reference);
5748        if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
5749          update2();
5750        }
5751        prevRefRect = nextRefRect;
5752        frameId = requestAnimationFrame(frameLoop);
5753      }
5754      update2();
5755      return () => {
5756        var _resizeObserver2;
5757        ancestors.forEach((ancestor) => {
5758          ancestorScroll && ancestor.removeEventListener("scroll", update2);
5759          ancestorResize && ancestor.removeEventListener("resize", update2);
5760        });
5761        cleanupIo == null || cleanupIo();
5762        (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
5763        resizeObserver = null;
5764        if (animationFrame) {
5765          cancelAnimationFrame(frameId);
5766        }
5767      };
5768    }
5769    var offset2 = offset;
5770    var shift2 = shift;
5771    var flip2 = flip;
5772    var size2 = size;
5773    var hide2 = hide;
5774    var limitShift2 = limitShift;
5775    var computePosition2 = (reference, floating, options) => {
5776      const cache = /* @__PURE__ */ new Map();
5777      const mergedOptions = {
5778        platform: platform2,
5779        ...options
5780      };
5781      const platformWithCache = {
5782        ...mergedOptions.platform,
5783        _c: cache
5784      };
5785      return computePosition(reference, floating, {
5786        ...mergedOptions,
5787        platform: platformWithCache
5788      });
5789    };
5790  
5791    // node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs
5792    var React19 = __toESM(require_react(), 1);
5793    var import_react2 = __toESM(require_react(), 1);
5794    var ReactDOM3 = __toESM(require_react_dom(), 1);
5795    var isClient = typeof document !== "undefined";
5796    var noop3 = function noop4() {
5797    };
5798    var index = isClient ? import_react2.useLayoutEffect : noop3;
5799    function deepEqual(a2, b2) {
5800      if (a2 === b2) {
5801        return true;
5802      }
5803      if (typeof a2 !== typeof b2) {
5804        return false;
5805      }
5806      if (typeof a2 === "function" && a2.toString() === b2.toString()) {
5807        return true;
5808      }
5809      let length;
5810      let i2;
5811      let keys;
5812      if (a2 && b2 && typeof a2 === "object") {
5813        if (Array.isArray(a2)) {
5814          length = a2.length;
5815          if (length !== b2.length) return false;
5816          for (i2 = length; i2-- !== 0; ) {
5817            if (!deepEqual(a2[i2], b2[i2])) {
5818              return false;
5819            }
5820          }
5821          return true;
5822        }
5823        keys = Object.keys(a2);
5824        length = keys.length;
5825        if (length !== Object.keys(b2).length) {
5826          return false;
5827        }
5828        for (i2 = length; i2-- !== 0; ) {
5829          if (!{}.hasOwnProperty.call(b2, keys[i2])) {
5830            return false;
5831          }
5832        }
5833        for (i2 = length; i2-- !== 0; ) {
5834          const key = keys[i2];
5835          if (key === "_owner" && a2.$$typeof) {
5836            continue;
5837          }
5838          if (!deepEqual(a2[key], b2[key])) {
5839            return false;
5840          }
5841        }
5842        return true;
5843      }
5844      return a2 !== a2 && b2 !== b2;
5845    }
5846    function getDPR(element) {
5847      if (typeof window === "undefined") {
5848        return 1;
5849      }
5850      const win = element.ownerDocument.defaultView || window;
5851      return win.devicePixelRatio || 1;
5852    }
5853    function roundByDPR(element, value) {
5854      const dpr = getDPR(element);
5855      return Math.round(value * dpr) / dpr;
5856    }
5857    function useLatestRef(value) {
5858      const ref = React19.useRef(value);
5859      index(() => {
5860        ref.current = value;
5861      });
5862      return ref;
5863    }
5864    function useFloating(options) {
5865      if (options === void 0) {
5866        options = {};
5867      }
5868      const {
5869        placement = "bottom",
5870        strategy = "absolute",
5871        middleware = [],
5872        platform: platform3,
5873        elements: {
5874          reference: externalReference,
5875          floating: externalFloating
5876        } = {},
5877        transform = true,
5878        whileElementsMounted,
5879        open
5880      } = options;
5881      const [data, setData] = React19.useState({
5882        x: 0,
5883        y: 0,
5884        strategy,
5885        placement,
5886        middlewareData: {},
5887        isPositioned: false
5888      });
5889      const [latestMiddleware, setLatestMiddleware] = React19.useState(middleware);
5890      if (!deepEqual(latestMiddleware, middleware)) {
5891        setLatestMiddleware(middleware);
5892      }
5893      const [_reference, _setReference] = React19.useState(null);
5894      const [_floating, _setFloating] = React19.useState(null);
5895      const setReference = React19.useCallback((node) => {
5896        if (node !== referenceRef.current) {
5897          referenceRef.current = node;
5898          _setReference(node);
5899        }
5900      }, []);
5901      const setFloating = React19.useCallback((node) => {
5902        if (node !== floatingRef.current) {
5903          floatingRef.current = node;
5904          _setFloating(node);
5905        }
5906      }, []);
5907      const referenceEl = externalReference || _reference;
5908      const floatingEl = externalFloating || _floating;
5909      const referenceRef = React19.useRef(null);
5910      const floatingRef = React19.useRef(null);
5911      const dataRef = React19.useRef(data);
5912      const hasWhileElementsMounted = whileElementsMounted != null;
5913      const whileElementsMountedRef = useLatestRef(whileElementsMounted);
5914      const platformRef = useLatestRef(platform3);
5915      const openRef = useLatestRef(open);
5916      const update2 = React19.useCallback(() => {
5917        if (!referenceRef.current || !floatingRef.current) {
5918          return;
5919        }
5920        const config = {
5921          placement,
5922          strategy,
5923          middleware: latestMiddleware
5924        };
5925        if (platformRef.current) {
5926          config.platform = platformRef.current;
5927        }
5928        computePosition2(referenceRef.current, floatingRef.current, config).then((data2) => {
5929          const fullData = {
5930            ...data2,
5931            // The floating element's position may be recomputed while it's closed
5932            // but still mounted (such as when transitioning out). To ensure
5933            // `isPositioned` will be `false` initially on the next open, avoid
5934            // setting it to `true` when `open === false` (must be specified).
5935            isPositioned: openRef.current !== false
5936          };
5937          if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
5938            dataRef.current = fullData;
5939            ReactDOM3.flushSync(() => {
5940              setData(fullData);
5941            });
5942          }
5943        });
5944      }, [latestMiddleware, placement, strategy, platformRef, openRef]);
5945      index(() => {
5946        if (open === false && dataRef.current.isPositioned) {
5947          dataRef.current.isPositioned = false;
5948          setData((data2) => ({
5949            ...data2,
5950            isPositioned: false
5951          }));
5952        }
5953      }, [open]);
5954      const isMountedRef = React19.useRef(false);
5955      index(() => {
5956        isMountedRef.current = true;
5957        return () => {
5958          isMountedRef.current = false;
5959        };
5960      }, []);
5961      index(() => {
5962        if (referenceEl) referenceRef.current = referenceEl;
5963        if (floatingEl) floatingRef.current = floatingEl;
5964        if (referenceEl && floatingEl) {
5965          if (whileElementsMountedRef.current) {
5966            return whileElementsMountedRef.current(referenceEl, floatingEl, update2);
5967          }
5968          update2();
5969        }
5970      }, [referenceEl, floatingEl, update2, whileElementsMountedRef, hasWhileElementsMounted]);
5971      const refs = React19.useMemo(() => ({
5972        reference: referenceRef,
5973        floating: floatingRef,
5974        setReference,
5975        setFloating
5976      }), [setReference, setFloating]);
5977      const elements = React19.useMemo(() => ({
5978        reference: referenceEl,
5979        floating: floatingEl
5980      }), [referenceEl, floatingEl]);
5981      const floatingStyles = React19.useMemo(() => {
5982        const initialStyles = {
5983          position: strategy,
5984          left: 0,
5985          top: 0
5986        };
5987        if (!elements.floating) {
5988          return initialStyles;
5989        }
5990        const x2 = roundByDPR(elements.floating, data.x);
5991        const y2 = roundByDPR(elements.floating, data.y);
5992        if (transform) {
5993          return {
5994            ...initialStyles,
5995            transform: "translate(" + x2 + "px, " + y2 + "px)",
5996            ...getDPR(elements.floating) >= 1.5 && {
5997              willChange: "transform"
5998            }
5999          };
6000        }
6001        return {
6002          position: strategy,
6003          left: x2,
6004          top: y2
6005        };
6006      }, [strategy, transform, elements.floating, data.x, data.y]);
6007      return React19.useMemo(() => ({
6008        ...data,
6009        update: update2,
6010        refs,
6011        elements,
6012        floatingStyles
6013      }), [data, update2, refs, elements, floatingStyles]);
6014    }
6015    var offset3 = (options, deps) => {
6016      const result = offset2(options);
6017      return {
6018        name: result.name,
6019        fn: result.fn,
6020        options: [options, deps]
6021      };
6022    };
6023    var shift3 = (options, deps) => {
6024      const result = shift2(options);
6025      return {
6026        name: result.name,
6027        fn: result.fn,
6028        options: [options, deps]
6029      };
6030    };
6031    var limitShift3 = (options, deps) => {
6032      const result = limitShift2(options);
6033      return {
6034        fn: result.fn,
6035        options: [options, deps]
6036      };
6037    };
6038    var flip3 = (options, deps) => {
6039      const result = flip2(options);
6040      return {
6041        name: result.name,
6042        fn: result.fn,
6043        options: [options, deps]
6044      };
6045    };
6046    var size3 = (options, deps) => {
6047      const result = size2(options);
6048      return {
6049        name: result.name,
6050        fn: result.fn,
6051        options: [options, deps]
6052      };
6053    };
6054    var hide3 = (options, deps) => {
6055      const result = hide2(options);
6056      return {
6057        name: result.name,
6058        fn: result.fn,
6059        options: [options, deps]
6060      };
6061    };
6062  
6063    // node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs
6064    var React24 = __toESM(require_react(), 1);
6065    var ReactDOM4 = __toESM(require_react_dom(), 1);
6066  
6067    // node_modules/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.mjs
6068    var React23 = __toESM(require_react(), 1);
6069  
6070    // node_modules/@base-ui/utils/store/createSelector.mjs
6071    var createSelector = (a2, b2, c2, d2, e2, f2, ...other) => {
6072      if (other.length > 0) {
6073        throw new Error(true ? "Unsupported number of selectors" : formatErrorMessage_default(1));
6074      }
6075      let selector2;
6076      if (a2 && b2 && c2 && d2 && e2 && f2) {
6077        selector2 = (state, a1, a22, a3) => {
6078          const va = a2(state, a1, a22, a3);
6079          const vb = b2(state, a1, a22, a3);
6080          const vc = c2(state, a1, a22, a3);
6081          const vd = d2(state, a1, a22, a3);
6082          const ve = e2(state, a1, a22, a3);
6083          return f2(va, vb, vc, vd, ve, a1, a22, a3);
6084        };
6085      } else if (a2 && b2 && c2 && d2 && e2) {
6086        selector2 = (state, a1, a22, a3) => {
6087          const va = a2(state, a1, a22, a3);
6088          const vb = b2(state, a1, a22, a3);
6089          const vc = c2(state, a1, a22, a3);
6090          const vd = d2(state, a1, a22, a3);
6091          return e2(va, vb, vc, vd, a1, a22, a3);
6092        };
6093      } else if (a2 && b2 && c2 && d2) {
6094        selector2 = (state, a1, a22, a3) => {
6095          const va = a2(state, a1, a22, a3);
6096          const vb = b2(state, a1, a22, a3);
6097          const vc = c2(state, a1, a22, a3);
6098          return d2(va, vb, vc, a1, a22, a3);
6099        };
6100      } else if (a2 && b2 && c2) {
6101        selector2 = (state, a1, a22, a3) => {
6102          const va = a2(state, a1, a22, a3);
6103          const vb = b2(state, a1, a22, a3);
6104          return c2(va, vb, a1, a22, a3);
6105        };
6106      } else if (a2 && b2) {
6107        selector2 = (state, a1, a22, a3) => {
6108          const va = a2(state, a1, a22, a3);
6109          return b2(va, a1, a22, a3);
6110        };
6111      } else if (a2) {
6112        selector2 = a2;
6113      } else {
6114        throw (
6115          /* minify-error-disabled */
6116          new Error("Missing arguments")
6117        );
6118      }
6119      return selector2;
6120    };
6121  
6122    // node_modules/@base-ui/utils/store/useStore.mjs
6123    var React21 = __toESM(require_react(), 1);
6124    var import_shim = __toESM(require_shim(), 1);
6125    var import_with_selector = __toESM(require_with_selector(), 1);
6126  
6127    // node_modules/@base-ui/utils/fastHooks.mjs
6128    var React20 = __toESM(require_react(), 1);
6129    var hooks = [];
6130    var currentInstance = void 0;
6131    function getInstance() {
6132      return currentInstance;
6133    }
6134    function register(hook) {
6135      hooks.push(hook);
6136    }
6137    function fastComponent(fn) {
6138      const FastComponent = (props, forwardedRef) => {
6139        const instance = useRefWithInit(createInstance).current;
6140        let result;
6141        try {
6142          currentInstance = instance;
6143          for (const hook of hooks) {
6144            hook.before(instance);
6145          }
6146          result = fn(props, forwardedRef);
6147          for (const hook of hooks) {
6148            hook.after(instance);
6149          }
6150          instance.didInitialize = true;
6151        } finally {
6152          currentInstance = void 0;
6153        }
6154        return result;
6155      };
6156      FastComponent.displayName = fn.displayName || fn.name;
6157      return FastComponent;
6158    }
6159    function fastComponentRef(fn) {
6160      return /* @__PURE__ */ React20.forwardRef(fastComponent(fn));
6161    }
6162    function createInstance() {
6163      return {
6164        didInitialize: false
6165      };
6166    }
6167  
6168    // node_modules/@base-ui/utils/store/useStore.mjs
6169    var canUseRawUseSyncExternalStore = isReactVersionAtLeast(19);
6170    var useStoreImplementation = canUseRawUseSyncExternalStore ? useStoreFast : useStoreLegacy;
6171    function useStore(store, selector2, a1, a2, a3) {
6172      return useStoreImplementation(store, selector2, a1, a2, a3);
6173    }
6174    function useStoreR19(store, selector2, a1, a2, a3) {
6175      const getSelection = React21.useCallback(() => selector2(store.getSnapshot(), a1, a2, a3), [store, selector2, a1, a2, a3]);
6176      return (0, import_shim.useSyncExternalStore)(store.subscribe, getSelection, getSelection);
6177    }
6178    register({
6179      before(instance) {
6180        instance.syncIndex = 0;
6181        if (!instance.didInitialize) {
6182          instance.syncTick = 1;
6183          instance.syncHooks = [];
6184          instance.didChangeStore = true;
6185          instance.getSnapshot = () => {
6186            let didChange2 = false;
6187            for (let i2 = 0; i2 < instance.syncHooks.length; i2 += 1) {
6188              const hook = instance.syncHooks[i2];
6189              const value = hook.selector(hook.store.state, hook.a1, hook.a2, hook.a3);
6190              if (!Object.is(hook.value, value)) {
6191                didChange2 = true;
6192                hook.value = value;
6193              }
6194            }
6195            if (didChange2) {
6196              instance.syncTick += 1;
6197            }
6198            return instance.syncTick;
6199          };
6200        }
6201      },
6202      after(instance) {
6203        if (instance.syncHooks.length > 0) {
6204          if (instance.didChangeStore) {
6205            instance.didChangeStore = false;
6206            instance.subscribe = (onStoreChange) => {
6207              const stores = /* @__PURE__ */ new Set();
6208              for (const hook of instance.syncHooks) {
6209                stores.add(hook.store);
6210              }
6211              const unsubscribes = [];
6212              for (const store of stores) {
6213                unsubscribes.push(store.subscribe(onStoreChange));
6214              }
6215              return () => {
6216                for (const unsubscribe of unsubscribes) {
6217                  unsubscribe();
6218                }
6219              };
6220            };
6221          }
6222          (0, import_shim.useSyncExternalStore)(instance.subscribe, instance.getSnapshot, instance.getSnapshot);
6223        }
6224      }
6225    });
6226    function useStoreFast(store, selector2, a1, a2, a3) {
6227      const instance = getInstance();
6228      if (!instance) {
6229        return useStoreR19(store, selector2, a1, a2, a3);
6230      }
6231      const index2 = instance.syncIndex;
6232      instance.syncIndex += 1;
6233      let hook;
6234      if (!instance.didInitialize) {
6235        hook = {
6236          store,
6237          selector: selector2,
6238          a1,
6239          a2,
6240          a3,
6241          value: selector2(store.getSnapshot(), a1, a2, a3)
6242        };
6243        instance.syncHooks.push(hook);
6244      } else {
6245        hook = instance.syncHooks[index2];
6246        if (hook.store !== store || hook.selector !== selector2 || !Object.is(hook.a1, a1) || !Object.is(hook.a2, a2) || !Object.is(hook.a3, a3)) {
6247          if (hook.store !== store) {
6248            instance.didChangeStore = true;
6249          }
6250          hook.store = store;
6251          hook.selector = selector2;
6252          hook.a1 = a1;
6253          hook.a2 = a2;
6254          hook.a3 = a3;
6255          hook.value = selector2(store.getSnapshot(), a1, a2, a3);
6256        }
6257      }
6258      return hook.value;
6259    }
6260    function useStoreLegacy(store, selector2, a1, a2, a3) {
6261      return (0, import_with_selector.useSyncExternalStoreWithSelector)(store.subscribe, store.getSnapshot, store.getSnapshot, (state) => selector2(state, a1, a2, a3));
6262    }
6263  
6264    // node_modules/@base-ui/utils/store/Store.mjs
6265    var Store = class {
6266      /**
6267       * The current state of the store.
6268       * This property is updated immediately when the state changes as a result of calling {@link setState}, {@link update}, or {@link set}.
6269       * 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).
6270       * The values can be used directly (to avoid subscribing to the store) in effects or event handlers.
6271       *
6272       * Do not modify properties in state directly. Instead, use the provided methods to ensure proper state management and listener notification.
6273       */
6274      // Internal state to handle recursive `setState()` calls
6275      constructor(state) {
6276        this.state = state;
6277        this.listeners = /* @__PURE__ */ new Set();
6278        this.updateTick = 0;
6279      }
6280      /**
6281       * Registers a listener that will be called whenever the store's state changes.
6282       *
6283       * @param fn The listener function to be called on state changes.
6284       * @returns A function to unsubscribe the listener.
6285       */
6286      subscribe = (fn) => {
6287        this.listeners.add(fn);
6288        return () => {
6289          this.listeners.delete(fn);
6290        };
6291      };
6292      /**
6293       * Returns the current state of the store.
6294       */
6295      getSnapshot = () => {
6296        return this.state;
6297      };
6298      /**
6299       * Updates the entire store's state and notifies all registered listeners.
6300       *
6301       * @param newState The new state to set for the store.
6302       */
6303      setState(newState) {
6304        if (this.state === newState) {
6305          return;
6306        }
6307        this.state = newState;
6308        this.updateTick += 1;
6309        const currentTick = this.updateTick;
6310        for (const listener of this.listeners) {
6311          if (currentTick !== this.updateTick) {
6312            return;
6313          }
6314          listener(newState);
6315        }
6316      }
6317      /**
6318       * Merges the provided changes into the current state and notifies listeners if there are changes.
6319       *
6320       * @param changes An object containing the changes to apply to the current state.
6321       */
6322      update(changes) {
6323        for (const key in changes) {
6324          if (!Object.is(this.state[key], changes[key])) {
6325            this.setState({
6326              ...this.state,
6327              ...changes
6328            });
6329            return;
6330          }
6331        }
6332      }
6333      /**
6334       * Sets a specific key in the store's state to a new value and notifies listeners if the value has changed.
6335       *
6336       * @param key The key in the store's state to update.
6337       * @param value The new value to set for the specified key.
6338       */
6339      set(key, value) {
6340        if (!Object.is(this.state[key], value)) {
6341          this.setState({
6342            ...this.state,
6343            [key]: value
6344          });
6345        }
6346      }
6347      /**
6348       * Gives the state a new reference and updates all registered listeners.
6349       */
6350      notifyAll() {
6351        const newState = {
6352          ...this.state
6353        };
6354        this.setState(newState);
6355      }
6356      use(selector2, a1, a2, a3) {
6357        return useStore(this, selector2, a1, a2, a3);
6358      }
6359    };
6360  
6361    // node_modules/@base-ui/utils/store/ReactStore.mjs
6362    var React22 = __toESM(require_react(), 1);
6363    var ReactStore = class extends Store {
6364      /**
6365       * Creates a new ReactStore instance.
6366       *
6367       * @param state Initial state of the store.
6368       * @param context Non-reactive context values.
6369       * @param selectors Optional selectors for use with `useState`.
6370       */
6371      constructor(state, context = {}, selectors3) {
6372        super(state);
6373        this.context = context;
6374        this.selectors = selectors3;
6375      }
6376      /**
6377       * Non-reactive values such as refs, callbacks, etc.
6378       */
6379      /**
6380       * Synchronizes a single external value into the store.
6381       *
6382       * Note that the while the value in `state` is updated immediately, the value returned
6383       * by `useState` is updated before the next render (similarly to React's `useState`).
6384       */
6385      useSyncedValue(key, value) {
6386        React22.useDebugValue(key);
6387        const store = this;
6388        useIsoLayoutEffect(() => {
6389          if (store.state[key] !== value) {
6390            store.set(key, value);
6391          }
6392        }, [store, key, value]);
6393      }
6394      /**
6395       * Synchronizes a single external value into the store and
6396       * cleans it up (sets to `undefined`) on unmount.
6397       *
6398       * Note that the while the value in `state` is updated immediately, the value returned
6399       * by `useState` is updated before the next render (similarly to React's `useState`).
6400       */
6401      useSyncedValueWithCleanup(key, value) {
6402        const store = this;
6403        useIsoLayoutEffect(() => {
6404          if (store.state[key] !== value) {
6405            store.set(key, value);
6406          }
6407          return () => {
6408            store.set(key, void 0);
6409          };
6410        }, [store, key, value]);
6411      }
6412      /**
6413       * Synchronizes multiple external values into the store.
6414       *
6415       * Note that the while the values in `state` are updated immediately, the values returned
6416       * by `useState` are updated before the next render (similarly to React's `useState`).
6417       */
6418      useSyncedValues(statePart) {
6419        const store = this;
6420        if (true) {
6421          React22.useDebugValue(statePart, (p2) => Object.keys(p2));
6422          const keys = React22.useRef(Object.keys(statePart)).current;
6423          const nextKeys = Object.keys(statePart);
6424          if (keys.length !== nextKeys.length || keys.some((key, index2) => key !== nextKeys[index2])) {
6425            console.error("ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable.");
6426          }
6427        }
6428        const dependencies = Object.values(statePart);
6429        useIsoLayoutEffect(() => {
6430          store.update(statePart);
6431        }, [store, ...dependencies]);
6432      }
6433      /**
6434       * Registers a controllable prop pair (`controlled`, `defaultValue`) for a specific key. If `controlled`
6435       * is non-undefined, the store's state at `key` is updated to match `controlled`.
6436       */
6437      useControlledProp(key, controlled) {
6438        React22.useDebugValue(key);
6439        const store = this;
6440        const isControlled = controlled !== void 0;
6441        useIsoLayoutEffect(() => {
6442          if (isControlled && !Object.is(store.state[key], controlled)) {
6443            store.setState({
6444              ...store.state,
6445              [key]: controlled
6446            });
6447          }
6448        }, [store, key, controlled, isControlled]);
6449        if (true) {
6450          const cache = this.controlledValues ??= /* @__PURE__ */ new Map();
6451          if (!cache.has(key)) {
6452            cache.set(key, isControlled);
6453          }
6454          const previouslyControlled = cache.get(key);
6455          if (previouslyControlled !== void 0 && previouslyControlled !== isControlled) {
6456            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).`);
6457          }
6458        }
6459      }
6460      /** Gets the current value from the store using a selector with the provided key.
6461       *
6462       * @param key Key of the selector to use.
6463       */
6464      select(key, a1, a2, a3) {
6465        const selector2 = this.selectors[key];
6466        return selector2(this.state, a1, a2, a3);
6467      }
6468      /**
6469       * Returns a value from the store's state using a selector function.
6470       * Used to subscribe to specific parts of the state.
6471       * This methods causes a rerender whenever the selected state changes.
6472       *
6473       * @param key Key of the selector to use.
6474       */
6475      useState(key, a1, a2, a3) {
6476        React22.useDebugValue(key);
6477        return useStore(this, this.selectors[key], a1, a2, a3);
6478      }
6479      /**
6480       * Wraps a function with `useStableCallback` to ensure it has a stable reference
6481       * and assigns it to the context.
6482       *
6483       * @param key Key of the event callback. Must be a function in the context.
6484       * @param fn Function to assign.
6485       */
6486      useContextCallback(key, fn) {
6487        React22.useDebugValue(key);
6488        const stableFunction = useStableCallback(fn ?? NOOP);
6489        this.context[key] = stableFunction;
6490      }
6491      /**
6492       * Returns a stable setter function for a specific key in the store's state.
6493       * It's commonly used to pass as a ref callback to React elements.
6494       *
6495       * @param key Key of the state to set.
6496       */
6497      useStateSetter(key) {
6498        const ref = React22.useRef(void 0);
6499        if (ref.current === void 0) {
6500          ref.current = (value) => {
6501            this.set(key, value);
6502          };
6503        }
6504        return ref.current;
6505      }
6506      /**
6507       * Observes changes derived from the store's selectors and calls the listener when the selected value changes.
6508       *
6509       * @param key Key of the selector to observe.
6510       * @param listener Listener function called when the selector result changes.
6511       */
6512      observe(selector2, listener) {
6513        let selectFn;
6514        if (typeof selector2 === "function") {
6515          selectFn = selector2;
6516        } else {
6517          selectFn = this.selectors[selector2];
6518        }
6519        let prevValue = selectFn(this.state);
6520        listener(prevValue, prevValue, this);
6521        return this.subscribe((nextState) => {
6522          const nextValue = selectFn(nextState);
6523          if (!Object.is(prevValue, nextValue)) {
6524            const oldValue = prevValue;
6525            prevValue = nextValue;
6526            listener(nextValue, oldValue, this);
6527          }
6528        });
6529      }
6530    };
6531  
6532    // node_modules/@base-ui/react/floating-ui-react/components/FloatingRootStore.mjs
6533    var selectors = {
6534      open: createSelector((state) => state.open),
6535      transitionStatus: createSelector((state) => state.transitionStatus),
6536      domReferenceElement: createSelector((state) => state.domReferenceElement),
6537      referenceElement: createSelector((state) => state.positionReference ?? state.referenceElement),
6538      floatingElement: createSelector((state) => state.floatingElement),
6539      floatingId: createSelector((state) => state.floatingId)
6540    };
6541    var FloatingRootStore = class extends ReactStore {
6542      constructor(options) {
6543        const {
6544          syncOnly,
6545          nested,
6546          onOpenChange,
6547          triggerElements,
6548          ...initialState
6549        } = options;
6550        super({
6551          ...initialState,
6552          positionReference: initialState.referenceElement,
6553          domReferenceElement: initialState.referenceElement
6554        }, {
6555          onOpenChange,
6556          dataRef: {
6557            current: {}
6558          },
6559          events: createEventEmitter(),
6560          nested,
6561          triggerElements
6562        }, selectors);
6563        this.syncOnly = syncOnly;
6564      }
6565      /**
6566       * Syncs the event used by hover logic to distinguish hover-open from click-like interaction.
6567       */
6568      syncOpenEvent = (newOpen, event) => {
6569        if (!newOpen || !this.state.open || // Prevent a pending hover-open from overwriting a click-open event, while allowing
6570        // click events to upgrade a hover-open.
6571        event != null && isClickLikeEvent(event)) {
6572          this.context.dataRef.current.openEvent = newOpen ? event : void 0;
6573        }
6574      };
6575      /**
6576       * Runs the root-owned side effects for an open state change.
6577       */
6578      dispatchOpenChange = (newOpen, eventDetails) => {
6579        this.syncOpenEvent(newOpen, eventDetails.event);
6580        const details = {
6581          open: newOpen,
6582          reason: eventDetails.reason,
6583          nativeEvent: eventDetails.event,
6584          nested: this.context.nested,
6585          triggerElement: eventDetails.trigger
6586        };
6587        this.context.events.emit("openchange", details);
6588      };
6589      /**
6590       * Emits the `openchange` event through the internal event emitter and calls the `onOpenChange` handler with the provided arguments.
6591       *
6592       * @param newOpen The new open state.
6593       * @param eventDetails Details about the event that triggered the open state change.
6594       */
6595      setOpen = (newOpen, eventDetails) => {
6596        if (this.syncOnly) {
6597          this.context.onOpenChange?.(newOpen, eventDetails);
6598          return;
6599        }
6600        this.dispatchOpenChange(newOpen, eventDetails);
6601        this.context.onOpenChange?.(newOpen, eventDetails);
6602      };
6603    };
6604  
6605    // node_modules/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.mjs
6606    function useSyncedFloatingRootContext(options) {
6607      const {
6608        popupStore,
6609        treatPopupAsFloatingElement = false,
6610        floatingRootContext: floatingRootContextProp,
6611        floatingId,
6612        nested,
6613        onOpenChange
6614      } = options;
6615      const open = popupStore.useState("open");
6616      const referenceElement = popupStore.useState("activeTriggerElement");
6617      const floatingElement = popupStore.useState(treatPopupAsFloatingElement ? "popupElement" : "positionerElement");
6618      const triggerElements = popupStore.context.triggerElements;
6619      const handleOpenChange = onOpenChange;
6620      const internalStoreRef = React23.useRef(null);
6621      if (floatingRootContextProp === void 0 && internalStoreRef.current === null) {
6622        internalStoreRef.current = new FloatingRootStore({
6623          open,
6624          transitionStatus: void 0,
6625          referenceElement,
6626          floatingElement,
6627          triggerElements,
6628          onOpenChange: handleOpenChange,
6629          floatingId,
6630          syncOnly: true,
6631          nested
6632        });
6633      }
6634      const store = floatingRootContextProp ?? internalStoreRef.current;
6635      popupStore.useSyncedValue("floatingId", floatingId);
6636      useIsoLayoutEffect(() => {
6637        const valuesToSync = {
6638          open,
6639          floatingId,
6640          referenceElement,
6641          floatingElement
6642        };
6643        if (isElement(referenceElement)) {
6644          valuesToSync.domReferenceElement = referenceElement;
6645        }
6646        if (store.state.positionReference === store.state.referenceElement) {
6647          valuesToSync.positionReference = referenceElement;
6648        }
6649        store.update(valuesToSync);
6650      }, [open, floatingId, referenceElement, floatingElement, store]);
6651      store.context.onOpenChange = handleOpenChange;
6652      store.context.nested = nested;
6653      return store;
6654    }
6655  
6656    // node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs
6657    var FOCUSABLE_POPUP_PROPS = {
6658      tabIndex: -1,
6659      [FOCUSABLE_ATTRIBUTE]: ""
6660    };
6661    function usePopupStore(externalStore, createStore2, treatPopupAsFloatingElement = false) {
6662      const floatingId = useId();
6663      const nested = useFloatingParentNodeId() != null;
6664      const internalStoreRef = React24.useRef(null);
6665      if (externalStore === void 0 && internalStoreRef.current === null) {
6666        internalStoreRef.current = createStore2(floatingId, nested);
6667      }
6668      const store = externalStore ?? internalStoreRef.current;
6669      useSyncedFloatingRootContext({
6670        popupStore: store,
6671        treatPopupAsFloatingElement,
6672        floatingRootContext: store.state.floatingRootContext,
6673        floatingId,
6674        nested,
6675        onOpenChange: store.setOpen
6676      });
6677      return {
6678        store,
6679        internalStore: internalStoreRef.current
6680      };
6681    }
6682    function useTriggerRegistration(id, store) {
6683      const registeredElementIdRef = React24.useRef(null);
6684      const registeredElementRef = React24.useRef(null);
6685      return React24.useCallback((element) => {
6686        if (id === void 0) {
6687          return;
6688        }
6689        let shouldSyncTriggerCount = false;
6690        if (registeredElementIdRef.current !== null) {
6691          const registeredId = registeredElementIdRef.current;
6692          const registeredElement = registeredElementRef.current;
6693          const currentElement = store.context.triggerElements.getById(registeredId);
6694          if (registeredElement && currentElement === registeredElement) {
6695            store.context.triggerElements.delete(registeredId);
6696            shouldSyncTriggerCount = true;
6697          }
6698          registeredElementIdRef.current = null;
6699          registeredElementRef.current = null;
6700        }
6701        if (element !== null) {
6702          registeredElementIdRef.current = id;
6703          registeredElementRef.current = element;
6704          store.context.triggerElements.add(id, element);
6705          shouldSyncTriggerCount = true;
6706        }
6707        if (shouldSyncTriggerCount) {
6708          const triggerCount = store.context.triggerElements.size;
6709          if (store.select("open") && store.state.triggerCount !== triggerCount) {
6710            store.set("triggerCount", triggerCount);
6711          }
6712        }
6713      }, [store, id]);
6714    }
6715    function setPopupOpenState(state, open, trigger, preventUnmountOnClose = false) {
6716      if (open) {
6717        state.preventUnmountingOnClose = false;
6718      } else if (preventUnmountOnClose) {
6719        state.preventUnmountingOnClose = true;
6720      }
6721      const triggerId = trigger?.id ?? null;
6722      if (triggerId || open) {
6723        state.activeTriggerId = triggerId;
6724        state.activeTriggerElement = trigger ?? null;
6725      }
6726    }
6727    function attachPreventUnmountOnClose(eventDetails) {
6728      let preventUnmountOnClose = false;
6729      eventDetails.preventUnmountOnClose = () => {
6730        preventUnmountOnClose = true;
6731      };
6732      return () => preventUnmountOnClose;
6733    }
6734    function applyPopupOpenChange(store, nextOpen, eventDetails, options = {}) {
6735      const reason = eventDetails.reason;
6736      const isHover = reason === reason_parts_exports.triggerHover;
6737      const isFocusOpen = nextOpen && reason === reason_parts_exports.triggerFocus;
6738      const isDismissClose = !nextOpen && (reason === reason_parts_exports.triggerPress || reason === reason_parts_exports.escapeKey);
6739      const shouldPreventUnmountOnClose = attachPreventUnmountOnClose(eventDetails);
6740      store.context.onOpenChange?.(nextOpen, eventDetails);
6741      if (eventDetails.isCanceled) {
6742        return;
6743      }
6744      options.onBeforeDispatch?.();
6745      store.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails);
6746      const changeState = () => {
6747        const updatedState = {
6748          ...options.extraState,
6749          open: nextOpen
6750        };
6751        if (isFocusOpen) {
6752          updatedState.instantType = "focus";
6753        } else if (isDismissClose) {
6754          updatedState.instantType = "dismiss";
6755        } else if (isHover) {
6756          updatedState.instantType = void 0;
6757        }
6758        setPopupOpenState(updatedState, nextOpen, eventDetails.trigger, shouldPreventUnmountOnClose());
6759        store.update(updatedState);
6760      };
6761      if (isHover) {
6762        ReactDOM4.flushSync(changeState);
6763      } else {
6764        changeState();
6765      }
6766    }
6767    function useInitialOpenSync(store, openProp, defaultOpen, defaultTriggerId) {
6768      useOnFirstRender(() => {
6769        if (openProp === void 0 && store.state.open === false && defaultOpen) {
6770          store.state = {
6771            ...store.state,
6772            open: true,
6773            activeTriggerId: defaultTriggerId,
6774            preventUnmountingOnClose: false
6775          };
6776        }
6777      });
6778    }
6779    function useTriggerDataForwarding(triggerId, triggerElementRef, store, stateUpdates) {
6780      const isMountedByThisTrigger = store.useState("isMountedByTrigger", triggerId);
6781      const baseRegisterTrigger = useTriggerRegistration(triggerId, store);
6782      const registerTrigger = useStableCallback((element) => {
6783        baseRegisterTrigger(element);
6784        if (!element) {
6785          return;
6786        }
6787        const open = store.select("open");
6788        const activeTriggerId = store.select("activeTriggerId");
6789        if (activeTriggerId === triggerId) {
6790          store.update({
6791            activeTriggerElement: element,
6792            ...open ? stateUpdates : null
6793          });
6794          return;
6795        }
6796        if (activeTriggerId == null && open) {
6797          store.update({
6798            activeTriggerId: triggerId,
6799            activeTriggerElement: element,
6800            ...stateUpdates
6801          });
6802        }
6803      });
6804      useIsoLayoutEffect(() => {
6805        if (isMountedByThisTrigger) {
6806          store.update({
6807            activeTriggerElement: triggerElementRef.current,
6808            ...stateUpdates
6809          });
6810        }
6811      }, [isMountedByThisTrigger, store, triggerElementRef, ...Object.values(stateUpdates)]);
6812      return {
6813        registerTrigger,
6814        isMountedByThisTrigger
6815      };
6816    }
6817    function useImplicitActiveTrigger(store, options = {}) {
6818      const {
6819        closeOnActiveTriggerUnmount = false
6820      } = options;
6821      const open = store.useState("open");
6822      const reactiveTriggerCount = store.useState("triggerCount");
6823      useIsoLayoutEffect(() => {
6824        if (!open) {
6825          if (store.state.triggerCount !== 0) {
6826            store.set("triggerCount", 0);
6827          }
6828          return;
6829        }
6830        const triggerCount = store.context.triggerElements.size;
6831        const stateUpdates = {};
6832        if (store.state.triggerCount !== triggerCount) {
6833          stateUpdates.triggerCount = triggerCount;
6834        }
6835        const activeTriggerId = store.select("activeTriggerId");
6836        let lostActiveTriggerId = null;
6837        if (activeTriggerId) {
6838          const activeTriggerElement = store.context.triggerElements.getById(activeTriggerId);
6839          if (!activeTriggerElement) {
6840            lostActiveTriggerId = activeTriggerId;
6841          } else if (activeTriggerElement !== store.state.activeTriggerElement) {
6842            stateUpdates.activeTriggerElement = activeTriggerElement;
6843          }
6844        }
6845        if (!lostActiveTriggerId && !activeTriggerId && triggerCount === 1) {
6846          const iteratorResult = store.context.triggerElements.entries().next();
6847          if (!iteratorResult.done) {
6848            const [implicitTriggerId, implicitTriggerElement] = iteratorResult.value;
6849            stateUpdates.activeTriggerId = implicitTriggerId;
6850            stateUpdates.activeTriggerElement = implicitTriggerElement;
6851          }
6852        }
6853        if (stateUpdates.triggerCount !== void 0 || stateUpdates.activeTriggerId !== void 0 || stateUpdates.activeTriggerElement !== void 0) {
6854          store.update(stateUpdates);
6855        }
6856        if (lostActiveTriggerId) {
6857          if (closeOnActiveTriggerUnmount) {
6858            queueMicrotask(() => {
6859              if (store.select("open") && store.select("activeTriggerId") === lostActiveTriggerId && !store.context.triggerElements.getById(lostActiveTriggerId)) {
6860                const eventDetails = createChangeEventDetails(reason_parts_exports.none);
6861                store.setOpen(false, eventDetails);
6862                if (!eventDetails.isCanceled) {
6863                  store.update({
6864                    activeTriggerId: null,
6865                    activeTriggerElement: null
6866                  });
6867                }
6868              }
6869            });
6870          }
6871        }
6872      }, [open, store, reactiveTriggerCount, closeOnActiveTriggerUnmount]);
6873    }
6874    function useOpenStateTransitions(open, store, onUnmount) {
6875      const {
6876        mounted,
6877        setMounted,
6878        transitionStatus
6879      } = useTransitionStatus(open);
6880      const preventUnmountingOnClose = store.useState("preventUnmountingOnClose");
6881      const syncedPreventUnmountingOnClose = open ? false : preventUnmountingOnClose;
6882      store.useSyncedValues({
6883        mounted,
6884        transitionStatus,
6885        preventUnmountingOnClose: syncedPreventUnmountingOnClose
6886      });
6887      const forceUnmount = useStableCallback(() => {
6888        setMounted(false);
6889        store.update({
6890          activeTriggerId: null,
6891          activeTriggerElement: null,
6892          mounted: false,
6893          preventUnmountingOnClose: false
6894        });
6895        onUnmount?.();
6896        store.context.onOpenChangeComplete?.(false);
6897      });
6898      useOpenChangeComplete({
6899        enabled: mounted && !open && !syncedPreventUnmountingOnClose,
6900        open,
6901        ref: store.context.popupRef,
6902        onComplete() {
6903          if (!open) {
6904            forceUnmount();
6905          }
6906        }
6907      });
6908      return {
6909        forceUnmount,
6910        transitionStatus
6911      };
6912    }
6913    function usePopupInteractionProps(store, statePart) {
6914      store.useSyncedValues(statePart);
6915      useIsoLayoutEffect(() => () => {
6916        store.update({
6917          activeTriggerProps: EMPTY_OBJECT,
6918          inactiveTriggerProps: EMPTY_OBJECT,
6919          popupProps: EMPTY_OBJECT
6920        });
6921      }, [store]);
6922    }
6923  
6924    // node_modules/@base-ui/react/utils/popups/popupTriggerMap.mjs
6925    var PopupTriggerMap = class {
6926      constructor() {
6927        this.elementsSet = /* @__PURE__ */ new Set();
6928        this.idMap = /* @__PURE__ */ new Map();
6929      }
6930      /**
6931       * Adds a trigger element with the given ID.
6932       *
6933       * Note: The provided element is assumed to not be registered under multiple IDs.
6934       */
6935      add(id, element) {
6936        const existingElement = this.idMap.get(id);
6937        if (existingElement === element) {
6938          return;
6939        }
6940        if (existingElement !== void 0) {
6941          this.elementsSet.delete(existingElement);
6942        }
6943        this.elementsSet.add(element);
6944        this.idMap.set(id, element);
6945        if (true) {
6946          if (this.elementsSet.size !== this.idMap.size) {
6947            throw new Error("Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap.");
6948          }
6949        }
6950      }
6951      /**
6952       * Removes the trigger element with the given ID.
6953       */
6954      delete(id) {
6955        const element = this.idMap.get(id);
6956        if (element) {
6957          this.elementsSet.delete(element);
6958          this.idMap.delete(id);
6959        }
6960      }
6961      /**
6962       * Whether the given element is registered as a trigger.
6963       */
6964      hasElement(element) {
6965        return this.elementsSet.has(element);
6966      }
6967      /**
6968       * Whether there is a registered trigger element matching the given predicate.
6969       */
6970      hasMatchingElement(predicate) {
6971        for (const element of this.elementsSet) {
6972          if (predicate(element)) {
6973            return true;
6974          }
6975        }
6976        return false;
6977      }
6978      /**
6979       * Returns the trigger element associated with the given ID, or undefined if no such element exists.
6980       */
6981      getById(id) {
6982        return this.idMap.get(id);
6983      }
6984      /**
6985       * Returns an iterable of all registered trigger entries, where each entry is a tuple of [id, element].
6986       */
6987      entries() {
6988        return this.idMap.entries();
6989      }
6990      /**
6991       * Returns an iterable of all registered trigger elements.
6992       */
6993      elements() {
6994        return this.elementsSet.values();
6995      }
6996      /**
6997       * Returns the number of registered trigger elements.
6998       */
6999      get size() {
7000        return this.idMap.size;
7001      }
7002    };
7003  
7004    // node_modules/@base-ui/react/floating-ui-react/utils/getEmptyRootContext.mjs
7005    function getEmptyRootContext() {
7006      return new FloatingRootStore({
7007        open: false,
7008        transitionStatus: void 0,
7009        floatingElement: null,
7010        referenceElement: null,
7011        triggerElements: new PopupTriggerMap(),
7012        floatingId: void 0,
7013        syncOnly: false,
7014        nested: false,
7015        onOpenChange: void 0
7016      });
7017    }
7018  
7019    // node_modules/@base-ui/react/utils/popups/store.mjs
7020    function createInitialPopupStoreState() {
7021      return {
7022        open: false,
7023        openProp: void 0,
7024        mounted: false,
7025        transitionStatus: void 0,
7026        floatingRootContext: getEmptyRootContext(),
7027        floatingId: void 0,
7028        triggerCount: 0,
7029        preventUnmountingOnClose: false,
7030        payload: void 0,
7031        activeTriggerId: null,
7032        activeTriggerElement: null,
7033        triggerIdProp: void 0,
7034        popupElement: null,
7035        positionerElement: null,
7036        activeTriggerProps: EMPTY_OBJECT,
7037        inactiveTriggerProps: EMPTY_OBJECT,
7038        popupProps: EMPTY_OBJECT
7039      };
7040    }
7041    function createPopupFloatingRootContext(triggerElements, floatingId, nested = false) {
7042      return new FloatingRootStore({
7043        open: false,
7044        transitionStatus: void 0,
7045        floatingElement: null,
7046        referenceElement: null,
7047        triggerElements,
7048        floatingId,
7049        syncOnly: true,
7050        nested,
7051        onOpenChange: void 0
7052      });
7053    }
7054    var activeTriggerIdSelector = createSelector((state) => state.triggerIdProp ?? state.activeTriggerId);
7055    var openSelector = createSelector((state) => state.openProp ?? state.open);
7056    var popupIdSelector = createSelector((state) => {
7057      const popupId = state.popupElement?.id ?? state.floatingId;
7058      return popupId || void 0;
7059    });
7060    function triggerOwnsOpenPopup(state, triggerId) {
7061      return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) === triggerId;
7062    }
7063    function triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) {
7064      if (triggerOwnsOpenPopup(state, triggerId)) {
7065        return true;
7066      }
7067      return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) == null && state.triggerCount === 1;
7068    }
7069    var popupStoreSelectors = {
7070      open: openSelector,
7071      mounted: createSelector((state) => state.mounted),
7072      transitionStatus: createSelector((state) => state.transitionStatus),
7073      floatingRootContext: createSelector((state) => state.floatingRootContext),
7074      triggerCount: createSelector((state) => state.triggerCount),
7075      preventUnmountingOnClose: createSelector((state) => state.preventUnmountingOnClose),
7076      payload: createSelector((state) => state.payload),
7077      activeTriggerId: activeTriggerIdSelector,
7078      activeTriggerElement: createSelector((state) => state.mounted ? state.activeTriggerElement : null),
7079      popupId: popupIdSelector,
7080      /**
7081       * Whether the trigger with the given ID was used to open the popup.
7082       */
7083      isTriggerActive: createSelector((state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId),
7084      /**
7085       * Whether the popup is open and was activated by a trigger with the given ID.
7086       */
7087      isOpenedByTrigger: createSelector((state, triggerId) => triggerOwnsOpenPopup(state, triggerId)),
7088      /**
7089       * Whether the popup is mounted and was activated by a trigger with the given ID.
7090       */
7091      isMountedByTrigger: createSelector((state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId && state.mounted),
7092      triggerProps: createSelector((state, isActive) => isActive ? state.activeTriggerProps : state.inactiveTriggerProps),
7093      /**
7094       * Popup id for the trigger that currently owns the open popup.
7095       */
7096      triggerPopupId: createSelector((state, triggerId) => triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) ? popupIdSelector(state) : void 0),
7097      popupProps: createSelector((state) => state.popupProps),
7098      popupElement: createSelector((state) => state.popupElement),
7099      positionerElement: createSelector((state) => state.positionerElement)
7100    };
7101  
7102    // node_modules/@base-ui/react/floating-ui-react/hooks/useFloatingRootContext.mjs
7103    function useFloatingRootContext(options) {
7104      const {
7105        open = false,
7106        onOpenChange,
7107        elements = {}
7108      } = options;
7109      const floatingId = useId();
7110      const nested = useFloatingParentNodeId() != null;
7111      if (true) {
7112        const optionDomReference = elements.reference;
7113        if (optionDomReference && !isElement(optionDomReference)) {
7114          console.error("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `context.setPositionReference()`", "instead.");
7115        }
7116      }
7117      const store = useRefWithInit(() => new FloatingRootStore({
7118        open,
7119        transitionStatus: void 0,
7120        onOpenChange,
7121        referenceElement: elements.reference ?? null,
7122        floatingElement: elements.floating ?? null,
7123        triggerElements: new PopupTriggerMap(),
7124        floatingId,
7125        syncOnly: false,
7126        nested
7127      })).current;
7128      useIsoLayoutEffect(() => {
7129        const valuesToSync = {
7130          open,
7131          floatingId
7132        };
7133        if (elements.reference !== void 0) {
7134          valuesToSync.referenceElement = elements.reference;
7135          valuesToSync.domReferenceElement = isElement(elements.reference) ? elements.reference : null;
7136        }
7137        if (elements.floating !== void 0) {
7138          valuesToSync.floatingElement = elements.floating;
7139        }
7140        store.update(valuesToSync);
7141      }, [open, floatingId, elements.reference, elements.floating, store]);
7142      store.context.onOpenChange = onOpenChange;
7143      store.context.nested = nested;
7144      return store;
7145    }
7146  
7147    // node_modules/@base-ui/react/floating-ui-react/hooks/useFloating.mjs
7148    function useFloating2(options = {}) {
7149      const {
7150        nodeId,
7151        externalTree
7152      } = options;
7153      const internalStore = useFloatingRootContext(options);
7154      const store = options.rootContext || internalStore;
7155      const referenceElement = store.useState("referenceElement");
7156      const floatingElement = store.useState("floatingElement");
7157      const domReferenceElement = store.useState("domReferenceElement");
7158      const open = store.useState("open");
7159      const floatingId = store.useState("floatingId");
7160      const [positionReference, setPositionReferenceRaw] = React25.useState(null);
7161      const [localDomReference, setLocalDomReference] = React25.useState(void 0);
7162      const [localFloatingElement, setLocalFloatingElement] = React25.useState(void 0);
7163      const domReferenceRef = React25.useRef(null);
7164      const tree = useFloatingTree(externalTree);
7165      const storeElements = React25.useMemo(() => ({
7166        reference: referenceElement,
7167        floating: floatingElement,
7168        domReference: domReferenceElement
7169      }), [referenceElement, floatingElement, domReferenceElement]);
7170      const position = useFloating({
7171        ...options,
7172        elements: {
7173          ...storeElements,
7174          ...positionReference && {
7175            reference: positionReference
7176          }
7177        }
7178      });
7179      const localDomReferenceElement = isElement(localDomReference) ? localDomReference : null;
7180      const syncedFloatingElement = localFloatingElement === void 0 ? store.state.floatingElement : localFloatingElement;
7181      store.useSyncedValue("referenceElement", localDomReference ?? null);
7182      store.useSyncedValue("domReferenceElement", localDomReference === void 0 ? domReferenceElement : localDomReferenceElement);
7183      store.useSyncedValue("floatingElement", syncedFloatingElement);
7184      const setPositionReference = React25.useCallback((node) => {
7185        const computedPositionReference = isElement(node) ? {
7186          getBoundingClientRect: () => node.getBoundingClientRect(),
7187          getClientRects: () => node.getClientRects(),
7188          contextElement: node
7189        } : node;
7190        setPositionReferenceRaw(computedPositionReference);
7191        position.refs.setReference(computedPositionReference);
7192      }, [position.refs]);
7193      const setReference = React25.useCallback((node) => {
7194        if (isElement(node) || node === null) {
7195          domReferenceRef.current = node;
7196          setLocalDomReference(node);
7197        }
7198        if (isElement(position.refs.reference.current) || position.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
7199        // `null` to support `positionReference` + an unstable `reference`
7200        // callback ref.
7201        node !== null && !isElement(node)) {
7202          position.refs.setReference(node);
7203        }
7204      }, [position.refs, setLocalDomReference]);
7205      const setFloating = React25.useCallback((node) => {
7206        setLocalFloatingElement(node);
7207        position.refs.setFloating(node);
7208      }, [position.refs]);
7209      const refs = React25.useMemo(() => ({
7210        ...position.refs,
7211        setReference,
7212        setFloating,
7213        setPositionReference,
7214        domReference: domReferenceRef
7215      }), [position.refs, setReference, setFloating, setPositionReference]);
7216      const elements = React25.useMemo(() => ({
7217        ...position.elements,
7218        domReference: domReferenceElement
7219      }), [position.elements, domReferenceElement]);
7220      const context = React25.useMemo(() => ({
7221        ...position,
7222        dataRef: store.context.dataRef,
7223        open,
7224        onOpenChange: store.setOpen,
7225        events: store.context.events,
7226        floatingId,
7227        refs,
7228        elements,
7229        nodeId,
7230        rootStore: store
7231      }), [position, refs, elements, nodeId, store, open, floatingId]);
7232      useIsoLayoutEffect(() => {
7233        if (domReferenceElement) {
7234          domReferenceRef.current = domReferenceElement;
7235        }
7236      }, [domReferenceElement]);
7237      useIsoLayoutEffect(() => {
7238        store.context.dataRef.current.floatingContext = context;
7239        const node = tree?.nodesRef.current.find((n2) => n2.id === nodeId);
7240        if (node) {
7241          node.context = context;
7242        }
7243      });
7244      return React25.useMemo(() => ({
7245        ...position,
7246        context,
7247        refs,
7248        elements,
7249        rootStore: store
7250      }), [position, refs, elements, context, store]);
7251    }
7252  
7253    // node_modules/@base-ui/react/floating-ui-react/hooks/useFocus.mjs
7254    var React26 = __toESM(require_react(), 1);
7255    var isMacSafari = parts_exports.os.mac && parts_exports.engine.webkit;
7256    function useFocus(context, props = {}) {
7257      const {
7258        enabled = true,
7259        delay
7260      } = props;
7261      const store = "rootStore" in context ? context.rootStore : context;
7262      const {
7263        events,
7264        dataRef
7265      } = store.context;
7266      const blockFocusRef = React26.useRef(false);
7267      const blockedReferenceRef = React26.useRef(null);
7268      const keyboardModalityRef = React26.useRef(true);
7269      const timeout = useTimeout();
7270      React26.useEffect(() => {
7271        const domReference = store.select("domReferenceElement");
7272        if (!enabled) {
7273          return void 0;
7274        }
7275        const win = getWindow(domReference);
7276        function onBlur() {
7277          const currentDomReference = store.select("domReferenceElement");
7278          if (!store.select("open") && isHTMLElement(currentDomReference) && currentDomReference === activeElement(ownerDocument(currentDomReference))) {
7279            blockFocusRef.current = true;
7280          }
7281        }
7282        function onKeyDown() {
7283          keyboardModalityRef.current = true;
7284        }
7285        function onPointerDown() {
7286          keyboardModalityRef.current = false;
7287        }
7288        return mergeCleanups(addEventListener(win, "blur", onBlur), isMacSafari && addEventListener(win, "keydown", onKeyDown, true), isMacSafari && addEventListener(win, "pointerdown", onPointerDown, true));
7289      }, [store, enabled]);
7290      React26.useEffect(() => {
7291        if (!enabled) {
7292          return void 0;
7293        }
7294        function onOpenChangeLocal(details) {
7295          if (details.reason === reason_parts_exports.triggerPress || details.reason === reason_parts_exports.escapeKey) {
7296            const referenceElement = store.select("domReferenceElement");
7297            if (isElement(referenceElement)) {
7298              blockedReferenceRef.current = referenceElement;
7299              blockFocusRef.current = true;
7300            }
7301          }
7302        }
7303        events.on("openchange", onOpenChangeLocal);
7304        return () => {
7305          events.off("openchange", onOpenChangeLocal);
7306        };
7307      }, [events, enabled, store]);
7308      const reference = React26.useMemo(() => {
7309        function resetBlockedFocus() {
7310          blockFocusRef.current = false;
7311          blockedReferenceRef.current = null;
7312        }
7313        return {
7314          onMouseLeave() {
7315            resetBlockedFocus();
7316          },
7317          onFocus(event) {
7318            const focusTarget = event.currentTarget;
7319            if (blockFocusRef.current) {
7320              if (blockedReferenceRef.current === focusTarget) {
7321                return;
7322              }
7323              resetBlockedFocus();
7324            }
7325            const target = getTarget(event.nativeEvent);
7326            if (isElement(target)) {
7327              if (isMacSafari && !event.relatedTarget) {
7328                if (!keyboardModalityRef.current && !isTypeableElement(target)) {
7329                  return;
7330                }
7331              } else if (!matchesFocusVisible(target)) {
7332                return;
7333              }
7334            }
7335            const movedFromOtherEnabledTrigger = isTargetInsideEnabledTrigger(event.relatedTarget, store.context.triggerElements);
7336            const {
7337              nativeEvent,
7338              currentTarget
7339            } = event;
7340            const delayValue = typeof delay === "function" ? delay() : delay;
7341            if (store.select("open") && movedFromOtherEnabledTrigger || delayValue === 0 || delayValue === void 0) {
7342              store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget));
7343              return;
7344            }
7345            timeout.start(delayValue, () => {
7346              if (blockFocusRef.current) {
7347                return;
7348              }
7349              store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget));
7350            });
7351          },
7352          onBlur(event) {
7353            resetBlockedFocus();
7354            const relatedTarget = event.relatedTarget;
7355            const nativeEvent = event.nativeEvent;
7356            const movedToFocusGuard = isElement(relatedTarget) && relatedTarget.hasAttribute(createAttribute("focus-guard")) && relatedTarget.getAttribute("data-type") === "outside";
7357            timeout.start(0, () => {
7358              const domReference = store.select("domReferenceElement");
7359              const activeEl = activeElement(ownerDocument(domReference));
7360              if (!relatedTarget && activeEl === domReference) {
7361                return;
7362              }
7363              if (contains(dataRef.current.floatingContext?.refs.floating.current, activeEl) || contains(domReference, activeEl) || movedToFocusGuard) {
7364                return;
7365              }
7366              const nextFocusedElement = relatedTarget ?? activeEl;
7367              if (isTargetInsideEnabledTrigger(nextFocusedElement, store.context.triggerElements)) {
7368                return;
7369              }
7370              store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent));
7371            });
7372          }
7373        };
7374      }, [dataRef, delay, store, timeout]);
7375      return React26.useMemo(() => enabled ? {
7376        reference,
7377        trigger: reference
7378      } : {}, [enabled, reference]);
7379    }
7380  
7381    // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverFloatingInteraction.mjs
7382    var React27 = __toESM(require_react(), 1);
7383  
7384    // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverInteractionSharedState.mjs
7385    var HoverInteraction = class _HoverInteraction {
7386      constructor() {
7387        this.pointerType = void 0;
7388        this.interactedInside = false;
7389        this.handler = void 0;
7390        this.blockMouseMove = true;
7391        this.performedPointerEventsMutation = false;
7392        this.pointerEventsScopeElement = null;
7393        this.pointerEventsReferenceElement = null;
7394        this.pointerEventsFloatingElement = null;
7395        this.restTimeoutPending = false;
7396        this.openChangeTimeout = new Timeout();
7397        this.restTimeout = new Timeout();
7398        this.handleCloseOptions = void 0;
7399      }
7400      static create() {
7401        return new _HoverInteraction();
7402      }
7403      dispose = () => {
7404        this.openChangeTimeout.clear();
7405        this.restTimeout.clear();
7406      };
7407      disposeEffect = () => {
7408        return this.dispose;
7409      };
7410    };
7411    var pointerEventsMutationOwnerByScopeElement = /* @__PURE__ */ new WeakMap();
7412    function clearSafePolygonPointerEventsMutation(instance) {
7413      if (!instance.performedPointerEventsMutation) {
7414        return;
7415      }
7416      const scopeElement = instance.pointerEventsScopeElement;
7417      if (scopeElement && pointerEventsMutationOwnerByScopeElement.get(scopeElement) === instance) {
7418        instance.pointerEventsScopeElement?.style.removeProperty("pointer-events");
7419        instance.pointerEventsReferenceElement?.style.removeProperty("pointer-events");
7420        instance.pointerEventsFloatingElement?.style.removeProperty("pointer-events");
7421        pointerEventsMutationOwnerByScopeElement.delete(scopeElement);
7422      }
7423      instance.performedPointerEventsMutation = false;
7424      instance.pointerEventsScopeElement = null;
7425      instance.pointerEventsReferenceElement = null;
7426      instance.pointerEventsFloatingElement = null;
7427    }
7428    function applySafePolygonPointerEventsMutation(instance, options) {
7429      const {
7430        scopeElement,
7431        referenceElement,
7432        floatingElement
7433      } = options;
7434      const existingOwner = pointerEventsMutationOwnerByScopeElement.get(scopeElement);
7435      if (existingOwner && existingOwner !== instance) {
7436        clearSafePolygonPointerEventsMutation(existingOwner);
7437      }
7438      clearSafePolygonPointerEventsMutation(instance);
7439      instance.performedPointerEventsMutation = true;
7440      instance.pointerEventsScopeElement = scopeElement;
7441      instance.pointerEventsReferenceElement = referenceElement;
7442      instance.pointerEventsFloatingElement = floatingElement;
7443      pointerEventsMutationOwnerByScopeElement.set(scopeElement, instance);
7444      scopeElement.style.pointerEvents = "none";
7445      referenceElement.style.pointerEvents = "auto";
7446      floatingElement.style.pointerEvents = "auto";
7447    }
7448    function useHoverInteractionSharedState(store) {
7449      const data = store.context.dataRef.current;
7450      const instance = useRefWithInit(() => data.hoverInteractionState ?? HoverInteraction.create()).current;
7451      if (!data.hoverInteractionState) {
7452        data.hoverInteractionState = instance;
7453      }
7454      useOnMount(data.hoverInteractionState.disposeEffect);
7455      return data.hoverInteractionState;
7456    }
7457  
7458    // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverFloatingInteraction.mjs
7459    function useHoverFloatingInteraction(context, parameters = {}) {
7460      const {
7461        enabled = true,
7462        closeDelay: closeDelayProp = 0,
7463        nodeId: nodeIdProp
7464      } = parameters;
7465      const store = "rootStore" in context ? context.rootStore : context;
7466      const open = store.useState("open");
7467      const floatingElement = store.useState("floatingElement");
7468      const domReferenceElement = store.useState("domReferenceElement");
7469      const {
7470        dataRef
7471      } = store.context;
7472      const tree = useFloatingTree();
7473      const parentId = useFloatingParentNodeId();
7474      const instance = useHoverInteractionSharedState(store);
7475      const childClosedTimeout = useTimeout();
7476      const isClickLikeOpenEvent2 = useStableCallback(() => {
7477        return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside);
7478      });
7479      const isHoverOpen = useStableCallback(() => {
7480        return isHoverOpenEvent(dataRef.current.openEvent?.type);
7481      });
7482      const clearPointerEvents = useStableCallback(() => {
7483        clearSafePolygonPointerEventsMutation(instance);
7484      });
7485      useIsoLayoutEffect(() => {
7486        if (!open) {
7487          instance.pointerType = void 0;
7488          instance.restTimeoutPending = false;
7489          instance.interactedInside = false;
7490          clearPointerEvents();
7491        }
7492      }, [open, instance, clearPointerEvents]);
7493      React27.useEffect(() => {
7494        return clearPointerEvents;
7495      }, [clearPointerEvents]);
7496      useIsoLayoutEffect(() => {
7497        if (!enabled) {
7498          return void 0;
7499        }
7500        if (open && instance.handleCloseOptions?.blockPointerEvents && isHoverOpen() && isElement(domReferenceElement) && floatingElement) {
7501          const ref = domReferenceElement;
7502          const floatingEl = floatingElement;
7503          const doc = ownerDocument(floatingElement);
7504          const parentFloating = tree?.nodesRef.current.find((node) => node.id === parentId)?.context?.elements.floating;
7505          if (parentFloating) {
7506            parentFloating.style.pointerEvents = "";
7507          }
7508          const cachedScopeElement = instance.pointerEventsScopeElement !== floatingEl ? instance.pointerEventsScopeElement : null;
7509          const parentScopeElement = parentFloating !== floatingEl ? parentFloating : null;
7510          const scopeElement = instance.handleCloseOptions?.getScope?.() ?? cachedScopeElement ?? parentScopeElement ?? ref.closest("[data-rootownerid]") ?? doc.body;
7511          applySafePolygonPointerEventsMutation(instance, {
7512            scopeElement,
7513            referenceElement: ref,
7514            floatingElement: floatingEl
7515          });
7516          return () => {
7517            clearPointerEvents();
7518          };
7519        }
7520        return void 0;
7521      }, [enabled, open, domReferenceElement, floatingElement, instance, isHoverOpen, tree, parentId, clearPointerEvents]);
7522      React27.useEffect(() => {
7523        if (!enabled) {
7524          return void 0;
7525        }
7526        function hasParentChildren() {
7527          return !!(tree && parentId && getNodeChildren(tree.nodesRef.current, parentId).length > 0);
7528        }
7529        function closeWithDelay(event) {
7530          const closeDelay = getDelay(closeDelayProp, "close", instance.pointerType);
7531          const close = () => {
7532            store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
7533            tree?.events.emit("floating.closed", event);
7534          };
7535          if (closeDelay) {
7536            instance.openChangeTimeout.start(closeDelay, close);
7537          } else {
7538            instance.openChangeTimeout.clear();
7539            close();
7540          }
7541        }
7542        function handleInteractInside(event) {
7543          const target = getTarget(event);
7544          if (!isInteractiveElement(target)) {
7545            instance.interactedInside = false;
7546            return;
7547          }
7548          instance.interactedInside = target?.closest("[aria-haspopup]") != null;
7549        }
7550        function onFloatingMouseEnter() {
7551          instance.openChangeTimeout.clear();
7552          childClosedTimeout.clear();
7553          tree?.events.off("floating.closed", onNodeClosed);
7554          clearPointerEvents();
7555        }
7556        function onFloatingMouseLeave(event) {
7557          if (hasParentChildren() && tree) {
7558            tree.events.on("floating.closed", onNodeClosed);
7559            return;
7560          }
7561          if (isTargetInsideEnabledTrigger(event.relatedTarget, store.context.triggerElements)) {
7562            return;
7563          }
7564          const currentNodeId = dataRef.current.floatingContext?.nodeId ?? nodeIdProp;
7565          const relatedTarget = event.relatedTarget;
7566          const isMovingIntoDescendantFloating = tree && currentNodeId && isElement(relatedTarget) && getNodeChildren(tree.nodesRef.current, currentNodeId, false).some((node) => contains(node.context?.elements.floating, relatedTarget));
7567          if (isMovingIntoDescendantFloating) {
7568            return;
7569          }
7570          if (instance.handler) {
7571            instance.handler(event);
7572            return;
7573          }
7574          clearPointerEvents();
7575          if (isHoverOpen() && !isClickLikeOpenEvent2()) {
7576            closeWithDelay(event);
7577          }
7578        }
7579        function onNodeClosed(event) {
7580          if (!tree || !parentId || hasParentChildren()) {
7581            return;
7582          }
7583          childClosedTimeout.start(0, () => {
7584            tree.events.off("floating.closed", onNodeClosed);
7585            store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
7586            tree.events.emit("floating.closed", event);
7587          });
7588        }
7589        const floating = floatingElement;
7590        return mergeCleanups(floating && addEventListener(floating, "mouseenter", onFloatingMouseEnter), floating && addEventListener(floating, "mouseleave", onFloatingMouseLeave), floating && addEventListener(floating, "pointerdown", handleInteractInside, true), () => {
7591          tree?.events.off("floating.closed", onNodeClosed);
7592        });
7593      }, [enabled, floatingElement, store, dataRef, closeDelayProp, nodeIdProp, isHoverOpen, isClickLikeOpenEvent2, clearPointerEvents, instance, tree, parentId, childClosedTimeout]);
7594    }
7595  
7596    // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverReferenceInteraction.mjs
7597    var React28 = __toESM(require_react(), 1);
7598    var ReactDOM5 = __toESM(require_react_dom(), 1);
7599    var EMPTY_REF = {
7600      current: null
7601    };
7602    function useHoverReferenceInteraction(context, props = {}) {
7603      const {
7604        enabled = true,
7605        delay = 0,
7606        handleClose = null,
7607        mouseOnly = false,
7608        restMs = 0,
7609        move = true,
7610        triggerElementRef = EMPTY_REF,
7611        externalTree,
7612        isActiveTrigger = true,
7613        getHandleCloseContext,
7614        isClosing,
7615        shouldOpen: shouldOpenProp
7616      } = props;
7617      const store = "rootStore" in context ? context.rootStore : context;
7618      const {
7619        dataRef,
7620        events
7621      } = store.context;
7622      const tree = useFloatingTree(externalTree);
7623      const instance = useHoverInteractionSharedState(store);
7624      const isHoverCloseActiveRef = React28.useRef(false);
7625      const handleCloseRef = useValueAsRef(handleClose);
7626      const delayRef = useValueAsRef(delay);
7627      const restMsRef = useValueAsRef(restMs);
7628      const enabledRef = useValueAsRef(enabled);
7629      const shouldOpenRef = useValueAsRef(shouldOpenProp);
7630      const isClosingRef = useValueAsRef(isClosing);
7631      const isClickLikeOpenEvent2 = useStableCallback(() => {
7632        return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside);
7633      });
7634      const checkShouldOpen = useStableCallback(() => {
7635        return shouldOpenRef.current?.() !== false;
7636      });
7637      const isOverInactiveTrigger = useStableCallback((currentDomReference, currentTarget, target) => {
7638        const allTriggers = store.context.triggerElements;
7639        if (allTriggers.hasElement(currentTarget)) {
7640          return !currentDomReference || !contains(currentDomReference, currentTarget);
7641        }
7642        if (!isElement(target)) {
7643          return false;
7644        }
7645        const targetElement = target;
7646        return allTriggers.hasMatchingElement((trigger) => contains(trigger, targetElement)) && (!currentDomReference || !contains(currentDomReference, targetElement));
7647      });
7648      const cleanupMouseMoveHandler = useStableCallback(() => {
7649        if (!instance.handler) {
7650          return;
7651        }
7652        const doc = ownerDocument(store.select("domReferenceElement"));
7653        doc.removeEventListener("mousemove", instance.handler);
7654        instance.handler = void 0;
7655      });
7656      const clearPointerEvents = useStableCallback(() => {
7657        clearSafePolygonPointerEventsMutation(instance);
7658      });
7659      if (isActiveTrigger) {
7660        instance.handleCloseOptions = handleCloseRef.current?.__options;
7661      }
7662      React28.useEffect(() => cleanupMouseMoveHandler, [cleanupMouseMoveHandler]);
7663      React28.useEffect(() => {
7664        if (!enabled) {
7665          return void 0;
7666        }
7667        function onOpenChangeLocal(details) {
7668          if (!details.open) {
7669            isHoverCloseActiveRef.current = details.reason === reason_parts_exports.triggerHover;
7670            cleanupMouseMoveHandler();
7671            instance.openChangeTimeout.clear();
7672            instance.restTimeout.clear();
7673            instance.blockMouseMove = true;
7674            instance.restTimeoutPending = false;
7675          } else {
7676            isHoverCloseActiveRef.current = false;
7677          }
7678        }
7679        events.on("openchange", onOpenChangeLocal);
7680        return () => {
7681          events.off("openchange", onOpenChangeLocal);
7682        };
7683      }, [enabled, events, instance, cleanupMouseMoveHandler]);
7684      React28.useEffect(() => {
7685        if (!enabled) {
7686          return void 0;
7687        }
7688        function closeWithDelay(event, runElseBranch = true) {
7689          const closeDelay = getDelay(delayRef.current, "close", instance.pointerType);
7690          if (closeDelay) {
7691            instance.openChangeTimeout.start(closeDelay, () => {
7692              store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
7693              tree?.events.emit("floating.closed", event);
7694            });
7695          } else if (runElseBranch) {
7696            instance.openChangeTimeout.clear();
7697            store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
7698            tree?.events.emit("floating.closed", event);
7699          }
7700        }
7701        const trigger = triggerElementRef.current ?? (isActiveTrigger ? store.select("domReferenceElement") : null);
7702        if (!isElement(trigger)) {
7703          return void 0;
7704        }
7705        function onMouseEnter(event) {
7706          instance.openChangeTimeout.clear();
7707          instance.blockMouseMove = false;
7708          if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) {
7709            return;
7710          }
7711          const restMsValue = getRestMs(restMsRef.current);
7712          const openDelay = getDelay(delayRef.current, "open", instance.pointerType);
7713          const eventTarget = getTarget(event);
7714          const currentTarget = event.currentTarget ?? null;
7715          const currentDomReference = store.select("domReferenceElement");
7716          let triggerNode = currentTarget;
7717          if (isElement(eventTarget) && !store.context.triggerElements.hasElement(eventTarget)) {
7718            for (const triggerElement of store.context.triggerElements.elements()) {
7719              if (contains(triggerElement, eventTarget)) {
7720                triggerNode = triggerElement;
7721                break;
7722              }
7723            }
7724          }
7725          if (isElement(currentTarget) && isElement(currentDomReference) && !store.context.triggerElements.hasElement(currentTarget) && contains(currentTarget, currentDomReference)) {
7726            triggerNode = currentDomReference;
7727          }
7728          const isOverInactive = triggerNode == null ? false : isOverInactiveTrigger(currentDomReference, triggerNode, eventTarget);
7729          const isOpen = store.select("open");
7730          const isInClosingTransition = isClosingRef.current?.() ?? store.select("transitionStatus") === "ending";
7731          const isHoverCloseTransition = !isOpen && isInClosingTransition && isHoverCloseActiveRef.current;
7732          const isReenteringSameTriggerDuringCloseTransition = !isOverInactive && isElement(triggerNode) && isElement(currentDomReference) && contains(currentDomReference, triggerNode) && isHoverCloseTransition;
7733          const isRestOnlyDelay = restMsValue > 0 && !openDelay;
7734          const shouldOpenImmediately = isOverInactive && (isOpen || isHoverCloseTransition) || isReenteringSameTriggerDuringCloseTransition;
7735          const shouldOpen = !isOpen || isOverInactive;
7736          if (shouldOpenImmediately) {
7737            if (checkShouldOpen()) {
7738              store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode));
7739            }
7740            return;
7741          }
7742          if (isRestOnlyDelay) {
7743            return;
7744          }
7745          if (openDelay) {
7746            instance.openChangeTimeout.start(openDelay, () => {
7747              if (shouldOpen && checkShouldOpen()) {
7748                store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode));
7749              }
7750            });
7751          } else if (shouldOpen) {
7752            if (checkShouldOpen()) {
7753              store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode));
7754            }
7755          }
7756        }
7757        function onMouseLeave(event) {
7758          if (isClickLikeOpenEvent2()) {
7759            clearPointerEvents();
7760            return;
7761          }
7762          cleanupMouseMoveHandler();
7763          const domReferenceElement = store.select("domReferenceElement");
7764          const doc = ownerDocument(domReferenceElement);
7765          instance.restTimeout.clear();
7766          instance.restTimeoutPending = false;
7767          const handleCloseContextBase = dataRef.current.floatingContext ?? getHandleCloseContext?.();
7768          if (isTargetInsideEnabledTrigger(event.relatedTarget, store.context.triggerElements)) {
7769            return;
7770          }
7771          if (handleCloseRef.current && handleCloseContextBase) {
7772            if (!store.select("open")) {
7773              instance.openChangeTimeout.clear();
7774            }
7775            const currentTrigger = triggerElementRef.current;
7776            instance.handler = handleCloseRef.current({
7777              ...handleCloseContextBase,
7778              tree,
7779              x: event.clientX,
7780              y: event.clientY,
7781              onClose() {
7782                clearPointerEvents();
7783                cleanupMouseMoveHandler();
7784                if (enabledRef.current && !isClickLikeOpenEvent2() && currentTrigger === store.select("domReferenceElement")) {
7785                  closeWithDelay(event, true);
7786                }
7787              }
7788            });
7789            doc.addEventListener("mousemove", instance.handler);
7790            instance.handler(event);
7791            return;
7792          }
7793          const shouldClose = instance.pointerType === "touch" ? !contains(store.select("floatingElement"), event.relatedTarget) : true;
7794          if (shouldClose) {
7795            closeWithDelay(event);
7796          }
7797        }
7798        if (move) {
7799          return mergeCleanups(addEventListener(trigger, "mousemove", onMouseEnter, {
7800            once: true
7801          }), addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave));
7802        }
7803        return mergeCleanups(addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave));
7804      }, [cleanupMouseMoveHandler, clearPointerEvents, dataRef, delayRef, store, enabled, handleCloseRef, instance, isActiveTrigger, isOverInactiveTrigger, isClickLikeOpenEvent2, mouseOnly, move, restMsRef, triggerElementRef, tree, enabledRef, getHandleCloseContext, isClosingRef, checkShouldOpen]);
7805      return React28.useMemo(() => {
7806        if (!enabled) {
7807          return void 0;
7808        }
7809        function setPointerRef(event) {
7810          instance.pointerType = event.pointerType;
7811        }
7812        return {
7813          onPointerDown: setPointerRef,
7814          onPointerEnter: setPointerRef,
7815          onMouseMove(event) {
7816            const {
7817              nativeEvent
7818            } = event;
7819            const trigger = event.currentTarget;
7820            const currentDomReference = store.select("domReferenceElement");
7821            const currentOpen = store.select("open");
7822            const isOverInactive = isOverInactiveTrigger(currentDomReference, trigger, event.target);
7823            if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) {
7824              return;
7825            }
7826            if (currentOpen && isOverInactive && instance.handleCloseOptions?.blockPointerEvents) {
7827              const floatingElement = store.select("floatingElement");
7828              if (floatingElement) {
7829                const scopeElement = instance.handleCloseOptions?.getScope?.() ?? trigger.ownerDocument.body;
7830                applySafePolygonPointerEventsMutation(instance, {
7831                  scopeElement,
7832                  referenceElement: trigger,
7833                  floatingElement
7834                });
7835              }
7836            }
7837            const restMsValue = getRestMs(restMsRef.current);
7838            if (currentOpen && !isOverInactive || restMsValue === 0) {
7839              return;
7840            }
7841            if (!isOverInactive && instance.restTimeoutPending && event.movementX ** 2 + event.movementY ** 2 < 2) {
7842              return;
7843            }
7844            instance.restTimeout.clear();
7845            function handleMouseMove() {
7846              instance.restTimeoutPending = false;
7847              if (isClickLikeOpenEvent2()) {
7848                return;
7849              }
7850              const latestOpen = store.select("open");
7851              if (!instance.blockMouseMove && (!latestOpen || isOverInactive) && checkShouldOpen()) {
7852                store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, nativeEvent, trigger));
7853              }
7854            }
7855            if (instance.pointerType === "touch") {
7856              ReactDOM5.flushSync(() => {
7857                handleMouseMove();
7858              });
7859            } else if (isOverInactive && currentOpen) {
7860              handleMouseMove();
7861            } else {
7862              instance.restTimeoutPending = true;
7863              instance.restTimeout.start(restMsValue, handleMouseMove);
7864            }
7865          }
7866        };
7867      }, [enabled, instance, isClickLikeOpenEvent2, isOverInactiveTrigger, mouseOnly, store, restMsRef, checkShouldOpen]);
7868    }
7869  
7870    // node_modules/@base-ui/react/floating-ui-react/safePolygon.mjs
7871    var CURSOR_SPEED_THRESHOLD = 0.1;
7872    var CURSOR_SPEED_THRESHOLD_SQUARED = CURSOR_SPEED_THRESHOLD * CURSOR_SPEED_THRESHOLD;
7873    var POLYGON_BUFFER = 0.5;
7874    function hasIntersectingEdge(pointX, pointY, xi, yi, xj, yj) {
7875      return yi >= pointY !== yj >= pointY && pointX <= (xj - xi) * (pointY - yi) / (yj - yi) + xi;
7876    }
7877    function isPointInQuadrilateral(pointX, pointY, x1, y1, x2, y2, x3, y3, x4, y4) {
7878      let isInsideValue = false;
7879      if (hasIntersectingEdge(pointX, pointY, x1, y1, x2, y2)) {
7880        isInsideValue = !isInsideValue;
7881      }
7882      if (hasIntersectingEdge(pointX, pointY, x2, y2, x3, y3)) {
7883        isInsideValue = !isInsideValue;
7884      }
7885      if (hasIntersectingEdge(pointX, pointY, x3, y3, x4, y4)) {
7886        isInsideValue = !isInsideValue;
7887      }
7888      if (hasIntersectingEdge(pointX, pointY, x4, y4, x1, y1)) {
7889        isInsideValue = !isInsideValue;
7890      }
7891      return isInsideValue;
7892    }
7893    function isInsideRect(pointX, pointY, rect) {
7894      return pointX >= rect.x && pointX <= rect.x + rect.width && pointY >= rect.y && pointY <= rect.y + rect.height;
7895    }
7896    function isInsideAxisAlignedRect(pointX, pointY, x1, y1, x2, y2) {
7897      const minX = Math.min(x1, x2);
7898      const maxX = Math.max(x1, x2);
7899      const minY = Math.min(y1, y2);
7900      const maxY = Math.max(y1, y2);
7901      return pointX >= minX && pointX <= maxX && pointY >= minY && pointY <= maxY;
7902    }
7903    function safePolygon(options = {}) {
7904      const {
7905        blockPointerEvents = false
7906      } = options;
7907      const timeout = new Timeout();
7908      const fn = ({
7909        x: x2,
7910        y: y2,
7911        placement,
7912        elements,
7913        onClose,
7914        nodeId,
7915        tree
7916      }) => {
7917        const side = placement?.split("-")[0];
7918        let hasLanded = false;
7919        let lastX = null;
7920        let lastY = null;
7921        let lastCursorTime = typeof performance !== "undefined" ? performance.now() : 0;
7922        function isCursorMovingSlowly(nextX, nextY) {
7923          const currentTime = performance.now();
7924          const elapsedTime = currentTime - lastCursorTime;
7925          if (lastX === null || lastY === null || elapsedTime === 0) {
7926            lastX = nextX;
7927            lastY = nextY;
7928            lastCursorTime = currentTime;
7929            return false;
7930          }
7931          const deltaX = nextX - lastX;
7932          const deltaY = nextY - lastY;
7933          const distanceSquared = deltaX * deltaX + deltaY * deltaY;
7934          const thresholdSquared = elapsedTime * elapsedTime * CURSOR_SPEED_THRESHOLD_SQUARED;
7935          lastX = nextX;
7936          lastY = nextY;
7937          lastCursorTime = currentTime;
7938          return distanceSquared < thresholdSquared;
7939        }
7940        function close() {
7941          timeout.clear();
7942          onClose();
7943        }
7944        return function onMouseMove(event) {
7945          timeout.clear();
7946          const domReference = elements.domReference;
7947          const floating = elements.floating;
7948          if (!domReference || !floating || side == null || x2 == null || y2 == null) {
7949            return void 0;
7950          }
7951          const {
7952            clientX,
7953            clientY
7954          } = event;
7955          const target = getTarget(event);
7956          const isLeave = event.type === "mouseleave";
7957          const isOverFloatingEl = contains(floating, target);
7958          const isOverReferenceEl = contains(domReference, target);
7959          if (isOverFloatingEl) {
7960            hasLanded = true;
7961            if (!isLeave) {
7962              return void 0;
7963            }
7964          }
7965          if (isOverReferenceEl) {
7966            hasLanded = false;
7967            if (!isLeave) {
7968              hasLanded = true;
7969              return void 0;
7970            }
7971          }
7972          if (isLeave && isElement(event.relatedTarget) && contains(floating, event.relatedTarget)) {
7973            return void 0;
7974          }
7975          function hasOpenChildNode() {
7976            return Boolean(tree && getNodeChildren(tree.nodesRef.current, nodeId).length > 0);
7977          }
7978          function closeIfNoOpenChild() {
7979            if (!hasOpenChildNode()) {
7980              close();
7981            }
7982          }
7983          if (hasOpenChildNode()) {
7984            return void 0;
7985          }
7986          const refRect = domReference.getBoundingClientRect();
7987          const rect = floating.getBoundingClientRect();
7988          const cursorLeaveFromRight = x2 > rect.right - rect.width / 2;
7989          const cursorLeaveFromBottom = y2 > rect.bottom - rect.height / 2;
7990          const isFloatingWider = rect.width > refRect.width;
7991          const isFloatingTaller = rect.height > refRect.height;
7992          const left = (isFloatingWider ? refRect : rect).left;
7993          const right = (isFloatingWider ? refRect : rect).right;
7994          const top = (isFloatingTaller ? refRect : rect).top;
7995          const bottom = (isFloatingTaller ? refRect : rect).bottom;
7996          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) {
7997            closeIfNoOpenChild();
7998            return void 0;
7999          }
8000          let isInsideTroughRect = false;
8001          switch (side) {
8002            case "top":
8003              isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, refRect.top + 1, right, rect.bottom - 1);
8004              break;
8005            case "bottom":
8006              isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, rect.top + 1, right, refRect.bottom - 1);
8007              break;
8008            case "left":
8009              isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, rect.right - 1, bottom, refRect.left + 1, top);
8010              break;
8011            case "right":
8012              isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, refRect.right - 1, bottom, rect.left + 1, top);
8013              break;
8014            default:
8015          }
8016          if (isInsideTroughRect) {
8017            return void 0;
8018          }
8019          if (hasLanded && !isInsideRect(clientX, clientY, refRect)) {
8020            closeIfNoOpenChild();
8021            return void 0;
8022          }
8023          if (!isLeave && isCursorMovingSlowly(clientX, clientY)) {
8024            closeIfNoOpenChild();
8025            return void 0;
8026          }
8027          let isInsidePolygon = false;
8028          switch (side) {
8029            case "top": {
8030              const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;
8031              const cursorPointOneX = isFloatingWider ? x2 + cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset;
8032              const cursorPointTwoX = isFloatingWider ? x2 - cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset;
8033              const cursorPointY = y2 + POLYGON_BUFFER + 1;
8034              const commonYLeft = cursorLeaveFromRight ? rect.bottom - POLYGON_BUFFER : isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top;
8035              const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top : rect.bottom - POLYGON_BUFFER;
8036              isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight);
8037              break;
8038            }
8039            case "bottom": {
8040              const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;
8041              const cursorPointOneX = isFloatingWider ? x2 + cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset;
8042              const cursorPointTwoX = isFloatingWider ? x2 - cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset;
8043              const cursorPointY = y2 - POLYGON_BUFFER;
8044              const commonYLeft = cursorLeaveFromRight ? rect.top + POLYGON_BUFFER : isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom;
8045              const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom : rect.top + POLYGON_BUFFER;
8046              isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight);
8047              break;
8048            }
8049            case "left": {
8050              const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;
8051              const cursorPointOneY = isFloatingTaller ? y2 + cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset;
8052              const cursorPointTwoY = isFloatingTaller ? y2 - cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset;
8053              const cursorPointX = x2 + POLYGON_BUFFER + 1;
8054              const commonXTop = cursorLeaveFromBottom ? rect.right - POLYGON_BUFFER : isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left;
8055              const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left : rect.right - POLYGON_BUFFER;
8056              isInsidePolygon = isPointInQuadrilateral(clientX, clientY, commonXTop, rect.top, commonXBottom, rect.bottom, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY);
8057              break;
8058            }
8059            case "right": {
8060              const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;
8061              const cursorPointOneY = isFloatingTaller ? y2 + cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset;
8062              const cursorPointTwoY = isFloatingTaller ? y2 - cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset;
8063              const cursorPointX = x2 - POLYGON_BUFFER;
8064              const commonXTop = cursorLeaveFromBottom ? rect.left + POLYGON_BUFFER : isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right;
8065              const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right : rect.left + POLYGON_BUFFER;
8066              isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY, commonXTop, rect.top, commonXBottom, rect.bottom);
8067              break;
8068            }
8069            default:
8070          }
8071          if (!isInsidePolygon) {
8072            closeIfNoOpenChild();
8073          } else if (!hasLanded) {
8074            timeout.start(40, closeIfNoOpenChild);
8075          }
8076          return void 0;
8077        };
8078      };
8079      fn.__options = {
8080        ...options,
8081        blockPointerEvents
8082      };
8083      return fn;
8084    }
8085  
8086    // node_modules/@base-ui/react/utils/popupStateMapping.mjs
8087    var CommonPopupDataAttributes = (function(CommonPopupDataAttributes2) {
8088      CommonPopupDataAttributes2["open"] = "data-open";
8089      CommonPopupDataAttributes2["closed"] = "data-closed";
8090      CommonPopupDataAttributes2[CommonPopupDataAttributes2["startingStyle"] = TransitionStatusDataAttributes.startingStyle] = "startingStyle";
8091      CommonPopupDataAttributes2[CommonPopupDataAttributes2["endingStyle"] = TransitionStatusDataAttributes.endingStyle] = "endingStyle";
8092      CommonPopupDataAttributes2["anchorHidden"] = "data-anchor-hidden";
8093      CommonPopupDataAttributes2["side"] = "data-side";
8094      CommonPopupDataAttributes2["align"] = "data-align";
8095      return CommonPopupDataAttributes2;
8096    })({});
8097    var CommonTriggerDataAttributes = /* @__PURE__ */ (function(CommonTriggerDataAttributes2) {
8098      CommonTriggerDataAttributes2["popupOpen"] = "data-popup-open";
8099      CommonTriggerDataAttributes2["pressed"] = "data-pressed";
8100      return CommonTriggerDataAttributes2;
8101    })({});
8102    var TRIGGER_HOOK = {
8103      [CommonTriggerDataAttributes.popupOpen]: ""
8104    };
8105    var PRESSABLE_TRIGGER_HOOK = {
8106      [CommonTriggerDataAttributes.popupOpen]: "",
8107      [CommonTriggerDataAttributes.pressed]: ""
8108    };
8109    var POPUP_OPEN_HOOK = {
8110      [CommonPopupDataAttributes.open]: ""
8111    };
8112    var POPUP_CLOSED_HOOK = {
8113      [CommonPopupDataAttributes.closed]: ""
8114    };
8115    var ANCHOR_HIDDEN_HOOK = {
8116      [CommonPopupDataAttributes.anchorHidden]: ""
8117    };
8118    var triggerOpenStateMapping = {
8119      open(value) {
8120        if (value) {
8121          return TRIGGER_HOOK;
8122        }
8123        return null;
8124      }
8125    };
8126    var popupStateMapping = {
8127      open(value) {
8128        if (value) {
8129          return POPUP_OPEN_HOOK;
8130        }
8131        return POPUP_CLOSED_HOOK;
8132      },
8133      anchorHidden(value) {
8134        if (value) {
8135          return ANCHOR_HIDDEN_HOOK;
8136        }
8137        return null;
8138      }
8139    };
8140  
8141    // node_modules/@base-ui/utils/inertValue.mjs
8142    function inertValue(value) {
8143      if (isReactVersionAtLeast(19)) {
8144        return value;
8145      }
8146      return value ? "true" : void 0;
8147    }
8148  
8149    // node_modules/@base-ui/react/utils/useAnchorPositioning.mjs
8150    var React29 = __toESM(require_react(), 1);
8151  
8152    // node_modules/@base-ui/react/floating-ui-react/middleware/arrow.mjs
8153    var baseArrow = (options) => ({
8154      name: "arrow",
8155      options,
8156      async fn(state) {
8157        const {
8158          x: x2,
8159          y: y2,
8160          placement,
8161          rects,
8162          platform: platform3,
8163          elements,
8164          middlewareData
8165        } = state;
8166        const {
8167          element,
8168          padding = 0,
8169          offsetParent = "real"
8170        } = evaluate(options, state) || {};
8171        if (element == null) {
8172          return {};
8173        }
8174        const paddingObject = getPaddingObject(padding);
8175        const coords = {
8176          x: x2,
8177          y: y2
8178        };
8179        const axis = getAlignmentAxis(placement);
8180        const length = getAxisLength(axis);
8181        const arrowDimensions = await platform3.getDimensions(element);
8182        const isYAxis = axis === "y";
8183        const minProp = isYAxis ? "top" : "left";
8184        const maxProp = isYAxis ? "bottom" : "right";
8185        const clientProp = isYAxis ? "clientHeight" : "clientWidth";
8186        const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
8187        const startDiff = coords[axis] - rects.reference[axis];
8188        const arrowOffsetParent = offsetParent === "real" ? await platform3.getOffsetParent?.(element) : elements.floating;
8189        let clientSize = elements.floating[clientProp] || rects.floating[length];
8190        if (!clientSize || !await platform3.isElement?.(arrowOffsetParent)) {
8191          clientSize = elements.floating[clientProp] || rects.floating[length];
8192        }
8193        const centerToReference = endDiff / 2 - startDiff / 2;
8194        const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
8195        const minPadding = Math.min(paddingObject[minProp], largestPossiblePadding);
8196        const maxPadding = Math.min(paddingObject[maxProp], largestPossiblePadding);
8197        const min2 = minPadding;
8198        const max2 = clientSize - arrowDimensions[length] - maxPadding;
8199        const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
8200        const offset4 = clamp(min2, center, max2);
8201        const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset4 && rects.reference[length] / 2 - (center < min2 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
8202        const alignmentOffset = shouldAddOffset ? center < min2 ? center - min2 : center - max2 : 0;
8203        return {
8204          [axis]: coords[axis] + alignmentOffset,
8205          data: {
8206            [axis]: offset4,
8207            centerOffset: center - offset4 - alignmentOffset,
8208            ...shouldAddOffset && {
8209              alignmentOffset
8210            }
8211          },
8212          reset: shouldAddOffset
8213        };
8214      }
8215    });
8216    var arrow4 = (options, deps) => ({
8217      ...baseArrow(options),
8218      options: [options, deps]
8219    });
8220  
8221    // node_modules/@base-ui/react/utils/hideMiddleware.mjs
8222    var nativeHideFn = hide3().fn;
8223    var hide4 = {
8224      name: "hide",
8225      async fn(state) {
8226        const {
8227          width,
8228          height,
8229          x: x2,
8230          y: y2
8231        } = state.rects.reference;
8232        const anchorHidden = width === 0 && height === 0 && x2 === 0 && y2 === 0;
8233        const nativeHideResult = await nativeHideFn(state);
8234        return {
8235          data: {
8236            referenceHidden: nativeHideResult.data?.referenceHidden || anchorHidden
8237          }
8238        };
8239      }
8240    };
8241  
8242    // node_modules/@base-ui/react/utils/adaptiveOriginMiddleware.mjs
8243    var DEFAULT_SIDES = {
8244      sideX: "left",
8245      sideY: "top"
8246    };
8247    var adaptiveOrigin = {
8248      name: "adaptiveOrigin",
8249      async fn(state) {
8250        const {
8251          x: rawX,
8252          y: rawY,
8253          rects: {
8254            floating: floatRect
8255          },
8256          elements: {
8257            floating
8258          },
8259          platform: platform3,
8260          strategy,
8261          placement
8262        } = state;
8263        const win = getWindow(floating);
8264        const styles = win.getComputedStyle(floating);
8265        const hasTransition = styles.transitionDuration !== "0s" && styles.transitionDuration !== "";
8266        if (!hasTransition) {
8267          return {
8268            x: rawX,
8269            y: rawY,
8270            data: DEFAULT_SIDES
8271          };
8272        }
8273        const offsetParent = await platform3.getOffsetParent?.(floating);
8274        let offsetDimensions = {
8275          width: 0,
8276          height: 0
8277        };
8278        if (strategy === "fixed" && win?.visualViewport) {
8279          offsetDimensions = {
8280            width: win.visualViewport.width,
8281            height: win.visualViewport.height
8282          };
8283        } else if (offsetParent === win) {
8284          const doc = ownerDocument(floating);
8285          offsetDimensions = {
8286            width: doc.documentElement.clientWidth,
8287            height: doc.documentElement.clientHeight
8288          };
8289        } else if (await platform3.isElement?.(offsetParent)) {
8290          offsetDimensions = await platform3.getDimensions(offsetParent);
8291        }
8292        const currentSide = getSide(placement);
8293        let x2 = rawX;
8294        let y2 = rawY;
8295        if (currentSide === "left") {
8296          x2 = offsetDimensions.width - (rawX + floatRect.width);
8297        }
8298        if (currentSide === "top") {
8299          y2 = offsetDimensions.height - (rawY + floatRect.height);
8300        }
8301        const sideX = currentSide === "left" ? "right" : DEFAULT_SIDES.sideX;
8302        const sideY = currentSide === "top" ? "bottom" : DEFAULT_SIDES.sideY;
8303        return {
8304          x: x2,
8305          y: y2,
8306          data: {
8307            sideX,
8308            sideY
8309          }
8310        };
8311      }
8312    };
8313  
8314    // node_modules/@base-ui/react/utils/useAnchorPositioning.mjs
8315    function getLogicalSide(sideParam, renderedSide, isRtl) {
8316      const isLogicalSideParam = sideParam === "inline-start" || sideParam === "inline-end";
8317      const logicalRight = isRtl ? "inline-start" : "inline-end";
8318      const logicalLeft = isRtl ? "inline-end" : "inline-start";
8319      return {
8320        top: "top",
8321        right: isLogicalSideParam ? logicalRight : "right",
8322        bottom: "bottom",
8323        left: isLogicalSideParam ? logicalLeft : "left"
8324      }[renderedSide];
8325    }
8326    function getOffsetData(state, sideParam, isRtl) {
8327      const {
8328        rects,
8329        placement
8330      } = state;
8331      const data = {
8332        side: getLogicalSide(sideParam, getSide(placement), isRtl),
8333        align: getAlignment(placement) || "center",
8334        anchor: {
8335          width: rects.reference.width,
8336          height: rects.reference.height
8337        },
8338        positioner: {
8339          width: rects.floating.width,
8340          height: rects.floating.height
8341        }
8342      };
8343      return data;
8344    }
8345    function useAnchorPositioning(params) {
8346      const {
8347        // Public parameters
8348        anchor,
8349        positionMethod = "absolute",
8350        side: sideParam = "bottom",
8351        sideOffset = 0,
8352        align = "center",
8353        alignOffset = 0,
8354        collisionBoundary,
8355        collisionPadding: collisionPaddingParam = 5,
8356        sticky = false,
8357        arrowPadding = 5,
8358        disableAnchorTracking = false,
8359        inline: inlineMiddleware,
8360        // Private parameters
8361        keepMounted = false,
8362        floatingRootContext,
8363        mounted,
8364        collisionAvoidance,
8365        shiftCrossAxis = false,
8366        nodeId,
8367        adaptiveOrigin: adaptiveOrigin2,
8368        lazyFlip = false,
8369        externalTree
8370      } = params;
8371      const [mountSide, setMountSide] = React29.useState(null);
8372      if (!mounted && mountSide !== null) {
8373        setMountSide(null);
8374      }
8375      const collisionAvoidanceSide = collisionAvoidance.side || "flip";
8376      const collisionAvoidanceAlign = collisionAvoidance.align || "flip";
8377      const collisionAvoidanceFallbackAxisSide = collisionAvoidance.fallbackAxisSide || "end";
8378      const anchorFn = typeof anchor === "function" ? anchor : void 0;
8379      const anchorFnCallback = useStableCallback(anchorFn);
8380      const anchorDep = anchorFn ? anchorFnCallback : anchor;
8381      const anchorValueRef = useValueAsRef(anchor);
8382      const mountedRef = useValueAsRef(mounted);
8383      const direction = useDirection();
8384      const isRtl = direction === "rtl";
8385      const side = mountSide || {
8386        top: "top",
8387        right: "right",
8388        bottom: "bottom",
8389        left: "left",
8390        "inline-end": isRtl ? "left" : "right",
8391        "inline-start": isRtl ? "right" : "left"
8392      }[sideParam];
8393      const placement = align === "center" ? side : `$side}-$align}`;
8394      let collisionPadding = collisionPaddingParam;
8395      const bias = 1;
8396      const biasTop = sideParam === "bottom" ? bias : 0;
8397      const biasBottom = sideParam === "top" ? bias : 0;
8398      const biasLeft = sideParam === "right" ? bias : 0;
8399      const biasRight = sideParam === "left" ? bias : 0;
8400      if (typeof collisionPadding === "number") {
8401        collisionPadding = {
8402          top: collisionPadding + biasTop,
8403          right: collisionPadding + biasRight,
8404          bottom: collisionPadding + biasBottom,
8405          left: collisionPadding + biasLeft
8406        };
8407      } else if (collisionPadding) {
8408        collisionPadding = {
8409          top: (collisionPadding.top || 0) + biasTop,
8410          right: (collisionPadding.right || 0) + biasRight,
8411          bottom: (collisionPadding.bottom || 0) + biasBottom,
8412          left: (collisionPadding.left || 0) + biasLeft
8413        };
8414      }
8415      const commonCollisionProps = {
8416        boundary: collisionBoundary === "clipping-ancestors" ? "clippingAncestors" : collisionBoundary,
8417        padding: collisionPadding
8418      };
8419      const arrowRef = React29.useRef(null);
8420      const sideOffsetRef = useValueAsRef(sideOffset);
8421      const alignOffsetRef = useValueAsRef(alignOffset);
8422      const sideOffsetDep = typeof sideOffset !== "function" ? sideOffset : 0;
8423      const alignOffsetDep = typeof alignOffset !== "function" ? alignOffset : 0;
8424      const middleware = [];
8425      if (inlineMiddleware) {
8426        middleware.push(inlineMiddleware);
8427      }
8428      middleware.push(offset3((state) => {
8429        const data = getOffsetData(state, sideParam, isRtl);
8430        const sideAxis = typeof sideOffsetRef.current === "function" ? sideOffsetRef.current(data) : sideOffsetRef.current;
8431        const alignAxis = typeof alignOffsetRef.current === "function" ? alignOffsetRef.current(data) : alignOffsetRef.current;
8432        return {
8433          mainAxis: sideAxis,
8434          crossAxis: alignAxis,
8435          alignmentAxis: alignAxis
8436        };
8437      }, [sideOffsetDep, alignOffsetDep, isRtl, sideParam]));
8438      const shiftDisabled = collisionAvoidanceAlign === "none" && collisionAvoidanceSide !== "shift";
8439      const crossAxisShiftEnabled = !shiftDisabled && (sticky || shiftCrossAxis || collisionAvoidanceSide === "shift");
8440      const flipMiddleware = collisionAvoidanceSide === "none" ? null : flip3({
8441        ...commonCollisionProps,
8442        // Ensure the popup flips if it's been limited by its --available-height and it resizes.
8443        // Since the size() padding is smaller than the flip() padding, flip() will take precedence.
8444        padding: {
8445          top: collisionPadding.top + bias,
8446          right: collisionPadding.right + bias,
8447          bottom: collisionPadding.bottom + bias,
8448          left: collisionPadding.left + bias
8449        },
8450        mainAxis: !shiftCrossAxis && collisionAvoidanceSide === "flip",
8451        crossAxis: collisionAvoidanceAlign === "flip" ? "alignment" : false,
8452        fallbackAxisSideDirection: collisionAvoidanceFallbackAxisSide
8453      });
8454      const shiftMiddleware = shiftDisabled ? null : shift3((data) => {
8455        const html = ownerDocument(data.elements.floating).documentElement;
8456        return {
8457          ...commonCollisionProps,
8458          // Use the Layout Viewport to avoid shifting around when pinch-zooming
8459          // for context menus.
8460          rootBoundary: shiftCrossAxis ? {
8461            x: 0,
8462            y: 0,
8463            width: html.clientWidth,
8464            height: html.clientHeight
8465          } : void 0,
8466          mainAxis: collisionAvoidanceAlign !== "none",
8467          crossAxis: crossAxisShiftEnabled,
8468          limiter: sticky || shiftCrossAxis ? void 0 : limitShift3((limitData) => {
8469            if (!arrowRef.current) {
8470              return {};
8471            }
8472            const {
8473              width,
8474              height
8475            } = arrowRef.current.getBoundingClientRect();
8476            const sideAxis = getSideAxis(getSide(limitData.placement));
8477            const arrowSize = sideAxis === "y" ? width : height;
8478            const offsetAmount = sideAxis === "y" ? collisionPadding.left + collisionPadding.right : collisionPadding.top + collisionPadding.bottom;
8479            return {
8480              offset: arrowSize / 2 + offsetAmount / 2
8481            };
8482          })
8483        };
8484      }, [commonCollisionProps, sticky, shiftCrossAxis, collisionPadding, collisionAvoidanceAlign]);
8485      if (collisionAvoidanceSide === "shift" || collisionAvoidanceAlign === "shift" || align === "center") {
8486        middleware.push(shiftMiddleware, flipMiddleware);
8487      } else {
8488        middleware.push(flipMiddleware, shiftMiddleware);
8489      }
8490      middleware.push(size3({
8491        ...commonCollisionProps,
8492        apply({
8493          elements: {
8494            floating
8495          },
8496          availableWidth,
8497          availableHeight,
8498          rects
8499        }) {
8500          if (!mountedRef.current) {
8501            return;
8502          }
8503          const floatingStyle = floating.style;
8504          floatingStyle.setProperty("--available-width", `$availableWidth}px`);
8505          floatingStyle.setProperty("--available-height", `$availableHeight}px`);
8506          const dpr = getWindow(floating).devicePixelRatio || 1;
8507          const {
8508            x: x3,
8509            y: y3,
8510            width,
8511            height
8512          } = rects.reference;
8513          const anchorWidth = (Math.round((x3 + width) * dpr) - Math.round(x3 * dpr)) / dpr;
8514          const anchorHeight = (Math.round((y3 + height) * dpr) - Math.round(y3 * dpr)) / dpr;
8515          floatingStyle.setProperty("--anchor-width", `$anchorWidth}px`);
8516          floatingStyle.setProperty("--anchor-height", `$anchorHeight}px`);
8517        }
8518      }), arrow4((state) => ({
8519        // `transform-origin` calculations rely on an element existing. If the arrow hasn't been set,
8520        // we'll create a fake element.
8521        element: arrowRef.current || ownerDocument(state.elements.floating).createElement("div"),
8522        padding: arrowPadding,
8523        offsetParent: "floating"
8524      }), [arrowPadding]), {
8525        name: "transformOrigin",
8526        fn(state) {
8527          const {
8528            elements: elements2,
8529            middlewareData: middlewareData2,
8530            placement: renderedPlacement2,
8531            rects,
8532            y: y3
8533          } = state;
8534          const currentRenderedSide = getSide(renderedPlacement2);
8535          const currentRenderedAxis = getSideAxis(currentRenderedSide);
8536          const arrowEl = arrowRef.current;
8537          const arrowX = middlewareData2.arrow?.x || 0;
8538          const arrowY = middlewareData2.arrow?.y || 0;
8539          const arrowWidth = arrowEl?.clientWidth || 0;
8540          const arrowHeight = arrowEl?.clientHeight || 0;
8541          const transformX = arrowX + arrowWidth / 2;
8542          const transformY = arrowY + arrowHeight / 2;
8543          const shiftY = Math.abs(middlewareData2.shift?.y || 0);
8544          const halfAnchorHeight = rects.reference.height / 2;
8545          const sideOffsetValue = typeof sideOffset === "function" ? sideOffset(getOffsetData(state, sideParam, isRtl)) : sideOffset;
8546          const isOverlappingAnchor = shiftY > sideOffsetValue;
8547          const adjacentTransformOrigin = {
8548            top: `$transformX}px calc(100% + $sideOffsetValue}px)`,
8549            bottom: `$transformX}px ${-sideOffsetValue}px`,
8550            left: `calc(100% + $sideOffsetValue}px) $transformY}px`,
8551            right: `${-sideOffsetValue}px $transformY}px`
8552          }[currentRenderedSide];
8553          const overlapTransformOrigin = `$transformX}px $rects.reference.y + halfAnchorHeight - y3}px`;
8554          elements2.floating.style.setProperty("--transform-origin", crossAxisShiftEnabled && currentRenderedAxis === "y" && isOverlappingAnchor ? overlapTransformOrigin : adjacentTransformOrigin);
8555          return {};
8556        }
8557      }, hide4, adaptiveOrigin2);
8558      useIsoLayoutEffect(() => {
8559        if (!mounted && floatingRootContext) {
8560          floatingRootContext.update({
8561            referenceElement: null,
8562            floatingElement: null,
8563            domReferenceElement: null,
8564            positionReference: null
8565          });
8566        }
8567      }, [mounted, floatingRootContext]);
8568      const autoUpdateOptions = React29.useMemo(() => ({
8569        elementResize: !disableAnchorTracking && typeof ResizeObserver !== "undefined",
8570        layoutShift: !disableAnchorTracking && typeof IntersectionObserver !== "undefined"
8571      }), [disableAnchorTracking]);
8572      const {
8573        refs,
8574        elements,
8575        x: x2,
8576        y: y2,
8577        middlewareData,
8578        update: update2,
8579        placement: renderedPlacement,
8580        context,
8581        isPositioned,
8582        floatingStyles: originalFloatingStyles
8583      } = useFloating2({
8584        rootContext: floatingRootContext,
8585        open: keepMounted ? mounted : void 0,
8586        placement,
8587        middleware,
8588        strategy: positionMethod,
8589        whileElementsMounted: keepMounted ? void 0 : (...args) => autoUpdate(...args, autoUpdateOptions),
8590        nodeId,
8591        externalTree
8592      });
8593      const {
8594        sideX,
8595        sideY
8596      } = middlewareData.adaptiveOrigin || DEFAULT_SIDES;
8597      const resolvedPosition = isPositioned ? positionMethod : "fixed";
8598      const floatingStyles = React29.useMemo(() => {
8599        const base = adaptiveOrigin2 ? {
8600          position: resolvedPosition,
8601          [sideX]: x2,
8602          [sideY]: y2
8603        } : {
8604          position: resolvedPosition,
8605          ...originalFloatingStyles
8606        };
8607        if (!isPositioned) {
8608          base.opacity = 0;
8609        }
8610        return base;
8611      }, [adaptiveOrigin2, resolvedPosition, sideX, x2, sideY, y2, originalFloatingStyles, isPositioned]);
8612      const registeredPositionReferenceRef = React29.useRef(null);
8613      useIsoLayoutEffect(() => {
8614        if (!mounted) {
8615          return;
8616        }
8617        const anchorValue = anchorValueRef.current;
8618        const resolvedAnchor = typeof anchorValue === "function" ? anchorValue() : anchorValue;
8619        const unwrappedElement = (isRef(resolvedAnchor) ? resolvedAnchor.current : resolvedAnchor) || null;
8620        const finalAnchor = unwrappedElement || null;
8621        if (finalAnchor !== registeredPositionReferenceRef.current) {
8622          refs.setPositionReference(finalAnchor);
8623          registeredPositionReferenceRef.current = finalAnchor;
8624        }
8625      }, [mounted, refs, anchorDep, anchorValueRef]);
8626      React29.useEffect(() => {
8627        if (!mounted) {
8628          return;
8629        }
8630        const anchorValue = anchorValueRef.current;
8631        if (typeof anchorValue === "function") {
8632          return;
8633        }
8634        if (isRef(anchorValue) && anchorValue.current !== registeredPositionReferenceRef.current) {
8635          refs.setPositionReference(anchorValue.current);
8636          registeredPositionReferenceRef.current = anchorValue.current;
8637        }
8638      }, [mounted, refs, anchorDep, anchorValueRef]);
8639      React29.useEffect(() => {
8640        if (keepMounted && mounted && elements.reference && elements.floating) {
8641          return autoUpdate(elements.reference, elements.floating, update2, autoUpdateOptions);
8642        }
8643        return void 0;
8644      }, [keepMounted, mounted, elements, update2, autoUpdateOptions]);
8645      const renderedSide = getSide(renderedPlacement);
8646      const logicalRenderedSide = getLogicalSide(sideParam, renderedSide, isRtl);
8647      const renderedAlign = getAlignment(renderedPlacement) || "center";
8648      const anchorHidden = Boolean(middlewareData.hide?.referenceHidden);
8649      useIsoLayoutEffect(() => {
8650        if (lazyFlip && mounted && isPositioned) {
8651          setMountSide(renderedSide);
8652        }
8653      }, [lazyFlip, mounted, isPositioned, renderedSide]);
8654      const arrowStyles = React29.useMemo(() => ({
8655        position: "absolute",
8656        top: middlewareData.arrow?.y,
8657        left: middlewareData.arrow?.x
8658      }), [middlewareData.arrow]);
8659      const arrowUncentered = middlewareData.arrow?.centerOffset !== 0;
8660      return React29.useMemo(() => ({
8661        positionerStyles: floatingStyles,
8662        arrowStyles,
8663        arrowRef,
8664        arrowUncentered,
8665        side: logicalRenderedSide,
8666        align: renderedAlign,
8667        physicalSide: renderedSide,
8668        anchorHidden,
8669        refs,
8670        context,
8671        isPositioned,
8672        update: update2
8673      }), [floatingStyles, arrowStyles, arrowRef, arrowUncentered, logicalRenderedSide, renderedAlign, renderedSide, anchorHidden, refs, context, isPositioned, update2]);
8674    }
8675    function isRef(param) {
8676      return param != null && "current" in param;
8677    }
8678  
8679    // node_modules/@base-ui/react/utils/getDisabledMountTransitionStyles.mjs
8680    function getDisabledMountTransitionStyles(transitionStatus) {
8681      return transitionStatus === "starting" ? DISABLED_TRANSITIONS_STYLE : EMPTY_OBJECT;
8682    }
8683  
8684    // node_modules/@base-ui/react/utils/usePositioner.mjs
8685    function usePositioner(componentProps, state, {
8686      styles,
8687      transitionStatus,
8688      props,
8689      refs,
8690      hidden,
8691      inert = false
8692    }) {
8693      const style = {
8694        ...styles
8695      };
8696      if (inert) {
8697        style.pointerEvents = "none";
8698      }
8699      return useRenderElement("div", componentProps, {
8700        state,
8701        ref: refs,
8702        props: [{
8703          role: "presentation",
8704          hidden,
8705          style
8706        }, getDisabledMountTransitionStyles(transitionStatus), props],
8707        stateAttributesMapping: popupStateMapping
8708      });
8709    }
8710  
8711    // node_modules/@base-ui/react/utils/usePopupViewport.mjs
8712    var React32 = __toESM(require_react(), 1);
8713    var ReactDOM6 = __toESM(require_react_dom(), 1);
8714  
8715    // node_modules/@base-ui/utils/usePreviousValue.mjs
8716    var React30 = __toESM(require_react(), 1);
8717    function usePreviousValue(value) {
8718      const [state, setState] = React30.useState({
8719        current: value,
8720        previous: null
8721      });
8722      if (value !== state.current) {
8723        setState({
8724          current: value,
8725          previous: state.current
8726        });
8727      }
8728      return state.previous;
8729    }
8730  
8731    // node_modules/@base-ui/react/utils/usePopupAutoResize.mjs
8732    var React31 = __toESM(require_react(), 1);
8733  
8734    // node_modules/@base-ui/react/utils/getCssDimensions.mjs
8735    function getCssDimensions2(element) {
8736      const css = getComputedStyle2(element);
8737      let width = parseFloat(css.width) || 0;
8738      let height = parseFloat(css.height) || 0;
8739      const hasOffset = isHTMLElement(element);
8740      const offsetWidth = hasOffset ? element.offsetWidth : width;
8741      const offsetHeight = hasOffset ? element.offsetHeight : height;
8742      const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
8743      if (shouldFallback) {
8744        width = offsetWidth;
8745        height = offsetHeight;
8746      }
8747      return {
8748        width,
8749        height
8750      };
8751    }
8752  
8753    // node_modules/@base-ui/react/utils/usePopupAutoResize.mjs
8754    function usePopupAutoResize(parameters) {
8755      const {
8756        popupElement,
8757        positionerElement,
8758        content,
8759        mounted,
8760        onMeasureLayout: onMeasureLayoutParam,
8761        onMeasureLayoutComplete: onMeasureLayoutCompleteParam,
8762        side,
8763        direction
8764      } = parameters;
8765      const runOnceAnimationsFinish = useAnimationsFinished(popupElement, true, false);
8766      const animationFrame = useAnimationFrame();
8767      const committedDimensionsRef = React31.useRef(null);
8768      const isInitialRenderRef = React31.useRef(true);
8769      const restoreAnchoringStylesRef = React31.useRef(NOOP);
8770      const onMeasureLayout = useStableCallback(onMeasureLayoutParam);
8771      const onMeasureLayoutComplete = useStableCallback(onMeasureLayoutCompleteParam);
8772      const anchoringStyles = React31.useMemo(() => {
8773        let isOriginSide = side === "top";
8774        let isPhysicalLeft = side === "left";
8775        if (direction === "rtl") {
8776          isOriginSide = isOriginSide || side === "inline-end";
8777          isPhysicalLeft = isPhysicalLeft || side === "inline-end";
8778        } else {
8779          isOriginSide = isOriginSide || side === "inline-start";
8780          isPhysicalLeft = isPhysicalLeft || side === "inline-start";
8781        }
8782        return isOriginSide ? {
8783          position: "absolute",
8784          [side === "top" ? "bottom" : "top"]: "0",
8785          [isPhysicalLeft ? "right" : "left"]: "0"
8786        } : EMPTY_OBJECT;
8787      }, [side, direction]);
8788      useIsoLayoutEffect(() => {
8789        if (!mounted) {
8790          restoreAnchoringStylesRef.current = NOOP;
8791          isInitialRenderRef.current = true;
8792          committedDimensionsRef.current = null;
8793          return void 0;
8794        }
8795        if (!popupElement || !positionerElement) {
8796          return void 0;
8797        }
8798        restoreAnchoringStylesRef.current = applyElementStyles(popupElement, anchoringStyles);
8799        setPopupCssSize(popupElement, "auto");
8800        const restorePopupPosition = overrideElementStyle(popupElement, "position", "static");
8801        const restorePopupTransform = overrideElementStyle(popupElement, "transform", "none");
8802        const restorePopupScale = overrideElementStyle(popupElement, "scale", "1");
8803        const restorePositionerAvailableSize = applyElementStyles(positionerElement, {
8804          "--available-width": "max-content",
8805          "--available-height": "max-content"
8806        });
8807        function restoreMeasurementOverrides() {
8808          restorePopupPosition();
8809          restorePopupTransform();
8810          restorePositionerAvailableSize();
8811        }
8812        function restoreMeasurementOverridesIncludingScale() {
8813          restoreMeasurementOverrides();
8814          restorePopupScale();
8815        }
8816        onMeasureLayout?.();
8817        if (isInitialRenderRef.current || committedDimensionsRef.current === null) {
8818          setPositionerCssSize(positionerElement, "max-content");
8819          const dimensions = getCssDimensions2(popupElement);
8820          committedDimensionsRef.current = dimensions;
8821          setPositionerCssSize(positionerElement, dimensions);
8822          restoreMeasurementOverridesIncludingScale();
8823          onMeasureLayoutComplete?.(null, dimensions);
8824          isInitialRenderRef.current = false;
8825          return () => {
8826            restoreAnchoringStylesRef.current();
8827            restoreAnchoringStylesRef.current = NOOP;
8828          };
8829        }
8830        setPositionerCssSize(positionerElement, "max-content");
8831        const previousDimensions = committedDimensionsRef.current;
8832        const newDimensions = getCssDimensions2(popupElement);
8833        committedDimensionsRef.current = newDimensions;
8834        setPopupCssSize(popupElement, previousDimensions);
8835        restoreMeasurementOverridesIncludingScale();
8836        onMeasureLayoutComplete?.(previousDimensions, newDimensions);
8837        setPositionerCssSize(positionerElement, newDimensions);
8838        const abortController = new AbortController();
8839        animationFrame.request(() => {
8840          setPopupCssSize(popupElement, newDimensions);
8841          runOnceAnimationsFinish(() => {
8842            popupElement.style.setProperty("--popup-width", "auto");
8843            popupElement.style.setProperty("--popup-height", "auto");
8844          }, abortController.signal);
8845        });
8846        return () => {
8847          abortController.abort();
8848          animationFrame.cancel();
8849          restoreAnchoringStylesRef.current();
8850          restoreAnchoringStylesRef.current = NOOP;
8851        };
8852      }, [content, popupElement, positionerElement, runOnceAnimationsFinish, animationFrame, mounted, onMeasureLayout, onMeasureLayoutComplete, anchoringStyles]);
8853    }
8854    function overrideElementStyle(element, property, value) {
8855      const originalValue = element.style.getPropertyValue(property);
8856      element.style.setProperty(property, value);
8857      return () => {
8858        element.style.setProperty(property, originalValue);
8859      };
8860    }
8861    function applyElementStyles(element, styles) {
8862      const restorers = [];
8863      for (const [key, value] of Object.entries(styles)) {
8864        restorers.push(overrideElementStyle(element, key, value));
8865      }
8866      return restorers.length ? () => {
8867        restorers.forEach((restore) => restore());
8868      } : NOOP;
8869    }
8870    function setPopupCssSize(popupElement, size4) {
8871      const width = size4 === "auto" ? "auto" : `$size4.width}px`;
8872      const height = size4 === "auto" ? "auto" : `$size4.height}px`;
8873      popupElement.style.setProperty("--popup-width", width);
8874      popupElement.style.setProperty("--popup-height", height);
8875    }
8876    function setPositionerCssSize(positionerElement, size4) {
8877      const width = size4 === "max-content" ? "max-content" : `$size4.width}px`;
8878      const height = size4 === "max-content" ? "max-content" : `$size4.height}px`;
8879      positionerElement.style.setProperty("--positioner-width", width);
8880      positionerElement.style.setProperty("--positioner-height", height);
8881    }
8882  
8883    // node_modules/@base-ui/react/utils/usePopupViewport.mjs
8884    var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1);
8885    function usePopupViewport(parameters) {
8886      const {
8887        store,
8888        side,
8889        cssVars,
8890        children
8891      } = parameters;
8892      const direction = useDirection();
8893      const activeTrigger = store.useState("activeTriggerElement");
8894      const activeTriggerId = store.useState("activeTriggerId");
8895      const open = store.useState("open");
8896      const payload = store.useState("payload");
8897      const mounted = store.useState("mounted");
8898      const popupElement = store.useState("popupElement");
8899      const positionerElement = store.useState("positionerElement");
8900      const previousActiveTrigger = usePreviousValue(open ? activeTrigger : null);
8901      const currentContentKey = usePopupContentKey(activeTriggerId, payload);
8902      const capturedNodeRef = React32.useRef(null);
8903      const [previousContentNode, setPreviousContentNode] = React32.useState(null);
8904      const [newTriggerOffset, setNewTriggerOffset] = React32.useState(null);
8905      const currentContainerRef = React32.useRef(null);
8906      const previousContainerRef = React32.useRef(null);
8907      const onAnimationsFinished = useAnimationsFinished(currentContainerRef, true, false);
8908      const cleanupFrame = useAnimationFrame();
8909      const [previousContentDimensions, setPreviousContentDimensions] = React32.useState(null);
8910      const [showStartingStyleAttribute, setShowStartingStyleAttribute] = React32.useState(false);
8911      useIsoLayoutEffect(() => {
8912        store.set("hasViewport", true);
8913        return () => {
8914          store.set("hasViewport", false);
8915        };
8916      }, [store]);
8917      const handleMeasureLayout = useStableCallback(() => {
8918        currentContainerRef.current?.style.setProperty("animation", "none");
8919        currentContainerRef.current?.style.setProperty("transition", "none");
8920        previousContainerRef.current?.style.setProperty("display", "none");
8921      });
8922      const handleMeasureLayoutComplete = useStableCallback((previousDimensions) => {
8923        currentContainerRef.current?.style.removeProperty("animation");
8924        currentContainerRef.current?.style.removeProperty("transition");
8925        previousContainerRef.current?.style.removeProperty("display");
8926        if (previousDimensions) {
8927          setPreviousContentDimensions(previousDimensions);
8928        }
8929      });
8930      const lastHandledTriggerRef = React32.useRef(null);
8931      useIsoLayoutEffect(() => {
8932        if (!open || !mounted) {
8933          lastHandledTriggerRef.current = null;
8934        }
8935      }, [open, mounted]);
8936      useIsoLayoutEffect(() => {
8937        if (activeTrigger && previousActiveTrigger && activeTrigger !== previousActiveTrigger && lastHandledTriggerRef.current !== activeTrigger && capturedNodeRef.current) {
8938          setPreviousContentNode(capturedNodeRef.current);
8939          setShowStartingStyleAttribute(true);
8940          const offset4 = calculateRelativePosition(previousActiveTrigger, activeTrigger);
8941          setNewTriggerOffset(offset4);
8942          cleanupFrame.request(() => {
8943            ReactDOM6.flushSync(() => {
8944              setShowStartingStyleAttribute(false);
8945            });
8946            onAnimationsFinished(() => {
8947              setPreviousContentNode(null);
8948              setPreviousContentDimensions(null);
8949              capturedNodeRef.current = null;
8950            });
8951          });
8952          lastHandledTriggerRef.current = activeTrigger;
8953        }
8954      }, [activeTrigger, previousActiveTrigger, previousContentNode, onAnimationsFinished, cleanupFrame]);
8955      useIsoLayoutEffect(() => {
8956        const source = currentContainerRef.current;
8957        if (!source) {
8958          return;
8959        }
8960        const wrapper = ownerDocument(source).createElement("div");
8961        for (const child of Array.from(source.childNodes)) {
8962          wrapper.appendChild(child.cloneNode(true));
8963        }
8964        capturedNodeRef.current = wrapper;
8965      });
8966      const isTransitioning = previousContentNode != null;
8967      let childrenToRender;
8968      if (!isTransitioning) {
8969        childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", {
8970          "data-current": true,
8971          ref: currentContainerRef,
8972          children
8973        }, currentContentKey);
8974      } else {
8975        childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(React32.Fragment, {
8976          children: [/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", {
8977            "data-previous": true,
8978            inert: inertValue(true),
8979            ref: previousContainerRef,
8980            style: {
8981              ...previousContentDimensions ? {
8982                [cssVars.popupWidth]: `$previousContentDimensions.width}px`,
8983                [cssVars.popupHeight]: `$previousContentDimensions.height}px`
8984              } : null,
8985              position: "absolute"
8986            },
8987            "data-ending-style": showStartingStyleAttribute ? void 0 : ""
8988          }, "previous"), /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", {
8989            "data-current": true,
8990            ref: currentContainerRef,
8991            "data-starting-style": showStartingStyleAttribute ? "" : void 0,
8992            children
8993          }, currentContentKey)]
8994        });
8995      }
8996      useIsoLayoutEffect(() => {
8997        const container = previousContainerRef.current;
8998        if (!container || !previousContentNode) {
8999          return;
9000        }
9001        container.replaceChildren(...Array.from(previousContentNode.childNodes));
9002      }, [previousContentNode]);
9003      usePopupAutoResize({
9004        popupElement,
9005        positionerElement,
9006        mounted,
9007        content: payload,
9008        onMeasureLayout: handleMeasureLayout,
9009        onMeasureLayoutComplete: handleMeasureLayoutComplete,
9010        side,
9011        direction
9012      });
9013      const state = {
9014        activationDirection: getActivationDirection(newTriggerOffset),
9015        transitioning: isTransitioning
9016      };
9017      return {
9018        children: childrenToRender,
9019        state
9020      };
9021    }
9022    function getActivationDirection(offset4) {
9023      if (!offset4) {
9024        return void 0;
9025      }
9026      return `$getValueWithTolerance(offset4.horizontal, 5, "right", "left")} $getValueWithTolerance(offset4.vertical, 5, "down", "up")}`;
9027    }
9028    function getValueWithTolerance(value, tolerance, positiveLabel, negativeLabel) {
9029      if (value > tolerance) {
9030        return positiveLabel;
9031      }
9032      if (value < -tolerance) {
9033        return negativeLabel;
9034      }
9035      return "";
9036    }
9037    function calculateRelativePosition(from, to) {
9038      const fromRect = from.getBoundingClientRect();
9039      const toRect = to.getBoundingClientRect();
9040      const fromCenter = {
9041        x: fromRect.left + fromRect.width / 2,
9042        y: fromRect.top + fromRect.height / 2
9043      };
9044      const toCenter = {
9045        x: toRect.left + toRect.width / 2,
9046        y: toRect.top + toRect.height / 2
9047      };
9048      return {
9049        horizontal: toCenter.x - fromCenter.x,
9050        vertical: toCenter.y - fromCenter.y
9051      };
9052    }
9053    function usePopupContentKey(activeTriggerId, payload) {
9054      const [contentKey, setContentKey] = React32.useState(0);
9055      const previousActiveTriggerIdRef = React32.useRef(activeTriggerId);
9056      const previousPayloadRef = React32.useRef(payload);
9057      const pendingPayloadUpdateRef = React32.useRef(false);
9058      useIsoLayoutEffect(() => {
9059        const previousActiveTriggerId = previousActiveTriggerIdRef.current;
9060        const previousPayload = previousPayloadRef.current;
9061        const triggerIdChanged = activeTriggerId !== previousActiveTriggerId;
9062        const payloadChanged = payload !== previousPayload;
9063        if (triggerIdChanged) {
9064          setContentKey((value) => value + 1);
9065          pendingPayloadUpdateRef.current = !payloadChanged;
9066        } else if (pendingPayloadUpdateRef.current && payloadChanged) {
9067          setContentKey((value) => value + 1);
9068          pendingPayloadUpdateRef.current = false;
9069        }
9070        previousActiveTriggerIdRef.current = activeTriggerId;
9071        previousPayloadRef.current = payload;
9072      }, [activeTriggerId, payload]);
9073      return `$activeTriggerId ?? "current"}-$contentKey}`;
9074    }
9075  
9076    // node_modules/@base-ui/react/utils/FloatingPortalLite.mjs
9077    var React33 = __toESM(require_react(), 1);
9078    var ReactDOM7 = __toESM(require_react_dom(), 1);
9079    var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1);
9080    var FloatingPortalLite = /* @__PURE__ */ React33.forwardRef(function FloatingPortalLite2(componentProps, forwardedRef) {
9081      const {
9082        children,
9083        container,
9084        className,
9085        render: render4,
9086        style,
9087        ...elementProps
9088      } = componentProps;
9089      const {
9090        portalNode,
9091        portalSubtree
9092      } = useFloatingPortalNode({
9093        container,
9094        ref: forwardedRef,
9095        componentProps,
9096        elementProps
9097      });
9098      if (!portalSubtree && !portalNode) {
9099        return null;
9100      }
9101      return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(React33.Fragment, {
9102        children: [portalSubtree, portalNode && /* @__PURE__ */ ReactDOM7.createPortal(children, portalNode)]
9103      });
9104    });
9105    if (true) FloatingPortalLite.displayName = "FloatingPortalLite";
9106  
9107    // node_modules/@base-ui/react/tooltip/index.parts.mjs
9108    var index_parts_exports = {};
9109    __export(index_parts_exports, {
9110      Arrow: () => TooltipArrow,
9111      Handle: () => TooltipHandle,
9112      Popup: () => TooltipPopup,
9113      Portal: () => TooltipPortal,
9114      Positioner: () => TooltipPositioner,
9115      Provider: () => TooltipProvider,
9116      Root: () => TooltipRoot,
9117      Trigger: () => TooltipTrigger,
9118      Viewport: () => TooltipViewport,
9119      createHandle: () => createTooltipHandle
9120    });
9121  
9122    // node_modules/@base-ui/react/tooltip/root/TooltipRoot.mjs
9123    var React36 = __toESM(require_react(), 1);
9124  
9125    // node_modules/@base-ui/react/tooltip/root/TooltipRootContext.mjs
9126    var React34 = __toESM(require_react(), 1);
9127    var TooltipRootContext = /* @__PURE__ */ React34.createContext(void 0);
9128    if (true) TooltipRootContext.displayName = "TooltipRootContext";
9129    function useTooltipRootContext(optional) {
9130      const context = React34.useContext(TooltipRootContext);
9131      if (context === void 0 && !optional) {
9132        throw new Error(true ? "Base UI: TooltipRootContext is missing. Tooltip parts must be placed within <Tooltip.Root>." : formatErrorMessage_default(72));
9133      }
9134      return context;
9135    }
9136  
9137    // node_modules/@base-ui/react/tooltip/store/TooltipStore.mjs
9138    var React35 = __toESM(require_react(), 1);
9139    var selectors2 = {
9140      ...popupStoreSelectors,
9141      disabled: createSelector((state) => state.disabled),
9142      instantType: createSelector((state) => state.instantType),
9143      isInstantPhase: createSelector((state) => state.isInstantPhase),
9144      trackCursorAxis: createSelector((state) => state.trackCursorAxis),
9145      disableHoverablePopup: createSelector((state) => state.disableHoverablePopup),
9146      lastOpenChangeReason: createSelector((state) => state.openChangeReason),
9147      closeOnClick: createSelector((state) => state.closeOnClick),
9148      closeDelay: createSelector((state) => state.closeDelay),
9149      hasViewport: createSelector((state) => state.hasViewport)
9150    };
9151    var TooltipStore = class _TooltipStore extends ReactStore {
9152      constructor(initialState, floatingId, nested = false) {
9153        const triggerElements = new PopupTriggerMap();
9154        const state = {
9155          ...createInitialState(),
9156          ...initialState
9157        };
9158        state.floatingRootContext = createPopupFloatingRootContext(triggerElements, floatingId, nested);
9159        super(state, {
9160          popupRef: /* @__PURE__ */ React35.createRef(),
9161          onOpenChange: void 0,
9162          onOpenChangeComplete: void 0,
9163          triggerElements
9164        }, selectors2);
9165      }
9166      setOpen = (nextOpen, eventDetails) => {
9167        applyPopupOpenChange(this, nextOpen, eventDetails, {
9168          extraState: {
9169            openChangeReason: eventDetails.reason
9170          }
9171        });
9172      };
9173      // Used by trigger clicks to clear a delayed hover open without reporting a public open-state change.
9174      cancelPendingOpen(event) {
9175        this.state.floatingRootContext.dispatchOpenChange(false, createChangeEventDetails(reason_parts_exports.triggerPress, event));
9176      }
9177      static useStore(externalStore, initialState) {
9178        const store = usePopupStore(externalStore, (floatingId, nested) => new _TooltipStore(initialState, floatingId, nested)).store;
9179        return store;
9180      }
9181    };
9182    function createInitialState() {
9183      return {
9184        ...createInitialPopupStoreState(),
9185        disabled: false,
9186        instantType: void 0,
9187        isInstantPhase: false,
9188        trackCursorAxis: "none",
9189        disableHoverablePopup: false,
9190        openChangeReason: null,
9191        closeOnClick: true,
9192        closeDelay: 0,
9193        hasViewport: false
9194      };
9195    }
9196  
9197    // node_modules/@base-ui/react/tooltip/root/TooltipRoot.mjs
9198    var import_jsx_runtime37 = __toESM(require_jsx_runtime(), 1);
9199    var TooltipRoot = fastComponent(function TooltipRoot2(props) {
9200      const {
9201        disabled: disabled2 = false,
9202        defaultOpen = false,
9203        open: openProp,
9204        disableHoverablePopup = false,
9205        trackCursorAxis = "none",
9206        actionsRef,
9207        onOpenChange,
9208        onOpenChangeComplete,
9209        handle,
9210        triggerId: triggerIdProp,
9211        defaultTriggerId: defaultTriggerIdProp = null,
9212        children
9213      } = props;
9214      const store = TooltipStore.useStore(handle?.store, {
9215        open: defaultOpen,
9216        openProp,
9217        activeTriggerId: defaultTriggerIdProp,
9218        triggerIdProp
9219      });
9220      useInitialOpenSync(store, openProp, defaultOpen, defaultTriggerIdProp);
9221      store.useControlledProp("openProp", openProp);
9222      store.useControlledProp("triggerIdProp", triggerIdProp);
9223      store.useContextCallback("onOpenChange", onOpenChange);
9224      store.useContextCallback("onOpenChangeComplete", onOpenChangeComplete);
9225      const openState = store.useState("open");
9226      const open = !disabled2 && openState;
9227      const activeTriggerId = store.useState("activeTriggerId");
9228      const mounted = store.useState("mounted");
9229      const payload = store.useState("payload");
9230      store.useSyncedValues({
9231        trackCursorAxis,
9232        disableHoverablePopup
9233      });
9234      store.useSyncedValue("disabled", disabled2);
9235      useImplicitActiveTrigger(store, {
9236        closeOnActiveTriggerUnmount: true
9237      });
9238      const {
9239        forceUnmount,
9240        transitionStatus
9241      } = useOpenStateTransitions(open, store);
9242      const isInstantPhase = store.useState("isInstantPhase");
9243      const instantType = store.useState("instantType");
9244      const lastOpenChangeReason = store.useState("lastOpenChangeReason");
9245      const previousInstantTypeRef = React36.useRef(null);
9246      useIsoLayoutEffect(() => {
9247        if (openState && disabled2) {
9248          store.setOpen(false, createChangeEventDetails(reason_parts_exports.disabled));
9249        }
9250      }, [openState, disabled2, store]);
9251      useIsoLayoutEffect(() => {
9252        if (transitionStatus === "ending" && lastOpenChangeReason === reason_parts_exports.none || transitionStatus !== "ending" && isInstantPhase) {
9253          if (instantType !== "delay") {
9254            previousInstantTypeRef.current = instantType;
9255          }
9256          store.set("instantType", "delay");
9257        } else if (previousInstantTypeRef.current !== null) {
9258          store.set("instantType", previousInstantTypeRef.current);
9259          previousInstantTypeRef.current = null;
9260        }
9261      }, [transitionStatus, isInstantPhase, lastOpenChangeReason, instantType, store]);
9262      useIsoLayoutEffect(() => {
9263        if (open) {
9264          if (activeTriggerId == null) {
9265            store.set("payload", void 0);
9266          }
9267        }
9268      }, [store, activeTriggerId, open]);
9269      const handleImperativeClose = React36.useCallback(() => {
9270        store.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction));
9271      }, [store]);
9272      React36.useImperativeHandle(actionsRef, () => ({
9273        unmount: forceUnmount,
9274        close: handleImperativeClose
9275      }), [forceUnmount, handleImperativeClose]);
9276      const shouldRenderInteractions = open || mounted || !disabled2 && trackCursorAxis !== "none";
9277      return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(TooltipRootContext.Provider, {
9278        value: store,
9279        children: [shouldRenderInteractions && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TooltipInteractions, {
9280          store,
9281          disabled: disabled2,
9282          trackCursorAxis
9283        }), typeof children === "function" ? children({
9284          payload
9285        }) : children]
9286      });
9287    });
9288    if (true) TooltipRoot.displayName = "TooltipRoot";
9289    function TooltipInteractions({
9290      store,
9291      disabled: disabled2,
9292      trackCursorAxis
9293    }) {
9294      const floatingRootContext = store.useState("floatingRootContext");
9295      const dismiss = useDismiss(floatingRootContext, {
9296        enabled: !disabled2,
9297        referencePress: () => store.select("closeOnClick")
9298      });
9299      const clientPoint = useClientPoint(floatingRootContext, {
9300        enabled: !disabled2 && trackCursorAxis !== "none",
9301        axis: trackCursorAxis === "none" ? void 0 : trackCursorAxis
9302      });
9303      const activeTriggerProps = React36.useMemo(() => mergeProps(clientPoint.reference, dismiss.reference), [clientPoint.reference, dismiss.reference]);
9304      const inactiveTriggerProps = React36.useMemo(() => mergeProps(clientPoint.trigger, dismiss.trigger), [clientPoint.trigger, dismiss.trigger]);
9305      const popupProps = React36.useMemo(() => mergeProps(FOCUSABLE_POPUP_PROPS, clientPoint.floating, dismiss.floating), [clientPoint.floating, dismiss.floating]);
9306      usePopupInteractionProps(store, {
9307        activeTriggerProps,
9308        inactiveTriggerProps,
9309        popupProps
9310      });
9311      return null;
9312    }
9313  
9314    // node_modules/@base-ui/react/tooltip/trigger/TooltipTrigger.mjs
9315    var React38 = __toESM(require_react(), 1);
9316  
9317    // node_modules/@base-ui/react/tooltip/provider/TooltipProviderContext.mjs
9318    var React37 = __toESM(require_react(), 1);
9319    var TooltipProviderContext = /* @__PURE__ */ React37.createContext(void 0);
9320    if (true) TooltipProviderContext.displayName = "TooltipProviderContext";
9321    function useTooltipProviderContext() {
9322      return React37.useContext(TooltipProviderContext);
9323    }
9324  
9325    // node_modules/@base-ui/react/tooltip/trigger/TooltipTriggerDataAttributes.mjs
9326    var TooltipTriggerDataAttributes = (function(TooltipTriggerDataAttributes2) {
9327      TooltipTriggerDataAttributes2[TooltipTriggerDataAttributes2["popupOpen"] = CommonTriggerDataAttributes.popupOpen] = "popupOpen";
9328      TooltipTriggerDataAttributes2["triggerDisabled"] = "data-trigger-disabled";
9329      return TooltipTriggerDataAttributes2;
9330    })({});
9331  
9332    // node_modules/@base-ui/react/tooltip/utils/constants.mjs
9333    var OPEN_DELAY = 600;
9334  
9335    // node_modules/@base-ui/react/tooltip/trigger/TooltipTrigger.mjs
9336    var TOOLTIP_TRIGGER_IDENTIFIER = "data-base-ui-tooltip-trigger";
9337    function getTargetElement(event) {
9338      if ("composedPath" in event) {
9339        const path = event.composedPath();
9340        for (let i2 = 0; i2 < path.length; i2 += 1) {
9341          const element = path[i2];
9342          if (isElement(element)) {
9343            return element;
9344          }
9345        }
9346      }
9347      const target = event.target;
9348      if (isElement(target)) {
9349        return target;
9350      }
9351      return null;
9352    }
9353    function closestEnabledTooltipTrigger(element) {
9354      let current = element;
9355      while (current) {
9356        if (current.hasAttribute(TOOLTIP_TRIGGER_IDENTIFIER)) {
9357          return current;
9358        }
9359        const parentElement = current.parentElement;
9360        if (parentElement) {
9361          current = parentElement;
9362          continue;
9363        }
9364        const root = current.getRootNode();
9365        current = "host" in root && isElement(root.host) ? root.host : null;
9366      }
9367      return null;
9368    }
9369    var TooltipTrigger = fastComponentRef(function TooltipTrigger2(componentProps, forwardedRef) {
9370      const {
9371        render: render4,
9372        className,
9373        style,
9374        handle,
9375        payload,
9376        disabled: disabledProp,
9377        delay,
9378        closeOnClick = true,
9379        closeDelay,
9380        id: idProp,
9381        ...elementProps
9382      } = componentProps;
9383      const rootContext = useTooltipRootContext(true);
9384      const store = handle?.store ?? rootContext;
9385      if (!store) {
9386        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));
9387      }
9388      const thisTriggerId = useBaseUiId(idProp);
9389      const isTriggerActive = store.useState("isTriggerActive", thisTriggerId);
9390      const isOpenedByThisTrigger = store.useState("isOpenedByTrigger", thisTriggerId);
9391      const floatingRootContext = store.useState("floatingRootContext");
9392      const triggerElementRef = React38.useRef(null);
9393      const delayWithDefault = delay ?? OPEN_DELAY;
9394      const closeDelayWithDefault = closeDelay ?? 0;
9395      const {
9396        registerTrigger,
9397        isMountedByThisTrigger
9398      } = useTriggerDataForwarding(thisTriggerId, triggerElementRef, store, {
9399        payload,
9400        closeOnClick,
9401        closeDelay: closeDelayWithDefault
9402      });
9403      const providerContext = useTooltipProviderContext();
9404      const {
9405        delayRef,
9406        isInstantPhase,
9407        hasProvider
9408      } = useDelayGroup(floatingRootContext, {
9409        open: isOpenedByThisTrigger
9410      });
9411      const hoverInteraction = useHoverInteractionSharedState(floatingRootContext);
9412      store.useSyncedValue("isInstantPhase", isInstantPhase);
9413      const rootDisabled = store.useState("disabled");
9414      const disabled2 = disabledProp ?? rootDisabled;
9415      const disabledRef = useValueAsRef(disabled2);
9416      const trackCursorAxis = store.useState("trackCursorAxis");
9417      const disableHoverablePopup = store.useState("disableHoverablePopup");
9418      const isNestedTriggerHoveredRef = React38.useRef(false);
9419      const nestedTriggerOpenTimeout = useTimeout();
9420      const pointerTypeRef = React38.useRef(void 0);
9421      function getOpenDelay() {
9422        const providerDelay = providerContext?.delay;
9423        const groupOpenValue = typeof delayRef.current === "object" ? delayRef.current.open : void 0;
9424        let computedOpenDelay = delayWithDefault;
9425        if (hasProvider) {
9426          if (groupOpenValue !== 0) {
9427            computedOpenDelay = delay ?? providerDelay ?? delayWithDefault;
9428          } else {
9429            computedOpenDelay = 0;
9430          }
9431        }
9432        return computedOpenDelay;
9433      }
9434      function isEnabledNestedTriggerTarget(target) {
9435        const triggerEl = triggerElementRef.current;
9436        if (!triggerEl || !target) {
9437          return false;
9438        }
9439        const nearestTrigger = closestEnabledTooltipTrigger(target);
9440        return nearestTrigger !== null && nearestTrigger !== triggerEl && contains(triggerEl, nearestTrigger);
9441      }
9442      function detectNestedTriggerHover(target) {
9443        const nestedTriggerHovered = isEnabledNestedTriggerTarget(target);
9444        isNestedTriggerHoveredRef.current = nestedTriggerHovered;
9445        if (nestedTriggerHovered) {
9446          hoverInteraction.openChangeTimeout.clear();
9447          hoverInteraction.restTimeout.clear();
9448          hoverInteraction.restTimeoutPending = false;
9449          nestedTriggerOpenTimeout.clear();
9450        }
9451        return nestedTriggerHovered;
9452      }
9453      const hoverProps = useHoverReferenceInteraction(floatingRootContext, {
9454        enabled: !disabled2,
9455        mouseOnly: true,
9456        move: false,
9457        handleClose: !disableHoverablePopup && trackCursorAxis !== "both" ? safePolygon() : null,
9458        restMs: getOpenDelay,
9459        delay() {
9460          const closeValue = typeof delayRef.current === "object" ? delayRef.current.close : void 0;
9461          let computedCloseDelay = closeDelayWithDefault;
9462          if (closeDelay == null && hasProvider) {
9463            computedCloseDelay = closeValue;
9464          }
9465          return {
9466            close: computedCloseDelay
9467          };
9468        },
9469        triggerElementRef,
9470        isActiveTrigger: isTriggerActive,
9471        isClosing: () => store.select("transitionStatus") === "ending",
9472        shouldOpen() {
9473          return !isNestedTriggerHoveredRef.current;
9474        }
9475      });
9476      const focusProps = useFocus(floatingRootContext, {
9477        enabled: !disabled2
9478      }).reference;
9479      const handleNestedTriggerHover = (event) => {
9480        const wasNestedTriggerHovered = isNestedTriggerHoveredRef.current;
9481        const target = getTargetElement(event);
9482        const nestedTriggerHovered = detectNestedTriggerHover(target);
9483        const triggerEl = triggerElementRef.current;
9484        const targetInsideTrigger = triggerEl && target && contains(triggerEl, target);
9485        if (nestedTriggerHovered && store.select("open") && store.select("lastOpenChangeReason") === reason_parts_exports.triggerHover) {
9486          store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
9487          return;
9488        }
9489        if (wasNestedTriggerHovered && !nestedTriggerHovered && targetInsideTrigger && !disabledRef.current && !store.select("open") && triggerEl && // Match the hover hook's non-strict mouse fallback for mouse-only event sequences.
9490        isMouseLikePointerType(pointerTypeRef.current)) {
9491          const open = () => {
9492            if (!isNestedTriggerHoveredRef.current && !disabledRef.current && !store.select("open")) {
9493              store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerEl));
9494            }
9495          };
9496          const openDelay = getOpenDelay();
9497          if (openDelay === 0) {
9498            nestedTriggerOpenTimeout.clear();
9499            open();
9500          } else {
9501            nestedTriggerOpenTimeout.start(openDelay, open);
9502          }
9503        }
9504      };
9505      const rootTriggerProps = store.useState("triggerProps", isMountedByThisTrigger);
9506      const shouldApplyRootTriggerProps = isMountedByThisTrigger || trackCursorAxis !== "none";
9507      const state = {
9508        open: isOpenedByThisTrigger
9509      };
9510      const element = useRenderElement("button", componentProps, {
9511        state,
9512        ref: [forwardedRef, registerTrigger, triggerElementRef],
9513        props: [hoverProps, focusProps, shouldApplyRootTriggerProps ? rootTriggerProps : void 0, {
9514          onMouseOver(event) {
9515            handleNestedTriggerHover(event.nativeEvent);
9516          },
9517          onFocus(event) {
9518            if (isEnabledNestedTriggerTarget(getTargetElement(event.nativeEvent))) {
9519              event.preventBaseUIHandler();
9520            }
9521          },
9522          onMouseLeave() {
9523            isNestedTriggerHoveredRef.current = false;
9524            nestedTriggerOpenTimeout.clear();
9525            pointerTypeRef.current = void 0;
9526          },
9527          onPointerEnter(event) {
9528            pointerTypeRef.current = event.pointerType;
9529          },
9530          onPointerDown(event) {
9531            pointerTypeRef.current = event.pointerType;
9532            store.set("closeOnClick", closeOnClick);
9533            if (closeOnClick && !store.select("open")) {
9534              store.cancelPendingOpen(event.nativeEvent);
9535            }
9536          },
9537          onClick(event) {
9538            if (closeOnClick && !store.select("open")) {
9539              store.cancelPendingOpen(event.nativeEvent);
9540            }
9541          },
9542          id: thisTriggerId,
9543          [TooltipTriggerDataAttributes.triggerDisabled]: disabled2 ? "" : void 0,
9544          [TOOLTIP_TRIGGER_IDENTIFIER]: disabled2 ? void 0 : ""
9545        }, elementProps],
9546        stateAttributesMapping: triggerOpenStateMapping
9547      });
9548      return element;
9549    });
9550    if (true) TooltipTrigger.displayName = "TooltipTrigger";
9551  
9552    // node_modules/@base-ui/react/tooltip/portal/TooltipPortal.mjs
9553    var React40 = __toESM(require_react(), 1);
9554  
9555    // node_modules/@base-ui/react/tooltip/portal/TooltipPortalContext.mjs
9556    var React39 = __toESM(require_react(), 1);
9557    var TooltipPortalContext = /* @__PURE__ */ React39.createContext(void 0);
9558    if (true) TooltipPortalContext.displayName = "TooltipPortalContext";
9559    function useTooltipPortalContext() {
9560      const value = React39.useContext(TooltipPortalContext);
9561      if (value === void 0) {
9562        throw new Error(true ? "Base UI: <Tooltip.Portal> is missing." : formatErrorMessage_default(70));
9563      }
9564      return value;
9565    }
9566  
9567    // node_modules/@base-ui/react/tooltip/portal/TooltipPortal.mjs
9568    var import_jsx_runtime38 = __toESM(require_jsx_runtime(), 1);
9569    var TooltipPortal = /* @__PURE__ */ React40.forwardRef(function TooltipPortal2(props, forwardedRef) {
9570      const {
9571        keepMounted = false,
9572        ...portalProps
9573      } = props;
9574      const store = useTooltipRootContext();
9575      const mounted = store.useState("mounted");
9576      const shouldRender = mounted || keepMounted;
9577      if (!shouldRender) {
9578        return null;
9579      }
9580      return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TooltipPortalContext.Provider, {
9581        value: keepMounted,
9582        children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(FloatingPortalLite, {
9583          ref: forwardedRef,
9584          ...portalProps
9585        })
9586      });
9587    });
9588    if (true) TooltipPortal.displayName = "TooltipPortal";
9589  
9590    // node_modules/@base-ui/react/tooltip/positioner/TooltipPositioner.mjs
9591    var React42 = __toESM(require_react(), 1);
9592  
9593    // node_modules/@base-ui/react/tooltip/positioner/TooltipPositionerContext.mjs
9594    var React41 = __toESM(require_react(), 1);
9595    var TooltipPositionerContext = /* @__PURE__ */ React41.createContext(void 0);
9596    if (true) TooltipPositionerContext.displayName = "TooltipPositionerContext";
9597    function useTooltipPositionerContext() {
9598      const context = React41.useContext(TooltipPositionerContext);
9599      if (context === void 0) {
9600        throw new Error(true ? "Base UI: TooltipPositionerContext is missing. TooltipPositioner parts must be placed within <Tooltip.Positioner>." : formatErrorMessage_default(71));
9601      }
9602      return context;
9603    }
9604  
9605    // node_modules/@base-ui/react/tooltip/positioner/TooltipPositioner.mjs
9606    var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1);
9607    var TooltipPositioner = /* @__PURE__ */ React42.forwardRef(function TooltipPositioner2(componentProps, forwardedRef) {
9608      const {
9609        render: render4,
9610        className,
9611        anchor,
9612        positionMethod = "absolute",
9613        side = "top",
9614        align = "center",
9615        sideOffset = 0,
9616        alignOffset = 0,
9617        collisionBoundary = "clipping-ancestors",
9618        collisionPadding = 5,
9619        arrowPadding = 5,
9620        sticky = false,
9621        disableAnchorTracking = false,
9622        collisionAvoidance = POPUP_COLLISION_AVOIDANCE,
9623        style,
9624        ...elementProps
9625      } = componentProps;
9626      const store = useTooltipRootContext();
9627      const keepMounted = useTooltipPortalContext();
9628      const open = store.useState("open");
9629      const mounted = store.useState("mounted");
9630      const trackCursorAxis = store.useState("trackCursorAxis");
9631      const disableHoverablePopup = store.useState("disableHoverablePopup");
9632      const floatingRootContext = store.useState("floatingRootContext");
9633      const instantType = store.useState("instantType");
9634      const transitionStatus = store.useState("transitionStatus");
9635      const hasViewport = store.useState("hasViewport");
9636      const positioning = useAnchorPositioning({
9637        anchor,
9638        positionMethod,
9639        floatingRootContext,
9640        mounted,
9641        side,
9642        sideOffset,
9643        align,
9644        alignOffset,
9645        collisionBoundary,
9646        collisionPadding,
9647        sticky,
9648        arrowPadding,
9649        disableAnchorTracking,
9650        keepMounted,
9651        collisionAvoidance,
9652        adaptiveOrigin: hasViewport ? adaptiveOrigin : void 0
9653      });
9654      const state = React42.useMemo(() => ({
9655        open,
9656        side: positioning.side,
9657        align: positioning.align,
9658        anchorHidden: positioning.anchorHidden,
9659        instant: trackCursorAxis !== "none" ? "tracking-cursor" : instantType
9660      }), [open, positioning.side, positioning.align, positioning.anchorHidden, trackCursorAxis, instantType]);
9661      const element = usePositioner(componentProps, state, {
9662        styles: positioning.positionerStyles,
9663        transitionStatus,
9664        props: elementProps,
9665        refs: [forwardedRef, store.useStateSetter("positionerElement")],
9666        hidden: !mounted,
9667        inert: !open || trackCursorAxis === "both" || disableHoverablePopup
9668      });
9669      return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TooltipPositionerContext.Provider, {
9670        value: positioning,
9671        children: element
9672      });
9673    });
9674    if (true) TooltipPositioner.displayName = "TooltipPositioner";
9675  
9676    // node_modules/@base-ui/react/tooltip/popup/TooltipPopup.mjs
9677    var React43 = __toESM(require_react(), 1);
9678    var stateAttributesMapping = {
9679      ...popupStateMapping,
9680      ...transitionStatusMapping
9681    };
9682    var TooltipPopup = /* @__PURE__ */ React43.forwardRef(function TooltipPopup2(componentProps, forwardedRef) {
9683      const {
9684        render: render4,
9685        className,
9686        style,
9687        ...elementProps
9688      } = componentProps;
9689      const store = useTooltipRootContext();
9690      const {
9691        side,
9692        align
9693      } = useTooltipPositionerContext();
9694      const open = store.useState("open");
9695      const instantType = store.useState("instantType");
9696      const transitionStatus = store.useState("transitionStatus");
9697      const popupProps = store.useState("popupProps");
9698      const floatingContext = store.useState("floatingRootContext");
9699      const disabled2 = store.useState("disabled");
9700      const closeDelay = store.useState("closeDelay");
9701      useOpenChangeComplete({
9702        open,
9703        ref: store.context.popupRef,
9704        onComplete() {
9705          if (open) {
9706            store.context.onOpenChangeComplete?.(true);
9707          }
9708        }
9709      });
9710      useHoverFloatingInteraction(floatingContext, {
9711        enabled: !disabled2,
9712        closeDelay
9713      });
9714      const setPopupElement = store.useStateSetter("popupElement");
9715      const state = {
9716        open,
9717        side,
9718        align,
9719        instant: instantType,
9720        transitionStatus
9721      };
9722      const element = useRenderElement("div", componentProps, {
9723        state,
9724        ref: [forwardedRef, store.context.popupRef, setPopupElement],
9725        props: [popupProps, getDisabledMountTransitionStyles(transitionStatus), elementProps],
9726        stateAttributesMapping
9727      });
9728      return element;
9729    });
9730    if (true) TooltipPopup.displayName = "TooltipPopup";
9731  
9732    // node_modules/@base-ui/react/tooltip/arrow/TooltipArrow.mjs
9733    var React44 = __toESM(require_react(), 1);
9734    var TooltipArrow = /* @__PURE__ */ React44.forwardRef(function TooltipArrow2(componentProps, forwardedRef) {
9735      const {
9736        render: render4,
9737        className,
9738        style,
9739        ...elementProps
9740      } = componentProps;
9741      const store = useTooltipRootContext();
9742      const {
9743        arrowRef,
9744        side,
9745        align,
9746        arrowUncentered,
9747        arrowStyles
9748      } = useTooltipPositionerContext();
9749      const open = store.useState("open");
9750      const instantType = store.useState("instantType");
9751      const state = {
9752        open,
9753        side,
9754        align,
9755        uncentered: arrowUncentered,
9756        instant: instantType
9757      };
9758      const element = useRenderElement("div", componentProps, {
9759        state,
9760        ref: [forwardedRef, arrowRef],
9761        props: [{
9762          style: arrowStyles,
9763          "aria-hidden": true
9764        }, elementProps],
9765        stateAttributesMapping: popupStateMapping
9766      });
9767      return element;
9768    });
9769    if (true) TooltipArrow.displayName = "TooltipArrow";
9770  
9771    // node_modules/@base-ui/react/tooltip/provider/TooltipProvider.mjs
9772    var React45 = __toESM(require_react(), 1);
9773    var import_jsx_runtime40 = __toESM(require_jsx_runtime(), 1);
9774    var TooltipProvider = function TooltipProvider2(props) {
9775      const {
9776        delay,
9777        closeDelay,
9778        timeout = 400
9779      } = props;
9780      const contextValue = React45.useMemo(() => ({
9781        delay,
9782        closeDelay
9783      }), [delay, closeDelay]);
9784      const delayValue = React45.useMemo(() => ({
9785        open: delay,
9786        close: closeDelay
9787      }), [delay, closeDelay]);
9788      return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(TooltipProviderContext.Provider, {
9789        value: contextValue,
9790        children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FloatingDelayGroup, {
9791          delay: delayValue,
9792          timeoutMs: timeout,
9793          children: props.children
9794        })
9795      });
9796    };
9797    if (true) TooltipProvider.displayName = "TooltipProvider";
9798  
9799    // node_modules/@base-ui/react/tooltip/viewport/TooltipViewport.mjs
9800    var React46 = __toESM(require_react(), 1);
9801  
9802    // node_modules/@base-ui/react/tooltip/viewport/TooltipViewportCssVars.mjs
9803    var TooltipViewportCssVars = /* @__PURE__ */ (function(TooltipViewportCssVars2) {
9804      TooltipViewportCssVars2["popupWidth"] = "--popup-width";
9805      TooltipViewportCssVars2["popupHeight"] = "--popup-height";
9806      return TooltipViewportCssVars2;
9807    })({});
9808  
9809    // node_modules/@base-ui/react/tooltip/viewport/TooltipViewport.mjs
9810    var stateAttributesMapping2 = {
9811      activationDirection: (value) => value ? {
9812        "data-activation-direction": value
9813      } : null
9814    };
9815    var TooltipViewport = /* @__PURE__ */ React46.forwardRef(function TooltipViewport2(componentProps, forwardedRef) {
9816      const {
9817        render: render4,
9818        className,
9819        style,
9820        children,
9821        ...elementProps
9822      } = componentProps;
9823      const store = useTooltipRootContext();
9824      const positioner = useTooltipPositionerContext();
9825      const instantType = store.useState("instantType");
9826      const {
9827        children: childrenToRender,
9828        state: viewportState
9829      } = usePopupViewport({
9830        store,
9831        side: positioner.side,
9832        cssVars: TooltipViewportCssVars,
9833        children
9834      });
9835      const state = {
9836        activationDirection: viewportState.activationDirection,
9837        transitioning: viewportState.transitioning,
9838        instant: instantType
9839      };
9840      return useRenderElement("div", componentProps, {
9841        state,
9842        ref: forwardedRef,
9843        props: [elementProps, {
9844          children: childrenToRender
9845        }],
9846        stateAttributesMapping: stateAttributesMapping2
9847      });
9848    });
9849    if (true) TooltipViewport.displayName = "TooltipViewport";
9850  
9851    // node_modules/@base-ui/react/tooltip/store/TooltipHandle.mjs
9852    var TooltipHandle = class {
9853      /**
9854       * Internal store holding the tooltip state.
9855       * @internal
9856       */
9857      constructor() {
9858        this.store = new TooltipStore();
9859      }
9860      /**
9861       * Opens the tooltip and associates it with the trigger with the given ID.
9862       * The trigger must be a Tooltip.Trigger component with this handle passed as a prop.
9863       *
9864       * This method should only be called in an event handler or an effect (not during rendering).
9865       *
9866       * @param triggerId ID of the trigger to associate with the tooltip.
9867       */
9868      open(triggerId) {
9869        const triggerElement = triggerId ? this.store.context.triggerElements.getById(triggerId) : void 0;
9870        if (triggerId && !triggerElement) {
9871          throw new Error(true ? `Base UI: TooltipHandle.open: No trigger found with id "$triggerId}".` : formatErrorMessage_default(81, triggerId));
9872        }
9873        this.store.setOpen(true, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, triggerElement));
9874      }
9875      /**
9876       * Closes the tooltip.
9877       */
9878      close() {
9879        this.store.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, void 0));
9880      }
9881      /**
9882       * Indicates whether the tooltip is currently open.
9883       */
9884      get isOpen() {
9885        return this.store.select("open");
9886      }
9887    };
9888    function createTooltipHandle() {
9889      return new TooltipHandle();
9890    }
9891  
9892    // node_modules/@base-ui/react/use-render/useRender.mjs
9893    function useRender(params) {
9894      return useRenderElement(params.defaultTagName ?? "div", params, params);
9895    }
9896  
9897    // packages/ui/build-module/utils/render-slot-with-children.mjs
9898    var import_element11 = __toESM(require_element(), 1);
9899    function renderSlotWithChildren(slot, defaultSlot, children) {
9900      return (0, import_element11.cloneElement)(slot ?? defaultSlot, { children });
9901    }
9902  
9903    // packages/ui/build-module/utils/theme-provider.mjs
9904    var theme = __toESM(require_theme(), 1);
9905  
9906    // packages/ui/build-module/lock-unlock.mjs
9907    var import_private_apis = __toESM(require_private_apis(), 1);
9908    var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
9909      "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
9910      "@wordpress/ui"
9911    );
9912  
9913    // packages/ui/build-module/utils/theme-provider.mjs
9914    function getThemeProvider() {
9915      const themePackage = theme;
9916      if (themePackage.ThemeProvider) {
9917        return themePackage.ThemeProvider;
9918      }
9919      if (!themePackage.privateApis) {
9920        throw new Error(
9921          "@wordpress/ui: @wordpress/theme must expose `ThemeProvider` or `privateApis.ThemeProvider`."
9922        );
9923      }
9924      return unlock(
9925        themePackage.privateApis
9926      ).ThemeProvider;
9927    }
9928    var ThemeProvider = getThemeProvider();
9929  
9930    // packages/ui/build-module/stack/stack.mjs
9931    var import_element12 = __toESM(require_element(), 1);
9932    var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
9933    function getRuntime() {
9934      const globalScope = globalThis;
9935      if (globalScope.__wpStyleRuntime) {
9936        return globalScope.__wpStyleRuntime;
9937      }
9938      globalScope.__wpStyleRuntime = {
9939        documents: /* @__PURE__ */ new Map(),
9940        styles: /* @__PURE__ */ new Map(),
9941        injectedStyles: /* @__PURE__ */ new WeakMap()
9942      };
9943      if (typeof document !== "undefined") {
9944        registerDocument(document);
9945      }
9946      return globalScope.__wpStyleRuntime;
9947    }
9948    function documentContainsStyleHash(targetDocument, hash) {
9949      if (!targetDocument.head) {
9950        return false;
9951      }
9952      for (const style of targetDocument.head.querySelectorAll(
9953        `style[$STYLE_HASH_ATTRIBUTE}]`
9954      )) {
9955        if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {
9956          return true;
9957        }
9958      }
9959      return false;
9960    }
9961    function injectStyle(targetDocument, hash, css) {
9962      if (!targetDocument.head) {
9963        return;
9964      }
9965      const runtime = getRuntime();
9966      let injectedStyles = runtime.injectedStyles.get(targetDocument);
9967      if (!injectedStyles) {
9968        injectedStyles = /* @__PURE__ */ new Set();
9969        runtime.injectedStyles.set(targetDocument, injectedStyles);
9970      }
9971      if (injectedStyles.has(hash)) {
9972        return;
9973      }
9974      if (documentContainsStyleHash(targetDocument, hash)) {
9975        injectedStyles.add(hash);
9976        return;
9977      }
9978      const style = targetDocument.createElement("style");
9979      style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);
9980      style.appendChild(targetDocument.createTextNode(css));
9981      targetDocument.head.appendChild(style);
9982      injectedStyles.add(hash);
9983    }
9984    function registerDocument(targetDocument) {
9985      const runtime = getRuntime();
9986      runtime.documents.set(
9987        targetDocument,
9988        (runtime.documents.get(targetDocument) ?? 0) + 1
9989      );
9990      for (const [hash, css] of runtime.styles) {
9991        injectStyle(targetDocument, hash, css);
9992      }
9993      return () => {
9994        const count = runtime.documents.get(targetDocument);
9995        if (count === void 0) {
9996          return;
9997        }
9998        if (count <= 1) {
9999          runtime.documents.delete(targetDocument);
10000          return;
10001        }
10002        runtime.documents.set(targetDocument, count - 1);
10003      };
10004    }
10005    function registerStyle(hash, css) {
10006      const runtime = getRuntime();
10007      runtime.styles.set(hash, css);
10008      for (const targetDocument of runtime.documents.keys()) {
10009        injectStyle(targetDocument, hash, css);
10010      }
10011    }
10012    if (typeof process === "undefined" || true) {
10013      registerStyle("32aba35fe1", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._19ce0419607e1896__stack{display:flex}}}");
10014    }
10015    var style_default = { "stack": "_19ce0419607e1896__stack" };
10016    var gapTokens = {
10017      xs: "var(--wpds-dimension-gap-xs, 4px)",
10018      sm: "var(--wpds-dimension-gap-sm, 8px)",
10019      md: "var(--wpds-dimension-gap-md, 12px)",
10020      lg: "var(--wpds-dimension-gap-lg, 16px)",
10021      xl: "var(--wpds-dimension-gap-xl, 24px)",
10022      "2xl": "var(--wpds-dimension-gap-2xl, 32px)",
10023      "3xl": "var(--wpds-dimension-gap-3xl, 40px)"
10024    };
10025    var Stack = (0, import_element12.forwardRef)(function Stack2({ direction, gap, align, justify, wrap, render: render4, ...props }, ref) {
10026      const style = {
10027        gap: gap && gapTokens[gap],
10028        alignItems: align,
10029        justifyContent: justify,
10030        flexDirection: direction,
10031        flexWrap: wrap
10032      };
10033      const element = useRender({
10034        render: render4,
10035        ref,
10036        props: mergeProps(props, { style, className: style_default.stack })
10037      });
10038      return element;
10039    });
10040  
10041    // packages/ui/build-module/tooltip/index.mjs
10042    var tooltip_exports = {};
10043    __export(tooltip_exports, {
10044      Popup: () => Popup,
10045      Portal: () => Portal,
10046      Positioner: () => Positioner,
10047      Provider: () => Provider,
10048      Root: () => Root,
10049      Trigger: () => Trigger
10050    });
10051  
10052    // packages/ui/build-module/tooltip/popup.mjs
10053    var import_element15 = __toESM(require_element(), 1);
10054  
10055    // packages/ui/build-module/tooltip/portal.mjs
10056    var import_element13 = __toESM(require_element(), 1);
10057  
10058    // packages/ui/build-module/utils/wp-compat-overlay-slot.mjs
10059    var STYLE_HASH_ATTRIBUTE2 = "data-wp-hash";
10060    function getRuntime2() {
10061      const globalScope = globalThis;
10062      if (globalScope.__wpStyleRuntime) {
10063        return globalScope.__wpStyleRuntime;
10064      }
10065      globalScope.__wpStyleRuntime = {
10066        documents: /* @__PURE__ */ new Map(),
10067        styles: /* @__PURE__ */ new Map(),
10068        injectedStyles: /* @__PURE__ */ new WeakMap()
10069      };
10070      if (typeof document !== "undefined") {
10071        registerDocument2(document);
10072      }
10073      return globalScope.__wpStyleRuntime;
10074    }
10075    function documentContainsStyleHash2(targetDocument, hash) {
10076      if (!targetDocument.head) {
10077        return false;
10078      }
10079      for (const style of targetDocument.head.querySelectorAll(
10080        `style[$STYLE_HASH_ATTRIBUTE2}]`
10081      )) {
10082        if (style.getAttribute(STYLE_HASH_ATTRIBUTE2) === hash) {
10083          return true;
10084        }
10085      }
10086      return false;
10087    }
10088    function injectStyle2(targetDocument, hash, css) {
10089      if (!targetDocument.head) {
10090        return;
10091      }
10092      const runtime = getRuntime2();
10093      let injectedStyles = runtime.injectedStyles.get(targetDocument);
10094      if (!injectedStyles) {
10095        injectedStyles = /* @__PURE__ */ new Set();
10096        runtime.injectedStyles.set(targetDocument, injectedStyles);
10097      }
10098      if (injectedStyles.has(hash)) {
10099        return;
10100      }
10101      if (documentContainsStyleHash2(targetDocument, hash)) {
10102        injectedStyles.add(hash);
10103        return;
10104      }
10105      const style = targetDocument.createElement("style");
10106      style.setAttribute(STYLE_HASH_ATTRIBUTE2, hash);
10107      style.appendChild(targetDocument.createTextNode(css));
10108      targetDocument.head.appendChild(style);
10109      injectedStyles.add(hash);
10110    }
10111    function registerDocument2(targetDocument) {
10112      const runtime = getRuntime2();
10113      runtime.documents.set(
10114        targetDocument,
10115        (runtime.documents.get(targetDocument) ?? 0) + 1
10116      );
10117      for (const [hash, css] of runtime.styles) {
10118        injectStyle2(targetDocument, hash, css);
10119      }
10120      return () => {
10121        const count = runtime.documents.get(targetDocument);
10122        if (count === void 0) {
10123          return;
10124        }
10125        if (count <= 1) {
10126          runtime.documents.delete(targetDocument);
10127          return;
10128        }
10129        runtime.documents.set(targetDocument, count - 1);
10130      };
10131    }
10132    function registerStyle2(hash, css) {
10133      const runtime = getRuntime2();
10134      runtime.styles.set(hash, css);
10135      for (const targetDocument of runtime.documents.keys()) {
10136        injectStyle2(targetDocument, hash, css);
10137      }
10138    }
10139    if (typeof process === "undefined" || true) {
10140      registerStyle2("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}}}");
10141    }
10142    var wp_compat_overlay_slot_default = { "slot": "_11fc52b637ff8a7e__slot" };
10143    var WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE = "data-wp-compat-overlay-slot";
10144    function resolveOwnerDocument() {
10145      return typeof document === "undefined" ? null : document;
10146    }
10147    function isInWordPressEnvironment() {
10148      let topWp;
10149      try {
10150        topWp = window.top?.wp;
10151      } catch {
10152      }
10153      const wp = topWp ?? window.wp;
10154      return typeof wp?.components === "object" && wp.components !== null;
10155    }
10156    var cachedSlot = null;
10157    function createSlot(ownerDocument2) {
10158      const element = ownerDocument2.createElement("div");
10159      element.setAttribute(WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE, "");
10160      if (wp_compat_overlay_slot_default.slot) {
10161        element.classList.add(wp_compat_overlay_slot_default.slot);
10162      }
10163      ownerDocument2.body.appendChild(element);
10164      return element;
10165    }
10166    function getWpCompatOverlaySlot() {
10167      if (typeof window === "undefined") {
10168        return void 0;
10169      }
10170      if (!isInWordPressEnvironment() && window.__wpUiCompatOverlaySlotEnabled !== true) {
10171        return void 0;
10172      }
10173      const ownerDocument2 = resolveOwnerDocument();
10174      if (!ownerDocument2 || !ownerDocument2.body) {
10175        return void 0;
10176      }
10177      if (cachedSlot && cachedSlot.ownerDocument === ownerDocument2 && cachedSlot.isConnected) {
10178        return cachedSlot;
10179      }
10180      const existing = ownerDocument2.querySelector(
10181        `[$WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE}]`
10182      );
10183      if (existing instanceof HTMLDivElement) {
10184        cachedSlot = existing;
10185        return existing;
10186      }
10187      if (cachedSlot?.isConnected) {
10188        cachedSlot.remove();
10189      }
10190      cachedSlot = createSlot(ownerDocument2);
10191      return cachedSlot;
10192    }
10193  
10194    // packages/ui/build-module/tooltip/portal.mjs
10195    var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1);
10196    var Portal = (0, import_element13.forwardRef)(
10197      function TooltipPortal3({ container, ...restProps }, ref) {
10198        return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
10199          index_parts_exports.Portal,
10200          {
10201            container: container ?? getWpCompatOverlaySlot(),
10202            ...restProps,
10203            ref
10204          }
10205        );
10206      }
10207    );
10208  
10209    // packages/ui/build-module/tooltip/positioner.mjs
10210    var import_element14 = __toESM(require_element(), 1);
10211    var import_jsx_runtime42 = __toESM(require_jsx_runtime(), 1);
10212    var STYLE_HASH_ATTRIBUTE3 = "data-wp-hash";
10213    function getRuntime3() {
10214      const globalScope = globalThis;
10215      if (globalScope.__wpStyleRuntime) {
10216        return globalScope.__wpStyleRuntime;
10217      }
10218      globalScope.__wpStyleRuntime = {
10219        documents: /* @__PURE__ */ new Map(),
10220        styles: /* @__PURE__ */ new Map(),
10221        injectedStyles: /* @__PURE__ */ new WeakMap()
10222      };
10223      if (typeof document !== "undefined") {
10224        registerDocument3(document);
10225      }
10226      return globalScope.__wpStyleRuntime;
10227    }
10228    function documentContainsStyleHash3(targetDocument, hash) {
10229      if (!targetDocument.head) {
10230        return false;
10231      }
10232      for (const style of targetDocument.head.querySelectorAll(
10233        `style[$STYLE_HASH_ATTRIBUTE3}]`
10234      )) {
10235        if (style.getAttribute(STYLE_HASH_ATTRIBUTE3) === hash) {
10236          return true;
10237        }
10238      }
10239      return false;
10240    }
10241    function injectStyle3(targetDocument, hash, css) {
10242      if (!targetDocument.head) {
10243        return;
10244      }
10245      const runtime = getRuntime3();
10246      let injectedStyles = runtime.injectedStyles.get(targetDocument);
10247      if (!injectedStyles) {
10248        injectedStyles = /* @__PURE__ */ new Set();
10249        runtime.injectedStyles.set(targetDocument, injectedStyles);
10250      }
10251      if (injectedStyles.has(hash)) {
10252        return;
10253      }
10254      if (documentContainsStyleHash3(targetDocument, hash)) {
10255        injectedStyles.add(hash);
10256        return;
10257      }
10258      const style = targetDocument.createElement("style");
10259      style.setAttribute(STYLE_HASH_ATTRIBUTE3, hash);
10260      style.appendChild(targetDocument.createTextNode(css));
10261      targetDocument.head.appendChild(style);
10262      injectedStyles.add(hash);
10263    }
10264    function registerDocument3(targetDocument) {
10265      const runtime = getRuntime3();
10266      runtime.documents.set(
10267        targetDocument,
10268        (runtime.documents.get(targetDocument) ?? 0) + 1
10269      );
10270      for (const [hash, css] of runtime.styles) {
10271        injectStyle3(targetDocument, hash, css);
10272      }
10273      return () => {
10274        const count = runtime.documents.get(targetDocument);
10275        if (count === void 0) {
10276          return;
10277        }
10278        if (count <= 1) {
10279          runtime.documents.delete(targetDocument);
10280          return;
10281        }
10282        runtime.documents.set(targetDocument, count - 1);
10283      };
10284    }
10285    function registerStyle3(hash, css) {
10286      const runtime = getRuntime3();
10287      runtime.styles.set(hash, css);
10288      for (const targetDocument of runtime.documents.keys()) {
10289        injectStyle3(targetDocument, hash, css);
10290      }
10291    }
10292    if (typeof process === "undefined" || true) {
10293      registerStyle3("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}");
10294    }
10295    var resets_default = { "box-sizing": "_336cd3e4e743482f__box-sizing" };
10296    if (typeof process === "undefined" || true) {
10297      registerStyle3("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}}}}');
10298    }
10299    var style_default2 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" };
10300    var Positioner = (0, import_element14.forwardRef)(
10301      function TooltipPositioner3({ align = "center", className, side = "top", sideOffset = 4, ...props }, ref) {
10302        return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10303          index_parts_exports.Positioner,
10304          {
10305            ref,
10306            align,
10307            side,
10308            sideOffset,
10309            ...props,
10310            className: clsx_default(
10311              resets_default["box-sizing"],
10312              style_default2.positioner,
10313              className
10314            )
10315          }
10316        );
10317      }
10318    );
10319  
10320    // packages/ui/build-module/tooltip/popup.mjs
10321    var import_jsx_runtime43 = __toESM(require_jsx_runtime(), 1);
10322    var STYLE_HASH_ATTRIBUTE4 = "data-wp-hash";
10323    function getRuntime4() {
10324      const globalScope = globalThis;
10325      if (globalScope.__wpStyleRuntime) {
10326        return globalScope.__wpStyleRuntime;
10327      }
10328      globalScope.__wpStyleRuntime = {
10329        documents: /* @__PURE__ */ new Map(),
10330        styles: /* @__PURE__ */ new Map(),
10331        injectedStyles: /* @__PURE__ */ new WeakMap()
10332      };
10333      if (typeof document !== "undefined") {
10334        registerDocument4(document);
10335      }
10336      return globalScope.__wpStyleRuntime;
10337    }
10338    function documentContainsStyleHash4(targetDocument, hash) {
10339      if (!targetDocument.head) {
10340        return false;
10341      }
10342      for (const style of targetDocument.head.querySelectorAll(
10343        `style[$STYLE_HASH_ATTRIBUTE4}]`
10344      )) {
10345        if (style.getAttribute(STYLE_HASH_ATTRIBUTE4) === hash) {
10346          return true;
10347        }
10348      }
10349      return false;
10350    }
10351    function injectStyle4(targetDocument, hash, css) {
10352      if (!targetDocument.head) {
10353        return;
10354      }
10355      const runtime = getRuntime4();
10356      let injectedStyles = runtime.injectedStyles.get(targetDocument);
10357      if (!injectedStyles) {
10358        injectedStyles = /* @__PURE__ */ new Set();
10359        runtime.injectedStyles.set(targetDocument, injectedStyles);
10360      }
10361      if (injectedStyles.has(hash)) {
10362        return;
10363      }
10364      if (documentContainsStyleHash4(targetDocument, hash)) {
10365        injectedStyles.add(hash);
10366        return;
10367      }
10368      const style = targetDocument.createElement("style");
10369      style.setAttribute(STYLE_HASH_ATTRIBUTE4, hash);
10370      style.appendChild(targetDocument.createTextNode(css));
10371      targetDocument.head.appendChild(style);
10372      injectedStyles.add(hash);
10373    }
10374    function registerDocument4(targetDocument) {
10375      const runtime = getRuntime4();
10376      runtime.documents.set(
10377        targetDocument,
10378        (runtime.documents.get(targetDocument) ?? 0) + 1
10379      );
10380      for (const [hash, css] of runtime.styles) {
10381        injectStyle4(targetDocument, hash, css);
10382      }
10383      return () => {
10384        const count = runtime.documents.get(targetDocument);
10385        if (count === void 0) {
10386          return;
10387        }
10388        if (count <= 1) {
10389          runtime.documents.delete(targetDocument);
10390          return;
10391        }
10392        runtime.documents.set(targetDocument, count - 1);
10393      };
10394    }
10395    function registerStyle4(hash, css) {
10396      const runtime = getRuntime4();
10397      runtime.styles.set(hash, css);
10398      for (const targetDocument of runtime.documents.keys()) {
10399        injectStyle4(targetDocument, hash, css);
10400      }
10401    }
10402    if (typeof process === "undefined" || true) {
10403      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}}}}');
10404    }
10405    var style_default3 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" };
10406    var POPUP_COLOR = { background: "#1e1e1e" };
10407    var Popup = (0, import_element15.forwardRef)(function TooltipPopup3({ portal, positioner, children, className, ...props }, ref) {
10408      const popupContent = /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ThemeProvider, { color: POPUP_COLOR, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
10409        index_parts_exports.Popup,
10410        {
10411          ref,
10412          className: clsx_default(style_default3.popup, className),
10413          ...props,
10414          children
10415        }
10416      ) });
10417      const positionedPopup = renderSlotWithChildren(
10418        positioner,
10419        /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Positioner, {}),
10420        popupContent
10421      );
10422      return renderSlotWithChildren(portal, /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Portal, {}), positionedPopup);
10423    });
10424  
10425    // packages/ui/build-module/tooltip/trigger.mjs
10426    var import_element16 = __toESM(require_element(), 1);
10427    var import_jsx_runtime44 = __toESM(require_jsx_runtime(), 1);
10428    var Trigger = (0, import_element16.forwardRef)(
10429      function TooltipTrigger3(props, ref) {
10430        return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(index_parts_exports.Trigger, { ref, ...props });
10431      }
10432    );
10433  
10434    // packages/ui/build-module/tooltip/root.mjs
10435    var import_jsx_runtime45 = __toESM(require_jsx_runtime(), 1);
10436    function Root(props) {
10437      return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(index_parts_exports.Root, { ...props });
10438    }
10439  
10440    // packages/ui/build-module/tooltip/provider.mjs
10441    var import_jsx_runtime46 = __toESM(require_jsx_runtime(), 1);
10442    function Provider({ ...props }) {
10443      return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(index_parts_exports.Provider, { ...props });
10444    }
10445  
10446    // packages/ui/build-module/visually-hidden/visually-hidden.mjs
10447    var import_element17 = __toESM(require_element(), 1);
10448    var STYLE_HASH_ATTRIBUTE5 = "data-wp-hash";
10449    function getRuntime5() {
10450      const globalScope = globalThis;
10451      if (globalScope.__wpStyleRuntime) {
10452        return globalScope.__wpStyleRuntime;
10453      }
10454      globalScope.__wpStyleRuntime = {
10455        documents: /* @__PURE__ */ new Map(),
10456        styles: /* @__PURE__ */ new Map(),
10457        injectedStyles: /* @__PURE__ */ new WeakMap()
10458      };
10459      if (typeof document !== "undefined") {
10460        registerDocument5(document);
10461      }
10462      return globalScope.__wpStyleRuntime;
10463    }
10464    function documentContainsStyleHash5(targetDocument, hash) {
10465      if (!targetDocument.head) {
10466        return false;
10467      }
10468      for (const style of targetDocument.head.querySelectorAll(
10469        `style[$STYLE_HASH_ATTRIBUTE5}]`
10470      )) {
10471        if (style.getAttribute(STYLE_HASH_ATTRIBUTE5) === hash) {
10472          return true;
10473        }
10474      }
10475      return false;
10476    }
10477    function injectStyle5(targetDocument, hash, css) {
10478      if (!targetDocument.head) {
10479        return;
10480      }
10481      const runtime = getRuntime5();
10482      let injectedStyles = runtime.injectedStyles.get(targetDocument);
10483      if (!injectedStyles) {
10484        injectedStyles = /* @__PURE__ */ new Set();
10485        runtime.injectedStyles.set(targetDocument, injectedStyles);
10486      }
10487      if (injectedStyles.has(hash)) {
10488        return;
10489      }
10490      if (documentContainsStyleHash5(targetDocument, hash)) {
10491        injectedStyles.add(hash);
10492        return;
10493      }
10494      const style = targetDocument.createElement("style");
10495      style.setAttribute(STYLE_HASH_ATTRIBUTE5, hash);
10496      style.appendChild(targetDocument.createTextNode(css));
10497      targetDocument.head.appendChild(style);
10498      injectedStyles.add(hash);
10499    }
10500    function registerDocument5(targetDocument) {
10501      const runtime = getRuntime5();
10502      runtime.documents.set(
10503        targetDocument,
10504        (runtime.documents.get(targetDocument) ?? 0) + 1
10505      );
10506      for (const [hash, css] of runtime.styles) {
10507        injectStyle5(targetDocument, hash, css);
10508      }
10509      return () => {
10510        const count = runtime.documents.get(targetDocument);
10511        if (count === void 0) {
10512          return;
10513        }
10514        if (count <= 1) {
10515          runtime.documents.delete(targetDocument);
10516          return;
10517        }
10518        runtime.documents.set(targetDocument, count - 1);
10519      };
10520    }
10521    function registerStyle5(hash, css) {
10522      const runtime = getRuntime5();
10523      runtime.styles.set(hash, css);
10524      for (const targetDocument of runtime.documents.keys()) {
10525        injectStyle5(targetDocument, hash, css);
10526      }
10527    }
10528    if (typeof process === "undefined" || true) {
10529      registerStyle5("fa606a57ae", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.f37b9e2e191ebd66__visually-hidden{word-wrap:normal;border:0;clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-break:normal}}}");
10530    }
10531    var style_default4 = { "visually-hidden": "f37b9e2e191ebd66__visually-hidden" };
10532    var VisuallyHidden = (0, import_element17.forwardRef)(
10533      function VisuallyHidden2({ render: render4, ...restProps }, ref) {
10534        const element = useRender({
10535          render: render4,
10536          ref,
10537          props: mergeProps(
10538            { className: style_default4["visually-hidden"] },
10539            restProps,
10540            {
10541              // @ts-expect-error Arbitrary data-* attributes aren't indexable on the typed div props. Kept hardcoded so consumers can't change or remove it.
10542              "data-visually-hidden": ""
10543            }
10544          )
10545        });
10546        return element;
10547      }
10548    );
10549  
10550    // packages/ui/build-module/link/link.mjs
10551    var import_element18 = __toESM(require_element(), 1);
10552    var import_i18n7 = __toESM(require_i18n(), 1);
10553    var import_jsx_runtime47 = __toESM(require_jsx_runtime(), 1);
10554    var STYLE_HASH_ATTRIBUTE6 = "data-wp-hash";
10555    function getRuntime6() {
10556      const globalScope = globalThis;
10557      if (globalScope.__wpStyleRuntime) {
10558        return globalScope.__wpStyleRuntime;
10559      }
10560      globalScope.__wpStyleRuntime = {
10561        documents: /* @__PURE__ */ new Map(),
10562        styles: /* @__PURE__ */ new Map(),
10563        injectedStyles: /* @__PURE__ */ new WeakMap()
10564      };
10565      if (typeof document !== "undefined") {
10566        registerDocument6(document);
10567      }
10568      return globalScope.__wpStyleRuntime;
10569    }
10570    function documentContainsStyleHash6(targetDocument, hash) {
10571      if (!targetDocument.head) {
10572        return false;
10573      }
10574      for (const style of targetDocument.head.querySelectorAll(
10575        `style[$STYLE_HASH_ATTRIBUTE6}]`
10576      )) {
10577        if (style.getAttribute(STYLE_HASH_ATTRIBUTE6) === hash) {
10578          return true;
10579        }
10580      }
10581      return false;
10582    }
10583    function injectStyle6(targetDocument, hash, css) {
10584      if (!targetDocument.head) {
10585        return;
10586      }
10587      const runtime = getRuntime6();
10588      let injectedStyles = runtime.injectedStyles.get(targetDocument);
10589      if (!injectedStyles) {
10590        injectedStyles = /* @__PURE__ */ new Set();
10591        runtime.injectedStyles.set(targetDocument, injectedStyles);
10592      }
10593      if (injectedStyles.has(hash)) {
10594        return;
10595      }
10596      if (documentContainsStyleHash6(targetDocument, hash)) {
10597        injectedStyles.add(hash);
10598        return;
10599      }
10600      const style = targetDocument.createElement("style");
10601      style.setAttribute(STYLE_HASH_ATTRIBUTE6, hash);
10602      style.appendChild(targetDocument.createTextNode(css));
10603      targetDocument.head.appendChild(style);
10604      injectedStyles.add(hash);
10605    }
10606    function registerDocument6(targetDocument) {
10607      const runtime = getRuntime6();
10608      runtime.documents.set(
10609        targetDocument,
10610        (runtime.documents.get(targetDocument) ?? 0) + 1
10611      );
10612      for (const [hash, css] of runtime.styles) {
10613        injectStyle6(targetDocument, hash, css);
10614      }
10615      return () => {
10616        const count = runtime.documents.get(targetDocument);
10617        if (count === void 0) {
10618          return;
10619        }
10620        if (count <= 1) {
10621          runtime.documents.delete(targetDocument);
10622          return;
10623        }
10624        runtime.documents.set(targetDocument, count - 1);
10625      };
10626    }
10627    function registerStyle6(hash, css) {
10628      const runtime = getRuntime6();
10629      runtime.styles.set(hash, css);
10630      for (const targetDocument of runtime.documents.keys()) {
10631        injectStyle6(targetDocument, hash, css);
10632      }
10633    }
10634    if (typeof process === "undefined" || true) {
10635      registerStyle6("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}");
10636    }
10637    var resets_default2 = { "box-sizing": "_336cd3e4e743482f__box-sizing" };
10638    if (typeof process === "undefined" || true) {
10639      registerStyle6("5f8e7aa0bc", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._08e8a2e44959f892__outset-ring--focus:focus,._970d04df7376df67__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible:focus-within:has(:focus-visible),.cd83dfc2126a0846__outset-ring--focus-within:focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible:focus-visible,.e25b2bdd7aa21721__outset-ring--focus-except-active:focus:not(:active),:focus-visible .ecadb9e080e2dfa5__outset-ring--focus-parent-visible{--_gcd-a-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));--_gcd-div-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));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));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}}");
10640    }
10641    var focus_default = { "outset-ring--focus": "_08e8a2e44959f892__outset-ring--focus", "outset-ring--focus-except-active": "e25b2bdd7aa21721__outset-ring--focus-except-active", "outset-ring--focus-visible": "d0541bc9dd9dc7b6__outset-ring--focus-visible", "outset-ring--focus-within": "cd83dfc2126a0846__outset-ring--focus-within", "outset-ring--focus-within-except-active": "_970d04df7376df67__outset-ring--focus-within-except-active", "outset-ring--focus-within-visible": "c5cb3ee4bddaa8e4__outset-ring--focus-within-visible", "outset-ring--focus-parent-visible": "ecadb9e080e2dfa5__outset-ring--focus-parent-visible" };
10642    if (typeof process === "undefined" || true) {
10643      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"}}}');
10644    }
10645    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" };
10646    if (typeof process === "undefined" || true) {
10647      registerStyle6("af6d9984a6", "._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);&: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))}&::placeholder{color:var(--_gcd-input-placeholder-color,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)}");
10648    }
10649    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" };
10650    var Link = (0, import_element18.forwardRef)(function Link2({
10651      children,
10652      variant = "default",
10653      tone = "brand",
10654      openInNewTab = false,
10655      render: render4,
10656      className,
10657      ...props
10658    }, ref) {
10659      const element = useRender({
10660        render: render4,
10661        defaultTagName: "a",
10662        ref,
10663        props: mergeProps(props, {
10664          className: clsx_default(
10665            global_css_defense_default.a,
10666            resets_default2["box-sizing"],
10667            focus_default["outset-ring--focus-except-active"],
10668            variant !== "unstyled" && style_default5.link,
10669            variant !== "unstyled" && style_default5[`is-$tone}`],
10670            variant === "unstyled" && style_default5["is-unstyled"],
10671            className
10672          ),
10673          target: openInNewTab ? "_blank" : void 0,
10674          children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
10675            children,
10676            openInNewTab && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
10677              "span",
10678              {
10679                className: style_default5["link-icon"],
10680                role: "img",
10681                "aria-label": (
10682                  /* translators: accessibility text appended to link text */
10683                  (0, import_i18n7.__)("(opens in a new tab)")
10684                )
10685              }
10686            )
10687          ] })
10688        })
10689      });
10690      return element;
10691    });
10692  
10693    // packages/dataviews/build-module/components/dataviews-context/index.mjs
10694    var import_element19 = __toESM(require_element(), 1);
10695  
10696    // packages/dataviews/build-module/constants.mjs
10697    var import_i18n8 = __toESM(require_i18n(), 1);
10698    var OPERATOR_IS_ANY = "isAny";
10699    var OPERATOR_IS_NONE = "isNone";
10700    var OPERATOR_IS_ALL = "isAll";
10701    var OPERATOR_IS_NOT_ALL = "isNotAll";
10702    var OPERATOR_BETWEEN = "between";
10703    var OPERATOR_IN_THE_PAST = "inThePast";
10704    var OPERATOR_OVER = "over";
10705    var OPERATOR_IS = "is";
10706    var OPERATOR_IS_NOT = "isNot";
10707    var OPERATOR_LESS_THAN = "lessThan";
10708    var OPERATOR_GREATER_THAN = "greaterThan";
10709    var OPERATOR_LESS_THAN_OR_EQUAL = "lessThanOrEqual";
10710    var OPERATOR_GREATER_THAN_OR_EQUAL = "greaterThanOrEqual";
10711    var OPERATOR_BEFORE = "before";
10712    var OPERATOR_AFTER = "after";
10713    var OPERATOR_BEFORE_INC = "beforeInc";
10714    var OPERATOR_AFTER_INC = "afterInc";
10715    var OPERATOR_CONTAINS = "contains";
10716    var OPERATOR_NOT_CONTAINS = "notContains";
10717    var OPERATOR_STARTS_WITH = "startsWith";
10718    var OPERATOR_ON = "on";
10719    var OPERATOR_NOT_ON = "notOn";
10720    var SORTING_DIRECTIONS = ["asc", "desc"];
10721    var sortArrows = { asc: "\u2191", desc: "\u2193" };
10722    var sortValues = { asc: "ascending", desc: "descending" };
10723    var sortLabels = {
10724      asc: (0, import_i18n8.__)("Sort ascending"),
10725      desc: (0, import_i18n8.__)("Sort descending")
10726    };
10727    var sortIcons = {
10728      asc: arrow_up_default,
10729      desc: arrow_down_default
10730    };
10731    var LAYOUT_TABLE = "table";
10732    var LAYOUT_GRID = "grid";
10733    var LAYOUT_LIST = "list";
10734    var LAYOUT_ACTIVITY = "activity";
10735    var LAYOUT_PICKER_GRID = "pickerGrid";
10736    var LAYOUT_PICKER_TABLE = "pickerTable";
10737    var LAYOUT_PICKER_ACTIVITY = "pickerActivity";
10738  
10739    // packages/dataviews/build-module/components/dataviews-context/index.mjs
10740    var DataViewsContext = (0, import_element19.createContext)({
10741      view: { type: LAYOUT_TABLE },
10742      onChangeView: () => {
10743      },
10744      fields: [],
10745      data: [],
10746      paginationInfo: {
10747        totalItems: 0,
10748        totalPages: 0
10749      },
10750      selection: [],
10751      onChangeSelection: () => {
10752      },
10753      setOpenedFilter: () => {
10754      },
10755      openedFilter: null,
10756      getItemId: (item) => item.id,
10757      isItemClickable: () => true,
10758      renderItemLink: void 0,
10759      containerWidth: 0,
10760      containerRef: (0, import_element19.createRef)(),
10761      resizeObserverRef: () => {
10762      },
10763      defaultLayouts: { list: {}, grid: {}, table: {} },
10764      filters: [],
10765      isShowingFilter: false,
10766      setIsShowingFilter: () => {
10767      },
10768      hasInitiallyLoaded: false,
10769      config: {
10770        perPageSizes: []
10771      },
10772      intersectionObserver: null
10773    });
10774    DataViewsContext.displayName = "DataViewsContext";
10775    var dataviews_context_default = DataViewsContext;
10776  
10777    // packages/dataviews/build-module/components/dataviews-layouts/index.mjs
10778    var import_i18n29 = __toESM(require_i18n(), 1);
10779  
10780    // packages/dataviews/build-module/components/dataviews-layouts/table/index.mjs
10781    var import_i18n16 = __toESM(require_i18n(), 1);
10782    var import_components6 = __toESM(require_components(), 1);
10783    var import_element28 = __toESM(require_element(), 1);
10784    var import_keycodes2 = __toESM(require_keycodes(), 1);
10785  
10786    // packages/dataviews/build-module/components/dataviews-selection-checkbox/index.mjs
10787    var import_components = __toESM(require_components(), 1);
10788    var import_i18n9 = __toESM(require_i18n(), 1);
10789    var import_jsx_runtime48 = __toESM(require_jsx_runtime(), 1);
10790    var SELECTION_CHECKBOX_CLASS = "dataviews-selection-checkbox";
10791    function DataViewsSelectionCheckbox({
10792      selection,
10793      onChangeSelection,
10794      item,
10795      getItemId,
10796      titleField,
10797      disabled: disabled2,
10798      ...extraProps
10799    }) {
10800      const id = getItemId(item);
10801      const isInSelectionArray = selection.includes(id);
10802      const checked = !disabled2 && isInSelectionArray;
10803      const selectionLabel = titleField?.getValue?.({ item }) || (0, import_i18n9.__)("(no title)");
10804      return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
10805        import_components.CheckboxControl,
10806        {
10807          className: SELECTION_CHECKBOX_CLASS,
10808          "aria-label": selectionLabel,
10809          "aria-disabled": disabled2,
10810          checked,
10811          onChange: () => {
10812            if (disabled2) {
10813              return;
10814            }
10815            onChangeSelection(
10816              isInSelectionArray ? selection.filter((itemId) => id !== itemId) : [...selection, id]
10817            );
10818          },
10819          ...extraProps
10820        }
10821      );
10822    }
10823  
10824    // packages/dataviews/build-module/components/dataviews-item-actions/index.mjs
10825    var import_components2 = __toESM(require_components(), 1);
10826    var import_i18n10 = __toESM(require_i18n(), 1);
10827    var import_element20 = __toESM(require_element(), 1);
10828    var import_data2 = __toESM(require_data(), 1);
10829    var import_compose = __toESM(require_compose(), 1);
10830  
10831    // packages/dataviews/build-module/lock-unlock.mjs
10832    var import_private_apis2 = __toESM(require_private_apis(), 1);
10833    var { lock: lock2, unlock: unlock2 } = (0, import_private_apis2.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
10834      "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
10835      "@wordpress/dataviews"
10836    );
10837  
10838    // packages/dataviews/build-module/components/dataviews-item-actions/index.mjs
10839    var import_jsx_runtime49 = __toESM(require_jsx_runtime(), 1);
10840    var { Menu, kebabCase } = unlock2(import_components2.privateApis);
10841    function ButtonTrigger({
10842      action,
10843      onClick,
10844      items,
10845      variant
10846    }) {
10847      const label = typeof action.label === "string" ? action.label : action.label(items);
10848      return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10849        import_components2.Button,
10850        {
10851          disabled: !!action.disabled,
10852          accessibleWhenDisabled: true,
10853          size: "compact",
10854          variant,
10855          onClick,
10856          children: label
10857        }
10858      );
10859    }
10860    function MenuItemTrigger({
10861      action,
10862      onClick,
10863      items
10864    }) {
10865      const label = typeof action.label === "string" ? action.label : action.label(items);
10866      return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Menu.Item, { disabled: action.disabled, onClick, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Menu.ItemLabel, { children: label }) });
10867    }
10868    function ActionModal({
10869      action,
10870      items,
10871      closeModal
10872    }) {
10873      const label = typeof action.label === "string" ? action.label : action.label(items);
10874      const modalHeader = typeof action.modalHeader === "function" ? action.modalHeader(items) : action.modalHeader;
10875      return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10876        import_components2.Modal,
10877        {
10878          title: modalHeader || label,
10879          __experimentalHideHeader: !!action.hideModalHeader,
10880          onRequestClose: closeModal,
10881          focusOnMount: action.modalFocusOnMount ?? true,
10882          size: action.modalSize || "medium",
10883          overlayClassName: `dataviews-action-modal dataviews-action-modal__$kebabCase(
10884            action.id
10885          )}`,
10886          children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(action.RenderModal, { items, closeModal })
10887        }
10888      );
10889    }
10890    function ActionsMenuGroup({
10891      actions,
10892      item,
10893      registry,
10894      setActiveModalAction
10895    }) {
10896      const { primaryActions, regularActions } = (0, import_element20.useMemo)(() => {
10897        return actions.reduce(
10898          (acc, action) => {
10899            (action.isPrimary ? acc.primaryActions : acc.regularActions).push(action);
10900            return acc;
10901          },
10902          {
10903            primaryActions: [],
10904            regularActions: []
10905          }
10906        );
10907      }, [actions]);
10908      const renderActionGroup = (actionList) => actionList.map((action) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10909        MenuItemTrigger,
10910        {
10911          action,
10912          onClick: () => {
10913            if ("RenderModal" in action) {
10914              setActiveModalAction(action);
10915              return;
10916            }
10917            action.callback([item], { registry });
10918          },
10919          items: [item]
10920        },
10921        action.id
10922      ));
10923      return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(Menu.Group, { children: [
10924        renderActionGroup(primaryActions),
10925        renderActionGroup(regularActions)
10926      ] });
10927    }
10928    function ItemActions({
10929      item,
10930      actions,
10931      isCompact
10932    }) {
10933      const registry = (0, import_data2.useRegistry)();
10934      const { primaryActions, eligibleActions } = (0, import_element20.useMemo)(() => {
10935        const _eligibleActions = actions.filter(
10936          (action) => !action.isEligible || action.isEligible(item)
10937        );
10938        const _primaryActions = _eligibleActions.filter(
10939          (action) => action.isPrimary
10940        );
10941        return {
10942          primaryActions: _primaryActions,
10943          eligibleActions: _eligibleActions
10944        };
10945      }, [actions, item]);
10946      const isMobileViewport = (0, import_compose.useViewportMatch)("medium", "<");
10947      if (isCompact) {
10948        return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10949          CompactItemActions,
10950          {
10951            item,
10952            actions: eligibleActions,
10953            isSmall: true,
10954            registry
10955          }
10956        );
10957      }
10958      return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
10959        Stack,
10960        {
10961          direction: "row",
10962          justify: "flex-end",
10963          className: "dataviews-item-actions",
10964          style: {
10965            flexShrink: 0,
10966            width: "auto"
10967          },
10968          children: [
10969            /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10970              PrimaryActions,
10971              {
10972                item,
10973                actions: primaryActions,
10974                registry
10975              }
10976            ),
10977            (primaryActions.length < eligibleActions.length || // Since we hide primary actions on mobile, we need to show the menu
10978            // there if there are any actions at all.
10979            isMobileViewport) && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10980              CompactItemActions,
10981              {
10982                item,
10983                actions: eligibleActions,
10984                registry
10985              }
10986            )
10987          ]
10988        }
10989      );
10990    }
10991    function CompactItemActions({
10992      item,
10993      actions,
10994      isSmall,
10995      registry
10996    }) {
10997      const [activeModalAction, setActiveModalAction] = (0, import_element20.useState)(
10998        null
10999      );
11000      return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
11001        /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(Menu, { placement: "bottom-end", children: [
11002          /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
11003            Menu.TriggerButton,
11004            {
11005              render: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
11006                import_components2.Button,
11007                {
11008                  size: isSmall ? "small" : "compact",
11009                  icon: more_vertical_default,
11010                  label: (0, import_i18n10.__)("Actions"),
11011                  accessibleWhenDisabled: true,
11012                  disabled: !actions.length,
11013                  className: "dataviews-all-actions-button"
11014                }
11015              )
11016            }
11017          ),
11018          /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Menu.Popover, { children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
11019            ActionsMenuGroup,
11020            {
11021              actions,
11022              item,
11023              registry,
11024              setActiveModalAction
11025            }
11026          ) })
11027        ] }),
11028        !!activeModalAction && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
11029          ActionModal,
11030          {
11031            action: activeModalAction,
11032            items: [item],
11033            closeModal: () => setActiveModalAction(null)
11034          }
11035        )
11036      ] });
11037    }
11038    function PrimaryActions({
11039      item,
11040      actions,
11041      registry,
11042      buttonVariant
11043    }) {
11044      const [activeModalAction, setActiveModalAction] = (0, import_element20.useState)(null);
11045      const isMobileViewport = (0, import_compose.useViewportMatch)("medium", "<");
11046      if (isMobileViewport) {
11047        return null;
11048      }
11049      if (!Array.isArray(actions) || actions.length === 0) {
11050        return null;
11051      }
11052      return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
11053        actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
11054          ButtonTrigger,
11055          {
11056            action,
11057            onClick: () => {
11058              if ("RenderModal" in action) {
11059                setActiveModalAction(action);
11060                return;
11061              }
11062              action.callback([item], { registry });
11063            },
11064            items: [item],
11065            variant: buttonVariant
11066          },
11067          action.id
11068        )),
11069        !!activeModalAction && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
11070          ActionModal,
11071          {
11072            action: activeModalAction,
11073            items: [item],
11074            closeModal: () => setActiveModalAction(null)
11075          }
11076        )
11077      ] });
11078    }
11079  
11080    // packages/dataviews/build-module/components/dataviews-bulk-actions/index.mjs
11081    var import_components3 = __toESM(require_components(), 1);
11082    var import_i18n12 = __toESM(require_i18n(), 1);
11083    var import_element21 = __toESM(require_element(), 1);
11084    var import_data3 = __toESM(require_data(), 1);
11085    var import_compose2 = __toESM(require_compose(), 1);
11086  
11087    // packages/dataviews/build-module/utils/get-footer-message.mjs
11088    var import_i18n11 = __toESM(require_i18n(), 1);
11089    function getFooterMessage(selectionCount, itemsCount, totalItems, onlyTotalCount = false) {
11090      if (selectionCount > 0) {
11091        return (0, import_i18n11.sprintf)(
11092          /* translators: %d: number of items. */
11093          (0, import_i18n11._n)("%d Item selected", "%d Items selected", selectionCount),
11094          selectionCount
11095        );
11096      }
11097      if (onlyTotalCount || totalItems <= itemsCount) {
11098        return (0, import_i18n11.sprintf)(
11099          /* translators: %d: number of items. */
11100          (0, import_i18n11._n)("%d Item", "%d Items", totalItems),
11101          totalItems
11102        );
11103      }
11104      return (0, import_i18n11.sprintf)(
11105        /* translators: %1$d: number of items. %2$d: total number of items. */
11106        (0, import_i18n11._n)("%1$d of %2$d Item", "%1$d of %2$d Items", totalItems),
11107        itemsCount,
11108        totalItems
11109      );
11110    }
11111  
11112    // packages/dataviews/build-module/components/dataviews-bulk-actions/index.mjs
11113    var import_jsx_runtime50 = __toESM(require_jsx_runtime(), 1);
11114    function hasAPossibleBulkAction(actions, item) {
11115      return actions.some(
11116        (action) => action.supportsBulk && (!action.isEligible || action.isEligible(item))
11117      );
11118    }
11119    function useHasAPossibleBulkAction(actions, item) {
11120      return (0, import_element21.useMemo)(
11121        () => hasAPossibleBulkAction(actions, item),
11122        [actions, item]
11123      );
11124    }
11125    function useSomeItemHasAPossibleBulkAction(actions, data) {
11126      return (0, import_element21.useMemo)(
11127        () => data.some((item) => hasAPossibleBulkAction(actions, item)),
11128        [actions, data]
11129      );
11130    }
11131    function BulkSelectionCheckbox({
11132      selection,
11133      onChangeSelection,
11134      data,
11135      actions,
11136      getItemId,
11137      disableSelectAll = false
11138    }) {
11139      const selectableItems = (0, import_element21.useMemo)(() => {
11140        return data.filter((item) => {
11141          return actions.some(
11142            (action) => action.supportsBulk && (!action.isEligible || action.isEligible(item))
11143          );
11144        });
11145      }, [data, actions]);
11146      const selectedItems = data.filter(
11147        (item) => selection.includes(getItemId(item)) && selectableItems.includes(item)
11148      );
11149      const hasSelection = selection.length > 0;
11150      const areAllSelected = selectedItems.length === selectableItems.length;
11151      if (disableSelectAll) {
11152        return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
11153          import_components3.CheckboxControl,
11154          {
11155            className: "dataviews-view-table-selection-checkbox",
11156            checked: hasSelection,
11157            disabled: !hasSelection,
11158            onChange: () => {
11159              onChangeSelection([]);
11160            },
11161            "aria-label": (0, import_i18n12.__)("Deselect all")
11162          }
11163        );
11164      }
11165      return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
11166        import_components3.CheckboxControl,
11167        {
11168          className: "dataviews-view-table-selection-checkbox",
11169          checked: areAllSelected,
11170          indeterminate: !areAllSelected && !!selectedItems.length,
11171          onChange: () => {
11172            if (areAllSelected) {
11173              onChangeSelection([]);
11174            } else {
11175              onChangeSelection(
11176                selectableItems.map((item) => getItemId(item))
11177              );
11178            }
11179          },
11180          "aria-label": areAllSelected ? (0, import_i18n12.__)("Deselect all") : (0, import_i18n12.__)("Select all")
11181        }
11182      );
11183    }
11184  
11185    // packages/dataviews/build-module/components/dataviews-layouts/table/column-header-menu.mjs
11186    var import_i18n13 = __toESM(require_i18n(), 1);
11187    var import_components4 = __toESM(require_components(), 1);
11188    var import_element22 = __toESM(require_element(), 1);
11189  
11190    // packages/dataviews/build-module/utils/get-hideable-fields.mjs
11191    function getHideableFields(view, fields) {
11192      const togglableFields = [
11193        view?.titleField,
11194        view?.mediaField,
11195        view?.descriptionField
11196      ].filter(Boolean);
11197      return fields.filter(
11198        (f2) => !togglableFields.includes(f2.id) && f2.type !== "media" && f2.enableHiding !== false
11199      );
11200    }
11201  
11202    // packages/dataviews/build-module/components/dataviews-layouts/table/column-header-menu.mjs
11203    var import_jsx_runtime51 = __toESM(require_jsx_runtime(), 1);
11204    var { Menu: Menu2 } = unlock2(import_components4.privateApis);
11205    function WithMenuSeparators({ children }) {
11206      return import_element22.Children.toArray(children).filter(Boolean).map((child, i2) => /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_element22.Fragment, { children: [
11207        i2 > 0 && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Menu2.Separator, {}),
11208        child
11209      ] }, i2));
11210    }
11211    var _HeaderMenu = (0, import_element22.forwardRef)(function HeaderMenu({
11212      fieldId,
11213      view,
11214      fields,
11215      onChangeView,
11216      onHide,
11217      setOpenedFilter,
11218      canMove = true,
11219      canInsertLeft = true,
11220      canInsertRight = true
11221    }, ref) {
11222      const visibleFieldIds = view.fields ?? [];
11223      const index2 = visibleFieldIds?.indexOf(fieldId);
11224      const isSorted = view.sort?.field === fieldId;
11225      let isHidable = false;
11226      let isSortable = false;
11227      let canAddFilter = false;
11228      let operators = [];
11229      const field = fields.find((f2) => f2.id === fieldId);
11230      const { setIsShowingFilter } = (0, import_element22.useContext)(dataviews_context_default);
11231      if (!field) {
11232        return null;
11233      }
11234      isHidable = field.enableHiding !== false;
11235      isSortable = field.enableSorting !== false;
11236      const header = field.header;
11237      operators = !!field.filterBy && field.filterBy?.operators || [];
11238      canAddFilter = !view.filters?.some((_filter) => fieldId === _filter.field) && !!(field.hasElements || field.Edit) && field.filterBy !== false && !field.filterBy?.isPrimary;
11239      if (!isSortable && !canMove && !isHidable && !canAddFilter) {
11240        return header;
11241      }
11242      const hiddenFields = getHideableFields(view, fields).filter(
11243        (f2) => !visibleFieldIds.includes(f2.id)
11244      );
11245      const canInsert = (canInsertLeft || canInsertRight) && !!hiddenFields.length;
11246      const isRtl = (0, import_i18n13.isRTL)();
11247      return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(Menu2, { children: [
11248        /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
11249          Menu2.TriggerButton,
11250          {
11251            render: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
11252              import_components4.Button,
11253              {
11254                size: "compact",
11255                className: "dataviews-view-table-header-button",
11256                ref,
11257                variant: "tertiary"
11258              }
11259            ),
11260            children: [
11261              header,
11262              view.sort && isSorted && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { "aria-hidden": "true", children: sortArrows[view.sort.direction] })
11263            ]
11264          }
11265        ),
11266        /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Menu2.Popover, { style: { minWidth: "240px" }, children: /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(WithMenuSeparators, { children: [
11267          isSortable && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Menu2.Group, { children: SORTING_DIRECTIONS.map(
11268            (direction) => {
11269              const isChecked = view.sort && isSorted && view.sort.direction === direction;
11270              const value = `$fieldId}-$direction}`;
11271              return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
11272                Menu2.RadioItem,
11273                {
11274                  name: "view-table-sorting",
11275                  value,
11276                  checked: isChecked,
11277                  onChange: () => {
11278                    onChangeView({
11279                      ...view,
11280                      sort: {
11281                        field: fieldId,
11282                        direction
11283                      },
11284                      showLevels: false
11285                    });
11286                  },
11287                  children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Menu2.ItemLabel, { children: sortLabels[direction] })
11288                },
11289                value
11290              );
11291            }
11292          ) }),
11293          canAddFilter && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Menu2.Group, { children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
11294            Menu2.Item,
11295            {
11296              prefix: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_components4.Icon, { icon: funnel_default }),
11297              onClick: () => {
11298                setOpenedFilter(fieldId);
11299                setIsShowingFilter(true);
11300                onChangeView({
11301                  ...view,
11302                  page: 1,
11303                  filters: [
11304                    ...view.filters || [],
11305                    {
11306                      field: fieldId,
11307                      value: void 0,
11308                      operator: operators[0]
11309                    }
11310                  ]
11311                });
11312              },
11313              children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Menu2.ItemLabel, { children: (0, import_i18n13.__)("Add filter") })
11314            }
11315          ) }),
11316          (canMove || isHidable || canInsert) && field && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(Menu2.Group, { children: [
11317            canMove && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
11318              Menu2.Item,
11319              {
11320                prefix: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_components4.Icon, { icon: arrow_left_default }),
11321                disabled: isRtl ? index2 >= visibleFieldIds.length - 1 : index2 < 1,
11322                onClick: () => {
11323                  const targetIndex = isRtl ? index2 + 1 : index2 - 1;
11324                  const newFields = [
11325                    ...visibleFieldIds
11326                  ];
11327                  newFields.splice(index2, 1);
11328                  newFields.splice(
11329                    targetIndex,
11330                    0,
11331                    fieldId
11332                  );
11333                  onChangeView({
11334                    ...view,
11335                    fields: newFields
11336                  });
11337                },
11338                children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Menu2.ItemLabel, { children: (0, import_i18n13.__)("Move left") })
11339              }
11340            ),
11341            canMove && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
11342              Menu2.Item,
11343              {
11344                prefix: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_components4.Icon, { icon: arrow_right_default }),
11345                disabled: isRtl ? index2 < 1 : index2 >= visibleFieldIds.length - 1,
11346                onClick: () => {
11347                  const targetIndex = isRtl ? index2 - 1 : index2 + 1;
11348                  const newFields = [
11349                    ...visibleFieldIds
11350                  ];
11351                  newFields.splice(index2, 1);
11352                  newFields.splice(
11353                    targetIndex,
11354                    0,
11355                    fieldId
11356                  );
11357                  onChangeView({
11358                    ...view,
11359                    fields: newFields
11360                  });
11361                },
11362                children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Menu2.ItemLabel, { children: (0, import_i18n13.__)("Move right") })
11363              }
11364            ),
11365            canInsertLeft && !!hiddenFields.length && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(Menu2, { children: [
11366              /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Menu2.SubmenuTriggerItem, { children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Menu2.ItemLabel, { children: (0, import_i18n13.__)("Insert left") }) }),
11367              /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Menu2.Popover, { children: hiddenFields.map((hiddenField) => {
11368                const insertIndex = isRtl ? index2 + 1 : index2;
11369                return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
11370                  Menu2.Item,
11371                  {
11372                    onClick: () => {
11373                      onChangeView({
11374                        ...view,
11375                        fields: [
11376                          ...visibleFieldIds.slice(
11377                            0,
11378                            insertIndex
11379                          ),
11380                          hiddenField.id,
11381                          ...visibleFieldIds.slice(
11382                            insertIndex
11383                          )
11384                        ]
11385                      });
11386                    },
11387                    children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Menu2.ItemLabel, { children: hiddenField.label })
11388                  },
11389                  hiddenField.id
11390                );
11391              }) })
11392            ] }),
11393            canInsertRight && !!hiddenFields.length && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(Menu2, { children: [
11394              /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Menu2.SubmenuTriggerItem, { children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Menu2.ItemLabel, { children: (0, import_i18n13.__)("Insert right") }) }),
11395              /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Menu2.Popover, { children: hiddenFields.map((hiddenField) => {
11396                const insertIndex = isRtl ? index2 : index2 + 1;
11397                return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
11398                  Menu2.Item,
11399                  {
11400                    onClick: () => {
11401                      onChangeView({
11402                        ...view,
11403                        fields: [
11404                          ...visibleFieldIds.slice(
11405                            0,
11406                            insertIndex
11407                          ),
11408                          hiddenField.id,
11409                          ...visibleFieldIds.slice(
11410                            insertIndex
11411                          )
11412                        ]
11413                      });
11414                    },
11415                    children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Menu2.ItemLabel, { children: hiddenField.label })
11416                  },
11417                  hiddenField.id
11418                );
11419              }) })
11420            ] }),
11421            isHidable && field && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
11422              Menu2.Item,
11423              {
11424                prefix: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_components4.Icon, { icon: unseen_default }),
11425                onClick: () => {
11426                  onHide(field);
11427                  onChangeView({
11428                    ...view,
11429                    fields: visibleFieldIds.filter(
11430                      (id) => id !== fieldId
11431                    )
11432                  });
11433                },
11434                children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Menu2.ItemLabel, { children: (0, import_i18n13.__)("Hide column") })
11435              }
11436            )
11437          ] })
11438        ] }) })
11439      ] });
11440    });
11441    var ColumnHeaderMenu = _HeaderMenu;
11442    var column_header_menu_default = ColumnHeaderMenu;
11443  
11444    // packages/dataviews/build-module/components/dataviews-layouts/utils/item-click-wrapper.mjs
11445    var import_element23 = __toESM(require_element(), 1);
11446    var import_jsx_runtime52 = __toESM(require_jsx_runtime(), 1);
11447    function getClickableItemProps({
11448      item,
11449      isItemClickable: isItemClickable2,
11450      onClickItem,
11451      className
11452    }) {
11453      if (!isItemClickable2(item) || !onClickItem) {
11454        return { className };
11455      }
11456      return {
11457        className: className ? `$className} $className}--clickable` : void 0,
11458        role: "button",
11459        tabIndex: 0,
11460        onClick: (event) => {
11461          event.stopPropagation();
11462          onClickItem(item);
11463        },
11464        onKeyDown: (event) => {
11465          if (event.key === "Enter" || event.key === "" || event.key === " ") {
11466            event.stopPropagation();
11467            onClickItem(item);
11468          }
11469        }
11470      };
11471    }
11472    function ItemClickWrapper({
11473      item,
11474      isItemClickable: isItemClickable2,
11475      onClickItem,
11476      renderItemLink,
11477      className,
11478      children,
11479      ...extraProps
11480    }) {
11481      if (!isItemClickable2(item)) {
11482        return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className, ...extraProps, children });
11483      }
11484      if (renderItemLink) {
11485        const renderedElement = renderItemLink({
11486          item,
11487          className: `$className} $className}--clickable`,
11488          ...extraProps,
11489          children
11490        });
11491        return (0, import_element23.cloneElement)(renderedElement, {
11492          onClick: (event) => {
11493            event.stopPropagation();
11494            if (renderedElement.props.onClick) {
11495              renderedElement.props.onClick(event);
11496            }
11497          },
11498          onKeyDown: (event) => {
11499            if (event.key === "Enter" || event.key === "" || event.key === " ") {
11500              event.stopPropagation();
11501              if (renderedElement.props.onKeyDown) {
11502                renderedElement.props.onKeyDown(event);
11503              }
11504            }
11505          }
11506        });
11507      }
11508      const clickProps = getClickableItemProps({
11509        item,
11510        isItemClickable: isItemClickable2,
11511        onClickItem,
11512        className
11513      });
11514      return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { ...clickProps, ...extraProps, children });
11515    }
11516  
11517    // packages/dataviews/build-module/components/dataviews-layouts/table/column-primary.mjs
11518    var import_jsx_runtime53 = __toESM(require_jsx_runtime(), 1);
11519    function ColumnPrimary({
11520      item,
11521      level,
11522      titleField,
11523      mediaField,
11524      descriptionField: descriptionField2,
11525      onClickItem,
11526      renderItemLink,
11527      isItemClickable: isItemClickable2
11528    }) {
11529      return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(Stack, { direction: "row", gap: "md", align: "flex-start", justify: "flex-start", children: [
11530        mediaField && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11531          ItemClickWrapper,
11532          {
11533            item,
11534            isItemClickable: isItemClickable2,
11535            onClickItem,
11536            renderItemLink,
11537            className: "dataviews-view-table__cell-content-wrapper dataviews-column-primary__media",
11538            "aria-label": isItemClickable2(item) && (!!onClickItem || !!renderItemLink) && !!titleField ? titleField.getValue?.({ item }) : void 0,
11539            children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11540              mediaField.render,
11541              {
11542                item,
11543                field: mediaField,
11544                config: { sizes: "32px" }
11545              }
11546            )
11547          }
11548        ),
11549        /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
11550          Stack,
11551          {
11552            direction: "column",
11553            align: "flex-start",
11554            className: "dataviews-view-table__primary-column-content",
11555            children: [
11556              titleField && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
11557                ItemClickWrapper,
11558                {
11559                  item,
11560                  isItemClickable: isItemClickable2,
11561                  onClickItem,
11562                  renderItemLink,
11563                  className: "dataviews-view-table__cell-content-wrapper dataviews-title-field",
11564                  children: [
11565                    level !== void 0 && level > 0 && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { className: "dataviews-view-table__level", children: [
11566                      Array(level).fill("\u2014").join(" "),
11567                      "\xA0"
11568                    ] }),
11569                    /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(titleField.render, { item, field: titleField })
11570                  ]
11571                }
11572              ),
11573              descriptionField2 && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11574                descriptionField2.render,
11575                {
11576                  item,
11577                  field: descriptionField2
11578                }
11579              )
11580            ]
11581          }
11582        )
11583      ] });
11584    }
11585    var column_primary_default = ColumnPrimary;
11586  
11587    // packages/dataviews/build-module/components/dataviews-layouts/table/use-scroll-state.mjs
11588    var import_element24 = __toESM(require_element(), 1);
11589    var import_i18n14 = __toESM(require_i18n(), 1);
11590    var isScrolledToEnd = (element) => {
11591      if ((0, import_i18n14.isRTL)()) {
11592        const scrollLeft = Math.abs(element.scrollLeft);
11593        return scrollLeft <= 1;
11594      }
11595      return element.scrollLeft + element.clientWidth >= element.scrollWidth - 1;
11596    };
11597    function useScrollState({
11598      scrollContainerRef,
11599      enabledHorizontal = false
11600    }) {
11601      const [isHorizontalScrollEnd, setIsHorizontalScrollEnd] = (0, import_element24.useState)(false);
11602      const [isVerticallyScrolled, setIsVerticallyScrolled] = (0, import_element24.useState)(false);
11603      const handleScroll = (0, import_element24.useCallback)(() => {
11604        const scrollContainer = scrollContainerRef.current;
11605        if (!scrollContainer) {
11606          return;
11607        }
11608        if (enabledHorizontal) {
11609          setIsHorizontalScrollEnd(isScrolledToEnd(scrollContainer));
11610        }
11611        setIsVerticallyScrolled(scrollContainer.scrollTop > 0);
11612      }, [scrollContainerRef, enabledHorizontal]);
11613      (0, import_element24.useEffect)(() => {
11614        if (typeof window === "undefined" || !scrollContainerRef.current) {
11615          return () => {
11616          };
11617        }
11618        const scrollContainer = scrollContainerRef.current;
11619        handleScroll();
11620        scrollContainer.addEventListener("scroll", handleScroll);
11621        window.addEventListener("resize", handleScroll);
11622        return () => {
11623          scrollContainer.removeEventListener("scroll", handleScroll);
11624          window.removeEventListener("resize", handleScroll);
11625        };
11626      }, [scrollContainerRef, enabledHorizontal, handleScroll]);
11627      return { isHorizontalScrollEnd, isVerticallyScrolled };
11628    }
11629  
11630    // packages/dataviews/build-module/components/dataviews-layouts/utils/get-data-by-group.mjs
11631    function getDataByGroup(data, groupByField) {
11632      return data.reduce((groups, item) => {
11633        const groupName = groupByField.getValue({ item });
11634        if (!groups.has(groupName)) {
11635          groups.set(groupName, []);
11636        }
11637        groups.get(groupName)?.push(item);
11638        return groups;
11639      }, /* @__PURE__ */ new Map());
11640    }
11641  
11642    // packages/dataviews/build-module/components/dataviews-layouts/utils/use-selection-props.mjs
11643    var import_element25 = __toESM(require_element(), 1);
11644    var import_keycodes = __toESM(require_keycodes(), 1);
11645    function getRange(orderedIds, fromIndex, toIndex) {
11646      return orderedIds.slice(
11647        Math.min(fromIndex, toIndex),
11648        Math.max(fromIndex, toIndex) + 1
11649      );
11650    }
11651    function getRangeSelection({
11652      anchorId,
11653      targetId,
11654      lastTargetId,
11655      orderedIds,
11656      selection
11657    }) {
11658      const targetIndex = orderedIds.indexOf(targetId);
11659      if (targetIndex === -1) {
11660        return selection;
11661      }
11662      const anchorIndex = anchorId === null ? -1 : orderedIds.indexOf(anchorId);
11663      const hasAnchor = anchorIndex !== -1;
11664      const rangeStart = hasAnchor ? anchorIndex : targetIndex;
11665      const lastTargetIndex = hasAnchor && lastTargetId !== null ? orderedIds.indexOf(lastTargetId) : -1;
11666      const lastRange = lastTargetIndex === -1 ? [] : getRange(orderedIds, rangeStart, lastTargetIndex);
11667      const base = selection.filter((id) => !lastRange.includes(id));
11668      return [
11669        .../* @__PURE__ */ new Set([
11670          ...base,
11671          ...getRange(orderedIds, rangeStart, targetIndex)
11672        ])
11673      ];
11674    }
11675    function getClosestSelectedId({
11676      targetId,
11677      orderedIds,
11678      selection
11679    }) {
11680      const targetIndex = orderedIds.indexOf(targetId);
11681      if (targetIndex === -1) {
11682        return null;
11683      }
11684      const selectedIds = new Set(selection);
11685      let closestId = null;
11686      let closestDistance = Infinity;
11687      orderedIds.forEach((id, index2) => {
11688        if (!selectedIds.has(id)) {
11689          return;
11690        }
11691        const distance = Math.abs(index2 - targetIndex);
11692        if (distance < closestDistance) {
11693          closestDistance = distance;
11694          closestId = id;
11695        }
11696      });
11697      return closestId;
11698    }
11699    function useSelectionProps({
11700      data,
11701      actions,
11702      getItemId,
11703      selection,
11704      onChangeSelection
11705    }) {
11706      const gestureRef = (0, import_element25.useRef)(null);
11707      const isTouchDeviceRef = (0, import_element25.useRef)(false);
11708      (0, import_element25.useEffect)(() => {
11709        const markTouchDevice = () => {
11710          isTouchDeviceRef.current = true;
11711        };
11712        document.addEventListener("touchstart", markTouchDevice, {
11713          once: true
11714        });
11715        return () => document.removeEventListener("touchstart", markTouchDevice);
11716      }, []);
11717      const selectableIds = data.filter((item) => hasAPossibleBulkAction(actions, item)).map(getItemId);
11718      const selectableIdSet = new Set(selectableIds);
11719      const hasSelectableItems = selectableIds.length > 0;
11720      const getSelectionProps = (id) => {
11721        const isSelectable = selectableIdSet.has(id);
11722        return {
11723          onMouseDown: (event) => {
11724            if (event.button === 0 && event.shiftKey && hasSelectableItems) {
11725              event.preventDefault();
11726            }
11727          },
11728          onClickCapture: (event) => {
11729            if (!hasSelectableItems) {
11730              return;
11731            }
11732            const isModifierKeyPressed = (0, import_keycodes.isAppleOS)() ? event.metaKey : event.ctrlKey;
11733            const isSelectionCheckboxClick = event.target instanceof Element && !!event.target.closest(`.$SELECTION_CHECKBOX_CLASS}`);
11734            if (!isModifierKeyPressed && !event.shiftKey) {
11735              if (isSelectable && isSelectionCheckboxClick) {
11736                gestureRef.current = {
11737                  anchorId: id,
11738                  lastTargetId: null
11739                };
11740              }
11741              return;
11742            }
11743            if (isTouchDeviceRef.current || document.getSelection()?.type === "Range") {
11744              return;
11745            }
11746            event.stopPropagation();
11747            if (!isSelectionCheckboxClick) {
11748              event.preventDefault();
11749            }
11750            if (!isSelectable) {
11751              return;
11752            }
11753            if (event.shiftKey) {
11754              let gesture = gestureRef.current;
11755              if (!gesture || !selectableIdSet.has(gesture.anchorId)) {
11756                gesture = {
11757                  anchorId: getClosestSelectedId({
11758                    targetId: id,
11759                    orderedIds: selectableIds,
11760                    selection
11761                  }) ?? id,
11762                  lastTargetId: null
11763                };
11764              }
11765              onChangeSelection(
11766                getRangeSelection({
11767                  anchorId: gesture.anchorId,
11768                  targetId: id,
11769                  lastTargetId: gesture.lastTargetId,
11770                  orderedIds: selectableIds,
11771                  selection
11772                })
11773              );
11774              gestureRef.current = {
11775                anchorId: gesture.anchorId,
11776                lastTargetId: id
11777              };
11778            } else {
11779              onChangeSelection(
11780                selection.includes(id) ? selection.filter((itemId) => id !== itemId) : [...selection, id]
11781              );
11782              gestureRef.current = { anchorId: id, lastTargetId: null };
11783            }
11784          }
11785        };
11786      };
11787      return { getSelectionProps };
11788    }
11789  
11790    // packages/dataviews/build-module/components/dataviews-view-config/properties-section.mjs
11791    var import_components5 = __toESM(require_components(), 1);
11792    var import_i18n15 = __toESM(require_i18n(), 1);
11793    var import_element26 = __toESM(require_element(), 1);
11794    var import_jsx_runtime54 = __toESM(require_jsx_runtime(), 1);
11795    function FieldItem({
11796      field,
11797      isVisible: isVisible2,
11798      onToggleVisibility
11799    }) {
11800      return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_components5.__experimentalItem, { onClick: field.enableHiding ? onToggleVisibility : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(Stack, { direction: "row", gap: "sm", justify: "flex-start", align: "center", children: [
11801        /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { style: { height: 24, width: 24 }, children: isVisible2 && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_components5.Icon, { icon: check_default }) }),
11802        /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "dataviews-view-config__label", children: field.label })
11803      ] }) });
11804    }
11805    function isDefined(item) {
11806      return !!item;
11807    }
11808    function PropertiesSection({
11809      showLabel = true
11810    }) {
11811      const { view, fields, onChangeView } = (0, import_element26.useContext)(dataviews_context_default);
11812      const regularFields = getHideableFields(view, fields);
11813      if (!regularFields?.length) {
11814        return null;
11815      }
11816      const titleField = fields.find((f2) => f2.id === view.titleField);
11817      const previewField = fields.find((f2) => f2.id === view.mediaField);
11818      const descriptionField2 = fields.find(
11819        (f2) => f2.id === view.descriptionField
11820      );
11821      const lockedFields = [
11822        {
11823          field: titleField,
11824          isVisibleFlag: "showTitle"
11825        },
11826        {
11827          field: previewField,
11828          isVisibleFlag: "showMedia"
11829        },
11830        {
11831          field: descriptionField2,
11832          isVisibleFlag: "showDescription"
11833        }
11834      ].filter(({ field }) => isDefined(field));
11835      const visibleFieldIds = view.fields ?? [];
11836      const visibleRegularFieldsCount = regularFields.filter(
11837        (f2) => visibleFieldIds.includes(f2.id)
11838      ).length;
11839      const visibleLockedFields = lockedFields.filter(
11840        ({ isVisibleFlag }) => (
11841          // @ts-expect-error
11842          view[isVisibleFlag] ?? true
11843        )
11844      );
11845      const totalVisibleFields = visibleLockedFields.length + visibleRegularFieldsCount;
11846      const isSingleVisibleLockedField = totalVisibleFields === 1 && visibleLockedFields.length === 1;
11847      return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(Stack, { direction: "column", className: "dataviews-field-control", children: [
11848        showLabel && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_components5.BaseControl.VisualLabel, { children: (0, import_i18n15.__)("Properties") }),
11849        /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
11850          Stack,
11851          {
11852            direction: "column",
11853            className: "dataviews-view-config__properties",
11854            children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_components5.__experimentalItemGroup, { isBordered: true, isSeparated: true, size: "medium", children: [
11855              lockedFields.map(({ field, isVisibleFlag }) => {
11856                const isVisible2 = view[isVisibleFlag] ?? true;
11857                const fieldToRender = isSingleVisibleLockedField && isVisible2 ? { ...field, enableHiding: false } : field;
11858                return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
11859                  FieldItem,
11860                  {
11861                    field: fieldToRender,
11862                    isVisible: isVisible2,
11863                    onToggleVisibility: () => {
11864                      onChangeView({
11865                        ...view,
11866                        [isVisibleFlag]: !isVisible2
11867                      });
11868                    }
11869                  },
11870                  field.id
11871                );
11872              }),
11873              regularFields.map((field) => {
11874                const isVisible2 = visibleFieldIds.includes(field.id);
11875                const fieldToRender = totalVisibleFields === 1 && isVisible2 ? { ...field, enableHiding: false } : field;
11876                return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
11877                  FieldItem,
11878                  {
11879                    field: fieldToRender,
11880                    isVisible: isVisible2,
11881                    onToggleVisibility: () => {
11882                      onChangeView({
11883                        ...view,
11884                        fields: isVisible2 ? visibleFieldIds.filter(
11885                          (fieldId) => fieldId !== field.id
11886                        ) : [...visibleFieldIds, field.id]
11887                      });
11888                    }
11889                  },
11890                  field.id
11891                );
11892              })
11893            ] })
11894          }
11895        )
11896      ] });
11897    }
11898  
11899    // packages/dataviews/build-module/hooks/use-delayed-loading.mjs
11900    var import_element27 = __toESM(require_element(), 1);
11901    function useDelayedLoading(isLoading, options = { delay: 400 }) {
11902      const [showLoader, setShowLoader] = (0, import_element27.useState)(false);
11903      (0, import_element27.useEffect)(() => {
11904        if (!isLoading) {
11905          return;
11906        }
11907        const timeout = setTimeout(() => {
11908          setShowLoader(true);
11909        }, options.delay);
11910        return () => {
11911          clearTimeout(timeout);
11912          setShowLoader(false);
11913        };
11914      }, [isLoading, options.delay]);
11915      return showLoader;
11916    }
11917  
11918    // packages/dataviews/build-module/components/dataviews-layouts/table/index.mjs
11919    var import_jsx_runtime55 = __toESM(require_jsx_runtime(), 1);
11920    function getEffectiveAlign(explicitAlign, fieldType) {
11921      if (explicitAlign) {
11922        return explicitAlign;
11923      }
11924      if (fieldType === "integer" || fieldType === "number") {
11925        return "end";
11926      }
11927      return void 0;
11928    }
11929    function TableColumnField({
11930      item,
11931      fields,
11932      column,
11933      align
11934    }) {
11935      const field = fields.find((f2) => f2.id === column);
11936      if (!field) {
11937        return null;
11938      }
11939      const className = clsx_default("dataviews-view-table__cell-content-wrapper", {
11940        "dataviews-view-table__cell-align-end": align === "end",
11941        "dataviews-view-table__cell-align-center": align === "center"
11942      });
11943      return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(field.render, { item, field }) });
11944    }
11945    function TableRow({
11946      hasBulkActions,
11947      item,
11948      level,
11949      actions,
11950      fields,
11951      id,
11952      view,
11953      titleField,
11954      mediaField,
11955      descriptionField: descriptionField2,
11956      selection,
11957      getItemId,
11958      isItemClickable: isItemClickable2,
11959      onClickItem,
11960      renderItemLink,
11961      onChangeSelection,
11962      onMouseDown,
11963      onClickCapture,
11964      isActionsColumnSticky,
11965      posinset
11966    }) {
11967      const { paginationInfo } = (0, import_element28.useContext)(dataviews_context_default);
11968      const hasPossibleBulkAction = useHasAPossibleBulkAction(actions, item);
11969      const isSelected2 = hasPossibleBulkAction && selection.includes(id);
11970      const {
11971        showTitle = true,
11972        showMedia = true,
11973        showDescription = true,
11974        infiniteScrollEnabled
11975      } = view;
11976      const columns = view.fields ?? [];
11977      const hasPrimaryColumn = titleField && showTitle || mediaField && showMedia || descriptionField2 && showDescription;
11978      return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
11979        "tr",
11980        {
11981          className: clsx_default("dataviews-view-table__row", {
11982            "is-selected": hasPossibleBulkAction && isSelected2,
11983            "has-bulk-actions": hasPossibleBulkAction
11984          }),
11985          "aria-setsize": infiniteScrollEnabled ? paginationInfo.totalItems : void 0,
11986          "aria-posinset": posinset,
11987          role: infiniteScrollEnabled ? "article" : void 0,
11988          onClickCapture,
11989          onMouseDown: (event) => {
11990            const isMetaClick = (0, import_keycodes2.isAppleOS)() ? event.metaKey : event.ctrlKey;
11991            if (event.button === 0 && isMetaClick && window.navigator.userAgent.toLowerCase().includes("firefox")) {
11992              event.preventDefault();
11993            }
11994            onMouseDown(event);
11995          },
11996          children: [
11997            hasBulkActions && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("td", { className: "dataviews-view-table__checkbox-column", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "dataviews-view-table__cell-content-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
11998              DataViewsSelectionCheckbox,
11999              {
12000                item,
12001                selection,
12002                onChangeSelection,
12003                getItemId,
12004                titleField,
12005                disabled: !hasPossibleBulkAction
12006              }
12007            ) }) }),
12008            hasPrimaryColumn && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
12009              column_primary_default,
12010              {
12011                item,
12012                level,
12013                titleField: showTitle ? titleField : void 0,
12014                mediaField: showMedia ? mediaField : void 0,
12015                descriptionField: showDescription ? descriptionField2 : void 0,
12016                isItemClickable: isItemClickable2,
12017                onClickItem,
12018                renderItemLink
12019              }
12020            ) }),
12021            columns.map((column) => {
12022              const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {};
12023              const field = fields.find((f2) => f2.id === column);
12024              const effectiveAlign = getEffectiveAlign(align, field?.type);
12025              return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
12026                "td",
12027                {
12028                  style: {
12029                    width,
12030                    maxWidth,
12031                    minWidth
12032                  },
12033                  children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
12034                    TableColumnField,
12035                    {
12036                      fields,
12037                      item,
12038                      column,
12039                      align: effectiveAlign
12040                    }
12041                  )
12042                },
12043                column
12044              );
12045            }),
12046            !!actions?.length && // Disable reason: we are not making the element interactive,
12047            // but preventing any click events from bubbling up to the
12048            // table row. This allows us to add a click handler to the row
12049            // itself (to toggle row selection) without erroneously
12050            // intercepting click events from ItemActions.
12051            /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
12052              "td",
12053              {
12054                className: clsx_default("dataviews-view-table__actions-column", {
12055                  "dataviews-view-table__actions-column--sticky": true,
12056                  "dataviews-view-table__actions-column--stuck": isActionsColumnSticky
12057                }),
12058                onClick: (e2) => e2.stopPropagation(),
12059                children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(ItemActions, { item, actions })
12060              }
12061            )
12062          ]
12063        }
12064      );
12065    }
12066    function ViewTable({
12067      actions,
12068      data,
12069      fields,
12070      getItemId,
12071      getItemLevel,
12072      isLoading = false,
12073      onChangeView,
12074      onChangeSelection,
12075      selection,
12076      setOpenedFilter,
12077      onClickItem,
12078      isItemClickable: isItemClickable2,
12079      renderItemLink,
12080      view,
12081      className,
12082      empty
12083    }) {
12084      const { containerRef } = (0, import_element28.useContext)(dataviews_context_default);
12085      const isDelayedLoading = useDelayedLoading(isLoading);
12086      const groupField = view.groupBy?.field ? fields.find((f2) => f2.id === view.groupBy?.field) : null;
12087      const dataByGroup = groupField ? getDataByGroup(data, groupField) : null;
12088      const orderedData = dataByGroup ? Array.from(dataByGroup.values()).flat() : data;
12089      const { getSelectionProps } = useSelectionProps({
12090        data: orderedData,
12091        actions,
12092        getItemId,
12093        selection,
12094        onChangeSelection
12095      });
12096      const headerMenuRefs = (0, import_element28.useRef)(/* @__PURE__ */ new Map());
12097      const headerMenuToFocusRef = (0, import_element28.useRef)(void 0);
12098      const [nextHeaderMenuToFocus, setNextHeaderMenuToFocus] = (0, import_element28.useState)();
12099      const [contextMenuAnchor, setContextMenuAnchor] = (0, import_element28.useState)(null);
12100      (0, import_element28.useEffect)(() => {
12101        if (headerMenuToFocusRef.current) {
12102          headerMenuToFocusRef.current.focus();
12103          headerMenuToFocusRef.current = void 0;
12104        }
12105      });
12106      const tableNoticeId = (0, import_element28.useId)();
12107      const { isHorizontalScrollEnd, isVerticallyScrolled } = useScrollState({
12108        scrollContainerRef: containerRef,
12109        enabledHorizontal: !!actions?.length
12110      });
12111      const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data);
12112      if (nextHeaderMenuToFocus) {
12113        headerMenuToFocusRef.current = nextHeaderMenuToFocus;
12114        setNextHeaderMenuToFocus(void 0);
12115        return;
12116      }
12117      const onHide = (field) => {
12118        const hidden = headerMenuRefs.current.get(field.id);
12119        const fallback = hidden ? headerMenuRefs.current.get(hidden.fallback) : void 0;
12120        setNextHeaderMenuToFocus(fallback?.node);
12121      };
12122      const handleHeaderContextMenu = (event) => {
12123        event.preventDefault();
12124        event.stopPropagation();
12125        const virtualAnchor = {
12126          getBoundingClientRect: () => ({
12127            x: event.clientX,
12128            y: event.clientY,
12129            top: event.clientY,
12130            left: event.clientX,
12131            right: event.clientX,
12132            bottom: event.clientY,
12133            width: 0,
12134            height: 0,
12135            toJSON: () => ({})
12136          })
12137        };
12138        window.requestAnimationFrame(() => {
12139          setContextMenuAnchor(virtualAnchor);
12140        });
12141      };
12142      const hasData = !!data?.length;
12143      const titleField = fields.find((field) => field.id === view.titleField);
12144      const mediaField = fields.find((field) => field.id === view.mediaField);
12145      const descriptionField2 = fields.find(
12146        (field) => field.id === view.descriptionField
12147      );
12148      const { showTitle = true, showMedia = true, showDescription = true } = view;
12149      const hasPrimaryColumn = titleField && showTitle || mediaField && showMedia || descriptionField2 && showDescription;
12150      const columns = view.fields ?? [];
12151      const headerMenuRef = (column, index2) => (node) => {
12152        if (node) {
12153          headerMenuRefs.current.set(column, {
12154            node,
12155            fallback: columns[index2 > 0 ? index2 - 1 : 1]
12156          });
12157        } else {
12158          headerMenuRefs.current.delete(column);
12159        }
12160      };
12161      const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup;
12162      const isRtl = (0, import_i18n16.isRTL)();
12163      if (!hasData) {
12164        return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
12165          "div",
12166          {
12167            className: clsx_default("dataviews-no-results", {
12168              "is-refreshing": isDelayedLoading
12169            }),
12170            id: tableNoticeId,
12171            children: empty
12172          }
12173        );
12174      }
12175      return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
12176        /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
12177          "table",
12178          {
12179            className: clsx_default("dataviews-view-table", className, {
12180              [`has-$view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes(
12181                view.layout.density
12182              ),
12183              "has-bulk-actions": hasBulkActions,
12184              "is-refreshing": !isInfiniteScroll && isDelayedLoading
12185            }),
12186            "aria-busy": isLoading,
12187            "aria-describedby": tableNoticeId,
12188            role: isInfiniteScroll ? "feed" : void 0,
12189            inert: !isInfiniteScroll && isLoading ? "true" : void 0,
12190            children: [
12191              /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("colgroup", { children: [
12192                hasBulkActions && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("col", { className: "dataviews-view-table__col-checkbox" }),
12193                hasPrimaryColumn && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("col", { className: "dataviews-view-table__col-first-data" }),
12194                columns.map((column, index2) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
12195                  "col",
12196                  {
12197                    className: clsx_default(
12198                      `dataviews-view-table__col-$column}`,
12199                      {
12200                        "dataviews-view-table__col-expand": !hasPrimaryColumn && index2 === columns.length - 1
12201                      }
12202                    )
12203                  },
12204                  `col-$column}`
12205                )),
12206                !!actions?.length && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("col", { className: "dataviews-view-table__col-actions" })
12207              ] }),
12208              contextMenuAnchor && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
12209                import_components6.Popover,
12210                {
12211                  anchor: contextMenuAnchor,
12212                  onClose: () => setContextMenuAnchor(null),
12213                  placement: "bottom-start",
12214                  children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(PropertiesSection, { showLabel: false })
12215                }
12216              ),
12217              /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
12218                "thead",
12219                {
12220                  className: clsx_default({
12221                    "dataviews-view-table__thead--stuck": isVerticallyScrolled
12222                  }),
12223                  onContextMenu: handleHeaderContextMenu,
12224                  children: /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("tr", { className: "dataviews-view-table__row", children: [
12225                    hasBulkActions && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
12226                      "th",
12227                      {
12228                        className: "dataviews-view-table__checkbox-column",
12229                        scope: "col",
12230                        onContextMenu: handleHeaderContextMenu,
12231                        children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
12232                          BulkSelectionCheckbox,
12233                          {
12234                            selection,
12235                            onChangeSelection,
12236                            data,
12237                            actions,
12238                            getItemId
12239                          }
12240                        )
12241                      }
12242                    ),
12243                    hasPrimaryColumn && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("th", { scope: "col", children: titleField && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
12244                      column_header_menu_default,
12245                      {
12246                        ref: headerMenuRef(
12247                          titleField.id,
12248                          0
12249                        ),
12250                        fieldId: titleField.id,
12251                        view,
12252                        fields,
12253                        onChangeView,
12254                        onHide,
12255                        setOpenedFilter,
12256                        canMove: false,
12257                        canInsertLeft: isRtl ? view.layout?.enableMoving ?? true : false,
12258                        canInsertRight: isRtl ? false : view.layout?.enableMoving ?? true
12259                      }
12260                    ) }),
12261                    columns.map((column, index2) => {
12262                      const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {};
12263                      const field = fields.find(
12264                        (f2) => f2.id === column
12265                      );
12266                      const effectiveAlign = getEffectiveAlign(
12267                        align,
12268                        field?.type
12269                      );
12270                      const canInsertOrMove = view.layout?.enableMoving ?? true;
12271                      return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
12272                        "th",
12273                        {
12274                          style: {
12275                            width,
12276                            maxWidth,
12277                            minWidth,
12278                            textAlign: effectiveAlign
12279                          },
12280                          "aria-sort": view.sort?.direction && view.sort?.field === column ? sortValues[view.sort.direction] : void 0,
12281                          scope: "col",
12282                          children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
12283                            column_header_menu_default,
12284                            {
12285                              ref: headerMenuRef(column, index2),
12286                              fieldId: column,
12287                              view,
12288                              fields,
12289                              onChangeView,
12290                              onHide,
12291                              setOpenedFilter,
12292                              canMove: canInsertOrMove,
12293                              canInsertLeft: canInsertOrMove,
12294                              canInsertRight: canInsertOrMove
12295                            }
12296                          )
12297                        },
12298                        column
12299                      );
12300                    }),
12301                    !!actions?.length && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
12302                      "th",
12303                      {
12304                        className: clsx_default(
12305                          "dataviews-view-table__actions-column",
12306                          {
12307                            "dataviews-view-table__actions-column--sticky": true,
12308                            "dataviews-view-table__actions-column--stuck": !isHorizontalScrollEnd
12309                          }
12310                        ),
12311                        children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "dataviews-view-table-header", children: (0, import_i18n16.__)("Actions") })
12312                      }
12313                    )
12314                  ] })
12315                }
12316              ),
12317              hasData && groupField && dataByGroup ? Array.from(dataByGroup.entries()).map(
12318                ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("tbody", { children: [
12319                  /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("tr", { className: "dataviews-view-table__group-header-row", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
12320                    "td",
12321                    {
12322                      colSpan: columns.length + (hasPrimaryColumn ? 1 : 0) + (hasBulkActions ? 1 : 0) + (actions?.length ? 1 : 0),
12323                      className: "dataviews-view-table__group-header-cell",
12324                      children: view.groupBy?.showLabel === false ? groupName : (0, import_i18n16.sprintf)(
12325                        // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022".
12326                        (0, import_i18n16.__)("%1$s: %2$s"),
12327                        groupField.label,
12328                        groupName
12329                      )
12330                    }
12331                  ) }),
12332                  groupItems.map((item, index2) => {
12333                    const id = getItemId(item) || index2.toString();
12334                    return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
12335                      TableRow,
12336                      {
12337                        item,
12338                        level: view.showLevels && typeof getItemLevel === "function" ? getItemLevel(item) : void 0,
12339                        hasBulkActions,
12340                        actions,
12341                        fields,
12342                        id,
12343                        view,
12344                        titleField,
12345                        mediaField,
12346                        descriptionField: descriptionField2,
12347                        selection,
12348                        getItemId,
12349                        onChangeSelection,
12350                        ...getSelectionProps(id),
12351                        onClickItem,
12352                        renderItemLink,
12353                        isItemClickable: isItemClickable2,
12354                        isActionsColumnSticky: !isHorizontalScrollEnd
12355                      },
12356                      getItemId(item)
12357                    );
12358                  })
12359                ] }, `group-$groupName}`)
12360              ) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("tbody", { children: hasData && data.map((item, index2) => {
12361                const id = getItemId(item) || index2.toString();
12362                return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
12363                  TableRow,
12364                  {
12365                    item,
12366                    level: view.showLevels && typeof getItemLevel === "function" ? getItemLevel(item) : void 0,
12367                    hasBulkActions,
12368                    actions,
12369                    fields,
12370                    id,
12371                    view,
12372                    titleField,
12373                    mediaField,
12374                    descriptionField: descriptionField2,
12375                    selection,
12376                    getItemId,
12377                    onChangeSelection,
12378                    ...getSelectionProps(id),
12379                    onClickItem,
12380                    renderItemLink,
12381                    isItemClickable: isItemClickable2,
12382                    isActionsColumnSticky: !isHorizontalScrollEnd,
12383                    posinset: isInfiniteScroll ? index2 + 1 : void 0
12384                  },
12385                  getItemId(item)
12386                );
12387              }) })
12388            ]
12389          }
12390        ),
12391        isInfiniteScroll && isLoading && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "dataviews-loading", id: tableNoticeId, children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_components6.Spinner, {}) }) })
12392      ] });
12393    }
12394    var table_default = ViewTable;
12395  
12396    // packages/dataviews/build-module/components/dataviews-layouts/grid/index.mjs
12397    var import_components9 = __toESM(require_components(), 1);
12398    var import_i18n19 = __toESM(require_i18n(), 1);
12399  
12400    // packages/dataviews/build-module/components/dataviews-layouts/grid/composite-grid.mjs
12401    var import_components8 = __toESM(require_components(), 1);
12402    var import_i18n18 = __toESM(require_i18n(), 1);
12403    var import_compose3 = __toESM(require_compose(), 1);
12404    var import_element32 = __toESM(require_element(), 1);
12405  
12406    // packages/dataviews/build-module/components/dataviews-layouts/grid/preview-size-picker.mjs
12407    var import_components7 = __toESM(require_components(), 1);
12408    var import_i18n17 = __toESM(require_i18n(), 1);
12409    var import_element29 = __toESM(require_element(), 1);
12410    var import_jsx_runtime56 = __toESM(require_jsx_runtime(), 1);
12411    var imageSizes = [
12412      {
12413        value: 120,
12414        breakpoint: 1
12415      },
12416      {
12417        value: 170,
12418        breakpoint: 1
12419      },
12420      {
12421        value: 230,
12422        breakpoint: 1
12423      },
12424      {
12425        value: 290,
12426        breakpoint: 1112
12427        // at minimum image width, 4 images display at this container size
12428      },
12429      {
12430        value: 350,
12431        breakpoint: 1636
12432        // at minimum image width, 6 images display at this container size
12433      },
12434      {
12435        value: 430,
12436        breakpoint: 588
12437        // at minimum image width, 2 images display at this container size
12438      }
12439    ];
12440    var DEFAULT_PREVIEW_SIZE = imageSizes[2].value;
12441    function useGridColumns() {
12442      const context = (0, import_element29.useContext)(dataviews_context_default);
12443      const view = context.view;
12444      return (0, import_element29.useMemo)(() => {
12445        const containerWidth = context.containerWidth;
12446        const gap = 32;
12447        const previewSize = view.layout?.previewSize ?? DEFAULT_PREVIEW_SIZE;
12448        const columns = Math.floor(
12449          (containerWidth + gap) / (previewSize + gap)
12450        );
12451        return Math.max(1, columns);
12452      }, [context.containerWidth, view.layout?.previewSize]);
12453    }
12454  
12455    // packages/dataviews/build-module/components/dataviews-layouts/utils/grid-items.mjs
12456    var import_element30 = __toESM(require_element(), 1);
12457    var import_jsx_runtime57 = __toESM(require_jsx_runtime(), 1);
12458    var GridItems = (0, import_element30.forwardRef)(({ className, previewSize, ...props }, ref) => {
12459      return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
12460        "div",
12461        {
12462          ref,
12463          className: clsx_default("dataviews-view-grid-items", className),
12464          style: {
12465            gridTemplateColumns: previewSize && `repeat(auto-fill, minmax($previewSize}px, 1fr))`
12466          },
12467          ...props
12468        }
12469      );
12470    });
12471  
12472    // packages/dataviews/build-module/components/dataviews-layouts/utils/use-infinite-scroll.mjs
12473    var import_element31 = __toESM(require_element(), 1);
12474    function useIntersectionObserver(elementRef, posinset) {
12475      const { intersectionObserver } = (0, import_element31.useContext)(dataviews_context_default);
12476      (0, import_element31.useEffect)(() => {
12477        const element = elementRef.current;
12478        if (!element || posinset === void 0 || !intersectionObserver) {
12479          return;
12480        }
12481        intersectionObserver.observe(element);
12482        return () => {
12483          intersectionObserver.unobserve(element);
12484        };
12485      }, [elementRef, intersectionObserver, posinset]);
12486    }
12487    function usePlaceholdersNeeded(data, isInfiniteScroll, gridColumns) {
12488      const hasData = !!data?.length;
12489      const firstItemPosition = hasData && isInfiniteScroll ? data[0].position : void 0;
12490      return firstItemPosition && gridColumns ? (firstItemPosition - 1) % gridColumns : 0;
12491    }
12492  
12493    // packages/dataviews/build-module/components/dataviews-layouts/grid/composite-grid.mjs
12494    var import_jsx_runtime58 = __toESM(require_jsx_runtime(), 1);
12495    var { Badge: WCBadge } = unlock2(import_components8.privateApis);
12496    function chunk(array, size4) {
12497      const chunks = [];
12498      for (let i2 = 0, j2 = array.length; i2 < j2; i2 += size4) {
12499        chunks.push(array.slice(i2, i2 + size4));
12500      }
12501      return chunks;
12502    }
12503    var GridItem = (0, import_element32.forwardRef)(
12504      function GridItem2({
12505        view,
12506        selection,
12507        onChangeSelection,
12508        onClickItem,
12509        isItemClickable: isItemClickable2,
12510        renderItemLink,
12511        getItemId,
12512        item,
12513        actions,
12514        mediaField,
12515        titleField,
12516        descriptionField: descriptionField2,
12517        regularFields,
12518        badgeFields,
12519        hasBulkActions,
12520        config,
12521        posinset,
12522        setsize,
12523        ...props
12524      }, forwardedRef) {
12525        const {
12526          showTitle = true,
12527          showMedia = true,
12528          showDescription = true
12529        } = view;
12530        const hasBulkAction = useHasAPossibleBulkAction(actions, item);
12531        const id = getItemId(item);
12532        const elementRef = (0, import_element32.useRef)(null);
12533        const setRefs = (0, import_element32.useCallback)(
12534          (node) => {
12535            elementRef.current = node;
12536            if (typeof forwardedRef === "function") {
12537              forwardedRef(node);
12538            } else if (forwardedRef) {
12539              forwardedRef.current = node;
12540            }
12541          },
12542          [forwardedRef]
12543        );
12544        useIntersectionObserver(elementRef, posinset);
12545        const instanceId = (0, import_compose3.useInstanceId)(GridItem2);
12546        const isSelected2 = selection.includes(id);
12547        const mediaPlaceholder = /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "dataviews-view-grid__media-placeholder" });
12548        const rendersMediaField = showMedia && mediaField?.render;
12549        const renderedMediaField = rendersMediaField ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12550          mediaField.render,
12551          {
12552            item,
12553            field: mediaField,
12554            config
12555          }
12556        ) : mediaPlaceholder;
12557        const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(titleField.render, { item, field: titleField }) : null;
12558        let mediaA11yProps;
12559        let titleA11yProps;
12560        if (isItemClickable2(item) && onClickItem) {
12561          if (renderedTitleField) {
12562            mediaA11yProps = {
12563              "aria-labelledby": `dataviews-view-grid__title-field-$instanceId}`
12564            };
12565            titleA11yProps = {
12566              id: `dataviews-view-grid__title-field-$instanceId}`
12567            };
12568          } else {
12569            mediaA11yProps = {
12570              "aria-label": (0, import_i18n18.__)("Navigate to item")
12571            };
12572          }
12573        }
12574        return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
12575          Stack,
12576          {
12577            direction: "column",
12578            ...props,
12579            ref: setRefs,
12580            "aria-setsize": setsize,
12581            "aria-posinset": posinset,
12582            className: clsx_default(
12583              props.className,
12584              "dataviews-view-grid__row__gridcell",
12585              "dataviews-view-grid__card",
12586              {
12587                "is-selected": hasBulkAction && isSelected2
12588              }
12589            ),
12590            children: [
12591              /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12592                ItemClickWrapper,
12593                {
12594                  item,
12595                  isItemClickable: isItemClickable2,
12596                  onClickItem,
12597                  renderItemLink,
12598                  className: clsx_default("dataviews-view-grid__media", {
12599                    "dataviews-view-grid__media--placeholder": !rendersMediaField
12600                  }),
12601                  ...mediaA11yProps,
12602                  children: renderedMediaField
12603                }
12604              ),
12605              hasBulkActions && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12606                DataViewsSelectionCheckbox,
12607                {
12608                  item,
12609                  selection,
12610                  onChangeSelection,
12611                  getItemId,
12612                  titleField,
12613                  disabled: !hasBulkAction
12614                }
12615              ),
12616              !!actions?.length && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "dataviews-view-grid__media-actions", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12617                ItemActions,
12618                {
12619                  item,
12620                  actions,
12621                  isCompact: true
12622                }
12623              ) }),
12624              showTitle && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "dataviews-view-grid__title-actions", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12625                ItemClickWrapper,
12626                {
12627                  item,
12628                  isItemClickable: isItemClickable2,
12629                  onClickItem,
12630                  renderItemLink,
12631                  className: "dataviews-view-grid__title-field dataviews-title-field",
12632                  ...titleA11yProps,
12633                  title: titleField?.getValueFormatted({
12634                    item,
12635                    field: titleField
12636                  }) || void 0,
12637                  children: renderedTitleField
12638                }
12639              ) }),
12640              /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(Stack, { direction: "column", gap: "xs", children: [
12641                showDescription && descriptionField2?.render && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12642                  descriptionField2.render,
12643                  {
12644                    item,
12645                    field: descriptionField2
12646                  }
12647                ),
12648                !!badgeFields?.length && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12649                  Stack,
12650                  {
12651                    direction: "row",
12652                    className: "dataviews-view-grid__badge-fields",
12653                    gap: "sm",
12654                    wrap: "wrap",
12655                    align: "top",
12656                    justify: "flex-start",
12657                    children: badgeFields.map((field) => {
12658                      return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12659                        WCBadge,
12660                        {
12661                          className: "dataviews-view-grid__field-value",
12662                          children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12663                            field.render,
12664                            {
12665                              item,
12666                              field
12667                            }
12668                          )
12669                        },
12670                        field.id
12671                      );
12672                    })
12673                  }
12674                ),
12675                !!regularFields?.length && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12676                  Stack,
12677                  {
12678                    direction: "column",
12679                    className: "dataviews-view-grid__fields",
12680                    gap: "xs",
12681                    children: regularFields.map((field) => {
12682                      return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12683                        import_components8.Flex,
12684                        {
12685                          className: "dataviews-view-grid__field",
12686                          gap: 1,
12687                          justify: "flex-start",
12688                          expanded: true,
12689                          style: { height: "auto" },
12690                          direction: "row",
12691                          children: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_jsx_runtime58.Fragment, { children: [
12692                            /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(tooltip_exports.Root, { children: [
12693                              /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12694                                tooltip_exports.Trigger,
12695                                {
12696                                  render: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_components8.FlexItem, { className: "dataviews-view-grid__field-name", children: field.header })
12697                                }
12698                              ),
12699                              /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(tooltip_exports.Popup, { children: field.label })
12700                            ] }),
12701                            /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12702                              import_components8.FlexItem,
12703                              {
12704                                className: "dataviews-view-grid__field-value",
12705                                style: { maxHeight: "none" },
12706                                children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12707                                  field.render,
12708                                  {
12709                                    item,
12710                                    field
12711                                  }
12712                                )
12713                              }
12714                            )
12715                          ] })
12716                        },
12717                        field.id
12718                      );
12719                    })
12720                  }
12721                )
12722              ] })
12723            ]
12724          }
12725        );
12726      }
12727    );
12728    function CompositeGrid({
12729      data,
12730      isInfiniteScroll,
12731      className,
12732      inert,
12733      isLoading,
12734      view,
12735      fields,
12736      selection,
12737      onChangeSelection,
12738      onClickItem,
12739      isItemClickable: isItemClickable2,
12740      renderItemLink,
12741      getItemId,
12742      actions,
12743      getSelectionProps
12744    }) {
12745      const { paginationInfo, resizeObserverRef } = (0, import_element32.useContext)(dataviews_context_default);
12746      const gridColumns = useGridColumns();
12747      const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data);
12748      const titleField = fields.find(
12749        (field) => field.id === view?.titleField
12750      );
12751      const mediaField = fields.find(
12752        (field) => field.id === view?.mediaField
12753      );
12754      const descriptionField2 = fields.find(
12755        (field) => field.id === view?.descriptionField
12756      );
12757      const otherFields = view.fields ?? [];
12758      const { regularFields, badgeFields } = otherFields.reduce(
12759        (accumulator, fieldId) => {
12760          const field = fields.find((f2) => f2.id === fieldId);
12761          if (!field) {
12762            return accumulator;
12763          }
12764          const key = view.layout?.badgeFields?.includes(fieldId) ? "badgeFields" : "regularFields";
12765          accumulator[key].push(field);
12766          return accumulator;
12767        },
12768        { regularFields: [], badgeFields: [] }
12769      );
12770      const size4 = "900px";
12771      const totalRows = Math.ceil(data.length / gridColumns);
12772      const placeholdersNeeded = usePlaceholdersNeeded(
12773        data,
12774        isInfiniteScroll,
12775        gridColumns
12776      );
12777      return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_jsx_runtime58.Fragment, {
12778        // Render infinite scroll layout (no rows, feed semantics)
12779        children: [
12780          isInfiniteScroll && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
12781            import_components8.Composite,
12782            {
12783              render: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12784                GridItems,
12785                {
12786                  className: clsx_default(
12787                    "dataviews-view-grid-infinite-scroll",
12788                    className,
12789                    {
12790                      [`has-$view.layout?.density}-density`]: view.layout?.density && [
12791                        "compact",
12792                        "comfortable"
12793                      ].includes(view.layout.density)
12794                    }
12795                  ),
12796                  previewSize: view.layout?.previewSize,
12797                  "aria-busy": isLoading,
12798                  ref: resizeObserverRef
12799                }
12800              ),
12801              role: "feed",
12802              focusWrap: true,
12803              inert,
12804              children: [
12805                Array.from({ length: placeholdersNeeded }).map(
12806                  (_, index2) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12807                    import_components8.Composite.Item,
12808                    {
12809                      render: (props) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12810                        Stack,
12811                        {
12812                          ...props,
12813                          direction: "column",
12814                          role: "article",
12815                          className: "dataviews-view-grid__row__gridcell dataviews-view-grid__card dataviews-view-grid__placeholder"
12816                        }
12817                      ),
12818                      "aria-hidden": true,
12819                      tabIndex: -1
12820                    },
12821                    `placeholder-$index2}`
12822                  )
12823                ),
12824                data.map((item) => {
12825                  const itemId = getItemId(item);
12826                  const selectionProps = getSelectionProps(itemId);
12827                  const stablePosition = item.position;
12828                  return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12829                    import_components8.Composite.Item,
12830                    {
12831                      render: (props) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12832                        GridItem,
12833                        {
12834                          ...props,
12835                          id: itemId,
12836                          role: "article",
12837                          view,
12838                          selection,
12839                          onChangeSelection,
12840                          onClickItem,
12841                          isItemClickable: isItemClickable2,
12842                          renderItemLink,
12843                          getItemId,
12844                          item,
12845                          actions,
12846                          onMouseDown: (event) => {
12847                            props.onMouseDown?.(event);
12848                            selectionProps.onMouseDown(
12849                              event
12850                            );
12851                          },
12852                          onClickCapture: (event) => {
12853                            props.onClickCapture?.(event);
12854                            selectionProps.onClickCapture(
12855                              event
12856                            );
12857                          },
12858                          mediaField,
12859                          titleField,
12860                          descriptionField: descriptionField2,
12861                          regularFields,
12862                          badgeFields,
12863                          hasBulkActions,
12864                          posinset: stablePosition,
12865                          setsize: paginationInfo.totalItems,
12866                          config: {
12867                            sizes: size4
12868                          }
12869                        }
12870                      )
12871                    },
12872                    itemId
12873                  );
12874                })
12875              ]
12876            }
12877          ),
12878          // Render standard grid layout (with rows, grid semantics)
12879          !isInfiniteScroll && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12880            import_components8.Composite,
12881            {
12882              role: "grid",
12883              className: clsx_default("dataviews-view-grid", className, {
12884                [`has-$view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes(
12885                  view.layout.density
12886                )
12887              }),
12888              focusWrap: true,
12889              "aria-busy": isLoading,
12890              "aria-rowcount": totalRows,
12891              ref: resizeObserverRef,
12892              inert,
12893              children: chunk(data, gridColumns).map((row, i2) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12894                import_components8.Composite.Row,
12895                {
12896                  render: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12897                    "div",
12898                    {
12899                      role: "row",
12900                      "aria-rowindex": i2 + 1,
12901                      "aria-label": (0, import_i18n18.sprintf)(
12902                        /* translators: %d: The row number in the grid */
12903                        (0, import_i18n18.__)("Row %d"),
12904                        i2 + 1
12905                      ),
12906                      className: "dataviews-view-grid__row",
12907                      style: {
12908                        gridTemplateColumns: `repeat( $gridColumns}, minmax(0, 1fr) )`
12909                      }
12910                    }
12911                  ),
12912                  children: row.map((item) => {
12913                    const itemId = getItemId(item);
12914                    const selectionProps = getSelectionProps(itemId);
12915                    return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12916                      import_components8.Composite.Item,
12917                      {
12918                        render: (props) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12919                          GridItem,
12920                          {
12921                            ...props,
12922                            id: itemId,
12923                            role: "gridcell",
12924                            view,
12925                            selection,
12926                            onChangeSelection,
12927                            onClickItem,
12928                            isItemClickable: isItemClickable2,
12929                            renderItemLink,
12930                            getItemId,
12931                            item,
12932                            actions,
12933                            onMouseDown: (event) => {
12934                              props.onMouseDown?.(
12935                                event
12936                              );
12937                              selectionProps.onMouseDown(
12938                                event
12939                              );
12940                            },
12941                            onClickCapture: (event) => {
12942                              props.onClickCapture?.(
12943                                event
12944                              );
12945                              selectionProps.onClickCapture(
12946                                event
12947                              );
12948                            },
12949                            mediaField,
12950                            titleField,
12951                            descriptionField: descriptionField2,
12952                            regularFields,
12953                            badgeFields,
12954                            hasBulkActions,
12955                            config: {
12956                              sizes: size4
12957                            }
12958                          }
12959                        )
12960                      },
12961                      itemId
12962                    );
12963                  })
12964                },
12965                i2
12966              ))
12967            }
12968          )
12969        ]
12970      });
12971    }
12972  
12973    // packages/dataviews/build-module/components/dataviews-layouts/grid/index.mjs
12974    var import_jsx_runtime59 = __toESM(require_jsx_runtime(), 1);
12975    function ViewGrid({
12976      actions,
12977      data,
12978      fields,
12979      getItemId,
12980      isLoading,
12981      onChangeSelection,
12982      onClickItem,
12983      isItemClickable: isItemClickable2,
12984      renderItemLink,
12985      selection,
12986      view,
12987      className,
12988      empty
12989    }) {
12990      const isDelayedLoading = useDelayedLoading(!!isLoading);
12991      const hasData = !!data?.length;
12992      const groupField = view.groupBy?.field ? fields.find((f2) => f2.id === view.groupBy?.field) : null;
12993      const dataByGroup = groupField ? getDataByGroup(data, groupField) : null;
12994      const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup;
12995      const orderedData = dataByGroup ? Array.from(dataByGroup.values()).flat() : data;
12996      const { getSelectionProps } = useSelectionProps({
12997        data: orderedData,
12998        actions,
12999        getItemId,
13000        selection,
13001        onChangeSelection
13002      });
13003      if (!hasData) {
13004        return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
13005          "div",
13006          {
13007            className: clsx_default("dataviews-no-results", {
13008              "is-refreshing": isDelayedLoading
13009            }),
13010            children: empty
13011          }
13012        );
13013      }
13014      const gridProps = {
13015        className: clsx_default(className, {
13016          "is-refreshing": !isInfiniteScroll && isDelayedLoading
13017        }),
13018        inert: !isInfiniteScroll && !!isLoading ? "true" : void 0,
13019        isLoading,
13020        view,
13021        fields,
13022        selection,
13023        onChangeSelection,
13024        onClickItem,
13025        isItemClickable: isItemClickable2,
13026        renderItemLink,
13027        getItemId,
13028        actions,
13029        getSelectionProps
13030      };
13031      return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_jsx_runtime59.Fragment, {
13032        // Render multiple groups.
13033        children: [
13034          hasData && groupField && dataByGroup && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Stack, { direction: "column", gap: "lg", children: Array.from(dataByGroup.entries()).map(
13035            ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
13036              Stack,
13037              {
13038                direction: "column",
13039                gap: "sm",
13040                children: [
13041                  /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("h3", { className: "dataviews-view-grid__group-header", children: view.groupBy?.showLabel === false ? groupName : (0, import_i18n19.sprintf)(
13042                    // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022".
13043                    (0, import_i18n19.__)("%1$s: %2$s"),
13044                    groupField.label,
13045                    groupName
13046                  ) }),
13047                  /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
13048                    CompositeGrid,
13049                    {
13050                      ...gridProps,
13051                      data: groupItems,
13052                      isInfiniteScroll: false
13053                    }
13054                  )
13055                ]
13056              },
13057              groupName
13058            )
13059          ) }),
13060          // Render a single grid with all data.
13061          !dataByGroup && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
13062            CompositeGrid,
13063            {
13064              ...gridProps,
13065              data,
13066              isInfiniteScroll: !!isInfiniteScroll
13067            }
13068          ),
13069          isInfiniteScroll && isLoading && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_components9.Spinner, {}) })
13070        ]
13071      });
13072    }
13073    var grid_default = ViewGrid;
13074  
13075    // packages/dataviews/build-module/components/dataviews-layouts/list/index.mjs
13076    var import_compose4 = __toESM(require_compose(), 1);
13077    var import_components10 = __toESM(require_components(), 1);
13078    var import_element33 = __toESM(require_element(), 1);
13079    var import_i18n20 = __toESM(require_i18n(), 1);
13080    var import_data4 = __toESM(require_data(), 1);
13081    var import_jsx_runtime60 = __toESM(require_jsx_runtime(), 1);
13082    var { Menu: Menu3 } = unlock2(import_components10.privateApis);
13083    function generateItemWrapperCompositeId(idPrefix) {
13084      return `$idPrefix}-item-wrapper`;
13085    }
13086    function generatePrimaryActionCompositeId(idPrefix, primaryActionId) {
13087      return `$idPrefix}-primary-action-$primaryActionId}`;
13088    }
13089    function generateDropdownTriggerCompositeId(idPrefix) {
13090      return `$idPrefix}-dropdown`;
13091    }
13092    function PrimaryActionGridCell({
13093      idPrefix,
13094      primaryAction,
13095      item
13096    }) {
13097      const registry = (0, import_data4.useRegistry)();
13098      const [isModalOpen, setIsModalOpen] = (0, import_element33.useState)(false);
13099      const compositeItemId = generatePrimaryActionCompositeId(
13100        idPrefix,
13101        primaryAction.id
13102      );
13103      const label = typeof primaryAction.label === "string" ? primaryAction.label : primaryAction.label([item]);
13104      return "RenderModal" in primaryAction ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { role: "gridcell", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13105        import_components10.Composite.Item,
13106        {
13107          id: compositeItemId,
13108          render: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13109            import_components10.Button,
13110            {
13111              disabled: !!primaryAction.disabled,
13112              accessibleWhenDisabled: true,
13113              text: label,
13114              size: "small",
13115              onClick: () => setIsModalOpen(true)
13116            }
13117          ),
13118          children: isModalOpen && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13119            ActionModal,
13120            {
13121              action: primaryAction,
13122              items: [item],
13123              closeModal: () => setIsModalOpen(false)
13124            }
13125          )
13126        }
13127      ) }, primaryAction.id) : /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { role: "gridcell", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13128        import_components10.Composite.Item,
13129        {
13130          id: compositeItemId,
13131          render: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13132            import_components10.Button,
13133            {
13134              disabled: !!primaryAction.disabled,
13135              accessibleWhenDisabled: true,
13136              size: "small",
13137              onClick: () => {
13138                primaryAction.callback([item], { registry });
13139              },
13140              children: label
13141            }
13142          )
13143        }
13144      ) }, primaryAction.id);
13145    }
13146    function ListItem({
13147      view,
13148      actions,
13149      idPrefix,
13150      isSelected: isSelected2,
13151      item,
13152      titleField,
13153      mediaField,
13154      descriptionField: descriptionField2,
13155      onSelect,
13156      otherFields,
13157      onDropdownTriggerKeyDown,
13158      posinset
13159    }) {
13160      const {
13161        showTitle = true,
13162        showMedia = true,
13163        showDescription = true,
13164        infiniteScrollEnabled
13165      } = view;
13166      const itemRef = (0, import_element33.useRef)(null);
13167      const labelId = `$idPrefix}-label`;
13168      const descriptionId = `$idPrefix}-description`;
13169      const registry = (0, import_data4.useRegistry)();
13170      const [isHovered, setIsHovered] = (0, import_element33.useState)(false);
13171      const [activeModalAction, setActiveModalAction] = (0, import_element33.useState)(
13172        null
13173      );
13174      const handleHover = ({ type }) => {
13175        const isHover = type === "mouseenter";
13176        setIsHovered(isHover);
13177      };
13178      const { paginationInfo } = (0, import_element33.useContext)(dataviews_context_default);
13179      (0, import_element33.useEffect)(() => {
13180        if (isSelected2) {
13181          itemRef.current?.scrollIntoView({
13182            behavior: "auto",
13183            block: "nearest",
13184            inline: "nearest"
13185          });
13186        }
13187      }, [isSelected2]);
13188      const { primaryAction, eligibleActions } = (0, import_element33.useMemo)(() => {
13189        const _eligibleActions = actions.filter(
13190          (action) => !action.isEligible || action.isEligible(item)
13191        );
13192        const _primaryActions = _eligibleActions.filter(
13193          (action) => action.isPrimary
13194        );
13195        return {
13196          primaryAction: _primaryActions[0],
13197          eligibleActions: _eligibleActions
13198        };
13199      }, [actions, item]);
13200      const hasOnlyOnePrimaryAction = primaryAction && actions.length === 1;
13201      const renderedMediaField = showMedia && mediaField?.render ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "dataviews-view-list__media-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13202        mediaField.render,
13203        {
13204          item,
13205          field: mediaField,
13206          config: { sizes: "52px" }
13207        }
13208      ) }) : null;
13209      const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(titleField.render, { item, field: titleField }) : null;
13210      const renderDescription = showDescription && descriptionField2?.render;
13211      const hasOnlyMediaAndTitle = !!renderedMediaField && !renderDescription && !otherFields.length;
13212      const usedActions = eligibleActions?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
13213        Stack,
13214        {
13215          direction: "row",
13216          gap: "md",
13217          className: "dataviews-view-list__item-actions",
13218          children: [
13219            primaryAction && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13220              PrimaryActionGridCell,
13221              {
13222                idPrefix,
13223                primaryAction,
13224                item
13225              }
13226            ),
13227            !hasOnlyOnePrimaryAction && /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { role: "gridcell", children: [
13228              /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(Menu3, { placement: "bottom-end", children: [
13229                /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13230                  Menu3.TriggerButton,
13231                  {
13232                    render: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13233                      import_components10.Composite.Item,
13234                      {
13235                        id: generateDropdownTriggerCompositeId(
13236                          idPrefix
13237                        ),
13238                        render: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13239                          import_components10.Button,
13240                          {
13241                            size: "small",
13242                            icon: more_vertical_default,
13243                            label: (0, import_i18n20.__)("Actions"),
13244                            accessibleWhenDisabled: true,
13245                            disabled: !actions.length,
13246                            onKeyDown: onDropdownTriggerKeyDown
13247                          }
13248                        )
13249                      }
13250                    )
13251                  }
13252                ),
13253                /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Menu3.Popover, { children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13254                  ActionsMenuGroup,
13255                  {
13256                    actions: eligibleActions,
13257                    item,
13258                    registry,
13259                    setActiveModalAction
13260                  }
13261                ) })
13262              ] }),
13263              !!activeModalAction && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13264                ActionModal,
13265                {
13266                  action: activeModalAction,
13267                  items: [item],
13268                  closeModal: () => setActiveModalAction(null)
13269                }
13270              )
13271            ] })
13272          ]
13273        }
13274      );
13275      return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13276        import_components10.Composite.Row,
13277        {
13278          ref: itemRef,
13279          render: (
13280            /* aria-posinset breaks Composite.Row if passed to it directly. */
13281            /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13282              "div",
13283              {
13284                "aria-posinset": posinset,
13285                "aria-setsize": infiniteScrollEnabled ? paginationInfo.totalItems : void 0
13286              }
13287            )
13288          ),
13289          role: infiniteScrollEnabled ? "article" : "row",
13290          className: clsx_default({
13291            "is-selected": isSelected2,
13292            "is-hovered": isHovered
13293          }),
13294          onMouseEnter: handleHover,
13295          onMouseLeave: handleHover,
13296          children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
13297            Stack,
13298            {
13299              direction: "row",
13300              className: "dataviews-view-list__item-wrapper",
13301              children: [
13302                /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { role: "gridcell", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13303                  import_components10.Composite.Item,
13304                  {
13305                    id: generateItemWrapperCompositeId(idPrefix),
13306                    "aria-pressed": isSelected2,
13307                    "aria-labelledby": labelId,
13308                    "aria-describedby": descriptionId,
13309                    className: "dataviews-view-list__item",
13310                    onClick: () => onSelect(item)
13311                  }
13312                ) }),
13313                /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
13314                  Stack,
13315                  {
13316                    direction: "row",
13317                    gap: "md",
13318                    justify: "start",
13319                    align: hasOnlyMediaAndTitle ? "center" : "flex-start",
13320                    style: { flex: 1, minWidth: 0 },
13321                    children: [
13322                      renderedMediaField,
13323                      /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
13324                        Stack,
13325                        {
13326                          direction: "column",
13327                          gap: "xs",
13328                          className: "dataviews-view-list__field-wrapper",
13329                          children: [
13330                            /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(Stack, { direction: "row", align: "center", children: [
13331                              /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13332                                "div",
13333                                {
13334                                  className: "dataviews-title-field dataviews-view-list__title-field",
13335                                  id: labelId,
13336                                  children: renderedTitleField
13337                                }
13338                              ),
13339                              usedActions
13340                            ] }),
13341                            renderDescription && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "dataviews-view-list__field", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13342                              descriptionField2.render,
13343                              {
13344                                item,
13345                                field: descriptionField2
13346                              }
13347                            ) }),
13348                            /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13349                              "div",
13350                              {
13351                                className: "dataviews-view-list__fields",
13352                                id: descriptionId,
13353                                children: otherFields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
13354                                  "div",
13355                                  {
13356                                    className: "dataviews-view-list__field",
13357                                    children: [
13358                                      /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13359                                        VisuallyHidden,
13360                                        {
13361                                          className: "dataviews-view-list__field-label",
13362                                          render: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", {}),
13363                                          children: field.label
13364                                        }
13365                                      ),
13366                                      /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "dataviews-view-list__field-value", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13367                                        field.render,
13368                                        {
13369                                          item,
13370                                          field
13371                                        }
13372                                      ) })
13373                                    ]
13374                                  },
13375                                  field.id
13376                                ))
13377                              }
13378                            )
13379                          ]
13380                        }
13381                      )
13382                    ]
13383                  }
13384                )
13385              ]
13386            }
13387          )
13388        }
13389      );
13390    }
13391    function isDefined2(item) {
13392      return !!item;
13393    }
13394    function ViewList(props) {
13395      const {
13396        actions,
13397        data,
13398        fields,
13399        getItemId,
13400        isLoading,
13401        onChangeSelection,
13402        selection,
13403        view,
13404        className,
13405        empty
13406      } = props;
13407      const baseId = (0, import_compose4.useInstanceId)(ViewList, "view-list");
13408      const isDelayedLoading = useDelayedLoading(!!isLoading);
13409      const { paginationInfo } = (0, import_element33.useContext)(dataviews_context_default);
13410      const selectedItem = data?.findLast(
13411        (item) => selection.includes(getItemId(item))
13412      );
13413      const titleField = fields.find((field) => field.id === view.titleField);
13414      const mediaField = fields.find((field) => field.id === view.mediaField);
13415      const descriptionField2 = fields.find(
13416        (field) => field.id === view.descriptionField
13417      );
13418      const otherFields = (view?.fields ?? []).map((fieldId) => fields.find((f2) => fieldId === f2.id)).filter(isDefined2);
13419      const onSelect = (item) => onChangeSelection([getItemId(item)]);
13420      const generateCompositeItemIdPrefix = (0, import_element33.useCallback)(
13421        (item) => `$baseId}-$getItemId(item)}`,
13422        [baseId, getItemId]
13423      );
13424      const isActiveCompositeItem = (0, import_element33.useCallback)(
13425        (item, idToCheck) => {
13426          return idToCheck.startsWith(
13427            generateCompositeItemIdPrefix(item)
13428          );
13429        },
13430        [generateCompositeItemIdPrefix]
13431      );
13432      const [activeCompositeId, setActiveCompositeId] = (0, import_element33.useState)(void 0);
13433      const compositeRef = (0, import_element33.useRef)(null);
13434      (0, import_element33.useEffect)(() => {
13435        if (selectedItem) {
13436          setActiveCompositeId(
13437            generateItemWrapperCompositeId(
13438              generateCompositeItemIdPrefix(selectedItem)
13439            )
13440          );
13441        }
13442      }, [selectedItem, generateCompositeItemIdPrefix]);
13443      const activeItemIndex = data.findIndex(
13444        (item) => isActiveCompositeItem(item, activeCompositeId ?? "")
13445      );
13446      const previousActiveItemIndex = (0, import_compose4.usePrevious)(activeItemIndex);
13447      const isActiveIdInList = activeItemIndex !== -1;
13448      const selectCompositeItem = (0, import_element33.useCallback)(
13449        (targetIndex, generateCompositeId) => {
13450          const clampedIndex = Math.min(
13451            data.length - 1,
13452            Math.max(0, targetIndex)
13453          );
13454          if (!data[clampedIndex]) {
13455            return;
13456          }
13457          const itemIdPrefix = generateCompositeItemIdPrefix(
13458            data[clampedIndex]
13459          );
13460          const targetCompositeItemId = generateCompositeId(itemIdPrefix);
13461          setActiveCompositeId(targetCompositeItemId);
13462          if (compositeRef.current?.contains(
13463            compositeRef.current.ownerDocument.activeElement
13464          )) {
13465            document.getElementById(targetCompositeItemId)?.focus();
13466          }
13467        },
13468        [data, generateCompositeItemIdPrefix]
13469      );
13470      (0, import_element33.useEffect)(() => {
13471        const wasActiveIdInList = previousActiveItemIndex !== void 0 && previousActiveItemIndex !== -1;
13472        if (!isActiveIdInList && wasActiveIdInList) {
13473          selectCompositeItem(
13474            previousActiveItemIndex,
13475            generateItemWrapperCompositeId
13476          );
13477        }
13478      }, [isActiveIdInList, selectCompositeItem, previousActiveItemIndex]);
13479      const onDropdownTriggerKeyDown = (0, import_element33.useCallback)(
13480        (event) => {
13481          if (event.key === "ArrowDown") {
13482            event.preventDefault();
13483            selectCompositeItem(
13484              activeItemIndex + 1,
13485              generateDropdownTriggerCompositeId
13486            );
13487          }
13488          if (event.key === "ArrowUp") {
13489            event.preventDefault();
13490            selectCompositeItem(
13491              activeItemIndex - 1,
13492              generateDropdownTriggerCompositeId
13493            );
13494          }
13495        },
13496        [selectCompositeItem, activeItemIndex]
13497      );
13498      const hasData = !!data?.length;
13499      const groupField = view.groupBy?.field ? fields.find((field) => field.id === view.groupBy?.field) : null;
13500      const dataByGroup = hasData && groupField ? getDataByGroup(data, groupField) : null;
13501      const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup;
13502      const hasMoreItems = isInfiniteScroll && (view.startPosition ?? 1) + (view.perPage ?? 0) < paginationInfo.totalItems;
13503      const listClassName = clsx_default("dataviews-view-list", className, {
13504        [`has-$view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes(view.layout.density),
13505        "is-refreshing": !isInfiniteScroll && isDelayedLoading
13506      });
13507      const compositeProps = {
13508        ref: compositeRef,
13509        id: baseId,
13510        render: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", {}),
13511        activeId: activeCompositeId,
13512        setActiveId: setActiveCompositeId,
13513        inert: !isInfiniteScroll && !!isLoading ? "true" : void 0
13514      };
13515      if (!hasData) {
13516        return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13517          "div",
13518          {
13519            className: clsx_default("dataviews-no-results", {
13520              "is-refreshing": isDelayedLoading
13521            }),
13522            children: empty
13523          }
13524        );
13525      }
13526      if (hasData && groupField && dataByGroup) {
13527        return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13528          import_components10.Composite,
13529          {
13530            ...compositeProps,
13531            className: "dataviews-view-list__group",
13532            role: "grid",
13533            children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Stack, { direction: "column", gap: "lg", className: listClassName, children: Array.from(dataByGroup.entries()).map(
13534              ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(Stack, { direction: "column", children: [
13535                /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("h3", { className: "dataviews-view-list__group-header", children: view.groupBy?.showLabel === false ? groupName : (0, import_i18n20.sprintf)(
13536                  // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022".
13537                  (0, import_i18n20.__)("%1$s: %2$s"),
13538                  groupField.label,
13539                  groupName
13540                ) }),
13541                groupItems.map((item) => {
13542                  const id = generateCompositeItemIdPrefix(item);
13543                  return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13544                    ListItem,
13545                    {
13546                      view,
13547                      idPrefix: id,
13548                      actions,
13549                      item,
13550                      isSelected: item === selectedItem,
13551                      onSelect,
13552                      mediaField,
13553                      titleField,
13554                      descriptionField: descriptionField2,
13555                      otherFields,
13556                      onDropdownTriggerKeyDown
13557                    },
13558                    id
13559                  );
13560                })
13561              ] }, groupName)
13562            ) })
13563          }
13564        );
13565      }
13566      return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_jsx_runtime60.Fragment, { children: [
13567        /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13568          import_components10.Composite,
13569          {
13570            ...compositeProps,
13571            className: listClassName,
13572            role: view.infiniteScrollEnabled ? "feed" : "grid",
13573            children: data.map((item, index2) => {
13574              const id = generateCompositeItemIdPrefix(item);
13575              return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13576                ListItem,
13577                {
13578                  view,
13579                  idPrefix: id,
13580                  actions,
13581                  item,
13582                  isSelected: item === selectedItem,
13583                  onSelect,
13584                  mediaField,
13585                  titleField,
13586                  descriptionField: descriptionField2,
13587                  otherFields,
13588                  onDropdownTriggerKeyDown,
13589                  posinset: view.infiniteScrollEnabled ? index2 + 1 : void 0
13590                },
13591                id
13592              );
13593            })
13594          }
13595        ),
13596        (hasMoreItems || isInfiniteScroll && isLoading) && // Keep the spinner's height reserved while loading more so the
13597        // scroll position doesn't bounce. Hidden, and silent to a11y,
13598        // while idle.
13599        /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
13600          "p",
13601          {
13602            className: "dataviews-loading-more",
13603            "aria-hidden": !isLoading,
13604            children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_components10.Spinner, {})
13605          }
13606        )
13607      ] });
13608    }
13609  
13610    // packages/dataviews/build-module/components/dataviews-layouts/activity/index.mjs
13611    var import_components11 = __toESM(require_components(), 1);
13612  
13613    // packages/dataviews/build-module/components/dataviews-layouts/activity/activity-group.mjs
13614    var import_i18n21 = __toESM(require_i18n(), 1);
13615    var import_element34 = __toESM(require_element(), 1);
13616    var import_jsx_runtime61 = __toESM(require_jsx_runtime(), 1);
13617    function ActivityGroup({
13618      groupName,
13619      groupData,
13620      groupField,
13621      showLabel = true,
13622      children
13623    }) {
13624      const groupHeader = showLabel ? (0, import_element34.createInterpolateElement)(
13625        // translators: %s: The label of the field e.g. "Status".
13626        (0, import_i18n21.sprintf)((0, import_i18n21.__)("%s: <groupName />"), groupField.label).trim(),
13627        {
13628          groupName: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
13629            groupField.render,
13630            {
13631              item: groupData[0],
13632              field: groupField
13633            }
13634          )
13635        }
13636      ) : /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(groupField.render, { item: groupData[0], field: groupField });
13637      return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
13638        Stack,
13639        {
13640          direction: "column",
13641          className: "dataviews-view-activity__group",
13642          children: [
13643            /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("h3", { className: "dataviews-view-activity__group-header", children: groupHeader }),
13644            children
13645          ]
13646        },
13647        groupName
13648      );
13649    }
13650  
13651    // packages/dataviews/build-module/components/dataviews-layouts/activity/activity-item.mjs
13652    var import_element35 = __toESM(require_element(), 1);
13653    var import_data5 = __toESM(require_data(), 1);
13654    var import_compose5 = __toESM(require_compose(), 1);
13655    var import_jsx_runtime62 = __toESM(require_jsx_runtime(), 1);
13656    function ActivityItem(props) {
13657      const {
13658        view,
13659        actions,
13660        item,
13661        titleField,
13662        mediaField,
13663        descriptionField: descriptionField2,
13664        otherFields,
13665        posinset,
13666        onClickItem,
13667        renderItemLink,
13668        isItemClickable: isItemClickable2
13669      } = props;
13670      const {
13671        showTitle = true,
13672        showMedia = true,
13673        showDescription = true,
13674        infiniteScrollEnabled
13675      } = view;
13676      const itemRef = (0, import_element35.useRef)(null);
13677      const registry = (0, import_data5.useRegistry)();
13678      const { paginationInfo } = (0, import_element35.useContext)(dataviews_context_default);
13679      const { primaryActions, eligibleActions } = (0, import_element35.useMemo)(() => {
13680        const _eligibleActions = actions.filter(
13681          (action) => !action.isEligible || action.isEligible(item)
13682        );
13683        const _primaryActions = _eligibleActions.filter(
13684          (action) => action.isPrimary
13685        );
13686        return {
13687          primaryActions: _primaryActions,
13688          eligibleActions: _eligibleActions
13689        };
13690      }, [actions, item]);
13691      const isMobileViewport = (0, import_compose5.useViewportMatch)("medium", "<");
13692      const density = view.layout?.density ?? "balanced";
13693      const mediaContent = showMedia && density !== "compact" && mediaField?.render ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
13694        mediaField.render,
13695        {
13696          item,
13697          field: mediaField,
13698          config: {
13699            sizes: density === "comfortable" ? "32px" : "24px"
13700          }
13701        }
13702      ) : null;
13703      const renderedMediaField = /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "dataviews-view-activity__item-type-icon", children: mediaContent || /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
13704        "span",
13705        {
13706          className: "dataviews-view-activity__item-bullet",
13707          "aria-hidden": "true"
13708        }
13709      ) });
13710      const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(titleField.render, { item, field: titleField }) : null;
13711      const verticalGap = (0, import_element35.useMemo)(() => {
13712        switch (density) {
13713          case "comfortable":
13714            return "md";
13715          default:
13716            return "sm";
13717        }
13718      }, [density]);
13719      return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
13720        "div",
13721        {
13722          ref: itemRef,
13723          role: infiniteScrollEnabled ? "article" : void 0,
13724          "aria-posinset": posinset,
13725          "aria-setsize": infiniteScrollEnabled ? paginationInfo.totalItems : void 0,
13726          className: clsx_default(
13727            "dataviews-view-activity__item",
13728            density === "compact" && "is-compact",
13729            density === "balanced" && "is-balanced",
13730            density === "comfortable" && "is-comfortable"
13731          ),
13732          children: /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Stack, { direction: "row", gap: "lg", justify: "start", align: "flex-start", children: [
13733            /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
13734              Stack,
13735              {
13736                direction: "column",
13737                gap: "xs",
13738                align: "center",
13739                className: "dataviews-view-activity__item-type",
13740                children: renderedMediaField
13741              }
13742            ),
13743            /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
13744              Stack,
13745              {
13746                direction: "column",
13747                gap: verticalGap,
13748                align: "flex-start",
13749                className: "dataviews-view-activity__item-content",
13750                children: [
13751                  renderedTitleField && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
13752                    ItemClickWrapper,
13753                    {
13754                      item,
13755                      isItemClickable: isItemClickable2,
13756                      onClickItem,
13757                      renderItemLink,
13758                      className: "dataviews-view-activity__item-title",
13759                      children: renderedTitleField
13760                    }
13761                  ),
13762                  showDescription && descriptionField2 && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "dataviews-view-activity__item-description", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
13763                    descriptionField2.render,
13764                    {
13765                      item,
13766                      field: descriptionField2
13767                    }
13768                  ) }),
13769                  /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "dataviews-view-activity__item-fields", children: otherFields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
13770                    "div",
13771                    {
13772                      className: "dataviews-view-activity__item-field",
13773                      children: [
13774                        /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
13775                          VisuallyHidden,
13776                          {
13777                            className: "dataviews-view-activity__item-field-label",
13778                            render: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", {}),
13779                            children: field.label
13780                          }
13781                        ),
13782                        /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "dataviews-view-activity__item-field-value", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
13783                          field.render,
13784                          {
13785                            item,
13786                            field
13787                          }
13788                        ) })
13789                      ]
13790                    },
13791                    field.id
13792                  )) }),
13793                  !!primaryActions?.length && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
13794                    PrimaryActions,
13795                    {
13796                      item,
13797                      actions: primaryActions,
13798                      registry,
13799                      buttonVariant: "secondary"
13800                    }
13801                  )
13802                ]
13803              }
13804            ),
13805            (primaryActions.length < eligibleActions.length || // Since we hide primary actions on mobile, we need to show the menu
13806            // there if there are any actions at all.
13807            isMobileViewport && // At the same time, only show the menu if there are actions to show.
13808            eligibleActions.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "dataviews-view-activity__item-actions", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
13809              ItemActions,
13810              {
13811                item,
13812                actions: eligibleActions,
13813                isCompact: true
13814              }
13815            ) })
13816          ] })
13817        }
13818      );
13819    }
13820    var activity_item_default = ActivityItem;
13821  
13822    // packages/dataviews/build-module/components/dataviews-layouts/activity/activity-items.mjs
13823    var import_react6 = __toESM(require_react(), 1);
13824    function isDefined3(item) {
13825      return !!item;
13826    }
13827    function ActivityItems(props) {
13828      const { data, fields, getItemId, view } = props;
13829      const titleField = fields.find((field) => field.id === view.titleField);
13830      const mediaField = fields.find((field) => field.id === view.mediaField);
13831      const descriptionField2 = fields.find(
13832        (field) => field.id === view.descriptionField
13833      );
13834      const otherFields = (view?.fields ?? []).map((fieldId) => fields.find((f2) => fieldId === f2.id)).filter(isDefined3);
13835      return data.map((item, index2) => {
13836        return /* @__PURE__ */ (0, import_react6.createElement)(
13837          activity_item_default,
13838          {
13839            ...props,
13840            key: getItemId(item),
13841            item,
13842            mediaField,
13843            titleField,
13844            descriptionField: descriptionField2,
13845            otherFields,
13846            posinset: view.infiniteScrollEnabled ? index2 + 1 : void 0
13847          }
13848        );
13849      });
13850    }
13851  
13852    // packages/dataviews/build-module/components/dataviews-layouts/activity/index.mjs
13853    var import_jsx_runtime63 = __toESM(require_jsx_runtime(), 1);
13854    function ViewActivity(props) {
13855      const { empty, data, fields, isLoading, view, className } = props;
13856      const isDelayedLoading = useDelayedLoading(!!isLoading);
13857      const hasData = !!data?.length;
13858      const groupField = view.groupBy?.field ? fields.find((field) => field.id === view.groupBy?.field) : null;
13859      const dataByGroup = hasData && groupField ? getDataByGroup(data, groupField) : null;
13860      const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup;
13861      if (!hasData) {
13862        return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
13863          "div",
13864          {
13865            className: clsx_default("dataviews-no-results", {
13866              "is-refreshing": isDelayedLoading
13867            }),
13868            children: empty
13869          }
13870        );
13871      }
13872      const isInert = !isInfiniteScroll && !!isLoading;
13873      const wrapperClassName = clsx_default("dataviews-view-activity", className, {
13874        "is-refreshing": !isInfiniteScroll && isDelayedLoading
13875      });
13876      const groupedEntries = dataByGroup ? Array.from(dataByGroup.entries()) : [];
13877      if (hasData && groupField && dataByGroup) {
13878        return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
13879          Stack,
13880          {
13881            direction: "column",
13882            gap: "sm",
13883            className: wrapperClassName,
13884            inert: isInert ? "true" : void 0,
13885            children: groupedEntries.map(
13886              ([groupName, groupData]) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
13887                ActivityGroup,
13888                {
13889                  groupName,
13890                  groupData,
13891                  groupField,
13892                  showLabel: view.groupBy?.showLabel !== false,
13893                  children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
13894                    ActivityItems,
13895                    {
13896                      ...props,
13897                      data: groupData
13898                    }
13899                  )
13900                },
13901                groupName
13902              )
13903            )
13904          }
13905        );
13906      }
13907      return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
13908        /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
13909          "div",
13910          {
13911            className: wrapperClassName,
13912            role: view.infiniteScrollEnabled ? "feed" : void 0,
13913            inert: isInert ? "true" : void 0,
13914            children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(ActivityItems, { ...props })
13915          }
13916        ),
13917        isInfiniteScroll && isLoading && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_components11.Spinner, {}) })
13918      ] });
13919    }
13920  
13921    // packages/dataviews/build-module/components/dataviews-layouts/picker-grid/index.mjs
13922    var import_components14 = __toESM(require_components(), 1);
13923    var import_i18n24 = __toESM(require_i18n(), 1);
13924    var import_compose6 = __toESM(require_compose(), 1);
13925    var import_element38 = __toESM(require_element(), 1);
13926  
13927    // packages/dataviews/build-module/components/dataviews-picker-footer/index.mjs
13928    var import_components13 = __toESM(require_components(), 1);
13929    var import_data6 = __toESM(require_data(), 1);
13930    var import_element37 = __toESM(require_element(), 1);
13931    var import_i18n23 = __toESM(require_i18n(), 1);
13932  
13933    // packages/dataviews/build-module/components/dataviews-pagination/index.mjs
13934    var import_components12 = __toESM(require_components(), 1);
13935    var import_element36 = __toESM(require_element(), 1);
13936    var import_i18n22 = __toESM(require_i18n(), 1);
13937    var import_jsx_runtime64 = __toESM(require_jsx_runtime(), 1);
13938    function hasPaginationControls(view, paginationInfo) {
13939      return !view.infiniteScrollEnabled && paginationInfo.totalItems > 0 && paginationInfo.totalPages > 1;
13940    }
13941    function DataViewsPagination() {
13942      const { view, onChangeView, paginationInfo } = (0, import_element36.useContext)(dataviews_context_default);
13943      if (!hasPaginationControls(view, paginationInfo)) {
13944        return null;
13945      }
13946      const { totalPages } = paginationInfo;
13947      const currentPage = view.page ?? 1;
13948      const pageSelectOptions = Array.from(Array(totalPages)).map(
13949        (_, i2) => {
13950          const page = i2 + 1;
13951          return {
13952            value: page.toString(),
13953            label: page.toString(),
13954            "aria-label": currentPage === page ? (0, import_i18n22.sprintf)(
13955              // translators: 1: current page number. 2: total number of pages.
13956              (0, import_i18n22.__)("Page %1$d of %2$d"),
13957              currentPage,
13958              totalPages
13959            ) : page.toString()
13960          };
13961        }
13962      );
13963      return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
13964        Stack,
13965        {
13966          direction: "row",
13967          className: "dataviews-pagination",
13968          justify: "end",
13969          align: "center",
13970          gap: "xl",
13971          children: [
13972            /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
13973              Stack,
13974              {
13975                direction: "row",
13976                justify: "flex-start",
13977                align: "center",
13978                gap: "xs",
13979                className: "dataviews-pagination__page-select",
13980                children: (0, import_element36.createInterpolateElement)(
13981                  (0, import_i18n22.sprintf)(
13982                    // translators: 1: Current page number, 2: Total number of pages.
13983                    (0, import_i18n22._x)("<div>Page</div>%1$s<div>of %2$d</div>", "paging"),
13984                    "<CurrentPage />",
13985                    totalPages
13986                  ),
13987                  {
13988                    div: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { "aria-hidden": true }),
13989                    // @ts-expect-error — Tag injected via sprintf argument, not visible in format string.
13990                    CurrentPage: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
13991                      import_components12.SelectControl,
13992                      {
13993                        "aria-label": (0, import_i18n22.__)("Current page"),
13994                        value: currentPage.toString(),
13995                        options: pageSelectOptions,
13996                        onChange: (newValue) => {
13997                          onChangeView({
13998                            ...view,
13999                            page: +newValue
14000                          });
14001                        },
14002                        size: "small",
14003                        variant: "minimal"
14004                      }
14005                    )
14006                  }
14007                )
14008              }
14009            ),
14010            /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(Stack, { direction: "row", gap: "xs", align: "center", children: [
14011              /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
14012                import_components12.Button,
14013                {
14014                  onClick: () => onChangeView({
14015                    ...view,
14016                    page: currentPage - 1
14017                  }),
14018                  disabled: currentPage === 1,
14019                  accessibleWhenDisabled: true,
14020                  label: (0, import_i18n22.__)("Previous page"),
14021                  icon: (0, import_i18n22.isRTL)() ? next_default : previous_default,
14022                  showTooltip: true,
14023                  size: "compact",
14024                  tooltipPosition: "top"
14025                }
14026              ),
14027              /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
14028                import_components12.Button,
14029                {
14030                  onClick: () => onChangeView({ ...view, page: currentPage + 1 }),
14031                  disabled: currentPage >= totalPages,
14032                  accessibleWhenDisabled: true,
14033                  label: (0, import_i18n22.__)("Next page"),
14034                  icon: (0, import_i18n22.isRTL)() ? previous_default : next_default,
14035                  showTooltip: true,
14036                  size: "compact",
14037                  tooltipPosition: "top"
14038                }
14039              )
14040            ] })
14041          ]
14042        }
14043      );
14044    }
14045    var dataviews_pagination_default = (0, import_element36.memo)(DataViewsPagination);
14046  
14047    // packages/dataviews/build-module/components/dataviews-picker-footer/index.mjs
14048    var import_jsx_runtime65 = __toESM(require_jsx_runtime(), 1);
14049    var EMPTY_ARRAY2 = [];
14050    function useIsMultiselectPicker(actions) {
14051      return (0, import_element37.useMemo)(() => {
14052        return !!actions?.length && actions?.every((action) => action.supportsBulk);
14053      }, [actions]);
14054    }
14055    function BulkSelectionCheckbox2({
14056      selection,
14057      selectedItems,
14058      onChangeSelection,
14059      data,
14060      getItemId,
14061      disableSelectAll = false
14062    }) {
14063      const hasSelection = selection.length > 0;
14064      const areAllSelected = selectedItems.length === data.length;
14065      if (disableSelectAll) {
14066        return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
14067          import_components13.CheckboxControl,
14068          {
14069            className: "dataviews-view-table-selection-checkbox",
14070            checked: hasSelection,
14071            disabled: !hasSelection,
14072            onChange: () => {
14073              onChangeSelection([]);
14074            },
14075            "aria-label": (0, import_i18n23.__)("Deselect all")
14076          }
14077        );
14078      }
14079      return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
14080        import_components13.CheckboxControl,
14081        {
14082          className: "dataviews-view-table-selection-checkbox",
14083          checked: areAllSelected,
14084          indeterminate: !areAllSelected && !!selectedItems.length,
14085          onChange: () => {
14086            if (areAllSelected) {
14087              onChangeSelection(
14088                selection.filter(
14089                  (id) => !data.some(
14090                    (item) => id === getItemId(item)
14091                  )
14092                )
14093              );
14094            } else {
14095              const selectionSet = /* @__PURE__ */ new Set([
14096                ...selection,
14097                ...data.map((item) => getItemId(item))
14098              ]);
14099              onChangeSelection(Array.from(selectionSet));
14100            }
14101          },
14102          "aria-label": areAllSelected ? (0, import_i18n23.__)("Deselect all") : (0, import_i18n23.__)("Select all")
14103        }
14104      );
14105    }
14106    function ActionButtons({
14107      actions,
14108      items,
14109      selection
14110    }) {
14111      const registry = (0, import_data6.useRegistry)();
14112      const [actionInProgress, setActionInProgress] = (0, import_element37.useState)(
14113        null
14114      );
14115      return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Stack, { direction: "row", gap: "xs", children: actions.map((action) => {
14116        if (!("callback" in action)) {
14117          return null;
14118        }
14119        const { id, label, icon, isPrimary, callback } = action;
14120        const _label = typeof label === "string" ? label : label(items);
14121        const variant = isPrimary ? "primary" : "tertiary";
14122        const isInProgress = id === actionInProgress;
14123        return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
14124          import_components13.Button,
14125          {
14126            accessibleWhenDisabled: true,
14127            icon,
14128            disabled: isInProgress || !selection?.length,
14129            isBusy: isInProgress,
14130            onClick: async () => {
14131              setActionInProgress(id);
14132              await callback(items, {
14133                registry
14134              });
14135              setActionInProgress(null);
14136            },
14137            size: "compact",
14138            variant,
14139            children: _label
14140          },
14141          id
14142        );
14143      }) });
14144    }
14145    function PickerBulkSelectionInfo() {
14146      const {
14147        data,
14148        selection,
14149        onChangeSelection,
14150        getItemId,
14151        actions = EMPTY_ARRAY2,
14152        paginationInfo,
14153        view
14154      } = (0, import_element37.useContext)(dataviews_context_default);
14155      const isMultiselect = useIsMultiselectPicker(actions);
14156      const selectedItems = (0, import_element37.useMemo)(
14157        () => data.filter((item) => selection.includes(getItemId(item))),
14158        [selection, getItemId, data]
14159      );
14160      if (!actions.length) {
14161        return null;
14162      }
14163      const message2 = getFooterMessage(
14164        selection.length,
14165        data.length,
14166        paginationInfo.totalItems,
14167        !!view.infiniteScrollEnabled
14168      );
14169      return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
14170        Stack,
14171        {
14172          direction: "row",
14173          className: "dataviews-picker-footer__bulk-selection",
14174          gap: "md",
14175          align: "center",
14176          children: [
14177            isMultiselect && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
14178              BulkSelectionCheckbox2,
14179              {
14180                selection,
14181                selectedItems,
14182                onChangeSelection,
14183                data,
14184                getItemId,
14185                disableSelectAll: !!view.infiniteScrollEnabled
14186              }
14187            ),
14188            /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "dataviews-bulk-actions-footer__item-count", children: message2 })
14189          ]
14190        }
14191      );
14192    }
14193    function PickerActions() {
14194      const {
14195        data,
14196        selection,
14197        getItemId,
14198        actions = EMPTY_ARRAY2
14199      } = (0, import_element37.useContext)(dataviews_context_default);
14200      const selectedItems = (0, import_element37.useMemo)(
14201        () => data.filter((item) => selection.includes(getItemId(item))),
14202        [selection, getItemId, data]
14203      );
14204      if (!actions.length) {
14205        return null;
14206      }
14207      return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "dataviews-picker-footer__actions", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
14208        ActionButtons,
14209        {
14210          actions,
14211          items: selectedItems,
14212          selection
14213        }
14214      ) });
14215    }
14216    function DataViewsPickerBulkActionToolbar() {
14217      return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(Stack, { direction: "row", gap: "md", align: "center", children: [
14218        /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(PickerBulkSelectionInfo, {}),
14219        /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(PickerActions, {})
14220      ] });
14221    }
14222    function DataViewsPickerFooter() {
14223      const {
14224        actions = EMPTY_ARRAY2,
14225        paginationInfo,
14226        view
14227      } = (0, import_element37.useContext)(dataviews_context_default);
14228      const hasPagination = !view.infiniteScrollEnabled && !!paginationInfo.totalItems && paginationInfo.totalPages > 1;
14229      if (!actions.length && !hasPagination) {
14230        return null;
14231      }
14232      return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
14233        Stack,
14234        {
14235          direction: "row",
14236          justify: "space-between",
14237          align: "center",
14238          className: "dataviews-footer",
14239          gap: "sm",
14240          children: [
14241            /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(PickerBulkSelectionInfo, {}),
14242            /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(dataviews_pagination_default, {}),
14243            /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(PickerActions, {})
14244          ]
14245        }
14246      );
14247    }
14248  
14249    // packages/dataviews/build-module/components/dataviews-layouts/picker-grid/index.mjs
14250    var import_jsx_runtime66 = __toESM(require_jsx_runtime(), 1);
14251    var { Badge: WCBadge2 } = unlock2(import_components14.privateApis);
14252    function GridItem3({
14253      view,
14254      multiselect,
14255      selection,
14256      onChangeSelection,
14257      getItemId,
14258      item,
14259      mediaField,
14260      titleField,
14261      descriptionField: descriptionField2,
14262      regularFields,
14263      badgeFields,
14264      config,
14265      posinset,
14266      setsize
14267    }) {
14268      const { showTitle = true, showMedia = true, showDescription = true } = view;
14269      const id = getItemId(item);
14270      const elementRef = (0, import_element38.useRef)(null);
14271      const isSelected2 = selection.includes(id);
14272      useIntersectionObserver(elementRef, posinset);
14273      const renderedMediaField = mediaField?.render ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
14274        mediaField.render,
14275        {
14276          item,
14277          field: mediaField,
14278          config
14279        }
14280      ) : null;
14281      const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(titleField.render, { item, field: titleField }) : null;
14282      return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
14283        import_components14.Composite.Item,
14284        {
14285          ref: elementRef,
14286          "aria-label": titleField ? titleField.getValue({ item }) || (0, import_i18n24.__)("(no title)") : void 0,
14287          render: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Stack, { direction: "column", children, ...props }),
14288          role: "option",
14289          "aria-posinset": posinset,
14290          "aria-setsize": setsize,
14291          className: clsx_default("dataviews-view-picker-grid__card", {
14292            "is-selected": isSelected2
14293          }),
14294          "aria-selected": isSelected2,
14295          onClick: () => {
14296            if (isSelected2) {
14297              onChangeSelection(
14298                selection.filter((itemId) => id !== itemId)
14299              );
14300            } else {
14301              const newSelection = multiselect ? [...selection, id] : [id];
14302              onChangeSelection(newSelection);
14303            }
14304          },
14305          children: [
14306            showMedia && renderedMediaField && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "dataviews-view-picker-grid__media", children: renderedMediaField }),
14307            showMedia && renderedMediaField && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
14308              DataViewsSelectionCheckbox,
14309              {
14310                item,
14311                selection,
14312                onChangeSelection,
14313                getItemId,
14314                titleField,
14315                disabled: false,
14316                "aria-hidden": true,
14317                tabIndex: -1
14318              }
14319            ),
14320            showTitle && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
14321              Stack,
14322              {
14323                direction: "row",
14324                justify: "space-between",
14325                className: "dataviews-view-picker-grid__title-actions",
14326                children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "dataviews-view-picker-grid__title-field dataviews-title-field", children: renderedTitleField })
14327              }
14328            ),
14329            /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(Stack, { direction: "column", gap: "xs", children: [
14330              showDescription && descriptionField2?.render && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
14331                descriptionField2.render,
14332                {
14333                  item,
14334                  field: descriptionField2
14335                }
14336              ),
14337              !!badgeFields?.length && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
14338                Stack,
14339                {
14340                  direction: "row",
14341                  className: "dataviews-view-picker-grid__badge-fields",
14342                  gap: "sm",
14343                  wrap: "wrap",
14344                  align: "top",
14345                  justify: "flex-start",
14346                  children: badgeFields.map((field) => {
14347                    return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
14348                      WCBadge2,
14349                      {
14350                        className: "dataviews-view-picker-grid__field-value",
14351                        children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
14352                          field.render,
14353                          {
14354                            item,
14355                            field
14356                          }
14357                        )
14358                      },
14359                      field.id
14360                    );
14361                  })
14362                }
14363              ),
14364              !!regularFields?.length && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
14365                Stack,
14366                {
14367                  direction: "column",
14368                  className: "dataviews-view-picker-grid__fields",
14369                  gap: "xs",
14370                  children: regularFields.map((field) => {
14371                    return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
14372                      import_components14.Flex,
14373                      {
14374                        className: "dataviews-view-picker-grid__field",
14375                        gap: 1,
14376                        justify: "flex-start",
14377                        expanded: true,
14378                        style: { height: "auto" },
14379                        direction: "row",
14380                        children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
14381                          /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_components14.FlexItem, { className: "dataviews-view-picker-grid__field-name", children: field.header }),
14382                          /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
14383                            import_components14.FlexItem,
14384                            {
14385                              className: "dataviews-view-picker-grid__field-value",
14386                              style: { maxHeight: "none" },
14387                              children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
14388                                field.render,
14389                                {
14390                                  item,
14391                                  field
14392                                }
14393                              )
14394                            }
14395                          )
14396                        ] })
14397                      },
14398                      field.id
14399                    );
14400                  })
14401                }
14402              )
14403            ] })
14404          ]
14405        },
14406        id
14407      );
14408    }
14409    function GridGroup({
14410      groupName,
14411      groupField,
14412      showLabel = true,
14413      children
14414    }) {
14415      const headerId = (0, import_compose6.useInstanceId)(
14416        GridGroup,
14417        "dataviews-view-picker-grid-group__header"
14418      );
14419      return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
14420        Stack,
14421        {
14422          direction: "column",
14423          gap: "sm",
14424          role: "group",
14425          "aria-labelledby": headerId,
14426          children: [
14427            /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
14428              "h3",
14429              {
14430                className: "dataviews-view-picker-grid-group__header",
14431                id: headerId,
14432                children: showLabel ? (0, import_i18n24.sprintf)(
14433                  // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022".
14434                  (0, import_i18n24.__)("%1$s: %2$s"),
14435                  groupField.label,
14436                  groupName
14437                ) : groupName
14438              }
14439            ),
14440            children
14441          ]
14442        },
14443        groupName
14444      );
14445    }
14446    function ViewPickerGrid({
14447      actions,
14448      data,
14449      fields,
14450      getItemId,
14451      isLoading,
14452      onChangeSelection,
14453      selection,
14454      view,
14455      className,
14456      empty
14457    }) {
14458      const { resizeObserverRef, paginationInfo, itemListLabel } = (0, import_element38.useContext)(dataviews_context_default);
14459      const titleField = fields.find(
14460        (field) => field.id === view?.titleField
14461      );
14462      const mediaField = fields.find(
14463        (field) => field.id === view?.mediaField
14464      );
14465      const descriptionField2 = fields.find(
14466        (field) => field.id === view?.descriptionField
14467      );
14468      const otherFields = view.fields ?? [];
14469      const { regularFields, badgeFields } = otherFields.reduce(
14470        (accumulator, fieldId) => {
14471          const field = fields.find((f2) => f2.id === fieldId);
14472          if (!field) {
14473            return accumulator;
14474          }
14475          const key = view.layout?.badgeFields?.includes(fieldId) ? "badgeFields" : "regularFields";
14476          accumulator[key].push(field);
14477          return accumulator;
14478        },
14479        { regularFields: [], badgeFields: [] }
14480      );
14481      const hasData = !!data?.length;
14482      const usedPreviewSize = view.layout?.previewSize;
14483      const isMultiselect = useIsMultiselectPicker(actions);
14484      const size4 = "900px";
14485      const groupField = view.groupBy?.field ? fields.find((f2) => f2.id === view.groupBy?.field) : null;
14486      const dataByGroup = groupField ? getDataByGroup(data, groupField) : null;
14487      const isInfiniteScroll = (view.infiniteScrollEnabled && !dataByGroup) ?? false;
14488      const currentPage = view?.page ?? 1;
14489      const perPage = view?.perPage ?? 0;
14490      const setSize = isInfiniteScroll ? paginationInfo?.totalItems : void 0;
14491      const gridColumns = useGridColumns();
14492      const placeholdersNeeded = usePlaceholdersNeeded(
14493        data,
14494        isInfiniteScroll,
14495        gridColumns
14496      );
14497      return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, {
14498        // Render multiple groups.
14499        children: [
14500          hasData && groupField && dataByGroup && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
14501            import_components14.Composite,
14502            {
14503              virtualFocus: true,
14504              orientation: "horizontal",
14505              role: "listbox",
14506              "aria-multiselectable": isMultiselect,
14507              className: clsx_default(
14508                "dataviews-view-picker-grid",
14509                className,
14510                {
14511                  [`has-$view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes(
14512                    view.layout.density
14513                  )
14514                }
14515              ),
14516              "aria-label": itemListLabel,
14517              render: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
14518                Stack,
14519                {
14520                  direction: "column",
14521                  gap: "lg",
14522                  children,
14523                  ...props
14524                }
14525              ),
14526              children: Array.from(dataByGroup.entries()).map(
14527                ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
14528                  GridGroup,
14529                  {
14530                    groupName,
14531                    groupField,
14532                    showLabel: view.groupBy?.showLabel !== false,
14533                    children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
14534                      GridItems,
14535                      {
14536                        previewSize: usedPreviewSize,
14537                        style: {
14538                          gridTemplateColumns: usedPreviewSize && `repeat(auto-fill, minmax($usedPreviewSize}px, 1fr))`
14539                        },
14540                        "aria-busy": isLoading,
14541                        ref: resizeObserverRef,
14542                        children: groupItems.map((item) => {
14543                          const posInSet = item.position ?? (currentPage - 1) * perPage + data.indexOf(item) + 1;
14544                          return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
14545                            GridItem3,
14546                            {
14547                              view,
14548                              multiselect: isMultiselect,
14549                              selection,
14550                              onChangeSelection,
14551                              getItemId,
14552                              item,
14553                              mediaField,
14554                              titleField,
14555                              descriptionField: descriptionField2,
14556                              regularFields,
14557                              badgeFields,
14558                              config: {
14559                                sizes: size4
14560                              },
14561                              posinset: posInSet,
14562                              setsize: setSize
14563                            },
14564                            getItemId(item)
14565                          );
14566                        })
14567                      }
14568                    )
14569                  },
14570                  groupName
14571                )
14572              )
14573            }
14574          ),
14575          // Render a single grid with all data.
14576          hasData && !dataByGroup && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
14577            import_components14.Composite,
14578            {
14579              render: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
14580                GridItems,
14581                {
14582                  className: clsx_default(
14583                    "dataviews-view-picker-grid",
14584                    className,
14585                    {
14586                      [`has-$view.layout?.density}-density`]: view.layout?.density && [
14587                        "compact",
14588                        "comfortable"
14589                      ].includes(view.layout.density)
14590                    }
14591                  ),
14592                  previewSize: usedPreviewSize,
14593                  "aria-busy": isLoading,
14594                  ref: resizeObserverRef
14595                }
14596              ),
14597              virtualFocus: true,
14598              orientation: "horizontal",
14599              role: "listbox",
14600              "aria-multiselectable": isMultiselect,
14601              "aria-label": itemListLabel,
14602              children: [
14603                Array.from({ length: placeholdersNeeded }).map(
14604                  (_, index2) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
14605                    import_components14.Composite.Item,
14606                    {
14607                      render: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
14608                        Stack,
14609                        {
14610                          direction: "column",
14611                          children,
14612                          ...props
14613                        }
14614                      ),
14615                      role: "option",
14616                      "aria-hidden": true,
14617                      tabIndex: -1,
14618                      className: "dataviews-view-picker-grid__card dataviews-view-picker-grid__placeholder"
14619                    },
14620                    `placeholder-$index2}`
14621                  )
14622                ),
14623                data.map((item) => {
14624                  const posinset = item.position;
14625                  return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
14626                    GridItem3,
14627                    {
14628                      view,
14629                      multiselect: isMultiselect,
14630                      selection,
14631                      onChangeSelection,
14632                      getItemId,
14633                      item,
14634                      mediaField,
14635                      titleField,
14636                      descriptionField: descriptionField2,
14637                      regularFields,
14638                      badgeFields,
14639                      config: {
14640                        sizes: size4
14641                      },
14642                      posinset,
14643                      setsize: setSize
14644                    },
14645                    getItemId(item)
14646                  );
14647                })
14648              ]
14649            }
14650          ),
14651          // Render empty state.
14652          !hasData && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
14653            "div",
14654            {
14655              className: clsx_default({
14656                "dataviews-loading": isLoading,
14657                "dataviews-no-results": !isLoading
14658              }),
14659              children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_components14.Spinner, {}) }) : empty
14660            }
14661          ),
14662          hasData && isLoading && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_components14.Spinner, {}) })
14663        ]
14664      });
14665    }
14666    var picker_grid_default = ViewPickerGrid;
14667  
14668    // packages/dataviews/build-module/components/dataviews-layouts/picker-table/index.mjs
14669    var import_i18n25 = __toESM(require_i18n(), 1);
14670    var import_components15 = __toESM(require_components(), 1);
14671    var import_element39 = __toESM(require_element(), 1);
14672    var import_jsx_runtime67 = __toESM(require_jsx_runtime(), 1);
14673    function TableColumnField2({
14674      item,
14675      fields,
14676      column,
14677      align
14678    }) {
14679      const field = fields.find((f2) => f2.id === column);
14680      if (!field) {
14681        return null;
14682      }
14683      const className = clsx_default("dataviews-view-table__cell-content-wrapper", {
14684        "dataviews-view-table__cell-align-end": align === "end",
14685        "dataviews-view-table__cell-align-center": align === "center"
14686      });
14687      return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(field.render, { item, field }) });
14688    }
14689    function TableRow2({
14690      item,
14691      fields,
14692      id,
14693      view,
14694      titleField,
14695      mediaField,
14696      descriptionField: descriptionField2,
14697      selection,
14698      getItemId,
14699      onChangeSelection,
14700      multiselect,
14701      posinset
14702    }) {
14703      const { paginationInfo } = (0, import_element39.useContext)(dataviews_context_default);
14704      const isSelected2 = selection.includes(id);
14705      const [isHovered, setIsHovered] = (0, import_element39.useState)(false);
14706      const elementRef = (0, import_element39.useRef)(null);
14707      useIntersectionObserver(elementRef, posinset);
14708      const {
14709        showTitle = true,
14710        showMedia = true,
14711        showDescription = true,
14712        infiniteScrollEnabled
14713      } = view;
14714      const handleMouseEnter = () => {
14715        setIsHovered(true);
14716      };
14717      const handleMouseLeave = () => {
14718        setIsHovered(false);
14719      };
14720      const columns = view.fields ?? [];
14721      const hasPrimaryColumn = titleField && showTitle || mediaField && showMedia || descriptionField2 && showDescription;
14722      return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
14723        import_components15.Composite.Item,
14724        {
14725          ref: elementRef,
14726          render: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
14727            "tr",
14728            {
14729              className: clsx_default("dataviews-view-table__row", {
14730                "is-selected": isSelected2,
14731                "is-hovered": isHovered
14732              }),
14733              onMouseEnter: handleMouseEnter,
14734              onMouseLeave: handleMouseLeave,
14735              children,
14736              ...props
14737            }
14738          ),
14739          "aria-selected": isSelected2,
14740          "aria-setsize": paginationInfo.totalItems || void 0,
14741          "aria-posinset": posinset,
14742          role: infiniteScrollEnabled ? "article" : "option",
14743          onMouseDown: (event) => {
14744            if (event.button !== 0) {
14745              return;
14746            }
14747            event.currentTarget.parentElement?.focus({
14748              preventScroll: true
14749            });
14750          },
14751          onClick: () => {
14752            if (isSelected2) {
14753              onChangeSelection(
14754                selection.filter((itemId) => id !== itemId)
14755              );
14756            } else {
14757              const newSelection = multiselect ? [...selection, id] : [id];
14758              onChangeSelection(newSelection);
14759            }
14760          },
14761          children: [
14762            /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
14763              "td",
14764              {
14765                className: "dataviews-view-table__checkbox-column",
14766                role: "presentation",
14767                children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: "dataviews-view-table__cell-content-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
14768                  DataViewsSelectionCheckbox,
14769                  {
14770                    item,
14771                    selection,
14772                    onChangeSelection,
14773                    getItemId,
14774                    titleField,
14775                    disabled: false,
14776                    "aria-hidden": true,
14777                    tabIndex: -1
14778                  }
14779                ) })
14780              }
14781            ),
14782            hasPrimaryColumn && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
14783              "td",
14784              {
14785                role: "presentation",
14786                children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
14787                  column_primary_default,
14788                  {
14789                    item,
14790                    titleField: showTitle ? titleField : void 0,
14791                    mediaField: showMedia ? mediaField : void 0,
14792                    descriptionField: showDescription ? descriptionField2 : void 0,
14793                    isItemClickable: () => false
14794                  }
14795                )
14796              }
14797            ),
14798            columns.map((column) => {
14799              const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {};
14800              return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
14801                "td",
14802                {
14803                  style: {
14804                    width,
14805                    maxWidth,
14806                    minWidth
14807                  },
14808                  role: "presentation",
14809                  children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
14810                    TableColumnField2,
14811                    {
14812                      fields,
14813                      item,
14814                      column,
14815                      align
14816                    }
14817                  )
14818                },
14819                column
14820              );
14821            })
14822          ]
14823        },
14824        id
14825      );
14826    }
14827    function ViewPickerTable({
14828      actions,
14829      data,
14830      fields,
14831      getItemId,
14832      isLoading = false,
14833      onChangeView,
14834      onChangeSelection,
14835      selection,
14836      setOpenedFilter,
14837      view,
14838      className,
14839      empty
14840    }) {
14841      const headerMenuRefs = (0, import_element39.useRef)(/* @__PURE__ */ new Map());
14842      const headerMenuToFocusRef = (0, import_element39.useRef)(void 0);
14843      const [nextHeaderMenuToFocus, setNextHeaderMenuToFocus] = (0, import_element39.useState)();
14844      const isMultiselect = useIsMultiselectPicker(actions) ?? false;
14845      (0, import_element39.useEffect)(() => {
14846        if (headerMenuToFocusRef.current) {
14847          headerMenuToFocusRef.current.focus();
14848          headerMenuToFocusRef.current = void 0;
14849        }
14850      });
14851      const groupField = view.groupBy?.field ? fields.find((f2) => f2.id === view.groupBy?.field) : null;
14852      const dataByGroup = groupField ? getDataByGroup(data, groupField) : null;
14853      const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup;
14854      const tableNoticeId = (0, import_element39.useId)();
14855      if (nextHeaderMenuToFocus) {
14856        headerMenuToFocusRef.current = nextHeaderMenuToFocus;
14857        setNextHeaderMenuToFocus(void 0);
14858        return;
14859      }
14860      const onHide = (field) => {
14861        const hidden = headerMenuRefs.current.get(field.id);
14862        const fallback = hidden ? headerMenuRefs.current.get(hidden.fallback) : void 0;
14863        setNextHeaderMenuToFocus(fallback?.node);
14864      };
14865      const hasData = !!data?.length;
14866      const titleField = fields.find((field) => field.id === view.titleField);
14867      const mediaField = fields.find((field) => field.id === view.mediaField);
14868      const descriptionField2 = fields.find(
14869        (field) => field.id === view.descriptionField
14870      );
14871      const { showTitle = true, showMedia = true, showDescription = true } = view;
14872      const hasPrimaryColumn = titleField && showTitle || mediaField && showMedia || descriptionField2 && showDescription;
14873      const columns = view.fields ?? [];
14874      const headerMenuRef = (column, index2) => (node) => {
14875        if (node) {
14876          headerMenuRefs.current.set(column, {
14877            node,
14878            fallback: columns[index2 > 0 ? index2 - 1 : 1]
14879          });
14880        } else {
14881          headerMenuRefs.current.delete(column);
14882        }
14883      };
14884      return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(import_jsx_runtime67.Fragment, { children: [
14885        /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
14886          "table",
14887          {
14888            className: clsx_default(
14889              "dataviews-view-table",
14890              "dataviews-view-picker-table",
14891              className,
14892              {
14893                [`has-$view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes(
14894                  view.layout.density
14895                )
14896              }
14897            ),
14898            "aria-busy": isLoading,
14899            "aria-describedby": tableNoticeId,
14900            role: isInfiniteScroll ? "feed" : "listbox",
14901            children: [
14902              /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("thead", { role: "presentation", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
14903                "tr",
14904                {
14905                  className: "dataviews-view-table__row",
14906                  role: "presentation",
14907                  children: [
14908                    /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("th", { className: "dataviews-view-table__checkbox-column", children: isMultiselect && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
14909                      BulkSelectionCheckbox,
14910                      {
14911                        selection,
14912                        onChangeSelection,
14913                        data,
14914                        actions,
14915                        getItemId,
14916                        disableSelectAll: isInfiniteScroll
14917                      }
14918                    ) }),
14919                    hasPrimaryColumn && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("th", { children: titleField && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
14920                      column_header_menu_default,
14921                      {
14922                        ref: headerMenuRef(
14923                          titleField.id,
14924                          0
14925                        ),
14926                        fieldId: titleField.id,
14927                        view,
14928                        fields,
14929                        onChangeView,
14930                        onHide,
14931                        setOpenedFilter,
14932                        canMove: false
14933                      }
14934                    ) }),
14935                    columns.map((column, index2) => {
14936                      const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {};
14937                      return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
14938                        "th",
14939                        {
14940                          style: {
14941                            width,
14942                            maxWidth,
14943                            minWidth,
14944                            textAlign: align
14945                          },
14946                          "aria-sort": view.sort?.direction && view.sort?.field === column ? sortValues[view.sort.direction] : void 0,
14947                          scope: "col",
14948                          children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
14949                            column_header_menu_default,
14950                            {
14951                              ref: headerMenuRef(column, index2),
14952                              fieldId: column,
14953                              view,
14954                              fields,
14955                              onChangeView,
14956                              onHide,
14957                              setOpenedFilter,
14958                              canMove: view.layout?.enableMoving ?? true
14959                            }
14960                          )
14961                        },
14962                        column
14963                      );
14964                    })
14965                  ]
14966                }
14967              ) }),
14968              hasData && groupField && dataByGroup ? Array.from(dataByGroup.entries()).map(
14969                ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
14970                  import_components15.Composite,
14971                  {
14972                    virtualFocus: true,
14973                    orientation: "vertical",
14974                    render: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("tbody", { role: "group" }),
14975                    children: [
14976                      /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
14977                        "tr",
14978                        {
14979                          className: "dataviews-view-table__group-header-row",
14980                          role: "presentation",
14981                          children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
14982                            "td",
14983                            {
14984                              colSpan: columns.length + (hasPrimaryColumn ? 1 : 0) + 1,
14985                              className: "dataviews-view-table__group-header-cell",
14986                              role: "presentation",
14987                              children: view.groupBy?.showLabel === false ? groupName : (0, import_i18n25.sprintf)(
14988                                // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022".
14989                                (0, import_i18n25.__)("%1$s: %2$s"),
14990                                groupField.label,
14991                                groupName
14992                              )
14993                            }
14994                          )
14995                        }
14996                      ),
14997                      groupItems.map((item, index2) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
14998                        TableRow2,
14999                        {
15000                          item,
15001                          fields,
15002                          id: getItemId(item) || index2.toString(),
15003                          view,
15004                          titleField,
15005                          mediaField,
15006                          descriptionField: descriptionField2,
15007                          selection,
15008                          getItemId,
15009                          onChangeSelection,
15010                          multiselect: isMultiselect
15011                        },
15012                        getItemId(item)
15013                      ))
15014                    ]
15015                  },
15016                  `group-$groupName}`
15017                )
15018              ) : /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
15019                import_components15.Composite,
15020                {
15021                  render: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("tbody", { role: "presentation" }),
15022                  virtualFocus: true,
15023                  orientation: "vertical",
15024                  children: hasData && data.map((item, index2) => {
15025                    const itemId = getItemId(item);
15026                    const posinset = item.position;
15027                    return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
15028                      TableRow2,
15029                      {
15030                        item,
15031                        fields,
15032                        id: itemId || index2.toString(),
15033                        view,
15034                        titleField,
15035                        mediaField,
15036                        descriptionField: descriptionField2,
15037                        selection,
15038                        getItemId,
15039                        onChangeSelection,
15040                        multiselect: isMultiselect,
15041                        posinset
15042                      },
15043                      itemId
15044                    );
15045                  })
15046                }
15047              )
15048            ]
15049          }
15050        ),
15051        /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
15052          "div",
15053          {
15054            className: clsx_default({
15055              "dataviews-loading": isLoading,
15056              "dataviews-no-results": !hasData && !isLoading
15057            }),
15058            id: tableNoticeId,
15059            children: [
15060              !hasData && (isLoading ? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_components15.Spinner, {}) }) : empty),
15061              hasData && isLoading && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_components15.Spinner, {}) })
15062            ]
15063          }
15064        )
15065      ] });
15066    }
15067    var picker_table_default = ViewPickerTable;
15068  
15069    // packages/dataviews/build-module/components/dataviews-layouts/picker-activity/index.mjs
15070    var import_components16 = __toESM(require_components(), 1);
15071    var import_element40 = __toESM(require_element(), 1);
15072    var import_compose7 = __toESM(require_compose(), 1);
15073    var import_i18n26 = __toESM(require_i18n(), 1);
15074    var import_jsx_runtime68 = __toESM(require_jsx_runtime(), 1);
15075    function isDefined4(item) {
15076      return !!item;
15077    }
15078    function PickerActivityItem({
15079      view,
15080      multiselect,
15081      selection,
15082      onChangeSelection,
15083      getItemId,
15084      item,
15085      titleField,
15086      mediaField,
15087      descriptionField: descriptionField2,
15088      otherFields,
15089      posinset,
15090      setsize
15091    }) {
15092      const elementRef = (0, import_element40.useRef)(null);
15093      useIntersectionObserver(elementRef, posinset);
15094      const { showTitle = true, showMedia = true, showDescription = true } = view;
15095      const id = getItemId(item);
15096      const isSelected2 = selection.includes(id);
15097      const density = view.layout?.density ?? "balanced";
15098      const mediaContent = showMedia && density !== "compact" && mediaField?.render ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
15099        mediaField.render,
15100        {
15101          item,
15102          field: mediaField,
15103          config: {
15104            sizes: density === "comfortable" ? "32px" : "24px"
15105          }
15106        }
15107      ) : null;
15108      const renderedMediaField = /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "dataviews-view-picker-activity__item-type-icon", children: mediaContent || /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
15109        "span",
15110        {
15111          className: "dataviews-view-picker-activity__item-bullet",
15112          "aria-hidden": "true"
15113        }
15114      ) });
15115      const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(titleField.render, { item, field: titleField }) : null;
15116      const renderedDescriptionField = showDescription && descriptionField2?.render ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(descriptionField2.render, { item, field: descriptionField2 }) : null;
15117      const verticalGap = (0, import_element40.useMemo)(() => {
15118        switch (density) {
15119          case "comfortable":
15120            return "md";
15121          default:
15122            return "sm";
15123        }
15124      }, [density]);
15125      return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
15126        import_components16.Composite.Item,
15127        {
15128          ref: elementRef,
15129          role: "option",
15130          "aria-label": titleField ? titleField.getValue({ item }) || void 0 : void 0,
15131          "aria-posinset": posinset,
15132          "aria-setsize": setsize,
15133          "aria-selected": isSelected2,
15134          className: clsx_default(
15135            "dataviews-view-picker-activity__item",
15136            density === "compact" && "is-compact",
15137            density === "balanced" && "is-balanced",
15138            density === "comfortable" && "is-comfortable",
15139            isSelected2 && "is-selected"
15140          ),
15141          onClick: () => {
15142            if (isSelected2) {
15143              onChangeSelection(
15144                selection.filter((itemId) => id !== itemId)
15145              );
15146            } else {
15147              const newSelection = multiselect ? [...selection, id] : [id];
15148              onChangeSelection(newSelection);
15149            }
15150          },
15151          render: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", {}),
15152          children: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(Stack, { direction: "row", gap: "lg", justify: "start", align: "flex-start", children: [
15153            /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
15154              Stack,
15155              {
15156                direction: "column",
15157                gap: "xs",
15158                align: "center",
15159                className: "dataviews-view-picker-activity__item-type",
15160                children: renderedMediaField
15161              }
15162            ),
15163            /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
15164              Stack,
15165              {
15166                direction: "column",
15167                gap: verticalGap,
15168                align: "flex-start",
15169                className: "dataviews-view-picker-activity__item-content",
15170                children: [
15171                  renderedTitleField && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "dataviews-view-picker-activity__item-title", children: renderedTitleField }),
15172                  renderedDescriptionField && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "dataviews-view-picker-activity__item-description", children: renderedDescriptionField }),
15173                  /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "dataviews-view-picker-activity__item-fields", children: otherFields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
15174                    "div",
15175                    {
15176                      className: "dataviews-view-picker-activity__item-field",
15177                      children: [
15178                        /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
15179                          VisuallyHidden,
15180                          {
15181                            render: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", {}),
15182                            className: "dataviews-view-picker-activity__item-field-label",
15183                            children: field.label
15184                          }
15185                        ),
15186                        /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "dataviews-view-picker-activity__item-field-value", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
15187                          field.render,
15188                          {
15189                            item,
15190                            field
15191                          }
15192                        ) })
15193                      ]
15194                    },
15195                    field.id
15196                  )) })
15197                ]
15198              }
15199            )
15200          ] })
15201        }
15202      );
15203    }
15204    function PickerActivityGroup({
15205      groupName,
15206      groupField,
15207      showLabel = true,
15208      children
15209    }) {
15210      const headerId = (0, import_compose7.useInstanceId)(
15211        PickerActivityGroup,
15212        "dataviews-view-picker-activity-group__header"
15213      );
15214      return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
15215        Stack,
15216        {
15217          direction: "column",
15218          role: "group",
15219          "aria-labelledby": headerId,
15220          className: "dataviews-view-picker-activity-group",
15221          children: [
15222            /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
15223              "h3",
15224              {
15225                className: "dataviews-view-picker-activity-group__header",
15226                id: headerId,
15227                children: showLabel ? (0, import_i18n26.sprintf)(
15228                  // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022".
15229                  (0, import_i18n26.__)("%1$s: %2$s"),
15230                  groupField.label,
15231                  groupName
15232                ) : groupName
15233              }
15234            ),
15235            children
15236          ]
15237        }
15238      );
15239    }
15240    function ViewPickerActivity({
15241      data,
15242      fields,
15243      getItemId,
15244      isLoading,
15245      onChangeSelection,
15246      selection,
15247      view,
15248      actions,
15249      className,
15250      empty
15251    }) {
15252      const { itemListLabel, paginationInfo } = (0, import_element40.useContext)(dataviews_context_default);
15253      const isMultiselect = useIsMultiselectPicker(actions);
15254      const titleField = fields.find(
15255        (field) => field.id === view?.titleField
15256      );
15257      const mediaField = fields.find(
15258        (field) => field.id === view?.mediaField
15259      );
15260      const descriptionField2 = fields.find(
15261        (field) => field.id === view?.descriptionField
15262      );
15263      const otherFields = (view?.fields ?? []).map((fieldId) => fields.find((f2) => fieldId === f2.id)).filter(isDefined4);
15264      const groupField = view.groupBy?.field ? fields.find((f2) => f2.id === view.groupBy?.field) : null;
15265      const dataByGroup = groupField ? getDataByGroup(data, groupField) : null;
15266      const isInfiniteScroll = (view.infiniteScrollEnabled && !dataByGroup) ?? false;
15267      const setsize = isInfiniteScroll ? paginationInfo?.totalItems : void 0;
15268      const hasData = !!data?.length;
15269      const isGrouped = !!(groupField && dataByGroup);
15270      const renderItem = (item) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
15271        PickerActivityItem,
15272        {
15273          view,
15274          multiselect: isMultiselect,
15275          selection,
15276          onChangeSelection,
15277          getItemId,
15278          item,
15279          titleField,
15280          mediaField,
15281          descriptionField: descriptionField2,
15282          otherFields,
15283          posinset: item.position,
15284          setsize
15285        },
15286        getItemId(item)
15287      );
15288      if (!hasData) {
15289        return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
15290          "div",
15291          {
15292            className: clsx_default({
15293              "dataviews-loading": isLoading,
15294              "dataviews-no-results": !isLoading
15295            }),
15296            children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_components16.Spinner, {}) }) : empty
15297          }
15298        );
15299      }
15300      return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(import_jsx_runtime68.Fragment, { children: [
15301        /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
15302          import_components16.Composite,
15303          {
15304            virtualFocus: true,
15305            orientation: "vertical",
15306            role: "listbox",
15307            "aria-multiselectable": isMultiselect,
15308            "aria-label": itemListLabel,
15309            "aria-busy": isLoading,
15310            render: isGrouped ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Stack, { direction: "column", gap: "sm" }) : void 0,
15311            className: clsx_default(
15312              "dataviews-view-picker-activity",
15313              className
15314            ),
15315            children: isGrouped && dataByGroup ? Array.from(dataByGroup.entries()).map(
15316              ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
15317                PickerActivityGroup,
15318                {
15319                  groupName,
15320                  groupField,
15321                  showLabel: view.groupBy?.showLabel !== false,
15322                  children: groupItems.map(renderItem)
15323                },
15324                groupName
15325              )
15326            ) : data.map(renderItem)
15327          }
15328        ),
15329        isLoading && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_components16.Spinner, {}) })
15330      ] });
15331    }
15332  
15333    // packages/dataviews/build-module/components/dataviews-layouts/utils/density-picker.mjs
15334    var import_components17 = __toESM(require_components(), 1);
15335    var import_i18n27 = __toESM(require_i18n(), 1);
15336    var import_element41 = __toESM(require_element(), 1);
15337    var import_jsx_runtime69 = __toESM(require_jsx_runtime(), 1);
15338    function DensityPicker() {
15339      const context = (0, import_element41.useContext)(dataviews_context_default);
15340      const view = context.view;
15341      return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
15342        import_components17.__experimentalToggleGroupControl,
15343        {
15344          label: (0, import_i18n27.__)("Density"),
15345          value: view.layout?.density || "balanced",
15346          onChange: (value) => {
15347            context.onChangeView({
15348              ...view,
15349              layout: {
15350                ...view.layout,
15351                density: value
15352              }
15353            });
15354          },
15355          isBlock: true,
15356          children: [
15357            /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
15358              import_components17.__experimentalToggleGroupControlOption,
15359              {
15360                value: "comfortable",
15361                label: (0, import_i18n27._x)(
15362                  "Comfortable",
15363                  "Density option for DataView layout"
15364                )
15365              },
15366              "comfortable"
15367            ),
15368            /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
15369              import_components17.__experimentalToggleGroupControlOption,
15370              {
15371                value: "balanced",
15372                label: (0, import_i18n27._x)("Balanced", "Density option for DataView layout")
15373              },
15374              "balanced"
15375            ),
15376            /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
15377              import_components17.__experimentalToggleGroupControlOption,
15378              {
15379                value: "compact",
15380                label: (0, import_i18n27._x)("Compact", "Density option for DataView layout")
15381              },
15382              "compact"
15383            )
15384          ]
15385        }
15386      );
15387    }
15388  
15389    // packages/dataviews/build-module/components/dataviews-layouts/utils/preview-size-picker.mjs
15390    var import_components18 = __toESM(require_components(), 1);
15391    var import_i18n28 = __toESM(require_i18n(), 1);
15392    var import_element42 = __toESM(require_element(), 1);
15393    var import_jsx_runtime70 = __toESM(require_jsx_runtime(), 1);
15394    var imageSizes2 = [
15395      {
15396        value: 120,
15397        breakpoint: 1
15398      },
15399      {
15400        value: 170,
15401        breakpoint: 1
15402      },
15403      {
15404        value: 230,
15405        breakpoint: 1
15406      },
15407      {
15408        value: 290,
15409        breakpoint: 1112
15410        // at minimum image width, 4 images display at this container size
15411      },
15412      {
15413        value: 350,
15414        breakpoint: 1636
15415        // at minimum image width, 6 images display at this container size
15416      },
15417      {
15418        value: 430,
15419        breakpoint: 588
15420        // at minimum image width, 2 images display at this container size
15421      }
15422    ];
15423    function PreviewSizePicker() {
15424      const context = (0, import_element42.useContext)(dataviews_context_default);
15425      const view = context.view;
15426      const breakValues = imageSizes2.filter((size4) => {
15427        return context.containerWidth >= size4.breakpoint;
15428      });
15429      const layoutPreviewSize = view.layout?.previewSize ?? 230;
15430      const previewSizeToUse = breakValues.map((size4, index2) => ({ ...size4, index: index2 })).filter((size4) => size4.value <= layoutPreviewSize).sort((a2, b2) => b2.value - a2.value)[0]?.index ?? 0;
15431      const marks = breakValues.map((size4, index2) => {
15432        return {
15433          value: index2
15434        };
15435      });
15436      return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
15437        import_components18.RangeControl,
15438        {
15439          showTooltip: false,
15440          label: (0, import_i18n28.__)("Preview size"),
15441          value: previewSizeToUse,
15442          min: 0,
15443          max: breakValues.length - 1,
15444          withInputField: false,
15445          onChange: (value = 0) => {
15446            context.onChangeView({
15447              ...view,
15448              layout: {
15449                ...view.layout,
15450                previewSize: breakValues[value].value
15451              }
15452            });
15453          },
15454          step: 1,
15455          marks
15456        }
15457      );
15458    }
15459  
15460    // packages/dataviews/build-module/components/dataviews-layouts/utils/grid-config-options.mjs
15461    var import_jsx_runtime71 = __toESM(require_jsx_runtime(), 1);
15462    function GridConfigOptions() {
15463      return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_jsx_runtime71.Fragment, { children: [
15464        /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(DensityPicker, {}),
15465        /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(PreviewSizePicker, {})
15466      ] });
15467    }
15468  
15469    // packages/dataviews/build-module/components/dataviews-layouts/index.mjs
15470    var VIEW_LAYOUTS = [
15471      {
15472        type: LAYOUT_TABLE,
15473        label: (0, import_i18n29.__)("Table"),
15474        component: table_default,
15475        icon: block_table_default,
15476        viewConfigOptions: DensityPicker
15477      },
15478      {
15479        type: LAYOUT_GRID,
15480        label: (0, import_i18n29.__)("Grid"),
15481        component: grid_default,
15482        icon: category_default,
15483        viewConfigOptions: GridConfigOptions
15484      },
15485      {
15486        type: LAYOUT_LIST,
15487        label: (0, import_i18n29.__)("List"),
15488        component: ViewList,
15489        icon: (0, import_i18n29.isRTL)() ? format_list_bullets_rtl_default : format_list_bullets_default,
15490        viewConfigOptions: DensityPicker
15491      },
15492      {
15493        type: LAYOUT_ACTIVITY,
15494        label: (0, import_i18n29.__)("Activity"),
15495        component: ViewActivity,
15496        icon: scheduled_default,
15497        viewConfigOptions: DensityPicker
15498      },
15499      {
15500        type: LAYOUT_PICKER_GRID,
15501        label: (0, import_i18n29.__)("Grid"),
15502        component: picker_grid_default,
15503        icon: category_default,
15504        viewConfigOptions: GridConfigOptions,
15505        isPicker: true
15506      },
15507      {
15508        type: LAYOUT_PICKER_TABLE,
15509        label: (0, import_i18n29.__)("Table"),
15510        component: picker_table_default,
15511        icon: block_table_default,
15512        viewConfigOptions: DensityPicker,
15513        isPicker: true
15514      },
15515      {
15516        type: LAYOUT_PICKER_ACTIVITY,
15517        label: (0, import_i18n29.__)("Activity"),
15518        component: ViewPickerActivity,
15519        icon: scheduled_default,
15520        viewConfigOptions: DensityPicker,
15521        isPicker: true
15522      }
15523    ];
15524  
15525    // packages/dataviews/build-module/components/dataviews-filters/filters.mjs
15526    var import_element50 = __toESM(require_element(), 1);
15527  
15528    // packages/dataviews/build-module/components/dataviews-filters/filter.mjs
15529    var import_components21 = __toESM(require_components(), 1);
15530    var import_i18n32 = __toESM(require_i18n(), 1);
15531    var import_element47 = __toESM(require_element(), 1);
15532  
15533    // node_modules/@ariakit/react-components/dist/focusable/focusable-context.js
15534    var import_react7 = __toESM(require_react(), 1);
15535    var FocusableContext = (0, import_react7.createContext)(true);
15536  
15537    // node_modules/@ariakit/utils/dist/index.js
15538    function toArray(arg) {
15539      if (Array.isArray(arg)) return arg;
15540      return typeof arg !== "undefined" ? [arg] : [];
15541    }
15542    function flatten2DArray(array) {
15543      const flattened = [];
15544      for (const row of array) flattened.push(...row);
15545      return flattened;
15546    }
15547    function reverseArray(array) {
15548      return array.slice().reverse();
15549    }
15550    function noop5(..._) {
15551    }
15552    function hasOwnProperty(object, prop) {
15553      if (typeof Object.hasOwn === "function") return Object.hasOwn(object, prop);
15554      return Object.prototype.hasOwnProperty.call(object, prop);
15555    }
15556    function chain(...fns) {
15557      return (...args) => {
15558        for (const fn of fns) if (typeof fn === "function") fn(...args);
15559      };
15560    }
15561    function normalizeString(str) {
15562      return str.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
15563    }
15564    function omit(object, keys) {
15565      const result = { ...object };
15566      for (const key of keys) if (hasOwnProperty(result, key)) delete result[key];
15567      return result;
15568    }
15569    function pick(object, paths) {
15570      const result = {};
15571      for (const key of paths) if (hasOwnProperty(object, key)) result[key] = object[key];
15572      return result;
15573    }
15574    function identity(value) {
15575      return value;
15576    }
15577    function afterPaint(cb = noop5) {
15578      let raf = requestAnimationFrame(() => {
15579        raf = requestAnimationFrame(cb);
15580      });
15581      return () => cancelAnimationFrame(raf);
15582    }
15583    function invariant(condition, message2) {
15584      if (condition) return;
15585      if (typeof message2 !== "string") throw new Error("Invariant failed");
15586      throw new Error(message2);
15587    }
15588    function getKeys(obj) {
15589      return Object.keys(obj);
15590    }
15591    function isFalsyBooleanCallback(booleanOrCallback, ...args) {
15592      const result = typeof booleanOrCallback === "function" ? booleanOrCallback(...args) : booleanOrCallback;
15593      if (result == null) return false;
15594      return !result;
15595    }
15596    function disabledFromProps(props) {
15597      return props.disabled || props["aria-disabled"] === true || props["aria-disabled"] === "true";
15598    }
15599    function removeUndefinedValues(obj) {
15600      const result = {};
15601      for (const key in obj) if (obj[key] !== void 0) result[key] = obj[key];
15602      return result;
15603    }
15604    function defaultValue(...values) {
15605      for (const value of values) if (value !== void 0) return value;
15606    }
15607    var canUseDOM = checkIsBrowser();
15608    function checkIsBrowser() {
15609      return typeof window !== "undefined" && !!window.document?.createElement;
15610    }
15611    function getDocument(node) {
15612      if (!node) return document;
15613      if ("self" in node) return node.document;
15614      return node.ownerDocument || document;
15615    }
15616    function getActiveElement(node, activeDescendant = false) {
15617      const { activeElement: activeElement2 } = getDocument(node);
15618      if (!activeElement2?.nodeName) return null;
15619      if (isFrame(activeElement2) && activeElement2.contentDocument?.body) return getActiveElement(activeElement2.contentDocument.body, activeDescendant);
15620      if (activeDescendant) {
15621        const id = activeElement2.getAttribute("aria-activedescendant");
15622        if (id) {
15623          const element = getDocument(activeElement2).getElementById(id);
15624          if (element) return element;
15625        }
15626      }
15627      return activeElement2;
15628    }
15629    function contains2(parent, child) {
15630      return parent === child || parent.contains(child);
15631    }
15632    function isElement2(target) {
15633      return target?.nodeType === 1;
15634    }
15635    function isNode2(target) {
15636      return typeof target?.nodeType === "number";
15637    }
15638    function isFrame(element) {
15639      return element.tagName === "IFRAME";
15640    }
15641    function isButton(element) {
15642      const tagName = element.tagName.toLowerCase();
15643      if (tagName === "button") return true;
15644      if (tagName === "input" && element.type) return buttonInputTypes.indexOf(element.type) !== -1;
15645      return false;
15646    }
15647    var buttonInputTypes = [
15648      "button",
15649      "color",
15650      "file",
15651      "image",
15652      "reset",
15653      "submit"
15654    ];
15655    function isVisible(element) {
15656      if (typeof element.checkVisibility === "function") return element.checkVisibility();
15657      const htmlElement = element;
15658      return htmlElement.offsetWidth > 0 || htmlElement.offsetHeight > 0 || element.getClientRects().length > 0;
15659    }
15660    function isTextField(element) {
15661      try {
15662        if (element.tagName === "TEXTAREA") return true;
15663        if (element.tagName !== "INPUT") return false;
15664        return element.selectionStart !== null;
15665      } catch (_error) {
15666        return false;
15667      }
15668    }
15669    function isTextbox(element) {
15670      return element.isContentEditable || isTextField(element);
15671    }
15672    function getTextboxValue(element) {
15673      if (isTextField(element)) return element.value;
15674      if (element.isContentEditable) {
15675        const range = getDocument(element).createRange();
15676        range.selectNodeContents(element);
15677        return range.toString();
15678      }
15679      return "";
15680    }
15681    function getTextboxSelection(element) {
15682      let start = 0;
15683      let end = 0;
15684      if (isTextField(element)) {
15685        start = element.selectionStart || 0;
15686        end = element.selectionEnd || 0;
15687      } else if (element.isContentEditable) {
15688        const selection = getDocument(element).getSelection();
15689        if (selection?.rangeCount && selection.anchorNode && contains2(element, selection.anchorNode) && selection.focusNode && contains2(element, selection.focusNode)) {
15690          const range = selection.getRangeAt(0);
15691          const nextRange = range.cloneRange();
15692          nextRange.selectNodeContents(element);
15693          nextRange.setEnd(range.startContainer, range.startOffset);
15694          start = nextRange.toString().length;
15695          nextRange.setEnd(range.endContainer, range.endOffset);
15696          end = nextRange.toString().length;
15697        }
15698      }
15699      return {
15700        start,
15701        end
15702      };
15703    }
15704    var allowedPopupRoles = [
15705      "dialog",
15706      "menu",
15707      "listbox",
15708      "tree",
15709      "grid"
15710    ];
15711    var itemRoleByPopupRole = {
15712      menu: "menuitem",
15713      listbox: "option",
15714      tree: "treeitem"
15715    };
15716    function getPopupRole(element, fallback) {
15717      const role = element?.getAttribute("role");
15718      if (role && allowedPopupRoles.indexOf(role) !== -1) return role;
15719      return fallback;
15720    }
15721    function getItemRoleByPopupRole(popupRole) {
15722      if (popupRole == null) return;
15723      if (!hasOwnProperty(itemRoleByPopupRole, popupRole)) return;
15724      return itemRoleByPopupRole[popupRole];
15725    }
15726    function getScrollingElement(element) {
15727      if (!element) return null;
15728      const isScrollableOverflow = (overflow) => {
15729        if (overflow === "auto") return true;
15730        if (overflow === "scroll") return true;
15731        return false;
15732      };
15733      if (element.clientHeight && element.scrollHeight > element.clientHeight) {
15734        const { overflowY } = getComputedStyle(element);
15735        if (isScrollableOverflow(overflowY)) return element;
15736      } else if (element.clientWidth && element.scrollWidth > element.clientWidth) {
15737        const { overflowX } = getComputedStyle(element);
15738        if (isScrollableOverflow(overflowX)) return element;
15739      }
15740      const doc = getDocument(element);
15741      return getScrollingElement(element.parentElement) || doc.scrollingElement || doc.body;
15742    }
15743    function setSelectionRange(element, ...args) {
15744      if (/text|search|password|tel|url/i.test(element.type)) element.setSelectionRange(...args);
15745    }
15746    function sortBasedOnDOMPosition(items, getElement) {
15747      const pairs = items.map((item, index2) => [index2, item]);
15748      let isOrderDifferent = false;
15749      pairs.sort(([indexA, a2], [indexB, b2]) => {
15750        const elementA = getElement(a2);
15751        const elementB = getElement(b2);
15752        if (elementA === elementB) return 0;
15753        if (!elementA || !elementB) return 0;
15754        if (isElementPreceding(elementA, elementB)) {
15755          if (indexA > indexB) isOrderDifferent = true;
15756          return -1;
15757        }
15758        if (indexA < indexB) isOrderDifferent = true;
15759        return 1;
15760      });
15761      if (isOrderDifferent) return pairs.map(([_, item]) => item);
15762      return items;
15763    }
15764    function isElementPreceding(a2, b2) {
15765      return Boolean(b2.compareDocumentPosition(a2) & Node.DOCUMENT_POSITION_PRECEDING);
15766    }
15767    function isTouchDevice() {
15768      return canUseDOM && !!navigator.maxTouchPoints;
15769    }
15770    function isApple() {
15771      if (!canUseDOM) return false;
15772      return /mac|iphone|ipad|ipod/i.test(navigator.platform);
15773    }
15774    function isSafari() {
15775      return canUseDOM && isApple() && /apple/i.test(navigator.vendor);
15776    }
15777    function isFirefox() {
15778      return canUseDOM && /firefox\//i.test(navigator.userAgent);
15779    }
15780    function isPortalEvent(event) {
15781      const { currentTarget, target } = event;
15782      if (!currentTarget) return false;
15783      if (!isNode2(target)) return true;
15784      return !contains2(currentTarget, target);
15785    }
15786    function isSelfTarget(event) {
15787      return event.target === event.currentTarget;
15788    }
15789    function isActivatableNavigationTarget(element) {
15790      if (!isElement2(element)) return false;
15791      const target = element;
15792      const tagName = target.tagName.toLowerCase();
15793      if (tagName === "a") return true;
15794      if (tagName === "button" && target.type === "submit") return true;
15795      if (tagName === "input" && target.type === "submit") return true;
15796      return false;
15797    }
15798    function isOpeningInNewTab(event) {
15799      const isAppleDevice = isApple();
15800      if (isAppleDevice && !event.metaKey) return false;
15801      if (!isAppleDevice && !event.ctrlKey) return false;
15802      return isActivatableNavigationTarget(event.currentTarget);
15803    }
15804    function isDownloading(event) {
15805      if (!event.altKey) return false;
15806      return isActivatableNavigationTarget(event.currentTarget);
15807    }
15808    function fireBlurEvent(element, eventInit) {
15809      const event = new FocusEvent("blur", eventInit);
15810      const defaultAllowed = element.dispatchEvent(event);
15811      const bubbleInit = {
15812        ...eventInit,
15813        bubbles: true
15814      };
15815      element.dispatchEvent(new FocusEvent("focusout", bubbleInit));
15816      return defaultAllowed;
15817    }
15818    function fireKeyboardEvent(element, type, eventInit) {
15819      const event = new KeyboardEvent(type, eventInit);
15820      return element.dispatchEvent(event);
15821    }
15822    function fireClickEvent(element, eventInit) {
15823      const event = new MouseEvent("click", eventInit);
15824      return element.dispatchEvent(event);
15825    }
15826    function isFocusEventOutside(event, container) {
15827      const containerElement = container || event.currentTarget;
15828      const relatedTarget = event.relatedTarget;
15829      return !isNode2(relatedTarget) || !contains2(containerElement, relatedTarget);
15830    }
15831    function isInputEvent(event) {
15832      return event.type === "input";
15833    }
15834    function queueBeforeEvent(element, type, callback, timeout) {
15835      const createTimer = (callback2) => {
15836        if (timeout) {
15837          const timerId2 = setTimeout(callback2, timeout);
15838          return () => clearTimeout(timerId2);
15839        }
15840        const timerId = requestAnimationFrame(callback2);
15841        return () => cancelAnimationFrame(timerId);
15842      };
15843      const cancelTimer = createTimer(() => {
15844        element.removeEventListener(type, callSync, true);
15845        callback();
15846      });
15847      const callSync = () => {
15848        cancelTimer();
15849        callback();
15850      };
15851      element.addEventListener(type, callSync, {
15852        once: true,
15853        capture: true
15854      });
15855      return () => {
15856        cancelTimer();
15857        element.removeEventListener(type, callSync, true);
15858      };
15859    }
15860    function addGlobalEventListener(type, listener, options, scope = window) {
15861      const children = [];
15862      try {
15863        scope.document.addEventListener(type, listener, options);
15864        for (const frame of Array.from(scope.frames)) children.push(addGlobalEventListener(type, listener, options, frame));
15865      } catch {
15866      }
15867      const removeEventListener = () => {
15868        try {
15869          scope.document.removeEventListener(type, listener, options);
15870        } catch {
15871        }
15872        for (const remove of children) remove();
15873      };
15874      return removeEventListener;
15875    }
15876    var selector = "input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], summary, iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])";
15877    function isFocusable(element) {
15878      if (!element.matches(selector)) return false;
15879      if (!isVisible(element)) return false;
15880      if (element.closest("[inert]")) return false;
15881      return true;
15882    }
15883    function hasFocus(element) {
15884      const activeElement2 = getActiveElement(element);
15885      if (!activeElement2) return false;
15886      if (activeElement2 === element) return true;
15887      const activeDescendant = activeElement2.getAttribute("aria-activedescendant");
15888      if (!activeDescendant) return false;
15889      return activeDescendant === element.id;
15890    }
15891    function hasFocusWithin(element) {
15892      const activeElement2 = getActiveElement(element);
15893      if (!activeElement2) return false;
15894      if (contains2(element, activeElement2)) return true;
15895      const activeDescendant = activeElement2.getAttribute("aria-activedescendant");
15896      if (!activeDescendant) return false;
15897      if (!("id" in element)) return false;
15898      if (activeDescendant === element.id) return true;
15899      return !!element.querySelector(`#$CSS.escape(activeDescendant)}`);
15900    }
15901    function focusIntoView(element, options) {
15902      if (!("scrollIntoView" in element)) element.focus();
15903      else {
15904        element.focus({ preventScroll: true });
15905        element.scrollIntoView({
15906          block: "nearest",
15907          inline: "nearest",
15908          ...options
15909        });
15910      }
15911    }
15912    function createUndoCallback(callback) {
15913      return async () => {
15914        const redo = await callback?.();
15915        return createUndoCallback(async () => {
15916          await redo?.();
15917          return callback;
15918        });
15919      };
15920    }
15921    var UndoManager = createUndoManager();
15922    function createUndoManager({ limit = 100 } = {}) {
15923      const undoStack = [];
15924      let redoStack = [];
15925      let currentGroup = null;
15926      const canUndo = () => undoStack.length > 0;
15927      const canRedo = () => redoStack.length > 0;
15928      const undo = async () => {
15929        if (!canUndo()) return;
15930        currentGroup = null;
15931        redoStack.push(await undoStack.pop()?.());
15932      };
15933      const redo = async () => {
15934        if (!canRedo()) return;
15935        currentGroup = null;
15936        undoStack.push(await redoStack.pop()?.());
15937      };
15938      const execute = async (callback, group) => {
15939        if (!callback) return;
15940        const sameGroup = group === currentGroup;
15941        currentGroup = group ?? null;
15942        const nextIndex = sameGroup ? Math.max(0, undoStack.length - 1) : undoStack.length;
15943        const undoCallback = await callback();
15944        if (!undoCallback) return;
15945        redoStack = [];
15946        const currentUndo = undoStack[nextIndex];
15947        undoStack[nextIndex] = createUndoCallback(async () => {
15948          await undoCallback?.();
15949          const currentRedo = await currentUndo?.();
15950          return async () => {
15951            await currentRedo?.();
15952            await callback?.();
15953          };
15954        });
15955        while (undoStack.length > limit) undoStack.shift();
15956      };
15957      return {
15958        canUndo,
15959        canRedo,
15960        undo,
15961        redo,
15962        execute
15963      };
15964    }
15965  
15966    // node_modules/@ariakit/react-utils/dist/index.js
15967    var React47 = __toESM(require_react(), 1);
15968    var import_react8 = __toESM(require_react(), 1);
15969    var import_jsx_runtime72 = __toESM(require_jsx_runtime(), 1);
15970    function setRef(ref, value) {
15971      if (typeof ref === "function") {
15972        const cleanup = ref(value);
15973        if (typeof cleanup === "function") return cleanup;
15974      } else if (ref) ref.current = value;
15975    }
15976    function isValidElementWithRef(element) {
15977      if (!element) return false;
15978      if (!(0, import_react8.isValidElement)(element)) return false;
15979      if ("ref" in element.props) return true;
15980      if ("ref" in element) return true;
15981      return false;
15982    }
15983    function getRefProperty(element) {
15984      if (!isValidElementWithRef(element)) return null;
15985      return { ...element.props }.ref || element.ref;
15986    }
15987    function mergeProps2(base, overrides) {
15988      const props = { ...base };
15989      for (const key in overrides) {
15990        if (!hasOwnProperty(overrides, key)) continue;
15991        if (key === "className") {
15992          const prop = "className";
15993          const baseClass = base[prop];
15994          const overrideClass = overrides[prop];
15995          if (baseClass && overrideClass) props[prop] = `$baseClass} $overrideClass}`;
15996          else props[prop] = overrideClass || baseClass;
15997          continue;
15998        }
15999        if (key === "style") {
16000          const prop = "style";
16001          props[prop] = base[prop] ? {
16002            ...base[prop],
16003            ...overrides[prop]
16004          } : overrides[prop];
16005          continue;
16006        }
16007        const overrideValue = overrides[key];
16008        if (key.startsWith("on")) {
16009          if (typeof overrideValue !== "function") continue;
16010          const baseValue = base[key];
16011          if (typeof baseValue === "function") {
16012            props[key] = (...args) => {
16013              overrideValue(...args);
16014              baseValue(...args);
16015            };
16016            continue;
16017          }
16018        }
16019        props[key] = overrideValue;
16020      }
16021      return props;
16022    }
16023    var _React = { ...React47 };
16024    var useReactId = _React.useId;
16025    var useReactDeferredValue = _React.useDeferredValue;
16026    var useReactInsertionEffect = _React.useInsertionEffect;
16027    var useSafeLayoutEffect = canUseDOM ? import_react8.useLayoutEffect : import_react8.useEffect;
16028    function useInitialValue(value) {
16029      const [initialValue] = (0, import_react8.useState)(value);
16030      return initialValue;
16031    }
16032    function useLiveRef(value) {
16033      const ref = (0, import_react8.useRef)(value);
16034      useSafeLayoutEffect(() => {
16035        ref.current = value;
16036      });
16037      return ref;
16038    }
16039    function useEvent(callback) {
16040      const ref = (0, import_react8.useRef)(() => {
16041        throw new Error("Cannot call an event handler while rendering.");
16042      });
16043      if (useReactInsertionEffect) useReactInsertionEffect(() => {
16044        ref.current = callback;
16045      });
16046      else ref.current = callback;
16047      return (0, import_react8.useCallback)((...args) => ref.current?.(...args), []);
16048    }
16049    function useTransactionState(callback) {
16050      const [state, setState] = (0, import_react8.useState)(null);
16051      useSafeLayoutEffect(() => {
16052        if (state == null) return;
16053        if (!callback) return;
16054        let prevState = null;
16055        callback((prev) => {
16056          prevState = prev;
16057          return state;
16058        });
16059        return () => {
16060          callback(prevState);
16061        };
16062      }, [state, callback]);
16063      return [state, setState];
16064    }
16065    function useMergeRefs(...refs) {
16066      return (0, import_react8.useMemo)(() => {
16067        if (!refs.some(Boolean)) return;
16068        return (value) => {
16069          const refEffects = [];
16070          for (const ref of refs) {
16071            if (!ref) continue;
16072            const cleanup = setRef(ref, value);
16073            refEffects.push({
16074              ref,
16075              cleanup: typeof cleanup === "function" ? cleanup : void 0
16076            });
16077          }
16078          if (!refEffects.some((effect) => effect.cleanup)) return;
16079          return () => {
16080            for (const { ref, cleanup } of refEffects) if (cleanup) cleanup();
16081            else setRef(ref, null);
16082          };
16083        };
16084      }, refs);
16085    }
16086    function useId4(defaultId) {
16087      if (useReactId) {
16088        const reactId = useReactId();
16089        if (defaultId) return defaultId;
16090        return reactId;
16091      }
16092      const [id, setId] = (0, import_react8.useState)(defaultId);
16093      useSafeLayoutEffect(() => {
16094        if (defaultId || id) return;
16095        setId(`id-$Math.random().toString(36).slice(2, 8)}`);
16096      }, [defaultId, id]);
16097      return defaultId || id;
16098    }
16099    function useTagName(refOrElement, type) {
16100      const stringOrUndefined = (type2) => {
16101        if (typeof type2 !== "string") return;
16102        return type2;
16103      };
16104      const [tagName, setTagName] = (0, import_react8.useState)(() => stringOrUndefined(type));
16105      useSafeLayoutEffect(() => {
16106        setTagName((refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement)?.tagName.toLowerCase() || stringOrUndefined(type));
16107      }, [refOrElement, type]);
16108      return tagName;
16109    }
16110    function useAttribute(refOrElement, attributeName, defaultValue2) {
16111      const initialValue = useInitialValue(defaultValue2);
16112      const [attribute, setAttribute] = (0, import_react8.useState)(initialValue);
16113      (0, import_react8.useEffect)(() => {
16114        const element = refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement;
16115        if (!element) return;
16116        const callback = () => {
16117          const value = element.getAttribute(attributeName);
16118          setAttribute(value == null ? initialValue : value);
16119        };
16120        const observer = new MutationObserver(callback);
16121        observer.observe(element, { attributeFilter: [attributeName] });
16122        callback();
16123        return () => observer.disconnect();
16124      }, [
16125        refOrElement,
16126        attributeName,
16127        initialValue
16128      ]);
16129      return attribute;
16130    }
16131    function useUpdateEffect(effect, deps) {
16132      const mounted = (0, import_react8.useRef)(false);
16133      (0, import_react8.useEffect)(() => {
16134        if (mounted.current) return effect();
16135        mounted.current = true;
16136      }, deps);
16137      (0, import_react8.useEffect)(() => () => {
16138        mounted.current = false;
16139      }, []);
16140    }
16141    function useUpdateLayoutEffect(effect, deps) {
16142      const mounted = (0, import_react8.useRef)(false);
16143      useSafeLayoutEffect(() => {
16144        if (mounted.current) return effect();
16145        mounted.current = true;
16146      }, deps);
16147      useSafeLayoutEffect(() => () => {
16148        mounted.current = false;
16149      }, []);
16150    }
16151    function useForceUpdate() {
16152      return (0, import_react8.useReducer)(() => [], []);
16153    }
16154    function useBooleanEvent(booleanOrCallback) {
16155      return useEvent(typeof booleanOrCallback === "function" ? booleanOrCallback : () => booleanOrCallback);
16156    }
16157    function useWrapElement(props, callback, deps = []) {
16158      const wrapElement = (0, import_react8.useCallback)((element) => {
16159        if (props.wrapElement) element = props.wrapElement(element);
16160        return callback(element);
16161      }, [...deps, props.wrapElement]);
16162      return {
16163        ...props,
16164        wrapElement
16165      };
16166    }
16167    function useMetadataProps(props, key, value) {
16168      const parent = props.onLoadedMetadataCapture;
16169      const onLoadedMetadataCapture = (0, import_react8.useMemo)(() => {
16170        return Object.assign(() => {
16171        }, parent, ...value !== void 0 ? [{ [key]: value }] : []);
16172      }, [
16173        parent,
16174        key,
16175        value
16176      ]);
16177      return [parent?.[key], { onLoadedMetadataCapture }];
16178    }
16179    var hasInstalledGlobalEventListeners = false;
16180    function useIsMouseMoving() {
16181      (0, import_react8.useEffect)(() => {
16182        if (hasInstalledGlobalEventListeners) return;
16183        addGlobalEventListener("mousemove", setMouseMoving, true);
16184        addGlobalEventListener("mousedown", resetMouseMoving, true);
16185        addGlobalEventListener("mouseup", resetMouseMoving, true);
16186        addGlobalEventListener("keydown", resetMouseMoving, true);
16187        addGlobalEventListener("scroll", resetMouseMoving, true);
16188        hasInstalledGlobalEventListeners = true;
16189      }, []);
16190      return useEvent(() => mouseMoving);
16191    }
16192    var mouseMoving = false;
16193    var previousScreenX = 0;
16194    var previousScreenY = 0;
16195    function hasMouseMovement(event) {
16196      const movementX = event.movementX || event.screenX - previousScreenX;
16197      const movementY = event.movementY || event.screenY - previousScreenY;
16198      previousScreenX = event.screenX;
16199      previousScreenY = event.screenY;
16200      return movementX || movementY || false;
16201    }
16202    function setMouseMoving(event) {
16203      if (!hasMouseMovement(event)) return;
16204      mouseMoving = true;
16205    }
16206    function resetMouseMoving() {
16207      mouseMoving = false;
16208    }
16209    function forwardRef21(render4) {
16210      const Role = React47.forwardRef((props, ref) => render4({
16211        ...props,
16212        ref
16213      }));
16214      Role.displayName = render4.displayName || render4.name;
16215      return Role;
16216    }
16217    function memo3(Component2, propsAreEqual) {
16218      return React47.memo(Component2, propsAreEqual);
16219    }
16220    function createElement3(Type, props) {
16221      const { wrapElement, render: render4, ...rest } = props;
16222      const mergedRef = useMergeRefs(props.ref, getRefProperty(render4));
16223      let element;
16224      if (React47.isValidElement(render4)) {
16225        const renderProps = {
16226          ...render4.props,
16227          ref: mergedRef
16228        };
16229        element = React47.cloneElement(render4, mergeProps2(rest, renderProps));
16230      } else if (render4) element = render4(rest);
16231      else element = /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Type, { ...rest });
16232      if (wrapElement) return wrapElement(element);
16233      return element;
16234    }
16235    function createHook(useProps) {
16236      const useRole = (props = {}) => {
16237        return useProps(props);
16238      };
16239      useRole.displayName = useProps.name;
16240      return useRole;
16241    }
16242    function createStoreContext(providers = [], scopedProviders = []) {
16243      const context = React47.createContext(void 0);
16244      const scopedContext = React47.createContext(void 0);
16245      const useContext37 = () => React47.useContext(context);
16246      const useScopedContext = (onlyScoped = false) => {
16247        const scoped = React47.useContext(scopedContext);
16248        const store = useContext37();
16249        if (onlyScoped) return scoped;
16250        return scoped || store;
16251      };
16252      const useProviderContext = () => {
16253        const scoped = React47.useContext(scopedContext);
16254        const store = useContext37();
16255        if (scoped && scoped === store) return;
16256        return store;
16257      };
16258      const ContextProvider = (props) => {
16259        return providers.reduceRight((children, Provider2) => /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Provider2, {
16260          ...props,
16261          children
16262        }), /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(context.Provider, { ...props }));
16263      };
16264      const ScopedContextProvider = (props) => {
16265        return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ContextProvider, {
16266          ...props,
16267          children: scopedProviders.reduceRight((children, Provider2) => /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Provider2, {
16268            ...props,
16269            children
16270          }), /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(scopedContext.Provider, { ...props }))
16271        });
16272      };
16273      return {
16274        context,
16275        scopedContext,
16276        useContext: useContext37,
16277        useScopedContext,
16278        useProviderContext,
16279        ContextProvider,
16280        ScopedContextProvider
16281      };
16282    }
16283  
16284    // node_modules/@ariakit/react-components/dist/focusable/focusable.js
16285    var import_react9 = __toESM(require_react(), 1);
16286    var TagName = "div";
16287    var accessibleWhenDisabledSymbol = /* @__PURE__ */ Symbol("accessibleWhenDisabled");
16288    var isSafariBrowser = isSafari();
16289    var alwaysFocusVisibleInputTypes = [
16290      "text",
16291      "search",
16292      "url",
16293      "tel",
16294      "email",
16295      "password",
16296      "number",
16297      "date",
16298      "month",
16299      "week",
16300      "time",
16301      "datetime",
16302      "datetime-local"
16303    ];
16304    function isAlwaysFocusVisible(element) {
16305      const { tagName, readOnly, type } = element;
16306      if (tagName === "TEXTAREA" && !readOnly) return true;
16307      if (tagName === "SELECT" && !readOnly) return true;
16308      if (tagName === "INPUT" && !readOnly) return alwaysFocusVisibleInputTypes.includes(type);
16309      if (element.isContentEditable) return true;
16310      if (element.getAttribute("role") === "combobox" && element.dataset.name) return true;
16311      return false;
16312    }
16313    function isNativeTabbable(tagName) {
16314      if (!tagName) return true;
16315      return tagName === "button" || tagName === "summary" || tagName === "input" || tagName === "select" || tagName === "textarea" || tagName === "a";
16316    }
16317    function supportsDisabledAttribute(tagName) {
16318      if (!tagName) return true;
16319      return tagName === "button" || tagName === "input" || tagName === "select" || tagName === "textarea";
16320    }
16321    function isNativeSubmitControl(element) {
16322      if (element.tagName === "BUTTON") {
16323        const { type } = element;
16324        return type === "submit";
16325      }
16326      if (element.tagName === "INPUT") {
16327        const { type } = element;
16328        return type === "submit" || type === "image";
16329      }
16330      return false;
16331    }
16332    function getTabIndex2({ focusable: focusable2, trulyDisabled, nativeTabbable, supportsDisabled, safariTabIndex, tabIndexProp }) {
16333      if (!focusable2) return tabIndexProp;
16334      if (trulyDisabled) {
16335        if (nativeTabbable && !supportsDisabled) return -1;
16336        return;
16337      }
16338      if (nativeTabbable) {
16339        if (safariTabIndex && tabIndexProp == null) return 0;
16340        return tabIndexProp;
16341      }
16342      return tabIndexProp ?? 0;
16343    }
16344    function useDisableEvent(onEvent, disabled2) {
16345      return useEvent((event) => {
16346        onEvent?.(event);
16347        if (event.defaultPrevented) return;
16348        if (disabled2) {
16349          event.stopPropagation();
16350          event.preventDefault();
16351        }
16352      });
16353    }
16354    var hasInstalledGlobalEventListeners2 = false;
16355    var isKeyboardModality = true;
16356    function onGlobalMouseDown(event) {
16357      const target = event.target;
16358      if (isElement2(target) && !target.hasAttribute("data-focus-visible")) isKeyboardModality = false;
16359    }
16360    function onGlobalKeyDown(event) {
16361      if (event.metaKey) return;
16362      if (event.ctrlKey) return;
16363      if (event.altKey) return;
16364      isKeyboardModality = true;
16365    }
16366    var useFocusable = createHook(function useFocusable2({ focusable: focusable2 = true, accessibleWhenDisabled, autoFocus, onFocusVisible, ...props }) {
16367      const ref = (0, import_react9.useRef)(null);
16368      const [parentAccessibleWhenDisabled, metadataProps] = useMetadataProps(props, accessibleWhenDisabledSymbol, accessibleWhenDisabled);
16369      accessibleWhenDisabled ??= parentAccessibleWhenDisabled;
16370      (0, import_react9.useEffect)(() => {
16371        if (!focusable2) return;
16372        if (hasInstalledGlobalEventListeners2) return;
16373        addGlobalEventListener("mousedown", onGlobalMouseDown, true);
16374        addGlobalEventListener("keydown", onGlobalKeyDown, true);
16375        hasInstalledGlobalEventListeners2 = true;
16376      }, [focusable2]);
16377      const disabled2 = focusable2 && disabledFromProps(props);
16378      const trulyDisabled = disabled2 && !accessibleWhenDisabled;
16379      const [focusVisible, setFocusVisible] = (0, import_react9.useState)(false);
16380      const focusVisibleRef = (0, import_react9.useRef)(false);
16381      const nativeSubmitObserverCleanupRef = (0, import_react9.useRef)(null);
16382      const cleanupFocusVisible = useEvent((element) => {
16383        nativeSubmitObserverCleanupRef.current?.();
16384        nativeSubmitObserverCleanupRef.current = null;
16385        focusVisibleRef.current = false;
16386        element?.removeAttribute("data-focus-visible");
16387      });
16388      (0, import_react9.useEffect)(() => {
16389        if (!focusable2) return;
16390        if (!trulyDisabled) return;
16391        cleanupFocusVisible(ref.current);
16392        if (focusVisible) setFocusVisible(false);
16393      }, [
16394        focusable2,
16395        trulyDisabled,
16396        focusVisible,
16397        cleanupFocusVisible
16398      ]);
16399      (0, import_react9.useEffect)(() => {
16400        if (!focusable2) return;
16401        if (!focusVisible) return;
16402        const element = ref.current;
16403        if (!element) return;
16404        if (typeof IntersectionObserver === "undefined") return;
16405        const observer = new IntersectionObserver(() => {
16406          if (!isFocusable(element)) {
16407            focusVisibleRef.current = false;
16408            setFocusVisible(false);
16409          }
16410        });
16411        observer.observe(element);
16412        return () => observer.disconnect();
16413      }, [focusable2, focusVisible]);
16414      (0, import_react9.useEffect)(() => {
16415        return () => nativeSubmitObserverCleanupRef.current?.();
16416      }, []);
16417      const onKeyPressCapture = useDisableEvent(props.onKeyPressCapture, disabled2);
16418      const onMouseDownCapture = useDisableEvent(props.onMouseDownCapture, disabled2);
16419      const onClickCapture = useDisableEvent(props.onClickCapture, disabled2);
16420      const handleFocusVisible = (event, currentTarget) => {
16421        if (currentTarget) event.currentTarget = currentTarget;
16422        if (!focusable2) return;
16423        const element = event.currentTarget;
16424        if (!element) return;
16425        if (!hasFocus(element)) return;
16426        onFocusVisible?.(event);
16427        if (event.defaultPrevented) return;
16428        element.dataset.focusVisible = "true";
16429        focusVisibleRef.current = true;
16430        if (isNativeSubmitControl(element)) {
16431          nativeSubmitObserverCleanupRef.current?.();
16432          nativeSubmitObserverCleanupRef.current = null;
16433          if (typeof IntersectionObserver !== "undefined") {
16434            const observer = new IntersectionObserver(() => {
16435              if (isFocusable(element)) return;
16436              cleanupFocusVisible(element);
16437            });
16438            observer.observe(element);
16439            nativeSubmitObserverCleanupRef.current = () => observer.disconnect();
16440          }
16441          return;
16442        }
16443        setFocusVisible(true);
16444      };
16445      const onKeyDownCaptureProp = props.onKeyDownCapture;
16446      const onKeyDownCapture = useEvent((event) => {
16447        onKeyDownCaptureProp?.(event);
16448        if (event.defaultPrevented) return;
16449        if (!focusable2) return;
16450        if (focusVisible) return;
16451        if (focusVisibleRef.current) return;
16452        if (event.metaKey) return;
16453        if (event.altKey) return;
16454        if (event.ctrlKey) return;
16455        if (!isSelfTarget(event)) return;
16456        const element = event.currentTarget;
16457        const applyFocusVisible = () => handleFocusVisible(event, element);
16458        queueBeforeEvent(element, "focusout", applyFocusVisible);
16459      });
16460      const onFocusCaptureProp = props.onFocusCapture;
16461      const onFocusCapture = useEvent((event) => {
16462        onFocusCaptureProp?.(event);
16463        if (event.defaultPrevented) return;
16464        if (!focusable2) return;
16465        if (!isSelfTarget(event)) {
16466          setFocusVisible(false);
16467          return;
16468        }
16469        const element = event.currentTarget;
16470        const applyFocusVisible = () => handleFocusVisible(event, element);
16471        if (isKeyboardModality || isAlwaysFocusVisible(event.target)) queueBeforeEvent(event.target, "focusout", applyFocusVisible);
16472        else setFocusVisible(false);
16473      });
16474      const onBlurProp = props.onBlur;
16475      const onBlur = useEvent((event) => {
16476        onBlurProp?.(event);
16477        if (!focusable2) return;
16478        if (!isFocusEventOutside(event)) return;
16479        cleanupFocusVisible(event.currentTarget);
16480        setFocusVisible(false);
16481      });
16482      const autoFocusOnShow = (0, import_react9.useContext)(FocusableContext);
16483      const autoFocusRef = useEvent((element) => {
16484        if (!focusable2) return;
16485        if (!autoFocus) return;
16486        if (!element) return;
16487        if (!autoFocusOnShow) return;
16488        queueMicrotask(() => {
16489          if (hasFocus(element)) return;
16490          if (!isFocusable(element)) return;
16491          element.focus();
16492        });
16493      });
16494      const tagName = useTagName(ref);
16495      const nativeTabbable = focusable2 && isNativeTabbable(tagName);
16496      const supportsDisabled = focusable2 && supportsDisabledAttribute(tagName);
16497      const [safariTabIndex, setSafariTabIndex] = (0, import_react9.useState)(false);
16498      if (isSafariBrowser) (0, import_react9.useEffect)(() => {
16499        if (!focusable2) return;
16500        const element = ref.current;
16501        if (!element) return;
16502        const { type } = element;
16503        const isNativeCheckboxOrRadio = element.tagName === "INPUT" && (type === "checkbox" || type === "radio");
16504        setSafariTabIndex(isButton(element) || isNativeCheckboxOrRadio);
16505      }, [focusable2]);
16506      const styleProp = props.style;
16507      const style = (0, import_react9.useMemo)(() => {
16508        if (trulyDisabled) return {
16509          pointerEvents: "none",
16510          ...styleProp
16511        };
16512        return styleProp;
16513      }, [trulyDisabled, styleProp]);
16514      props = {
16515        "data-focus-visible": focusable2 && focusVisible || void 0,
16516        "data-autofocus": autoFocus || void 0,
16517        "aria-disabled": disabled2 || void 0,
16518        ...props,
16519        ...metadataProps,
16520        ref: useMergeRefs(ref, autoFocusRef, props.ref),
16521        style,
16522        tabIndex: getTabIndex2({
16523          focusable: focusable2,
16524          trulyDisabled,
16525          nativeTabbable,
16526          supportsDisabled,
16527          safariTabIndex,
16528          tabIndexProp: props.tabIndex
16529        }),
16530        disabled: supportsDisabled && trulyDisabled ? true : void 0,
16531        contentEditable: disabled2 ? void 0 : props.contentEditable,
16532        onKeyPressCapture,
16533        onClickCapture,
16534        onMouseDownCapture,
16535        onKeyDownCapture,
16536        onFocusCapture,
16537        onBlur
16538      };
16539      return removeUndefinedValues(props);
16540    });
16541    var Focusable = forwardRef21(function Focusable2(props) {
16542      return createElement3(TagName, useFocusable(props));
16543    });
16544  
16545    // node_modules/@ariakit/react-components/dist/command/command.js
16546    var import_react10 = __toESM(require_react(), 1);
16547    var TagName2 = "button";
16548    function isNativeClick(event) {
16549      if (!event.isTrusted) return false;
16550      const element = event.currentTarget;
16551      if (event.key === "Enter") return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "A";
16552      if (event.key === " ") return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "INPUT" || element.tagName === "SELECT";
16553      return false;
16554    }
16555    var symbol = /* @__PURE__ */ Symbol("command");
16556    var useCommand = createHook(function useCommand2({ clickOnEnter = true, clickOnSpace = true, ...props }) {
16557      const ref = (0, import_react10.useRef)(null);
16558      const [isNativeButton, setIsNativeButton] = (0, import_react10.useState)(false);
16559      (0, import_react10.useEffect)(() => {
16560        if (!ref.current) return;
16561        setIsNativeButton(isButton(ref.current));
16562      }, []);
16563      const [active, setActive] = (0, import_react10.useState)(false);
16564      const activeRef = (0, import_react10.useRef)(false);
16565      const disabled2 = disabledFromProps(props);
16566      const [isDuplicate, metadataProps] = useMetadataProps(props, symbol, true);
16567      useSafeLayoutEffect(() => {
16568        if (!disabled2) return;
16569        activeRef.current = false;
16570        setActive(false);
16571      }, [disabled2]);
16572      const onKeyDownProp = props.onKeyDown;
16573      const onKeyDown = useEvent((event) => {
16574        onKeyDownProp?.(event);
16575        const element = event.currentTarget;
16576        if (event.defaultPrevented) return;
16577        if (isDuplicate) return;
16578        if (disabled2) return;
16579        if (!isSelfTarget(event)) return;
16580        if (isTextField(element)) return;
16581        if (element.isContentEditable) return;
16582        const isEnter = clickOnEnter && event.key === "Enter";
16583        const isSpace = clickOnSpace && event.key === " ";
16584        const shouldPreventEnter = event.key === "Enter" && !clickOnEnter;
16585        const shouldPreventSpace = event.key === " " && !clickOnSpace;
16586        if (shouldPreventEnter || shouldPreventSpace) {
16587          event.preventDefault();
16588          return;
16589        }
16590        if (isEnter || isSpace) {
16591          const nativeClick = isNativeClick(event);
16592          if (isEnter) {
16593            if (!nativeClick) {
16594              event.preventDefault();
16595              const { view, ...eventInit } = event;
16596              const click = () => fireClickEvent(element, eventInit);
16597              if (isFirefox()) queueBeforeEvent(element, "keyup", click);
16598              else queueMicrotask(click);
16599            }
16600          } else if (isSpace) {
16601            activeRef.current = true;
16602            if (!nativeClick) {
16603              event.preventDefault();
16604              setActive(true);
16605            }
16606          }
16607        }
16608      });
16609      const onKeyUpProp = props.onKeyUp;
16610      const onKeyUp = useEvent((event) => {
16611        onKeyUpProp?.(event);
16612        if (isDuplicate) return;
16613        const isSpace = clickOnSpace && event.key === " ";
16614        if (!activeRef.current || !isSpace) return;
16615        const nativeClick = isNativeClick(event);
16616        activeRef.current = false;
16617        if (!nativeClick) setActive(false);
16618        if (event.defaultPrevented) return;
16619        if (!isSelfTarget(event)) return;
16620        if (disabled2) return;
16621        if (event.metaKey) return;
16622        if (nativeClick) return;
16623        event.preventDefault();
16624        const element = event.currentTarget;
16625        const { view, ...eventInit } = event;
16626        queueMicrotask(() => fireClickEvent(element, eventInit));
16627      });
16628      const onBlurProp = props.onBlur;
16629      const onBlur = useEvent((event) => {
16630        onBlurProp?.(event);
16631        if (!activeRef.current) return;
16632        activeRef.current = false;
16633        setActive(false);
16634      });
16635      props = {
16636        "data-active": active || void 0,
16637        type: isNativeButton ? "button" : void 0,
16638        ...metadataProps,
16639        ...props,
16640        ref: useMergeRefs(ref, props.ref),
16641        onKeyDown,
16642        onKeyUp,
16643        onBlur
16644      };
16645      props = useFocusable(props);
16646      return props;
16647    });
16648    var Command = forwardRef21(function Command2(props) {
16649      return createElement3(TagName2, useCommand(props));
16650    });
16651  
16652    // node_modules/@ariakit/react-components/dist/collection/collection-context.js
16653    var ctx = createStoreContext();
16654    var useCollectionContext = ctx.useContext;
16655    var useCollectionScopedContext = ctx.useScopedContext;
16656    var useCollectionProviderContext = ctx.useProviderContext;
16657    var CollectionContextProvider = ctx.ContextProvider;
16658    var CollectionScopedContextProvider = ctx.ScopedContextProvider;
16659  
16660    // node_modules/@ariakit/react-components/dist/collection/collection-item.js
16661    var import_react11 = __toESM(require_react(), 1);
16662    var TagName3 = "div";
16663    var useCollectionItem = createHook(function useCollectionItem2({ store, shouldRegisterItem = true, getItem = identity, element, ...props }) {
16664      const context = useCollectionContext();
16665      store = store || context;
16666      const id = useId4(props.id);
16667      const ref = (0, import_react11.useRef)(element);
16668      (0, import_react11.useEffect)(() => {
16669        const element2 = ref.current;
16670        if (!id) return;
16671        if (!element2) return;
16672        if (!shouldRegisterItem) return;
16673        const item = getItem({
16674          id,
16675          element: element2
16676        });
16677        return store?.renderItem(item);
16678      }, [
16679        id,
16680        shouldRegisterItem,
16681        getItem,
16682        store
16683      ]);
16684      props = {
16685        ...props,
16686        ref: useMergeRefs(ref, props.ref)
16687      };
16688      return removeUndefinedValues(props);
16689    });
16690    var CollectionItem = forwardRef21(function CollectionItem2(props) {
16691      return createElement3(TagName3, useCollectionItem(props));
16692    });
16693  
16694    // node_modules/@ariakit/react-components/dist/composite/composite-context.js
16695    var import_react12 = __toESM(require_react(), 1);
16696    var ctx2 = createStoreContext([CollectionContextProvider], [CollectionScopedContextProvider]);
16697    var useCompositeContext = ctx2.useContext;
16698    var useCompositeScopedContext = ctx2.useScopedContext;
16699    var useCompositeProviderContext = ctx2.useProviderContext;
16700    var CompositeContextProvider = ctx2.ContextProvider;
16701    var CompositeScopedContextProvider = ctx2.ScopedContextProvider;
16702    var CompositeItemContext = (0, import_react12.createContext)(void 0);
16703    var CompositeRowContext = (0, import_react12.createContext)(void 0);
16704  
16705    // node_modules/@ariakit/store/dist/index.js
16706    function getInternal(store, key) {
16707      const internals = store.__unstableInternals;
16708      invariant(internals, "Invalid store");
16709      return internals[key];
16710    }
16711    function hasUpdatedKey(keys, updatedKey) {
16712      if (!keys) return true;
16713      for (const currentKey of keys) if (updatedKey instanceof Set) {
16714        if (updatedKey.has(currentKey)) return true;
16715      } else if (currentKey === updatedKey) return true;
16716      return false;
16717    }
16718    function isSameValue(value, other) {
16719      return value === other || value !== value && other !== other;
16720    }
16721    function getCleanupPrevState(prevState, state, stateBeforeCleanup, updatedKey) {
16722      let cleanupPrevState;
16723      for (const key of getKeys(state)) {
16724        if (isSameValue(state[key], stateBeforeCleanup[key])) continue;
16725        if (updatedKey !== void 0 && hasUpdatedKey([key], updatedKey)) continue;
16726        cleanupPrevState ??= { ...prevState };
16727        cleanupPrevState[key] = state[key];
16728      }
16729      return cleanupPrevState;
16730    }
16731    var MAX_REPAIR_PASSES = 100;
16732    function addKeyedListener(map, keys, listener) {
16733      if (!keys) return;
16734      for (const key of keys) {
16735        let listeners = map.get(key);
16736        if (!listeners) {
16737          listeners = /* @__PURE__ */ new Set();
16738          map.set(key, listeners);
16739        }
16740        listeners.add(listener);
16741      }
16742    }
16743    function deleteKeyedListener(map, keys, listener) {
16744      if (!map) return;
16745      if (!keys) return;
16746      for (const key of keys) {
16747        const listeners = map.get(key);
16748        if (!listeners) continue;
16749        listeners.delete(listener);
16750        if (!listeners.size) map.delete(key);
16751      }
16752    }
16753    function getFastPathNotifiedListeners(frame) {
16754      const notifiedListeners = /* @__PURE__ */ new Set();
16755      const currentListener = frame.currentListener;
16756      if (!currentListener) return notifiedListeners;
16757      for (const listener of frame.keyedListeners) {
16758        notifiedListeners.add(listener);
16759        if (listener === currentListener) return notifiedListeners;
16760      }
16761      notifiedListeners.clear();
16762      notifiedListeners.add(currentListener);
16763      return notifiedListeners;
16764    }
16765    function preserveFastPathNotifiedListeners(frame) {
16766      frame.notifiedListeners ??= getFastPathNotifiedListeners(frame);
16767    }
16768    function hasFastPathPassedListener(frame, listener) {
16769      if (!frame.currentListener) return false;
16770      let foundCurrentKeyedListener = false;
16771      for (const currentListener of frame.keyedListeners) {
16772        if (currentListener === frame.currentListener) {
16773          foundCurrentKeyedListener = true;
16774          continue;
16775        }
16776        if (!foundCurrentKeyedListener) continue;
16777        if (currentListener === listener) return false;
16778      }
16779      let foundListener = false;
16780      for (const currentListener of frame.group.listeners) {
16781        if (currentListener === frame.currentListener) return foundListener;
16782        if (currentListener === listener) foundListener = true;
16783      }
16784      return false;
16785    }
16786    function preserveFastPathFrames(fastPathFrames, group, listener) {
16787      for (const frame of fastPathFrames) {
16788        if (frame.group !== group) continue;
16789        if (frame.recovering) continue;
16790        if (listener && !frame.keyedListeners.has(listener)) continue;
16791        preserveFastPathNotifiedListeners(frame);
16792        for (const currentListener of frame.group.listeners) {
16793          if (currentListener === frame.currentListener) break;
16794          if (!hasFastPathPassedListener(frame, currentListener)) continue;
16795          frame.notifiedListeners?.add(currentListener);
16796        }
16797      }
16798    }
16799    function preserveFastPathPassedListeners(fastPathFrames, group, listener) {
16800      for (const frame of fastPathFrames) {
16801        if (frame.group !== group) continue;
16802        if (frame.recovering) continue;
16803        if (!hasFastPathPassedListener(frame, listener)) continue;
16804        preserveFastPathNotifiedListeners(frame);
16805        frame.notifiedListeners?.add(listener);
16806      }
16807    }
16808    function preserveFastPathPassedKeyedListeners({ fastPathFrames, group, keys, listener }) {
16809      const wasRegistered = group.listeners.has(listener);
16810      for (const frame of fastPathFrames) {
16811        if (frame.group !== group) continue;
16812        if (frame.recovering) continue;
16813        if (!keys.includes(frame.updatedKey)) continue;
16814        if (hasFastPathPassedListener(frame, listener)) {
16815          preserveFastPathNotifiedListeners(frame);
16816          frame.notifiedListeners?.add(listener);
16817        } else if (wasRegistered) {
16818          preserveFastPathNotifiedListeners(frame);
16819          frame.recoverToLive = true;
16820        }
16821      }
16822    }
16823    function clearFastPathNotifiedListener(fastPathFrames, group, listener) {
16824      for (const frame of fastPathFrames) {
16825        if (frame.group !== group) continue;
16826        frame.notifiedListeners?.delete(listener);
16827      }
16828    }
16829    function addFastPathKeyedListener({ fastPathFrames, group, keys, listener }) {
16830      for (const frame of fastPathFrames) {
16831        if (frame.group !== group) continue;
16832        if (frame.recovering) continue;
16833        if (!keys.includes(frame.updatedKey)) continue;
16834        frame.keyedListeners.add(listener);
16835      }
16836    }
16837    function runPendingCleanup(group, listener) {
16838      if (!group.disposables.size) return;
16839      const cleanup = group.disposables.get(listener);
16840      if (!cleanup) return;
16841      group.disposables.delete(listener);
16842      cleanup();
16843    }
16844    function setListenerCleanup(group, listener, cleanup) {
16845      const currentCleanup = group.disposables.get(listener);
16846      if (!currentCleanup) {
16847        group.disposables.set(listener, cleanup);
16848        return;
16849      }
16850      group.disposables.set(listener, () => {
16851        currentCleanup();
16852        cleanup();
16853      });
16854    }
16855    function notifyStoreListener(group, listener, state, prevState, getState, updatedKey) {
16856      if (group.suspendCounts?.has(listener)) return;
16857      const { disposables } = group;
16858      const cleanup = disposables.size ? disposables.get(listener) : void 0;
16859      if (cleanup) {
16860        disposables.delete(listener);
16861        const stateBeforeCleanup = state;
16862        cleanup();
16863        state = getState?.() ?? state;
16864        if (state !== stateBeforeCleanup) prevState = getCleanupPrevState(prevState, state, stateBeforeCleanup, updatedKey) ?? prevState;
16865      }
16866      const result = listener(state, prevState);
16867      if (result) setListenerCleanup(group, listener, result);
16868    }
16869    function runLiveListeners({ group, getState, prevState, updatedKey, notifiedListeners }) {
16870      const allKeysListeners = group.allKeysListeners;
16871      for (const listener of group.listeners) {
16872        if (notifiedListeners?.has(listener)) continue;
16873        if (!allKeysListeners?.has(listener)) {
16874          if (!hasUpdatedKey(group.listenerKeys.get(listener), updatedKey)) continue;
16875        }
16876        notifiedListeners?.add(listener);
16877        notifyStoreListener(group, listener, getState(), prevState, getState, updatedKey);
16878      }
16879    }
16880    function createStore(initialState, ...stores) {
16881      let state = initialState;
16882      let prevStateBatch = state;
16883      let destroy = noop5;
16884      let batchPending = false;
16885      let inDispatch = false;
16886      let updatedKeys = /* @__PURE__ */ new Set();
16887      const instances = /* @__PURE__ */ new Set();
16888      const setups = /* @__PURE__ */ new Set();
16889      const syncListenerGroup = {
16890        listeners: /* @__PURE__ */ new Set(),
16891        disposables: /* @__PURE__ */ new Map(),
16892        listenerKeys: /* @__PURE__ */ new WeakMap()
16893      };
16894      const batchListenerGroup = {
16895        listeners: /* @__PURE__ */ new Set(),
16896        disposables: /* @__PURE__ */ new Map(),
16897        listenerKeys: /* @__PURE__ */ new WeakMap()
16898      };
16899      const storeSetup = (callback) => {
16900        setups.add(callback);
16901        return () => setups.delete(callback);
16902      };
16903      const storeInit = () => {
16904        const initializedInstances = instances.size;
16905        const instance = /* @__PURE__ */ Symbol();
16906        instances.add(instance);
16907        const maybeDestroy = () => {
16908          if (!instances.delete(instance)) return;
16909          if (instances.size) return;
16910          destroy();
16911        };
16912        if (initializedInstances) return maybeDestroy;
16913        const stateKeys = getKeys(state);
16914        const desyncs = [];
16915        for (const store of stores) {
16916          const storeState = store?.getState?.();
16917          if (!storeState) continue;
16918          const keys = stateKeys.filter((key) => hasOwnProperty(storeState, key));
16919          if (!keys.length) continue;
16920          if (stores.length === 1 || keys.length === stateKeys.length) {
16921            for (const key of keys) desyncs.push(sync(store, [key], (state2) => {
16922              setState(key, state2[key], true);
16923            }));
16924            continue;
16925          }
16926          desyncs.push(subscribe(store, keys, (state2, prevState) => {
16927            for (const key of keys) {
16928              if (state2[key] === prevState[key]) continue;
16929              setState(key, state2[key], true);
16930            }
16931          }));
16932          for (const key of keys) {
16933            const liveState = store?.getState?.();
16934            if (!liveState) continue;
16935            setState(key, liveState[key], true);
16936          }
16937        }
16938        const teardowns = [];
16939        for (const setup2 of setups) teardowns.push(setup2());
16940        const cleanups = stores.map(init);
16941        destroy = chain(...desyncs, ...teardowns, ...cleanups);
16942        return maybeDestroy;
16943      };
16944      const deleteListenerIndexes = (group, listener, keys) => {
16945        if (keys === void 0) return;
16946        if (keys) deleteKeyedListener(group.listenersByKey, keys, listener);
16947        else group.allKeysListeners?.delete(listener);
16948      };
16949      const fastPathFrames = [];
16950      const registerListener = (keys, listener, group = syncListenerGroup) => {
16951        const listenerKeysValue = keys ? [...keys] : null;
16952        const wasRegistered = group.listeners.has(listener);
16953        if (!wasRegistered) clearFastPathNotifiedListener(fastPathFrames, group, listener);
16954        if (!listenerKeysValue) {
16955          if (wasRegistered) preserveFastPathFrames(fastPathFrames, group);
16956          preserveFastPathPassedListeners(fastPathFrames, group, listener);
16957        } else preserveFastPathPassedKeyedListeners({
16958          fastPathFrames,
16959          group,
16960          keys: listenerKeysValue,
16961          listener
16962        });
16963        if (wasRegistered) {
16964          preserveFastPathFrames(fastPathFrames, group, listener);
16965          deleteListenerIndexes(group, listener, group.listenerKeys.get(listener));
16966        }
16967        group.listeners.add(listener);
16968        if (listenerKeysValue) {
16969          group.listenersByKey ??= /* @__PURE__ */ new Map();
16970          addKeyedListener(group.listenersByKey, listenerKeysValue, listener);
16971          addFastPathKeyedListener({
16972            fastPathFrames,
16973            group,
16974            keys: listenerKeysValue,
16975            listener
16976          });
16977        } else {
16978          group.allKeysListeners ??= /* @__PURE__ */ new Set();
16979          group.allKeysListeners.add(listener);
16980        }
16981        group.listenerKeys.set(listener, listenerKeysValue);
16982        return () => {
16983          const cleanup = group.disposables.get(listener);
16984          group.disposables.delete(listener);
16985          preserveFastPathFrames(fastPathFrames, group, listener);
16986          const currentKeys = group.listenerKeys.get(listener);
16987          deleteListenerIndexes(group, listener, listenerKeysValue);
16988          if (currentKeys !== listenerKeysValue) deleteListenerIndexes(group, listener, currentKeys);
16989          group.listenerKeys.delete(listener);
16990          group.listeners.delete(listener);
16991          cleanup?.();
16992        };
16993      };
16994      const storeSubscribe = (keys, listener) => registerListener(keys, listener);
16995      const runInitialListener = (group, listener, prevState) => {
16996        const shouldSuspend = group.listeners.has(listener);
16997        if (shouldSuspend) {
16998          group.suspendCounts ??= /* @__PURE__ */ new Map();
16999          const count = group.suspendCounts.get(listener) ?? 0;
17000          group.suspendCounts.set(listener, count + 1);
17001        }
17002        let cleanupPrevState;
17003        try {
17004          const stateBeforeCleanups = state;
17005          runPendingCleanup(group, listener);
17006          if (state !== stateBeforeCleanups) cleanupPrevState = getCleanupPrevState(prevState, state, stateBeforeCleanups);
17007          const cleanup = listener(state, cleanupPrevState ?? prevState);
17008          if (cleanup) setListenerCleanup(group, listener, cleanup);
17009        } finally {
17010          if (shouldSuspend) {
17011            const suspendCounts = group.suspendCounts;
17012            const count = suspendCounts?.get(listener);
17013            if (count && count > 1) suspendCounts?.set(listener, count - 1);
17014            else suspendCounts?.delete(listener);
17015            if (!suspendCounts?.size) delete group.suspendCounts;
17016          }
17017        }
17018      };
17019      const storeSync = (keys, listener) => {
17020        runInitialListener(syncListenerGroup, listener, state);
17021        return registerListener(keys, listener);
17022      };
17023      const storeBatch = (keys, listener) => {
17024        if (!batchListenerGroup.listeners.size && !inDispatch) prevStateBatch = state;
17025        runInitialListener(batchListenerGroup, listener, prevStateBatch);
17026        return registerListener(keys, listener, batchListenerGroup);
17027      };
17028      const storePick = (keys) => createStore(pick(state, keys), finalStore);
17029      const storeOmit = (keys) => createStore(omit(state, keys), finalStore);
17030      const getState = () => state;
17031      const runListeners = (group, prevState, updatedKey) => {
17032        if (!(updatedKey instanceof Set) && !group.allKeysListeners?.size) {
17033          const keyedListeners = group.listenersByKey?.get(updatedKey);
17034          if (!keyedListeners) return;
17035          const frame = {
17036            group,
17037            keyedListeners,
17038            updatedKey,
17039            currentListener: null
17040          };
17041          fastPathFrames.push(frame);
17042          try {
17043            for (const listener of keyedListeners) {
17044              if (frame.notifiedListeners?.has(listener)) continue;
17045              frame.currentListener = listener;
17046              frame.notifiedListeners?.add(listener);
17047              notifyStoreListener(group, listener, state, prevState, getState, updatedKey);
17048              if (!group.allKeysListeners?.size && !frame.recoverToLive) continue;
17049              const notifiedListeners = frame.notifiedListeners ?? getFastPathNotifiedListeners(frame);
17050              frame.notifiedListeners = notifiedListeners;
17051              frame.recovering = true;
17052              runLiveListeners({
17053                group,
17054                getState,
17055                prevState,
17056                updatedKey,
17057                notifiedListeners
17058              });
17059              return;
17060            }
17061          } finally {
17062            fastPathFrames.pop();
17063          }
17064          return;
17065        }
17066        runLiveListeners({
17067          group,
17068          getState,
17069          prevState,
17070          updatedKey
17071        });
17072      };
17073      const setState = (key, value, fromStores = false) => {
17074        if (!hasOwnProperty(state, key)) return;
17075        const currentValue = state[key];
17076        const nextValue = typeof value === "function" ? value(currentValue) : value;
17077        if (isSameValue(nextValue, currentValue)) return;
17078        const wasInDispatch = inDispatch;
17079        inDispatch = true;
17080        const prevState = state;
17081        const nextState = {
17082          ...state,
17083          [key]: nextValue
17084        };
17085        state = nextState;
17086        let superseded = false;
17087        try {
17088          if (!fromStores && stores.length) {
17089            for (const store of stores) {
17090              store?.setState?.(key, nextValue);
17091              if (isSameValue(state[key], nextValue)) continue;
17092              superseded = true;
17093              break;
17094            }
17095            if (superseded) {
17096              let pass = 0;
17097              for (; pass < MAX_REPAIR_PASSES; pass += 1) {
17098                let changed = false;
17099                for (const store of stores) {
17100                  const previousValue = state[key];
17101                  store?.setState?.(key, previousValue);
17102                  if (!isSameValue(state[key], previousValue)) changed = true;
17103                }
17104                if (!changed) break;
17105              }
17106              if (pass === MAX_REPAIR_PASSES) console.warn("Parent stores did not converge after a superseded fan-out; a parent listener may be rewriting this key in a cycle.");
17107            }
17108          }
17109          if (!superseded) runListeners(syncListenerGroup, state === nextState ? prevState : {
17110            ...state,
17111            [key]: prevState[key]
17112          }, key);
17113        } finally {
17114          inDispatch = wasInDispatch;
17115        }
17116        if (!batchListenerGroup.listeners.size) {
17117          if (!inDispatch) prevStateBatch = state;
17118          return;
17119        }
17120        updatedKeys.add(key);
17121        if (batchPending) return;
17122        batchPending = true;
17123        queueMicrotask(() => {
17124          batchPending = false;
17125          const snapshot = state;
17126          const updatedKeysSnapshot = updatedKeys;
17127          updatedKeys = /* @__PURE__ */ new Set();
17128          const prevStateBatchBefore = prevStateBatch;
17129          runListeners(batchListenerGroup, prevStateBatchBefore, updatedKeysSnapshot);
17130          if (prevStateBatch === prevStateBatchBefore) prevStateBatch = snapshot;
17131        });
17132      };
17133      const finalStore = {
17134        getState,
17135        setState,
17136        __unstableInternals: {
17137          setup: storeSetup,
17138          init: storeInit,
17139          subscribe: storeSubscribe,
17140          sync: storeSync,
17141          batch: storeBatch,
17142          pick: storePick,
17143          omit: storeOmit
17144        }
17145      };
17146      return finalStore;
17147    }
17148    function setup(store, ...args) {
17149      if (!store) return;
17150      return getInternal(store, "setup")(...args);
17151    }
17152    function init(store, ...args) {
17153      if (!store) return;
17154      return getInternal(store, "init")(...args);
17155    }
17156    function subscribe(store, ...args) {
17157      if (!store) return;
17158      return getInternal(store, "subscribe")(...args);
17159    }
17160    function sync(store, ...args) {
17161      if (!store) return;
17162      return getInternal(store, "sync")(...args);
17163    }
17164    function batch(store, ...args) {
17165      if (!store) return;
17166      return getInternal(store, "batch")(...args);
17167    }
17168    function omit2(store, ...args) {
17169      if (!store) return;
17170      return getInternal(store, "omit")(...args);
17171    }
17172    function pick2(store, ...args) {
17173      if (!store) return;
17174      return getInternal(store, "pick")(...args);
17175    }
17176    function mergeStore(...stores) {
17177      const initialState = {};
17178      for (const store2 of stores) {
17179        const nextState = store2?.getState?.();
17180        if (nextState) Object.assign(initialState, nextState);
17181      }
17182      const store = createStore(initialState, ...stores);
17183      return Object.assign({}, ...stores, store);
17184    }
17185    function throwOnConflictingProps(props, store) {
17186      if (false) return;
17187      if (!store) return;
17188      const defaultKeys = Object.entries(props).filter(([key, value]) => key.startsWith("default") && value !== void 0).map(([key]) => {
17189        const stateKey = key.replace("default", "");
17190        return `$stateKey[0]?.toLowerCase() || ""}$stateKey.slice(1)}`;
17191      });
17192      if (!defaultKeys.length) return;
17193      const storeState = store.getState();
17194      if (!defaultKeys.filter((key) => hasOwnProperty(storeState, key)).length) return;
17195      throw new Error(`Passing a store prop in conjunction with a default state is not supported.
17196  
17197  const store = useSelectStore();
17198  <SelectProvider store={store} defaultValue="Apple" />
17199                  ^             ^
17200  
17201  Instead, pass the default state to the topmost store:
17202  
17203  const store = useSelectStore({ defaultValue: "Apple" });
17204  <SelectProvider store={store} />
17205  
17206  See https://github.com/ariakit/ariakit/pull/2745 for more details.
17207  
17208  If there's a particular need for this, please submit a feature request at https://github.com/ariakit/ariakit
17209  `);
17210    }
17211  
17212    // node_modules/@ariakit/components/dist/collection/collection-store.js
17213    function getCommonParent(items) {
17214      const firstItem = items.find((item) => !!item.element);
17215      const lastElement = [...items].reverse().find((item) => !!item.element)?.element;
17216      let parentElement = firstItem?.element?.parentElement;
17217      if (!lastElement) return getDocument(parentElement).body;
17218      while (parentElement) {
17219        if (parentElement.contains(lastElement)) return parentElement;
17220        parentElement = parentElement.parentElement;
17221      }
17222      return getDocument(parentElement).body;
17223    }
17224    function getPrivateStore(store) {
17225      return store?.__unstablePrivateStore;
17226    }
17227    function createCollectionStore(props = {}) {
17228      throwOnConflictingProps(props, props.store);
17229      const syncState = props.store?.getState();
17230      const items = defaultValue(props.items, syncState?.items, props.defaultItems, []);
17231      const itemsMap = new Map(items.map((item) => [item.id, item]));
17232      const initialState = {
17233        items,
17234        renderedItems: defaultValue(syncState?.renderedItems, [])
17235      };
17236      const syncPrivateStore = getPrivateStore(props.store);
17237      const privateStore = createStore({
17238        items,
17239        renderedItems: initialState.renderedItems
17240      }, syncPrivateStore);
17241      const collection = createStore(initialState, props.store);
17242      const sortItems = (renderedItems) => {
17243        const sortedItems = sortBasedOnDOMPosition(renderedItems, (i2) => i2.element);
17244        privateStore.setState("renderedItems", sortedItems);
17245        collection.setState("renderedItems", sortedItems);
17246      };
17247      setup(collection, () => init(privateStore));
17248      setup(privateStore, () => {
17249        return batch(privateStore, ["items"], (state) => {
17250          collection.setState("items", state.items);
17251        });
17252      });
17253      setup(privateStore, () => {
17254        return batch(privateStore, ["renderedItems"], (state) => {
17255          let firstRun = true;
17256          let raf = requestAnimationFrame(() => {
17257            const { renderedItems } = collection.getState();
17258            if (state.renderedItems === renderedItems) return;
17259            sortItems(state.renderedItems);
17260          });
17261          if (typeof IntersectionObserver !== "function") return () => cancelAnimationFrame(raf);
17262          const ioCallback = () => {
17263            if (firstRun) {
17264              firstRun = false;
17265              return;
17266            }
17267            cancelAnimationFrame(raf);
17268            raf = requestAnimationFrame(() => sortItems(state.renderedItems));
17269          };
17270          const root = getCommonParent(state.renderedItems);
17271          const observer = new IntersectionObserver(ioCallback, { root });
17272          for (const item of state.renderedItems) {
17273            if (!item.element) continue;
17274            observer.observe(item.element);
17275          }
17276          return () => {
17277            cancelAnimationFrame(raf);
17278            observer.disconnect();
17279          };
17280        });
17281      });
17282      const mergeItem = (item, setItems, canDeleteFromMap = false) => {
17283        let prevItem;
17284        setItems((items2) => {
17285          const index2 = items2.findIndex(({ id }) => id === item.id);
17286          const nextItems = items2.slice();
17287          if (index2 !== -1) {
17288            prevItem = items2[index2];
17289            const nextItem = {
17290              ...prevItem,
17291              ...item
17292            };
17293            nextItems[index2] = nextItem;
17294            itemsMap.set(item.id, nextItem);
17295          } else {
17296            nextItems.push(item);
17297            itemsMap.set(item.id, item);
17298          }
17299          return nextItems;
17300        });
17301        const unmergeItem = () => {
17302          setItems((items2) => {
17303            if (!prevItem) {
17304              if (canDeleteFromMap) itemsMap.delete(item.id);
17305              return items2.filter(({ id }) => id !== item.id);
17306            }
17307            const index2 = items2.findIndex(({ id }) => id === item.id);
17308            if (index2 === -1) return items2;
17309            const nextItems = items2.slice();
17310            nextItems[index2] = prevItem;
17311            itemsMap.set(item.id, prevItem);
17312            return nextItems;
17313          });
17314        };
17315        return unmergeItem;
17316      };
17317      const registerItem = (item) => mergeItem(item, (getItems) => privateStore.setState("items", getItems), true);
17318      return {
17319        ...collection,
17320        registerItem,
17321        renderItem: (item) => chain(registerItem(item), mergeItem(item, (getItems) => privateStore.setState("renderedItems", getItems))),
17322        item: (id) => {
17323          if (!id) return null;
17324          let item = itemsMap.get(id);
17325          if (!item) {
17326            const { items: items2 } = privateStore.getState();
17327            item = items2.find((item2) => item2.id === id);
17328            if (item) itemsMap.set(id, item);
17329          }
17330          return item || null;
17331        },
17332        __unstablePrivateStore: privateStore
17333      };
17334    }
17335  
17336    // node_modules/@ariakit/components/dist/composite/composite-store.js
17337    var NULL_ITEM = { id: null };
17338    function findFirstEnabledItem(items, excludeId) {
17339      return items.find((item) => {
17340        if (excludeId) return !item.disabled && item.id !== excludeId;
17341        return !item.disabled;
17342      });
17343    }
17344    function getEnabledItems(items, excludeId) {
17345      return items.filter((item) => {
17346        if (excludeId) return !item.disabled && item.id !== excludeId;
17347        return !item.disabled;
17348      });
17349    }
17350    function getItemsInRow(items, rowId) {
17351      return items.filter((item) => item.rowId === rowId);
17352    }
17353    function findEnabledItemId({ items, fromIndex, step, rowId, excludeId }) {
17354      for (let i2 = fromIndex; i2 >= 0 && i2 < items.length; i2 += step) {
17355        const item = items[i2];
17356        if (!item) continue;
17357        if (item.rowId !== rowId) continue;
17358        if (item.disabled) continue;
17359        if (excludeId != null && item.id === excludeId) continue;
17360        return item.id;
17361      }
17362    }
17363    function flipItems(items, activeId, shouldInsertNullItem = false) {
17364      const index2 = items.findIndex((item) => item.id === activeId);
17365      return [
17366        ...items.slice(index2 + 1),
17367        ...shouldInsertNullItem ? [NULL_ITEM] : [],
17368        ...items.slice(0, index2)
17369      ];
17370    }
17371    function groupItemsByRows(items) {
17372      const rows = [];
17373      for (const item of items) {
17374        const row = rows.find((currentRow) => currentRow[0]?.rowId === item.rowId);
17375        if (row) row.push(item);
17376        else rows.push([item]);
17377      }
17378      return rows;
17379    }
17380    function getMaxRowLength(array) {
17381      let maxLength = 0;
17382      for (const { length } of array) if (length > maxLength) maxLength = length;
17383      return maxLength;
17384    }
17385    function createEmptyItem(rowId) {
17386      return {
17387        id: "__EMPTY_ITEM__",
17388        disabled: true,
17389        rowId
17390      };
17391    }
17392    function normalizeRows(rows, activeId, focusShift) {
17393      const maxLength = getMaxRowLength(rows);
17394      for (const row of rows) for (let i2 = 0; i2 < maxLength; i2 += 1) {
17395        const item = row[i2];
17396        if (!item || focusShift && item.disabled) {
17397          const previousItem = i2 === 0 && focusShift ? findFirstEnabledItem(row) : row[i2 - 1];
17398          row[i2] = previousItem && activeId !== previousItem.id && focusShift ? previousItem : createEmptyItem(previousItem?.rowId);
17399        }
17400      }
17401      return rows;
17402    }
17403    function verticalizeItems(items) {
17404      const rows = groupItemsByRows(items);
17405      const maxLength = getMaxRowLength(rows);
17406      const verticalized = [];
17407      for (let i2 = 0; i2 < maxLength; i2 += 1) for (const row of rows) {
17408        const item = row[i2];
17409        if (item) verticalized.push({
17410          ...item,
17411          rowId: item.rowId ? `$i2}` : void 0
17412        });
17413      }
17414      return verticalized;
17415    }
17416    function createCompositeStore(props = {}) {
17417      const syncState = props.store?.getState();
17418      const collection = createCollectionStore(props);
17419      const activeId = defaultValue(props.activeId, syncState?.activeId, props.defaultActiveId);
17420      const composite = createStore({
17421        ...collection.getState(),
17422        id: defaultValue(props.id, syncState?.id) ?? `id-$Math.random().toString(36).slice(2, 8)}`,
17423        activeId,
17424        baseElement: defaultValue(syncState?.baseElement, null),
17425        includesBaseElement: defaultValue(props.includesBaseElement, syncState?.includesBaseElement, activeId === null),
17426        moves: defaultValue(syncState?.moves, 0),
17427        orientation: defaultValue(props.orientation, syncState?.orientation, "both"),
17428        rtl: defaultValue(props.rtl, syncState?.rtl, false),
17429        virtualFocus: defaultValue(props.virtualFocus, syncState?.virtualFocus, false),
17430        focusLoop: defaultValue(props.focusLoop, syncState?.focusLoop, false),
17431        focusWrap: defaultValue(props.focusWrap, syncState?.focusWrap, false),
17432        focusShift: defaultValue(props.focusShift, syncState?.focusShift, false)
17433      }, collection, props.store);
17434      setup(composite, () => sync(composite, ["renderedItems", "activeId"], (state) => {
17435        composite.setState("activeId", (activeId2) => {
17436          if (activeId2 !== void 0) return activeId2;
17437          return findFirstEnabledItem(state.renderedItems)?.id;
17438        });
17439      }));
17440      const getNextId = (direction = "next", options = {}) => {
17441        const defaultState = composite.getState();
17442        const { skip = 0, activeId: activeId2 = defaultState.activeId, focusShift = defaultState.focusShift, focusLoop = defaultState.focusLoop, focusWrap = defaultState.focusWrap, includesBaseElement = defaultState.includesBaseElement, renderedItems = defaultState.renderedItems, rtl = defaultState.rtl } = options;
17443        const isVerticalDirection = direction === "up" || direction === "down";
17444        const isNextDirection = direction === "next" || direction === "down";
17445        const canReverse = isNextDirection ? rtl && !isVerticalDirection : !rtl || isVerticalDirection;
17446        const canShift = focusShift && !skip;
17447        if (!skip && !focusWrap && !includesBaseElement && activeId2 != null) {
17448          if (!isVerticalDirection ? true : !canShift && !renderedItems.some((item) => item.rowId != null)) {
17449            const activeIndex2 = renderedItems.findIndex((item) => item.id === activeId2);
17450            const activeItem2 = renderedItems[activeIndex2];
17451            if (activeItem2) {
17452              const step = canReverse ? -1 : 1;
17453              const nextId = findEnabledItemId({
17454                items: renderedItems,
17455                fromIndex: activeIndex2 + step,
17456                step,
17457                rowId: activeItem2.rowId,
17458                excludeId: activeId2
17459              });
17460              if (nextId !== void 0) return nextId;
17461              if (!(focusLoop && (isVerticalDirection ? focusLoop !== "horizontal" : focusLoop !== "vertical"))) return void 0;
17462              return findEnabledItemId({
17463                items: renderedItems,
17464                fromIndex: step === 1 ? 0 : renderedItems.length - 1,
17465                step,
17466                rowId: activeItem2.rowId,
17467                excludeId: activeId2
17468              });
17469            }
17470          }
17471        }
17472        let items = !isVerticalDirection ? renderedItems : flatten2DArray(normalizeRows(groupItemsByRows(renderedItems), activeId2, canShift));
17473        items = canReverse ? reverseArray(items) : items;
17474        items = isVerticalDirection ? verticalizeItems(items) : items;
17475        if (activeId2 == null) return findFirstEnabledItem(items)?.id;
17476        const activeItem = items.find((item) => item.id === activeId2);
17477        if (!activeItem) return findFirstEnabledItem(items)?.id;
17478        const isGrid2 = items.some((item) => item.rowId);
17479        const activeIndex = items.indexOf(activeItem);
17480        const nextItems = items.slice(activeIndex + 1);
17481        const nextItemsInRow = getItemsInRow(nextItems, activeItem.rowId);
17482        if (skip) {
17483          const nextEnabledItemsInRow = getEnabledItems(nextItemsInRow, activeId2);
17484          return (nextEnabledItemsInRow.slice(skip)[0] || nextEnabledItemsInRow[nextEnabledItemsInRow.length - 1])?.id;
17485        }
17486        const canLoop = focusLoop && (isVerticalDirection ? focusLoop !== "horizontal" : focusLoop !== "vertical");
17487        const canWrap = isGrid2 && focusWrap && (isVerticalDirection ? focusWrap !== "horizontal" : focusWrap !== "vertical");
17488        const hasNullItem = isNextDirection ? (!isGrid2 || isVerticalDirection) && canLoop && includesBaseElement : isVerticalDirection ? includesBaseElement : false;
17489        if (canLoop) return findFirstEnabledItem(flipItems(canWrap && !hasNullItem ? items : getItemsInRow(items, activeItem.rowId), activeId2, hasNullItem), activeId2)?.id;
17490        if (canWrap) {
17491          const nextItem2 = findFirstEnabledItem(hasNullItem ? nextItemsInRow : nextItems, activeId2);
17492          return hasNullItem ? nextItem2?.id || null : nextItem2?.id;
17493        }
17494        const nextItem = findFirstEnabledItem(nextItemsInRow, activeId2);
17495        if (!nextItem && hasNullItem) return null;
17496        return nextItem?.id;
17497      };
17498      const getNextIdFromOptions = (direction, options) => {
17499        if (typeof options === "number") return getNextId(direction, { skip: options });
17500        return getNextId(direction, options);
17501      };
17502      return {
17503        ...collection,
17504        ...composite,
17505        setBaseElement: (element) => composite.setState("baseElement", element),
17506        setActiveId: (id) => composite.setState("activeId", id),
17507        move: (id) => {
17508          if (id === void 0) return;
17509          composite.setState("activeId", id);
17510          composite.setState("moves", (moves) => moves + 1);
17511        },
17512        first: () => findFirstEnabledItem(composite.getState().renderedItems)?.id,
17513        last: () => findFirstEnabledItem(reverseArray(composite.getState().renderedItems))?.id,
17514        next: (options) => getNextIdFromOptions("next", options),
17515        previous: (options) => getNextIdFromOptions("previous", options),
17516        down: (options) => getNextIdFromOptions("down", options),
17517        up: (options) => getNextIdFromOptions("up", options)
17518      };
17519    }
17520  
17521    // node_modules/@ariakit/react-components/dist/composite/utils.js
17522    var findFirstEnabledItem2 = findFirstEnabledItem;
17523    var groupItemsByRows2 = groupItemsByRows;
17524    function getEnabledItem(store, id) {
17525      if (!id) return null;
17526      return store.item(id) || null;
17527    }
17528    function selectTextField(element, collapseToEnd = false) {
17529      if (isTextField(element)) element.setSelectionRange(collapseToEnd ? element.value.length : 0, element.value.length);
17530      else if (element.isContentEditable) {
17531        const selection = getDocument(element).getSelection();
17532        selection?.selectAllChildren(element);
17533        if (collapseToEnd) selection?.collapseToEnd();
17534      }
17535    }
17536    var FOCUS_SILENTLY = /* @__PURE__ */ Symbol("FOCUS_SILENTLY");
17537    function focusSilently(element) {
17538      element[FOCUS_SILENTLY] = true;
17539      element.focus({ preventScroll: true });
17540    }
17541    function silentlyFocused(element) {
17542      const isSilentlyFocused = element[FOCUS_SILENTLY];
17543      delete element[FOCUS_SILENTLY];
17544      return isSilentlyFocused;
17545    }
17546    function isItem(store, element, exclude) {
17547      if (!element) return false;
17548      if (element === exclude) return false;
17549      const item = store.item(element.id);
17550      if (!item) return false;
17551      if (exclude && item.element === exclude) return false;
17552      return true;
17553    }
17554  
17555    // node_modules/@ariakit/react-components/dist/composite/composite-item.js
17556    var import_react13 = __toESM(require_react(), 1);
17557    var import_jsx_runtime73 = __toESM(require_jsx_runtime(), 1);
17558  
17559    // node_modules/@ariakit/react-store/dist/index.js
17560    var React48 = __toESM(require_react(), 1);
17561    var import_shim2 = __toESM(require_shim(), 1);
17562    var noopSubscribe = () => () => {
17563    };
17564    function useStoreState(store, keyOrSelector = identity) {
17565      const storeSubscribe = React48.useCallback((callback) => {
17566        if (!store) return noopSubscribe();
17567        return subscribe(store, null, callback);
17568      }, [store]);
17569      const getSnapshot = () => {
17570        const key = typeof keyOrSelector === "string" ? keyOrSelector : null;
17571        const selector2 = typeof keyOrSelector === "function" ? keyOrSelector : null;
17572        const state = store?.getState();
17573        if (selector2) return selector2(state);
17574        if (!state) return;
17575        if (!key) return;
17576        if (!hasOwnProperty(state, key)) return;
17577        return state[key];
17578      };
17579      return (0, import_shim2.useSyncExternalStore)(storeSubscribe, getSnapshot, getSnapshot);
17580    }
17581    function useStoreStateObject(store, object) {
17582      const objRef = React48.useRef({});
17583      const storeSubscribe = React48.useCallback((callback) => {
17584        if (!store) return noopSubscribe();
17585        return subscribe(store, null, callback);
17586      }, [store]);
17587      const getSnapshot = () => {
17588        const state = store?.getState();
17589        let updated = false;
17590        const obj = objRef.current;
17591        for (const prop in object) {
17592          const keyOrSelector = object[prop];
17593          if (typeof keyOrSelector === "function") {
17594            const value = keyOrSelector(state);
17595            if (!Object.is(value, obj[prop])) {
17596              obj[prop] = value;
17597              updated = true;
17598            }
17599          }
17600          if (typeof keyOrSelector === "string") {
17601            if (!state) continue;
17602            if (!hasOwnProperty(state, keyOrSelector)) continue;
17603            const value = state[keyOrSelector];
17604            if (!Object.is(value, obj[prop])) {
17605              obj[prop] = value;
17606              updated = true;
17607            }
17608          }
17609        }
17610        if (updated) objRef.current = { ...obj };
17611        return objRef.current;
17612      };
17613      return (0, import_shim2.useSyncExternalStore)(storeSubscribe, getSnapshot, getSnapshot);
17614    }
17615    function useStoreProps(store, props, key, setKey) {
17616      const value = hasOwnProperty(props, key) ? props[key] : void 0;
17617      const propsRef = useLiveRef({
17618        value,
17619        setValue: setKey ? props[setKey] : void 0
17620      });
17621      useSafeLayoutEffect(() => {
17622        return sync(store, [key], (state, prev) => {
17623          const { value: value2, setValue } = propsRef.current;
17624          if (!setValue) return;
17625          if (state[key] === prev[key]) return;
17626          if (state[key] === value2) return;
17627          setValue(state[key]);
17628        });
17629      }, [store, key]);
17630      useSafeLayoutEffect(() => {
17631        if (value === void 0) return;
17632        store.setState(key, value);
17633        return batch(store, [key], () => {
17634          if (value === void 0) return;
17635          store.setState(key, value);
17636        });
17637      });
17638    }
17639    function useStore2(createStore2, props) {
17640      const [store, setStore] = React48.useState(() => createStore2(props));
17641      useSafeLayoutEffect(() => init(store), [store]);
17642      const useState43 = React48.useCallback((keyOrSelector) => useStoreState(store, keyOrSelector), [store]);
17643      return [React48.useMemo(() => ({
17644        ...store,
17645        useState: useState43
17646      }), [store, useState43]), useEvent(() => {
17647        setStore((store2) => createStore2({
17648          ...props,
17649          ...store2.getState()
17650        }));
17651      })];
17652    }
17653  
17654    // node_modules/@ariakit/react-components/dist/composite/composite-item.js
17655    var TagName4 = "button";
17656    function isEditableElement(element) {
17657      if (isTextbox(element)) return true;
17658      return element.tagName === "INPUT" && !isButton(element);
17659    }
17660    function getNextPageOffset(scrollingElement, pageUp = false) {
17661      const height = scrollingElement.clientHeight;
17662      const { top } = scrollingElement.getBoundingClientRect();
17663      const pageSize = Math.max(height * 0.875, height - 40) * 1.5;
17664      const pageOffset = pageUp ? height - pageSize + top : pageSize + top;
17665      if (scrollingElement.tagName === "HTML") return pageOffset + scrollingElement.scrollTop;
17666      return pageOffset;
17667    }
17668    function getItemOffset(itemElement, pageUp = false) {
17669      const { top } = itemElement.getBoundingClientRect();
17670      if (pageUp) return top + itemElement.clientHeight;
17671      return top;
17672    }
17673    function findNextPageItemId(element, store, next, pageUp = false) {
17674      if (!store) return;
17675      if (!next) return;
17676      const { renderedItems } = store.getState();
17677      const scrollingElement = getScrollingElement(element);
17678      if (!scrollingElement) return;
17679      const nextPageOffset = getNextPageOffset(scrollingElement, pageUp);
17680      let id;
17681      let prevDifference;
17682      for (let i2 = 0; i2 < renderedItems.length; i2 += 1) {
17683        const previousId = id;
17684        id = next(i2);
17685        if (!id) break;
17686        if (id === previousId) continue;
17687        const itemElement = getEnabledItem(store, id)?.element;
17688        if (!itemElement) continue;
17689        const difference = getItemOffset(itemElement, pageUp) - nextPageOffset;
17690        const absDifference = Math.abs(difference);
17691        if (pageUp && difference <= 0 || !pageUp && difference >= 0) {
17692          if (prevDifference !== void 0 && prevDifference < absDifference) id = previousId;
17693          break;
17694        }
17695        prevDifference = absDifference;
17696      }
17697      return id;
17698    }
17699    function targetIsAnotherItem(event, store) {
17700      if (isSelfTarget(event)) return false;
17701      return isItem(store, event.target);
17702    }
17703    var useCompositeItem = createHook(function useCompositeItem2({ store, rowId: rowIdProp, preventScrollOnKeyDown = false, moveOnKeyPress = true, tabbable: tabbable2 = false, getItem: getItemProp, "aria-setsize": ariaSetSizeProp, "aria-posinset": ariaPosInSetProp, ...props }) {
17704      const context = useCompositeScopedContext();
17705      store = store || context;
17706      const id = useId4(props.id);
17707      const ref = (0, import_react13.useRef)(null);
17708      const row = (0, import_react13.useContext)(CompositeRowContext);
17709      const trulyDisabled = disabledFromProps(props) && !props.accessibleWhenDisabled;
17710      const shouldRegisterItem = props.shouldRegisterItem;
17711      const getRowId = (state) => {
17712        if (rowIdProp) return rowIdProp;
17713        if (!state) return;
17714        if (!row?.baseElement) return;
17715        if (row.baseElement !== state.baseElement) return;
17716        return row.id;
17717      };
17718      const { rowId, baseElement, isActiveItem, ariaSetSize, ariaPosInSet, isTabbable } = useStoreStateObject(store, {
17719        rowId: getRowId,
17720        baseElement(state) {
17721          return state?.baseElement || void 0;
17722        },
17723        isActiveItem(state) {
17724          return !!state && state.activeId === id;
17725        },
17726        ariaSetSize(state) {
17727          if (ariaSetSizeProp != null) return ariaSetSizeProp;
17728          if (!state) return;
17729          if (!row?.ariaSetSize) return;
17730          if (row.baseElement !== state.baseElement) return;
17731          return row.ariaSetSize;
17732        },
17733        ariaPosInSet(state) {
17734          if (ariaPosInSetProp != null) return ariaPosInSetProp;
17735          if (!state) return;
17736          if (!row?.ariaPosInSet) return;
17737          if (row.baseElement !== state.baseElement) return;
17738          const rowId2 = getRowId(state);
17739          const itemsInRow = state.renderedItems.filter((item) => item.rowId === rowId2);
17740          return row.ariaPosInSet + itemsInRow.findIndex((item) => item.id === id);
17741        },
17742        isTabbable(state) {
17743          if (!state?.renderedItems.length) return true;
17744          if (state.virtualFocus) return false;
17745          if (tabbable2) return true;
17746          if (state.activeId === null) return false;
17747          const item = store?.item(state.activeId);
17748          if (item?.disabled) return true;
17749          if (!item?.element) return true;
17750          return state.activeId === id;
17751        }
17752      });
17753      const getItem = (0, import_react13.useCallback)((item) => {
17754        const nextItem = {
17755          ...item,
17756          id: id || item.id,
17757          rowId,
17758          disabled: trulyDisabled,
17759          children: item.element?.textContent
17760        };
17761        if (getItemProp) return getItemProp(nextItem);
17762        return nextItem;
17763      }, [
17764        id,
17765        rowId,
17766        trulyDisabled,
17767        getItemProp
17768      ]);
17769      const onFocusProp = props.onFocus;
17770      const hasFocusedComposite = (0, import_react13.useRef)(false);
17771      const cancelScheduledFocusRedirectRef = (0, import_react13.useRef)(null);
17772      const onFocus = useEvent((event) => {
17773        onFocusProp?.(event);
17774        if (event.defaultPrevented) return;
17775        if (isPortalEvent(event)) return;
17776        if (!id) return;
17777        if (!store) return;
17778        if (targetIsAnotherItem(event, store)) return;
17779        const { virtualFocus, baseElement: baseElement2 } = store.getState();
17780        store.setActiveId(id);
17781        if (isTextbox(event.currentTarget)) selectTextField(event.currentTarget);
17782        if (!virtualFocus) return;
17783        if (!isSelfTarget(event)) return;
17784        if (isEditableElement(event.currentTarget)) return;
17785        const redirectFocusToBaseElement = (currentTarget2, relatedTarget2, baseElement3) => {
17786          if (isSafari() && currentTarget2.hasAttribute("data-autofocus")) currentTarget2.scrollIntoView({
17787            block: "nearest",
17788            inline: "nearest"
17789          });
17790          hasFocusedComposite.current = true;
17791          if (relatedTarget2 === baseElement3 || isItem(store, relatedTarget2)) focusSilently(baseElement3);
17792          else baseElement3.focus();
17793        };
17794        if (baseElement2?.isConnected) {
17795          redirectFocusToBaseElement(event.currentTarget, event.relatedTarget, baseElement2);
17796          return;
17797        }
17798        if (shouldRegisterItem === false) return;
17799        const { currentTarget, relatedTarget } = event;
17800        const cancelScheduledFocusRedirect = () => {
17801          cancelScheduledFocusRedirectRef.current?.();
17802          cancelScheduledFocusRedirectRef.current = null;
17803        };
17804        cancelScheduledFocusRedirect();
17805        cancelScheduledFocusRedirectRef.current = subscribe(store, null, () => {
17806          if (getActiveElement(currentTarget) !== currentTarget) {
17807            cancelScheduledFocusRedirect();
17808            return;
17809          }
17810          const state = store.getState();
17811          const nextBaseElement = state.baseElement;
17812          if (!nextBaseElement?.isConnected) return;
17813          cancelScheduledFocusRedirect();
17814          if (!state.virtualFocus) return;
17815          redirectFocusToBaseElement(currentTarget, relatedTarget, nextBaseElement);
17816        });
17817      });
17818      const onBlurCaptureProp = props.onBlurCapture;
17819      const onBlurCapture = useEvent((event) => {
17820        onBlurCaptureProp?.(event);
17821        if (event.defaultPrevented) return;
17822        if (store?.getState()?.virtualFocus && hasFocusedComposite.current) {
17823          hasFocusedComposite.current = false;
17824          event.preventDefault();
17825          event.stopPropagation();
17826        }
17827      });
17828      const onKeyDownProp = props.onKeyDown;
17829      const preventScrollOnKeyDownProp = useBooleanEvent(preventScrollOnKeyDown);
17830      const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress);
17831      const onKeyDown = useEvent((event) => {
17832        onKeyDownProp?.(event);
17833        if (event.defaultPrevented) return;
17834        if (!isSelfTarget(event)) return;
17835        if (!store) return;
17836        const { currentTarget } = event;
17837        const state = store.getState();
17838        const isGrid2 = !!store.item(id)?.rowId;
17839        const isVertical = state.orientation !== "horizontal";
17840        const isHorizontal = state.orientation !== "vertical";
17841        const canHomeEnd = () => {
17842          if (isGrid2) return true;
17843          if (isHorizontal) return true;
17844          if (!state.baseElement) return true;
17845          if (!isTextField(state.baseElement)) return true;
17846          return false;
17847        };
17848        const action = {
17849          ArrowUp: (isGrid2 || isVertical) && store.up,
17850          ArrowRight: (isGrid2 || isHorizontal) && store.next,
17851          ArrowDown: (isGrid2 || isVertical) && store.down,
17852          ArrowLeft: (isGrid2 || isHorizontal) && store.previous,
17853          Home: () => {
17854            if (!canHomeEnd()) return;
17855            if (!isGrid2 || event.ctrlKey) return store?.first();
17856            return store?.previous(-1);
17857          },
17858          End: () => {
17859            if (!canHomeEnd()) return;
17860            if (!isGrid2 || event.ctrlKey) return store?.last();
17861            return store?.next(-1);
17862          },
17863          PageUp: () => {
17864            return findNextPageItemId(currentTarget, store, store?.up, true);
17865          },
17866          PageDown: () => {
17867            return findNextPageItemId(currentTarget, store, store?.down);
17868          }
17869        }[event.key];
17870        if (action) {
17871          if (isTextbox(currentTarget)) {
17872            const selection = getTextboxSelection(currentTarget);
17873            const isLeft = isHorizontal && event.key === "ArrowLeft";
17874            const isRight = isHorizontal && event.key === "ArrowRight";
17875            const isUp = isVertical && event.key === "ArrowUp";
17876            const isDown = isVertical && event.key === "ArrowDown";
17877            if (isRight || isDown) {
17878              const { length: valueLength } = getTextboxValue(currentTarget);
17879              if (selection.end !== valueLength) return;
17880            } else if ((isLeft || isUp) && selection.start !== 0) return;
17881          }
17882          const nextId = action();
17883          if (preventScrollOnKeyDownProp(event) || nextId !== void 0) {
17884            if (!moveOnKeyPressProp(event)) return;
17885            event.preventDefault();
17886            store.move(nextId);
17887          }
17888        }
17889      });
17890      const providerValue = (0, import_react13.useMemo)(() => ({
17891        id,
17892        baseElement
17893      }), [id, baseElement]);
17894      props = useWrapElement(props, (element) => /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(CompositeItemContext.Provider, {
17895        value: providerValue,
17896        children: element
17897      }), [providerValue]);
17898      props = {
17899        "data-active-item": isActiveItem || void 0,
17900        ...props,
17901        id,
17902        ref: useMergeRefs(ref, props.ref),
17903        tabIndex: isTabbable ? props.tabIndex : -1,
17904        onFocus,
17905        onBlurCapture,
17906        onKeyDown
17907      };
17908      props = useCommand(props);
17909      props = useCollectionItem({
17910        store,
17911        ...props,
17912        getItem,
17913        shouldRegisterItem: id ? shouldRegisterItem : false
17914      });
17915      return removeUndefinedValues({
17916        ...props,
17917        "aria-setsize": ariaSetSize,
17918        "aria-posinset": ariaPosInSet
17919      });
17920    });
17921    var CompositeItem = memo3(forwardRef21(function CompositeItem2(props) {
17922      return createElement3(TagName4, useCompositeItem(props));
17923    }));
17924  
17925    // node_modules/@ariakit/react-components/dist/composite/composite.js
17926    var import_react14 = __toESM(require_react(), 1);
17927    var import_jsx_runtime74 = __toESM(require_jsx_runtime(), 1);
17928    var TagName5 = "div";
17929    function isGrid(items) {
17930      return items.some((item) => !!item.rowId);
17931    }
17932    function isPrintableKey(event) {
17933      const target = event.target;
17934      if (target && !isTextField(target)) return false;
17935      return event.key.length === 1 && !event.ctrlKey && !event.metaKey;
17936    }
17937    function isModifierKey(event) {
17938      return event.key === "Shift" || event.key === "Control" || event.key === "Alt" || event.key === "Meta";
17939    }
17940    function useKeyboardEventProxy(store, onKeyboardEvent, previousElementRef) {
17941      return useEvent((event) => {
17942        onKeyboardEvent?.(event);
17943        if (event.defaultPrevented) return;
17944        if (event.isPropagationStopped()) return;
17945        if (!isSelfTarget(event)) return;
17946        if (isModifierKey(event)) return;
17947        if (isPrintableKey(event)) return;
17948        const activeElement2 = getEnabledItem(store, store.getState().activeId)?.element;
17949        if (!activeElement2) return;
17950        const { view, ...eventInit } = event;
17951        if (activeElement2 !== previousElementRef?.current) activeElement2.focus();
17952        if (!fireKeyboardEvent(activeElement2, event.type, eventInit)) event.preventDefault();
17953        if (event.currentTarget.contains(activeElement2)) event.stopPropagation();
17954      });
17955    }
17956    function findFirstEnabledItemInTheLastRow(items) {
17957      return findFirstEnabledItem2(flatten2DArray(reverseArray(groupItemsByRows2(items))));
17958    }
17959    function withBaseScrollPreserved(store, callback) {
17960      const { virtualFocus, baseElement } = store.getState();
17961      if (!virtualFocus || !baseElement || !isTextField(baseElement)) {
17962        callback();
17963        return;
17964      }
17965      const savedScrollLeft = baseElement.scrollLeft;
17966      const savedScrollTop = baseElement.scrollTop;
17967      callback();
17968      baseElement.scrollLeft = savedScrollLeft;
17969      baseElement.scrollTop = savedScrollTop;
17970    }
17971    function useScheduleFocus(store) {
17972      const [scheduled, setScheduled] = (0, import_react14.useState)(false);
17973      const schedule = (0, import_react14.useCallback)(() => setScheduled(true), []);
17974      const activeItem = useStoreState(store, (state) => scheduled ? getEnabledItem(store, state.activeId) : null);
17975      (0, import_react14.useEffect)(() => {
17976        const activeElement2 = activeItem?.element;
17977        if (!scheduled) return;
17978        if (!activeElement2) return;
17979        setScheduled(false);
17980        withBaseScrollPreserved(store, () => {
17981          activeElement2.focus({ preventScroll: true });
17982        });
17983      }, [
17984        store,
17985        activeItem,
17986        scheduled
17987      ]);
17988      return schedule;
17989    }
17990    var CompositeFocusOnMove = memo3(function CompositeFocusOnMove2({ store, focusOnMove, previousElementRef }) {
17991      const moves = useStoreState(store, "moves");
17992      const baseElement = useStoreState(store, "baseElement");
17993      (0, import_react14.useEffect)(() => {
17994        if (!moves) return;
17995        if (!focusOnMove) return;
17996        const { activeId } = store.getState();
17997        const itemElement = getEnabledItem(store, activeId)?.element;
17998        if (!itemElement) return;
17999        withBaseScrollPreserved(store, () => focusIntoView(itemElement));
18000      }, [
18001        store,
18002        moves,
18003        focusOnMove
18004      ]);
18005      useSafeLayoutEffect(() => {
18006        if (!moves) return;
18007        if (!baseElement) return;
18008        const { activeId } = store.getState();
18009        if (!(activeId === null)) return;
18010        const previousElement = previousElementRef.current;
18011        previousElementRef.current = null;
18012        if (previousElement) fireBlurEvent(previousElement, { relatedTarget: baseElement });
18013        if (!hasFocus(baseElement)) baseElement.focus();
18014      }, [
18015        store,
18016        moves,
18017        baseElement
18018      ]);
18019      return null;
18020    });
18021    var useComposite = createHook(function useComposite2({ store, composite = true, focusOnMove = composite, moveOnKeyPress = true, ...props }) {
18022      const context = useCompositeProviderContext();
18023      store = store || context;
18024      invariant(store, "Composite must receive a `store` prop or be wrapped in a CompositeProvider component.");
18025      const ref = (0, import_react14.useRef)(null);
18026      const previousElementRef = (0, import_react14.useRef)(null);
18027      const scheduleFocus = useScheduleFocus(store);
18028      const [, setBaseElement] = useTransactionState(composite ? store.setBaseElement : null);
18029      const virtualFocus = useStoreState(store, "virtualFocus");
18030      const activeId = useStoreState(store, (state) => state.virtualFocus ? state.activeId : null);
18031      useSafeLayoutEffect(() => {
18032        if (!store) return;
18033        if (!composite) return;
18034        if (!virtualFocus) return;
18035        const previousElement = previousElementRef.current;
18036        previousElementRef.current = null;
18037        if (!previousElement) return;
18038        const relatedTarget = getEnabledItem(store, activeId)?.element || getActiveElement(previousElement);
18039        if (relatedTarget === previousElement) return;
18040        fireBlurEvent(previousElement, { relatedTarget });
18041      }, [
18042        store,
18043        activeId,
18044        virtualFocus,
18045        composite
18046      ]);
18047      const onKeyDownCapture = useKeyboardEventProxy(store, props.onKeyDownCapture, previousElementRef);
18048      const onKeyUpCapture = useKeyboardEventProxy(store, props.onKeyUpCapture, previousElementRef);
18049      const onFocusCaptureProp = props.onFocusCapture;
18050      const onFocusCapture = useEvent((event) => {
18051        onFocusCaptureProp?.(event);
18052        if (event.defaultPrevented) return;
18053        if (!store) return;
18054        const { virtualFocus: virtualFocus2 } = store.getState();
18055        if (!virtualFocus2) return;
18056        const previousActiveElement = event.relatedTarget;
18057        const isSilentlyFocused = silentlyFocused(event.currentTarget);
18058        if (isSelfTarget(event) && isSilentlyFocused) {
18059          event.stopPropagation();
18060          previousElementRef.current = previousActiveElement;
18061        }
18062      });
18063      const onFocusProp = props.onFocus;
18064      const onFocus = useEvent((event) => {
18065        onFocusProp?.(event);
18066        if (event.defaultPrevented) return;
18067        if (!composite) return;
18068        if (!store) return;
18069        const { relatedTarget } = event;
18070        const { virtualFocus: virtualFocus2 } = store.getState();
18071        if (virtualFocus2) {
18072          if (isSelfTarget(event) && !isItem(store, relatedTarget)) queueMicrotask(scheduleFocus);
18073        } else if (isSelfTarget(event)) store.setActiveId(null);
18074      });
18075      const onBlurCaptureProp = props.onBlurCapture;
18076      const onBlurCapture = useEvent((event) => {
18077        onBlurCaptureProp?.(event);
18078        if (event.defaultPrevented) return;
18079        if (!store) return;
18080        const { virtualFocus: virtualFocus2, activeId: activeId2 } = store.getState();
18081        if (!virtualFocus2) return;
18082        const activeElement2 = getEnabledItem(store, activeId2)?.element;
18083        const nextActiveElement = event.relatedTarget;
18084        const nextActiveElementIsItem = isItem(store, nextActiveElement);
18085        const previousElement = previousElementRef.current;
18086        previousElementRef.current = null;
18087        if (isSelfTarget(event) && nextActiveElementIsItem) {
18088          if (nextActiveElement === activeElement2) {
18089            if (previousElement && previousElement !== nextActiveElement) fireBlurEvent(previousElement, event);
18090          } else if (activeElement2) fireBlurEvent(activeElement2, event);
18091          else if (previousElement) fireBlurEvent(previousElement, event);
18092          event.stopPropagation();
18093        } else if (!isItem(store, event.target) && activeElement2) fireBlurEvent(activeElement2, event);
18094      });
18095      const onKeyDownProp = props.onKeyDown;
18096      const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress);
18097      const onKeyDown = useEvent((event) => {
18098        onKeyDownProp?.(event);
18099        if (event.nativeEvent.isComposing) return;
18100        if (event.defaultPrevented) return;
18101        if (!store) return;
18102        if (!isSelfTarget(event)) return;
18103        const { orientation, renderedItems, activeId: activeId2, rtl } = store.getState();
18104        if (getEnabledItem(store, activeId2)?.element?.isConnected) return;
18105        const isVertical = orientation !== "horizontal";
18106        const isHorizontal = orientation !== "vertical";
18107        const grid = isGrid(renderedItems);
18108        if ((event.key === "ArrowLeft" || event.key === "ArrowRight" || event.key === "Home" || event.key === "End") && isTextField(event.currentTarget)) return;
18109        const up = () => {
18110          if (grid) return findFirstEnabledItemInTheLastRow(renderedItems)?.id;
18111          return store?.last();
18112        };
18113        const action = {
18114          ArrowUp: (grid || isVertical) && up,
18115          ArrowRight: (grid || isHorizontal) && (rtl ? store.last : store.first),
18116          ArrowDown: (grid || isVertical) && store.first,
18117          ArrowLeft: (grid || isHorizontal) && (rtl ? store.first : store.last),
18118          Home: store.first,
18119          End: store.last,
18120          PageUp: store.first,
18121          PageDown: store.last
18122        }[event.key];
18123        if (action) {
18124          const id = action();
18125          if (id !== void 0) {
18126            if (!moveOnKeyPressProp(event)) return;
18127            event.preventDefault();
18128            store.move(id);
18129          }
18130        }
18131      });
18132      props = useWrapElement(props, (element) => /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(CompositeScopedContextProvider, {
18133        value: store,
18134        children: [element, composite && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(CompositeFocusOnMove, {
18135          store,
18136          focusOnMove,
18137          previousElementRef
18138        })]
18139      }), [
18140        store,
18141        composite,
18142        focusOnMove
18143      ]);
18144      props = {
18145        "aria-activedescendant": useStoreState(store, (state) => {
18146          if (!store) return;
18147          if (!composite) return;
18148          if (!state.virtualFocus) return;
18149          return getEnabledItem(store, state.activeId)?.id;
18150        }),
18151        ...props,
18152        ref: useMergeRefs(ref, setBaseElement, props.ref),
18153        onKeyDownCapture,
18154        onKeyUpCapture,
18155        onFocusCapture,
18156        onFocus,
18157        onBlurCapture,
18158        onKeyDown
18159      };
18160      props = useFocusable({
18161        focusable: useStoreState(store, (state) => composite && (state.virtualFocus || state.activeId === null)),
18162        ...props
18163      });
18164      return props;
18165    });
18166    var Composite6 = forwardRef21(function Composite7(props) {
18167      return createElement3(TagName5, useComposite(props));
18168    });
18169  
18170    // node_modules/@ariakit/react-components/dist/disclosure/disclosure-context.js
18171    var ctx3 = createStoreContext();
18172    var useDisclosureContext = ctx3.useContext;
18173    var useDisclosureScopedContext = ctx3.useScopedContext;
18174    var useDisclosureProviderContext = ctx3.useProviderContext;
18175    var DisclosureContextProvider = ctx3.ContextProvider;
18176    var DisclosureScopedContextProvider = ctx3.ScopedContextProvider;
18177  
18178    // node_modules/@ariakit/react-components/dist/dialog/dialog-context.js
18179    var import_react15 = __toESM(require_react(), 1);
18180    var ctx4 = createStoreContext([DisclosureContextProvider], [DisclosureScopedContextProvider]);
18181    var useDialogContext = ctx4.useContext;
18182    var useDialogScopedContext = ctx4.useScopedContext;
18183    var useDialogProviderContext = ctx4.useProviderContext;
18184    var DialogContextProvider = ctx4.ContextProvider;
18185    var DialogScopedContextProvider = ctx4.ScopedContextProvider;
18186    var DialogHeadingContext = (0, import_react15.createContext)(void 0);
18187    var DialogDescriptionContext = (0, import_react15.createContext)(void 0);
18188  
18189    // node_modules/@ariakit/react-components/dist/disclosure/disclosure-content.js
18190    var import_react16 = __toESM(require_react(), 1);
18191    var import_jsx_runtime75 = __toESM(require_jsx_runtime(), 1);
18192    var import_react_dom4 = __toESM(require_react_dom(), 1);
18193    var TagName6 = "div";
18194    function afterTimeout(timeoutMs, cb) {
18195      const timeoutId = setTimeout(cb, timeoutMs);
18196      return () => clearTimeout(timeoutId);
18197    }
18198    function parseCSSTime(time) {
18199      const value = time?.trim() || "0s";
18200      const multiplier = value.endsWith("ms") ? 1 : 1e3;
18201      const parsed = Number.parseFloat(value) * multiplier;
18202      return Number.isNaN(parsed) ? 0 : parsed;
18203    }
18204    function getEndTime(names, delays, durations) {
18205      const nameList = names.split(",");
18206      const delayList = delays.split(",");
18207      const durationList = durations.split(",");
18208      let endTime = 0;
18209      for (const [index2, name] of nameList.entries()) {
18210        if (name.trim() === "none") continue;
18211        const delay = parseCSSTime(delayList[index2 % delayList.length]);
18212        const duration = parseCSSTime(durationList[index2 % durationList.length]);
18213        endTime = Math.max(endTime, delay + duration);
18214      }
18215      return endTime;
18216    }
18217    function getElementEndTime(element) {
18218      const { transitionProperty, transitionDuration, transitionDelay, animationName, animationDuration, animationDelay } = getComputedStyle(element);
18219      return Math.max(getEndTime(transitionProperty, transitionDelay, transitionDuration), getEndTime(animationName, animationDelay, animationDuration));
18220    }
18221    function isHidden(mounted, hidden, alwaysVisible) {
18222      return !alwaysVisible && hidden !== false && (!mounted || !!hidden);
18223    }
18224    var useDisclosureContent = createHook(function useDisclosureContent2({ store, alwaysVisible, unstable_otherElementRef: otherElementRef, ...props }) {
18225      const context = useDisclosureProviderContext();
18226      store = store || context;
18227      invariant(store, "DisclosureContent must receive a `store` prop or be wrapped in a DisclosureProvider component.");
18228      const ref = (0, import_react16.useRef)(null);
18229      const id = useId4(props.id);
18230      const [transition, setTransition] = (0, import_react16.useState)(null);
18231      const open = useStoreState(store, "open");
18232      const mounted = useStoreState(store, "mounted");
18233      const animated = useStoreState(store, "animated");
18234      const contentElement = useStoreState(store, "contentElement");
18235      const otherElement = useStoreState(store.disclosure, "contentElement");
18236      const hasClosedRef = (0, import_react16.useRef)(false);
18237      useSafeLayoutEffect(() => {
18238        if (!ref.current) return;
18239        store?.setContentElement(ref.current);
18240      }, [store]);
18241      useSafeLayoutEffect(() => {
18242        let previousAnimated;
18243        store?.setState("animated", (animated2) => {
18244          previousAnimated = animated2;
18245          return true;
18246        });
18247        return () => {
18248          if (previousAnimated === void 0) return;
18249          store?.setState("animated", previousAnimated);
18250        };
18251      }, [store]);
18252      useSafeLayoutEffect(() => {
18253        if (!animated) {
18254          if (!open) {
18255            hasClosedRef.current = true;
18256            setTransition(null);
18257          } else if (hasClosedRef.current) {
18258            hasClosedRef.current = false;
18259            setTransition("enter");
18260          }
18261          return;
18262        }
18263        if (!contentElement?.isConnected) {
18264          setTransition(null);
18265          return;
18266        }
18267        return afterPaint(() => {
18268          setTransition(open ? "enter" : mounted ? "leave" : null);
18269        });
18270      }, [
18271        animated,
18272        contentElement,
18273        open,
18274        mounted
18275      ]);
18276      useSafeLayoutEffect(() => {
18277        if (!store) return;
18278        if (!animated) return;
18279        if (!transition) return;
18280        if (!contentElement) return;
18281        const stopAnimation = () => store?.setState("animating", false);
18282        const stopAnimationSync = () => (0, import_react_dom4.flushSync)(stopAnimation);
18283        if (transition === "leave" && open) return;
18284        if (transition === "enter" && !open) return;
18285        if (typeof animated === "number") return afterTimeout(animated, stopAnimationSync);
18286        const elements = [contentElement];
18287        if (otherElement) elements.push(otherElement);
18288        const relatedElement = otherElementRef?.current;
18289        if (relatedElement) elements.push(relatedElement);
18290        const timeout = Math.max(...elements.map(getElementEndTime));
18291        if (!timeout) {
18292          if (transition === "enter") store.setState("animated", false);
18293          stopAnimation();
18294          return;
18295        }
18296        return afterTimeout(Math.max(timeout - 1e3 / 60, 0), stopAnimationSync);
18297      }, [
18298        store,
18299        animated,
18300        contentElement,
18301        otherElement,
18302        otherElementRef,
18303        open,
18304        transition
18305      ]);
18306      props = useWrapElement(props, (element) => /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(DialogScopedContextProvider, {
18307        value: store,
18308        children: element
18309      }), [store]);
18310      const hidden = isHidden(mounted, props.hidden, alwaysVisible);
18311      const styleProp = props.style;
18312      const style = (0, import_react16.useMemo)(() => {
18313        if (hidden) return {
18314          ...styleProp,
18315          display: "none"
18316        };
18317        return styleProp;
18318      }, [hidden, styleProp]);
18319      props = {
18320        "data-open": open || void 0,
18321        "data-enter": transition === "enter" || void 0,
18322        "data-leave": transition === "leave" || void 0,
18323        hidden,
18324        ...props,
18325        id,
18326        ref: useMergeRefs(id ? store.setContentElement : null, ref, props.ref),
18327        style
18328      };
18329      return removeUndefinedValues(props);
18330    });
18331    var DisclosureContentImpl = forwardRef21(function DisclosureContentImpl2(props) {
18332      return createElement3(TagName6, useDisclosureContent(props));
18333    });
18334    var DisclosureContent = forwardRef21(function DisclosureContent2({ unmountOnHide, ...props }) {
18335      const context = useDisclosureProviderContext();
18336      if (useStoreState(props.store || context, (state) => !unmountOnHide || state?.mounted) === false) return null;
18337      return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(DisclosureContentImpl, { ...props });
18338    });
18339  
18340    // node_modules/@ariakit/components/dist/disclosure/disclosure-store.js
18341    function createDisclosureStore(props = {}) {
18342      const store = mergeStore(props.store, omit2(props.disclosure, ["contentElement", "disclosureElement"]));
18343      throwOnConflictingProps(props, store);
18344      const syncState = store?.getState();
18345      const open = defaultValue(props.open, syncState?.open, props.defaultOpen, false);
18346      const animated = defaultValue(props.animated, syncState?.animated, false);
18347      const disclosure = createStore({
18348        open,
18349        animated,
18350        animating: !!animated && open,
18351        mounted: open,
18352        contentElement: defaultValue(syncState?.contentElement, null),
18353        disclosureElement: defaultValue(syncState?.disclosureElement, null)
18354      }, store);
18355      setup(disclosure, () => sync(disclosure, ["animated", "animating"], (state) => {
18356        if (state.animated) return;
18357        disclosure.setState("animating", false);
18358      }));
18359      setup(disclosure, () => subscribe(disclosure, ["open"], () => {
18360        if (!disclosure.getState().animated) return;
18361        disclosure.setState("animating", true);
18362      }));
18363      setup(disclosure, () => sync(disclosure, ["open", "animating"], (state) => {
18364        disclosure.setState("mounted", state.open || state.animating);
18365      }));
18366      return {
18367        ...disclosure,
18368        disclosure: props.disclosure,
18369        setOpen: (value) => disclosure.setState("open", value),
18370        show: () => disclosure.setState("open", true),
18371        hide: () => disclosure.setState("open", false),
18372        toggle: () => disclosure.setState("open", (open2) => !open2),
18373        stopAnimation: () => disclosure.setState("animating", false),
18374        setContentElement: (value) => disclosure.setState("contentElement", value),
18375        setDisclosureElement: (value) => disclosure.setState("disclosureElement", value)
18376      };
18377    }
18378  
18379    // node_modules/@ariakit/react-components/dist/disclosure/disclosure-store.js
18380    function useDisclosureStoreProps(store, update2, props) {
18381      useUpdateEffect(update2, [props.store, props.disclosure]);
18382      useStoreProps(store, props, "open", "setOpen");
18383      useStoreProps(store, props, "mounted", "setMounted");
18384      useStoreProps(store, props, "animated");
18385      return Object.assign(store, { disclosure: props.disclosure });
18386    }
18387  
18388    // node_modules/@ariakit/react-components/dist/popover/popover-context.js
18389    var ctx5 = createStoreContext([DialogContextProvider], [DialogScopedContextProvider]);
18390    var usePopoverContext = ctx5.useContext;
18391    var usePopoverScopedContext = ctx5.useScopedContext;
18392    var usePopoverProviderContext = ctx5.useProviderContext;
18393    var PopoverContextProvider = ctx5.ContextProvider;
18394    var PopoverScopedContextProvider = ctx5.ScopedContextProvider;
18395  
18396    // node_modules/@ariakit/react-components/dist/combobox/combobox-context.js
18397    var import_react17 = __toESM(require_react(), 1);
18398    var ComboboxListRoleContext = (0, import_react17.createContext)(void 0);
18399    var ctx6 = createStoreContext([PopoverContextProvider, CompositeContextProvider], [PopoverScopedContextProvider, CompositeScopedContextProvider]);
18400    var useComboboxContext = ctx6.useContext;
18401    var useComboboxScopedContext = ctx6.useScopedContext;
18402    var useComboboxProviderContext = ctx6.useProviderContext;
18403    var ComboboxContextProvider = ctx6.ContextProvider;
18404    var ComboboxScopedContextProvider = ctx6.ScopedContextProvider;
18405    var ComboboxItemValueContext = (0, import_react17.createContext)(void 0);
18406    var ComboboxItemCheckedContext = (0, import_react17.createContext)(false);
18407  
18408    // node_modules/@ariakit/react-components/dist/collection/collection-store.js
18409    function useCollectionStoreProps(store, update2, props) {
18410      useUpdateEffect(update2, [props.store]);
18411      useStoreProps(store, props, "items", "setItems");
18412      return store;
18413    }
18414  
18415    // node_modules/@ariakit/react-components/dist/composite/composite-store.js
18416    function useCompositeStoreOptions(props) {
18417      return {
18418        id: useId4(props.id),
18419        ...props
18420      };
18421    }
18422    function useCompositeStoreProps(store, update2, props) {
18423      store = useCollectionStoreProps(store, update2, props);
18424      useStoreProps(store, props, "activeId", "setActiveId");
18425      useStoreProps(store, props, "includesBaseElement");
18426      useStoreProps(store, props, "virtualFocus");
18427      useStoreProps(store, props, "orientation");
18428      useStoreProps(store, props, "rtl");
18429      useStoreProps(store, props, "focusLoop");
18430      useStoreProps(store, props, "focusWrap");
18431      useStoreProps(store, props, "focusShift");
18432      return store;
18433    }
18434  
18435    // node_modules/@ariakit/components/dist/dialog/dialog-store.js
18436    function createDialogStore(props = {}) {
18437      return createDisclosureStore(props);
18438    }
18439  
18440    // node_modules/@ariakit/react-components/dist/dialog/dialog-store.js
18441    function useDialogStoreProps(store, update2, props) {
18442      return useDisclosureStoreProps(store, update2, props);
18443    }
18444  
18445    // node_modules/@ariakit/components/dist/popover/popover-store.js
18446    function createPopoverStore({ popover: otherPopover, ...props } = {}) {
18447      const store = mergeStore(props.store, omit2(otherPopover, [
18448        "arrowElement",
18449        "anchorElement",
18450        "contentElement",
18451        "popoverElement",
18452        "disclosureElement"
18453      ]));
18454      throwOnConflictingProps(props, store);
18455      const syncState = store?.getState();
18456      const dialog = createDialogStore({
18457        ...props,
18458        store
18459      });
18460      const placement = defaultValue(props.placement, syncState?.placement, "bottom");
18461      const popover = createStore({
18462        ...dialog.getState(),
18463        placement,
18464        currentPlacement: placement,
18465        anchorElement: defaultValue(syncState?.anchorElement, null),
18466        popoverElement: defaultValue(syncState?.popoverElement, null),
18467        arrowElement: defaultValue(syncState?.arrowElement, null),
18468        rendered: /* @__PURE__ */ Symbol("rendered")
18469      }, dialog, store);
18470      return {
18471        ...dialog,
18472        ...popover,
18473        setAnchorElement: (element) => popover.setState("anchorElement", element),
18474        setPopoverElement: (element) => popover.setState("popoverElement", element),
18475        setArrowElement: (element) => popover.setState("arrowElement", element),
18476        render: () => popover.setState("rendered", /* @__PURE__ */ Symbol("rendered"))
18477      };
18478    }
18479  
18480    // node_modules/@ariakit/react-components/dist/popover/popover-store.js
18481    function usePopoverStoreProps(store, update2, props) {
18482      useUpdateEffect(update2, [props.popover]);
18483      useStoreProps(store, props, "placement");
18484      return useDialogStoreProps(store, update2, props);
18485    }
18486  
18487    // node_modules/@ariakit/react-components/dist/popover/popover-anchor.js
18488    var TagName7 = "div";
18489    var usePopoverAnchor = createHook(function usePopoverAnchor2({ store, ...props }) {
18490      const context = usePopoverProviderContext();
18491      store = store || context;
18492      props = {
18493        ...props,
18494        ref: useMergeRefs(store?.setAnchorElement, props.ref)
18495      };
18496      return props;
18497    });
18498    var PopoverAnchor = forwardRef21(function PopoverAnchor2(props) {
18499      return createElement3(TagName7, usePopoverAnchor(props));
18500    });
18501  
18502    // node_modules/@ariakit/react-components/dist/composite/composite-hover.js
18503    var import_react18 = __toESM(require_react(), 1);
18504    var TagName8 = "div";
18505    function hoveringInside(event) {
18506      const nextElement = event.relatedTarget;
18507      if (!isElement2(nextElement)) return false;
18508      return contains2(event.currentTarget, nextElement);
18509    }
18510    var symbol2 = /* @__PURE__ */ Symbol("composite-hover");
18511    function movingToAnotherItem(event) {
18512      const { relatedTarget } = event;
18513      if (!isElement2(relatedTarget)) return false;
18514      let dest = relatedTarget;
18515      do {
18516        if (hasOwnProperty(dest, symbol2) && dest[symbol2]) return true;
18517        dest = dest.parentElement;
18518      } while (dest);
18519      return false;
18520    }
18521    var useCompositeHover = createHook(function useCompositeHover2({ store, focusOnHover = true, blurOnHoverEnd = !!focusOnHover, ...props }) {
18522      const context = useCompositeScopedContext();
18523      store = store || context;
18524      invariant(store, "CompositeHover must be wrapped in a Composite component.");
18525      const isMouseMoving = useIsMouseMoving();
18526      const onMouseMoveProp = props.onMouseMove;
18527      const focusOnHoverProp = useBooleanEvent(focusOnHover);
18528      const onMouseMove = useEvent((event) => {
18529        onMouseMoveProp?.(event);
18530        if (event.defaultPrevented) return;
18531        if (!isMouseMoving()) return;
18532        if (!focusOnHoverProp(event)) return;
18533        if (!hasFocusWithin(event.currentTarget)) {
18534          const baseElement = store?.getState().baseElement;
18535          if (baseElement && !hasFocus(baseElement)) baseElement.focus();
18536        }
18537        store?.setActiveId(event.currentTarget.id);
18538      });
18539      const onMouseLeaveProp = props.onMouseLeave;
18540      const blurOnHoverEndProp = useBooleanEvent(blurOnHoverEnd);
18541      const onMouseLeave = useEvent((event) => {
18542        onMouseLeaveProp?.(event);
18543        if (event.defaultPrevented) return;
18544        if (!isMouseMoving()) return;
18545        if (hoveringInside(event)) return;
18546        if (movingToAnotherItem(event)) return;
18547        if (!focusOnHoverProp(event)) return;
18548        if (!blurOnHoverEndProp(event)) return;
18549        store?.setActiveId(null);
18550        store?.getState().baseElement?.focus();
18551      });
18552      const ref = (0, import_react18.useCallback)((element) => {
18553        if (!element) return;
18554        element[symbol2] = true;
18555      }, []);
18556      props = {
18557        ...props,
18558        ref: useMergeRefs(ref, props.ref),
18559        onMouseMove,
18560        onMouseLeave
18561      };
18562      return removeUndefinedValues(props);
18563    });
18564    var CompositeHover = memo3(forwardRef21(function CompositeHover2(props) {
18565      return createElement3(TagName8, useCompositeHover(props));
18566    }));
18567  
18568    // node_modules/@ariakit/react-components/dist/combobox/combobox.js
18569    var import_react19 = __toESM(require_react(), 1);
18570    var TagName9 = "input";
18571    function isFirstItemAutoSelected(items, activeValue, autoSelect) {
18572      if (!autoSelect) return false;
18573      return items.find((item) => !item.disabled && item.value)?.value === activeValue;
18574    }
18575    function hasCompletionString(value, activeValue) {
18576      if (!activeValue) return false;
18577      if (value == null) return false;
18578      const normalizedValue = normalizeString(value);
18579      const normalizedActiveValue = normalizeString(activeValue);
18580      if (normalizedValue.length !== value.length) return false;
18581      if (normalizedActiveValue.length !== activeValue.length) return false;
18582      return normalizedActiveValue.length > normalizedValue.length && normalizedActiveValue.toLowerCase().startsWith(normalizedValue.toLowerCase());
18583    }
18584    function isAriaAutoCompleteValue(value) {
18585      return value === "inline" || value === "list" || value === "both" || value === "none";
18586    }
18587    function getDefaultAutoSelectId(items) {
18588      return items.find((item) => {
18589        if (item.disabled) return false;
18590        return item.element?.getAttribute("role") !== "tab";
18591      })?.id;
18592    }
18593    var useCombobox = createHook(function useCombobox2({ store, focusable: focusable2 = true, autoSelect: autoSelectProp = false, getAutoSelectId, setValueOnChange, showMinLength = 0, showOnChange, showOnMouseDown, showOnClick = showOnMouseDown, showOnKeyDown, showOnKeyPress = showOnKeyDown, blurActiveItemOnClick, setValueOnClick = true, moveOnKeyPress = true, autoComplete = "list", ...props }) {
18594      const context = useComboboxProviderContext();
18595      store = store || context;
18596      invariant(store, "Combobox must receive a `store` prop or be wrapped in a ComboboxProvider component.");
18597      const ref = (0, import_react19.useRef)(null);
18598      const [valueUpdated, forceValueUpdate] = useForceUpdate();
18599      const canAutoSelectRef = (0, import_react19.useRef)(false);
18600      const composingRef = (0, import_react19.useRef)(false);
18601      const autoSelect = useStoreState(store, (state) => state.virtualFocus && autoSelectProp);
18602      const inline4 = autoComplete === "inline" || autoComplete === "both";
18603      const [canInline, setCanInline] = (0, import_react19.useState)(inline4);
18604      useUpdateLayoutEffect(() => {
18605        if (!inline4) return;
18606        setCanInline(true);
18607      }, [inline4]);
18608      const storeValue = useStoreState(store, "value");
18609      const prevSelectedValueRef = (0, import_react19.useRef)(void 0);
18610      (0, import_react19.useEffect)(() => {
18611        return sync(store, ["selectedValue", "activeId"], (_, prev) => {
18612          prevSelectedValueRef.current = prev.selectedValue;
18613        });
18614      }, [store]);
18615      const inlineActiveValue = useStoreState(store, (state) => {
18616        if (!inline4) return;
18617        if (!canInline) return;
18618        if (state.activeValue && Array.isArray(state.selectedValue)) {
18619          if (state.selectedValue.includes(state.activeValue)) return;
18620          if (prevSelectedValueRef.current?.includes(state.activeValue)) return;
18621        }
18622        return state.activeValue;
18623      });
18624      const items = useStoreState(store, "renderedItems");
18625      const open = useStoreState(store, "open");
18626      const contentElement = useStoreState(store, "contentElement");
18627      const value = (0, import_react19.useMemo)(() => {
18628        if (!inline4) return storeValue;
18629        if (!canInline) return storeValue;
18630        if (isFirstItemAutoSelected(items, inlineActiveValue, autoSelect)) {
18631          if (hasCompletionString(storeValue, inlineActiveValue)) return storeValue + (inlineActiveValue?.slice(storeValue.length) || "");
18632          return storeValue;
18633        }
18634        return inlineActiveValue || storeValue;
18635      }, [
18636        inline4,
18637        canInline,
18638        items,
18639        inlineActiveValue,
18640        autoSelect,
18641        storeValue
18642      ]);
18643      (0, import_react19.useEffect)(() => {
18644        const element = ref.current;
18645        if (!element) return;
18646        const onCompositeItemMove = () => setCanInline(true);
18647        element.addEventListener("combobox-item-move", onCompositeItemMove);
18648        return () => {
18649          element.removeEventListener("combobox-item-move", onCompositeItemMove);
18650        };
18651      }, []);
18652      (0, import_react19.useEffect)(() => {
18653        if (!inline4) return;
18654        if (!canInline) return;
18655        if (!inlineActiveValue) return;
18656        if (!isFirstItemAutoSelected(items, inlineActiveValue, autoSelect)) return;
18657        if (!hasCompletionString(storeValue, inlineActiveValue)) return;
18658        let cleanup = noop5;
18659        queueMicrotask(() => {
18660          const element = ref.current;
18661          if (!element) return;
18662          const { start: prevStart, end: prevEnd } = getTextboxSelection(element);
18663          const nextStart = storeValue.length;
18664          const nextEnd = inlineActiveValue.length;
18665          setSelectionRange(element, nextStart, nextEnd);
18666          cleanup = () => {
18667            if (!hasFocus(element)) return;
18668            const { start, end } = getTextboxSelection(element);
18669            if (start !== nextStart) return;
18670            if (end !== nextEnd) return;
18671            setSelectionRange(element, prevStart, prevEnd);
18672          };
18673        });
18674        return () => cleanup();
18675      }, [
18676        valueUpdated,
18677        inline4,
18678        canInline,
18679        inlineActiveValue,
18680        items,
18681        autoSelect,
18682        storeValue
18683      ]);
18684      const getAutoSelectIdProp = useEvent(getAutoSelectId);
18685      const autoSelectIdRef = (0, import_react19.useRef)(null);
18686      const autoSelectMovedRef = (0, import_react19.useRef)(void 0);
18687      const userScrolledRef = (0, import_react19.useRef)(false);
18688      const isAutoScrollingRef = (0, import_react19.useRef)(false);
18689      (0, import_react19.useEffect)(() => {
18690        if (!open) return;
18691        if (!contentElement) return;
18692        const scrollingElement = getScrollingElement(contentElement);
18693        if (!scrollingElement) return;
18694        const onUserScroll = () => {
18695          canAutoSelectRef.current = false;
18696          userScrolledRef.current = true;
18697        };
18698        const onScroll = () => {
18699          if (!isAutoScrollingRef.current) userScrolledRef.current = true;
18700          if (!store) return;
18701          if (!canAutoSelectRef.current) return;
18702          const { activeId } = store.getState();
18703          if (activeId === null) return;
18704          if (activeId === autoSelectIdRef.current) return;
18705          canAutoSelectRef.current = false;
18706        };
18707        const options = {
18708          passive: true,
18709          capture: true
18710        };
18711        scrollingElement.addEventListener("wheel", onUserScroll, options);
18712        scrollingElement.addEventListener("touchmove", onUserScroll, options);
18713        scrollingElement.addEventListener("scroll", onScroll, options);
18714        return () => {
18715          scrollingElement.removeEventListener("wheel", onUserScroll, true);
18716          scrollingElement.removeEventListener("touchmove", onUserScroll, true);
18717          scrollingElement.removeEventListener("scroll", onScroll, true);
18718        };
18719      }, [
18720        open,
18721        contentElement,
18722        store
18723      ]);
18724      useSafeLayoutEffect(() => {
18725        userScrolledRef.current = false;
18726        if (!storeValue) return;
18727        if (composingRef.current) return;
18728        canAutoSelectRef.current = true;
18729      }, [storeValue]);
18730      useSafeLayoutEffect(() => {
18731        if (autoSelect !== "always" && open) return;
18732        canAutoSelectRef.current = open;
18733      }, [autoSelect, open]);
18734      useSafeLayoutEffect(() => {
18735        if (open) return;
18736        autoSelectMovedRef.current = void 0;
18737      }, [open]);
18738      const resetValueOnSelect = useStoreState(store, "resetValueOnSelect");
18739      useUpdateEffect(() => {
18740        const canAutoSelect = canAutoSelectRef.current;
18741        if (!store) return;
18742        if (!open) return;
18743        if (!canAutoSelect && (!resetValueOnSelect || userScrolledRef.current)) return;
18744        const { baseElement, contentElement: contentElement2, activeId } = store.getState();
18745        if (baseElement && !hasFocus(baseElement)) return;
18746        if (contentElement2?.hasAttribute("data-placing")) {
18747          const observer = new MutationObserver(forceValueUpdate);
18748          observer.observe(contentElement2, { attributeFilter: ["data-placing"] });
18749          return () => observer.disconnect();
18750        }
18751        if (autoSelect && canAutoSelect) {
18752          const userAutoSelectId = getAutoSelectIdProp(items);
18753          const autoSelectId = userAutoSelectId !== void 0 ? userAutoSelectId : getDefaultAutoSelectId(items) ?? store.first();
18754          autoSelectIdRef.current = autoSelectId;
18755          const nextActiveId = autoSelectId ?? null;
18756          const nextActiveValue = store.item(nextActiveId)?.value;
18757          const moved = autoSelectMovedRef.current;
18758          if (nextActiveId !== activeId || moved?.id !== nextActiveId || moved?.value !== nextActiveValue) {
18759            autoSelectMovedRef.current = {
18760              id: nextActiveId,
18761              value: nextActiveValue
18762            };
18763            store.move(nextActiveId);
18764          } else store.setState("activeValue", nextActiveValue);
18765        } else {
18766          const element = store.item(activeId || store.first())?.element;
18767          if (element && "scrollIntoView" in element) {
18768            isAutoScrollingRef.current = true;
18769            element.scrollIntoView({
18770              block: "nearest",
18771              inline: "nearest"
18772            });
18773            requestAnimationFrame(() => {
18774              isAutoScrollingRef.current = false;
18775            });
18776          }
18777        }
18778      }, [
18779        store,
18780        open,
18781        valueUpdated,
18782        storeValue,
18783        autoSelect,
18784        resetValueOnSelect,
18785        getAutoSelectIdProp,
18786        items
18787      ]);
18788      (0, import_react19.useEffect)(() => {
18789        if (!inline4) return;
18790        const combobox = ref.current;
18791        if (!combobox) return;
18792        const elements = [combobox, contentElement].filter((value2) => !!value2);
18793        const onBlur2 = (event) => {
18794          if (elements.every((el) => isFocusEventOutside(event, el))) store?.setValue(value);
18795        };
18796        for (const element of elements) element.addEventListener("focusout", onBlur2);
18797        return () => {
18798          for (const element of elements) element.removeEventListener("focusout", onBlur2);
18799        };
18800      }, [
18801        inline4,
18802        contentElement,
18803        store,
18804        value
18805      ]);
18806      const canShow = (event) => {
18807        return event.currentTarget.value.length >= showMinLength;
18808      };
18809      const onChangeProp = props.onChange;
18810      const showOnChangeProp = useBooleanEvent(showOnChange ?? canShow);
18811      const setValueOnChangeProp = useBooleanEvent(setValueOnChange ?? !store.tag);
18812      const onChange = useEvent((event) => {
18813        onChangeProp?.(event);
18814        if (event.defaultPrevented) return;
18815        if (!store) return;
18816        const currentTarget = event.currentTarget;
18817        const { value: value2, selectionStart, selectionEnd } = currentTarget;
18818        const nativeEvent = event.nativeEvent;
18819        canAutoSelectRef.current = true;
18820        if (isInputEvent(nativeEvent)) {
18821          if (nativeEvent.isComposing) {
18822            canAutoSelectRef.current = false;
18823            composingRef.current = true;
18824          }
18825          if (inline4) {
18826            const textInserted = nativeEvent.inputType === "insertText" || nativeEvent.inputType === "insertCompositionText";
18827            const caretAtEnd = selectionStart === value2.length;
18828            setCanInline(textInserted && caretAtEnd);
18829          }
18830        }
18831        if (setValueOnChangeProp(event)) {
18832          const isSameValue2 = value2 === store.getState().value;
18833          store.setValue(value2);
18834          queueMicrotask(() => {
18835            setSelectionRange(currentTarget, selectionStart, selectionEnd);
18836          });
18837          if (inline4 && autoSelect && isSameValue2) forceValueUpdate();
18838        }
18839        if (showOnChangeProp(event)) store.show();
18840        if (!autoSelect || !canAutoSelectRef.current) store.setActiveId(null);
18841      });
18842      const onCompositionEndProp = props.onCompositionEnd;
18843      const onCompositionEnd = useEvent((event) => {
18844        canAutoSelectRef.current = true;
18845        composingRef.current = false;
18846        onCompositionEndProp?.(event);
18847        if (event.defaultPrevented) return;
18848        if (!autoSelect) return;
18849        forceValueUpdate();
18850      });
18851      const onMouseDownProp = props.onMouseDown;
18852      const blurActiveItemOnClickProp = useBooleanEvent(blurActiveItemOnClick ?? (() => store.getState().includesBaseElement));
18853      const setValueOnClickProp = useBooleanEvent(setValueOnClick);
18854      const showOnClickProp = useBooleanEvent(showOnClick ?? canShow);
18855      const onMouseDown = useEvent((event) => {
18856        onMouseDownProp?.(event);
18857        if (event.defaultPrevented) return;
18858        if (event.button) return;
18859        if (event.ctrlKey) return;
18860        if (!store) return;
18861        if (blurActiveItemOnClickProp(event)) store.setActiveId(null);
18862        if (setValueOnClickProp(event)) store.setValue(value);
18863        if (showOnClickProp(event)) queueBeforeEvent(event.currentTarget, "mouseup", store.show);
18864      });
18865      const onKeyDownProp = props.onKeyDown;
18866      const showOnKeyPressProp = useBooleanEvent(showOnKeyPress ?? canShow);
18867      const onKeyDown = useEvent((event) => {
18868        onKeyDownProp?.(event);
18869        if (!event.repeat) canAutoSelectRef.current = false;
18870        if (event.defaultPrevented) return;
18871        if (!store) return;
18872        const { open: open2 } = store.getState();
18873        if (open2 && event.key === "Enter") {
18874          event.preventDefault();
18875          return;
18876        }
18877        if (event.ctrlKey) return;
18878        if (event.altKey) return;
18879        if (event.shiftKey) return;
18880        if (event.metaKey) return;
18881        if (open2) return;
18882        if (event.key === "ArrowUp" || event.key === "ArrowDown") {
18883          if (showOnKeyPressProp(event)) {
18884            event.preventDefault();
18885            store.show();
18886          }
18887        }
18888      });
18889      const onBlurProp = props.onBlur;
18890      const onBlur = useEvent((event) => {
18891        canAutoSelectRef.current = false;
18892        onBlurProp?.(event);
18893      });
18894      const id = useId4(props.id);
18895      const ariaAutoComplete = isAriaAutoCompleteValue(autoComplete) ? autoComplete : void 0;
18896      const isActiveItem = useStoreState(store, (state) => state.activeId === null);
18897      props = {
18898        role: "combobox",
18899        "aria-autocomplete": ariaAutoComplete,
18900        "aria-haspopup": getPopupRole(contentElement, "listbox"),
18901        "aria-expanded": open,
18902        "aria-controls": contentElement?.id,
18903        "data-active-item": isActiveItem || void 0,
18904        value,
18905        ...props,
18906        id,
18907        ref: useMergeRefs(ref, props.ref),
18908        onChange,
18909        onCompositionEnd,
18910        onMouseDown,
18911        onKeyDown,
18912        onBlur
18913      };
18914      props = useComposite({
18915        store,
18916        focusable: focusable2,
18917        ...props,
18918        moveOnKeyPress: (event) => {
18919          if (isFalsyBooleanCallback(moveOnKeyPress, event)) return false;
18920          if (inline4) setCanInline(true);
18921          return true;
18922        }
18923      });
18924      props = usePopoverAnchor({
18925        store,
18926        ...props
18927      });
18928      return {
18929        autoComplete: "off",
18930        ...props
18931      };
18932    });
18933    var Combobox = forwardRef21(function Combobox2(props) {
18934      return createElement3(TagName9, useCombobox(props));
18935    });
18936  
18937    // node_modules/@ariakit/react-components/dist/combobox/combobox-item.js
18938    var import_react20 = __toESM(require_react(), 1);
18939    var import_jsx_runtime76 = __toESM(require_jsx_runtime(), 1);
18940    var TagName10 = "div";
18941    function isSelected(storeValue, itemValue) {
18942      if (itemValue == null) return;
18943      if (storeValue == null) return false;
18944      if (Array.isArray(storeValue)) return storeValue.includes(itemValue);
18945      return storeValue === itemValue;
18946    }
18947    function getItemRole(popupRole) {
18948      return getItemRoleByPopupRole(popupRole) ?? "option";
18949    }
18950    var useComboboxItem = createHook(function useComboboxItem2({ store, value, hideOnClick, setValueOnClick, selectValueOnClick = true, resetValueOnSelect, focusOnHover = false, moveOnKeyPress = true, getItem: getItemProp, ...props }) {
18951      const context = useComboboxScopedContext();
18952      store = store || context;
18953      invariant(store, "ComboboxItem must be wrapped in a ComboboxList or ComboboxPopover component.");
18954      const { resetValueOnSelectState, multiSelectable, selected } = useStoreStateObject(store, {
18955        resetValueOnSelectState: "resetValueOnSelect",
18956        multiSelectable(state) {
18957          return Array.isArray(state.selectedValue);
18958        },
18959        selected(state) {
18960          return isSelected(state.selectedValue, value);
18961        }
18962      });
18963      const getItem = (0, import_react20.useCallback)((item) => {
18964        const nextItem = {
18965          ...item,
18966          value
18967        };
18968        if (getItemProp) return getItemProp(nextItem);
18969        return nextItem;
18970      }, [value, getItemProp]);
18971      setValueOnClick = setValueOnClick ?? !multiSelectable;
18972      hideOnClick = hideOnClick ?? (value != null && !multiSelectable);
18973      const onClickProp = props.onClick;
18974      const setValueOnClickProp = useBooleanEvent(setValueOnClick);
18975      const selectValueOnClickProp = useBooleanEvent(selectValueOnClick);
18976      const resetValueOnSelectProp = useBooleanEvent(resetValueOnSelect ?? resetValueOnSelectState ?? multiSelectable);
18977      const hideOnClickProp = useBooleanEvent(hideOnClick);
18978      const onClick = useEvent((event) => {
18979        onClickProp?.(event);
18980        if (event.defaultPrevented) return;
18981        if (isDownloading(event)) return;
18982        if (isOpeningInNewTab(event)) return;
18983        if (value != null) {
18984          if (selectValueOnClickProp(event)) {
18985            if (resetValueOnSelectProp(event)) store?.resetValue();
18986            store?.setSelectedValue((prevValue) => {
18987              if (!Array.isArray(prevValue)) return value;
18988              if (prevValue.includes(value)) return prevValue.filter((v2) => v2 !== value);
18989              return [...prevValue, value];
18990            });
18991          }
18992          if (setValueOnClickProp(event)) store?.setValue(value);
18993        }
18994        if (hideOnClickProp(event)) store?.hide();
18995      });
18996      const onKeyDownProp = props.onKeyDown;
18997      const onKeyDown = useEvent((event) => {
18998        onKeyDownProp?.(event);
18999        if (event.defaultPrevented) return;
19000        const baseElement = store?.getState().baseElement;
19001        if (!baseElement) return;
19002        if (hasFocus(baseElement)) return;
19003        const printable = event.key.length === 1 && !event.ctrlKey && !event.metaKey;
19004        const paste = (!isApple() ? event.ctrlKey : event.metaKey) && event.key.toLowerCase() === "v";
19005        const deleteKey = event.key === "Backspace" || event.key === "Delete";
19006        if (printable || paste || deleteKey) {
19007          queueMicrotask(() => baseElement.focus());
19008          if (isTextField(baseElement)) store?.setValue(baseElement.value);
19009        }
19010      });
19011      if (multiSelectable && selected != null) props = {
19012        "aria-selected": selected,
19013        ...props
19014      };
19015      props = useWrapElement(props, (element) => /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(ComboboxItemValueContext.Provider, {
19016        value,
19017        children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(ComboboxItemCheckedContext.Provider, {
19018          value: selected ?? false,
19019          children: element
19020        })
19021      }), [value, selected]);
19022      props = {
19023        role: getItemRole((0, import_react20.useContext)(ComboboxListRoleContext)),
19024        children: value,
19025        ...props,
19026        onClick,
19027        onKeyDown
19028      };
19029      const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress);
19030      props = useCompositeItem({
19031        store,
19032        ...props,
19033        getItem,
19034        moveOnKeyPress: (event) => {
19035          if (!moveOnKeyPressProp(event)) return false;
19036          const moveEvent = new Event("combobox-item-move");
19037          store?.getState().baseElement?.dispatchEvent(moveEvent);
19038          return true;
19039        }
19040      });
19041      props = useCompositeHover({
19042        store,
19043        focusOnHover,
19044        ...props
19045      });
19046      return props;
19047    });
19048    var ComboboxItem = memo3(forwardRef21(function ComboboxItem2(props) {
19049      return createElement3(TagName10, useComboboxItem(props));
19050    }));
19051  
19052    // node_modules/@ariakit/react-components/dist/combobox/combobox-item-value.js
19053    var import_react21 = __toESM(require_react(), 1);
19054    var import_jsx_runtime77 = __toESM(require_jsx_runtime(), 1);
19055    var TagName11 = "span";
19056    function normalizeValue(value) {
19057      return normalizeString(value).toLowerCase();
19058    }
19059    function getOffsets(string, values) {
19060      const offsets = [];
19061      for (const value of values) {
19062        if (!value) continue;
19063        let pos = 0;
19064        const length = value.length;
19065        let index2 = string.indexOf(value, pos);
19066        while (index2 !== -1) {
19067          offsets.push([index2, length]);
19068          pos = index2 + 1;
19069          index2 = string.indexOf(value, pos);
19070        }
19071      }
19072      return offsets;
19073    }
19074    function mergeOverlappingOffsets(offsets) {
19075      offsets.sort(([a2], [b2]) => a2 - b2);
19076      const merged = [];
19077      for (const [offset4, length] of offsets) {
19078        const last = merged[merged.length - 1];
19079        if (last && offset4 < last[0] + last[1]) last[1] = Math.max(last[1], offset4 + length - last[0]);
19080        else merged.push([offset4, length]);
19081      }
19082      return merged;
19083    }
19084    function getNormalizedIndexes(itemValue) {
19085      const starts = [];
19086      const ends = [];
19087      let index2 = 0;
19088      for (const char of itemValue) {
19089        const normalizedLength = normalizeValue(char).length;
19090        for (let i2 = 0; i2 < normalizedLength; i2 += 1) {
19091          starts.push(i2 === 0 ? index2 : -1);
19092          ends.push(index2);
19093        }
19094        index2 += char.length;
19095      }
19096      starts.push(itemValue.length);
19097      ends.push(itemValue.length);
19098      let nextBoundary = itemValue.length;
19099      for (let i2 = starts.length - 1; i2 >= 0; i2 -= 1) {
19100        const start = starts[i2];
19101        if (start == null) continue;
19102        if (start === -1) starts[i2] = nextBoundary;
19103        else nextBoundary = start;
19104      }
19105      return {
19106        starts,
19107        ends
19108      };
19109    }
19110    function toOriginalOffsets(itemValue, normalizedOffsets) {
19111      if (!normalizedOffsets.length) return normalizedOffsets;
19112      const { starts, ends } = getNormalizedIndexes(itemValue);
19113      const offsets = [];
19114      for (const [normalizedOffset, normalizedLength] of normalizedOffsets) {
19115        const start = starts[normalizedOffset];
19116        const end = ends[normalizedOffset + normalizedLength];
19117        if (start == null || end == null) continue;
19118        if (end <= start) continue;
19119        offsets.push([start, end - start]);
19120      }
19121      return offsets;
19122    }
19123    function splitValue(itemValue, userValue) {
19124      if (!itemValue) return itemValue;
19125      if (!userValue) return itemValue;
19126      const userValues = toArray(userValue).map(normalizeValue);
19127      const parts = [];
19128      const span = (value, autocomplete = false) => /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", {
19129        "data-autocomplete-value": autocomplete ? "" : void 0,
19130        "data-user-value": autocomplete ? void 0 : "",
19131        children: value
19132      }, parts.length);
19133      const offsets = toOriginalOffsets(itemValue, mergeOverlappingOffsets(getOffsets(normalizeValue(itemValue), new Set(userValues))));
19134      const firstEntry = offsets[0];
19135      if (!firstEntry) {
19136        parts.push(span(itemValue, true));
19137        return parts;
19138      }
19139      const [firstOffset] = firstEntry;
19140      [itemValue.slice(0, firstOffset), ...offsets.flatMap(([offset4, length], i2) => {
19141        const value = itemValue.slice(offset4, offset4 + length);
19142        const nextOffset = offsets[i2 + 1]?.[0];
19143        return [value, itemValue.slice(offset4 + length, nextOffset)];
19144      })].forEach((value, i2) => {
19145        if (!value) return;
19146        parts.push(span(value, i2 % 2 === 0));
19147      });
19148      return parts;
19149    }
19150    var useComboboxItemValue = createHook(function useComboboxItemValue2({ store, value, userValue, ...props }) {
19151      const context = useComboboxScopedContext();
19152      store = store || context;
19153      const itemContext = (0, import_react21.useContext)(ComboboxItemValueContext);
19154      const itemValue = value ?? itemContext;
19155      const inputValue = useStoreState(store, (state) => userValue ?? state?.value);
19156      props = {
19157        children: (0, import_react21.useMemo)(() => {
19158          if (!itemValue) return;
19159          if (!inputValue) return itemValue;
19160          return splitValue(itemValue, inputValue);
19161        }, [itemValue, inputValue]),
19162        ...props
19163      };
19164      return removeUndefinedValues(props);
19165    });
19166    var ComboboxItemValue = forwardRef21(function ComboboxItemValue2(props) {
19167      return createElement3(TagName11, useComboboxItemValue(props));
19168    });
19169  
19170    // node_modules/@ariakit/react-components/dist/combobox/combobox-label.js
19171    var TagName12 = "label";
19172    var useComboboxLabel = createHook(function useComboboxLabel2({ store, ...props }) {
19173      const context = useComboboxProviderContext();
19174      store = store || context;
19175      invariant(store, "ComboboxLabel must receive a `store` prop or be wrapped in a ComboboxProvider component.");
19176      props = {
19177        htmlFor: useStoreState(store, (state) => state.baseElement?.id),
19178        ...props
19179      };
19180      return removeUndefinedValues(props);
19181    });
19182    var ComboboxLabel = memo3(forwardRef21(function ComboboxLabel2(props) {
19183      return createElement3(TagName12, useComboboxLabel(props));
19184    }));
19185  
19186    // node_modules/@ariakit/react-components/dist/combobox/combobox-list.js
19187    var import_react22 = __toESM(require_react(), 1);
19188    var import_jsx_runtime78 = __toESM(require_jsx_runtime(), 1);
19189    var TagName13 = "div";
19190    var useComboboxList = createHook(function useComboboxList2({ store, alwaysVisible, ...props }) {
19191      const scopedContext = useComboboxScopedContext(true);
19192      const context = useComboboxContext();
19193      store = store || context;
19194      const scopedContextSameStore = !!store && store === scopedContext;
19195      invariant(store, "ComboboxList must receive a `store` prop or be wrapped in a ComboboxProvider component.");
19196      const ref = (0, import_react22.useRef)(null);
19197      const id = useId4(props.id);
19198      const mounted = useStoreState(store, "mounted");
19199      const hidden = isHidden(mounted, props.hidden, alwaysVisible);
19200      const style = hidden ? {
19201        ...props.style,
19202        display: "none"
19203      } : props.style;
19204      const multiSelectable = useStoreState(store, (state) => Array.isArray(state.selectedValue));
19205      const role = useAttribute(ref, "role", props.role);
19206      const ariaMultiSelectable = role === "listbox" || role === "tree" || role === "grid" ? multiSelectable || void 0 : void 0;
19207      const [hasListboxInside, setHasListboxInside] = (0, import_react22.useState)(false);
19208      const contentElement = useStoreState(store, "contentElement");
19209      useSafeLayoutEffect(() => {
19210        if (!mounted) return;
19211        const element = ref.current;
19212        if (!element) return;
19213        if (contentElement !== element) return;
19214        const callback = () => {
19215          setHasListboxInside(!!element.querySelector("[role='listbox']"));
19216        };
19217        const observer = new MutationObserver(callback);
19218        observer.observe(element, {
19219          subtree: true,
19220          childList: true,
19221          attributeFilter: ["role"]
19222        });
19223        callback();
19224        return () => observer.disconnect();
19225      }, [mounted, contentElement]);
19226      if (!hasListboxInside) props = {
19227        role: "listbox",
19228        "aria-multiselectable": ariaMultiSelectable,
19229        ...props
19230      };
19231      props = useWrapElement(props, (element) => /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(ComboboxScopedContextProvider, {
19232        value: store,
19233        children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(ComboboxListRoleContext.Provider, {
19234          value: role,
19235          children: element
19236        })
19237      }), [store, role]);
19238      const setContentElement = id && (!scopedContext || !scopedContextSameStore) ? store.setContentElement : null;
19239      props = {
19240        hidden,
19241        ...props,
19242        id,
19243        ref: useMergeRefs(setContentElement, ref, props.ref),
19244        style
19245      };
19246      return removeUndefinedValues(props);
19247    });
19248    var ComboboxList = forwardRef21(function ComboboxList2(props) {
19249      return createElement3(TagName13, useComboboxList(props));
19250    });
19251  
19252    // node_modules/@ariakit/react-components/dist/tag/tag-context.js
19253    var import_react23 = __toESM(require_react(), 1);
19254    var TagValueContext = (0, import_react23.createContext)(null);
19255    var TagRemoveIdContext = (0, import_react23.createContext)(null);
19256    var ctx7 = createStoreContext([CompositeContextProvider], [CompositeScopedContextProvider]);
19257    var useTagContext = ctx7.useContext;
19258    var useTagScopedContext = ctx7.useScopedContext;
19259    var useTagProviderContext = ctx7.useProviderContext;
19260    var TagContextProvider = ctx7.ContextProvider;
19261    var TagScopedContextProvider = ctx7.ScopedContextProvider;
19262  
19263    // node_modules/@ariakit/components/dist/combobox/combobox-store.js
19264    var isTouchSafari = isSafari() && isTouchDevice();
19265    function createComboboxStore({ tag, ...props } = {}) {
19266      const store = mergeStore(props.store, pick2(tag, ["value", "rtl"]));
19267      throwOnConflictingProps(props, store);
19268      const tagState = tag?.getState();
19269      const syncState = store?.getState();
19270      const activeId = defaultValue(props.activeId, syncState?.activeId, props.defaultActiveId, null);
19271      const composite = createCompositeStore({
19272        ...props,
19273        activeId,
19274        includesBaseElement: defaultValue(props.includesBaseElement, syncState?.includesBaseElement, true),
19275        orientation: defaultValue(props.orientation, syncState?.orientation, "vertical"),
19276        focusLoop: defaultValue(props.focusLoop, syncState?.focusLoop, true),
19277        focusWrap: defaultValue(props.focusWrap, syncState?.focusWrap, true),
19278        virtualFocus: defaultValue(props.virtualFocus, syncState?.virtualFocus, true)
19279      });
19280      const popover = createPopoverStore({
19281        ...props,
19282        placement: defaultValue(props.placement, syncState?.placement, "bottom-start")
19283      });
19284      const value = defaultValue(props.value, syncState?.value, props.defaultValue, "");
19285      const selectedValue = defaultValue(props.selectedValue, syncState?.selectedValue, tagState?.values, props.defaultSelectedValue, "");
19286      const multiSelectable = Array.isArray(selectedValue);
19287      const initialState = {
19288        ...composite.getState(),
19289        ...popover.getState(),
19290        value,
19291        selectedValue,
19292        resetValueOnSelect: defaultValue(props.resetValueOnSelect, syncState?.resetValueOnSelect, multiSelectable),
19293        resetValueOnHide: defaultValue(props.resetValueOnHide, syncState?.resetValueOnHide, multiSelectable && !tag),
19294        activeValue: syncState?.activeValue
19295      };
19296      const combobox = createStore(initialState, composite, popover, store);
19297      if (isTouchSafari) setup(combobox, () => sync(combobox, ["virtualFocus"], () => {
19298        combobox.setState("virtualFocus", false);
19299      }));
19300      setup(combobox, () => {
19301        if (!tag) return;
19302        return chain(sync(combobox, ["selectedValue"], (state) => {
19303          if (!Array.isArray(state.selectedValue)) return;
19304          tag.setValues(state.selectedValue);
19305        }), sync(tag, ["values"], (state) => {
19306          combobox.setState("selectedValue", state.values);
19307        }));
19308      });
19309      setup(combobox, () => sync(combobox, ["resetValueOnHide", "mounted"], (state) => {
19310        if (!state.resetValueOnHide) return;
19311        if (state.mounted) return;
19312        combobox.setState("value", value);
19313      }));
19314      setup(combobox, () => sync(combobox, ["open"], (state) => {
19315        if (state.open) return;
19316        combobox.setState("activeId", activeId);
19317        combobox.setState("moves", 0);
19318      }));
19319      setup(combobox, () => sync(combobox, ["moves", "activeId"], (state, prevState) => {
19320        if (state.moves === prevState.moves) combobox.setState("activeValue", void 0);
19321      }));
19322      setup(combobox, () => batch(combobox, ["moves", "renderedItems"], (state, prev) => {
19323        if (state.moves === prev.moves) return;
19324        const { activeId: activeId2 } = combobox.getState();
19325        const activeItem = composite.item(activeId2);
19326        combobox.setState("activeValue", activeItem?.value);
19327      }));
19328      return {
19329        ...popover,
19330        ...composite,
19331        ...combobox,
19332        tag,
19333        setValue: (value2) => combobox.setState("value", value2),
19334        resetValue: () => combobox.setState("value", initialState.value),
19335        setSelectedValue: (selectedValue2) => combobox.setState("selectedValue", selectedValue2)
19336      };
19337    }
19338  
19339    // node_modules/@ariakit/react-components/dist/combobox/combobox-store.js
19340    function useComboboxStoreOptions(props) {
19341      const tag = useTagContext();
19342      props = {
19343        ...props,
19344        tag: props.tag !== void 0 ? props.tag : tag
19345      };
19346      return useCompositeStoreOptions(props);
19347    }
19348    function useComboboxStoreProps(store, update2, props) {
19349      useUpdateEffect(update2, [props.tag]);
19350      useStoreProps(store, props, "value", "setValue");
19351      useStoreProps(store, props, "selectedValue", "setSelectedValue");
19352      useStoreProps(store, props, "resetValueOnHide");
19353      useStoreProps(store, props, "resetValueOnSelect");
19354      return Object.assign(useCompositeStoreProps(usePopoverStoreProps(store, update2, props), update2, props), { tag: props.tag });
19355    }
19356    function useComboboxStore(props = {}) {
19357      props = useComboboxStoreOptions(props);
19358      const [store, update2] = useStore2(createComboboxStore, props);
19359      return useComboboxStoreProps(store, update2, props);
19360    }
19361  
19362    // node_modules/@ariakit/react-components/dist/combobox/combobox-provider.js
19363    var import_jsx_runtime79 = __toESM(require_jsx_runtime(), 1);
19364    function ComboboxProvider(props = {}) {
19365      return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(ComboboxContextProvider, {
19366        value: useComboboxStore(props),
19367        children: props.children
19368      });
19369    }
19370  
19371    // packages/dataviews/build-module/components/dataviews-filters/search-widget.mjs
19372    var import_remove_accents = __toESM(require_remove_accents(), 1);
19373    var import_compose8 = __toESM(require_compose(), 1);
19374    var import_i18n30 = __toESM(require_i18n(), 1);
19375    var import_element44 = __toESM(require_element(), 1);
19376    var import_components19 = __toESM(require_components(), 1);
19377  
19378    // packages/dataviews/build-module/components/dataviews-filters/utils.mjs
19379    var EMPTY_ARRAY3 = [];
19380    var getCurrentValue = (filterDefinition, currentFilter) => {
19381      if (filterDefinition.singleSelection) {
19382        return currentFilter?.value;
19383      }
19384      if (Array.isArray(currentFilter?.value)) {
19385        return currentFilter.value;
19386      }
19387      if (!Array.isArray(currentFilter?.value) && !!currentFilter?.value) {
19388        return [currentFilter.value];
19389      }
19390      return EMPTY_ARRAY3;
19391    };
19392  
19393    // packages/dataviews/build-module/hooks/use-elements.mjs
19394    var import_element43 = __toESM(require_element(), 1);
19395    var EMPTY_ARRAY4 = [];
19396    function useElements({
19397      elements,
19398      getElements
19399    }) {
19400      const staticElements = Array.isArray(elements) && elements.length > 0 ? elements : EMPTY_ARRAY4;
19401      const [records, setRecords] = (0, import_element43.useState)(staticElements);
19402      const [isLoading, setIsLoading] = (0, import_element43.useState)(false);
19403      (0, import_element43.useEffect)(() => {
19404        if (!getElements) {
19405          setRecords(staticElements);
19406          return;
19407        }
19408        let cancelled = false;
19409        setIsLoading(true);
19410        getElements().then((fetchedElements) => {
19411          if (!cancelled) {
19412            const dynamicElements = Array.isArray(fetchedElements) && fetchedElements.length > 0 ? fetchedElements : staticElements;
19413            setRecords(dynamicElements);
19414          }
19415        }).catch(() => {
19416          if (!cancelled) {
19417            setRecords(staticElements);
19418          }
19419        }).finally(() => {
19420          if (!cancelled) {
19421            setIsLoading(false);
19422          }
19423        });
19424        return () => {
19425          cancelled = true;
19426        };
19427      }, [getElements, staticElements]);
19428      return {
19429        elements: records,
19430        isLoading
19431      };
19432    }
19433  
19434    // packages/dataviews/build-module/components/dataviews-filters/search-widget.mjs
19435    var import_jsx_runtime80 = __toESM(require_jsx_runtime(), 1);
19436    function normalizeSearchInput(input = "") {
19437      return (0, import_remove_accents.default)(input.trim().toLowerCase());
19438    }
19439    var getNewValue = (filterDefinition, currentFilter, value) => {
19440      if (filterDefinition.singleSelection) {
19441        return value;
19442      }
19443      if (Array.isArray(currentFilter?.value)) {
19444        return currentFilter.value.includes(value) ? currentFilter.value.filter((v2) => v2 !== value) : [...currentFilter.value, value];
19445      }
19446      return [value];
19447    };
19448    function generateFilterElementCompositeItemId(prefix, filterElementValue) {
19449      return `$prefix}-$filterElementValue}`;
19450    }
19451    var MultiSelectionOption = ({ selected }) => {
19452      return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
19453        "span",
19454        {
19455          className: clsx_default(
19456            "dataviews-filters__search-widget-listitem-multi-selection",
19457            { "is-selected": selected }
19458          ),
19459          children: selected && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_components19.Icon, { icon: check_default })
19460        }
19461      );
19462    };
19463    var SingleSelectionOption = ({ selected }) => {
19464      return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
19465        "span",
19466        {
19467          className: clsx_default(
19468            "dataviews-filters__search-widget-listitem-single-selection",
19469            { "is-selected": selected }
19470          )
19471        }
19472      );
19473    };
19474    function ListBox({ view, filter, onChangeView }) {
19475      const baseId = (0, import_compose8.useInstanceId)(ListBox, "dataviews-filter-list-box");
19476      const [activeCompositeId, setActiveCompositeId] = (0, import_element44.useState)(
19477        // When there are one or less operators, the first item is set as active
19478        // (by setting the initial `activeId` to `undefined`).
19479        // With 2 or more operators, the focus is moved on the operators control
19480        // (by setting the initial `activeId` to `null`), meaning that there won't
19481        // be an active item initially. Focus is then managed via the
19482        // `onFocusVisible` callback.
19483        filter.operators?.length === 1 ? void 0 : null
19484      );
19485      const currentFilter = view.filters?.find(
19486        (f2) => f2.field === filter.field
19487      );
19488      const currentValue = getCurrentValue(filter, currentFilter);
19489      return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
19490        import_components19.Composite,
19491        {
19492          virtualFocus: true,
19493          focusLoop: true,
19494          activeId: activeCompositeId,
19495          setActiveId: setActiveCompositeId,
19496          role: "listbox",
19497          className: "dataviews-filters__search-widget-listbox",
19498          "aria-label": (0, import_i18n30.sprintf)(
19499            /* translators: List of items for a filter. 1: Filter name. e.g.: "List of: Author". */
19500            (0, import_i18n30.__)("List of: %1$s"),
19501            filter.name
19502          ),
19503          onFocusVisible: () => {
19504            if (!activeCompositeId && filter.elements.length) {
19505              setActiveCompositeId(
19506                generateFilterElementCompositeItemId(
19507                  baseId,
19508                  filter.elements[0].value
19509                )
19510              );
19511            }
19512          },
19513          render: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_components19.Composite.Typeahead, {}),
19514          children: filter.elements.map((element) => /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(
19515            import_components19.Composite.Hover,
19516            {
19517              render: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
19518                import_components19.Composite.Item,
19519                {
19520                  id: generateFilterElementCompositeItemId(
19521                    baseId,
19522                    element.value
19523                  ),
19524                  render: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
19525                    "div",
19526                    {
19527                      "aria-label": element.label,
19528                      role: "option",
19529                      className: "dataviews-filters__search-widget-listitem"
19530                    }
19531                  ),
19532                  onClick: () => {
19533                    const newFilters = currentFilter ? [
19534                      ...(view.filters ?? []).map(
19535                        (_filter) => {
19536                          if (_filter.field === filter.field) {
19537                            return {
19538                              ..._filter,
19539                              operator: currentFilter.operator || filter.operators[0],
19540                              value: getNewValue(
19541                                filter,
19542                                currentFilter,
19543                                element.value
19544                              )
19545                            };
19546                          }
19547                          return _filter;
19548                        }
19549                      )
19550                    ] : [
19551                      ...view.filters ?? [],
19552                      {
19553                        field: filter.field,
19554                        operator: filter.operators[0],
19555                        value: getNewValue(
19556                          filter,
19557                          currentFilter,
19558                          element.value
19559                        )
19560                      }
19561                    ];
19562                    onChangeView({
19563                      ...view,
19564                      page: 1,
19565                      filters: newFilters
19566                    });
19567                  }
19568                }
19569              ),
19570              children: [
19571                filter.singleSelection && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
19572                  SingleSelectionOption,
19573                  {
19574                    selected: currentValue === element.value
19575                  }
19576                ),
19577                !filter.singleSelection && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
19578                  MultiSelectionOption,
19579                  {
19580                    selected: currentValue.includes(element.value)
19581                  }
19582                ),
19583                /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
19584                  "span",
19585                  {
19586                    className: "dataviews-filters__search-widget-listitem-value",
19587                    title: element.label,
19588                    children: element.label
19589                  }
19590                )
19591              ]
19592            },
19593            element.value
19594          ))
19595        }
19596      );
19597    }
19598    function ComboboxList22({ view, filter, onChangeView }) {
19599      const [searchValue, setSearchValue] = (0, import_element44.useState)("");
19600      const deferredSearchValue = (0, import_element44.useDeferredValue)(searchValue);
19601      const currentFilter = view.filters?.find(
19602        (_filter) => _filter.field === filter.field
19603      );
19604      const currentValue = getCurrentValue(filter, currentFilter);
19605      const matches = (0, import_element44.useMemo)(() => {
19606        const normalizedSearch = normalizeSearchInput(deferredSearchValue);
19607        return filter.elements.filter(
19608          (item) => normalizeSearchInput(item.label).includes(normalizedSearch)
19609        );
19610      }, [filter.elements, deferredSearchValue]);
19611      return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(
19612        ComboboxProvider,
19613        {
19614          selectedValue: currentValue,
19615          setSelectedValue: (value) => {
19616            const newFilters = currentFilter ? [
19617              ...(view.filters ?? []).map((_filter) => {
19618                if (_filter.field === filter.field) {
19619                  return {
19620                    ..._filter,
19621                    operator: currentFilter.operator || filter.operators[0],
19622                    value
19623                  };
19624                }
19625                return _filter;
19626              })
19627            ] : [
19628              ...view.filters ?? [],
19629              {
19630                field: filter.field,
19631                operator: filter.operators[0],
19632                value
19633              }
19634            ];
19635            onChangeView({
19636              ...view,
19637              page: 1,
19638              filters: newFilters
19639            });
19640          },
19641          setValue: setSearchValue,
19642          children: [
19643            /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "dataviews-filters__search-widget-filter-combobox__wrapper", children: [
19644              /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(VisuallyHidden, { render: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(ComboboxLabel, {}), children: (0, import_i18n30.__)("Search items") }),
19645              /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
19646                Combobox,
19647                {
19648                  autoSelect: "always",
19649                  placeholder: (0, import_i18n30.__)("Search"),
19650                  className: "dataviews-filters__search-widget-filter-combobox__input"
19651                }
19652              ),
19653              /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "dataviews-filters__search-widget-filter-combobox__icon", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_components19.Icon, { icon: search_default }) })
19654            ] }),
19655            /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(
19656              ComboboxList,
19657              {
19658                className: "dataviews-filters__search-widget-filter-combobox-list",
19659                alwaysVisible: true,
19660                children: [
19661                  matches.map((element) => {
19662                    return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(
19663                      ComboboxItem,
19664                      {
19665                        resetValueOnSelect: false,
19666                        value: element.value,
19667                        className: "dataviews-filters__search-widget-listitem",
19668                        hideOnClick: false,
19669                        setValueOnClick: false,
19670                        focusOnHover: true,
19671                        children: [
19672                          filter.singleSelection && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
19673                            SingleSelectionOption,
19674                            {
19675                              selected: currentValue === element.value
19676                            }
19677                          ),
19678                          !filter.singleSelection && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
19679                            MultiSelectionOption,
19680                            {
19681                              selected: currentValue.includes(
19682                                element.value
19683                              )
19684                            }
19685                          ),
19686                          /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(
19687                            "span",
19688                            {
19689                              className: "dataviews-filters__search-widget-listitem-value",
19690                              title: element.label,
19691                              children: [
19692                                /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
19693                                  ComboboxItemValue,
19694                                  {
19695                                    className: "dataviews-filters__search-widget-filter-combobox-item-value",
19696                                    value: element.label
19697                                  }
19698                                ),
19699                                !!element.description && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "dataviews-filters__search-widget-listitem-description", children: element.description })
19700                              ]
19701                            }
19702                          )
19703                        ]
19704                      },
19705                      element.value
19706                    );
19707                  }),
19708                  !matches.length && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("p", { children: (0, import_i18n30.__)("No results found") })
19709                ]
19710              }
19711            )
19712          ]
19713        }
19714      );
19715    }
19716    function SearchWidget(props) {
19717      const { elements, isLoading } = useElements({
19718        elements: props.filter.elements,
19719        getElements: props.filter.getElements
19720      });
19721      if (isLoading) {
19722        return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "dataviews-filters__search-widget-no-elements", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_components19.Spinner, {}) });
19723      }
19724      if (elements.length === 0) {
19725        return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "dataviews-filters__search-widget-no-elements", children: (0, import_i18n30.__)("No elements found") });
19726      }
19727      const Widget = elements.length > 10 ? ComboboxList22 : ListBox;
19728      return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Widget, { ...props, filter: { ...props.filter, elements } });
19729    }
19730  
19731    // packages/dataviews/build-module/components/dataviews-filters/input-widget.mjs
19732    var import_es6 = __toESM(require_es6(), 1);
19733    var import_compose9 = __toESM(require_compose(), 1);
19734    var import_element45 = __toESM(require_element(), 1);
19735    var import_components20 = __toESM(require_components(), 1);
19736    var import_jsx_runtime81 = __toESM(require_jsx_runtime(), 1);
19737    function InputWidget({
19738      filter,
19739      view,
19740      onChangeView,
19741      fields
19742    }) {
19743      const currentFilter = view.filters?.find(
19744        (f2) => f2.field === filter.field
19745      );
19746      const currentValue = getCurrentValue(filter, currentFilter);
19747      const field = (0, import_element45.useMemo)(() => {
19748        const currentField = fields.find((f2) => f2.id === filter.field);
19749        if (currentField) {
19750          return {
19751            ...currentField,
19752            // Deactivate validation for filters.
19753            isValid: {},
19754            // Filter controls are always enabled.
19755            isDisabled: () => false,
19756            // Filter controls are always visible.
19757            isVisible: () => true,
19758            // Configure getValue/setValue as if Item was a plain object.
19759            getValue: ({ item }) => item[currentField.id],
19760            setValue: ({ value }) => ({
19761              [currentField.id]: value
19762            })
19763          };
19764        }
19765        return currentField;
19766      }, [fields, filter.field]);
19767      const data = (0, import_element45.useMemo)(() => {
19768        return (view.filters ?? []).reduce(
19769          (acc, activeFilter) => {
19770            acc[activeFilter.field] = activeFilter.value;
19771            return acc;
19772          },
19773          {}
19774        );
19775      }, [view.filters]);
19776      const handleChange = (0, import_compose9.useEvent)((updatedData) => {
19777        if (!field || !currentFilter) {
19778          return;
19779        }
19780        const nextValue = field.getValue({ item: updatedData });
19781        if ((0, import_es6.default)(nextValue, currentValue)) {
19782          return;
19783        }
19784        onChangeView({
19785          ...view,
19786          filters: (view.filters ?? []).map(
19787            (_filter) => _filter.field === filter.field ? {
19788              ..._filter,
19789              operator: currentFilter.operator || filter.operators[0],
19790              // Consider empty strings as undefined:
19791              //
19792              // - undefined as value means the filter is unset: the filter widget displays no value and the search returns all records
19793              // - empty string as value means "search empty string": returns only the records that have an empty string as value
19794              //
19795              // In practice, this means the filter will not be able to find an empty string as the value.
19796              value: nextValue === "" ? void 0 : nextValue
19797            } : _filter
19798          )
19799        });
19800      });
19801      if (!field || !field.Edit || !currentFilter) {
19802        return null;
19803      }
19804      return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
19805        import_components20.Flex,
19806        {
19807          className: "dataviews-filters__user-input-widget",
19808          gap: 2.5,
19809          direction: "column",
19810          children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
19811            field.Edit,
19812            {
19813              hideLabelFromVision: true,
19814              data,
19815              field,
19816              operator: currentFilter.operator,
19817              onChange: handleChange
19818            }
19819          )
19820        }
19821      );
19822    }
19823  
19824    // node_modules/date-fns/constants.js
19825    var daysInYear = 365.2425;
19826    var maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1e3;
19827    var minTime = -maxTime;
19828    var millisecondsInWeek = 6048e5;
19829    var millisecondsInDay = 864e5;
19830    var secondsInHour = 3600;
19831    var secondsInDay = secondsInHour * 24;
19832    var secondsInWeek = secondsInDay * 7;
19833    var secondsInYear = secondsInDay * daysInYear;
19834    var secondsInMonth = secondsInYear / 12;
19835    var secondsInQuarter = secondsInMonth * 3;
19836    var constructFromSymbol = /* @__PURE__ */ Symbol.for("constructDateFrom");
19837  
19838    // node_modules/date-fns/constructFrom.js
19839    function constructFrom(date, value) {
19840      if (typeof date === "function") return date(value);
19841      if (date && typeof date === "object" && constructFromSymbol in date)
19842        return date[constructFromSymbol](value);
19843      if (date instanceof Date) return new date.constructor(value);
19844      return new Date(value);
19845    }
19846  
19847    // node_modules/date-fns/toDate.js
19848    function toDate(argument, context) {
19849      return constructFrom(context || argument, argument);
19850    }
19851  
19852    // node_modules/date-fns/addDays.js
19853    function addDays(date, amount, options) {
19854      const _date = toDate(date, options?.in);
19855      if (isNaN(amount)) return constructFrom(options?.in || date, NaN);
19856      if (!amount) return _date;
19857      _date.setDate(_date.getDate() + amount);
19858      return _date;
19859    }
19860  
19861    // node_modules/date-fns/addMonths.js
19862    function addMonths(date, amount, options) {
19863      const _date = toDate(date, options?.in);
19864      if (isNaN(amount)) return constructFrom(options?.in || date, NaN);
19865      if (!amount) {
19866        return _date;
19867      }
19868      const dayOfMonth = _date.getDate();
19869      const endOfDesiredMonth = constructFrom(options?.in || date, _date.getTime());
19870      endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0);
19871      const daysInMonth = endOfDesiredMonth.getDate();
19872      if (dayOfMonth >= daysInMonth) {
19873        return endOfDesiredMonth;
19874      } else {
19875        _date.setFullYear(
19876          endOfDesiredMonth.getFullYear(),
19877          endOfDesiredMonth.getMonth(),
19878          dayOfMonth
19879        );
19880        return _date;
19881      }
19882    }
19883  
19884    // node_modules/date-fns/_lib/defaultOptions.js
19885    var defaultOptions = {};
19886    function getDefaultOptions() {
19887      return defaultOptions;
19888    }
19889  
19890    // node_modules/date-fns/startOfWeek.js
19891    function startOfWeek(date, options) {
19892      const defaultOptions2 = getDefaultOptions();
19893      const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
19894      const _date = toDate(date, options?.in);
19895      const day = _date.getDay();
19896      const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
19897      _date.setDate(_date.getDate() - diff);
19898      _date.setHours(0, 0, 0, 0);
19899      return _date;
19900    }
19901  
19902    // node_modules/date-fns/startOfISOWeek.js
19903    function startOfISOWeek(date, options) {
19904      return startOfWeek(date, { ...options, weekStartsOn: 1 });
19905    }
19906  
19907    // node_modules/date-fns/getISOWeekYear.js
19908    function getISOWeekYear(date, options) {
19909      const _date = toDate(date, options?.in);
19910      const year = _date.getFullYear();
19911      const fourthOfJanuaryOfNextYear = constructFrom(_date, 0);
19912      fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
19913      fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
19914      const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);
19915      const fourthOfJanuaryOfThisYear = constructFrom(_date, 0);
19916      fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);
19917      fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);
19918      const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);
19919      if (_date.getTime() >= startOfNextYear.getTime()) {
19920        return year + 1;
19921      } else if (_date.getTime() >= startOfThisYear.getTime()) {
19922        return year;
19923      } else {
19924        return year - 1;
19925      }
19926    }
19927  
19928    // node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js
19929    function getTimezoneOffsetInMilliseconds(date) {
19930      const _date = toDate(date);
19931      const utcDate = new Date(
19932        Date.UTC(
19933          _date.getFullYear(),
19934          _date.getMonth(),
19935          _date.getDate(),
19936          _date.getHours(),
19937          _date.getMinutes(),
19938          _date.getSeconds(),
19939          _date.getMilliseconds()
19940        )
19941      );
19942      utcDate.setUTCFullYear(_date.getFullYear());
19943      return +date - +utcDate;
19944    }
19945  
19946    // node_modules/date-fns/_lib/normalizeDates.js
19947    function normalizeDates(context, ...dates) {
19948      const normalize = constructFrom.bind(
19949        null,
19950        context || dates.find((date) => typeof date === "object")
19951      );
19952      return dates.map(normalize);
19953    }
19954  
19955    // node_modules/date-fns/startOfDay.js
19956    function startOfDay(date, options) {
19957      const _date = toDate(date, options?.in);
19958      _date.setHours(0, 0, 0, 0);
19959      return _date;
19960    }
19961  
19962    // node_modules/date-fns/differenceInCalendarDays.js
19963    function differenceInCalendarDays(laterDate, earlierDate, options) {
19964      const [laterDate_, earlierDate_] = normalizeDates(
19965        options?.in,
19966        laterDate,
19967        earlierDate
19968      );
19969      const laterStartOfDay = startOfDay(laterDate_);
19970      const earlierStartOfDay = startOfDay(earlierDate_);
19971      const laterTimestamp = +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay);
19972      const earlierTimestamp = +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay);
19973      return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay);
19974    }
19975  
19976    // node_modules/date-fns/startOfISOWeekYear.js
19977    function startOfISOWeekYear(date, options) {
19978      const year = getISOWeekYear(date, options);
19979      const fourthOfJanuary = constructFrom(options?.in || date, 0);
19980      fourthOfJanuary.setFullYear(year, 0, 4);
19981      fourthOfJanuary.setHours(0, 0, 0, 0);
19982      return startOfISOWeek(fourthOfJanuary);
19983    }
19984  
19985    // node_modules/date-fns/addWeeks.js
19986    function addWeeks(date, amount, options) {
19987      return addDays(date, amount * 7, options);
19988    }
19989  
19990    // node_modules/date-fns/addYears.js
19991    function addYears(date, amount, options) {
19992      return addMonths(date, amount * 12, options);
19993    }
19994  
19995    // node_modules/date-fns/isDate.js
19996    function isDate(value) {
19997      return value instanceof Date || typeof value === "object" && Object.prototype.toString.call(value) === "[object Date]";
19998    }
19999  
20000    // node_modules/date-fns/isValid.js
20001    function isValid(date) {
20002      return !(!isDate(date) && typeof date !== "number" || isNaN(+toDate(date)));
20003    }
20004  
20005    // node_modules/date-fns/startOfMonth.js
20006    function startOfMonth(date, options) {
20007      const _date = toDate(date, options?.in);
20008      _date.setDate(1);
20009      _date.setHours(0, 0, 0, 0);
20010      return _date;
20011    }
20012  
20013    // node_modules/date-fns/startOfYear.js
20014    function startOfYear(date, options) {
20015      const date_ = toDate(date, options?.in);
20016      date_.setFullYear(date_.getFullYear(), 0, 1);
20017      date_.setHours(0, 0, 0, 0);
20018      return date_;
20019    }
20020  
20021    // node_modules/date-fns/locale/en-US/_lib/formatDistance.js
20022    var formatDistanceLocale = {
20023      lessThanXSeconds: {
20024        one: "less than a second",
20025        other: "less than {{count}} seconds"
20026      },
20027      xSeconds: {
20028        one: "1 second",
20029        other: "{{count}} seconds"
20030      },
20031      halfAMinute: "half a minute",
20032      lessThanXMinutes: {
20033        one: "less than a minute",
20034        other: "less than {{count}} minutes"
20035      },
20036      xMinutes: {
20037        one: "1 minute",
20038        other: "{{count}} minutes"
20039      },
20040      aboutXHours: {
20041        one: "about 1 hour",
20042        other: "about {{count}} hours"
20043      },
20044      xHours: {
20045        one: "1 hour",
20046        other: "{{count}} hours"
20047      },
20048      xDays: {
20049        one: "1 day",
20050        other: "{{count}} days"
20051      },
20052      aboutXWeeks: {
20053        one: "about 1 week",
20054        other: "about {{count}} weeks"
20055      },
20056      xWeeks: {
20057        one: "1 week",
20058        other: "{{count}} weeks"
20059      },
20060      aboutXMonths: {
20061        one: "about 1 month",
20062        other: "about {{count}} months"
20063      },
20064      xMonths: {
20065        one: "1 month",
20066        other: "{{count}} months"
20067      },
20068      aboutXYears: {
20069        one: "about 1 year",
20070        other: "about {{count}} years"
20071      },
20072      xYears: {
20073        one: "1 year",
20074        other: "{{count}} years"
20075      },
20076      overXYears: {
20077        one: "over 1 year",
20078        other: "over {{count}} years"
20079      },
20080      almostXYears: {
20081        one: "almost 1 year",
20082        other: "almost {{count}} years"
20083      }
20084    };
20085    var formatDistance = (token, count, options) => {
20086      let result;
20087      const tokenValue = formatDistanceLocale[token];
20088      if (typeof tokenValue === "string") {
20089        result = tokenValue;
20090      } else if (count === 1) {
20091        result = tokenValue.one;
20092      } else {
20093        result = tokenValue.other.replace("{{count}}", count.toString());
20094      }
20095      if (options?.addSuffix) {
20096        if (options.comparison && options.comparison > 0) {
20097          return "in " + result;
20098        } else {
20099          return result + " ago";
20100        }
20101      }
20102      return result;
20103    };
20104  
20105    // node_modules/date-fns/locale/_lib/buildFormatLongFn.js
20106    function buildFormatLongFn(args) {
20107      return (options = {}) => {
20108        const width = options.width ? String(options.width) : args.defaultWidth;
20109        const format6 = args.formats[width] || args.formats[args.defaultWidth];
20110        return format6;
20111      };
20112    }
20113  
20114    // node_modules/date-fns/locale/en-US/_lib/formatLong.js
20115    var dateFormats = {
20116      full: "EEEE, MMMM do, y",
20117      long: "MMMM do, y",
20118      medium: "MMM d, y",
20119      short: "MM/dd/yyyy"
20120    };
20121    var timeFormats = {
20122      full: "h:mm:ss a zzzz",
20123      long: "h:mm:ss a z",
20124      medium: "h:mm:ss a",
20125      short: "h:mm a"
20126    };
20127    var dateTimeFormats = {
20128      full: "{{date}} 'at' {{time}}",
20129      long: "{{date}} 'at' {{time}}",
20130      medium: "{{date}}, {{time}}",
20131      short: "{{date}}, {{time}}"
20132    };
20133    var formatLong = {
20134      date: buildFormatLongFn({
20135        formats: dateFormats,
20136        defaultWidth: "full"
20137      }),
20138      time: buildFormatLongFn({
20139        formats: timeFormats,
20140        defaultWidth: "full"
20141      }),
20142      dateTime: buildFormatLongFn({
20143        formats: dateTimeFormats,
20144        defaultWidth: "full"
20145      })
20146    };
20147  
20148    // node_modules/date-fns/locale/en-US/_lib/formatRelative.js
20149    var formatRelativeLocale = {
20150      lastWeek: "'last' eeee 'at' p",
20151      yesterday: "'yesterday at' p",
20152      today: "'today at' p",
20153      tomorrow: "'tomorrow at' p",
20154      nextWeek: "eeee 'at' p",
20155      other: "P"
20156    };
20157    var formatRelative = (token, _date, _baseDate, _options) => formatRelativeLocale[token];
20158  
20159    // node_modules/date-fns/locale/_lib/buildLocalizeFn.js
20160    function buildLocalizeFn(args) {
20161      return (value, options) => {
20162        const context = options?.context ? String(options.context) : "standalone";
20163        let valuesArray;
20164        if (context === "formatting" && args.formattingValues) {
20165          const defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
20166          const width = options?.width ? String(options.width) : defaultWidth;
20167          valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
20168        } else {
20169          const defaultWidth = args.defaultWidth;
20170          const width = options?.width ? String(options.width) : args.defaultWidth;
20171          valuesArray = args.values[width] || args.values[defaultWidth];
20172        }
20173        const index2 = args.argumentCallback ? args.argumentCallback(value) : value;
20174        return valuesArray[index2];
20175      };
20176    }
20177  
20178    // node_modules/date-fns/locale/en-US/_lib/localize.js
20179    var eraValues = {
20180      narrow: ["B", "A"],
20181      abbreviated: ["BC", "AD"],
20182      wide: ["Before Christ", "Anno Domini"]
20183    };
20184    var quarterValues = {
20185      narrow: ["1", "2", "3", "4"],
20186      abbreviated: ["Q1", "Q2", "Q3", "Q4"],
20187      wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
20188    };
20189    var monthValues = {
20190      narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
20191      abbreviated: [
20192        "Jan",
20193        "Feb",
20194        "Mar",
20195        "Apr",
20196        "May",
20197        "Jun",
20198        "Jul",
20199        "Aug",
20200        "Sep",
20201        "Oct",
20202        "Nov",
20203        "Dec"
20204      ],
20205      wide: [
20206        "January",
20207        "February",
20208        "March",
20209        "April",
20210        "May",
20211        "June",
20212        "July",
20213        "August",
20214        "September",
20215        "October",
20216        "November",
20217        "December"
20218      ]
20219    };
20220    var dayValues = {
20221      narrow: ["S", "M", "T", "W", "T", "F", "S"],
20222      short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
20223      abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
20224      wide: [
20225        "Sunday",
20226        "Monday",
20227        "Tuesday",
20228        "Wednesday",
20229        "Thursday",
20230        "Friday",
20231        "Saturday"
20232      ]
20233    };
20234    var dayPeriodValues = {
20235      narrow: {
20236        am: "a",
20237        pm: "p",
20238        midnight: "mi",
20239        noon: "n",
20240        morning: "morning",
20241        afternoon: "afternoon",
20242        evening: "evening",
20243        night: "night"
20244      },
20245      abbreviated: {
20246        am: "AM",
20247        pm: "PM",
20248        midnight: "midnight",
20249        noon: "noon",
20250        morning: "morning",
20251        afternoon: "afternoon",
20252        evening: "evening",
20253        night: "night"
20254      },
20255      wide: {
20256        am: "a.m.",
20257        pm: "p.m.",
20258        midnight: "midnight",
20259        noon: "noon",
20260        morning: "morning",
20261        afternoon: "afternoon",
20262        evening: "evening",
20263        night: "night"
20264      }
20265    };
20266    var formattingDayPeriodValues = {
20267      narrow: {
20268        am: "a",
20269        pm: "p",
20270        midnight: "mi",
20271        noon: "n",
20272        morning: "in the morning",
20273        afternoon: "in the afternoon",
20274        evening: "in the evening",
20275        night: "at night"
20276      },
20277      abbreviated: {
20278        am: "AM",
20279        pm: "PM",
20280        midnight: "midnight",
20281        noon: "noon",
20282        morning: "in the morning",
20283        afternoon: "in the afternoon",
20284        evening: "in the evening",
20285        night: "at night"
20286      },
20287      wide: {
20288        am: "a.m.",
20289        pm: "p.m.",
20290        midnight: "midnight",
20291        noon: "noon",
20292        morning: "in the morning",
20293        afternoon: "in the afternoon",
20294        evening: "in the evening",
20295        night: "at night"
20296      }
20297    };
20298    var ordinalNumber = (dirtyNumber, _options) => {
20299      const number = Number(dirtyNumber);
20300      const rem100 = number % 100;
20301      if (rem100 > 20 || rem100 < 10) {
20302        switch (rem100 % 10) {
20303          case 1:
20304            return number + "st";
20305          case 2:
20306            return number + "nd";
20307          case 3:
20308            return number + "rd";
20309        }
20310      }
20311      return number + "th";
20312    };
20313    var localize = {
20314      ordinalNumber,
20315      era: buildLocalizeFn({
20316        values: eraValues,
20317        defaultWidth: "wide"
20318      }),
20319      quarter: buildLocalizeFn({
20320        values: quarterValues,
20321        defaultWidth: "wide",
20322        argumentCallback: (quarter) => quarter - 1
20323      }),
20324      month: buildLocalizeFn({
20325        values: monthValues,
20326        defaultWidth: "wide"
20327      }),
20328      day: buildLocalizeFn({
20329        values: dayValues,
20330        defaultWidth: "wide"
20331      }),
20332      dayPeriod: buildLocalizeFn({
20333        values: dayPeriodValues,
20334        defaultWidth: "wide",
20335        formattingValues: formattingDayPeriodValues,
20336        defaultFormattingWidth: "wide"
20337      })
20338    };
20339  
20340    // node_modules/date-fns/locale/_lib/buildMatchFn.js
20341    function buildMatchFn(args) {
20342      return (string, options = {}) => {
20343        const width = options.width;
20344        const matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
20345        const matchResult = string.match(matchPattern);
20346        if (!matchResult) {
20347          return null;
20348        }
20349        const matchedString = matchResult[0];
20350        const parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
20351        const key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString)) : (
20352          // [TODO] -- I challenge you to fix the type
20353          findKey(parsePatterns, (pattern) => pattern.test(matchedString))
20354        );
20355        let value;
20356        value = args.valueCallback ? args.valueCallback(key) : key;
20357        value = options.valueCallback ? (
20358          // [TODO] -- I challenge you to fix the type
20359          options.valueCallback(value)
20360        ) : value;
20361        const rest = string.slice(matchedString.length);
20362        return { value, rest };
20363      };
20364    }
20365    function findKey(object, predicate) {
20366      for (const key in object) {
20367        if (Object.prototype.hasOwnProperty.call(object, key) && predicate(object[key])) {
20368          return key;
20369        }
20370      }
20371      return void 0;
20372    }
20373    function findIndex(array, predicate) {
20374      for (let key = 0; key < array.length; key++) {
20375        if (predicate(array[key])) {
20376          return key;
20377        }
20378      }
20379      return void 0;
20380    }
20381  
20382    // node_modules/date-fns/locale/_lib/buildMatchPatternFn.js
20383    function buildMatchPatternFn(args) {
20384      return (string, options = {}) => {
20385        const matchResult = string.match(args.matchPattern);
20386        if (!matchResult) return null;
20387        const matchedString = matchResult[0];
20388        const parseResult = string.match(args.parsePattern);
20389        if (!parseResult) return null;
20390        let value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
20391        value = options.valueCallback ? options.valueCallback(value) : value;
20392        const rest = string.slice(matchedString.length);
20393        return { value, rest };
20394      };
20395    }
20396  
20397    // node_modules/date-fns/locale/en-US/_lib/match.js
20398    var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
20399    var parseOrdinalNumberPattern = /\d+/i;
20400    var matchEraPatterns = {
20401      narrow: /^(b|a)/i,
20402      abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
20403      wide: /^(before christ|before common era|anno domini|common era)/i
20404    };
20405    var parseEraPatterns = {
20406      any: [/^b/i, /^(a|c)/i]
20407    };
20408    var matchQuarterPatterns = {
20409      narrow: /^[1234]/i,
20410      abbreviated: /^q[1234]/i,
20411      wide: /^[1234](th|st|nd|rd)? quarter/i
20412    };
20413    var parseQuarterPatterns = {
20414      any: [/1/i, /2/i, /3/i, /4/i]
20415    };
20416    var matchMonthPatterns = {
20417      narrow: /^[jfmasond]/i,
20418      abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
20419      wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
20420    };
20421    var parseMonthPatterns = {
20422      narrow: [
20423        /^j/i,
20424        /^f/i,
20425        /^m/i,
20426        /^a/i,
20427        /^m/i,
20428        /^j/i,
20429        /^j/i,
20430        /^a/i,
20431        /^s/i,
20432        /^o/i,
20433        /^n/i,
20434        /^d/i
20435      ],
20436      any: [
20437        /^ja/i,
20438        /^f/i,
20439        /^mar/i,
20440        /^ap/i,
20441        /^may/i,
20442        /^jun/i,
20443        /^jul/i,
20444        /^au/i,
20445        /^s/i,
20446        /^o/i,
20447        /^n/i,
20448        /^d/i
20449      ]
20450    };
20451    var matchDayPatterns = {
20452      narrow: /^[smtwf]/i,
20453      short: /^(su|mo|tu|we|th|fr|sa)/i,
20454      abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
20455      wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
20456    };
20457    var parseDayPatterns = {
20458      narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
20459      any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
20460    };
20461    var matchDayPeriodPatterns = {
20462      narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
20463      any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
20464    };
20465    var parseDayPeriodPatterns = {
20466      any: {
20467        am: /^a/i,
20468        pm: /^p/i,
20469        midnight: /^mi/i,
20470        noon: /^no/i,
20471        morning: /morning/i,
20472        afternoon: /afternoon/i,
20473        evening: /evening/i,
20474        night: /night/i
20475      }
20476    };
20477    var match = {
20478      ordinalNumber: buildMatchPatternFn({
20479        matchPattern: matchOrdinalNumberPattern,
20480        parsePattern: parseOrdinalNumberPattern,
20481        valueCallback: (value) => parseInt(value, 10)
20482      }),
20483      era: buildMatchFn({
20484        matchPatterns: matchEraPatterns,
20485        defaultMatchWidth: "wide",
20486        parsePatterns: parseEraPatterns,
20487        defaultParseWidth: "any"
20488      }),
20489      quarter: buildMatchFn({
20490        matchPatterns: matchQuarterPatterns,
20491        defaultMatchWidth: "wide",
20492        parsePatterns: parseQuarterPatterns,
20493        defaultParseWidth: "any",
20494        valueCallback: (index2) => index2 + 1
20495      }),
20496      month: buildMatchFn({
20497        matchPatterns: matchMonthPatterns,
20498        defaultMatchWidth: "wide",
20499        parsePatterns: parseMonthPatterns,
20500        defaultParseWidth: "any"
20501      }),
20502      day: buildMatchFn({
20503        matchPatterns: matchDayPatterns,
20504        defaultMatchWidth: "wide",
20505        parsePatterns: parseDayPatterns,
20506        defaultParseWidth: "any"
20507      }),
20508      dayPeriod: buildMatchFn({
20509        matchPatterns: matchDayPeriodPatterns,
20510        defaultMatchWidth: "any",
20511        parsePatterns: parseDayPeriodPatterns,
20512        defaultParseWidth: "any"
20513      })
20514    };
20515  
20516    // node_modules/date-fns/locale/en-US.js
20517    var enUS = {
20518      code: "en-US",
20519      formatDistance,
20520      formatLong,
20521      formatRelative,
20522      localize,
20523      match,
20524      options: {
20525        weekStartsOn: 0,
20526        firstWeekContainsDate: 1
20527      }
20528    };
20529  
20530    // node_modules/date-fns/getDayOfYear.js
20531    function getDayOfYear(date, options) {
20532      const _date = toDate(date, options?.in);
20533      const diff = differenceInCalendarDays(_date, startOfYear(_date));
20534      const dayOfYear = diff + 1;
20535      return dayOfYear;
20536    }
20537  
20538    // node_modules/date-fns/getISOWeek.js
20539    function getISOWeek(date, options) {
20540      const _date = toDate(date, options?.in);
20541      const diff = +startOfISOWeek(_date) - +startOfISOWeekYear(_date);
20542      return Math.round(diff / millisecondsInWeek) + 1;
20543    }
20544  
20545    // node_modules/date-fns/getWeekYear.js
20546    function getWeekYear(date, options) {
20547      const _date = toDate(date, options?.in);
20548      const year = _date.getFullYear();
20549      const defaultOptions2 = getDefaultOptions();
20550      const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
20551      const firstWeekOfNextYear = constructFrom(options?.in || date, 0);
20552      firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate);
20553      firstWeekOfNextYear.setHours(0, 0, 0, 0);
20554      const startOfNextYear = startOfWeek(firstWeekOfNextYear, options);
20555      const firstWeekOfThisYear = constructFrom(options?.in || date, 0);
20556      firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate);
20557      firstWeekOfThisYear.setHours(0, 0, 0, 0);
20558      const startOfThisYear = startOfWeek(firstWeekOfThisYear, options);
20559      if (+_date >= +startOfNextYear) {
20560        return year + 1;
20561      } else if (+_date >= +startOfThisYear) {
20562        return year;
20563      } else {
20564        return year - 1;
20565      }
20566    }
20567  
20568    // node_modules/date-fns/startOfWeekYear.js
20569    function startOfWeekYear(date, options) {
20570      const defaultOptions2 = getDefaultOptions();
20571      const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
20572      const year = getWeekYear(date, options);
20573      const firstWeek = constructFrom(options?.in || date, 0);
20574      firstWeek.setFullYear(year, 0, firstWeekContainsDate);
20575      firstWeek.setHours(0, 0, 0, 0);
20576      const _date = startOfWeek(firstWeek, options);
20577      return _date;
20578    }
20579  
20580    // node_modules/date-fns/getWeek.js
20581    function getWeek(date, options) {
20582      const _date = toDate(date, options?.in);
20583      const diff = +startOfWeek(_date, options) - +startOfWeekYear(_date, options);
20584      return Math.round(diff / millisecondsInWeek) + 1;
20585    }
20586  
20587    // node_modules/date-fns/_lib/addLeadingZeros.js
20588    function addLeadingZeros(number, targetLength) {
20589      const sign = number < 0 ? "-" : "";
20590      const output = Math.abs(number).toString().padStart(targetLength, "0");
20591      return sign + output;
20592    }
20593  
20594    // node_modules/date-fns/_lib/format/lightFormatters.js
20595    var lightFormatters = {
20596      // Year
20597      y(date, token) {
20598        const signedYear = date.getFullYear();
20599        const year = signedYear > 0 ? signedYear : 1 - signedYear;
20600        return addLeadingZeros(token === "yy" ? year % 100 : year, token.length);
20601      },
20602      // Month
20603      M(date, token) {
20604        const month = date.getMonth();
20605        return token === "M" ? String(month + 1) : addLeadingZeros(month + 1, 2);
20606      },
20607      // Day of the month
20608      d(date, token) {
20609        return addLeadingZeros(date.getDate(), token.length);
20610      },
20611      // AM or PM
20612      a(date, token) {
20613        const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? "pm" : "am";
20614        switch (token) {
20615          case "a":
20616          case "aa":
20617            return dayPeriodEnumValue.toUpperCase();
20618          case "aaa":
20619            return dayPeriodEnumValue;
20620          case "aaaaa":
20621            return dayPeriodEnumValue[0];
20622          case "aaaa":
20623          default:
20624            return dayPeriodEnumValue === "am" ? "a.m." : "p.m.";
20625        }
20626      },
20627      // Hour [1-12]
20628      h(date, token) {
20629        return addLeadingZeros(date.getHours() % 12 || 12, token.length);
20630      },
20631      // Hour [0-23]
20632      H(date, token) {
20633        return addLeadingZeros(date.getHours(), token.length);
20634      },
20635      // Minute
20636      m(date, token) {
20637        return addLeadingZeros(date.getMinutes(), token.length);
20638      },
20639      // Second
20640      s(date, token) {
20641        return addLeadingZeros(date.getSeconds(), token.length);
20642      },
20643      // Fraction of second
20644      S(date, token) {
20645        const numberOfDigits = token.length;
20646        const milliseconds = date.getMilliseconds();
20647        const fractionalSeconds = Math.trunc(
20648          milliseconds * Math.pow(10, numberOfDigits - 3)
20649        );
20650        return addLeadingZeros(fractionalSeconds, token.length);
20651      }
20652    };
20653  
20654    // node_modules/date-fns/_lib/format/formatters.js
20655    var dayPeriodEnum = {
20656      am: "am",
20657      pm: "pm",
20658      midnight: "midnight",
20659      noon: "noon",
20660      morning: "morning",
20661      afternoon: "afternoon",
20662      evening: "evening",
20663      night: "night"
20664    };
20665    var formatters = {
20666      // Era
20667      G: function(date, token, localize2) {
20668        const era = date.getFullYear() > 0 ? 1 : 0;
20669        switch (token) {
20670          // AD, BC
20671          case "G":
20672          case "GG":
20673          case "GGG":
20674            return localize2.era(era, { width: "abbreviated" });
20675          // A, B
20676          case "GGGGG":
20677            return localize2.era(era, { width: "narrow" });
20678          // Anno Domini, Before Christ
20679          case "GGGG":
20680          default:
20681            return localize2.era(era, { width: "wide" });
20682        }
20683      },
20684      // Year
20685      y: function(date, token, localize2) {
20686        if (token === "yo") {
20687          const signedYear = date.getFullYear();
20688          const year = signedYear > 0 ? signedYear : 1 - signedYear;
20689          return localize2.ordinalNumber(year, { unit: "year" });
20690        }
20691        return lightFormatters.y(date, token);
20692      },
20693      // Local week-numbering year
20694      Y: function(date, token, localize2, options) {
20695        const signedWeekYear = getWeekYear(date, options);
20696        const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
20697        if (token === "YY") {
20698          const twoDigitYear = weekYear % 100;
20699          return addLeadingZeros(twoDigitYear, 2);
20700        }
20701        if (token === "Yo") {
20702          return localize2.ordinalNumber(weekYear, { unit: "year" });
20703        }
20704        return addLeadingZeros(weekYear, token.length);
20705      },
20706      // ISO week-numbering year
20707      R: function(date, token) {
20708        const isoWeekYear = getISOWeekYear(date);
20709        return addLeadingZeros(isoWeekYear, token.length);
20710      },
20711      // Extended year. This is a single number designating the year of this calendar system.
20712      // The main difference between `y` and `u` localizers are B.C. years:
20713      // | Year | `y` | `u` |
20714      // |------|-----|-----|
20715      // | AC 1 |   1 |   1 |
20716      // | BC 1 |   1 |   0 |
20717      // | BC 2 |   2 |  -1 |
20718      // Also `yy` always returns the last two digits of a year,
20719      // while `uu` pads single digit years to 2 characters and returns other years unchanged.
20720      u: function(date, token) {
20721        const year = date.getFullYear();
20722        return addLeadingZeros(year, token.length);
20723      },
20724      // Quarter
20725      Q: function(date, token, localize2) {
20726        const quarter = Math.ceil((date.getMonth() + 1) / 3);
20727        switch (token) {
20728          // 1, 2, 3, 4
20729          case "Q":
20730            return String(quarter);
20731          // 01, 02, 03, 04
20732          case "QQ":
20733            return addLeadingZeros(quarter, 2);
20734          // 1st, 2nd, 3rd, 4th
20735          case "Qo":
20736            return localize2.ordinalNumber(quarter, { unit: "quarter" });
20737          // Q1, Q2, Q3, Q4
20738          case "QQQ":
20739            return localize2.quarter(quarter, {
20740              width: "abbreviated",
20741              context: "formatting"
20742            });
20743          // 1, 2, 3, 4 (narrow quarter; could be not numerical)
20744          case "QQQQQ":
20745            return localize2.quarter(quarter, {
20746              width: "narrow",
20747              context: "formatting"
20748            });
20749          // 1st quarter, 2nd quarter, ...
20750          case "QQQQ":
20751          default:
20752            return localize2.quarter(quarter, {
20753              width: "wide",
20754              context: "formatting"
20755            });
20756        }
20757      },
20758      // Stand-alone quarter
20759      q: function(date, token, localize2) {
20760        const quarter = Math.ceil((date.getMonth() + 1) / 3);
20761        switch (token) {
20762          // 1, 2, 3, 4
20763          case "q":
20764            return String(quarter);
20765          // 01, 02, 03, 04
20766          case "qq":
20767            return addLeadingZeros(quarter, 2);
20768          // 1st, 2nd, 3rd, 4th
20769          case "qo":
20770            return localize2.ordinalNumber(quarter, { unit: "quarter" });
20771          // Q1, Q2, Q3, Q4
20772          case "qqq":
20773            return localize2.quarter(quarter, {
20774              width: "abbreviated",
20775              context: "standalone"
20776            });
20777          // 1, 2, 3, 4 (narrow quarter; could be not numerical)
20778          case "qqqqq":
20779            return localize2.quarter(quarter, {
20780              width: "narrow",
20781              context: "standalone"
20782            });
20783          // 1st quarter, 2nd quarter, ...
20784          case "qqqq":
20785          default:
20786            return localize2.quarter(quarter, {
20787              width: "wide",
20788              context: "standalone"
20789            });
20790        }
20791      },
20792      // Month
20793      M: function(date, token, localize2) {
20794        const month = date.getMonth();
20795        switch (token) {
20796          case "M":
20797          case "MM":
20798            return lightFormatters.M(date, token);
20799          // 1st, 2nd, ..., 12th
20800          case "Mo":
20801            return localize2.ordinalNumber(month + 1, { unit: "month" });
20802          // Jan, Feb, ..., Dec
20803          case "MMM":
20804            return localize2.month(month, {
20805              width: "abbreviated",
20806              context: "formatting"
20807            });
20808          // J, F, ..., D
20809          case "MMMMM":
20810            return localize2.month(month, {
20811              width: "narrow",
20812              context: "formatting"
20813            });
20814          // January, February, ..., December
20815          case "MMMM":
20816          default:
20817            return localize2.month(month, { width: "wide", context: "formatting" });
20818        }
20819      },
20820      // Stand-alone month
20821      L: function(date, token, localize2) {
20822        const month = date.getMonth();
20823        switch (token) {
20824          // 1, 2, ..., 12
20825          case "L":
20826            return String(month + 1);
20827          // 01, 02, ..., 12
20828          case "LL":
20829            return addLeadingZeros(month + 1, 2);
20830          // 1st, 2nd, ..., 12th
20831          case "Lo":
20832            return localize2.ordinalNumber(month + 1, { unit: "month" });
20833          // Jan, Feb, ..., Dec
20834          case "LLL":
20835            return localize2.month(month, {
20836              width: "abbreviated",
20837              context: "standalone"
20838            });
20839          // J, F, ..., D
20840          case "LLLLL":
20841            return localize2.month(month, {
20842              width: "narrow",
20843              context: "standalone"
20844            });
20845          // January, February, ..., December
20846          case "LLLL":
20847          default:
20848            return localize2.month(month, { width: "wide", context: "standalone" });
20849        }
20850      },
20851      // Local week of year
20852      w: function(date, token, localize2, options) {
20853        const week = getWeek(date, options);
20854        if (token === "wo") {
20855          return localize2.ordinalNumber(week, { unit: "week" });
20856        }
20857        return addLeadingZeros(week, token.length);
20858      },
20859      // ISO week of year
20860      I: function(date, token, localize2) {
20861        const isoWeek = getISOWeek(date);
20862        if (token === "Io") {
20863          return localize2.ordinalNumber(isoWeek, { unit: "week" });
20864        }
20865        return addLeadingZeros(isoWeek, token.length);
20866      },
20867      // Day of the month
20868      d: function(date, token, localize2) {
20869        if (token === "do") {
20870          return localize2.ordinalNumber(date.getDate(), { unit: "date" });
20871        }
20872        return lightFormatters.d(date, token);
20873      },
20874      // Day of year
20875      D: function(date, token, localize2) {
20876        const dayOfYear = getDayOfYear(date);
20877        if (token === "Do") {
20878          return localize2.ordinalNumber(dayOfYear, { unit: "dayOfYear" });
20879        }
20880        return addLeadingZeros(dayOfYear, token.length);
20881      },
20882      // Day of week
20883      E: function(date, token, localize2) {
20884        const dayOfWeek = date.getDay();
20885        switch (token) {
20886          // Tue
20887          case "E":
20888          case "EE":
20889          case "EEE":
20890            return localize2.day(dayOfWeek, {
20891              width: "abbreviated",
20892              context: "formatting"
20893            });
20894          // T
20895          case "EEEEE":
20896            return localize2.day(dayOfWeek, {
20897              width: "narrow",
20898              context: "formatting"
20899            });
20900          // Tu
20901          case "EEEEEE":
20902            return localize2.day(dayOfWeek, {
20903              width: "short",
20904              context: "formatting"
20905            });
20906          // Tuesday
20907          case "EEEE":
20908          default:
20909            return localize2.day(dayOfWeek, {
20910              width: "wide",
20911              context: "formatting"
20912            });
20913        }
20914      },
20915      // Local day of week
20916      e: function(date, token, localize2, options) {
20917        const dayOfWeek = date.getDay();
20918        const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
20919        switch (token) {
20920          // Numerical value (Nth day of week with current locale or weekStartsOn)
20921          case "e":
20922            return String(localDayOfWeek);
20923          // Padded numerical value
20924          case "ee":
20925            return addLeadingZeros(localDayOfWeek, 2);
20926          // 1st, 2nd, ..., 7th
20927          case "eo":
20928            return localize2.ordinalNumber(localDayOfWeek, { unit: "day" });
20929          case "eee":
20930            return localize2.day(dayOfWeek, {
20931              width: "abbreviated",
20932              context: "formatting"
20933            });
20934          // T
20935          case "eeeee":
20936            return localize2.day(dayOfWeek, {
20937              width: "narrow",
20938              context: "formatting"
20939            });
20940          // Tu
20941          case "eeeeee":
20942            return localize2.day(dayOfWeek, {
20943              width: "short",
20944              context: "formatting"
20945            });
20946          // Tuesday
20947          case "eeee":
20948          default:
20949            return localize2.day(dayOfWeek, {
20950              width: "wide",
20951              context: "formatting"
20952            });
20953        }
20954      },
20955      // Stand-alone local day of week
20956      c: function(date, token, localize2, options) {
20957        const dayOfWeek = date.getDay();
20958        const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
20959        switch (token) {
20960          // Numerical value (same as in `e`)
20961          case "c":
20962            return String(localDayOfWeek);
20963          // Padded numerical value
20964          case "cc":
20965            return addLeadingZeros(localDayOfWeek, token.length);
20966          // 1st, 2nd, ..., 7th
20967          case "co":
20968            return localize2.ordinalNumber(localDayOfWeek, { unit: "day" });
20969          case "ccc":
20970            return localize2.day(dayOfWeek, {
20971              width: "abbreviated",
20972              context: "standalone"
20973            });
20974          // T
20975          case "ccccc":
20976            return localize2.day(dayOfWeek, {
20977              width: "narrow",
20978              context: "standalone"
20979            });
20980          // Tu
20981          case "cccccc":
20982            return localize2.day(dayOfWeek, {
20983              width: "short",
20984              context: "standalone"
20985            });
20986          // Tuesday
20987          case "cccc":
20988          default:
20989            return localize2.day(dayOfWeek, {
20990              width: "wide",
20991              context: "standalone"
20992            });
20993        }
20994      },
20995      // ISO day of week
20996      i: function(date, token, localize2) {
20997        const dayOfWeek = date.getDay();
20998        const isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
20999        switch (token) {
21000          // 2
21001          case "i":
21002            return String(isoDayOfWeek);
21003          // 02
21004          case "ii":
21005            return addLeadingZeros(isoDayOfWeek, token.length);
21006          // 2nd
21007          case "io":
21008            return localize2.ordinalNumber(isoDayOfWeek, { unit: "day" });
21009          // Tue
21010          case "iii":
21011            return localize2.day(dayOfWeek, {
21012              width: "abbreviated",
21013              context: "formatting"
21014            });
21015          // T
21016          case "iiiii":
21017            return localize2.day(dayOfWeek, {
21018              width: "narrow",
21019              context: "formatting"
21020            });
21021          // Tu
21022          case "iiiiii":
21023            return localize2.day(dayOfWeek, {
21024              width: "short",
21025              context: "formatting"
21026            });
21027          // Tuesday
21028          case "iiii":
21029          default:
21030            return localize2.day(dayOfWeek, {
21031              width: "wide",
21032              context: "formatting"
21033            });
21034        }
21035      },
21036      // AM or PM
21037      a: function(date, token, localize2) {
21038        const hours = date.getHours();
21039        const dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
21040        switch (token) {
21041          case "a":
21042          case "aa":
21043            return localize2.dayPeriod(dayPeriodEnumValue, {
21044              width: "abbreviated",
21045              context: "formatting"
21046            });
21047          case "aaa":
21048            return localize2.dayPeriod(dayPeriodEnumValue, {
21049              width: "abbreviated",
21050              context: "formatting"
21051            }).toLowerCase();
21052          case "aaaaa":
21053            return localize2.dayPeriod(dayPeriodEnumValue, {
21054              width: "narrow",
21055              context: "formatting"
21056            });
21057          case "aaaa":
21058          default:
21059            return localize2.dayPeriod(dayPeriodEnumValue, {
21060              width: "wide",
21061              context: "formatting"
21062            });
21063        }
21064      },
21065      // AM, PM, midnight, noon
21066      b: function(date, token, localize2) {
21067        const hours = date.getHours();
21068        let dayPeriodEnumValue;
21069        if (hours === 12) {
21070          dayPeriodEnumValue = dayPeriodEnum.noon;
21071        } else if (hours === 0) {
21072          dayPeriodEnumValue = dayPeriodEnum.midnight;
21073        } else {
21074          dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
21075        }
21076        switch (token) {
21077          case "b":
21078          case "bb":
21079            return localize2.dayPeriod(dayPeriodEnumValue, {
21080              width: "abbreviated",
21081              context: "formatting"
21082            });
21083          case "bbb":
21084            return localize2.dayPeriod(dayPeriodEnumValue, {
21085              width: "abbreviated",
21086              context: "formatting"
21087            }).toLowerCase();
21088          case "bbbbb":
21089            return localize2.dayPeriod(dayPeriodEnumValue, {
21090              width: "narrow",
21091              context: "formatting"
21092            });
21093          case "bbbb":
21094          default:
21095            return localize2.dayPeriod(dayPeriodEnumValue, {
21096              width: "wide",
21097              context: "formatting"
21098            });
21099        }
21100      },
21101      // in the morning, in the afternoon, in the evening, at night
21102      B: function(date, token, localize2) {
21103        const hours = date.getHours();
21104        let dayPeriodEnumValue;
21105        if (hours >= 17) {
21106          dayPeriodEnumValue = dayPeriodEnum.evening;
21107        } else if (hours >= 12) {
21108          dayPeriodEnumValue = dayPeriodEnum.afternoon;
21109        } else if (hours >= 4) {
21110          dayPeriodEnumValue = dayPeriodEnum.morning;
21111        } else {
21112          dayPeriodEnumValue = dayPeriodEnum.night;
21113        }
21114        switch (token) {
21115          case "B":
21116          case "BB":
21117          case "BBB":
21118            return localize2.dayPeriod(dayPeriodEnumValue, {
21119              width: "abbreviated",
21120              context: "formatting"
21121            });
21122          case "BBBBB":
21123            return localize2.dayPeriod(dayPeriodEnumValue, {
21124              width: "narrow",
21125              context: "formatting"
21126            });
21127          case "BBBB":
21128          default:
21129            return localize2.dayPeriod(dayPeriodEnumValue, {
21130              width: "wide",
21131              context: "formatting"
21132            });
21133        }
21134      },
21135      // Hour [1-12]
21136      h: function(date, token, localize2) {
21137        if (token === "ho") {
21138          let hours = date.getHours() % 12;
21139          if (hours === 0) hours = 12;
21140          return localize2.ordinalNumber(hours, { unit: "hour" });
21141        }
21142        return lightFormatters.h(date, token);
21143      },
21144      // Hour [0-23]
21145      H: function(date, token, localize2) {
21146        if (token === "Ho") {
21147          return localize2.ordinalNumber(date.getHours(), { unit: "hour" });
21148        }
21149        return lightFormatters.H(date, token);
21150      },
21151      // Hour [0-11]
21152      K: function(date, token, localize2) {
21153        const hours = date.getHours() % 12;
21154        if (token === "Ko") {
21155          return localize2.ordinalNumber(hours, { unit: "hour" });
21156        }
21157        return addLeadingZeros(hours, token.length);
21158      },
21159      // Hour [1-24]
21160      k: function(date, token, localize2) {
21161        let hours = date.getHours();
21162        if (hours === 0) hours = 24;
21163        if (token === "ko") {
21164          return localize2.ordinalNumber(hours, { unit: "hour" });
21165        }
21166        return addLeadingZeros(hours, token.length);
21167      },
21168      // Minute
21169      m: function(date, token, localize2) {
21170        if (token === "mo") {
21171          return localize2.ordinalNumber(date.getMinutes(), { unit: "minute" });
21172        }
21173        return lightFormatters.m(date, token);
21174      },
21175      // Second
21176      s: function(date, token, localize2) {
21177        if (token === "so") {
21178          return localize2.ordinalNumber(date.getSeconds(), { unit: "second" });
21179        }
21180        return lightFormatters.s(date, token);
21181      },
21182      // Fraction of second
21183      S: function(date, token) {
21184        return lightFormatters.S(date, token);
21185      },
21186      // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
21187      X: function(date, token, _localize) {
21188        const timezoneOffset = date.getTimezoneOffset();
21189        if (timezoneOffset === 0) {
21190          return "Z";
21191        }
21192        switch (token) {
21193          // Hours and optional minutes
21194          case "X":
21195            return formatTimezoneWithOptionalMinutes(timezoneOffset);
21196          // Hours, minutes and optional seconds without `:` delimiter
21197          // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
21198          // so this token always has the same output as `XX`
21199          case "XXXX":
21200          case "XX":
21201            return formatTimezone(timezoneOffset);
21202          // Hours, minutes and optional seconds with `:` delimiter
21203          // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
21204          // so this token always has the same output as `XXX`
21205          case "XXXXX":
21206          case "XXX":
21207          // Hours and minutes with `:` delimiter
21208          default:
21209            return formatTimezone(timezoneOffset, ":");
21210        }
21211      },
21212      // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
21213      x: function(date, token, _localize) {
21214        const timezoneOffset = date.getTimezoneOffset();
21215        switch (token) {
21216          // Hours and optional minutes
21217          case "x":
21218            return formatTimezoneWithOptionalMinutes(timezoneOffset);
21219          // Hours, minutes and optional seconds without `:` delimiter
21220          // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
21221          // so this token always has the same output as `xx`
21222          case "xxxx":
21223          case "xx":
21224            return formatTimezone(timezoneOffset);
21225          // Hours, minutes and optional seconds with `:` delimiter
21226          // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
21227          // so this token always has the same output as `xxx`
21228          case "xxxxx":
21229          case "xxx":
21230          // Hours and minutes with `:` delimiter
21231          default:
21232            return formatTimezone(timezoneOffset, ":");
21233        }
21234      },
21235      // Timezone (GMT)
21236      O: function(date, token, _localize) {
21237        const timezoneOffset = date.getTimezoneOffset();
21238        switch (token) {
21239          // Short
21240          case "O":
21241          case "OO":
21242          case "OOO":
21243            return "GMT" + formatTimezoneShort(timezoneOffset, ":");
21244          // Long
21245          case "OOOO":
21246          default:
21247            return "GMT" + formatTimezone(timezoneOffset, ":");
21248        }
21249      },
21250      // Timezone (specific non-location)
21251      z: function(date, token, _localize) {
21252        const timezoneOffset = date.getTimezoneOffset();
21253        switch (token) {
21254          // Short
21255          case "z":
21256          case "zz":
21257          case "zzz":
21258            return "GMT" + formatTimezoneShort(timezoneOffset, ":");
21259          // Long
21260          case "zzzz":
21261          default:
21262            return "GMT" + formatTimezone(timezoneOffset, ":");
21263        }
21264      },
21265      // Seconds timestamp
21266      t: function(date, token, _localize) {
21267        const timestamp = Math.trunc(+date / 1e3);
21268        return addLeadingZeros(timestamp, token.length);
21269      },
21270      // Milliseconds timestamp
21271      T: function(date, token, _localize) {
21272        return addLeadingZeros(+date, token.length);
21273      }
21274    };
21275    function formatTimezoneShort(offset4, delimiter = "") {
21276      const sign = offset4 > 0 ? "-" : "+";
21277      const absOffset = Math.abs(offset4);
21278      const hours = Math.trunc(absOffset / 60);
21279      const minutes = absOffset % 60;
21280      if (minutes === 0) {
21281        return sign + String(hours);
21282      }
21283      return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
21284    }
21285    function formatTimezoneWithOptionalMinutes(offset4, delimiter) {
21286      if (offset4 % 60 === 0) {
21287        const sign = offset4 > 0 ? "-" : "+";
21288        return sign + addLeadingZeros(Math.abs(offset4) / 60, 2);
21289      }
21290      return formatTimezone(offset4, delimiter);
21291    }
21292    function formatTimezone(offset4, delimiter = "") {
21293      const sign = offset4 > 0 ? "-" : "+";
21294      const absOffset = Math.abs(offset4);
21295      const hours = addLeadingZeros(Math.trunc(absOffset / 60), 2);
21296      const minutes = addLeadingZeros(absOffset % 60, 2);
21297      return sign + hours + delimiter + minutes;
21298    }
21299  
21300    // node_modules/date-fns/_lib/format/longFormatters.js
21301    var dateLongFormatter = (pattern, formatLong2) => {
21302      switch (pattern) {
21303        case "P":
21304          return formatLong2.date({ width: "short" });
21305        case "PP":
21306          return formatLong2.date({ width: "medium" });
21307        case "PPP":
21308          return formatLong2.date({ width: "long" });
21309        case "PPPP":
21310        default:
21311          return formatLong2.date({ width: "full" });
21312      }
21313    };
21314    var timeLongFormatter = (pattern, formatLong2) => {
21315      switch (pattern) {
21316        case "p":
21317          return formatLong2.time({ width: "short" });
21318        case "pp":
21319          return formatLong2.time({ width: "medium" });
21320        case "ppp":
21321          return formatLong2.time({ width: "long" });
21322        case "pppp":
21323        default:
21324          return formatLong2.time({ width: "full" });
21325      }
21326    };
21327    var dateTimeLongFormatter = (pattern, formatLong2) => {
21328      const matchResult = pattern.match(/(P+)(p+)?/) || [];
21329      const datePattern = matchResult[1];
21330      const timePattern = matchResult[2];
21331      if (!timePattern) {
21332        return dateLongFormatter(pattern, formatLong2);
21333      }
21334      let dateTimeFormat;
21335      switch (datePattern) {
21336        case "P":
21337          dateTimeFormat = formatLong2.dateTime({ width: "short" });
21338          break;
21339        case "PP":
21340          dateTimeFormat = formatLong2.dateTime({ width: "medium" });
21341          break;
21342        case "PPP":
21343          dateTimeFormat = formatLong2.dateTime({ width: "long" });
21344          break;
21345        case "PPPP":
21346        default:
21347          dateTimeFormat = formatLong2.dateTime({ width: "full" });
21348          break;
21349      }
21350      return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong2)).replace("{{time}}", timeLongFormatter(timePattern, formatLong2));
21351    };
21352    var longFormatters = {
21353      p: timeLongFormatter,
21354      P: dateTimeLongFormatter
21355    };
21356  
21357    // node_modules/date-fns/_lib/protectedTokens.js
21358    var dayOfYearTokenRE = /^D+$/;
21359    var weekYearTokenRE = /^Y+$/;
21360    var throwTokens = ["D", "DD", "YY", "YYYY"];
21361    function isProtectedDayOfYearToken(token) {
21362      return dayOfYearTokenRE.test(token);
21363    }
21364    function isProtectedWeekYearToken(token) {
21365      return weekYearTokenRE.test(token);
21366    }
21367    function warnOrThrowProtectedError(token, format6, input) {
21368      const _message = message(token, format6, input);
21369      console.warn(_message);
21370      if (throwTokens.includes(token)) throw new RangeError(_message);
21371    }
21372    function message(token, format6, input) {
21373      const subject = token[0] === "Y" ? "years" : "days of the month";
21374      return `Use \`$token.toLowerCase()}\` instead of \`$token}\` (in \`$format6}\`) for formatting $subject} to the input \`$input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
21375    }
21376  
21377    // node_modules/date-fns/format.js
21378    var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
21379    var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
21380    var escapedStringRegExp = /^'([^]*?)'?$/;
21381    var doubleQuoteRegExp = /''/g;
21382    var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
21383    function format(date, formatStr, options) {
21384      const defaultOptions2 = getDefaultOptions();
21385      const locale = options?.locale ?? defaultOptions2.locale ?? enUS;
21386      const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
21387      const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
21388      const originalDate = toDate(date, options?.in);
21389      if (!isValid(originalDate)) {
21390        throw new RangeError("Invalid time value");
21391      }
21392      let parts = formatStr.match(longFormattingTokensRegExp).map((substring) => {
21393        const firstCharacter = substring[0];
21394        if (firstCharacter === "p" || firstCharacter === "P") {
21395          const longFormatter = longFormatters[firstCharacter];
21396          return longFormatter(substring, locale.formatLong);
21397        }
21398        return substring;
21399      }).join("").match(formattingTokensRegExp).map((substring) => {
21400        if (substring === "''") {
21401          return { isToken: false, value: "'" };
21402        }
21403        const firstCharacter = substring[0];
21404        if (firstCharacter === "'") {
21405          return { isToken: false, value: cleanEscapedString(substring) };
21406        }
21407        if (formatters[firstCharacter]) {
21408          return { isToken: true, value: substring };
21409        }
21410        if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
21411          throw new RangeError(
21412            "Format string contains an unescaped latin alphabet character `" + firstCharacter + "`"
21413          );
21414        }
21415        return { isToken: false, value: substring };
21416      });
21417      if (locale.localize.preprocessor) {
21418        parts = locale.localize.preprocessor(originalDate, parts);
21419      }
21420      const formatterOptions = {
21421        firstWeekContainsDate,
21422        weekStartsOn,
21423        locale
21424      };
21425      return parts.map((part) => {
21426        if (!part.isToken) return part.value;
21427        const token = part.value;
21428        if (!options?.useAdditionalWeekYearTokens && isProtectedWeekYearToken(token) || !options?.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(token)) {
21429          warnOrThrowProtectedError(token, formatStr, String(date));
21430        }
21431        const formatter = formatters[token[0]];
21432        return formatter(originalDate, token, locale.localize, formatterOptions);
21433      }).join("");
21434    }
21435    function cleanEscapedString(input) {
21436      const matched = input.match(escapedStringRegExp);
21437      if (!matched) {
21438        return input;
21439      }
21440      return matched[1].replace(doubleQuoteRegExp, "'");
21441    }
21442  
21443    // node_modules/date-fns/subDays.js
21444    function subDays(date, amount, options) {
21445      return addDays(date, -amount, options);
21446    }
21447  
21448    // node_modules/date-fns/subMonths.js
21449    function subMonths(date, amount, options) {
21450      return addMonths(date, -amount, options);
21451    }
21452  
21453    // node_modules/date-fns/subWeeks.js
21454    function subWeeks(date, amount, options) {
21455      return addWeeks(date, -amount, options);
21456    }
21457  
21458    // node_modules/date-fns/subYears.js
21459    function subYears(date, amount, options) {
21460      return addYears(date, -amount, options);
21461    }
21462  
21463    // packages/dataviews/build-module/utils/operators.mjs
21464    var import_i18n31 = __toESM(require_i18n(), 1);
21465    var import_element46 = __toESM(require_element(), 1);
21466    var import_date = __toESM(require_date(), 1);
21467    var import_jsx_runtime82 = __toESM(require_jsx_runtime(), 1);
21468    var filterTextWrappers = {
21469      Name: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("span", { className: "dataviews-filters__summary-filter-text-name" }),
21470      Value: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("span", { className: "dataviews-filters__summary-filter-text-value" })
21471    };
21472    function getRelativeDate(value, unit) {
21473      switch (unit) {
21474        case "days":
21475          return subDays(/* @__PURE__ */ new Date(), value);
21476        case "weeks":
21477          return subWeeks(/* @__PURE__ */ new Date(), value);
21478        case "months":
21479          return subMonths(/* @__PURE__ */ new Date(), value);
21480        case "years":
21481          return subYears(/* @__PURE__ */ new Date(), value);
21482        default:
21483          return /* @__PURE__ */ new Date();
21484      }
21485    }
21486    var isNoneOperatorDefinition = {
21487      /* translators: DataViews operator name */
21488      label: (0, import_i18n31.__)("Is none of"),
21489      filterText: (filter, activeElements) => (0, import_element46.createInterpolateElement)(
21490        (0, import_i18n31.sprintf)(
21491          /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is none of: Admin, Editor". */
21492          (0, import_i18n31.__)("<Name>%1$s is none of: </Name><Value>%2$s</Value>"),
21493          filter.name,
21494          activeElements.map((element) => element.label).join(", ")
21495        ),
21496        filterTextWrappers
21497      ),
21498      filter: ((item, field, filterValue) => {
21499        if (!filterValue?.length) {
21500          return true;
21501        }
21502        const fieldValue = field.getValue({ item });
21503        if (Array.isArray(fieldValue)) {
21504          return !filterValue.some(
21505            (fv) => fieldValue.includes(fv)
21506          );
21507        } else if (typeof fieldValue === "string") {
21508          return !filterValue.includes(fieldValue);
21509        }
21510        return false;
21511      }),
21512      selection: "multi"
21513    };
21514    var OPERATORS = [
21515      {
21516        name: OPERATOR_IS_ANY,
21517        /* translators: DataViews operator name */
21518        label: (0, import_i18n31.__)("Includes"),
21519        filterText: (filter, activeElements) => (0, import_element46.createInterpolateElement)(
21520          (0, import_i18n31.sprintf)(
21521            /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is any: Admin, Editor". */
21522            (0, import_i18n31.__)("<Name>%1$s includes: </Name><Value>%2$s</Value>"),
21523            filter.name,
21524            activeElements.map((element) => element.label).join(", ")
21525          ),
21526          filterTextWrappers
21527        ),
21528        filter(item, field, filterValue) {
21529          if (!filterValue?.length) {
21530            return true;
21531          }
21532          const fieldValue = field.getValue({ item });
21533          if (Array.isArray(fieldValue)) {
21534            return filterValue.some(
21535              (fv) => fieldValue.includes(fv)
21536            );
21537          } else if (typeof fieldValue === "string") {
21538            return filterValue.includes(fieldValue);
21539          }
21540          return false;
21541        },
21542        selection: "multi"
21543      },
21544      {
21545        name: OPERATOR_IS_NONE,
21546        ...isNoneOperatorDefinition
21547      },
21548      {
21549        name: OPERATOR_IS_ALL,
21550        /* translators: DataViews operator name */
21551        label: (0, import_i18n31.__)("Includes all"),
21552        filterText: (filter, activeElements) => (0, import_element46.createInterpolateElement)(
21553          (0, import_i18n31.sprintf)(
21554            /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author includes all: Admin, Editor". */
21555            (0, import_i18n31.__)("<Name>%1$s includes all: </Name><Value>%2$s</Value>"),
21556            filter.name,
21557            activeElements.map((element) => element.label).join(", ")
21558          ),
21559          filterTextWrappers
21560        ),
21561        filter(item, field, filterValue) {
21562          if (!filterValue?.length) {
21563            return true;
21564          }
21565          return filterValue.every((value) => {
21566            return field.getValue({ item })?.includes(value);
21567          });
21568        },
21569        selection: "multi"
21570      },
21571      {
21572        name: OPERATOR_IS_NOT_ALL,
21573        ...isNoneOperatorDefinition
21574      },
21575      {
21576        name: OPERATOR_BETWEEN,
21577        /* translators: DataViews operator name */
21578        label: (0, import_i18n31.__)("Between (inc)"),
21579        filterText: (filter, activeElements) => (0, import_element46.createInterpolateElement)(
21580          (0, import_i18n31.sprintf)(
21581            /* 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". */
21582            (0, import_i18n31.__)(
21583              "<Name>%1$s between (inc): </Name><Value>%2$s and %3$s</Value>"
21584            ),
21585            filter.name,
21586            activeElements[0].label[0],
21587            activeElements[0].label[1]
21588          ),
21589          filterTextWrappers
21590        ),
21591        filter(item, field, filterValue) {
21592          if (!Array.isArray(filterValue) || filterValue.length !== 2 || filterValue[0] === void 0 || filterValue[1] === void 0) {
21593            return true;
21594          }
21595          const fieldValue = field.getValue({ item });
21596          if (typeof fieldValue === "number" || fieldValue instanceof Date || typeof fieldValue === "string") {
21597            return fieldValue >= filterValue[0] && fieldValue <= filterValue[1];
21598          }
21599          return false;
21600        },
21601        selection: "custom"
21602      },
21603      {
21604        name: OPERATOR_IN_THE_PAST,
21605        /* translators: DataViews operator name */
21606        label: (0, import_i18n31.__)("In the past"),
21607        filterText: (filter, activeElements) => (0, import_element46.createInterpolateElement)(
21608          (0, import_i18n31.sprintf)(
21609            /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "7 days"): "Date is in the past: 7 days". */
21610            (0, import_i18n31.__)(
21611              "<Name>%1$s is in the past: </Name><Value>%2$s</Value>"
21612            ),
21613            filter.name,
21614            `$activeElements[0].value.value} $activeElements[0].value.unit}`
21615          ),
21616          filterTextWrappers
21617        ),
21618        filter(item, field, filterValue) {
21619          if (filterValue?.value === void 0 || filterValue?.unit === void 0) {
21620            return true;
21621          }
21622          const targetDate = getRelativeDate(
21623            filterValue.value,
21624            filterValue.unit
21625          );
21626          const fieldValue = (0, import_date.getDate)(field.getValue({ item }));
21627          return fieldValue >= targetDate && fieldValue <= /* @__PURE__ */ new Date();
21628        },
21629        selection: "custom"
21630      },
21631      {
21632        name: OPERATOR_OVER,
21633        /* translators: DataViews operator name */
21634        label: (0, import_i18n31.__)("Over"),
21635        filterText: (filter, activeElements) => (0, import_element46.createInterpolateElement)(
21636          (0, import_i18n31.sprintf)(
21637            /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "7 days"): "Date is over: 7 days". */
21638            (0, import_i18n31.__)("<Name>%1$s is over: </Name><Value>%2$s</Value>"),
21639            filter.name,
21640            `$activeElements[0].value.value} $activeElements[0].value.unit}`
21641          ),
21642          filterTextWrappers
21643        ),
21644        filter(item, field, filterValue) {
21645          if (filterValue?.value === void 0 || filterValue?.unit === void 0) {
21646            return true;
21647          }
21648          const targetDate = getRelativeDate(
21649            filterValue.value,
21650            filterValue.unit
21651          );
21652          const fieldValue = (0, import_date.getDate)(field.getValue({ item }));
21653          return fieldValue < targetDate;
21654        },
21655        selection: "custom"
21656      },
21657      {
21658        name: OPERATOR_IS,
21659        /* translators: DataViews operator name */
21660        label: (0, import_i18n31.__)("Is"),
21661        filterText: (filter, activeElements) => (0, import_element46.createInterpolateElement)(
21662          (0, import_i18n31.sprintf)(
21663            /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is: Admin". */
21664            (0, import_i18n31.__)("<Name>%1$s is: </Name><Value>%2$s</Value>"),
21665            filter.name,
21666            activeElements[0].label
21667          ),
21668          filterTextWrappers
21669        ),
21670        filter(item, field, filterValue) {
21671          return filterValue === field.getValue({ item }) || filterValue === void 0;
21672        },
21673        selection: "single"
21674      },
21675      {
21676        name: OPERATOR_IS_NOT,
21677        /* translators: DataViews operator name */
21678        label: (0, import_i18n31.__)("Is not"),
21679        filterText: (filter, activeElements) => (0, import_element46.createInterpolateElement)(
21680          (0, import_i18n31.sprintf)(
21681            /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is not: Admin". */
21682            (0, import_i18n31.__)("<Name>%1$s is not: </Name><Value>%2$s</Value>"),
21683            filter.name,
21684            activeElements[0].label
21685          ),
21686          filterTextWrappers
21687        ),
21688        filter(item, field, filterValue) {
21689          return filterValue !== field.getValue({ item });
21690        },
21691        selection: "single"
21692      },
21693      {
21694        name: OPERATOR_LESS_THAN,
21695        /* translators: DataViews operator name */
21696        label: (0, import_i18n31.__)("Less than"),
21697        filterText: (filter, activeElements) => (0, import_element46.createInterpolateElement)(
21698          (0, import_i18n31.sprintf)(
21699            /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is less than: 10". */
21700            (0, import_i18n31.__)("<Name>%1$s is less than: </Name><Value>%2$s</Value>"),
21701            filter.name,
21702            activeElements[0].label
21703          ),
21704          filterTextWrappers
21705        ),
21706        filter(item, field, filterValue) {
21707          if (filterValue === void 0) {
21708            return true;
21709          }
21710          const fieldValue = field.getValue({ item });
21711          return fieldValue < filterValue;
21712        },
21713        selection: "single"
21714      },
21715      {
21716        name: OPERATOR_GREATER_THAN,
21717        /* translators: DataViews operator name */
21718        label: (0, import_i18n31.__)("Greater than"),
21719        filterText: (filter, activeElements) => (0, import_element46.createInterpolateElement)(
21720          (0, import_i18n31.sprintf)(
21721            /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is greater than: 10". */
21722            (0, import_i18n31.__)(
21723              "<Name>%1$s is greater than: </Name><Value>%2$s</Value>"
21724            ),
21725            filter.name,
21726            activeElements[0].label
21727          ),
21728          filterTextWrappers
21729        ),
21730        filter(item, field, filterValue) {
21731          if (filterValue === void 0) {
21732            return true;
21733          }
21734          const fieldValue = field.getValue({ item });
21735          return fieldValue > filterValue;
21736        },
21737        selection: "single"
21738      },
21739      {
21740        name: OPERATOR_LESS_THAN_OR_EQUAL,
21741        /* translators: DataViews operator name */
21742        label: (0, import_i18n31.__)("Less than or equal"),
21743        filterText: (filter, activeElements) => (0, import_element46.createInterpolateElement)(
21744          (0, import_i18n31.sprintf)(
21745            /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is less than or equal to: 10". */
21746            (0, import_i18n31.__)(
21747              "<Name>%1$s is less than or equal to: </Name><Value>%2$s</Value>"
21748            ),
21749            filter.name,
21750            activeElements[0].label
21751          ),
21752          filterTextWrappers
21753        ),
21754        filter(item, field, filterValue) {
21755          if (filterValue === void 0) {
21756            return true;
21757          }
21758          const fieldValue = field.getValue({ item });
21759          return fieldValue <= filterValue;
21760        },
21761        selection: "single"
21762      },
21763      {
21764        name: OPERATOR_GREATER_THAN_OR_EQUAL,
21765        /* translators: DataViews operator name */
21766        label: (0, import_i18n31.__)("Greater than or equal"),
21767        filterText: (filter, activeElements) => (0, import_element46.createInterpolateElement)(
21768          (0, import_i18n31.sprintf)(
21769            /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is greater than or equal to: 10". */
21770            (0, import_i18n31.__)(
21771              "<Name>%1$s is greater than or equal to: </Name><Value>%2$s</Value>"
21772            ),
21773            filter.name,
21774            activeElements[0].label
21775          ),
21776          filterTextWrappers
21777        ),
21778        filter(item, field, filterValue) {
21779          if (filterValue === void 0) {
21780            return true;
21781          }
21782          const fieldValue = field.getValue({ item });
21783          return fieldValue >= filterValue;
21784        },
21785        selection: "single"
21786      },
21787      {
21788        name: OPERATOR_BEFORE,
21789        /* translators: DataViews operator name */
21790        label: (0, import_i18n31.__)("Before"),
21791        filterText: (filter, activeElements) => (0, import_element46.createInterpolateElement)(
21792          (0, import_i18n31.sprintf)(
21793            /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is before: 2024-01-01". */
21794            (0, import_i18n31.__)("<Name>%1$s is before: </Name><Value>%2$s</Value>"),
21795            filter.name,
21796            activeElements[0].label
21797          ),
21798          filterTextWrappers
21799        ),
21800        filter(item, field, filterValue) {
21801          if (filterValue === void 0) {
21802            return true;
21803          }
21804          const filterDate = (0, import_date.getDate)(filterValue);
21805          const fieldDate = (0, import_date.getDate)(field.getValue({ item }));
21806          return fieldDate < filterDate;
21807        },
21808        selection: "single"
21809      },
21810      {
21811        name: OPERATOR_AFTER,
21812        /* translators: DataViews operator name */
21813        label: (0, import_i18n31.__)("After"),
21814        filterText: (filter, activeElements) => (0, import_element46.createInterpolateElement)(
21815          (0, import_i18n31.sprintf)(
21816            /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is after: 2024-01-01". */
21817            (0, import_i18n31.__)("<Name>%1$s is after: </Name><Value>%2$s</Value>"),
21818            filter.name,
21819            activeElements[0].label
21820          ),
21821          filterTextWrappers
21822        ),
21823        filter(item, field, filterValue) {
21824          if (filterValue === void 0) {
21825            return true;
21826          }
21827          const filterDate = (0, import_date.getDate)(filterValue);
21828          const fieldDate = (0, import_date.getDate)(field.getValue({ item }));
21829          return fieldDate > filterDate;
21830        },
21831        selection: "single"
21832      },
21833      {
21834        name: OPERATOR_BEFORE_INC,
21835        /* translators: DataViews operator name */
21836        label: (0, import_i18n31.__)("Before (inc)"),
21837        filterText: (filter, activeElements) => (0, import_element46.createInterpolateElement)(
21838          (0, import_i18n31.sprintf)(
21839            /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is on or before: 2024-01-01". */
21840            (0, import_i18n31.__)(
21841              "<Name>%1$s is on or before: </Name><Value>%2$s</Value>"
21842            ),
21843            filter.name,
21844            activeElements[0].label
21845          ),
21846          filterTextWrappers
21847        ),
21848        filter(item, field, filterValue) {
21849          if (filterValue === void 0) {
21850            return true;
21851          }
21852          const filterDate = (0, import_date.getDate)(filterValue);
21853          const fieldDate = (0, import_date.getDate)(field.getValue({ item }));
21854          return fieldDate <= filterDate;
21855        },
21856        selection: "single"
21857      },
21858      {
21859        name: OPERATOR_AFTER_INC,
21860        /* translators: DataViews operator name */
21861        label: (0, import_i18n31.__)("After (inc)"),
21862        filterText: (filter, activeElements) => (0, import_element46.createInterpolateElement)(
21863          (0, import_i18n31.sprintf)(
21864            /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is on or after: 2024-01-01". */
21865            (0, import_i18n31.__)(
21866              "<Name>%1$s is on or after: </Name><Value>%2$s</Value>"
21867            ),
21868            filter.name,
21869            activeElements[0].label
21870          ),
21871          filterTextWrappers
21872        ),
21873        filter(item, field, filterValue) {
21874          if (filterValue === void 0) {
21875            return true;
21876          }
21877          const filterDate = (0, import_date.getDate)(filterValue);
21878          const fieldDate = (0, import_date.getDate)(field.getValue({ item }));
21879          return fieldDate >= filterDate;
21880        },
21881        selection: "single"
21882      },
21883      {
21884        name: OPERATOR_CONTAINS,
21885        /* translators: DataViews operator name */
21886        label: (0, import_i18n31.__)("Contains"),
21887        filterText: (filter, activeElements) => (0, import_element46.createInterpolateElement)(
21888          (0, import_i18n31.sprintf)(
21889            /* translators: 1: Filter name (e.g. "Title"). 2: Filter value (e.g. "Hello"): "Title contains: Hello". */
21890            (0, import_i18n31.__)("<Name>%1$s contains: </Name><Value>%2$s</Value>"),
21891            filter.name,
21892            activeElements[0].label
21893          ),
21894          filterTextWrappers
21895        ),
21896        filter(item, field, filterValue) {
21897          if (filterValue === void 0) {
21898            return true;
21899          }
21900          const fieldValue = field.getValue({ item });
21901          return typeof fieldValue === "string" && filterValue && fieldValue.toLowerCase().includes(String(filterValue).toLowerCase());
21902        },
21903        selection: "single"
21904      },
21905      {
21906        name: OPERATOR_NOT_CONTAINS,
21907        /* translators: DataViews operator name */
21908        label: (0, import_i18n31.__)("Doesn't contain"),
21909        filterText: (filter, activeElements) => (0, import_element46.createInterpolateElement)(
21910          (0, import_i18n31.sprintf)(
21911            /* translators: 1: Filter name (e.g. "Title"). 2: Filter value (e.g. "Hello"): "Title doesn't contain: Hello". */
21912            (0, import_i18n31.__)(
21913              "<Name>%1$s doesn't contain: </Name><Value>%2$s</Value>"
21914            ),
21915            filter.name,
21916            activeElements[0].label
21917          ),
21918          filterTextWrappers
21919        ),
21920        filter(item, field, filterValue) {
21921          if (filterValue === void 0) {
21922            return true;
21923          }
21924          const fieldValue = field.getValue({ item });
21925          return typeof fieldValue === "string" && filterValue && !fieldValue.toLowerCase().includes(String(filterValue).toLowerCase());
21926        },
21927        selection: "single"
21928      },
21929      {
21930        name: OPERATOR_STARTS_WITH,
21931        /* translators: DataViews operator name */
21932        label: (0, import_i18n31.__)("Starts with"),
21933        filterText: (filter, activeElements) => (0, import_element46.createInterpolateElement)(
21934          (0, import_i18n31.sprintf)(
21935            /* translators: 1: Filter name (e.g. "Title"). 2: Filter value (e.g. "Hello"): "Title starts with: Hello". */
21936            (0, import_i18n31.__)("<Name>%1$s starts with: </Name><Value>%2$s</Value>"),
21937            filter.name,
21938            activeElements[0].label
21939          ),
21940          filterTextWrappers
21941        ),
21942        filter(item, field, filterValue) {
21943          if (filterValue === void 0) {
21944            return true;
21945          }
21946          const fieldValue = field.getValue({ item });
21947          return typeof fieldValue === "string" && filterValue && fieldValue.toLowerCase().startsWith(String(filterValue).toLowerCase());
21948        },
21949        selection: "single"
21950      },
21951      {
21952        name: OPERATOR_ON,
21953        /* translators: DataViews operator name */
21954        label: (0, import_i18n31.__)("On"),
21955        filterText: (filter, activeElements) => (0, import_element46.createInterpolateElement)(
21956          (0, import_i18n31.sprintf)(
21957            /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is: 2024-01-01". */
21958            (0, import_i18n31.__)("<Name>%1$s is: </Name><Value>%2$s</Value>"),
21959            filter.name,
21960            activeElements[0].label
21961          ),
21962          filterTextWrappers
21963        ),
21964        filter(item, field, filterValue) {
21965          if (filterValue === void 0) {
21966            return true;
21967          }
21968          const filterDate = (0, import_date.getDate)(filterValue);
21969          const fieldDate = (0, import_date.getDate)(field.getValue({ item }));
21970          return filterDate.getTime() === fieldDate.getTime();
21971        },
21972        selection: "single"
21973      },
21974      {
21975        name: OPERATOR_NOT_ON,
21976        /* translators: DataViews operator name */
21977        label: (0, import_i18n31.__)("Not on"),
21978        filterText: (filter, activeElements) => (0, import_element46.createInterpolateElement)(
21979          (0, import_i18n31.sprintf)(
21980            /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is not: 2024-01-01". */
21981            (0, import_i18n31.__)("<Name>%1$s is not: </Name><Value>%2$s</Value>"),
21982            filter.name,
21983            activeElements[0].label
21984          ),
21985          filterTextWrappers
21986        ),
21987        filter(item, field, filterValue) {
21988          if (filterValue === void 0) {
21989            return true;
21990          }
21991          const filterDate = (0, import_date.getDate)(filterValue);
21992          const fieldDate = (0, import_date.getDate)(field.getValue({ item }));
21993          return filterDate.getTime() !== fieldDate.getTime();
21994        },
21995        selection: "single"
21996      }
21997    ];
21998    var getOperatorByName = (name) => OPERATORS.find((op) => op.name === name);
21999    var getAllOperatorNames = () => OPERATORS.map((op) => op.name);
22000    var isSingleSelectionOperator = (name) => OPERATORS.filter((op) => op.selection === "single").some(
22001      (op) => op.name === name
22002    );
22003    var isRegisteredOperator = (name) => OPERATORS.some((op) => op.name === name);
22004  
22005    // packages/dataviews/build-module/components/dataviews-filters/filter.mjs
22006    var import_jsx_runtime83 = __toESM(require_jsx_runtime(), 1);
22007    var ENTER = "Enter";
22008    var SPACE = " ";
22009    var FilterText = ({
22010      activeElements,
22011      filterInView,
22012      filter
22013    }) => {
22014      if (activeElements === void 0 || activeElements.length === 0) {
22015        return filter.name;
22016      }
22017      const operator = getOperatorByName(filterInView?.operator);
22018      if (operator !== void 0) {
22019        return operator.filterText(filter, activeElements);
22020      }
22021      return (0, import_i18n32.sprintf)(
22022        /* translators: 1: Filter name e.g.: "Unknown status for Author". */
22023        (0, import_i18n32.__)("Unknown status for %1$s"),
22024        filter.name
22025      );
22026    };
22027    function OperatorSelector({
22028      filter,
22029      view,
22030      onChangeView
22031    }) {
22032      const operatorOptions = filter.operators?.map((operator) => ({
22033        value: operator,
22034        label: getOperatorByName(operator)?.label || operator
22035      }));
22036      const currentFilter = view.filters?.find(
22037        (_filter) => _filter.field === filter.field
22038      );
22039      const value = currentFilter?.operator || filter.operators[0];
22040      return operatorOptions.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
22041        Stack,
22042        {
22043          direction: "row",
22044          gap: "sm",
22045          justify: "flex-start",
22046          className: "dataviews-filters__summary-operators-container",
22047          align: "center",
22048          children: [
22049            /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_components21.FlexItem, { className: "dataviews-filters__summary-operators-filter-name", children: filter.name }),
22050            /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
22051              import_components21.SelectControl,
22052              {
22053                className: "dataviews-filters__summary-operators-filter-select",
22054                label: (0, import_i18n32.__)("Conditions"),
22055                value,
22056                options: operatorOptions,
22057                onChange: (newValue) => {
22058                  const newOperator = newValue;
22059                  const currentOperator = currentFilter?.operator;
22060                  const newFilters = currentFilter ? [
22061                    ...(view.filters ?? []).map(
22062                      (_filter) => {
22063                        if (_filter.field === filter.field) {
22064                          const currentOpSelectionModel = getOperatorByName(
22065                            currentOperator
22066                          )?.selection;
22067                          const newOpSelectionModel = getOperatorByName(
22068                            newOperator
22069                          )?.selection;
22070                          const shouldResetValue = currentOpSelectionModel !== newOpSelectionModel || [
22071                            currentOpSelectionModel,
22072                            newOpSelectionModel
22073                          ].includes("custom");
22074                          return {
22075                            ..._filter,
22076                            value: shouldResetValue ? void 0 : _filter.value,
22077                            operator: newOperator
22078                          };
22079                        }
22080                        return _filter;
22081                      }
22082                    )
22083                  ] : [
22084                    ...view.filters ?? [],
22085                    {
22086                      field: filter.field,
22087                      operator: newOperator,
22088                      value: void 0
22089                    }
22090                  ];
22091                  onChangeView({
22092                    ...view,
22093                    page: 1,
22094                    filters: newFilters
22095                  });
22096                },
22097                size: "small",
22098                variant: "minimal",
22099                hideLabelFromVision: true
22100              }
22101            )
22102          ]
22103        }
22104      );
22105    }
22106    function Filter({
22107      addFilterRef,
22108      openedFilter,
22109      fields,
22110      ...commonProps
22111    }) {
22112      const toggleRef = (0, import_element47.useRef)(null);
22113      const { filter, view, onChangeView } = commonProps;
22114      const filterInView = view.filters?.find(
22115        (f2) => f2.field === filter.field
22116      );
22117      let activeElements = [];
22118      const field = (0, import_element47.useMemo)(() => {
22119        const currentField = fields.find((f2) => f2.id === filter.field);
22120        if (currentField) {
22121          return {
22122            ...currentField,
22123            // Configure getValue as if Item was a plain object.
22124            // See related input-widget.tsx
22125            getValue: ({ item }) => item[currentField.id]
22126          };
22127        }
22128        return currentField;
22129      }, [fields, filter.field]);
22130      const { elements } = useElements({
22131        elements: filter.elements,
22132        getElements: filter.getElements
22133      });
22134      if (elements.length > 0) {
22135        activeElements = elements.filter((element) => {
22136          if (filter.singleSelection) {
22137            return element.value === filterInView?.value;
22138          }
22139          return filterInView?.value?.includes(element.value);
22140        });
22141      } else if (Array.isArray(filterInView?.value)) {
22142        const label = filterInView.value.map((v2) => {
22143          const formattedValue = field?.getValueFormatted({
22144            item: { [field.id]: v2 },
22145            field
22146          });
22147          return formattedValue || String(v2);
22148        });
22149        activeElements = [
22150          {
22151            value: filterInView.value,
22152            // @ts-ignore
22153            label
22154          }
22155        ];
22156      } else if (typeof filterInView?.value === "object") {
22157        activeElements = [
22158          { value: filterInView.value, label: filterInView.value }
22159        ];
22160      } else if (filterInView?.value !== void 0) {
22161        const label = field !== void 0 ? field.getValueFormatted({
22162          item: { [field.id]: filterInView.value },
22163          field
22164        }) : String(filterInView.value);
22165        activeElements = [
22166          {
22167            value: filterInView.value,
22168            label
22169          }
22170        ];
22171      }
22172      const isPrimary = filter.isPrimary;
22173      const isLocked = filterInView?.isLocked;
22174      const hasValues = !isLocked && filterInView?.value !== void 0;
22175      const canResetOrRemove = !isLocked && (!isPrimary || hasValues);
22176      const resetOrRemoveLabel = isPrimary ? (0, import_i18n32.__)("Reset") : (0, import_i18n32.__)("Remove");
22177      return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
22178        import_components21.Dropdown,
22179        {
22180          defaultOpen: openedFilter === filter.field,
22181          contentClassName: "dataviews-filters__summary-popover",
22182          popoverProps: { placement: "bottom-start", role: "dialog" },
22183          onClose: () => {
22184            toggleRef.current?.focus();
22185          },
22186          renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "dataviews-filters__summary-chip-container", children: [
22187            /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(tooltip_exports.Root, { children: [
22188              /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
22189                tooltip_exports.Trigger,
22190                {
22191                  render: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
22192                    "div",
22193                    {
22194                      className: clsx_default(
22195                        "dataviews-filters__summary-chip",
22196                        {
22197                          "has-reset": canResetOrRemove,
22198                          "has-values": hasValues,
22199                          "is-not-clickable": isLocked
22200                        }
22201                      ),
22202                      role: "button",
22203                      tabIndex: isLocked ? -1 : 0,
22204                      onClick: () => {
22205                        if (!isLocked) {
22206                          onToggle();
22207                        }
22208                      },
22209                      onKeyDown: (event) => {
22210                        if (!isLocked && [ENTER, SPACE].includes(
22211                          event.key
22212                        )) {
22213                          onToggle();
22214                          event.preventDefault();
22215                        }
22216                      },
22217                      "aria-disabled": isLocked,
22218                      "aria-pressed": isOpen,
22219                      "aria-expanded": isOpen,
22220                      ref: toggleRef,
22221                      children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
22222                        FilterText,
22223                        {
22224                          activeElements,
22225                          filterInView,
22226                          filter
22227                        }
22228                      )
22229                    }
22230                  )
22231                }
22232              ),
22233              /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(tooltip_exports.Popup, { children: (0, import_i18n32.sprintf)(
22234                /* translators: 1: Filter name. */
22235                (0, import_i18n32.__)("Filter by: %1$s"),
22236                filter.name.toLowerCase()
22237              ) })
22238            ] }),
22239            canResetOrRemove && /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(tooltip_exports.Root, { children: [
22240              /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
22241                tooltip_exports.Trigger,
22242                {
22243                  render: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
22244                    "button",
22245                    {
22246                      className: clsx_default(
22247                        "dataviews-filters__summary-chip-remove",
22248                        { "has-values": hasValues }
22249                      ),
22250                      "aria-label": resetOrRemoveLabel,
22251                      onClick: () => {
22252                        onChangeView({
22253                          ...view,
22254                          page: 1,
22255                          filters: view.filters?.filter(
22256                            (_filter) => _filter.field !== filter.field
22257                          )
22258                        });
22259                        if (!isPrimary) {
22260                          addFilterRef.current?.focus();
22261                        } else {
22262                          toggleRef.current?.focus();
22263                        }
22264                      },
22265                      children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_components21.Icon, { icon: close_small_default })
22266                    }
22267                  )
22268                }
22269              ),
22270              /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(tooltip_exports.Popup, { children: resetOrRemoveLabel })
22271            ] })
22272          ] }),
22273          renderContent: () => {
22274            return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(Stack, { direction: "column", justify: "flex-start", children: [
22275              /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(OperatorSelector, { ...commonProps }),
22276              commonProps.filter.hasElements ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
22277                SearchWidget,
22278                {
22279                  ...commonProps,
22280                  filter: {
22281                    ...commonProps.filter,
22282                    elements
22283                  }
22284                }
22285              ) : /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(InputWidget, { ...commonProps, fields })
22286            ] });
22287          }
22288        }
22289      );
22290    }
22291  
22292    // packages/dataviews/build-module/components/dataviews-filters/add-filter.mjs
22293    var import_components22 = __toESM(require_components(), 1);
22294    var import_i18n33 = __toESM(require_i18n(), 1);
22295    var import_element48 = __toESM(require_element(), 1);
22296    var import_jsx_runtime84 = __toESM(require_jsx_runtime(), 1);
22297    var { Menu: Menu4 } = unlock2(import_components22.privateApis);
22298    function AddFilterMenu({
22299      filters,
22300      view,
22301      onChangeView,
22302      setOpenedFilter,
22303      triggerProps
22304    }) {
22305      const inactiveFilters = filters.filter((filter) => !filter.isVisible);
22306      return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(Menu4, { children: [
22307        /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Menu4.TriggerButton, { ...triggerProps }),
22308        /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Menu4.Popover, { children: inactiveFilters.map((filter) => {
22309          return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
22310            Menu4.Item,
22311            {
22312              onClick: () => {
22313                setOpenedFilter(filter.field);
22314                onChangeView({
22315                  ...view,
22316                  page: 1,
22317                  filters: [
22318                    ...view.filters || [],
22319                    {
22320                      field: filter.field,
22321                      value: void 0,
22322                      operator: filter.operators[0]
22323                    }
22324                  ]
22325                });
22326              },
22327              children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Menu4.ItemLabel, { children: filter.name })
22328            },
22329            filter.field
22330          );
22331        }) })
22332      ] });
22333    }
22334    function AddFilter({ filters, view, onChangeView, setOpenedFilter }, ref) {
22335      if (!filters.length || filters.every(({ isPrimary }) => isPrimary)) {
22336        return null;
22337      }
22338      const inactiveFilters = filters.filter((filter) => !filter.isVisible);
22339      return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
22340        AddFilterMenu,
22341        {
22342          triggerProps: {
22343            render: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
22344              import_components22.Button,
22345              {
22346                accessibleWhenDisabled: true,
22347                size: "compact",
22348                className: "dataviews-filters-button",
22349                variant: "tertiary",
22350                disabled: !inactiveFilters.length,
22351                ref
22352              }
22353            ),
22354            children: (0, import_i18n33.__)("Add filter")
22355          },
22356          ...{ filters, view, onChangeView, setOpenedFilter }
22357        }
22358      );
22359    }
22360    var add_filter_default = (0, import_element48.forwardRef)(AddFilter);
22361  
22362    // packages/dataviews/build-module/components/dataviews-filters/reset-filters.mjs
22363    var import_components23 = __toESM(require_components(), 1);
22364    var import_i18n34 = __toESM(require_i18n(), 1);
22365    var import_jsx_runtime85 = __toESM(require_jsx_runtime(), 1);
22366    function ResetFilter({
22367      filters,
22368      view,
22369      onChangeView
22370    }) {
22371      const isPrimary = (field) => filters.some(
22372        (_filter) => _filter.field === field && _filter.isPrimary
22373      );
22374      const isDisabled = !view.search && !view.filters?.some(
22375        (_filter) => !_filter.isLocked && (_filter.value !== void 0 || !isPrimary(_filter.field))
22376      );
22377      return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
22378        import_components23.Button,
22379        {
22380          disabled: isDisabled,
22381          accessibleWhenDisabled: true,
22382          size: "compact",
22383          variant: "tertiary",
22384          className: "dataviews-filters__reset-button",
22385          onClick: () => {
22386            onChangeView({
22387              ...view,
22388              page: 1,
22389              search: "",
22390              filters: view.filters?.filter((f2) => !!f2.isLocked) || []
22391            });
22392          },
22393          children: (0, import_i18n34.__)("Reset")
22394        }
22395      );
22396    }
22397  
22398    // packages/dataviews/build-module/components/dataviews-filters/use-filters.mjs
22399    var import_element49 = __toESM(require_element(), 1);
22400    function useFilters(fields, view) {
22401      return (0, import_element49.useMemo)(() => {
22402        const filters = [];
22403        fields.forEach((field) => {
22404          if (field.filterBy === false || !field.hasElements && !field.Edit) {
22405            return;
22406          }
22407          const operators = field.filterBy.operators;
22408          const isPrimary = !!field.filterBy?.isPrimary;
22409          const isLocked = view.filters?.some(
22410            (f2) => f2.field === field.id && !!f2.isLocked
22411          ) ?? false;
22412          filters.push({
22413            field: field.id,
22414            name: field.label,
22415            elements: field.elements,
22416            getElements: field.getElements,
22417            hasElements: field.hasElements,
22418            singleSelection: operators.some(
22419              (op) => isSingleSelectionOperator(op)
22420            ),
22421            operators,
22422            isVisible: isLocked || isPrimary || !!view.filters?.some(
22423              (f2) => f2.field === field.id && isRegisteredOperator(f2.operator)
22424            ),
22425            isPrimary,
22426            isLocked
22427          });
22428        });
22429        filters.sort((a2, b2) => {
22430          if (a2.isLocked && !b2.isLocked) {
22431            return -1;
22432          }
22433          if (!a2.isLocked && b2.isLocked) {
22434            return 1;
22435          }
22436          if (a2.isPrimary && !b2.isPrimary) {
22437            return -1;
22438          }
22439          if (!a2.isPrimary && b2.isPrimary) {
22440            return 1;
22441          }
22442          return a2.name.localeCompare(b2.name);
22443        });
22444        return filters;
22445      }, [fields, view]);
22446    }
22447    var use_filters_default = useFilters;
22448  
22449    // packages/dataviews/build-module/components/dataviews-filters/filters.mjs
22450    var import_jsx_runtime86 = __toESM(require_jsx_runtime(), 1);
22451    function Filters({ className }) {
22452      const { fields, view, onChangeView, openedFilter, setOpenedFilter } = (0, import_element50.useContext)(dataviews_context_default);
22453      const addFilterRef = (0, import_element50.useRef)(null);
22454      const filters = use_filters_default(fields, view);
22455      const addFilter = /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
22456        add_filter_default,
22457        {
22458          filters,
22459          view,
22460          onChangeView,
22461          ref: addFilterRef,
22462          setOpenedFilter
22463        },
22464        "add-filter"
22465      );
22466      const visibleFilters = filters.filter((filter) => filter.isVisible);
22467      if (visibleFilters.length === 0) {
22468        return null;
22469      }
22470      const filterComponents = [
22471        ...visibleFilters.map((filter) => {
22472          return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
22473            Filter,
22474            {
22475              filter,
22476              view,
22477              fields,
22478              onChangeView,
22479              addFilterRef,
22480              openedFilter
22481            },
22482            filter.field
22483          );
22484        }),
22485        addFilter
22486      ];
22487      filterComponents.push(
22488        /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
22489          ResetFilter,
22490          {
22491            filters,
22492            view,
22493            onChangeView
22494          },
22495          "reset-filters"
22496        )
22497      );
22498      return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
22499        Stack,
22500        {
22501          direction: "row",
22502          justify: "flex-start",
22503          gap: "sm",
22504          style: { width: "fit-content" },
22505          wrap: "wrap",
22506          className,
22507          children: filterComponents
22508        }
22509      );
22510    }
22511    var filters_default = (0, import_element50.memo)(Filters);
22512  
22513    // packages/dataviews/build-module/components/dataviews-filters/toggle.mjs
22514    var import_element51 = __toESM(require_element(), 1);
22515    var import_components24 = __toESM(require_components(), 1);
22516    var import_i18n35 = __toESM(require_i18n(), 1);
22517    var import_jsx_runtime87 = __toESM(require_jsx_runtime(), 1);
22518    function FiltersToggle() {
22519      const {
22520        filters,
22521        view,
22522        onChangeView,
22523        setOpenedFilter,
22524        isShowingFilter,
22525        setIsShowingFilter
22526      } = (0, import_element51.useContext)(dataviews_context_default);
22527      const buttonRef = (0, import_element51.useRef)(null);
22528      const onChangeViewWithFilterVisibility = (0, import_element51.useCallback)(
22529        (_view) => {
22530          onChangeView(_view);
22531          setIsShowingFilter(true);
22532        },
22533        [onChangeView, setIsShowingFilter]
22534      );
22535      if (filters.length === 0) {
22536        return null;
22537      }
22538      const hasVisibleFilters = filters.some((filter) => filter.isVisible);
22539      const addFilterButtonProps = {
22540        label: (0, import_i18n35.__)("Add filter"),
22541        "aria-expanded": false,
22542        isPressed: false
22543      };
22544      const toggleFiltersButtonProps = {
22545        label: (0, import_i18n35._x)("Filter", "verb"),
22546        "aria-expanded": isShowingFilter,
22547        isPressed: isShowingFilter,
22548        onClick: () => {
22549          if (!isShowingFilter) {
22550            setOpenedFilter(null);
22551          }
22552          setIsShowingFilter(!isShowingFilter);
22553        }
22554      };
22555      const hasPrimaryOrLockedFilters = filters.some(
22556        (filter) => filter.isPrimary || filter.isLocked
22557      );
22558      const buttonComponent = /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
22559        import_components24.Button,
22560        {
22561          ref: buttonRef,
22562          className: "dataviews-filters__visibility-toggle",
22563          size: "compact",
22564          icon: funnel_default,
22565          disabled: hasPrimaryOrLockedFilters,
22566          accessibleWhenDisabled: true,
22567          ...hasVisibleFilters ? toggleFiltersButtonProps : addFilterButtonProps
22568        }
22569      );
22570      return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "dataviews-filters__container-visibility-toggle", children: !hasVisibleFilters ? /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
22571        AddFilterMenu,
22572        {
22573          filters,
22574          view,
22575          onChangeView: onChangeViewWithFilterVisibility,
22576          setOpenedFilter,
22577          triggerProps: { render: buttonComponent }
22578        }
22579      ) : /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
22580        FilterVisibilityToggle,
22581        {
22582          buttonRef,
22583          filtersCount: view.filters?.length,
22584          children: buttonComponent
22585        }
22586      ) });
22587    }
22588    function FilterVisibilityToggle({
22589      buttonRef,
22590      filtersCount,
22591      children
22592    }) {
22593      (0, import_element51.useEffect)(
22594        () => () => {
22595          buttonRef.current?.focus();
22596        },
22597        [buttonRef]
22598      );
22599      return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_jsx_runtime87.Fragment, { children: [
22600        children,
22601        !!filtersCount && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "dataviews-filters-toggle__count", children: filtersCount })
22602      ] });
22603    }
22604    var toggle_default = FiltersToggle;
22605  
22606    // packages/dataviews/build-module/components/dataviews-filters/filters-toggled.mjs
22607    var import_element52 = __toESM(require_element(), 1);
22608    var import_jsx_runtime88 = __toESM(require_jsx_runtime(), 1);
22609    function FiltersToggled(props) {
22610      const { isShowingFilter } = (0, import_element52.useContext)(dataviews_context_default);
22611      if (!isShowingFilter) {
22612        return null;
22613      }
22614      return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(filters_default, { ...props });
22615    }
22616    var filters_toggled_default = FiltersToggled;
22617  
22618    // packages/dataviews/build-module/components/dataviews-layout/index.mjs
22619    var import_element53 = __toESM(require_element(), 1);
22620    var import_components25 = __toESM(require_components(), 1);
22621    var import_i18n36 = __toESM(require_i18n(), 1);
22622    var import_jsx_runtime89 = __toESM(require_jsx_runtime(), 1);
22623    function DataViewsLayout({ className }) {
22624      const {
22625        actions = [],
22626        data,
22627        fields,
22628        getItemId,
22629        getItemLevel,
22630        hasInitiallyLoaded,
22631        isLoading,
22632        view,
22633        onChangeView,
22634        selection,
22635        onChangeSelection,
22636        setOpenedFilter,
22637        onClickItem,
22638        isItemClickable: isItemClickable2,
22639        renderItemLink,
22640        defaultLayouts: defaultLayouts2,
22641        containerRef,
22642        empty = /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("p", { children: (0, import_i18n36.__)("No results") })
22643      } = (0, import_element53.useContext)(dataviews_context_default);
22644      const isDelayedInitialLoading = useDelayedLoading(!hasInitiallyLoaded, {
22645        delay: 200
22646      });
22647      if (!hasInitiallyLoaded) {
22648        if (!isDelayedInitialLoading) {
22649          return null;
22650        }
22651        return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "dataviews-loading", children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_components25.Spinner, {}) }) });
22652      }
22653      const ViewComponent = VIEW_LAYOUTS.find(
22654        (v2) => v2.type === view.type && defaultLayouts2[v2.type]
22655      )?.component;
22656      return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "dataviews-layout__container", ref: containerRef, children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
22657        ViewComponent,
22658        {
22659          className,
22660          actions,
22661          data,
22662          fields,
22663          getItemId,
22664          getItemLevel,
22665          isLoading,
22666          onChangeView,
22667          onChangeSelection,
22668          selection,
22669          setOpenedFilter,
22670          onClickItem,
22671          renderItemLink,
22672          isItemClickable: isItemClickable2,
22673          view,
22674          empty
22675        }
22676      ) });
22677    }
22678  
22679    // packages/dataviews/build-module/components/dataviews-search/index.mjs
22680    var import_i18n37 = __toESM(require_i18n(), 1);
22681    var import_element54 = __toESM(require_element(), 1);
22682    var import_components26 = __toESM(require_components(), 1);
22683    var import_compose10 = __toESM(require_compose(), 1);
22684    var import_jsx_runtime90 = __toESM(require_jsx_runtime(), 1);
22685    var DataViewsSearch = (0, import_element54.memo)(function Search({ label }) {
22686      const { view, onChangeView } = (0, import_element54.useContext)(dataviews_context_default);
22687      const [search, setSearch, debouncedSearch] = (0, import_compose10.useDebouncedInput)(
22688        view.search
22689      );
22690      (0, import_element54.useEffect)(() => {
22691        if (view.search !== debouncedSearch) {
22692          setSearch(view.search ?? "");
22693        }
22694      }, [view.search, setSearch]);
22695      const onChangeViewRef = (0, import_element54.useRef)(onChangeView);
22696      const viewRef = (0, import_element54.useRef)(view);
22697      (0, import_element54.useEffect)(() => {
22698        onChangeViewRef.current = onChangeView;
22699        viewRef.current = view;
22700      }, [onChangeView, view]);
22701      (0, import_element54.useEffect)(() => {
22702        if (debouncedSearch !== viewRef.current?.search) {
22703          onChangeViewRef.current({
22704            ...viewRef.current,
22705            page: view.page ? 1 : void 0,
22706            startPosition: view.startPosition ? 1 : void 0,
22707            search: debouncedSearch
22708          });
22709        }
22710      }, [debouncedSearch]);
22711      const searchLabel = label || (0, import_i18n37.__)("Search");
22712      return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
22713        import_components26.SearchControl,
22714        {
22715          className: "dataviews-search",
22716          onChange: setSearch,
22717          value: search,
22718          label: searchLabel,
22719          placeholder: searchLabel,
22720          size: "compact"
22721        }
22722      );
22723    });
22724    var dataviews_search_default = DataViewsSearch;
22725  
22726    // packages/dataviews/build-module/components/dataviews-view-config/index.mjs
22727    var import_components27 = __toESM(require_components(), 1);
22728    var import_i18n38 = __toESM(require_i18n(), 1);
22729    var import_element55 = __toESM(require_element(), 1);
22730    var import_warning = __toESM(require_warning(), 1);
22731    var import_compose11 = __toESM(require_compose(), 1);
22732    var import_jsx_runtime91 = __toESM(require_jsx_runtime(), 1);
22733    var { Menu: Menu5 } = unlock2(import_components27.privateApis);
22734    var DATAVIEWS_CONFIG_POPOVER_PROPS = {
22735      className: "dataviews-config__popover",
22736      placement: "bottom-end",
22737      offset: 9
22738    };
22739    function ViewTypeMenu() {
22740      const { view, onChangeView, defaultLayouts: defaultLayouts2 } = (0, import_element55.useContext)(dataviews_context_default);
22741      const availableLayouts = Object.keys(defaultLayouts2);
22742      if (availableLayouts.length <= 1) {
22743        return null;
22744      }
22745      const activeView = VIEW_LAYOUTS.find((v2) => view.type === v2.type);
22746      return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(Menu5, { children: [
22747        /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
22748          Menu5.TriggerButton,
22749          {
22750            render: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
22751              import_components27.Button,
22752              {
22753                size: "compact",
22754                icon: activeView?.icon,
22755                label: (0, import_i18n38.__)("Layout")
22756              }
22757            )
22758          }
22759        ),
22760        /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Menu5.Popover, { children: availableLayouts.map((layout) => {
22761          const config = VIEW_LAYOUTS.find(
22762            (v2) => v2.type === layout
22763          );
22764          if (!config) {
22765            return null;
22766          }
22767          return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
22768            Menu5.RadioItem,
22769            {
22770              value: layout,
22771              name: "view-actions-available-view",
22772              checked: layout === view.type,
22773              hideOnClick: true,
22774              onChange: (e2) => {
22775                switch (e2.target.value) {
22776                  case "list":
22777                  case "grid":
22778                  case "table":
22779                  case "pickerGrid":
22780                  case "pickerTable":
22781                  case "pickerActivity":
22782                  case "activity":
22783                    const viewWithoutLayout = { ...view };
22784                    if ("layout" in viewWithoutLayout) {
22785                      delete viewWithoutLayout.layout;
22786                    }
22787                    return onChangeView({
22788                      ...viewWithoutLayout,
22789                      type: e2.target.value,
22790                      ...defaultLayouts2[e2.target.value]
22791                    });
22792                }
22793                (0, import_warning.default)("Invalid dataview");
22794              },
22795              children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Menu5.ItemLabel, { children: config.label })
22796            },
22797            layout
22798          );
22799        }) })
22800      ] });
22801    }
22802    function SortFieldControl() {
22803      const { view, fields, onChangeView } = (0, import_element55.useContext)(dataviews_context_default);
22804      const orderOptions = (0, import_element55.useMemo)(() => {
22805        const sortableFields = fields.filter(
22806          (field) => field.enableSorting !== false
22807        );
22808        return sortableFields.map((field) => {
22809          return {
22810            label: field.label,
22811            value: field.id
22812          };
22813        });
22814      }, [fields]);
22815      return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
22816        import_components27.SelectControl,
22817        {
22818          label: (0, import_i18n38.__)("Sort by"),
22819          value: view.sort?.field,
22820          options: orderOptions,
22821          onChange: (value) => {
22822            onChangeView({
22823              ...view,
22824              sort: {
22825                direction: view?.sort?.direction || "desc",
22826                field: value
22827              },
22828              showLevels: false
22829            });
22830          }
22831        }
22832      );
22833    }
22834    function SortDirectionControl() {
22835      const { view, fields, onChangeView } = (0, import_element55.useContext)(dataviews_context_default);
22836      const sortableFields = fields.filter(
22837        (field) => field.enableSorting !== false
22838      );
22839      if (sortableFields.length === 0) {
22840        return null;
22841      }
22842      let value = view.sort?.direction;
22843      if (!value && view.sort?.field) {
22844        value = "desc";
22845      }
22846      return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
22847        import_components27.__experimentalToggleGroupControl,
22848        {
22849          className: "dataviews-view-config__sort-direction",
22850          isBlock: true,
22851          label: (0, import_i18n38.__)("Order"),
22852          value,
22853          onChange: (newDirection) => {
22854            if (newDirection === "asc" || newDirection === "desc") {
22855              onChangeView({
22856                ...view,
22857                sort: {
22858                  direction: newDirection,
22859                  field: view.sort?.field || // If there is no field assigned as the sorting field assign the first sortable field.
22860                  fields.find(
22861                    (field) => field.enableSorting !== false
22862                  )?.id || ""
22863                },
22864                showLevels: false
22865              });
22866              return;
22867            }
22868            (0, import_warning.default)("Invalid direction");
22869          },
22870          children: SORTING_DIRECTIONS.map((direction) => {
22871            return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
22872              import_components27.__experimentalToggleGroupControlOptionIcon,
22873              {
22874                value: direction,
22875                icon: sortIcons[direction],
22876                label: sortLabels[direction]
22877              },
22878              direction
22879            );
22880          })
22881        }
22882      );
22883    }
22884    function ItemsPerPageControl() {
22885      const { view, config, onChangeView } = (0, import_element55.useContext)(dataviews_context_default);
22886      const { infiniteScrollEnabled } = view;
22887      if (!config || !config.perPageSizes || config.perPageSizes.length < 2 || config.perPageSizes.length > 6 || infiniteScrollEnabled) {
22888        return null;
22889      }
22890      return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
22891        import_components27.__experimentalToggleGroupControl,
22892        {
22893          isBlock: true,
22894          label: (0, import_i18n38.__)("Items per page"),
22895          value: view.perPage || 10,
22896          disabled: !view?.sort?.field,
22897          onChange: (newItemsPerPage) => {
22898            const newItemsPerPageNumber = typeof newItemsPerPage === "number" || newItemsPerPage === void 0 ? newItemsPerPage : parseInt(newItemsPerPage, 10);
22899            onChangeView({
22900              ...view,
22901              perPage: newItemsPerPageNumber,
22902              page: 1
22903            });
22904          },
22905          children: config.perPageSizes.map((value) => {
22906            return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
22907              import_components27.__experimentalToggleGroupControlOption,
22908              {
22909                value,
22910                label: value.toString()
22911              },
22912              value
22913            );
22914          })
22915        }
22916      );
22917    }
22918    function ResetViewButton() {
22919      const { onReset } = (0, import_element55.useContext)(dataviews_context_default);
22920      if (onReset === void 0) {
22921        return null;
22922      }
22923      const isDisabled = onReset === false;
22924      return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
22925        import_components27.Button,
22926        {
22927          variant: "tertiary",
22928          size: "compact",
22929          disabled: isDisabled,
22930          accessibleWhenDisabled: true,
22931          className: "dataviews-view-config__reset-button",
22932          onClick: () => {
22933            if (typeof onReset === "function") {
22934              onReset();
22935            }
22936          },
22937          children: (0, import_i18n38.__)("Reset view")
22938        }
22939      );
22940    }
22941    function DataviewsViewConfigDropdown() {
22942      const { view, onReset } = (0, import_element55.useContext)(dataviews_context_default);
22943      const popoverId = (0, import_compose11.useInstanceId)(
22944        _DataViewsViewConfig,
22945        "dataviews-view-config-dropdown"
22946      );
22947      const activeLayout = VIEW_LAYOUTS.find(
22948        (layout) => layout.type === view.type
22949      );
22950      const isModified = typeof onReset === "function";
22951      return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
22952        import_components27.Dropdown,
22953        {
22954          expandOnMobile: true,
22955          popoverProps: {
22956            ...DATAVIEWS_CONFIG_POPOVER_PROPS,
22957            id: popoverId
22958          },
22959          renderToggle: ({ onToggle, isOpen }) => {
22960            return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: "dataviews-view-config__toggle-wrapper", children: [
22961              /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
22962                import_components27.Button,
22963                {
22964                  size: "compact",
22965                  icon: cog_default,
22966                  label: (0, import_i18n38._x)(
22967                    "View options",
22968                    "View is used as a noun"
22969                  ),
22970                  onClick: onToggle,
22971                  "aria-expanded": isOpen ? "true" : "false",
22972                  "aria-controls": popoverId
22973                }
22974              ),
22975              isModified && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "dataviews-view-config__modified-indicator" })
22976            ] });
22977          },
22978          renderContent: () => /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
22979            import_components27.__experimentalDropdownContentWrapper,
22980            {
22981              paddingSize: "medium",
22982              className: "dataviews-config__popover-content-wrapper",
22983              children: /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
22984                Stack,
22985                {
22986                  direction: "column",
22987                  className: "dataviews-view-config",
22988                  gap: "xl",
22989                  children: [
22990                    /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
22991                      Stack,
22992                      {
22993                        direction: "row",
22994                        justify: "space-between",
22995                        align: "center",
22996                        className: "dataviews-view-config__header",
22997                        children: [
22998                          /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
22999                            import_components27.__experimentalHeading,
23000                            {
23001                              level: 2,
23002                              className: "dataviews-settings-section__title",
23003                              children: (0, import_i18n38.__)("Appearance")
23004                            }
23005                          ),
23006                          /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(ResetViewButton, {})
23007                        ]
23008                      }
23009                    ),
23010                    /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(Stack, { direction: "column", gap: "lg", children: [
23011                      /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
23012                        Stack,
23013                        {
23014                          direction: "row",
23015                          gap: "sm",
23016                          className: "dataviews-view-config__sort-controls",
23017                          children: [
23018                            /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(SortFieldControl, {}),
23019                            /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(SortDirectionControl, {})
23020                          ]
23021                        }
23022                      ),
23023                      !!activeLayout?.viewConfigOptions && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(activeLayout.viewConfigOptions, {}),
23024                      /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(ItemsPerPageControl, {}),
23025                      /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(PropertiesSection, {})
23026                    ] })
23027                  ]
23028                }
23029              )
23030            }
23031          )
23032        }
23033      );
23034    }
23035    function _DataViewsViewConfig() {
23036      return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(import_jsx_runtime91.Fragment, { children: [
23037        /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(ViewTypeMenu, {}),
23038        /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(DataviewsViewConfigDropdown, {})
23039      ] });
23040    }
23041    var DataViewsViewConfig = (0, import_element55.memo)(_DataViewsViewConfig);
23042    var dataviews_view_config_default = DataViewsViewConfig;
23043  
23044    // packages/dataviews/build-module/components/dataform-controls/checkbox.mjs
23045    var import_components28 = __toESM(require_components(), 1);
23046    var import_element56 = __toESM(require_element(), 1);
23047  
23048    // packages/dataviews/build-module/components/dataform-controls/utils/get-custom-validity.mjs
23049    function getCustomValidity(isValid2, validity) {
23050      let customValidity;
23051      if (isValid2?.required && validity?.required) {
23052        customValidity = validity?.required?.message ? validity.required : void 0;
23053      } else if (isValid2?.pattern && validity?.pattern) {
23054        customValidity = validity.pattern;
23055      } else if (isValid2?.min && validity?.min) {
23056        customValidity = validity.min;
23057      } else if (isValid2?.max && validity?.max) {
23058        customValidity = validity.max;
23059      } else if (isValid2?.minLength && validity?.minLength) {
23060        customValidity = validity.minLength;
23061      } else if (isValid2?.maxLength && validity?.maxLength) {
23062        customValidity = validity.maxLength;
23063      } else if (isValid2?.elements && validity?.elements) {
23064        customValidity = validity.elements;
23065      } else if (validity?.custom) {
23066        customValidity = validity.custom;
23067      }
23068      return customValidity;
23069    }
23070  
23071    // packages/dataviews/build-module/components/dataform-controls/checkbox.mjs
23072    var import_jsx_runtime92 = __toESM(require_jsx_runtime(), 1);
23073    var { ValidatedCheckboxControl } = unlock2(import_components28.privateApis);
23074    function Checkbox({
23075      field,
23076      onChange,
23077      data,
23078      hideLabelFromVision,
23079      markWhenOptional,
23080      validity
23081    }) {
23082      const { getValue, setValue, label, description, isValid: isValid2 } = field;
23083      const disabled2 = field.isDisabled({ item: data, field });
23084      const onChangeControl = (0, import_element56.useCallback)(() => {
23085        onChange(
23086          setValue({ item: data, value: !getValue({ item: data }) })
23087        );
23088      }, [data, getValue, onChange, setValue]);
23089      return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
23090        ValidatedCheckboxControl,
23091        {
23092          required: !!field.isValid?.required,
23093          markWhenOptional,
23094          customValidity: getCustomValidity(isValid2, validity),
23095          hidden: hideLabelFromVision,
23096          label,
23097          help: description,
23098          checked: getValue({ item: data }),
23099          onChange: onChangeControl,
23100          disabled: disabled2
23101        }
23102      );
23103    }
23104  
23105    // packages/dataviews/build-module/components/dataform-controls/combobox.mjs
23106    var import_components29 = __toESM(require_components(), 1);
23107    var import_element57 = __toESM(require_element(), 1);
23108    var import_jsx_runtime93 = __toESM(require_jsx_runtime(), 1);
23109    var { ValidatedComboboxControl } = unlock2(import_components29.privateApis);
23110    function Combobox3({
23111      data,
23112      field,
23113      onChange,
23114      hideLabelFromVision,
23115      validity
23116    }) {
23117      const { label, description, placeholder, getValue, setValue, isValid: isValid2 } = field;
23118      const value = getValue({ item: data }) ?? "";
23119      const onChangeControl = (0, import_element57.useCallback)(
23120        (newValue) => onChange(setValue({ item: data, value: newValue ?? "" })),
23121        [data, onChange, setValue]
23122      );
23123      const { elements, isLoading } = useElements({
23124        elements: field.elements,
23125        getElements: field.getElements
23126      });
23127      if (isLoading) {
23128        return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_components29.Spinner, {});
23129      }
23130      return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
23131        ValidatedComboboxControl,
23132        {
23133          required: !!field.isValid?.required,
23134          customValidity: getCustomValidity(isValid2, validity),
23135          label,
23136          value,
23137          help: description,
23138          placeholder,
23139          options: elements,
23140          onChange: onChangeControl,
23141          hideLabelFromVision,
23142          allowReset: true,
23143          expandOnFocus: true
23144        }
23145      );
23146    }
23147  
23148    // packages/dataviews/build-module/components/dataform-controls/datetime.mjs
23149    var import_components31 = __toESM(require_components(), 1);
23150    var import_element60 = __toESM(require_element(), 1);
23151    var import_i18n40 = __toESM(require_i18n(), 1);
23152    var import_date3 = __toESM(require_date(), 1);
23153  
23154    // packages/dataviews/build-module/components/dataform-controls/utils/relative-date-control.mjs
23155    var import_components30 = __toESM(require_components(), 1);
23156    var import_element58 = __toESM(require_element(), 1);
23157    var import_i18n39 = __toESM(require_i18n(), 1);
23158    var import_jsx_runtime94 = __toESM(require_jsx_runtime(), 1);
23159    var TIME_UNITS_OPTIONS = {
23160      [OPERATOR_IN_THE_PAST]: [
23161        { value: "days", label: (0, import_i18n39.__)("Days") },
23162        { value: "weeks", label: (0, import_i18n39.__)("Weeks") },
23163        { value: "months", label: (0, import_i18n39.__)("Months") },
23164        { value: "years", label: (0, import_i18n39.__)("Years") }
23165      ],
23166      [OPERATOR_OVER]: [
23167        { value: "days", label: (0, import_i18n39.__)("Days ago") },
23168        { value: "weeks", label: (0, import_i18n39.__)("Weeks ago") },
23169        { value: "months", label: (0, import_i18n39.__)("Months ago") },
23170        { value: "years", label: (0, import_i18n39.__)("Years ago") }
23171      ]
23172    };
23173    function RelativeDateControl({
23174      className,
23175      data,
23176      field,
23177      onChange,
23178      hideLabelFromVision,
23179      operator
23180    }) {
23181      const options = TIME_UNITS_OPTIONS[operator === OPERATOR_IN_THE_PAST ? "inThePast" : "over"];
23182      const { id, label, description, getValue, setValue } = field;
23183      const disabled2 = field.isDisabled({ item: data, field });
23184      const fieldValue = getValue({ item: data });
23185      const { value: relValue = "", unit = options[0].value } = fieldValue && typeof fieldValue === "object" ? fieldValue : {};
23186      const onChangeValue = (0, import_element58.useCallback)(
23187        (newValue) => onChange(
23188          setValue({
23189            item: data,
23190            value: { value: Number(newValue), unit }
23191          })
23192        ),
23193        [onChange, setValue, data, unit]
23194      );
23195      const onChangeUnit = (0, import_element58.useCallback)(
23196        (newUnit) => onChange(
23197          setValue({
23198            item: data,
23199            value: { value: relValue, unit: newUnit }
23200          })
23201        ),
23202        [onChange, setValue, data, relValue]
23203      );
23204      return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
23205        import_components30.BaseControl,
23206        {
23207          id,
23208          className: clsx_default(className, "dataviews-controls__relative-date"),
23209          label,
23210          hideLabelFromVision,
23211          help: description,
23212          children: /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(Stack, { direction: "row", gap: "sm", children: [
23213            /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
23214              import_components30.__experimentalNumberControl,
23215              {
23216                className: "dataviews-controls__relative-date-number",
23217                spinControls: "none",
23218                min: 1,
23219                step: 1,
23220                value: relValue,
23221                onChange: onChangeValue,
23222                disabled: disabled2
23223              }
23224            ),
23225            /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
23226              import_components30.SelectControl,
23227              {
23228                className: "dataviews-controls__relative-date-unit",
23229                label: (0, import_i18n39.__)("Unit"),
23230                value: unit,
23231                options,
23232                onChange: onChangeUnit,
23233                hideLabelFromVision: true,
23234                disabled: disabled2
23235              }
23236            )
23237          ] })
23238        }
23239      );
23240    }
23241  
23242    // packages/dataviews/build-module/components/dataform-controls/utils/use-disabled-date-matchers.mjs
23243    var import_element59 = __toESM(require_element(), 1);
23244    function useDisabledDateMatchers(isValid2, parseDateFn) {
23245      const minConstraint = typeof isValid2.min?.constraint === "string" ? isValid2.min.constraint : void 0;
23246      const maxConstraint = typeof isValid2.max?.constraint === "string" ? isValid2.max.constraint : void 0;
23247      const disabledMatchers = (0, import_element59.useMemo)(() => {
23248        const matchers = [];
23249        if (minConstraint) {
23250          const minDate = parseDateFn(minConstraint);
23251          if (minDate) {
23252            matchers.push({ before: minDate });
23253          }
23254        }
23255        if (maxConstraint) {
23256          const maxDate = parseDateFn(maxConstraint);
23257          if (maxDate) {
23258            matchers.push({ after: maxDate });
23259          }
23260        }
23261        return matchers.length > 0 ? matchers : void 0;
23262      }, [minConstraint, maxConstraint, parseDateFn]);
23263      return { minConstraint, maxConstraint, disabledMatchers };
23264    }
23265  
23266    // packages/dataviews/build-module/field-types/utils/parse-date-time.mjs
23267    var import_date2 = __toESM(require_date(), 1);
23268    function parseDateTime(dateTimeString) {
23269      if (!dateTimeString) {
23270        return null;
23271      }
23272      const parsed = (0, import_date2.getDate)(dateTimeString);
23273      return parsed && isValid(parsed) ? parsed : null;
23274    }
23275  
23276    // packages/dataviews/build-module/components/dataform-controls/datetime.mjs
23277    var import_jsx_runtime95 = __toESM(require_jsx_runtime(), 1);
23278    var { DateCalendar, ValidatedInputControl } = unlock2(import_components31.privateApis);
23279    var formatDateTime = (value) => {
23280      if (!value) {
23281        return "";
23282      }
23283      return (0, import_date3.dateI18n)("Y-m-d\\TH:i", (0, import_date3.getDate)(value));
23284    };
23285    function CalendarDateTimeControl({
23286      data,
23287      field,
23288      onChange,
23289      hideLabelFromVision,
23290      markWhenOptional,
23291      validity,
23292      config
23293    }) {
23294      const { compact } = config || {};
23295      const { id, label, description, setValue, getValue, isValid: isValid2 } = field;
23296      const disabled2 = field.isDisabled({ item: data, field });
23297      const fieldValue = getValue({ item: data });
23298      const value = typeof fieldValue === "string" ? fieldValue : void 0;
23299      const [calendarMonth, setCalendarMonth] = (0, import_element60.useState)(() => {
23300        const parsedDate = parseDateTime(value);
23301        return parsedDate || /* @__PURE__ */ new Date();
23302      });
23303      const inputControlRef = (0, import_element60.useRef)(null);
23304      const validationTimeoutRef = (0, import_element60.useRef)(void 0);
23305      const previousFocusRef = (0, import_element60.useRef)(null);
23306      const { minConstraint, maxConstraint, disabledMatchers } = useDisabledDateMatchers(isValid2, parseDateTime);
23307      const onChangeCallback = (0, import_element60.useCallback)(
23308        (newValue) => onChange(setValue({ item: data, value: newValue })),
23309        [data, onChange, setValue]
23310      );
23311      (0, import_element60.useEffect)(() => {
23312        return () => {
23313          if (validationTimeoutRef.current) {
23314            clearTimeout(validationTimeoutRef.current);
23315          }
23316        };
23317      }, []);
23318      const onSelectDate = (0, import_element60.useCallback)(
23319        (newDate) => {
23320          let dateTimeValue;
23321          if (newDate) {
23322            const wpDate = (0, import_date3.dateI18n)("Y-m-d", newDate);
23323            let wpTime;
23324            if (value) {
23325              wpTime = (0, import_date3.dateI18n)("H:i", (0, import_date3.getDate)(value));
23326            } else {
23327              wpTime = (0, import_date3.dateI18n)("H:i", newDate);
23328            }
23329            const finalDateTime = (0, import_date3.getDate)(`$wpDate}T$wpTime}`);
23330            dateTimeValue = finalDateTime.toISOString();
23331            onChangeCallback(dateTimeValue);
23332            if (validationTimeoutRef.current) {
23333              clearTimeout(validationTimeoutRef.current);
23334            }
23335          } else {
23336            onChangeCallback(void 0);
23337          }
23338          previousFocusRef.current = inputControlRef.current && inputControlRef.current.ownerDocument.activeElement;
23339          validationTimeoutRef.current = setTimeout(() => {
23340            if (inputControlRef.current) {
23341              inputControlRef.current.focus();
23342              inputControlRef.current.blur();
23343              onChangeCallback(dateTimeValue);
23344              if (previousFocusRef.current && previousFocusRef.current instanceof HTMLElement) {
23345                previousFocusRef.current.focus();
23346              }
23347            }
23348          }, 0);
23349        },
23350        [onChangeCallback, value]
23351      );
23352      const handleManualDateTimeChange = (0, import_element60.useCallback)(
23353        (newValue) => {
23354          if (newValue) {
23355            const dateTime = (0, import_date3.getDate)(newValue);
23356            onChangeCallback(dateTime.toISOString());
23357            const parsedDate = parseDateTime(dateTime.toISOString());
23358            if (parsedDate) {
23359              setCalendarMonth(parsedDate);
23360            }
23361          } else {
23362            onChangeCallback(void 0);
23363          }
23364        },
23365        [onChangeCallback]
23366      );
23367      const { format: fieldFormat } = field;
23368      const weekStartsOn = fieldFormat.weekStartsOn ?? (0, import_date3.getSettings)().l10n.startOfWeek;
23369      const {
23370        timezone: { string: timezoneString }
23371      } = (0, import_date3.getSettings)();
23372      let displayLabel = label;
23373      if (isValid2?.required && !markWhenOptional && !hideLabelFromVision) {
23374        displayLabel = `$label} (${(0, import_i18n40.__)("Required")})`;
23375      } else if (!isValid2?.required && markWhenOptional && !hideLabelFromVision) {
23376        displayLabel = `$label} (${(0, import_i18n40.__)("Optional")})`;
23377      }
23378      return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
23379        import_components31.BaseControl,
23380        {
23381          id,
23382          label: displayLabel,
23383          help: description,
23384          hideLabelFromVision,
23385          children: /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(Stack, { direction: "column", gap: "lg", children: [
23386            /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
23387              ValidatedInputControl,
23388              {
23389                ref: inputControlRef,
23390                required: !!isValid2?.required,
23391                customValidity: getCustomValidity(isValid2, validity),
23392                type: "datetime-local",
23393                label: (0, import_i18n40.__)("Date time"),
23394                hideLabelFromVision: true,
23395                value: formatDateTime(value),
23396                onChange: handleManualDateTimeChange,
23397                disabled: disabled2,
23398                min: minConstraint ? formatDateTime(minConstraint) : void 0,
23399                max: maxConstraint ? formatDateTime(maxConstraint) : void 0
23400              }
23401            ),
23402            !compact && /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
23403              DateCalendar,
23404              {
23405                style: { width: "100%" },
23406                selected: value ? parseDateTime(value) || void 0 : void 0,
23407                onSelect: onSelectDate,
23408                month: calendarMonth,
23409                onMonthChange: setCalendarMonth,
23410                timeZone: timezoneString || void 0,
23411                weekStartsOn,
23412                disabled: disabled2 || disabledMatchers
23413              }
23414            )
23415          ] })
23416        }
23417      );
23418    }
23419    function DateTime({
23420      data,
23421      field,
23422      onChange,
23423      hideLabelFromVision,
23424      markWhenOptional,
23425      operator,
23426      validity,
23427      config
23428    }) {
23429      if (operator === OPERATOR_IN_THE_PAST || operator === OPERATOR_OVER) {
23430        return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
23431          RelativeDateControl,
23432          {
23433            className: "dataviews-controls__datetime",
23434            data,
23435            field,
23436            onChange,
23437            hideLabelFromVision,
23438            operator
23439          }
23440        );
23441      }
23442      return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
23443        CalendarDateTimeControl,
23444        {
23445          data,
23446          field,
23447          onChange,
23448          hideLabelFromVision,
23449          markWhenOptional,
23450          validity,
23451          config
23452        }
23453      );
23454    }
23455  
23456    // packages/dataviews/build-module/components/dataform-controls/date.mjs
23457    var import_components32 = __toESM(require_components(), 1);
23458    var import_a11y = __toESM(require_a11y(), 1);
23459    var import_element61 = __toESM(require_element(), 1);
23460    var import_i18n41 = __toESM(require_i18n(), 1);
23461    var import_date4 = __toESM(require_date(), 1);
23462    var import_jsx_runtime96 = __toESM(require_jsx_runtime(), 1);
23463    var { DateCalendar: DateCalendar2, DateRangeCalendar } = unlock2(import_components32.privateApis);
23464    var DATE_PRESETS = [
23465      {
23466        id: "today",
23467        label: (0, import_i18n41.__)("Today"),
23468        getValue: () => (0, import_date4.getDate)(null)
23469      },
23470      {
23471        id: "yesterday",
23472        label: (0, import_i18n41.__)("Yesterday"),
23473        getValue: () => {
23474          const today = (0, import_date4.getDate)(null);
23475          return subDays(today, 1);
23476        }
23477      },
23478      {
23479        id: "past-week",
23480        label: (0, import_i18n41.__)("Past week"),
23481        getValue: () => {
23482          const today = (0, import_date4.getDate)(null);
23483          return subDays(today, 7);
23484        }
23485      },
23486      {
23487        id: "past-month",
23488        label: (0, import_i18n41.__)("Past month"),
23489        getValue: () => {
23490          const today = (0, import_date4.getDate)(null);
23491          return subMonths(today, 1);
23492        }
23493      }
23494    ];
23495    var DATE_RANGE_PRESETS = [
23496      {
23497        id: "last-7-days",
23498        label: (0, import_i18n41.__)("Last 7 days"),
23499        getValue: () => {
23500          const today = (0, import_date4.getDate)(null);
23501          return [subDays(today, 7), today];
23502        }
23503      },
23504      {
23505        id: "last-30-days",
23506        label: (0, import_i18n41.__)("Last 30 days"),
23507        getValue: () => {
23508          const today = (0, import_date4.getDate)(null);
23509          return [subDays(today, 30), today];
23510        }
23511      },
23512      {
23513        id: "month-to-date",
23514        label: (0, import_i18n41.__)("Month to date"),
23515        getValue: () => {
23516          const today = (0, import_date4.getDate)(null);
23517          return [startOfMonth(today), today];
23518        }
23519      },
23520      {
23521        id: "last-year",
23522        label: (0, import_i18n41.__)("Last year"),
23523        getValue: () => {
23524          const today = (0, import_date4.getDate)(null);
23525          return [subYears(today, 1), today];
23526        }
23527      },
23528      {
23529        id: "year-to-date",
23530        label: (0, import_i18n41.__)("Year to date"),
23531        getValue: () => {
23532          const today = (0, import_date4.getDate)(null);
23533          return [startOfYear(today), today];
23534        }
23535      }
23536    ];
23537    var parseDate = (dateString) => {
23538      if (!dateString) {
23539        return null;
23540      }
23541      const parsed = (0, import_date4.getDate)(dateString);
23542      return parsed && isValid(parsed) ? parsed : null;
23543    };
23544    var formatDate = (date) => {
23545      if (!date) {
23546        return "";
23547      }
23548      return typeof date === "string" ? date : format(date, "yyyy-MM-dd");
23549    };
23550    function ValidatedDateControl({
23551      field,
23552      validity,
23553      inputRefs,
23554      isTouched,
23555      setIsTouched,
23556      children
23557    }) {
23558      const { isValid: isValid2 } = field;
23559      const [customValidity, setCustomValidity] = (0, import_element61.useState)(void 0);
23560      const validateRefs = (0, import_element61.useCallback)(() => {
23561        const refs = Array.isArray(inputRefs) ? inputRefs : [inputRefs];
23562        for (const ref of refs) {
23563          const input = ref.current;
23564          if (input && !input.validity.valid) {
23565            setCustomValidity({
23566              type: "invalid",
23567              message: input.validationMessage
23568            });
23569            return;
23570          }
23571        }
23572        setCustomValidity(void 0);
23573      }, [inputRefs]);
23574      (0, import_element61.useEffect)(() => {
23575        const refs = Array.isArray(inputRefs) ? inputRefs : [inputRefs];
23576        const result = validity ? getCustomValidity(isValid2, validity) : void 0;
23577        for (const ref of refs) {
23578          const input = ref.current;
23579          if (input) {
23580            input.setCustomValidity(
23581              result?.type === "invalid" && result.message ? result.message : ""
23582            );
23583          }
23584        }
23585      }, [inputRefs, isValid2, validity]);
23586      (0, import_element61.useEffect)(() => {
23587        const refs = Array.isArray(inputRefs) ? inputRefs : [inputRefs];
23588        const handleInvalid = (event) => {
23589          event.preventDefault();
23590          setIsTouched(true);
23591        };
23592        for (const ref of refs) {
23593          ref.current?.addEventListener("invalid", handleInvalid);
23594        }
23595        return () => {
23596          for (const ref of refs) {
23597            ref.current?.removeEventListener("invalid", handleInvalid);
23598          }
23599        };
23600      }, [inputRefs, setIsTouched]);
23601      (0, import_element61.useEffect)(() => {
23602        if (!isTouched) {
23603          return;
23604        }
23605        const result = validity ? getCustomValidity(isValid2, validity) : void 0;
23606        if (result) {
23607          setCustomValidity(result);
23608        } else {
23609          validateRefs();
23610        }
23611      }, [isTouched, isValid2, validity, validateRefs]);
23612      (0, import_element61.useEffect)(() => {
23613        if (isTouched && customValidity?.message) {
23614          (0, import_a11y.speak)(customValidity.message);
23615        }
23616      }, [isTouched, customValidity?.message]);
23617      const onBlur = (event) => {
23618        if (isTouched) {
23619          return;
23620        }
23621        if (!event.relatedTarget || !event.currentTarget.contains(event.relatedTarget)) {
23622          setIsTouched(true);
23623        }
23624      };
23625      return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)("div", { onBlur, children: [
23626        children,
23627        customValidity && /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(
23628          "p",
23629          {
23630            className: clsx_default(
23631              "components-validated-control__indicator",
23632              customValidity.type === "invalid" ? "is-invalid" : void 0
23633            ),
23634            children: [
23635              /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
23636                import_components32.Icon,
23637                {
23638                  className: "components-validated-control__indicator-icon",
23639                  icon: error_default,
23640                  size: 16,
23641                  fill: "currentColor"
23642                }
23643              ),
23644              customValidity.message
23645            ]
23646          }
23647        )
23648      ] });
23649    }
23650    function CalendarDateControl({
23651      data,
23652      field,
23653      onChange,
23654      hideLabelFromVision,
23655      markWhenOptional,
23656      validity
23657    }) {
23658      const {
23659        id,
23660        label,
23661        description,
23662        setValue,
23663        getValue,
23664        isValid: isValid2,
23665        format: fieldFormat
23666      } = field;
23667      const disabled2 = field.isDisabled({ item: data, field });
23668      const [selectedPresetId, setSelectedPresetId] = (0, import_element61.useState)(
23669        null
23670      );
23671      const weekStartsOn = fieldFormat.weekStartsOn ?? (0, import_date4.getSettings)().l10n.startOfWeek;
23672      const fieldValue = getValue({ item: data });
23673      const value = typeof fieldValue === "string" ? fieldValue : void 0;
23674      const [calendarMonth, setCalendarMonth] = (0, import_element61.useState)(() => {
23675        const parsedDate = parseDate(value);
23676        return parsedDate || /* @__PURE__ */ new Date();
23677      });
23678      const [isTouched, setIsTouched] = (0, import_element61.useState)(false);
23679      const validityTargetRef = (0, import_element61.useRef)(null);
23680      const { minConstraint, maxConstraint, disabledMatchers } = useDisabledDateMatchers(isValid2, parseDate);
23681      const onChangeCallback = (0, import_element61.useCallback)(
23682        (newValue) => onChange(setValue({ item: data, value: newValue })),
23683        [data, onChange, setValue]
23684      );
23685      const onSelectDate = (0, import_element61.useCallback)(
23686        (newDate) => {
23687          const dateValue = newDate ? format(newDate, "yyyy-MM-dd") : void 0;
23688          onChangeCallback(dateValue);
23689          setSelectedPresetId(null);
23690          setIsTouched(true);
23691        },
23692        [onChangeCallback]
23693      );
23694      const handlePresetClick = (0, import_element61.useCallback)(
23695        (preset) => {
23696          const presetDate = preset.getValue();
23697          const dateValue = formatDate(presetDate);
23698          setCalendarMonth(presetDate);
23699          onChangeCallback(dateValue);
23700          setSelectedPresetId(preset.id);
23701          setIsTouched(true);
23702        },
23703        [onChangeCallback]
23704      );
23705      const handleManualDateChange = (0, import_element61.useCallback)(
23706        (newValue) => {
23707          onChangeCallback(newValue);
23708          if (newValue) {
23709            const parsedDate = parseDate(newValue);
23710            if (parsedDate) {
23711              setCalendarMonth(parsedDate);
23712            }
23713          }
23714          setSelectedPresetId(null);
23715          setIsTouched(true);
23716        },
23717        [onChangeCallback]
23718      );
23719      const {
23720        timezone: { string: timezoneString }
23721      } = (0, import_date4.getSettings)();
23722      let displayLabel = label;
23723      if (isValid2?.required && !markWhenOptional) {
23724        displayLabel = `$label} (${(0, import_i18n41.__)("Required")})`;
23725      } else if (!isValid2?.required && markWhenOptional) {
23726        displayLabel = `$label} (${(0, import_i18n41.__)("Optional")})`;
23727      }
23728      return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
23729        ValidatedDateControl,
23730        {
23731          field,
23732          validity,
23733          inputRefs: validityTargetRef,
23734          isTouched,
23735          setIsTouched,
23736          children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
23737            import_components32.BaseControl,
23738            {
23739              id,
23740              className: "dataviews-controls__date",
23741              label: displayLabel,
23742              help: description,
23743              hideLabelFromVision,
23744              children: /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(Stack, { direction: "column", gap: "lg", children: [
23745                /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(
23746                  Stack,
23747                  {
23748                    direction: "row",
23749                    gap: "sm",
23750                    wrap: "wrap",
23751                    justify: "flex-start",
23752                    children: [
23753                      DATE_PRESETS.map((preset) => {
23754                        const isSelected2 = selectedPresetId === preset.id;
23755                        return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
23756                          import_components32.Button,
23757                          {
23758                            className: "dataviews-controls__date-preset",
23759                            variant: "tertiary",
23760                            isPressed: isSelected2,
23761                            size: "small",
23762                            disabled: disabled2,
23763                            accessibleWhenDisabled: true,
23764                            onClick: () => handlePresetClick(preset),
23765                            children: preset.label
23766                          },
23767                          preset.id
23768                        );
23769                      }),
23770                      /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
23771                        import_components32.Button,
23772                        {
23773                          className: "dataviews-controls__date-preset",
23774                          variant: "tertiary",
23775                          isPressed: !selectedPresetId,
23776                          size: "small",
23777                          disabled: !!selectedPresetId || disabled2,
23778                          accessibleWhenDisabled: true,
23779                          children: (0, import_i18n41.__)("Custom")
23780                        }
23781                      )
23782                    ]
23783                  }
23784                ),
23785                /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
23786                  import_components32.__experimentalInputControl,
23787                  {
23788                    ref: validityTargetRef,
23789                    type: "date",
23790                    label: (0, import_i18n41.__)("Date"),
23791                    hideLabelFromVision: true,
23792                    value,
23793                    onChange: handleManualDateChange,
23794                    required: !!field.isValid?.required,
23795                    disabled: disabled2,
23796                    min: minConstraint,
23797                    max: maxConstraint
23798                  }
23799                ),
23800                /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
23801                  DateCalendar2,
23802                  {
23803                    style: { width: "100%" },
23804                    selected: value ? parseDate(value) || void 0 : void 0,
23805                    onSelect: onSelectDate,
23806                    month: calendarMonth,
23807                    onMonthChange: setCalendarMonth,
23808                    timeZone: timezoneString || void 0,
23809                    weekStartsOn,
23810                    disabled: disabled2 || disabledMatchers,
23811                    disableNavigation: disabled2
23812                  }
23813                )
23814              ] })
23815            }
23816          )
23817        }
23818      );
23819    }
23820    function CalendarDateRangeControl({
23821      data,
23822      field,
23823      onChange,
23824      hideLabelFromVision,
23825      markWhenOptional,
23826      validity
23827    }) {
23828      const {
23829        id,
23830        label,
23831        description,
23832        getValue,
23833        setValue,
23834        isValid: isValid2,
23835        format: fieldFormat
23836      } = field;
23837      const disabled2 = field.isDisabled({ item: data, field });
23838      let value;
23839      const fieldValue = getValue({ item: data });
23840      if (Array.isArray(fieldValue) && fieldValue.length === 2 && fieldValue.every((date) => typeof date === "string")) {
23841        value = fieldValue;
23842      }
23843      const weekStartsOn = fieldFormat.weekStartsOn ?? (0, import_date4.getSettings)().l10n.startOfWeek;
23844      const { minConstraint, maxConstraint, disabledMatchers } = useDisabledDateMatchers(isValid2, parseDate);
23845      const onChangeCallback = (0, import_element61.useCallback)(
23846        (newValue) => {
23847          onChange(
23848            setValue({
23849              item: data,
23850              value: newValue
23851            })
23852          );
23853        },
23854        [data, onChange, setValue]
23855      );
23856      const [selectedPresetId, setSelectedPresetId] = (0, import_element61.useState)(
23857        null
23858      );
23859      const selectedRange = (0, import_element61.useMemo)(() => {
23860        if (!value) {
23861          return { from: void 0, to: void 0 };
23862        }
23863        const [from, to] = value;
23864        return {
23865          from: parseDate(from) || void 0,
23866          to: parseDate(to) || void 0
23867        };
23868      }, [value]);
23869      const [calendarMonth, setCalendarMonth] = (0, import_element61.useState)(() => {
23870        return selectedRange.from || /* @__PURE__ */ new Date();
23871      });
23872      const [isTouched, setIsTouched] = (0, import_element61.useState)(false);
23873      const fromInputRef = (0, import_element61.useRef)(null);
23874      const toInputRef = (0, import_element61.useRef)(null);
23875      const updateDateRange = (0, import_element61.useCallback)(
23876        (fromDate, toDate2) => {
23877          if (fromDate && toDate2) {
23878            onChangeCallback([
23879              formatDate(fromDate),
23880              formatDate(toDate2)
23881            ]);
23882          } else if (!fromDate && !toDate2) {
23883            onChangeCallback(void 0);
23884          }
23885        },
23886        [onChangeCallback]
23887      );
23888      const onSelectCalendarRange = (0, import_element61.useCallback)(
23889        (newRange) => {
23890          updateDateRange(newRange?.from, newRange?.to);
23891          setSelectedPresetId(null);
23892          setIsTouched(true);
23893        },
23894        [updateDateRange]
23895      );
23896      const handlePresetClick = (0, import_element61.useCallback)(
23897        (preset) => {
23898          const [startDate, endDate] = preset.getValue();
23899          setCalendarMonth(startDate);
23900          updateDateRange(startDate, endDate);
23901          setSelectedPresetId(preset.id);
23902          setIsTouched(true);
23903        },
23904        [updateDateRange]
23905      );
23906      const handleManualDateChange = (0, import_element61.useCallback)(
23907        (fromOrTo, newValue) => {
23908          const [currentFrom, currentTo] = value || [
23909            void 0,
23910            void 0
23911          ];
23912          const updatedFrom = fromOrTo === "from" ? newValue : currentFrom;
23913          const updatedTo = fromOrTo === "to" ? newValue : currentTo;
23914          updateDateRange(updatedFrom, updatedTo);
23915          if (newValue) {
23916            const parsedDate = parseDate(newValue);
23917            if (parsedDate) {
23918              setCalendarMonth(parsedDate);
23919            }
23920          }
23921          setSelectedPresetId(null);
23922          setIsTouched(true);
23923        },
23924        [value, updateDateRange]
23925      );
23926      const { timezone } = (0, import_date4.getSettings)();
23927      let displayLabel = label;
23928      if (field.isValid?.required && !markWhenOptional) {
23929        displayLabel = `$label} (${(0, import_i18n41.__)("Required")})`;
23930      } else if (!field.isValid?.required && markWhenOptional) {
23931        displayLabel = `$label} (${(0, import_i18n41.__)("Optional")})`;
23932      }
23933      return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
23934        ValidatedDateControl,
23935        {
23936          field,
23937          validity,
23938          inputRefs: [fromInputRef, toInputRef],
23939          isTouched,
23940          setIsTouched,
23941          children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
23942            import_components32.BaseControl,
23943            {
23944              id,
23945              className: "dataviews-controls__date",
23946              label: displayLabel,
23947              help: description,
23948              hideLabelFromVision,
23949              children: /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(Stack, { direction: "column", gap: "lg", children: [
23950                /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(
23951                  Stack,
23952                  {
23953                    direction: "row",
23954                    gap: "sm",
23955                    wrap: "wrap",
23956                    justify: "flex-start",
23957                    children: [
23958                      DATE_RANGE_PRESETS.map((preset) => {
23959                        const isSelected2 = selectedPresetId === preset.id;
23960                        return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
23961                          import_components32.Button,
23962                          {
23963                            className: "dataviews-controls__date-preset",
23964                            variant: "tertiary",
23965                            isPressed: isSelected2,
23966                            size: "small",
23967                            disabled: disabled2,
23968                            accessibleWhenDisabled: true,
23969                            onClick: () => handlePresetClick(preset),
23970                            children: preset.label
23971                          },
23972                          preset.id
23973                        );
23974                      }),
23975                      /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
23976                        import_components32.Button,
23977                        {
23978                          className: "dataviews-controls__date-preset",
23979                          variant: "tertiary",
23980                          isPressed: !selectedPresetId,
23981                          size: "small",
23982                          accessibleWhenDisabled: true,
23983                          disabled: !!selectedPresetId || disabled2,
23984                          children: (0, import_i18n41.__)("Custom")
23985                        }
23986                      )
23987                    ]
23988                  }
23989                ),
23990                /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(
23991                  Stack,
23992                  {
23993                    direction: "row",
23994                    gap: "sm",
23995                    justify: "space-between",
23996                    className: "dataviews-controls__date-range-inputs",
23997                    children: [
23998                      /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
23999                        import_components32.__experimentalInputControl,
24000                        {
24001                          ref: fromInputRef,
24002                          type: "date",
24003                          label: (0, import_i18n41.__)("From"),
24004                          hideLabelFromVision: true,
24005                          value: value?.[0],
24006                          onChange: (newValue) => handleManualDateChange("from", newValue),
24007                          required: !!field.isValid?.required,
24008                          disabled: disabled2,
24009                          min: minConstraint,
24010                          max: maxConstraint
24011                        }
24012                      ),
24013                      /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
24014                        import_components32.__experimentalInputControl,
24015                        {
24016                          ref: toInputRef,
24017                          type: "date",
24018                          label: (0, import_i18n41.__)("To"),
24019                          hideLabelFromVision: true,
24020                          value: value?.[1],
24021                          onChange: (newValue) => handleManualDateChange("to", newValue),
24022                          required: !!field.isValid?.required,
24023                          disabled: disabled2,
24024                          min: minConstraint,
24025                          max: maxConstraint
24026                        }
24027                      )
24028                    ]
24029                  }
24030                ),
24031                /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
24032                  DateRangeCalendar,
24033                  {
24034                    style: { width: "100%" },
24035                    selected: selectedRange,
24036                    onSelect: onSelectCalendarRange,
24037                    month: calendarMonth,
24038                    onMonthChange: setCalendarMonth,
24039                    timeZone: timezone.string || void 0,
24040                    weekStartsOn,
24041                    disabled: disabled2 || disabledMatchers
24042                  }
24043                )
24044              ] })
24045            }
24046          )
24047        }
24048      );
24049    }
24050    function DateControl({
24051      data,
24052      field,
24053      onChange,
24054      hideLabelFromVision,
24055      markWhenOptional,
24056      operator,
24057      validity
24058    }) {
24059      if (operator === OPERATOR_IN_THE_PAST || operator === OPERATOR_OVER) {
24060        return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
24061          RelativeDateControl,
24062          {
24063            className: "dataviews-controls__date",
24064            data,
24065            field,
24066            onChange,
24067            hideLabelFromVision,
24068            operator
24069          }
24070        );
24071      }
24072      if (operator === OPERATOR_BETWEEN) {
24073        return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
24074          CalendarDateRangeControl,
24075          {
24076            data,
24077            field,
24078            onChange,
24079            hideLabelFromVision,
24080            markWhenOptional,
24081            validity
24082          }
24083        );
24084      }
24085      return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
24086        CalendarDateControl,
24087        {
24088          data,
24089          field,
24090          onChange,
24091          hideLabelFromVision,
24092          markWhenOptional,
24093          validity
24094        }
24095      );
24096    }
24097  
24098    // packages/dataviews/build-module/components/dataform-controls/select.mjs
24099    var import_components33 = __toESM(require_components(), 1);
24100    var import_element62 = __toESM(require_element(), 1);
24101    var import_jsx_runtime97 = __toESM(require_jsx_runtime(), 1);
24102    var { ValidatedSelectControl } = unlock2(import_components33.privateApis);
24103    function Select({
24104      data,
24105      field,
24106      onChange,
24107      hideLabelFromVision,
24108      markWhenOptional,
24109      validity
24110    }) {
24111      const { type, label, description, getValue, setValue, isValid: isValid2 } = field;
24112      const disabled2 = field.isDisabled({ item: data, field });
24113      const isMultiple = type === "array";
24114      const value = getValue({ item: data }) ?? (isMultiple ? [] : "");
24115      const onChangeControl = (0, import_element62.useCallback)(
24116        (newValue) => onChange(setValue({ item: data, value: newValue })),
24117        [data, onChange, setValue]
24118      );
24119      const { elements, isLoading } = useElements({
24120        elements: field.elements,
24121        getElements: field.getElements
24122      });
24123      if (isLoading) {
24124        return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(import_components33.Spinner, {});
24125      }
24126      return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
24127        ValidatedSelectControl,
24128        {
24129          required: !!field.isValid?.required,
24130          markWhenOptional,
24131          customValidity: getCustomValidity(isValid2, validity),
24132          label,
24133          value,
24134          help: description,
24135          options: elements,
24136          onChange: onChangeControl,
24137          hideLabelFromVision,
24138          multiple: isMultiple,
24139          disabled: disabled2
24140        }
24141      );
24142    }
24143  
24144    // packages/dataviews/build-module/components/dataform-controls/adaptive-select.mjs
24145    var import_jsx_runtime98 = __toESM(require_jsx_runtime(), 1);
24146    var ELEMENTS_THRESHOLD = 10;
24147    function AdaptiveSelect(props) {
24148      const { field } = props;
24149      const { elements } = useElements({
24150        elements: field.elements,
24151        getElements: field.getElements
24152      });
24153      if (elements.length >= ELEMENTS_THRESHOLD) {
24154        return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Combobox3, { ...props });
24155      }
24156      return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Select, { ...props });
24157    }
24158  
24159    // packages/dataviews/build-module/components/dataform-controls/email.mjs
24160    var import_components35 = __toESM(require_components(), 1);
24161  
24162    // packages/dataviews/build-module/components/dataform-controls/utils/validated-input.mjs
24163    var import_components34 = __toESM(require_components(), 1);
24164    var import_element63 = __toESM(require_element(), 1);
24165    var import_jsx_runtime99 = __toESM(require_jsx_runtime(), 1);
24166    var { ValidatedInputControl: ValidatedInputControl2 } = unlock2(import_components34.privateApis);
24167    function ValidatedText({
24168      data,
24169      field,
24170      onChange,
24171      hideLabelFromVision,
24172      markWhenOptional,
24173      type,
24174      prefix,
24175      suffix,
24176      validity
24177    }) {
24178      const { label, placeholder, description, getValue, setValue, isValid: isValid2 } = field;
24179      const value = getValue({ item: data });
24180      const disabled2 = field.isDisabled({ item: data, field });
24181      const onChangeControl = (0, import_element63.useCallback)(
24182        (newValue) => onChange(
24183          setValue({
24184            item: data,
24185            value: newValue
24186          })
24187        ),
24188        [data, setValue, onChange]
24189      );
24190      return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
24191        ValidatedInputControl2,
24192        {
24193          required: !!isValid2.required,
24194          markWhenOptional,
24195          customValidity: getCustomValidity(isValid2, validity),
24196          label,
24197          placeholder,
24198          value: value ?? "",
24199          help: description,
24200          onChange: onChangeControl,
24201          hideLabelFromVision,
24202          type,
24203          prefix,
24204          suffix,
24205          disabled: disabled2,
24206          pattern: isValid2.pattern ? isValid2.pattern.constraint : void 0,
24207          minLength: isValid2.minLength ? isValid2.minLength.constraint : void 0,
24208          maxLength: isValid2.maxLength ? isValid2.maxLength.constraint : void 0
24209        }
24210      );
24211    }
24212  
24213    // packages/dataviews/build-module/components/dataform-controls/email.mjs
24214    var import_jsx_runtime100 = __toESM(require_jsx_runtime(), 1);
24215    function Email({
24216      data,
24217      field,
24218      onChange,
24219      hideLabelFromVision,
24220      markWhenOptional,
24221      validity
24222    }) {
24223      return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
24224        ValidatedText,
24225        {
24226          ...{
24227            data,
24228            field,
24229            onChange,
24230            hideLabelFromVision,
24231            markWhenOptional,
24232            validity,
24233            type: "email",
24234            prefix: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_components35.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_components35.Icon, { icon: envelope_default }) })
24235          }
24236        }
24237      );
24238    }
24239  
24240    // packages/dataviews/build-module/components/dataform-controls/telephone.mjs
24241    var import_components36 = __toESM(require_components(), 1);
24242    var import_jsx_runtime101 = __toESM(require_jsx_runtime(), 1);
24243    function Telephone({
24244      data,
24245      field,
24246      onChange,
24247      hideLabelFromVision,
24248      markWhenOptional,
24249      validity
24250    }) {
24251      return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
24252        ValidatedText,
24253        {
24254          ...{
24255            data,
24256            field,
24257            onChange,
24258            hideLabelFromVision,
24259            markWhenOptional,
24260            validity,
24261            type: "tel",
24262            prefix: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(import_components36.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(import_components36.Icon, { icon: mobile_default }) })
24263          }
24264        }
24265      );
24266    }
24267  
24268    // packages/dataviews/build-module/components/dataform-controls/url.mjs
24269    var import_components37 = __toESM(require_components(), 1);
24270    var import_jsx_runtime102 = __toESM(require_jsx_runtime(), 1);
24271    function Url({
24272      data,
24273      field,
24274      onChange,
24275      hideLabelFromVision,
24276      markWhenOptional,
24277      validity
24278    }) {
24279      return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
24280        ValidatedText,
24281        {
24282          ...{
24283            data,
24284            field,
24285            onChange,
24286            hideLabelFromVision,
24287            markWhenOptional,
24288            validity,
24289            type: "url",
24290            prefix: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_components37.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_components37.Icon, { icon: link_default }) })
24291          }
24292        }
24293      );
24294    }
24295  
24296    // packages/dataviews/build-module/components/dataform-controls/utils/validated-number.mjs
24297    var import_components38 = __toESM(require_components(), 1);
24298    var import_element64 = __toESM(require_element(), 1);
24299    var import_i18n42 = __toESM(require_i18n(), 1);
24300    var import_jsx_runtime103 = __toESM(require_jsx_runtime(), 1);
24301    var { ValidatedNumberControl } = unlock2(import_components38.privateApis);
24302    function toNumberOrEmpty(value) {
24303      if (value === "" || value === void 0) {
24304        return "";
24305      }
24306      const number = Number(value);
24307      return Number.isFinite(number) ? number : "";
24308    }
24309    function BetweenControls({
24310      value,
24311      onChange,
24312      hideLabelFromVision,
24313      step
24314    }) {
24315      const [min2 = "", max2 = ""] = value;
24316      const onChangeMin = (0, import_element64.useCallback)(
24317        (newValue) => onChange([toNumberOrEmpty(newValue), max2]),
24318        [onChange, max2]
24319      );
24320      const onChangeMax = (0, import_element64.useCallback)(
24321        (newValue) => onChange([min2, toNumberOrEmpty(newValue)]),
24322        [onChange, min2]
24323      );
24324      return /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
24325        import_components38.BaseControl,
24326        {
24327          help: (0, import_i18n42.__)("The max. value must be greater than the min. value."),
24328          children: /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(import_components38.Flex, { direction: "row", gap: 4, children: [
24329            /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
24330              import_components38.__experimentalNumberControl,
24331              {
24332                label: (0, import_i18n42.__)("Min."),
24333                value: min2,
24334                max: max2 ? Number(max2) - step : void 0,
24335                onChange: onChangeMin,
24336                hideLabelFromVision,
24337                step
24338              }
24339            ),
24340            /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
24341              import_components38.__experimentalNumberControl,
24342              {
24343                label: (0, import_i18n42.__)("Max."),
24344                value: max2,
24345                min: min2 ? Number(min2) + step : void 0,
24346                onChange: onChangeMax,
24347                hideLabelFromVision,
24348                step
24349              }
24350            )
24351          ] })
24352        }
24353      );
24354    }
24355    function ValidatedNumber({
24356      data,
24357      field,
24358      onChange,
24359      hideLabelFromVision,
24360      markWhenOptional,
24361      operator,
24362      validity
24363    }) {
24364      const decimals = field.format?.decimals ?? 0;
24365      const step = Math.pow(10, Math.abs(decimals) * -1);
24366      const { label, description, getValue, setValue, isValid: isValid2 } = field;
24367      const value = getValue({ item: data }) ?? "";
24368      const disabled2 = field.isDisabled({ item: data, field });
24369      const onChangeControl = (0, import_element64.useCallback)(
24370        (newValue) => {
24371          onChange(
24372            setValue({
24373              item: data,
24374              // Do not convert an empty string or undefined to a number,
24375              // otherwise there's a mismatch between the UI control (empty)
24376              // and the data relied by onChange (0).
24377              value: ["", void 0].includes(newValue) ? void 0 : Number(newValue)
24378            })
24379          );
24380        },
24381        [data, onChange, setValue]
24382      );
24383      const onChangeBetweenControls = (0, import_element64.useCallback)(
24384        (newValue) => {
24385          onChange(
24386            setValue({
24387              item: data,
24388              value: newValue
24389            })
24390          );
24391        },
24392        [data, onChange, setValue]
24393      );
24394      if (operator === OPERATOR_BETWEEN) {
24395        let valueBetween = ["", ""];
24396        if (Array.isArray(value) && value.length === 2 && value.every(
24397          (element) => typeof element === "number" || element === ""
24398        )) {
24399          valueBetween = value;
24400        }
24401        return /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
24402          BetweenControls,
24403          {
24404            value: valueBetween,
24405            onChange: onChangeBetweenControls,
24406            hideLabelFromVision,
24407            step
24408          }
24409        );
24410      }
24411      return /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
24412        ValidatedNumberControl,
24413        {
24414          required: !!isValid2.required,
24415          markWhenOptional,
24416          customValidity: getCustomValidity(isValid2, validity),
24417          label,
24418          help: description,
24419          value,
24420          onChange: onChangeControl,
24421          hideLabelFromVision,
24422          step,
24423          min: isValid2.min ? isValid2.min.constraint : void 0,
24424          max: isValid2.max ? isValid2.max.constraint : void 0,
24425          disabled: disabled2
24426        }
24427      );
24428    }
24429  
24430    // packages/dataviews/build-module/components/dataform-controls/integer.mjs
24431    var import_jsx_runtime104 = __toESM(require_jsx_runtime(), 1);
24432    function Integer(props) {
24433      return /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(ValidatedNumber, { ...props });
24434    }
24435  
24436    // packages/dataviews/build-module/components/dataform-controls/number.mjs
24437    var import_jsx_runtime105 = __toESM(require_jsx_runtime(), 1);
24438    function Number2(props) {
24439      return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(ValidatedNumber, { ...props });
24440    }
24441  
24442    // packages/dataviews/build-module/components/dataform-controls/radio.mjs
24443    var import_components39 = __toESM(require_components(), 1);
24444    var import_element65 = __toESM(require_element(), 1);
24445    var import_jsx_runtime106 = __toESM(require_jsx_runtime(), 1);
24446    var { ValidatedRadioControl } = unlock2(import_components39.privateApis);
24447    function Radio({
24448      data,
24449      field,
24450      onChange,
24451      hideLabelFromVision,
24452      markWhenOptional,
24453      validity
24454    }) {
24455      const { label, description, getValue, setValue, isValid: isValid2 } = field;
24456      const disabled2 = field.isDisabled({ item: data, field });
24457      const { elements, isLoading } = useElements({
24458        elements: field.elements,
24459        getElements: field.getElements
24460      });
24461      const value = getValue({ item: data });
24462      const onChangeControl = (0, import_element65.useCallback)(
24463        (newValue) => onChange(setValue({ item: data, value: newValue })),
24464        [data, onChange, setValue]
24465      );
24466      if (isLoading) {
24467        return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(import_components39.Spinner, {});
24468      }
24469      return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
24470        ValidatedRadioControl,
24471        {
24472          required: !!field.isValid?.required,
24473          markWhenOptional,
24474          customValidity: getCustomValidity(isValid2, validity),
24475          label,
24476          help: description,
24477          onChange: onChangeControl,
24478          options: elements,
24479          selected: value,
24480          hideLabelFromVision,
24481          disabled: disabled2
24482        }
24483      );
24484    }
24485  
24486    // packages/dataviews/build-module/components/dataform-controls/text.mjs
24487    var import_element66 = __toESM(require_element(), 1);
24488    var import_jsx_runtime107 = __toESM(require_jsx_runtime(), 1);
24489    function Text({
24490      data,
24491      field,
24492      onChange,
24493      hideLabelFromVision,
24494      markWhenOptional,
24495      config,
24496      validity
24497    }) {
24498      const { prefix, suffix } = config || {};
24499      return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
24500        ValidatedText,
24501        {
24502          ...{
24503            data,
24504            field,
24505            onChange,
24506            hideLabelFromVision,
24507            markWhenOptional,
24508            validity,
24509            prefix: prefix ? (0, import_element66.createElement)(prefix) : void 0,
24510            suffix: suffix ? (0, import_element66.createElement)(suffix) : void 0
24511          }
24512        }
24513      );
24514    }
24515  
24516    // packages/dataviews/build-module/components/dataform-controls/toggle.mjs
24517    var import_components40 = __toESM(require_components(), 1);
24518    var import_element67 = __toESM(require_element(), 1);
24519    var import_jsx_runtime108 = __toESM(require_jsx_runtime(), 1);
24520    var { ValidatedToggleControl } = unlock2(import_components40.privateApis);
24521    function Toggle({
24522      field,
24523      onChange,
24524      data,
24525      hideLabelFromVision,
24526      markWhenOptional,
24527      validity
24528    }) {
24529      const { label, description, getValue, setValue, isValid: isValid2 } = field;
24530      const disabled2 = field.isDisabled({ item: data, field });
24531      const onChangeControl = (0, import_element67.useCallback)(() => {
24532        onChange(
24533          setValue({ item: data, value: !getValue({ item: data }) })
24534        );
24535      }, [onChange, setValue, data, getValue]);
24536      return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
24537        ValidatedToggleControl,
24538        {
24539          required: !!isValid2.required,
24540          markWhenOptional,
24541          customValidity: getCustomValidity(isValid2, validity),
24542          hidden: hideLabelFromVision,
24543          label,
24544          help: description,
24545          checked: getValue({ item: data }),
24546          onChange: onChangeControl,
24547          disabled: disabled2
24548        }
24549      );
24550    }
24551  
24552    // packages/dataviews/build-module/components/dataform-controls/textarea.mjs
24553    var import_components41 = __toESM(require_components(), 1);
24554    var import_element68 = __toESM(require_element(), 1);
24555    var import_jsx_runtime109 = __toESM(require_jsx_runtime(), 1);
24556    var { ValidatedTextareaControl } = unlock2(import_components41.privateApis);
24557    function Textarea({
24558      data,
24559      field,
24560      onChange,
24561      hideLabelFromVision,
24562      markWhenOptional,
24563      config,
24564      validity
24565    }) {
24566      const { rows = 4 } = config || {};
24567      const disabled2 = field.isDisabled({ item: data, field });
24568      const { label, placeholder, description, setValue, isValid: isValid2 } = field;
24569      const value = field.getValue({ item: data });
24570      const onChangeControl = (0, import_element68.useCallback)(
24571        (newValue) => onChange(setValue({ item: data, value: newValue })),
24572        [data, onChange, setValue]
24573      );
24574      return /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
24575        ValidatedTextareaControl,
24576        {
24577          required: !!isValid2.required,
24578          markWhenOptional,
24579          customValidity: getCustomValidity(isValid2, validity),
24580          label,
24581          placeholder,
24582          value: value ?? "",
24583          help: description,
24584          onChange: onChangeControl,
24585          rows,
24586          disabled: disabled2,
24587          minLength: isValid2.minLength ? isValid2.minLength.constraint : void 0,
24588          maxLength: isValid2.maxLength ? isValid2.maxLength.constraint : void 0,
24589          __next40pxDefaultSize: true,
24590          hideLabelFromVision
24591        }
24592      );
24593    }
24594  
24595    // packages/dataviews/build-module/components/dataform-controls/richtext/index.mjs
24596    var import_element70 = __toESM(require_element(), 1);
24597  
24598    // packages/dataviews/build-module/components/dataform-controls/richtext/control.mjs
24599    var import_components42 = __toESM(require_components(), 1);
24600    var import_compose12 = __toESM(require_compose(), 1);
24601    var import_element69 = __toESM(require_element(), 1);
24602    var import_rich_text2 = __toESM(require_rich_text(), 1);
24603  
24604    // packages/dataviews/build-module/components/dataform-controls/richtext/utils.mjs
24605    var EMPTY_ARRAY5 = [];
24606    function getAllowedFormats({
24607      allowedFormats,
24608      disableFormats
24609    }) {
24610      if (disableFormats) {
24611        return EMPTY_ARRAY5;
24612      }
24613      return allowedFormats;
24614    }
24615  
24616    // packages/dataviews/build-module/components/dataform-controls/richtext/format-edit.mjs
24617    var import_rich_text = __toESM(require_rich_text(), 1);
24618    var import_jsx_runtime110 = __toESM(require_jsx_runtime(), 1);
24619    var import_react24 = __toESM(require_react(), 1);
24620    var EMPTY_CONTEXT = {};
24621    function Edit({
24622      onChange,
24623      onFocus,
24624      value,
24625      forwardedRef,
24626      settings,
24627      isVisible: isVisible2
24628    }) {
24629      const { name, edit: EditFunction } = settings;
24630      if (!EditFunction) {
24631        return null;
24632      }
24633      const activeFormat = (0, import_rich_text.getActiveFormat)(value, name);
24634      const isActive = activeFormat !== void 0;
24635      const activeObject = (0, import_rich_text.getActiveObject)(value);
24636      const isObjectActive = activeObject !== void 0 && activeObject.type === name;
24637      return /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
24638        EditFunction,
24639        {
24640          isActive,
24641          isVisible: isVisible2,
24642          activeAttributes: isActive ? activeFormat.attributes || {} : {},
24643          isObjectActive,
24644          activeObjectAttributes: isObjectActive ? activeObject.attributes || {} : {},
24645          value,
24646          onChange,
24647          onFocus,
24648          contentRef: forwardedRef,
24649          context: EMPTY_CONTEXT
24650        },
24651        name
24652      );
24653    }
24654    function FormatEdit({
24655      formatTypes,
24656      ...props
24657    }) {
24658      return formatTypes.map((settings) => /* @__PURE__ */ (0, import_react24.createElement)(Edit, { settings, ...props, key: settings.name }));
24659    }
24660  
24661    // packages/dataviews/build-module/components/dataform-controls/richtext/control.mjs
24662    var import_jsx_runtime111 = __toESM(require_jsx_runtime(), 1);
24663    var {
24664      ValidatedContentEditableControl: RichTextControlShell,
24665      withIgnoreIMEEvents
24666    } = unlock2(import_components42.privateApis);
24667    var {
24668      useRichText,
24669      KeyboardShortcutContext,
24670      InputEventContext,
24671      shortcutsListener,
24672      inputEventsListener
24673    } = unlock2(import_rich_text2.privateApis);
24674    var EMPTY_COMPLETERS = [];
24675    function RichTextControl({
24676      label,
24677      value: attrValue,
24678      onChange,
24679      placeholder,
24680      id,
24681      clientId,
24682      className,
24683      hideLabelFromVision,
24684      help,
24685      disabled: disabled2,
24686      required,
24687      markWhenOptional,
24688      customValidity,
24689      allowedFormats,
24690      disableFormats,
24691      withoutInteractiveFormatting,
24692      preserveWhiteSpace,
24693      disableLineBreaks,
24694      focusOnMount,
24695      completers = EMPTY_COMPLETERS
24696    }) {
24697      const [selection, setSelection] = (0, import_element69.useState)({
24698        start: void 0,
24699        end: void 0
24700      });
24701      const [isSelected2, setIsSelected] = (0, import_element69.useState)(false);
24702      const anchorRef = (0, import_element69.useRef)(void 0);
24703      const inputEvents = (0, import_element69.useRef)(/* @__PURE__ */ new Set());
24704      const keyboardShortcuts = (0, import_element69.useRef)(
24705        /* @__PURE__ */ new Set()
24706      );
24707      const popoverSlotRef = (0, import_element69.useRef)(null);
24708      const [popoverContainer, setPopoverContainer] = (0, import_element69.useState)(null);
24709      const popoverContainerRef = (0, import_compose12.useRefEffect)((element) => {
24710        setPopoverContainer(element.ownerDocument.body);
24711      }, []);
24712      const blurDeselectTimeoutRef = (0, import_element69.useRef)();
24713      const stopPopoverFocusTrackingRef = (0, import_element69.useRef)(
24714        void 0
24715      );
24716      (0, import_element69.useEffect)(
24717        () => () => {
24718          clearTimeout(blurDeselectTimeoutRef.current);
24719          stopPopoverFocusTrackingRef.current?.();
24720        },
24721        []
24722      );
24723      function isFocusInField(ownerDocument2) {
24724        const active = ownerDocument2.activeElement;
24725        return !!(active && (anchorRef.current?.contains(active) || popoverSlotRef.current?.contains(active)));
24726      }
24727      function trackPopoverFocusOut(ownerDocument2) {
24728        stopPopoverFocusTrackingRef.current?.();
24729        function onDocumentFocusOut() {
24730          clearTimeout(blurDeselectTimeoutRef.current);
24731          blurDeselectTimeoutRef.current = setTimeout(() => {
24732            if (isFocusInField(ownerDocument2)) {
24733              return;
24734            }
24735            stopPopoverFocusTrackingRef.current?.();
24736            setIsSelected(false);
24737          }, 0);
24738        }
24739        ownerDocument2.addEventListener("focusout", onDocumentFocusOut);
24740        stopPopoverFocusTrackingRef.current = () => {
24741          ownerDocument2.removeEventListener("focusout", onDocumentFocusOut);
24742          stopPopoverFocusTrackingRef.current = void 0;
24743        };
24744      }
24745      function onEditableFocus() {
24746        clearTimeout(blurDeselectTimeoutRef.current);
24747        stopPopoverFocusTrackingRef.current?.();
24748        setIsSelected(true);
24749      }
24750      function onEditableBlur(event) {
24751        clearTimeout(blurDeselectTimeoutRef.current);
24752        const { ownerDocument: ownerDocument2 } = event.currentTarget;
24753        blurDeselectTimeoutRef.current = setTimeout(() => {
24754          if (isFocusInField(ownerDocument2)) {
24755            trackPopoverFocusOut(ownerDocument2);
24756            return;
24757          }
24758          setIsSelected(false);
24759        }, 0);
24760      }
24761      const adjustedAllowedFormats = getAllowedFormats({
24762        allowedFormats,
24763        disableFormats
24764      });
24765      const {
24766        value,
24767        onChange: onRichTextChange,
24768        ref: richTextRef,
24769        formatTypes,
24770        getValue
24771      } = useRichText({
24772        value: attrValue,
24773        onChange,
24774        selectionStart: selection.start,
24775        selectionEnd: selection.end,
24776        onSelectionChange: (start, end) => setSelection({ start, end }),
24777        __unstableIsSelected: isSelected2,
24778        preserveWhiteSpace: !!preserveWhiteSpace,
24779        placeholder,
24780        __unstableDisableFormats: disableFormats,
24781        allowedFormats: adjustedAllowedFormats,
24782        withoutInteractiveFormatting,
24783        __unstableFormatTypeHandlerContext: (0, import_element69.useMemo)(
24784          () => ({
24785            richTextIdentifier: id,
24786            blockClientId: clientId
24787          }),
24788          [id, clientId]
24789        )
24790      });
24791      function onFocus() {
24792        anchorRef.current?.focus();
24793      }
24794      const eventListenersPropsRef = (0, import_element69.useRef)({
24795        keyboardShortcuts,
24796        inputEvents
24797      });
24798      const inputRulePropsRef = (0, import_element69.useRef)({
24799        formatTypes,
24800        getValue,
24801        onChange: onRichTextChange
24802      });
24803      (0, import_element69.useInsertionEffect)(() => {
24804        inputRulePropsRef.current = {
24805          formatTypes,
24806          getValue,
24807          onChange: onRichTextChange
24808        };
24809      });
24810      const enterRef = (0, import_compose12.useRefEffect)(
24811        (element) => {
24812          if (disabled2) {
24813            return;
24814          }
24815          const onKeyDown = withIgnoreIMEEvents((event) => {
24816            if (event.key !== "Enter" || event.defaultPrevented || event.metaKey || event.ctrlKey) {
24817              return;
24818            }
24819            event.preventDefault();
24820            if (disableLineBreaks) {
24821              return;
24822            }
24823            const { getValue: getCurrentValue2, onChange: handleChange } = inputRulePropsRef.current;
24824            const current = getCurrentValue2();
24825            handleChange(
24826              (0, import_rich_text2.insert)(
24827                current,
24828                "\n",
24829                current.start ?? current.text.length,
24830                current.end ?? current.text.length
24831              )
24832            );
24833          });
24834          element.addEventListener("keydown", onKeyDown);
24835          return () => element.removeEventListener("keydown", onKeyDown);
24836        },
24837        [disableLineBreaks, disabled2]
24838      );
24839      const eventListenersRef = (0, import_compose12.useRefEffect)(
24840        (element) => {
24841          if (!isSelected2) {
24842            return;
24843          }
24844          const cleanupShortcuts = shortcutsListener(
24845            eventListenersPropsRef
24846          )(element);
24847          const cleanupInputEvents = inputEventsListener(
24848            eventListenersPropsRef
24849          )(element);
24850          function onFormatInput(event) {
24851            if (event.inputType !== "insertText" && event.type !== "compositionend") {
24852              return;
24853            }
24854            const {
24855              formatTypes: types,
24856              getValue: getCurrentValue2,
24857              onChange: handleChange
24858            } = inputRulePropsRef.current;
24859            const current = getCurrentValue2();
24860            const transformed = types.reduce(
24861              (accumulator, {
24862                __unstableInputRule
24863              }) => __unstableInputRule ? __unstableInputRule(accumulator) : accumulator,
24864              current
24865            );
24866            if (transformed !== current) {
24867              handleChange({
24868                ...transformed,
24869                activeFormats: current.activeFormats
24870              });
24871            }
24872          }
24873          element.addEventListener("input", onFormatInput);
24874          element.addEventListener("compositionend", onFormatInput);
24875          return () => {
24876            cleanupShortcuts();
24877            cleanupInputEvents();
24878            element.removeEventListener("input", onFormatInput);
24879            element.removeEventListener("compositionend", onFormatInput);
24880          };
24881        },
24882        [isSelected2]
24883      );
24884      const unusedContentRef = (0, import_element69.useRef)(null);
24885      const {
24886        ref: autocompleteRef,
24887        "aria-activedescendant": autocompleteActiveDescendant,
24888        "aria-autocomplete": autocompleteAriaAutocomplete,
24889        ...autocompleteRest
24890      } = (0, import_components42.__unstableUseAutocompleteProps)({
24891        completers,
24892        record: value,
24893        onChange: onRichTextChange,
24894        // This control's completers insert their completion into the value;
24895        // none replace the whole value, so the required `onReplace` is a
24896        // no-op here.
24897        onReplace: () => {
24898        },
24899        contentRef: unusedContentRef
24900      });
24901      const autocompleteProps = {
24902        ...autocompleteRest,
24903        "aria-activedescendant": autocompleteActiveDescendant ?? void 0,
24904        "aria-autocomplete": autocompleteAriaAutocomplete
24905      };
24906      const focusOnMountRef = (0, import_compose12.useRefEffect)(
24907        (element) => {
24908          if (focusOnMount && !disabled2) {
24909            element.focus();
24910          }
24911        },
24912        [focusOnMount, disabled2]
24913      );
24914      const editableRef = (0, import_compose12.useMergeRefs)([
24915        richTextRef,
24916        anchorRef,
24917        eventListenersRef,
24918        enterRef,
24919        focusOnMountRef,
24920        popoverContainerRef,
24921        autocompleteRef
24922      ]);
24923      return (
24924        /*
24925         * The provider scopes every slot/fill rendered by this field — most
24926         * importantly the format popovers, which land in the `Popover.Slot`
24927         * below. That containment is what the blur handling above checks to
24928         * decide whether focus is still within the field's own UI. A format
24929         * popover using a custom `__unstableSlotName` would portal to the
24930         * body-level fallback container instead and deselect the field;
24931         * `core/link` (and every other core format) uses the default slot.
24932         */
24933        /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)(import_components42.SlotFillProvider, { children: [
24934          /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
24935            RichTextControlShell,
24936            {
24937              label,
24938              id,
24939              className: clsx_default("dataviews-controls__richtext", className),
24940              placeholder,
24941              hideLabelFromVision,
24942              help,
24943              disabled: disabled2,
24944              required,
24945              markWhenOptional,
24946              customValidity,
24947              value: value.text,
24948              "aria-multiline": !disableLineBreaks,
24949              ...autocompleteProps,
24950              ref: editableRef,
24951              onFocus: onEditableFocus,
24952              onBlur: onEditableBlur
24953            }
24954          ),
24955          isSelected2 && !disabled2 && /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(KeyboardShortcutContext.Provider, { value: keyboardShortcuts, children: /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(InputEventContext.Provider, { value: inputEvents, children: /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
24956            FormatEdit,
24957            {
24958              value,
24959              onChange: onRichTextChange,
24960              onFocus,
24961              formatTypes,
24962              forwardedRef: anchorRef,
24963              isVisible: true
24964            }
24965          ) }) }),
24966          popoverContainer && (0, import_element69.createPortal)(
24967            /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(import_components42.Popover.Slot, { ref: popoverSlotRef }),
24968            popoverContainer
24969          )
24970        ] })
24971      );
24972    }
24973  
24974    // packages/dataviews/build-module/components/dataform-controls/richtext/index.mjs
24975    var import_jsx_runtime112 = __toESM(require_jsx_runtime(), 1);
24976    function RichText({
24977      data,
24978      field,
24979      onChange,
24980      hideLabelFromVision,
24981      markWhenOptional,
24982      config,
24983      validity
24984    }) {
24985      const {
24986        className,
24987        clientId,
24988        allowedFormats,
24989        disableFormats,
24990        withoutInteractiveFormatting,
24991        preserveWhiteSpace,
24992        disableLineBreaks
24993      } = config || {};
24994      const disabled2 = field.isDisabled({ item: data, field });
24995      const { label, placeholder, description, id, setValue, isValid: isValid2 } = field;
24996      const value = field.getValue({ item: data }) ?? "";
24997      const onChangeControl = (0, import_element70.useCallback)(
24998        (newValue) => onChange(setValue({ item: data, value: newValue })),
24999        [data, onChange, setValue]
25000      );
25001      return /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
25002        RichTextControl,
25003        {
25004          label,
25005          value,
25006          onChange: onChangeControl,
25007          placeholder,
25008          id,
25009          hideLabelFromVision,
25010          help: description,
25011          disabled: disabled2,
25012          required: !!isValid2.required,
25013          markWhenOptional,
25014          customValidity: getCustomValidity(isValid2, validity),
25015          className,
25016          clientId,
25017          allowedFormats,
25018          disableFormats,
25019          withoutInteractiveFormatting,
25020          preserveWhiteSpace,
25021          disableLineBreaks
25022        }
25023      );
25024    }
25025  
25026    // packages/dataviews/build-module/components/dataform-controls/toggle-group.mjs
25027    var import_components43 = __toESM(require_components(), 1);
25028    var import_element71 = __toESM(require_element(), 1);
25029    var import_jsx_runtime113 = __toESM(require_jsx_runtime(), 1);
25030    var { ValidatedToggleGroupControl } = unlock2(import_components43.privateApis);
25031    function ToggleGroup({
25032      data,
25033      field,
25034      onChange,
25035      hideLabelFromVision,
25036      markWhenOptional,
25037      validity
25038    }) {
25039      const { getValue, setValue, isValid: isValid2 } = field;
25040      const disabled2 = field.isDisabled({ item: data, field });
25041      const value = getValue({ item: data });
25042      const onChangeControl = (0, import_element71.useCallback)(
25043        (newValue) => onChange(setValue({ item: data, value: newValue })),
25044        [data, onChange, setValue]
25045      );
25046      const { elements, isLoading } = useElements({
25047        elements: field.elements,
25048        getElements: field.getElements
25049      });
25050      if (isLoading) {
25051        return /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(import_components43.Spinner, {});
25052      }
25053      if (elements.length === 0) {
25054        return null;
25055      }
25056      const selectedOption = elements.find((el) => el.value === value);
25057      return /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
25058        ValidatedToggleGroupControl,
25059        {
25060          required: !!field.isValid?.required,
25061          markWhenOptional,
25062          customValidity: getCustomValidity(isValid2, validity),
25063          isBlock: true,
25064          label: field.label,
25065          help: selectedOption?.description || field.description,
25066          onChange: onChangeControl,
25067          value,
25068          hideLabelFromVision,
25069          children: elements.map((el) => /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
25070            import_components43.__experimentalToggleGroupControlOption,
25071            {
25072              label: el.label,
25073              value: el.value,
25074              disabled: disabled2
25075            },
25076            el.value
25077          ))
25078        }
25079      );
25080    }
25081  
25082    // packages/dataviews/build-module/components/dataform-controls/array.mjs
25083    var import_components44 = __toESM(require_components(), 1);
25084    var import_element72 = __toESM(require_element(), 1);
25085    var import_jsx_runtime114 = __toESM(require_jsx_runtime(), 1);
25086    var { ValidatedFormTokenField } = unlock2(import_components44.privateApis);
25087    function ArrayControl({
25088      data,
25089      field,
25090      onChange,
25091      hideLabelFromVision,
25092      markWhenOptional,
25093      validity
25094    }) {
25095      const { label, placeholder, description, getValue, setValue, isValid: isValid2 } = field;
25096      const value = getValue({ item: data });
25097      const disabled2 = field.isDisabled({ item: data, field });
25098      const { elements, isLoading } = useElements({
25099        elements: field.elements,
25100        getElements: field.getElements
25101      });
25102      const arrayValueAsElements = (0, import_element72.useMemo)(
25103        () => Array.isArray(value) ? value.map((token) => {
25104          const element = elements?.find(
25105            (suggestion) => suggestion.value === token
25106          );
25107          return element || { value: token, label: token };
25108        }) : [],
25109        [value, elements]
25110      );
25111      const onChangeControl = (0, import_element72.useCallback)(
25112        (tokens) => {
25113          const valueTokens = tokens.map((token) => {
25114            if (typeof token === "object" && "value" in token) {
25115              return token.value;
25116            }
25117            return token;
25118          });
25119          onChange(setValue({ item: data, value: valueTokens }));
25120        },
25121        [onChange, setValue, data]
25122      );
25123      if (isLoading) {
25124        return /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(import_components44.Spinner, {});
25125      }
25126      return /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
25127        ValidatedFormTokenField,
25128        {
25129          required: !!isValid2?.required,
25130          markWhenOptional,
25131          customValidity: getCustomValidity(isValid2, validity),
25132          label: hideLabelFromVision ? void 0 : label,
25133          value: arrayValueAsElements,
25134          onChange: onChangeControl,
25135          placeholder,
25136          suggestions: elements?.map((element) => element.value),
25137          disabled: disabled2,
25138          __experimentalValidateInput: (token) => {
25139            if (field.isValid?.elements && elements) {
25140              return elements.some(
25141                (element) => element.value === token || element.label === token
25142              );
25143            }
25144            return true;
25145          },
25146          __experimentalExpandOnFocus: elements && elements.length > 0,
25147          help: description ?? (field.isValid?.elements ? "" : void 0),
25148          displayTransform: (token) => {
25149            if (typeof token === "object" && "label" in token) {
25150              return token.label;
25151            }
25152            if (typeof token === "string" && elements) {
25153              const element = elements.find(
25154                (el) => el.value === token
25155              );
25156              return element?.label || token;
25157            }
25158            return token;
25159          },
25160          __experimentalRenderItem: ({ item }) => {
25161            if (typeof item === "string" && elements) {
25162              const element = elements.find(
25163                (el) => el.value === item
25164              );
25165              return /* @__PURE__ */ (0, import_jsx_runtime114.jsx)("span", { children: element?.label || item });
25166            }
25167            return /* @__PURE__ */ (0, import_jsx_runtime114.jsx)("span", { children: item });
25168          }
25169        }
25170      );
25171    }
25172  
25173    // node_modules/colord/index.mjs
25174    var r2 = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) };
25175    var t = function(r3) {
25176      return "string" == typeof r3 ? r3.length > 0 : "number" == typeof r3;
25177    };
25178    var n = function(r3, t2, n2) {
25179      return void 0 === t2 && (t2 = 0), void 0 === n2 && (n2 = Math.pow(10, t2)), Math.round(n2 * r3) / n2 + 0;
25180    };
25181    var e = function(r3, t2, n2) {
25182      return void 0 === t2 && (t2 = 0), void 0 === n2 && (n2 = 1), r3 > n2 ? n2 : r3 > t2 ? r3 : t2;
25183    };
25184    var u = function(r3) {
25185      return (r3 = isFinite(r3) ? r3 % 360 : 0) > 0 ? r3 : r3 + 360;
25186    };
25187    var a = function(r3) {
25188      return { r: e(r3.r, 0, 255), g: e(r3.g, 0, 255), b: e(r3.b, 0, 255), a: e(r3.a) };
25189    };
25190    var o = function(r3) {
25191      return { r: n(r3.r), g: n(r3.g), b: n(r3.b), a: n(r3.a, 3) };
25192    };
25193    var i = /^#([0-9a-f]{3,8})$/i;
25194    var s = function(r3) {
25195      var t2 = r3.toString(16);
25196      return t2.length < 2 ? "0" + t2 : t2;
25197    };
25198    var h = function(r3) {
25199      var t2 = r3.r, n2 = r3.g, e2 = r3.b, u2 = r3.a, a2 = Math.max(t2, n2, e2), o2 = a2 - Math.min(t2, n2, e2), i2 = o2 ? a2 === t2 ? (n2 - e2) / o2 : a2 === n2 ? 2 + (e2 - t2) / o2 : 4 + (t2 - n2) / o2 : 0;
25200      return { h: 60 * (i2 < 0 ? i2 + 6 : i2), s: a2 ? o2 / a2 * 100 : 0, v: a2 / 255 * 100, a: u2 };
25201    };
25202    var b = function(r3) {
25203      var t2 = r3.h, n2 = r3.s, e2 = r3.v, u2 = r3.a;
25204      t2 = t2 / 360 * 6, n2 /= 100, e2 /= 100;
25205      var a2 = Math.floor(t2), o2 = e2 * (1 - n2), i2 = e2 * (1 - (t2 - a2) * n2), s2 = e2 * (1 - (1 - t2 + a2) * n2), h2 = a2 % 6;
25206      return { r: 255 * [e2, i2, o2, o2, s2, e2][h2], g: 255 * [s2, e2, e2, i2, o2, o2][h2], b: 255 * [o2, o2, s2, e2, e2, i2][h2], a: u2 };
25207    };
25208    var g = function(r3) {
25209      return { h: u(r3.h), s: e(r3.s, 0, 100), l: e(r3.l, 0, 100), a: e(r3.a) };
25210    };
25211    var d = function(r3) {
25212      return { h: n(r3.h), s: n(r3.s), l: n(r3.l), a: n(r3.a, 3) };
25213    };
25214    var f = function(r3) {
25215      return b((n2 = (t2 = r3).s, { h: t2.h, s: (n2 *= ((e2 = t2.l) < 50 ? e2 : 100 - e2) / 100) > 0 ? 2 * n2 / (e2 + n2) * 100 : 0, v: e2 + n2, a: t2.a }));
25216      var t2, n2, e2;
25217    };
25218    var c = function(r3) {
25219      return { h: (t2 = h(r3)).h, s: (u2 = (200 - (n2 = t2.s)) * (e2 = t2.v) / 100) > 0 && u2 < 200 ? n2 * e2 / 100 / (u2 <= 100 ? u2 : 200 - u2) * 100 : 0, l: u2 / 2, a: t2.a };
25220      var t2, n2, e2, u2;
25221    };
25222    var l = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i;
25223    var p = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i;
25224    var v = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i;
25225    var m = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i;
25226    var y = { string: [[function(r3) {
25227      var t2 = i.exec(r3);
25228      return t2 ? (r3 = t2[1]).length <= 4 ? { r: parseInt(r3[0] + r3[0], 16), g: parseInt(r3[1] + r3[1], 16), b: parseInt(r3[2] + r3[2], 16), a: 4 === r3.length ? n(parseInt(r3[3] + r3[3], 16) / 255, 2) : 1 } : 6 === r3.length || 8 === r3.length ? { r: parseInt(r3.substr(0, 2), 16), g: parseInt(r3.substr(2, 2), 16), b: parseInt(r3.substr(4, 2), 16), a: 8 === r3.length ? n(parseInt(r3.substr(6, 2), 16) / 255, 2) : 1 } : null : null;
25229    }, "hex"], [function(r3) {
25230      var t2 = v.exec(r3) || m.exec(r3);
25231      return t2 ? t2[2] !== t2[4] || t2[4] !== t2[6] ? null : a({ r: Number(t2[1]) / (t2[2] ? 100 / 255 : 1), g: Number(t2[3]) / (t2[4] ? 100 / 255 : 1), b: Number(t2[5]) / (t2[6] ? 100 / 255 : 1), a: void 0 === t2[7] ? 1 : Number(t2[7]) / (t2[8] ? 100 : 1) }) : null;
25232    }, "rgb"], [function(t2) {
25233      var n2 = l.exec(t2) || p.exec(t2);
25234      if (!n2) return null;
25235      var e2, u2, a2 = g({ h: (e2 = n2[1], u2 = n2[2], void 0 === u2 && (u2 = "deg"), Number(e2) * (r2[u2] || 1)), s: Number(n2[3]), l: Number(n2[4]), a: void 0 === n2[5] ? 1 : Number(n2[5]) / (n2[6] ? 100 : 1) });
25236      return f(a2);
25237    }, "hsl"]], object: [[function(r3) {
25238      var n2 = r3.r, e2 = r3.g, u2 = r3.b, o2 = r3.a, i2 = void 0 === o2 ? 1 : o2;
25239      return t(n2) && t(e2) && t(u2) ? a({ r: Number(n2), g: Number(e2), b: Number(u2), a: Number(i2) }) : null;
25240    }, "rgb"], [function(r3) {
25241      var n2 = r3.h, e2 = r3.s, u2 = r3.l, a2 = r3.a, o2 = void 0 === a2 ? 1 : a2;
25242      if (!t(n2) || !t(e2) || !t(u2)) return null;
25243      var i2 = g({ h: Number(n2), s: Number(e2), l: Number(u2), a: Number(o2) });
25244      return f(i2);
25245    }, "hsl"], [function(r3) {
25246      var n2 = r3.h, a2 = r3.s, o2 = r3.v, i2 = r3.a, s2 = void 0 === i2 ? 1 : i2;
25247      if (!t(n2) || !t(a2) || !t(o2)) return null;
25248      var h2 = (function(r4) {
25249        return { h: u(r4.h), s: e(r4.s, 0, 100), v: e(r4.v, 0, 100), a: e(r4.a) };
25250      })({ h: Number(n2), s: Number(a2), v: Number(o2), a: Number(s2) });
25251      return b(h2);
25252    }, "hsv"]] };
25253    var N = function(r3, t2) {
25254      for (var n2 = 0; n2 < t2.length; n2++) {
25255        var e2 = t2[n2][0](r3);
25256        if (e2) return [e2, t2[n2][1]];
25257      }
25258      return [null, void 0];
25259    };
25260    var x = function(r3) {
25261      return "string" == typeof r3 ? N(r3.trim(), y.string) : "object" == typeof r3 && null !== r3 ? N(r3, y.object) : [null, void 0];
25262    };
25263    var M = function(r3, t2) {
25264      var n2 = c(r3);
25265      return { h: n2.h, s: e(n2.s + 100 * t2, 0, 100), l: n2.l, a: n2.a };
25266    };
25267    var H = function(r3) {
25268      return (299 * r3.r + 587 * r3.g + 114 * r3.b) / 1e3 / 255;
25269    };
25270    var $ = function(r3, t2) {
25271      var n2 = c(r3);
25272      return { h: n2.h, s: n2.s, l: e(n2.l + 100 * t2, 0, 100), a: n2.a };
25273    };
25274    var j = (function() {
25275      function r3(r4) {
25276        this.parsed = x(r4)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 };
25277      }
25278      return r3.prototype.isValid = function() {
25279        return null !== this.parsed;
25280      }, r3.prototype.brightness = function() {
25281        return n(H(this.rgba), 2);
25282      }, r3.prototype.isDark = function() {
25283        return H(this.rgba) < 0.5;
25284      }, r3.prototype.isLight = function() {
25285        return H(this.rgba) >= 0.5;
25286      }, r3.prototype.toHex = function() {
25287        return r4 = o(this.rgba), t2 = r4.r, e2 = r4.g, u2 = r4.b, i2 = (a2 = r4.a) < 1 ? s(n(255 * a2)) : "", "#" + s(t2) + s(e2) + s(u2) + i2;
25288        var r4, t2, e2, u2, a2, i2;
25289      }, r3.prototype.toRgb = function() {
25290        return o(this.rgba);
25291      }, r3.prototype.toRgbString = function() {
25292        return r4 = o(this.rgba), t2 = r4.r, n2 = r4.g, e2 = r4.b, (u2 = r4.a) < 1 ? "rgba(" + t2 + ", " + n2 + ", " + e2 + ", " + u2 + ")" : "rgb(" + t2 + ", " + n2 + ", " + e2 + ")";
25293        var r4, t2, n2, e2, u2;
25294      }, r3.prototype.toHsl = function() {
25295        return d(c(this.rgba));
25296      }, r3.prototype.toHslString = function() {
25297        return r4 = d(c(this.rgba)), t2 = r4.h, n2 = r4.s, e2 = r4.l, (u2 = r4.a) < 1 ? "hsla(" + t2 + ", " + n2 + "%, " + e2 + "%, " + u2 + ")" : "hsl(" + t2 + ", " + n2 + "%, " + e2 + "%)";
25298        var r4, t2, n2, e2, u2;
25299      }, r3.prototype.toHsv = function() {
25300        return r4 = h(this.rgba), { h: n(r4.h), s: n(r4.s), v: n(r4.v), a: n(r4.a, 3) };
25301        var r4;
25302      }, r3.prototype.invert = function() {
25303        return w({ r: 255 - (r4 = this.rgba).r, g: 255 - r4.g, b: 255 - r4.b, a: r4.a });
25304        var r4;
25305      }, r3.prototype.saturate = function(r4) {
25306        return void 0 === r4 && (r4 = 0.1), w(M(this.rgba, r4));
25307      }, r3.prototype.desaturate = function(r4) {
25308        return void 0 === r4 && (r4 = 0.1), w(M(this.rgba, -r4));
25309      }, r3.prototype.grayscale = function() {
25310        return w(M(this.rgba, -1));
25311      }, r3.prototype.lighten = function(r4) {
25312        return void 0 === r4 && (r4 = 0.1), w($(this.rgba, r4));
25313      }, r3.prototype.darken = function(r4) {
25314        return void 0 === r4 && (r4 = 0.1), w($(this.rgba, -r4));
25315      }, r3.prototype.rotate = function(r4) {
25316        return void 0 === r4 && (r4 = 15), this.hue(this.hue() + r4);
25317      }, r3.prototype.alpha = function(r4) {
25318        return "number" == typeof r4 ? w({ r: (t2 = this.rgba).r, g: t2.g, b: t2.b, a: r4 }) : n(this.rgba.a, 3);
25319        var t2;
25320      }, r3.prototype.hue = function(r4) {
25321        var t2 = c(this.rgba);
25322        return "number" == typeof r4 ? w({ h: r4, s: t2.s, l: t2.l, a: t2.a }) : n(t2.h);
25323      }, r3.prototype.isEqual = function(r4) {
25324        return this.toHex() === w(r4).toHex();
25325      }, r3;
25326    })();
25327    var w = function(r3) {
25328      return r3 instanceof j ? r3 : new j(r3);
25329    };
25330  
25331    // packages/dataviews/build-module/components/dataform-controls/color.mjs
25332    var import_components45 = __toESM(require_components(), 1);
25333    var import_element73 = __toESM(require_element(), 1);
25334    var import_i18n43 = __toESM(require_i18n(), 1);
25335    var import_jsx_runtime115 = __toESM(require_jsx_runtime(), 1);
25336    var { ValidatedInputControl: ValidatedInputControl3 } = unlock2(import_components45.privateApis);
25337    var ColorPickerDropdown = ({
25338      color,
25339      onColorChange,
25340      disabled: disabled2
25341    }) => {
25342      const validColor = color && w(color).isValid() ? color : "#ffffff";
25343      return /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
25344        import_components45.Dropdown,
25345        {
25346          className: "dataviews-controls__color-picker-dropdown",
25347          popoverProps: { resize: false },
25348          renderToggle: ({ onToggle }) => /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
25349            import_components45.Button,
25350            {
25351              onClick: onToggle,
25352              "aria-label": (0, import_i18n43.__)("Open color picker"),
25353              size: "small",
25354              disabled: disabled2,
25355              accessibleWhenDisabled: true,
25356              icon: () => /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(import_components45.ColorIndicator, { colorValue: validColor })
25357            }
25358          ),
25359          renderContent: () => /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(import_components45.__experimentalDropdownContentWrapper, { paddingSize: "none", children: /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
25360            import_components45.ColorPicker,
25361            {
25362              color: validColor,
25363              onChange: onColorChange,
25364              enableAlpha: true
25365            }
25366          ) })
25367        }
25368      );
25369    };
25370    function Color({
25371      data,
25372      field,
25373      onChange,
25374      hideLabelFromVision,
25375      markWhenOptional,
25376      validity
25377    }) {
25378      const { label, placeholder, description, setValue, isValid: isValid2 } = field;
25379      const disabled2 = field.isDisabled({ item: data, field });
25380      const value = field.getValue({ item: data }) || "";
25381      const handleColorChange = (0, import_element73.useCallback)(
25382        (newColor) => {
25383          onChange(setValue({ item: data, value: newColor }));
25384        },
25385        [data, onChange, setValue]
25386      );
25387      const handleInputChange = (0, import_element73.useCallback)(
25388        (newValue) => {
25389          onChange(setValue({ item: data, value: newValue || "" }));
25390        },
25391        [data, onChange, setValue]
25392      );
25393      return /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
25394        ValidatedInputControl3,
25395        {
25396          required: !!field.isValid?.required,
25397          markWhenOptional,
25398          customValidity: getCustomValidity(isValid2, validity),
25399          label,
25400          placeholder,
25401          value,
25402          help: description,
25403          onChange: handleInputChange,
25404          hideLabelFromVision,
25405          type: "text",
25406          disabled: disabled2,
25407          prefix: /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(import_components45.__experimentalInputControlPrefixWrapper, { variant: "control", children: /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
25408            ColorPickerDropdown,
25409            {
25410              color: value,
25411              onColorChange: handleColorChange,
25412              disabled: disabled2
25413            }
25414          ) })
25415        }
25416      );
25417    }
25418  
25419    // packages/dataviews/build-module/components/dataform-controls/password.mjs
25420    var import_components46 = __toESM(require_components(), 1);
25421    var import_element74 = __toESM(require_element(), 1);
25422    var import_i18n44 = __toESM(require_i18n(), 1);
25423    var import_jsx_runtime116 = __toESM(require_jsx_runtime(), 1);
25424    function Password({
25425      data,
25426      field,
25427      onChange,
25428      hideLabelFromVision,
25429      markWhenOptional,
25430      validity
25431    }) {
25432      const [isVisible2, setIsVisible] = (0, import_element74.useState)(false);
25433      const disabled2 = field.isDisabled({ item: data, field });
25434      const toggleVisibility = (0, import_element74.useCallback)(() => {
25435        setIsVisible((prev) => !prev);
25436      }, []);
25437      return /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
25438        ValidatedText,
25439        {
25440          ...{
25441            data,
25442            field,
25443            onChange,
25444            hideLabelFromVision,
25445            markWhenOptional,
25446            validity,
25447            type: isVisible2 ? "text" : "password",
25448            suffix: /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(import_components46.__experimentalInputControlSuffixWrapper, { variant: "control", children: /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
25449              import_components46.Button,
25450              {
25451                icon: isVisible2 ? unseen_default : seen_default,
25452                onClick: toggleVisibility,
25453                size: "small",
25454                label: isVisible2 ? (0, import_i18n44.__)("Hide password") : (0, import_i18n44.__)("Show password"),
25455                disabled: disabled2,
25456                accessibleWhenDisabled: true
25457              }
25458            ) })
25459          }
25460        }
25461      );
25462    }
25463  
25464    // packages/dataviews/build-module/field-types/utils/has-elements.mjs
25465    function hasElements(field) {
25466      return Array.isArray(field.elements) && field.elements.length > 0 || typeof field.getElements === "function";
25467    }
25468  
25469    // packages/dataviews/build-module/components/dataform-controls/index.mjs
25470    var import_jsx_runtime117 = __toESM(require_jsx_runtime(), 1);
25471    var FORM_CONTROLS = {
25472      adaptiveSelect: AdaptiveSelect,
25473      array: ArrayControl,
25474      checkbox: Checkbox,
25475      color: Color,
25476      combobox: Combobox3,
25477      datetime: DateTime,
25478      date: DateControl,
25479      email: Email,
25480      telephone: Telephone,
25481      url: Url,
25482      integer: Integer,
25483      number: Number2,
25484      password: Password,
25485      radio: Radio,
25486      select: Select,
25487      text: Text,
25488      toggle: Toggle,
25489      textarea: Textarea,
25490      richtext: RichText,
25491      toggleGroup: ToggleGroup
25492    };
25493    function isEditConfig(value) {
25494      return value && typeof value === "object" && typeof value.control === "string";
25495    }
25496    function createConfiguredControl(config) {
25497      const { control, ...controlConfig } = config;
25498      const BaseControlType = getControlByType(control);
25499      if (BaseControlType === null) {
25500        return null;
25501      }
25502      return function ConfiguredControl(props) {
25503        return /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(BaseControlType, { ...props, config: controlConfig });
25504      };
25505    }
25506    function getControl(field, fallback) {
25507      if (typeof field.Edit === "function") {
25508        return field.Edit;
25509      }
25510      if (typeof field.Edit === "string") {
25511        return getControlByType(field.Edit);
25512      }
25513      if (isEditConfig(field.Edit)) {
25514        return createConfiguredControl(field.Edit);
25515      }
25516      if (hasElements(field) && field.type !== "array") {
25517        return getControlByType("adaptiveSelect");
25518      }
25519      if (fallback === null) {
25520        return null;
25521      }
25522      return getControlByType(fallback);
25523    }
25524    function getControlByType(type) {
25525      if (Object.keys(FORM_CONTROLS).includes(type)) {
25526        return FORM_CONTROLS[type];
25527      }
25528      return null;
25529    }
25530  
25531    // packages/dataviews/build-module/field-types/utils/get-filter-by.mjs
25532    function getFilterBy(field, defaultOperators, validOperators) {
25533      if (field.filterBy === false) {
25534        return false;
25535      }
25536      const operators = field.filterBy?.operators?.filter(
25537        (op) => validOperators.includes(op)
25538      ) ?? defaultOperators;
25539      if (operators.length === 0) {
25540        return false;
25541      }
25542      return {
25543        isPrimary: !!field.filterBy?.isPrimary,
25544        operators
25545      };
25546    }
25547    var get_filter_by_default = getFilterBy;
25548  
25549    // packages/dataviews/build-module/field-types/utils/get-value-from-id.mjs
25550    var getValueFromId = (id) => ({ item }) => {
25551      const path = id.split(".");
25552      let value = item;
25553      for (const segment of path) {
25554        if (value.hasOwnProperty(segment)) {
25555          value = value[segment];
25556        } else {
25557          value = void 0;
25558        }
25559      }
25560      return value;
25561    };
25562    var get_value_from_id_default = getValueFromId;
25563  
25564    // packages/dataviews/build-module/field-types/utils/set-value-from-id.mjs
25565    var setValueFromId = (id) => ({ value }) => {
25566      const path = id.split(".");
25567      const result = {};
25568      let current = result;
25569      for (const segment of path.slice(0, -1)) {
25570        current[segment] = {};
25571        current = current[segment];
25572      }
25573      current[path.at(-1)] = value;
25574      return result;
25575    };
25576    var set_value_from_id_default = setValueFromId;
25577  
25578    // packages/dataviews/build-module/field-types/email.mjs
25579    var import_i18n45 = __toESM(require_i18n(), 1);
25580  
25581    // packages/dataviews/build-module/field-types/utils/render-from-elements.mjs
25582    function RenderFromElements({
25583      item,
25584      field
25585    }) {
25586      const { elements, isLoading } = useElements({
25587        elements: field.elements,
25588        getElements: field.getElements
25589      });
25590      const value = field.getValue({ item });
25591      if (isLoading) {
25592        return value;
25593      }
25594      if (elements.length === 0) {
25595        return value;
25596      }
25597      return elements?.find((element) => element.value === value)?.label || field.getValue({ item });
25598    }
25599  
25600    // packages/dataviews/build-module/field-types/utils/render-default.mjs
25601    var import_jsx_runtime118 = __toESM(require_jsx_runtime(), 1);
25602    function render({
25603      item,
25604      field
25605    }) {
25606      if (field.hasElements) {
25607        return /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(RenderFromElements, { item, field });
25608      }
25609      return field.getValueFormatted({ item, field });
25610    }
25611  
25612    // packages/dataviews/build-module/field-types/utils/sort-text.mjs
25613    var sort_text_default = (a2, b2, direction) => {
25614      return direction === "asc" ? a2.localeCompare(b2) : b2.localeCompare(a2);
25615    };
25616  
25617    // packages/dataviews/build-module/field-types/utils/is-valid-required.mjs
25618    function isValidRequired(item, field) {
25619      const value = field.getValue({ item });
25620      return ![void 0, "", null].includes(value);
25621    }
25622  
25623    // packages/dataviews/build-module/field-types/utils/is-valid-min-length.mjs
25624    function isValidMinLength(item, field) {
25625      if (typeof field.isValid.minLength?.constraint !== "number") {
25626        return false;
25627      }
25628      const value = field.getValue({ item });
25629      if ([void 0, "", null].includes(value)) {
25630        return true;
25631      }
25632      return String(value).length >= field.isValid.minLength.constraint;
25633    }
25634  
25635    // packages/dataviews/build-module/field-types/utils/is-valid-max-length.mjs
25636    function isValidMaxLength(item, field) {
25637      if (typeof field.isValid.maxLength?.constraint !== "number") {
25638        return false;
25639      }
25640      const value = field.getValue({ item });
25641      if ([void 0, "", null].includes(value)) {
25642        return true;
25643      }
25644      return String(value).length <= field.isValid.maxLength.constraint;
25645    }
25646  
25647    // packages/dataviews/build-module/field-types/utils/is-valid-pattern.mjs
25648    function isValidPattern(item, field) {
25649      if (field.isValid.pattern?.constraint === void 0) {
25650        return true;
25651      }
25652      try {
25653        const regexp = new RegExp(field.isValid.pattern.constraint);
25654        const value = field.getValue({ item });
25655        if ([void 0, "", null].includes(value)) {
25656          return true;
25657        }
25658        return regexp.test(String(value));
25659      } catch {
25660        return false;
25661      }
25662    }
25663  
25664    // packages/dataviews/build-module/field-types/utils/is-valid-elements.mjs
25665    function isValidElements(item, field) {
25666      const elements = field.elements ?? [];
25667      const validValues = elements.map((el) => el.value);
25668      if (validValues.length === 0) {
25669        return true;
25670      }
25671      const value = field.getValue({ item });
25672      return [].concat(value).every((v2) => validValues.includes(v2));
25673    }
25674  
25675    // packages/dataviews/build-module/field-types/utils/get-value-formatted-default.mjs
25676    function getValueFormatted({
25677      item,
25678      field
25679    }) {
25680      return field.getValue({ item });
25681    }
25682    var get_value_formatted_default_default = getValueFormatted;
25683  
25684    // packages/dataviews/build-module/field-types/email.mjs
25685    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])?)*$/;
25686    function isValidCustom(item, field) {
25687      const value = field.getValue({ item });
25688      if (![void 0, "", null].includes(value) && !emailRegex.test(value)) {
25689        return (0, import_i18n45.__)("Value must be a valid email address.");
25690      }
25691      return null;
25692    }
25693    var email_default = {
25694      type: "email",
25695      render,
25696      Edit: "email",
25697      sort: sort_text_default,
25698      enableSorting: true,
25699      enableGlobalSearch: false,
25700      defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE],
25701      validOperators: [
25702        OPERATOR_IS,
25703        OPERATOR_IS_NOT,
25704        OPERATOR_CONTAINS,
25705        OPERATOR_NOT_CONTAINS,
25706        OPERATOR_STARTS_WITH,
25707        // Multiple selection
25708        OPERATOR_IS_ANY,
25709        OPERATOR_IS_NONE,
25710        OPERATOR_IS_ALL,
25711        OPERATOR_IS_NOT_ALL
25712      ],
25713      format: {},
25714      getValueFormatted: get_value_formatted_default_default,
25715      validate: {
25716        required: isValidRequired,
25717        pattern: isValidPattern,
25718        minLength: isValidMinLength,
25719        maxLength: isValidMaxLength,
25720        elements: isValidElements,
25721        custom: isValidCustom
25722      }
25723    };
25724  
25725    // packages/dataviews/build-module/field-types/integer.mjs
25726    var import_i18n46 = __toESM(require_i18n(), 1);
25727  
25728    // packages/dataviews/build-module/field-types/utils/sort-number.mjs
25729    var sort_number_default = (a2, b2, direction) => {
25730      return direction === "asc" ? a2 - b2 : b2 - a2;
25731    };
25732  
25733    // packages/dataviews/build-module/field-types/utils/is-valid-min.mjs
25734    function isValidMin(item, field) {
25735      if (typeof field.isValid.min?.constraint !== "number") {
25736        return false;
25737      }
25738      const value = field.getValue({ item });
25739      if ([void 0, "", null].includes(value)) {
25740        return true;
25741      }
25742      return Number(value) >= field.isValid.min.constraint;
25743    }
25744  
25745    // packages/dataviews/build-module/field-types/utils/is-valid-max.mjs
25746    function isValidMax(item, field) {
25747      if (typeof field.isValid.max?.constraint !== "number") {
25748        return false;
25749      }
25750      const value = field.getValue({ item });
25751      if ([void 0, "", null].includes(value)) {
25752        return true;
25753      }
25754      return Number(value) <= field.isValid.max.constraint;
25755    }
25756  
25757    // packages/dataviews/build-module/field-types/integer.mjs
25758    var format2 = {
25759      separatorThousand: ","
25760    };
25761    function getValueFormatted2({
25762      item,
25763      field
25764    }) {
25765      let value = field.getValue({ item });
25766      if (value === null || value === void 0) {
25767        return "";
25768      }
25769      value = Number(value);
25770      if (!Number.isFinite(value)) {
25771        return String(value);
25772      }
25773      let formatInteger;
25774      if (field.type !== "integer") {
25775        formatInteger = format2;
25776      } else {
25777        formatInteger = field.format;
25778      }
25779      const { separatorThousand } = formatInteger;
25780      const integerValue = Math.trunc(value);
25781      if (!separatorThousand) {
25782        return String(integerValue);
25783      }
25784      return String(integerValue).replace(
25785        /\B(?=(\d{3})+(?!\d))/g,
25786        separatorThousand
25787      );
25788    }
25789    function isValidCustom2(item, field) {
25790      const value = field.getValue({ item });
25791      if (![void 0, "", null].includes(value) && !Number.isInteger(value)) {
25792        return (0, import_i18n46.__)("Value must be an integer.");
25793      }
25794      return null;
25795    }
25796    var integer_default = {
25797      type: "integer",
25798      render,
25799      Edit: "integer",
25800      sort: sort_number_default,
25801      enableSorting: true,
25802      enableGlobalSearch: false,
25803      defaultOperators: [
25804        OPERATOR_IS,
25805        OPERATOR_IS_NOT,
25806        OPERATOR_LESS_THAN,
25807        OPERATOR_GREATER_THAN,
25808        OPERATOR_LESS_THAN_OR_EQUAL,
25809        OPERATOR_GREATER_THAN_OR_EQUAL,
25810        OPERATOR_BETWEEN
25811      ],
25812      validOperators: [
25813        // Single-selection
25814        OPERATOR_IS,
25815        OPERATOR_IS_NOT,
25816        OPERATOR_LESS_THAN,
25817        OPERATOR_GREATER_THAN,
25818        OPERATOR_LESS_THAN_OR_EQUAL,
25819        OPERATOR_GREATER_THAN_OR_EQUAL,
25820        OPERATOR_BETWEEN,
25821        // Multiple-selection
25822        OPERATOR_IS_ANY,
25823        OPERATOR_IS_NONE,
25824        OPERATOR_IS_ALL,
25825        OPERATOR_IS_NOT_ALL
25826      ],
25827      format: format2,
25828      getValueFormatted: getValueFormatted2,
25829      validate: {
25830        required: isValidRequired,
25831        min: isValidMin,
25832        max: isValidMax,
25833        elements: isValidElements,
25834        custom: isValidCustom2
25835      }
25836    };
25837  
25838    // packages/dataviews/build-module/field-types/number.mjs
25839    var import_i18n47 = __toESM(require_i18n(), 1);
25840    var format3 = {
25841      separatorThousand: ",",
25842      separatorDecimal: ".",
25843      decimals: 2
25844    };
25845    function getValueFormatted3({
25846      item,
25847      field
25848    }) {
25849      let value = field.getValue({ item });
25850      if (value === null || value === void 0) {
25851        return "";
25852      }
25853      value = Number(value);
25854      if (!Number.isFinite(value)) {
25855        return String(value);
25856      }
25857      let formatNumber;
25858      if (field.type !== "number") {
25859        formatNumber = format3;
25860      } else {
25861        formatNumber = field.format;
25862      }
25863      const { separatorThousand, separatorDecimal, decimals } = formatNumber;
25864      const fixedValue = value.toFixed(decimals);
25865      const [integerPart, decimalPart] = fixedValue.split(".");
25866      const formattedInteger = separatorThousand ? integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, separatorThousand) : integerPart;
25867      return decimals === 0 ? formattedInteger : formattedInteger + separatorDecimal + decimalPart;
25868    }
25869    function isEmpty(value) {
25870      return value === "" || value === void 0 || value === null;
25871    }
25872    function isValidCustom3(item, field) {
25873      const value = field.getValue({ item });
25874      if (!isEmpty(value) && !Number.isFinite(value)) {
25875        return (0, import_i18n47.__)("Value must be a number.");
25876      }
25877      return null;
25878    }
25879    var number_default = {
25880      type: "number",
25881      render,
25882      Edit: "number",
25883      sort: sort_number_default,
25884      enableSorting: true,
25885      enableGlobalSearch: false,
25886      defaultOperators: [
25887        OPERATOR_IS,
25888        OPERATOR_IS_NOT,
25889        OPERATOR_LESS_THAN,
25890        OPERATOR_GREATER_THAN,
25891        OPERATOR_LESS_THAN_OR_EQUAL,
25892        OPERATOR_GREATER_THAN_OR_EQUAL,
25893        OPERATOR_BETWEEN
25894      ],
25895      validOperators: [
25896        // Single-selection
25897        OPERATOR_IS,
25898        OPERATOR_IS_NOT,
25899        OPERATOR_LESS_THAN,
25900        OPERATOR_GREATER_THAN,
25901        OPERATOR_LESS_THAN_OR_EQUAL,
25902        OPERATOR_GREATER_THAN_OR_EQUAL,
25903        OPERATOR_BETWEEN,
25904        // Multiple-selection
25905        OPERATOR_IS_ANY,
25906        OPERATOR_IS_NONE,
25907        OPERATOR_IS_ALL,
25908        OPERATOR_IS_NOT_ALL
25909      ],
25910      format: format3,
25911      getValueFormatted: getValueFormatted3,
25912      validate: {
25913        required: isValidRequired,
25914        min: isValidMin,
25915        max: isValidMax,
25916        elements: isValidElements,
25917        custom: isValidCustom3
25918      }
25919    };
25920  
25921    // packages/dataviews/build-module/field-types/text.mjs
25922    var text_default = {
25923      type: "text",
25924      render,
25925      Edit: "text",
25926      sort: sort_text_default,
25927      enableSorting: true,
25928      enableGlobalSearch: false,
25929      defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE],
25930      validOperators: [
25931        // Single selection
25932        OPERATOR_IS,
25933        OPERATOR_IS_NOT,
25934        OPERATOR_CONTAINS,
25935        OPERATOR_NOT_CONTAINS,
25936        OPERATOR_STARTS_WITH,
25937        // Multiple selection
25938        OPERATOR_IS_ANY,
25939        OPERATOR_IS_NONE,
25940        OPERATOR_IS_ALL,
25941        OPERATOR_IS_NOT_ALL
25942      ],
25943      format: {},
25944      getValueFormatted: get_value_formatted_default_default,
25945      validate: {
25946        required: isValidRequired,
25947        pattern: isValidPattern,
25948        minLength: isValidMinLength,
25949        maxLength: isValidMaxLength,
25950        elements: isValidElements
25951      }
25952    };
25953  
25954    // packages/dataviews/build-module/field-types/datetime.mjs
25955    var import_date7 = __toESM(require_date(), 1);
25956  
25957    // packages/dataviews/build-module/field-types/utils/is-valid-date-boundary.mjs
25958    var import_date6 = __toESM(require_date(), 1);
25959    function parseDateLike(value) {
25960      if (!value) {
25961        return null;
25962      }
25963      if (!isValid(new Date(value))) {
25964        return null;
25965      }
25966      const parsed = (0, import_date6.getDate)(value);
25967      return parsed && isValid(parsed) ? parsed : null;
25968    }
25969    function validateDateLikeBoundary(item, field, boundary) {
25970      const constraint = field.isValid[boundary]?.constraint;
25971      if (typeof constraint !== "string") {
25972        return false;
25973      }
25974      const value = field.getValue({ item });
25975      const boundaryValue = Array.isArray(value) ? value[boundary === "min" ? 0 : value.length - 1] : value;
25976      if (boundaryValue === void 0 || boundaryValue === null || boundaryValue === "") {
25977        return true;
25978      }
25979      const parsedConstraint = parseDateLike(constraint);
25980      const parsedValue = parseDateLike(String(boundaryValue));
25981      return !!parsedConstraint && !!parsedValue && (boundary === "min" ? parsedValue.getTime() >= parsedConstraint.getTime() : parsedValue.getTime() <= parsedConstraint.getTime());
25982    }
25983    function isValidMinDate(item, field) {
25984      return validateDateLikeBoundary(item, field, "min");
25985    }
25986    function isValidMaxDate(item, field) {
25987      return validateDateLikeBoundary(item, field, "max");
25988    }
25989  
25990    // packages/dataviews/build-module/field-types/datetime.mjs
25991    var format4 = {
25992      datetime: (0, import_date7.getSettings)().formats.datetime,
25993      weekStartsOn: (0, import_date7.getSettings)().l10n.startOfWeek
25994    };
25995    function getValueFormatted4({
25996      item,
25997      field
25998    }) {
25999      const value = field.getValue({ item });
26000      if (["", void 0, null].includes(value)) {
26001        return "";
26002      }
26003      let formatDatetime;
26004      if (field.type !== "datetime") {
26005        formatDatetime = format4;
26006      } else {
26007        formatDatetime = field.format;
26008      }
26009      return (0, import_date7.dateI18n)(formatDatetime.datetime, (0, import_date7.getDate)(value));
26010    }
26011    var sort = (a2, b2, direction) => {
26012      const timeA = new Date(a2).getTime();
26013      const timeB = new Date(b2).getTime();
26014      return direction === "asc" ? timeA - timeB : timeB - timeA;
26015    };
26016    var datetime_default = {
26017      type: "datetime",
26018      render,
26019      Edit: "datetime",
26020      sort,
26021      enableSorting: true,
26022      enableGlobalSearch: false,
26023      defaultOperators: [
26024        OPERATOR_ON,
26025        OPERATOR_NOT_ON,
26026        OPERATOR_BEFORE,
26027        OPERATOR_AFTER,
26028        OPERATOR_BEFORE_INC,
26029        OPERATOR_AFTER_INC,
26030        OPERATOR_IN_THE_PAST,
26031        OPERATOR_OVER
26032      ],
26033      validOperators: [
26034        OPERATOR_ON,
26035        OPERATOR_NOT_ON,
26036        OPERATOR_BEFORE,
26037        OPERATOR_AFTER,
26038        OPERATOR_BEFORE_INC,
26039        OPERATOR_AFTER_INC,
26040        OPERATOR_IN_THE_PAST,
26041        OPERATOR_OVER
26042      ],
26043      format: format4,
26044      getValueFormatted: getValueFormatted4,
26045      validate: {
26046        required: isValidRequired,
26047        elements: isValidElements,
26048        min: isValidMinDate,
26049        max: isValidMaxDate
26050      }
26051    };
26052  
26053    // packages/dataviews/build-module/field-types/date.mjs
26054    var import_date8 = __toESM(require_date(), 1);
26055    var format5 = {
26056      date: (0, import_date8.getSettings)().formats.date,
26057      weekStartsOn: (0, import_date8.getSettings)().l10n.startOfWeek
26058    };
26059    function getValueFormatted5({
26060      item,
26061      field
26062    }) {
26063      const value = field.getValue({ item });
26064      if (["", void 0, null].includes(value)) {
26065        return "";
26066      }
26067      let formatDate2;
26068      if (field.type !== "date") {
26069        formatDate2 = format5;
26070      } else {
26071        formatDate2 = field.format;
26072      }
26073      return (0, import_date8.dateI18n)(formatDate2.date, (0, import_date8.getDate)(value));
26074    }
26075    var sort2 = (a2, b2, direction) => {
26076      const timeA = new Date(a2).getTime();
26077      const timeB = new Date(b2).getTime();
26078      return direction === "asc" ? timeA - timeB : timeB - timeA;
26079    };
26080    var date_default = {
26081      type: "date",
26082      render,
26083      Edit: "date",
26084      sort: sort2,
26085      enableSorting: true,
26086      enableGlobalSearch: false,
26087      defaultOperators: [
26088        OPERATOR_ON,
26089        OPERATOR_NOT_ON,
26090        OPERATOR_BEFORE,
26091        OPERATOR_AFTER,
26092        OPERATOR_BEFORE_INC,
26093        OPERATOR_AFTER_INC,
26094        OPERATOR_IN_THE_PAST,
26095        OPERATOR_OVER,
26096        OPERATOR_BETWEEN
26097      ],
26098      validOperators: [
26099        OPERATOR_ON,
26100        OPERATOR_NOT_ON,
26101        OPERATOR_BEFORE,
26102        OPERATOR_AFTER,
26103        OPERATOR_BEFORE_INC,
26104        OPERATOR_AFTER_INC,
26105        OPERATOR_IN_THE_PAST,
26106        OPERATOR_OVER,
26107        OPERATOR_BETWEEN
26108      ],
26109      format: format5,
26110      getValueFormatted: getValueFormatted5,
26111      validate: {
26112        required: isValidRequired,
26113        elements: isValidElements,
26114        min: isValidMinDate,
26115        max: isValidMaxDate
26116      }
26117    };
26118  
26119    // packages/dataviews/build-module/field-types/boolean.mjs
26120    var import_i18n48 = __toESM(require_i18n(), 1);
26121  
26122    // packages/dataviews/build-module/field-types/utils/is-valid-required-for-bool.mjs
26123    function isValidRequiredForBool(item, field) {
26124      const value = field.getValue({ item });
26125      return value === true;
26126    }
26127  
26128    // packages/dataviews/build-module/field-types/boolean.mjs
26129    function getValueFormatted6({
26130      item,
26131      field
26132    }) {
26133      const value = field.getValue({ item });
26134      if (value === true) {
26135        return (0, import_i18n48.__)("True");
26136      }
26137      if (value === false) {
26138        return (0, import_i18n48.__)("False");
26139      }
26140      return "";
26141    }
26142    function isValidCustom4(item, field) {
26143      const value = field.getValue({ item });
26144      if (![void 0, "", null].includes(value) && ![true, false].includes(value)) {
26145        return (0, import_i18n48.__)("Value must be true, false, or undefined");
26146      }
26147      return null;
26148    }
26149    var sort3 = (a2, b2, direction) => {
26150      const boolA = Boolean(a2);
26151      const boolB = Boolean(b2);
26152      if (boolA === boolB) {
26153        return 0;
26154      }
26155      if (direction === "asc") {
26156        return boolA ? 1 : -1;
26157      }
26158      return boolA ? -1 : 1;
26159    };
26160    var boolean_default = {
26161      type: "boolean",
26162      render,
26163      Edit: "checkbox",
26164      sort: sort3,
26165      validate: {
26166        required: isValidRequiredForBool,
26167        elements: isValidElements,
26168        custom: isValidCustom4
26169      },
26170      enableSorting: true,
26171      enableGlobalSearch: false,
26172      defaultOperators: [OPERATOR_IS, OPERATOR_IS_NOT],
26173      validOperators: [OPERATOR_IS, OPERATOR_IS_NOT],
26174      format: {},
26175      getValueFormatted: getValueFormatted6
26176    };
26177  
26178    // packages/dataviews/build-module/field-types/media.mjs
26179    var media_default = {
26180      type: "media",
26181      render: () => null,
26182      Edit: null,
26183      sort: () => 0,
26184      enableSorting: false,
26185      enableGlobalSearch: false,
26186      defaultOperators: [],
26187      validOperators: [],
26188      format: {},
26189      getValueFormatted: get_value_formatted_default_default,
26190      // cannot validate any constraint, so
26191      // the only available validation for the field author
26192      // would be providing a custom validator.
26193      validate: {}
26194    };
26195  
26196    // packages/dataviews/build-module/field-types/array.mjs
26197    var import_i18n49 = __toESM(require_i18n(), 1);
26198  
26199    // packages/dataviews/build-module/field-types/utils/is-valid-required-for-array.mjs
26200    function isValidRequiredForArray(item, field) {
26201      const value = field.getValue({ item });
26202      return Array.isArray(value) && value.length > 0 && value.every(
26203        (element) => ![void 0, "", null].includes(element)
26204      );
26205    }
26206  
26207    // packages/dataviews/build-module/field-types/array.mjs
26208    function getValueFormatted7({
26209      item,
26210      field
26211    }) {
26212      const value = field.getValue({ item });
26213      const arr = Array.isArray(value) ? value : [];
26214      return arr.join(", ");
26215    }
26216    function render2({ item, field }) {
26217      return getValueFormatted7({ item, field });
26218    }
26219    function isValidCustom5(item, field) {
26220      const value = field.getValue({ item });
26221      if (![void 0, "", null].includes(value) && !Array.isArray(value)) {
26222        return (0, import_i18n49.__)("Value must be an array.");
26223      }
26224      if (!value.every((v2) => typeof v2 === "string")) {
26225        return (0, import_i18n49.__)("Every value must be a string.");
26226      }
26227      return null;
26228    }
26229    var sort4 = (a2, b2, direction) => {
26230      const arrA = Array.isArray(a2) ? a2 : [];
26231      const arrB = Array.isArray(b2) ? b2 : [];
26232      if (arrA.length !== arrB.length) {
26233        return direction === "asc" ? arrA.length - arrB.length : arrB.length - arrA.length;
26234      }
26235      const joinedA = arrA.join(",");
26236      const joinedB = arrB.join(",");
26237      return direction === "asc" ? joinedA.localeCompare(joinedB) : joinedB.localeCompare(joinedA);
26238    };
26239    var array_default = {
26240      type: "array",
26241      render: render2,
26242      Edit: "array",
26243      sort: sort4,
26244      enableSorting: true,
26245      enableGlobalSearch: false,
26246      defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE],
26247      validOperators: [
26248        OPERATOR_IS_ANY,
26249        OPERATOR_IS_NONE,
26250        OPERATOR_IS_ALL,
26251        OPERATOR_IS_NOT_ALL
26252      ],
26253      format: {},
26254      getValueFormatted: getValueFormatted7,
26255      validate: {
26256        required: isValidRequiredForArray,
26257        elements: isValidElements,
26258        custom: isValidCustom5
26259      }
26260    };
26261  
26262    // packages/dataviews/build-module/field-types/password.mjs
26263    function getValueFormatted8({
26264      item,
26265      field
26266    }) {
26267      return field.getValue({ item }) ? "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" : "";
26268    }
26269    var password_default = {
26270      type: "password",
26271      render,
26272      Edit: "password",
26273      sort: () => 0,
26274      // Passwords should not be sortable for security reasons
26275      enableSorting: false,
26276      enableGlobalSearch: false,
26277      defaultOperators: [],
26278      validOperators: [],
26279      format: {},
26280      getValueFormatted: getValueFormatted8,
26281      validate: {
26282        required: isValidRequired,
26283        pattern: isValidPattern,
26284        minLength: isValidMinLength,
26285        maxLength: isValidMaxLength,
26286        elements: isValidElements
26287      }
26288    };
26289  
26290    // packages/dataviews/build-module/field-types/telephone.mjs
26291    var telephone_default = {
26292      type: "telephone",
26293      render,
26294      Edit: "telephone",
26295      sort: sort_text_default,
26296      enableSorting: true,
26297      enableGlobalSearch: false,
26298      defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE],
26299      validOperators: [
26300        OPERATOR_IS,
26301        OPERATOR_IS_NOT,
26302        OPERATOR_CONTAINS,
26303        OPERATOR_NOT_CONTAINS,
26304        OPERATOR_STARTS_WITH,
26305        // Multiple selection
26306        OPERATOR_IS_ANY,
26307        OPERATOR_IS_NONE,
26308        OPERATOR_IS_ALL,
26309        OPERATOR_IS_NOT_ALL
26310      ],
26311      format: {},
26312      getValueFormatted: get_value_formatted_default_default,
26313      validate: {
26314        required: isValidRequired,
26315        pattern: isValidPattern,
26316        minLength: isValidMinLength,
26317        maxLength: isValidMaxLength,
26318        elements: isValidElements
26319      }
26320    };
26321  
26322    // packages/dataviews/build-module/field-types/color.mjs
26323    var import_i18n50 = __toESM(require_i18n(), 1);
26324    var import_jsx_runtime119 = __toESM(require_jsx_runtime(), 1);
26325    function render3({ item, field }) {
26326      if (field.hasElements) {
26327        return /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(RenderFromElements, { item, field });
26328      }
26329      const value = get_value_formatted_default_default({ item, field });
26330      if (!value || !w(value).isValid()) {
26331        return value;
26332      }
26333      return /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
26334        /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
26335          "div",
26336          {
26337            style: {
26338              width: "16px",
26339              height: "16px",
26340              borderRadius: "50%",
26341              backgroundColor: value,
26342              border: "1px solid #ddd",
26343              flexShrink: 0
26344            }
26345          }
26346        ),
26347        /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("span", { children: value })
26348      ] });
26349    }
26350    function isValidCustom6(item, field) {
26351      const value = field.getValue({ item });
26352      if (![void 0, "", null].includes(value) && !w(value).isValid()) {
26353        return (0, import_i18n50.__)("Value must be a valid color.");
26354      }
26355      return null;
26356    }
26357    var sort5 = (a2, b2, direction) => {
26358      const colorA = w(a2);
26359      const colorB = w(b2);
26360      if (!colorA.isValid() && !colorB.isValid()) {
26361        return 0;
26362      }
26363      if (!colorA.isValid()) {
26364        return direction === "asc" ? 1 : -1;
26365      }
26366      if (!colorB.isValid()) {
26367        return direction === "asc" ? -1 : 1;
26368      }
26369      const hslA = colorA.toHsl();
26370      const hslB = colorB.toHsl();
26371      if (hslA.h !== hslB.h) {
26372        return direction === "asc" ? hslA.h - hslB.h : hslB.h - hslA.h;
26373      }
26374      if (hslA.s !== hslB.s) {
26375        return direction === "asc" ? hslA.s - hslB.s : hslB.s - hslA.s;
26376      }
26377      return direction === "asc" ? hslA.l - hslB.l : hslB.l - hslA.l;
26378    };
26379    var color_default = {
26380      type: "color",
26381      render: render3,
26382      Edit: "color",
26383      sort: sort5,
26384      enableSorting: true,
26385      enableGlobalSearch: false,
26386      defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE],
26387      validOperators: [
26388        OPERATOR_IS,
26389        OPERATOR_IS_NOT,
26390        OPERATOR_IS_ANY,
26391        OPERATOR_IS_NONE
26392      ],
26393      format: {},
26394      getValueFormatted: get_value_formatted_default_default,
26395      validate: {
26396        required: isValidRequired,
26397        elements: isValidElements,
26398        custom: isValidCustom6
26399      }
26400    };
26401  
26402    // packages/dataviews/build-module/field-types/url.mjs
26403    var url_default = {
26404      type: "url",
26405      render,
26406      Edit: "url",
26407      sort: sort_text_default,
26408      enableSorting: true,
26409      enableGlobalSearch: false,
26410      defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE],
26411      validOperators: [
26412        OPERATOR_IS,
26413        OPERATOR_IS_NOT,
26414        OPERATOR_CONTAINS,
26415        OPERATOR_NOT_CONTAINS,
26416        OPERATOR_STARTS_WITH,
26417        // Multiple selection
26418        OPERATOR_IS_ANY,
26419        OPERATOR_IS_NONE,
26420        OPERATOR_IS_ALL,
26421        OPERATOR_IS_NOT_ALL
26422      ],
26423      format: {},
26424      getValueFormatted: get_value_formatted_default_default,
26425      validate: {
26426        required: isValidRequired,
26427        pattern: isValidPattern,
26428        minLength: isValidMinLength,
26429        maxLength: isValidMaxLength,
26430        elements: isValidElements
26431      }
26432    };
26433  
26434    // packages/dataviews/build-module/field-types/no-type.mjs
26435    var sort6 = (a2, b2, direction) => {
26436      if (typeof a2 === "number" && typeof b2 === "number") {
26437        return sort_number_default(a2, b2, direction);
26438      }
26439      return sort_text_default(a2, b2, direction);
26440    };
26441    var no_type_default = {
26442      // type: no type for this one
26443      render,
26444      Edit: null,
26445      sort: sort6,
26446      enableSorting: true,
26447      enableGlobalSearch: false,
26448      defaultOperators: [OPERATOR_IS, OPERATOR_IS_NOT],
26449      validOperators: getAllOperatorNames(),
26450      format: {},
26451      getValueFormatted: get_value_formatted_default_default,
26452      validate: {
26453        required: isValidRequired,
26454        elements: isValidElements
26455      }
26456    };
26457  
26458    // packages/dataviews/build-module/field-types/utils/get-is-valid.mjs
26459    function supportsNumericRangeConstraint(type) {
26460      return type === "integer" || type === "number";
26461    }
26462    function supportsDateRangeConstraint(type) {
26463      return type === "date" || type === "datetime";
26464    }
26465    function normalizeRangeRule(value, fieldType, key) {
26466      const validator = fieldType.validate[key];
26467      if (validator && (typeof value === "number" && supportsNumericRangeConstraint(fieldType.type) || typeof value === "string" && supportsDateRangeConstraint(fieldType.type))) {
26468        return { constraint: value, validate: validator };
26469      }
26470      return void 0;
26471    }
26472    function getIsValid(field, fieldType) {
26473      const rules = field.isValid;
26474      let required;
26475      if (rules?.required === true && fieldType.validate.required !== void 0) {
26476        required = {
26477          constraint: true,
26478          validate: fieldType.validate.required
26479        };
26480      }
26481      let elements;
26482      if ((rules?.elements === true || // elements is enabled unless the field opts-out
26483      rules?.elements === void 0 && (!!field.elements || !!field.getElements)) && fieldType.validate.elements !== void 0) {
26484        elements = {
26485          constraint: true,
26486          validate: fieldType.validate.elements
26487        };
26488      }
26489      const min2 = normalizeRangeRule(rules?.min, fieldType, "min");
26490      const max2 = normalizeRangeRule(rules?.max, fieldType, "max");
26491      const minLengthValue = rules?.minLength;
26492      let minLength;
26493      if (typeof minLengthValue === "number" && fieldType.validate.minLength !== void 0) {
26494        minLength = {
26495          constraint: minLengthValue,
26496          validate: fieldType.validate.minLength
26497        };
26498      }
26499      const maxLengthValue = rules?.maxLength;
26500      let maxLength;
26501      if (typeof maxLengthValue === "number" && fieldType.validate.maxLength !== void 0) {
26502        maxLength = {
26503          constraint: maxLengthValue,
26504          validate: fieldType.validate.maxLength
26505        };
26506      }
26507      const patternValue = rules?.pattern;
26508      let pattern;
26509      if (patternValue !== void 0 && fieldType.validate.pattern !== void 0) {
26510        pattern = {
26511          constraint: patternValue,
26512          validate: fieldType.validate.pattern
26513        };
26514      }
26515      const custom = rules?.custom ?? fieldType.validate.custom;
26516      return {
26517        required,
26518        elements,
26519        min: min2,
26520        max: max2,
26521        minLength,
26522        maxLength,
26523        pattern,
26524        custom
26525      };
26526    }
26527  
26528    // packages/dataviews/build-module/field-types/utils/get-filter.mjs
26529    function getFilter(fieldType) {
26530      return fieldType.validOperators.reduce((accumulator, operator) => {
26531        const operatorObj = getOperatorByName(operator);
26532        if (operatorObj?.filter) {
26533          accumulator[operator] = operatorObj.filter;
26534        }
26535        return accumulator;
26536      }, {});
26537    }
26538  
26539    // packages/dataviews/build-module/field-types/utils/get-format.mjs
26540    function getFormat(field, fieldType) {
26541      return {
26542        ...fieldType.format,
26543        ...field.format
26544      };
26545    }
26546    var get_format_default = getFormat;
26547  
26548    // packages/dataviews/build-module/field-types/index.mjs
26549    function getFieldTypeByName(type) {
26550      const found = [
26551        email_default,
26552        integer_default,
26553        number_default,
26554        text_default,
26555        datetime_default,
26556        date_default,
26557        boolean_default,
26558        media_default,
26559        array_default,
26560        password_default,
26561        telephone_default,
26562        color_default,
26563        url_default
26564      ].find((fieldType) => fieldType?.type === type);
26565      if (!!found) {
26566        return found;
26567      }
26568      return no_type_default;
26569    }
26570    function normalizeFields(fields) {
26571      return fields.map((field) => {
26572        const fieldType = getFieldTypeByName(field.type);
26573        const getValue = field.getValue || get_value_from_id_default(field.id);
26574        const sort7 = function(a2, b2, direction) {
26575          const aValue = getValue({ item: a2 });
26576          const bValue = getValue({ item: b2 });
26577          return field.sort ? field.sort(aValue, bValue, direction) : fieldType.sort(aValue, bValue, direction);
26578        };
26579        return {
26580          id: field.id,
26581          label: field.label || field.id,
26582          header: field.header || field.label || field.id,
26583          description: field.description,
26584          placeholder: field.placeholder,
26585          getValue,
26586          setValue: field.setValue || set_value_from_id_default(field.id),
26587          elements: field.elements,
26588          getElements: field.getElements,
26589          hasElements: hasElements(field),
26590          isVisible: field.isVisible,
26591          isDisabled: typeof field.isDisabled === "function" ? field.isDisabled : () => !!field.isDisabled,
26592          enableHiding: field.enableHiding ?? true,
26593          readOnly: field.readOnly ?? false,
26594          // The type provides defaults for the following props
26595          type: fieldType.type,
26596          render: field.render ?? fieldType.render,
26597          Edit: getControl(field, fieldType.Edit),
26598          sort: sort7,
26599          enableSorting: field.enableSorting ?? fieldType.enableSorting,
26600          enableGlobalSearch: field.enableGlobalSearch ?? fieldType.enableGlobalSearch,
26601          isValid: getIsValid(field, fieldType),
26602          filterBy: get_filter_by_default(
26603            field,
26604            fieldType.defaultOperators,
26605            fieldType.validOperators
26606          ),
26607          filter: getFilter(fieldType),
26608          format: get_format_default(field, fieldType),
26609          getValueFormatted: field.getValueFormatted ?? fieldType.getValueFormatted
26610        };
26611      });
26612    }
26613  
26614    // packages/dataviews/build-module/hooks/use-data.mjs
26615    var import_element75 = __toESM(require_element(), 1);
26616    function useData({
26617      view,
26618      data: shownData,
26619      getItemId,
26620      isLoading,
26621      paginationInfo,
26622      selection
26623    }) {
26624      const isInfiniteScrollEnabled = view.infiniteScrollEnabled;
26625      const [hasInitiallyLoaded, setHasInitiallyLoaded] = (0, import_element75.useState)(
26626        !isLoading
26627      );
26628      (0, import_element75.useEffect)(() => {
26629        if (!isLoading) {
26630          setHasInitiallyLoaded(true);
26631        }
26632      }, [isLoading]);
26633      const previousDataRef = (0, import_element75.useRef)(shownData);
26634      const previousPaginationInfoRef = (0, import_element75.useRef)(paginationInfo);
26635      (0, import_element75.useEffect)(() => {
26636        if (!isLoading) {
26637          previousDataRef.current = shownData;
26638          previousPaginationInfoRef.current = paginationInfo;
26639        }
26640      }, [shownData, isLoading, paginationInfo]);
26641      const [visibleEntries, setVisibleEntries] = (0, import_element75.useState)([]);
26642      const positionMapRef = (0, import_element75.useRef)(/* @__PURE__ */ new Map());
26643      const allLoadedRecordsRef = (0, import_element75.useRef)([]);
26644      const prevViewParamsRef = (0, import_element75.useRef)({
26645        search: void 0,
26646        filters: void 0,
26647        perPage: void 0
26648      });
26649      const scrollDirectionRef = (0, import_element75.useRef)(void 0);
26650      const prevStartPositionRef = (0, import_element75.useRef)(void 0);
26651      const hasInitializedRef = (0, import_element75.useRef)(false);
26652      const allLoadedRecords = (0, import_element75.useMemo)(() => {
26653        if (view.startPosition !== void 0 && prevStartPositionRef.current !== void 0) {
26654          if (view.startPosition < prevStartPositionRef.current) {
26655            scrollDirectionRef.current = "up";
26656          } else if (view.startPosition > prevStartPositionRef.current) {
26657            scrollDirectionRef.current = "down";
26658          }
26659        }
26660        prevStartPositionRef.current = view.startPosition;
26661        const currentFiltersKey = JSON.stringify(view.filters ?? []);
26662        const prevFiltersKey = prevViewParamsRef.current.filters;
26663        const shouldReset = !hasInitializedRef.current || !view.infiniteScrollEnabled || view.search !== prevViewParamsRef.current.search || currentFiltersKey !== prevFiltersKey || view.perPage !== prevViewParamsRef.current.perPage;
26664        hasInitializedRef.current = true;
26665        prevViewParamsRef.current = {
26666          search: view.search,
26667          filters: currentFiltersKey,
26668          perPage: view.perPage
26669        };
26670        if (shouldReset) {
26671          positionMapRef.current.clear();
26672          scrollDirectionRef.current = void 0;
26673          const startPosition = view.search ? 1 : view.startPosition ?? 1;
26674          const records = shownData.map((record, index2) => {
26675            const position = startPosition + index2;
26676            positionMapRef.current.set(getItemId(record), position);
26677            return {
26678              ...record,
26679              position
26680            };
26681          });
26682          allLoadedRecordsRef.current = records;
26683          return records;
26684        }
26685        const prev = allLoadedRecordsRef.current;
26686        const shownDataIds = new Set(shownData.map(getItemId));
26687        const scrollDirection = scrollDirectionRef.current;
26688        const basePosition = view.search ? 1 : view.startPosition ?? 1;
26689        const newRecords = shownData.map((record, index2) => {
26690          const itemId = getItemId(record);
26691          const position = view.infiniteScrollEnabled ? basePosition + index2 : void 0;
26692          if (position !== void 0) {
26693            positionMapRef.current.set(itemId, position);
26694          }
26695          return {
26696            ...record,
26697            position
26698          };
26699        });
26700        if (newRecords.length === 0) {
26701          return prev;
26702        }
26703        const prevWithoutDuplicates = prev.filter(
26704          (record) => !shownDataIds.has(getItemId(record))
26705        );
26706        const allRecords = scrollDirection === "up" ? [...newRecords, ...prevWithoutDuplicates] : [...prevWithoutDuplicates, ...newRecords];
26707        allRecords.sort((a2, b2) => {
26708          const posA = a2.position;
26709          const posB = b2.position;
26710          return posA - posB;
26711        });
26712        let result = allRecords;
26713        if (visibleEntries.length > 0) {
26714          const visibleMin = Math.min(...visibleEntries);
26715          const visibleMax = Math.max(...visibleEntries);
26716          const buffer = 20;
26717          const recordPositions = allRecords.map(
26718            (r3) => r3.position
26719          );
26720          const minRecordPos = Math.min(...recordPositions);
26721          const maxRecordPos = Math.max(...recordPositions);
26722          const hasOverlap = !(maxRecordPos < visibleMin - buffer || minRecordPos > visibleMax + buffer);
26723          if (hasOverlap) {
26724            result = allRecords.filter((record) => {
26725              const itemId = getItemId(record);
26726              const isSelected2 = selection?.includes(itemId);
26727              if (isSelected2) {
26728                return true;
26729              }
26730              const itemPosition = record.position;
26731              if (scrollDirection === "up") {
26732                return itemPosition <= visibleMax + buffer;
26733              } else if (scrollDirection === "down") {
26734                return itemPosition >= visibleMin - buffer;
26735              }
26736              return itemPosition >= visibleMin - buffer && itemPosition <= visibleMax + buffer;
26737            });
26738          }
26739        }
26740        allLoadedRecordsRef.current = result;
26741        return result;
26742      }, [
26743        shownData,
26744        view.search,
26745        view.filters,
26746        view.perPage,
26747        view.startPosition,
26748        view.infiniteScrollEnabled,
26749        visibleEntries,
26750        selection,
26751        getItemId
26752      ]);
26753      if (!isInfiniteScrollEnabled) {
26754        const dataToReturn = isLoading && previousDataRef.current?.length ? previousDataRef.current : shownData;
26755        return {
26756          data: dataToReturn.map((item) => ({
26757            ...item,
26758            position: void 0
26759          })),
26760          paginationInfo: isLoading && previousDataRef.current?.length ? previousPaginationInfoRef.current : paginationInfo,
26761          hasInitiallyLoaded,
26762          setVisibleEntries: void 0
26763        };
26764      }
26765      return {
26766        data: allLoadedRecords,
26767        paginationInfo,
26768        hasInitiallyLoaded,
26769        setVisibleEntries
26770      };
26771    }
26772  
26773    // packages/dataviews/build-module/hooks/use-infinite-scroll.mjs
26774    var import_element76 = __toESM(require_element(), 1);
26775    var import_compose13 = __toESM(require_compose(), 1);
26776    function captureAnchorElement(container, anchorElementRef, direction) {
26777      const containerRect = container.getBoundingClientRect();
26778      const centerY = containerRect.top + containerRect.height / 2;
26779      const items = Array.from(container.querySelectorAll("[aria-posinset]"));
26780      if (items.length === 0) {
26781        return false;
26782      }
26783      const bestAnchor = items.reduce((best, item) => {
26784        const itemRect = item.getBoundingClientRect();
26785        const itemCenterY = itemRect.top + itemRect.height / 2;
26786        const distance = Math.abs(itemCenterY - centerY);
26787        const bestRect = best.getBoundingClientRect();
26788        const bestCenterY = bestRect.top + bestRect.height / 2;
26789        const bestDistance = Math.abs(bestCenterY - centerY);
26790        return distance < bestDistance ? item : best;
26791      });
26792      const posinset = Number(bestAnchor.getAttribute("aria-posinset"));
26793      const anchorRect = bestAnchor.getBoundingClientRect();
26794      anchorElementRef.current = {
26795        posinset,
26796        viewportOffset: anchorRect.top - containerRect.top,
26797        scrollTop: container.scrollTop,
26798        direction
26799      };
26800      return true;
26801    }
26802    function useInfiniteScroll({
26803      view,
26804      onChangeView,
26805      isLoading,
26806      paginationInfo,
26807      containerRef,
26808      setVisibleEntries
26809    }) {
26810      const anchorElementRef = (0, import_element76.useRef)(null);
26811      const viewRef = (0, import_element76.useRef)(view);
26812      const isLoadingRef = (0, import_element76.useRef)(isLoading);
26813      const onChangeViewRef = (0, import_element76.useRef)(onChangeView);
26814      const totalItemsRef = (0, import_element76.useRef)(paginationInfo.totalItems);
26815      (0, import_element76.useLayoutEffect)(() => {
26816        viewRef.current = view;
26817        isLoadingRef.current = isLoading;
26818        onChangeViewRef.current = onChangeView;
26819        totalItemsRef.current = paginationInfo.totalItems;
26820      }, [view, isLoading, onChangeView, paginationInfo.totalItems]);
26821      const intersectionObserverCallback = (0, import_element76.useCallback)(
26822        (entries) => {
26823          if (!setVisibleEntries) {
26824            return;
26825          }
26826          setVisibleEntries((prev) => {
26827            const newVisibleEntries = new Set(prev);
26828            let hasChanged = false;
26829            entries.forEach((entry) => {
26830              const posInSet = Number(
26831                entry.target?.attributes?.getNamedItem(
26832                  "aria-posinset"
26833                )?.value
26834              );
26835              if (isNaN(posInSet)) {
26836                return;
26837              }
26838              if (entry.isIntersecting) {
26839                if (!newVisibleEntries.has(posInSet)) {
26840                  newVisibleEntries.add(posInSet);
26841                  hasChanged = true;
26842                }
26843              } else if (newVisibleEntries.has(posInSet)) {
26844                newVisibleEntries.delete(posInSet);
26845                hasChanged = true;
26846              }
26847            });
26848            return hasChanged ? Array.from(newVisibleEntries).sort() : prev;
26849          });
26850        },
26851        [setVisibleEntries]
26852      );
26853      (0, import_element76.useLayoutEffect)(() => {
26854        const container = containerRef.current;
26855        const anchor = anchorElementRef.current;
26856        if (!container || !view.infiniteScrollEnabled || !anchor || isLoading) {
26857          return;
26858        }
26859        const anchorElement = container.querySelector(
26860          `[aria-posinset="$anchor.posinset}"]`
26861        );
26862        if (anchorElement) {
26863          const containerRect = container.getBoundingClientRect();
26864          const anchorRect = anchorElement.getBoundingClientRect();
26865          const currentOffset = anchorRect.top - containerRect.top;
26866          const scrollAdjustment = currentOffset - anchor.viewportOffset + (container.scrollTop - anchor.scrollTop);
26867          if (Math.abs(scrollAdjustment) > 1) {
26868            container.scrollTop += scrollAdjustment;
26869          }
26870        }
26871        anchorElementRef.current = null;
26872      }, [containerRef, isLoading, view.infiniteScrollEnabled]);
26873      const intersectionObserverRef = (0, import_element76.useRef)(
26874        null
26875      );
26876      (0, import_element76.useEffect)(() => {
26877        if (!view.infiniteScrollEnabled || !intersectionObserverCallback) {
26878          if (intersectionObserverRef.current) {
26879            intersectionObserverRef.current.disconnect();
26880            intersectionObserverRef.current = null;
26881          }
26882          return;
26883        }
26884        intersectionObserverRef.current = new IntersectionObserver(
26885          intersectionObserverCallback,
26886          { root: null, rootMargin: "0px", threshold: 0.1 }
26887        );
26888        return () => {
26889          if (intersectionObserverRef.current) {
26890            intersectionObserverRef.current.disconnect();
26891            intersectionObserverRef.current = null;
26892          }
26893        };
26894      }, [view.infiniteScrollEnabled, intersectionObserverCallback]);
26895      (0, import_element76.useEffect)(() => {
26896        if (!view.infiniteScrollEnabled || !containerRef.current) {
26897          return;
26898        }
26899        let lastScrollTop = 0;
26900        const BOTTOM_THRESHOLD = 600;
26901        const TOP_THRESHOLD = 800;
26902        const handleScroll = (0, import_compose13.throttle)((event) => {
26903          const currentView = viewRef.current;
26904          const totalItems = totalItemsRef.current;
26905          const target = event.target;
26906          const scrollTop = target.scrollTop;
26907          const scrollHeight = target.scrollHeight;
26908          const clientHeight = target.clientHeight;
26909          const scrollDirection = scrollTop > lastScrollTop ? "down" : "up";
26910          lastScrollTop = scrollTop;
26911          if (isLoadingRef.current) {
26912            return;
26913          }
26914          const currentStartPosition = currentView.startPosition || 1;
26915          const batchSize = currentView.perPage || 10;
26916          const currentEndPosition = Math.min(
26917            currentStartPosition + batchSize,
26918            totalItems
26919          );
26920          if (scrollDirection === "down" && scrollTop + clientHeight >= scrollHeight - BOTTOM_THRESHOLD) {
26921            if (currentEndPosition < totalItems) {
26922              const newStartPosition = currentEndPosition;
26923              captureAnchorElement(target, anchorElementRef, "down");
26924              onChangeViewRef.current({
26925                ...currentView,
26926                startPosition: newStartPosition
26927              });
26928            }
26929          }
26930          if (scrollDirection === "up" && scrollTop <= TOP_THRESHOLD) {
26931            if (currentStartPosition > 1) {
26932              const calculatedStartPosition = currentStartPosition - batchSize;
26933              const newStartPosition = calculatedStartPosition < 6 ? 1 : calculatedStartPosition;
26934              captureAnchorElement(target, anchorElementRef, "up");
26935              onChangeViewRef.current({
26936                ...currentView,
26937                startPosition: newStartPosition
26938              });
26939            }
26940          }
26941        }, 50);
26942        const container = containerRef.current;
26943        container.addEventListener("scroll", handleScroll);
26944        return () => {
26945          container.removeEventListener("scroll", handleScroll);
26946          handleScroll.cancel();
26947        };
26948      }, [containerRef, view.infiniteScrollEnabled]);
26949      return {
26950        intersectionObserver: intersectionObserverRef.current
26951      };
26952    }
26953  
26954    // packages/dataviews/build-module/dataviews-picker/index.mjs
26955    var import_element77 = __toESM(require_element(), 1);
26956    var import_compose14 = __toESM(require_compose(), 1);
26957    var import_jsx_runtime120 = __toESM(require_jsx_runtime(), 1);
26958    var isItemClickable = () => false;
26959    var dataViewsPickerLayouts = VIEW_LAYOUTS.filter(
26960      (viewLayout) => viewLayout.isPicker
26961    );
26962    var defaultGetItemId = (item) => item.id;
26963    var EMPTY_ARRAY6 = [];
26964    var DEFAULT_PICKER_LAYOUTS = {
26965      pickerGrid: true,
26966      pickerTable: true
26967    };
26968    function DefaultUI({
26969      search = true,
26970      searchLabel = void 0
26971    }) {
26972      const { view } = (0, import_element77.useContext)(dataviews_context_default);
26973      const isInfiniteScroll = view.infiniteScrollEnabled;
26974      return /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)(import_jsx_runtime120.Fragment, { children: [
26975        /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)(
26976          Stack,
26977          {
26978            direction: "row",
26979            align: "top",
26980            justify: "space-between",
26981            className: clsx_default("dataviews__view-actions", {
26982              "dataviews__view-actions--infinite-scroll": isInfiniteScroll
26983            }),
26984            gap: "xs",
26985            children: [
26986              /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)(
26987                Stack,
26988                {
26989                  direction: "row",
26990                  gap: "sm",
26991                  justify: "start",
26992                  className: "dataviews__search",
26993                  children: [
26994                    search && /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(dataviews_search_default, { label: searchLabel }),
26995                    /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(toggle_default, {})
26996                  ]
26997                }
26998              ),
26999              /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(Stack, { direction: "row", gap: "xs", style: { flexShrink: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(dataviews_view_config_default, {}) })
27000            ]
27001          }
27002        ),
27003        /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(filters_toggled_default, { className: "dataviews-filters__container" }),
27004        /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(DataViewsLayout, {}),
27005        /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(DataViewsPickerFooter, {})
27006      ] });
27007    }
27008    function DataViewsPicker({
27009      view,
27010      onChangeView,
27011      fields,
27012      search = true,
27013      searchLabel = void 0,
27014      actions = EMPTY_ARRAY6,
27015      data,
27016      getItemId = defaultGetItemId,
27017      isLoading = false,
27018      paginationInfo,
27019      defaultLayouts: defaultLayoutsProperty = DEFAULT_PICKER_LAYOUTS,
27020      selection,
27021      onChangeSelection,
27022      children,
27023      config = { perPageSizes: [10, 20, 50, 100] },
27024      itemListLabel,
27025      empty,
27026      onReset
27027    }) {
27028      const { data: displayData, setVisibleEntries } = useData({
27029        view,
27030        data,
27031        getItemId,
27032        selection,
27033        paginationInfo
27034      });
27035      const containerRef = (0, import_element77.useRef)(null);
27036      const [containerWidth, setContainerWidth] = (0, import_element77.useState)(0);
27037      const resizeObserverRef = (0, import_compose14.useResizeObserver)(
27038        (resizeObserverEntries) => {
27039          setContainerWidth(
27040            resizeObserverEntries[0].borderBoxSize[0].inlineSize
27041          );
27042        },
27043        { box: "border-box" }
27044      );
27045      const [openedFilter, setOpenedFilter] = (0, import_element77.useState)(null);
27046      function setSelectionWithChange(value) {
27047        const newValue = typeof value === "function" ? value(selection) : value;
27048        if (onChangeSelection) {
27049          onChangeSelection(newValue);
27050        }
27051      }
27052      const _fields = (0, import_element77.useMemo)(() => normalizeFields(fields), [fields]);
27053      const filters = use_filters_default(_fields, view);
27054      const hasPrimaryOrLockedFilters = (0, import_element77.useMemo)(
27055        () => (filters || []).some(
27056          (filter) => filter.isPrimary || filter.isLocked
27057        ),
27058        [filters]
27059      );
27060      const [isShowingFilter, setIsShowingFilter] = (0, import_element77.useState)(
27061        hasPrimaryOrLockedFilters
27062      );
27063      const { intersectionObserver } = useInfiniteScroll({
27064        view,
27065        onChangeView,
27066        isLoading,
27067        paginationInfo,
27068        containerRef,
27069        setVisibleEntries
27070      });
27071      (0, import_element77.useEffect)(() => {
27072        if (hasPrimaryOrLockedFilters && !isShowingFilter) {
27073          setIsShowingFilter(true);
27074        }
27075      }, [hasPrimaryOrLockedFilters, isShowingFilter]);
27076      const defaultLayouts2 = (0, import_element77.useMemo)(
27077        () => Object.fromEntries(
27078          Object.entries(defaultLayoutsProperty).filter(([layoutType]) => {
27079            return dataViewsPickerLayouts.some(
27080              (viewLayout) => viewLayout.type === layoutType
27081            );
27082          }).map(([key, value]) => [
27083            key,
27084            value === true ? {} : value
27085          ])
27086        ),
27087        [defaultLayoutsProperty]
27088      );
27089      if (!defaultLayouts2[view.type]) {
27090        return null;
27091      }
27092      return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
27093        dataviews_context_default.Provider,
27094        {
27095          value: {
27096            view,
27097            onChangeView,
27098            fields: _fields,
27099            actions,
27100            data: displayData,
27101            isLoading,
27102            paginationInfo,
27103            isItemClickable,
27104            selection,
27105            onChangeSelection: setSelectionWithChange,
27106            openedFilter,
27107            setOpenedFilter,
27108            getItemId,
27109            containerWidth,
27110            containerRef,
27111            resizeObserverRef,
27112            defaultLayouts: defaultLayouts2,
27113            filters,
27114            isShowingFilter,
27115            setIsShowingFilter,
27116            config,
27117            itemListLabel,
27118            empty,
27119            onReset,
27120            hasInitiallyLoaded: true,
27121            intersectionObserver
27122          },
27123          children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("div", { className: "dataviews-picker-wrapper", children: children ?? /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(DefaultUI, { search, searchLabel }) })
27124        }
27125      );
27126    }
27127    var DataViewsPickerSubComponents = DataViewsPicker;
27128    DataViewsPickerSubComponents.BulkActionToolbar = DataViewsPickerBulkActionToolbar;
27129    DataViewsPickerSubComponents.Footer = DataViewsPickerFooter;
27130    DataViewsPickerSubComponents.Filters = filters_default;
27131    DataViewsPickerSubComponents.FiltersToggled = filters_toggled_default;
27132    DataViewsPickerSubComponents.FiltersToggle = toggle_default;
27133    DataViewsPickerSubComponents.Layout = DataViewsLayout;
27134    DataViewsPickerSubComponents.LayoutSwitcher = ViewTypeMenu;
27135    DataViewsPickerSubComponents.Pagination = DataViewsPagination;
27136    DataViewsPickerSubComponents.Search = dataviews_search_default;
27137    DataViewsPickerSubComponents.ViewConfig = DataviewsViewConfigDropdown;
27138    var dataviews_picker_default = DataViewsPickerSubComponents;
27139  
27140    // node_modules/dequal/dist/index.mjs
27141    var has = Object.prototype.hasOwnProperty;
27142    function find(iter, tar, key) {
27143      for (key of iter.keys()) {
27144        if (dequal(key, tar)) return key;
27145      }
27146    }
27147    function dequal(foo, bar) {
27148      var ctor, len, tmp;
27149      if (foo === bar) return true;
27150      if (foo && bar && (ctor = foo.constructor) === bar.constructor) {
27151        if (ctor === Date) return foo.getTime() === bar.getTime();
27152        if (ctor === RegExp) return foo.toString() === bar.toString();
27153        if (ctor === Array) {
27154          if ((len = foo.length) === bar.length) {
27155            while (len-- && dequal(foo[len], bar[len])) ;
27156          }
27157          return len === -1;
27158        }
27159        if (ctor === Set) {
27160          if (foo.size !== bar.size) {
27161            return false;
27162          }
27163          for (len of foo) {
27164            tmp = len;
27165            if (tmp && typeof tmp === "object") {
27166              tmp = find(bar, tmp);
27167              if (!tmp) return false;
27168            }
27169            if (!bar.has(tmp)) return false;
27170          }
27171          return true;
27172        }
27173        if (ctor === Map) {
27174          if (foo.size !== bar.size) {
27175            return false;
27176          }
27177          for (len of foo) {
27178            tmp = len[0];
27179            if (tmp && typeof tmp === "object") {
27180              tmp = find(bar, tmp);
27181              if (!tmp) return false;
27182            }
27183            if (!dequal(len[1], bar.get(tmp))) {
27184              return false;
27185            }
27186          }
27187          return true;
27188        }
27189        if (ctor === ArrayBuffer) {
27190          foo = new Uint8Array(foo);
27191          bar = new Uint8Array(bar);
27192        } else if (ctor === DataView) {
27193          if ((len = foo.byteLength) === bar.byteLength) {
27194            while (len-- && foo.getInt8(len) === bar.getInt8(len)) ;
27195          }
27196          return len === -1;
27197        }
27198        if (ArrayBuffer.isView(foo)) {
27199          if ((len = foo.byteLength) === bar.byteLength) {
27200            while (len-- && foo[len] === bar[len]) ;
27201          }
27202          return len === -1;
27203        }
27204        if (!ctor || typeof foo === "object") {
27205          len = 0;
27206          for (ctor in foo) {
27207            if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false;
27208            if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false;
27209          }
27210          return Object.keys(bar).length === len;
27211        }
27212      }
27213      return foo !== foo && bar !== bar;
27214    }
27215  
27216    // packages/views/build-module/use-view.mjs
27217    var import_element78 = __toESM(require_element(), 1);
27218    var import_data7 = __toESM(require_data(), 1);
27219    var import_preferences = __toESM(require_preferences(), 1);
27220  
27221    // packages/views/build-module/preference-keys.mjs
27222    function generatePreferenceKey(kind, name, slug) {
27223      return `dataviews-$kind}-$name}-$slug}`;
27224    }
27225  
27226    // packages/views/build-module/filter-utils.mjs
27227    var SCALAR_VALUES = [
27228      "titleField",
27229      "mediaField",
27230      "descriptionField",
27231      "showTitle",
27232      "showMedia",
27233      "showDescription",
27234      "showLevels",
27235      "infiniteScrollEnabled"
27236    ];
27237    function mergeActiveViewOverrides(view, activeViewOverrides, defaultView2) {
27238      if (!activeViewOverrides) {
27239        return view;
27240      }
27241      let result = view;
27242      for (const key of SCALAR_VALUES) {
27243        if (key in activeViewOverrides) {
27244          result = { ...result, [key]: activeViewOverrides[key] };
27245        }
27246      }
27247      if (activeViewOverrides.filters && activeViewOverrides.filters.length > 0) {
27248        const activeFields = new Set(
27249          activeViewOverrides.filters.map((f2) => f2.field)
27250        );
27251        const preserved = (view.filters ?? []).filter(
27252          (f2) => !activeFields.has(f2.field)
27253        );
27254        result = {
27255          ...result,
27256          filters: [...preserved, ...activeViewOverrides.filters]
27257        };
27258      }
27259      if (activeViewOverrides.sort) {
27260        const isDefaultSort = defaultView2 && view.sort?.field === defaultView2.sort?.field && view.sort?.direction === defaultView2.sort?.direction;
27261        if (isDefaultSort) {
27262          result = {
27263            ...result,
27264            sort: activeViewOverrides.sort
27265          };
27266        }
27267      }
27268      if (activeViewOverrides.layout) {
27269        result = {
27270          ...result,
27271          layout: {
27272            ...result.layout,
27273            ...activeViewOverrides.layout
27274          }
27275        };
27276      }
27277      if (activeViewOverrides.groupBy) {
27278        result = {
27279          ...result,
27280          groupBy: activeViewOverrides.groupBy
27281        };
27282      }
27283      return result;
27284    }
27285    function stripActiveViewOverrides(view, activeViewOverrides, defaultView2) {
27286      if (!activeViewOverrides) {
27287        return view;
27288      }
27289      let result = view;
27290      for (const key of SCALAR_VALUES) {
27291        if (key in activeViewOverrides) {
27292          const { [key]: _, ...rest } = result;
27293          result = rest;
27294        }
27295      }
27296      if (activeViewOverrides.filters && activeViewOverrides.filters.length > 0) {
27297        const activeFields = new Set(
27298          activeViewOverrides.filters.map((f2) => f2.field)
27299        );
27300        result = {
27301          ...result,
27302          filters: (view.filters ?? []).filter(
27303            (f2) => !activeFields.has(f2.field)
27304          )
27305        };
27306      }
27307      if (activeViewOverrides.sort && view.sort?.field === activeViewOverrides.sort.field && view.sort?.direction === activeViewOverrides.sort.direction) {
27308        result = {
27309          ...result,
27310          sort: defaultView2?.sort
27311        };
27312      }
27313      if (activeViewOverrides.layout && "layout" in result && result.layout) {
27314        const layout = { ...result.layout };
27315        for (const key of Object.keys(activeViewOverrides.layout)) {
27316          delete layout[key];
27317        }
27318        result = {
27319          ...result,
27320          layout: Object.keys(layout).length > 0 ? layout : void 0
27321        };
27322      }
27323      if (activeViewOverrides.groupBy && "groupBy" in result) {
27324        const { groupBy: _, ...rest } = result;
27325        result = rest;
27326      }
27327      return result;
27328    }
27329  
27330    // packages/views/build-module/use-view.mjs
27331    function omit3(obj, keys) {
27332      const result = { ...obj };
27333      for (const key of keys) {
27334        delete result[key];
27335      }
27336      return result;
27337    }
27338    function useView(config) {
27339      const {
27340        kind,
27341        name,
27342        slug,
27343        defaultView: defaultView2,
27344        activeViewOverrides,
27345        queryParams,
27346        onChangeQueryParams
27347      } = config;
27348      const preferenceKey = generatePreferenceKey(kind, name, slug);
27349      const persistedView = (0, import_data7.useSelect)(
27350        (select3) => {
27351          return select3(import_preferences.store).get(
27352            "core/views",
27353            preferenceKey
27354          );
27355        },
27356        [preferenceKey]
27357      );
27358      const { set: set2 } = (0, import_data7.useDispatch)(import_preferences.store);
27359      const baseView = (0, import_element78.useMemo)(
27360        () => persistedView ?? defaultView2 ?? {},
27361        [persistedView, defaultView2]
27362      );
27363      const page = Number(queryParams?.page ?? baseView.page ?? 1);
27364      const search = queryParams?.search ?? baseView.search ?? "";
27365      const combinedOverrides = (0, import_element78.useMemo)(() => {
27366        const rawDefaults = config.defaultLayouts?.[baseView.type];
27367        const layoutTypeDefaults = !rawDefaults || rawDefaults === true ? {} : rawDefaults;
27368        return { ...layoutTypeDefaults, ...activeViewOverrides };
27369      }, [config.defaultLayouts, baseView.type, activeViewOverrides]);
27370      const view = (0, import_element78.useMemo)(() => {
27371        return mergeActiveViewOverrides(
27372          {
27373            ...baseView,
27374            page,
27375            search
27376          },
27377          combinedOverrides,
27378          defaultView2
27379        );
27380      }, [baseView, page, search, combinedOverrides, defaultView2]);
27381      const isModified = !!persistedView;
27382      const updateView = (0, import_element78.useCallback)(
27383        (newView) => {
27384          const urlParams = {
27385            page: newView?.page,
27386            search: newView?.search
27387          };
27388          const preferenceView = stripActiveViewOverrides(
27389            omit3(newView, ["page", "search"]),
27390            combinedOverrides,
27391            defaultView2
27392          );
27393          if (onChangeQueryParams && !dequal(urlParams, { page, search })) {
27394            onChangeQueryParams(urlParams);
27395          }
27396          const comparableBaseView = stripActiveViewOverrides(
27397            baseView,
27398            combinedOverrides,
27399            defaultView2
27400          );
27401          const comparableDefaultView = stripActiveViewOverrides(
27402            defaultView2,
27403            combinedOverrides,
27404            defaultView2
27405          );
27406          if (!dequal(comparableBaseView, preferenceView)) {
27407            if (dequal(preferenceView, comparableDefaultView)) {
27408              set2("core/views", preferenceKey, void 0);
27409            } else {
27410              set2("core/views", preferenceKey, preferenceView);
27411            }
27412          }
27413        },
27414        [
27415          onChangeQueryParams,
27416          page,
27417          search,
27418          baseView,
27419          defaultView2,
27420          combinedOverrides,
27421          set2,
27422          preferenceKey
27423        ]
27424      );
27425      const resetToDefault = (0, import_element78.useCallback)(() => {
27426        set2("core/views", preferenceKey, void 0);
27427      }, [preferenceKey, set2]);
27428      return {
27429        view,
27430        isModified,
27431        updateView,
27432        resetToDefault
27433      };
27434    }
27435  
27436    // packages/views/build-module/load-view.mjs
27437    var import_data8 = __toESM(require_data(), 1);
27438    var import_preferences2 = __toESM(require_preferences(), 1);
27439  
27440    // packages/views/build-module/use-view-config.mjs
27441    var import_data9 = __toESM(require_data(), 1);
27442    var import_core_data2 = __toESM(require_core_data(), 1);
27443  
27444    // packages/views/build-module/lock-unlock.mjs
27445    var import_private_apis3 = __toESM(require_private_apis(), 1);
27446    var { lock: lock3, unlock: unlock3 } = (0, import_private_apis3.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
27447      "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
27448      "@wordpress/views"
27449    );
27450  
27451    // packages/media-fields/build-module/alt_text/index.mjs
27452    var import_i18n51 = __toESM(require_i18n(), 1);
27453    var import_components47 = __toESM(require_components(), 1);
27454    var import_jsx_runtime121 = __toESM(require_jsx_runtime(), 1);
27455    var altTextField = {
27456      id: "alt_text",
27457      type: "text",
27458      label: (0, import_i18n51.__)("Alt text"),
27459      isVisible: (item) => item?.media_type === "image",
27460      render: ({ item }) => item?.alt_text || "-",
27461      Edit: ({ field, onChange, data }) => {
27462        return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
27463          import_components47.TextareaControl,
27464          {
27465            label: field.label,
27466            value: data.alt_text || "",
27467            onChange: (value) => onChange({ alt_text: value }),
27468            help: /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(import_jsx_runtime121.Fragment, { children: [
27469              /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
27470                Link,
27471                {
27472                  href: (
27473                    // translators: Localized tutorial, if one exists. W3C Web Accessibility Initiative link has list of existing translations.
27474                    (0, import_i18n51.__)(
27475                      "https://www.w3.org/WAI/tutorials/images/decision-tree/"
27476                    )
27477                  ),
27478                  openInNewTab: true,
27479                  children: (0, import_i18n51.__)("Describe the purpose of the image.")
27480                }
27481              ),
27482              /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("br", {}),
27483              (0, import_i18n51.__)("Leave empty if decorative.")
27484            ] }),
27485            rows: 2
27486          }
27487        );
27488      },
27489      enableSorting: false,
27490      filterBy: false
27491    };
27492    var alt_text_default = altTextField;
27493  
27494    // packages/media-fields/build-module/attached_to/index.mjs
27495    var import_i18n54 = __toESM(require_i18n(), 1);
27496  
27497    // packages/media-fields/build-module/attached_to/view.mjs
27498    var import_element79 = __toESM(require_element(), 1);
27499    var import_i18n52 = __toESM(require_i18n(), 1);
27500  
27501    // packages/media-fields/build-module/utils/get-rendered-content.mjs
27502    function getRenderedContent(content) {
27503      if (!content) {
27504        return "";
27505      }
27506      if (typeof content === "string") {
27507        return content;
27508      }
27509      if (typeof content === "object") {
27510        return content.rendered || content.raw || "";
27511      }
27512      return "";
27513    }
27514  
27515    // packages/media-fields/build-module/attached_to/view.mjs
27516    var import_jsx_runtime122 = __toESM(require_jsx_runtime(), 1);
27517    function MediaAttachedToView({
27518      item
27519    }) {
27520      const [attachedPostTitle, setAttachedPostTitle] = (0, import_element79.useState)(null);
27521      const parentId = item.post;
27522      const embeddedPostId = item._embedded?.["wp:attached-to"]?.[0]?.id;
27523      const embeddedPostTitle = item._embedded?.["wp:attached-to"]?.[0]?.title;
27524      (0, import_element79.useEffect)(() => {
27525        if (!!parentId && parentId === embeddedPostId) {
27526          setAttachedPostTitle(
27527            getRenderedContent(embeddedPostTitle) || (0, import_i18n52.__)("(no title)")
27528          );
27529        }
27530        if (!parentId) {
27531          setAttachedPostTitle((0, import_i18n52.__)("(Unattached)"));
27532        }
27533      }, [parentId, embeddedPostId, embeddedPostTitle]);
27534      return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(import_jsx_runtime122.Fragment, { children: attachedPostTitle });
27535    }
27536  
27537    // packages/media-fields/build-module/attached_to/edit.mjs
27538    var import_core_data3 = __toESM(require_core_data(), 1);
27539    var import_components48 = __toESM(require_components(), 1);
27540    var import_i18n53 = __toESM(require_i18n(), 1);
27541    var import_element80 = __toESM(require_element(), 1);
27542    var import_compose15 = __toESM(require_compose(), 1);
27543    var import_data10 = __toESM(require_data(), 1);
27544    var import_jsx_runtime123 = __toESM(require_jsx_runtime(), 1);
27545    function MediaAttachedToEdit({
27546      data,
27547      onChange
27548    }) {
27549      const defaultPost = !!data.post && !!data?._embedded?.["wp:attached-to"]?.[0] ? [
27550        {
27551          label: getRenderedContent(
27552            data._embedded?.["wp:attached-to"]?.[0]?.title
27553          ),
27554          value: data.post.toString()
27555        }
27556      ] : [];
27557      const [options, setOptions] = (0, import_element80.useState)(defaultPost);
27558      const [searchResults, setSearchResults] = (0, import_element80.useState)(
27559        []
27560      );
27561      const [isLoading, setIsLoading] = (0, import_element80.useState)(false);
27562      const [value, setValue] = (0, import_element80.useState)(
27563        data?.post?.toString() ?? null
27564      );
27565      const postTypes = (0, import_data10.useSelect)(
27566        (select3) => select3(import_core_data3.store).getPostTypes(),
27567        []
27568      );
27569      const handleDetach = () => {
27570        onChange({
27571          post: 0,
27572          _embedded: { ...data?._embedded, "wp:attached-to": void 0 }
27573        });
27574        setValue(null);
27575        setOptions([]);
27576      };
27577      const onValueChange = async (filterValue) => {
27578        setIsLoading(true);
27579        const results = await (0, import_core_data3.__experimentalFetchLinkSuggestions)(
27580          filterValue,
27581          /*
27582           * @TODO `fetchLinkSuggestions()` should accept `perPage` as an option argument.
27583           * `isInitialSuggestions` limits the result to 3, otherwise it's hardcoded to 20.
27584           */
27585          { type: "post", isInitialSuggestions: true },
27586          {}
27587        );
27588        setSearchResults(results);
27589        const suggestions = results.map((result) => {
27590          return {
27591            label: result.title,
27592            value: result.id.toString()
27593          };
27594        });
27595        const includeCurrent = !filterValue && suggestions.findIndex((s2) => s2.value === value) === -1;
27596        setOptions(suggestions.concat(includeCurrent ? defaultPost : []));
27597        setIsLoading(false);
27598      };
27599      const handleSelectOption = (selectedPostId) => {
27600        if (!selectedPostId) {
27601          handleDetach();
27602          return;
27603        }
27604        setValue(selectedPostId);
27605        if (selectedPostId) {
27606          const selectedPost = searchResults.find(
27607            (result) => result.id === Number(selectedPostId)
27608          );
27609          if (selectedPost && postTypes) {
27610            const postType = postTypes.find(
27611              (_postType) => _postType.slug === selectedPost?.type
27612            );
27613            const attachedTo = {
27614              ...postType && { type: postType.slug },
27615              id: Number(selectedPostId),
27616              title: {
27617                raw: selectedPost.title,
27618                rendered: selectedPost.title
27619              }
27620            };
27621            onChange({
27622              post: Number(selectedPostId),
27623              _embedded: {
27624                ...data?._embedded,
27625                "wp:attached-to": [attachedTo]
27626              }
27627            });
27628          }
27629        }
27630      };
27631      const help = (0, import_element80.createInterpolateElement)(
27632        (0, import_i18n53.__)(
27633          "Search for a post or page to attach this media to or <button>detach current</button>."
27634        ),
27635        {
27636          button: /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
27637            import_components48.Button,
27638            {
27639              __next40pxDefaultSize: true,
27640              onClick: handleDetach,
27641              variant: "link",
27642              accessibleWhenDisabled: true,
27643              disabled: !value
27644            }
27645          )
27646        }
27647      );
27648      return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
27649        import_components48.ComboboxControl,
27650        {
27651          className: "dataviews-media-field__attached-to",
27652          isLoading,
27653          label: (0, import_i18n53.__)("Attached to"),
27654          help,
27655          value,
27656          options,
27657          onFilterValueChange: (0, import_compose15.debounce)(
27658            (filterValue) => onValueChange(filterValue),
27659            300
27660          ),
27661          onChange: handleSelectOption,
27662          hideLabelFromVision: true
27663        }
27664      );
27665    }
27666  
27667    // packages/media-fields/build-module/attached_to/index.mjs
27668    var attachedToField = {
27669      id: "attached_to",
27670      type: "text",
27671      label: (0, import_i18n54.__)("Attached to"),
27672      Edit: MediaAttachedToEdit,
27673      render: MediaAttachedToView,
27674      enableSorting: false,
27675      filterBy: false
27676    };
27677    var attached_to_default = attachedToField;
27678  
27679    // packages/media-fields/build-module/author/index.mjs
27680    var import_i18n56 = __toESM(require_i18n(), 1);
27681    var import_data11 = __toESM(require_data(), 1);
27682    var import_core_data4 = __toESM(require_core_data(), 1);
27683  
27684    // packages/media-fields/build-module/author/view.mjs
27685    var import_i18n55 = __toESM(require_i18n(), 1);
27686    var import_element81 = __toESM(require_element(), 1);
27687    var import_components49 = __toESM(require_components(), 1);
27688    var import_jsx_runtime124 = __toESM(require_jsx_runtime(), 1);
27689    function AuthorView({
27690      item
27691    }) {
27692      const author = item?._embedded?.author?.[0];
27693      const text = author?.name;
27694      const imageUrl = author?.avatar_urls?.[48];
27695      const [loadingState, setLoadingState] = (0, import_element81.useState)("loading");
27696      (0, import_element81.useEffect)(() => {
27697        setLoadingState("loading");
27698      }, [imageUrl]);
27699      const imgRef = (0, import_element81.useCallback)((img) => {
27700        if (img?.complete) {
27701          setLoadingState("instant");
27702        }
27703      }, []);
27704      const handleLoad = () => {
27705        if (loadingState === "loading") {
27706          setLoadingState("loaded");
27707        }
27708      };
27709      return /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(import_components49.__experimentalHStack, { alignment: "left", spacing: 0, children: [
27710        !!imageUrl && /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
27711          "div",
27712          {
27713            className: clsx_default("media-author-field__avatar", {
27714              "is-loading": loadingState === "loading",
27715              "is-loaded": loadingState === "loaded"
27716            }),
27717            children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
27718              "img",
27719              {
27720                ref: imgRef,
27721                onLoad: handleLoad,
27722                alt: (0, import_i18n55.__)("Author avatar"),
27723                src: imageUrl
27724              }
27725            )
27726          }
27727        ),
27728        !imageUrl && /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("div", { className: "media-author-field__icon", children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(import_components49.Icon, { icon: comment_author_avatar_default }) }),
27729        /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("span", { className: "media-author-field__name", children: text })
27730      ] });
27731    }
27732  
27733    // packages/media-fields/build-module/author/index.mjs
27734    var authorField = {
27735      label: (0, import_i18n56.__)("Author"),
27736      id: "author",
27737      type: "integer",
27738      getElements: async () => {
27739        const authors = await (0, import_data11.resolveSelect)(import_core_data4.store).getEntityRecords(
27740          "root",
27741          "user",
27742          {
27743            per_page: -1,
27744            who: "authors",
27745            _fields: "id,name",
27746            context: "view"
27747          }
27748        ) ?? [];
27749        return authors.map(({ id, name }) => ({
27750          value: id,
27751          label: name
27752        }));
27753      },
27754      render: AuthorView,
27755      sort: (a2, b2, direction) => {
27756        const nameA = a2._embedded?.author?.[0]?.name || "";
27757        const nameB = b2._embedded?.author?.[0]?.name || "";
27758        return direction === "asc" ? nameA.localeCompare(nameB) : nameB.localeCompare(nameA);
27759      },
27760      filterBy: {
27761        operators: ["isAny", "isNone"]
27762      },
27763      readOnly: true
27764    };
27765    var author_default = authorField;
27766  
27767    // packages/media-fields/build-module/caption/index.mjs
27768    var import_i18n57 = __toESM(require_i18n(), 1);
27769    var import_components50 = __toESM(require_components(), 1);
27770  
27771    // packages/media-fields/build-module/utils/get-raw-content.mjs
27772    function getRawContent(content) {
27773      if (!content) {
27774        return "";
27775      }
27776      if (typeof content === "string") {
27777        return content;
27778      }
27779      if (typeof content === "object" && "raw" in content) {
27780        return content.raw || "";
27781      }
27782      return "";
27783    }
27784  
27785    // packages/media-fields/build-module/caption/index.mjs
27786    var import_jsx_runtime125 = __toESM(require_jsx_runtime(), 1);
27787    var captionField = {
27788      id: "caption",
27789      type: "text",
27790      label: (0, import_i18n57.__)("Caption"),
27791      getValue: ({ item }) => getRawContent(item?.caption),
27792      render: ({ item }) => getRawContent(item?.caption) || "-",
27793      Edit: ({ field, onChange, data }) => {
27794        return /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
27795          import_components50.TextareaControl,
27796          {
27797            label: field.label,
27798            value: getRawContent(data.caption) || "",
27799            onChange: (value) => onChange({ caption: value }),
27800            rows: 2
27801          }
27802        );
27803      },
27804      enableSorting: false,
27805      filterBy: false
27806    };
27807    var caption_default = captionField;
27808  
27809    // packages/media-fields/build-module/date_added/index.mjs
27810    var import_i18n58 = __toESM(require_i18n(), 1);
27811    var dateAddedField = {
27812      id: "date",
27813      type: "datetime",
27814      label: (0, import_i18n58.__)("Date added"),
27815      filterBy: {
27816        operators: ["before", "after"]
27817      },
27818      readOnly: true
27819    };
27820    var date_added_default = dateAddedField;
27821  
27822    // packages/media-fields/build-module/date_modified/index.mjs
27823    var import_i18n59 = __toESM(require_i18n(), 1);
27824    var dateModifiedField = {
27825      id: "modified",
27826      type: "datetime",
27827      label: (0, import_i18n59.__)("Date modified"),
27828      filterBy: {
27829        operators: ["before", "after"]
27830      },
27831      readOnly: true
27832    };
27833    var date_modified_default = dateModifiedField;
27834  
27835    // packages/media-fields/build-module/description/index.mjs
27836    var import_i18n60 = __toESM(require_i18n(), 1);
27837    var import_components51 = __toESM(require_components(), 1);
27838    var import_jsx_runtime126 = __toESM(require_jsx_runtime(), 1);
27839    var descriptionField = {
27840      id: "description",
27841      type: "text",
27842      label: (0, import_i18n60.__)("Description"),
27843      getValue: ({ item }) => getRawContent(item?.description),
27844      render: ({ item }) => /* @__PURE__ */ (0, import_jsx_runtime126.jsx)("div", { children: getRawContent(item?.description) || "-" }),
27845      Edit: ({ field, onChange, data }) => {
27846        return /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
27847          import_components51.TextareaControl,
27848          {
27849            label: field.label,
27850            value: getRawContent(data.description) || "",
27851            onChange: (value) => onChange({ description: value }),
27852            rows: 5
27853          }
27854        );
27855      },
27856      enableSorting: false,
27857      filterBy: false
27858    };
27859    var description_default = descriptionField;
27860  
27861    // packages/media-fields/build-module/filename/index.mjs
27862    var import_i18n61 = __toESM(require_i18n(), 1);
27863    var import_url4 = __toESM(require_url(), 1);
27864  
27865    // packages/media-fields/build-module/filename/view.mjs
27866    var import_element82 = __toESM(require_element(), 1);
27867    var import_url3 = __toESM(require_url(), 1);
27868    var import_jsx_runtime127 = __toESM(require_jsx_runtime(), 1);
27869    var TRUNCATE_LENGTH = 15;
27870    function FileNameView({
27871      item
27872    }) {
27873      const fileName = (0, import_element82.useMemo)(
27874        () => item?.source_url ? (0, import_url3.getFilename)(item.source_url) : null,
27875        [item?.source_url]
27876      );
27877      if (!fileName) {
27878        return "";
27879      }
27880      if (fileName.length <= TRUNCATE_LENGTH) {
27881        return /* @__PURE__ */ (0, import_jsx_runtime127.jsx)("span", { className: "dataviews-media-field__filename", children: fileName });
27882      }
27883      return /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(tooltip_exports.Root, { children: [
27884        /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
27885          tooltip_exports.Trigger,
27886          {
27887            render: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)("span", { className: "dataviews-media-field__filename", children: fileName })
27888          }
27889        ),
27890        /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(tooltip_exports.Popup, { children: fileName })
27891      ] });
27892    }
27893  
27894    // packages/media-fields/build-module/filename/index.mjs
27895    var filenameField = {
27896      id: "filename",
27897      type: "text",
27898      label: (0, import_i18n61.__)("File name"),
27899      getValue: ({ item }) => (0, import_url4.getFilename)(item?.source_url || ""),
27900      render: FileNameView,
27901      enableSorting: false,
27902      filterBy: false,
27903      readOnly: true
27904    };
27905    var filename_default = filenameField;
27906  
27907    // packages/media-fields/build-module/filesize/index.mjs
27908    var import_i18n62 = __toESM(require_i18n(), 1);
27909    var KB_IN_BYTES = 1024;
27910    var MB_IN_BYTES = 1024 * KB_IN_BYTES;
27911    var GB_IN_BYTES = 1024 * MB_IN_BYTES;
27912    var TB_IN_BYTES = 1024 * GB_IN_BYTES;
27913    var PB_IN_BYTES = 1024 * TB_IN_BYTES;
27914    var EB_IN_BYTES = 1024 * PB_IN_BYTES;
27915    var ZB_IN_BYTES = 1024 * EB_IN_BYTES;
27916    var YB_IN_BYTES = 1024 * ZB_IN_BYTES;
27917    function getBytesString(bytes, unitSymbol, decimals = 2) {
27918      return (0, import_i18n62.sprintf)(
27919        // translators: 1: Actual bytes of a file. 2: The unit symbol (e.g. MB).
27920        (0, import_i18n62._x)("%1$s %2$s", "file size"),
27921        bytes.toLocaleString(void 0, {
27922          minimumFractionDigits: 0,
27923          maximumFractionDigits: decimals
27924        }),
27925        unitSymbol
27926      );
27927    }
27928    function formatFileSize(bytes, decimals = 2) {
27929      if (bytes === 0) {
27930        return getBytesString(0, (0, import_i18n62._x)("B", "unit symbol"), decimals);
27931      }
27932      const quant = {
27933        /* translators: Unit symbol for yottabyte. */
27934        [(0, import_i18n62._x)("YB", "unit symbol")]: YB_IN_BYTES,
27935        /* translators: Unit symbol for zettabyte. */
27936        [(0, import_i18n62._x)("ZB", "unit symbol")]: ZB_IN_BYTES,
27937        /* translators: Unit symbol for exabyte. */
27938        [(0, import_i18n62._x)("EB", "unit symbol")]: EB_IN_BYTES,
27939        /* translators: Unit symbol for petabyte. */
27940        [(0, import_i18n62._x)("PB", "unit symbol")]: PB_IN_BYTES,
27941        /* translators: Unit symbol for terabyte. */
27942        [(0, import_i18n62._x)("TB", "unit symbol")]: TB_IN_BYTES,
27943        /* translators: Unit symbol for gigabyte. */
27944        [(0, import_i18n62._x)("GB", "unit symbol")]: GB_IN_BYTES,
27945        /* translators: Unit symbol for megabyte. */
27946        [(0, import_i18n62._x)("MB", "unit symbol")]: MB_IN_BYTES,
27947        /* translators: Unit symbol for kilobyte. */
27948        [(0, import_i18n62._x)("KB", "unit symbol")]: KB_IN_BYTES,
27949        /* translators: Unit symbol for byte. */
27950        [(0, import_i18n62._x)("B", "unit symbol")]: 1
27951      };
27952      for (const [unit, mag] of Object.entries(quant)) {
27953        if (bytes >= mag) {
27954          return getBytesString(bytes / mag, unit, decimals);
27955        }
27956      }
27957      return "";
27958    }
27959    var filesizeField = {
27960      id: "filesize",
27961      type: "text",
27962      label: (0, import_i18n62.__)("File size"),
27963      getValue: ({ item }) => item?.media_details?.filesize ? formatFileSize(item?.media_details?.filesize) : "",
27964      isVisible: (item) => {
27965        return !!item?.media_details?.filesize;
27966      },
27967      enableSorting: false,
27968      filterBy: false,
27969      readOnly: true
27970    };
27971    var filesize_default = filesizeField;
27972  
27973    // packages/media-fields/build-module/media_dimensions/index.mjs
27974    var import_i18n63 = __toESM(require_i18n(), 1);
27975    var mediaDimensionsField = {
27976      id: "media_dimensions",
27977      type: "text",
27978      label: (0, import_i18n63.__)("Dimensions"),
27979      getValue: ({ item }) => item?.media_details?.width && item?.media_details?.height ? (0, import_i18n63.sprintf)(
27980        // translators: 1: Width. 2: Height.
27981        (0, import_i18n63._x)("%1$s \xD7 %2$s", "image dimensions"),
27982        item?.media_details?.width?.toString(),
27983        item?.media_details?.height?.toString()
27984      ) : "",
27985      isVisible: (item) => {
27986        return !!(item?.media_details?.width && item?.media_details?.height);
27987      },
27988      enableSorting: false,
27989      filterBy: false,
27990      readOnly: true
27991    };
27992    var media_dimensions_default = mediaDimensionsField;
27993  
27994    // packages/media-fields/build-module/media_thumbnail/index.mjs
27995    var import_i18n65 = __toESM(require_i18n(), 1);
27996  
27997    // packages/media-fields/build-module/media_thumbnail/view.mjs
27998    var import_data12 = __toESM(require_data(), 1);
27999    var import_core_data5 = __toESM(require_core_data(), 1);
28000    var import_components52 = __toESM(require_components(), 1);
28001    var import_element83 = __toESM(require_element(), 1);
28002    var import_url5 = __toESM(require_url(), 1);
28003  
28004    // packages/media-fields/build-module/utils/get-media-type-from-mime-type.mjs
28005    var import_i18n64 = __toESM(require_i18n(), 1);
28006    function getMediaTypeFromMimeType(mimeType) {
28007      if (mimeType.startsWith("image/")) {
28008        return {
28009          type: "image",
28010          label: (0, import_i18n64.__)("Image"),
28011          icon: image_default
28012        };
28013      }
28014      if (mimeType.startsWith("video/")) {
28015        return {
28016          type: "video",
28017          label: (0, import_i18n64.__)("Video"),
28018          icon: video_default
28019        };
28020      }
28021      if (mimeType.startsWith("audio/")) {
28022        return {
28023          type: "audio",
28024          label: (0, import_i18n64.__)("Audio"),
28025          icon: audio_default
28026        };
28027      }
28028      return {
28029        type: "application",
28030        label: (0, import_i18n64.__)("Application"),
28031        icon: file_default
28032      };
28033    }
28034  
28035    // packages/media-fields/build-module/media_thumbnail/view.mjs
28036    var import_jsx_runtime128 = __toESM(require_jsx_runtime(), 1);
28037    function getBestImageUrl(featuredMedia, configSizes) {
28038      const sizes = featuredMedia?.media_details?.sizes;
28039      if (!sizes) {
28040        return featuredMedia.source_url;
28041      }
28042      const sizeEntries = Object.values(sizes);
28043      if (!sizeEntries.length) {
28044        return featuredMedia.source_url;
28045      }
28046      const targetWidth = configSizes ? parseInt(configSizes, 10) : NaN;
28047      if (!Number.isNaN(targetWidth)) {
28048        const validEntries = sizeEntries.filter(
28049          (s2) => typeof s2.width === "number" && !Number.isNaN(s2.width)
28050        );
28051        if (!validEntries.length) {
28052          return featuredMedia.source_url;
28053        }
28054        const sorted = [...validEntries].sort(
28055          (a2, b2) => a2.width - b2.width
28056        );
28057        const match2 = sorted.find((s2) => s2.width >= targetWidth);
28058        if (match2) {
28059          return match2.source_url;
28060        }
28061        return sorted[sorted.length - 1].source_url;
28062      }
28063      return featuredMedia.source_url;
28064    }
28065    function FallbackView({
28066      item,
28067      filename
28068    }) {
28069      return /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("div", { className: "dataviews-media-field__media-thumbnail", children: /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)(
28070        import_components52.__experimentalVStack,
28071        {
28072          justify: "center",
28073          alignment: "center",
28074          className: "dataviews-media-field__media-thumbnail__stack",
28075          spacing: 0,
28076          children: [
28077            /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
28078              import_components52.Icon,
28079              {
28080                className: "dataviews-media-field__media-thumbnail--icon",
28081                icon: getMediaTypeFromMimeType(item.mime_type).icon,
28082                size: 24
28083              }
28084            ),
28085            !!filename && /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("div", { className: "dataviews-media-field__media-thumbnail__filename", children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(import_components52.__experimentalTruncate, { className: "dataviews-media-field__media-thumbnail__filename__truncate", children: filename }) })
28086          ]
28087        }
28088      ) });
28089    }
28090    function ImageView({
28091      item,
28092      configSizes,
28093      onError
28094    }) {
28095      const imageUrl = getBestImageUrl(item, configSizes);
28096      const imgRef = (0, import_element83.useRef)(null);
28097      const [loadingState, setLoadingState] = (0, import_element83.useState)("loading");
28098      (0, import_element83.useLayoutEffect)(() => {
28099        if (imgRef.current?.complete) {
28100          setLoadingState("instant");
28101        } else {
28102          setLoadingState("loading");
28103        }
28104      }, [imageUrl]);
28105      const handleLoad = () => {
28106        if (loadingState === "loading") {
28107          setLoadingState("loaded");
28108        }
28109      };
28110      return /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
28111        "div",
28112        {
28113          className: clsx_default("dataviews-media-field__media-thumbnail", {
28114            "is-loading": loadingState === "loading",
28115            "is-loaded": loadingState === "loaded"
28116          }),
28117          children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
28118            "img",
28119            {
28120              ref: imgRef,
28121              className: "dataviews-media-field__media-thumbnail--image",
28122              src: imageUrl,
28123              alt: item.alt_text || item.title.raw,
28124              onLoad: handleLoad,
28125              onError,
28126              loading: "lazy"
28127            }
28128          )
28129        }
28130      );
28131    }
28132    function MediaThumbnailView({
28133      item,
28134      config
28135    }) {
28136      const [imageError, setImageError] = (0, import_element83.useState)(false);
28137      const _featuredMedia = (0, import_data12.useSelect)(
28138        (select3) => {
28139          if (!item.featured_media) {
28140            return;
28141          }
28142          return select3(import_core_data5.store).getEntityRecord(
28143            "postType",
28144            "attachment",
28145            item.featured_media
28146          );
28147        },
28148        [item.featured_media]
28149      );
28150      const featuredMedia = item.featured_media ? _featuredMedia : item;
28151      if (!featuredMedia) {
28152        return null;
28153      }
28154      const filename = (0, import_url5.getFilename)(featuredMedia.source_url || "");
28155      if (imageError || getMediaTypeFromMimeType(featuredMedia.mime_type).type !== "image") {
28156        return /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(FallbackView, { item: featuredMedia, filename: filename || "" });
28157      }
28158      return /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
28159        ImageView,
28160        {
28161          item: featuredMedia,
28162          configSizes: config?.sizes,
28163          onError: () => setImageError(true)
28164        }
28165      );
28166    }
28167  
28168    // packages/media-fields/build-module/media_thumbnail/index.mjs
28169    var mediaThumbnailField = {
28170      id: "media_thumbnail",
28171      type: "media",
28172      label: (0, import_i18n65.__)("Thumbnail"),
28173      render: MediaThumbnailView,
28174      enableSorting: false,
28175      filterBy: false
28176    };
28177    var media_thumbnail_default = mediaThumbnailField;
28178  
28179    // packages/media-fields/build-module/mime_type/index.mjs
28180    var import_i18n66 = __toESM(require_i18n(), 1);
28181    var mimeTypeField = {
28182      id: "mime_type",
28183      type: "text",
28184      label: (0, import_i18n66.__)("File type"),
28185      getValue: ({ item }) => item?.mime_type || "",
28186      render: ({ item }) => item?.mime_type || "-",
28187      // Disable sorting until REST API support for ordering my `mime_type` is added.
28188      // See: https://core.trac.wordpress.org/ticket/64073
28189      enableSorting: false,
28190      filterBy: false,
28191      readOnly: true
28192    };
28193    var mime_type_default = mimeTypeField;
28194  
28195    // packages/media-utils/build-module/components/media-upload-modal/index.mjs
28196    var import_notices = __toESM(require_notices(), 1);
28197  
28198    // packages/media-utils/build-module/lock-unlock.mjs
28199    var import_private_apis4 = __toESM(require_private_apis(), 1);
28200    var { lock: lock4, unlock: unlock4 } = (0, import_private_apis4.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
28201      "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
28202      "@wordpress/media-utils"
28203    );
28204  
28205    // packages/media-utils/build-module/components/media-upload-modal/upload-status-popover.mjs
28206    var import_element84 = __toESM(require_element(), 1);
28207    var import_i18n67 = __toESM(require_i18n(), 1);
28208    var import_components53 = __toESM(require_components(), 1);
28209    var import_jsx_runtime129 = __toESM(require_jsx_runtime(), 1);
28210    function UploadStatusPopover({
28211      uploadingFiles,
28212      onDismissError,
28213      onOpenChange
28214    }) {
28215      const [isOpen, setIsOpen] = (0, import_element84.useState)(false);
28216      const [prevHadErrors, setPrevHadErrors] = (0, import_element84.useState)(false);
28217      const triggerRef = (0, import_element84.useRef)(null);
28218      const updateIsOpen = (0, import_element84.useCallback)(
28219        (open) => {
28220          setIsOpen(open);
28221          onOpenChange?.(open);
28222        },
28223        [onOpenChange]
28224      );
28225      const activeFiles = uploadingFiles.filter(
28226        (file) => file.status === "uploading"
28227      );
28228      const errorFiles = uploadingFiles.filter(
28229        (file) => file.status === "error"
28230      );
28231      const hasErrors = errorFiles.length > 0;
28232      const isUploading = activeFiles.length > 0;
28233      (0, import_element84.useEffect)(() => {
28234        if (hasErrors && !prevHadErrors) {
28235          updateIsOpen(true);
28236        }
28237        setPrevHadErrors(hasErrors);
28238      }, [hasErrors, prevHadErrors, updateIsOpen]);
28239      if (uploadingFiles.length === 0) {
28240        return null;
28241      }
28242      let buttonLabel, popoverHeading;
28243      if (isUploading) {
28244        buttonLabel = (0, import_i18n67.sprintf)(
28245          // translators: %s: number of files being uploaded
28246          (0, import_i18n67._n)("Uploading %s file", "Uploading %s files", activeFiles.length),
28247          activeFiles.length.toLocaleString()
28248        );
28249        popoverHeading = (0, import_i18n67.__)("Uploading");
28250      } else if (hasErrors) {
28251        buttonLabel = (0, import_i18n67.sprintf)(
28252          // translators: %s: number of upload errors
28253          (0, import_i18n67._n)("%s upload error", "%s upload errors", errorFiles.length),
28254          errorFiles.length.toLocaleString()
28255        );
28256        popoverHeading = (0, import_i18n67.__)("Upload errors");
28257      } else {
28258        buttonLabel = (0, import_i18n67.__)("Upload complete");
28259        popoverHeading = (0, import_i18n67.__)("Upload complete");
28260      }
28261      return /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)("div", { className: "media-upload-modal__upload-status", children: [
28262        isUploading && /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_components53.Spinner, {}),
28263        /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
28264          import_components53.Button,
28265          {
28266            className: "media-upload-modal__upload-status__trigger",
28267            size: "compact",
28268            icon: chevron_down_default,
28269            iconPosition: "right",
28270            onClick: () => updateIsOpen(!isOpen),
28271            "aria-expanded": isOpen,
28272            ref: triggerRef,
28273            children: buttonLabel
28274          }
28275        ),
28276        isOpen && /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(
28277          import_components53.Popover,
28278          {
28279            className: "media-upload-modal__upload-status__popover",
28280            placement: "top-start",
28281            offset: 8,
28282            anchor: triggerRef.current,
28283            focusOnMount: true,
28284            onClose: () => {
28285              if (triggerRef.current?.contains(
28286                triggerRef.current.ownerDocument.activeElement
28287              )) {
28288                return;
28289              }
28290              updateIsOpen(false);
28291            },
28292            children: [
28293              /* @__PURE__ */ (0, import_jsx_runtime129.jsx)("div", { className: "media-upload-modal__upload-status__header", children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)("h3", { children: popoverHeading }) }),
28294              /* @__PURE__ */ (0, import_jsx_runtime129.jsx)("ul", { className: "media-upload-modal__upload-status__list", children: uploadingFiles.map((file) => /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(
28295                "li",
28296                {
28297                  className: "media-upload-modal__upload-status__item",
28298                  children: [
28299                    file.status === "uploading" && /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_components53.Spinner, {}),
28300                    file.status === "uploaded" && /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_components53.Icon, { icon: check_default, size: 16 }),
28301                    (file.status === "uploading" || file.status === "uploaded") && /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
28302                      "span",
28303                      {
28304                        className: "media-upload-modal__upload-status__filename",
28305                        title: file.name,
28306                        children: file.name
28307                      }
28308                    ),
28309                    file.status === "error" && /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(
28310                      import_components53.Notice,
28311                      {
28312                        status: "error",
28313                        isDismissible: !!onDismissError,
28314                        onRemove: () => onDismissError?.(file.id),
28315                        children: [
28316                          file.name,
28317                          ": ",
28318                          file.error
28319                        ]
28320                      }
28321                    )
28322                  ]
28323                },
28324                file.id
28325              )) })
28326            ]
28327          }
28328        )
28329      ] });
28330    }
28331  
28332    // packages/media-utils/build-module/components/media-upload-modal/use-invalidate-attachment-resolutions.mjs
28333    var import_element85 = __toESM(require_element(), 1);
28334    var import_data13 = __toESM(require_data(), 1);
28335    function useInvalidateAttachmentResolutions() {
28336      const registry = (0, import_data13.useRegistry)();
28337      return (0, import_element85.useCallback)(
28338        () => invalidateAttachmentResolutions(registry),
28339        [registry]
28340      );
28341    }
28342  
28343    // packages/media-utils/build-module/components/media-upload-modal/use-upload-status.mjs
28344    var import_element86 = __toESM(require_element(), 1);
28345    var import_blob2 = __toESM(require_blob(), 1);
28346    var idCounter = 0;
28347    var batchIdCounter = 0;
28348    function useUploadStatus({
28349      onBatchComplete
28350    } = {}) {
28351      const [uploadingFiles, setUploadingFiles] = (0, import_element86.useState)(
28352        []
28353      );
28354      const clearCompleted = (0, import_element86.useCallback)(() => {
28355        setUploadingFiles(
28356          (prev) => prev.filter((item) => item.status !== "uploaded")
28357        );
28358      }, []);
28359      const dismissError = (0, import_element86.useCallback)((fileId) => {
28360        setUploadingFiles(
28361          (prev) => prev.filter((item) => item.id !== fileId)
28362        );
28363      }, []);
28364      const registerBatch = (0, import_element86.useCallback)(
28365        (files) => {
28366          const batchId = String(++batchIdCounter);
28367          const batchSize = files.length;
28368          const newEntries = files.map((file) => ({
28369            id: String(++idCounter),
28370            batchId,
28371            name: file.name,
28372            status: "uploading"
28373          }));
28374          setUploadingFiles((prev) => [...prev, ...newEntries]);
28375          let successCount = 0;
28376          let errorCount = 0;
28377          let batchDone = false;
28378          let successAttachments = [];
28379          const completeBatchIfDone = () => {
28380            if (batchDone || successCount + errorCount < batchSize) {
28381              return;
28382            }
28383            batchDone = true;
28384            setUploadingFiles(
28385              (prev) => prev.map(
28386                (item) => item.batchId === batchId && item.status === "uploading" ? {
28387                  ...item,
28388                  status: "uploaded"
28389                } : item
28390              )
28391            );
28392            onBatchComplete?.(successAttachments);
28393          };
28394          const onFileChange = (attachments) => {
28395            if (batchDone) {
28396              return;
28397            }
28398            const allReal = attachments.every(
28399              (attachment) => attachment.id && attachment.url && !(0, import_blob2.isBlobURL)(attachment.url)
28400            );
28401            if (!allReal) {
28402              return;
28403            }
28404            successCount = attachments.length;
28405            successAttachments = attachments;
28406            completeBatchIfDone();
28407          };
28408          const onError = (error) => {
28409            const fileName = error instanceof UploadError ? error.file.name : void 0;
28410            setUploadingFiles((prev) => {
28411              let matched = false;
28412              return prev.map((item) => {
28413                if (!matched && item.batchId === batchId && item.status === "uploading" && (!fileName || item.name === fileName)) {
28414                  matched = true;
28415                  return {
28416                    ...item,
28417                    status: "error",
28418                    error: error.message
28419                  };
28420                }
28421                return item;
28422              });
28423            });
28424            errorCount++;
28425            completeBatchIfDone();
28426          };
28427          return { onFileChange, onError };
28428        },
28429        [onBatchComplete]
28430      );
28431      const allComplete = uploadingFiles.length > 0 && uploadingFiles.every((item) => item.status !== "uploading");
28432      return {
28433        uploadingFiles,
28434        registerBatch,
28435        dismissError,
28436        clearCompleted,
28437        allComplete
28438      };
28439    }
28440  
28441    // packages/media-utils/build-module/components/media-upload-modal/index.mjs
28442    var import_jsx_runtime130 = __toESM(require_jsx_runtime(), 1);
28443    var { useEntityRecordsWithPermissions } = unlock4(import_core_data6.privateApis);
28444    var LAYOUT_PICKER_GRID2 = "pickerGrid";
28445    var LAYOUT_PICKER_TABLE2 = "pickerTable";
28446    var NOTICES_CONTEXT = "media-modal";
28447    var NOTICE_ID_UPLOAD_PROGRESS = "media-modal-upload-progress";
28448    var defaultQueryParams = {
28449      page: 1,
28450      search: ""
28451    };
28452    function getSelectionFromValue(value) {
28453      if (!value) {
28454        return [];
28455      }
28456      return Array.isArray(value) ? value.map(String) : [String(value)];
28457    }
28458    var defaultView = {
28459      type: LAYOUT_PICKER_GRID2,
28460      fields: [],
28461      showTitle: false,
28462      titleField: "title",
28463      mediaField: "media_thumbnail",
28464      perPage: 50,
28465      filters: [],
28466      layout: {
28467        previewSize: 170,
28468        density: "compact"
28469      }
28470    };
28471    var defaultLayouts = {
28472      [LAYOUT_PICKER_GRID2]: {
28473        fields: [],
28474        showTitle: false,
28475        layout: {
28476          previewSize: 170,
28477          density: "compact"
28478        }
28479      },
28480      [LAYOUT_PICKER_TABLE2]: {
28481        fields: [
28482          "filename",
28483          "filesize",
28484          "media_dimensions",
28485          "author",
28486          "date"
28487        ],
28488        showTitle: true
28489      }
28490    };
28491    function MediaUploadModal({
28492      allowedTypes,
28493      multiple = false,
28494      value,
28495      onSelect,
28496      onClose,
28497      onUpload,
28498      title = (0, import_i18n68.__)("Select Media"),
28499      isOpen,
28500      isDismissible = true,
28501      modalClass,
28502      search = true,
28503      searchLabel = (0, import_i18n68.__)("Search media")
28504    }) {
28505      const [selection, setSelection] = (0, import_element87.useState)(
28506        () => getSelectionFromValue(value)
28507      );
28508      const { createSuccessNotice, removeAllNotices } = (0, import_data14.useDispatch)(import_notices.store);
28509      const invalidateAttachmentResolutions2 = useInvalidateAttachmentResolutions();
28510      const [queryParams, setQueryParams] = (0, import_element87.useState)(
28511        () => defaultQueryParams
28512      );
28513      const { view, updateView, isModified, resetToDefault } = useView({
28514        kind: "postType",
28515        name: "attachment",
28516        slug: "media-modal",
28517        defaultView,
28518        queryParams,
28519        onChangeQueryParams: setQueryParams
28520      });
28521      const handleChangeView = (0, import_element87.useCallback)(
28522        (nextView) => {
28523          const normalizedView = { ...nextView };
28524          if (normalizedView.startPosition === void 0) {
28525            delete normalizedView.startPosition;
28526          }
28527          updateView(normalizedView);
28528        },
28529        [updateView]
28530      );
28531      const queryArgs = (0, import_element87.useMemo)(() => {
28532        const filters = {};
28533        view.filters?.forEach((filter) => {
28534          if (filter.field === "media_type") {
28535            filters.media_type = filter.value;
28536          }
28537          if (filter.field === "author") {
28538            if (filter.operator === "isAny") {
28539              filters.author = filter.value;
28540            } else if (filter.operator === "isNone") {
28541              filters.author_exclude = filter.value;
28542            }
28543          }
28544          if (filter.field === "date" || filter.field === "modified") {
28545            if (filter.operator === "before") {
28546              filters.before = filter.value;
28547            } else if (filter.operator === "after") {
28548              filters.after = filter.value;
28549            }
28550          }
28551          if (filter.field === "mime_type") {
28552            filters.mime_type = filter.value;
28553          }
28554        });
28555        if (!filters.media_type && !filters.mime_type && allowedTypes && !allowedTypes.includes("*")) {
28556          const { mediaTypes, mimeTypes } = allowedTypes.reduce(
28557            (acc, type) => {
28558              if (type.endsWith("/*")) {
28559                acc.mediaTypes.push(type.replace("/*", ""));
28560              } else if (type.includes("/")) {
28561                acc.mimeTypes.push(type);
28562              } else {
28563                acc.mediaTypes.push(type);
28564              }
28565              return acc;
28566            },
28567            { mediaTypes: [], mimeTypes: [] }
28568          );
28569          if (mediaTypes.length) {
28570            filters.media_type = mediaTypes;
28571          }
28572          if (mimeTypes.length) {
28573            filters.mime_type = mimeTypes;
28574          }
28575        }
28576        return {
28577          per_page: view.perPage || 20,
28578          page: view.page || 1,
28579          status: "inherit",
28580          order: view.sort?.direction,
28581          orderby: view.sort?.field,
28582          search: view.search,
28583          _embed: "author,wp:attached-to",
28584          ...filters
28585        };
28586      }, [view, allowedTypes]);
28587      const handleBatchComplete = (0, import_element87.useCallback)(
28588        (attachments) => {
28589          const uploadedIds = attachments.map((attachment) => String(attachment.id)).filter(Boolean);
28590          if (multiple) {
28591            setSelection((prev) => {
28592              const existing = new Set(prev);
28593              const newIds = uploadedIds.filter(
28594                (id) => !existing.has(id)
28595              );
28596              return [...prev, ...newIds];
28597            });
28598          } else {
28599            setSelection(uploadedIds.slice(0, 1));
28600          }
28601          invalidateAttachmentResolutions2();
28602        },
28603        [multiple, invalidateAttachmentResolutions2]
28604      );
28605      const {
28606        uploadingFiles,
28607        registerBatch,
28608        dismissError,
28609        clearCompleted,
28610        allComplete
28611      } = useUploadStatus({ onBatchComplete: handleBatchComplete });
28612      const isPopoverOpenRef = (0, import_element87.useRef)(false);
28613      const handlePopoverOpenChange = (0, import_element87.useCallback)(
28614        (open) => {
28615          isPopoverOpenRef.current = open;
28616          if (!open) {
28617            clearCompleted();
28618          }
28619        },
28620        [clearCompleted]
28621      );
28622      const {
28623        records: mediaRecords,
28624        isResolving: isLoading,
28625        totalItems,
28626        totalPages
28627      } = useEntityRecordsWithPermissions("postType", "attachment", queryArgs);
28628      const fields = (0, import_element87.useMemo)(
28629        () => [
28630          // Media field definitions from @wordpress/media-fields
28631          // Cast is safe because RestAttachment has the same properties as Attachment
28632          {
28633            ...media_thumbnail_default,
28634            enableHiding: false
28635            // Within the modal, the thumbnail should always be shown.
28636          },
28637          {
28638            id: "title",
28639            type: "text",
28640            label: (0, import_i18n68.__)("Title"),
28641            getValue: ({ item }) => {
28642              const titleValue = item.title.raw || item.title.rendered;
28643              return titleValue || (0, import_i18n68.__)("(no title)");
28644            }
28645          },
28646          alt_text_default,
28647          caption_default,
28648          description_default,
28649          date_added_default,
28650          date_modified_default,
28651          author_default,
28652          filename_default,
28653          filesize_default,
28654          media_dimensions_default,
28655          mime_type_default,
28656          attached_to_default
28657        ],
28658        []
28659      );
28660      const actions = (0, import_element87.useMemo)(
28661        () => [
28662          {
28663            id: "select",
28664            label: (0, import_i18n68.__)("Select"),
28665            isPrimary: true,
28666            supportsBulk: multiple,
28667            async callback() {
28668              if (selection.length === 0) {
28669                return;
28670              }
28671              const selectedPostsQuery = {
28672                include: selection,
28673                per_page: -1
28674              };
28675              const selectedPosts = await (0, import_data14.resolveSelect)(
28676                import_core_data6.store
28677              ).getEntityRecords(
28678                "postType",
28679                "attachment",
28680                selectedPostsQuery
28681              );
28682              const transformedPosts = (selectedPosts ?? []).map(transformAttachment).filter(Boolean);
28683              const selectedItems = multiple ? transformedPosts : transformedPosts?.[0];
28684              removeAllNotices("snackbar", NOTICES_CONTEXT);
28685              onSelect(selectedItems);
28686            }
28687          }
28688        ],
28689        [multiple, onSelect, selection, removeAllNotices]
28690      );
28691      const handleModalClose = (0, import_element87.useCallback)(() => {
28692        removeAllNotices("snackbar", NOTICES_CONTEXT);
28693        onClose?.();
28694      }, [removeAllNotices, onClose]);
28695      const valueRef = (0, import_element87.useRef)(value);
28696      (0, import_element87.useEffect)(() => {
28697        valueRef.current = value;
28698      }, [value]);
28699      (0, import_element87.useEffect)(() => {
28700        if (isOpen) {
28701          setSelection(getSelectionFromValue(valueRef.current));
28702        } else {
28703          setQueryParams(defaultQueryParams);
28704        }
28705      }, [isOpen]);
28706      const handleUpload = onUpload || uploadMedia;
28707      const prevAllCompleteRef = (0, import_element87.useRef)(false);
28708      (0, import_element87.useEffect)(() => {
28709        if (allComplete && !prevAllCompleteRef.current) {
28710          const completeCount = uploadingFiles.filter(
28711            (file) => file.status === "uploaded"
28712          ).length;
28713          if (completeCount > 0) {
28714            createSuccessNotice(
28715              (0, import_i18n68.sprintf)(
28716                // translators: %s: number of files
28717                (0, import_i18n68._n)(
28718                  "Uploaded %s file",
28719                  "Uploaded %s files",
28720                  completeCount
28721                ),
28722                completeCount.toLocaleString()
28723              ),
28724              {
28725                type: "snackbar",
28726                context: NOTICES_CONTEXT,
28727                id: NOTICE_ID_UPLOAD_PROGRESS
28728              }
28729            );
28730          }
28731          if (!isPopoverOpenRef.current) {
28732            clearCompleted();
28733          }
28734        }
28735        prevAllCompleteRef.current = allComplete;
28736      }, [allComplete, uploadingFiles, createSuccessNotice, clearCompleted]);
28737      const handleFileSelect = (0, import_element87.useCallback)(
28738        (event) => {
28739          const files = event.target.files;
28740          if (files && files.length > 0) {
28741            const filesArray = Array.from(files);
28742            const { onFileChange, onError } = registerBatch(filesArray);
28743            handleUpload({
28744              allowedTypes,
28745              filesList: filesArray,
28746              onFileChange,
28747              onError
28748            });
28749          }
28750        },
28751        [allowedTypes, handleUpload, registerBatch]
28752      );
28753      const paginationInfo = (0, import_element87.useMemo)(
28754        () => ({
28755          totalItems,
28756          totalPages
28757        }),
28758        [totalItems, totalPages]
28759      );
28760      const acceptTypes = (0, import_element87.useMemo)(() => {
28761        if (allowedTypes?.includes("*")) {
28762          return void 0;
28763        }
28764        return allowedTypes?.join(",");
28765      }, [allowedTypes]);
28766      if (!isOpen) {
28767        return null;
28768      }
28769      return /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(
28770        import_components54.Modal,
28771        {
28772          title,
28773          onRequestClose: handleModalClose,
28774          isDismissible,
28775          className: modalClass,
28776          overlayClassName: "media-upload-modal",
28777          size: "fill",
28778          headerActions: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
28779            import_components54.FormFileUpload,
28780            {
28781              accept: acceptTypes,
28782              multiple: true,
28783              onChange: handleFileSelect,
28784              render: ({ openFileDialog }) => /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
28785                import_components54.Button,
28786                {
28787                  onClick: openFileDialog,
28788                  icon: upload_default,
28789                  __next40pxDefaultSize: true,
28790                  children: (0, import_i18n68.__)("Upload media")
28791                }
28792              )
28793            }
28794          ),
28795          children: [
28796            /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
28797              import_components54.DropZone,
28798              {
28799                onFilesDrop: (files) => {
28800                  let filteredFiles = files;
28801                  if (allowedTypes && !allowedTypes.includes("*")) {
28802                    filteredFiles = files.filter(
28803                      (file) => allowedTypes.some((allowedType) => {
28804                        return file.type === allowedType || file.type.startsWith(
28805                          allowedType.replace("*", "")
28806                        );
28807                      })
28808                    );
28809                  }
28810                  if (filteredFiles.length > 0) {
28811                    const { onFileChange, onError } = registerBatch(filteredFiles);
28812                    handleUpload({
28813                      allowedTypes,
28814                      filesList: filteredFiles,
28815                      onFileChange,
28816                      onError
28817                    });
28818                  }
28819                },
28820                label: (0, import_i18n68.__)("Drop files to upload")
28821              }
28822            ),
28823            /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(
28824              dataviews_picker_default,
28825              {
28826                data: mediaRecords || [],
28827                fields,
28828                view,
28829                onChangeView: handleChangeView,
28830                actions,
28831                selection,
28832                onChangeSelection: setSelection,
28833                isLoading,
28834                paginationInfo,
28835                defaultLayouts,
28836                getItemId: (item) => String(item.id),
28837                itemListLabel: (0, import_i18n68.__)("Media items"),
28838                onReset: isModified ? resetToDefault : false,
28839                children: [
28840                  /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(
28841                    Stack,
28842                    {
28843                      direction: "row",
28844                      align: "top",
28845                      justify: "space-between",
28846                      className: "dataviews__view-actions",
28847                      gap: "xs",
28848                      children: [
28849                        /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(
28850                          Stack,
28851                          {
28852                            direction: "row",
28853                            gap: "sm",
28854                            justify: "start",
28855                            className: "dataviews__search",
28856                            children: [
28857                              search && /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(dataviews_picker_default.Search, { label: searchLabel }),
28858                              /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(dataviews_picker_default.FiltersToggle, {})
28859                            ]
28860                          }
28861                        ),
28862                        /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(Stack, { direction: "row", gap: "xs", style: { flexShrink: 0 }, children: [
28863                          /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(dataviews_picker_default.LayoutSwitcher, {}),
28864                          /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(dataviews_picker_default.ViewConfig, {})
28865                        ] })
28866                      ]
28867                    }
28868                  ),
28869                  /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(dataviews_picker_default.FiltersToggled, { className: "dataviews-filters__container" }),
28870                  /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(dataviews_picker_default.Layout, {}),
28871                  /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(
28872                    "div",
28873                    {
28874                      className: clsx_default("media-upload-modal__footer", {
28875                        "is-uploading": uploadingFiles.length > 0
28876                      }),
28877                      children: [
28878                        /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
28879                          UploadStatusPopover,
28880                          {
28881                            uploadingFiles,
28882                            onDismissError: dismissError,
28883                            onOpenChange: handlePopoverOpenChange
28884                          }
28885                        ),
28886                        /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(dataviews_picker_default.Footer, {})
28887                      ]
28888                    }
28889                  )
28890                ]
28891              }
28892            ),
28893            (0, import_element87.createPortal)(
28894              /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
28895                import_notices.SnackbarNotices,
28896                {
28897                  className: "media-upload-modal__snackbar",
28898                  context: NOTICES_CONTEXT
28899                }
28900              ),
28901              document.body
28902            )
28903          ]
28904        }
28905      );
28906    }
28907  
28908    // packages/media-utils/build-module/private-apis.mjs
28909    var privateApis12 = {};
28910    lock4(privateApis12, {
28911      sideloadMedia,
28912      MediaUploadModal
28913    });
28914    return __toCommonJS(index_exports);
28915  })();
28916  /*! Bundled license information:
28917  
28918  use-sync-external-store/cjs/use-sync-external-store-shim.development.js:
28919    (**
28920     * @license React
28921     * use-sync-external-store-shim.development.js
28922     *
28923     * Copyright (c) Meta Platforms, Inc. and affiliates.
28924     *
28925     * This source code is licensed under the MIT license found in the
28926     * LICENSE file in the root directory of this source tree.
28927     *)
28928  
28929  use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js:
28930    (**
28931     * @license React
28932     * use-sync-external-store-shim/with-selector.development.js
28933     *
28934     * Copyright (c) Meta Platforms, Inc. and affiliates.
28935     *
28936     * This source code is licensed under the MIT license found in the
28937     * LICENSE file in the root directory of this source tree.
28938     *)
28939  */


Generated : Thu Jul 16 08:20:16 2026 Cross-referenced by PHPXref