[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/build/routes/post-list/ -> content.js (source)

   1  var __create = Object.create;
   2  var __defProp = Object.defineProperty;
   3  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
   4  var __getOwnPropNames = Object.getOwnPropertyNames;
   5  var __getProtoOf = Object.getPrototypeOf;
   6  var __hasOwnProp = Object.prototype.hasOwnProperty;
   7  var __commonJS = (cb, mod) => function __require() {
   8    return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
   9  };
  10  var __copyProps = (to, from, except, desc) => {
  11    if (from && typeof from === "object" || typeof from === "function") {
  12      for (let key of __getOwnPropNames(from))
  13        if (!__hasOwnProp.call(to, key) && key !== except)
  14          __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  15    }
  16    return to;
  17  };
  18  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  19    // If the importer is in node compatibility mode or this is not an ESM
  20    // file that has been converted to a CommonJS file using a Babel-
  21    // compatible transform (i.e. "__esModule" has not been set), then set
  22    // "default" to the CommonJS "module.exports" for node compatibility.
  23    isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  24    mod
  25  ));
  26  
  27  // package-external:@wordpress/element
  28  var require_element = __commonJS({
  29    "package-external:@wordpress/element"(exports, module) {
  30      module.exports = window.wp.element;
  31    }
  32  });
  33  
  34  // package-external:@wordpress/data
  35  var require_data = __commonJS({
  36    "package-external:@wordpress/data"(exports, module) {
  37      module.exports = window.wp.data;
  38    }
  39  });
  40  
  41  // package-external:@wordpress/preferences
  42  var require_preferences = __commonJS({
  43    "package-external:@wordpress/preferences"(exports, module) {
  44      module.exports = window.wp.preferences;
  45    }
  46  });
  47  
  48  // package-external:@wordpress/components
  49  var require_components = __commonJS({
  50    "package-external:@wordpress/components"(exports, module) {
  51      module.exports = window.wp.components;
  52    }
  53  });
  54  
  55  // package-external:@wordpress/compose
  56  var require_compose = __commonJS({
  57    "package-external:@wordpress/compose"(exports, module) {
  58      module.exports = window.wp.compose;
  59    }
  60  });
  61  
  62  // package-external:@wordpress/i18n
  63  var require_i18n = __commonJS({
  64    "package-external:@wordpress/i18n"(exports, module) {
  65      module.exports = window.wp.i18n;
  66    }
  67  });
  68  
  69  // package-external:@wordpress/primitives
  70  var require_primitives = __commonJS({
  71    "package-external:@wordpress/primitives"(exports, module) {
  72      module.exports = window.wp.primitives;
  73    }
  74  });
  75  
  76  // vendor-external:react/jsx-runtime
  77  var require_jsx_runtime = __commonJS({
  78    "vendor-external:react/jsx-runtime"(exports, module) {
  79      module.exports = window.ReactJSXRuntime;
  80    }
  81  });
  82  
  83  // package-external:@wordpress/keycodes
  84  var require_keycodes = __commonJS({
  85    "package-external:@wordpress/keycodes"(exports, module) {
  86      module.exports = window.wp.keycodes;
  87    }
  88  });
  89  
  90  // package-external:@wordpress/private-apis
  91  var require_private_apis = __commonJS({
  92    "package-external:@wordpress/private-apis"(exports, module) {
  93      module.exports = window.wp.privateApis;
  94    }
  95  });
  96  
  97  // vendor-external:react
  98  var require_react = __commonJS({
  99    "vendor-external:react"(exports, module) {
 100      module.exports = window.React;
 101    }
 102  });
 103  
 104  // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js
 105  var require_use_sync_external_store_shim_development = __commonJS({
 106    "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"(exports) {
 107      "use strict";
 108      (function() {
 109        function is(x2, y2) {
 110          return x2 === y2 && (0 !== x2 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2;
 111        }
 112        function useSyncExternalStore$2(subscribe2, getSnapshot) {
 113          didWarnOld18Alpha || void 0 === React5.startTransition || (didWarnOld18Alpha = true, console.error(
 114            "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."
 115          ));
 116          var value = getSnapshot();
 117          if (!didWarnUncachedGetSnapshot) {
 118            var cachedValue = getSnapshot();
 119            objectIs(value, cachedValue) || (console.error(
 120              "The result of getSnapshot should be cached to avoid an infinite loop"
 121            ), didWarnUncachedGetSnapshot = true);
 122          }
 123          cachedValue = useState22({
 124            inst: { value, getSnapshot }
 125          });
 126          var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
 127          useLayoutEffect2(
 128            function() {
 129              inst.value = value;
 130              inst.getSnapshot = getSnapshot;
 131              checkIfSnapshotChanged(inst) && forceUpdate({ inst });
 132            },
 133            [subscribe2, value, getSnapshot]
 134          );
 135          useEffect17(
 136            function() {
 137              checkIfSnapshotChanged(inst) && forceUpdate({ inst });
 138              return subscribe2(function() {
 139                checkIfSnapshotChanged(inst) && forceUpdate({ inst });
 140              });
 141            },
 142            [subscribe2]
 143          );
 144          useDebugValue(value);
 145          return value;
 146        }
 147        function checkIfSnapshotChanged(inst) {
 148          var latestGetSnapshot = inst.getSnapshot;
 149          inst = inst.value;
 150          try {
 151            var nextValue = latestGetSnapshot();
 152            return !objectIs(inst, nextValue);
 153          } catch (error) {
 154            return true;
 155          }
 156        }
 157        function useSyncExternalStore$1(subscribe2, getSnapshot) {
 158          return getSnapshot();
 159        }
 160        "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
 161        var React5 = require_react(), objectIs = "function" === typeof Object.is ? Object.is : is, useState22 = React5.useState, useEffect17 = React5.useEffect, useLayoutEffect2 = React5.useLayoutEffect, useDebugValue = React5.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
 162        exports.useSyncExternalStore = void 0 !== React5.useSyncExternalStore ? React5.useSyncExternalStore : shim;
 163        "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
 164      })();
 165    }
 166  });
 167  
 168  // node_modules/use-sync-external-store/shim/index.js
 169  var require_shim = __commonJS({
 170    "node_modules/use-sync-external-store/shim/index.js"(exports, module) {
 171      "use strict";
 172      if (false) {
 173        module.exports = null;
 174      } else {
 175        module.exports = require_use_sync_external_store_shim_development();
 176      }
 177    }
 178  });
 179  
 180  // vendor-external:react-dom
 181  var require_react_dom = __commonJS({
 182    "vendor-external:react-dom"(exports, module) {
 183      module.exports = window.ReactDOM;
 184    }
 185  });
 186  
 187  // node_modules/remove-accents/index.js
 188  var require_remove_accents = __commonJS({
 189    "node_modules/remove-accents/index.js"(exports, module) {
 190      var characterMap = {
 191        "\xC0": "A",
 192        "\xC1": "A",
 193        "\xC2": "A",
 194        "\xC3": "A",
 195        "\xC4": "A",
 196        "\xC5": "A",
 197        "\u1EA4": "A",
 198        "\u1EAE": "A",
 199        "\u1EB2": "A",
 200        "\u1EB4": "A",
 201        "\u1EB6": "A",
 202        "\xC6": "AE",
 203        "\u1EA6": "A",
 204        "\u1EB0": "A",
 205        "\u0202": "A",
 206        "\u1EA2": "A",
 207        "\u1EA0": "A",
 208        "\u1EA8": "A",
 209        "\u1EAA": "A",
 210        "\u1EAC": "A",
 211        "\xC7": "C",
 212        "\u1E08": "C",
 213        "\xC8": "E",
 214        "\xC9": "E",
 215        "\xCA": "E",
 216        "\xCB": "E",
 217        "\u1EBE": "E",
 218        "\u1E16": "E",
 219        "\u1EC0": "E",
 220        "\u1E14": "E",
 221        "\u1E1C": "E",
 222        "\u0206": "E",
 223        "\u1EBA": "E",
 224        "\u1EBC": "E",
 225        "\u1EB8": "E",
 226        "\u1EC2": "E",
 227        "\u1EC4": "E",
 228        "\u1EC6": "E",
 229        "\xCC": "I",
 230        "\xCD": "I",
 231        "\xCE": "I",
 232        "\xCF": "I",
 233        "\u1E2E": "I",
 234        "\u020A": "I",
 235        "\u1EC8": "I",
 236        "\u1ECA": "I",
 237        "\xD0": "D",
 238        "\xD1": "N",
 239        "\xD2": "O",
 240        "\xD3": "O",
 241        "\xD4": "O",
 242        "\xD5": "O",
 243        "\xD6": "O",
 244        "\xD8": "O",
 245        "\u1ED0": "O",
 246        "\u1E4C": "O",
 247        "\u1E52": "O",
 248        "\u020E": "O",
 249        "\u1ECE": "O",
 250        "\u1ECC": "O",
 251        "\u1ED4": "O",
 252        "\u1ED6": "O",
 253        "\u1ED8": "O",
 254        "\u1EDC": "O",
 255        "\u1EDE": "O",
 256        "\u1EE0": "O",
 257        "\u1EDA": "O",
 258        "\u1EE2": "O",
 259        "\xD9": "U",
 260        "\xDA": "U",
 261        "\xDB": "U",
 262        "\xDC": "U",
 263        "\u1EE6": "U",
 264        "\u1EE4": "U",
 265        "\u1EEC": "U",
 266        "\u1EEE": "U",
 267        "\u1EF0": "U",
 268        "\xDD": "Y",
 269        "\xE0": "a",
 270        "\xE1": "a",
 271        "\xE2": "a",
 272        "\xE3": "a",
 273        "\xE4": "a",
 274        "\xE5": "a",
 275        "\u1EA5": "a",
 276        "\u1EAF": "a",
 277        "\u1EB3": "a",
 278        "\u1EB5": "a",
 279        "\u1EB7": "a",
 280        "\xE6": "ae",
 281        "\u1EA7": "a",
 282        "\u1EB1": "a",
 283        "\u0203": "a",
 284        "\u1EA3": "a",
 285        "\u1EA1": "a",
 286        "\u1EA9": "a",
 287        "\u1EAB": "a",
 288        "\u1EAD": "a",
 289        "\xE7": "c",
 290        "\u1E09": "c",
 291        "\xE8": "e",
 292        "\xE9": "e",
 293        "\xEA": "e",
 294        "\xEB": "e",
 295        "\u1EBF": "e",
 296        "\u1E17": "e",
 297        "\u1EC1": "e",
 298        "\u1E15": "e",
 299        "\u1E1D": "e",
 300        "\u0207": "e",
 301        "\u1EBB": "e",
 302        "\u1EBD": "e",
 303        "\u1EB9": "e",
 304        "\u1EC3": "e",
 305        "\u1EC5": "e",
 306        "\u1EC7": "e",
 307        "\xEC": "i",
 308        "\xED": "i",
 309        "\xEE": "i",
 310        "\xEF": "i",
 311        "\u1E2F": "i",
 312        "\u020B": "i",
 313        "\u1EC9": "i",
 314        "\u1ECB": "i",
 315        "\xF0": "d",
 316        "\xF1": "n",
 317        "\xF2": "o",
 318        "\xF3": "o",
 319        "\xF4": "o",
 320        "\xF5": "o",
 321        "\xF6": "o",
 322        "\xF8": "o",
 323        "\u1ED1": "o",
 324        "\u1E4D": "o",
 325        "\u1E53": "o",
 326        "\u020F": "o",
 327        "\u1ECF": "o",
 328        "\u1ECD": "o",
 329        "\u1ED5": "o",
 330        "\u1ED7": "o",
 331        "\u1ED9": "o",
 332        "\u1EDD": "o",
 333        "\u1EDF": "o",
 334        "\u1EE1": "o",
 335        "\u1EDB": "o",
 336        "\u1EE3": "o",
 337        "\xF9": "u",
 338        "\xFA": "u",
 339        "\xFB": "u",
 340        "\xFC": "u",
 341        "\u1EE7": "u",
 342        "\u1EE5": "u",
 343        "\u1EED": "u",
 344        "\u1EEF": "u",
 345        "\u1EF1": "u",
 346        "\xFD": "y",
 347        "\xFF": "y",
 348        "\u0100": "A",
 349        "\u0101": "a",
 350        "\u0102": "A",
 351        "\u0103": "a",
 352        "\u0104": "A",
 353        "\u0105": "a",
 354        "\u0106": "C",
 355        "\u0107": "c",
 356        "\u0108": "C",
 357        "\u0109": "c",
 358        "\u010A": "C",
 359        "\u010B": "c",
 360        "\u010C": "C",
 361        "\u010D": "c",
 362        "C\u0306": "C",
 363        "c\u0306": "c",
 364        "\u010E": "D",
 365        "\u010F": "d",
 366        "\u0110": "D",
 367        "\u0111": "d",
 368        "\u0112": "E",
 369        "\u0113": "e",
 370        "\u0114": "E",
 371        "\u0115": "e",
 372        "\u0116": "E",
 373        "\u0117": "e",
 374        "\u0118": "E",
 375        "\u0119": "e",
 376        "\u011A": "E",
 377        "\u011B": "e",
 378        "\u011C": "G",
 379        "\u01F4": "G",
 380        "\u011D": "g",
 381        "\u01F5": "g",
 382        "\u011E": "G",
 383        "\u011F": "g",
 384        "\u0120": "G",
 385        "\u0121": "g",
 386        "\u0122": "G",
 387        "\u0123": "g",
 388        "\u0124": "H",
 389        "\u0125": "h",
 390        "\u0126": "H",
 391        "\u0127": "h",
 392        "\u1E2A": "H",
 393        "\u1E2B": "h",
 394        "\u0128": "I",
 395        "\u0129": "i",
 396        "\u012A": "I",
 397        "\u012B": "i",
 398        "\u012C": "I",
 399        "\u012D": "i",
 400        "\u012E": "I",
 401        "\u012F": "i",
 402        "\u0130": "I",
 403        "\u0131": "i",
 404        "\u0132": "IJ",
 405        "\u0133": "ij",
 406        "\u0134": "J",
 407        "\u0135": "j",
 408        "\u0136": "K",
 409        "\u0137": "k",
 410        "\u1E30": "K",
 411        "\u1E31": "k",
 412        "K\u0306": "K",
 413        "k\u0306": "k",
 414        "\u0139": "L",
 415        "\u013A": "l",
 416        "\u013B": "L",
 417        "\u013C": "l",
 418        "\u013D": "L",
 419        "\u013E": "l",
 420        "\u013F": "L",
 421        "\u0140": "l",
 422        "\u0141": "l",
 423        "\u0142": "l",
 424        "\u1E3E": "M",
 425        "\u1E3F": "m",
 426        "M\u0306": "M",
 427        "m\u0306": "m",
 428        "\u0143": "N",
 429        "\u0144": "n",
 430        "\u0145": "N",
 431        "\u0146": "n",
 432        "\u0147": "N",
 433        "\u0148": "n",
 434        "\u0149": "n",
 435        "N\u0306": "N",
 436        "n\u0306": "n",
 437        "\u014C": "O",
 438        "\u014D": "o",
 439        "\u014E": "O",
 440        "\u014F": "o",
 441        "\u0150": "O",
 442        "\u0151": "o",
 443        "\u0152": "OE",
 444        "\u0153": "oe",
 445        "P\u0306": "P",
 446        "p\u0306": "p",
 447        "\u0154": "R",
 448        "\u0155": "r",
 449        "\u0156": "R",
 450        "\u0157": "r",
 451        "\u0158": "R",
 452        "\u0159": "r",
 453        "R\u0306": "R",
 454        "r\u0306": "r",
 455        "\u0212": "R",
 456        "\u0213": "r",
 457        "\u015A": "S",
 458        "\u015B": "s",
 459        "\u015C": "S",
 460        "\u015D": "s",
 461        "\u015E": "S",
 462        "\u0218": "S",
 463        "\u0219": "s",
 464        "\u015F": "s",
 465        "\u0160": "S",
 466        "\u0161": "s",
 467        "\u0162": "T",
 468        "\u0163": "t",
 469        "\u021B": "t",
 470        "\u021A": "T",
 471        "\u0164": "T",
 472        "\u0165": "t",
 473        "\u0166": "T",
 474        "\u0167": "t",
 475        "T\u0306": "T",
 476        "t\u0306": "t",
 477        "\u0168": "U",
 478        "\u0169": "u",
 479        "\u016A": "U",
 480        "\u016B": "u",
 481        "\u016C": "U",
 482        "\u016D": "u",
 483        "\u016E": "U",
 484        "\u016F": "u",
 485        "\u0170": "U",
 486        "\u0171": "u",
 487        "\u0172": "U",
 488        "\u0173": "u",
 489        "\u0216": "U",
 490        "\u0217": "u",
 491        "V\u0306": "V",
 492        "v\u0306": "v",
 493        "\u0174": "W",
 494        "\u0175": "w",
 495        "\u1E82": "W",
 496        "\u1E83": "w",
 497        "X\u0306": "X",
 498        "x\u0306": "x",
 499        "\u0176": "Y",
 500        "\u0177": "y",
 501        "\u0178": "Y",
 502        "Y\u0306": "Y",
 503        "y\u0306": "y",
 504        "\u0179": "Z",
 505        "\u017A": "z",
 506        "\u017B": "Z",
 507        "\u017C": "z",
 508        "\u017D": "Z",
 509        "\u017E": "z",
 510        "\u017F": "s",
 511        "\u0192": "f",
 512        "\u01A0": "O",
 513        "\u01A1": "o",
 514        "\u01AF": "U",
 515        "\u01B0": "u",
 516        "\u01CD": "A",
 517        "\u01CE": "a",
 518        "\u01CF": "I",
 519        "\u01D0": "i",
 520        "\u01D1": "O",
 521        "\u01D2": "o",
 522        "\u01D3": "U",
 523        "\u01D4": "u",
 524        "\u01D5": "U",
 525        "\u01D6": "u",
 526        "\u01D7": "U",
 527        "\u01D8": "u",
 528        "\u01D9": "U",
 529        "\u01DA": "u",
 530        "\u01DB": "U",
 531        "\u01DC": "u",
 532        "\u1EE8": "U",
 533        "\u1EE9": "u",
 534        "\u1E78": "U",
 535        "\u1E79": "u",
 536        "\u01FA": "A",
 537        "\u01FB": "a",
 538        "\u01FC": "AE",
 539        "\u01FD": "ae",
 540        "\u01FE": "O",
 541        "\u01FF": "o",
 542        "\xDE": "TH",
 543        "\xFE": "th",
 544        "\u1E54": "P",
 545        "\u1E55": "p",
 546        "\u1E64": "S",
 547        "\u1E65": "s",
 548        "X\u0301": "X",
 549        "x\u0301": "x",
 550        "\u0403": "\u0413",
 551        "\u0453": "\u0433",
 552        "\u040C": "\u041A",
 553        "\u045C": "\u043A",
 554        "A\u030B": "A",
 555        "a\u030B": "a",
 556        "E\u030B": "E",
 557        "e\u030B": "e",
 558        "I\u030B": "I",
 559        "i\u030B": "i",
 560        "\u01F8": "N",
 561        "\u01F9": "n",
 562        "\u1ED2": "O",
 563        "\u1ED3": "o",
 564        "\u1E50": "O",
 565        "\u1E51": "o",
 566        "\u1EEA": "U",
 567        "\u1EEB": "u",
 568        "\u1E80": "W",
 569        "\u1E81": "w",
 570        "\u1EF2": "Y",
 571        "\u1EF3": "y",
 572        "\u0200": "A",
 573        "\u0201": "a",
 574        "\u0204": "E",
 575        "\u0205": "e",
 576        "\u0208": "I",
 577        "\u0209": "i",
 578        "\u020C": "O",
 579        "\u020D": "o",
 580        "\u0210": "R",
 581        "\u0211": "r",
 582        "\u0214": "U",
 583        "\u0215": "u",
 584        "B\u030C": "B",
 585        "b\u030C": "b",
 586        "\u010C\u0323": "C",
 587        "\u010D\u0323": "c",
 588        "\xCA\u030C": "E",
 589        "\xEA\u030C": "e",
 590        "F\u030C": "F",
 591        "f\u030C": "f",
 592        "\u01E6": "G",
 593        "\u01E7": "g",
 594        "\u021E": "H",
 595        "\u021F": "h",
 596        "J\u030C": "J",
 597        "\u01F0": "j",
 598        "\u01E8": "K",
 599        "\u01E9": "k",
 600        "M\u030C": "M",
 601        "m\u030C": "m",
 602        "P\u030C": "P",
 603        "p\u030C": "p",
 604        "Q\u030C": "Q",
 605        "q\u030C": "q",
 606        "\u0158\u0329": "R",
 607        "\u0159\u0329": "r",
 608        "\u1E66": "S",
 609        "\u1E67": "s",
 610        "V\u030C": "V",
 611        "v\u030C": "v",
 612        "W\u030C": "W",
 613        "w\u030C": "w",
 614        "X\u030C": "X",
 615        "x\u030C": "x",
 616        "Y\u030C": "Y",
 617        "y\u030C": "y",
 618        "A\u0327": "A",
 619        "a\u0327": "a",
 620        "B\u0327": "B",
 621        "b\u0327": "b",
 622        "\u1E10": "D",
 623        "\u1E11": "d",
 624        "\u0228": "E",
 625        "\u0229": "e",
 626        "\u0190\u0327": "E",
 627        "\u025B\u0327": "e",
 628        "\u1E28": "H",
 629        "\u1E29": "h",
 630        "I\u0327": "I",
 631        "i\u0327": "i",
 632        "\u0197\u0327": "I",
 633        "\u0268\u0327": "i",
 634        "M\u0327": "M",
 635        "m\u0327": "m",
 636        "O\u0327": "O",
 637        "o\u0327": "o",
 638        "Q\u0327": "Q",
 639        "q\u0327": "q",
 640        "U\u0327": "U",
 641        "u\u0327": "u",
 642        "X\u0327": "X",
 643        "x\u0327": "x",
 644        "Z\u0327": "Z",
 645        "z\u0327": "z",
 646        "\u0439": "\u0438",
 647        "\u0419": "\u0418",
 648        "\u0451": "\u0435",
 649        "\u0401": "\u0415"
 650      };
 651      var chars = Object.keys(characterMap).join("|");
 652      var allAccents = new RegExp(chars, "g");
 653      var firstAccent = new RegExp(chars, "");
 654      function matcher(match2) {
 655        return characterMap[match2];
 656      }
 657      var removeAccents2 = function(string) {
 658        return string.replace(allAccents, matcher);
 659      };
 660      var hasAccents = function(string) {
 661        return !!string.match(firstAccent);
 662      };
 663      module.exports = removeAccents2;
 664      module.exports.has = hasAccents;
 665      module.exports.remove = removeAccents2;
 666    }
 667  });
 668  
 669  // node_modules/fast-deep-equal/es6/index.js
 670  var require_es6 = __commonJS({
 671    "node_modules/fast-deep-equal/es6/index.js"(exports, module) {
 672      "use strict";
 673      module.exports = function equal(a2, b2) {
 674        if (a2 === b2) return true;
 675        if (a2 && b2 && typeof a2 == "object" && typeof b2 == "object") {
 676          if (a2.constructor !== b2.constructor) return false;
 677          var length, i2, keys;
 678          if (Array.isArray(a2)) {
 679            length = a2.length;
 680            if (length != b2.length) return false;
 681            for (i2 = length; i2-- !== 0; )
 682              if (!equal(a2[i2], b2[i2])) return false;
 683            return true;
 684          }
 685          if (a2 instanceof Map && b2 instanceof Map) {
 686            if (a2.size !== b2.size) return false;
 687            for (i2 of a2.entries())
 688              if (!b2.has(i2[0])) return false;
 689            for (i2 of a2.entries())
 690              if (!equal(i2[1], b2.get(i2[0]))) return false;
 691            return true;
 692          }
 693          if (a2 instanceof Set && b2 instanceof Set) {
 694            if (a2.size !== b2.size) return false;
 695            for (i2 of a2.entries())
 696              if (!b2.has(i2[0])) return false;
 697            return true;
 698          }
 699          if (ArrayBuffer.isView(a2) && ArrayBuffer.isView(b2)) {
 700            length = a2.length;
 701            if (length != b2.length) return false;
 702            for (i2 = length; i2-- !== 0; )
 703              if (a2[i2] !== b2[i2]) return false;
 704            return true;
 705          }
 706          if (a2.constructor === RegExp) return a2.source === b2.source && a2.flags === b2.flags;
 707          if (a2.valueOf !== Object.prototype.valueOf) return a2.valueOf() === b2.valueOf();
 708          if (a2.toString !== Object.prototype.toString) return a2.toString() === b2.toString();
 709          keys = Object.keys(a2);
 710          length = keys.length;
 711          if (length !== Object.keys(b2).length) return false;
 712          for (i2 = length; i2-- !== 0; )
 713            if (!Object.prototype.hasOwnProperty.call(b2, keys[i2])) return false;
 714          for (i2 = length; i2-- !== 0; ) {
 715            var key = keys[i2];
 716            if (!equal(a2[key], b2[key])) return false;
 717          }
 718          return true;
 719        }
 720        return a2 !== a2 && b2 !== b2;
 721      };
 722    }
 723  });
 724  
 725  // package-external:@wordpress/warning
 726  var require_warning = __commonJS({
 727    "package-external:@wordpress/warning"(exports, module) {
 728      module.exports = window.wp.warning;
 729    }
 730  });
 731  
 732  // package-external:@wordpress/date
 733  var require_date = __commonJS({
 734    "package-external:@wordpress/date"(exports, module) {
 735      module.exports = window.wp.date;
 736    }
 737  });
 738  
 739  // package-external:@wordpress/core-data
 740  var require_core_data = __commonJS({
 741    "package-external:@wordpress/core-data"(exports, module) {
 742      module.exports = window.wp.coreData;
 743    }
 744  });
 745  
 746  // package-external:@wordpress/editor
 747  var require_editor = __commonJS({
 748    "package-external:@wordpress/editor"(exports, module) {
 749      module.exports = window.wp.editor;
 750    }
 751  });
 752  
 753  // routes/post-list/stage.tsx
 754  import {
 755    useParams,
 756    useNavigate,
 757    useSearch,
 758    Link,
 759    useInvalidate
 760  } from "@wordpress/route";
 761  
 762  // node_modules/dequal/dist/index.mjs
 763  var has = Object.prototype.hasOwnProperty;
 764  function find(iter, tar, key) {
 765    for (key of iter.keys()) {
 766      if (dequal(key, tar)) return key;
 767    }
 768  }
 769  function dequal(foo, bar) {
 770    var ctor, len, tmp;
 771    if (foo === bar) return true;
 772    if (foo && bar && (ctor = foo.constructor) === bar.constructor) {
 773      if (ctor === Date) return foo.getTime() === bar.getTime();
 774      if (ctor === RegExp) return foo.toString() === bar.toString();
 775      if (ctor === Array) {
 776        if ((len = foo.length) === bar.length) {
 777          while (len-- && dequal(foo[len], bar[len])) ;
 778        }
 779        return len === -1;
 780      }
 781      if (ctor === Set) {
 782        if (foo.size !== bar.size) {
 783          return false;
 784        }
 785        for (len of foo) {
 786          tmp = len;
 787          if (tmp && typeof tmp === "object") {
 788            tmp = find(bar, tmp);
 789            if (!tmp) return false;
 790          }
 791          if (!bar.has(tmp)) return false;
 792        }
 793        return true;
 794      }
 795      if (ctor === Map) {
 796        if (foo.size !== bar.size) {
 797          return false;
 798        }
 799        for (len of foo) {
 800          tmp = len[0];
 801          if (tmp && typeof tmp === "object") {
 802            tmp = find(bar, tmp);
 803            if (!tmp) return false;
 804          }
 805          if (!dequal(len[1], bar.get(tmp))) {
 806            return false;
 807          }
 808        }
 809        return true;
 810      }
 811      if (ctor === ArrayBuffer) {
 812        foo = new Uint8Array(foo);
 813        bar = new Uint8Array(bar);
 814      } else if (ctor === DataView) {
 815        if ((len = foo.byteLength) === bar.byteLength) {
 816          while (len-- && foo.getInt8(len) === bar.getInt8(len)) ;
 817        }
 818        return len === -1;
 819      }
 820      if (ArrayBuffer.isView(foo)) {
 821        if ((len = foo.byteLength) === bar.byteLength) {
 822          while (len-- && foo[len] === bar[len]) ;
 823        }
 824        return len === -1;
 825      }
 826      if (!ctor || typeof foo === "object") {
 827        len = 0;
 828        for (ctor in foo) {
 829          if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false;
 830          if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false;
 831        }
 832        return Object.keys(bar).length === len;
 833      }
 834    }
 835    return foo !== foo && bar !== bar;
 836  }
 837  
 838  // packages/views/build-module/preference-keys.js
 839  function generatePreferenceKey(kind, name, slug) {
 840    return `dataviews-$kind}-$name}-$slug}`;
 841  }
 842  
 843  // packages/views/build-module/use-view.js
 844  var import_element = __toESM(require_element());
 845  var import_data = __toESM(require_data());
 846  var import_preferences = __toESM(require_preferences());
 847  function omit(obj, keys) {
 848    const result = { ...obj };
 849    for (const key of keys) {
 850      delete result[key];
 851    }
 852    return result;
 853  }
 854  function useView(config) {
 855    const { kind, name, slug, defaultView, queryParams, onChangeQueryParams } = config;
 856    const preferenceKey = generatePreferenceKey(kind, name, slug);
 857    const persistedView = (0, import_data.useSelect)(
 858      (select2) => {
 859        return select2(import_preferences.store).get(
 860          "core/views",
 861          preferenceKey
 862        );
 863      },
 864      [preferenceKey]
 865    );
 866    const { set } = (0, import_data.useDispatch)(import_preferences.store);
 867    const baseView = persistedView ?? defaultView;
 868    const page = Number(queryParams?.page ?? baseView.page ?? 1);
 869    const search = queryParams?.search ?? baseView.search ?? "";
 870    const view = (0, import_element.useMemo)(() => {
 871      return {
 872        ...baseView,
 873        page,
 874        search
 875      };
 876    }, [baseView, page, search]);
 877    const isModified = !!persistedView;
 878    const updateView = (0, import_element.useCallback)(
 879      (newView) => {
 880        const urlParams = {
 881          page: newView?.page,
 882          search: newView?.search
 883        };
 884        const preferenceView = omit(newView, ["page", "search"]);
 885        if (onChangeQueryParams && !dequal(urlParams, { page, search })) {
 886          onChangeQueryParams(urlParams);
 887        }
 888        if (!dequal(baseView, preferenceView)) {
 889          if (dequal(preferenceView, defaultView)) {
 890            set("core/views", preferenceKey, void 0);
 891          } else {
 892            set("core/views", preferenceKey, preferenceView);
 893          }
 894        }
 895      },
 896      [
 897        onChangeQueryParams,
 898        page,
 899        search,
 900        baseView,
 901        defaultView,
 902        set,
 903        preferenceKey
 904      ]
 905    );
 906    const resetToDefault = (0, import_element.useCallback)(() => {
 907      set("core/views", preferenceKey, void 0);
 908    }, [preferenceKey, set]);
 909    return {
 910      view,
 911      isModified,
 912      updateView,
 913      resetToDefault
 914    };
 915  }
 916  
 917  // packages/views/build-module/load-view.js
 918  var import_data2 = __toESM(require_data());
 919  var import_preferences2 = __toESM(require_preferences());
 920  
 921  // packages/dataviews/build-module/components/dataviews/index.js
 922  var import_components49 = __toESM(require_components());
 923  var import_element52 = __toESM(require_element());
 924  var import_compose11 = __toESM(require_compose());
 925  
 926  // packages/dataviews/build-module/components/dataviews-context/index.js
 927  var import_element2 = __toESM(require_element());
 928  
 929  // packages/dataviews/build-module/constants.js
 930  var import_i18n = __toESM(require_i18n());
 931  
 932  // packages/icons/build-module/library/arrow-down.js
 933  var import_primitives = __toESM(require_primitives());
 934  var import_jsx_runtime = __toESM(require_jsx_runtime());
 935  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", 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" }) });
 936  
 937  // packages/icons/build-module/library/arrow-left.js
 938  var import_primitives2 = __toESM(require_primitives());
 939  var import_jsx_runtime2 = __toESM(require_jsx_runtime());
 940  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", 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" }) });
 941  
 942  // packages/icons/build-module/library/arrow-right.js
 943  var import_primitives3 = __toESM(require_primitives());
 944  var import_jsx_runtime3 = __toESM(require_jsx_runtime());
 945  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", 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" }) });
 946  
 947  // packages/icons/build-module/library/arrow-up.js
 948  var import_primitives4 = __toESM(require_primitives());
 949  var import_jsx_runtime4 = __toESM(require_jsx_runtime());
 950  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", 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" }) });
 951  
 952  // packages/icons/build-module/library/block-table.js
 953  var import_primitives5 = __toESM(require_primitives());
 954  var import_jsx_runtime5 = __toESM(require_jsx_runtime());
 955  var block_table_default = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_primitives5.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_primitives5.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" }) });
 956  
 957  // packages/icons/build-module/library/category.js
 958  var import_primitives6 = __toESM(require_primitives());
 959  var import_jsx_runtime6 = __toESM(require_jsx_runtime());
 960  var category_default = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_primitives6.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
 961    import_primitives6.Path,
 962    {
 963      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",
 964      fillRule: "evenodd",
 965      clipRule: "evenodd"
 966    }
 967  ) });
 968  
 969  // packages/icons/build-module/library/check.js
 970  var import_primitives7 = __toESM(require_primitives());
 971  var import_jsx_runtime7 = __toESM(require_jsx_runtime());
 972  var check_default = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_primitives7.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_primitives7.Path, { d: "M16.5 7.5 10 13.9l-2.5-2.4-1 1 3.5 3.6 7.5-7.6z" }) });
 973  
 974  // packages/icons/build-module/library/close-small.js
 975  var import_primitives8 = __toESM(require_primitives());
 976  var import_jsx_runtime8 = __toESM(require_jsx_runtime());
 977  var close_small_default = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_primitives8.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_primitives8.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" }) });
 978  
 979  // packages/icons/build-module/library/cog.js
 980  var import_primitives9 = __toESM(require_primitives());
 981  var import_jsx_runtime9 = __toESM(require_jsx_runtime());
 982  var cog_default = /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_primitives9.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
 983    import_primitives9.Path,
 984    {
 985      fillRule: "evenodd",
 986      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",
 987      clipRule: "evenodd"
 988    }
 989  ) });
 990  
 991  // packages/icons/build-module/library/envelope.js
 992  var import_primitives10 = __toESM(require_primitives());
 993  var import_jsx_runtime10 = __toESM(require_jsx_runtime());
 994  var envelope_default = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_primitives10.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
 995    import_primitives10.Path,
 996    {
 997      fillRule: "evenodd",
 998      clipRule: "evenodd",
 999      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"
1000    }
1001  ) });
1002  
1003  // packages/icons/build-module/library/error.js
1004  var import_primitives11 = __toESM(require_primitives());
1005  var import_jsx_runtime11 = __toESM(require_jsx_runtime());
1006  var error_default = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_primitives11.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1007    import_primitives11.Path,
1008    {
1009      fillRule: "evenodd",
1010      clipRule: "evenodd",
1011      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"
1012    }
1013  ) });
1014  
1015  // packages/icons/build-module/library/format-list-bullets-rtl.js
1016  var import_primitives12 = __toESM(require_primitives());
1017  var import_jsx_runtime12 = __toESM(require_jsx_runtime());
1018  var format_list_bullets_rtl_default = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives12.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives12.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" }) });
1019  
1020  // packages/icons/build-module/library/format-list-bullets.js
1021  var import_primitives13 = __toESM(require_primitives());
1022  var import_jsx_runtime13 = __toESM(require_jsx_runtime());
1023  var format_list_bullets_default = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_primitives13.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_primitives13.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" }) });
1024  
1025  // packages/icons/build-module/library/funnel.js
1026  var import_primitives14 = __toESM(require_primitives());
1027  var import_jsx_runtime14 = __toESM(require_jsx_runtime());
1028  var funnel_default = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_primitives14.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_primitives14.Path, { d: "M10 17.5H14V16H10V17.5ZM6 6V7.5H18V6H6ZM8 12.5H16V11H8V12.5Z" }) });
1029  
1030  // packages/icons/build-module/library/link.js
1031  var import_primitives15 = __toESM(require_primitives());
1032  var import_jsx_runtime15 = __toESM(require_jsx_runtime());
1033  var link_default = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_primitives15.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_primitives15.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" }) });
1034  
1035  // packages/icons/build-module/library/mobile.js
1036  var import_primitives16 = __toESM(require_primitives());
1037  var import_jsx_runtime16 = __toESM(require_jsx_runtime());
1038  var mobile_default = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_primitives16.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_primitives16.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" }) });
1039  
1040  // packages/icons/build-module/library/more-vertical.js
1041  var import_primitives17 = __toESM(require_primitives());
1042  var import_jsx_runtime17 = __toESM(require_jsx_runtime());
1043  var more_vertical_default = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_primitives17.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_primitives17.Path, { d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" }) });
1044  
1045  // packages/icons/build-module/library/next.js
1046  var import_primitives18 = __toESM(require_primitives());
1047  var import_jsx_runtime18 = __toESM(require_jsx_runtime());
1048  var next_default = /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_primitives18.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_primitives18.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" }) });
1049  
1050  // packages/icons/build-module/library/previous.js
1051  var import_primitives19 = __toESM(require_primitives());
1052  var import_jsx_runtime19 = __toESM(require_jsx_runtime());
1053  var previous_default = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_primitives19.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_primitives19.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" }) });
1054  
1055  // packages/icons/build-module/library/scheduled.js
1056  var import_primitives20 = __toESM(require_primitives());
1057  var import_jsx_runtime20 = __toESM(require_jsx_runtime());
1058  var scheduled_default = /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_primitives20.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1059    import_primitives20.Path,
1060    {
1061      fillRule: "evenodd",
1062      clipRule: "evenodd",
1063      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"
1064    }
1065  ) });
1066  
1067  // packages/icons/build-module/library/search.js
1068  var import_primitives21 = __toESM(require_primitives());
1069  var import_jsx_runtime21 = __toESM(require_jsx_runtime());
1070  var search_default = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_primitives21.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_primitives21.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" }) });
1071  
1072  // packages/icons/build-module/library/seen.js
1073  var import_primitives22 = __toESM(require_primitives());
1074  var import_jsx_runtime22 = __toESM(require_jsx_runtime());
1075  var seen_default = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_primitives22.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_primitives22.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" }) });
1076  
1077  // packages/icons/build-module/library/unseen.js
1078  var import_primitives23 = __toESM(require_primitives());
1079  var import_jsx_runtime23 = __toESM(require_jsx_runtime());
1080  var unseen_default = /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_primitives23.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_primitives23.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" }) });
1081  
1082  // packages/dataviews/build-module/constants.js
1083  var OPERATOR_IS_ANY = "isAny";
1084  var OPERATOR_IS_NONE = "isNone";
1085  var OPERATOR_IS_ALL = "isAll";
1086  var OPERATOR_IS_NOT_ALL = "isNotAll";
1087  var OPERATOR_BETWEEN = "between";
1088  var OPERATOR_IN_THE_PAST = "inThePast";
1089  var OPERATOR_OVER = "over";
1090  var OPERATOR_IS = "is";
1091  var OPERATOR_IS_NOT = "isNot";
1092  var OPERATOR_LESS_THAN = "lessThan";
1093  var OPERATOR_GREATER_THAN = "greaterThan";
1094  var OPERATOR_LESS_THAN_OR_EQUAL = "lessThanOrEqual";
1095  var OPERATOR_GREATER_THAN_OR_EQUAL = "greaterThanOrEqual";
1096  var OPERATOR_BEFORE = "before";
1097  var OPERATOR_AFTER = "after";
1098  var OPERATOR_BEFORE_INC = "beforeInc";
1099  var OPERATOR_AFTER_INC = "afterInc";
1100  var OPERATOR_CONTAINS = "contains";
1101  var OPERATOR_NOT_CONTAINS = "notContains";
1102  var OPERATOR_STARTS_WITH = "startsWith";
1103  var OPERATOR_ON = "on";
1104  var OPERATOR_NOT_ON = "notOn";
1105  var SORTING_DIRECTIONS = ["asc", "desc"];
1106  var sortArrows = { asc: "\u2191", desc: "\u2193" };
1107  var sortValues = { asc: "ascending", desc: "descending" };
1108  var sortLabels = {
1109    asc: (0, import_i18n.__)("Sort ascending"),
1110    desc: (0, import_i18n.__)("Sort descending")
1111  };
1112  var sortIcons = {
1113    asc: arrow_up_default,
1114    desc: arrow_down_default
1115  };
1116  var LAYOUT_TABLE = "table";
1117  var LAYOUT_GRID = "grid";
1118  var LAYOUT_LIST = "list";
1119  var LAYOUT_ACTIVITY = "activity";
1120  var LAYOUT_PICKER_GRID = "pickerGrid";
1121  var LAYOUT_PICKER_TABLE = "pickerTable";
1122  
1123  // packages/dataviews/build-module/components/dataviews-context/index.js
1124  var DataViewsContext = (0, import_element2.createContext)({
1125    view: { type: LAYOUT_TABLE },
1126    onChangeView: () => {
1127    },
1128    fields: [],
1129    data: [],
1130    paginationInfo: {
1131      totalItems: 0,
1132      totalPages: 0
1133    },
1134    selection: [],
1135    onChangeSelection: () => {
1136    },
1137    setOpenedFilter: () => {
1138    },
1139    openedFilter: null,
1140    getItemId: (item) => item.id,
1141    isItemClickable: () => true,
1142    renderItemLink: void 0,
1143    containerWidth: 0,
1144    containerRef: (0, import_element2.createRef)(),
1145    resizeObserverRef: () => {
1146    },
1147    defaultLayouts: { list: {}, grid: {}, table: {} },
1148    filters: [],
1149    isShowingFilter: false,
1150    setIsShowingFilter: () => {
1151    },
1152    hasInfiniteScrollHandler: false,
1153    config: {
1154      perPageSizes: []
1155    }
1156  });
1157  DataViewsContext.displayName = "DataViewsContext";
1158  var dataviews_context_default = DataViewsContext;
1159  
1160  // packages/dataviews/build-module/dataviews-layouts/index.js
1161  var import_i18n20 = __toESM(require_i18n());
1162  
1163  // node_modules/clsx/dist/clsx.mjs
1164  function r(e2) {
1165    var t2, f2, n2 = "";
1166    if ("string" == typeof e2 || "number" == typeof e2) n2 += e2;
1167    else if ("object" == typeof e2) if (Array.isArray(e2)) {
1168      var o2 = e2.length;
1169      for (t2 = 0; t2 < o2; t2++) e2[t2] && (f2 = r(e2[t2])) && (n2 && (n2 += " "), n2 += f2);
1170    } else for (f2 in e2) e2[f2] && (n2 && (n2 += " "), n2 += f2);
1171    return n2;
1172  }
1173  function clsx() {
1174    for (var e2, t2, f2 = 0, n2 = "", o2 = arguments.length; f2 < o2; f2++) (e2 = arguments[f2]) && (t2 = r(e2)) && (n2 && (n2 += " "), n2 += t2);
1175    return n2;
1176  }
1177  var clsx_default = clsx;
1178  
1179  // packages/dataviews/build-module/dataviews-layouts/table/index.js
1180  var import_i18n8 = __toESM(require_i18n());
1181  var import_components7 = __toESM(require_components());
1182  var import_element9 = __toESM(require_element());
1183  var import_keycodes = __toESM(require_keycodes());
1184  
1185  // packages/dataviews/build-module/components/dataviews-selection-checkbox/index.js
1186  var import_components = __toESM(require_components());
1187  var import_i18n2 = __toESM(require_i18n());
1188  var import_jsx_runtime24 = __toESM(require_jsx_runtime());
1189  function DataViewsSelectionCheckbox({
1190    selection,
1191    onChangeSelection,
1192    item,
1193    getItemId: getItemId2,
1194    titleField,
1195    disabled,
1196    ...extraProps
1197  }) {
1198    const id = getItemId2(item);
1199    const checked = !disabled && selection.includes(id);
1200    const selectionLabel = titleField?.getValue?.({ item }) || (0, import_i18n2.__)("(no title)");
1201    return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1202      import_components.CheckboxControl,
1203      {
1204        className: "dataviews-selection-checkbox",
1205        "aria-label": selectionLabel,
1206        "aria-disabled": disabled,
1207        checked,
1208        onChange: () => {
1209          if (disabled) {
1210            return;
1211          }
1212          onChangeSelection(
1213            selection.includes(id) ? selection.filter((itemId) => id !== itemId) : [...selection, id]
1214          );
1215        },
1216        ...extraProps
1217      }
1218    );
1219  }
1220  
1221  // packages/dataviews/build-module/components/dataviews-item-actions/index.js
1222  var import_components2 = __toESM(require_components());
1223  var import_i18n3 = __toESM(require_i18n());
1224  var import_element3 = __toESM(require_element());
1225  var import_data3 = __toESM(require_data());
1226  var import_compose = __toESM(require_compose());
1227  
1228  // packages/dataviews/build-module/lock-unlock.js
1229  var import_private_apis = __toESM(require_private_apis());
1230  var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
1231    "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
1232    "@wordpress/dataviews"
1233  );
1234  
1235  // packages/dataviews/build-module/components/dataviews-item-actions/index.js
1236  var import_jsx_runtime25 = __toESM(require_jsx_runtime());
1237  var { Menu, kebabCase } = unlock(import_components2.privateApis);
1238  function ButtonTrigger({
1239    action,
1240    onClick,
1241    items,
1242    variant
1243  }) {
1244    const label = typeof action.label === "string" ? action.label : action.label(items);
1245    return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1246      import_components2.Button,
1247      {
1248        disabled: !!action.disabled,
1249        accessibleWhenDisabled: true,
1250        size: "compact",
1251        variant,
1252        onClick,
1253        children: label
1254      }
1255    );
1256  }
1257  function MenuItemTrigger({
1258    action,
1259    onClick,
1260    items
1261  }) {
1262    const label = typeof action.label === "string" ? action.label : action.label(items);
1263    return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Menu.Item, { disabled: action.disabled, onClick, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Menu.ItemLabel, { children: label }) });
1264  }
1265  function ActionModal({
1266    action,
1267    items,
1268    closeModal
1269  }) {
1270    const label = typeof action.label === "string" ? action.label : action.label(items);
1271    const modalHeader = typeof action.modalHeader === "function" ? action.modalHeader(items) : action.modalHeader;
1272    return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1273      import_components2.Modal,
1274      {
1275        title: modalHeader || label,
1276        __experimentalHideHeader: !!action.hideModalHeader,
1277        onRequestClose: closeModal,
1278        focusOnMount: action.modalFocusOnMount ?? true,
1279        size: action.modalSize || "medium",
1280        overlayClassName: `dataviews-action-modal dataviews-action-modal__$kebabCase(
1281          action.id
1282        )}`,
1283        children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(action.RenderModal, { items, closeModal })
1284      }
1285    );
1286  }
1287  function ActionsMenuGroup({
1288    actions,
1289    item,
1290    registry,
1291    setActiveModalAction
1292  }) {
1293    const { primaryActions, regularActions } = (0, import_element3.useMemo)(() => {
1294      return actions.reduce(
1295        (acc, action) => {
1296          (action.isPrimary ? acc.primaryActions : acc.regularActions).push(action);
1297          return acc;
1298        },
1299        {
1300          primaryActions: [],
1301          regularActions: []
1302        }
1303      );
1304    }, [actions]);
1305    const renderActionGroup = (actionList) => actionList.map((action) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1306      MenuItemTrigger,
1307      {
1308        action,
1309        onClick: () => {
1310          if ("RenderModal" in action) {
1311            setActiveModalAction(action);
1312            return;
1313          }
1314          action.callback([item], { registry });
1315        },
1316        items: [item]
1317      },
1318      action.id
1319    ));
1320    return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Menu.Group, { children: [
1321      renderActionGroup(primaryActions),
1322      primaryActions.length > 0 && regularActions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Menu.Separator, {}),
1323      renderActionGroup(regularActions)
1324    ] });
1325  }
1326  function ItemActions({
1327    item,
1328    actions,
1329    isCompact
1330  }) {
1331    const registry = (0, import_data3.useRegistry)();
1332    const { primaryActions, eligibleActions } = (0, import_element3.useMemo)(() => {
1333      const _eligibleActions = actions.filter(
1334        (action) => !action.isEligible || action.isEligible(item)
1335      );
1336      const _primaryActions = _eligibleActions.filter(
1337        (action) => action.isPrimary
1338      );
1339      return {
1340        primaryActions: _primaryActions,
1341        eligibleActions: _eligibleActions
1342      };
1343    }, [actions, item]);
1344    if (isCompact) {
1345      return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1346        CompactItemActions,
1347        {
1348          item,
1349          actions: eligibleActions,
1350          isSmall: true,
1351          registry
1352        }
1353      );
1354    }
1355    return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
1356      import_components2.__experimentalHStack,
1357      {
1358        spacing: 0,
1359        justify: "flex-end",
1360        className: "dataviews-item-actions",
1361        style: {
1362          flexShrink: 0,
1363          width: "auto"
1364        },
1365        children: [
1366          /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1367            PrimaryActions,
1368            {
1369              item,
1370              actions: primaryActions,
1371              registry
1372            }
1373          ),
1374          primaryActions.length < eligibleActions.length && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1375            CompactItemActions,
1376            {
1377              item,
1378              actions: eligibleActions,
1379              registry
1380            }
1381          )
1382        ]
1383      }
1384    );
1385  }
1386  function CompactItemActions({
1387    item,
1388    actions,
1389    isSmall,
1390    registry
1391  }) {
1392    const [activeModalAction, setActiveModalAction] = (0, import_element3.useState)(
1393      null
1394    );
1395    return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
1396      /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Menu, { placement: "bottom-end", children: [
1397        /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1398          Menu.TriggerButton,
1399          {
1400            render: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1401              import_components2.Button,
1402              {
1403                size: isSmall ? "small" : "compact",
1404                icon: more_vertical_default,
1405                label: (0, import_i18n3.__)("Actions"),
1406                accessibleWhenDisabled: true,
1407                disabled: !actions.length,
1408                className: "dataviews-all-actions-button"
1409              }
1410            )
1411          }
1412        ),
1413        /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Menu.Popover, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1414          ActionsMenuGroup,
1415          {
1416            actions,
1417            item,
1418            registry,
1419            setActiveModalAction
1420          }
1421        ) })
1422      ] }),
1423      !!activeModalAction && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1424        ActionModal,
1425        {
1426          action: activeModalAction,
1427          items: [item],
1428          closeModal: () => setActiveModalAction(null)
1429        }
1430      )
1431    ] });
1432  }
1433  function PrimaryActions({
1434    item,
1435    actions,
1436    registry,
1437    buttonVariant
1438  }) {
1439    const [activeModalAction, setActiveModalAction] = (0, import_element3.useState)(null);
1440    const isMobileViewport = (0, import_compose.useViewportMatch)("medium", "<");
1441    if (isMobileViewport) {
1442      return null;
1443    }
1444    if (!Array.isArray(actions) || actions.length === 0) {
1445      return null;
1446    }
1447    return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
1448      actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1449        ButtonTrigger,
1450        {
1451          action,
1452          onClick: () => {
1453            if ("RenderModal" in action) {
1454              setActiveModalAction(action);
1455              return;
1456            }
1457            action.callback([item], { registry });
1458          },
1459          items: [item],
1460          variant: buttonVariant
1461        },
1462        action.id
1463      )),
1464      !!activeModalAction && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1465        ActionModal,
1466        {
1467          action: activeModalAction,
1468          items: [item],
1469          closeModal: () => setActiveModalAction(null)
1470        }
1471      )
1472    ] });
1473  }
1474  
1475  // packages/dataviews/build-module/components/dataviews-bulk-actions/index.js
1476  var import_components3 = __toESM(require_components());
1477  var import_i18n4 = __toESM(require_i18n());
1478  var import_element4 = __toESM(require_element());
1479  var import_data4 = __toESM(require_data());
1480  var import_compose2 = __toESM(require_compose());
1481  var import_jsx_runtime26 = __toESM(require_jsx_runtime());
1482  function ActionWithModal({
1483    action,
1484    items,
1485    ActionTriggerComponent
1486  }) {
1487    const [isModalOpen, setIsModalOpen] = (0, import_element4.useState)(false);
1488    const actionTriggerProps = {
1489      action,
1490      onClick: () => {
1491        setIsModalOpen(true);
1492      },
1493      items
1494    };
1495    return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
1496      /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ActionTriggerComponent, { ...actionTriggerProps }),
1497      isModalOpen && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
1498        ActionModal,
1499        {
1500          action,
1501          items,
1502          closeModal: () => setIsModalOpen(false)
1503        }
1504      )
1505    ] });
1506  }
1507  function useHasAPossibleBulkAction(actions, item) {
1508    return (0, import_element4.useMemo)(() => {
1509      return actions.some((action) => {
1510        return action.supportsBulk && (!action.isEligible || action.isEligible(item));
1511      });
1512    }, [actions, item]);
1513  }
1514  function useSomeItemHasAPossibleBulkAction(actions, data) {
1515    return (0, import_element4.useMemo)(() => {
1516      return data.some((item) => {
1517        return actions.some((action) => {
1518          return action.supportsBulk && (!action.isEligible || action.isEligible(item));
1519        });
1520      });
1521    }, [actions, data]);
1522  }
1523  function BulkSelectionCheckbox({
1524    selection,
1525    onChangeSelection,
1526    data,
1527    actions,
1528    getItemId: getItemId2
1529  }) {
1530    const selectableItems = (0, import_element4.useMemo)(() => {
1531      return data.filter((item) => {
1532        return actions.some(
1533          (action) => action.supportsBulk && (!action.isEligible || action.isEligible(item))
1534        );
1535      });
1536    }, [data, actions]);
1537    const selectedItems = data.filter(
1538      (item) => selection.includes(getItemId2(item)) && selectableItems.includes(item)
1539    );
1540    const areAllSelected = selectedItems.length === selectableItems.length;
1541    return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
1542      import_components3.CheckboxControl,
1543      {
1544        className: "dataviews-view-table-selection-checkbox",
1545        checked: areAllSelected,
1546        indeterminate: !areAllSelected && !!selectedItems.length,
1547        onChange: () => {
1548          if (areAllSelected) {
1549            onChangeSelection([]);
1550          } else {
1551            onChangeSelection(
1552              selectableItems.map((item) => getItemId2(item))
1553            );
1554          }
1555        },
1556        "aria-label": areAllSelected ? (0, import_i18n4.__)("Deselect all") : (0, import_i18n4.__)("Select all")
1557      }
1558    );
1559  }
1560  function ActionTrigger({
1561    action,
1562    onClick,
1563    isBusy,
1564    items
1565  }) {
1566    const label = typeof action.label === "string" ? action.label : action.label(items);
1567    const isMobile = (0, import_compose2.useViewportMatch)("medium", "<");
1568    if (isMobile) {
1569      return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
1570        import_components3.Button,
1571        {
1572          disabled: isBusy,
1573          accessibleWhenDisabled: true,
1574          label,
1575          icon: action.icon,
1576          size: "compact",
1577          onClick,
1578          isBusy
1579        }
1580      );
1581    }
1582    return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
1583      import_components3.Button,
1584      {
1585        disabled: isBusy,
1586        accessibleWhenDisabled: true,
1587        size: "compact",
1588        onClick,
1589        isBusy,
1590        children: label
1591      }
1592    );
1593  }
1594  var EMPTY_ARRAY = [];
1595  function ActionButton({
1596    action,
1597    selectedItems,
1598    actionInProgress,
1599    setActionInProgress
1600  }) {
1601    const registry = (0, import_data4.useRegistry)();
1602    const selectedEligibleItems = (0, import_element4.useMemo)(() => {
1603      return selectedItems.filter((item) => {
1604        return !action.isEligible || action.isEligible(item);
1605      });
1606    }, [action, selectedItems]);
1607    if ("RenderModal" in action) {
1608      return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
1609        ActionWithModal,
1610        {
1611          action,
1612          items: selectedEligibleItems,
1613          ActionTriggerComponent: ActionTrigger
1614        },
1615        action.id
1616      );
1617    }
1618    return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
1619      ActionTrigger,
1620      {
1621        action,
1622        onClick: async () => {
1623          setActionInProgress(action.id);
1624          await action.callback(selectedItems, {
1625            registry
1626          });
1627          setActionInProgress(null);
1628        },
1629        items: selectedEligibleItems,
1630        isBusy: actionInProgress === action.id
1631      },
1632      action.id
1633    );
1634  }
1635  function renderFooterContent(data, actions, getItemId2, selection, actionsToShow, selectedItems, actionInProgress, setActionInProgress, onChangeSelection) {
1636    const message2 = selectedItems.length > 0 ? (0, import_i18n4.sprintf)(
1637      /* translators: %d: number of items. */
1638      (0, import_i18n4._n)(
1639        "%d Item selected",
1640        "%d Items selected",
1641        selectedItems.length
1642      ),
1643      selectedItems.length
1644    ) : (0, import_i18n4.sprintf)(
1645      /* translators: %d: number of items. */
1646      (0, import_i18n4._n)("%d Item", "%d Items", data.length),
1647      data.length
1648    );
1649    return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
1650      import_components3.__experimentalHStack,
1651      {
1652        expanded: false,
1653        className: "dataviews-bulk-actions-footer__container",
1654        spacing: 3,
1655        children: [
1656          /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
1657            BulkSelectionCheckbox,
1658            {
1659              selection,
1660              onChangeSelection,
1661              data,
1662              actions,
1663              getItemId: getItemId2
1664            }
1665          ),
1666          /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "dataviews-bulk-actions-footer__item-count", children: message2 }),
1667          /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
1668            import_components3.__experimentalHStack,
1669            {
1670              className: "dataviews-bulk-actions-footer__action-buttons",
1671              expanded: false,
1672              spacing: 1,
1673              children: [
1674                actionsToShow.map((action) => {
1675                  return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
1676                    ActionButton,
1677                    {
1678                      action,
1679                      selectedItems,
1680                      actionInProgress,
1681                      setActionInProgress
1682                    },
1683                    action.id
1684                  );
1685                }),
1686                selectedItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
1687                  import_components3.Button,
1688                  {
1689                    icon: close_small_default,
1690                    showTooltip: true,
1691                    tooltipPosition: "top",
1692                    size: "compact",
1693                    label: (0, import_i18n4.__)("Cancel"),
1694                    disabled: !!actionInProgress,
1695                    accessibleWhenDisabled: false,
1696                    onClick: () => {
1697                      onChangeSelection(EMPTY_ARRAY);
1698                    }
1699                  }
1700                )
1701              ]
1702            }
1703          )
1704        ]
1705      }
1706    );
1707  }
1708  function FooterContent({
1709    selection,
1710    actions,
1711    onChangeSelection,
1712    data,
1713    getItemId: getItemId2
1714  }) {
1715    const [actionInProgress, setActionInProgress] = (0, import_element4.useState)(
1716      null
1717    );
1718    const footerContentRef = (0, import_element4.useRef)(null);
1719    const isMobile = (0, import_compose2.useViewportMatch)("medium", "<");
1720    const bulkActions = (0, import_element4.useMemo)(
1721      () => actions.filter((action) => action.supportsBulk),
1722      [actions]
1723    );
1724    const selectableItems = (0, import_element4.useMemo)(() => {
1725      return data.filter((item) => {
1726        return bulkActions.some(
1727          (action) => !action.isEligible || action.isEligible(item)
1728        );
1729      });
1730    }, [data, bulkActions]);
1731    const selectedItems = (0, import_element4.useMemo)(() => {
1732      return data.filter(
1733        (item) => selection.includes(getItemId2(item)) && selectableItems.includes(item)
1734      );
1735    }, [selection, data, getItemId2, selectableItems]);
1736    const actionsToShow = (0, import_element4.useMemo)(
1737      () => actions.filter((action) => {
1738        return action.supportsBulk && (!isMobile || action.icon) && selectedItems.some(
1739          (item) => !action.isEligible || action.isEligible(item)
1740        );
1741      }),
1742      [actions, selectedItems, isMobile]
1743    );
1744    if (!actionInProgress) {
1745      if (footerContentRef.current) {
1746        footerContentRef.current = null;
1747      }
1748      return renderFooterContent(
1749        data,
1750        actions,
1751        getItemId2,
1752        selection,
1753        actionsToShow,
1754        selectedItems,
1755        actionInProgress,
1756        setActionInProgress,
1757        onChangeSelection
1758      );
1759    } else if (!footerContentRef.current) {
1760      footerContentRef.current = renderFooterContent(
1761        data,
1762        actions,
1763        getItemId2,
1764        selection,
1765        actionsToShow,
1766        selectedItems,
1767        actionInProgress,
1768        setActionInProgress,
1769        onChangeSelection
1770      );
1771    }
1772    return footerContentRef.current;
1773  }
1774  function BulkActionsFooter() {
1775    const {
1776      data,
1777      selection,
1778      actions = EMPTY_ARRAY,
1779      onChangeSelection,
1780      getItemId: getItemId2
1781    } = (0, import_element4.useContext)(dataviews_context_default);
1782    return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
1783      FooterContent,
1784      {
1785        selection,
1786        onChangeSelection,
1787        data,
1788        actions,
1789        getItemId: getItemId2
1790      }
1791    );
1792  }
1793  
1794  // packages/dataviews/build-module/dataviews-layouts/table/column-header-menu.js
1795  var import_i18n5 = __toESM(require_i18n());
1796  var import_components4 = __toESM(require_components());
1797  var import_element5 = __toESM(require_element());
1798  
1799  // packages/dataviews/build-module/utils/get-hideable-fields.js
1800  function getHideableFields(view, fields) {
1801    const togglableFields = [
1802      view?.titleField,
1803      view?.mediaField,
1804      view?.descriptionField
1805    ].filter(Boolean);
1806    return fields.filter(
1807      (f2) => !togglableFields.includes(f2.id) && f2.type !== "media" && f2.enableHiding !== false
1808    );
1809  }
1810  
1811  // packages/dataviews/build-module/dataviews-layouts/table/column-header-menu.js
1812  var import_jsx_runtime27 = __toESM(require_jsx_runtime());
1813  var { Menu: Menu2 } = unlock(import_components4.privateApis);
1814  function WithMenuSeparators({ children }) {
1815    return import_element5.Children.toArray(children).filter(Boolean).map((child, i2) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_element5.Fragment, { children: [
1816      i2 > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Menu2.Separator, {}),
1817      child
1818    ] }, i2));
1819  }
1820  var _HeaderMenu = (0, import_element5.forwardRef)(function HeaderMenu({
1821    fieldId,
1822    view,
1823    fields,
1824    onChangeView,
1825    onHide,
1826    setOpenedFilter,
1827    canMove = true,
1828    canInsertLeft = true,
1829    canInsertRight = true
1830  }, ref) {
1831    const visibleFieldIds = view.fields ?? [];
1832    const index = visibleFieldIds?.indexOf(fieldId);
1833    const isSorted = view.sort?.field === fieldId;
1834    let isHidable = false;
1835    let isSortable = false;
1836    let canAddFilter = false;
1837    let operators = [];
1838    const field = fields.find((f2) => f2.id === fieldId);
1839    const { setIsShowingFilter } = (0, import_element5.useContext)(dataviews_context_default);
1840    if (!field) {
1841      return null;
1842    }
1843    isHidable = field.enableHiding !== false;
1844    isSortable = field.enableSorting !== false;
1845    const header = field.header;
1846    operators = !!field.filterBy && field.filterBy?.operators || [];
1847    canAddFilter = !view.filters?.some((_filter) => fieldId === _filter.field) && !!(field.hasElements || field.Edit) && field.filterBy !== false && !field.filterBy?.isPrimary;
1848    if (!isSortable && !canMove && !isHidable && !canAddFilter) {
1849      return header;
1850    }
1851    const hiddenFields = getHideableFields(view, fields).filter(
1852      (f2) => !visibleFieldIds.includes(f2.id)
1853    );
1854    const canInsert = (canInsertLeft || canInsertRight) && !!hiddenFields.length;
1855    return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Menu2, { children: [
1856      /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
1857        Menu2.TriggerButton,
1858        {
1859          render: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
1860            import_components4.Button,
1861            {
1862              size: "compact",
1863              className: "dataviews-view-table-header-button",
1864              ref,
1865              variant: "tertiary"
1866            }
1867          ),
1868          children: [
1869            header,
1870            view.sort && isSorted && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { "aria-hidden": "true", children: sortArrows[view.sort.direction] })
1871          ]
1872        }
1873      ),
1874      /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Menu2.Popover, { style: { minWidth: "240px" }, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(WithMenuSeparators, { children: [
1875        isSortable && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Menu2.Group, { children: SORTING_DIRECTIONS.map(
1876          (direction) => {
1877            const isChecked = view.sort && isSorted && view.sort.direction === direction;
1878            const value = `$fieldId}-$direction}`;
1879            return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
1880              Menu2.RadioItem,
1881              {
1882                name: "view-table-sorting",
1883                value,
1884                checked: isChecked,
1885                onChange: () => {
1886                  onChangeView({
1887                    ...view,
1888                    sort: {
1889                      field: fieldId,
1890                      direction
1891                    },
1892                    showLevels: false
1893                  });
1894                },
1895                children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Menu2.ItemLabel, { children: sortLabels[direction] })
1896              },
1897              value
1898            );
1899          }
1900        ) }),
1901        canAddFilter && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Menu2.Group, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
1902          Menu2.Item,
1903          {
1904            prefix: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_components4.Icon, { icon: funnel_default }),
1905            onClick: () => {
1906              setOpenedFilter(fieldId);
1907              setIsShowingFilter(true);
1908              onChangeView({
1909                ...view,
1910                page: 1,
1911                filters: [
1912                  ...view.filters || [],
1913                  {
1914                    field: fieldId,
1915                    value: void 0,
1916                    operator: operators[0]
1917                  }
1918                ]
1919              });
1920            },
1921            children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Menu2.ItemLabel, { children: (0, import_i18n5.__)("Add filter") })
1922          }
1923        ) }),
1924        (canMove || isHidable || canInsert) && field && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Menu2.Group, { children: [
1925          canMove && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
1926            Menu2.Item,
1927            {
1928              prefix: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_components4.Icon, { icon: arrow_left_default }),
1929              disabled: index < 1,
1930              onClick: () => {
1931                onChangeView({
1932                  ...view,
1933                  fields: [
1934                    ...visibleFieldIds.slice(
1935                      0,
1936                      index - 1
1937                    ) ?? [],
1938                    fieldId,
1939                    visibleFieldIds[index - 1],
1940                    ...visibleFieldIds.slice(
1941                      index + 1
1942                    )
1943                  ]
1944                });
1945              },
1946              children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Menu2.ItemLabel, { children: (0, import_i18n5.__)("Move left") })
1947            }
1948          ),
1949          canMove && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
1950            Menu2.Item,
1951            {
1952              prefix: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_components4.Icon, { icon: arrow_right_default }),
1953              disabled: index >= visibleFieldIds.length - 1,
1954              onClick: () => {
1955                onChangeView({
1956                  ...view,
1957                  fields: [
1958                    ...visibleFieldIds.slice(
1959                      0,
1960                      index
1961                    ) ?? [],
1962                    visibleFieldIds[index + 1],
1963                    fieldId,
1964                    ...visibleFieldIds.slice(
1965                      index + 2
1966                    )
1967                  ]
1968                });
1969              },
1970              children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Menu2.ItemLabel, { children: (0, import_i18n5.__)("Move right") })
1971            }
1972          ),
1973          canInsertLeft && !!hiddenFields.length && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Menu2, { children: [
1974            /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Menu2.SubmenuTriggerItem, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Menu2.ItemLabel, { children: (0, import_i18n5.__)("Insert left") }) }),
1975            /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Menu2.Popover, { children: hiddenFields.map((hiddenField) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
1976              Menu2.Item,
1977              {
1978                onClick: () => {
1979                  onChangeView({
1980                    ...view,
1981                    fields: [
1982                      ...visibleFieldIds.slice(
1983                        0,
1984                        index
1985                      ),
1986                      hiddenField.id,
1987                      ...visibleFieldIds.slice(
1988                        index
1989                      )
1990                    ]
1991                  });
1992                },
1993                children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Menu2.ItemLabel, { children: hiddenField.label })
1994              },
1995              hiddenField.id
1996            )) })
1997          ] }),
1998          canInsertRight && !!hiddenFields.length && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Menu2, { children: [
1999            /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Menu2.SubmenuTriggerItem, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Menu2.ItemLabel, { children: (0, import_i18n5.__)("Insert right") }) }),
2000            /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Menu2.Popover, { children: hiddenFields.map((hiddenField) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2001              Menu2.Item,
2002              {
2003                onClick: () => {
2004                  onChangeView({
2005                    ...view,
2006                    fields: [
2007                      ...visibleFieldIds.slice(
2008                        0,
2009                        index + 1
2010                      ),
2011                      hiddenField.id,
2012                      ...visibleFieldIds.slice(
2013                        index + 1
2014                      )
2015                    ]
2016                  });
2017                },
2018                children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Menu2.ItemLabel, { children: hiddenField.label })
2019              },
2020              hiddenField.id
2021            )) })
2022          ] }),
2023          isHidable && field && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2024            Menu2.Item,
2025            {
2026              prefix: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_components4.Icon, { icon: unseen_default }),
2027              onClick: () => {
2028                onHide(field);
2029                onChangeView({
2030                  ...view,
2031                  fields: visibleFieldIds.filter(
2032                    (id) => id !== fieldId
2033                  )
2034                });
2035              },
2036              children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Menu2.ItemLabel, { children: (0, import_i18n5.__)("Hide column") })
2037            }
2038          )
2039        ] })
2040      ] }) })
2041    ] });
2042  });
2043  var ColumnHeaderMenu = _HeaderMenu;
2044  var column_header_menu_default = ColumnHeaderMenu;
2045  
2046  // packages/dataviews/build-module/dataviews-layouts/table/column-primary.js
2047  var import_components5 = __toESM(require_components());
2048  
2049  // packages/dataviews/build-module/dataviews-layouts/utils/item-click-wrapper.js
2050  var import_element6 = __toESM(require_element());
2051  var import_jsx_runtime28 = __toESM(require_jsx_runtime());
2052  function getClickableItemProps({
2053    item,
2054    isItemClickable,
2055    onClickItem,
2056    className
2057  }) {
2058    if (!isItemClickable(item) || !onClickItem) {
2059      return { className };
2060    }
2061    return {
2062      className: className ? `$className} $className}--clickable` : void 0,
2063      role: "button",
2064      tabIndex: 0,
2065      onClick: (event) => {
2066        event.stopPropagation();
2067        onClickItem(item);
2068      },
2069      onKeyDown: (event) => {
2070        if (event.key === "Enter" || event.key === "" || event.key === " ") {
2071          event.stopPropagation();
2072          onClickItem(item);
2073        }
2074      }
2075    };
2076  }
2077  function ItemClickWrapper({
2078    item,
2079    isItemClickable,
2080    onClickItem,
2081    renderItemLink,
2082    className,
2083    children,
2084    ...extraProps
2085  }) {
2086    if (!isItemClickable(item)) {
2087      return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className, ...extraProps, children });
2088    }
2089    if (renderItemLink) {
2090      const renderedElement = renderItemLink({
2091        item,
2092        className: `$className} $className}--clickable`,
2093        ...extraProps,
2094        children
2095      });
2096      return (0, import_element6.cloneElement)(renderedElement, {
2097        onClick: (event) => {
2098          event.stopPropagation();
2099          if (renderedElement.props.onClick) {
2100            renderedElement.props.onClick(event);
2101          }
2102        },
2103        onKeyDown: (event) => {
2104          if (event.key === "Enter" || event.key === "" || event.key === " ") {
2105            event.stopPropagation();
2106            if (renderedElement.props.onKeyDown) {
2107              renderedElement.props.onKeyDown(event);
2108            }
2109          }
2110        }
2111      });
2112    }
2113    const clickProps = getClickableItemProps({
2114      item,
2115      isItemClickable,
2116      onClickItem,
2117      className
2118    });
2119    return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { ...clickProps, ...extraProps, children });
2120  }
2121  
2122  // packages/dataviews/build-module/dataviews-layouts/table/column-primary.js
2123  var import_jsx_runtime29 = __toESM(require_jsx_runtime());
2124  function ColumnPrimary({
2125    item,
2126    level,
2127    titleField,
2128    mediaField,
2129    descriptionField,
2130    onClickItem,
2131    renderItemLink,
2132    isItemClickable
2133  }) {
2134    return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_components5.__experimentalHStack, { spacing: 3, alignment: "flex-start", justify: "flex-start", children: [
2135      mediaField && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
2136        ItemClickWrapper,
2137        {
2138          item,
2139          isItemClickable,
2140          onClickItem,
2141          renderItemLink,
2142          className: "dataviews-view-table__cell-content-wrapper dataviews-column-primary__media",
2143          "aria-label": isItemClickable(item) && (!!onClickItem || !!renderItemLink) && !!titleField ? titleField.getValue?.({ item }) : void 0,
2144          children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
2145            mediaField.render,
2146            {
2147              item,
2148              field: mediaField,
2149              config: { sizes: "32px" }
2150            }
2151          )
2152        }
2153      ),
2154      /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
2155        import_components5.__experimentalVStack,
2156        {
2157          spacing: 0,
2158          alignment: "flex-start",
2159          className: "dataviews-view-table__primary-column-content",
2160          children: [
2161            titleField && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
2162              ItemClickWrapper,
2163              {
2164                item,
2165                isItemClickable,
2166                onClickItem,
2167                renderItemLink,
2168                className: "dataviews-view-table__cell-content-wrapper dataviews-title-field",
2169                children: [
2170                  level !== void 0 && level > 0 && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "dataviews-view-table__level", children: [
2171                    "\u2014".repeat(level),
2172                    "\xA0"
2173                  ] }),
2174                  /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(titleField.render, { item, field: titleField })
2175                ]
2176              }
2177            ),
2178            descriptionField && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
2179              descriptionField.render,
2180              {
2181                item,
2182                field: descriptionField
2183              }
2184            )
2185          ]
2186        }
2187      )
2188    ] });
2189  }
2190  var column_primary_default = ColumnPrimary;
2191  
2192  // packages/dataviews/build-module/dataviews-layouts/table/use-is-horizontal-scroll-end.js
2193  var import_compose3 = __toESM(require_compose());
2194  var import_element7 = __toESM(require_element());
2195  var import_i18n6 = __toESM(require_i18n());
2196  var isScrolledToEnd = (element) => {
2197    if ((0, import_i18n6.isRTL)()) {
2198      const scrollLeft = Math.abs(element.scrollLeft);
2199      return scrollLeft <= 1;
2200    }
2201    return element.scrollLeft + element.clientWidth >= element.scrollWidth - 1;
2202  };
2203  function useIsHorizontalScrollEnd({
2204    scrollContainerRef,
2205    enabled = false
2206  }) {
2207    const [isHorizontalScrollEnd, setIsHorizontalScrollEnd] = (0, import_element7.useState)(false);
2208    const handleIsHorizontalScrollEnd = (0, import_compose3.useDebounce)(
2209      (0, import_element7.useCallback)(() => {
2210        const scrollContainer = scrollContainerRef.current;
2211        if (scrollContainer) {
2212          setIsHorizontalScrollEnd(isScrolledToEnd(scrollContainer));
2213        }
2214      }, [scrollContainerRef, setIsHorizontalScrollEnd]),
2215      200
2216    );
2217    (0, import_element7.useEffect)(() => {
2218      if (typeof window === "undefined" || !enabled || !scrollContainerRef.current) {
2219        return () => {
2220        };
2221      }
2222      handleIsHorizontalScrollEnd();
2223      scrollContainerRef.current.addEventListener(
2224        "scroll",
2225        handleIsHorizontalScrollEnd
2226      );
2227      window.addEventListener("resize", handleIsHorizontalScrollEnd);
2228      return () => {
2229        scrollContainerRef.current?.removeEventListener(
2230          "scroll",
2231          handleIsHorizontalScrollEnd
2232        );
2233        window.removeEventListener("resize", handleIsHorizontalScrollEnd);
2234      };
2235    }, [scrollContainerRef, enabled]);
2236    return isHorizontalScrollEnd;
2237  }
2238  
2239  // packages/dataviews/build-module/dataviews-layouts/utils/get-data-by-group.js
2240  function getDataByGroup(data, groupByField) {
2241    return data.reduce((groups, item) => {
2242      const groupName = groupByField.getValue({ item });
2243      if (!groups.has(groupName)) {
2244        groups.set(groupName, []);
2245      }
2246      groups.get(groupName)?.push(item);
2247      return groups;
2248    }, /* @__PURE__ */ new Map());
2249  }
2250  
2251  // packages/dataviews/build-module/components/dataviews-view-config/properties-section.js
2252  var import_components6 = __toESM(require_components());
2253  var import_i18n7 = __toESM(require_i18n());
2254  var import_element8 = __toESM(require_element());
2255  var import_jsx_runtime30 = __toESM(require_jsx_runtime());
2256  function FieldItem({
2257    field,
2258    isVisible: isVisible2,
2259    onToggleVisibility
2260  }) {
2261    return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_components6.__experimentalItem, { onClick: field.enableHiding ? onToggleVisibility : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_components6.__experimentalHStack, { expanded: true, justify: "flex-start", alignment: "center", children: [
2262      /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { style: { height: 24, width: 24 }, children: isVisible2 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_components6.Icon, { icon: check_default }) }),
2263      /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "dataviews-view-config__label", children: field.label })
2264    ] }) });
2265  }
2266  function isDefined(item) {
2267    return !!item;
2268  }
2269  function PropertiesSection({
2270    showLabel = true
2271  }) {
2272    const { view, fields, onChangeView } = (0, import_element8.useContext)(dataviews_context_default);
2273    const regularFields = getHideableFields(view, fields);
2274    if (!regularFields?.length) {
2275      return null;
2276    }
2277    const titleField = fields.find((f2) => f2.id === view.titleField);
2278    const previewField = fields.find((f2) => f2.id === view.mediaField);
2279    const descriptionField = fields.find(
2280      (f2) => f2.id === view.descriptionField
2281    );
2282    const lockedFields = [
2283      {
2284        field: titleField,
2285        isVisibleFlag: "showTitle"
2286      },
2287      {
2288        field: previewField,
2289        isVisibleFlag: "showMedia"
2290      },
2291      {
2292        field: descriptionField,
2293        isVisibleFlag: "showDescription"
2294      }
2295    ].filter(({ field }) => isDefined(field));
2296    const visibleFieldIds = view.fields ?? [];
2297    const visibleRegularFieldsCount = regularFields.filter(
2298      (f2) => visibleFieldIds.includes(f2.id)
2299    ).length;
2300    let visibleLockedFields = lockedFields.filter(
2301      ({ field, isVisibleFlag }) => (
2302        // @ts-expect-error
2303        isDefined(field) && (view[isVisibleFlag] ?? true)
2304      )
2305    );
2306    const totalVisibleFields = visibleLockedFields.length + visibleRegularFieldsCount;
2307    if (totalVisibleFields === 1) {
2308      if (visibleLockedFields.length === 1) {
2309        visibleLockedFields = visibleLockedFields.map((locked) => ({
2310          ...locked,
2311          field: { ...locked.field, enableHiding: false }
2312        }));
2313      }
2314    }
2315    const hiddenLockedFields = lockedFields.filter(
2316      ({ field, isVisibleFlag }) => (
2317        // @ts-expect-error
2318        isDefined(field) && !(view[isVisibleFlag] ?? true)
2319      )
2320    );
2321    return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_components6.__experimentalVStack, { className: "dataviews-field-control", spacing: 0, children: [
2322      showLabel && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_components6.BaseControl.VisualLabel, { children: (0, import_i18n7.__)("Properties") }),
2323      /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_components6.__experimentalVStack, { className: "dataviews-view-config__properties", spacing: 0, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_components6.__experimentalItemGroup, { isBordered: true, isSeparated: true, size: "medium", children: [
2324        visibleLockedFields.map(({ field, isVisibleFlag }) => {
2325          return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
2326            FieldItem,
2327            {
2328              field,
2329              isVisible: true,
2330              onToggleVisibility: () => {
2331                onChangeView({
2332                  ...view,
2333                  [isVisibleFlag]: false
2334                });
2335              }
2336            },
2337            field.id
2338          );
2339        }),
2340        hiddenLockedFields.map(({ field, isVisibleFlag }) => {
2341          return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
2342            FieldItem,
2343            {
2344              field,
2345              isVisible: false,
2346              onToggleVisibility: () => {
2347                onChangeView({
2348                  ...view,
2349                  [isVisibleFlag]: true
2350                });
2351              }
2352            },
2353            field.id
2354          );
2355        }),
2356        regularFields.map((field) => {
2357          const isVisible2 = visibleFieldIds.includes(field.id);
2358          const isLastVisible = totalVisibleFields === 1 && isVisible2;
2359          const fieldToRender = isLastVisible ? { ...field, enableHiding: false } : field;
2360          return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
2361            FieldItem,
2362            {
2363              field: fieldToRender,
2364              isVisible: isVisible2,
2365              onToggleVisibility: () => {
2366                onChangeView({
2367                  ...view,
2368                  fields: isVisible2 ? visibleFieldIds.filter(
2369                    (fieldId) => fieldId !== field.id
2370                  ) : [...visibleFieldIds, field.id]
2371                });
2372              }
2373            },
2374            field.id
2375          );
2376        })
2377      ] }) })
2378    ] });
2379  }
2380  
2381  // packages/dataviews/build-module/dataviews-layouts/table/index.js
2382  var import_jsx_runtime31 = __toESM(require_jsx_runtime());
2383  function TableColumnField({
2384    item,
2385    fields,
2386    column,
2387    align
2388  }) {
2389    const field = fields.find((f2) => f2.id === column);
2390    if (!field) {
2391      return null;
2392    }
2393    const className = clsx_default("dataviews-view-table__cell-content-wrapper", {
2394      "dataviews-view-table__cell-align-end": align === "end",
2395      "dataviews-view-table__cell-align-center": align === "center"
2396    });
2397    return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(field.render, { item, field }) });
2398  }
2399  function TableRow({
2400    hasBulkActions,
2401    item,
2402    level,
2403    actions,
2404    fields,
2405    id,
2406    view,
2407    titleField,
2408    mediaField,
2409    descriptionField,
2410    selection,
2411    getItemId: getItemId2,
2412    isItemClickable,
2413    onClickItem,
2414    renderItemLink,
2415    onChangeSelection,
2416    isActionsColumnSticky,
2417    posinset
2418  }) {
2419    const { paginationInfo } = (0, import_element9.useContext)(dataviews_context_default);
2420    const hasPossibleBulkAction = useHasAPossibleBulkAction(actions, item);
2421    const isSelected2 = hasPossibleBulkAction && selection.includes(id);
2422    const {
2423      showTitle = true,
2424      showMedia = true,
2425      showDescription = true,
2426      infiniteScrollEnabled
2427    } = view;
2428    const isTouchDeviceRef = (0, import_element9.useRef)(false);
2429    const columns = view.fields ?? [];
2430    const hasPrimaryColumn = titleField && showTitle || mediaField && showMedia || descriptionField && showDescription;
2431    return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
2432      "tr",
2433      {
2434        className: clsx_default("dataviews-view-table__row", {
2435          "is-selected": hasPossibleBulkAction && isSelected2,
2436          "has-bulk-actions": hasPossibleBulkAction
2437        }),
2438        onTouchStart: () => {
2439          isTouchDeviceRef.current = true;
2440        },
2441        "aria-setsize": infiniteScrollEnabled ? paginationInfo.totalItems : void 0,
2442        "aria-posinset": posinset,
2443        role: infiniteScrollEnabled ? "article" : void 0,
2444        onMouseDown: (event) => {
2445          const isMetaClick = (0, import_keycodes.isAppleOS)() ? event.metaKey : event.ctrlKey;
2446          if (event.button === 0 && isMetaClick && window.navigator.userAgent.toLowerCase().includes("firefox")) {
2447            event?.preventDefault();
2448          }
2449        },
2450        onClick: (event) => {
2451          if (!hasPossibleBulkAction) {
2452            return;
2453          }
2454          const isModifierKeyPressed = (0, import_keycodes.isAppleOS)() ? event.metaKey : event.ctrlKey;
2455          if (isModifierKeyPressed && !isTouchDeviceRef.current && document.getSelection()?.type !== "Range") {
2456            onChangeSelection(
2457              selection.includes(id) ? selection.filter((itemId) => id !== itemId) : [...selection, id]
2458            );
2459          }
2460        },
2461        children: [
2462          hasBulkActions && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("td", { className: "dataviews-view-table__checkbox-column", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "dataviews-view-table__cell-content-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
2463            DataViewsSelectionCheckbox,
2464            {
2465              item,
2466              selection,
2467              onChangeSelection,
2468              getItemId: getItemId2,
2469              titleField,
2470              disabled: !hasPossibleBulkAction
2471            }
2472          ) }) }),
2473          hasPrimaryColumn && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
2474            column_primary_default,
2475            {
2476              item,
2477              level,
2478              titleField: showTitle ? titleField : void 0,
2479              mediaField: showMedia ? mediaField : void 0,
2480              descriptionField: showDescription ? descriptionField : void 0,
2481              isItemClickable,
2482              onClickItem,
2483              renderItemLink
2484            }
2485          ) }),
2486          columns.map((column) => {
2487            const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {};
2488            return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
2489              "td",
2490              {
2491                style: {
2492                  width,
2493                  maxWidth,
2494                  minWidth
2495                },
2496                children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
2497                  TableColumnField,
2498                  {
2499                    fields,
2500                    item,
2501                    column,
2502                    align
2503                  }
2504                )
2505              },
2506              column
2507            );
2508          }),
2509          !!actions?.length && // Disable reason: we are not making the element interactive,
2510          // but preventing any click events from bubbling up to the
2511          // table row. This allows us to add a click handler to the row
2512          // itself (to toggle row selection) without erroneously
2513          // intercepting click events from ItemActions.
2514          /* eslint-disable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */
2515          /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
2516            "td",
2517            {
2518              className: clsx_default("dataviews-view-table__actions-column", {
2519                "dataviews-view-table__actions-column--sticky": true,
2520                "dataviews-view-table__actions-column--stuck": isActionsColumnSticky
2521              }),
2522              onClick: (e2) => e2.stopPropagation(),
2523              children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ItemActions, { item, actions })
2524            }
2525          )
2526        ]
2527      }
2528    );
2529  }
2530  function ViewTable({
2531    actions,
2532    data,
2533    fields,
2534    getItemId: getItemId2,
2535    getItemLevel: getItemLevel2,
2536    isLoading = false,
2537    onChangeView,
2538    onChangeSelection,
2539    selection,
2540    setOpenedFilter,
2541    onClickItem,
2542    isItemClickable,
2543    renderItemLink,
2544    view,
2545    className,
2546    empty
2547  }) {
2548    const { containerRef } = (0, import_element9.useContext)(dataviews_context_default);
2549    const headerMenuRefs = (0, import_element9.useRef)(/* @__PURE__ */ new Map());
2550    const headerMenuToFocusRef = (0, import_element9.useRef)();
2551    const [nextHeaderMenuToFocus, setNextHeaderMenuToFocus] = (0, import_element9.useState)();
2552    const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data);
2553    const [contextMenuAnchor, setContextMenuAnchor] = (0, import_element9.useState)(null);
2554    (0, import_element9.useEffect)(() => {
2555      if (headerMenuToFocusRef.current) {
2556        headerMenuToFocusRef.current.focus();
2557        headerMenuToFocusRef.current = void 0;
2558      }
2559    });
2560    const tableNoticeId = (0, import_element9.useId)();
2561    const isHorizontalScrollEnd = useIsHorizontalScrollEnd({
2562      scrollContainerRef: containerRef,
2563      enabled: !!actions?.length
2564    });
2565    if (nextHeaderMenuToFocus) {
2566      headerMenuToFocusRef.current = nextHeaderMenuToFocus;
2567      setNextHeaderMenuToFocus(void 0);
2568      return;
2569    }
2570    const onHide = (field) => {
2571      const hidden = headerMenuRefs.current.get(field.id);
2572      const fallback = hidden ? headerMenuRefs.current.get(hidden.fallback) : void 0;
2573      setNextHeaderMenuToFocus(fallback?.node);
2574    };
2575    const handleHeaderContextMenu = (event) => {
2576      event.preventDefault();
2577      event.stopPropagation();
2578      const virtualAnchor = {
2579        getBoundingClientRect: () => ({
2580          x: event.clientX,
2581          y: event.clientY,
2582          top: event.clientY,
2583          left: event.clientX,
2584          right: event.clientX,
2585          bottom: event.clientY,
2586          width: 0,
2587          height: 0,
2588          toJSON: () => ({})
2589        })
2590      };
2591      window.requestAnimationFrame(() => {
2592        setContextMenuAnchor(virtualAnchor);
2593      });
2594    };
2595    const hasData = !!data?.length;
2596    const titleField = fields.find((field) => field.id === view.titleField);
2597    const mediaField = fields.find((field) => field.id === view.mediaField);
2598    const descriptionField = fields.find(
2599      (field) => field.id === view.descriptionField
2600    );
2601    const groupField = view.groupBy?.field ? fields.find((f2) => f2.id === view.groupBy?.field) : null;
2602    const dataByGroup = groupField ? getDataByGroup(data, groupField) : null;
2603    const { showTitle = true, showMedia = true, showDescription = true } = view;
2604    const hasPrimaryColumn = titleField && showTitle || mediaField && showMedia || descriptionField && showDescription;
2605    const columns = view.fields ?? [];
2606    const headerMenuRef = (column, index) => (node) => {
2607      if (node) {
2608        headerMenuRefs.current.set(column, {
2609          node,
2610          fallback: columns[index > 0 ? index - 1 : 1]
2611        });
2612      } else {
2613        headerMenuRefs.current.delete(column);
2614      }
2615    };
2616    const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup;
2617    return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
2618      /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
2619        "table",
2620        {
2621          className: clsx_default("dataviews-view-table", className, {
2622            [`has-$view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes(
2623              view.layout.density
2624            ),
2625            "has-bulk-actions": hasBulkActions
2626          }),
2627          "aria-busy": isLoading,
2628          "aria-describedby": tableNoticeId,
2629          role: isInfiniteScroll ? "feed" : void 0,
2630          children: [
2631            /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("colgroup", { children: [
2632              hasBulkActions && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("col", { className: "dataviews-view-table__col-checkbox" }),
2633              hasPrimaryColumn && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("col", { className: "dataviews-view-table__col-first-data" }),
2634              columns.map((column, index) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
2635                "col",
2636                {
2637                  className: clsx_default(
2638                    `dataviews-view-table__col-$column}`,
2639                    {
2640                      "dataviews-view-table__col-first-data": !hasPrimaryColumn && index === 0
2641                    }
2642                  )
2643                },
2644                `col-$column}`
2645              )),
2646              !!actions?.length && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("col", { className: "dataviews-view-table__col-actions" })
2647            ] }),
2648            contextMenuAnchor && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
2649              import_components7.Popover,
2650              {
2651                anchor: contextMenuAnchor,
2652                onClose: () => setContextMenuAnchor(null),
2653                placement: "bottom-start",
2654                children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(PropertiesSection, { showLabel: false })
2655              }
2656            ),
2657            /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("thead", { onContextMenu: handleHeaderContextMenu, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("tr", { className: "dataviews-view-table__row", children: [
2658              hasBulkActions && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
2659                "th",
2660                {
2661                  className: "dataviews-view-table__checkbox-column",
2662                  scope: "col",
2663                  onContextMenu: handleHeaderContextMenu,
2664                  children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
2665                    BulkSelectionCheckbox,
2666                    {
2667                      selection,
2668                      onChangeSelection,
2669                      data,
2670                      actions,
2671                      getItemId: getItemId2
2672                    }
2673                  )
2674                }
2675              ),
2676              hasPrimaryColumn && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("th", { scope: "col", children: titleField && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
2677                column_header_menu_default,
2678                {
2679                  ref: headerMenuRef(
2680                    titleField.id,
2681                    0
2682                  ),
2683                  fieldId: titleField.id,
2684                  view,
2685                  fields,
2686                  onChangeView,
2687                  onHide,
2688                  setOpenedFilter,
2689                  canMove: false,
2690                  canInsertLeft: false,
2691                  canInsertRight: view.layout?.enableMoving ?? true
2692                }
2693              ) }),
2694              columns.map((column, index) => {
2695                const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {};
2696                const canInsertOrMove = view.layout?.enableMoving ?? true;
2697                return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
2698                  "th",
2699                  {
2700                    style: {
2701                      width,
2702                      maxWidth,
2703                      minWidth,
2704                      textAlign: align
2705                    },
2706                    "aria-sort": view.sort?.direction && view.sort?.field === column ? sortValues[view.sort.direction] : void 0,
2707                    scope: "col",
2708                    children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
2709                      column_header_menu_default,
2710                      {
2711                        ref: headerMenuRef(column, index),
2712                        fieldId: column,
2713                        view,
2714                        fields,
2715                        onChangeView,
2716                        onHide,
2717                        setOpenedFilter,
2718                        canMove: canInsertOrMove,
2719                        canInsertLeft: canInsertOrMove,
2720                        canInsertRight: canInsertOrMove
2721                      }
2722                    )
2723                  },
2724                  column
2725                );
2726              }),
2727              !!actions?.length && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
2728                "th",
2729                {
2730                  className: clsx_default(
2731                    "dataviews-view-table__actions-column",
2732                    {
2733                      "dataviews-view-table__actions-column--sticky": true,
2734                      "dataviews-view-table__actions-column--stuck": !isHorizontalScrollEnd
2735                    }
2736                  ),
2737                  children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "dataviews-view-table-header", children: (0, import_i18n8.__)("Actions") })
2738                }
2739              )
2740            ] }) }),
2741            hasData && groupField && dataByGroup ? Array.from(dataByGroup.entries()).map(
2742              ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("tbody", { children: [
2743                /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("tr", { className: "dataviews-view-table__group-header-row", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
2744                  "td",
2745                  {
2746                    colSpan: columns.length + (hasPrimaryColumn ? 1 : 0) + (hasBulkActions ? 1 : 0) + (actions?.length ? 1 : 0),
2747                    className: "dataviews-view-table__group-header-cell",
2748                    children: (0, import_i18n8.sprintf)(
2749                      // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022".
2750                      (0, import_i18n8.__)("%1$s: %2$s"),
2751                      groupField.label,
2752                      groupName
2753                    )
2754                  }
2755                ) }),
2756                groupItems.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
2757                  TableRow,
2758                  {
2759                    item,
2760                    level: view.showLevels && typeof getItemLevel2 === "function" ? getItemLevel2(item) : void 0,
2761                    hasBulkActions,
2762                    actions,
2763                    fields,
2764                    id: getItemId2(item) || index.toString(),
2765                    view,
2766                    titleField,
2767                    mediaField,
2768                    descriptionField,
2769                    selection,
2770                    getItemId: getItemId2,
2771                    onChangeSelection,
2772                    onClickItem,
2773                    renderItemLink,
2774                    isItemClickable,
2775                    isActionsColumnSticky: !isHorizontalScrollEnd
2776                  },
2777                  getItemId2(item)
2778                ))
2779              ] }, `group-$groupName}`)
2780            ) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("tbody", { children: hasData && data.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
2781              TableRow,
2782              {
2783                item,
2784                level: view.showLevels && typeof getItemLevel2 === "function" ? getItemLevel2(item) : void 0,
2785                hasBulkActions,
2786                actions,
2787                fields,
2788                id: getItemId2(item) || index.toString(),
2789                view,
2790                titleField,
2791                mediaField,
2792                descriptionField,
2793                selection,
2794                getItemId: getItemId2,
2795                onChangeSelection,
2796                onClickItem,
2797                renderItemLink,
2798                isItemClickable,
2799                isActionsColumnSticky: !isHorizontalScrollEnd,
2800                posinset: isInfiniteScroll ? index + 1 : void 0
2801              },
2802              getItemId2(item)
2803            )) })
2804          ]
2805        }
2806      ),
2807      /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
2808        "div",
2809        {
2810          className: clsx_default({
2811            "dataviews-loading": isLoading,
2812            "dataviews-no-results": !hasData && !isLoading
2813          }),
2814          id: tableNoticeId,
2815          children: [
2816            !hasData && (isLoading ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_components7.Spinner, {}) }) : empty),
2817            hasData && isLoading && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_components7.Spinner, {}) })
2818          ]
2819        }
2820      )
2821    ] });
2822  }
2823  var table_default = ViewTable;
2824  
2825  // packages/dataviews/build-module/dataviews-layouts/grid/index.js
2826  var import_components10 = __toESM(require_components());
2827  var import_i18n11 = __toESM(require_i18n());
2828  
2829  // packages/dataviews/build-module/dataviews-layouts/grid/composite-grid.js
2830  var import_components9 = __toESM(require_components());
2831  var import_i18n10 = __toESM(require_i18n());
2832  var import_compose4 = __toESM(require_compose());
2833  var import_keycodes2 = __toESM(require_keycodes());
2834  var import_element11 = __toESM(require_element());
2835  
2836  // packages/dataviews/build-module/dataviews-layouts/grid/preview-size-picker.js
2837  var import_components8 = __toESM(require_components());
2838  var import_i18n9 = __toESM(require_i18n());
2839  var import_element10 = __toESM(require_element());
2840  var import_jsx_runtime32 = __toESM(require_jsx_runtime());
2841  var imageSizes = [
2842    {
2843      value: 120,
2844      breakpoint: 1
2845    },
2846    {
2847      value: 170,
2848      breakpoint: 1
2849    },
2850    {
2851      value: 230,
2852      breakpoint: 1
2853    },
2854    {
2855      value: 290,
2856      breakpoint: 1112
2857      // at minimum image width, 4 images display at this container size
2858    },
2859    {
2860      value: 350,
2861      breakpoint: 1636
2862      // at minimum image width, 6 images display at this container size
2863    },
2864    {
2865      value: 430,
2866      breakpoint: 588
2867      // at minimum image width, 2 images display at this container size
2868    }
2869  ];
2870  var DEFAULT_PREVIEW_SIZE = imageSizes[2].value;
2871  function useGridColumns() {
2872    const context = (0, import_element10.useContext)(dataviews_context_default);
2873    const view = context.view;
2874    return (0, import_element10.useMemo)(() => {
2875      const containerWidth = context.containerWidth;
2876      const gap = 32;
2877      const previewSize = view.layout?.previewSize ?? DEFAULT_PREVIEW_SIZE;
2878      const columns = Math.floor(
2879        (containerWidth + gap) / (previewSize + gap)
2880      );
2881      return Math.max(1, columns);
2882    }, [context.containerWidth, view.layout?.previewSize]);
2883  }
2884  
2885  // packages/dataviews/build-module/dataviews-layouts/grid/composite-grid.js
2886  var import_jsx_runtime33 = __toESM(require_jsx_runtime());
2887  var { Badge } = unlock(import_components9.privateApis);
2888  function chunk(array, size) {
2889    const chunks = [];
2890    for (let i2 = 0, j2 = array.length; i2 < j2; i2 += size) {
2891      chunks.push(array.slice(i2, i2 + size));
2892    }
2893    return chunks;
2894  }
2895  var GridItem = (0, import_element11.forwardRef)(function GridItem2({
2896    view,
2897    selection,
2898    onChangeSelection,
2899    onClickItem,
2900    isItemClickable,
2901    renderItemLink,
2902    getItemId: getItemId2,
2903    item,
2904    actions,
2905    mediaField,
2906    titleField,
2907    descriptionField,
2908    regularFields,
2909    badgeFields,
2910    hasBulkActions,
2911    config,
2912    ...props
2913  }, ref) {
2914    const { showTitle = true, showMedia = true, showDescription = true } = view;
2915    const hasBulkAction = useHasAPossibleBulkAction(actions, item);
2916    const id = getItemId2(item);
2917    const instanceId = (0, import_compose4.useInstanceId)(GridItem2);
2918    const isSelected2 = selection.includes(id);
2919    const renderedMediaField = mediaField?.render ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
2920      mediaField.render,
2921      {
2922        item,
2923        field: mediaField,
2924        config
2925      }
2926    ) : null;
2927    const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(titleField.render, { item, field: titleField }) : null;
2928    const shouldRenderMedia = showMedia && renderedMediaField;
2929    let mediaA11yProps;
2930    let titleA11yProps;
2931    if (isItemClickable(item) && onClickItem) {
2932      if (renderedTitleField) {
2933        mediaA11yProps = {
2934          "aria-labelledby": `dataviews-view-grid__title-field-$instanceId}`
2935        };
2936        titleA11yProps = {
2937          id: `dataviews-view-grid__title-field-$instanceId}`
2938        };
2939      } else {
2940        mediaA11yProps = {
2941          "aria-label": (0, import_i18n10.__)("Navigate to item")
2942        };
2943      }
2944    }
2945    return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
2946      import_components9.__experimentalVStack,
2947      {
2948        ...props,
2949        ref,
2950        spacing: 0,
2951        className: clsx_default(
2952          props.className,
2953          "dataviews-view-grid__row__gridcell",
2954          "dataviews-view-grid__card",
2955          {
2956            "is-selected": hasBulkAction && isSelected2
2957          }
2958        ),
2959        onClickCapture: (event) => {
2960          props.onClickCapture?.(event);
2961          if ((0, import_keycodes2.isAppleOS)() ? event.metaKey : event.ctrlKey) {
2962            event.stopPropagation();
2963            event.preventDefault();
2964            if (!hasBulkAction) {
2965              return;
2966            }
2967            onChangeSelection(
2968              selection.includes(id) ? selection.filter((itemId) => id !== itemId) : [...selection, id]
2969            );
2970          }
2971        },
2972        children: [
2973          shouldRenderMedia && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
2974            ItemClickWrapper,
2975            {
2976              item,
2977              isItemClickable,
2978              onClickItem,
2979              renderItemLink,
2980              className: "dataviews-view-grid__media",
2981              ...mediaA11yProps,
2982              children: renderedMediaField
2983            }
2984          ),
2985          hasBulkActions && shouldRenderMedia && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
2986            DataViewsSelectionCheckbox,
2987            {
2988              item,
2989              selection,
2990              onChangeSelection,
2991              getItemId: getItemId2,
2992              titleField,
2993              disabled: !hasBulkAction
2994            }
2995          ),
2996          !showTitle && shouldRenderMedia && !!actions?.length && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "dataviews-view-grid__media-actions", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ItemActions, { item, actions, isCompact: true }) }),
2997          showTitle && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
2998            import_components9.__experimentalHStack,
2999            {
3000              justify: "space-between",
3001              className: "dataviews-view-grid__title-actions",
3002              children: [
3003                /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
3004                  ItemClickWrapper,
3005                  {
3006                    item,
3007                    isItemClickable,
3008                    onClickItem,
3009                    renderItemLink,
3010                    className: "dataviews-view-grid__title-field dataviews-title-field",
3011                    ...titleA11yProps,
3012                    children: renderedTitleField
3013                  }
3014                ),
3015                !!actions?.length && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
3016                  ItemActions,
3017                  {
3018                    item,
3019                    actions,
3020                    isCompact: true
3021                  }
3022                )
3023              ]
3024            }
3025          ),
3026          /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_components9.__experimentalVStack, { spacing: 1, children: [
3027            showDescription && descriptionField?.render && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
3028              descriptionField.render,
3029              {
3030                item,
3031                field: descriptionField
3032              }
3033            ),
3034            !!badgeFields?.length && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
3035              import_components9.__experimentalHStack,
3036              {
3037                className: "dataviews-view-grid__badge-fields",
3038                spacing: 2,
3039                wrap: true,
3040                alignment: "top",
3041                justify: "flex-start",
3042                children: badgeFields.map((field) => {
3043                  return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
3044                    Badge,
3045                    {
3046                      className: "dataviews-view-grid__field-value",
3047                      children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
3048                        field.render,
3049                        {
3050                          item,
3051                          field
3052                        }
3053                      )
3054                    },
3055                    field.id
3056                  );
3057                })
3058              }
3059            ),
3060            !!regularFields?.length && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
3061              import_components9.__experimentalVStack,
3062              {
3063                className: "dataviews-view-grid__fields",
3064                spacing: 1,
3065                children: regularFields.map((field) => {
3066                  return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
3067                    import_components9.Flex,
3068                    {
3069                      className: "dataviews-view-grid__field",
3070                      gap: 1,
3071                      justify: "flex-start",
3072                      expanded: true,
3073                      style: { height: "auto" },
3074                      direction: "row",
3075                      children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
3076                        /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_components9.Tooltip, { text: field.label, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_components9.FlexItem, { className: "dataviews-view-grid__field-name", children: field.header }) }),
3077                        /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
3078                          import_components9.FlexItem,
3079                          {
3080                            className: "dataviews-view-grid__field-value",
3081                            style: { maxHeight: "none" },
3082                            children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
3083                              field.render,
3084                              {
3085                                item,
3086                                field
3087                              }
3088                            )
3089                          }
3090                        )
3091                      ] })
3092                    },
3093                    field.id
3094                  );
3095                })
3096              }
3097            )
3098          ] })
3099        ]
3100      }
3101    );
3102  });
3103  function CompositeGrid({
3104    data,
3105    isInfiniteScroll,
3106    className,
3107    isLoading,
3108    view,
3109    fields,
3110    selection,
3111    onChangeSelection,
3112    onClickItem,
3113    isItemClickable,
3114    renderItemLink,
3115    getItemId: getItemId2,
3116    actions
3117  }) {
3118    const { paginationInfo, resizeObserverRef } = (0, import_element11.useContext)(dataviews_context_default);
3119    const gridColumns = useGridColumns();
3120    const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data);
3121    const titleField = fields.find(
3122      (field) => field.id === view?.titleField
3123    );
3124    const mediaField = fields.find(
3125      (field) => field.id === view?.mediaField
3126    );
3127    const descriptionField = fields.find(
3128      (field) => field.id === view?.descriptionField
3129    );
3130    const otherFields = view.fields ?? [];
3131    const { regularFields, badgeFields } = otherFields.reduce(
3132      (accumulator, fieldId) => {
3133        const field = fields.find((f2) => f2.id === fieldId);
3134        if (!field) {
3135          return accumulator;
3136        }
3137        const key = view.layout?.badgeFields?.includes(fieldId) ? "badgeFields" : "regularFields";
3138        accumulator[key].push(field);
3139        return accumulator;
3140      },
3141      { regularFields: [], badgeFields: [] }
3142    );
3143    const size = "900px";
3144    const totalRows = Math.ceil(data.length / gridColumns);
3145    return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
3146      import_components9.Composite,
3147      {
3148        role: isInfiniteScroll ? "feed" : "grid",
3149        className: clsx_default("dataviews-view-grid", className),
3150        focusWrap: true,
3151        "aria-busy": isLoading,
3152        "aria-rowcount": isInfiniteScroll ? void 0 : totalRows,
3153        ref: resizeObserverRef,
3154        children: chunk(data, gridColumns).map((row, i2) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
3155          import_components9.Composite.Row,
3156          {
3157            render: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
3158              "div",
3159              {
3160                role: "row",
3161                "aria-rowindex": i2 + 1,
3162                "aria-label": (0, import_i18n10.sprintf)(
3163                  /* translators: %d: The row number in the grid */
3164                  (0, import_i18n10.__)("Row %d"),
3165                  i2 + 1
3166                ),
3167                className: "dataviews-view-grid__row",
3168                style: {
3169                  gridTemplateColumns: `repeat( $gridColumns}, minmax(0, 1fr) )`
3170                }
3171              }
3172            ),
3173            children: row.map((item, indexInRow) => {
3174              const index = i2 * gridColumns + indexInRow;
3175              return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
3176                import_components9.Composite.Item,
3177                {
3178                  render: (props) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
3179                    GridItem,
3180                    {
3181                      ...props,
3182                      role: isInfiniteScroll ? "article" : "gridcell",
3183                      "aria-setsize": isInfiniteScroll ? paginationInfo.totalItems : void 0,
3184                      "aria-posinset": isInfiniteScroll ? index + 1 : void 0,
3185                      view,
3186                      selection,
3187                      onChangeSelection,
3188                      onClickItem,
3189                      isItemClickable,
3190                      renderItemLink,
3191                      getItemId: getItemId2,
3192                      item,
3193                      actions,
3194                      mediaField,
3195                      titleField,
3196                      descriptionField,
3197                      regularFields,
3198                      badgeFields,
3199                      hasBulkActions,
3200                      config: {
3201                        sizes: size
3202                      }
3203                    }
3204                  )
3205                },
3206                getItemId2(item)
3207              );
3208            })
3209          },
3210          i2
3211        ))
3212      }
3213    );
3214  }
3215  
3216  // packages/dataviews/build-module/dataviews-layouts/grid/index.js
3217  var import_jsx_runtime34 = __toESM(require_jsx_runtime());
3218  function ViewGrid({
3219    actions,
3220    data,
3221    fields,
3222    getItemId: getItemId2,
3223    isLoading,
3224    onChangeSelection,
3225    onClickItem,
3226    isItemClickable,
3227    renderItemLink,
3228    selection,
3229    view,
3230    className,
3231    empty
3232  }) {
3233    const hasData = !!data?.length;
3234    const groupField = view.groupBy?.field ? fields.find((f2) => f2.id === view.groupBy?.field) : null;
3235    const dataByGroup = groupField ? getDataByGroup(data, groupField) : null;
3236    const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup;
3237    const gridProps = {
3238      className,
3239      isLoading,
3240      view,
3241      fields,
3242      selection,
3243      onChangeSelection,
3244      onClickItem,
3245      isItemClickable,
3246      renderItemLink,
3247      getItemId: getItemId2,
3248      actions
3249    };
3250    return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, {
3251      // Render multiple groups.
3252      children: [
3253        hasData && groupField && dataByGroup && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_components10.__experimentalVStack, { spacing: 4, children: Array.from(dataByGroup.entries()).map(
3254          ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_components10.__experimentalVStack, { spacing: 2, children: [
3255            /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("h3", { className: "dataviews-view-grid__group-header", children: (0, import_i18n11.sprintf)(
3256              // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022".
3257              (0, import_i18n11.__)("%1$s: %2$s"),
3258              groupField.label,
3259              groupName
3260            ) }),
3261            /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
3262              CompositeGrid,
3263              {
3264                ...gridProps,
3265                data: groupItems,
3266                isInfiniteScroll: false
3267              }
3268            )
3269          ] }, groupName)
3270        ) }),
3271        // Render a single grid with all data.
3272        hasData && !dataByGroup && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
3273          CompositeGrid,
3274          {
3275            ...gridProps,
3276            data,
3277            isInfiniteScroll: !!isInfiniteScroll
3278          }
3279        ),
3280        // Render empty state.
3281        !hasData && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
3282          "div",
3283          {
3284            className: clsx_default({
3285              "dataviews-loading": isLoading,
3286              "dataviews-no-results": !isLoading
3287            }),
3288            children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_components10.Spinner, {}) }) : empty
3289          }
3290        ),
3291        hasData && isLoading && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_components10.Spinner, {}) })
3292      ]
3293    });
3294  }
3295  var grid_default = ViewGrid;
3296  
3297  // packages/dataviews/build-module/dataviews-layouts/list/index.js
3298  var import_compose5 = __toESM(require_compose());
3299  var import_components11 = __toESM(require_components());
3300  var import_element12 = __toESM(require_element());
3301  var import_i18n12 = __toESM(require_i18n());
3302  var import_data5 = __toESM(require_data());
3303  var import_jsx_runtime35 = __toESM(require_jsx_runtime());
3304  var { Menu: Menu3 } = unlock(import_components11.privateApis);
3305  function generateItemWrapperCompositeId(idPrefix) {
3306    return `$idPrefix}-item-wrapper`;
3307  }
3308  function generatePrimaryActionCompositeId(idPrefix, primaryActionId) {
3309    return `$idPrefix}-primary-action-$primaryActionId}`;
3310  }
3311  function generateDropdownTriggerCompositeId(idPrefix) {
3312    return `$idPrefix}-dropdown`;
3313  }
3314  function PrimaryActionGridCell({
3315    idPrefix,
3316    primaryAction,
3317    item
3318  }) {
3319    const registry = (0, import_data5.useRegistry)();
3320    const [isModalOpen, setIsModalOpen] = (0, import_element12.useState)(false);
3321    const compositeItemId = generatePrimaryActionCompositeId(
3322      idPrefix,
3323      primaryAction.id
3324    );
3325    const label = typeof primaryAction.label === "string" ? primaryAction.label : primaryAction.label([item]);
3326    return "RenderModal" in primaryAction ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { role: "gridcell", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3327      import_components11.Composite.Item,
3328      {
3329        id: compositeItemId,
3330        render: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3331          import_components11.Button,
3332          {
3333            disabled: !!primaryAction.disabled,
3334            accessibleWhenDisabled: true,
3335            text: label,
3336            size: "small",
3337            onClick: () => setIsModalOpen(true)
3338          }
3339        ),
3340        children: isModalOpen && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3341          ActionModal,
3342          {
3343            action: primaryAction,
3344            items: [item],
3345            closeModal: () => setIsModalOpen(false)
3346          }
3347        )
3348      }
3349    ) }, primaryAction.id) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { role: "gridcell", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3350      import_components11.Composite.Item,
3351      {
3352        id: compositeItemId,
3353        render: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3354          import_components11.Button,
3355          {
3356            disabled: !!primaryAction.disabled,
3357            accessibleWhenDisabled: true,
3358            size: "small",
3359            onClick: () => {
3360              primaryAction.callback([item], { registry });
3361            },
3362            children: label
3363          }
3364        )
3365      }
3366    ) }, primaryAction.id);
3367  }
3368  function ListItem({
3369    view,
3370    actions,
3371    idPrefix,
3372    isSelected: isSelected2,
3373    item,
3374    titleField,
3375    mediaField,
3376    descriptionField,
3377    onSelect,
3378    otherFields,
3379    onDropdownTriggerKeyDown,
3380    posinset
3381  }) {
3382    const {
3383      showTitle = true,
3384      showMedia = true,
3385      showDescription = true,
3386      infiniteScrollEnabled
3387    } = view;
3388    const itemRef = (0, import_element12.useRef)(null);
3389    const labelId = `$idPrefix}-label`;
3390    const descriptionId = `$idPrefix}-description`;
3391    const registry = (0, import_data5.useRegistry)();
3392    const [isHovered, setIsHovered] = (0, import_element12.useState)(false);
3393    const [activeModalAction, setActiveModalAction] = (0, import_element12.useState)(
3394      null
3395    );
3396    const handleHover = ({ type }) => {
3397      const isHover = type === "mouseenter";
3398      setIsHovered(isHover);
3399    };
3400    const { paginationInfo } = (0, import_element12.useContext)(dataviews_context_default);
3401    (0, import_element12.useEffect)(() => {
3402      if (isSelected2) {
3403        itemRef.current?.scrollIntoView({
3404          behavior: "auto",
3405          block: "nearest",
3406          inline: "nearest"
3407        });
3408      }
3409    }, [isSelected2]);
3410    const { primaryAction, eligibleActions } = (0, import_element12.useMemo)(() => {
3411      const _eligibleActions = actions.filter(
3412        (action) => !action.isEligible || action.isEligible(item)
3413      );
3414      const _primaryActions = _eligibleActions.filter(
3415        (action) => action.isPrimary
3416      );
3417      return {
3418        primaryAction: _primaryActions[0],
3419        eligibleActions: _eligibleActions
3420      };
3421    }, [actions, item]);
3422    const hasOnlyOnePrimaryAction = primaryAction && actions.length === 1;
3423    const renderedMediaField = showMedia && mediaField?.render ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "dataviews-view-list__media-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3424      mediaField.render,
3425      {
3426        item,
3427        field: mediaField,
3428        config: { sizes: "52px" }
3429      }
3430    ) }) : null;
3431    const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(titleField.render, { item, field: titleField }) : null;
3432    const usedActions = eligibleActions?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_components11.__experimentalHStack, { spacing: 3, className: "dataviews-view-list__item-actions", children: [
3433      primaryAction && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3434        PrimaryActionGridCell,
3435        {
3436          idPrefix,
3437          primaryAction,
3438          item
3439        }
3440      ),
3441      !hasOnlyOnePrimaryAction && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { role: "gridcell", children: [
3442        /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Menu3, { placement: "bottom-end", children: [
3443          /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3444            Menu3.TriggerButton,
3445            {
3446              render: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3447                import_components11.Composite.Item,
3448                {
3449                  id: generateDropdownTriggerCompositeId(
3450                    idPrefix
3451                  ),
3452                  render: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3453                    import_components11.Button,
3454                    {
3455                      size: "small",
3456                      icon: more_vertical_default,
3457                      label: (0, import_i18n12.__)("Actions"),
3458                      accessibleWhenDisabled: true,
3459                      disabled: !actions.length,
3460                      onKeyDown: onDropdownTriggerKeyDown
3461                    }
3462                  )
3463                }
3464              )
3465            }
3466          ),
3467          /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Menu3.Popover, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3468            ActionsMenuGroup,
3469            {
3470              actions: eligibleActions,
3471              item,
3472              registry,
3473              setActiveModalAction
3474            }
3475          ) })
3476        ] }),
3477        !!activeModalAction && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3478          ActionModal,
3479          {
3480            action: activeModalAction,
3481            items: [item],
3482            closeModal: () => setActiveModalAction(null)
3483          }
3484        )
3485      ] })
3486    ] });
3487    return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3488      import_components11.Composite.Row,
3489      {
3490        ref: itemRef,
3491        render: (
3492          /* aria-posinset breaks Composite.Row if passed to it directly. */
3493          /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3494            "div",
3495            {
3496              "aria-posinset": posinset,
3497              "aria-setsize": infiniteScrollEnabled ? paginationInfo.totalItems : void 0
3498            }
3499          )
3500        ),
3501        role: infiniteScrollEnabled ? "article" : "row",
3502        className: clsx_default({
3503          "is-selected": isSelected2,
3504          "is-hovered": isHovered
3505        }),
3506        onMouseEnter: handleHover,
3507        onMouseLeave: handleHover,
3508        children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_components11.__experimentalHStack, { className: "dataviews-view-list__item-wrapper", spacing: 0, children: [
3509          /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { role: "gridcell", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3510            import_components11.Composite.Item,
3511            {
3512              id: generateItemWrapperCompositeId(idPrefix),
3513              "aria-pressed": isSelected2,
3514              "aria-labelledby": labelId,
3515              "aria-describedby": descriptionId,
3516              className: "dataviews-view-list__item",
3517              onClick: () => onSelect(item)
3518            }
3519          ) }),
3520          /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_components11.__experimentalHStack, { spacing: 3, justify: "start", alignment: "flex-start", children: [
3521            renderedMediaField,
3522            /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
3523              import_components11.__experimentalVStack,
3524              {
3525                spacing: 1,
3526                className: "dataviews-view-list__field-wrapper",
3527                children: [
3528                  /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_components11.__experimentalHStack, { spacing: 0, children: [
3529                    /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3530                      "div",
3531                      {
3532                        className: "dataviews-title-field",
3533                        id: labelId,
3534                        children: renderedTitleField
3535                      }
3536                    ),
3537                    usedActions
3538                  ] }),
3539                  showDescription && descriptionField?.render && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "dataviews-view-list__field", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3540                    descriptionField.render,
3541                    {
3542                      item,
3543                      field: descriptionField
3544                    }
3545                  ) }),
3546                  /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3547                    "div",
3548                    {
3549                      className: "dataviews-view-list__fields",
3550                      id: descriptionId,
3551                      children: otherFields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
3552                        "div",
3553                        {
3554                          className: "dataviews-view-list__field",
3555                          children: [
3556                            /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3557                              import_components11.VisuallyHidden,
3558                              {
3559                                as: "span",
3560                                className: "dataviews-view-list__field-label",
3561                                children: field.label
3562                              }
3563                            ),
3564                            /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "dataviews-view-list__field-value", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3565                              field.render,
3566                              {
3567                                item,
3568                                field
3569                              }
3570                            ) })
3571                          ]
3572                        },
3573                        field.id
3574                      ))
3575                    }
3576                  )
3577                ]
3578              }
3579            )
3580          ] })
3581        ] })
3582      }
3583    );
3584  }
3585  function isDefined2(item) {
3586    return !!item;
3587  }
3588  function ViewList(props) {
3589    const {
3590      actions,
3591      data,
3592      fields,
3593      getItemId: getItemId2,
3594      isLoading,
3595      onChangeSelection,
3596      selection,
3597      view,
3598      className,
3599      empty
3600    } = props;
3601    const baseId = (0, import_compose5.useInstanceId)(ViewList, "view-list");
3602    const selectedItem = data?.findLast(
3603      (item) => selection.includes(getItemId2(item))
3604    );
3605    const titleField = fields.find((field) => field.id === view.titleField);
3606    const mediaField = fields.find((field) => field.id === view.mediaField);
3607    const descriptionField = fields.find(
3608      (field) => field.id === view.descriptionField
3609    );
3610    const otherFields = (view?.fields ?? []).map((fieldId) => fields.find((f2) => fieldId === f2.id)).filter(isDefined2);
3611    const onSelect = (item) => onChangeSelection([getItemId2(item)]);
3612    const generateCompositeItemIdPrefix = (0, import_element12.useCallback)(
3613      (item) => `$baseId}-$getItemId2(item)}`,
3614      [baseId, getItemId2]
3615    );
3616    const isActiveCompositeItem = (0, import_element12.useCallback)(
3617      (item, idToCheck) => {
3618        return idToCheck.startsWith(
3619          generateCompositeItemIdPrefix(item)
3620        );
3621      },
3622      [generateCompositeItemIdPrefix]
3623    );
3624    const [activeCompositeId, setActiveCompositeId] = (0, import_element12.useState)(void 0);
3625    (0, import_element12.useEffect)(() => {
3626      if (selectedItem) {
3627        setActiveCompositeId(
3628          generateItemWrapperCompositeId(
3629            generateCompositeItemIdPrefix(selectedItem)
3630          )
3631        );
3632      }
3633    }, [selectedItem, generateCompositeItemIdPrefix]);
3634    const activeItemIndex = data.findIndex(
3635      (item) => isActiveCompositeItem(item, activeCompositeId ?? "")
3636    );
3637    const previousActiveItemIndex = (0, import_compose5.usePrevious)(activeItemIndex);
3638    const isActiveIdInList = activeItemIndex !== -1;
3639    const selectCompositeItem = (0, import_element12.useCallback)(
3640      (targetIndex, generateCompositeId) => {
3641        const clampedIndex = Math.min(
3642          data.length - 1,
3643          Math.max(0, targetIndex)
3644        );
3645        if (!data[clampedIndex]) {
3646          return;
3647        }
3648        const itemIdPrefix = generateCompositeItemIdPrefix(
3649          data[clampedIndex]
3650        );
3651        const targetCompositeItemId = generateCompositeId(itemIdPrefix);
3652        setActiveCompositeId(targetCompositeItemId);
3653        document.getElementById(targetCompositeItemId)?.focus();
3654      },
3655      [data, generateCompositeItemIdPrefix]
3656    );
3657    (0, import_element12.useEffect)(() => {
3658      const wasActiveIdInList = previousActiveItemIndex !== void 0 && previousActiveItemIndex !== -1;
3659      if (!isActiveIdInList && wasActiveIdInList) {
3660        selectCompositeItem(
3661          previousActiveItemIndex,
3662          generateItemWrapperCompositeId
3663        );
3664      }
3665    }, [isActiveIdInList, selectCompositeItem, previousActiveItemIndex]);
3666    const onDropdownTriggerKeyDown = (0, import_element12.useCallback)(
3667      (event) => {
3668        if (event.key === "ArrowDown") {
3669          event.preventDefault();
3670          selectCompositeItem(
3671            activeItemIndex + 1,
3672            generateDropdownTriggerCompositeId
3673          );
3674        }
3675        if (event.key === "ArrowUp") {
3676          event.preventDefault();
3677          selectCompositeItem(
3678            activeItemIndex - 1,
3679            generateDropdownTriggerCompositeId
3680          );
3681        }
3682      },
3683      [selectCompositeItem, activeItemIndex]
3684    );
3685    const hasData = data?.length;
3686    if (!hasData) {
3687      return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3688        "div",
3689        {
3690          className: clsx_default({
3691            "dataviews-loading": isLoading,
3692            "dataviews-no-results": !hasData && !isLoading
3693          }),
3694          children: !hasData && (isLoading ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_components11.Spinner, {}) }) : empty)
3695        }
3696      );
3697    }
3698    const groupField = view.groupBy?.field ? fields.find((field) => field.id === view.groupBy?.field) : null;
3699    const dataByGroup = groupField ? getDataByGroup(data, groupField) : null;
3700    if (hasData && groupField && dataByGroup) {
3701      return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3702        import_components11.Composite,
3703        {
3704          id: `$baseId}`,
3705          render: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", {}),
3706          className: "dataviews-view-list__group",
3707          role: "grid",
3708          activeId: activeCompositeId,
3709          setActiveId: setActiveCompositeId,
3710          children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3711            import_components11.__experimentalVStack,
3712            {
3713              spacing: 4,
3714              className: clsx_default("dataviews-view-list", className),
3715              children: Array.from(dataByGroup.entries()).map(
3716                ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_components11.__experimentalVStack, { spacing: 2, children: [
3717                  /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("h3", { className: "dataviews-view-list__group-header", children: (0, import_i18n12.sprintf)(
3718                    // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022".
3719                    (0, import_i18n12.__)("%1$s: %2$s"),
3720                    groupField.label,
3721                    groupName
3722                  ) }),
3723                  groupItems.map((item) => {
3724                    const id = generateCompositeItemIdPrefix(item);
3725                    return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3726                      ListItem,
3727                      {
3728                        view,
3729                        idPrefix: id,
3730                        actions,
3731                        item,
3732                        isSelected: item === selectedItem,
3733                        onSelect,
3734                        mediaField,
3735                        titleField,
3736                        descriptionField,
3737                        otherFields,
3738                        onDropdownTriggerKeyDown
3739                      },
3740                      id
3741                    );
3742                  })
3743                ] }, groupName)
3744              )
3745            }
3746          )
3747        }
3748      );
3749    }
3750    return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
3751      /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3752        import_components11.Composite,
3753        {
3754          id: baseId,
3755          render: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", {}),
3756          className: clsx_default("dataviews-view-list", className),
3757          role: view.infiniteScrollEnabled ? "feed" : "grid",
3758          activeId: activeCompositeId,
3759          setActiveId: setActiveCompositeId,
3760          children: data.map((item, index) => {
3761            const id = generateCompositeItemIdPrefix(item);
3762            return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3763              ListItem,
3764              {
3765                view,
3766                idPrefix: id,
3767                actions,
3768                item,
3769                isSelected: item === selectedItem,
3770                onSelect,
3771                mediaField,
3772                titleField,
3773                descriptionField,
3774                otherFields,
3775                onDropdownTriggerKeyDown,
3776                posinset: view.infiniteScrollEnabled ? index + 1 : void 0
3777              },
3778              id
3779            );
3780          })
3781        }
3782      ),
3783      hasData && isLoading && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_components11.Spinner, {}) })
3784    ] });
3785  }
3786  
3787  // packages/dataviews/build-module/dataviews-layouts/activity/index.js
3788  var import_components14 = __toESM(require_components());
3789  
3790  // packages/dataviews/build-module/dataviews-layouts/activity/activity-group.js
3791  var import_components12 = __toESM(require_components());
3792  var import_i18n13 = __toESM(require_i18n());
3793  var import_element13 = __toESM(require_element());
3794  var import_jsx_runtime36 = __toESM(require_jsx_runtime());
3795  function ActivityGroup({
3796    groupName,
3797    groupData,
3798    groupField,
3799    children
3800  }) {
3801    const groupHeader = (0, import_element13.createInterpolateElement)(
3802      // translators: %s: The label of the field e.g. "Status".
3803      (0, import_i18n13.sprintf)((0, import_i18n13.__)("%s: <groupName />"), groupField.label).trim(),
3804      {
3805        groupName: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
3806          groupField.render,
3807          {
3808            item: groupData[0],
3809            field: groupField
3810          }
3811        )
3812      }
3813    );
3814    return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
3815      import_components12.__experimentalVStack,
3816      {
3817        spacing: 0,
3818        className: "dataviews-view-activity__group",
3819        children: [
3820          /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("h3", { className: "dataviews-view-activity__group-header", children: groupHeader }),
3821          children
3822        ]
3823      },
3824      groupName
3825    );
3826  }
3827  
3828  // packages/dataviews/build-module/dataviews-layouts/activity/activity-item.js
3829  var import_components13 = __toESM(require_components());
3830  var import_element14 = __toESM(require_element());
3831  var import_data6 = __toESM(require_data());
3832  var import_jsx_runtime37 = __toESM(require_jsx_runtime());
3833  function ActivityItem(props) {
3834    const {
3835      view,
3836      actions,
3837      item,
3838      titleField,
3839      mediaField,
3840      descriptionField,
3841      otherFields,
3842      posinset,
3843      onClickItem,
3844      renderItemLink,
3845      isItemClickable
3846    } = props;
3847    const {
3848      showTitle = true,
3849      showMedia = true,
3850      showDescription = true,
3851      infiniteScrollEnabled
3852    } = view;
3853    const itemRef = (0, import_element14.useRef)(null);
3854    const registry = (0, import_data6.useRegistry)();
3855    const { paginationInfo } = (0, import_element14.useContext)(dataviews_context_default);
3856    const { primaryActions, eligibleActions } = (0, import_element14.useMemo)(() => {
3857      const _eligibleActions = actions.filter(
3858        (action) => !action.isEligible || action.isEligible(item)
3859      );
3860      const _primaryActions = _eligibleActions.filter(
3861        (action) => action.isPrimary
3862      );
3863      return {
3864        primaryActions: _primaryActions,
3865        eligibleActions: _eligibleActions
3866      };
3867    }, [actions, item]);
3868    const density = view.layout?.density ?? "balanced";
3869    const mediaContent = showMedia && density !== "compact" && mediaField?.render ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
3870      mediaField.render,
3871      {
3872        item,
3873        field: mediaField,
3874        config: {
3875          sizes: density === "comfortable" ? "32px" : "24px"
3876        }
3877      }
3878    ) : null;
3879    const renderedMediaField = /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "dataviews-view-activity__item-type-icon", children: mediaContent || /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
3880      "span",
3881      {
3882        className: "dataviews-view-activity__item-bullet",
3883        "aria-hidden": "true"
3884      }
3885    ) });
3886    const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(titleField.render, { item, field: titleField }) : null;
3887    const verticalSpacing = (0, import_element14.useMemo)(() => {
3888      switch (density) {
3889        case "comfortable":
3890          return "3";
3891        default:
3892          return "2";
3893      }
3894    }, [density]);
3895    return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
3896      "div",
3897      {
3898        ref: itemRef,
3899        role: infiniteScrollEnabled ? "article" : void 0,
3900        "aria-posinset": posinset,
3901        "aria-setsize": infiniteScrollEnabled ? paginationInfo.totalItems : void 0,
3902        className: clsx_default(
3903          "dataviews-view-activity__item",
3904          density === "compact" && "is-compact",
3905          density === "balanced" && "is-balanced",
3906          density === "comfortable" && "is-comfortable"
3907        ),
3908        children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_components13.__experimentalHStack, { spacing: 4, justify: "start", alignment: "flex-start", children: [
3909          /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
3910            import_components13.__experimentalVStack,
3911            {
3912              spacing: 1,
3913              alignment: "center",
3914              className: "dataviews-view-activity__item-type",
3915              children: renderedMediaField
3916            }
3917          ),
3918          /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
3919            import_components13.__experimentalVStack,
3920            {
3921              spacing: verticalSpacing,
3922              alignment: "flex-start",
3923              className: "dataviews-view-activity__item-content",
3924              children: [
3925                renderedTitleField && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
3926                  ItemClickWrapper,
3927                  {
3928                    item,
3929                    isItemClickable,
3930                    onClickItem,
3931                    renderItemLink,
3932                    className: "dataviews-view-activity__item-title",
3933                    children: renderedTitleField
3934                  }
3935                ),
3936                showDescription && descriptionField && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "dataviews-view-activity__item-description", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
3937                  descriptionField.render,
3938                  {
3939                    item,
3940                    field: descriptionField
3941                  }
3942                ) }),
3943                /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "dataviews-view-activity__item-fields", children: otherFields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
3944                  "div",
3945                  {
3946                    className: "dataviews-view-activity__item-field",
3947                    children: [
3948                      /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
3949                        import_components13.VisuallyHidden,
3950                        {
3951                          as: "span",
3952                          className: "dataviews-view-activity__item-field-label",
3953                          children: field.label
3954                        }
3955                      ),
3956                      /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "dataviews-view-activity__item-field-value", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
3957                        field.render,
3958                        {
3959                          item,
3960                          field
3961                        }
3962                      ) })
3963                    ]
3964                  },
3965                  field.id
3966                )) }),
3967                !!primaryActions?.length && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
3968                  PrimaryActions,
3969                  {
3970                    item,
3971                    actions: primaryActions,
3972                    registry,
3973                    buttonVariant: "secondary"
3974                  }
3975                )
3976              ]
3977            }
3978          ),
3979          primaryActions.length < eligibleActions.length && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "dataviews-view-activity__item-actions", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
3980            ItemActions,
3981            {
3982              item,
3983              actions: eligibleActions,
3984              isCompact: true
3985            }
3986          ) })
3987        ] })
3988      }
3989    );
3990  }
3991  var activity_item_default = ActivityItem;
3992  
3993  // packages/dataviews/build-module/dataviews-layouts/activity/activity-items.js
3994  var import_react = __toESM(require_react());
3995  function isDefined3(item) {
3996    return !!item;
3997  }
3998  function ActivityItems(props) {
3999    const { data, fields, getItemId: getItemId2, view } = props;
4000    const titleField = fields.find((field) => field.id === view.titleField);
4001    const mediaField = fields.find((field) => field.id === view.mediaField);
4002    const descriptionField = fields.find(
4003      (field) => field.id === view.descriptionField
4004    );
4005    const otherFields = (view?.fields ?? []).map((fieldId) => fields.find((f2) => fieldId === f2.id)).filter(isDefined3);
4006    return data.map((item, index) => {
4007      return /* @__PURE__ */ (0, import_react.createElement)(
4008        activity_item_default,
4009        {
4010          ...props,
4011          key: getItemId2(item),
4012          item,
4013          mediaField,
4014          titleField,
4015          descriptionField,
4016          otherFields,
4017          posinset: view.infiniteScrollEnabled ? index + 1 : void 0
4018        }
4019      );
4020    });
4021  }
4022  
4023  // packages/dataviews/build-module/dataviews-layouts/activity/index.js
4024  var import_jsx_runtime38 = __toESM(require_jsx_runtime());
4025  function ViewActivity(props) {
4026    const { empty, data, fields, isLoading, view, className } = props;
4027    const hasData = data?.length;
4028    if (!hasData) {
4029      return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
4030        "div",
4031        {
4032          className: clsx_default({
4033            "dataviews-loading": isLoading,
4034            "dataviews-no-results": !hasData && !isLoading
4035          }),
4036          children: !hasData && (isLoading ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_components14.Spinner, {}) }) : empty)
4037        }
4038      );
4039    }
4040    const wrapperClassName = clsx_default("dataviews-view-activity", className);
4041    const groupField = view.groupBy?.field ? fields.find((field) => field.id === view.groupBy?.field) : null;
4042    const dataByGroup = groupField ? getDataByGroup(data, groupField) : null;
4043    const groupedEntries = dataByGroup ? Array.from(dataByGroup.entries()) : [];
4044    if (hasData && groupField && dataByGroup) {
4045      return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_components14.__experimentalVStack, { spacing: 2, className: wrapperClassName, children: groupedEntries.map(
4046        ([groupName, groupData]) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
4047          ActivityGroup,
4048          {
4049            groupName,
4050            groupData,
4051            groupField,
4052            children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
4053              ActivityItems,
4054              {
4055                ...props,
4056                data: groupData
4057              }
4058            )
4059          },
4060          groupName
4061        )
4062      ) });
4063    }
4064    return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
4065      /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
4066        "div",
4067        {
4068          className: wrapperClassName,
4069          role: view.infiniteScrollEnabled ? "feed" : void 0,
4070          children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ActivityItems, { ...props })
4071        }
4072      ),
4073      hasData && isLoading && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_components14.Spinner, {}) })
4074    ] });
4075  }
4076  
4077  // packages/dataviews/build-module/dataviews-layouts/picker-grid/index.js
4078  var import_components17 = __toESM(require_components());
4079  var import_i18n16 = __toESM(require_i18n());
4080  var import_compose6 = __toESM(require_compose());
4081  var import_element18 = __toESM(require_element());
4082  
4083  // packages/dataviews/build-module/components/dataviews-picker/footer.js
4084  var import_components16 = __toESM(require_components());
4085  var import_data7 = __toESM(require_data());
4086  var import_element16 = __toESM(require_element());
4087  var import_i18n15 = __toESM(require_i18n());
4088  
4089  // packages/dataviews/build-module/components/dataviews-pagination/index.js
4090  var import_components15 = __toESM(require_components());
4091  var import_element15 = __toESM(require_element());
4092  var import_i18n14 = __toESM(require_i18n());
4093  var import_jsx_runtime39 = __toESM(require_jsx_runtime());
4094  function DataViewsPagination() {
4095    const {
4096      view,
4097      onChangeView,
4098      paginationInfo: { totalItems = 0, totalPages }
4099    } = (0, import_element15.useContext)(dataviews_context_default);
4100    if (!totalItems || !totalPages || view.infiniteScrollEnabled) {
4101      return null;
4102    }
4103    const currentPage = view.page ?? 1;
4104    const pageSelectOptions = Array.from(Array(totalPages)).map(
4105      (_, i2) => {
4106        const page = i2 + 1;
4107        return {
4108          value: page.toString(),
4109          label: page.toString(),
4110          "aria-label": currentPage === page ? (0, import_i18n14.sprintf)(
4111            // translators: 1: current page number. 2: total number of pages.
4112            (0, import_i18n14.__)("Page %1$d of %2$d"),
4113            currentPage,
4114            totalPages
4115          ) : page.toString()
4116        };
4117      }
4118    );
4119    return !!totalItems && totalPages !== 1 && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
4120      import_components15.__experimentalHStack,
4121      {
4122        expanded: false,
4123        className: "dataviews-pagination",
4124        justify: "end",
4125        spacing: 6,
4126        children: [
4127          /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
4128            import_components15.__experimentalHStack,
4129            {
4130              justify: "flex-start",
4131              expanded: false,
4132              spacing: 1,
4133              className: "dataviews-pagination__page-select",
4134              children: (0, import_element15.createInterpolateElement)(
4135                (0, import_i18n14.sprintf)(
4136                  // translators: 1: Current page number, 2: Total number of pages.
4137                  (0, import_i18n14._x)(
4138                    "<div>Page</div>%1$s<div>of %2$d</div>",
4139                    "paging"
4140                  ),
4141                  "<CurrentPage />",
4142                  totalPages
4143                ),
4144                {
4145                  div: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { "aria-hidden": true }),
4146                  CurrentPage: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
4147                    import_components15.SelectControl,
4148                    {
4149                      "aria-label": (0, import_i18n14.__)("Current page"),
4150                      value: currentPage.toString(),
4151                      options: pageSelectOptions,
4152                      onChange: (newValue) => {
4153                        onChangeView({
4154                          ...view,
4155                          page: +newValue
4156                        });
4157                      },
4158                      size: "small",
4159                      variant: "minimal"
4160                    }
4161                  )
4162                }
4163              )
4164            }
4165          ),
4166          /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_components15.__experimentalHStack, { expanded: false, spacing: 1, children: [
4167            /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
4168              import_components15.Button,
4169              {
4170                onClick: () => onChangeView({
4171                  ...view,
4172                  page: currentPage - 1
4173                }),
4174                disabled: currentPage === 1,
4175                accessibleWhenDisabled: true,
4176                label: (0, import_i18n14.__)("Previous page"),
4177                icon: (0, import_i18n14.isRTL)() ? next_default : previous_default,
4178                showTooltip: true,
4179                size: "compact",
4180                tooltipPosition: "top"
4181              }
4182            ),
4183            /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
4184              import_components15.Button,
4185              {
4186                onClick: () => onChangeView({ ...view, page: currentPage + 1 }),
4187                disabled: currentPage >= totalPages,
4188                accessibleWhenDisabled: true,
4189                label: (0, import_i18n14.__)("Next page"),
4190                icon: (0, import_i18n14.isRTL)() ? previous_default : next_default,
4191                showTooltip: true,
4192                size: "compact",
4193                tooltipPosition: "top"
4194              }
4195            )
4196          ] })
4197        ]
4198      }
4199    );
4200  }
4201  var dataviews_pagination_default = (0, import_element15.memo)(DataViewsPagination);
4202  
4203  // packages/dataviews/build-module/components/dataviews-picker/footer.js
4204  var import_jsx_runtime40 = __toESM(require_jsx_runtime());
4205  function useIsMultiselectPicker(actions) {
4206    return (0, import_element16.useMemo)(() => {
4207      return actions?.every((action) => action.supportsBulk);
4208    }, [actions]);
4209  }
4210  
4211  // packages/dataviews/build-module/dataviews-layouts/utils/grid-items.js
4212  var import_element17 = __toESM(require_element());
4213  var import_jsx_runtime41 = __toESM(require_jsx_runtime());
4214  var GridItems = (0, import_element17.forwardRef)(({ className, previewSize, ...props }, ref) => {
4215    return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
4216      "div",
4217      {
4218        ref,
4219        className: clsx_default("dataviews-view-grid-items", className),
4220        style: {
4221          gridTemplateColumns: previewSize && `repeat(auto-fill, minmax($previewSize}px, 1fr))`
4222        },
4223        ...props
4224      }
4225    );
4226  });
4227  
4228  // packages/dataviews/build-module/dataviews-layouts/picker-grid/index.js
4229  var import_jsx_runtime42 = __toESM(require_jsx_runtime());
4230  var { Badge: Badge2 } = unlock(import_components17.privateApis);
4231  function GridItem3({
4232    view,
4233    multiselect,
4234    selection,
4235    onChangeSelection,
4236    getItemId: getItemId2,
4237    item,
4238    mediaField,
4239    titleField,
4240    descriptionField,
4241    regularFields,
4242    badgeFields,
4243    config,
4244    posinset,
4245    setsize
4246  }) {
4247    const { showTitle = true, showMedia = true, showDescription = true } = view;
4248    const id = getItemId2(item);
4249    const isSelected2 = selection.includes(id);
4250    const renderedMediaField = mediaField?.render ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4251      mediaField.render,
4252      {
4253        item,
4254        field: mediaField,
4255        config
4256      }
4257    ) : null;
4258    const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(titleField.render, { item, field: titleField }) : null;
4259    return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
4260      import_components17.Composite.Item,
4261      {
4262        "aria-label": titleField ? titleField.getValue({ item }) || (0, import_i18n16.__)("(no title)") : void 0,
4263        render: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_components17.__experimentalVStack, { spacing: 0, children, ...props }),
4264        role: "option",
4265        "aria-posinset": posinset,
4266        "aria-setsize": setsize,
4267        className: clsx_default("dataviews-view-picker-grid__card", {
4268          "is-selected": isSelected2
4269        }),
4270        "aria-selected": isSelected2,
4271        onClick: () => {
4272          if (isSelected2) {
4273            onChangeSelection(
4274              selection.filter((itemId) => id !== itemId)
4275            );
4276          } else {
4277            const newSelection = multiselect ? [...selection, id] : [id];
4278            onChangeSelection(newSelection);
4279          }
4280        },
4281        children: [
4282          showMedia && renderedMediaField && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "dataviews-view-picker-grid__media", children: renderedMediaField }),
4283          showMedia && renderedMediaField && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4284            DataViewsSelectionCheckbox,
4285            {
4286              item,
4287              selection,
4288              onChangeSelection,
4289              getItemId: getItemId2,
4290              titleField,
4291              disabled: false,
4292              "aria-hidden": true,
4293              tabIndex: -1
4294            }
4295          ),
4296          showTitle && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4297            import_components17.__experimentalHStack,
4298            {
4299              justify: "space-between",
4300              className: "dataviews-view-picker-grid__title-actions",
4301              children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "dataviews-view-picker-grid__title-field dataviews-title-field", children: renderedTitleField })
4302            }
4303          ),
4304          /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_components17.__experimentalVStack, { spacing: 1, children: [
4305            showDescription && descriptionField?.render && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4306              descriptionField.render,
4307              {
4308                item,
4309                field: descriptionField
4310              }
4311            ),
4312            !!badgeFields?.length && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4313              import_components17.__experimentalHStack,
4314              {
4315                className: "dataviews-view-picker-grid__badge-fields",
4316                spacing: 2,
4317                wrap: true,
4318                alignment: "top",
4319                justify: "flex-start",
4320                children: badgeFields.map((field) => {
4321                  return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4322                    Badge2,
4323                    {
4324                      className: "dataviews-view-picker-grid__field-value",
4325                      children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4326                        field.render,
4327                        {
4328                          item,
4329                          field
4330                        }
4331                      )
4332                    },
4333                    field.id
4334                  );
4335                })
4336              }
4337            ),
4338            !!regularFields?.length && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4339              import_components17.__experimentalVStack,
4340              {
4341                className: "dataviews-view-picker-grid__fields",
4342                spacing: 1,
4343                children: regularFields.map((field) => {
4344                  return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4345                    import_components17.Flex,
4346                    {
4347                      className: "dataviews-view-picker-grid__field",
4348                      gap: 1,
4349                      justify: "flex-start",
4350                      expanded: true,
4351                      style: { height: "auto" },
4352                      direction: "row",
4353                      children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
4354                        /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_components17.FlexItem, { className: "dataviews-view-picker-grid__field-name", children: field.header }),
4355                        /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4356                          import_components17.FlexItem,
4357                          {
4358                            className: "dataviews-view-picker-grid__field-value",
4359                            style: { maxHeight: "none" },
4360                            children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4361                              field.render,
4362                              {
4363                                item,
4364                                field
4365                              }
4366                            )
4367                          }
4368                        )
4369                      ] })
4370                    },
4371                    field.id
4372                  );
4373                })
4374              }
4375            )
4376          ] })
4377        ]
4378      },
4379      id
4380    );
4381  }
4382  function GridGroup({
4383    groupName,
4384    groupField,
4385    children
4386  }) {
4387    const headerId = (0, import_compose6.useInstanceId)(
4388      GridGroup,
4389      "dataviews-view-picker-grid-group__header"
4390    );
4391    return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
4392      import_components17.__experimentalVStack,
4393      {
4394        spacing: 2,
4395        role: "group",
4396        "aria-labelledby": headerId,
4397        children: [
4398          /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4399            "h3",
4400            {
4401              className: "dataviews-view-picker-grid-group__header",
4402              id: headerId,
4403              children: (0, import_i18n16.sprintf)(
4404                // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022".
4405                (0, import_i18n16.__)("%1$s: %2$s"),
4406                groupField.label,
4407                groupName
4408              )
4409            }
4410          ),
4411          children
4412        ]
4413      },
4414      groupName
4415    );
4416  }
4417  function ViewPickerGrid({
4418    actions,
4419    data,
4420    fields,
4421    getItemId: getItemId2,
4422    isLoading,
4423    onChangeSelection,
4424    selection,
4425    view,
4426    className,
4427    empty
4428  }) {
4429    const { resizeObserverRef, paginationInfo, itemListLabel } = (0, import_element18.useContext)(dataviews_context_default);
4430    const titleField = fields.find(
4431      (field) => field.id === view?.titleField
4432    );
4433    const mediaField = fields.find(
4434      (field) => field.id === view?.mediaField
4435    );
4436    const descriptionField = fields.find(
4437      (field) => field.id === view?.descriptionField
4438    );
4439    const otherFields = view.fields ?? [];
4440    const { regularFields, badgeFields } = otherFields.reduce(
4441      (accumulator, fieldId) => {
4442        const field = fields.find((f2) => f2.id === fieldId);
4443        if (!field) {
4444          return accumulator;
4445        }
4446        const key = view.layout?.badgeFields?.includes(fieldId) ? "badgeFields" : "regularFields";
4447        accumulator[key].push(field);
4448        return accumulator;
4449      },
4450      { regularFields: [], badgeFields: [] }
4451    );
4452    const hasData = !!data?.length;
4453    const usedPreviewSize = view.layout?.previewSize;
4454    const isMultiselect = useIsMultiselectPicker(actions);
4455    const size = "900px";
4456    const groupField = view.groupBy?.field ? fields.find((f2) => f2.id === view.groupBy?.field) : null;
4457    const dataByGroup = groupField ? getDataByGroup(data, groupField) : null;
4458    const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup;
4459    const currentPage = view?.page ?? 1;
4460    const perPage = view?.perPage ?? 0;
4461    const setSize = isInfiniteScroll ? paginationInfo?.totalItems : void 0;
4462    return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, {
4463      // Render multiple groups.
4464      children: [
4465        hasData && groupField && dataByGroup && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4466          import_components17.Composite,
4467          {
4468            virtualFocus: true,
4469            orientation: "horizontal",
4470            role: "listbox",
4471            "aria-multiselectable": isMultiselect,
4472            className: clsx_default(
4473              "dataviews-view-picker-grid",
4474              className
4475            ),
4476            "aria-label": itemListLabel,
4477            render: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4478              import_components17.__experimentalVStack,
4479              {
4480                spacing: 4,
4481                children,
4482                ...props
4483              }
4484            ),
4485            children: Array.from(dataByGroup.entries()).map(
4486              ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4487                GridGroup,
4488                {
4489                  groupName,
4490                  groupField,
4491                  children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4492                    GridItems,
4493                    {
4494                      previewSize: usedPreviewSize,
4495                      style: {
4496                        gridTemplateColumns: usedPreviewSize && `repeat(auto-fill, minmax($usedPreviewSize}px, 1fr))`
4497                      },
4498                      "aria-busy": isLoading,
4499                      ref: resizeObserverRef,
4500                      children: groupItems.map((item) => {
4501                        const posInSet = (currentPage - 1) * perPage + data.indexOf(item) + 1;
4502                        return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4503                          GridItem3,
4504                          {
4505                            view,
4506                            multiselect: isMultiselect,
4507                            selection,
4508                            onChangeSelection,
4509                            getItemId: getItemId2,
4510                            item,
4511                            mediaField,
4512                            titleField,
4513                            descriptionField,
4514                            regularFields,
4515                            badgeFields,
4516                            config: {
4517                              sizes: size
4518                            },
4519                            posinset: posInSet,
4520                            setsize: setSize
4521                          },
4522                          getItemId2(item)
4523                        );
4524                      })
4525                    }
4526                  )
4527                },
4528                groupName
4529              )
4530            )
4531          }
4532        ),
4533        // Render a single grid with all data.
4534        hasData && !dataByGroup && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4535          import_components17.Composite,
4536          {
4537            render: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4538              GridItems,
4539              {
4540                className: clsx_default(
4541                  "dataviews-view-picker-grid",
4542                  className
4543                ),
4544                previewSize: usedPreviewSize,
4545                "aria-busy": isLoading,
4546                ref: resizeObserverRef
4547              }
4548            ),
4549            virtualFocus: true,
4550            orientation: "horizontal",
4551            role: "listbox",
4552            "aria-multiselectable": isMultiselect,
4553            "aria-label": itemListLabel,
4554            children: data.map((item, index) => {
4555              let posinset = isInfiniteScroll ? index + 1 : void 0;
4556              if (!isInfiniteScroll) {
4557                posinset = (currentPage - 1) * perPage + index + 1;
4558              }
4559              return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4560                GridItem3,
4561                {
4562                  view,
4563                  multiselect: isMultiselect,
4564                  selection,
4565                  onChangeSelection,
4566                  getItemId: getItemId2,
4567                  item,
4568                  mediaField,
4569                  titleField,
4570                  descriptionField,
4571                  regularFields,
4572                  badgeFields,
4573                  config: {
4574                    sizes: size
4575                  },
4576                  posinset,
4577                  setsize: setSize
4578                },
4579                getItemId2(item)
4580              );
4581            })
4582          }
4583        ),
4584        // Render empty state.
4585        !hasData && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4586          "div",
4587          {
4588            className: clsx_default({
4589              "dataviews-loading": isLoading,
4590              "dataviews-no-results": !isLoading
4591            }),
4592            children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_components17.Spinner, {}) }) : empty
4593          }
4594        ),
4595        hasData && isLoading && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_components17.Spinner, {}) })
4596      ]
4597    });
4598  }
4599  var picker_grid_default = ViewPickerGrid;
4600  
4601  // packages/dataviews/build-module/dataviews-layouts/picker-table/index.js
4602  var import_i18n17 = __toESM(require_i18n());
4603  var import_components18 = __toESM(require_components());
4604  var import_element19 = __toESM(require_element());
4605  var import_jsx_runtime43 = __toESM(require_jsx_runtime());
4606  function TableColumnField2({
4607    item,
4608    fields,
4609    column,
4610    align
4611  }) {
4612    const field = fields.find((f2) => f2.id === column);
4613    if (!field) {
4614      return null;
4615    }
4616    const className = clsx_default("dataviews-view-table__cell-content-wrapper", {
4617      "dataviews-view-table__cell-align-end": align === "end",
4618      "dataviews-view-table__cell-align-center": align === "center"
4619    });
4620    return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(field.render, { item, field }) });
4621  }
4622  function TableRow2({
4623    item,
4624    fields,
4625    id,
4626    view,
4627    titleField,
4628    mediaField,
4629    descriptionField,
4630    selection,
4631    getItemId: getItemId2,
4632    onChangeSelection,
4633    multiselect,
4634    posinset
4635  }) {
4636    const { paginationInfo } = (0, import_element19.useContext)(dataviews_context_default);
4637    const isSelected2 = selection.includes(id);
4638    const [isHovered, setIsHovered] = (0, import_element19.useState)(false);
4639    const {
4640      showTitle = true,
4641      showMedia = true,
4642      showDescription = true,
4643      infiniteScrollEnabled
4644    } = view;
4645    const handleMouseEnter = () => {
4646      setIsHovered(true);
4647    };
4648    const handleMouseLeave = () => {
4649      setIsHovered(false);
4650    };
4651    const columns = view.fields ?? [];
4652    const hasPrimaryColumn = titleField && showTitle || mediaField && showMedia || descriptionField && showDescription;
4653    return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
4654      import_components18.Composite.Item,
4655      {
4656        render: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
4657          "tr",
4658          {
4659            className: clsx_default("dataviews-view-table__row", {
4660              "is-selected": isSelected2,
4661              "is-hovered": isHovered
4662            }),
4663            onMouseEnter: handleMouseEnter,
4664            onMouseLeave: handleMouseLeave,
4665            children,
4666            ...props
4667          }
4668        ),
4669        "aria-selected": isSelected2,
4670        "aria-setsize": paginationInfo.totalItems || void 0,
4671        "aria-posinset": posinset,
4672        role: infiniteScrollEnabled ? "article" : "option",
4673        onClick: () => {
4674          if (isSelected2) {
4675            onChangeSelection(
4676              selection.filter((itemId) => id !== itemId)
4677            );
4678          } else {
4679            const newSelection = multiselect ? [...selection, id] : [id];
4680            onChangeSelection(newSelection);
4681          }
4682        },
4683        children: [
4684          /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
4685            "td",
4686            {
4687              className: "dataviews-view-table__checkbox-column",
4688              role: "presentation",
4689              children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "dataviews-view-table__cell-content-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
4690                DataViewsSelectionCheckbox,
4691                {
4692                  item,
4693                  selection,
4694                  onChangeSelection,
4695                  getItemId: getItemId2,
4696                  titleField,
4697                  disabled: false,
4698                  "aria-hidden": true,
4699                  tabIndex: -1
4700                }
4701              ) })
4702            }
4703          ),
4704          hasPrimaryColumn && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("td", { role: "presentation", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
4705            column_primary_default,
4706            {
4707              item,
4708              titleField: showTitle ? titleField : void 0,
4709              mediaField: showMedia ? mediaField : void 0,
4710              descriptionField: showDescription ? descriptionField : void 0,
4711              isItemClickable: () => false
4712            }
4713          ) }),
4714          columns.map((column) => {
4715            const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {};
4716            return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
4717              "td",
4718              {
4719                style: {
4720                  width,
4721                  maxWidth,
4722                  minWidth
4723                },
4724                role: "presentation",
4725                children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
4726                  TableColumnField2,
4727                  {
4728                    fields,
4729                    item,
4730                    column,
4731                    align
4732                  }
4733                )
4734              },
4735              column
4736            );
4737          })
4738        ]
4739      },
4740      id
4741    );
4742  }
4743  function ViewPickerTable({
4744    actions,
4745    data,
4746    fields,
4747    getItemId: getItemId2,
4748    isLoading = false,
4749    onChangeView,
4750    onChangeSelection,
4751    selection,
4752    setOpenedFilter,
4753    view,
4754    className,
4755    empty
4756  }) {
4757    const headerMenuRefs = (0, import_element19.useRef)(/* @__PURE__ */ new Map());
4758    const headerMenuToFocusRef = (0, import_element19.useRef)();
4759    const [nextHeaderMenuToFocus, setNextHeaderMenuToFocus] = (0, import_element19.useState)();
4760    const isMultiselect = useIsMultiselectPicker(actions) ?? false;
4761    (0, import_element19.useEffect)(() => {
4762      if (headerMenuToFocusRef.current) {
4763        headerMenuToFocusRef.current.focus();
4764        headerMenuToFocusRef.current = void 0;
4765      }
4766    });
4767    const tableNoticeId = (0, import_element19.useId)();
4768    if (nextHeaderMenuToFocus) {
4769      headerMenuToFocusRef.current = nextHeaderMenuToFocus;
4770      setNextHeaderMenuToFocus(void 0);
4771      return;
4772    }
4773    const onHide = (field) => {
4774      const hidden = headerMenuRefs.current.get(field.id);
4775      const fallback = hidden ? headerMenuRefs.current.get(hidden.fallback) : void 0;
4776      setNextHeaderMenuToFocus(fallback?.node);
4777    };
4778    const hasData = !!data?.length;
4779    const titleField = fields.find((field) => field.id === view.titleField);
4780    const mediaField = fields.find((field) => field.id === view.mediaField);
4781    const descriptionField = fields.find(
4782      (field) => field.id === view.descriptionField
4783    );
4784    const groupField = view.groupBy?.field ? fields.find((f2) => f2.id === view.groupBy?.field) : null;
4785    const dataByGroup = groupField ? getDataByGroup(data, groupField) : null;
4786    const { showTitle = true, showMedia = true, showDescription = true } = view;
4787    const hasPrimaryColumn = titleField && showTitle || mediaField && showMedia || descriptionField && showDescription;
4788    const columns = view.fields ?? [];
4789    const headerMenuRef = (column, index) => (node) => {
4790      if (node) {
4791        headerMenuRefs.current.set(column, {
4792          node,
4793          fallback: columns[index > 0 ? index - 1 : 1]
4794        });
4795      } else {
4796        headerMenuRefs.current.delete(column);
4797      }
4798    };
4799    const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup;
4800    return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
4801      /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
4802        "table",
4803        {
4804          className: clsx_default(
4805            "dataviews-view-table",
4806            "dataviews-view-picker-table",
4807            className,
4808            {
4809              [`has-$view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes(
4810                view.layout.density
4811              )
4812            }
4813          ),
4814          "aria-busy": isLoading,
4815          "aria-describedby": tableNoticeId,
4816          role: isInfiniteScroll ? "feed" : "listbox",
4817          children: [
4818            /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("thead", { role: "presentation", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
4819              "tr",
4820              {
4821                className: "dataviews-view-table__row",
4822                role: "presentation",
4823                children: [
4824                  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("th", { className: "dataviews-view-table__checkbox-column", children: isMultiselect && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
4825                    BulkSelectionCheckbox,
4826                    {
4827                      selection,
4828                      onChangeSelection,
4829                      data,
4830                      actions,
4831                      getItemId: getItemId2
4832                    }
4833                  ) }),
4834                  hasPrimaryColumn && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("th", { children: titleField && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
4835                    column_header_menu_default,
4836                    {
4837                      ref: headerMenuRef(
4838                        titleField.id,
4839                        0
4840                      ),
4841                      fieldId: titleField.id,
4842                      view,
4843                      fields,
4844                      onChangeView,
4845                      onHide,
4846                      setOpenedFilter,
4847                      canMove: false
4848                    }
4849                  ) }),
4850                  columns.map((column, index) => {
4851                    const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {};
4852                    return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
4853                      "th",
4854                      {
4855                        style: {
4856                          width,
4857                          maxWidth,
4858                          minWidth,
4859                          textAlign: align
4860                        },
4861                        "aria-sort": view.sort?.direction && view.sort?.field === column ? sortValues[view.sort.direction] : void 0,
4862                        scope: "col",
4863                        children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
4864                          column_header_menu_default,
4865                          {
4866                            ref: headerMenuRef(column, index),
4867                            fieldId: column,
4868                            view,
4869                            fields,
4870                            onChangeView,
4871                            onHide,
4872                            setOpenedFilter,
4873                            canMove: view.layout?.enableMoving ?? true
4874                          }
4875                        )
4876                      },
4877                      column
4878                    );
4879                  })
4880                ]
4881              }
4882            ) }),
4883            hasData && groupField && dataByGroup ? Array.from(dataByGroup.entries()).map(
4884              ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
4885                import_components18.Composite,
4886                {
4887                  virtualFocus: true,
4888                  orientation: "vertical",
4889                  render: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("tbody", { role: "group" }),
4890                  children: [
4891                    /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
4892                      "tr",
4893                      {
4894                        className: "dataviews-view-table__group-header-row",
4895                        role: "presentation",
4896                        children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
4897                          "td",
4898                          {
4899                            colSpan: columns.length + (hasPrimaryColumn ? 1 : 0) + 1,
4900                            className: "dataviews-view-table__group-header-cell",
4901                            role: "presentation",
4902                            children: (0, import_i18n17.sprintf)(
4903                              // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022".
4904                              (0, import_i18n17.__)("%1$s: %2$s"),
4905                              groupField.label,
4906                              groupName
4907                            )
4908                          }
4909                        )
4910                      }
4911                    ),
4912                    groupItems.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
4913                      TableRow2,
4914                      {
4915                        item,
4916                        fields,
4917                        id: getItemId2(item) || index.toString(),
4918                        view,
4919                        titleField,
4920                        mediaField,
4921                        descriptionField,
4922                        selection,
4923                        getItemId: getItemId2,
4924                        onChangeSelection,
4925                        multiselect: isMultiselect
4926                      },
4927                      getItemId2(item)
4928                    ))
4929                  ]
4930                },
4931                `group-$groupName}`
4932              )
4933            ) : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
4934              import_components18.Composite,
4935              {
4936                render: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("tbody", { role: "presentation" }),
4937                virtualFocus: true,
4938                orientation: "vertical",
4939                children: hasData && data.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
4940                  TableRow2,
4941                  {
4942                    item,
4943                    fields,
4944                    id: getItemId2(item) || index.toString(),
4945                    view,
4946                    titleField,
4947                    mediaField,
4948                    descriptionField,
4949                    selection,
4950                    getItemId: getItemId2,
4951                    onChangeSelection,
4952                    multiselect: isMultiselect,
4953                    posinset: index + 1
4954                  },
4955                  getItemId2(item)
4956                ))
4957              }
4958            )
4959          ]
4960        }
4961      ),
4962      /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
4963        "div",
4964        {
4965          className: clsx_default({
4966            "dataviews-loading": isLoading,
4967            "dataviews-no-results": !hasData && !isLoading
4968          }),
4969          id: tableNoticeId,
4970          children: [
4971            !hasData && (isLoading ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_components18.Spinner, {}) }) : empty),
4972            hasData && isLoading && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_components18.Spinner, {}) })
4973          ]
4974        }
4975      )
4976    ] });
4977  }
4978  var picker_table_default = ViewPickerTable;
4979  
4980  // packages/dataviews/build-module/dataviews-layouts/utils/preview-size-picker.js
4981  var import_components19 = __toESM(require_components());
4982  var import_i18n18 = __toESM(require_i18n());
4983  var import_element20 = __toESM(require_element());
4984  var import_jsx_runtime44 = __toESM(require_jsx_runtime());
4985  var imageSizes2 = [
4986    {
4987      value: 120,
4988      breakpoint: 1
4989    },
4990    {
4991      value: 170,
4992      breakpoint: 1
4993    },
4994    {
4995      value: 230,
4996      breakpoint: 1
4997    },
4998    {
4999      value: 290,
5000      breakpoint: 1112
5001      // at minimum image width, 4 images display at this container size
5002    },
5003    {
5004      value: 350,
5005      breakpoint: 1636
5006      // at minimum image width, 6 images display at this container size
5007    },
5008    {
5009      value: 430,
5010      breakpoint: 588
5011      // at minimum image width, 2 images display at this container size
5012    }
5013  ];
5014  function PreviewSizePicker() {
5015    const context = (0, import_element20.useContext)(dataviews_context_default);
5016    const view = context.view;
5017    const breakValues = imageSizes2.filter((size) => {
5018      return context.containerWidth >= size.breakpoint;
5019    });
5020    const layoutPreviewSize = view.layout?.previewSize ?? 230;
5021    const previewSizeToUse = breakValues.map((size, index) => ({ ...size, index })).filter((size) => size.value <= layoutPreviewSize).sort((a2, b2) => b2.value - a2.value)[0]?.index ?? 0;
5022    const marks = breakValues.map((size, index) => {
5023      return {
5024        value: index
5025      };
5026    });
5027    return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
5028      import_components19.RangeControl,
5029      {
5030        __next40pxDefaultSize: true,
5031        showTooltip: false,
5032        label: (0, import_i18n18.__)("Preview size"),
5033        value: previewSizeToUse,
5034        min: 0,
5035        max: breakValues.length - 1,
5036        withInputField: false,
5037        onChange: (value = 0) => {
5038          context.onChangeView({
5039            ...view,
5040            layout: {
5041              ...view.layout,
5042              previewSize: breakValues[value].value
5043            }
5044          });
5045        },
5046        step: 1,
5047        marks
5048      }
5049    );
5050  }
5051  
5052  // packages/dataviews/build-module/dataviews-layouts/table/density-picker.js
5053  var import_components20 = __toESM(require_components());
5054  var import_i18n19 = __toESM(require_i18n());
5055  var import_element21 = __toESM(require_element());
5056  var import_jsx_runtime45 = __toESM(require_jsx_runtime());
5057  function DensityPicker() {
5058    const context = (0, import_element21.useContext)(dataviews_context_default);
5059    const view = context.view;
5060    return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
5061      import_components20.__experimentalToggleGroupControl,
5062      {
5063        size: "__unstable-large",
5064        label: (0, import_i18n19.__)("Density"),
5065        value: view.layout?.density || "balanced",
5066        onChange: (value) => {
5067          context.onChangeView({
5068            ...view,
5069            layout: {
5070              ...view.layout,
5071              density: value
5072            }
5073          });
5074        },
5075        isBlock: true,
5076        children: [
5077          /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
5078            import_components20.__experimentalToggleGroupControlOption,
5079            {
5080              value: "comfortable",
5081              label: (0, import_i18n19._x)(
5082                "Comfortable",
5083                "Density option for DataView layout"
5084              )
5085            },
5086            "comfortable"
5087          ),
5088          /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
5089            import_components20.__experimentalToggleGroupControlOption,
5090            {
5091              value: "balanced",
5092              label: (0, import_i18n19._x)("Balanced", "Density option for DataView layout")
5093            },
5094            "balanced"
5095          ),
5096          /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
5097            import_components20.__experimentalToggleGroupControlOption,
5098            {
5099              value: "compact",
5100              label: (0, import_i18n19._x)("Compact", "Density option for DataView layout")
5101            },
5102            "compact"
5103          )
5104        ]
5105      }
5106    );
5107  }
5108  
5109  // packages/dataviews/build-module/dataviews-layouts/index.js
5110  var VIEW_LAYOUTS = [
5111    {
5112      type: LAYOUT_TABLE,
5113      label: (0, import_i18n20.__)("Table"),
5114      component: table_default,
5115      icon: block_table_default,
5116      viewConfigOptions: DensityPicker
5117    },
5118    {
5119      type: LAYOUT_GRID,
5120      label: (0, import_i18n20.__)("Grid"),
5121      component: grid_default,
5122      icon: category_default,
5123      viewConfigOptions: PreviewSizePicker
5124    },
5125    {
5126      type: LAYOUT_LIST,
5127      label: (0, import_i18n20.__)("List"),
5128      component: ViewList,
5129      icon: (0, import_i18n20.isRTL)() ? format_list_bullets_rtl_default : format_list_bullets_default
5130    },
5131    {
5132      type: LAYOUT_ACTIVITY,
5133      label: (0, import_i18n20.__)("Activity"),
5134      component: ViewActivity,
5135      icon: scheduled_default,
5136      viewConfigOptions: DensityPicker
5137    },
5138    {
5139      type: LAYOUT_PICKER_GRID,
5140      label: (0, import_i18n20.__)("Grid"),
5141      component: picker_grid_default,
5142      icon: category_default,
5143      viewConfigOptions: PreviewSizePicker,
5144      isPicker: true
5145    },
5146    {
5147      type: LAYOUT_PICKER_TABLE,
5148      label: (0, import_i18n20.__)("Table"),
5149      component: picker_table_default,
5150      icon: block_table_default,
5151      viewConfigOptions: DensityPicker,
5152      isPicker: true
5153    }
5154  ];
5155  
5156  // packages/dataviews/build-module/components/dataviews-filters/filters.js
5157  var import_element29 = __toESM(require_element());
5158  var import_components26 = __toESM(require_components());
5159  
5160  // packages/dataviews/build-module/components/dataviews-filters/filter.js
5161  var import_components23 = __toESM(require_components());
5162  var import_i18n23 = __toESM(require_i18n());
5163  var import_element26 = __toESM(require_element());
5164  
5165  // node_modules/@ariakit/react-core/esm/__chunks/3YLGPPWQ.js
5166  var __defProp2 = Object.defineProperty;
5167  var __defProps = Object.defineProperties;
5168  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5169  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5170  var __hasOwnProp2 = Object.prototype.hasOwnProperty;
5171  var __propIsEnum = Object.prototype.propertyIsEnumerable;
5172  var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5173  var __spreadValues = (a2, b2) => {
5174    for (var prop in b2 || (b2 = {}))
5175      if (__hasOwnProp2.call(b2, prop))
5176        __defNormalProp(a2, prop, b2[prop]);
5177    if (__getOwnPropSymbols)
5178      for (var prop of __getOwnPropSymbols(b2)) {
5179        if (__propIsEnum.call(b2, prop))
5180          __defNormalProp(a2, prop, b2[prop]);
5181      }
5182    return a2;
5183  };
5184  var __spreadProps = (a2, b2) => __defProps(a2, __getOwnPropDescs(b2));
5185  var __objRest = (source, exclude) => {
5186    var target = {};
5187    for (var prop in source)
5188      if (__hasOwnProp2.call(source, prop) && exclude.indexOf(prop) < 0)
5189        target[prop] = source[prop];
5190    if (source != null && __getOwnPropSymbols)
5191      for (var prop of __getOwnPropSymbols(source)) {
5192        if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
5193          target[prop] = source[prop];
5194      }
5195    return target;
5196  };
5197  
5198  // node_modules/@ariakit/core/esm/__chunks/3YLGPPWQ.js
5199  var __defProp3 = Object.defineProperty;
5200  var __defProps2 = Object.defineProperties;
5201  var __getOwnPropDescs2 = Object.getOwnPropertyDescriptors;
5202  var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
5203  var __hasOwnProp3 = Object.prototype.hasOwnProperty;
5204  var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
5205  var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5206  var __spreadValues2 = (a2, b2) => {
5207    for (var prop in b2 || (b2 = {}))
5208      if (__hasOwnProp3.call(b2, prop))
5209        __defNormalProp2(a2, prop, b2[prop]);
5210    if (__getOwnPropSymbols2)
5211      for (var prop of __getOwnPropSymbols2(b2)) {
5212        if (__propIsEnum2.call(b2, prop))
5213          __defNormalProp2(a2, prop, b2[prop]);
5214      }
5215    return a2;
5216  };
5217  var __spreadProps2 = (a2, b2) => __defProps2(a2, __getOwnPropDescs2(b2));
5218  var __objRest2 = (source, exclude) => {
5219    var target = {};
5220    for (var prop in source)
5221      if (__hasOwnProp3.call(source, prop) && exclude.indexOf(prop) < 0)
5222        target[prop] = source[prop];
5223    if (source != null && __getOwnPropSymbols2)
5224      for (var prop of __getOwnPropSymbols2(source)) {
5225        if (exclude.indexOf(prop) < 0 && __propIsEnum2.call(source, prop))
5226          target[prop] = source[prop];
5227      }
5228    return target;
5229  };
5230  
5231  // node_modules/@ariakit/core/esm/__chunks/PBFD2E7P.js
5232  function noop(..._) {
5233  }
5234  function applyState(argument, currentValue) {
5235    if (isUpdater(argument)) {
5236      const value = isLazyValue(currentValue) ? currentValue() : currentValue;
5237      return argument(value);
5238    }
5239    return argument;
5240  }
5241  function isUpdater(argument) {
5242    return typeof argument === "function";
5243  }
5244  function isLazyValue(value) {
5245    return typeof value === "function";
5246  }
5247  function hasOwnProperty(object, prop) {
5248    if (typeof Object.hasOwn === "function") {
5249      return Object.hasOwn(object, prop);
5250    }
5251    return Object.prototype.hasOwnProperty.call(object, prop);
5252  }
5253  function chain(...fns) {
5254    return (...args) => {
5255      for (const fn of fns) {
5256        if (typeof fn === "function") {
5257          fn(...args);
5258        }
5259      }
5260    };
5261  }
5262  function normalizeString(str) {
5263    return str.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
5264  }
5265  function omit2(object, keys) {
5266    const result = __spreadValues2({}, object);
5267    for (const key of keys) {
5268      if (hasOwnProperty(result, key)) {
5269        delete result[key];
5270      }
5271    }
5272    return result;
5273  }
5274  function pick(object, paths) {
5275    const result = {};
5276    for (const key of paths) {
5277      if (hasOwnProperty(object, key)) {
5278        result[key] = object[key];
5279      }
5280    }
5281    return result;
5282  }
5283  function identity(value) {
5284    return value;
5285  }
5286  function invariant(condition, message2) {
5287    if (condition) return;
5288    if (typeof message2 !== "string") throw new Error("Invariant failed");
5289    throw new Error(message2);
5290  }
5291  function getKeys(obj) {
5292    return Object.keys(obj);
5293  }
5294  function isFalsyBooleanCallback(booleanOrCallback, ...args) {
5295    const result = typeof booleanOrCallback === "function" ? booleanOrCallback(...args) : booleanOrCallback;
5296    if (result == null) return false;
5297    return !result;
5298  }
5299  function disabledFromProps(props) {
5300    return props.disabled || props["aria-disabled"] === true || props["aria-disabled"] === "true";
5301  }
5302  function removeUndefinedValues(obj) {
5303    const result = {};
5304    for (const key in obj) {
5305      if (obj[key] !== void 0) {
5306        result[key] = obj[key];
5307      }
5308    }
5309    return result;
5310  }
5311  function defaultValue(...values) {
5312    for (const value of values) {
5313      if (value !== void 0) return value;
5314    }
5315    return void 0;
5316  }
5317  
5318  // node_modules/@ariakit/react-core/esm/__chunks/SK3NAZA3.js
5319  var import_react2 = __toESM(require_react(), 1);
5320  function setRef(ref, value) {
5321    if (typeof ref === "function") {
5322      ref(value);
5323    } else if (ref) {
5324      ref.current = value;
5325    }
5326  }
5327  function isValidElementWithRef(element) {
5328    if (!element) return false;
5329    if (!(0, import_react2.isValidElement)(element)) return false;
5330    if ("ref" in element.props) return true;
5331    if ("ref" in element) return true;
5332    return false;
5333  }
5334  function getRefProperty(element) {
5335    if (!isValidElementWithRef(element)) return null;
5336    const props = __spreadValues({}, element.props);
5337    return props.ref || element.ref;
5338  }
5339  function mergeProps(base, overrides) {
5340    const props = __spreadValues({}, base);
5341    for (const key in overrides) {
5342      if (!hasOwnProperty(overrides, key)) continue;
5343      if (key === "className") {
5344        const prop = "className";
5345        props[prop] = base[prop] ? `$base[prop]} $overrides[prop]}` : overrides[prop];
5346        continue;
5347      }
5348      if (key === "style") {
5349        const prop = "style";
5350        props[prop] = base[prop] ? __spreadValues(__spreadValues({}, base[prop]), overrides[prop]) : overrides[prop];
5351        continue;
5352      }
5353      const overrideValue = overrides[key];
5354      if (typeof overrideValue === "function" && key.startsWith("on")) {
5355        const baseValue = base[key];
5356        if (typeof baseValue === "function") {
5357          props[key] = (...args) => {
5358            overrideValue(...args);
5359            baseValue(...args);
5360          };
5361          continue;
5362        }
5363      }
5364      props[key] = overrideValue;
5365    }
5366    return props;
5367  }
5368  
5369  // node_modules/@ariakit/core/esm/__chunks/DTR5TSDJ.js
5370  var canUseDOM = checkIsBrowser();
5371  function checkIsBrowser() {
5372    var _a;
5373    return typeof window !== "undefined" && !!((_a = window.document) == null ? void 0 : _a.createElement);
5374  }
5375  function getDocument(node) {
5376    if (!node) return document;
5377    if ("self" in node) return node.document;
5378    return node.ownerDocument || document;
5379  }
5380  function getActiveElement(node, activeDescendant = false) {
5381    const { activeElement } = getDocument(node);
5382    if (!(activeElement == null ? void 0 : activeElement.nodeName)) {
5383      return null;
5384    }
5385    if (isFrame(activeElement) && activeElement.contentDocument) {
5386      return getActiveElement(
5387        activeElement.contentDocument.body,
5388        activeDescendant
5389      );
5390    }
5391    if (activeDescendant) {
5392      const id = activeElement.getAttribute("aria-activedescendant");
5393      if (id) {
5394        const element = getDocument(activeElement).getElementById(id);
5395        if (element) {
5396          return element;
5397        }
5398      }
5399    }
5400    return activeElement;
5401  }
5402  function contains(parent, child) {
5403    return parent === child || parent.contains(child);
5404  }
5405  function isFrame(element) {
5406    return element.tagName === "IFRAME";
5407  }
5408  function isButton(element) {
5409    const tagName = element.tagName.toLowerCase();
5410    if (tagName === "button") return true;
5411    if (tagName === "input" && element.type) {
5412      return buttonInputTypes.indexOf(element.type) !== -1;
5413    }
5414    return false;
5415  }
5416  var buttonInputTypes = [
5417    "button",
5418    "color",
5419    "file",
5420    "image",
5421    "reset",
5422    "submit"
5423  ];
5424  function isVisible(element) {
5425    if (typeof element.checkVisibility === "function") {
5426      return element.checkVisibility();
5427    }
5428    const htmlElement = element;
5429    return htmlElement.offsetWidth > 0 || htmlElement.offsetHeight > 0 || element.getClientRects().length > 0;
5430  }
5431  function isTextField(element) {
5432    try {
5433      const isTextInput = element instanceof HTMLInputElement && element.selectionStart !== null;
5434      const isTextArea = element.tagName === "TEXTAREA";
5435      return isTextInput || isTextArea || false;
5436    } catch (error) {
5437      return false;
5438    }
5439  }
5440  function isTextbox(element) {
5441    return element.isContentEditable || isTextField(element);
5442  }
5443  function getTextboxValue(element) {
5444    if (isTextField(element)) {
5445      return element.value;
5446    }
5447    if (element.isContentEditable) {
5448      const range = getDocument(element).createRange();
5449      range.selectNodeContents(element);
5450      return range.toString();
5451    }
5452    return "";
5453  }
5454  function getTextboxSelection(element) {
5455    let start = 0;
5456    let end = 0;
5457    if (isTextField(element)) {
5458      start = element.selectionStart || 0;
5459      end = element.selectionEnd || 0;
5460    } else if (element.isContentEditable) {
5461      const selection = getDocument(element).getSelection();
5462      if ((selection == null ? void 0 : selection.rangeCount) && selection.anchorNode && contains(element, selection.anchorNode) && selection.focusNode && contains(element, selection.focusNode)) {
5463        const range = selection.getRangeAt(0);
5464        const nextRange = range.cloneRange();
5465        nextRange.selectNodeContents(element);
5466        nextRange.setEnd(range.startContainer, range.startOffset);
5467        start = nextRange.toString().length;
5468        nextRange.setEnd(range.endContainer, range.endOffset);
5469        end = nextRange.toString().length;
5470      }
5471    }
5472    return { start, end };
5473  }
5474  function getPopupRole(element, fallback) {
5475    const allowedPopupRoles = ["dialog", "menu", "listbox", "tree", "grid"];
5476    const role = element == null ? void 0 : element.getAttribute("role");
5477    if (role && allowedPopupRoles.indexOf(role) !== -1) {
5478      return role;
5479    }
5480    return fallback;
5481  }
5482  function getScrollingElement(element) {
5483    if (!element) return null;
5484    const isScrollableOverflow = (overflow) => {
5485      if (overflow === "auto") return true;
5486      if (overflow === "scroll") return true;
5487      return false;
5488    };
5489    if (element.clientHeight && element.scrollHeight > element.clientHeight) {
5490      const { overflowY } = getComputedStyle(element);
5491      if (isScrollableOverflow(overflowY)) return element;
5492    } else if (element.clientWidth && element.scrollWidth > element.clientWidth) {
5493      const { overflowX } = getComputedStyle(element);
5494      if (isScrollableOverflow(overflowX)) return element;
5495    }
5496    return getScrollingElement(element.parentElement) || document.scrollingElement || document.body;
5497  }
5498  function setSelectionRange(element, ...args) {
5499    if (/text|search|password|tel|url/i.test(element.type)) {
5500      element.setSelectionRange(...args);
5501    }
5502  }
5503  function sortBasedOnDOMPosition(items, getElement) {
5504    const pairs = items.map((item, index) => [index, item]);
5505    let isOrderDifferent = false;
5506    pairs.sort(([indexA, a2], [indexB, b2]) => {
5507      const elementA = getElement(a2);
5508      const elementB = getElement(b2);
5509      if (elementA === elementB) return 0;
5510      if (!elementA || !elementB) return 0;
5511      if (isElementPreceding(elementA, elementB)) {
5512        if (indexA > indexB) {
5513          isOrderDifferent = true;
5514        }
5515        return -1;
5516      }
5517      if (indexA < indexB) {
5518        isOrderDifferent = true;
5519      }
5520      return 1;
5521    });
5522    if (isOrderDifferent) {
5523      return pairs.map(([_, item]) => item);
5524    }
5525    return items;
5526  }
5527  function isElementPreceding(a2, b2) {
5528    return Boolean(
5529      b2.compareDocumentPosition(a2) & Node.DOCUMENT_POSITION_PRECEDING
5530    );
5531  }
5532  
5533  // node_modules/@ariakit/core/esm/__chunks/QAGXQEUG.js
5534  function isTouchDevice() {
5535    return canUseDOM && !!navigator.maxTouchPoints;
5536  }
5537  function isApple() {
5538    if (!canUseDOM) return false;
5539    return /mac|iphone|ipad|ipod/i.test(navigator.platform);
5540  }
5541  function isSafari() {
5542    return canUseDOM && isApple() && /apple/i.test(navigator.vendor);
5543  }
5544  function isFirefox() {
5545    return canUseDOM && /firefox\//i.test(navigator.userAgent);
5546  }
5547  
5548  // node_modules/@ariakit/core/esm/utils/events.js
5549  function isPortalEvent(event) {
5550    return Boolean(
5551      event.currentTarget && !contains(event.currentTarget, event.target)
5552    );
5553  }
5554  function isSelfTarget(event) {
5555    return event.target === event.currentTarget;
5556  }
5557  function isOpeningInNewTab(event) {
5558    const element = event.currentTarget;
5559    if (!element) return false;
5560    const isAppleDevice = isApple();
5561    if (isAppleDevice && !event.metaKey) return false;
5562    if (!isAppleDevice && !event.ctrlKey) return false;
5563    const tagName = element.tagName.toLowerCase();
5564    if (tagName === "a") return true;
5565    if (tagName === "button" && element.type === "submit") return true;
5566    if (tagName === "input" && element.type === "submit") return true;
5567    return false;
5568  }
5569  function isDownloading(event) {
5570    const element = event.currentTarget;
5571    if (!element) return false;
5572    const tagName = element.tagName.toLowerCase();
5573    if (!event.altKey) return false;
5574    if (tagName === "a") return true;
5575    if (tagName === "button" && element.type === "submit") return true;
5576    if (tagName === "input" && element.type === "submit") return true;
5577    return false;
5578  }
5579  function fireBlurEvent(element, eventInit) {
5580    const event = new FocusEvent("blur", eventInit);
5581    const defaultAllowed = element.dispatchEvent(event);
5582    const bubbleInit = __spreadProps2(__spreadValues2({}, eventInit), { bubbles: true });
5583    element.dispatchEvent(new FocusEvent("focusout", bubbleInit));
5584    return defaultAllowed;
5585  }
5586  function fireKeyboardEvent(element, type, eventInit) {
5587    const event = new KeyboardEvent(type, eventInit);
5588    return element.dispatchEvent(event);
5589  }
5590  function fireClickEvent(element, eventInit) {
5591    const event = new MouseEvent("click", eventInit);
5592    return element.dispatchEvent(event);
5593  }
5594  function isFocusEventOutside(event, container) {
5595    const containerElement = container || event.currentTarget;
5596    const relatedTarget = event.relatedTarget;
5597    return !relatedTarget || !contains(containerElement, relatedTarget);
5598  }
5599  function queueBeforeEvent(element, type, callback, timeout) {
5600    const createTimer = (callback2) => {
5601      if (timeout) {
5602        const timerId2 = setTimeout(callback2, timeout);
5603        return () => clearTimeout(timerId2);
5604      }
5605      const timerId = requestAnimationFrame(callback2);
5606      return () => cancelAnimationFrame(timerId);
5607    };
5608    const cancelTimer = createTimer(() => {
5609      element.removeEventListener(type, callSync, true);
5610      callback();
5611    });
5612    const callSync = () => {
5613      cancelTimer();
5614      callback();
5615    };
5616    element.addEventListener(type, callSync, { once: true, capture: true });
5617    return cancelTimer;
5618  }
5619  function addGlobalEventListener(type, listener, options, scope = window) {
5620    const children = [];
5621    try {
5622      scope.document.addEventListener(type, listener, options);
5623      for (const frame of Array.from(scope.frames)) {
5624        children.push(addGlobalEventListener(type, listener, options, frame));
5625      }
5626    } catch (e2) {
5627    }
5628    const removeEventListener = () => {
5629      try {
5630        scope.document.removeEventListener(type, listener, options);
5631      } catch (e2) {
5632      }
5633      for (const remove of children) {
5634        remove();
5635      }
5636    };
5637    return removeEventListener;
5638  }
5639  
5640  // node_modules/@ariakit/react-core/esm/__chunks/ABQUS43J.js
5641  var import_react3 = __toESM(require_react(), 1);
5642  var React2 = __toESM(require_react(), 1);
5643  var _React = __spreadValues({}, React2);
5644  var useReactId = _React.useId;
5645  var useReactDeferredValue = _React.useDeferredValue;
5646  var useReactInsertionEffect = _React.useInsertionEffect;
5647  var useSafeLayoutEffect = canUseDOM ? import_react3.useLayoutEffect : import_react3.useEffect;
5648  function useInitialValue(value) {
5649    const [initialValue] = (0, import_react3.useState)(value);
5650    return initialValue;
5651  }
5652  function useLiveRef(value) {
5653    const ref = (0, import_react3.useRef)(value);
5654    useSafeLayoutEffect(() => {
5655      ref.current = value;
5656    });
5657    return ref;
5658  }
5659  function useEvent(callback) {
5660    const ref = (0, import_react3.useRef)(() => {
5661      throw new Error("Cannot call an event handler while rendering.");
5662    });
5663    if (useReactInsertionEffect) {
5664      useReactInsertionEffect(() => {
5665        ref.current = callback;
5666      });
5667    } else {
5668      ref.current = callback;
5669    }
5670    return (0, import_react3.useCallback)((...args) => {
5671      var _a;
5672      return (_a = ref.current) == null ? void 0 : _a.call(ref, ...args);
5673    }, []);
5674  }
5675  function useTransactionState(callback) {
5676    const [state, setState] = (0, import_react3.useState)(null);
5677    useSafeLayoutEffect(() => {
5678      if (state == null) return;
5679      if (!callback) return;
5680      let prevState = null;
5681      callback((prev) => {
5682        prevState = prev;
5683        return state;
5684      });
5685      return () => {
5686        callback(prevState);
5687      };
5688    }, [state, callback]);
5689    return [state, setState];
5690  }
5691  function useMergeRefs(...refs) {
5692    return (0, import_react3.useMemo)(() => {
5693      if (!refs.some(Boolean)) return;
5694      return (value) => {
5695        for (const ref of refs) {
5696          setRef(ref, value);
5697        }
5698      };
5699    }, refs);
5700  }
5701  function useId3(defaultId) {
5702    if (useReactId) {
5703      const reactId = useReactId();
5704      if (defaultId) return defaultId;
5705      return reactId;
5706    }
5707    const [id, setId] = (0, import_react3.useState)(defaultId);
5708    useSafeLayoutEffect(() => {
5709      if (defaultId || id) return;
5710      const random = Math.random().toString(36).slice(2, 8);
5711      setId(`id-$random}`);
5712    }, [defaultId, id]);
5713    return defaultId || id;
5714  }
5715  function useTagName(refOrElement, type) {
5716    const stringOrUndefined = (type2) => {
5717      if (typeof type2 !== "string") return;
5718      return type2;
5719    };
5720    const [tagName, setTagName] = (0, import_react3.useState)(() => stringOrUndefined(type));
5721    useSafeLayoutEffect(() => {
5722      const element = refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement;
5723      setTagName((element == null ? void 0 : element.tagName.toLowerCase()) || stringOrUndefined(type));
5724    }, [refOrElement, type]);
5725    return tagName;
5726  }
5727  function useAttribute(refOrElement, attributeName, defaultValue2) {
5728    const initialValue = useInitialValue(defaultValue2);
5729    const [attribute, setAttribute] = (0, import_react3.useState)(initialValue);
5730    (0, import_react3.useEffect)(() => {
5731      const element = refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement;
5732      if (!element) return;
5733      const callback = () => {
5734        const value = element.getAttribute(attributeName);
5735        setAttribute(value == null ? initialValue : value);
5736      };
5737      const observer = new MutationObserver(callback);
5738      observer.observe(element, { attributeFilter: [attributeName] });
5739      callback();
5740      return () => observer.disconnect();
5741    }, [refOrElement, attributeName, initialValue]);
5742    return attribute;
5743  }
5744  function useUpdateEffect(effect, deps) {
5745    const mounted = (0, import_react3.useRef)(false);
5746    (0, import_react3.useEffect)(() => {
5747      if (mounted.current) {
5748        return effect();
5749      }
5750      mounted.current = true;
5751    }, deps);
5752    (0, import_react3.useEffect)(
5753      () => () => {
5754        mounted.current = false;
5755      },
5756      []
5757    );
5758  }
5759  function useUpdateLayoutEffect(effect, deps) {
5760    const mounted = (0, import_react3.useRef)(false);
5761    useSafeLayoutEffect(() => {
5762      if (mounted.current) {
5763        return effect();
5764      }
5765      mounted.current = true;
5766    }, deps);
5767    useSafeLayoutEffect(
5768      () => () => {
5769        mounted.current = false;
5770      },
5771      []
5772    );
5773  }
5774  function useForceUpdate() {
5775    return (0, import_react3.useReducer)(() => [], []);
5776  }
5777  function useBooleanEvent(booleanOrCallback) {
5778    return useEvent(
5779      typeof booleanOrCallback === "function" ? booleanOrCallback : () => booleanOrCallback
5780    );
5781  }
5782  function useWrapElement(props, callback, deps = []) {
5783    const wrapElement = (0, import_react3.useCallback)(
5784      (element) => {
5785        if (props.wrapElement) {
5786          element = props.wrapElement(element);
5787        }
5788        return callback(element);
5789      },
5790      [...deps, props.wrapElement]
5791    );
5792    return __spreadProps(__spreadValues({}, props), { wrapElement });
5793  }
5794  function useMetadataProps(props, key, value) {
5795    const parent = props.onLoadedMetadataCapture;
5796    const onLoadedMetadataCapture = (0, import_react3.useMemo)(() => {
5797      return Object.assign(() => {
5798      }, __spreadProps(__spreadValues({}, parent), { [key]: value }));
5799    }, [parent, key, value]);
5800    return [parent == null ? void 0 : parent[key], { onLoadedMetadataCapture }];
5801  }
5802  function useIsMouseMoving() {
5803    (0, import_react3.useEffect)(() => {
5804      addGlobalEventListener("mousemove", setMouseMoving, true);
5805      addGlobalEventListener("mousedown", resetMouseMoving, true);
5806      addGlobalEventListener("mouseup", resetMouseMoving, true);
5807      addGlobalEventListener("keydown", resetMouseMoving, true);
5808      addGlobalEventListener("scroll", resetMouseMoving, true);
5809    }, []);
5810    const isMouseMoving = useEvent(() => mouseMoving);
5811    return isMouseMoving;
5812  }
5813  var mouseMoving = false;
5814  var previousScreenX = 0;
5815  var previousScreenY = 0;
5816  function hasMouseMovement(event) {
5817    const movementX = event.movementX || event.screenX - previousScreenX;
5818    const movementY = event.movementY || event.screenY - previousScreenY;
5819    previousScreenX = event.screenX;
5820    previousScreenY = event.screenY;
5821    return movementX || movementY || false;
5822  }
5823  function setMouseMoving(event) {
5824    if (!hasMouseMovement(event)) return;
5825    mouseMoving = true;
5826  }
5827  function resetMouseMoving() {
5828    mouseMoving = false;
5829  }
5830  
5831  // node_modules/@ariakit/react-core/esm/__chunks/LMDWO4NN.js
5832  var React3 = __toESM(require_react(), 1);
5833  var import_jsx_runtime46 = __toESM(require_jsx_runtime(), 1);
5834  function forwardRef22(render4) {
5835    const Role = React3.forwardRef((props, ref) => render4(__spreadProps(__spreadValues({}, props), { ref })));
5836    Role.displayName = render4.displayName || render4.name;
5837    return Role;
5838  }
5839  function memo22(Component, propsAreEqual) {
5840    return React3.memo(Component, propsAreEqual);
5841  }
5842  function createElement2(Type, props) {
5843    const _a = props, { wrapElement, render: render4 } = _a, rest = __objRest(_a, ["wrapElement", "render"]);
5844    const mergedRef = useMergeRefs(props.ref, getRefProperty(render4));
5845    let element;
5846    if (React3.isValidElement(render4)) {
5847      const renderProps = __spreadProps(__spreadValues({}, render4.props), { ref: mergedRef });
5848      element = React3.cloneElement(render4, mergeProps(rest, renderProps));
5849    } else if (render4) {
5850      element = render4(rest);
5851    } else {
5852      element = /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Type, __spreadValues({}, rest));
5853    }
5854    if (wrapElement) {
5855      return wrapElement(element);
5856    }
5857    return element;
5858  }
5859  function createHook(useProps) {
5860    const useRole = (props = {}) => {
5861      return useProps(props);
5862    };
5863    useRole.displayName = useProps.name;
5864    return useRole;
5865  }
5866  function createStoreContext(providers = [], scopedProviders = []) {
5867    const context = React3.createContext(void 0);
5868    const scopedContext = React3.createContext(void 0);
5869    const useContext28 = () => React3.useContext(context);
5870    const useScopedContext = (onlyScoped = false) => {
5871      const scoped = React3.useContext(scopedContext);
5872      const store = useContext28();
5873      if (onlyScoped) return scoped;
5874      return scoped || store;
5875    };
5876    const useProviderContext = () => {
5877      const scoped = React3.useContext(scopedContext);
5878      const store = useContext28();
5879      if (scoped && scoped === store) return;
5880      return store;
5881    };
5882    const ContextProvider = (props) => {
5883      return providers.reduceRight(
5884        (children, Provider) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Provider, __spreadProps(__spreadValues({}, props), { children })),
5885        /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(context.Provider, __spreadValues({}, props))
5886      );
5887    };
5888    const ScopedContextProvider = (props) => {
5889      return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(ContextProvider, __spreadProps(__spreadValues({}, props), { children: scopedProviders.reduceRight(
5890        (children, Provider) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Provider, __spreadProps(__spreadValues({}, props), { children })),
5891        /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(scopedContext.Provider, __spreadValues({}, props))
5892      ) }));
5893    };
5894    return {
5895      context,
5896      scopedContext,
5897      useContext: useContext28,
5898      useScopedContext,
5899      useProviderContext,
5900      ContextProvider,
5901      ScopedContextProvider
5902    };
5903  }
5904  
5905  // node_modules/@ariakit/react-core/esm/__chunks/VDHZ5F7K.js
5906  var ctx = createStoreContext();
5907  var useCollectionContext = ctx.useContext;
5908  var useCollectionScopedContext = ctx.useScopedContext;
5909  var useCollectionProviderContext = ctx.useProviderContext;
5910  var CollectionContextProvider = ctx.ContextProvider;
5911  var CollectionScopedContextProvider = ctx.ScopedContextProvider;
5912  
5913  // node_modules/@ariakit/react-core/esm/__chunks/P7GR5CS5.js
5914  var import_react4 = __toESM(require_react(), 1);
5915  var ctx2 = createStoreContext(
5916    [CollectionContextProvider],
5917    [CollectionScopedContextProvider]
5918  );
5919  var useCompositeContext = ctx2.useContext;
5920  var useCompositeScopedContext = ctx2.useScopedContext;
5921  var useCompositeProviderContext = ctx2.useProviderContext;
5922  var CompositeContextProvider = ctx2.ContextProvider;
5923  var CompositeScopedContextProvider = ctx2.ScopedContextProvider;
5924  var CompositeItemContext = (0, import_react4.createContext)(
5925    void 0
5926  );
5927  var CompositeRowContext = (0, import_react4.createContext)(
5928    void 0
5929  );
5930  
5931  // node_modules/@ariakit/react-core/esm/__chunks/3XAVFTCA.js
5932  var import_react5 = __toESM(require_react(), 1);
5933  var TagValueContext = (0, import_react5.createContext)(null);
5934  var TagRemoveIdContext = (0, import_react5.createContext)(
5935    null
5936  );
5937  var ctx3 = createStoreContext(
5938    [CompositeContextProvider],
5939    [CompositeScopedContextProvider]
5940  );
5941  var useTagContext = ctx3.useContext;
5942  var useTagScopedContext = ctx3.useScopedContext;
5943  var useTagProviderContext = ctx3.useProviderContext;
5944  var TagContextProvider = ctx3.ContextProvider;
5945  var TagScopedContextProvider = ctx3.ScopedContextProvider;
5946  
5947  // node_modules/@ariakit/core/esm/__chunks/BCALMBPZ.js
5948  function getInternal(store, key) {
5949    const internals = store.__unstableInternals;
5950    invariant(internals, "Invalid store");
5951    return internals[key];
5952  }
5953  function createStore(initialState, ...stores) {
5954    let state = initialState;
5955    let prevStateBatch = state;
5956    let lastUpdate = Symbol();
5957    let destroy = noop;
5958    const instances = /* @__PURE__ */ new Set();
5959    const updatedKeys = /* @__PURE__ */ new Set();
5960    const setups = /* @__PURE__ */ new Set();
5961    const listeners = /* @__PURE__ */ new Set();
5962    const batchListeners = /* @__PURE__ */ new Set();
5963    const disposables = /* @__PURE__ */ new WeakMap();
5964    const listenerKeys = /* @__PURE__ */ new WeakMap();
5965    const storeSetup = (callback) => {
5966      setups.add(callback);
5967      return () => setups.delete(callback);
5968    };
5969    const storeInit = () => {
5970      const initialized = instances.size;
5971      const instance = Symbol();
5972      instances.add(instance);
5973      const maybeDestroy = () => {
5974        instances.delete(instance);
5975        if (instances.size) return;
5976        destroy();
5977      };
5978      if (initialized) return maybeDestroy;
5979      const desyncs = getKeys(state).map(
5980        (key) => chain(
5981          ...stores.map((store) => {
5982            var _a;
5983            const storeState = (_a = store == null ? void 0 : store.getState) == null ? void 0 : _a.call(store);
5984            if (!storeState) return;
5985            if (!hasOwnProperty(storeState, key)) return;
5986            return sync(store, [key], (state2) => {
5987              setState(
5988                key,
5989                state2[key],
5990                // @ts-expect-error - Not public API. This is just to prevent
5991                // infinite loops.
5992                true
5993              );
5994            });
5995          })
5996        )
5997      );
5998      const teardowns = [];
5999      for (const setup2 of setups) {
6000        teardowns.push(setup2());
6001      }
6002      const cleanups = stores.map(init);
6003      destroy = chain(...desyncs, ...teardowns, ...cleanups);
6004      return maybeDestroy;
6005    };
6006    const sub = (keys, listener, set = listeners) => {
6007      set.add(listener);
6008      listenerKeys.set(listener, keys);
6009      return () => {
6010        var _a;
6011        (_a = disposables.get(listener)) == null ? void 0 : _a();
6012        disposables.delete(listener);
6013        listenerKeys.delete(listener);
6014        set.delete(listener);
6015      };
6016    };
6017    const storeSubscribe = (keys, listener) => sub(keys, listener);
6018    const storeSync = (keys, listener) => {
6019      disposables.set(listener, listener(state, state));
6020      return sub(keys, listener);
6021    };
6022    const storeBatch = (keys, listener) => {
6023      disposables.set(listener, listener(state, prevStateBatch));
6024      return sub(keys, listener, batchListeners);
6025    };
6026    const storePick = (keys) => createStore(pick(state, keys), finalStore);
6027    const storeOmit = (keys) => createStore(omit2(state, keys), finalStore);
6028    const getState = () => state;
6029    const setState = (key, value, fromStores = false) => {
6030      var _a;
6031      if (!hasOwnProperty(state, key)) return;
6032      const nextValue = applyState(value, state[key]);
6033      if (nextValue === state[key]) return;
6034      if (!fromStores) {
6035        for (const store of stores) {
6036          (_a = store == null ? void 0 : store.setState) == null ? void 0 : _a.call(store, key, nextValue);
6037        }
6038      }
6039      const prevState = state;
6040      state = __spreadProps2(__spreadValues2({}, state), { [key]: nextValue });
6041      const thisUpdate = Symbol();
6042      lastUpdate = thisUpdate;
6043      updatedKeys.add(key);
6044      const run = (listener, prev, uKeys) => {
6045        var _a2;
6046        const keys = listenerKeys.get(listener);
6047        const updated = (k) => uKeys ? uKeys.has(k) : k === key;
6048        if (!keys || keys.some(updated)) {
6049          (_a2 = disposables.get(listener)) == null ? void 0 : _a2();
6050          disposables.set(listener, listener(state, prev));
6051        }
6052      };
6053      for (const listener of listeners) {
6054        run(listener, prevState);
6055      }
6056      queueMicrotask(() => {
6057        if (lastUpdate !== thisUpdate) return;
6058        const snapshot = state;
6059        for (const listener of batchListeners) {
6060          run(listener, prevStateBatch, updatedKeys);
6061        }
6062        prevStateBatch = snapshot;
6063        updatedKeys.clear();
6064      });
6065    };
6066    const finalStore = {
6067      getState,
6068      setState,
6069      __unstableInternals: {
6070        setup: storeSetup,
6071        init: storeInit,
6072        subscribe: storeSubscribe,
6073        sync: storeSync,
6074        batch: storeBatch,
6075        pick: storePick,
6076        omit: storeOmit
6077      }
6078    };
6079    return finalStore;
6080  }
6081  function setup(store, ...args) {
6082    if (!store) return;
6083    return getInternal(store, "setup")(...args);
6084  }
6085  function init(store, ...args) {
6086    if (!store) return;
6087    return getInternal(store, "init")(...args);
6088  }
6089  function subscribe(store, ...args) {
6090    if (!store) return;
6091    return getInternal(store, "subscribe")(...args);
6092  }
6093  function sync(store, ...args) {
6094    if (!store) return;
6095    return getInternal(store, "sync")(...args);
6096  }
6097  function batch(store, ...args) {
6098    if (!store) return;
6099    return getInternal(store, "batch")(...args);
6100  }
6101  function omit22(store, ...args) {
6102    if (!store) return;
6103    return getInternal(store, "omit")(...args);
6104  }
6105  function pick2(store, ...args) {
6106    if (!store) return;
6107    return getInternal(store, "pick")(...args);
6108  }
6109  function mergeStore(...stores) {
6110    const initialState = stores.reduce((state, store2) => {
6111      var _a;
6112      const nextState = (_a = store2 == null ? void 0 : store2.getState) == null ? void 0 : _a.call(store2);
6113      if (!nextState) return state;
6114      return Object.assign(state, nextState);
6115    }, {});
6116    const store = createStore(initialState, ...stores);
6117    return Object.assign({}, ...stores, store);
6118  }
6119  function throwOnConflictingProps(props, store) {
6120    if (false) return;
6121    if (!store) return;
6122    const defaultKeys = Object.entries(props).filter(([key, value]) => key.startsWith("default") && value !== void 0).map(([key]) => {
6123      var _a;
6124      const stateKey = key.replace("default", "");
6125      return `${((_a = stateKey[0]) == null ? void 0 : _a.toLowerCase()) || ""}$stateKey.slice(1)}`;
6126    });
6127    if (!defaultKeys.length) return;
6128    const storeState = store.getState();
6129    const conflictingProps = defaultKeys.filter(
6130      (key) => hasOwnProperty(storeState, key)
6131    );
6132    if (!conflictingProps.length) return;
6133    throw new Error(
6134      `Passing a store prop in conjunction with a default state is not supported.
6135  
6136  const store = useSelectStore();
6137  <SelectProvider store={store} defaultValue="Apple" />
6138                  ^             ^
6139  
6140  Instead, pass the default state to the topmost store:
6141  
6142  const store = useSelectStore({ defaultValue: "Apple" });
6143  <SelectProvider store={store} />
6144  
6145  See https://github.com/ariakit/ariakit/pull/2745 for more details.
6146  
6147  If there's a particular need for this, please submit a feature request at https://github.com/ariakit/ariakit
6148  `
6149    );
6150  }
6151  
6152  // node_modules/@ariakit/react-core/esm/__chunks/YV4JVR4I.js
6153  var React4 = __toESM(require_react(), 1);
6154  var import_shim = __toESM(require_shim(), 1);
6155  var { useSyncExternalStore } = import_shim.default;
6156  var noopSubscribe = () => () => {
6157  };
6158  function useStoreState(store, keyOrSelector = identity) {
6159    const storeSubscribe = React4.useCallback(
6160      (callback) => {
6161        if (!store) return noopSubscribe();
6162        return subscribe(store, null, callback);
6163      },
6164      [store]
6165    );
6166    const getSnapshot = () => {
6167      const key = typeof keyOrSelector === "string" ? keyOrSelector : null;
6168      const selector2 = typeof keyOrSelector === "function" ? keyOrSelector : null;
6169      const state = store == null ? void 0 : store.getState();
6170      if (selector2) return selector2(state);
6171      if (!state) return;
6172      if (!key) return;
6173      if (!hasOwnProperty(state, key)) return;
6174      return state[key];
6175    };
6176    return useSyncExternalStore(storeSubscribe, getSnapshot, getSnapshot);
6177  }
6178  function useStoreStateObject(store, object) {
6179    const objRef = React4.useRef(
6180      {}
6181    );
6182    const storeSubscribe = React4.useCallback(
6183      (callback) => {
6184        if (!store) return noopSubscribe();
6185        return subscribe(store, null, callback);
6186      },
6187      [store]
6188    );
6189    const getSnapshot = () => {
6190      const state = store == null ? void 0 : store.getState();
6191      let updated = false;
6192      const obj = objRef.current;
6193      for (const prop in object) {
6194        const keyOrSelector = object[prop];
6195        if (typeof keyOrSelector === "function") {
6196          const value = keyOrSelector(state);
6197          if (value !== obj[prop]) {
6198            obj[prop] = value;
6199            updated = true;
6200          }
6201        }
6202        if (typeof keyOrSelector === "string") {
6203          if (!state) continue;
6204          if (!hasOwnProperty(state, keyOrSelector)) continue;
6205          const value = state[keyOrSelector];
6206          if (value !== obj[prop]) {
6207            obj[prop] = value;
6208            updated = true;
6209          }
6210        }
6211      }
6212      if (updated) {
6213        objRef.current = __spreadValues({}, obj);
6214      }
6215      return objRef.current;
6216    };
6217    return useSyncExternalStore(storeSubscribe, getSnapshot, getSnapshot);
6218  }
6219  function useStoreProps(store, props, key, setKey) {
6220    const value = hasOwnProperty(props, key) ? props[key] : void 0;
6221    const setValue = setKey ? props[setKey] : void 0;
6222    const propsRef = useLiveRef({ value, setValue });
6223    useSafeLayoutEffect(() => {
6224      return sync(store, [key], (state, prev) => {
6225        const { value: value2, setValue: setValue2 } = propsRef.current;
6226        if (!setValue2) return;
6227        if (state[key] === prev[key]) return;
6228        if (state[key] === value2) return;
6229        setValue2(state[key]);
6230      });
6231    }, [store, key]);
6232    useSafeLayoutEffect(() => {
6233      if (value === void 0) return;
6234      store.setState(key, value);
6235      return batch(store, [key], () => {
6236        if (value === void 0) return;
6237        store.setState(key, value);
6238      });
6239    });
6240  }
6241  function useStore(createStore2, props) {
6242    const [store, setStore] = React4.useState(() => createStore2(props));
6243    useSafeLayoutEffect(() => init(store), [store]);
6244    const useState22 = React4.useCallback(
6245      (keyOrSelector) => useStoreState(store, keyOrSelector),
6246      [store]
6247    );
6248    const memoizedStore = React4.useMemo(
6249      () => __spreadProps(__spreadValues({}, store), { useState: useState22 }),
6250      [store, useState22]
6251    );
6252    const updateStore = useEvent(() => {
6253      setStore((store2) => createStore2(__spreadValues(__spreadValues({}, props), store2.getState())));
6254    });
6255    return [memoizedStore, updateStore];
6256  }
6257  
6258  // node_modules/@ariakit/core/esm/__chunks/CYQWQL4J.js
6259  function getCommonParent(items) {
6260    var _a;
6261    const firstItem = items.find((item) => !!item.element);
6262    const lastItem = [...items].reverse().find((item) => !!item.element);
6263    let parentElement = (_a = firstItem == null ? void 0 : firstItem.element) == null ? void 0 : _a.parentElement;
6264    while (parentElement && (lastItem == null ? void 0 : lastItem.element)) {
6265      const parent = parentElement;
6266      if (lastItem && parent.contains(lastItem.element)) {
6267        return parentElement;
6268      }
6269      parentElement = parentElement.parentElement;
6270    }
6271    return getDocument(parentElement).body;
6272  }
6273  function getPrivateStore(store) {
6274    return store == null ? void 0 : store.__unstablePrivateStore;
6275  }
6276  function createCollectionStore(props = {}) {
6277    var _a;
6278    throwOnConflictingProps(props, props.store);
6279    const syncState = (_a = props.store) == null ? void 0 : _a.getState();
6280    const items = defaultValue(
6281      props.items,
6282      syncState == null ? void 0 : syncState.items,
6283      props.defaultItems,
6284      []
6285    );
6286    const itemsMap = new Map(items.map((item) => [item.id, item]));
6287    const initialState = {
6288      items,
6289      renderedItems: defaultValue(syncState == null ? void 0 : syncState.renderedItems, [])
6290    };
6291    const syncPrivateStore = getPrivateStore(props.store);
6292    const privateStore = createStore(
6293      { items, renderedItems: initialState.renderedItems },
6294      syncPrivateStore
6295    );
6296    const collection = createStore(initialState, props.store);
6297    const sortItems = (renderedItems) => {
6298      const sortedItems = sortBasedOnDOMPosition(renderedItems, (i2) => i2.element);
6299      privateStore.setState("renderedItems", sortedItems);
6300      collection.setState("renderedItems", sortedItems);
6301    };
6302    setup(collection, () => init(privateStore));
6303    setup(privateStore, () => {
6304      return batch(privateStore, ["items"], (state) => {
6305        collection.setState("items", state.items);
6306      });
6307    });
6308    setup(privateStore, () => {
6309      return batch(privateStore, ["renderedItems"], (state) => {
6310        let firstRun = true;
6311        let raf = requestAnimationFrame(() => {
6312          const { renderedItems } = collection.getState();
6313          if (state.renderedItems === renderedItems) return;
6314          sortItems(state.renderedItems);
6315        });
6316        if (typeof IntersectionObserver !== "function") {
6317          return () => cancelAnimationFrame(raf);
6318        }
6319        const ioCallback = () => {
6320          if (firstRun) {
6321            firstRun = false;
6322            return;
6323          }
6324          cancelAnimationFrame(raf);
6325          raf = requestAnimationFrame(() => sortItems(state.renderedItems));
6326        };
6327        const root = getCommonParent(state.renderedItems);
6328        const observer = new IntersectionObserver(ioCallback, { root });
6329        for (const item of state.renderedItems) {
6330          if (!item.element) continue;
6331          observer.observe(item.element);
6332        }
6333        return () => {
6334          cancelAnimationFrame(raf);
6335          observer.disconnect();
6336        };
6337      });
6338    });
6339    const mergeItem = (item, setItems, canDeleteFromMap = false) => {
6340      let prevItem;
6341      setItems((items2) => {
6342        const index = items2.findIndex(({ id }) => id === item.id);
6343        const nextItems = items2.slice();
6344        if (index !== -1) {
6345          prevItem = items2[index];
6346          const nextItem = __spreadValues2(__spreadValues2({}, prevItem), item);
6347          nextItems[index] = nextItem;
6348          itemsMap.set(item.id, nextItem);
6349        } else {
6350          nextItems.push(item);
6351          itemsMap.set(item.id, item);
6352        }
6353        return nextItems;
6354      });
6355      const unmergeItem = () => {
6356        setItems((items2) => {
6357          if (!prevItem) {
6358            if (canDeleteFromMap) {
6359              itemsMap.delete(item.id);
6360            }
6361            return items2.filter(({ id }) => id !== item.id);
6362          }
6363          const index = items2.findIndex(({ id }) => id === item.id);
6364          if (index === -1) return items2;
6365          const nextItems = items2.slice();
6366          nextItems[index] = prevItem;
6367          itemsMap.set(item.id, prevItem);
6368          return nextItems;
6369        });
6370      };
6371      return unmergeItem;
6372    };
6373    const registerItem = (item) => mergeItem(
6374      item,
6375      (getItems) => privateStore.setState("items", getItems),
6376      true
6377    );
6378    return __spreadProps2(__spreadValues2({}, collection), {
6379      registerItem,
6380      renderItem: (item) => chain(
6381        registerItem(item),
6382        mergeItem(
6383          item,
6384          (getItems) => privateStore.setState("renderedItems", getItems)
6385        )
6386      ),
6387      item: (id) => {
6388        if (!id) return null;
6389        let item = itemsMap.get(id);
6390        if (!item) {
6391          const { items: items2 } = privateStore.getState();
6392          item = items2.find((item2) => item2.id === id);
6393          if (item) {
6394            itemsMap.set(id, item);
6395          }
6396        }
6397        return item || null;
6398      },
6399      // @ts-expect-error Internal
6400      __unstablePrivateStore: privateStore
6401    });
6402  }
6403  
6404  // node_modules/@ariakit/react-core/esm/__chunks/C3IKGW5T.js
6405  function useCollectionStoreProps(store, update, props) {
6406    useUpdateEffect(update, [props.store]);
6407    useStoreProps(store, props, "items", "setItems");
6408    return store;
6409  }
6410  
6411  // node_modules/@ariakit/core/esm/__chunks/7PRQYBBV.js
6412  function toArray(arg) {
6413    if (Array.isArray(arg)) {
6414      return arg;
6415    }
6416    return typeof arg !== "undefined" ? [arg] : [];
6417  }
6418  function flatten2DArray(array) {
6419    const flattened = [];
6420    for (const row of array) {
6421      flattened.push(...row);
6422    }
6423    return flattened;
6424  }
6425  function reverseArray(array) {
6426    return array.slice().reverse();
6427  }
6428  
6429  // node_modules/@ariakit/core/esm/__chunks/AJZ4BYF3.js
6430  var NULL_ITEM = { id: null };
6431  function findFirstEnabledItem(items, excludeId) {
6432    return items.find((item) => {
6433      if (excludeId) {
6434        return !item.disabled && item.id !== excludeId;
6435      }
6436      return !item.disabled;
6437    });
6438  }
6439  function getEnabledItems(items, excludeId) {
6440    return items.filter((item) => {
6441      if (excludeId) {
6442        return !item.disabled && item.id !== excludeId;
6443      }
6444      return !item.disabled;
6445    });
6446  }
6447  function getItemsInRow(items, rowId) {
6448    return items.filter((item) => item.rowId === rowId);
6449  }
6450  function flipItems(items, activeId, shouldInsertNullItem = false) {
6451    const index = items.findIndex((item) => item.id === activeId);
6452    return [
6453      ...items.slice(index + 1),
6454      ...shouldInsertNullItem ? [NULL_ITEM] : [],
6455      ...items.slice(0, index)
6456    ];
6457  }
6458  function groupItemsByRows(items) {
6459    const rows = [];
6460    for (const item of items) {
6461      const row = rows.find((currentRow) => {
6462        var _a;
6463        return ((_a = currentRow[0]) == null ? void 0 : _a.rowId) === item.rowId;
6464      });
6465      if (row) {
6466        row.push(item);
6467      } else {
6468        rows.push([item]);
6469      }
6470    }
6471    return rows;
6472  }
6473  function getMaxRowLength(array) {
6474    let maxLength = 0;
6475    for (const { length } of array) {
6476      if (length > maxLength) {
6477        maxLength = length;
6478      }
6479    }
6480    return maxLength;
6481  }
6482  function createEmptyItem(rowId) {
6483    return {
6484      id: "__EMPTY_ITEM__",
6485      disabled: true,
6486      rowId
6487    };
6488  }
6489  function normalizeRows(rows, activeId, focusShift) {
6490    const maxLength = getMaxRowLength(rows);
6491    for (const row of rows) {
6492      for (let i2 = 0; i2 < maxLength; i2 += 1) {
6493        const item = row[i2];
6494        if (!item || focusShift && item.disabled) {
6495          const isFirst = i2 === 0;
6496          const previousItem = isFirst && focusShift ? findFirstEnabledItem(row) : row[i2 - 1];
6497          row[i2] = previousItem && activeId !== previousItem.id && focusShift ? previousItem : createEmptyItem(previousItem == null ? void 0 : previousItem.rowId);
6498        }
6499      }
6500    }
6501    return rows;
6502  }
6503  function verticalizeItems(items) {
6504    const rows = groupItemsByRows(items);
6505    const maxLength = getMaxRowLength(rows);
6506    const verticalized = [];
6507    for (let i2 = 0; i2 < maxLength; i2 += 1) {
6508      for (const row of rows) {
6509        const item = row[i2];
6510        if (item) {
6511          verticalized.push(__spreadProps2(__spreadValues2({}, item), {
6512            // If there's no rowId, it means that it's not a grid composite, but
6513            // a single row instead. So, instead of verticalizing it, that is,
6514            // assigning a different rowId based on the column index, we keep it
6515            // undefined so they will be part of the same row. This is useful
6516            // when using up/down on one-dimensional composites.
6517            rowId: item.rowId ? `$i2}` : void 0
6518          }));
6519        }
6520      }
6521    }
6522    return verticalized;
6523  }
6524  function createCompositeStore(props = {}) {
6525    var _a;
6526    const syncState = (_a = props.store) == null ? void 0 : _a.getState();
6527    const collection = createCollectionStore(props);
6528    const activeId = defaultValue(
6529      props.activeId,
6530      syncState == null ? void 0 : syncState.activeId,
6531      props.defaultActiveId
6532    );
6533    const initialState = __spreadProps2(__spreadValues2({}, collection.getState()), {
6534      id: defaultValue(
6535        props.id,
6536        syncState == null ? void 0 : syncState.id,
6537        `id-$Math.random().toString(36).slice(2, 8)}`
6538      ),
6539      activeId,
6540      baseElement: defaultValue(syncState == null ? void 0 : syncState.baseElement, null),
6541      includesBaseElement: defaultValue(
6542        props.includesBaseElement,
6543        syncState == null ? void 0 : syncState.includesBaseElement,
6544        activeId === null
6545      ),
6546      moves: defaultValue(syncState == null ? void 0 : syncState.moves, 0),
6547      orientation: defaultValue(
6548        props.orientation,
6549        syncState == null ? void 0 : syncState.orientation,
6550        "both"
6551      ),
6552      rtl: defaultValue(props.rtl, syncState == null ? void 0 : syncState.rtl, false),
6553      virtualFocus: defaultValue(
6554        props.virtualFocus,
6555        syncState == null ? void 0 : syncState.virtualFocus,
6556        false
6557      ),
6558      focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, false),
6559      focusWrap: defaultValue(props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, false),
6560      focusShift: defaultValue(props.focusShift, syncState == null ? void 0 : syncState.focusShift, false)
6561    });
6562    const composite = createStore(initialState, collection, props.store);
6563    setup(
6564      composite,
6565      () => sync(composite, ["renderedItems", "activeId"], (state) => {
6566        composite.setState("activeId", (activeId2) => {
6567          var _a2;
6568          if (activeId2 !== void 0) return activeId2;
6569          return (_a2 = findFirstEnabledItem(state.renderedItems)) == null ? void 0 : _a2.id;
6570        });
6571      })
6572    );
6573    const getNextId = (direction = "next", options = {}) => {
6574      var _a2, _b;
6575      const defaultState = composite.getState();
6576      const {
6577        skip = 0,
6578        activeId: activeId2 = defaultState.activeId,
6579        focusShift = defaultState.focusShift,
6580        focusLoop = defaultState.focusLoop,
6581        focusWrap = defaultState.focusWrap,
6582        includesBaseElement = defaultState.includesBaseElement,
6583        renderedItems = defaultState.renderedItems,
6584        rtl = defaultState.rtl
6585      } = options;
6586      const isVerticalDirection = direction === "up" || direction === "down";
6587      const isNextDirection = direction === "next" || direction === "down";
6588      const canReverse = isNextDirection ? rtl && !isVerticalDirection : !rtl || isVerticalDirection;
6589      const canShift = focusShift && !skip;
6590      let items = !isVerticalDirection ? renderedItems : flatten2DArray(
6591        normalizeRows(groupItemsByRows(renderedItems), activeId2, canShift)
6592      );
6593      items = canReverse ? reverseArray(items) : items;
6594      items = isVerticalDirection ? verticalizeItems(items) : items;
6595      if (activeId2 == null) {
6596        return (_a2 = findFirstEnabledItem(items)) == null ? void 0 : _a2.id;
6597      }
6598      const activeItem = items.find((item) => item.id === activeId2);
6599      if (!activeItem) {
6600        return (_b = findFirstEnabledItem(items)) == null ? void 0 : _b.id;
6601      }
6602      const isGrid2 = items.some((item) => item.rowId);
6603      const activeIndex = items.indexOf(activeItem);
6604      const nextItems = items.slice(activeIndex + 1);
6605      const nextItemsInRow = getItemsInRow(nextItems, activeItem.rowId);
6606      if (skip) {
6607        const nextEnabledItemsInRow = getEnabledItems(nextItemsInRow, activeId2);
6608        const nextItem2 = nextEnabledItemsInRow.slice(skip)[0] || // If we can't find an item, just return the last one.
6609        nextEnabledItemsInRow[nextEnabledItemsInRow.length - 1];
6610        return nextItem2 == null ? void 0 : nextItem2.id;
6611      }
6612      const canLoop = focusLoop && (isVerticalDirection ? focusLoop !== "horizontal" : focusLoop !== "vertical");
6613      const canWrap = isGrid2 && focusWrap && (isVerticalDirection ? focusWrap !== "horizontal" : focusWrap !== "vertical");
6614      const hasNullItem = isNextDirection ? (!isGrid2 || isVerticalDirection) && canLoop && includesBaseElement : isVerticalDirection ? includesBaseElement : false;
6615      if (canLoop) {
6616        const loopItems = canWrap && !hasNullItem ? items : getItemsInRow(items, activeItem.rowId);
6617        const sortedItems = flipItems(loopItems, activeId2, hasNullItem);
6618        const nextItem2 = findFirstEnabledItem(sortedItems, activeId2);
6619        return nextItem2 == null ? void 0 : nextItem2.id;
6620      }
6621      if (canWrap) {
6622        const nextItem2 = findFirstEnabledItem(
6623          // We can use nextItems, which contains all the next items, including
6624          // items from other rows, to wrap between rows. However, if there is a
6625          // null item (the composite container), we'll only use the next items in
6626          // the row. So moving next from the last item will focus on the
6627          // composite container. On grid composites, horizontal navigation never
6628          // focuses on the composite container, only vertical.
6629          hasNullItem ? nextItemsInRow : nextItems,
6630          activeId2
6631        );
6632        const nextId = hasNullItem ? (nextItem2 == null ? void 0 : nextItem2.id) || null : nextItem2 == null ? void 0 : nextItem2.id;
6633        return nextId;
6634      }
6635      const nextItem = findFirstEnabledItem(nextItemsInRow, activeId2);
6636      if (!nextItem && hasNullItem) {
6637        return null;
6638      }
6639      return nextItem == null ? void 0 : nextItem.id;
6640    };
6641    return __spreadProps2(__spreadValues2(__spreadValues2({}, collection), composite), {
6642      setBaseElement: (element) => composite.setState("baseElement", element),
6643      setActiveId: (id) => composite.setState("activeId", id),
6644      move: (id) => {
6645        if (id === void 0) return;
6646        composite.setState("activeId", id);
6647        composite.setState("moves", (moves) => moves + 1);
6648      },
6649      first: () => {
6650        var _a2;
6651        return (_a2 = findFirstEnabledItem(composite.getState().renderedItems)) == null ? void 0 : _a2.id;
6652      },
6653      last: () => {
6654        var _a2;
6655        return (_a2 = findFirstEnabledItem(reverseArray(composite.getState().renderedItems))) == null ? void 0 : _a2.id;
6656      },
6657      next: (options) => {
6658        if (options !== void 0 && typeof options === "number") {
6659          options = { skip: options };
6660        }
6661        return getNextId("next", options);
6662      },
6663      previous: (options) => {
6664        if (options !== void 0 && typeof options === "number") {
6665          options = { skip: options };
6666        }
6667        return getNextId("previous", options);
6668      },
6669      down: (options) => {
6670        if (options !== void 0 && typeof options === "number") {
6671          options = { skip: options };
6672        }
6673        return getNextId("down", options);
6674      },
6675      up: (options) => {
6676        if (options !== void 0 && typeof options === "number") {
6677          options = { skip: options };
6678        }
6679        return getNextId("up", options);
6680      }
6681    });
6682  }
6683  
6684  // node_modules/@ariakit/react-core/esm/__chunks/4CMBR7SL.js
6685  function useCompositeStoreOptions(props) {
6686    const id = useId3(props.id);
6687    return __spreadValues({ id }, props);
6688  }
6689  function useCompositeStoreProps(store, update, props) {
6690    store = useCollectionStoreProps(store, update, props);
6691    useStoreProps(store, props, "activeId", "setActiveId");
6692    useStoreProps(store, props, "includesBaseElement");
6693    useStoreProps(store, props, "virtualFocus");
6694    useStoreProps(store, props, "orientation");
6695    useStoreProps(store, props, "rtl");
6696    useStoreProps(store, props, "focusLoop");
6697    useStoreProps(store, props, "focusWrap");
6698    useStoreProps(store, props, "focusShift");
6699    return store;
6700  }
6701  
6702  // node_modules/@ariakit/core/esm/__chunks/RCQ5P4YE.js
6703  function createDisclosureStore(props = {}) {
6704    const store = mergeStore(
6705      props.store,
6706      omit22(props.disclosure, ["contentElement", "disclosureElement"])
6707    );
6708    throwOnConflictingProps(props, store);
6709    const syncState = store == null ? void 0 : store.getState();
6710    const open = defaultValue(
6711      props.open,
6712      syncState == null ? void 0 : syncState.open,
6713      props.defaultOpen,
6714      false
6715    );
6716    const animated = defaultValue(props.animated, syncState == null ? void 0 : syncState.animated, false);
6717    const initialState = {
6718      open,
6719      animated,
6720      animating: !!animated && open,
6721      mounted: open,
6722      contentElement: defaultValue(syncState == null ? void 0 : syncState.contentElement, null),
6723      disclosureElement: defaultValue(syncState == null ? void 0 : syncState.disclosureElement, null)
6724    };
6725    const disclosure = createStore(initialState, store);
6726    setup(
6727      disclosure,
6728      () => sync(disclosure, ["animated", "animating"], (state) => {
6729        if (state.animated) return;
6730        disclosure.setState("animating", false);
6731      })
6732    );
6733    setup(
6734      disclosure,
6735      () => subscribe(disclosure, ["open"], () => {
6736        if (!disclosure.getState().animated) return;
6737        disclosure.setState("animating", true);
6738      })
6739    );
6740    setup(
6741      disclosure,
6742      () => sync(disclosure, ["open", "animating"], (state) => {
6743        disclosure.setState("mounted", state.open || state.animating);
6744      })
6745    );
6746    return __spreadProps2(__spreadValues2({}, disclosure), {
6747      disclosure: props.disclosure,
6748      setOpen: (value) => disclosure.setState("open", value),
6749      show: () => disclosure.setState("open", true),
6750      hide: () => disclosure.setState("open", false),
6751      toggle: () => disclosure.setState("open", (open2) => !open2),
6752      stopAnimation: () => disclosure.setState("animating", false),
6753      setContentElement: (value) => disclosure.setState("contentElement", value),
6754      setDisclosureElement: (value) => disclosure.setState("disclosureElement", value)
6755    });
6756  }
6757  
6758  // node_modules/@ariakit/react-core/esm/__chunks/WYCIER3C.js
6759  function useDisclosureStoreProps(store, update, props) {
6760    useUpdateEffect(update, [props.store, props.disclosure]);
6761    useStoreProps(store, props, "open", "setOpen");
6762    useStoreProps(store, props, "mounted", "setMounted");
6763    useStoreProps(store, props, "animated");
6764    return Object.assign(store, { disclosure: props.disclosure });
6765  }
6766  
6767  // node_modules/@ariakit/core/esm/__chunks/FZZ2AVHF.js
6768  function createDialogStore(props = {}) {
6769    return createDisclosureStore(props);
6770  }
6771  
6772  // node_modules/@ariakit/react-core/esm/__chunks/BM6PGYQY.js
6773  function useDialogStoreProps(store, update, props) {
6774    return useDisclosureStoreProps(store, update, props);
6775  }
6776  
6777  // node_modules/@ariakit/core/esm/__chunks/ME2CUF3F.js
6778  function createPopoverStore(_a = {}) {
6779    var _b = _a, {
6780      popover: otherPopover
6781    } = _b, props = __objRest2(_b, [
6782      "popover"
6783    ]);
6784    const store = mergeStore(
6785      props.store,
6786      omit22(otherPopover, [
6787        "arrowElement",
6788        "anchorElement",
6789        "contentElement",
6790        "popoverElement",
6791        "disclosureElement"
6792      ])
6793    );
6794    throwOnConflictingProps(props, store);
6795    const syncState = store == null ? void 0 : store.getState();
6796    const dialog = createDialogStore(__spreadProps2(__spreadValues2({}, props), { store }));
6797    const placement = defaultValue(
6798      props.placement,
6799      syncState == null ? void 0 : syncState.placement,
6800      "bottom"
6801    );
6802    const initialState = __spreadProps2(__spreadValues2({}, dialog.getState()), {
6803      placement,
6804      currentPlacement: placement,
6805      anchorElement: defaultValue(syncState == null ? void 0 : syncState.anchorElement, null),
6806      popoverElement: defaultValue(syncState == null ? void 0 : syncState.popoverElement, null),
6807      arrowElement: defaultValue(syncState == null ? void 0 : syncState.arrowElement, null),
6808      rendered: Symbol("rendered")
6809    });
6810    const popover = createStore(initialState, dialog, store);
6811    return __spreadProps2(__spreadValues2(__spreadValues2({}, dialog), popover), {
6812      setAnchorElement: (element) => popover.setState("anchorElement", element),
6813      setPopoverElement: (element) => popover.setState("popoverElement", element),
6814      setArrowElement: (element) => popover.setState("arrowElement", element),
6815      render: () => popover.setState("rendered", Symbol("rendered"))
6816    });
6817  }
6818  
6819  // node_modules/@ariakit/react-core/esm/__chunks/O2PQ2652.js
6820  function usePopoverStoreProps(store, update, props) {
6821    useUpdateEffect(update, [props.popover]);
6822    useStoreProps(store, props, "placement");
6823    return useDialogStoreProps(store, update, props);
6824  }
6825  
6826  // node_modules/@ariakit/core/esm/combobox/combobox-store.js
6827  var isTouchSafari = isSafari() && isTouchDevice();
6828  function createComboboxStore(_a = {}) {
6829    var _b = _a, {
6830      tag
6831    } = _b, props = __objRest2(_b, [
6832      "tag"
6833    ]);
6834    const store = mergeStore(props.store, pick2(tag, ["value", "rtl"]));
6835    throwOnConflictingProps(props, store);
6836    const tagState = tag == null ? void 0 : tag.getState();
6837    const syncState = store == null ? void 0 : store.getState();
6838    const activeId = defaultValue(
6839      props.activeId,
6840      syncState == null ? void 0 : syncState.activeId,
6841      props.defaultActiveId,
6842      null
6843    );
6844    const composite = createCompositeStore(__spreadProps2(__spreadValues2({}, props), {
6845      activeId,
6846      includesBaseElement: defaultValue(
6847        props.includesBaseElement,
6848        syncState == null ? void 0 : syncState.includesBaseElement,
6849        true
6850      ),
6851      orientation: defaultValue(
6852        props.orientation,
6853        syncState == null ? void 0 : syncState.orientation,
6854        "vertical"
6855      ),
6856      focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true),
6857      focusWrap: defaultValue(props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, true),
6858      virtualFocus: defaultValue(
6859        props.virtualFocus,
6860        syncState == null ? void 0 : syncState.virtualFocus,
6861        true
6862      )
6863    }));
6864    const popover = createPopoverStore(__spreadProps2(__spreadValues2({}, props), {
6865      placement: defaultValue(
6866        props.placement,
6867        syncState == null ? void 0 : syncState.placement,
6868        "bottom-start"
6869      )
6870    }));
6871    const value = defaultValue(
6872      props.value,
6873      syncState == null ? void 0 : syncState.value,
6874      props.defaultValue,
6875      ""
6876    );
6877    const selectedValue = defaultValue(
6878      props.selectedValue,
6879      syncState == null ? void 0 : syncState.selectedValue,
6880      tagState == null ? void 0 : tagState.values,
6881      props.defaultSelectedValue,
6882      ""
6883    );
6884    const multiSelectable = Array.isArray(selectedValue);
6885    const initialState = __spreadProps2(__spreadValues2(__spreadValues2({}, composite.getState()), popover.getState()), {
6886      value,
6887      selectedValue,
6888      resetValueOnSelect: defaultValue(
6889        props.resetValueOnSelect,
6890        syncState == null ? void 0 : syncState.resetValueOnSelect,
6891        multiSelectable
6892      ),
6893      resetValueOnHide: defaultValue(
6894        props.resetValueOnHide,
6895        syncState == null ? void 0 : syncState.resetValueOnHide,
6896        multiSelectable && !tag
6897      ),
6898      activeValue: syncState == null ? void 0 : syncState.activeValue
6899    });
6900    const combobox = createStore(initialState, composite, popover, store);
6901    if (isTouchSafari) {
6902      setup(
6903        combobox,
6904        () => sync(combobox, ["virtualFocus"], () => {
6905          combobox.setState("virtualFocus", false);
6906        })
6907      );
6908    }
6909    setup(combobox, () => {
6910      if (!tag) return;
6911      return chain(
6912        sync(combobox, ["selectedValue"], (state) => {
6913          if (!Array.isArray(state.selectedValue)) return;
6914          tag.setValues(state.selectedValue);
6915        }),
6916        sync(tag, ["values"], (state) => {
6917          combobox.setState("selectedValue", state.values);
6918        })
6919      );
6920    });
6921    setup(
6922      combobox,
6923      () => sync(combobox, ["resetValueOnHide", "mounted"], (state) => {
6924        if (!state.resetValueOnHide) return;
6925        if (state.mounted) return;
6926        combobox.setState("value", value);
6927      })
6928    );
6929    setup(
6930      combobox,
6931      () => sync(combobox, ["open"], (state) => {
6932        if (state.open) return;
6933        combobox.setState("activeId", activeId);
6934        combobox.setState("moves", 0);
6935      })
6936    );
6937    setup(
6938      combobox,
6939      () => sync(combobox, ["moves", "activeId"], (state, prevState) => {
6940        if (state.moves === prevState.moves) {
6941          combobox.setState("activeValue", void 0);
6942        }
6943      })
6944    );
6945    setup(
6946      combobox,
6947      () => batch(combobox, ["moves", "renderedItems"], (state, prev) => {
6948        if (state.moves === prev.moves) return;
6949        const { activeId: activeId2 } = combobox.getState();
6950        const activeItem = composite.item(activeId2);
6951        combobox.setState("activeValue", activeItem == null ? void 0 : activeItem.value);
6952      })
6953    );
6954    return __spreadProps2(__spreadValues2(__spreadValues2(__spreadValues2({}, popover), composite), combobox), {
6955      tag,
6956      setValue: (value2) => combobox.setState("value", value2),
6957      resetValue: () => combobox.setState("value", initialState.value),
6958      setSelectedValue: (selectedValue2) => combobox.setState("selectedValue", selectedValue2)
6959    });
6960  }
6961  
6962  // node_modules/@ariakit/react-core/esm/__chunks/FEOFMWBY.js
6963  function useComboboxStoreOptions(props) {
6964    const tag = useTagContext();
6965    props = __spreadProps(__spreadValues({}, props), {
6966      tag: props.tag !== void 0 ? props.tag : tag
6967    });
6968    return useCompositeStoreOptions(props);
6969  }
6970  function useComboboxStoreProps(store, update, props) {
6971    useUpdateEffect(update, [props.tag]);
6972    useStoreProps(store, props, "value", "setValue");
6973    useStoreProps(store, props, "selectedValue", "setSelectedValue");
6974    useStoreProps(store, props, "resetValueOnHide");
6975    useStoreProps(store, props, "resetValueOnSelect");
6976    return Object.assign(
6977      useCompositeStoreProps(
6978        usePopoverStoreProps(store, update, props),
6979        update,
6980        props
6981      ),
6982      { tag: props.tag }
6983    );
6984  }
6985  function useComboboxStore(props = {}) {
6986    props = useComboboxStoreOptions(props);
6987    const [store, update] = useStore(createComboboxStore, props);
6988    return useComboboxStoreProps(store, update, props);
6989  }
6990  
6991  // node_modules/@ariakit/react-core/esm/__chunks/S6EF7IVO.js
6992  var ctx4 = createStoreContext();
6993  var useDisclosureContext = ctx4.useContext;
6994  var useDisclosureScopedContext = ctx4.useScopedContext;
6995  var useDisclosureProviderContext = ctx4.useProviderContext;
6996  var DisclosureContextProvider = ctx4.ContextProvider;
6997  var DisclosureScopedContextProvider = ctx4.ScopedContextProvider;
6998  
6999  // node_modules/@ariakit/react-core/esm/__chunks/RS7LB2H4.js
7000  var import_react6 = __toESM(require_react(), 1);
7001  var ctx5 = createStoreContext(
7002    [DisclosureContextProvider],
7003    [DisclosureScopedContextProvider]
7004  );
7005  var useDialogContext = ctx5.useContext;
7006  var useDialogScopedContext = ctx5.useScopedContext;
7007  var useDialogProviderContext = ctx5.useProviderContext;
7008  var DialogContextProvider = ctx5.ContextProvider;
7009  var DialogScopedContextProvider = ctx5.ScopedContextProvider;
7010  var DialogHeadingContext = (0, import_react6.createContext)(void 0);
7011  var DialogDescriptionContext = (0, import_react6.createContext)(void 0);
7012  
7013  // node_modules/@ariakit/react-core/esm/__chunks/MTZPJQMC.js
7014  var ctx6 = createStoreContext(
7015    [DialogContextProvider],
7016    [DialogScopedContextProvider]
7017  );
7018  var usePopoverContext = ctx6.useContext;
7019  var usePopoverScopedContext = ctx6.useScopedContext;
7020  var usePopoverProviderContext = ctx6.useProviderContext;
7021  var PopoverContextProvider = ctx6.ContextProvider;
7022  var PopoverScopedContextProvider = ctx6.ScopedContextProvider;
7023  
7024  // node_modules/@ariakit/react-core/esm/__chunks/VEVQD5MH.js
7025  var import_react7 = __toESM(require_react(), 1);
7026  var ComboboxListRoleContext = (0, import_react7.createContext)(
7027    void 0
7028  );
7029  var ctx7 = createStoreContext(
7030    [PopoverContextProvider, CompositeContextProvider],
7031    [PopoverScopedContextProvider, CompositeScopedContextProvider]
7032  );
7033  var useComboboxContext = ctx7.useContext;
7034  var useComboboxScopedContext = ctx7.useScopedContext;
7035  var useComboboxProviderContext = ctx7.useProviderContext;
7036  var ComboboxContextProvider = ctx7.ContextProvider;
7037  var ComboboxScopedContextProvider = ctx7.ScopedContextProvider;
7038  var ComboboxItemValueContext = (0, import_react7.createContext)(
7039    void 0
7040  );
7041  var ComboboxItemCheckedContext = (0, import_react7.createContext)(false);
7042  
7043  // node_modules/@ariakit/react-core/esm/__chunks/OMU7RWRV.js
7044  var TagName = "div";
7045  var usePopoverAnchor = createHook(
7046    function usePopoverAnchor2(_a) {
7047      var _b = _a, { store } = _b, props = __objRest(_b, ["store"]);
7048      const context = usePopoverProviderContext();
7049      store = store || context;
7050      props = __spreadProps(__spreadValues({}, props), {
7051        ref: useMergeRefs(store == null ? void 0 : store.setAnchorElement, props.ref)
7052      });
7053      return props;
7054    }
7055  );
7056  var PopoverAnchor = forwardRef22(function PopoverAnchor2(props) {
7057    const htmlProps = usePopoverAnchor(props);
7058    return createElement2(TagName, htmlProps);
7059  });
7060  
7061  // node_modules/@ariakit/react-core/esm/__chunks/5VQZOHHZ.js
7062  function findFirstEnabledItem2(items, excludeId) {
7063    return items.find((item) => {
7064      if (excludeId) {
7065        return !item.disabled && item.id !== excludeId;
7066      }
7067      return !item.disabled;
7068    });
7069  }
7070  function getEnabledItem(store, id) {
7071    if (!id) return null;
7072    return store.item(id) || null;
7073  }
7074  function groupItemsByRows2(items) {
7075    const rows = [];
7076    for (const item of items) {
7077      const row = rows.find((currentRow) => {
7078        var _a;
7079        return ((_a = currentRow[0]) == null ? void 0 : _a.rowId) === item.rowId;
7080      });
7081      if (row) {
7082        row.push(item);
7083      } else {
7084        rows.push([item]);
7085      }
7086    }
7087    return rows;
7088  }
7089  function selectTextField(element, collapseToEnd = false) {
7090    if (isTextField(element)) {
7091      element.setSelectionRange(
7092        collapseToEnd ? element.value.length : 0,
7093        element.value.length
7094      );
7095    } else if (element.isContentEditable) {
7096      const selection = getDocument(element).getSelection();
7097      selection == null ? void 0 : selection.selectAllChildren(element);
7098      if (collapseToEnd) {
7099        selection == null ? void 0 : selection.collapseToEnd();
7100      }
7101    }
7102  }
7103  var FOCUS_SILENTLY = Symbol("FOCUS_SILENTLY");
7104  function focusSilently(element) {
7105    element[FOCUS_SILENTLY] = true;
7106    element.focus({ preventScroll: true });
7107  }
7108  function silentlyFocused(element) {
7109    const isSilentlyFocused = element[FOCUS_SILENTLY];
7110    delete element[FOCUS_SILENTLY];
7111    return isSilentlyFocused;
7112  }
7113  function isItem(store, element, exclude) {
7114    if (!element) return false;
7115    if (element === exclude) return false;
7116    const item = store.item(element.id);
7117    if (!item) return false;
7118    if (exclude && item.element === exclude) return false;
7119    return true;
7120  }
7121  
7122  // node_modules/@ariakit/react-core/esm/__chunks/SWN3JYXT.js
7123  var import_react8 = __toESM(require_react(), 1);
7124  var FocusableContext = (0, import_react8.createContext)(true);
7125  
7126  // node_modules/@ariakit/core/esm/utils/focus.js
7127  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'])";
7128  function isFocusable(element) {
7129    if (!element.matches(selector)) return false;
7130    if (!isVisible(element)) return false;
7131    if (element.closest("[inert]")) return false;
7132    return true;
7133  }
7134  function getClosestFocusable(element) {
7135    while (element && !isFocusable(element)) {
7136      element = element.closest(selector);
7137    }
7138    return element || null;
7139  }
7140  function hasFocus(element) {
7141    const activeElement = getActiveElement(element);
7142    if (!activeElement) return false;
7143    if (activeElement === element) return true;
7144    const activeDescendant = activeElement.getAttribute("aria-activedescendant");
7145    if (!activeDescendant) return false;
7146    return activeDescendant === element.id;
7147  }
7148  function hasFocusWithin(element) {
7149    const activeElement = getActiveElement(element);
7150    if (!activeElement) return false;
7151    if (contains(element, activeElement)) return true;
7152    const activeDescendant = activeElement.getAttribute("aria-activedescendant");
7153    if (!activeDescendant) return false;
7154    if (!("id" in element)) return false;
7155    if (activeDescendant === element.id) return true;
7156    return !!element.querySelector(`#$CSS.escape(activeDescendant)}`);
7157  }
7158  function focusIfNeeded(element) {
7159    if (!hasFocusWithin(element) && isFocusable(element)) {
7160      element.focus();
7161    }
7162  }
7163  function focusIntoView(element, options) {
7164    if (!("scrollIntoView" in element)) {
7165      element.focus();
7166    } else {
7167      element.focus({ preventScroll: true });
7168      element.scrollIntoView(__spreadValues2({ block: "nearest", inline: "nearest" }, options));
7169    }
7170  }
7171  
7172  // node_modules/@ariakit/react-core/esm/__chunks/LVA2YJMS.js
7173  var import_react9 = __toESM(require_react(), 1);
7174  var TagName2 = "div";
7175  var isSafariBrowser = isSafari();
7176  var alwaysFocusVisibleInputTypes = [
7177    "text",
7178    "search",
7179    "url",
7180    "tel",
7181    "email",
7182    "password",
7183    "number",
7184    "date",
7185    "month",
7186    "week",
7187    "time",
7188    "datetime",
7189    "datetime-local"
7190  ];
7191  var safariFocusAncestorSymbol = Symbol("safariFocusAncestor");
7192  function markSafariFocusAncestor(element, value) {
7193    if (!element) return;
7194    element[safariFocusAncestorSymbol] = value;
7195  }
7196  function isAlwaysFocusVisible(element) {
7197    const { tagName, readOnly, type } = element;
7198    if (tagName === "TEXTAREA" && !readOnly) return true;
7199    if (tagName === "SELECT" && !readOnly) return true;
7200    if (tagName === "INPUT" && !readOnly) {
7201      return alwaysFocusVisibleInputTypes.includes(type);
7202    }
7203    if (element.isContentEditable) return true;
7204    const role = element.getAttribute("role");
7205    if (role === "combobox" && element.dataset.name) {
7206      return true;
7207    }
7208    return false;
7209  }
7210  function getLabels(element) {
7211    if ("labels" in element) {
7212      return element.labels;
7213    }
7214    return null;
7215  }
7216  function isNativeCheckboxOrRadio(element) {
7217    const tagName = element.tagName.toLowerCase();
7218    if (tagName === "input" && element.type) {
7219      return element.type === "radio" || element.type === "checkbox";
7220    }
7221    return false;
7222  }
7223  function isNativeTabbable(tagName) {
7224    if (!tagName) return true;
7225    return tagName === "button" || tagName === "summary" || tagName === "input" || tagName === "select" || tagName === "textarea" || tagName === "a";
7226  }
7227  function supportsDisabledAttribute(tagName) {
7228    if (!tagName) return true;
7229    return tagName === "button" || tagName === "input" || tagName === "select" || tagName === "textarea";
7230  }
7231  function getTabIndex(focusable, trulyDisabled, nativeTabbable, supportsDisabled, tabIndexProp) {
7232    if (!focusable) {
7233      return tabIndexProp;
7234    }
7235    if (trulyDisabled) {
7236      if (nativeTabbable && !supportsDisabled) {
7237        return -1;
7238      }
7239      return;
7240    }
7241    if (nativeTabbable) {
7242      return tabIndexProp;
7243    }
7244    return tabIndexProp || 0;
7245  }
7246  function useDisableEvent(onEvent, disabled) {
7247    return useEvent((event) => {
7248      onEvent == null ? void 0 : onEvent(event);
7249      if (event.defaultPrevented) return;
7250      if (disabled) {
7251        event.stopPropagation();
7252        event.preventDefault();
7253      }
7254    });
7255  }
7256  var isKeyboardModality = true;
7257  function onGlobalMouseDown(event) {
7258    const target = event.target;
7259    if (target && "hasAttribute" in target) {
7260      if (!target.hasAttribute("data-focus-visible")) {
7261        isKeyboardModality = false;
7262      }
7263    }
7264  }
7265  function onGlobalKeyDown(event) {
7266    if (event.metaKey) return;
7267    if (event.ctrlKey) return;
7268    if (event.altKey) return;
7269    isKeyboardModality = true;
7270  }
7271  var useFocusable = createHook(
7272    function useFocusable2(_a) {
7273      var _b = _a, {
7274        focusable = true,
7275        accessibleWhenDisabled,
7276        autoFocus,
7277        onFocusVisible
7278      } = _b, props = __objRest(_b, [
7279        "focusable",
7280        "accessibleWhenDisabled",
7281        "autoFocus",
7282        "onFocusVisible"
7283      ]);
7284      const ref = (0, import_react9.useRef)(null);
7285      (0, import_react9.useEffect)(() => {
7286        if (!focusable) return;
7287        addGlobalEventListener("mousedown", onGlobalMouseDown, true);
7288        addGlobalEventListener("keydown", onGlobalKeyDown, true);
7289      }, [focusable]);
7290      if (isSafariBrowser) {
7291        (0, import_react9.useEffect)(() => {
7292          if (!focusable) return;
7293          const element = ref.current;
7294          if (!element) return;
7295          if (!isNativeCheckboxOrRadio(element)) return;
7296          const labels = getLabels(element);
7297          if (!labels) return;
7298          const onMouseUp = () => queueMicrotask(() => element.focus());
7299          for (const label of labels) {
7300            label.addEventListener("mouseup", onMouseUp);
7301          }
7302          return () => {
7303            for (const label of labels) {
7304              label.removeEventListener("mouseup", onMouseUp);
7305            }
7306          };
7307        }, [focusable]);
7308      }
7309      const disabled = focusable && disabledFromProps(props);
7310      const trulyDisabled = !!disabled && !accessibleWhenDisabled;
7311      const [focusVisible, setFocusVisible] = (0, import_react9.useState)(false);
7312      (0, import_react9.useEffect)(() => {
7313        if (!focusable) return;
7314        if (trulyDisabled && focusVisible) {
7315          setFocusVisible(false);
7316        }
7317      }, [focusable, trulyDisabled, focusVisible]);
7318      (0, import_react9.useEffect)(() => {
7319        if (!focusable) return;
7320        if (!focusVisible) return;
7321        const element = ref.current;
7322        if (!element) return;
7323        if (typeof IntersectionObserver === "undefined") return;
7324        const observer = new IntersectionObserver(() => {
7325          if (!isFocusable(element)) {
7326            setFocusVisible(false);
7327          }
7328        });
7329        observer.observe(element);
7330        return () => observer.disconnect();
7331      }, [focusable, focusVisible]);
7332      const onKeyPressCapture = useDisableEvent(
7333        props.onKeyPressCapture,
7334        disabled
7335      );
7336      const onMouseDownCapture = useDisableEvent(
7337        props.onMouseDownCapture,
7338        disabled
7339      );
7340      const onClickCapture = useDisableEvent(props.onClickCapture, disabled);
7341      const onMouseDownProp = props.onMouseDown;
7342      const onMouseDown = useEvent((event) => {
7343        onMouseDownProp == null ? void 0 : onMouseDownProp(event);
7344        if (event.defaultPrevented) return;
7345        if (!focusable) return;
7346        const element = event.currentTarget;
7347        if (!isSafariBrowser) return;
7348        if (isPortalEvent(event)) return;
7349        if (!isButton(element) && !isNativeCheckboxOrRadio(element)) return;
7350        let receivedFocus = false;
7351        const onFocus = () => {
7352          receivedFocus = true;
7353        };
7354        const options = { capture: true, once: true };
7355        element.addEventListener("focusin", onFocus, options);
7356        const focusableContainer = getClosestFocusable(element.parentElement);
7357        markSafariFocusAncestor(focusableContainer, true);
7358        queueBeforeEvent(element, "mouseup", () => {
7359          element.removeEventListener("focusin", onFocus, true);
7360          markSafariFocusAncestor(focusableContainer, false);
7361          if (receivedFocus) return;
7362          focusIfNeeded(element);
7363        });
7364      });
7365      const handleFocusVisible = (event, currentTarget) => {
7366        if (currentTarget) {
7367          event.currentTarget = currentTarget;
7368        }
7369        if (!focusable) return;
7370        const element = event.currentTarget;
7371        if (!element) return;
7372        if (!hasFocus(element)) return;
7373        onFocusVisible == null ? void 0 : onFocusVisible(event);
7374        if (event.defaultPrevented) return;
7375        element.dataset.focusVisible = "true";
7376        setFocusVisible(true);
7377      };
7378      const onKeyDownCaptureProp = props.onKeyDownCapture;
7379      const onKeyDownCapture = useEvent((event) => {
7380        onKeyDownCaptureProp == null ? void 0 : onKeyDownCaptureProp(event);
7381        if (event.defaultPrevented) return;
7382        if (!focusable) return;
7383        if (focusVisible) return;
7384        if (event.metaKey) return;
7385        if (event.altKey) return;
7386        if (event.ctrlKey) return;
7387        if (!isSelfTarget(event)) return;
7388        const element = event.currentTarget;
7389        const applyFocusVisible = () => handleFocusVisible(event, element);
7390        queueBeforeEvent(element, "focusout", applyFocusVisible);
7391      });
7392      const onFocusCaptureProp = props.onFocusCapture;
7393      const onFocusCapture = useEvent((event) => {
7394        onFocusCaptureProp == null ? void 0 : onFocusCaptureProp(event);
7395        if (event.defaultPrevented) return;
7396        if (!focusable) return;
7397        if (!isSelfTarget(event)) {
7398          setFocusVisible(false);
7399          return;
7400        }
7401        const element = event.currentTarget;
7402        const applyFocusVisible = () => handleFocusVisible(event, element);
7403        if (isKeyboardModality || isAlwaysFocusVisible(event.target)) {
7404          queueBeforeEvent(event.target, "focusout", applyFocusVisible);
7405        } else {
7406          setFocusVisible(false);
7407        }
7408      });
7409      const onBlurProp = props.onBlur;
7410      const onBlur = useEvent((event) => {
7411        onBlurProp == null ? void 0 : onBlurProp(event);
7412        if (!focusable) return;
7413        if (!isFocusEventOutside(event)) return;
7414        setFocusVisible(false);
7415      });
7416      const autoFocusOnShow = (0, import_react9.useContext)(FocusableContext);
7417      const autoFocusRef = useEvent((element) => {
7418        if (!focusable) return;
7419        if (!autoFocus) return;
7420        if (!element) return;
7421        if (!autoFocusOnShow) return;
7422        queueMicrotask(() => {
7423          if (hasFocus(element)) return;
7424          if (!isFocusable(element)) return;
7425          element.focus();
7426        });
7427      });
7428      const tagName = useTagName(ref);
7429      const nativeTabbable = focusable && isNativeTabbable(tagName);
7430      const supportsDisabled = focusable && supportsDisabledAttribute(tagName);
7431      const styleProp = props.style;
7432      const style = (0, import_react9.useMemo)(() => {
7433        if (trulyDisabled) {
7434          return __spreadValues({ pointerEvents: "none" }, styleProp);
7435        }
7436        return styleProp;
7437      }, [trulyDisabled, styleProp]);
7438      props = __spreadProps(__spreadValues({
7439        "data-focus-visible": focusable && focusVisible || void 0,
7440        "data-autofocus": autoFocus || void 0,
7441        "aria-disabled": disabled || void 0
7442      }, props), {
7443        ref: useMergeRefs(ref, autoFocusRef, props.ref),
7444        style,
7445        tabIndex: getTabIndex(
7446          focusable,
7447          trulyDisabled,
7448          nativeTabbable,
7449          supportsDisabled,
7450          props.tabIndex
7451        ),
7452        disabled: supportsDisabled && trulyDisabled ? true : void 0,
7453        // TODO: Test Focusable contentEditable.
7454        contentEditable: disabled ? void 0 : props.contentEditable,
7455        onKeyPressCapture,
7456        onClickCapture,
7457        onMouseDownCapture,
7458        onMouseDown,
7459        onKeyDownCapture,
7460        onFocusCapture,
7461        onBlur
7462      });
7463      return removeUndefinedValues(props);
7464    }
7465  );
7466  var Focusable = forwardRef22(function Focusable2(props) {
7467    const htmlProps = useFocusable(props);
7468    return createElement2(TagName2, htmlProps);
7469  });
7470  
7471  // node_modules/@ariakit/react-core/esm/__chunks/ITI7HKP4.js
7472  var import_react10 = __toESM(require_react(), 1);
7473  var import_jsx_runtime47 = __toESM(require_jsx_runtime(), 1);
7474  var TagName3 = "div";
7475  function isGrid(items) {
7476    return items.some((item) => !!item.rowId);
7477  }
7478  function isPrintableKey(event) {
7479    const target = event.target;
7480    if (target && !isTextField(target)) return false;
7481    return event.key.length === 1 && !event.ctrlKey && !event.metaKey;
7482  }
7483  function isModifierKey(event) {
7484    return event.key === "Shift" || event.key === "Control" || event.key === "Alt" || event.key === "Meta";
7485  }
7486  function useKeyboardEventProxy(store, onKeyboardEvent, previousElementRef) {
7487    return useEvent((event) => {
7488      var _a;
7489      onKeyboardEvent == null ? void 0 : onKeyboardEvent(event);
7490      if (event.defaultPrevented) return;
7491      if (event.isPropagationStopped()) return;
7492      if (!isSelfTarget(event)) return;
7493      if (isModifierKey(event)) return;
7494      if (isPrintableKey(event)) return;
7495      const state = store.getState();
7496      const activeElement = (_a = getEnabledItem(store, state.activeId)) == null ? void 0 : _a.element;
7497      if (!activeElement) return;
7498      const _b = event, { view } = _b, eventInit = __objRest(_b, ["view"]);
7499      const previousElement = previousElementRef == null ? void 0 : previousElementRef.current;
7500      if (activeElement !== previousElement) {
7501        activeElement.focus();
7502      }
7503      if (!fireKeyboardEvent(activeElement, event.type, eventInit)) {
7504        event.preventDefault();
7505      }
7506      if (event.currentTarget.contains(activeElement)) {
7507        event.stopPropagation();
7508      }
7509    });
7510  }
7511  function findFirstEnabledItemInTheLastRow(items) {
7512    return findFirstEnabledItem2(
7513      flatten2DArray(reverseArray(groupItemsByRows2(items)))
7514    );
7515  }
7516  function useScheduleFocus(store) {
7517    const [scheduled, setScheduled] = (0, import_react10.useState)(false);
7518    const schedule = (0, import_react10.useCallback)(() => setScheduled(true), []);
7519    const activeItem = store.useState(
7520      (state) => getEnabledItem(store, state.activeId)
7521    );
7522    (0, import_react10.useEffect)(() => {
7523      const activeElement = activeItem == null ? void 0 : activeItem.element;
7524      if (!scheduled) return;
7525      if (!activeElement) return;
7526      setScheduled(false);
7527      activeElement.focus({ preventScroll: true });
7528    }, [activeItem, scheduled]);
7529    return schedule;
7530  }
7531  var useComposite = createHook(
7532    function useComposite2(_a) {
7533      var _b = _a, {
7534        store,
7535        composite = true,
7536        focusOnMove = composite,
7537        moveOnKeyPress = true
7538      } = _b, props = __objRest(_b, [
7539        "store",
7540        "composite",
7541        "focusOnMove",
7542        "moveOnKeyPress"
7543      ]);
7544      const context = useCompositeProviderContext();
7545      store = store || context;
7546      invariant(
7547        store,
7548        "Composite must receive a `store` prop or be wrapped in a CompositeProvider component."
7549      );
7550      const ref = (0, import_react10.useRef)(null);
7551      const previousElementRef = (0, import_react10.useRef)(null);
7552      const scheduleFocus = useScheduleFocus(store);
7553      const moves = store.useState("moves");
7554      const [, setBaseElement] = useTransactionState(
7555        composite ? store.setBaseElement : null
7556      );
7557      (0, import_react10.useEffect)(() => {
7558        var _a2;
7559        if (!store) return;
7560        if (!moves) return;
7561        if (!composite) return;
7562        if (!focusOnMove) return;
7563        const { activeId: activeId2 } = store.getState();
7564        const itemElement = (_a2 = getEnabledItem(store, activeId2)) == null ? void 0 : _a2.element;
7565        if (!itemElement) return;
7566        focusIntoView(itemElement);
7567      }, [store, moves, composite, focusOnMove]);
7568      useSafeLayoutEffect(() => {
7569        if (!store) return;
7570        if (!moves) return;
7571        if (!composite) return;
7572        const { baseElement, activeId: activeId2 } = store.getState();
7573        const isSelfAcive = activeId2 === null;
7574        if (!isSelfAcive) return;
7575        if (!baseElement) return;
7576        const previousElement = previousElementRef.current;
7577        previousElementRef.current = null;
7578        if (previousElement) {
7579          fireBlurEvent(previousElement, { relatedTarget: baseElement });
7580        }
7581        if (!hasFocus(baseElement)) {
7582          baseElement.focus();
7583        }
7584      }, [store, moves, composite]);
7585      const activeId = store.useState("activeId");
7586      const virtualFocus = store.useState("virtualFocus");
7587      useSafeLayoutEffect(() => {
7588        var _a2;
7589        if (!store) return;
7590        if (!composite) return;
7591        if (!virtualFocus) return;
7592        const previousElement = previousElementRef.current;
7593        previousElementRef.current = null;
7594        if (!previousElement) return;
7595        const activeElement = (_a2 = getEnabledItem(store, activeId)) == null ? void 0 : _a2.element;
7596        const relatedTarget = activeElement || getActiveElement(previousElement);
7597        if (relatedTarget === previousElement) return;
7598        fireBlurEvent(previousElement, { relatedTarget });
7599      }, [store, activeId, virtualFocus, composite]);
7600      const onKeyDownCapture = useKeyboardEventProxy(
7601        store,
7602        props.onKeyDownCapture,
7603        previousElementRef
7604      );
7605      const onKeyUpCapture = useKeyboardEventProxy(
7606        store,
7607        props.onKeyUpCapture,
7608        previousElementRef
7609      );
7610      const onFocusCaptureProp = props.onFocusCapture;
7611      const onFocusCapture = useEvent((event) => {
7612        onFocusCaptureProp == null ? void 0 : onFocusCaptureProp(event);
7613        if (event.defaultPrevented) return;
7614        if (!store) return;
7615        const { virtualFocus: virtualFocus2 } = store.getState();
7616        if (!virtualFocus2) return;
7617        const previousActiveElement = event.relatedTarget;
7618        const isSilentlyFocused = silentlyFocused(event.currentTarget);
7619        if (isSelfTarget(event) && isSilentlyFocused) {
7620          event.stopPropagation();
7621          previousElementRef.current = previousActiveElement;
7622        }
7623      });
7624      const onFocusProp = props.onFocus;
7625      const onFocus = useEvent((event) => {
7626        onFocusProp == null ? void 0 : onFocusProp(event);
7627        if (event.defaultPrevented) return;
7628        if (!composite) return;
7629        if (!store) return;
7630        const { relatedTarget } = event;
7631        const { virtualFocus: virtualFocus2 } = store.getState();
7632        if (virtualFocus2) {
7633          if (isSelfTarget(event) && !isItem(store, relatedTarget)) {
7634            queueMicrotask(scheduleFocus);
7635          }
7636        } else if (isSelfTarget(event)) {
7637          store.setActiveId(null);
7638        }
7639      });
7640      const onBlurCaptureProp = props.onBlurCapture;
7641      const onBlurCapture = useEvent((event) => {
7642        var _a2;
7643        onBlurCaptureProp == null ? void 0 : onBlurCaptureProp(event);
7644        if (event.defaultPrevented) return;
7645        if (!store) return;
7646        const { virtualFocus: virtualFocus2, activeId: activeId2 } = store.getState();
7647        if (!virtualFocus2) return;
7648        const activeElement = (_a2 = getEnabledItem(store, activeId2)) == null ? void 0 : _a2.element;
7649        const nextActiveElement = event.relatedTarget;
7650        const nextActiveElementIsItem = isItem(store, nextActiveElement);
7651        const previousElement = previousElementRef.current;
7652        previousElementRef.current = null;
7653        if (isSelfTarget(event) && nextActiveElementIsItem) {
7654          if (nextActiveElement === activeElement) {
7655            if (previousElement && previousElement !== nextActiveElement) {
7656              fireBlurEvent(previousElement, event);
7657            }
7658          } else if (activeElement) {
7659            fireBlurEvent(activeElement, event);
7660          } else if (previousElement) {
7661            fireBlurEvent(previousElement, event);
7662          }
7663          event.stopPropagation();
7664        } else {
7665          const targetIsItem = isItem(store, event.target);
7666          if (!targetIsItem && activeElement) {
7667            fireBlurEvent(activeElement, event);
7668          }
7669        }
7670      });
7671      const onKeyDownProp = props.onKeyDown;
7672      const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress);
7673      const onKeyDown = useEvent((event) => {
7674        var _a2;
7675        onKeyDownProp == null ? void 0 : onKeyDownProp(event);
7676        if (event.defaultPrevented) return;
7677        if (!store) return;
7678        if (!isSelfTarget(event)) return;
7679        const { orientation, renderedItems, activeId: activeId2 } = store.getState();
7680        const activeItem = getEnabledItem(store, activeId2);
7681        if ((_a2 = activeItem == null ? void 0 : activeItem.element) == null ? void 0 : _a2.isConnected) return;
7682        const isVertical = orientation !== "horizontal";
7683        const isHorizontal = orientation !== "vertical";
7684        const grid = isGrid(renderedItems);
7685        const isHorizontalKey = event.key === "ArrowLeft" || event.key === "ArrowRight" || event.key === "Home" || event.key === "End";
7686        if (isHorizontalKey && isTextField(event.currentTarget)) return;
7687        const up = () => {
7688          if (grid) {
7689            const item = findFirstEnabledItemInTheLastRow(renderedItems);
7690            return item == null ? void 0 : item.id;
7691          }
7692          return store == null ? void 0 : store.last();
7693        };
7694        const keyMap = {
7695          ArrowUp: (grid || isVertical) && up,
7696          ArrowRight: (grid || isHorizontal) && store.first,
7697          ArrowDown: (grid || isVertical) && store.first,
7698          ArrowLeft: (grid || isHorizontal) && store.last,
7699          Home: store.first,
7700          End: store.last,
7701          PageUp: store.first,
7702          PageDown: store.last
7703        };
7704        const action = keyMap[event.key];
7705        if (action) {
7706          const id = action();
7707          if (id !== void 0) {
7708            if (!moveOnKeyPressProp(event)) return;
7709            event.preventDefault();
7710            store.move(id);
7711          }
7712        }
7713      });
7714      props = useWrapElement(
7715        props,
7716        (element) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(CompositeContextProvider, { value: store, children: element }),
7717        [store]
7718      );
7719      const activeDescendant = store.useState((state) => {
7720        var _a2;
7721        if (!store) return;
7722        if (!composite) return;
7723        if (!state.virtualFocus) return;
7724        return (_a2 = getEnabledItem(store, state.activeId)) == null ? void 0 : _a2.id;
7725      });
7726      props = __spreadProps(__spreadValues({
7727        "aria-activedescendant": activeDescendant
7728      }, props), {
7729        ref: useMergeRefs(ref, setBaseElement, props.ref),
7730        onKeyDownCapture,
7731        onKeyUpCapture,
7732        onFocusCapture,
7733        onFocus,
7734        onBlurCapture,
7735        onKeyDown
7736      });
7737      const focusable = store.useState(
7738        (state) => composite && (state.virtualFocus || state.activeId === null)
7739      );
7740      props = useFocusable(__spreadValues({ focusable }, props));
7741      return props;
7742    }
7743  );
7744  var Composite5 = forwardRef22(function Composite22(props) {
7745    const htmlProps = useComposite(props);
7746    return createElement2(TagName3, htmlProps);
7747  });
7748  
7749  // node_modules/@ariakit/react-core/esm/combobox/combobox.js
7750  var import_react11 = __toESM(require_react(), 1);
7751  var TagName4 = "input";
7752  function isFirstItemAutoSelected(items, activeValue, autoSelect) {
7753    if (!autoSelect) return false;
7754    const firstItem = items.find((item) => !item.disabled && item.value);
7755    return (firstItem == null ? void 0 : firstItem.value) === activeValue;
7756  }
7757  function hasCompletionString(value, activeValue) {
7758    if (!activeValue) return false;
7759    if (value == null) return false;
7760    value = normalizeString(value);
7761    return activeValue.length > value.length && activeValue.toLowerCase().indexOf(value.toLowerCase()) === 0;
7762  }
7763  function isInputEvent(event) {
7764    return event.type === "input";
7765  }
7766  function isAriaAutoCompleteValue(value) {
7767    return value === "inline" || value === "list" || value === "both" || value === "none";
7768  }
7769  function getDefaultAutoSelectId(items) {
7770    const item = items.find((item2) => {
7771      var _a;
7772      if (item2.disabled) return false;
7773      return ((_a = item2.element) == null ? void 0 : _a.getAttribute("role")) !== "tab";
7774    });
7775    return item == null ? void 0 : item.id;
7776  }
7777  var useCombobox = createHook(
7778    function useCombobox2(_a) {
7779      var _b = _a, {
7780        store,
7781        focusable = true,
7782        autoSelect: autoSelectProp = false,
7783        getAutoSelectId,
7784        setValueOnChange,
7785        showMinLength = 0,
7786        showOnChange,
7787        showOnMouseDown,
7788        showOnClick = showOnMouseDown,
7789        showOnKeyDown,
7790        showOnKeyPress = showOnKeyDown,
7791        blurActiveItemOnClick,
7792        setValueOnClick = true,
7793        moveOnKeyPress = true,
7794        autoComplete = "list"
7795      } = _b, props = __objRest(_b, [
7796        "store",
7797        "focusable",
7798        "autoSelect",
7799        "getAutoSelectId",
7800        "setValueOnChange",
7801        "showMinLength",
7802        "showOnChange",
7803        "showOnMouseDown",
7804        "showOnClick",
7805        "showOnKeyDown",
7806        "showOnKeyPress",
7807        "blurActiveItemOnClick",
7808        "setValueOnClick",
7809        "moveOnKeyPress",
7810        "autoComplete"
7811      ]);
7812      const context = useComboboxProviderContext();
7813      store = store || context;
7814      invariant(
7815        store,
7816        "Combobox must receive a `store` prop or be wrapped in a ComboboxProvider component."
7817      );
7818      const ref = (0, import_react11.useRef)(null);
7819      const [valueUpdated, forceValueUpdate] = useForceUpdate();
7820      const canAutoSelectRef = (0, import_react11.useRef)(false);
7821      const composingRef = (0, import_react11.useRef)(false);
7822      const autoSelect = store.useState(
7823        (state) => state.virtualFocus && autoSelectProp
7824      );
7825      const inline = autoComplete === "inline" || autoComplete === "both";
7826      const [canInline, setCanInline] = (0, import_react11.useState)(inline);
7827      useUpdateLayoutEffect(() => {
7828        if (!inline) return;
7829        setCanInline(true);
7830      }, [inline]);
7831      const storeValue = store.useState("value");
7832      const prevSelectedValueRef = (0, import_react11.useRef)();
7833      (0, import_react11.useEffect)(() => {
7834        return sync(store, ["selectedValue", "activeId"], (_, prev) => {
7835          prevSelectedValueRef.current = prev.selectedValue;
7836        });
7837      }, []);
7838      const inlineActiveValue = store.useState((state) => {
7839        var _a2;
7840        if (!inline) return;
7841        if (!canInline) return;
7842        if (state.activeValue && Array.isArray(state.selectedValue)) {
7843          if (state.selectedValue.includes(state.activeValue)) return;
7844          if ((_a2 = prevSelectedValueRef.current) == null ? void 0 : _a2.includes(state.activeValue)) return;
7845        }
7846        return state.activeValue;
7847      });
7848      const items = store.useState("renderedItems");
7849      const open = store.useState("open");
7850      const contentElement = store.useState("contentElement");
7851      const value = (0, import_react11.useMemo)(() => {
7852        if (!inline) return storeValue;
7853        if (!canInline) return storeValue;
7854        const firstItemAutoSelected = isFirstItemAutoSelected(
7855          items,
7856          inlineActiveValue,
7857          autoSelect
7858        );
7859        if (firstItemAutoSelected) {
7860          if (hasCompletionString(storeValue, inlineActiveValue)) {
7861            const slice = (inlineActiveValue == null ? void 0 : inlineActiveValue.slice(storeValue.length)) || "";
7862            return storeValue + slice;
7863          }
7864          return storeValue;
7865        }
7866        return inlineActiveValue || storeValue;
7867      }, [inline, canInline, items, inlineActiveValue, autoSelect, storeValue]);
7868      (0, import_react11.useEffect)(() => {
7869        const element = ref.current;
7870        if (!element) return;
7871        const onCompositeItemMove = () => setCanInline(true);
7872        element.addEventListener("combobox-item-move", onCompositeItemMove);
7873        return () => {
7874          element.removeEventListener("combobox-item-move", onCompositeItemMove);
7875        };
7876      }, []);
7877      (0, import_react11.useEffect)(() => {
7878        if (!inline) return;
7879        if (!canInline) return;
7880        if (!inlineActiveValue) return;
7881        const firstItemAutoSelected = isFirstItemAutoSelected(
7882          items,
7883          inlineActiveValue,
7884          autoSelect
7885        );
7886        if (!firstItemAutoSelected) return;
7887        if (!hasCompletionString(storeValue, inlineActiveValue)) return;
7888        let cleanup = noop;
7889        queueMicrotask(() => {
7890          const element = ref.current;
7891          if (!element) return;
7892          const { start: prevStart, end: prevEnd } = getTextboxSelection(element);
7893          const nextStart = storeValue.length;
7894          const nextEnd = inlineActiveValue.length;
7895          setSelectionRange(element, nextStart, nextEnd);
7896          cleanup = () => {
7897            if (!hasFocus(element)) return;
7898            const { start, end } = getTextboxSelection(element);
7899            if (start !== nextStart) return;
7900            if (end !== nextEnd) return;
7901            setSelectionRange(element, prevStart, prevEnd);
7902          };
7903        });
7904        return () => cleanup();
7905      }, [
7906        valueUpdated,
7907        inline,
7908        canInline,
7909        inlineActiveValue,
7910        items,
7911        autoSelect,
7912        storeValue
7913      ]);
7914      const scrollingElementRef = (0, import_react11.useRef)(null);
7915      const getAutoSelectIdProp = useEvent(getAutoSelectId);
7916      const autoSelectIdRef = (0, import_react11.useRef)(null);
7917      (0, import_react11.useEffect)(() => {
7918        if (!open) return;
7919        if (!contentElement) return;
7920        const scrollingElement = getScrollingElement(contentElement);
7921        if (!scrollingElement) return;
7922        scrollingElementRef.current = scrollingElement;
7923        const onUserScroll = () => {
7924          canAutoSelectRef.current = false;
7925        };
7926        const onScroll = () => {
7927          if (!store) return;
7928          if (!canAutoSelectRef.current) return;
7929          const { activeId } = store.getState();
7930          if (activeId === null) return;
7931          if (activeId === autoSelectIdRef.current) return;
7932          canAutoSelectRef.current = false;
7933        };
7934        const options = { passive: true, capture: true };
7935        scrollingElement.addEventListener("wheel", onUserScroll, options);
7936        scrollingElement.addEventListener("touchmove", onUserScroll, options);
7937        scrollingElement.addEventListener("scroll", onScroll, options);
7938        return () => {
7939          scrollingElement.removeEventListener("wheel", onUserScroll, true);
7940          scrollingElement.removeEventListener("touchmove", onUserScroll, true);
7941          scrollingElement.removeEventListener("scroll", onScroll, true);
7942        };
7943      }, [open, contentElement, store]);
7944      useSafeLayoutEffect(() => {
7945        if (!storeValue) return;
7946        if (composingRef.current) return;
7947        canAutoSelectRef.current = true;
7948      }, [storeValue]);
7949      useSafeLayoutEffect(() => {
7950        if (autoSelect !== "always" && open) return;
7951        canAutoSelectRef.current = open;
7952      }, [autoSelect, open]);
7953      const resetValueOnSelect = store.useState("resetValueOnSelect");
7954      useUpdateEffect(() => {
7955        var _a2, _b2;
7956        const canAutoSelect = canAutoSelectRef.current;
7957        if (!store) return;
7958        if (!open) return;
7959        if (!canAutoSelect && !resetValueOnSelect) return;
7960        const { baseElement, contentElement: contentElement2, activeId } = store.getState();
7961        if (baseElement && !hasFocus(baseElement)) return;
7962        if (contentElement2 == null ? void 0 : contentElement2.hasAttribute("data-placing")) {
7963          const observer = new MutationObserver(forceValueUpdate);
7964          observer.observe(contentElement2, { attributeFilter: ["data-placing"] });
7965          return () => observer.disconnect();
7966        }
7967        if (autoSelect && canAutoSelect) {
7968          const userAutoSelectId = getAutoSelectIdProp(items);
7969          const autoSelectId = userAutoSelectId !== void 0 ? userAutoSelectId : (_a2 = getDefaultAutoSelectId(items)) != null ? _a2 : store.first();
7970          autoSelectIdRef.current = autoSelectId;
7971          store.move(autoSelectId != null ? autoSelectId : null);
7972        } else {
7973          const element = (_b2 = store.item(activeId || store.first())) == null ? void 0 : _b2.element;
7974          if (element && "scrollIntoView" in element) {
7975            element.scrollIntoView({ block: "nearest", inline: "nearest" });
7976          }
7977        }
7978        return;
7979      }, [
7980        store,
7981        open,
7982        valueUpdated,
7983        storeValue,
7984        autoSelect,
7985        resetValueOnSelect,
7986        getAutoSelectIdProp,
7987        items
7988      ]);
7989      (0, import_react11.useEffect)(() => {
7990        if (!inline) return;
7991        const combobox = ref.current;
7992        if (!combobox) return;
7993        const elements = [combobox, contentElement].filter(
7994          (value2) => !!value2
7995        );
7996        const onBlur2 = (event) => {
7997          if (elements.every((el) => isFocusEventOutside(event, el))) {
7998            store == null ? void 0 : store.setValue(value);
7999          }
8000        };
8001        for (const element of elements) {
8002          element.addEventListener("focusout", onBlur2);
8003        }
8004        return () => {
8005          for (const element of elements) {
8006            element.removeEventListener("focusout", onBlur2);
8007          }
8008        };
8009      }, [inline, contentElement, store, value]);
8010      const canShow = (event) => {
8011        const currentTarget = event.currentTarget;
8012        return currentTarget.value.length >= showMinLength;
8013      };
8014      const onChangeProp = props.onChange;
8015      const showOnChangeProp = useBooleanEvent(showOnChange != null ? showOnChange : canShow);
8016      const setValueOnChangeProp = useBooleanEvent(
8017        // If the combobox is combined with tags, the value will be set by the tag
8018        // input component.
8019        setValueOnChange != null ? setValueOnChange : !store.tag
8020      );
8021      const onChange = useEvent((event) => {
8022        onChangeProp == null ? void 0 : onChangeProp(event);
8023        if (event.defaultPrevented) return;
8024        if (!store) return;
8025        const currentTarget = event.currentTarget;
8026        const { value: value2, selectionStart, selectionEnd } = currentTarget;
8027        const nativeEvent = event.nativeEvent;
8028        canAutoSelectRef.current = true;
8029        if (isInputEvent(nativeEvent)) {
8030          if (nativeEvent.isComposing) {
8031            canAutoSelectRef.current = false;
8032            composingRef.current = true;
8033          }
8034          if (inline) {
8035            const textInserted = nativeEvent.inputType === "insertText" || nativeEvent.inputType === "insertCompositionText";
8036            const caretAtEnd = selectionStart === value2.length;
8037            setCanInline(textInserted && caretAtEnd);
8038          }
8039        }
8040        if (setValueOnChangeProp(event)) {
8041          const isSameValue = value2 === store.getState().value;
8042          store.setValue(value2);
8043          queueMicrotask(() => {
8044            setSelectionRange(currentTarget, selectionStart, selectionEnd);
8045          });
8046          if (inline && autoSelect && isSameValue) {
8047            forceValueUpdate();
8048          }
8049        }
8050        if (showOnChangeProp(event)) {
8051          store.show();
8052        }
8053        if (!autoSelect || !canAutoSelectRef.current) {
8054          store.setActiveId(null);
8055        }
8056      });
8057      const onCompositionEndProp = props.onCompositionEnd;
8058      const onCompositionEnd = useEvent((event) => {
8059        canAutoSelectRef.current = true;
8060        composingRef.current = false;
8061        onCompositionEndProp == null ? void 0 : onCompositionEndProp(event);
8062        if (event.defaultPrevented) return;
8063        if (!autoSelect) return;
8064        forceValueUpdate();
8065      });
8066      const onMouseDownProp = props.onMouseDown;
8067      const blurActiveItemOnClickProp = useBooleanEvent(
8068        blurActiveItemOnClick != null ? blurActiveItemOnClick : () => !!(store == null ? void 0 : store.getState().includesBaseElement)
8069      );
8070      const setValueOnClickProp = useBooleanEvent(setValueOnClick);
8071      const showOnClickProp = useBooleanEvent(showOnClick != null ? showOnClick : canShow);
8072      const onMouseDown = useEvent((event) => {
8073        onMouseDownProp == null ? void 0 : onMouseDownProp(event);
8074        if (event.defaultPrevented) return;
8075        if (event.button) return;
8076        if (event.ctrlKey) return;
8077        if (!store) return;
8078        if (blurActiveItemOnClickProp(event)) {
8079          store.setActiveId(null);
8080        }
8081        if (setValueOnClickProp(event)) {
8082          store.setValue(value);
8083        }
8084        if (showOnClickProp(event)) {
8085          queueBeforeEvent(event.currentTarget, "mouseup", store.show);
8086        }
8087      });
8088      const onKeyDownProp = props.onKeyDown;
8089      const showOnKeyPressProp = useBooleanEvent(showOnKeyPress != null ? showOnKeyPress : canShow);
8090      const onKeyDown = useEvent((event) => {
8091        onKeyDownProp == null ? void 0 : onKeyDownProp(event);
8092        if (!event.repeat) {
8093          canAutoSelectRef.current = false;
8094        }
8095        if (event.defaultPrevented) return;
8096        if (event.ctrlKey) return;
8097        if (event.altKey) return;
8098        if (event.shiftKey) return;
8099        if (event.metaKey) return;
8100        if (!store) return;
8101        const { open: open2 } = store.getState();
8102        if (open2) return;
8103        if (event.key === "ArrowUp" || event.key === "ArrowDown") {
8104          if (showOnKeyPressProp(event)) {
8105            event.preventDefault();
8106            store.show();
8107          }
8108        }
8109      });
8110      const onBlurProp = props.onBlur;
8111      const onBlur = useEvent((event) => {
8112        canAutoSelectRef.current = false;
8113        onBlurProp == null ? void 0 : onBlurProp(event);
8114        if (event.defaultPrevented) return;
8115      });
8116      const id = useId3(props.id);
8117      const ariaAutoComplete = isAriaAutoCompleteValue(autoComplete) ? autoComplete : void 0;
8118      const isActiveItem = store.useState((state) => state.activeId === null);
8119      props = __spreadProps(__spreadValues({
8120        id,
8121        role: "combobox",
8122        "aria-autocomplete": ariaAutoComplete,
8123        "aria-haspopup": getPopupRole(contentElement, "listbox"),
8124        "aria-expanded": open,
8125        "aria-controls": contentElement == null ? void 0 : contentElement.id,
8126        "data-active-item": isActiveItem || void 0,
8127        value
8128      }, props), {
8129        ref: useMergeRefs(ref, props.ref),
8130        onChange,
8131        onCompositionEnd,
8132        onMouseDown,
8133        onKeyDown,
8134        onBlur
8135      });
8136      props = useComposite(__spreadProps(__spreadValues({
8137        store,
8138        focusable
8139      }, props), {
8140        // Enable inline autocomplete when the user moves from the combobox input
8141        // to an item.
8142        moveOnKeyPress: (event) => {
8143          if (isFalsyBooleanCallback(moveOnKeyPress, event)) return false;
8144          if (inline) setCanInline(true);
8145          return true;
8146        }
8147      }));
8148      props = usePopoverAnchor(__spreadValues({ store }, props));
8149      return __spreadValues({ autoComplete: "off" }, props);
8150    }
8151  );
8152  var Combobox = forwardRef22(function Combobox2(props) {
8153    const htmlProps = useCombobox(props);
8154    return createElement2(TagName4, htmlProps);
8155  });
8156  
8157  // node_modules/@ariakit/react-core/esm/combobox/combobox-provider.js
8158  var import_jsx_runtime48 = __toESM(require_jsx_runtime(), 1);
8159  function ComboboxProvider(props = {}) {
8160    const store = useComboboxStore(props);
8161    return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ComboboxContextProvider, { value: store, children: props.children });
8162  }
8163  
8164  // node_modules/@ariakit/react-core/esm/__chunks/KUU7WJ55.js
8165  var import_react12 = __toESM(require_react(), 1);
8166  var TagName5 = "button";
8167  function isNativeClick(event) {
8168    if (!event.isTrusted) return false;
8169    const element = event.currentTarget;
8170    if (event.key === "Enter") {
8171      return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "A";
8172    }
8173    if (event.key === " ") {
8174      return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "INPUT" || element.tagName === "SELECT";
8175    }
8176    return false;
8177  }
8178  var symbol = Symbol("command");
8179  var useCommand = createHook(
8180    function useCommand2(_a) {
8181      var _b = _a, { clickOnEnter = true, clickOnSpace = true } = _b, props = __objRest(_b, ["clickOnEnter", "clickOnSpace"]);
8182      const ref = (0, import_react12.useRef)(null);
8183      const [isNativeButton, setIsNativeButton] = (0, import_react12.useState)(false);
8184      (0, import_react12.useEffect)(() => {
8185        if (!ref.current) return;
8186        setIsNativeButton(isButton(ref.current));
8187      }, []);
8188      const [active, setActive] = (0, import_react12.useState)(false);
8189      const activeRef = (0, import_react12.useRef)(false);
8190      const disabled = disabledFromProps(props);
8191      const [isDuplicate, metadataProps] = useMetadataProps(props, symbol, true);
8192      const onKeyDownProp = props.onKeyDown;
8193      const onKeyDown = useEvent((event) => {
8194        onKeyDownProp == null ? void 0 : onKeyDownProp(event);
8195        const element = event.currentTarget;
8196        if (event.defaultPrevented) return;
8197        if (isDuplicate) return;
8198        if (disabled) return;
8199        if (!isSelfTarget(event)) return;
8200        if (isTextField(element)) return;
8201        if (element.isContentEditable) return;
8202        const isEnter = clickOnEnter && event.key === "Enter";
8203        const isSpace = clickOnSpace && event.key === " ";
8204        const shouldPreventEnter = event.key === "Enter" && !clickOnEnter;
8205        const shouldPreventSpace = event.key === " " && !clickOnSpace;
8206        if (shouldPreventEnter || shouldPreventSpace) {
8207          event.preventDefault();
8208          return;
8209        }
8210        if (isEnter || isSpace) {
8211          const nativeClick = isNativeClick(event);
8212          if (isEnter) {
8213            if (!nativeClick) {
8214              event.preventDefault();
8215              const _a2 = event, { view } = _a2, eventInit = __objRest(_a2, ["view"]);
8216              const click = () => fireClickEvent(element, eventInit);
8217              if (isFirefox()) {
8218                queueBeforeEvent(element, "keyup", click);
8219              } else {
8220                queueMicrotask(click);
8221              }
8222            }
8223          } else if (isSpace) {
8224            activeRef.current = true;
8225            if (!nativeClick) {
8226              event.preventDefault();
8227              setActive(true);
8228            }
8229          }
8230        }
8231      });
8232      const onKeyUpProp = props.onKeyUp;
8233      const onKeyUp = useEvent((event) => {
8234        onKeyUpProp == null ? void 0 : onKeyUpProp(event);
8235        if (event.defaultPrevented) return;
8236        if (isDuplicate) return;
8237        if (disabled) return;
8238        if (event.metaKey) return;
8239        const isSpace = clickOnSpace && event.key === " ";
8240        if (activeRef.current && isSpace) {
8241          activeRef.current = false;
8242          if (!isNativeClick(event)) {
8243            event.preventDefault();
8244            setActive(false);
8245            const element = event.currentTarget;
8246            const _a2 = event, { view } = _a2, eventInit = __objRest(_a2, ["view"]);
8247            queueMicrotask(() => fireClickEvent(element, eventInit));
8248          }
8249        }
8250      });
8251      props = __spreadProps(__spreadValues(__spreadValues({
8252        "data-active": active || void 0,
8253        type: isNativeButton ? "button" : void 0
8254      }, metadataProps), props), {
8255        ref: useMergeRefs(ref, props.ref),
8256        onKeyDown,
8257        onKeyUp
8258      });
8259      props = useFocusable(props);
8260      return props;
8261    }
8262  );
8263  var Command = forwardRef22(function Command2(props) {
8264    const htmlProps = useCommand(props);
8265    return createElement2(TagName5, htmlProps);
8266  });
8267  
8268  // node_modules/@ariakit/react-core/esm/combobox/combobox-item-value.js
8269  var import_react13 = __toESM(require_react(), 1);
8270  var import_jsx_runtime49 = __toESM(require_jsx_runtime(), 1);
8271  var TagName6 = "span";
8272  function normalizeValue(value) {
8273    return normalizeString(value).toLowerCase();
8274  }
8275  function getOffsets(string, values) {
8276    const offsets = [];
8277    for (const value of values) {
8278      let pos = 0;
8279      const length = value.length;
8280      while (string.indexOf(value, pos) !== -1) {
8281        const index = string.indexOf(value, pos);
8282        if (index !== -1) {
8283          offsets.push([index, length]);
8284        }
8285        pos = index + 1;
8286      }
8287    }
8288    return offsets;
8289  }
8290  function filterOverlappingOffsets(offsets) {
8291    return offsets.filter(([offset, length], i2, arr) => {
8292      return !arr.some(
8293        ([o2, l2], j2) => j2 !== i2 && o2 <= offset && o2 + l2 >= offset + length
8294      );
8295    });
8296  }
8297  function sortOffsets(offsets) {
8298    return offsets.sort(([a2], [b2]) => a2 - b2);
8299  }
8300  function splitValue(itemValue, userValue) {
8301    if (!itemValue) return itemValue;
8302    if (!userValue) return itemValue;
8303    const userValues = toArray(userValue).filter(Boolean).map(normalizeValue);
8304    const parts = [];
8305    const span = (value, autocomplete = false) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
8306      "span",
8307      {
8308        "data-autocomplete-value": autocomplete ? "" : void 0,
8309        "data-user-value": autocomplete ? void 0 : "",
8310        children: value
8311      },
8312      parts.length
8313    );
8314    const offsets = sortOffsets(
8315      filterOverlappingOffsets(
8316        // Convert userValues into a set to avoid duplicates
8317        getOffsets(normalizeValue(itemValue), new Set(userValues))
8318      )
8319    );
8320    if (!offsets.length) {
8321      parts.push(span(itemValue, true));
8322      return parts;
8323    }
8324    const [firstOffset] = offsets[0];
8325    const values = [
8326      itemValue.slice(0, firstOffset),
8327      ...offsets.flatMap(([offset, length], i2) => {
8328        var _a;
8329        const value = itemValue.slice(offset, offset + length);
8330        const nextOffset = (_a = offsets[i2 + 1]) == null ? void 0 : _a[0];
8331        const nextValue = itemValue.slice(offset + length, nextOffset);
8332        return [value, nextValue];
8333      })
8334    ];
8335    values.forEach((value, i2) => {
8336      if (!value) return;
8337      parts.push(span(value, i2 % 2 === 0));
8338    });
8339    return parts;
8340  }
8341  var useComboboxItemValue = createHook(function useComboboxItemValue2(_a) {
8342    var _b = _a, { store, value, userValue } = _b, props = __objRest(_b, ["store", "value", "userValue"]);
8343    const context = useComboboxScopedContext();
8344    store = store || context;
8345    const itemContext = (0, import_react13.useContext)(ComboboxItemValueContext);
8346    const itemValue = value != null ? value : itemContext;
8347    const inputValue = useStoreState(store, (state) => userValue != null ? userValue : state == null ? void 0 : state.value);
8348    const children = (0, import_react13.useMemo)(() => {
8349      if (!itemValue) return;
8350      if (!inputValue) return itemValue;
8351      return splitValue(itemValue, inputValue);
8352    }, [itemValue, inputValue]);
8353    props = __spreadValues({
8354      children
8355    }, props);
8356    return removeUndefinedValues(props);
8357  });
8358  var ComboboxItemValue = forwardRef22(function ComboboxItemValue2(props) {
8359    const htmlProps = useComboboxItemValue(props);
8360    return createElement2(TagName6, htmlProps);
8361  });
8362  
8363  // node_modules/@ariakit/react-core/esm/__chunks/UQQRIHDV.js
8364  var import_react14 = __toESM(require_react(), 1);
8365  var TagName7 = "div";
8366  function getMouseDestination(event) {
8367    const relatedTarget = event.relatedTarget;
8368    if ((relatedTarget == null ? void 0 : relatedTarget.nodeType) === Node.ELEMENT_NODE) {
8369      return relatedTarget;
8370    }
8371    return null;
8372  }
8373  function hoveringInside(event) {
8374    const nextElement = getMouseDestination(event);
8375    if (!nextElement) return false;
8376    return contains(event.currentTarget, nextElement);
8377  }
8378  var symbol2 = Symbol("composite-hover");
8379  function movingToAnotherItem(event) {
8380    let dest = getMouseDestination(event);
8381    if (!dest) return false;
8382    do {
8383      if (hasOwnProperty(dest, symbol2) && dest[symbol2]) return true;
8384      dest = dest.parentElement;
8385    } while (dest);
8386    return false;
8387  }
8388  var useCompositeHover = createHook(
8389    function useCompositeHover2(_a) {
8390      var _b = _a, {
8391        store,
8392        focusOnHover = true,
8393        blurOnHoverEnd = !!focusOnHover
8394      } = _b, props = __objRest(_b, [
8395        "store",
8396        "focusOnHover",
8397        "blurOnHoverEnd"
8398      ]);
8399      const context = useCompositeContext();
8400      store = store || context;
8401      invariant(
8402        store,
8403        "CompositeHover must be wrapped in a Composite component."
8404      );
8405      const isMouseMoving = useIsMouseMoving();
8406      const onMouseMoveProp = props.onMouseMove;
8407      const focusOnHoverProp = useBooleanEvent(focusOnHover);
8408      const onMouseMove = useEvent((event) => {
8409        onMouseMoveProp == null ? void 0 : onMouseMoveProp(event);
8410        if (event.defaultPrevented) return;
8411        if (!isMouseMoving()) return;
8412        if (!focusOnHoverProp(event)) return;
8413        if (!hasFocusWithin(event.currentTarget)) {
8414          const baseElement = store == null ? void 0 : store.getState().baseElement;
8415          if (baseElement && !hasFocus(baseElement)) {
8416            baseElement.focus();
8417          }
8418        }
8419        store == null ? void 0 : store.setActiveId(event.currentTarget.id);
8420      });
8421      const onMouseLeaveProp = props.onMouseLeave;
8422      const blurOnHoverEndProp = useBooleanEvent(blurOnHoverEnd);
8423      const onMouseLeave = useEvent((event) => {
8424        var _a2;
8425        onMouseLeaveProp == null ? void 0 : onMouseLeaveProp(event);
8426        if (event.defaultPrevented) return;
8427        if (!isMouseMoving()) return;
8428        if (hoveringInside(event)) return;
8429        if (movingToAnotherItem(event)) return;
8430        if (!focusOnHoverProp(event)) return;
8431        if (!blurOnHoverEndProp(event)) return;
8432        store == null ? void 0 : store.setActiveId(null);
8433        (_a2 = store == null ? void 0 : store.getState().baseElement) == null ? void 0 : _a2.focus();
8434      });
8435      const ref = (0, import_react14.useCallback)((element) => {
8436        if (!element) return;
8437        element[symbol2] = true;
8438      }, []);
8439      props = __spreadProps(__spreadValues({}, props), {
8440        ref: useMergeRefs(ref, props.ref),
8441        onMouseMove,
8442        onMouseLeave
8443      });
8444      return removeUndefinedValues(props);
8445    }
8446  );
8447  var CompositeHover = memo22(
8448    forwardRef22(function CompositeHover2(props) {
8449      const htmlProps = useCompositeHover(props);
8450      return createElement2(TagName7, htmlProps);
8451    })
8452  );
8453  
8454  // node_modules/@ariakit/react-core/esm/__chunks/RZ4GPYOB.js
8455  var import_react15 = __toESM(require_react(), 1);
8456  var TagName8 = "div";
8457  var useCollectionItem = createHook(
8458    function useCollectionItem2(_a) {
8459      var _b = _a, {
8460        store,
8461        shouldRegisterItem = true,
8462        getItem = identity,
8463        element
8464      } = _b, props = __objRest(_b, [
8465        "store",
8466        "shouldRegisterItem",
8467        "getItem",
8468        // @ts-expect-error This prop may come from a collection renderer.
8469        "element"
8470      ]);
8471      const context = useCollectionContext();
8472      store = store || context;
8473      const id = useId3(props.id);
8474      const ref = (0, import_react15.useRef)(element);
8475      (0, import_react15.useEffect)(() => {
8476        const element2 = ref.current;
8477        if (!id) return;
8478        if (!element2) return;
8479        if (!shouldRegisterItem) return;
8480        const item = getItem({ id, element: element2 });
8481        return store == null ? void 0 : store.renderItem(item);
8482      }, [id, shouldRegisterItem, getItem, store]);
8483      props = __spreadProps(__spreadValues({}, props), {
8484        ref: useMergeRefs(ref, props.ref)
8485      });
8486      return removeUndefinedValues(props);
8487    }
8488  );
8489  var CollectionItem = forwardRef22(function CollectionItem2(props) {
8490    const htmlProps = useCollectionItem(props);
8491    return createElement2(TagName8, htmlProps);
8492  });
8493  
8494  // node_modules/@ariakit/react-core/esm/__chunks/P2CTZE2T.js
8495  var import_react16 = __toESM(require_react(), 1);
8496  var import_jsx_runtime50 = __toESM(require_jsx_runtime(), 1);
8497  var TagName9 = "button";
8498  function isEditableElement(element) {
8499    if (isTextbox(element)) return true;
8500    return element.tagName === "INPUT" && !isButton(element);
8501  }
8502  function getNextPageOffset(scrollingElement, pageUp = false) {
8503    const height = scrollingElement.clientHeight;
8504    const { top } = scrollingElement.getBoundingClientRect();
8505    const pageSize = Math.max(height * 0.875, height - 40) * 1.5;
8506    const pageOffset = pageUp ? height - pageSize + top : pageSize + top;
8507    if (scrollingElement.tagName === "HTML") {
8508      return pageOffset + scrollingElement.scrollTop;
8509    }
8510    return pageOffset;
8511  }
8512  function getItemOffset(itemElement, pageUp = false) {
8513    const { top } = itemElement.getBoundingClientRect();
8514    if (pageUp) {
8515      return top + itemElement.clientHeight;
8516    }
8517    return top;
8518  }
8519  function findNextPageItemId(element, store, next, pageUp = false) {
8520    var _a;
8521    if (!store) return;
8522    if (!next) return;
8523    const { renderedItems } = store.getState();
8524    const scrollingElement = getScrollingElement(element);
8525    if (!scrollingElement) return;
8526    const nextPageOffset = getNextPageOffset(scrollingElement, pageUp);
8527    let id;
8528    let prevDifference;
8529    for (let i2 = 0; i2 < renderedItems.length; i2 += 1) {
8530      const previousId = id;
8531      id = next(i2);
8532      if (!id) break;
8533      if (id === previousId) continue;
8534      const itemElement = (_a = getEnabledItem(store, id)) == null ? void 0 : _a.element;
8535      if (!itemElement) continue;
8536      const itemOffset = getItemOffset(itemElement, pageUp);
8537      const difference = itemOffset - nextPageOffset;
8538      const absDifference = Math.abs(difference);
8539      if (pageUp && difference <= 0 || !pageUp && difference >= 0) {
8540        if (prevDifference !== void 0 && prevDifference < absDifference) {
8541          id = previousId;
8542        }
8543        break;
8544      }
8545      prevDifference = absDifference;
8546    }
8547    return id;
8548  }
8549  function targetIsAnotherItem(event, store) {
8550    if (isSelfTarget(event)) return false;
8551    return isItem(store, event.target);
8552  }
8553  var useCompositeItem = createHook(
8554    function useCompositeItem2(_a) {
8555      var _b = _a, {
8556        store,
8557        rowId: rowIdProp,
8558        preventScrollOnKeyDown = false,
8559        moveOnKeyPress = true,
8560        tabbable = false,
8561        getItem: getItemProp,
8562        "aria-setsize": ariaSetSizeProp,
8563        "aria-posinset": ariaPosInSetProp
8564      } = _b, props = __objRest(_b, [
8565        "store",
8566        "rowId",
8567        "preventScrollOnKeyDown",
8568        "moveOnKeyPress",
8569        "tabbable",
8570        "getItem",
8571        "aria-setsize",
8572        "aria-posinset"
8573      ]);
8574      const context = useCompositeContext();
8575      store = store || context;
8576      const id = useId3(props.id);
8577      const ref = (0, import_react16.useRef)(null);
8578      const row = (0, import_react16.useContext)(CompositeRowContext);
8579      const disabled = disabledFromProps(props);
8580      const trulyDisabled = disabled && !props.accessibleWhenDisabled;
8581      const {
8582        rowId,
8583        baseElement,
8584        isActiveItem,
8585        ariaSetSize,
8586        ariaPosInSet,
8587        isTabbable
8588      } = useStoreStateObject(store, {
8589        rowId(state) {
8590          if (rowIdProp) return rowIdProp;
8591          if (!state) return;
8592          if (!(row == null ? void 0 : row.baseElement)) return;
8593          if (row.baseElement !== state.baseElement) return;
8594          return row.id;
8595        },
8596        baseElement(state) {
8597          return (state == null ? void 0 : state.baseElement) || void 0;
8598        },
8599        isActiveItem(state) {
8600          return !!state && state.activeId === id;
8601        },
8602        ariaSetSize(state) {
8603          if (ariaSetSizeProp != null) return ariaSetSizeProp;
8604          if (!state) return;
8605          if (!(row == null ? void 0 : row.ariaSetSize)) return;
8606          if (row.baseElement !== state.baseElement) return;
8607          return row.ariaSetSize;
8608        },
8609        ariaPosInSet(state) {
8610          if (ariaPosInSetProp != null) return ariaPosInSetProp;
8611          if (!state) return;
8612          if (!(row == null ? void 0 : row.ariaPosInSet)) return;
8613          if (row.baseElement !== state.baseElement) return;
8614          const itemsInRow = state.renderedItems.filter(
8615            (item) => item.rowId === rowId
8616          );
8617          return row.ariaPosInSet + itemsInRow.findIndex((item) => item.id === id);
8618        },
8619        isTabbable(state) {
8620          if (!(state == null ? void 0 : state.renderedItems.length)) return true;
8621          if (state.virtualFocus) return false;
8622          if (tabbable) return true;
8623          if (state.activeId === null) return false;
8624          const item = store == null ? void 0 : store.item(state.activeId);
8625          if (item == null ? void 0 : item.disabled) return true;
8626          if (!(item == null ? void 0 : item.element)) return true;
8627          return state.activeId === id;
8628        }
8629      });
8630      const getItem = (0, import_react16.useCallback)(
8631        (item) => {
8632          var _a2;
8633          const nextItem = __spreadProps(__spreadValues({}, item), {
8634            id: id || item.id,
8635            rowId,
8636            disabled: !!trulyDisabled,
8637            children: (_a2 = item.element) == null ? void 0 : _a2.textContent
8638          });
8639          if (getItemProp) {
8640            return getItemProp(nextItem);
8641          }
8642          return nextItem;
8643        },
8644        [id, rowId, trulyDisabled, getItemProp]
8645      );
8646      const onFocusProp = props.onFocus;
8647      const hasFocusedComposite = (0, import_react16.useRef)(false);
8648      const onFocus = useEvent((event) => {
8649        onFocusProp == null ? void 0 : onFocusProp(event);
8650        if (event.defaultPrevented) return;
8651        if (isPortalEvent(event)) return;
8652        if (!id) return;
8653        if (!store) return;
8654        if (targetIsAnotherItem(event, store)) return;
8655        const { virtualFocus, baseElement: baseElement2 } = store.getState();
8656        store.setActiveId(id);
8657        if (isTextbox(event.currentTarget)) {
8658          selectTextField(event.currentTarget);
8659        }
8660        if (!virtualFocus) return;
8661        if (!isSelfTarget(event)) return;
8662        if (isEditableElement(event.currentTarget)) return;
8663        if (!(baseElement2 == null ? void 0 : baseElement2.isConnected)) return;
8664        if (isSafari() && event.currentTarget.hasAttribute("data-autofocus")) {
8665          event.currentTarget.scrollIntoView({
8666            block: "nearest",
8667            inline: "nearest"
8668          });
8669        }
8670        hasFocusedComposite.current = true;
8671        const fromComposite = event.relatedTarget === baseElement2 || isItem(store, event.relatedTarget);
8672        if (fromComposite) {
8673          focusSilently(baseElement2);
8674        } else {
8675          baseElement2.focus();
8676        }
8677      });
8678      const onBlurCaptureProp = props.onBlurCapture;
8679      const onBlurCapture = useEvent((event) => {
8680        onBlurCaptureProp == null ? void 0 : onBlurCaptureProp(event);
8681        if (event.defaultPrevented) return;
8682        const state = store == null ? void 0 : store.getState();
8683        if ((state == null ? void 0 : state.virtualFocus) && hasFocusedComposite.current) {
8684          hasFocusedComposite.current = false;
8685          event.preventDefault();
8686          event.stopPropagation();
8687        }
8688      });
8689      const onKeyDownProp = props.onKeyDown;
8690      const preventScrollOnKeyDownProp = useBooleanEvent(preventScrollOnKeyDown);
8691      const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress);
8692      const onKeyDown = useEvent((event) => {
8693        onKeyDownProp == null ? void 0 : onKeyDownProp(event);
8694        if (event.defaultPrevented) return;
8695        if (!isSelfTarget(event)) return;
8696        if (!store) return;
8697        const { currentTarget } = event;
8698        const state = store.getState();
8699        const item = store.item(id);
8700        const isGrid2 = !!(item == null ? void 0 : item.rowId);
8701        const isVertical = state.orientation !== "horizontal";
8702        const isHorizontal = state.orientation !== "vertical";
8703        const canHomeEnd = () => {
8704          if (isGrid2) return true;
8705          if (isHorizontal) return true;
8706          if (!state.baseElement) return true;
8707          if (!isTextField(state.baseElement)) return true;
8708          return false;
8709        };
8710        const keyMap = {
8711          ArrowUp: (isGrid2 || isVertical) && store.up,
8712          ArrowRight: (isGrid2 || isHorizontal) && store.next,
8713          ArrowDown: (isGrid2 || isVertical) && store.down,
8714          ArrowLeft: (isGrid2 || isHorizontal) && store.previous,
8715          Home: () => {
8716            if (!canHomeEnd()) return;
8717            if (!isGrid2 || event.ctrlKey) {
8718              return store == null ? void 0 : store.first();
8719            }
8720            return store == null ? void 0 : store.previous(-1);
8721          },
8722          End: () => {
8723            if (!canHomeEnd()) return;
8724            if (!isGrid2 || event.ctrlKey) {
8725              return store == null ? void 0 : store.last();
8726            }
8727            return store == null ? void 0 : store.next(-1);
8728          },
8729          PageUp: () => {
8730            return findNextPageItemId(currentTarget, store, store == null ? void 0 : store.up, true);
8731          },
8732          PageDown: () => {
8733            return findNextPageItemId(currentTarget, store, store == null ? void 0 : store.down);
8734          }
8735        };
8736        const action = keyMap[event.key];
8737        if (action) {
8738          if (isTextbox(currentTarget)) {
8739            const selection = getTextboxSelection(currentTarget);
8740            const isLeft = isHorizontal && event.key === "ArrowLeft";
8741            const isRight = isHorizontal && event.key === "ArrowRight";
8742            const isUp = isVertical && event.key === "ArrowUp";
8743            const isDown = isVertical && event.key === "ArrowDown";
8744            if (isRight || isDown) {
8745              const { length: valueLength } = getTextboxValue(currentTarget);
8746              if (selection.end !== valueLength) return;
8747            } else if ((isLeft || isUp) && selection.start !== 0) return;
8748          }
8749          const nextId = action();
8750          if (preventScrollOnKeyDownProp(event) || nextId !== void 0) {
8751            if (!moveOnKeyPressProp(event)) return;
8752            event.preventDefault();
8753            store.move(nextId);
8754          }
8755        }
8756      });
8757      const providerValue = (0, import_react16.useMemo)(
8758        () => ({ id, baseElement }),
8759        [id, baseElement]
8760      );
8761      props = useWrapElement(
8762        props,
8763        (element) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(CompositeItemContext.Provider, { value: providerValue, children: element }),
8764        [providerValue]
8765      );
8766      props = __spreadProps(__spreadValues({
8767        id,
8768        "data-active-item": isActiveItem || void 0
8769      }, props), {
8770        ref: useMergeRefs(ref, props.ref),
8771        tabIndex: isTabbable ? props.tabIndex : -1,
8772        onFocus,
8773        onBlurCapture,
8774        onKeyDown
8775      });
8776      props = useCommand(props);
8777      props = useCollectionItem(__spreadProps(__spreadValues({
8778        store
8779      }, props), {
8780        getItem,
8781        shouldRegisterItem: id ? props.shouldRegisterItem : false
8782      }));
8783      return removeUndefinedValues(__spreadProps(__spreadValues({}, props), {
8784        "aria-setsize": ariaSetSize,
8785        "aria-posinset": ariaPosInSet
8786      }));
8787    }
8788  );
8789  var CompositeItem = memo22(
8790    forwardRef22(function CompositeItem2(props) {
8791      const htmlProps = useCompositeItem(props);
8792      return createElement2(TagName9, htmlProps);
8793    })
8794  );
8795  
8796  // node_modules/@ariakit/react-core/esm/__chunks/ZTDSJLD6.js
8797  var import_react17 = __toESM(require_react(), 1);
8798  var import_jsx_runtime51 = __toESM(require_jsx_runtime(), 1);
8799  var TagName10 = "div";
8800  function isSelected(storeValue, itemValue) {
8801    if (itemValue == null) return;
8802    if (storeValue == null) return false;
8803    if (Array.isArray(storeValue)) {
8804      return storeValue.includes(itemValue);
8805    }
8806    return storeValue === itemValue;
8807  }
8808  function getItemRole(popupRole) {
8809    var _a;
8810    const itemRoleByPopupRole = {
8811      menu: "menuitem",
8812      listbox: "option",
8813      tree: "treeitem"
8814    };
8815    const key = popupRole;
8816    return (_a = itemRoleByPopupRole[key]) != null ? _a : "option";
8817  }
8818  var useComboboxItem = createHook(
8819    function useComboboxItem2(_a) {
8820      var _b = _a, {
8821        store,
8822        value,
8823        hideOnClick,
8824        setValueOnClick,
8825        selectValueOnClick = true,
8826        resetValueOnSelect,
8827        focusOnHover = false,
8828        moveOnKeyPress = true,
8829        getItem: getItemProp
8830      } = _b, props = __objRest(_b, [
8831        "store",
8832        "value",
8833        "hideOnClick",
8834        "setValueOnClick",
8835        "selectValueOnClick",
8836        "resetValueOnSelect",
8837        "focusOnHover",
8838        "moveOnKeyPress",
8839        "getItem"
8840      ]);
8841      var _a2;
8842      const context = useComboboxScopedContext();
8843      store = store || context;
8844      invariant(
8845        store,
8846        "ComboboxItem must be wrapped in a ComboboxList or ComboboxPopover component."
8847      );
8848      const { resetValueOnSelectState, multiSelectable, selected } = useStoreStateObject(store, {
8849        resetValueOnSelectState: "resetValueOnSelect",
8850        multiSelectable(state) {
8851          return Array.isArray(state.selectedValue);
8852        },
8853        selected(state) {
8854          return isSelected(state.selectedValue, value);
8855        }
8856      });
8857      const getItem = (0, import_react17.useCallback)(
8858        (item) => {
8859          const nextItem = __spreadProps(__spreadValues({}, item), { value });
8860          if (getItemProp) {
8861            return getItemProp(nextItem);
8862          }
8863          return nextItem;
8864        },
8865        [value, getItemProp]
8866      );
8867      setValueOnClick = setValueOnClick != null ? setValueOnClick : !multiSelectable;
8868      hideOnClick = hideOnClick != null ? hideOnClick : value != null && !multiSelectable;
8869      const onClickProp = props.onClick;
8870      const setValueOnClickProp = useBooleanEvent(setValueOnClick);
8871      const selectValueOnClickProp = useBooleanEvent(selectValueOnClick);
8872      const resetValueOnSelectProp = useBooleanEvent(
8873        (_a2 = resetValueOnSelect != null ? resetValueOnSelect : resetValueOnSelectState) != null ? _a2 : multiSelectable
8874      );
8875      const hideOnClickProp = useBooleanEvent(hideOnClick);
8876      const onClick = useEvent((event) => {
8877        onClickProp == null ? void 0 : onClickProp(event);
8878        if (event.defaultPrevented) return;
8879        if (isDownloading(event)) return;
8880        if (isOpeningInNewTab(event)) return;
8881        if (value != null) {
8882          if (selectValueOnClickProp(event)) {
8883            if (resetValueOnSelectProp(event)) {
8884              store == null ? void 0 : store.resetValue();
8885            }
8886            store == null ? void 0 : store.setSelectedValue((prevValue) => {
8887              if (!Array.isArray(prevValue)) return value;
8888              if (prevValue.includes(value)) {
8889                return prevValue.filter((v2) => v2 !== value);
8890              }
8891              return [...prevValue, value];
8892            });
8893          }
8894          if (setValueOnClickProp(event)) {
8895            store == null ? void 0 : store.setValue(value);
8896          }
8897        }
8898        if (hideOnClickProp(event)) {
8899          store == null ? void 0 : store.hide();
8900        }
8901      });
8902      const onKeyDownProp = props.onKeyDown;
8903      const onKeyDown = useEvent((event) => {
8904        onKeyDownProp == null ? void 0 : onKeyDownProp(event);
8905        if (event.defaultPrevented) return;
8906        const baseElement = store == null ? void 0 : store.getState().baseElement;
8907        if (!baseElement) return;
8908        if (hasFocus(baseElement)) return;
8909        const printable = event.key.length === 1;
8910        if (printable || event.key === "Backspace" || event.key === "Delete") {
8911          queueMicrotask(() => baseElement.focus());
8912          if (isTextField(baseElement)) {
8913            store == null ? void 0 : store.setValue(baseElement.value);
8914          }
8915        }
8916      });
8917      if (multiSelectable && selected != null) {
8918        props = __spreadValues({
8919          "aria-selected": selected
8920        }, props);
8921      }
8922      props = useWrapElement(
8923        props,
8924        (element) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ComboboxItemValueContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ComboboxItemCheckedContext.Provider, { value: selected != null ? selected : false, children: element }) }),
8925        [value, selected]
8926      );
8927      const popupRole = (0, import_react17.useContext)(ComboboxListRoleContext);
8928      props = __spreadProps(__spreadValues({
8929        role: getItemRole(popupRole),
8930        children: value
8931      }, props), {
8932        onClick,
8933        onKeyDown
8934      });
8935      const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress);
8936      props = useCompositeItem(__spreadProps(__spreadValues({
8937        store
8938      }, props), {
8939        getItem,
8940        // Dispatch a custom event on the combobox input when moving to an item
8941        // with the keyboard so the Combobox component can enable inline
8942        // autocompletion.
8943        moveOnKeyPress: (event) => {
8944          if (!moveOnKeyPressProp(event)) return false;
8945          const moveEvent = new Event("combobox-item-move");
8946          const baseElement = store == null ? void 0 : store.getState().baseElement;
8947          baseElement == null ? void 0 : baseElement.dispatchEvent(moveEvent);
8948          return true;
8949        }
8950      }));
8951      props = useCompositeHover(__spreadValues({ store, focusOnHover }, props));
8952      return props;
8953    }
8954  );
8955  var ComboboxItem = memo22(
8956    forwardRef22(function ComboboxItem2(props) {
8957      const htmlProps = useComboboxItem(props);
8958      return createElement2(TagName10, htmlProps);
8959    })
8960  );
8961  
8962  // node_modules/@ariakit/react-core/esm/combobox/combobox-label.js
8963  var TagName11 = "label";
8964  var useComboboxLabel = createHook(
8965    function useComboboxLabel2(_a) {
8966      var _b = _a, { store } = _b, props = __objRest(_b, ["store"]);
8967      const context = useComboboxProviderContext();
8968      store = store || context;
8969      invariant(
8970        store,
8971        "ComboboxLabel must receive a `store` prop or be wrapped in a ComboboxProvider component."
8972      );
8973      const comboboxId = store.useState((state) => {
8974        var _a2;
8975        return (_a2 = state.baseElement) == null ? void 0 : _a2.id;
8976      });
8977      props = __spreadValues({
8978        htmlFor: comboboxId
8979      }, props);
8980      return removeUndefinedValues(props);
8981    }
8982  );
8983  var ComboboxLabel = memo22(
8984    forwardRef22(function ComboboxLabel2(props) {
8985      const htmlProps = useComboboxLabel(props);
8986      return createElement2(TagName11, htmlProps);
8987    })
8988  );
8989  
8990  // node_modules/@ariakit/react-core/esm/__chunks/VGCJ63VH.js
8991  var import_react18 = __toESM(require_react(), 1);
8992  var import_react_dom = __toESM(require_react_dom(), 1);
8993  var import_jsx_runtime52 = __toESM(require_jsx_runtime(), 1);
8994  var TagName12 = "div";
8995  function afterTimeout(timeoutMs, cb) {
8996    const timeoutId = setTimeout(cb, timeoutMs);
8997    return () => clearTimeout(timeoutId);
8998  }
8999  function afterPaint2(cb) {
9000    let raf = requestAnimationFrame(() => {
9001      raf = requestAnimationFrame(cb);
9002    });
9003    return () => cancelAnimationFrame(raf);
9004  }
9005  function parseCSSTime(...times) {
9006    return times.join(", ").split(", ").reduce((longestTime, currentTimeString) => {
9007      const multiplier = currentTimeString.endsWith("ms") ? 1 : 1e3;
9008      const currentTime = Number.parseFloat(currentTimeString || "0s") * multiplier;
9009      if (currentTime > longestTime) return currentTime;
9010      return longestTime;
9011    }, 0);
9012  }
9013  function isHidden(mounted, hidden, alwaysVisible) {
9014    return !alwaysVisible && hidden !== false && (!mounted || !!hidden);
9015  }
9016  var useDisclosureContent = createHook(function useDisclosureContent2(_a) {
9017    var _b = _a, { store, alwaysVisible } = _b, props = __objRest(_b, ["store", "alwaysVisible"]);
9018    const context = useDisclosureProviderContext();
9019    store = store || context;
9020    invariant(
9021      store,
9022      "DisclosureContent must receive a `store` prop or be wrapped in a DisclosureProvider component."
9023    );
9024    const ref = (0, import_react18.useRef)(null);
9025    const id = useId3(props.id);
9026    const [transition, setTransition] = (0, import_react18.useState)(null);
9027    const open = store.useState("open");
9028    const mounted = store.useState("mounted");
9029    const animated = store.useState("animated");
9030    const contentElement = store.useState("contentElement");
9031    const otherElement = useStoreState(store.disclosure, "contentElement");
9032    useSafeLayoutEffect(() => {
9033      if (!ref.current) return;
9034      store == null ? void 0 : store.setContentElement(ref.current);
9035    }, [store]);
9036    useSafeLayoutEffect(() => {
9037      let previousAnimated;
9038      store == null ? void 0 : store.setState("animated", (animated2) => {
9039        previousAnimated = animated2;
9040        return true;
9041      });
9042      return () => {
9043        if (previousAnimated === void 0) return;
9044        store == null ? void 0 : store.setState("animated", previousAnimated);
9045      };
9046    }, [store]);
9047    useSafeLayoutEffect(() => {
9048      if (!animated) return;
9049      if (!(contentElement == null ? void 0 : contentElement.isConnected)) {
9050        setTransition(null);
9051        return;
9052      }
9053      return afterPaint2(() => {
9054        setTransition(open ? "enter" : mounted ? "leave" : null);
9055      });
9056    }, [animated, contentElement, open, mounted]);
9057    useSafeLayoutEffect(() => {
9058      if (!store) return;
9059      if (!animated) return;
9060      if (!transition) return;
9061      if (!contentElement) return;
9062      const stopAnimation = () => store == null ? void 0 : store.setState("animating", false);
9063      const stopAnimationSync = () => (0, import_react_dom.flushSync)(stopAnimation);
9064      if (transition === "leave" && open) return;
9065      if (transition === "enter" && !open) return;
9066      if (typeof animated === "number") {
9067        const timeout2 = animated;
9068        return afterTimeout(timeout2, stopAnimationSync);
9069      }
9070      const {
9071        transitionDuration,
9072        animationDuration,
9073        transitionDelay,
9074        animationDelay
9075      } = getComputedStyle(contentElement);
9076      const {
9077        transitionDuration: transitionDuration2 = "0",
9078        animationDuration: animationDuration2 = "0",
9079        transitionDelay: transitionDelay2 = "0",
9080        animationDelay: animationDelay2 = "0"
9081      } = otherElement ? getComputedStyle(otherElement) : {};
9082      const delay = parseCSSTime(
9083        transitionDelay,
9084        animationDelay,
9085        transitionDelay2,
9086        animationDelay2
9087      );
9088      const duration = parseCSSTime(
9089        transitionDuration,
9090        animationDuration,
9091        transitionDuration2,
9092        animationDuration2
9093      );
9094      const timeout = delay + duration;
9095      if (!timeout) {
9096        if (transition === "enter") {
9097          store.setState("animated", false);
9098        }
9099        stopAnimation();
9100        return;
9101      }
9102      const frameRate = 1e3 / 60;
9103      const maxTimeout = Math.max(timeout - frameRate, 0);
9104      return afterTimeout(maxTimeout, stopAnimationSync);
9105    }, [store, animated, contentElement, otherElement, open, transition]);
9106    props = useWrapElement(
9107      props,
9108      (element) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(DialogScopedContextProvider, { value: store, children: element }),
9109      [store]
9110    );
9111    const hidden = isHidden(mounted, props.hidden, alwaysVisible);
9112    const styleProp = props.style;
9113    const style = (0, import_react18.useMemo)(() => {
9114      if (hidden) {
9115        return __spreadProps(__spreadValues({}, styleProp), { display: "none" });
9116      }
9117      return styleProp;
9118    }, [hidden, styleProp]);
9119    props = __spreadProps(__spreadValues({
9120      id,
9121      "data-open": open || void 0,
9122      "data-enter": transition === "enter" || void 0,
9123      "data-leave": transition === "leave" || void 0,
9124      hidden
9125    }, props), {
9126      ref: useMergeRefs(id ? store.setContentElement : null, ref, props.ref),
9127      style
9128    });
9129    return removeUndefinedValues(props);
9130  });
9131  var DisclosureContentImpl = forwardRef22(function DisclosureContentImpl2(props) {
9132    const htmlProps = useDisclosureContent(props);
9133    return createElement2(TagName12, htmlProps);
9134  });
9135  var DisclosureContent = forwardRef22(function DisclosureContent2(_a) {
9136    var _b = _a, {
9137      unmountOnHide
9138    } = _b, props = __objRest(_b, [
9139      "unmountOnHide"
9140    ]);
9141    const context = useDisclosureProviderContext();
9142    const store = props.store || context;
9143    const mounted = useStoreState(
9144      store,
9145      (state) => !unmountOnHide || (state == null ? void 0 : state.mounted)
9146    );
9147    if (mounted === false) return null;
9148    return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(DisclosureContentImpl, __spreadValues({}, props));
9149  });
9150  
9151  // node_modules/@ariakit/react-core/esm/__chunks/HUWAI7RB.js
9152  var import_react19 = __toESM(require_react(), 1);
9153  var import_jsx_runtime53 = __toESM(require_jsx_runtime(), 1);
9154  var TagName13 = "div";
9155  var useComboboxList = createHook(
9156    function useComboboxList2(_a) {
9157      var _b = _a, { store, alwaysVisible } = _b, props = __objRest(_b, ["store", "alwaysVisible"]);
9158      const scopedContext = useComboboxScopedContext(true);
9159      const context = useComboboxContext();
9160      store = store || context;
9161      const scopedContextSameStore = !!store && store === scopedContext;
9162      invariant(
9163        store,
9164        "ComboboxList must receive a `store` prop or be wrapped in a ComboboxProvider component."
9165      );
9166      const ref = (0, import_react19.useRef)(null);
9167      const id = useId3(props.id);
9168      const mounted = store.useState("mounted");
9169      const hidden = isHidden(mounted, props.hidden, alwaysVisible);
9170      const style = hidden ? __spreadProps(__spreadValues({}, props.style), { display: "none" }) : props.style;
9171      const multiSelectable = store.useState(
9172        (state) => Array.isArray(state.selectedValue)
9173      );
9174      const role = useAttribute(ref, "role", props.role);
9175      const isCompositeRole = role === "listbox" || role === "tree" || role === "grid";
9176      const ariaMultiSelectable = isCompositeRole ? multiSelectable || void 0 : void 0;
9177      const [hasListboxInside, setHasListboxInside] = (0, import_react19.useState)(false);
9178      const contentElement = store.useState("contentElement");
9179      useSafeLayoutEffect(() => {
9180        if (!mounted) return;
9181        const element = ref.current;
9182        if (!element) return;
9183        if (contentElement !== element) return;
9184        const callback = () => {
9185          setHasListboxInside(!!element.querySelector("[role='listbox']"));
9186        };
9187        const observer = new MutationObserver(callback);
9188        observer.observe(element, {
9189          subtree: true,
9190          childList: true,
9191          attributeFilter: ["role"]
9192        });
9193        callback();
9194        return () => observer.disconnect();
9195      }, [mounted, contentElement]);
9196      if (!hasListboxInside) {
9197        props = __spreadValues({
9198          role: "listbox",
9199          "aria-multiselectable": ariaMultiSelectable
9200        }, props);
9201      }
9202      props = useWrapElement(
9203        props,
9204        (element) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ComboboxScopedContextProvider, { value: store, children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ComboboxListRoleContext.Provider, { value: role, children: element }) }),
9205        [store, role]
9206      );
9207      const setContentElement = id && (!scopedContext || !scopedContextSameStore) ? store.setContentElement : null;
9208      props = __spreadProps(__spreadValues({
9209        id,
9210        hidden
9211      }, props), {
9212        ref: useMergeRefs(setContentElement, ref, props.ref),
9213        style
9214      });
9215      return removeUndefinedValues(props);
9216    }
9217  );
9218  var ComboboxList = forwardRef22(function ComboboxList2(props) {
9219    const htmlProps = useComboboxList(props);
9220    return createElement2(TagName13, htmlProps);
9221  });
9222  
9223  // packages/dataviews/build-module/components/dataviews-filters/search-widget.js
9224  var import_remove_accents = __toESM(require_remove_accents());
9225  var import_compose7 = __toESM(require_compose());
9226  var import_i18n21 = __toESM(require_i18n());
9227  var import_element23 = __toESM(require_element());
9228  var import_components21 = __toESM(require_components());
9229  
9230  // packages/dataviews/build-module/components/dataviews-filters/utils.js
9231  var EMPTY_ARRAY2 = [];
9232  var getCurrentValue = (filterDefinition, currentFilter) => {
9233    if (filterDefinition.singleSelection) {
9234      return currentFilter?.value;
9235    }
9236    if (Array.isArray(currentFilter?.value)) {
9237      return currentFilter.value;
9238    }
9239    if (!Array.isArray(currentFilter?.value) && !!currentFilter?.value) {
9240      return [currentFilter.value];
9241    }
9242    return EMPTY_ARRAY2;
9243  };
9244  
9245  // packages/dataviews/build-module/hooks/use-elements.js
9246  var import_element22 = __toESM(require_element());
9247  var EMPTY_ARRAY3 = [];
9248  function useElements({
9249    elements,
9250    getElements
9251  }) {
9252    const staticElements = Array.isArray(elements) && elements.length > 0 ? elements : EMPTY_ARRAY3;
9253    const [records, setRecords] = (0, import_element22.useState)(staticElements);
9254    const [isLoading, setIsLoading] = (0, import_element22.useState)(false);
9255    (0, import_element22.useEffect)(() => {
9256      if (!getElements) {
9257        setRecords(staticElements);
9258        return;
9259      }
9260      let cancelled = false;
9261      setIsLoading(true);
9262      getElements().then((fetchedElements) => {
9263        if (!cancelled) {
9264          const dynamicElements = Array.isArray(fetchedElements) && fetchedElements.length > 0 ? fetchedElements : staticElements;
9265          setRecords(dynamicElements);
9266        }
9267      }).catch(() => {
9268        if (!cancelled) {
9269          setRecords(staticElements);
9270        }
9271      }).finally(() => {
9272        if (!cancelled) {
9273          setIsLoading(false);
9274        }
9275      });
9276      return () => {
9277        cancelled = true;
9278      };
9279    }, [getElements, staticElements]);
9280    return {
9281      elements: records,
9282      isLoading
9283    };
9284  }
9285  
9286  // packages/dataviews/build-module/components/dataviews-filters/search-widget.js
9287  var import_jsx_runtime54 = __toESM(require_jsx_runtime());
9288  function normalizeSearchInput(input = "") {
9289    return (0, import_remove_accents.default)(input.trim().toLowerCase());
9290  }
9291  var getNewValue = (filterDefinition, currentFilter, value) => {
9292    if (filterDefinition.singleSelection) {
9293      return value;
9294    }
9295    if (Array.isArray(currentFilter?.value)) {
9296      return currentFilter.value.includes(value) ? currentFilter.value.filter((v2) => v2 !== value) : [...currentFilter.value, value];
9297    }
9298    return [value];
9299  };
9300  function generateFilterElementCompositeItemId(prefix, filterElementValue) {
9301    return `$prefix}-$filterElementValue}`;
9302  }
9303  var MultiSelectionOption = ({ selected }) => {
9304    return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
9305      "span",
9306      {
9307        className: clsx_default(
9308          "dataviews-filters__search-widget-listitem-multi-selection",
9309          { "is-selected": selected }
9310        ),
9311        children: selected && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_components21.Icon, { icon: check_default })
9312      }
9313    );
9314  };
9315  var SingleSelectionOption = ({ selected }) => {
9316    return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
9317      "span",
9318      {
9319        className: clsx_default(
9320          "dataviews-filters__search-widget-listitem-single-selection",
9321          { "is-selected": selected }
9322        )
9323      }
9324    );
9325  };
9326  function ListBox({ view, filter, onChangeView }) {
9327    const baseId = (0, import_compose7.useInstanceId)(ListBox, "dataviews-filter-list-box");
9328    const [activeCompositeId, setActiveCompositeId] = (0, import_element23.useState)(
9329      // When there are one or less operators, the first item is set as active
9330      // (by setting the initial `activeId` to `undefined`).
9331      // With 2 or more operators, the focus is moved on the operators control
9332      // (by setting the initial `activeId` to `null`), meaning that there won't
9333      // be an active item initially. Focus is then managed via the
9334      // `onFocusVisible` callback.
9335      filter.operators?.length === 1 ? void 0 : null
9336    );
9337    const currentFilter = view.filters?.find(
9338      (f2) => f2.field === filter.field
9339    );
9340    const currentValue = getCurrentValue(filter, currentFilter);
9341    return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
9342      import_components21.Composite,
9343      {
9344        virtualFocus: true,
9345        focusLoop: true,
9346        activeId: activeCompositeId,
9347        setActiveId: setActiveCompositeId,
9348        role: "listbox",
9349        className: "dataviews-filters__search-widget-listbox",
9350        "aria-label": (0, import_i18n21.sprintf)(
9351          /* translators: List of items for a filter. 1: Filter name. e.g.: "List of: Author". */
9352          (0, import_i18n21.__)("List of: %1$s"),
9353          filter.name
9354        ),
9355        onFocusVisible: () => {
9356          if (!activeCompositeId && filter.elements.length) {
9357            setActiveCompositeId(
9358              generateFilterElementCompositeItemId(
9359                baseId,
9360                filter.elements[0].value
9361              )
9362            );
9363          }
9364        },
9365        render: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_components21.Composite.Typeahead, {}),
9366        children: filter.elements.map((element) => /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
9367          import_components21.Composite.Hover,
9368          {
9369            render: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
9370              import_components21.Composite.Item,
9371              {
9372                id: generateFilterElementCompositeItemId(
9373                  baseId,
9374                  element.value
9375                ),
9376                render: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
9377                  "div",
9378                  {
9379                    "aria-label": element.label,
9380                    role: "option",
9381                    className: "dataviews-filters__search-widget-listitem"
9382                  }
9383                ),
9384                onClick: () => {
9385                  const newFilters = currentFilter ? [
9386                    ...(view.filters ?? []).map(
9387                      (_filter) => {
9388                        if (_filter.field === filter.field) {
9389                          return {
9390                            ..._filter,
9391                            operator: currentFilter.operator || filter.operators[0],
9392                            value: getNewValue(
9393                              filter,
9394                              currentFilter,
9395                              element.value
9396                            )
9397                          };
9398                        }
9399                        return _filter;
9400                      }
9401                    )
9402                  ] : [
9403                    ...view.filters ?? [],
9404                    {
9405                      field: filter.field,
9406                      operator: filter.operators[0],
9407                      value: getNewValue(
9408                        filter,
9409                        currentFilter,
9410                        element.value
9411                      )
9412                    }
9413                  ];
9414                  onChangeView({
9415                    ...view,
9416                    page: 1,
9417                    filters: newFilters
9418                  });
9419                }
9420              }
9421            ),
9422            children: [
9423              filter.singleSelection && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
9424                SingleSelectionOption,
9425                {
9426                  selected: currentValue === element.value
9427                }
9428              ),
9429              !filter.singleSelection && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
9430                MultiSelectionOption,
9431                {
9432                  selected: currentValue.includes(element.value)
9433                }
9434              ),
9435              /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { children: element.label })
9436            ]
9437          },
9438          element.value
9439        ))
9440      }
9441    );
9442  }
9443  function ComboboxList22({ view, filter, onChangeView }) {
9444    const [searchValue, setSearchValue] = (0, import_element23.useState)("");
9445    const deferredSearchValue = (0, import_element23.useDeferredValue)(searchValue);
9446    const currentFilter = view.filters?.find(
9447      (_filter) => _filter.field === filter.field
9448    );
9449    const currentValue = getCurrentValue(filter, currentFilter);
9450    const matches = (0, import_element23.useMemo)(() => {
9451      const normalizedSearch = normalizeSearchInput(deferredSearchValue);
9452      return filter.elements.filter(
9453        (item) => normalizeSearchInput(item.label).includes(normalizedSearch)
9454      );
9455    }, [filter.elements, deferredSearchValue]);
9456    return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
9457      ComboboxProvider,
9458      {
9459        selectedValue: currentValue,
9460        setSelectedValue: (value) => {
9461          const newFilters = currentFilter ? [
9462            ...(view.filters ?? []).map((_filter) => {
9463              if (_filter.field === filter.field) {
9464                return {
9465                  ..._filter,
9466                  operator: currentFilter.operator || filter.operators[0],
9467                  value
9468                };
9469              }
9470              return _filter;
9471            })
9472          ] : [
9473            ...view.filters ?? [],
9474            {
9475              field: filter.field,
9476              operator: filter.operators[0],
9477              value
9478            }
9479          ];
9480          onChangeView({
9481            ...view,
9482            page: 1,
9483            filters: newFilters
9484          });
9485        },
9486        setValue: setSearchValue,
9487        children: [
9488          /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "dataviews-filters__search-widget-filter-combobox__wrapper", children: [
9489            /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
9490              ComboboxLabel,
9491              {
9492                render: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_components21.VisuallyHidden, { children: (0, import_i18n21.__)("Search items") }),
9493                children: (0, import_i18n21.__)("Search items")
9494              }
9495            ),
9496            /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
9497              Combobox,
9498              {
9499                autoSelect: "always",
9500                placeholder: (0, import_i18n21.__)("Search"),
9501                className: "dataviews-filters__search-widget-filter-combobox__input"
9502              }
9503            ),
9504            /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "dataviews-filters__search-widget-filter-combobox__icon", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_components21.Icon, { icon: search_default }) })
9505          ] }),
9506          /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
9507            ComboboxList,
9508            {
9509              className: "dataviews-filters__search-widget-filter-combobox-list",
9510              alwaysVisible: true,
9511              children: [
9512                matches.map((element) => {
9513                  return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
9514                    ComboboxItem,
9515                    {
9516                      resetValueOnSelect: false,
9517                      value: element.value,
9518                      className: "dataviews-filters__search-widget-listitem",
9519                      hideOnClick: false,
9520                      setValueOnClick: false,
9521                      focusOnHover: true,
9522                      children: [
9523                        filter.singleSelection && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
9524                          SingleSelectionOption,
9525                          {
9526                            selected: currentValue === element.value
9527                          }
9528                        ),
9529                        !filter.singleSelection && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
9530                          MultiSelectionOption,
9531                          {
9532                            selected: currentValue.includes(
9533                              element.value
9534                            )
9535                          }
9536                        ),
9537                        /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { children: [
9538                          /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
9539                            ComboboxItemValue,
9540                            {
9541                              className: "dataviews-filters__search-widget-filter-combobox-item-value",
9542                              value: element.label
9543                            }
9544                          ),
9545                          !!element.description && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "dataviews-filters__search-widget-listitem-description", children: element.description })
9546                        ] })
9547                      ]
9548                    },
9549                    element.value
9550                  );
9551                }),
9552                !matches.length && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { children: (0, import_i18n21.__)("No results found") })
9553              ]
9554            }
9555          )
9556        ]
9557      }
9558    );
9559  }
9560  function SearchWidget(props) {
9561    const { elements, isLoading } = useElements({
9562      elements: props.filter.elements,
9563      getElements: props.filter.getElements
9564    });
9565    if (isLoading) {
9566      return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "dataviews-filters__search-widget-no-elements", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_components21.Spinner, {}) });
9567    }
9568    if (elements.length === 0) {
9569      return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "dataviews-filters__search-widget-no-elements", children: (0, import_i18n21.__)("No elements found") });
9570    }
9571    const Widget = elements.length > 10 ? ComboboxList22 : ListBox;
9572    return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(Widget, { ...props, filter: { ...props.filter, elements } });
9573  }
9574  
9575  // packages/dataviews/build-module/components/dataviews-filters/input-widget.js
9576  var import_es6 = __toESM(require_es6());
9577  var import_compose8 = __toESM(require_compose());
9578  var import_element24 = __toESM(require_element());
9579  var import_components22 = __toESM(require_components());
9580  var import_jsx_runtime55 = __toESM(require_jsx_runtime());
9581  function InputWidget({
9582    filter,
9583    view,
9584    onChangeView,
9585    fields
9586  }) {
9587    const currentFilter = view.filters?.find(
9588      (f2) => f2.field === filter.field
9589    );
9590    const currentValue = getCurrentValue(filter, currentFilter);
9591    const field = (0, import_element24.useMemo)(() => {
9592      const currentField = fields.find((f2) => f2.id === filter.field);
9593      if (currentField) {
9594        return {
9595          ...currentField,
9596          // Deactivate validation for filters.
9597          isValid: {},
9598          // Configure getValue/setValue as if Item was a plain object.
9599          getValue: ({ item }) => item[currentField.id],
9600          setValue: ({ value }) => ({
9601            [currentField.id]: value
9602          })
9603        };
9604      }
9605      return currentField;
9606    }, [fields, filter.field]);
9607    const data = (0, import_element24.useMemo)(() => {
9608      return (view.filters ?? []).reduce(
9609        (acc, activeFilter) => {
9610          acc[activeFilter.field] = activeFilter.value;
9611          return acc;
9612        },
9613        {}
9614      );
9615    }, [view.filters]);
9616    const handleChange = (0, import_compose8.useEvent)((updatedData) => {
9617      if (!field || !currentFilter) {
9618        return;
9619      }
9620      const nextValue = field.getValue({ item: updatedData });
9621      if ((0, import_es6.default)(nextValue, currentValue)) {
9622        return;
9623      }
9624      onChangeView({
9625        ...view,
9626        filters: (view.filters ?? []).map(
9627          (_filter) => _filter.field === filter.field ? {
9628            ..._filter,
9629            operator: currentFilter.operator || filter.operators[0],
9630            // Consider empty strings as undefined:
9631            //
9632            // - undefined as value means the filter is unset: the filter widget displays no value and the search returns all records
9633            // - empty string as value means "search empty string": returns only the records that have an empty string as value
9634            //
9635            // In practice, this means the filter will not be able to find an empty string as the value.
9636            value: nextValue === "" ? void 0 : nextValue
9637          } : _filter
9638        )
9639      });
9640    });
9641    if (!field || !field.Edit || !currentFilter) {
9642      return null;
9643    }
9644    return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
9645      import_components22.Flex,
9646      {
9647        className: "dataviews-filters__user-input-widget",
9648        gap: 2.5,
9649        direction: "column",
9650        children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
9651          field.Edit,
9652          {
9653            hideLabelFromVision: true,
9654            data,
9655            field,
9656            operator: currentFilter.operator,
9657            onChange: handleChange
9658          }
9659        )
9660      }
9661    );
9662  }
9663  
9664  // packages/dataviews/build-module/utils/operators.js
9665  var import_i18n22 = __toESM(require_i18n());
9666  var import_element25 = __toESM(require_element());
9667  var import_jsx_runtime56 = __toESM(require_jsx_runtime());
9668  var filterTextWrappers = {
9669    Name: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "dataviews-filters__summary-filter-text-name" }),
9670    Value: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "dataviews-filters__summary-filter-text-value" })
9671  };
9672  var OPERATORS = [
9673    {
9674      name: OPERATOR_IS_ANY,
9675      /* translators: DataViews operator name */
9676      label: (0, import_i18n22.__)("Includes"),
9677      filterText: (filter, activeElements) => (0, import_element25.createInterpolateElement)(
9678        (0, import_i18n22.sprintf)(
9679          /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is any: Admin, Editor". */
9680          (0, import_i18n22.__)("<Name>%1$s includes: </Name><Value>%2$s</Value>"),
9681          filter.name,
9682          activeElements.map((element) => element.label).join(", ")
9683        ),
9684        filterTextWrappers
9685      ),
9686      selection: "multi"
9687    },
9688    {
9689      name: OPERATOR_IS_NONE,
9690      /* translators: DataViews operator name */
9691      label: (0, import_i18n22.__)("Is none of"),
9692      filterText: (filter, activeElements) => (0, import_element25.createInterpolateElement)(
9693        (0, import_i18n22.sprintf)(
9694          /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is none of: Admin, Editor". */
9695          (0, import_i18n22.__)("<Name>%1$s is none of: </Name><Value>%2$s</Value>"),
9696          filter.name,
9697          activeElements.map((element) => element.label).join(", ")
9698        ),
9699        filterTextWrappers
9700      ),
9701      selection: "multi"
9702    },
9703    {
9704      name: OPERATOR_IS_ALL,
9705      /* translators: DataViews operator name */
9706      label: (0, import_i18n22.__)("Includes all"),
9707      filterText: (filter, activeElements) => (0, import_element25.createInterpolateElement)(
9708        (0, import_i18n22.sprintf)(
9709          /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author includes all: Admin, Editor". */
9710          (0, import_i18n22.__)("<Name>%1$s includes all: </Name><Value>%2$s</Value>"),
9711          filter.name,
9712          activeElements.map((element) => element.label).join(", ")
9713        ),
9714        filterTextWrappers
9715      ),
9716      selection: "multi"
9717    },
9718    {
9719      name: OPERATOR_IS_NOT_ALL,
9720      /* translators: DataViews operator name */
9721      label: (0, import_i18n22.__)("Is none of"),
9722      filterText: (filter, activeElements) => (0, import_element25.createInterpolateElement)(
9723        (0, import_i18n22.sprintf)(
9724          /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is none of: Admin, Editor". */
9725          (0, import_i18n22.__)("<Name>%1$s is none of: </Name><Value>%2$s</Value>"),
9726          filter.name,
9727          activeElements.map((element) => element.label).join(", ")
9728        ),
9729        filterTextWrappers
9730      ),
9731      selection: "multi"
9732    },
9733    {
9734      name: OPERATOR_BETWEEN,
9735      /* translators: DataViews operator name */
9736      label: (0, import_i18n22.__)("Between (inc)"),
9737      filterText: (filter, activeElements) => (0, import_element25.createInterpolateElement)(
9738        (0, import_i18n22.sprintf)(
9739          /* 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". */
9740          (0, import_i18n22.__)(
9741            "<Name>%1$s between (inc): </Name><Value>%2$s and %3$s</Value>"
9742          ),
9743          filter.name,
9744          activeElements[0].label[0],
9745          activeElements[0].label[1]
9746        ),
9747        filterTextWrappers
9748      ),
9749      selection: "custom"
9750    },
9751    {
9752      name: OPERATOR_IN_THE_PAST,
9753      /* translators: DataViews operator name */
9754      label: (0, import_i18n22.__)("In the past"),
9755      filterText: (filter, activeElements) => (0, import_element25.createInterpolateElement)(
9756        (0, import_i18n22.sprintf)(
9757          /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "7 days"): "Date is in the past: 7 days". */
9758          (0, import_i18n22.__)(
9759            "<Name>%1$s is in the past: </Name><Value>%2$s</Value>"
9760          ),
9761          filter.name,
9762          `$activeElements[0].value.value} $activeElements[0].value.unit}`
9763        ),
9764        filterTextWrappers
9765      ),
9766      selection: "custom"
9767    },
9768    {
9769      name: OPERATOR_OVER,
9770      /* translators: DataViews operator name */
9771      label: (0, import_i18n22.__)("Over"),
9772      filterText: (filter, activeElements) => (0, import_element25.createInterpolateElement)(
9773        (0, import_i18n22.sprintf)(
9774          /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "7 days"): "Date is over: 7 days". */
9775          (0, import_i18n22.__)("<Name>%1$s is over: </Name><Value>%2$s</Value>"),
9776          filter.name,
9777          `$activeElements[0].value.value} $activeElements[0].value.unit}`
9778        ),
9779        filterTextWrappers
9780      ),
9781      selection: "custom"
9782    },
9783    {
9784      name: OPERATOR_IS,
9785      /* translators: DataViews operator name */
9786      label: (0, import_i18n22.__)("Is"),
9787      filterText: (filter, activeElements) => (0, import_element25.createInterpolateElement)(
9788        (0, import_i18n22.sprintf)(
9789          /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is: Admin". */
9790          (0, import_i18n22.__)("<Name>%1$s is: </Name><Value>%2$s</Value>"),
9791          filter.name,
9792          activeElements[0].label
9793        ),
9794        filterTextWrappers
9795      ),
9796      selection: "single"
9797    },
9798    {
9799      name: OPERATOR_IS_NOT,
9800      /* translators: DataViews operator name */
9801      label: (0, import_i18n22.__)("Is not"),
9802      filterText: (filter, activeElements) => (0, import_element25.createInterpolateElement)(
9803        (0, import_i18n22.sprintf)(
9804          /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is not: Admin". */
9805          (0, import_i18n22.__)("<Name>%1$s is not: </Name><Value>%2$s</Value>"),
9806          filter.name,
9807          activeElements[0].label
9808        ),
9809        filterTextWrappers
9810      ),
9811      selection: "single"
9812    },
9813    {
9814      name: OPERATOR_LESS_THAN,
9815      /* translators: DataViews operator name */
9816      label: (0, import_i18n22.__)("Less than"),
9817      filterText: (filter, activeElements) => (0, import_element25.createInterpolateElement)(
9818        (0, import_i18n22.sprintf)(
9819          /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is less than: 10". */
9820          (0, import_i18n22.__)("<Name>%1$s is less than: </Name><Value>%2$s</Value>"),
9821          filter.name,
9822          activeElements[0].label
9823        ),
9824        filterTextWrappers
9825      ),
9826      selection: "single"
9827    },
9828    {
9829      name: OPERATOR_GREATER_THAN,
9830      /* translators: DataViews operator name */
9831      label: (0, import_i18n22.__)("Greater than"),
9832      filterText: (filter, activeElements) => (0, import_element25.createInterpolateElement)(
9833        (0, import_i18n22.sprintf)(
9834          /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is greater than: 10". */
9835          (0, import_i18n22.__)(
9836            "<Name>%1$s is greater than: </Name><Value>%2$s</Value>"
9837          ),
9838          filter.name,
9839          activeElements[0].label
9840        ),
9841        filterTextWrappers
9842      ),
9843      selection: "single"
9844    },
9845    {
9846      name: OPERATOR_LESS_THAN_OR_EQUAL,
9847      /* translators: DataViews operator name */
9848      label: (0, import_i18n22.__)("Less than or equal"),
9849      filterText: (filter, activeElements) => (0, import_element25.createInterpolateElement)(
9850        (0, import_i18n22.sprintf)(
9851          /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is less than or equal to: 10". */
9852          (0, import_i18n22.__)(
9853            "<Name>%1$s is less than or equal to: </Name><Value>%2$s</Value>"
9854          ),
9855          filter.name,
9856          activeElements[0].label
9857        ),
9858        filterTextWrappers
9859      ),
9860      selection: "single"
9861    },
9862    {
9863      name: OPERATOR_GREATER_THAN_OR_EQUAL,
9864      /* translators: DataViews operator name */
9865      label: (0, import_i18n22.__)("Greater than or equal"),
9866      filterText: (filter, activeElements) => (0, import_element25.createInterpolateElement)(
9867        (0, import_i18n22.sprintf)(
9868          /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is greater than or equal to: 10". */
9869          (0, import_i18n22.__)(
9870            "<Name>%1$s is greater than or equal to: </Name><Value>%2$s</Value>"
9871          ),
9872          filter.name,
9873          activeElements[0].label
9874        ),
9875        filterTextWrappers
9876      ),
9877      selection: "single"
9878    },
9879    {
9880      name: OPERATOR_BEFORE,
9881      /* translators: DataViews operator name */
9882      label: (0, import_i18n22.__)("Before"),
9883      filterText: (filter, activeElements) => (0, import_element25.createInterpolateElement)(
9884        (0, import_i18n22.sprintf)(
9885          /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is before: 2024-01-01". */
9886          (0, import_i18n22.__)("<Name>%1$s is before: </Name><Value>%2$s</Value>"),
9887          filter.name,
9888          activeElements[0].label
9889        ),
9890        filterTextWrappers
9891      ),
9892      selection: "single"
9893    },
9894    {
9895      name: OPERATOR_AFTER,
9896      /* translators: DataViews operator name */
9897      label: (0, import_i18n22.__)("After"),
9898      filterText: (filter, activeElements) => (0, import_element25.createInterpolateElement)(
9899        (0, import_i18n22.sprintf)(
9900          /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is after: 2024-01-01". */
9901          (0, import_i18n22.__)("<Name>%1$s is after: </Name><Value>%2$s</Value>"),
9902          filter.name,
9903          activeElements[0].label
9904        ),
9905        filterTextWrappers
9906      ),
9907      selection: "single"
9908    },
9909    {
9910      name: OPERATOR_BEFORE_INC,
9911      /* translators: DataViews operator name */
9912      label: (0, import_i18n22.__)("Before (inc)"),
9913      filterText: (filter, activeElements) => (0, import_element25.createInterpolateElement)(
9914        (0, import_i18n22.sprintf)(
9915          /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is on or before: 2024-01-01". */
9916          (0, import_i18n22.__)(
9917            "<Name>%1$s is on or before: </Name><Value>%2$s</Value>"
9918          ),
9919          filter.name,
9920          activeElements[0].label
9921        ),
9922        filterTextWrappers
9923      ),
9924      selection: "single"
9925    },
9926    {
9927      name: OPERATOR_AFTER_INC,
9928      /* translators: DataViews operator name */
9929      label: (0, import_i18n22.__)("After (inc)"),
9930      filterText: (filter, activeElements) => (0, import_element25.createInterpolateElement)(
9931        (0, import_i18n22.sprintf)(
9932          /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is on or after: 2024-01-01". */
9933          (0, import_i18n22.__)(
9934            "<Name>%1$s is on or after: </Name><Value>%2$s</Value>"
9935          ),
9936          filter.name,
9937          activeElements[0].label
9938        ),
9939        filterTextWrappers
9940      ),
9941      selection: "single"
9942    },
9943    {
9944      name: OPERATOR_CONTAINS,
9945      /* translators: DataViews operator name */
9946      label: (0, import_i18n22.__)("Contains"),
9947      filterText: (filter, activeElements) => (0, import_element25.createInterpolateElement)(
9948        (0, import_i18n22.sprintf)(
9949          /* translators: 1: Filter name (e.g. "Title"). 2: Filter value (e.g. "Hello"): "Title contains: Hello". */
9950          (0, import_i18n22.__)("<Name>%1$s contains: </Name><Value>%2$s</Value>"),
9951          filter.name,
9952          activeElements[0].label
9953        ),
9954        filterTextWrappers
9955      ),
9956      selection: "single"
9957    },
9958    {
9959      name: OPERATOR_NOT_CONTAINS,
9960      /* translators: DataViews operator name */
9961      label: (0, import_i18n22.__)("Doesn't contain"),
9962      filterText: (filter, activeElements) => (0, import_element25.createInterpolateElement)(
9963        (0, import_i18n22.sprintf)(
9964          /* translators: 1: Filter name (e.g. "Title"). 2: Filter value (e.g. "Hello"): "Title doesn't contain: Hello". */
9965          (0, import_i18n22.__)(
9966            "<Name>%1$s doesn't contain: </Name><Value>%2$s</Value>"
9967          ),
9968          filter.name,
9969          activeElements[0].label
9970        ),
9971        filterTextWrappers
9972      ),
9973      selection: "single"
9974    },
9975    {
9976      name: OPERATOR_STARTS_WITH,
9977      /* translators: DataViews operator name */
9978      label: (0, import_i18n22.__)("Starts with"),
9979      filterText: (filter, activeElements) => (0, import_element25.createInterpolateElement)(
9980        (0, import_i18n22.sprintf)(
9981          /* translators: 1: Filter name (e.g. "Title"). 2: Filter value (e.g. "Hello"): "Title starts with: Hello". */
9982          (0, import_i18n22.__)("<Name>%1$s starts with: </Name><Value>%2$s</Value>"),
9983          filter.name,
9984          activeElements[0].label
9985        ),
9986        filterTextWrappers
9987      ),
9988      selection: "single"
9989    },
9990    {
9991      name: OPERATOR_ON,
9992      /* translators: DataViews operator name */
9993      label: (0, import_i18n22.__)("On"),
9994      filterText: (filter, activeElements) => (0, import_element25.createInterpolateElement)(
9995        (0, import_i18n22.sprintf)(
9996          /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is: 2024-01-01". */
9997          (0, import_i18n22.__)("<Name>%1$s is: </Name><Value>%2$s</Value>"),
9998          filter.name,
9999          activeElements[0].label
10000        ),
10001        filterTextWrappers
10002      ),
10003      selection: "single"
10004    },
10005    {
10006      name: OPERATOR_NOT_ON,
10007      /* translators: DataViews operator name */
10008      label: (0, import_i18n22.__)("Not on"),
10009      filterText: (filter, activeElements) => (0, import_element25.createInterpolateElement)(
10010        (0, import_i18n22.sprintf)(
10011          /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is not: 2024-01-01". */
10012          (0, import_i18n22.__)("<Name>%1$s is not: </Name><Value>%2$s</Value>"),
10013          filter.name,
10014          activeElements[0].label
10015        ),
10016        filterTextWrappers
10017      ),
10018      selection: "single"
10019    }
10020  ];
10021  var getOperatorByName = (name) => OPERATORS.find((op) => op.name === name);
10022  var getAllOperatorNames = () => OPERATORS.map((op) => op.name);
10023  var isSingleSelectionOperator = (name) => OPERATORS.filter((op) => op.selection === "single").some(
10024    (op) => op.name === name
10025  );
10026  var isRegisteredOperator = (name) => OPERATORS.some((op) => op.name === name);
10027  
10028  // packages/dataviews/build-module/components/dataviews-filters/filter.js
10029  var import_jsx_runtime57 = __toESM(require_jsx_runtime());
10030  var ENTER = "Enter";
10031  var SPACE = " ";
10032  var FilterText = ({
10033    activeElements,
10034    filterInView,
10035    filter
10036  }) => {
10037    if (activeElements === void 0 || activeElements.length === 0) {
10038      return filter.name;
10039    }
10040    const operator = getOperatorByName(filterInView?.operator);
10041    if (operator !== void 0) {
10042      return operator.filterText(filter, activeElements);
10043    }
10044    return (0, import_i18n23.sprintf)(
10045      /* translators: 1: Filter name e.g.: "Unknown status for Author". */
10046      (0, import_i18n23.__)("Unknown status for %1$s"),
10047      filter.name
10048    );
10049  };
10050  function OperatorSelector({
10051    filter,
10052    view,
10053    onChangeView
10054  }) {
10055    const operatorOptions = filter.operators?.map((operator) => ({
10056      value: operator,
10057      label: getOperatorByName(operator)?.label || operator
10058    }));
10059    const currentFilter = view.filters?.find(
10060      (_filter) => _filter.field === filter.field
10061    );
10062    const value = currentFilter?.operator || filter.operators[0];
10063    return operatorOptions.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
10064      import_components23.__experimentalHStack,
10065      {
10066        spacing: 2,
10067        justify: "flex-start",
10068        className: "dataviews-filters__summary-operators-container",
10069        children: [
10070          /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_components23.FlexItem, { className: "dataviews-filters__summary-operators-filter-name", children: filter.name }),
10071          /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
10072            import_components23.SelectControl,
10073            {
10074              className: "dataviews-filters__summary-operators-filter-select",
10075              label: (0, import_i18n23.__)("Conditions"),
10076              value,
10077              options: operatorOptions,
10078              onChange: (newValue) => {
10079                const newOperator = newValue;
10080                const currentOperator = currentFilter?.operator;
10081                const newFilters = currentFilter ? [
10082                  ...(view.filters ?? []).map(
10083                    (_filter) => {
10084                      if (_filter.field === filter.field) {
10085                        const currentOpSelectionModel = getOperatorByName(
10086                          currentOperator
10087                        )?.selection;
10088                        const newOpSelectionModel = getOperatorByName(
10089                          newOperator
10090                        )?.selection;
10091                        const shouldResetValue = currentOpSelectionModel !== newOpSelectionModel || [
10092                          currentOpSelectionModel,
10093                          newOpSelectionModel
10094                        ].includes("custom");
10095                        return {
10096                          ..._filter,
10097                          value: shouldResetValue ? void 0 : _filter.value,
10098                          operator: newOperator
10099                        };
10100                      }
10101                      return _filter;
10102                    }
10103                  )
10104                ] : [
10105                  ...view.filters ?? [],
10106                  {
10107                    field: filter.field,
10108                    operator: newOperator,
10109                    value: void 0
10110                  }
10111                ];
10112                onChangeView({
10113                  ...view,
10114                  page: 1,
10115                  filters: newFilters
10116                });
10117              },
10118              size: "small",
10119              variant: "minimal",
10120              hideLabelFromVision: true
10121            }
10122          )
10123        ]
10124      }
10125    );
10126  }
10127  function Filter({
10128    addFilterRef,
10129    openedFilter,
10130    fields,
10131    ...commonProps
10132  }) {
10133    const toggleRef = (0, import_element26.useRef)(null);
10134    const { filter, view, onChangeView } = commonProps;
10135    const filterInView = view.filters?.find(
10136      (f2) => f2.field === filter.field
10137    );
10138    let activeElements = [];
10139    const field = (0, import_element26.useMemo)(() => {
10140      const currentField = fields.find((f2) => f2.id === filter.field);
10141      if (currentField) {
10142        return {
10143          ...currentField,
10144          // Configure getValue as if Item was a plain object.
10145          // See related input-widget.tsx
10146          getValue: ({ item }) => item[currentField.id]
10147        };
10148      }
10149      return currentField;
10150    }, [fields, filter.field]);
10151    const { elements } = useElements({
10152      elements: filter.elements,
10153      getElements: filter.getElements
10154    });
10155    if (elements.length > 0) {
10156      activeElements = elements.filter((element) => {
10157        if (filter.singleSelection) {
10158          return element.value === filterInView?.value;
10159        }
10160        return filterInView?.value?.includes(element.value);
10161      });
10162    } else if (Array.isArray(filterInView?.value)) {
10163      const label = filterInView.value.map((v2) => {
10164        const formattedValue = field?.getValueFormatted({
10165          item: { [field.id]: v2 },
10166          field
10167        });
10168        return formattedValue || String(v2);
10169      });
10170      activeElements = [
10171        {
10172          value: filterInView.value,
10173          // @ts-ignore
10174          label
10175        }
10176      ];
10177    } else if (typeof filterInView?.value === "object") {
10178      activeElements = [
10179        { value: filterInView.value, label: filterInView.value }
10180      ];
10181    } else if (filterInView?.value !== void 0) {
10182      const label = field !== void 0 ? field.getValueFormatted({
10183        item: { [field.id]: filterInView.value },
10184        field
10185      }) : String(filterInView.value);
10186      activeElements = [
10187        {
10188          value: filterInView.value,
10189          label
10190        }
10191      ];
10192    }
10193    const isPrimary = filter.isPrimary;
10194    const isLocked = filterInView?.isLocked;
10195    const hasValues = !isLocked && filterInView?.value !== void 0;
10196    const canResetOrRemove = !isLocked && (!isPrimary || hasValues);
10197    return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
10198      import_components23.Dropdown,
10199      {
10200        defaultOpen: openedFilter === filter.field,
10201        contentClassName: "dataviews-filters__summary-popover",
10202        popoverProps: { placement: "bottom-start", role: "dialog" },
10203        onClose: () => {
10204          toggleRef.current?.focus();
10205        },
10206        renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "dataviews-filters__summary-chip-container", children: [
10207          /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
10208            import_components23.Tooltip,
10209            {
10210              text: (0, import_i18n23.sprintf)(
10211                /* translators: 1: Filter name. */
10212                (0, import_i18n23.__)("Filter by: %1$s"),
10213                filter.name.toLowerCase()
10214              ),
10215              placement: "top",
10216              children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
10217                "div",
10218                {
10219                  className: clsx_default(
10220                    "dataviews-filters__summary-chip",
10221                    {
10222                      "has-reset": canResetOrRemove,
10223                      "has-values": hasValues,
10224                      "is-not-clickable": isLocked
10225                    }
10226                  ),
10227                  role: "button",
10228                  tabIndex: isLocked ? -1 : 0,
10229                  onClick: () => {
10230                    if (!isLocked) {
10231                      onToggle();
10232                    }
10233                  },
10234                  onKeyDown: (event) => {
10235                    if (!isLocked && [ENTER, SPACE].includes(event.key)) {
10236                      onToggle();
10237                      event.preventDefault();
10238                    }
10239                  },
10240                  "aria-disabled": isLocked,
10241                  "aria-pressed": isOpen,
10242                  "aria-expanded": isOpen,
10243                  ref: toggleRef,
10244                  children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
10245                    FilterText,
10246                    {
10247                      activeElements,
10248                      filterInView,
10249                      filter
10250                    }
10251                  )
10252                }
10253              )
10254            }
10255          ),
10256          canResetOrRemove && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
10257            import_components23.Tooltip,
10258            {
10259              text: isPrimary ? (0, import_i18n23.__)("Reset") : (0, import_i18n23.__)("Remove"),
10260              placement: "top",
10261              children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
10262                "button",
10263                {
10264                  className: clsx_default(
10265                    "dataviews-filters__summary-chip-remove",
10266                    { "has-values": hasValues }
10267                  ),
10268                  onClick: () => {
10269                    onChangeView({
10270                      ...view,
10271                      page: 1,
10272                      filters: view.filters?.filter(
10273                        (_filter) => _filter.field !== filter.field
10274                      )
10275                    });
10276                    if (!isPrimary) {
10277                      addFilterRef.current?.focus();
10278                    } else {
10279                      toggleRef.current?.focus();
10280                    }
10281                  },
10282                  children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_components23.Icon, { icon: close_small_default })
10283                }
10284              )
10285            }
10286          )
10287        ] }),
10288        renderContent: () => {
10289          return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_components23.__experimentalVStack, { spacing: 0, justify: "flex-start", children: [
10290            /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(OperatorSelector, { ...commonProps }),
10291            commonProps.filter.hasElements ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
10292              SearchWidget,
10293              {
10294                ...commonProps,
10295                filter: {
10296                  ...commonProps.filter,
10297                  elements
10298                }
10299              }
10300            ) : /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(InputWidget, { ...commonProps, fields })
10301          ] });
10302        }
10303      }
10304    );
10305  }
10306  
10307  // packages/dataviews/build-module/components/dataviews-filters/add-filter.js
10308  var import_components24 = __toESM(require_components());
10309  var import_i18n24 = __toESM(require_i18n());
10310  var import_element27 = __toESM(require_element());
10311  var import_jsx_runtime58 = __toESM(require_jsx_runtime());
10312  var { Menu: Menu4 } = unlock(import_components24.privateApis);
10313  function AddFilterMenu({
10314    filters,
10315    view,
10316    onChangeView,
10317    setOpenedFilter,
10318    triggerProps
10319  }) {
10320    const inactiveFilters = filters.filter((filter) => !filter.isVisible);
10321    return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(Menu4, { children: [
10322      /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Menu4.TriggerButton, { ...triggerProps }),
10323      /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Menu4.Popover, { children: inactiveFilters.map((filter) => {
10324        return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
10325          Menu4.Item,
10326          {
10327            onClick: () => {
10328              setOpenedFilter(filter.field);
10329              onChangeView({
10330                ...view,
10331                page: 1,
10332                filters: [
10333                  ...view.filters || [],
10334                  {
10335                    field: filter.field,
10336                    value: void 0,
10337                    operator: filter.operators[0]
10338                  }
10339                ]
10340              });
10341            },
10342            children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Menu4.ItemLabel, { children: filter.name })
10343          },
10344          filter.field
10345        );
10346      }) })
10347    ] });
10348  }
10349  function AddFilter({ filters, view, onChangeView, setOpenedFilter }, ref) {
10350    if (!filters.length || filters.every(({ isPrimary }) => isPrimary)) {
10351      return null;
10352    }
10353    const inactiveFilters = filters.filter((filter) => !filter.isVisible);
10354    return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
10355      AddFilterMenu,
10356      {
10357        triggerProps: {
10358          render: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
10359            import_components24.Button,
10360            {
10361              accessibleWhenDisabled: true,
10362              size: "compact",
10363              className: "dataviews-filters-button",
10364              variant: "tertiary",
10365              disabled: !inactiveFilters.length,
10366              ref
10367            }
10368          ),
10369          children: (0, import_i18n24.__)("Add filter")
10370        },
10371        ...{ filters, view, onChangeView, setOpenedFilter }
10372      }
10373    );
10374  }
10375  var add_filter_default = (0, import_element27.forwardRef)(AddFilter);
10376  
10377  // packages/dataviews/build-module/components/dataviews-filters/reset-filters.js
10378  var import_components25 = __toESM(require_components());
10379  var import_i18n25 = __toESM(require_i18n());
10380  var import_jsx_runtime59 = __toESM(require_jsx_runtime());
10381  function ResetFilter({
10382    filters,
10383    view,
10384    onChangeView
10385  }) {
10386    const isPrimary = (field) => filters.some(
10387      (_filter) => _filter.field === field && _filter.isPrimary
10388    );
10389    const isDisabled = !view.search && !view.filters?.some(
10390      (_filter) => !_filter.isLocked && (_filter.value !== void 0 || !isPrimary(_filter.field))
10391    );
10392    return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
10393      import_components25.Button,
10394      {
10395        disabled: isDisabled,
10396        accessibleWhenDisabled: true,
10397        size: "compact",
10398        variant: "tertiary",
10399        className: "dataviews-filters__reset-button",
10400        onClick: () => {
10401          onChangeView({
10402            ...view,
10403            page: 1,
10404            search: "",
10405            filters: view.filters?.filter((f2) => !!f2.isLocked) || []
10406          });
10407        },
10408        children: (0, import_i18n25.__)("Reset")
10409      }
10410    );
10411  }
10412  
10413  // packages/dataviews/build-module/components/dataviews-filters/use-filters.js
10414  var import_element28 = __toESM(require_element());
10415  function useFilters(fields, view) {
10416    return (0, import_element28.useMemo)(() => {
10417      const filters = [];
10418      fields.forEach((field) => {
10419        if (field.filterBy === false || !field.hasElements && !field.Edit) {
10420          return;
10421        }
10422        const operators = field.filterBy.operators;
10423        const isPrimary = !!field.filterBy?.isPrimary;
10424        const isLocked = view.filters?.some(
10425          (f2) => f2.field === field.id && !!f2.isLocked
10426        ) ?? false;
10427        filters.push({
10428          field: field.id,
10429          name: field.label,
10430          elements: field.elements,
10431          getElements: field.getElements,
10432          hasElements: field.hasElements,
10433          singleSelection: operators.some(
10434            (op) => isSingleSelectionOperator(op)
10435          ),
10436          operators,
10437          isVisible: isLocked || isPrimary || !!view.filters?.some(
10438            (f2) => f2.field === field.id && isRegisteredOperator(f2.operator)
10439          ),
10440          isPrimary,
10441          isLocked
10442        });
10443      });
10444      filters.sort((a2, b2) => {
10445        if (a2.isLocked && !b2.isLocked) {
10446          return -1;
10447        }
10448        if (!a2.isLocked && b2.isLocked) {
10449          return 1;
10450        }
10451        if (a2.isPrimary && !b2.isPrimary) {
10452          return -1;
10453        }
10454        if (!a2.isPrimary && b2.isPrimary) {
10455          return 1;
10456        }
10457        return a2.name.localeCompare(b2.name);
10458      });
10459      return filters;
10460    }, [fields, view]);
10461  }
10462  var use_filters_default = useFilters;
10463  
10464  // packages/dataviews/build-module/components/dataviews-filters/filters.js
10465  var import_jsx_runtime60 = __toESM(require_jsx_runtime());
10466  function Filters({ className }) {
10467    const { fields, view, onChangeView, openedFilter, setOpenedFilter } = (0, import_element29.useContext)(dataviews_context_default);
10468    const addFilterRef = (0, import_element29.useRef)(null);
10469    const filters = use_filters_default(fields, view);
10470    const addFilter = /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
10471      add_filter_default,
10472      {
10473        filters,
10474        view,
10475        onChangeView,
10476        ref: addFilterRef,
10477        setOpenedFilter
10478      },
10479      "add-filter"
10480    );
10481    const visibleFilters = filters.filter((filter) => filter.isVisible);
10482    if (visibleFilters.length === 0) {
10483      return null;
10484    }
10485    const filterComponents = [
10486      ...visibleFilters.map((filter) => {
10487        return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
10488          Filter,
10489          {
10490            filter,
10491            view,
10492            fields,
10493            onChangeView,
10494            addFilterRef,
10495            openedFilter
10496          },
10497          filter.field
10498        );
10499      }),
10500      addFilter
10501    ];
10502    filterComponents.push(
10503      /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
10504        ResetFilter,
10505        {
10506          filters,
10507          view,
10508          onChangeView
10509        },
10510        "reset-filters"
10511      )
10512    );
10513    return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
10514      import_components26.__experimentalHStack,
10515      {
10516        justify: "flex-start",
10517        style: { width: "fit-content" },
10518        wrap: true,
10519        className,
10520        children: filterComponents
10521      }
10522    );
10523  }
10524  var filters_default = (0, import_element29.memo)(Filters);
10525  
10526  // packages/dataviews/build-module/components/dataviews-filters/toggle.js
10527  var import_element30 = __toESM(require_element());
10528  var import_components27 = __toESM(require_components());
10529  var import_i18n26 = __toESM(require_i18n());
10530  var import_jsx_runtime61 = __toESM(require_jsx_runtime());
10531  function FiltersToggle() {
10532    const {
10533      filters,
10534      view,
10535      onChangeView,
10536      setOpenedFilter,
10537      isShowingFilter,
10538      setIsShowingFilter
10539    } = (0, import_element30.useContext)(dataviews_context_default);
10540    const buttonRef = (0, import_element30.useRef)(null);
10541    const onChangeViewWithFilterVisibility = (0, import_element30.useCallback)(
10542      (_view) => {
10543        onChangeView(_view);
10544        setIsShowingFilter(true);
10545      },
10546      [onChangeView, setIsShowingFilter]
10547    );
10548    const visibleFilters = filters.filter((filter) => filter.isVisible);
10549    const hasVisibleFilters = !!visibleFilters.length;
10550    if (filters.length === 0) {
10551      return null;
10552    }
10553    const addFilterButtonProps = {
10554      label: (0, import_i18n26.__)("Add filter"),
10555      "aria-expanded": false,
10556      isPressed: false
10557    };
10558    const toggleFiltersButtonProps = {
10559      label: (0, import_i18n26._x)("Filter", "verb"),
10560      "aria-expanded": isShowingFilter,
10561      isPressed: isShowingFilter,
10562      onClick: () => {
10563        if (!isShowingFilter) {
10564          setOpenedFilter(null);
10565        }
10566        setIsShowingFilter(!isShowingFilter);
10567      }
10568    };
10569    const buttonComponent = /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
10570      import_components27.Button,
10571      {
10572        ref: buttonRef,
10573        className: "dataviews-filters__visibility-toggle",
10574        size: "compact",
10575        icon: funnel_default,
10576        ...hasVisibleFilters ? toggleFiltersButtonProps : addFilterButtonProps
10577      }
10578    );
10579    return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "dataviews-filters__container-visibility-toggle", children: !hasVisibleFilters ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
10580      AddFilterMenu,
10581      {
10582        filters,
10583        view,
10584        onChangeView: onChangeViewWithFilterVisibility,
10585        setOpenedFilter,
10586        triggerProps: { render: buttonComponent }
10587      }
10588    ) : /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
10589      FilterVisibilityToggle,
10590      {
10591        buttonRef,
10592        filtersCount: view.filters?.length,
10593        children: buttonComponent
10594      }
10595    ) });
10596  }
10597  function FilterVisibilityToggle({
10598    buttonRef,
10599    filtersCount,
10600    children
10601  }) {
10602    (0, import_element30.useEffect)(
10603      () => () => {
10604        buttonRef.current?.focus();
10605      },
10606      [buttonRef]
10607    );
10608    return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_jsx_runtime61.Fragment, { children: [
10609      children,
10610      !!filtersCount && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "dataviews-filters-toggle__count", children: filtersCount })
10611    ] });
10612  }
10613  var toggle_default = FiltersToggle;
10614  
10615  // packages/dataviews/build-module/components/dataviews-filters/filters-toggled.js
10616  var import_element31 = __toESM(require_element());
10617  var import_jsx_runtime62 = __toESM(require_jsx_runtime());
10618  function FiltersToggled(props) {
10619    const { isShowingFilter } = (0, import_element31.useContext)(dataviews_context_default);
10620    if (!isShowingFilter) {
10621      return null;
10622    }
10623    return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(filters_default, { ...props });
10624  }
10625  var filters_toggled_default = FiltersToggled;
10626  
10627  // packages/dataviews/build-module/components/dataviews-layout/index.js
10628  var import_element32 = __toESM(require_element());
10629  var import_i18n27 = __toESM(require_i18n());
10630  var import_jsx_runtime63 = __toESM(require_jsx_runtime());
10631  function DataViewsLayout({ className }) {
10632    const {
10633      actions = [],
10634      data,
10635      fields,
10636      getItemId: getItemId2,
10637      getItemLevel: getItemLevel2,
10638      isLoading,
10639      view,
10640      onChangeView,
10641      selection,
10642      onChangeSelection,
10643      setOpenedFilter,
10644      onClickItem,
10645      isItemClickable,
10646      renderItemLink,
10647      defaultLayouts,
10648      empty = /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("p", { children: (0, import_i18n27.__)("No results") })
10649    } = (0, import_element32.useContext)(dataviews_context_default);
10650    const ViewComponent = VIEW_LAYOUTS.find(
10651      (v2) => v2.type === view.type && defaultLayouts[v2.type]
10652    )?.component;
10653    return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
10654      ViewComponent,
10655      {
10656        className,
10657        actions,
10658        data,
10659        fields,
10660        getItemId: getItemId2,
10661        getItemLevel: getItemLevel2,
10662        isLoading,
10663        onChangeView,
10664        onChangeSelection,
10665        selection,
10666        setOpenedFilter,
10667        onClickItem,
10668        renderItemLink,
10669        isItemClickable,
10670        view,
10671        empty
10672      }
10673    );
10674  }
10675  
10676  // packages/dataviews/build-module/components/dataviews-footer/index.js
10677  var import_components28 = __toESM(require_components());
10678  var import_element33 = __toESM(require_element());
10679  var import_jsx_runtime64 = __toESM(require_jsx_runtime());
10680  var EMPTY_ARRAY4 = [];
10681  function DataViewsFooter() {
10682    const {
10683      view,
10684      paginationInfo: { totalItems = 0, totalPages },
10685      data,
10686      actions = EMPTY_ARRAY4
10687    } = (0, import_element33.useContext)(dataviews_context_default);
10688    const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data) && [LAYOUT_TABLE, LAYOUT_GRID].includes(view.type);
10689    if (!totalItems || !totalPages || totalPages <= 1 && !hasBulkActions) {
10690      return null;
10691    }
10692    return !!totalItems && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
10693      import_components28.__experimentalHStack,
10694      {
10695        expanded: false,
10696        justify: "end",
10697        className: "dataviews-footer",
10698        children: [
10699          hasBulkActions && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(BulkActionsFooter, {}),
10700          /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(dataviews_pagination_default, {})
10701        ]
10702      }
10703    );
10704  }
10705  
10706  // packages/dataviews/build-module/components/dataviews-search/index.js
10707  var import_i18n28 = __toESM(require_i18n());
10708  var import_element34 = __toESM(require_element());
10709  var import_components29 = __toESM(require_components());
10710  var import_compose9 = __toESM(require_compose());
10711  var import_jsx_runtime65 = __toESM(require_jsx_runtime());
10712  var DataViewsSearch = (0, import_element34.memo)(function Search({ label }) {
10713    const { view, onChangeView } = (0, import_element34.useContext)(dataviews_context_default);
10714    const [search, setSearch, debouncedSearch] = (0, import_compose9.useDebouncedInput)(
10715      view.search
10716    );
10717    (0, import_element34.useEffect)(() => {
10718      setSearch(view.search ?? "");
10719    }, [view.search, setSearch]);
10720    const onChangeViewRef = (0, import_element34.useRef)(onChangeView);
10721    const viewRef = (0, import_element34.useRef)(view);
10722    (0, import_element34.useEffect)(() => {
10723      onChangeViewRef.current = onChangeView;
10724      viewRef.current = view;
10725    }, [onChangeView, view]);
10726    (0, import_element34.useEffect)(() => {
10727      if (debouncedSearch !== viewRef.current?.search) {
10728        onChangeViewRef.current({
10729          ...viewRef.current,
10730          page: 1,
10731          search: debouncedSearch
10732        });
10733      }
10734    }, [debouncedSearch]);
10735    const searchLabel = label || (0, import_i18n28.__)("Search");
10736    return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
10737      import_components29.SearchControl,
10738      {
10739        className: "dataviews-search",
10740        onChange: setSearch,
10741        value: search,
10742        label: searchLabel,
10743        placeholder: searchLabel,
10744        size: "compact"
10745      }
10746    );
10747  });
10748  var dataviews_search_default = DataViewsSearch;
10749  
10750  // packages/dataviews/build-module/components/dataviews-view-config/index.js
10751  var import_components31 = __toESM(require_components());
10752  var import_i18n30 = __toESM(require_i18n());
10753  var import_element36 = __toESM(require_element());
10754  var import_warning = __toESM(require_warning());
10755  var import_compose10 = __toESM(require_compose());
10756  
10757  // packages/dataviews/build-module/components/dataviews-view-config/infinite-scroll-toggle.js
10758  var import_components30 = __toESM(require_components());
10759  var import_i18n29 = __toESM(require_i18n());
10760  var import_element35 = __toESM(require_element());
10761  var import_jsx_runtime66 = __toESM(require_jsx_runtime());
10762  function InfiniteScrollToggle() {
10763    const context = (0, import_element35.useContext)(dataviews_context_default);
10764    const { view, onChangeView } = context;
10765    const infiniteScrollEnabled = view.infiniteScrollEnabled ?? false;
10766    if (!context.hasInfiniteScrollHandler) {
10767      return null;
10768    }
10769    return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
10770      import_components30.ToggleControl,
10771      {
10772        label: (0, import_i18n29.__)("Enable infinite scroll"),
10773        help: (0, import_i18n29.__)(
10774          "Automatically load more content as you scroll, instead of showing pagination links."
10775        ),
10776        checked: infiniteScrollEnabled,
10777        onChange: (newValue) => {
10778          onChangeView({
10779            ...view,
10780            infiniteScrollEnabled: newValue
10781          });
10782        }
10783      }
10784    );
10785  }
10786  
10787  // packages/dataviews/build-module/components/dataviews-view-config/index.js
10788  var import_jsx_runtime67 = __toESM(require_jsx_runtime());
10789  var { Menu: Menu5 } = unlock(import_components31.privateApis);
10790  var DATAVIEWS_CONFIG_POPOVER_PROPS = {
10791    className: "dataviews-config__popover",
10792    placement: "bottom-end",
10793    offset: 9
10794  };
10795  function ViewTypeMenu() {
10796    const { view, onChangeView, defaultLayouts } = (0, import_element36.useContext)(dataviews_context_default);
10797    const availableLayouts = Object.keys(defaultLayouts);
10798    if (availableLayouts.length <= 1) {
10799      return null;
10800    }
10801    const activeView = VIEW_LAYOUTS.find((v2) => view.type === v2.type);
10802    return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(Menu5, { children: [
10803      /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
10804        Menu5.TriggerButton,
10805        {
10806          render: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
10807            import_components31.Button,
10808            {
10809              size: "compact",
10810              icon: activeView?.icon,
10811              label: (0, import_i18n30.__)("Layout")
10812            }
10813          )
10814        }
10815      ),
10816      /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Menu5.Popover, { children: availableLayouts.map((layout) => {
10817        const config = VIEW_LAYOUTS.find(
10818          (v2) => v2.type === layout
10819        );
10820        if (!config) {
10821          return null;
10822        }
10823        return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
10824          Menu5.RadioItem,
10825          {
10826            value: layout,
10827            name: "view-actions-available-view",
10828            checked: layout === view.type,
10829            hideOnClick: true,
10830            onChange: (e2) => {
10831              switch (e2.target.value) {
10832                case "list":
10833                case "grid":
10834                case "table":
10835                case "pickerGrid":
10836                case "pickerTable":
10837                case "activity":
10838                  const viewWithoutLayout = { ...view };
10839                  if ("layout" in viewWithoutLayout) {
10840                    delete viewWithoutLayout.layout;
10841                  }
10842                  return onChangeView({
10843                    ...viewWithoutLayout,
10844                    type: e2.target.value,
10845                    ...defaultLayouts[e2.target.value]
10846                  });
10847              }
10848              (0, import_warning.default)("Invalid dataview");
10849            },
10850            children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Menu5.ItemLabel, { children: config.label })
10851          },
10852          layout
10853        );
10854      }) })
10855    ] });
10856  }
10857  function SortFieldControl() {
10858    const { view, fields, onChangeView } = (0, import_element36.useContext)(dataviews_context_default);
10859    const orderOptions = (0, import_element36.useMemo)(() => {
10860      const sortableFields = fields.filter(
10861        (field) => field.enableSorting !== false
10862      );
10863      return sortableFields.map((field) => {
10864        return {
10865          label: field.label,
10866          value: field.id
10867        };
10868      });
10869    }, [fields]);
10870    return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
10871      import_components31.SelectControl,
10872      {
10873        __next40pxDefaultSize: true,
10874        label: (0, import_i18n30.__)("Sort by"),
10875        value: view.sort?.field,
10876        options: orderOptions,
10877        onChange: (value) => {
10878          onChangeView({
10879            ...view,
10880            sort: {
10881              direction: view?.sort?.direction || "desc",
10882              field: value
10883            },
10884            showLevels: false
10885          });
10886        }
10887      }
10888    );
10889  }
10890  function SortDirectionControl() {
10891    const { view, fields, onChangeView } = (0, import_element36.useContext)(dataviews_context_default);
10892    const sortableFields = fields.filter(
10893      (field) => field.enableSorting !== false
10894    );
10895    if (sortableFields.length === 0) {
10896      return null;
10897    }
10898    let value = view.sort?.direction;
10899    if (!value && view.sort?.field) {
10900      value = "desc";
10901    }
10902    return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
10903      import_components31.__experimentalToggleGroupControl,
10904      {
10905        className: "dataviews-view-config__sort-direction",
10906        __next40pxDefaultSize: true,
10907        isBlock: true,
10908        label: (0, import_i18n30.__)("Order"),
10909        value,
10910        onChange: (newDirection) => {
10911          if (newDirection === "asc" || newDirection === "desc") {
10912            onChangeView({
10913              ...view,
10914              sort: {
10915                direction: newDirection,
10916                field: view.sort?.field || // If there is no field assigned as the sorting field assign the first sortable field.
10917                fields.find(
10918                  (field) => field.enableSorting !== false
10919                )?.id || ""
10920              },
10921              showLevels: false
10922            });
10923            return;
10924          }
10925          (0, import_warning.default)("Invalid direction");
10926        },
10927        children: SORTING_DIRECTIONS.map((direction) => {
10928          return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
10929            import_components31.__experimentalToggleGroupControlOptionIcon,
10930            {
10931              value: direction,
10932              icon: sortIcons[direction],
10933              label: sortLabels[direction]
10934            },
10935            direction
10936          );
10937        })
10938      }
10939    );
10940  }
10941  function ItemsPerPageControl() {
10942    const { view, config, onChangeView } = (0, import_element36.useContext)(dataviews_context_default);
10943    const { infiniteScrollEnabled } = view;
10944    if (!config || !config.perPageSizes || config.perPageSizes.length < 2 || config.perPageSizes.length > 6 || infiniteScrollEnabled) {
10945      return null;
10946    }
10947    return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
10948      import_components31.__experimentalToggleGroupControl,
10949      {
10950        __next40pxDefaultSize: true,
10951        isBlock: true,
10952        label: (0, import_i18n30.__)("Items per page"),
10953        value: view.perPage || 10,
10954        disabled: !view?.sort?.field,
10955        onChange: (newItemsPerPage) => {
10956          const newItemsPerPageNumber = typeof newItemsPerPage === "number" || newItemsPerPage === void 0 ? newItemsPerPage : parseInt(newItemsPerPage, 10);
10957          onChangeView({
10958            ...view,
10959            perPage: newItemsPerPageNumber,
10960            page: 1
10961          });
10962        },
10963        children: config.perPageSizes.map((value) => {
10964          return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
10965            import_components31.__experimentalToggleGroupControlOption,
10966            {
10967              value,
10968              label: value.toString()
10969            },
10970            value
10971          );
10972        })
10973      }
10974    );
10975  }
10976  function SettingsSection({
10977    title,
10978    description,
10979    children
10980  }) {
10981    return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(import_components31.__experimentalGrid, { columns: 12, className: "dataviews-settings-section", gap: 4, children: [
10982      /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "dataviews-settings-section__sidebar", children: [
10983        /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
10984          import_components31.__experimentalHeading,
10985          {
10986            level: 2,
10987            className: "dataviews-settings-section__title",
10988            children: title
10989          }
10990        ),
10991        description && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
10992          import_components31.__experimentalText,
10993          {
10994            variant: "muted",
10995            className: "dataviews-settings-section__description",
10996            children: description
10997          }
10998        )
10999      ] }),
11000      /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
11001        import_components31.__experimentalGrid,
11002        {
11003          columns: 8,
11004          gap: 4,
11005          className: "dataviews-settings-section__content",
11006          children
11007        }
11008      )
11009    ] });
11010  }
11011  function DataviewsViewConfigDropdown() {
11012    const { view } = (0, import_element36.useContext)(dataviews_context_default);
11013    const popoverId = (0, import_compose10.useInstanceId)(
11014      _DataViewsViewConfig,
11015      "dataviews-view-config-dropdown"
11016    );
11017    const activeLayout = VIEW_LAYOUTS.find(
11018      (layout) => layout.type === view.type
11019    );
11020    return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
11021      import_components31.Dropdown,
11022      {
11023        expandOnMobile: true,
11024        popoverProps: {
11025          ...DATAVIEWS_CONFIG_POPOVER_PROPS,
11026          id: popoverId
11027        },
11028        renderToggle: ({ onToggle, isOpen }) => {
11029          return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
11030            import_components31.Button,
11031            {
11032              size: "compact",
11033              icon: cog_default,
11034              label: (0, import_i18n30._x)("View options", "View is used as a noun"),
11035              onClick: onToggle,
11036              "aria-expanded": isOpen ? "true" : "false",
11037              "aria-controls": popoverId
11038            }
11039          );
11040        },
11041        renderContent: () => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
11042          import_components31.__experimentalDropdownContentWrapper,
11043          {
11044            paddingSize: "medium",
11045            className: "dataviews-config__popover-content-wrapper",
11046            children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_components31.__experimentalVStack, { className: "dataviews-view-config", spacing: 6, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(SettingsSection, { title: (0, import_i18n30.__)("Appearance"), children: [
11047              /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(import_components31.__experimentalHStack, { expanded: true, className: "is-divided-in-two", children: [
11048                /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(SortFieldControl, {}),
11049                /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(SortDirectionControl, {})
11050              ] }),
11051              !!activeLayout?.viewConfigOptions && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(activeLayout.viewConfigOptions, {}),
11052              /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(InfiniteScrollToggle, {}),
11053              /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ItemsPerPageControl, {}),
11054              /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(PropertiesSection, {})
11055            ] }) })
11056          }
11057        )
11058      }
11059    );
11060  }
11061  function _DataViewsViewConfig() {
11062    return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(import_jsx_runtime67.Fragment, { children: [
11063      /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ViewTypeMenu, {}),
11064      /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(DataviewsViewConfigDropdown, {})
11065    ] });
11066  }
11067  var DataViewsViewConfig = (0, import_element36.memo)(_DataViewsViewConfig);
11068  var dataviews_view_config_default = DataViewsViewConfig;
11069  
11070  // packages/dataviews/build-module/dataform-controls/checkbox.js
11071  var import_components32 = __toESM(require_components());
11072  var import_element37 = __toESM(require_element());
11073  
11074  // packages/dataviews/build-module/dataform-controls/utils/get-custom-validity.js
11075  function getCustomValidity(isValid2, validity) {
11076    let customValidity;
11077    if (isValid2?.required && validity?.required) {
11078      customValidity = validity?.required?.message ? validity.required : void 0;
11079    } else if (isValid2?.pattern && validity?.pattern) {
11080      customValidity = validity.pattern;
11081    } else if (isValid2?.min && validity?.min) {
11082      customValidity = validity.min;
11083    } else if (isValid2?.max && validity?.max) {
11084      customValidity = validity.max;
11085    } else if (isValid2?.minLength && validity?.minLength) {
11086      customValidity = validity.minLength;
11087    } else if (isValid2?.maxLength && validity?.maxLength) {
11088      customValidity = validity.maxLength;
11089    } else if (isValid2?.elements && validity?.elements) {
11090      customValidity = validity.elements;
11091    } else if (validity?.custom) {
11092      customValidity = validity.custom;
11093    }
11094    return customValidity;
11095  }
11096  
11097  // packages/dataviews/build-module/dataform-controls/checkbox.js
11098  var import_jsx_runtime68 = __toESM(require_jsx_runtime());
11099  var { ValidatedCheckboxControl } = unlock(import_components32.privateApis);
11100  function Checkbox({
11101    field,
11102    onChange,
11103    data,
11104    hideLabelFromVision,
11105    validity
11106  }) {
11107    const { getValue, setValue, label, description, isValid: isValid2 } = field;
11108    const onChangeControl = (0, import_element37.useCallback)(() => {
11109      onChange(
11110        setValue({ item: data, value: !getValue({ item: data }) })
11111      );
11112    }, [data, getValue, onChange, setValue]);
11113    return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
11114      ValidatedCheckboxControl,
11115      {
11116        required: !!field.isValid?.required,
11117        customValidity: getCustomValidity(isValid2, validity),
11118        hidden: hideLabelFromVision,
11119        label,
11120        help: description,
11121        checked: getValue({ item: data }),
11122        onChange: onChangeControl
11123      }
11124    );
11125  }
11126  
11127  // packages/dataviews/node_modules/date-fns/constants.js
11128  var daysInYear = 365.2425;
11129  var maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1e3;
11130  var minTime = -maxTime;
11131  var millisecondsInWeek = 6048e5;
11132  var millisecondsInDay = 864e5;
11133  var secondsInHour = 3600;
11134  var secondsInDay = secondsInHour * 24;
11135  var secondsInWeek = secondsInDay * 7;
11136  var secondsInYear = secondsInDay * daysInYear;
11137  var secondsInMonth = secondsInYear / 12;
11138  var secondsInQuarter = secondsInMonth * 3;
11139  var constructFromSymbol = Symbol.for("constructDateFrom");
11140  
11141  // packages/dataviews/node_modules/date-fns/constructFrom.js
11142  function constructFrom(date, value) {
11143    if (typeof date === "function") return date(value);
11144    if (date && typeof date === "object" && constructFromSymbol in date)
11145      return date[constructFromSymbol](value);
11146    if (date instanceof Date) return new date.constructor(value);
11147    return new Date(value);
11148  }
11149  
11150  // packages/dataviews/node_modules/date-fns/toDate.js
11151  function toDate(argument, context) {
11152    return constructFrom(context || argument, argument);
11153  }
11154  
11155  // packages/dataviews/node_modules/date-fns/addDays.js
11156  function addDays(date, amount, options) {
11157    const _date = toDate(date, options?.in);
11158    if (isNaN(amount)) return constructFrom(options?.in || date, NaN);
11159    if (!amount) return _date;
11160    _date.setDate(_date.getDate() + amount);
11161    return _date;
11162  }
11163  
11164  // packages/dataviews/node_modules/date-fns/addMonths.js
11165  function addMonths(date, amount, options) {
11166    const _date = toDate(date, options?.in);
11167    if (isNaN(amount)) return constructFrom(options?.in || date, NaN);
11168    if (!amount) {
11169      return _date;
11170    }
11171    const dayOfMonth = _date.getDate();
11172    const endOfDesiredMonth = constructFrom(options?.in || date, _date.getTime());
11173    endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0);
11174    const daysInMonth = endOfDesiredMonth.getDate();
11175    if (dayOfMonth >= daysInMonth) {
11176      return endOfDesiredMonth;
11177    } else {
11178      _date.setFullYear(
11179        endOfDesiredMonth.getFullYear(),
11180        endOfDesiredMonth.getMonth(),
11181        dayOfMonth
11182      );
11183      return _date;
11184    }
11185  }
11186  
11187  // packages/dataviews/node_modules/date-fns/_lib/defaultOptions.js
11188  var defaultOptions = {};
11189  function getDefaultOptions() {
11190    return defaultOptions;
11191  }
11192  
11193  // packages/dataviews/node_modules/date-fns/startOfWeek.js
11194  function startOfWeek(date, options) {
11195    const defaultOptions2 = getDefaultOptions();
11196    const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
11197    const _date = toDate(date, options?.in);
11198    const day = _date.getDay();
11199    const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
11200    _date.setDate(_date.getDate() - diff);
11201    _date.setHours(0, 0, 0, 0);
11202    return _date;
11203  }
11204  
11205  // packages/dataviews/node_modules/date-fns/startOfISOWeek.js
11206  function startOfISOWeek(date, options) {
11207    return startOfWeek(date, { ...options, weekStartsOn: 1 });
11208  }
11209  
11210  // packages/dataviews/node_modules/date-fns/getISOWeekYear.js
11211  function getISOWeekYear(date, options) {
11212    const _date = toDate(date, options?.in);
11213    const year = _date.getFullYear();
11214    const fourthOfJanuaryOfNextYear = constructFrom(_date, 0);
11215    fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
11216    fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
11217    const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);
11218    const fourthOfJanuaryOfThisYear = constructFrom(_date, 0);
11219    fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);
11220    fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);
11221    const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);
11222    if (_date.getTime() >= startOfNextYear.getTime()) {
11223      return year + 1;
11224    } else if (_date.getTime() >= startOfThisYear.getTime()) {
11225      return year;
11226    } else {
11227      return year - 1;
11228    }
11229  }
11230  
11231  // packages/dataviews/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js
11232  function getTimezoneOffsetInMilliseconds(date) {
11233    const _date = toDate(date);
11234    const utcDate = new Date(
11235      Date.UTC(
11236        _date.getFullYear(),
11237        _date.getMonth(),
11238        _date.getDate(),
11239        _date.getHours(),
11240        _date.getMinutes(),
11241        _date.getSeconds(),
11242        _date.getMilliseconds()
11243      )
11244    );
11245    utcDate.setUTCFullYear(_date.getFullYear());
11246    return +date - +utcDate;
11247  }
11248  
11249  // packages/dataviews/node_modules/date-fns/_lib/normalizeDates.js
11250  function normalizeDates(context, ...dates) {
11251    const normalize = constructFrom.bind(
11252      null,
11253      context || dates.find((date) => typeof date === "object")
11254    );
11255    return dates.map(normalize);
11256  }
11257  
11258  // packages/dataviews/node_modules/date-fns/startOfDay.js
11259  function startOfDay(date, options) {
11260    const _date = toDate(date, options?.in);
11261    _date.setHours(0, 0, 0, 0);
11262    return _date;
11263  }
11264  
11265  // packages/dataviews/node_modules/date-fns/differenceInCalendarDays.js
11266  function differenceInCalendarDays(laterDate, earlierDate, options) {
11267    const [laterDate_, earlierDate_] = normalizeDates(
11268      options?.in,
11269      laterDate,
11270      earlierDate
11271    );
11272    const laterStartOfDay = startOfDay(laterDate_);
11273    const earlierStartOfDay = startOfDay(earlierDate_);
11274    const laterTimestamp = +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay);
11275    const earlierTimestamp = +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay);
11276    return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay);
11277  }
11278  
11279  // packages/dataviews/node_modules/date-fns/startOfISOWeekYear.js
11280  function startOfISOWeekYear(date, options) {
11281    const year = getISOWeekYear(date, options);
11282    const fourthOfJanuary = constructFrom(options?.in || date, 0);
11283    fourthOfJanuary.setFullYear(year, 0, 4);
11284    fourthOfJanuary.setHours(0, 0, 0, 0);
11285    return startOfISOWeek(fourthOfJanuary);
11286  }
11287  
11288  // packages/dataviews/node_modules/date-fns/addYears.js
11289  function addYears(date, amount, options) {
11290    return addMonths(date, amount * 12, options);
11291  }
11292  
11293  // packages/dataviews/node_modules/date-fns/isDate.js
11294  function isDate(value) {
11295    return value instanceof Date || typeof value === "object" && Object.prototype.toString.call(value) === "[object Date]";
11296  }
11297  
11298  // packages/dataviews/node_modules/date-fns/isValid.js
11299  function isValid(date) {
11300    return !(!isDate(date) && typeof date !== "number" || isNaN(+toDate(date)));
11301  }
11302  
11303  // packages/dataviews/node_modules/date-fns/startOfMonth.js
11304  function startOfMonth(date, options) {
11305    const _date = toDate(date, options?.in);
11306    _date.setDate(1);
11307    _date.setHours(0, 0, 0, 0);
11308    return _date;
11309  }
11310  
11311  // packages/dataviews/node_modules/date-fns/startOfYear.js
11312  function startOfYear(date, options) {
11313    const date_ = toDate(date, options?.in);
11314    date_.setFullYear(date_.getFullYear(), 0, 1);
11315    date_.setHours(0, 0, 0, 0);
11316    return date_;
11317  }
11318  
11319  // packages/dataviews/node_modules/date-fns/locale/en-US/_lib/formatDistance.js
11320  var formatDistanceLocale = {
11321    lessThanXSeconds: {
11322      one: "less than a second",
11323      other: "less than {{count}} seconds"
11324    },
11325    xSeconds: {
11326      one: "1 second",
11327      other: "{{count}} seconds"
11328    },
11329    halfAMinute: "half a minute",
11330    lessThanXMinutes: {
11331      one: "less than a minute",
11332      other: "less than {{count}} minutes"
11333    },
11334    xMinutes: {
11335      one: "1 minute",
11336      other: "{{count}} minutes"
11337    },
11338    aboutXHours: {
11339      one: "about 1 hour",
11340      other: "about {{count}} hours"
11341    },
11342    xHours: {
11343      one: "1 hour",
11344      other: "{{count}} hours"
11345    },
11346    xDays: {
11347      one: "1 day",
11348      other: "{{count}} days"
11349    },
11350    aboutXWeeks: {
11351      one: "about 1 week",
11352      other: "about {{count}} weeks"
11353    },
11354    xWeeks: {
11355      one: "1 week",
11356      other: "{{count}} weeks"
11357    },
11358    aboutXMonths: {
11359      one: "about 1 month",
11360      other: "about {{count}} months"
11361    },
11362    xMonths: {
11363      one: "1 month",
11364      other: "{{count}} months"
11365    },
11366    aboutXYears: {
11367      one: "about 1 year",
11368      other: "about {{count}} years"
11369    },
11370    xYears: {
11371      one: "1 year",
11372      other: "{{count}} years"
11373    },
11374    overXYears: {
11375      one: "over 1 year",
11376      other: "over {{count}} years"
11377    },
11378    almostXYears: {
11379      one: "almost 1 year",
11380      other: "almost {{count}} years"
11381    }
11382  };
11383  var formatDistance = (token, count, options) => {
11384    let result;
11385    const tokenValue = formatDistanceLocale[token];
11386    if (typeof tokenValue === "string") {
11387      result = tokenValue;
11388    } else if (count === 1) {
11389      result = tokenValue.one;
11390    } else {
11391      result = tokenValue.other.replace("{{count}}", count.toString());
11392    }
11393    if (options?.addSuffix) {
11394      if (options.comparison && options.comparison > 0) {
11395        return "in " + result;
11396      } else {
11397        return result + " ago";
11398      }
11399    }
11400    return result;
11401  };
11402  
11403  // packages/dataviews/node_modules/date-fns/locale/_lib/buildFormatLongFn.js
11404  function buildFormatLongFn(args) {
11405    return (options = {}) => {
11406      const width = options.width ? String(options.width) : args.defaultWidth;
11407      const format6 = args.formats[width] || args.formats[args.defaultWidth];
11408      return format6;
11409    };
11410  }
11411  
11412  // packages/dataviews/node_modules/date-fns/locale/en-US/_lib/formatLong.js
11413  var dateFormats = {
11414    full: "EEEE, MMMM do, y",
11415    long: "MMMM do, y",
11416    medium: "MMM d, y",
11417    short: "MM/dd/yyyy"
11418  };
11419  var timeFormats = {
11420    full: "h:mm:ss a zzzz",
11421    long: "h:mm:ss a z",
11422    medium: "h:mm:ss a",
11423    short: "h:mm a"
11424  };
11425  var dateTimeFormats = {
11426    full: "{{date}} 'at' {{time}}",
11427    long: "{{date}} 'at' {{time}}",
11428    medium: "{{date}}, {{time}}",
11429    short: "{{date}}, {{time}}"
11430  };
11431  var formatLong = {
11432    date: buildFormatLongFn({
11433      formats: dateFormats,
11434      defaultWidth: "full"
11435    }),
11436    time: buildFormatLongFn({
11437      formats: timeFormats,
11438      defaultWidth: "full"
11439    }),
11440    dateTime: buildFormatLongFn({
11441      formats: dateTimeFormats,
11442      defaultWidth: "full"
11443    })
11444  };
11445  
11446  // packages/dataviews/node_modules/date-fns/locale/en-US/_lib/formatRelative.js
11447  var formatRelativeLocale = {
11448    lastWeek: "'last' eeee 'at' p",
11449    yesterday: "'yesterday at' p",
11450    today: "'today at' p",
11451    tomorrow: "'tomorrow at' p",
11452    nextWeek: "eeee 'at' p",
11453    other: "P"
11454  };
11455  var formatRelative = (token, _date, _baseDate, _options) => formatRelativeLocale[token];
11456  
11457  // packages/dataviews/node_modules/date-fns/locale/_lib/buildLocalizeFn.js
11458  function buildLocalizeFn(args) {
11459    return (value, options) => {
11460      const context = options?.context ? String(options.context) : "standalone";
11461      let valuesArray;
11462      if (context === "formatting" && args.formattingValues) {
11463        const defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
11464        const width = options?.width ? String(options.width) : defaultWidth;
11465        valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
11466      } else {
11467        const defaultWidth = args.defaultWidth;
11468        const width = options?.width ? String(options.width) : args.defaultWidth;
11469        valuesArray = args.values[width] || args.values[defaultWidth];
11470      }
11471      const index = args.argumentCallback ? args.argumentCallback(value) : value;
11472      return valuesArray[index];
11473    };
11474  }
11475  
11476  // packages/dataviews/node_modules/date-fns/locale/en-US/_lib/localize.js
11477  var eraValues = {
11478    narrow: ["B", "A"],
11479    abbreviated: ["BC", "AD"],
11480    wide: ["Before Christ", "Anno Domini"]
11481  };
11482  var quarterValues = {
11483    narrow: ["1", "2", "3", "4"],
11484    abbreviated: ["Q1", "Q2", "Q3", "Q4"],
11485    wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
11486  };
11487  var monthValues = {
11488    narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
11489    abbreviated: [
11490      "Jan",
11491      "Feb",
11492      "Mar",
11493      "Apr",
11494      "May",
11495      "Jun",
11496      "Jul",
11497      "Aug",
11498      "Sep",
11499      "Oct",
11500      "Nov",
11501      "Dec"
11502    ],
11503    wide: [
11504      "January",
11505      "February",
11506      "March",
11507      "April",
11508      "May",
11509      "June",
11510      "July",
11511      "August",
11512      "September",
11513      "October",
11514      "November",
11515      "December"
11516    ]
11517  };
11518  var dayValues = {
11519    narrow: ["S", "M", "T", "W", "T", "F", "S"],
11520    short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
11521    abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
11522    wide: [
11523      "Sunday",
11524      "Monday",
11525      "Tuesday",
11526      "Wednesday",
11527      "Thursday",
11528      "Friday",
11529      "Saturday"
11530    ]
11531  };
11532  var dayPeriodValues = {
11533    narrow: {
11534      am: "a",
11535      pm: "p",
11536      midnight: "mi",
11537      noon: "n",
11538      morning: "morning",
11539      afternoon: "afternoon",
11540      evening: "evening",
11541      night: "night"
11542    },
11543    abbreviated: {
11544      am: "AM",
11545      pm: "PM",
11546      midnight: "midnight",
11547      noon: "noon",
11548      morning: "morning",
11549      afternoon: "afternoon",
11550      evening: "evening",
11551      night: "night"
11552    },
11553    wide: {
11554      am: "a.m.",
11555      pm: "p.m.",
11556      midnight: "midnight",
11557      noon: "noon",
11558      morning: "morning",
11559      afternoon: "afternoon",
11560      evening: "evening",
11561      night: "night"
11562    }
11563  };
11564  var formattingDayPeriodValues = {
11565    narrow: {
11566      am: "a",
11567      pm: "p",
11568      midnight: "mi",
11569      noon: "n",
11570      morning: "in the morning",
11571      afternoon: "in the afternoon",
11572      evening: "in the evening",
11573      night: "at night"
11574    },
11575    abbreviated: {
11576      am: "AM",
11577      pm: "PM",
11578      midnight: "midnight",
11579      noon: "noon",
11580      morning: "in the morning",
11581      afternoon: "in the afternoon",
11582      evening: "in the evening",
11583      night: "at night"
11584    },
11585    wide: {
11586      am: "a.m.",
11587      pm: "p.m.",
11588      midnight: "midnight",
11589      noon: "noon",
11590      morning: "in the morning",
11591      afternoon: "in the afternoon",
11592      evening: "in the evening",
11593      night: "at night"
11594    }
11595  };
11596  var ordinalNumber = (dirtyNumber, _options) => {
11597    const number = Number(dirtyNumber);
11598    const rem100 = number % 100;
11599    if (rem100 > 20 || rem100 < 10) {
11600      switch (rem100 % 10) {
11601        case 1:
11602          return number + "st";
11603        case 2:
11604          return number + "nd";
11605        case 3:
11606          return number + "rd";
11607      }
11608    }
11609    return number + "th";
11610  };
11611  var localize = {
11612    ordinalNumber,
11613    era: buildLocalizeFn({
11614      values: eraValues,
11615      defaultWidth: "wide"
11616    }),
11617    quarter: buildLocalizeFn({
11618      values: quarterValues,
11619      defaultWidth: "wide",
11620      argumentCallback: (quarter) => quarter - 1
11621    }),
11622    month: buildLocalizeFn({
11623      values: monthValues,
11624      defaultWidth: "wide"
11625    }),
11626    day: buildLocalizeFn({
11627      values: dayValues,
11628      defaultWidth: "wide"
11629    }),
11630    dayPeriod: buildLocalizeFn({
11631      values: dayPeriodValues,
11632      defaultWidth: "wide",
11633      formattingValues: formattingDayPeriodValues,
11634      defaultFormattingWidth: "wide"
11635    })
11636  };
11637  
11638  // packages/dataviews/node_modules/date-fns/locale/_lib/buildMatchFn.js
11639  function buildMatchFn(args) {
11640    return (string, options = {}) => {
11641      const width = options.width;
11642      const matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
11643      const matchResult = string.match(matchPattern);
11644      if (!matchResult) {
11645        return null;
11646      }
11647      const matchedString = matchResult[0];
11648      const parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
11649      const key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString)) : (
11650        // [TODO] -- I challenge you to fix the type
11651        findKey(parsePatterns, (pattern) => pattern.test(matchedString))
11652      );
11653      let value;
11654      value = args.valueCallback ? args.valueCallback(key) : key;
11655      value = options.valueCallback ? (
11656        // [TODO] -- I challenge you to fix the type
11657        options.valueCallback(value)
11658      ) : value;
11659      const rest = string.slice(matchedString.length);
11660      return { value, rest };
11661    };
11662  }
11663  function findKey(object, predicate) {
11664    for (const key in object) {
11665      if (Object.prototype.hasOwnProperty.call(object, key) && predicate(object[key])) {
11666        return key;
11667      }
11668    }
11669    return void 0;
11670  }
11671  function findIndex(array, predicate) {
11672    for (let key = 0; key < array.length; key++) {
11673      if (predicate(array[key])) {
11674        return key;
11675      }
11676    }
11677    return void 0;
11678  }
11679  
11680  // packages/dataviews/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js
11681  function buildMatchPatternFn(args) {
11682    return (string, options = {}) => {
11683      const matchResult = string.match(args.matchPattern);
11684      if (!matchResult) return null;
11685      const matchedString = matchResult[0];
11686      const parseResult = string.match(args.parsePattern);
11687      if (!parseResult) return null;
11688      let value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
11689      value = options.valueCallback ? options.valueCallback(value) : value;
11690      const rest = string.slice(matchedString.length);
11691      return { value, rest };
11692    };
11693  }
11694  
11695  // packages/dataviews/node_modules/date-fns/locale/en-US/_lib/match.js
11696  var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
11697  var parseOrdinalNumberPattern = /\d+/i;
11698  var matchEraPatterns = {
11699    narrow: /^(b|a)/i,
11700    abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
11701    wide: /^(before christ|before common era|anno domini|common era)/i
11702  };
11703  var parseEraPatterns = {
11704    any: [/^b/i, /^(a|c)/i]
11705  };
11706  var matchQuarterPatterns = {
11707    narrow: /^[1234]/i,
11708    abbreviated: /^q[1234]/i,
11709    wide: /^[1234](th|st|nd|rd)? quarter/i
11710  };
11711  var parseQuarterPatterns = {
11712    any: [/1/i, /2/i, /3/i, /4/i]
11713  };
11714  var matchMonthPatterns = {
11715    narrow: /^[jfmasond]/i,
11716    abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
11717    wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
11718  };
11719  var parseMonthPatterns = {
11720    narrow: [
11721      /^j/i,
11722      /^f/i,
11723      /^m/i,
11724      /^a/i,
11725      /^m/i,
11726      /^j/i,
11727      /^j/i,
11728      /^a/i,
11729      /^s/i,
11730      /^o/i,
11731      /^n/i,
11732      /^d/i
11733    ],
11734    any: [
11735      /^ja/i,
11736      /^f/i,
11737      /^mar/i,
11738      /^ap/i,
11739      /^may/i,
11740      /^jun/i,
11741      /^jul/i,
11742      /^au/i,
11743      /^s/i,
11744      /^o/i,
11745      /^n/i,
11746      /^d/i
11747    ]
11748  };
11749  var matchDayPatterns = {
11750    narrow: /^[smtwf]/i,
11751    short: /^(su|mo|tu|we|th|fr|sa)/i,
11752    abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
11753    wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
11754  };
11755  var parseDayPatterns = {
11756    narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
11757    any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
11758  };
11759  var matchDayPeriodPatterns = {
11760    narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
11761    any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
11762  };
11763  var parseDayPeriodPatterns = {
11764    any: {
11765      am: /^a/i,
11766      pm: /^p/i,
11767      midnight: /^mi/i,
11768      noon: /^no/i,
11769      morning: /morning/i,
11770      afternoon: /afternoon/i,
11771      evening: /evening/i,
11772      night: /night/i
11773    }
11774  };
11775  var match = {
11776    ordinalNumber: buildMatchPatternFn({
11777      matchPattern: matchOrdinalNumberPattern,
11778      parsePattern: parseOrdinalNumberPattern,
11779      valueCallback: (value) => parseInt(value, 10)
11780    }),
11781    era: buildMatchFn({
11782      matchPatterns: matchEraPatterns,
11783      defaultMatchWidth: "wide",
11784      parsePatterns: parseEraPatterns,
11785      defaultParseWidth: "any"
11786    }),
11787    quarter: buildMatchFn({
11788      matchPatterns: matchQuarterPatterns,
11789      defaultMatchWidth: "wide",
11790      parsePatterns: parseQuarterPatterns,
11791      defaultParseWidth: "any",
11792      valueCallback: (index) => index + 1
11793    }),
11794    month: buildMatchFn({
11795      matchPatterns: matchMonthPatterns,
11796      defaultMatchWidth: "wide",
11797      parsePatterns: parseMonthPatterns,
11798      defaultParseWidth: "any"
11799    }),
11800    day: buildMatchFn({
11801      matchPatterns: matchDayPatterns,
11802      defaultMatchWidth: "wide",
11803      parsePatterns: parseDayPatterns,
11804      defaultParseWidth: "any"
11805    }),
11806    dayPeriod: buildMatchFn({
11807      matchPatterns: matchDayPeriodPatterns,
11808      defaultMatchWidth: "any",
11809      parsePatterns: parseDayPeriodPatterns,
11810      defaultParseWidth: "any"
11811    })
11812  };
11813  
11814  // packages/dataviews/node_modules/date-fns/locale/en-US.js
11815  var enUS = {
11816    code: "en-US",
11817    formatDistance,
11818    formatLong,
11819    formatRelative,
11820    localize,
11821    match,
11822    options: {
11823      weekStartsOn: 0,
11824      firstWeekContainsDate: 1
11825    }
11826  };
11827  
11828  // packages/dataviews/node_modules/date-fns/getDayOfYear.js
11829  function getDayOfYear(date, options) {
11830    const _date = toDate(date, options?.in);
11831    const diff = differenceInCalendarDays(_date, startOfYear(_date));
11832    const dayOfYear = diff + 1;
11833    return dayOfYear;
11834  }
11835  
11836  // packages/dataviews/node_modules/date-fns/getISOWeek.js
11837  function getISOWeek(date, options) {
11838    const _date = toDate(date, options?.in);
11839    const diff = +startOfISOWeek(_date) - +startOfISOWeekYear(_date);
11840    return Math.round(diff / millisecondsInWeek) + 1;
11841  }
11842  
11843  // packages/dataviews/node_modules/date-fns/getWeekYear.js
11844  function getWeekYear(date, options) {
11845    const _date = toDate(date, options?.in);
11846    const year = _date.getFullYear();
11847    const defaultOptions2 = getDefaultOptions();
11848    const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
11849    const firstWeekOfNextYear = constructFrom(options?.in || date, 0);
11850    firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate);
11851    firstWeekOfNextYear.setHours(0, 0, 0, 0);
11852    const startOfNextYear = startOfWeek(firstWeekOfNextYear, options);
11853    const firstWeekOfThisYear = constructFrom(options?.in || date, 0);
11854    firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate);
11855    firstWeekOfThisYear.setHours(0, 0, 0, 0);
11856    const startOfThisYear = startOfWeek(firstWeekOfThisYear, options);
11857    if (+_date >= +startOfNextYear) {
11858      return year + 1;
11859    } else if (+_date >= +startOfThisYear) {
11860      return year;
11861    } else {
11862      return year - 1;
11863    }
11864  }
11865  
11866  // packages/dataviews/node_modules/date-fns/startOfWeekYear.js
11867  function startOfWeekYear(date, options) {
11868    const defaultOptions2 = getDefaultOptions();
11869    const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
11870    const year = getWeekYear(date, options);
11871    const firstWeek = constructFrom(options?.in || date, 0);
11872    firstWeek.setFullYear(year, 0, firstWeekContainsDate);
11873    firstWeek.setHours(0, 0, 0, 0);
11874    const _date = startOfWeek(firstWeek, options);
11875    return _date;
11876  }
11877  
11878  // packages/dataviews/node_modules/date-fns/getWeek.js
11879  function getWeek(date, options) {
11880    const _date = toDate(date, options?.in);
11881    const diff = +startOfWeek(_date, options) - +startOfWeekYear(_date, options);
11882    return Math.round(diff / millisecondsInWeek) + 1;
11883  }
11884  
11885  // packages/dataviews/node_modules/date-fns/_lib/addLeadingZeros.js
11886  function addLeadingZeros(number, targetLength) {
11887    const sign = number < 0 ? "-" : "";
11888    const output = Math.abs(number).toString().padStart(targetLength, "0");
11889    return sign + output;
11890  }
11891  
11892  // packages/dataviews/node_modules/date-fns/_lib/format/lightFormatters.js
11893  var lightFormatters = {
11894    // Year
11895    y(date, token) {
11896      const signedYear = date.getFullYear();
11897      const year = signedYear > 0 ? signedYear : 1 - signedYear;
11898      return addLeadingZeros(token === "yy" ? year % 100 : year, token.length);
11899    },
11900    // Month
11901    M(date, token) {
11902      const month = date.getMonth();
11903      return token === "M" ? String(month + 1) : addLeadingZeros(month + 1, 2);
11904    },
11905    // Day of the month
11906    d(date, token) {
11907      return addLeadingZeros(date.getDate(), token.length);
11908    },
11909    // AM or PM
11910    a(date, token) {
11911      const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? "pm" : "am";
11912      switch (token) {
11913        case "a":
11914        case "aa":
11915          return dayPeriodEnumValue.toUpperCase();
11916        case "aaa":
11917          return dayPeriodEnumValue;
11918        case "aaaaa":
11919          return dayPeriodEnumValue[0];
11920        case "aaaa":
11921        default:
11922          return dayPeriodEnumValue === "am" ? "a.m." : "p.m.";
11923      }
11924    },
11925    // Hour [1-12]
11926    h(date, token) {
11927      return addLeadingZeros(date.getHours() % 12 || 12, token.length);
11928    },
11929    // Hour [0-23]
11930    H(date, token) {
11931      return addLeadingZeros(date.getHours(), token.length);
11932    },
11933    // Minute
11934    m(date, token) {
11935      return addLeadingZeros(date.getMinutes(), token.length);
11936    },
11937    // Second
11938    s(date, token) {
11939      return addLeadingZeros(date.getSeconds(), token.length);
11940    },
11941    // Fraction of second
11942    S(date, token) {
11943      const numberOfDigits = token.length;
11944      const milliseconds = date.getMilliseconds();
11945      const fractionalSeconds = Math.trunc(
11946        milliseconds * Math.pow(10, numberOfDigits - 3)
11947      );
11948      return addLeadingZeros(fractionalSeconds, token.length);
11949    }
11950  };
11951  
11952  // packages/dataviews/node_modules/date-fns/_lib/format/formatters.js
11953  var dayPeriodEnum = {
11954    am: "am",
11955    pm: "pm",
11956    midnight: "midnight",
11957    noon: "noon",
11958    morning: "morning",
11959    afternoon: "afternoon",
11960    evening: "evening",
11961    night: "night"
11962  };
11963  var formatters = {
11964    // Era
11965    G: function(date, token, localize2) {
11966      const era = date.getFullYear() > 0 ? 1 : 0;
11967      switch (token) {
11968        // AD, BC
11969        case "G":
11970        case "GG":
11971        case "GGG":
11972          return localize2.era(era, { width: "abbreviated" });
11973        // A, B
11974        case "GGGGG":
11975          return localize2.era(era, { width: "narrow" });
11976        // Anno Domini, Before Christ
11977        case "GGGG":
11978        default:
11979          return localize2.era(era, { width: "wide" });
11980      }
11981    },
11982    // Year
11983    y: function(date, token, localize2) {
11984      if (token === "yo") {
11985        const signedYear = date.getFullYear();
11986        const year = signedYear > 0 ? signedYear : 1 - signedYear;
11987        return localize2.ordinalNumber(year, { unit: "year" });
11988      }
11989      return lightFormatters.y(date, token);
11990    },
11991    // Local week-numbering year
11992    Y: function(date, token, localize2, options) {
11993      const signedWeekYear = getWeekYear(date, options);
11994      const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
11995      if (token === "YY") {
11996        const twoDigitYear = weekYear % 100;
11997        return addLeadingZeros(twoDigitYear, 2);
11998      }
11999      if (token === "Yo") {
12000        return localize2.ordinalNumber(weekYear, { unit: "year" });
12001      }
12002      return addLeadingZeros(weekYear, token.length);
12003    },
12004    // ISO week-numbering year
12005    R: function(date, token) {
12006      const isoWeekYear = getISOWeekYear(date);
12007      return addLeadingZeros(isoWeekYear, token.length);
12008    },
12009    // Extended year. This is a single number designating the year of this calendar system.
12010    // The main difference between `y` and `u` localizers are B.C. years:
12011    // | Year | `y` | `u` |
12012    // |------|-----|-----|
12013    // | AC 1 |   1 |   1 |
12014    // | BC 1 |   1 |   0 |
12015    // | BC 2 |   2 |  -1 |
12016    // Also `yy` always returns the last two digits of a year,
12017    // while `uu` pads single digit years to 2 characters and returns other years unchanged.
12018    u: function(date, token) {
12019      const year = date.getFullYear();
12020      return addLeadingZeros(year, token.length);
12021    },
12022    // Quarter
12023    Q: function(date, token, localize2) {
12024      const quarter = Math.ceil((date.getMonth() + 1) / 3);
12025      switch (token) {
12026        // 1, 2, 3, 4
12027        case "Q":
12028          return String(quarter);
12029        // 01, 02, 03, 04
12030        case "QQ":
12031          return addLeadingZeros(quarter, 2);
12032        // 1st, 2nd, 3rd, 4th
12033        case "Qo":
12034          return localize2.ordinalNumber(quarter, { unit: "quarter" });
12035        // Q1, Q2, Q3, Q4
12036        case "QQQ":
12037          return localize2.quarter(quarter, {
12038            width: "abbreviated",
12039            context: "formatting"
12040          });
12041        // 1, 2, 3, 4 (narrow quarter; could be not numerical)
12042        case "QQQQQ":
12043          return localize2.quarter(quarter, {
12044            width: "narrow",
12045            context: "formatting"
12046          });
12047        // 1st quarter, 2nd quarter, ...
12048        case "QQQQ":
12049        default:
12050          return localize2.quarter(quarter, {
12051            width: "wide",
12052            context: "formatting"
12053          });
12054      }
12055    },
12056    // Stand-alone quarter
12057    q: function(date, token, localize2) {
12058      const quarter = Math.ceil((date.getMonth() + 1) / 3);
12059      switch (token) {
12060        // 1, 2, 3, 4
12061        case "q":
12062          return String(quarter);
12063        // 01, 02, 03, 04
12064        case "qq":
12065          return addLeadingZeros(quarter, 2);
12066        // 1st, 2nd, 3rd, 4th
12067        case "qo":
12068          return localize2.ordinalNumber(quarter, { unit: "quarter" });
12069        // Q1, Q2, Q3, Q4
12070        case "qqq":
12071          return localize2.quarter(quarter, {
12072            width: "abbreviated",
12073            context: "standalone"
12074          });
12075        // 1, 2, 3, 4 (narrow quarter; could be not numerical)
12076        case "qqqqq":
12077          return localize2.quarter(quarter, {
12078            width: "narrow",
12079            context: "standalone"
12080          });
12081        // 1st quarter, 2nd quarter, ...
12082        case "qqqq":
12083        default:
12084          return localize2.quarter(quarter, {
12085            width: "wide",
12086            context: "standalone"
12087          });
12088      }
12089    },
12090    // Month
12091    M: function(date, token, localize2) {
12092      const month = date.getMonth();
12093      switch (token) {
12094        case "M":
12095        case "MM":
12096          return lightFormatters.M(date, token);
12097        // 1st, 2nd, ..., 12th
12098        case "Mo":
12099          return localize2.ordinalNumber(month + 1, { unit: "month" });
12100        // Jan, Feb, ..., Dec
12101        case "MMM":
12102          return localize2.month(month, {
12103            width: "abbreviated",
12104            context: "formatting"
12105          });
12106        // J, F, ..., D
12107        case "MMMMM":
12108          return localize2.month(month, {
12109            width: "narrow",
12110            context: "formatting"
12111          });
12112        // January, February, ..., December
12113        case "MMMM":
12114        default:
12115          return localize2.month(month, { width: "wide", context: "formatting" });
12116      }
12117    },
12118    // Stand-alone month
12119    L: function(date, token, localize2) {
12120      const month = date.getMonth();
12121      switch (token) {
12122        // 1, 2, ..., 12
12123        case "L":
12124          return String(month + 1);
12125        // 01, 02, ..., 12
12126        case "LL":
12127          return addLeadingZeros(month + 1, 2);
12128        // 1st, 2nd, ..., 12th
12129        case "Lo":
12130          return localize2.ordinalNumber(month + 1, { unit: "month" });
12131        // Jan, Feb, ..., Dec
12132        case "LLL":
12133          return localize2.month(month, {
12134            width: "abbreviated",
12135            context: "standalone"
12136          });
12137        // J, F, ..., D
12138        case "LLLLL":
12139          return localize2.month(month, {
12140            width: "narrow",
12141            context: "standalone"
12142          });
12143        // January, February, ..., December
12144        case "LLLL":
12145        default:
12146          return localize2.month(month, { width: "wide", context: "standalone" });
12147      }
12148    },
12149    // Local week of year
12150    w: function(date, token, localize2, options) {
12151      const week = getWeek(date, options);
12152      if (token === "wo") {
12153        return localize2.ordinalNumber(week, { unit: "week" });
12154      }
12155      return addLeadingZeros(week, token.length);
12156    },
12157    // ISO week of year
12158    I: function(date, token, localize2) {
12159      const isoWeek = getISOWeek(date);
12160      if (token === "Io") {
12161        return localize2.ordinalNumber(isoWeek, { unit: "week" });
12162      }
12163      return addLeadingZeros(isoWeek, token.length);
12164    },
12165    // Day of the month
12166    d: function(date, token, localize2) {
12167      if (token === "do") {
12168        return localize2.ordinalNumber(date.getDate(), { unit: "date" });
12169      }
12170      return lightFormatters.d(date, token);
12171    },
12172    // Day of year
12173    D: function(date, token, localize2) {
12174      const dayOfYear = getDayOfYear(date);
12175      if (token === "Do") {
12176        return localize2.ordinalNumber(dayOfYear, { unit: "dayOfYear" });
12177      }
12178      return addLeadingZeros(dayOfYear, token.length);
12179    },
12180    // Day of week
12181    E: function(date, token, localize2) {
12182      const dayOfWeek = date.getDay();
12183      switch (token) {
12184        // Tue
12185        case "E":
12186        case "EE":
12187        case "EEE":
12188          return localize2.day(dayOfWeek, {
12189            width: "abbreviated",
12190            context: "formatting"
12191          });
12192        // T
12193        case "EEEEE":
12194          return localize2.day(dayOfWeek, {
12195            width: "narrow",
12196            context: "formatting"
12197          });
12198        // Tu
12199        case "EEEEEE":
12200          return localize2.day(dayOfWeek, {
12201            width: "short",
12202            context: "formatting"
12203          });
12204        // Tuesday
12205        case "EEEE":
12206        default:
12207          return localize2.day(dayOfWeek, {
12208            width: "wide",
12209            context: "formatting"
12210          });
12211      }
12212    },
12213    // Local day of week
12214    e: function(date, token, localize2, options) {
12215      const dayOfWeek = date.getDay();
12216      const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
12217      switch (token) {
12218        // Numerical value (Nth day of week with current locale or weekStartsOn)
12219        case "e":
12220          return String(localDayOfWeek);
12221        // Padded numerical value
12222        case "ee":
12223          return addLeadingZeros(localDayOfWeek, 2);
12224        // 1st, 2nd, ..., 7th
12225        case "eo":
12226          return localize2.ordinalNumber(localDayOfWeek, { unit: "day" });
12227        case "eee":
12228          return localize2.day(dayOfWeek, {
12229            width: "abbreviated",
12230            context: "formatting"
12231          });
12232        // T
12233        case "eeeee":
12234          return localize2.day(dayOfWeek, {
12235            width: "narrow",
12236            context: "formatting"
12237          });
12238        // Tu
12239        case "eeeeee":
12240          return localize2.day(dayOfWeek, {
12241            width: "short",
12242            context: "formatting"
12243          });
12244        // Tuesday
12245        case "eeee":
12246        default:
12247          return localize2.day(dayOfWeek, {
12248            width: "wide",
12249            context: "formatting"
12250          });
12251      }
12252    },
12253    // Stand-alone local day of week
12254    c: function(date, token, localize2, options) {
12255      const dayOfWeek = date.getDay();
12256      const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
12257      switch (token) {
12258        // Numerical value (same as in `e`)
12259        case "c":
12260          return String(localDayOfWeek);
12261        // Padded numerical value
12262        case "cc":
12263          return addLeadingZeros(localDayOfWeek, token.length);
12264        // 1st, 2nd, ..., 7th
12265        case "co":
12266          return localize2.ordinalNumber(localDayOfWeek, { unit: "day" });
12267        case "ccc":
12268          return localize2.day(dayOfWeek, {
12269            width: "abbreviated",
12270            context: "standalone"
12271          });
12272        // T
12273        case "ccccc":
12274          return localize2.day(dayOfWeek, {
12275            width: "narrow",
12276            context: "standalone"
12277          });
12278        // Tu
12279        case "cccccc":
12280          return localize2.day(dayOfWeek, {
12281            width: "short",
12282            context: "standalone"
12283          });
12284        // Tuesday
12285        case "cccc":
12286        default:
12287          return localize2.day(dayOfWeek, {
12288            width: "wide",
12289            context: "standalone"
12290          });
12291      }
12292    },
12293    // ISO day of week
12294    i: function(date, token, localize2) {
12295      const dayOfWeek = date.getDay();
12296      const isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
12297      switch (token) {
12298        // 2
12299        case "i":
12300          return String(isoDayOfWeek);
12301        // 02
12302        case "ii":
12303          return addLeadingZeros(isoDayOfWeek, token.length);
12304        // 2nd
12305        case "io":
12306          return localize2.ordinalNumber(isoDayOfWeek, { unit: "day" });
12307        // Tue
12308        case "iii":
12309          return localize2.day(dayOfWeek, {
12310            width: "abbreviated",
12311            context: "formatting"
12312          });
12313        // T
12314        case "iiiii":
12315          return localize2.day(dayOfWeek, {
12316            width: "narrow",
12317            context: "formatting"
12318          });
12319        // Tu
12320        case "iiiiii":
12321          return localize2.day(dayOfWeek, {
12322            width: "short",
12323            context: "formatting"
12324          });
12325        // Tuesday
12326        case "iiii":
12327        default:
12328          return localize2.day(dayOfWeek, {
12329            width: "wide",
12330            context: "formatting"
12331          });
12332      }
12333    },
12334    // AM or PM
12335    a: function(date, token, localize2) {
12336      const hours = date.getHours();
12337      const dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
12338      switch (token) {
12339        case "a":
12340        case "aa":
12341          return localize2.dayPeriod(dayPeriodEnumValue, {
12342            width: "abbreviated",
12343            context: "formatting"
12344          });
12345        case "aaa":
12346          return localize2.dayPeriod(dayPeriodEnumValue, {
12347            width: "abbreviated",
12348            context: "formatting"
12349          }).toLowerCase();
12350        case "aaaaa":
12351          return localize2.dayPeriod(dayPeriodEnumValue, {
12352            width: "narrow",
12353            context: "formatting"
12354          });
12355        case "aaaa":
12356        default:
12357          return localize2.dayPeriod(dayPeriodEnumValue, {
12358            width: "wide",
12359            context: "formatting"
12360          });
12361      }
12362    },
12363    // AM, PM, midnight, noon
12364    b: function(date, token, localize2) {
12365      const hours = date.getHours();
12366      let dayPeriodEnumValue;
12367      if (hours === 12) {
12368        dayPeriodEnumValue = dayPeriodEnum.noon;
12369      } else if (hours === 0) {
12370        dayPeriodEnumValue = dayPeriodEnum.midnight;
12371      } else {
12372        dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
12373      }
12374      switch (token) {
12375        case "b":
12376        case "bb":
12377          return localize2.dayPeriod(dayPeriodEnumValue, {
12378            width: "abbreviated",
12379            context: "formatting"
12380          });
12381        case "bbb":
12382          return localize2.dayPeriod(dayPeriodEnumValue, {
12383            width: "abbreviated",
12384            context: "formatting"
12385          }).toLowerCase();
12386        case "bbbbb":
12387          return localize2.dayPeriod(dayPeriodEnumValue, {
12388            width: "narrow",
12389            context: "formatting"
12390          });
12391        case "bbbb":
12392        default:
12393          return localize2.dayPeriod(dayPeriodEnumValue, {
12394            width: "wide",
12395            context: "formatting"
12396          });
12397      }
12398    },
12399    // in the morning, in the afternoon, in the evening, at night
12400    B: function(date, token, localize2) {
12401      const hours = date.getHours();
12402      let dayPeriodEnumValue;
12403      if (hours >= 17) {
12404        dayPeriodEnumValue = dayPeriodEnum.evening;
12405      } else if (hours >= 12) {
12406        dayPeriodEnumValue = dayPeriodEnum.afternoon;
12407      } else if (hours >= 4) {
12408        dayPeriodEnumValue = dayPeriodEnum.morning;
12409      } else {
12410        dayPeriodEnumValue = dayPeriodEnum.night;
12411      }
12412      switch (token) {
12413        case "B":
12414        case "BB":
12415        case "BBB":
12416          return localize2.dayPeriod(dayPeriodEnumValue, {
12417            width: "abbreviated",
12418            context: "formatting"
12419          });
12420        case "BBBBB":
12421          return localize2.dayPeriod(dayPeriodEnumValue, {
12422            width: "narrow",
12423            context: "formatting"
12424          });
12425        case "BBBB":
12426        default:
12427          return localize2.dayPeriod(dayPeriodEnumValue, {
12428            width: "wide",
12429            context: "formatting"
12430          });
12431      }
12432    },
12433    // Hour [1-12]
12434    h: function(date, token, localize2) {
12435      if (token === "ho") {
12436        let hours = date.getHours() % 12;
12437        if (hours === 0) hours = 12;
12438        return localize2.ordinalNumber(hours, { unit: "hour" });
12439      }
12440      return lightFormatters.h(date, token);
12441    },
12442    // Hour [0-23]
12443    H: function(date, token, localize2) {
12444      if (token === "Ho") {
12445        return localize2.ordinalNumber(date.getHours(), { unit: "hour" });
12446      }
12447      return lightFormatters.H(date, token);
12448    },
12449    // Hour [0-11]
12450    K: function(date, token, localize2) {
12451      const hours = date.getHours() % 12;
12452      if (token === "Ko") {
12453        return localize2.ordinalNumber(hours, { unit: "hour" });
12454      }
12455      return addLeadingZeros(hours, token.length);
12456    },
12457    // Hour [1-24]
12458    k: function(date, token, localize2) {
12459      let hours = date.getHours();
12460      if (hours === 0) hours = 24;
12461      if (token === "ko") {
12462        return localize2.ordinalNumber(hours, { unit: "hour" });
12463      }
12464      return addLeadingZeros(hours, token.length);
12465    },
12466    // Minute
12467    m: function(date, token, localize2) {
12468      if (token === "mo") {
12469        return localize2.ordinalNumber(date.getMinutes(), { unit: "minute" });
12470      }
12471      return lightFormatters.m(date, token);
12472    },
12473    // Second
12474    s: function(date, token, localize2) {
12475      if (token === "so") {
12476        return localize2.ordinalNumber(date.getSeconds(), { unit: "second" });
12477      }
12478      return lightFormatters.s(date, token);
12479    },
12480    // Fraction of second
12481    S: function(date, token) {
12482      return lightFormatters.S(date, token);
12483    },
12484    // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
12485    X: function(date, token, _localize) {
12486      const timezoneOffset = date.getTimezoneOffset();
12487      if (timezoneOffset === 0) {
12488        return "Z";
12489      }
12490      switch (token) {
12491        // Hours and optional minutes
12492        case "X":
12493          return formatTimezoneWithOptionalMinutes(timezoneOffset);
12494        // Hours, minutes and optional seconds without `:` delimiter
12495        // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
12496        // so this token always has the same output as `XX`
12497        case "XXXX":
12498        case "XX":
12499          return formatTimezone(timezoneOffset);
12500        // Hours, minutes and optional seconds with `:` delimiter
12501        // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
12502        // so this token always has the same output as `XXX`
12503        case "XXXXX":
12504        case "XXX":
12505        // Hours and minutes with `:` delimiter
12506        default:
12507          return formatTimezone(timezoneOffset, ":");
12508      }
12509    },
12510    // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
12511    x: function(date, token, _localize) {
12512      const timezoneOffset = date.getTimezoneOffset();
12513      switch (token) {
12514        // Hours and optional minutes
12515        case "x":
12516          return formatTimezoneWithOptionalMinutes(timezoneOffset);
12517        // Hours, minutes and optional seconds without `:` delimiter
12518        // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
12519        // so this token always has the same output as `xx`
12520        case "xxxx":
12521        case "xx":
12522          return formatTimezone(timezoneOffset);
12523        // Hours, minutes and optional seconds with `:` delimiter
12524        // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
12525        // so this token always has the same output as `xxx`
12526        case "xxxxx":
12527        case "xxx":
12528        // Hours and minutes with `:` delimiter
12529        default:
12530          return formatTimezone(timezoneOffset, ":");
12531      }
12532    },
12533    // Timezone (GMT)
12534    O: function(date, token, _localize) {
12535      const timezoneOffset = date.getTimezoneOffset();
12536      switch (token) {
12537        // Short
12538        case "O":
12539        case "OO":
12540        case "OOO":
12541          return "GMT" + formatTimezoneShort(timezoneOffset, ":");
12542        // Long
12543        case "OOOO":
12544        default:
12545          return "GMT" + formatTimezone(timezoneOffset, ":");
12546      }
12547    },
12548    // Timezone (specific non-location)
12549    z: function(date, token, _localize) {
12550      const timezoneOffset = date.getTimezoneOffset();
12551      switch (token) {
12552        // Short
12553        case "z":
12554        case "zz":
12555        case "zzz":
12556          return "GMT" + formatTimezoneShort(timezoneOffset, ":");
12557        // Long
12558        case "zzzz":
12559        default:
12560          return "GMT" + formatTimezone(timezoneOffset, ":");
12561      }
12562    },
12563    // Seconds timestamp
12564    t: function(date, token, _localize) {
12565      const timestamp = Math.trunc(+date / 1e3);
12566      return addLeadingZeros(timestamp, token.length);
12567    },
12568    // Milliseconds timestamp
12569    T: function(date, token, _localize) {
12570      return addLeadingZeros(+date, token.length);
12571    }
12572  };
12573  function formatTimezoneShort(offset, delimiter = "") {
12574    const sign = offset > 0 ? "-" : "+";
12575    const absOffset = Math.abs(offset);
12576    const hours = Math.trunc(absOffset / 60);
12577    const minutes = absOffset % 60;
12578    if (minutes === 0) {
12579      return sign + String(hours);
12580    }
12581    return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
12582  }
12583  function formatTimezoneWithOptionalMinutes(offset, delimiter) {
12584    if (offset % 60 === 0) {
12585      const sign = offset > 0 ? "-" : "+";
12586      return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
12587    }
12588    return formatTimezone(offset, delimiter);
12589  }
12590  function formatTimezone(offset, delimiter = "") {
12591    const sign = offset > 0 ? "-" : "+";
12592    const absOffset = Math.abs(offset);
12593    const hours = addLeadingZeros(Math.trunc(absOffset / 60), 2);
12594    const minutes = addLeadingZeros(absOffset % 60, 2);
12595    return sign + hours + delimiter + minutes;
12596  }
12597  
12598  // packages/dataviews/node_modules/date-fns/_lib/format/longFormatters.js
12599  var dateLongFormatter = (pattern, formatLong2) => {
12600    switch (pattern) {
12601      case "P":
12602        return formatLong2.date({ width: "short" });
12603      case "PP":
12604        return formatLong2.date({ width: "medium" });
12605      case "PPP":
12606        return formatLong2.date({ width: "long" });
12607      case "PPPP":
12608      default:
12609        return formatLong2.date({ width: "full" });
12610    }
12611  };
12612  var timeLongFormatter = (pattern, formatLong2) => {
12613    switch (pattern) {
12614      case "p":
12615        return formatLong2.time({ width: "short" });
12616      case "pp":
12617        return formatLong2.time({ width: "medium" });
12618      case "ppp":
12619        return formatLong2.time({ width: "long" });
12620      case "pppp":
12621      default:
12622        return formatLong2.time({ width: "full" });
12623    }
12624  };
12625  var dateTimeLongFormatter = (pattern, formatLong2) => {
12626    const matchResult = pattern.match(/(P+)(p+)?/) || [];
12627    const datePattern = matchResult[1];
12628    const timePattern = matchResult[2];
12629    if (!timePattern) {
12630      return dateLongFormatter(pattern, formatLong2);
12631    }
12632    let dateTimeFormat;
12633    switch (datePattern) {
12634      case "P":
12635        dateTimeFormat = formatLong2.dateTime({ width: "short" });
12636        break;
12637      case "PP":
12638        dateTimeFormat = formatLong2.dateTime({ width: "medium" });
12639        break;
12640      case "PPP":
12641        dateTimeFormat = formatLong2.dateTime({ width: "long" });
12642        break;
12643      case "PPPP":
12644      default:
12645        dateTimeFormat = formatLong2.dateTime({ width: "full" });
12646        break;
12647    }
12648    return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong2)).replace("{{time}}", timeLongFormatter(timePattern, formatLong2));
12649  };
12650  var longFormatters = {
12651    p: timeLongFormatter,
12652    P: dateTimeLongFormatter
12653  };
12654  
12655  // packages/dataviews/node_modules/date-fns/_lib/protectedTokens.js
12656  var dayOfYearTokenRE = /^D+$/;
12657  var weekYearTokenRE = /^Y+$/;
12658  var throwTokens = ["D", "DD", "YY", "YYYY"];
12659  function isProtectedDayOfYearToken(token) {
12660    return dayOfYearTokenRE.test(token);
12661  }
12662  function isProtectedWeekYearToken(token) {
12663    return weekYearTokenRE.test(token);
12664  }
12665  function warnOrThrowProtectedError(token, format6, input) {
12666    const _message = message(token, format6, input);
12667    console.warn(_message);
12668    if (throwTokens.includes(token)) throw new RangeError(_message);
12669  }
12670  function message(token, format6, input) {
12671    const subject = token[0] === "Y" ? "years" : "days of the month";
12672    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`;
12673  }
12674  
12675  // packages/dataviews/node_modules/date-fns/format.js
12676  var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
12677  var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
12678  var escapedStringRegExp = /^'([^]*?)'?$/;
12679  var doubleQuoteRegExp = /''/g;
12680  var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
12681  function format(date, formatStr, options) {
12682    const defaultOptions2 = getDefaultOptions();
12683    const locale = options?.locale ?? defaultOptions2.locale ?? enUS;
12684    const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
12685    const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
12686    const originalDate = toDate(date, options?.in);
12687    if (!isValid(originalDate)) {
12688      throw new RangeError("Invalid time value");
12689    }
12690    let parts = formatStr.match(longFormattingTokensRegExp).map((substring) => {
12691      const firstCharacter = substring[0];
12692      if (firstCharacter === "p" || firstCharacter === "P") {
12693        const longFormatter = longFormatters[firstCharacter];
12694        return longFormatter(substring, locale.formatLong);
12695      }
12696      return substring;
12697    }).join("").match(formattingTokensRegExp).map((substring) => {
12698      if (substring === "''") {
12699        return { isToken: false, value: "'" };
12700      }
12701      const firstCharacter = substring[0];
12702      if (firstCharacter === "'") {
12703        return { isToken: false, value: cleanEscapedString(substring) };
12704      }
12705      if (formatters[firstCharacter]) {
12706        return { isToken: true, value: substring };
12707      }
12708      if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
12709        throw new RangeError(
12710          "Format string contains an unescaped latin alphabet character `" + firstCharacter + "`"
12711        );
12712      }
12713      return { isToken: false, value: substring };
12714    });
12715    if (locale.localize.preprocessor) {
12716      parts = locale.localize.preprocessor(originalDate, parts);
12717    }
12718    const formatterOptions = {
12719      firstWeekContainsDate,
12720      weekStartsOn,
12721      locale
12722    };
12723    return parts.map((part) => {
12724      if (!part.isToken) return part.value;
12725      const token = part.value;
12726      if (!options?.useAdditionalWeekYearTokens && isProtectedWeekYearToken(token) || !options?.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(token)) {
12727        warnOrThrowProtectedError(token, formatStr, String(date));
12728      }
12729      const formatter = formatters[token[0]];
12730      return formatter(originalDate, token, locale.localize, formatterOptions);
12731    }).join("");
12732  }
12733  function cleanEscapedString(input) {
12734    const matched = input.match(escapedStringRegExp);
12735    if (!matched) {
12736      return input;
12737    }
12738    return matched[1].replace(doubleQuoteRegExp, "'");
12739  }
12740  
12741  // packages/dataviews/node_modules/date-fns/subDays.js
12742  function subDays(date, amount, options) {
12743    return addDays(date, -amount, options);
12744  }
12745  
12746  // packages/dataviews/node_modules/date-fns/subMonths.js
12747  function subMonths(date, amount, options) {
12748    return addMonths(date, -amount, options);
12749  }
12750  
12751  // packages/dataviews/node_modules/date-fns/subYears.js
12752  function subYears(date, amount, options) {
12753    return addYears(date, -amount, options);
12754  }
12755  
12756  // packages/dataviews/build-module/dataform-controls/datetime.js
12757  var import_components34 = __toESM(require_components());
12758  var import_element39 = __toESM(require_element());
12759  var import_i18n32 = __toESM(require_i18n());
12760  var import_date2 = __toESM(require_date());
12761  
12762  // packages/dataviews/build-module/dataform-controls/utils/relative-date-control.js
12763  var import_components33 = __toESM(require_components());
12764  var import_element38 = __toESM(require_element());
12765  var import_i18n31 = __toESM(require_i18n());
12766  var import_jsx_runtime69 = __toESM(require_jsx_runtime());
12767  var TIME_UNITS_OPTIONS = {
12768    [OPERATOR_IN_THE_PAST]: [
12769      { value: "days", label: (0, import_i18n31.__)("Days") },
12770      { value: "weeks", label: (0, import_i18n31.__)("Weeks") },
12771      { value: "months", label: (0, import_i18n31.__)("Months") },
12772      { value: "years", label: (0, import_i18n31.__)("Years") }
12773    ],
12774    [OPERATOR_OVER]: [
12775      { value: "days", label: (0, import_i18n31.__)("Days ago") },
12776      { value: "weeks", label: (0, import_i18n31.__)("Weeks ago") },
12777      { value: "months", label: (0, import_i18n31.__)("Months ago") },
12778      { value: "years", label: (0, import_i18n31.__)("Years ago") }
12779    ]
12780  };
12781  function RelativeDateControl({
12782    className,
12783    data,
12784    field,
12785    onChange,
12786    hideLabelFromVision,
12787    operator
12788  }) {
12789    const options = TIME_UNITS_OPTIONS[operator === OPERATOR_IN_THE_PAST ? "inThePast" : "over"];
12790    const { id, label, getValue, setValue } = field;
12791    const fieldValue = getValue({ item: data });
12792    const { value: relValue = "", unit = options[0].value } = fieldValue && typeof fieldValue === "object" ? fieldValue : {};
12793    const onChangeValue = (0, import_element38.useCallback)(
12794      (newValue) => onChange(
12795        setValue({
12796          item: data,
12797          value: { value: Number(newValue), unit }
12798        })
12799      ),
12800      [onChange, setValue, data, unit]
12801    );
12802    const onChangeUnit = (0, import_element38.useCallback)(
12803      (newUnit) => onChange(
12804        setValue({
12805          item: data,
12806          value: { value: relValue, unit: newUnit }
12807        })
12808      ),
12809      [onChange, setValue, data, relValue]
12810    );
12811    return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
12812      import_components33.BaseControl,
12813      {
12814        id,
12815        className: clsx_default(className, "dataviews-controls__relative-date"),
12816        label,
12817        hideLabelFromVision,
12818        children: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_components33.__experimentalHStack, { spacing: 2.5, children: [
12819          /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
12820            import_components33.__experimentalNumberControl,
12821            {
12822              __next40pxDefaultSize: true,
12823              className: "dataviews-controls__relative-date-number",
12824              spinControls: "none",
12825              min: 1,
12826              step: 1,
12827              value: relValue,
12828              onChange: onChangeValue
12829            }
12830          ),
12831          /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
12832            import_components33.SelectControl,
12833            {
12834              className: "dataviews-controls__relative-date-unit",
12835              __next40pxDefaultSize: true,
12836              label: (0, import_i18n31.__)("Unit"),
12837              value: unit,
12838              options,
12839              onChange: onChangeUnit,
12840              hideLabelFromVision: true
12841            }
12842          )
12843        ] })
12844      }
12845    );
12846  }
12847  
12848  // packages/dataviews/build-module/field-types/utils/parse-date-time.js
12849  var import_date = __toESM(require_date());
12850  function parseDateTime(dateTimeString) {
12851    if (!dateTimeString) {
12852      return null;
12853    }
12854    const parsed = (0, import_date.getDate)(dateTimeString);
12855    return parsed && isValid(parsed) ? parsed : null;
12856  }
12857  
12858  // packages/dataviews/build-module/dataform-controls/datetime.js
12859  var import_jsx_runtime70 = __toESM(require_jsx_runtime());
12860  var { DateCalendar, ValidatedInputControl } = unlock(import_components34.privateApis);
12861  var formatDateTime = (date) => {
12862    if (!date) {
12863      return "";
12864    }
12865    if (typeof date === "string") {
12866      return date;
12867    }
12868    return format(date, "yyyy-MM-dd'T'HH:mm");
12869  };
12870  function CalendarDateTimeControl({
12871    data,
12872    field,
12873    onChange,
12874    hideLabelFromVision,
12875    validity
12876  }) {
12877    const { id, label, description, setValue, getValue, isValid: isValid2 } = field;
12878    const fieldValue = getValue({ item: data });
12879    const value = typeof fieldValue === "string" ? fieldValue : void 0;
12880    const [calendarMonth, setCalendarMonth] = (0, import_element39.useState)(() => {
12881      const parsedDate = parseDateTime(value);
12882      return parsedDate || /* @__PURE__ */ new Date();
12883    });
12884    const inputControlRef = (0, import_element39.useRef)(null);
12885    const validationTimeoutRef = (0, import_element39.useRef)();
12886    const previousFocusRef = (0, import_element39.useRef)(null);
12887    const onChangeCallback = (0, import_element39.useCallback)(
12888      (newValue) => onChange(setValue({ item: data, value: newValue })),
12889      [data, onChange, setValue]
12890    );
12891    (0, import_element39.useEffect)(() => {
12892      return () => {
12893        if (validationTimeoutRef.current) {
12894          clearTimeout(validationTimeoutRef.current);
12895        }
12896      };
12897    }, []);
12898    const onSelectDate = (0, import_element39.useCallback)(
12899      (newDate) => {
12900        let dateTimeValue;
12901        if (newDate) {
12902          let finalDateTime = newDate;
12903          if (value) {
12904            const currentDateTime = parseDateTime(value);
12905            if (currentDateTime) {
12906              finalDateTime = new Date(newDate);
12907              finalDateTime.setHours(currentDateTime.getHours());
12908              finalDateTime.setMinutes(
12909                currentDateTime.getMinutes()
12910              );
12911            }
12912          }
12913          dateTimeValue = finalDateTime.toISOString();
12914          onChangeCallback(dateTimeValue);
12915          if (validationTimeoutRef.current) {
12916            clearTimeout(validationTimeoutRef.current);
12917          }
12918        } else {
12919          onChangeCallback(void 0);
12920        }
12921        previousFocusRef.current = inputControlRef.current && inputControlRef.current.ownerDocument.activeElement;
12922        validationTimeoutRef.current = setTimeout(() => {
12923          if (inputControlRef.current) {
12924            inputControlRef.current.focus();
12925            inputControlRef.current.blur();
12926            onChangeCallback(dateTimeValue);
12927            if (previousFocusRef.current && previousFocusRef.current instanceof HTMLElement) {
12928              previousFocusRef.current.focus();
12929            }
12930          }
12931        }, 0);
12932      },
12933      [onChangeCallback, value]
12934    );
12935    const handleManualDateTimeChange = (0, import_element39.useCallback)(
12936      (newValue) => {
12937        if (newValue) {
12938          const dateTime = new Date(newValue);
12939          onChangeCallback(dateTime.toISOString());
12940          const parsedDate = parseDateTime(dateTime.toISOString());
12941          if (parsedDate) {
12942            setCalendarMonth(parsedDate);
12943          }
12944        } else {
12945          onChangeCallback(void 0);
12946        }
12947      },
12948      [onChangeCallback]
12949    );
12950    const { format: fieldFormat } = field;
12951    const weekStartsOn = fieldFormat.weekStartsOn ?? (0, import_date2.getSettings)().l10n.startOfWeek;
12952    const {
12953      timezone: { string: timezoneString }
12954    } = (0, import_date2.getSettings)();
12955    const displayLabel = isValid2?.required && !hideLabelFromVision ? `$label} (${(0, import_i18n32.__)("Required")})` : label;
12956    return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
12957      import_components34.BaseControl,
12958      {
12959        id,
12960        label: displayLabel,
12961        help: description,
12962        hideLabelFromVision,
12963        children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_components34.__experimentalVStack, { spacing: 4, children: [
12964          /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
12965            DateCalendar,
12966            {
12967              style: { width: "100%" },
12968              selected: value ? parseDateTime(value) || void 0 : void 0,
12969              onSelect: onSelectDate,
12970              month: calendarMonth,
12971              onMonthChange: setCalendarMonth,
12972              timeZone: timezoneString || void 0,
12973              weekStartsOn
12974            }
12975          ),
12976          /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
12977            ValidatedInputControl,
12978            {
12979              ref: inputControlRef,
12980              __next40pxDefaultSize: true,
12981              required: !!isValid2?.required,
12982              customValidity: getCustomValidity(isValid2, validity),
12983              type: "datetime-local",
12984              label: (0, import_i18n32.__)("Date time"),
12985              hideLabelFromVision: true,
12986              value: value ? formatDateTime(
12987                parseDateTime(value) || void 0
12988              ) : "",
12989              onChange: handleManualDateTimeChange
12990            }
12991          )
12992        ] })
12993      }
12994    );
12995  }
12996  function DateTime({
12997    data,
12998    field,
12999    onChange,
13000    hideLabelFromVision,
13001    operator,
13002    validity
13003  }) {
13004    if (operator === OPERATOR_IN_THE_PAST || operator === OPERATOR_OVER) {
13005      return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
13006        RelativeDateControl,
13007        {
13008          className: "dataviews-controls__datetime",
13009          data,
13010          field,
13011          onChange,
13012          hideLabelFromVision,
13013          operator
13014        }
13015      );
13016    }
13017    return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
13018      CalendarDateTimeControl,
13019      {
13020        data,
13021        field,
13022        onChange,
13023        hideLabelFromVision,
13024        validity
13025      }
13026    );
13027  }
13028  
13029  // packages/dataviews/build-module/dataform-controls/date.js
13030  var import_components35 = __toESM(require_components());
13031  var import_element40 = __toESM(require_element());
13032  var import_i18n33 = __toESM(require_i18n());
13033  var import_date3 = __toESM(require_date());
13034  var import_jsx_runtime71 = __toESM(require_jsx_runtime());
13035  var { DateCalendar: DateCalendar2, DateRangeCalendar } = unlock(import_components35.privateApis);
13036  var DATE_PRESETS = [
13037    {
13038      id: "today",
13039      label: (0, import_i18n33.__)("Today"),
13040      getValue: () => (0, import_date3.getDate)(null)
13041    },
13042    {
13043      id: "yesterday",
13044      label: (0, import_i18n33.__)("Yesterday"),
13045      getValue: () => {
13046        const today = (0, import_date3.getDate)(null);
13047        return subDays(today, 1);
13048      }
13049    },
13050    {
13051      id: "past-week",
13052      label: (0, import_i18n33.__)("Past week"),
13053      getValue: () => {
13054        const today = (0, import_date3.getDate)(null);
13055        return subDays(today, 7);
13056      }
13057    },
13058    {
13059      id: "past-month",
13060      label: (0, import_i18n33.__)("Past month"),
13061      getValue: () => {
13062        const today = (0, import_date3.getDate)(null);
13063        return subMonths(today, 1);
13064      }
13065    }
13066  ];
13067  var DATE_RANGE_PRESETS = [
13068    {
13069      id: "last-7-days",
13070      label: (0, import_i18n33.__)("Last 7 days"),
13071      getValue: () => {
13072        const today = (0, import_date3.getDate)(null);
13073        return [subDays(today, 7), today];
13074      }
13075    },
13076    {
13077      id: "last-30-days",
13078      label: (0, import_i18n33.__)("Last 30 days"),
13079      getValue: () => {
13080        const today = (0, import_date3.getDate)(null);
13081        return [subDays(today, 30), today];
13082      }
13083    },
13084    {
13085      id: "month-to-date",
13086      label: (0, import_i18n33.__)("Month to date"),
13087      getValue: () => {
13088        const today = (0, import_date3.getDate)(null);
13089        return [startOfMonth(today), today];
13090      }
13091    },
13092    {
13093      id: "last-year",
13094      label: (0, import_i18n33.__)("Last year"),
13095      getValue: () => {
13096        const today = (0, import_date3.getDate)(null);
13097        return [subYears(today, 1), today];
13098      }
13099    },
13100    {
13101      id: "year-to-date",
13102      label: (0, import_i18n33.__)("Year to date"),
13103      getValue: () => {
13104        const today = (0, import_date3.getDate)(null);
13105        return [startOfYear(today), today];
13106      }
13107    }
13108  ];
13109  var parseDate = (dateString) => {
13110    if (!dateString) {
13111      return null;
13112    }
13113    const parsed = (0, import_date3.getDate)(dateString);
13114    return parsed && isValid(parsed) ? parsed : null;
13115  };
13116  var formatDate = (date) => {
13117    if (!date) {
13118      return "";
13119    }
13120    return typeof date === "string" ? date : format(date, "yyyy-MM-dd");
13121  };
13122  function ValidatedDateControl({
13123    field,
13124    validity,
13125    inputRefs,
13126    isTouched,
13127    setIsTouched,
13128    children
13129  }) {
13130    const { isValid: isValid2 } = field;
13131    const [customValidity, setCustomValidity] = (0, import_element40.useState)(void 0);
13132    const validateRefs = (0, import_element40.useCallback)(() => {
13133      const refs = Array.isArray(inputRefs) ? inputRefs : [inputRefs];
13134      for (const ref of refs) {
13135        const input = ref.current;
13136        if (input && !input.validity.valid) {
13137          setCustomValidity({
13138            type: "invalid",
13139            message: input.validationMessage
13140          });
13141          return;
13142        }
13143      }
13144      setCustomValidity(void 0);
13145    }, [inputRefs]);
13146    (0, import_element40.useEffect)(() => {
13147      if (isTouched) {
13148        const timeoutId = setTimeout(() => {
13149          if (validity) {
13150            setCustomValidity(getCustomValidity(isValid2, validity));
13151          } else {
13152            validateRefs();
13153          }
13154        }, 0);
13155        return () => clearTimeout(timeoutId);
13156      }
13157      return void 0;
13158    }, [isTouched, isValid2, validity, validateRefs]);
13159    const onBlur = (event) => {
13160      if (isTouched) {
13161        return;
13162      }
13163      if (!event.relatedTarget || !event.currentTarget.contains(event.relatedTarget)) {
13164        setIsTouched(true);
13165      }
13166    };
13167    return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { onBlur, children: [
13168      children,
13169      /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { "aria-live": "polite", children: customValidity && /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
13170        "p",
13171        {
13172          className: clsx_default(
13173            "components-validated-control__indicator",
13174            customValidity.type === "invalid" ? "is-invalid" : void 0,
13175            customValidity.type === "valid" ? "is-valid" : void 0
13176          ),
13177          children: [
13178            /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
13179              import_components35.Icon,
13180              {
13181                className: "components-validated-control__indicator-icon",
13182                icon: error_default,
13183                size: 16,
13184                fill: "currentColor"
13185              }
13186            ),
13187            customValidity.message
13188          ]
13189        }
13190      ) })
13191    ] });
13192  }
13193  function CalendarDateControl({
13194    data,
13195    field,
13196    onChange,
13197    hideLabelFromVision,
13198    validity
13199  }) {
13200    const {
13201      id,
13202      label,
13203      setValue,
13204      getValue,
13205      isValid: isValid2,
13206      format: fieldFormat
13207    } = field;
13208    const [selectedPresetId, setSelectedPresetId] = (0, import_element40.useState)(
13209      null
13210    );
13211    const weekStartsOn = fieldFormat.weekStartsOn ?? (0, import_date3.getSettings)().l10n.startOfWeek;
13212    const fieldValue = getValue({ item: data });
13213    const value = typeof fieldValue === "string" ? fieldValue : void 0;
13214    const [calendarMonth, setCalendarMonth] = (0, import_element40.useState)(() => {
13215      const parsedDate = parseDate(value);
13216      return parsedDate || /* @__PURE__ */ new Date();
13217    });
13218    const [isTouched, setIsTouched] = (0, import_element40.useState)(false);
13219    const validityTargetRef = (0, import_element40.useRef)(null);
13220    const onChangeCallback = (0, import_element40.useCallback)(
13221      (newValue) => onChange(setValue({ item: data, value: newValue })),
13222      [data, onChange, setValue]
13223    );
13224    const onSelectDate = (0, import_element40.useCallback)(
13225      (newDate) => {
13226        const dateValue = newDate ? format(newDate, "yyyy-MM-dd") : void 0;
13227        onChangeCallback(dateValue);
13228        setSelectedPresetId(null);
13229        setIsTouched(true);
13230      },
13231      [onChangeCallback]
13232    );
13233    const handlePresetClick = (0, import_element40.useCallback)(
13234      (preset) => {
13235        const presetDate = preset.getValue();
13236        const dateValue = formatDate(presetDate);
13237        setCalendarMonth(presetDate);
13238        onChangeCallback(dateValue);
13239        setSelectedPresetId(preset.id);
13240        setIsTouched(true);
13241      },
13242      [onChangeCallback]
13243    );
13244    const handleManualDateChange = (0, import_element40.useCallback)(
13245      (newValue) => {
13246        onChangeCallback(newValue);
13247        if (newValue) {
13248          const parsedDate = parseDate(newValue);
13249          if (parsedDate) {
13250            setCalendarMonth(parsedDate);
13251          }
13252        }
13253        setSelectedPresetId(null);
13254        setIsTouched(true);
13255      },
13256      [onChangeCallback]
13257    );
13258    const {
13259      timezone: { string: timezoneString }
13260    } = (0, import_date3.getSettings)();
13261    const displayLabel = isValid2?.required ? `$label} (${(0, import_i18n33.__)("Required")})` : label;
13262    return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
13263      ValidatedDateControl,
13264      {
13265        field,
13266        validity,
13267        inputRefs: validityTargetRef,
13268        isTouched,
13269        setIsTouched,
13270        children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
13271          import_components35.BaseControl,
13272          {
13273            id,
13274            className: "dataviews-controls__date",
13275            label: displayLabel,
13276            hideLabelFromVision,
13277            children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_components35.__experimentalVStack, { spacing: 4, children: [
13278              /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_components35.__experimentalHStack, { spacing: 2, wrap: true, justify: "flex-start", children: [
13279                DATE_PRESETS.map((preset) => {
13280                  const isSelected2 = selectedPresetId === preset.id;
13281                  return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
13282                    import_components35.Button,
13283                    {
13284                      className: "dataviews-controls__date-preset",
13285                      variant: "tertiary",
13286                      isPressed: isSelected2,
13287                      size: "small",
13288                      onClick: () => handlePresetClick(preset),
13289                      children: preset.label
13290                    },
13291                    preset.id
13292                  );
13293                }),
13294                /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
13295                  import_components35.Button,
13296                  {
13297                    className: "dataviews-controls__date-preset",
13298                    variant: "tertiary",
13299                    isPressed: !selectedPresetId,
13300                    size: "small",
13301                    disabled: !!selectedPresetId,
13302                    accessibleWhenDisabled: false,
13303                    children: (0, import_i18n33.__)("Custom")
13304                  }
13305                )
13306              ] }),
13307              /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
13308                import_components35.__experimentalInputControl,
13309                {
13310                  __next40pxDefaultSize: true,
13311                  ref: validityTargetRef,
13312                  type: "date",
13313                  label: (0, import_i18n33.__)("Date"),
13314                  hideLabelFromVision: true,
13315                  value,
13316                  onChange: handleManualDateChange,
13317                  required: !!field.isValid?.required
13318                }
13319              ),
13320              /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
13321                DateCalendar2,
13322                {
13323                  style: { width: "100%" },
13324                  selected: value ? parseDate(value) || void 0 : void 0,
13325                  onSelect: onSelectDate,
13326                  month: calendarMonth,
13327                  onMonthChange: setCalendarMonth,
13328                  timeZone: timezoneString || void 0,
13329                  weekStartsOn
13330                }
13331              )
13332            ] })
13333          }
13334        )
13335      }
13336    );
13337  }
13338  function CalendarDateRangeControl({
13339    data,
13340    field,
13341    onChange,
13342    hideLabelFromVision,
13343    validity
13344  }) {
13345    const { id, label, getValue, setValue, format: fieldFormat } = field;
13346    let value;
13347    const fieldValue = getValue({ item: data });
13348    if (Array.isArray(fieldValue) && fieldValue.length === 2 && fieldValue.every((date) => typeof date === "string")) {
13349      value = fieldValue;
13350    }
13351    const weekStartsOn = fieldFormat.weekStartsOn ?? (0, import_date3.getSettings)().l10n.startOfWeek;
13352    const onChangeCallback = (0, import_element40.useCallback)(
13353      (newValue) => {
13354        onChange(
13355          setValue({
13356            item: data,
13357            value: newValue
13358          })
13359        );
13360      },
13361      [data, onChange, setValue]
13362    );
13363    const [selectedPresetId, setSelectedPresetId] = (0, import_element40.useState)(
13364      null
13365    );
13366    const selectedRange = (0, import_element40.useMemo)(() => {
13367      if (!value) {
13368        return { from: void 0, to: void 0 };
13369      }
13370      const [from, to] = value;
13371      return {
13372        from: parseDate(from) || void 0,
13373        to: parseDate(to) || void 0
13374      };
13375    }, [value]);
13376    const [calendarMonth, setCalendarMonth] = (0, import_element40.useState)(() => {
13377      return selectedRange.from || /* @__PURE__ */ new Date();
13378    });
13379    const [isTouched, setIsTouched] = (0, import_element40.useState)(false);
13380    const fromInputRef = (0, import_element40.useRef)(null);
13381    const toInputRef = (0, import_element40.useRef)(null);
13382    const updateDateRange = (0, import_element40.useCallback)(
13383      (fromDate, toDate2) => {
13384        if (fromDate && toDate2) {
13385          onChangeCallback([
13386            formatDate(fromDate),
13387            formatDate(toDate2)
13388          ]);
13389        } else if (!fromDate && !toDate2) {
13390          onChangeCallback(void 0);
13391        }
13392      },
13393      [onChangeCallback]
13394    );
13395    const onSelectCalendarRange = (0, import_element40.useCallback)(
13396      (newRange) => {
13397        updateDateRange(newRange?.from, newRange?.to);
13398        setSelectedPresetId(null);
13399        setIsTouched(true);
13400      },
13401      [updateDateRange]
13402    );
13403    const handlePresetClick = (0, import_element40.useCallback)(
13404      (preset) => {
13405        const [startDate, endDate] = preset.getValue();
13406        setCalendarMonth(startDate);
13407        updateDateRange(startDate, endDate);
13408        setSelectedPresetId(preset.id);
13409        setIsTouched(true);
13410      },
13411      [updateDateRange]
13412    );
13413    const handleManualDateChange = (0, import_element40.useCallback)(
13414      (fromOrTo, newValue) => {
13415        const [currentFrom, currentTo] = value || [
13416          void 0,
13417          void 0
13418        ];
13419        const updatedFrom = fromOrTo === "from" ? newValue : currentFrom;
13420        const updatedTo = fromOrTo === "to" ? newValue : currentTo;
13421        updateDateRange(updatedFrom, updatedTo);
13422        if (newValue) {
13423          const parsedDate = parseDate(newValue);
13424          if (parsedDate) {
13425            setCalendarMonth(parsedDate);
13426          }
13427        }
13428        setSelectedPresetId(null);
13429        setIsTouched(true);
13430      },
13431      [value, updateDateRange]
13432    );
13433    const { timezone } = (0, import_date3.getSettings)();
13434    const displayLabel = field.isValid?.required ? `$label} (${(0, import_i18n33.__)("Required")})` : label;
13435    return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
13436      ValidatedDateControl,
13437      {
13438        field,
13439        validity,
13440        inputRefs: [fromInputRef, toInputRef],
13441        isTouched,
13442        setIsTouched,
13443        children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
13444          import_components35.BaseControl,
13445          {
13446            id,
13447            className: "dataviews-controls__date",
13448            label: displayLabel,
13449            hideLabelFromVision,
13450            children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_components35.__experimentalVStack, { spacing: 4, children: [
13451              /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_components35.__experimentalHStack, { spacing: 2, wrap: true, justify: "flex-start", children: [
13452                DATE_RANGE_PRESETS.map((preset) => {
13453                  const isSelected2 = selectedPresetId === preset.id;
13454                  return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
13455                    import_components35.Button,
13456                    {
13457                      className: "dataviews-controls__date-preset",
13458                      variant: "tertiary",
13459                      isPressed: isSelected2,
13460                      size: "small",
13461                      onClick: () => handlePresetClick(preset),
13462                      children: preset.label
13463                    },
13464                    preset.id
13465                  );
13466                }),
13467                /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
13468                  import_components35.Button,
13469                  {
13470                    className: "dataviews-controls__date-preset",
13471                    variant: "tertiary",
13472                    isPressed: !selectedPresetId,
13473                    size: "small",
13474                    accessibleWhenDisabled: false,
13475                    disabled: !!selectedPresetId,
13476                    children: (0, import_i18n33.__)("Custom")
13477                  }
13478                )
13479              ] }),
13480              /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_components35.__experimentalHStack, { spacing: 2, children: [
13481                /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
13482                  import_components35.__experimentalInputControl,
13483                  {
13484                    __next40pxDefaultSize: true,
13485                    ref: fromInputRef,
13486                    type: "date",
13487                    label: (0, import_i18n33.__)("From"),
13488                    hideLabelFromVision: true,
13489                    value: value?.[0],
13490                    onChange: (newValue) => handleManualDateChange("from", newValue),
13491                    required: !!field.isValid?.required
13492                  }
13493                ),
13494                /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
13495                  import_components35.__experimentalInputControl,
13496                  {
13497                    __next40pxDefaultSize: true,
13498                    ref: toInputRef,
13499                    type: "date",
13500                    label: (0, import_i18n33.__)("To"),
13501                    hideLabelFromVision: true,
13502                    value: value?.[1],
13503                    onChange: (newValue) => handleManualDateChange("to", newValue),
13504                    required: !!field.isValid?.required
13505                  }
13506                )
13507              ] }),
13508              /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
13509                DateRangeCalendar,
13510                {
13511                  style: { width: "100%" },
13512                  selected: selectedRange,
13513                  onSelect: onSelectCalendarRange,
13514                  month: calendarMonth,
13515                  onMonthChange: setCalendarMonth,
13516                  timeZone: timezone.string || void 0,
13517                  weekStartsOn
13518                }
13519              )
13520            ] })
13521          }
13522        )
13523      }
13524    );
13525  }
13526  function DateControl({
13527    data,
13528    field,
13529    onChange,
13530    hideLabelFromVision,
13531    operator,
13532    validity
13533  }) {
13534    if (operator === OPERATOR_IN_THE_PAST || operator === OPERATOR_OVER) {
13535      return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
13536        RelativeDateControl,
13537        {
13538          className: "dataviews-controls__date",
13539          data,
13540          field,
13541          onChange,
13542          hideLabelFromVision,
13543          operator
13544        }
13545      );
13546    }
13547    if (operator === OPERATOR_BETWEEN) {
13548      return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
13549        CalendarDateRangeControl,
13550        {
13551          data,
13552          field,
13553          onChange,
13554          hideLabelFromVision,
13555          validity
13556        }
13557      );
13558    }
13559    return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
13560      CalendarDateControl,
13561      {
13562        data,
13563        field,
13564        onChange,
13565        hideLabelFromVision,
13566        validity
13567      }
13568    );
13569  }
13570  
13571  // packages/dataviews/build-module/dataform-controls/email.js
13572  var import_components37 = __toESM(require_components());
13573  
13574  // packages/dataviews/build-module/dataform-controls/utils/validated-input.js
13575  var import_components36 = __toESM(require_components());
13576  var import_element41 = __toESM(require_element());
13577  var import_jsx_runtime72 = __toESM(require_jsx_runtime());
13578  var { ValidatedInputControl: ValidatedInputControl2 } = unlock(import_components36.privateApis);
13579  function ValidatedText({
13580    data,
13581    field,
13582    onChange,
13583    hideLabelFromVision,
13584    type,
13585    prefix,
13586    suffix,
13587    validity
13588  }) {
13589    const { label, placeholder, description, getValue, setValue, isValid: isValid2 } = field;
13590    const value = getValue({ item: data });
13591    const onChangeControl = (0, import_element41.useCallback)(
13592      (newValue) => onChange(
13593        setValue({
13594          item: data,
13595          value: newValue
13596        })
13597      ),
13598      [data, setValue, onChange]
13599    );
13600    return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
13601      ValidatedInputControl2,
13602      {
13603        required: !!isValid2.required,
13604        customValidity: getCustomValidity(isValid2, validity),
13605        label,
13606        placeholder,
13607        value: value ?? "",
13608        help: description,
13609        onChange: onChangeControl,
13610        hideLabelFromVision,
13611        type,
13612        prefix,
13613        suffix,
13614        pattern: isValid2.pattern ? isValid2.pattern.constraint : void 0,
13615        minLength: isValid2.minLength ? isValid2.minLength.constraint : void 0,
13616        maxLength: isValid2.maxLength ? isValid2.maxLength.constraint : void 0,
13617        __next40pxDefaultSize: true
13618      }
13619    );
13620  }
13621  
13622  // packages/dataviews/build-module/dataform-controls/email.js
13623  var import_jsx_runtime73 = __toESM(require_jsx_runtime());
13624  function Email({
13625    data,
13626    field,
13627    onChange,
13628    hideLabelFromVision,
13629    validity
13630  }) {
13631    return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
13632      ValidatedText,
13633      {
13634        ...{
13635          data,
13636          field,
13637          onChange,
13638          hideLabelFromVision,
13639          validity,
13640          type: "email",
13641          prefix: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_components37.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_components37.Icon, { icon: envelope_default }) })
13642        }
13643      }
13644    );
13645  }
13646  
13647  // packages/dataviews/build-module/dataform-controls/telephone.js
13648  var import_components38 = __toESM(require_components());
13649  var import_jsx_runtime74 = __toESM(require_jsx_runtime());
13650  function Telephone({
13651    data,
13652    field,
13653    onChange,
13654    hideLabelFromVision,
13655    validity
13656  }) {
13657    return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
13658      ValidatedText,
13659      {
13660        ...{
13661          data,
13662          field,
13663          onChange,
13664          hideLabelFromVision,
13665          validity,
13666          type: "tel",
13667          prefix: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_components38.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_components38.Icon, { icon: mobile_default }) })
13668        }
13669      }
13670    );
13671  }
13672  
13673  // packages/dataviews/build-module/dataform-controls/url.js
13674  var import_components39 = __toESM(require_components());
13675  var import_jsx_runtime75 = __toESM(require_jsx_runtime());
13676  function Url({
13677    data,
13678    field,
13679    onChange,
13680    hideLabelFromVision,
13681    validity
13682  }) {
13683    return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
13684      ValidatedText,
13685      {
13686        ...{
13687          data,
13688          field,
13689          onChange,
13690          hideLabelFromVision,
13691          validity,
13692          type: "url",
13693          prefix: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_components39.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_components39.Icon, { icon: link_default }) })
13694        }
13695      }
13696    );
13697  }
13698  
13699  // packages/dataviews/build-module/dataform-controls/utils/validated-number.js
13700  var import_components40 = __toESM(require_components());
13701  var import_element42 = __toESM(require_element());
13702  var import_i18n34 = __toESM(require_i18n());
13703  var import_jsx_runtime76 = __toESM(require_jsx_runtime());
13704  var { ValidatedNumberControl } = unlock(import_components40.privateApis);
13705  function toNumberOrEmpty(value) {
13706    if (value === "" || value === void 0) {
13707      return "";
13708    }
13709    const number = Number(value);
13710    return Number.isFinite(number) ? number : "";
13711  }
13712  function BetweenControls({
13713    value,
13714    onChange,
13715    hideLabelFromVision,
13716    step
13717  }) {
13718    const [min = "", max = ""] = value;
13719    const onChangeMin = (0, import_element42.useCallback)(
13720      (newValue) => onChange([toNumberOrEmpty(newValue), max]),
13721      [onChange, max]
13722    );
13723    const onChangeMax = (0, import_element42.useCallback)(
13724      (newValue) => onChange([min, toNumberOrEmpty(newValue)]),
13725      [onChange, min]
13726    );
13727    return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
13728      import_components40.BaseControl,
13729      {
13730        help: (0, import_i18n34.__)("The max. value must be greater than the min. value."),
13731        children: /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(import_components40.Flex, { direction: "row", gap: 4, children: [
13732          /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
13733            import_components40.__experimentalNumberControl,
13734            {
13735              label: (0, import_i18n34.__)("Min."),
13736              value: min,
13737              max: max ? Number(max) - step : void 0,
13738              onChange: onChangeMin,
13739              __next40pxDefaultSize: true,
13740              hideLabelFromVision,
13741              step
13742            }
13743          ),
13744          /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
13745            import_components40.__experimentalNumberControl,
13746            {
13747              label: (0, import_i18n34.__)("Max."),
13748              value: max,
13749              min: min ? Number(min) + step : void 0,
13750              onChange: onChangeMax,
13751              __next40pxDefaultSize: true,
13752              hideLabelFromVision,
13753              step
13754            }
13755          )
13756        ] })
13757      }
13758    );
13759  }
13760  function ValidatedNumber({
13761    data,
13762    field,
13763    onChange,
13764    hideLabelFromVision,
13765    operator,
13766    validity
13767  }) {
13768    const decimals = field.format?.decimals ?? 0;
13769    const step = Math.pow(10, Math.abs(decimals) * -1);
13770    const { label, description, getValue, setValue, isValid: isValid2 } = field;
13771    const value = getValue({ item: data }) ?? "";
13772    const onChangeControl = (0, import_element42.useCallback)(
13773      (newValue) => {
13774        onChange(
13775          setValue({
13776            item: data,
13777            // Do not convert an empty string or undefined to a number,
13778            // otherwise there's a mismatch between the UI control (empty)
13779            // and the data relied by onChange (0).
13780            value: ["", void 0].includes(newValue) ? void 0 : Number(newValue)
13781          })
13782        );
13783      },
13784      [data, onChange, setValue]
13785    );
13786    const onChangeBetweenControls = (0, import_element42.useCallback)(
13787      (newValue) => {
13788        onChange(
13789          setValue({
13790            item: data,
13791            value: newValue
13792          })
13793        );
13794      },
13795      [data, onChange, setValue]
13796    );
13797    if (operator === OPERATOR_BETWEEN) {
13798      let valueBetween = ["", ""];
13799      if (Array.isArray(value) && value.length === 2 && value.every(
13800        (element) => typeof element === "number" || element === ""
13801      )) {
13802        valueBetween = value;
13803      }
13804      return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
13805        BetweenControls,
13806        {
13807          value: valueBetween,
13808          onChange: onChangeBetweenControls,
13809          hideLabelFromVision,
13810          step
13811        }
13812      );
13813    }
13814    return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
13815      ValidatedNumberControl,
13816      {
13817        required: !!isValid2.required,
13818        customValidity: getCustomValidity(isValid2, validity),
13819        label,
13820        help: description,
13821        value,
13822        onChange: onChangeControl,
13823        __next40pxDefaultSize: true,
13824        hideLabelFromVision,
13825        step,
13826        min: isValid2.min ? isValid2.min.constraint : void 0,
13827        max: isValid2.max ? isValid2.max.constraint : void 0
13828      }
13829    );
13830  }
13831  
13832  // packages/dataviews/build-module/dataform-controls/integer.js
13833  var import_jsx_runtime77 = __toESM(require_jsx_runtime());
13834  function Integer(props) {
13835    return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ValidatedNumber, { ...props });
13836  }
13837  
13838  // packages/dataviews/build-module/dataform-controls/number.js
13839  var import_jsx_runtime78 = __toESM(require_jsx_runtime());
13840  function Number2(props) {
13841    return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(ValidatedNumber, { ...props });
13842  }
13843  
13844  // packages/dataviews/build-module/dataform-controls/radio.js
13845  var import_components41 = __toESM(require_components());
13846  var import_element43 = __toESM(require_element());
13847  var import_jsx_runtime79 = __toESM(require_jsx_runtime());
13848  var { ValidatedRadioControl } = unlock(import_components41.privateApis);
13849  function Radio({
13850    data,
13851    field,
13852    onChange,
13853    hideLabelFromVision,
13854    validity
13855  }) {
13856    const { label, description, getValue, setValue, isValid: isValid2 } = field;
13857    const { elements, isLoading } = useElements({
13858      elements: field.elements,
13859      getElements: field.getElements
13860    });
13861    const value = getValue({ item: data });
13862    const onChangeControl = (0, import_element43.useCallback)(
13863      (newValue) => onChange(setValue({ item: data, value: newValue })),
13864      [data, onChange, setValue]
13865    );
13866    if (isLoading) {
13867      return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_components41.Spinner, {});
13868    }
13869    return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
13870      ValidatedRadioControl,
13871      {
13872        required: !!field.isValid?.required,
13873        customValidity: getCustomValidity(isValid2, validity),
13874        label,
13875        help: description,
13876        onChange: onChangeControl,
13877        options: elements,
13878        selected: value,
13879        hideLabelFromVision
13880      }
13881    );
13882  }
13883  
13884  // packages/dataviews/build-module/dataform-controls/select.js
13885  var import_components42 = __toESM(require_components());
13886  var import_element44 = __toESM(require_element());
13887  var import_jsx_runtime80 = __toESM(require_jsx_runtime());
13888  var { ValidatedSelectControl } = unlock(import_components42.privateApis);
13889  function Select({
13890    data,
13891    field,
13892    onChange,
13893    hideLabelFromVision,
13894    validity
13895  }) {
13896    const { type, label, description, getValue, setValue, isValid: isValid2 } = field;
13897    const isMultiple = type === "array";
13898    const value = getValue({ item: data }) ?? (isMultiple ? [] : "");
13899    const onChangeControl = (0, import_element44.useCallback)(
13900      (newValue) => onChange(setValue({ item: data, value: newValue })),
13901      [data, onChange, setValue]
13902    );
13903    const { elements, isLoading } = useElements({
13904      elements: field.elements,
13905      getElements: field.getElements
13906    });
13907    if (isLoading) {
13908      return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_components42.Spinner, {});
13909    }
13910    return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
13911      ValidatedSelectControl,
13912      {
13913        required: !!field.isValid?.required,
13914        customValidity: getCustomValidity(isValid2, validity),
13915        label,
13916        value,
13917        help: description,
13918        options: elements,
13919        onChange: onChangeControl,
13920        __next40pxDefaultSize: true,
13921        hideLabelFromVision,
13922        multiple: isMultiple
13923      }
13924    );
13925  }
13926  
13927  // packages/dataviews/build-module/dataform-controls/text.js
13928  var import_element45 = __toESM(require_element());
13929  var import_jsx_runtime81 = __toESM(require_jsx_runtime());
13930  function Text2({
13931    data,
13932    field,
13933    onChange,
13934    hideLabelFromVision,
13935    config,
13936    validity
13937  }) {
13938    const { prefix, suffix } = config || {};
13939    return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
13940      ValidatedText,
13941      {
13942        ...{
13943          data,
13944          field,
13945          onChange,
13946          hideLabelFromVision,
13947          validity,
13948          prefix: prefix ? (0, import_element45.createElement)(prefix) : void 0,
13949          suffix: suffix ? (0, import_element45.createElement)(suffix) : void 0
13950        }
13951      }
13952    );
13953  }
13954  
13955  // packages/dataviews/build-module/dataform-controls/toggle.js
13956  var import_components43 = __toESM(require_components());
13957  var import_element46 = __toESM(require_element());
13958  var import_jsx_runtime82 = __toESM(require_jsx_runtime());
13959  var { ValidatedToggleControl } = unlock(import_components43.privateApis);
13960  function Toggle({
13961    field,
13962    onChange,
13963    data,
13964    hideLabelFromVision,
13965    validity
13966  }) {
13967    const { label, description, getValue, setValue, isValid: isValid2 } = field;
13968    const onChangeControl = (0, import_element46.useCallback)(() => {
13969      onChange(
13970        setValue({ item: data, value: !getValue({ item: data }) })
13971      );
13972    }, [onChange, setValue, data, getValue]);
13973    return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
13974      ValidatedToggleControl,
13975      {
13976        required: !!isValid2.required,
13977        customValidity: getCustomValidity(isValid2, validity),
13978        hidden: hideLabelFromVision,
13979        label,
13980        help: description,
13981        checked: getValue({ item: data }),
13982        onChange: onChangeControl
13983      }
13984    );
13985  }
13986  
13987  // packages/dataviews/build-module/dataform-controls/textarea.js
13988  var import_components44 = __toESM(require_components());
13989  var import_element47 = __toESM(require_element());
13990  var import_jsx_runtime83 = __toESM(require_jsx_runtime());
13991  var { ValidatedTextareaControl } = unlock(import_components44.privateApis);
13992  function Textarea({
13993    data,
13994    field,
13995    onChange,
13996    hideLabelFromVision,
13997    config,
13998    validity
13999  }) {
14000    const { rows = 4 } = config || {};
14001    const { label, placeholder, description, setValue, isValid: isValid2 } = field;
14002    const value = field.getValue({ item: data });
14003    const onChangeControl = (0, import_element47.useCallback)(
14004      (newValue) => onChange(setValue({ item: data, value: newValue })),
14005      [data, onChange, setValue]
14006    );
14007    return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
14008      ValidatedTextareaControl,
14009      {
14010        required: !!isValid2.required,
14011        customValidity: getCustomValidity(isValid2, validity),
14012        label,
14013        placeholder,
14014        value: value ?? "",
14015        help: description,
14016        onChange: onChangeControl,
14017        rows,
14018        minLength: isValid2.minLength ? isValid2.minLength.constraint : void 0,
14019        maxLength: isValid2.maxLength ? isValid2.maxLength.constraint : void 0,
14020        __next40pxDefaultSize: true,
14021        hideLabelFromVision
14022      }
14023    );
14024  }
14025  
14026  // packages/dataviews/build-module/dataform-controls/toggle-group.js
14027  var import_components45 = __toESM(require_components());
14028  var import_element48 = __toESM(require_element());
14029  var import_jsx_runtime84 = __toESM(require_jsx_runtime());
14030  var { ValidatedToggleGroupControl } = unlock(import_components45.privateApis);
14031  function ToggleGroup({
14032    data,
14033    field,
14034    onChange,
14035    hideLabelFromVision,
14036    validity
14037  }) {
14038    const { getValue, setValue, isValid: isValid2 } = field;
14039    const value = getValue({ item: data });
14040    const onChangeControl = (0, import_element48.useCallback)(
14041      (newValue) => onChange(setValue({ item: data, value: newValue })),
14042      [data, onChange, setValue]
14043    );
14044    const { elements, isLoading } = useElements({
14045      elements: field.elements,
14046      getElements: field.getElements
14047    });
14048    if (isLoading) {
14049      return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_components45.Spinner, {});
14050    }
14051    if (elements.length === 0) {
14052      return null;
14053    }
14054    const selectedOption = elements.find((el) => el.value === value);
14055    return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
14056      ValidatedToggleGroupControl,
14057      {
14058        required: !!field.isValid?.required,
14059        customValidity: getCustomValidity(isValid2, validity),
14060        __next40pxDefaultSize: true,
14061        isBlock: true,
14062        label: field.label,
14063        help: selectedOption?.description || field.description,
14064        onChange: onChangeControl,
14065        value,
14066        hideLabelFromVision,
14067        children: elements.map((el) => /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
14068          import_components45.__experimentalToggleGroupControlOption,
14069          {
14070            label: el.label,
14071            value: el.value
14072          },
14073          el.value
14074        ))
14075      }
14076    );
14077  }
14078  
14079  // packages/dataviews/build-module/dataform-controls/array.js
14080  var import_components46 = __toESM(require_components());
14081  var import_element49 = __toESM(require_element());
14082  var import_jsx_runtime85 = __toESM(require_jsx_runtime());
14083  var { ValidatedFormTokenField } = unlock(import_components46.privateApis);
14084  function ArrayControl({
14085    data,
14086    field,
14087    onChange,
14088    hideLabelFromVision,
14089    validity
14090  }) {
14091    const { label, placeholder, getValue, setValue, isValid: isValid2 } = field;
14092    const value = getValue({ item: data });
14093    const { elements, isLoading } = useElements({
14094      elements: field.elements,
14095      getElements: field.getElements
14096    });
14097    const arrayValueAsElements = (0, import_element49.useMemo)(
14098      () => Array.isArray(value) ? value.map((token) => {
14099        const element = elements?.find(
14100          (suggestion) => suggestion.value === token
14101        );
14102        return element || { value: token, label: token };
14103      }) : [],
14104      [value, elements]
14105    );
14106    const onChangeControl = (0, import_element49.useCallback)(
14107      (tokens) => {
14108        const valueTokens = tokens.map((token) => {
14109          if (typeof token === "object" && "value" in token) {
14110            return token.value;
14111          }
14112          return token;
14113        });
14114        onChange(setValue({ item: data, value: valueTokens }));
14115      },
14116      [onChange, setValue, data]
14117    );
14118    if (isLoading) {
14119      return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_components46.Spinner, {});
14120    }
14121    return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
14122      ValidatedFormTokenField,
14123      {
14124        required: !!isValid2?.required,
14125        customValidity: getCustomValidity(isValid2, validity),
14126        label: hideLabelFromVision ? void 0 : label,
14127        value: arrayValueAsElements,
14128        onChange: onChangeControl,
14129        placeholder,
14130        suggestions: elements?.map((element) => element.value),
14131        __experimentalValidateInput: (token) => {
14132          if (field.isValid?.elements && elements) {
14133            return elements.some(
14134              (element) => element.value === token || element.label === token
14135            );
14136          }
14137          return true;
14138        },
14139        __experimentalExpandOnFocus: elements && elements.length > 0,
14140        __experimentalShowHowTo: !field.isValid?.elements,
14141        displayTransform: (token) => {
14142          if (typeof token === "object" && "label" in token) {
14143            return token.label;
14144          }
14145          if (typeof token === "string" && elements) {
14146            const element = elements.find(
14147              (el) => el.value === token
14148            );
14149            return element?.label || token;
14150          }
14151          return token;
14152        },
14153        __experimentalRenderItem: ({ item }) => {
14154          if (typeof item === "string" && elements) {
14155            const element = elements.find(
14156              (el) => el.value === item
14157            );
14158            return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { children: element?.label || item });
14159          }
14160          return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { children: item });
14161        }
14162      }
14163    );
14164  }
14165  
14166  // node_modules/colord/index.mjs
14167  var r2 = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) };
14168  var t = function(r3) {
14169    return "string" == typeof r3 ? r3.length > 0 : "number" == typeof r3;
14170  };
14171  var n = function(r3, t2, n2) {
14172    return void 0 === t2 && (t2 = 0), void 0 === n2 && (n2 = Math.pow(10, t2)), Math.round(n2 * r3) / n2 + 0;
14173  };
14174  var e = function(r3, t2, n2) {
14175    return void 0 === t2 && (t2 = 0), void 0 === n2 && (n2 = 1), r3 > n2 ? n2 : r3 > t2 ? r3 : t2;
14176  };
14177  var u = function(r3) {
14178    return (r3 = isFinite(r3) ? r3 % 360 : 0) > 0 ? r3 : r3 + 360;
14179  };
14180  var a = function(r3) {
14181    return { r: e(r3.r, 0, 255), g: e(r3.g, 0, 255), b: e(r3.b, 0, 255), a: e(r3.a) };
14182  };
14183  var o = function(r3) {
14184    return { r: n(r3.r), g: n(r3.g), b: n(r3.b), a: n(r3.a, 3) };
14185  };
14186  var i = /^#([0-9a-f]{3,8})$/i;
14187  var s = function(r3) {
14188    var t2 = r3.toString(16);
14189    return t2.length < 2 ? "0" + t2 : t2;
14190  };
14191  var h = function(r3) {
14192    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;
14193    return { h: 60 * (i2 < 0 ? i2 + 6 : i2), s: a2 ? o2 / a2 * 100 : 0, v: a2 / 255 * 100, a: u2 };
14194  };
14195  var b = function(r3) {
14196    var t2 = r3.h, n2 = r3.s, e2 = r3.v, u2 = r3.a;
14197    t2 = t2 / 360 * 6, n2 /= 100, e2 /= 100;
14198    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;
14199    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 };
14200  };
14201  var g = function(r3) {
14202    return { h: u(r3.h), s: e(r3.s, 0, 100), l: e(r3.l, 0, 100), a: e(r3.a) };
14203  };
14204  var d = function(r3) {
14205    return { h: n(r3.h), s: n(r3.s), l: n(r3.l), a: n(r3.a, 3) };
14206  };
14207  var f = function(r3) {
14208    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 }));
14209    var t2, n2, e2;
14210  };
14211  var c = function(r3) {
14212    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 };
14213    var t2, n2, e2, u2;
14214  };
14215  var l = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i;
14216  var p = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i;
14217  var v = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i;
14218  var m = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i;
14219  var y = { string: [[function(r3) {
14220    var t2 = i.exec(r3);
14221    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;
14222  }, "hex"], [function(r3) {
14223    var t2 = v.exec(r3) || m.exec(r3);
14224    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;
14225  }, "rgb"], [function(t2) {
14226    var n2 = l.exec(t2) || p.exec(t2);
14227    if (!n2) return null;
14228    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) });
14229    return f(a2);
14230  }, "hsl"]], object: [[function(r3) {
14231    var n2 = r3.r, e2 = r3.g, u2 = r3.b, o2 = r3.a, i2 = void 0 === o2 ? 1 : o2;
14232    return t(n2) && t(e2) && t(u2) ? a({ r: Number(n2), g: Number(e2), b: Number(u2), a: Number(i2) }) : null;
14233  }, "rgb"], [function(r3) {
14234    var n2 = r3.h, e2 = r3.s, u2 = r3.l, a2 = r3.a, o2 = void 0 === a2 ? 1 : a2;
14235    if (!t(n2) || !t(e2) || !t(u2)) return null;
14236    var i2 = g({ h: Number(n2), s: Number(e2), l: Number(u2), a: Number(o2) });
14237    return f(i2);
14238  }, "hsl"], [function(r3) {
14239    var n2 = r3.h, a2 = r3.s, o2 = r3.v, i2 = r3.a, s2 = void 0 === i2 ? 1 : i2;
14240    if (!t(n2) || !t(a2) || !t(o2)) return null;
14241    var h2 = (function(r4) {
14242      return { h: u(r4.h), s: e(r4.s, 0, 100), v: e(r4.v, 0, 100), a: e(r4.a) };
14243    })({ h: Number(n2), s: Number(a2), v: Number(o2), a: Number(s2) });
14244    return b(h2);
14245  }, "hsv"]] };
14246  var N = function(r3, t2) {
14247    for (var n2 = 0; n2 < t2.length; n2++) {
14248      var e2 = t2[n2][0](r3);
14249      if (e2) return [e2, t2[n2][1]];
14250    }
14251    return [null, void 0];
14252  };
14253  var x = function(r3) {
14254    return "string" == typeof r3 ? N(r3.trim(), y.string) : "object" == typeof r3 && null !== r3 ? N(r3, y.object) : [null, void 0];
14255  };
14256  var M = function(r3, t2) {
14257    var n2 = c(r3);
14258    return { h: n2.h, s: e(n2.s + 100 * t2, 0, 100), l: n2.l, a: n2.a };
14259  };
14260  var H = function(r3) {
14261    return (299 * r3.r + 587 * r3.g + 114 * r3.b) / 1e3 / 255;
14262  };
14263  var $ = function(r3, t2) {
14264    var n2 = c(r3);
14265    return { h: n2.h, s: n2.s, l: e(n2.l + 100 * t2, 0, 100), a: n2.a };
14266  };
14267  var j = (function() {
14268    function r3(r4) {
14269      this.parsed = x(r4)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 };
14270    }
14271    return r3.prototype.isValid = function() {
14272      return null !== this.parsed;
14273    }, r3.prototype.brightness = function() {
14274      return n(H(this.rgba), 2);
14275    }, r3.prototype.isDark = function() {
14276      return H(this.rgba) < 0.5;
14277    }, r3.prototype.isLight = function() {
14278      return H(this.rgba) >= 0.5;
14279    }, r3.prototype.toHex = function() {
14280      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;
14281      var r4, t2, e2, u2, a2, i2;
14282    }, r3.prototype.toRgb = function() {
14283      return o(this.rgba);
14284    }, r3.prototype.toRgbString = function() {
14285      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 + ")";
14286      var r4, t2, n2, e2, u2;
14287    }, r3.prototype.toHsl = function() {
14288      return d(c(this.rgba));
14289    }, r3.prototype.toHslString = function() {
14290      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 + "%)";
14291      var r4, t2, n2, e2, u2;
14292    }, r3.prototype.toHsv = function() {
14293      return r4 = h(this.rgba), { h: n(r4.h), s: n(r4.s), v: n(r4.v), a: n(r4.a, 3) };
14294      var r4;
14295    }, r3.prototype.invert = function() {
14296      return w({ r: 255 - (r4 = this.rgba).r, g: 255 - r4.g, b: 255 - r4.b, a: r4.a });
14297      var r4;
14298    }, r3.prototype.saturate = function(r4) {
14299      return void 0 === r4 && (r4 = 0.1), w(M(this.rgba, r4));
14300    }, r3.prototype.desaturate = function(r4) {
14301      return void 0 === r4 && (r4 = 0.1), w(M(this.rgba, -r4));
14302    }, r3.prototype.grayscale = function() {
14303      return w(M(this.rgba, -1));
14304    }, r3.prototype.lighten = function(r4) {
14305      return void 0 === r4 && (r4 = 0.1), w($(this.rgba, r4));
14306    }, r3.prototype.darken = function(r4) {
14307      return void 0 === r4 && (r4 = 0.1), w($(this.rgba, -r4));
14308    }, r3.prototype.rotate = function(r4) {
14309      return void 0 === r4 && (r4 = 15), this.hue(this.hue() + r4);
14310    }, r3.prototype.alpha = function(r4) {
14311      return "number" == typeof r4 ? w({ r: (t2 = this.rgba).r, g: t2.g, b: t2.b, a: r4 }) : n(this.rgba.a, 3);
14312      var t2;
14313    }, r3.prototype.hue = function(r4) {
14314      var t2 = c(this.rgba);
14315      return "number" == typeof r4 ? w({ h: r4, s: t2.s, l: t2.l, a: t2.a }) : n(t2.h);
14316    }, r3.prototype.isEqual = function(r4) {
14317      return this.toHex() === w(r4).toHex();
14318    }, r3;
14319  })();
14320  var w = function(r3) {
14321    return r3 instanceof j ? r3 : new j(r3);
14322  };
14323  
14324  // packages/dataviews/build-module/dataform-controls/color.js
14325  var import_components47 = __toESM(require_components());
14326  var import_element50 = __toESM(require_element());
14327  var import_jsx_runtime86 = __toESM(require_jsx_runtime());
14328  var { ValidatedInputControl: ValidatedInputControl3, Picker } = unlock(import_components47.privateApis);
14329  var ColorPicker = ({
14330    color,
14331    onColorChange
14332  }) => {
14333    const validColor = color && w(color).isValid() ? color : "#ffffff";
14334    return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
14335      import_components47.Dropdown,
14336      {
14337        renderToggle: ({ onToggle, isOpen }) => /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_components47.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
14338          "button",
14339          {
14340            type: "button",
14341            onClick: onToggle,
14342            style: {
14343              width: "24px",
14344              height: "24px",
14345              borderRadius: "50%",
14346              backgroundColor: validColor,
14347              border: "1px solid #ddd",
14348              cursor: "pointer",
14349              outline: isOpen ? "2px solid #007cba" : "none",
14350              outlineOffset: "2px",
14351              display: "flex",
14352              alignItems: "center",
14353              justifyContent: "center",
14354              padding: 0,
14355              margin: 0
14356            },
14357            "aria-label": "Open color picker"
14358          }
14359        ) }),
14360        renderContent: () => /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { style: { padding: "16px" }, children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
14361          Picker,
14362          {
14363            color: w(validColor),
14364            onChange: onColorChange,
14365            enableAlpha: true
14366          }
14367        ) })
14368      }
14369    );
14370  };
14371  function Color({
14372    data,
14373    field,
14374    onChange,
14375    hideLabelFromVision,
14376    validity
14377  }) {
14378    const { label, placeholder, description, setValue, isValid: isValid2 } = field;
14379    const value = field.getValue({ item: data }) || "";
14380    const handleColorChange = (0, import_element50.useCallback)(
14381      (colorObject) => {
14382        onChange(setValue({ item: data, value: colorObject.toHex() }));
14383      },
14384      [data, onChange, setValue]
14385    );
14386    const handleInputChange = (0, import_element50.useCallback)(
14387      (newValue) => {
14388        onChange(setValue({ item: data, value: newValue || "" }));
14389      },
14390      [data, onChange, setValue]
14391    );
14392    return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
14393      ValidatedInputControl3,
14394      {
14395        required: !!field.isValid?.required,
14396        customValidity: getCustomValidity(isValid2, validity),
14397        label,
14398        placeholder,
14399        value,
14400        help: description,
14401        onChange: handleInputChange,
14402        hideLabelFromVision,
14403        type: "text",
14404        prefix: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
14405          ColorPicker,
14406          {
14407            color: value,
14408            onColorChange: handleColorChange
14409          }
14410        )
14411      }
14412    );
14413  }
14414  
14415  // packages/dataviews/build-module/dataform-controls/password.js
14416  var import_components48 = __toESM(require_components());
14417  var import_element51 = __toESM(require_element());
14418  var import_i18n35 = __toESM(require_i18n());
14419  var import_jsx_runtime87 = __toESM(require_jsx_runtime());
14420  function Password({
14421    data,
14422    field,
14423    onChange,
14424    hideLabelFromVision,
14425    validity
14426  }) {
14427    const [isVisible2, setIsVisible] = (0, import_element51.useState)(false);
14428    const toggleVisibility = (0, import_element51.useCallback)(() => {
14429      setIsVisible((prev) => !prev);
14430    }, []);
14431    return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
14432      ValidatedText,
14433      {
14434        ...{
14435          data,
14436          field,
14437          onChange,
14438          hideLabelFromVision,
14439          validity,
14440          type: isVisible2 ? "text" : "password",
14441          suffix: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_components48.__experimentalInputControlSuffixWrapper, { variant: "control", children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
14442            import_components48.Button,
14443            {
14444              icon: isVisible2 ? unseen_default : seen_default,
14445              onClick: toggleVisibility,
14446              size: "small",
14447              label: isVisible2 ? (0, import_i18n35.__)("Hide password") : (0, import_i18n35.__)("Show password")
14448            }
14449          ) })
14450        }
14451      }
14452    );
14453  }
14454  
14455  // packages/dataviews/build-module/field-types/utils/has-elements.js
14456  function hasElements(field) {
14457    return Array.isArray(field.elements) && field.elements.length > 0 || typeof field.getElements === "function";
14458  }
14459  
14460  // packages/dataviews/build-module/dataform-controls/index.js
14461  var import_jsx_runtime88 = __toESM(require_jsx_runtime());
14462  var FORM_CONTROLS = {
14463    array: ArrayControl,
14464    checkbox: Checkbox,
14465    color: Color,
14466    datetime: DateTime,
14467    date: DateControl,
14468    email: Email,
14469    telephone: Telephone,
14470    url: Url,
14471    integer: Integer,
14472    number: Number2,
14473    password: Password,
14474    radio: Radio,
14475    select: Select,
14476    text: Text2,
14477    toggle: Toggle,
14478    textarea: Textarea,
14479    toggleGroup: ToggleGroup
14480  };
14481  function isEditConfig(value) {
14482    return value && typeof value === "object" && typeof value.control === "string";
14483  }
14484  function createConfiguredControl(config) {
14485    const { control, ...controlConfig } = config;
14486    const BaseControlType = getControlByType(control);
14487    if (BaseControlType === null) {
14488      return null;
14489    }
14490    return function ConfiguredControl(props) {
14491      return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(BaseControlType, { ...props, config: controlConfig });
14492    };
14493  }
14494  function getControl(field, fallback) {
14495    if (typeof field.Edit === "function") {
14496      return field.Edit;
14497    }
14498    if (typeof field.Edit === "string") {
14499      return getControlByType(field.Edit);
14500    }
14501    if (isEditConfig(field.Edit)) {
14502      return createConfiguredControl(field.Edit);
14503    }
14504    if (hasElements(field) && field.type !== "array") {
14505      return getControlByType("select");
14506    }
14507    if (fallback === null) {
14508      return null;
14509    }
14510    return getControlByType(fallback);
14511  }
14512  function getControlByType(type) {
14513    if (Object.keys(FORM_CONTROLS).includes(type)) {
14514      return FORM_CONTROLS[type];
14515    }
14516    return null;
14517  }
14518  
14519  // packages/dataviews/build-module/field-types/utils/get-filter-by.js
14520  function getFilterBy(field, defaultOperators, validOperators) {
14521    if (field.filterBy === false) {
14522      return false;
14523    }
14524    const operators = field.filterBy?.operators?.filter(
14525      (op) => validOperators.includes(op)
14526    ) ?? defaultOperators;
14527    if (operators.length === 0) {
14528      return false;
14529    }
14530    return {
14531      isPrimary: !!field.filterBy?.isPrimary,
14532      operators
14533    };
14534  }
14535  var get_filter_by_default = getFilterBy;
14536  
14537  // packages/dataviews/build-module/field-types/utils/get-value-from-id.js
14538  var getValueFromId = (id) => ({ item }) => {
14539    const path = id.split(".");
14540    let value = item;
14541    for (const segment of path) {
14542      if (value.hasOwnProperty(segment)) {
14543        value = value[segment];
14544      } else {
14545        value = void 0;
14546      }
14547    }
14548    return value;
14549  };
14550  var get_value_from_id_default = getValueFromId;
14551  
14552  // packages/dataviews/build-module/field-types/utils/set-value-from-id.js
14553  var setValueFromId = (id) => ({ value }) => {
14554    const path = id.split(".");
14555    const result = {};
14556    let current = result;
14557    for (const segment of path.slice(0, -1)) {
14558      current[segment] = {};
14559      current = current[segment];
14560    }
14561    current[path.at(-1)] = value;
14562    return result;
14563  };
14564  var set_value_from_id_default = setValueFromId;
14565  
14566  // packages/dataviews/build-module/field-types/email.js
14567  var import_i18n36 = __toESM(require_i18n());
14568  
14569  // packages/dataviews/build-module/field-types/utils/render-from-elements.js
14570  function RenderFromElements({
14571    item,
14572    field
14573  }) {
14574    const { elements, isLoading } = useElements({
14575      elements: field.elements,
14576      getElements: field.getElements
14577    });
14578    const value = field.getValue({ item });
14579    if (isLoading) {
14580      return value;
14581    }
14582    if (elements.length === 0) {
14583      return value;
14584    }
14585    return elements?.find((element) => element.value === value)?.label || field.getValue({ item });
14586  }
14587  
14588  // packages/dataviews/build-module/field-types/utils/render-default.js
14589  var import_jsx_runtime89 = __toESM(require_jsx_runtime());
14590  function render({
14591    item,
14592    field
14593  }) {
14594    if (field.hasElements) {
14595      return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(RenderFromElements, { item, field });
14596    }
14597    return field.getValueFormatted({ item, field });
14598  }
14599  
14600  // packages/dataviews/build-module/field-types/utils/sort-text.js
14601  var sort_text_default = (a2, b2, direction) => {
14602    return direction === "asc" ? a2.localeCompare(b2) : b2.localeCompare(a2);
14603  };
14604  
14605  // packages/dataviews/build-module/field-types/utils/is-valid-required.js
14606  function isValidRequired(item, field) {
14607    const value = field.getValue({ item });
14608    return ![void 0, "", null].includes(value);
14609  }
14610  
14611  // packages/dataviews/build-module/field-types/utils/is-valid-min-length.js
14612  function isValidMinLength(item, field) {
14613    if (typeof field.isValid.minLength?.constraint !== "number") {
14614      return false;
14615    }
14616    const value = field.getValue({ item });
14617    if ([void 0, "", null].includes(value)) {
14618      return true;
14619    }
14620    return String(value).length >= field.isValid.minLength.constraint;
14621  }
14622  
14623  // packages/dataviews/build-module/field-types/utils/is-valid-max-length.js
14624  function isValidMaxLength(item, field) {
14625    if (typeof field.isValid.maxLength?.constraint !== "number") {
14626      return false;
14627    }
14628    const value = field.getValue({ item });
14629    if ([void 0, "", null].includes(value)) {
14630      return true;
14631    }
14632    return String(value).length <= field.isValid.maxLength.constraint;
14633  }
14634  
14635  // packages/dataviews/build-module/field-types/utils/is-valid-pattern.js
14636  function isValidPattern(item, field) {
14637    if (field.isValid.pattern?.constraint === void 0) {
14638      return true;
14639    }
14640    try {
14641      const regexp = new RegExp(field.isValid.pattern.constraint);
14642      const value = field.getValue({ item });
14643      if ([void 0, "", null].includes(value)) {
14644        return true;
14645      }
14646      return regexp.test(String(value));
14647    } catch {
14648      return false;
14649    }
14650  }
14651  
14652  // packages/dataviews/build-module/field-types/utils/is-valid-elements.js
14653  function isValidElements(item, field) {
14654    const elements = field.elements ?? [];
14655    const validValues = elements.map((el) => el.value);
14656    if (validValues.length === 0) {
14657      return true;
14658    }
14659    const value = field.getValue({ item });
14660    return [].concat(value).every((v2) => validValues.includes(v2));
14661  }
14662  
14663  // packages/dataviews/build-module/field-types/utils/get-value-formatted-default.js
14664  function getValueFormatted({
14665    item,
14666    field
14667  }) {
14668    return field.getValue({ item });
14669  }
14670  var get_value_formatted_default_default = getValueFormatted;
14671  
14672  // packages/dataviews/build-module/field-types/email.js
14673  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])?)*$/;
14674  function isValidCustom(item, field) {
14675    const value = field.getValue({ item });
14676    if (![void 0, "", null].includes(value) && !emailRegex.test(value)) {
14677      return (0, import_i18n36.__)("Value must be a valid email address.");
14678    }
14679    return null;
14680  }
14681  var email_default = {
14682    type: "email",
14683    render,
14684    Edit: "email",
14685    sort: sort_text_default,
14686    enableSorting: true,
14687    enableGlobalSearch: false,
14688    defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE],
14689    validOperators: [
14690      OPERATOR_IS,
14691      OPERATOR_IS_NOT,
14692      OPERATOR_CONTAINS,
14693      OPERATOR_NOT_CONTAINS,
14694      OPERATOR_STARTS_WITH,
14695      // Multiple selection
14696      OPERATOR_IS_ANY,
14697      OPERATOR_IS_NONE,
14698      OPERATOR_IS_ALL,
14699      OPERATOR_IS_NOT_ALL
14700    ],
14701    format: {},
14702    getValueFormatted: get_value_formatted_default_default,
14703    validate: {
14704      required: isValidRequired,
14705      pattern: isValidPattern,
14706      minLength: isValidMinLength,
14707      maxLength: isValidMaxLength,
14708      elements: isValidElements,
14709      custom: isValidCustom
14710    }
14711  };
14712  
14713  // packages/dataviews/build-module/field-types/integer.js
14714  var import_i18n37 = __toESM(require_i18n());
14715  
14716  // packages/dataviews/build-module/field-types/utils/sort-number.js
14717  var sort_number_default = (a2, b2, direction) => {
14718    return direction === "asc" ? a2 - b2 : b2 - a2;
14719  };
14720  
14721  // packages/dataviews/build-module/field-types/utils/is-valid-min.js
14722  function isValidMin(item, field) {
14723    if (typeof field.isValid.min?.constraint !== "number") {
14724      return false;
14725    }
14726    const value = field.getValue({ item });
14727    if ([void 0, "", null].includes(value)) {
14728      return true;
14729    }
14730    return Number(value) >= field.isValid.min.constraint;
14731  }
14732  
14733  // packages/dataviews/build-module/field-types/utils/is-valid-max.js
14734  function isValidMax(item, field) {
14735    if (typeof field.isValid.max?.constraint !== "number") {
14736      return false;
14737    }
14738    const value = field.getValue({ item });
14739    if ([void 0, "", null].includes(value)) {
14740      return true;
14741    }
14742    return Number(value) <= field.isValid.max.constraint;
14743  }
14744  
14745  // packages/dataviews/build-module/field-types/integer.js
14746  var format2 = {
14747    separatorThousand: ","
14748  };
14749  function getValueFormatted2({
14750    item,
14751    field
14752  }) {
14753    let value = field.getValue({ item });
14754    if (value === null || value === void 0) {
14755      return "";
14756    }
14757    value = Number(value);
14758    if (!Number.isFinite(value)) {
14759      return String(value);
14760    }
14761    let formatInteger;
14762    if (field.type !== "integer") {
14763      formatInteger = format2;
14764    } else {
14765      formatInteger = field.format;
14766    }
14767    const { separatorThousand } = formatInteger;
14768    const integerValue = Math.trunc(value);
14769    if (!separatorThousand) {
14770      return String(integerValue);
14771    }
14772    return String(integerValue).replace(
14773      /\B(?=(\d{3})+(?!\d))/g,
14774      separatorThousand
14775    );
14776  }
14777  function isValidCustom2(item, field) {
14778    const value = field.getValue({ item });
14779    if (![void 0, "", null].includes(value) && !Number.isInteger(value)) {
14780      return (0, import_i18n37.__)("Value must be an integer.");
14781    }
14782    return null;
14783  }
14784  var integer_default = {
14785    type: "integer",
14786    render,
14787    Edit: "integer",
14788    sort: sort_number_default,
14789    enableSorting: true,
14790    enableGlobalSearch: false,
14791    defaultOperators: [
14792      OPERATOR_IS,
14793      OPERATOR_IS_NOT,
14794      OPERATOR_LESS_THAN,
14795      OPERATOR_GREATER_THAN,
14796      OPERATOR_LESS_THAN_OR_EQUAL,
14797      OPERATOR_GREATER_THAN_OR_EQUAL,
14798      OPERATOR_BETWEEN
14799    ],
14800    validOperators: [
14801      // Single-selection
14802      OPERATOR_IS,
14803      OPERATOR_IS_NOT,
14804      OPERATOR_LESS_THAN,
14805      OPERATOR_GREATER_THAN,
14806      OPERATOR_LESS_THAN_OR_EQUAL,
14807      OPERATOR_GREATER_THAN_OR_EQUAL,
14808      OPERATOR_BETWEEN,
14809      // Multiple-selection
14810      OPERATOR_IS_ANY,
14811      OPERATOR_IS_NONE,
14812      OPERATOR_IS_ALL,
14813      OPERATOR_IS_NOT_ALL
14814    ],
14815    format: format2,
14816    getValueFormatted: getValueFormatted2,
14817    validate: {
14818      required: isValidRequired,
14819      min: isValidMin,
14820      max: isValidMax,
14821      elements: isValidElements,
14822      custom: isValidCustom2
14823    }
14824  };
14825  
14826  // packages/dataviews/build-module/field-types/number.js
14827  var import_i18n38 = __toESM(require_i18n());
14828  var format3 = {
14829    separatorThousand: ",",
14830    separatorDecimal: ".",
14831    decimals: 2
14832  };
14833  function getValueFormatted3({
14834    item,
14835    field
14836  }) {
14837    let value = field.getValue({ item });
14838    if (value === null || value === void 0) {
14839      return "";
14840    }
14841    value = Number(value);
14842    if (!Number.isFinite(value)) {
14843      return String(value);
14844    }
14845    let formatNumber;
14846    if (field.type !== "number") {
14847      formatNumber = format3;
14848    } else {
14849      formatNumber = field.format;
14850    }
14851    const { separatorThousand, separatorDecimal, decimals } = formatNumber;
14852    const fixedValue = value.toFixed(decimals);
14853    const [integerPart, decimalPart] = fixedValue.split(".");
14854    const formattedInteger = separatorThousand ? integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, separatorThousand) : integerPart;
14855    return decimals === 0 ? formattedInteger : formattedInteger + separatorDecimal + decimalPart;
14856  }
14857  function isEmpty2(value) {
14858    return value === "" || value === void 0 || value === null;
14859  }
14860  function isValidCustom3(item, field) {
14861    const value = field.getValue({ item });
14862    if (!isEmpty2(value) && !Number.isFinite(value)) {
14863      return (0, import_i18n38.__)("Value must be a number.");
14864    }
14865    return null;
14866  }
14867  var number_default = {
14868    type: "number",
14869    render,
14870    Edit: "number",
14871    sort: sort_number_default,
14872    enableSorting: true,
14873    enableGlobalSearch: false,
14874    defaultOperators: [
14875      OPERATOR_IS,
14876      OPERATOR_IS_NOT,
14877      OPERATOR_LESS_THAN,
14878      OPERATOR_GREATER_THAN,
14879      OPERATOR_LESS_THAN_OR_EQUAL,
14880      OPERATOR_GREATER_THAN_OR_EQUAL,
14881      OPERATOR_BETWEEN
14882    ],
14883    validOperators: [
14884      // Single-selection
14885      OPERATOR_IS,
14886      OPERATOR_IS_NOT,
14887      OPERATOR_LESS_THAN,
14888      OPERATOR_GREATER_THAN,
14889      OPERATOR_LESS_THAN_OR_EQUAL,
14890      OPERATOR_GREATER_THAN_OR_EQUAL,
14891      OPERATOR_BETWEEN,
14892      // Multiple-selection
14893      OPERATOR_IS_ANY,
14894      OPERATOR_IS_NONE,
14895      OPERATOR_IS_ALL,
14896      OPERATOR_IS_NOT_ALL
14897    ],
14898    format: format3,
14899    getValueFormatted: getValueFormatted3,
14900    validate: {
14901      required: isValidRequired,
14902      min: isValidMin,
14903      max: isValidMax,
14904      elements: isValidElements,
14905      custom: isValidCustom3
14906    }
14907  };
14908  
14909  // packages/dataviews/build-module/field-types/text.js
14910  var text_default = {
14911    type: "text",
14912    render,
14913    Edit: "text",
14914    sort: sort_text_default,
14915    enableSorting: true,
14916    enableGlobalSearch: false,
14917    defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE],
14918    validOperators: [
14919      // Single selection
14920      OPERATOR_IS,
14921      OPERATOR_IS_NOT,
14922      OPERATOR_CONTAINS,
14923      OPERATOR_NOT_CONTAINS,
14924      OPERATOR_STARTS_WITH,
14925      // Multiple selection
14926      OPERATOR_IS_ANY,
14927      OPERATOR_IS_NONE,
14928      OPERATOR_IS_ALL,
14929      OPERATOR_IS_NOT_ALL
14930    ],
14931    format: {},
14932    getValueFormatted: get_value_formatted_default_default,
14933    validate: {
14934      required: isValidRequired,
14935      pattern: isValidPattern,
14936      minLength: isValidMinLength,
14937      maxLength: isValidMaxLength,
14938      elements: isValidElements
14939    }
14940  };
14941  
14942  // packages/dataviews/build-module/field-types/datetime.js
14943  var import_date5 = __toESM(require_date());
14944  var format4 = {
14945    datetime: (0, import_date5.getSettings)().formats.datetime,
14946    weekStartsOn: (0, import_date5.getSettings)().l10n.startOfWeek
14947  };
14948  function getValueFormatted4({
14949    item,
14950    field
14951  }) {
14952    const value = field.getValue({ item });
14953    if (["", void 0, null].includes(value)) {
14954      return "";
14955    }
14956    let formatDatetime;
14957    if (field.type !== "datetime") {
14958      formatDatetime = format4;
14959    } else {
14960      formatDatetime = field.format;
14961    }
14962    return (0, import_date5.dateI18n)(formatDatetime.datetime, (0, import_date5.getDate)(value));
14963  }
14964  var sort = (a2, b2, direction) => {
14965    const timeA = new Date(a2).getTime();
14966    const timeB = new Date(b2).getTime();
14967    return direction === "asc" ? timeA - timeB : timeB - timeA;
14968  };
14969  var datetime_default = {
14970    type: "datetime",
14971    render,
14972    Edit: "datetime",
14973    sort,
14974    enableSorting: true,
14975    enableGlobalSearch: false,
14976    defaultOperators: [
14977      OPERATOR_ON,
14978      OPERATOR_NOT_ON,
14979      OPERATOR_BEFORE,
14980      OPERATOR_AFTER,
14981      OPERATOR_BEFORE_INC,
14982      OPERATOR_AFTER_INC,
14983      OPERATOR_IN_THE_PAST,
14984      OPERATOR_OVER
14985    ],
14986    validOperators: [
14987      OPERATOR_ON,
14988      OPERATOR_NOT_ON,
14989      OPERATOR_BEFORE,
14990      OPERATOR_AFTER,
14991      OPERATOR_BEFORE_INC,
14992      OPERATOR_AFTER_INC,
14993      OPERATOR_IN_THE_PAST,
14994      OPERATOR_OVER
14995    ],
14996    format: format4,
14997    getValueFormatted: getValueFormatted4,
14998    validate: {
14999      required: isValidRequired,
15000      elements: isValidElements
15001    }
15002  };
15003  
15004  // packages/dataviews/build-module/field-types/date.js
15005  var import_date6 = __toESM(require_date());
15006  var format5 = {
15007    date: (0, import_date6.getSettings)().formats.date,
15008    weekStartsOn: (0, import_date6.getSettings)().l10n.startOfWeek
15009  };
15010  function getValueFormatted5({
15011    item,
15012    field
15013  }) {
15014    const value = field.getValue({ item });
15015    if (["", void 0, null].includes(value)) {
15016      return "";
15017    }
15018    let formatDate2;
15019    if (field.type !== "date") {
15020      formatDate2 = format5;
15021    } else {
15022      formatDate2 = field.format;
15023    }
15024    return (0, import_date6.dateI18n)(formatDate2.date, (0, import_date6.getDate)(value));
15025  }
15026  var sort2 = (a2, b2, direction) => {
15027    const timeA = new Date(a2).getTime();
15028    const timeB = new Date(b2).getTime();
15029    return direction === "asc" ? timeA - timeB : timeB - timeA;
15030  };
15031  var date_default = {
15032    type: "date",
15033    render,
15034    Edit: "date",
15035    sort: sort2,
15036    enableSorting: true,
15037    enableGlobalSearch: false,
15038    defaultOperators: [
15039      OPERATOR_ON,
15040      OPERATOR_NOT_ON,
15041      OPERATOR_BEFORE,
15042      OPERATOR_AFTER,
15043      OPERATOR_BEFORE_INC,
15044      OPERATOR_AFTER_INC,
15045      OPERATOR_IN_THE_PAST,
15046      OPERATOR_OVER,
15047      OPERATOR_BETWEEN
15048    ],
15049    validOperators: [
15050      OPERATOR_ON,
15051      OPERATOR_NOT_ON,
15052      OPERATOR_BEFORE,
15053      OPERATOR_AFTER,
15054      OPERATOR_BEFORE_INC,
15055      OPERATOR_AFTER_INC,
15056      OPERATOR_IN_THE_PAST,
15057      OPERATOR_OVER,
15058      OPERATOR_BETWEEN
15059    ],
15060    format: format5,
15061    getValueFormatted: getValueFormatted5,
15062    validate: {
15063      required: isValidRequired,
15064      elements: isValidElements
15065    }
15066  };
15067  
15068  // packages/dataviews/build-module/field-types/boolean.js
15069  var import_i18n39 = __toESM(require_i18n());
15070  
15071  // packages/dataviews/build-module/field-types/utils/is-valid-required-for-bool.js
15072  function isValidRequiredForBool(item, field) {
15073    const value = field.getValue({ item });
15074    return value === true;
15075  }
15076  
15077  // packages/dataviews/build-module/field-types/boolean.js
15078  function getValueFormatted6({
15079    item,
15080    field
15081  }) {
15082    const value = field.getValue({ item });
15083    if (value === true) {
15084      return (0, import_i18n39.__)("True");
15085    }
15086    if (value === false) {
15087      return (0, import_i18n39.__)("False");
15088    }
15089    return "";
15090  }
15091  function isValidCustom4(item, field) {
15092    const value = field.getValue({ item });
15093    if (![void 0, "", null].includes(value) && ![true, false].includes(value)) {
15094      return (0, import_i18n39.__)("Value must be true, false, or undefined");
15095    }
15096    return null;
15097  }
15098  var sort3 = (a2, b2, direction) => {
15099    const boolA = Boolean(a2);
15100    const boolB = Boolean(b2);
15101    if (boolA === boolB) {
15102      return 0;
15103    }
15104    if (direction === "asc") {
15105      return boolA ? 1 : -1;
15106    }
15107    return boolA ? -1 : 1;
15108  };
15109  var boolean_default = {
15110    type: "boolean",
15111    render,
15112    Edit: "checkbox",
15113    sort: sort3,
15114    validate: {
15115      required: isValidRequiredForBool,
15116      elements: isValidElements,
15117      custom: isValidCustom4
15118    },
15119    enableSorting: true,
15120    enableGlobalSearch: false,
15121    defaultOperators: [OPERATOR_IS, OPERATOR_IS_NOT],
15122    validOperators: [OPERATOR_IS, OPERATOR_IS_NOT],
15123    format: {},
15124    getValueFormatted: getValueFormatted6
15125  };
15126  
15127  // packages/dataviews/build-module/field-types/media.js
15128  var media_default = {
15129    type: "media",
15130    render: () => null,
15131    Edit: null,
15132    sort: () => 0,
15133    enableSorting: false,
15134    enableGlobalSearch: false,
15135    defaultOperators: [],
15136    validOperators: [],
15137    format: {},
15138    getValueFormatted: get_value_formatted_default_default,
15139    // cannot validate any constraint, so
15140    // the only available validation for the field author
15141    // would be providing a custom validator.
15142    validate: {}
15143  };
15144  
15145  // packages/dataviews/build-module/field-types/array.js
15146  var import_i18n40 = __toESM(require_i18n());
15147  
15148  // packages/dataviews/build-module/field-types/utils/is-valid-required-for-array.js
15149  function isValidRequiredForArray(item, field) {
15150    const value = field.getValue({ item });
15151    return Array.isArray(value) && value.length > 0 && value.every(
15152      (element) => ![void 0, "", null].includes(element)
15153    );
15154  }
15155  
15156  // packages/dataviews/build-module/field-types/array.js
15157  function getValueFormatted7({
15158    item,
15159    field
15160  }) {
15161    const value = field.getValue({ item });
15162    const arr = Array.isArray(value) ? value : [];
15163    return arr.join(", ");
15164  }
15165  function render2({ item, field }) {
15166    return getValueFormatted7({ item, field });
15167  }
15168  function isValidCustom5(item, field) {
15169    const value = field.getValue({ item });
15170    if (![void 0, "", null].includes(value) && !Array.isArray(value)) {
15171      return (0, import_i18n40.__)("Value must be an array.");
15172    }
15173    if (!value.every((v2) => typeof v2 === "string")) {
15174      return (0, import_i18n40.__)("Every value must be a string.");
15175    }
15176    return null;
15177  }
15178  var sort4 = (a2, b2, direction) => {
15179    const arrA = Array.isArray(a2) ? a2 : [];
15180    const arrB = Array.isArray(b2) ? b2 : [];
15181    if (arrA.length !== arrB.length) {
15182      return direction === "asc" ? arrA.length - arrB.length : arrB.length - arrA.length;
15183    }
15184    const joinedA = arrA.join(",");
15185    const joinedB = arrB.join(",");
15186    return direction === "asc" ? joinedA.localeCompare(joinedB) : joinedB.localeCompare(joinedA);
15187  };
15188  var array_default = {
15189    type: "array",
15190    render: render2,
15191    Edit: "array",
15192    sort: sort4,
15193    enableSorting: true,
15194    enableGlobalSearch: false,
15195    defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE],
15196    validOperators: [
15197      OPERATOR_IS_ANY,
15198      OPERATOR_IS_NONE,
15199      OPERATOR_IS_ALL,
15200      OPERATOR_IS_NOT_ALL
15201    ],
15202    format: {},
15203    getValueFormatted: getValueFormatted7,
15204    validate: {
15205      required: isValidRequiredForArray,
15206      elements: isValidElements,
15207      custom: isValidCustom5
15208    }
15209  };
15210  
15211  // packages/dataviews/build-module/field-types/password.js
15212  function getValueFormatted8({
15213    item,
15214    field
15215  }) {
15216    return field.getValue({ item }) ? "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" : "";
15217  }
15218  var password_default = {
15219    type: "password",
15220    render,
15221    Edit: "password",
15222    sort: () => 0,
15223    // Passwords should not be sortable for security reasons
15224    enableSorting: false,
15225    enableGlobalSearch: false,
15226    defaultOperators: [],
15227    validOperators: [],
15228    format: {},
15229    getValueFormatted: getValueFormatted8,
15230    validate: {
15231      required: isValidRequired,
15232      pattern: isValidPattern,
15233      minLength: isValidMinLength,
15234      maxLength: isValidMaxLength,
15235      elements: isValidElements
15236    }
15237  };
15238  
15239  // packages/dataviews/build-module/field-types/telephone.js
15240  var telephone_default = {
15241    type: "telephone",
15242    render,
15243    Edit: "telephone",
15244    sort: sort_text_default,
15245    enableSorting: true,
15246    enableGlobalSearch: false,
15247    defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE],
15248    validOperators: [
15249      OPERATOR_IS,
15250      OPERATOR_IS_NOT,
15251      OPERATOR_CONTAINS,
15252      OPERATOR_NOT_CONTAINS,
15253      OPERATOR_STARTS_WITH,
15254      // Multiple selection
15255      OPERATOR_IS_ANY,
15256      OPERATOR_IS_NONE,
15257      OPERATOR_IS_ALL,
15258      OPERATOR_IS_NOT_ALL
15259    ],
15260    format: {},
15261    getValueFormatted: get_value_formatted_default_default,
15262    validate: {
15263      required: isValidRequired,
15264      pattern: isValidPattern,
15265      minLength: isValidMinLength,
15266      maxLength: isValidMaxLength,
15267      elements: isValidElements
15268    }
15269  };
15270  
15271  // packages/dataviews/build-module/field-types/color.js
15272  var import_i18n41 = __toESM(require_i18n());
15273  var import_jsx_runtime90 = __toESM(require_jsx_runtime());
15274  function render3({ item, field }) {
15275    if (field.hasElements) {
15276      return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(RenderFromElements, { item, field });
15277    }
15278    const value = get_value_formatted_default_default({ item, field });
15279    if (!value || !w(value).isValid()) {
15280      return value;
15281    }
15282    return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
15283      /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
15284        "div",
15285        {
15286          style: {
15287            width: "16px",
15288            height: "16px",
15289            borderRadius: "50%",
15290            backgroundColor: value,
15291            border: "1px solid #ddd",
15292            flexShrink: 0
15293          }
15294        }
15295      ),
15296      /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { children: value })
15297    ] });
15298  }
15299  function isValidCustom6(item, field) {
15300    const value = field.getValue({ item });
15301    if (![void 0, "", null].includes(value) && !w(value).isValid()) {
15302      return (0, import_i18n41.__)("Value must be a valid color.");
15303    }
15304    return null;
15305  }
15306  var sort5 = (a2, b2, direction) => {
15307    const colorA = w(a2);
15308    const colorB = w(b2);
15309    if (!colorA.isValid() && !colorB.isValid()) {
15310      return 0;
15311    }
15312    if (!colorA.isValid()) {
15313      return direction === "asc" ? 1 : -1;
15314    }
15315    if (!colorB.isValid()) {
15316      return direction === "asc" ? -1 : 1;
15317    }
15318    const hslA = colorA.toHsl();
15319    const hslB = colorB.toHsl();
15320    if (hslA.h !== hslB.h) {
15321      return direction === "asc" ? hslA.h - hslB.h : hslB.h - hslA.h;
15322    }
15323    if (hslA.s !== hslB.s) {
15324      return direction === "asc" ? hslA.s - hslB.s : hslB.s - hslA.s;
15325    }
15326    return direction === "asc" ? hslA.l - hslB.l : hslB.l - hslA.l;
15327  };
15328  var color_default = {
15329    type: "color",
15330    render: render3,
15331    Edit: "color",
15332    sort: sort5,
15333    enableSorting: true,
15334    enableGlobalSearch: false,
15335    defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE],
15336    validOperators: [
15337      OPERATOR_IS,
15338      OPERATOR_IS_NOT,
15339      OPERATOR_IS_ANY,
15340      OPERATOR_IS_NONE
15341    ],
15342    format: {},
15343    getValueFormatted: get_value_formatted_default_default,
15344    validate: {
15345      required: isValidRequired,
15346      elements: isValidElements,
15347      custom: isValidCustom6
15348    }
15349  };
15350  
15351  // packages/dataviews/build-module/field-types/url.js
15352  var url_default = {
15353    type: "url",
15354    render,
15355    Edit: "url",
15356    sort: sort_text_default,
15357    enableSorting: true,
15358    enableGlobalSearch: false,
15359    defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE],
15360    validOperators: [
15361      OPERATOR_IS,
15362      OPERATOR_IS_NOT,
15363      OPERATOR_CONTAINS,
15364      OPERATOR_NOT_CONTAINS,
15365      OPERATOR_STARTS_WITH,
15366      // Multiple selection
15367      OPERATOR_IS_ANY,
15368      OPERATOR_IS_NONE,
15369      OPERATOR_IS_ALL,
15370      OPERATOR_IS_NOT_ALL
15371    ],
15372    format: {},
15373    getValueFormatted: get_value_formatted_default_default,
15374    validate: {
15375      required: isValidRequired,
15376      pattern: isValidPattern,
15377      minLength: isValidMinLength,
15378      maxLength: isValidMaxLength,
15379      elements: isValidElements
15380    }
15381  };
15382  
15383  // packages/dataviews/build-module/field-types/no-type.js
15384  var sort6 = (a2, b2, direction) => {
15385    if (typeof a2 === "number" && typeof b2 === "number") {
15386      return sort_number_default(a2, b2, direction);
15387    }
15388    return sort_text_default(a2, b2, direction);
15389  };
15390  var no_type_default = {
15391    // type: no type for this one
15392    render,
15393    Edit: null,
15394    sort: sort6,
15395    enableSorting: true,
15396    enableGlobalSearch: false,
15397    defaultOperators: [OPERATOR_IS, OPERATOR_IS_NOT],
15398    validOperators: getAllOperatorNames(),
15399    format: {},
15400    getValueFormatted: get_value_formatted_default_default,
15401    validate: {
15402      required: isValidRequired,
15403      elements: isValidElements
15404    }
15405  };
15406  
15407  // packages/dataviews/build-module/field-types/utils/get-is-valid.js
15408  function getIsValid(field, fieldType) {
15409    let required;
15410    if (field.isValid?.required === true && fieldType.validate.required !== void 0) {
15411      required = {
15412        constraint: true,
15413        validate: fieldType.validate.required
15414      };
15415    }
15416    let elements;
15417    if ((field.isValid?.elements === true || // elements is enabled unless the field opts-out
15418    field.isValid?.elements === void 0 && (!!field.elements || !!field.getElements)) && fieldType.validate.elements !== void 0) {
15419      elements = {
15420        constraint: true,
15421        validate: fieldType.validate.elements
15422      };
15423    }
15424    let min;
15425    if (typeof field.isValid?.min === "number" && fieldType.validate.min !== void 0) {
15426      min = {
15427        constraint: field.isValid.min,
15428        validate: fieldType.validate.min
15429      };
15430    }
15431    let max;
15432    if (typeof field.isValid?.max === "number" && fieldType.validate.max !== void 0) {
15433      max = {
15434        constraint: field.isValid.max,
15435        validate: fieldType.validate.max
15436      };
15437    }
15438    let minLength;
15439    if (typeof field.isValid?.minLength === "number" && fieldType.validate.minLength !== void 0) {
15440      minLength = {
15441        constraint: field.isValid.minLength,
15442        validate: fieldType.validate.minLength
15443      };
15444    }
15445    let maxLength;
15446    if (typeof field.isValid?.maxLength === "number" && fieldType.validate.maxLength !== void 0) {
15447      maxLength = {
15448        constraint: field.isValid.maxLength,
15449        validate: fieldType.validate.maxLength
15450      };
15451    }
15452    let pattern;
15453    if (field.isValid?.pattern !== void 0 && fieldType.validate.pattern !== void 0) {
15454      pattern = {
15455        constraint: field.isValid?.pattern,
15456        validate: fieldType.validate.pattern
15457      };
15458    }
15459    const custom = field.isValid?.custom ?? fieldType.validate.custom;
15460    return {
15461      required,
15462      elements,
15463      min,
15464      max,
15465      minLength,
15466      maxLength,
15467      pattern,
15468      custom
15469    };
15470  }
15471  
15472  // packages/dataviews/build-module/field-types/utils/get-format.js
15473  function getFormat(field, fieldType) {
15474    return {
15475      ...fieldType.format,
15476      ...field.format
15477    };
15478  }
15479  var get_format_default = getFormat;
15480  
15481  // packages/dataviews/build-module/field-types/index.js
15482  function getFieldTypeByName(type) {
15483    const found = [
15484      email_default,
15485      integer_default,
15486      number_default,
15487      text_default,
15488      datetime_default,
15489      date_default,
15490      boolean_default,
15491      media_default,
15492      array_default,
15493      password_default,
15494      telephone_default,
15495      color_default,
15496      url_default
15497    ].find((fieldType) => fieldType?.type === type);
15498    if (!!found) {
15499      return found;
15500    }
15501    return no_type_default;
15502  }
15503  function normalizeFields(fields) {
15504    return fields.map((field) => {
15505      const fieldType = getFieldTypeByName(field.type);
15506      const getValue = field.getValue || get_value_from_id_default(field.id);
15507      const sort7 = function(a2, b2, direction) {
15508        const aValue = getValue({ item: a2 });
15509        const bValue = getValue({ item: b2 });
15510        return field.sort ? field.sort(aValue, bValue, direction) : fieldType.sort(aValue, bValue, direction);
15511      };
15512      return {
15513        id: field.id,
15514        label: field.label || field.id,
15515        header: field.header || field.label || field.id,
15516        description: field.description,
15517        placeholder: field.placeholder,
15518        getValue,
15519        setValue: field.setValue || set_value_from_id_default(field.id),
15520        elements: field.elements,
15521        getElements: field.getElements,
15522        hasElements: hasElements(field),
15523        isVisible: field.isVisible,
15524        enableHiding: field.enableHiding ?? true,
15525        readOnly: field.readOnly ?? false,
15526        // The type provides defaults for the following props
15527        type: fieldType.type,
15528        render: field.render ?? fieldType.render,
15529        Edit: getControl(field, fieldType.Edit),
15530        sort: sort7,
15531        enableSorting: field.enableSorting ?? fieldType.enableSorting,
15532        enableGlobalSearch: field.enableGlobalSearch ?? fieldType.enableGlobalSearch,
15533        isValid: getIsValid(field, fieldType),
15534        filterBy: get_filter_by_default(
15535          field,
15536          fieldType.defaultOperators,
15537          fieldType.validOperators
15538        ),
15539        format: get_format_default(field, fieldType),
15540        getValueFormatted: field.getValueFormatted ?? fieldType.getValueFormatted
15541      };
15542    });
15543  }
15544  
15545  // packages/dataviews/build-module/components/dataviews/index.js
15546  var import_jsx_runtime91 = __toESM(require_jsx_runtime());
15547  var defaultGetItemId = (item) => item.id;
15548  var defaultIsItemClickable = () => true;
15549  var EMPTY_ARRAY5 = [];
15550  var dataViewsLayouts = VIEW_LAYOUTS.filter(
15551    (viewLayout) => !viewLayout.isPicker
15552  );
15553  function DefaultUI({
15554    header,
15555    search = true,
15556    searchLabel = void 0
15557  }) {
15558    return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(import_jsx_runtime91.Fragment, { children: [
15559      /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
15560        import_components49.__experimentalHStack,
15561        {
15562          alignment: "top",
15563          justify: "space-between",
15564          className: "dataviews__view-actions",
15565          spacing: 1,
15566          children: [
15567            /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
15568              import_components49.__experimentalHStack,
15569              {
15570                justify: "start",
15571                expanded: false,
15572                className: "dataviews__search",
15573                children: [
15574                  search && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(dataviews_search_default, { label: searchLabel }),
15575                  /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(toggle_default, {})
15576                ]
15577              }
15578            ),
15579            /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
15580              import_components49.__experimentalHStack,
15581              {
15582                spacing: 1,
15583                expanded: false,
15584                style: { flexShrink: 0 },
15585                children: [
15586                  /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(dataviews_view_config_default, {}),
15587                  header
15588                ]
15589              }
15590            )
15591          ]
15592        }
15593      ),
15594      /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(filters_toggled_default, { className: "dataviews-filters__container" }),
15595      /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(DataViewsLayout, {}),
15596      /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(DataViewsFooter, {})
15597    ] });
15598  }
15599  function DataViews({
15600    view,
15601    onChangeView,
15602    fields,
15603    search = true,
15604    searchLabel = void 0,
15605    actions = EMPTY_ARRAY5,
15606    data,
15607    getItemId: getItemId2 = defaultGetItemId,
15608    getItemLevel: getItemLevel2,
15609    isLoading = false,
15610    paginationInfo,
15611    defaultLayouts: defaultLayoutsProperty,
15612    selection: selectionProperty,
15613    onChangeSelection,
15614    onClickItem,
15615    renderItemLink,
15616    isItemClickable = defaultIsItemClickable,
15617    header,
15618    children,
15619    config = { perPageSizes: [10, 20, 50, 100] },
15620    empty
15621  }) {
15622    const { infiniteScrollHandler } = paginationInfo;
15623    const containerRef = (0, import_element52.useRef)(null);
15624    const [containerWidth, setContainerWidth] = (0, import_element52.useState)(0);
15625    const resizeObserverRef = (0, import_compose11.useResizeObserver)(
15626      (resizeObserverEntries) => {
15627        setContainerWidth(
15628          resizeObserverEntries[0].borderBoxSize[0].inlineSize
15629        );
15630      },
15631      { box: "border-box" }
15632    );
15633    const [selectionState, setSelectionState] = (0, import_element52.useState)([]);
15634    const isUncontrolled = selectionProperty === void 0 || onChangeSelection === void 0;
15635    const selection = isUncontrolled ? selectionState : selectionProperty;
15636    const [openedFilter, setOpenedFilter] = (0, import_element52.useState)(null);
15637    function setSelectionWithChange(value) {
15638      const newValue = typeof value === "function" ? value(selection) : value;
15639      if (isUncontrolled) {
15640        setSelectionState(newValue);
15641      }
15642      if (onChangeSelection) {
15643        onChangeSelection(newValue);
15644      }
15645    }
15646    const _fields = (0, import_element52.useMemo)(() => normalizeFields(fields), [fields]);
15647    const _selection = (0, import_element52.useMemo)(() => {
15648      return selection.filter(
15649        (id) => data.some((item) => getItemId2(item) === id)
15650      );
15651    }, [selection, data, getItemId2]);
15652    const filters = use_filters_default(_fields, view);
15653    const hasPrimaryOrLockedFilters = (0, import_element52.useMemo)(
15654      () => (filters || []).some(
15655        (filter) => filter.isPrimary || filter.isLocked
15656      ),
15657      [filters]
15658    );
15659    const [isShowingFilter, setIsShowingFilter] = (0, import_element52.useState)(
15660      hasPrimaryOrLockedFilters
15661    );
15662    (0, import_element52.useEffect)(() => {
15663      if (hasPrimaryOrLockedFilters && !isShowingFilter) {
15664        setIsShowingFilter(true);
15665      }
15666    }, [hasPrimaryOrLockedFilters, isShowingFilter]);
15667    (0, import_element52.useEffect)(() => {
15668      if (!view.infiniteScrollEnabled || !containerRef.current) {
15669        return;
15670      }
15671      const handleScroll = (0, import_compose11.throttle)((event) => {
15672        const target = event.target;
15673        const scrollTop = target.scrollTop;
15674        const scrollHeight = target.scrollHeight;
15675        const clientHeight = target.clientHeight;
15676        if (scrollTop + clientHeight >= scrollHeight - 100) {
15677          infiniteScrollHandler?.();
15678        }
15679      }, 100);
15680      const container = containerRef.current;
15681      container.addEventListener("scroll", handleScroll);
15682      return () => {
15683        container.removeEventListener("scroll", handleScroll);
15684        handleScroll.cancel();
15685      };
15686    }, [infiniteScrollHandler, view.infiniteScrollEnabled]);
15687    const defaultLayouts = (0, import_element52.useMemo)(
15688      () => Object.fromEntries(
15689        Object.entries(defaultLayoutsProperty).filter(
15690          ([layoutType]) => {
15691            return dataViewsLayouts.some(
15692              (viewLayout) => viewLayout.type === layoutType
15693            );
15694          }
15695        )
15696      ),
15697      [defaultLayoutsProperty]
15698    );
15699    if (!defaultLayouts[view.type]) {
15700      return null;
15701    }
15702    return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
15703      dataviews_context_default.Provider,
15704      {
15705        value: {
15706          view,
15707          onChangeView,
15708          fields: _fields,
15709          actions,
15710          data,
15711          isLoading,
15712          paginationInfo,
15713          selection: _selection,
15714          onChangeSelection: setSelectionWithChange,
15715          openedFilter,
15716          setOpenedFilter,
15717          getItemId: getItemId2,
15718          getItemLevel: getItemLevel2,
15719          isItemClickable,
15720          onClickItem,
15721          renderItemLink,
15722          containerWidth,
15723          containerRef,
15724          resizeObserverRef,
15725          defaultLayouts,
15726          filters,
15727          isShowingFilter,
15728          setIsShowingFilter,
15729          config,
15730          empty,
15731          hasInfiniteScrollHandler: !!infiniteScrollHandler
15732        },
15733        children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "dataviews-wrapper", ref: containerRef, children: children ?? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
15734          DefaultUI,
15735          {
15736            header,
15737            search,
15738            searchLabel
15739          }
15740        ) })
15741      }
15742    );
15743  }
15744  var DataViewsSubComponents = DataViews;
15745  DataViewsSubComponents.BulkActionToolbar = BulkActionsFooter;
15746  DataViewsSubComponents.Filters = filters_default;
15747  DataViewsSubComponents.FiltersToggled = filters_toggled_default;
15748  DataViewsSubComponents.FiltersToggle = toggle_default;
15749  DataViewsSubComponents.Layout = DataViewsLayout;
15750  DataViewsSubComponents.LayoutSwitcher = ViewTypeMenu;
15751  DataViewsSubComponents.Pagination = DataViewsPagination;
15752  DataViewsSubComponents.Search = dataviews_search_default;
15753  DataViewsSubComponents.ViewConfig = DataviewsViewConfigDropdown;
15754  DataViewsSubComponents.Footer = DataViewsFooter;
15755  var dataviews_default = DataViewsSubComponents;
15756  
15757  // packages/admin-ui/build-module/navigable-region/index.js
15758  var import_element53 = __toESM(require_element());
15759  var import_jsx_runtime92 = __toESM(require_jsx_runtime());
15760  var NavigableRegion = (0, import_element53.forwardRef)(
15761    ({ children, className, ariaLabel, as: Tag = "div", ...props }, ref) => {
15762      return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
15763        Tag,
15764        {
15765          ref,
15766          className: clsx_default("admin-ui-navigable-region", className),
15767          "aria-label": ariaLabel,
15768          role: "region",
15769          tabIndex: "-1",
15770          ...props,
15771          children
15772        }
15773      );
15774    }
15775  );
15776  NavigableRegion.displayName = "NavigableRegion";
15777  var navigable_region_default = NavigableRegion;
15778  
15779  // packages/admin-ui/build-module/page/header.js
15780  var import_components51 = __toESM(require_components());
15781  
15782  // packages/admin-ui/build-module/page/sidebar-toggle-slot.js
15783  var import_components50 = __toESM(require_components());
15784  var { Fill: SidebarToggleFill, Slot: SidebarToggleSlot } = (0, import_components50.createSlotFill)("SidebarToggle");
15785  
15786  // packages/admin-ui/build-module/page/header.js
15787  var import_jsx_runtime93 = __toESM(require_jsx_runtime());
15788  function Header({
15789    breadcrumbs,
15790    badges,
15791    title,
15792    subTitle,
15793    actions,
15794    showSidebarToggle = true
15795  }) {
15796    return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_components51.__experimentalVStack, { className: "admin-ui-page__header", as: "header", children: [
15797      /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_components51.__experimentalHStack, { justify: "space-between", spacing: 2, children: [
15798        /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_components51.__experimentalHStack, { spacing: 2, justify: "left", children: [
15799          showSidebarToggle && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
15800            SidebarToggleSlot,
15801            {
15802              bubblesVirtually: true,
15803              className: "admin-ui-page__sidebar-toggle-slot"
15804            }
15805          ),
15806          title && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_components51.__experimentalHeading, { as: "h2", level: 3, weight: 500, truncate: true, children: title }),
15807          breadcrumbs,
15808          badges
15809        ] }),
15810        /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
15811          import_components51.__experimentalHStack,
15812          {
15813            style: { width: "auto", flexShrink: 0 },
15814            spacing: 2,
15815            className: "admin-ui-page__header-actions",
15816            children: actions
15817          }
15818        )
15819      ] }),
15820      subTitle && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("p", { className: "admin-ui-page__header-subtitle", children: subTitle })
15821    ] });
15822  }
15823  
15824  // packages/admin-ui/build-module/page/index.js
15825  var import_jsx_runtime94 = __toESM(require_jsx_runtime());
15826  function Page({
15827    breadcrumbs,
15828    badges,
15829    title,
15830    subTitle,
15831    children,
15832    className,
15833    actions,
15834    hasPadding = false,
15835    showSidebarToggle = true
15836  }) {
15837    const classes = clsx_default("admin-ui-page", className);
15838    return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(navigable_region_default, { className: classes, ariaLabel: title, children: [
15839      (title || breadcrumbs || badges) && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
15840        Header,
15841        {
15842          breadcrumbs,
15843          badges,
15844          title,
15845          subTitle,
15846          actions,
15847          showSidebarToggle
15848        }
15849      ),
15850      hasPadding ? /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "admin-ui-page__content has-padding", children }) : children
15851    ] });
15852  }
15853  Page.SidebarToggleFill = SidebarToggleFill;
15854  var page_default = Page;
15855  
15856  // routes/post-list/stage.tsx
15857  var import_core_data2 = __toESM(require_core_data());
15858  var import_components52 = __toESM(require_components());
15859  var import_data9 = __toESM(require_data());
15860  var import_element54 = __toESM(require_element());
15861  var import_editor = __toESM(require_editor());
15862  var import_i18n42 = __toESM(require_i18n());
15863  
15864  // routes/lock-unlock.ts
15865  var import_private_apis2 = __toESM(require_private_apis());
15866  var { lock: lock2, unlock: unlock2 } = (0, import_private_apis2.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
15867    "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
15868    "@wordpress/routes"
15869  );
15870  
15871  // routes/post-list/view-utils.ts
15872  var import_data8 = __toESM(require_data());
15873  var import_core_data = __toESM(require_core_data());
15874  var DEFAULT_VIEW = {
15875    type: "table",
15876    sort: {
15877      field: "date",
15878      direction: "desc"
15879    },
15880    fields: ["author", "status", "date"],
15881    titleField: "title",
15882    mediaField: "featured_media",
15883    descriptionField: "excerpt"
15884  };
15885  var DEFAULT_LAYOUTS = {
15886    table: {},
15887    grid: {},
15888    list: {}
15889  };
15890  var DEFAULT_VIEWS = [
15891    {
15892      slug: "all",
15893      label: "All",
15894      view: {
15895        ...DEFAULT_VIEW
15896      }
15897    },
15898    {
15899      slug: "publish",
15900      label: "Published",
15901      view: {
15902        ...DEFAULT_VIEW,
15903        filters: [
15904          {
15905            field: "status",
15906            operator: "is",
15907            value: "publish"
15908          }
15909        ]
15910      }
15911    },
15912    {
15913      slug: "draft",
15914      label: "Draft",
15915      view: {
15916        ...DEFAULT_VIEW,
15917        filters: [
15918          {
15919            field: "status",
15920            operator: "is",
15921            value: "draft"
15922          }
15923        ]
15924      }
15925    },
15926    {
15927      slug: "pending",
15928      label: "Pending",
15929      view: {
15930        ...DEFAULT_VIEW,
15931        filters: [
15932          {
15933            field: "status",
15934            operator: "is",
15935            value: "pending"
15936          }
15937        ]
15938      }
15939    },
15940    {
15941      slug: "private",
15942      label: "Private",
15943      view: {
15944        ...DEFAULT_VIEW,
15945        filters: [
15946          {
15947            field: "status",
15948            operator: "is",
15949            value: "private"
15950          }
15951        ]
15952      }
15953    },
15954    {
15955      slug: "trash",
15956      label: "Trash",
15957      view: {
15958        ...DEFAULT_VIEW,
15959        filters: [
15960          {
15961            field: "status",
15962            operator: "is",
15963            value: "trash"
15964          }
15965        ]
15966      }
15967    }
15968  ];
15969  function getDefaultView(postType, slug) {
15970    const viewConfig = DEFAULT_VIEWS.find((v2) => v2.slug === slug);
15971    const baseView = viewConfig?.view || DEFAULT_VIEW;
15972    return {
15973      ...baseView,
15974      showLevels: postType?.hierarchical
15975    };
15976  }
15977  function viewToQuery(view, postType) {
15978    const result = {};
15979    if (void 0 !== view.perPage) {
15980      result.per_page = view.perPage;
15981    }
15982    if (void 0 !== view.page) {
15983      result.page = view.page;
15984    }
15985    if (![void 0, ""].includes(view.search)) {
15986      result.search = view.search;
15987    }
15988    if (void 0 !== view.sort?.field) {
15989      let sortField = view.sort.field;
15990      if (sortField === "attached_to") {
15991        sortField = "parent";
15992      }
15993      result.orderby = sortField;
15994    }
15995    if (void 0 !== view.sort?.direction) {
15996      result.order = view.sort.direction;
15997    }
15998    if (view.showLevels) {
15999      result.orderby_hierarchy = true;
16000    }
16001    const status = view.filters?.find(
16002      (filter) => filter.field === "status"
16003    );
16004    if (status) {
16005      result.status = status.value;
16006    } else if (postType === "attachment") {
16007      result.status = "inherit";
16008    } else {
16009      result.status = "draft,future,pending,private,publish";
16010    }
16011    const author = view.filters?.find(
16012      (filter) => filter.field === "author"
16013    );
16014    if (author && author.operator === "is") {
16015      result.author = author.value;
16016    } else if (author && author.operator === "isNot") {
16017      result.author_exclude = author.value;
16018    }
16019    const commentStatus = view.filters?.find(
16020      (filter) => filter.field === "comment_status"
16021    );
16022    if (commentStatus && commentStatus.operator === "is") {
16023      result.comment_status = commentStatus.value;
16024    } else if (commentStatus && commentStatus.operator === "isNot") {
16025      result.comment_status_exclude = commentStatus.value;
16026    }
16027    const mediaType = view.filters?.find(
16028      (filter) => filter.field === "media_type"
16029    );
16030    if (mediaType) {
16031      result.media_type = mediaType.value;
16032    }
16033    const date = view.filters?.find((filter) => filter.field === "date");
16034    if (date && date.value) {
16035      if (date.operator === "before") {
16036        result.before = date.value;
16037      } else if (date.operator === "after") {
16038        result.after = date.value;
16039      }
16040    }
16041    if (postType === "attachment") {
16042      result._embed = "wp:attached-to";
16043    }
16044    return result;
16045  }
16046  
16047  // routes/post-list/style.scss
16048  var css = `/**
16049   * SCSS Variables.
16050   *
16051   * Please use variables from this sheet to ensure consistency across the UI.
16052   * Don't add to this sheet unless you're pretty sure the value will be reused in many places.
16053   * For example, don't add rules to this sheet that affect block visuals. It's purely for UI.
16054   */
16055  /**
16056   * Colors
16057   */
16058  /**
16059   * Fonts & basic variables.
16060   */
16061  /**
16062   * Typography
16063   */
16064  /**
16065   * Grid System.
16066   * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/
16067   */
16068  /**
16069   * Radius scale.
16070   */
16071  /**
16072   * Elevation scale.
16073   */
16074  /**
16075   * Dimensions.
16076   */
16077  /**
16078   * Mobile specific styles
16079   */
16080  /**
16081   * Editor styles.
16082   */
16083  /**
16084   * Block & Editor UI.
16085   */
16086  /**
16087   * Block paddings.
16088   */
16089  /**
16090   * React Native specific.
16091   * These variables do not appear to be used anywhere else.
16092   */
16093  /**
16094   * Typography
16095   */
16096  /**
16097   * SCSS Variables.
16098   *
16099   * Please use variables from this sheet to ensure consistency across the UI.
16100   * Don't add to this sheet unless you're pretty sure the value will be reused in many places.
16101   * For example, don't add rules to this sheet that affect block visuals. It's purely for UI.
16102   */
16103  /**
16104   * Colors
16105   */
16106  /**
16107   * Fonts & basic variables.
16108   */
16109  /**
16110   * Typography
16111   */
16112  /**
16113   * Grid System.
16114   * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/
16115   */
16116  /**
16117   * Radius scale.
16118   */
16119  /**
16120   * Elevation scale.
16121   */
16122  /**
16123   * Dimensions.
16124   */
16125  /**
16126   * Mobile specific styles
16127   */
16128  /**
16129   * Editor styles.
16130   */
16131  /**
16132   * Block & Editor UI.
16133   */
16134  /**
16135   * Block paddings.
16136   */
16137  /**
16138   * React Native specific.
16139   * These variables do not appear to be used anywhere else.
16140   */
16141  /**
16142   * Breakpoints & Media Queries
16143   */
16144  /**
16145  *  Converts a hex value into the rgb equivalent.
16146  *
16147  * @param {string} hex - the hexadecimal value to convert
16148  * @return {string} comma separated rgb values
16149  */
16150  /**
16151   * Long content fade mixin
16152   *
16153   * Creates a fading overlay to signify that the content is longer
16154   * than the space allows.
16155   */
16156  /**
16157   * Breakpoint mixins
16158   */
16159  /**
16160   * Focus styles.
16161   */
16162  /**
16163   * Applies editor left position to the selector passed as argument
16164   */
16165  /**
16166   * Styles that are reused verbatim in a few places
16167   */
16168  /**
16169   * Allows users to opt-out of animations via OS-level preferences.
16170   */
16171  /**
16172   * Reset default styles for JavaScript UI based pages.
16173   * This is a WP-admin agnostic reset
16174   */
16175  /**
16176   * Reset the WP Admin page styles for Gutenberg-like pages.
16177   */
16178  :root {
16179    --wp-block-synced-color: #7a00df;
16180    --wp-block-synced-color--rgb: 122, 0, 223;
16181    --wp-bound-block-color: var(--wp-block-synced-color);
16182    --wp-editor-canvas-background: #ddd;
16183    --wp-admin-theme-color: #007cba;
16184    --wp-admin-theme-color--rgb: 0, 124, 186;
16185    --wp-admin-theme-color-darker-10: rgb(0, 107, 160.5);
16186    --wp-admin-theme-color-darker-10--rgb: 0, 107, 160.5;
16187    --wp-admin-theme-color-darker-20: #005a87;
16188    --wp-admin-theme-color-darker-20--rgb: 0, 90, 135;
16189    --wp-admin-border-width-focus: 2px;
16190  }
16191  
16192  @media (min-resolution: 192dpi) {
16193    :root {
16194      --wp-admin-border-width-focus: 1.5px;
16195    }
16196  }
16197  .fields-create-template-part-modal {
16198    z-index: 1000001;
16199  }
16200  
16201  .fields-create-template-part-modal__area-fieldset {
16202    border: 0;
16203    padding: 0;
16204    margin: 0;
16205  }
16206  
16207  .fields-create-template-part-modal__area-radio-group {
16208    border: 1px solid #949494;
16209    border-radius: 2px;
16210  }
16211  
16212  .fields-create-template-part-modal__area-radio-wrapper {
16213    position: relative;
16214    padding: 12px;
16215    display: grid;
16216    align-items: center;
16217    grid-template-columns: min-content 1fr min-content;
16218    grid-gap: 4px 8px;
16219    color: #1e1e1e;
16220  }
16221  
16222  .fields-create-template-part-modal__area-radio-wrapper + .fields-create-template-part-modal__area-radio-wrapper {
16223    border-top: 1px solid #949494;
16224  }
16225  
16226  .fields-create-template-part-modal__area-radio-wrapper input[type=radio] {
16227    position: absolute;
16228    opacity: 0;
16229  }
16230  
16231  .fields-create-template-part-modal__area-radio-wrapper:has(input[type=radio]:checked) {
16232    z-index: 1;
16233  }
16234  
16235  .fields-create-template-part-modal__area-radio-wrapper:has(input[type=radio]:not(:checked)):hover {
16236    color: var(--wp-admin-theme-color);
16237  }
16238  
16239  .fields-create-template-part-modal__area-radio-wrapper > *:not(.fields-create-template-part-modal__area-radio-label) {
16240    pointer-events: none;
16241  }
16242  
16243  .fields-create-template-part-modal__area-radio-label::before {
16244    content: "";
16245    position: absolute;
16246    inset: 0;
16247  }
16248  
16249  input[type=radio]:not(:checked) ~ .fields-create-template-part-modal__area-radio-label::before {
16250    cursor: pointer;
16251  }
16252  
16253  input[type=radio]:focus-visible ~ .fields-create-template-part-modal__area-radio-label::before {
16254    outline: 4px solid transparent;
16255    box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
16256  }
16257  
16258  .fields-create-template-part-modal__area-radio-icon,
16259  .fields-create-template-part-modal__area-radio-checkmark {
16260    fill: currentColor;
16261  }
16262  
16263  input[type=radio]:not(:checked) ~ .fields-create-template-part-modal__area-radio-checkmark {
16264    opacity: 0;
16265  }
16266  
16267  .fields-create-template-part-modal__area-radio-description {
16268    grid-column: 2/3;
16269    margin: 0;
16270    color: #757575;
16271    font-size: 12px;
16272    line-height: normal;
16273    text-wrap: pretty;
16274  }
16275  
16276  input[type=radio]:not(:checked):hover ~ .fields-create-template-part-modal__area-radio-description {
16277    color: inherit;
16278  }
16279  
16280  .fields-controls__slug {
16281    border: 0;
16282    padding: 0;
16283    margin: 0;
16284  }
16285  
16286  .fields-controls__slug .fields-controls__slug-external-icon {
16287    margin-left: 5ch;
16288  }
16289  
16290  .fields-controls__slug .fields-controls__slug-input input.components-input-control__input {
16291    padding-inline-start: 0 !important;
16292  }
16293  
16294  .fields-controls__slug .fields-controls__slug-help-link {
16295    word-break: break-word;
16296  }
16297  
16298  .fields-controls__slug .fields-controls__slug-help {
16299    display: flex;
16300    flex-direction: column;
16301  }
16302  
16303  .fields-controls__slug .fields-controls__slug-help .fields-controls__slug-help-slug {
16304    font-weight: 600;
16305  }
16306  
16307  .fields-controls__featured-image-placeholder {
16308    border-radius: 2px;
16309    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
16310    display: inline-block;
16311    padding: 0;
16312    background: #fff linear-gradient(-45deg, transparent 48%, #ddd 48%, #ddd 52%, transparent 52%);
16313  }
16314  
16315  .fields-controls__featured-image-title {
16316    width: 100%;
16317    color: #1e1e1e;
16318    white-space: nowrap;
16319    text-overflow: ellipsis;
16320    overflow: hidden;
16321  }
16322  
16323  .fields-controls__featured-image-image {
16324    width: 100%;
16325    height: 100%;
16326    border-radius: 2px;
16327    align-self: center;
16328  }
16329  
16330  .fields-controls__featured-image-container .fields-controls__featured-image-placeholder {
16331    margin: 0;
16332  }
16333  
16334  .fields-controls__featured-image-container span {
16335    margin-right: auto;
16336  }
16337  
16338  fieldset.fields-controls__featured-image {
16339    border: 0;
16340    padding: 0;
16341    margin: 0;
16342  }
16343  
16344  fieldset.fields-controls__featured-image .fields-controls__featured-image-container {
16345    border: 1px solid #ddd;
16346    border-radius: 2px;
16347    padding: 8px 12px;
16348    cursor: pointer;
16349  }
16350  
16351  fieldset.fields-controls__featured-image .fields-controls__featured-image-container:hover {
16352    background-color: #f0f0f0;
16353  }
16354  
16355  fieldset.fields-controls__featured-image .fields-controls__featured-image-placeholder {
16356    width: 24px;
16357    height: 24px;
16358  }
16359  
16360  fieldset.fields-controls__featured-image span {
16361    align-self: center;
16362    text-align: start;
16363    white-space: nowrap;
16364  }
16365  
16366  fieldset.fields-controls__featured-image .fields-controls__featured-image-upload-button {
16367    padding: 0;
16368    height: fit-content;
16369  }
16370  
16371  fieldset.fields-controls__featured-image .fields-controls__featured-image-upload-button:hover, fieldset.fields-controls__featured-image .fields-controls__featured-image-upload-button:focus {
16372    border: 0;
16373    color: unset;
16374  }
16375  
16376  fieldset.fields-controls__featured-image .fields-controls__featured-image-remove-button {
16377    place-self: end;
16378  }
16379  
16380  .dataforms-layouts-panel__field-control .fields-controls__featured-image-image {
16381    width: 16px;
16382    height: 16px;
16383  }
16384  
16385  .dataforms-layouts-panel__field-control .fields-controls__featured-image-placeholder {
16386    width: 16px;
16387    height: 16px;
16388  }
16389  
16390  .dataviews-view-grid__media .fields-controls__featured-image-image,
16391  .dataviews-view-grid__media .fields-controls__featured-image-placeholder,
16392  .dataviews-view-table__cell-content-wrapper.dataviews-column-primary__media .fields-controls__featured-image-image,
16393  .dataviews-view-table__cell-content-wrapper.dataviews-column-primary__media .fields-controls__featured-image-placeholder,
16394  .dataviews-view-list__media-wrapper .fields-controls__featured-image-image,
16395  .dataviews-view-list__media-wrapper .fields-controls__featured-image-placeholder {
16396    width: 100%;
16397    height: 100%;
16398    display: block;
16399    border-radius: 4px;
16400  }
16401  
16402  .dataviews-view-grid__media .fields-controls__featured-image-placeholder,
16403  .dataviews-view-table__cell-content-wrapper.dataviews-column-primary__media .fields-controls__featured-image-placeholder,
16404  .dataviews-view-list__media-wrapper .fields-controls__featured-image-placeholder {
16405    box-shadow: none;
16406    background: #f0f0f0;
16407  }
16408  
16409  .dataviews-view-table__cell-content-wrapper.dataviews-column-primary__media .fields-controls__featured-image-image,
16410  .dataviews-view-table__cell-content-wrapper.dataviews-column-primary__media .fields-controls__featured-image-placeholder {
16411    width: 32px;
16412    height: 32px;
16413  }
16414  
16415  .fields-controls__parent {
16416    border: 0;
16417    padding: 0;
16418    margin: 0;
16419  }
16420  
16421  .fields-controls__password {
16422    border: 0;
16423    padding: 0;
16424    margin: 0;
16425  }
16426  
16427  .fields-controls__template {
16428    border: 0;
16429    padding: 0;
16430    margin: 0;
16431  }
16432  
16433  .fields-controls__template-modal {
16434    z-index: 1000001;
16435  }
16436  
16437  .fields-controls__template-content .block-editor-block-patterns-list {
16438    column-count: 2;
16439    column-gap: 24px;
16440    padding-top: 2px;
16441  }
16442  
16443  @media (min-width: 782px) {
16444    .fields-controls__template-content .block-editor-block-patterns-list {
16445      column-count: 3;
16446    }
16447  }
16448  @media (min-width: 1280px) {
16449    .fields-controls__template-content .block-editor-block-patterns-list {
16450      column-count: 4;
16451    }
16452  }
16453  .fields-controls__template-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item {
16454    break-inside: avoid-column;
16455  }
16456  
16457  .fields-field__title > span:first-child {
16458    text-overflow: ellipsis;
16459    overflow: hidden;
16460    text-decoration: none;
16461    white-space: nowrap;
16462    display: block;
16463    flex-grow: 0;
16464  }
16465  
16466  .fields-field__pattern-title span:first-child {
16467    flex: 1;
16468  }
16469  
16470  .routes-post-list__tabs-wrapper {
16471    border-bottom: 1px solid #f0f0f0;
16472    padding: 0 24px;
16473  }`;
16474  document.head.appendChild(document.createElement("style")).appendChild(document.createTextNode(css));
16475  
16476  // routes/post-list/stage.tsx
16477  var { useEntityRecordsWithPermissions } = unlock2(import_core_data2.privateApis);
16478  var { usePostActions, usePostFields } = unlock2(import_editor.privateApis);
16479  var { Tabs } = unlock2(import_components52.privateApis);
16480  function getItemId(item) {
16481    return item.id.toString();
16482  }
16483  function getItemLevel(item) {
16484    return item.level ?? 0;
16485  }
16486  function PostList() {
16487    const invalidate = useInvalidate();
16488    const { type: postType, slug = "all" } = useParams({
16489      from: "/types/$type/list/$slug"
16490    });
16491    const navigate = useNavigate();
16492    const searchParams = useSearch({ from: "/types/$type/list/$slug" });
16493    const postTypeObject = (0, import_data9.useSelect)(
16494      (select2) => select2(import_core_data2.store).getPostType(postType),
16495      [postType]
16496    );
16497    const labels = postTypeObject?.labels;
16498    const canCreateRecord = (0, import_data9.useSelect)(
16499      (select2) => select2(import_core_data2.store).canUser("create", {
16500        kind: "postType",
16501        name: postType
16502      }),
16503      [postType]
16504    );
16505    const defaultView = (0, import_element54.useMemo)(() => {
16506      return getDefaultView(postTypeObject, slug);
16507    }, [postTypeObject, slug]);
16508    const handleQueryParamsChange = (0, import_element54.useCallback)(
16509      (params) => {
16510        navigate({
16511          search: {
16512            ...searchParams,
16513            ...params
16514          }
16515        });
16516      },
16517      [searchParams, navigate]
16518    );
16519    const { view, isModified, updateView, resetToDefault } = useView({
16520      kind: "postType",
16521      name: postType,
16522      slug,
16523      defaultView,
16524      queryParams: searchParams,
16525      onChangeQueryParams: handleQueryParamsChange
16526    });
16527    const onReset = () => {
16528      resetToDefault();
16529      invalidate();
16530    };
16531    const onChangeView = (newView) => {
16532      updateView(newView);
16533      if (newView.type !== view.type) {
16534        invalidate();
16535      }
16536    };
16537    const postTypeQuery = (0, import_element54.useMemo)(
16538      () => viewToQuery(view, postType),
16539      [view, postType]
16540    );
16541    const {
16542      records: posts,
16543      totalItems,
16544      totalPages,
16545      isResolving
16546    } = useEntityRecordsWithPermissions("postType", postType, postTypeQuery);
16547    const allFields = usePostFields({
16548      postType
16549    });
16550    const fields = (0, import_element54.useMemo)(() => {
16551      return allFields.filter((field) => {
16552        if (field.id === "status" && slug !== "all") {
16553          return false;
16554        }
16555        return true;
16556      }).map((field) => {
16557        if (field.id === "status") {
16558          return { ...field, filterBy: false };
16559        }
16560        return field;
16561      });
16562    }, [allFields, slug]);
16563    const cleanupDeletedPostIdsFromUrl = (0, import_element54.useCallback)(
16564      (deletedItems) => {
16565        const deletedIds = deletedItems.map(
16566          (item) => item.id.toString()
16567        );
16568        const currentPostIds = searchParams.postIds || [];
16569        const remainingPostIds = currentPostIds.filter(
16570          (id) => !deletedIds.includes(id)
16571        );
16572        if (remainingPostIds.length !== currentPostIds.length) {
16573          navigate({
16574            search: {
16575              ...searchParams,
16576              postIds: remainingPostIds.length > 0 ? remainingPostIds : void 0
16577            }
16578          });
16579        } else {
16580          invalidate();
16581        }
16582      },
16583      [invalidate, searchParams, navigate]
16584    );
16585    const postTypeActions = usePostActions({
16586      postType,
16587      context: "list",
16588      onActionPerformed: (actionId, items) => {
16589        if (actionId === "move-to-trash" || actionId === "permanently-delete") {
16590          cleanupDeletedPostIdsFromUrl(items);
16591        }
16592      }
16593    });
16594    const actions = (0, import_element54.useMemo)(() => {
16595      return [
16596        ...postTypeActions?.flatMap((action) => {
16597          switch (action.id) {
16598            case "permanently-delete":
16599              return [
16600                {
16601                  ...action,
16602                  isEligible(item) {
16603                    if (item.type === "attachment") {
16604                      return true;
16605                    }
16606                    return action.isEligible?.(item) ?? false;
16607                  }
16608                }
16609              ];
16610            // Media can in some circumstances need a trash option, but
16611            // we need to extend the REST API to support it. See
16612            // https://github.com/WordPress/wordpress-develop/pull/9210.
16613            // Once that is merged we should fix this.
16614            case "move-to-trash":
16615              return [
16616                {
16617                  ...action,
16618                  isEligible(item) {
16619                    if (item.type === "attachment") {
16620                      return false;
16621                    }
16622                    return action.isEligible?.(item) ?? false;
16623                  }
16624                }
16625              ];
16626            // Skip revisions as the admin does not support it
16627            case "view-post-revisions":
16628              return [];
16629          }
16630          return [action];
16631        })
16632      ];
16633    }, [postTypeActions]);
16634    const handleTabChange = (0, import_element54.useCallback)(
16635      (status) => {
16636        navigate({
16637          to: `/types/$postType}/list/$status}`
16638        });
16639      },
16640      [navigate, postType]
16641    );
16642    if (!postTypeObject) {
16643      return null;
16644    }
16645    const selection = searchParams.postIds ?? [];
16646    if (view.type === "list" && selection.length === 0 && posts?.length > 0) {
16647      selection.push(posts[0].id.toString());
16648    }
16649    if (view.type === "list") {
16650      selection.splice(1);
16651    }
16652    return /* @__PURE__ */ React.createElement(
16653      page_default,
16654      {
16655        title: postTypeObject.labels?.name,
16656        subTitle: postTypeObject.labels?.description,
16657        className: `$postTypeObject.name.toLowerCase()}-page`,
16658        actions: /* @__PURE__ */ React.createElement(React.Fragment, null, isModified && /* @__PURE__ */ React.createElement(
16659          import_components52.Button,
16660          {
16661            variant: "tertiary",
16662            size: "compact",
16663            onClick: onReset
16664          },
16665          (0, import_i18n42.__)("Reset view")
16666        ), labels?.add_new_item && canCreateRecord && postType !== "attachment" && /* @__PURE__ */ React.createElement(
16667          import_components52.Button,
16668          {
16669            variant: "primary",
16670            onClick: () => {
16671              navigate({
16672                to: `/types/$postType}/new`
16673              });
16674            },
16675            size: "compact"
16676          },
16677          labels.add_new_item
16678        )),
16679        hasPadding: false
16680      },
16681      DEFAULT_VIEWS.length > 1 && /* @__PURE__ */ React.createElement("div", { className: "routes-post-list__tabs-wrapper" }, /* @__PURE__ */ React.createElement(
16682        Tabs,
16683        {
16684          onSelect: handleTabChange,
16685          selectedTabId: slug ?? "all"
16686        },
16687        /* @__PURE__ */ React.createElement(Tabs.TabList, null, DEFAULT_VIEWS.map(
16688          (filter) => /* @__PURE__ */ React.createElement(
16689            Tabs.Tab,
16690            {
16691              tabId: filter.slug,
16692              key: filter.slug
16693            },
16694            filter.label
16695          )
16696        ))
16697      )),
16698      /* @__PURE__ */ React.createElement(
16699        dataviews_default,
16700        {
16701          data: posts,
16702          fields,
16703          view,
16704          onChangeView,
16705          actions,
16706          isLoading: isResolving,
16707          paginationInfo: {
16708            totalItems,
16709            totalPages
16710          },
16711          defaultLayouts: DEFAULT_LAYOUTS,
16712          getItemId,
16713          getItemLevel,
16714          selection,
16715          onChangeSelection: (items) => {
16716            navigate({
16717              search: {
16718                ...searchParams,
16719                postIds: items.length > 0 ? items : void 0,
16720                edit: items.length === 0 ? void 0 : searchParams.edit
16721              }
16722            });
16723          },
16724          renderItemLink: ({ item, ...props }) => /* @__PURE__ */ React.createElement(
16725            Link,
16726            {
16727              to: `/types/$postType}/edit/$encodeURIComponent(
16728                item.id
16729              )}`,
16730              ...props,
16731              onClick: (event) => {
16732                event.stopPropagation();
16733              }
16734            }
16735          )
16736        }
16737      )
16738    );
16739  }
16740  var stage = PostList;
16741  export {
16742    stage
16743  };
16744  /*! Bundled license information:
16745  
16746  use-sync-external-store/cjs/use-sync-external-store-shim.development.js:
16747    (**
16748     * @license React
16749     * use-sync-external-store-shim.development.js
16750     *
16751     * Copyright (c) Meta Platforms, Inc. and affiliates.
16752     *
16753     * This source code is licensed under the MIT license found in the
16754     * LICENSE file in the root directory of this source tree.
16755     *)
16756  */


Generated : Sun Mar 8 08:20:03 2026 Cross-referenced by PHPXref