You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

4382 lines
183 KiB

1 year ago
  1. /******/ (function() { // webpackBootstrap
  2. /******/ var __webpack_modules__ = ({
  3. /***/ 4403:
  4. /***/ (function(module, exports) {
  5. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  6. Copyright (c) 2018 Jed Watson.
  7. Licensed under the MIT License (MIT), see
  8. http://jedwatson.github.io/classnames
  9. */
  10. /* global define */
  11. (function () {
  12. 'use strict';
  13. var hasOwn = {}.hasOwnProperty;
  14. var nativeCodeString = '[native code]';
  15. function classNames() {
  16. var classes = [];
  17. for (var i = 0; i < arguments.length; i++) {
  18. var arg = arguments[i];
  19. if (!arg) continue;
  20. var argType = typeof arg;
  21. if (argType === 'string' || argType === 'number') {
  22. classes.push(arg);
  23. } else if (Array.isArray(arg)) {
  24. if (arg.length) {
  25. var inner = classNames.apply(null, arg);
  26. if (inner) {
  27. classes.push(inner);
  28. }
  29. }
  30. } else if (argType === 'object') {
  31. if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
  32. classes.push(arg.toString());
  33. continue;
  34. }
  35. for (var key in arg) {
  36. if (hasOwn.call(arg, key) && arg[key]) {
  37. classes.push(key);
  38. }
  39. }
  40. }
  41. }
  42. return classes.join(' ');
  43. }
  44. if ( true && module.exports) {
  45. classNames.default = classNames;
  46. module.exports = classNames;
  47. } else if (true) {
  48. // register as 'classnames', consistent with npm package name
  49. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  50. return classNames;
  51. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  52. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  53. } else {}
  54. }());
  55. /***/ }),
  56. /***/ 8670:
  57. /***/ (function(module) {
  58. // The scores are arranged so that a continuous match of characters will
  59. // result in a total score of 1.
  60. //
  61. // The best case, this character is a match, and either this is the start
  62. // of the string, or the previous character was also a match.
  63. var SCORE_CONTINUE_MATCH = 1,
  64. // A new match at the start of a word scores better than a new match
  65. // elsewhere as it's more likely that the user will type the starts
  66. // of fragments.
  67. // (Our notion of word includes CamelCase and hypen-separated, etc.)
  68. SCORE_WORD_JUMP = 0.9,
  69. // Any other match isn't ideal, but we include it for completeness.
  70. SCORE_CHARACTER_JUMP = 0.3,
  71. // If the user transposed two letters, it should be signficantly penalized.
  72. //
  73. // i.e. "ouch" is more likely than "curtain" when "uc" is typed.
  74. SCORE_TRANSPOSITION = 0.1,
  75. // If the user jumped to half-way through a subsequent word, it should be
  76. // very significantly penalized.
  77. //
  78. // i.e. "loes" is very unlikely to match "loch ness".
  79. // NOTE: this is set to 0 for superhuman right now, but we may want to revisit.
  80. SCORE_LONG_JUMP = 0,
  81. // The goodness of a match should decay slightly with each missing
  82. // character.
  83. //
  84. // i.e. "bad" is more likely than "bard" when "bd" is typed.
  85. //
  86. // This will not change the order of suggestions based on SCORE_* until
  87. // 100 characters are inserted between matches.
  88. PENALTY_SKIPPED = 0.999,
  89. // The goodness of an exact-case match should be higher than a
  90. // case-insensitive match by a small amount.
  91. //
  92. // i.e. "HTML" is more likely than "haml" when "HM" is typed.
  93. //
  94. // This will not change the order of suggestions based on SCORE_* until
  95. // 1000 characters are inserted between matches.
  96. PENALTY_CASE_MISMATCH = 0.9999,
  97. // If the word has more characters than the user typed, it should
  98. // be penalised slightly.
  99. //
  100. // i.e. "html" is more likely than "html5" if I type "html".
  101. //
  102. // However, it may well be the case that there's a sensible secondary
  103. // ordering (like alphabetical) that it makes sense to rely on when
  104. // there are many prefix matches, so we don't make the penalty increase
  105. // with the number of tokens.
  106. PENALTY_NOT_COMPLETE = 0.99;
  107. var IS_GAP_REGEXP = /[\\\/\-_+.# \t"@\[\(\{&]/,
  108. COUNT_GAPS_REGEXP = /[\\\/\-_+.# \t"@\[\(\{&]/g;
  109. function commandScoreInner(string, abbreviation, lowerString, lowerAbbreviation, stringIndex, abbreviationIndex) {
  110. if (abbreviationIndex === abbreviation.length) {
  111. if (stringIndex === string.length) {
  112. return SCORE_CONTINUE_MATCH;
  113. }
  114. return PENALTY_NOT_COMPLETE;
  115. }
  116. var abbreviationChar = lowerAbbreviation.charAt(abbreviationIndex);
  117. var index = lowerString.indexOf(abbreviationChar, stringIndex);
  118. var highScore = 0;
  119. var score, transposedScore, wordBreaks;
  120. while (index >= 0) {
  121. score = commandScoreInner(string, abbreviation, lowerString, lowerAbbreviation, index + 1, abbreviationIndex + 1);
  122. if (score > highScore) {
  123. if (index === stringIndex) {
  124. score *= SCORE_CONTINUE_MATCH;
  125. } else if (IS_GAP_REGEXP.test(string.charAt(index - 1))) {
  126. score *= SCORE_WORD_JUMP;
  127. wordBreaks = string.slice(stringIndex, index - 1).match(COUNT_GAPS_REGEXP);
  128. if (wordBreaks && stringIndex > 0) {
  129. score *= Math.pow(PENALTY_SKIPPED, wordBreaks.length);
  130. }
  131. } else if (IS_GAP_REGEXP.test(string.slice(stringIndex, index - 1))) {
  132. score *= SCORE_LONG_JUMP;
  133. if (stringIndex > 0) {
  134. score *= Math.pow(PENALTY_SKIPPED, index - stringIndex);
  135. }
  136. } else {
  137. score *= SCORE_CHARACTER_JUMP;
  138. if (stringIndex > 0) {
  139. score *= Math.pow(PENALTY_SKIPPED, index - stringIndex);
  140. }
  141. }
  142. if (string.charAt(index) !== abbreviation.charAt(abbreviationIndex)) {
  143. score *= PENALTY_CASE_MISMATCH;
  144. }
  145. }
  146. if (score < SCORE_TRANSPOSITION &&
  147. lowerString.charAt(index - 1) === lowerAbbreviation.charAt(abbreviationIndex + 1) &&
  148. lowerString.charAt(index - 1) !== lowerAbbreviation.charAt(abbreviationIndex)) {
  149. transposedScore = commandScoreInner(string, abbreviation, lowerString, lowerAbbreviation, index + 1, abbreviationIndex + 2);
  150. if (transposedScore * SCORE_TRANSPOSITION > score) {
  151. score = transposedScore * SCORE_TRANSPOSITION;
  152. }
  153. }
  154. if (score > highScore) {
  155. highScore = score;
  156. }
  157. index = lowerString.indexOf(abbreviationChar, index + 1);
  158. }
  159. return highScore;
  160. }
  161. function commandScore(string, abbreviation) {
  162. /* NOTE:
  163. * in the original, we used to do the lower-casing on each recursive call, but this meant that toLowerCase()
  164. * was the dominating cost in the algorithm, passing both is a little ugly, but considerably faster.
  165. */
  166. return commandScoreInner(string, abbreviation, string.toLowerCase(), abbreviation.toLowerCase(), 0, 0);
  167. }
  168. module.exports = commandScore;
  169. /***/ })
  170. /******/ });
  171. /************************************************************************/
  172. /******/ // The module cache
  173. /******/ var __webpack_module_cache__ = {};
  174. /******/
  175. /******/ // The require function
  176. /******/ function __webpack_require__(moduleId) {
  177. /******/ // Check if module is in cache
  178. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  179. /******/ if (cachedModule !== undefined) {
  180. /******/ return cachedModule.exports;
  181. /******/ }
  182. /******/ // Create a new module (and put it into the cache)
  183. /******/ var module = __webpack_module_cache__[moduleId] = {
  184. /******/ // no module.id needed
  185. /******/ // no module.loaded needed
  186. /******/ exports: {}
  187. /******/ };
  188. /******/
  189. /******/ // Execute the module function
  190. /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
  191. /******/
  192. /******/ // Return the exports of the module
  193. /******/ return module.exports;
  194. /******/ }
  195. /******/
  196. /************************************************************************/
  197. /******/ /* webpack/runtime/compat get default export */
  198. /******/ !function() {
  199. /******/ // getDefaultExport function for compatibility with non-harmony modules
  200. /******/ __webpack_require__.n = function(module) {
  201. /******/ var getter = module && module.__esModule ?
  202. /******/ function() { return module['default']; } :
  203. /******/ function() { return module; };
  204. /******/ __webpack_require__.d(getter, { a: getter });
  205. /******/ return getter;
  206. /******/ };
  207. /******/ }();
  208. /******/
  209. /******/ /* webpack/runtime/define property getters */
  210. /******/ !function() {
  211. /******/ // define getter functions for harmony exports
  212. /******/ __webpack_require__.d = function(exports, definition) {
  213. /******/ for(var key in definition) {
  214. /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  215. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  216. /******/ }
  217. /******/ }
  218. /******/ };
  219. /******/ }();
  220. /******/
  221. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  222. /******/ !function() {
  223. /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
  224. /******/ }();
  225. /******/
  226. /******/ /* webpack/runtime/make namespace object */
  227. /******/ !function() {
  228. /******/ // define __esModule on exports
  229. /******/ __webpack_require__.r = function(exports) {
  230. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  231. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  232. /******/ }
  233. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  234. /******/ };
  235. /******/ }();
  236. /******/
  237. /******/ /* webpack/runtime/nonce */
  238. /******/ !function() {
  239. /******/ __webpack_require__.nc = undefined;
  240. /******/ }();
  241. /******/
  242. /************************************************************************/
  243. var __webpack_exports__ = {};
  244. // This entry need to be wrapped in an IIFE because it need to be in strict mode.
  245. !function() {
  246. "use strict";
  247. // ESM COMPAT FLAG
  248. __webpack_require__.r(__webpack_exports__);
  249. // EXPORTS
  250. __webpack_require__.d(__webpack_exports__, {
  251. CommandMenu: function() { return /* reexport */ CommandMenu; },
  252. privateApis: function() { return /* reexport */ privateApis; },
  253. store: function() { return /* reexport */ store; },
  254. useCommand: function() { return /* reexport */ useCommand; },
  255. useCommandLoader: function() { return /* reexport */ useCommandLoader; }
  256. });
  257. // NAMESPACE OBJECT: ./node_modules/@wordpress/commands/build-module/store/actions.js
  258. var actions_namespaceObject = {};
  259. __webpack_require__.r(actions_namespaceObject);
  260. __webpack_require__.d(actions_namespaceObject, {
  261. close: function() { return actions_close; },
  262. open: function() { return actions_open; },
  263. registerCommand: function() { return registerCommand; },
  264. registerCommandLoader: function() { return registerCommandLoader; },
  265. unregisterCommand: function() { return unregisterCommand; },
  266. unregisterCommandLoader: function() { return unregisterCommandLoader; }
  267. });
  268. // NAMESPACE OBJECT: ./node_modules/@wordpress/commands/build-module/store/selectors.js
  269. var selectors_namespaceObject = {};
  270. __webpack_require__.r(selectors_namespaceObject);
  271. __webpack_require__.d(selectors_namespaceObject, {
  272. getCommandLoaders: function() { return getCommandLoaders; },
  273. getCommands: function() { return getCommands; },
  274. getContext: function() { return getContext; },
  275. isOpen: function() { return selectors_isOpen; }
  276. });
  277. // NAMESPACE OBJECT: ./node_modules/@wordpress/commands/build-module/store/private-actions.js
  278. var private_actions_namespaceObject = {};
  279. __webpack_require__.r(private_actions_namespaceObject);
  280. __webpack_require__.d(private_actions_namespaceObject, {
  281. setContext: function() { return setContext; }
  282. });
  283. ;// CONCATENATED MODULE: external ["wp","element"]
  284. var external_wp_element_namespaceObject = window["wp"]["element"];
  285. ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
  286. function _extends() {
  287. _extends = Object.assign ? Object.assign.bind() : function (target) {
  288. for (var i = 1; i < arguments.length; i++) {
  289. var source = arguments[i];
  290. for (var key in source) {
  291. if (Object.prototype.hasOwnProperty.call(source, key)) {
  292. target[key] = source[key];
  293. }
  294. }
  295. }
  296. return target;
  297. };
  298. return _extends.apply(this, arguments);
  299. }
  300. ;// CONCATENATED MODULE: external "React"
  301. var external_React_namespaceObject = window["React"];
  302. ;// CONCATENATED MODULE: ./node_modules/@radix-ui/primitive/dist/index.module.js
  303. function $e42e1063c40fb3ef$export$b9ecd428b558ff10(originalEventHandler, ourEventHandler, { checkForDefaultPrevented: checkForDefaultPrevented = true } = {}) {
  304. return function handleEvent(event) {
  305. originalEventHandler === null || originalEventHandler === void 0 || originalEventHandler(event);
  306. if (checkForDefaultPrevented === false || !event.defaultPrevented) return ourEventHandler === null || ourEventHandler === void 0 ? void 0 : ourEventHandler(event);
  307. };
  308. }
  309. ;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-compose-refs/dist/index.module.js
  310. /**
  311. * Set a given ref to a given value
  312. * This utility takes care of different types of refs: callback refs and RefObject(s)
  313. */ function $6ed0406888f73fc4$var$setRef(ref, value) {
  314. if (typeof ref === 'function') ref(value);
  315. else if (ref !== null && ref !== undefined) ref.current = value;
  316. }
  317. /**
  318. * A utility to compose multiple refs together
  319. * Accepts callback refs and RefObject(s)
  320. */ function $6ed0406888f73fc4$export$43e446d32b3d21af(...refs) {
  321. return (node)=>refs.forEach((ref)=>$6ed0406888f73fc4$var$setRef(ref, node)
  322. )
  323. ;
  324. }
  325. /**
  326. * A custom hook that composes multiple refs
  327. * Accepts callback refs and RefObject(s)
  328. */ function $6ed0406888f73fc4$export$c7b2cbe3552a0d05(...refs) {
  329. // eslint-disable-next-line react-hooks/exhaustive-deps
  330. return (0,external_React_namespaceObject.useCallback)($6ed0406888f73fc4$export$43e446d32b3d21af(...refs), refs);
  331. }
  332. ;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-context/dist/index.module.js
  333. function $c512c27ab02ef895$export$fd42f52fd3ae1109(rootComponentName, defaultContext) {
  334. const Context = /*#__PURE__*/ (0,external_React_namespaceObject.createContext)(defaultContext);
  335. function Provider(props) {
  336. const { children: children , ...context } = props; // Only re-memoize when prop values change
  337. // eslint-disable-next-line react-hooks/exhaustive-deps
  338. const value = (0,external_React_namespaceObject.useMemo)(()=>context
  339. , Object.values(context));
  340. return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)(Context.Provider, {
  341. value: value
  342. }, children);
  343. }
  344. function useContext(consumerName) {
  345. const context = (0,external_React_namespaceObject.useContext)(Context);
  346. if (context) return context;
  347. if (defaultContext !== undefined) return defaultContext; // if a defaultContext wasn't specified, it's a required context.
  348. throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
  349. }
  350. Provider.displayName = rootComponentName + 'Provider';
  351. return [
  352. Provider,
  353. useContext
  354. ];
  355. }
  356. /* -------------------------------------------------------------------------------------------------
  357. * createContextScope
  358. * -----------------------------------------------------------------------------------------------*/ function $c512c27ab02ef895$export$50c7b4e9d9f19c1(scopeName, createContextScopeDeps = []) {
  359. let defaultContexts = [];
  360. /* -----------------------------------------------------------------------------------------------
  361. * createContext
  362. * ---------------------------------------------------------------------------------------------*/ function $c512c27ab02ef895$export$fd42f52fd3ae1109(rootComponentName, defaultContext) {
  363. const BaseContext = /*#__PURE__*/ (0,external_React_namespaceObject.createContext)(defaultContext);
  364. const index = defaultContexts.length;
  365. defaultContexts = [
  366. ...defaultContexts,
  367. defaultContext
  368. ];
  369. function Provider(props) {
  370. const { scope: scope , children: children , ...context } = props;
  371. const Context = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index]) || BaseContext; // Only re-memoize when prop values change
  372. // eslint-disable-next-line react-hooks/exhaustive-deps
  373. const value = (0,external_React_namespaceObject.useMemo)(()=>context
  374. , Object.values(context));
  375. return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)(Context.Provider, {
  376. value: value
  377. }, children);
  378. }
  379. function useContext(consumerName, scope) {
  380. const Context = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index]) || BaseContext;
  381. const context = (0,external_React_namespaceObject.useContext)(Context);
  382. if (context) return context;
  383. if (defaultContext !== undefined) return defaultContext; // if a defaultContext wasn't specified, it's a required context.
  384. throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
  385. }
  386. Provider.displayName = rootComponentName + 'Provider';
  387. return [
  388. Provider,
  389. useContext
  390. ];
  391. }
  392. /* -----------------------------------------------------------------------------------------------
  393. * createScope
  394. * ---------------------------------------------------------------------------------------------*/ const createScope = ()=>{
  395. const scopeContexts = defaultContexts.map((defaultContext)=>{
  396. return /*#__PURE__*/ (0,external_React_namespaceObject.createContext)(defaultContext);
  397. });
  398. return function useScope(scope) {
  399. const contexts = (scope === null || scope === void 0 ? void 0 : scope[scopeName]) || scopeContexts;
  400. return (0,external_React_namespaceObject.useMemo)(()=>({
  401. [`__scope${scopeName}`]: {
  402. ...scope,
  403. [scopeName]: contexts
  404. }
  405. })
  406. , [
  407. scope,
  408. contexts
  409. ]);
  410. };
  411. };
  412. createScope.scopeName = scopeName;
  413. return [
  414. $c512c27ab02ef895$export$fd42f52fd3ae1109,
  415. $c512c27ab02ef895$var$composeContextScopes(createScope, ...createContextScopeDeps)
  416. ];
  417. }
  418. /* -------------------------------------------------------------------------------------------------
  419. * composeContextScopes
  420. * -----------------------------------------------------------------------------------------------*/ function $c512c27ab02ef895$var$composeContextScopes(...scopes) {
  421. const baseScope = scopes[0];
  422. if (scopes.length === 1) return baseScope;
  423. const createScope1 = ()=>{
  424. const scopeHooks = scopes.map((createScope)=>({
  425. useScope: createScope(),
  426. scopeName: createScope.scopeName
  427. })
  428. );
  429. return function useComposedScopes(overrideScopes) {
  430. const nextScopes1 = scopeHooks.reduce((nextScopes, { useScope: useScope , scopeName: scopeName })=>{
  431. // We are calling a hook inside a callback which React warns against to avoid inconsistent
  432. // renders, however, scoping doesn't have render side effects so we ignore the rule.
  433. // eslint-disable-next-line react-hooks/rules-of-hooks
  434. const scopeProps = useScope(overrideScopes);
  435. const currentScope = scopeProps[`__scope${scopeName}`];
  436. return {
  437. ...nextScopes,
  438. ...currentScope
  439. };
  440. }, {});
  441. return (0,external_React_namespaceObject.useMemo)(()=>({
  442. [`__scope${baseScope.scopeName}`]: nextScopes1
  443. })
  444. , [
  445. nextScopes1
  446. ]);
  447. };
  448. };
  449. createScope1.scopeName = baseScope.scopeName;
  450. return createScope1;
  451. }
  452. ;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-use-layout-effect/dist/index.module.js
  453. /**
  454. * On the server, React emits a warning when calling `useLayoutEffect`.
  455. * This is because neither `useLayoutEffect` nor `useEffect` run on the server.
  456. * We use this safe version which suppresses the warning by replacing it with a noop on the server.
  457. *
  458. * See: https://reactjs.org/docs/hooks-reference.html#uselayouteffect
  459. */ const $9f79659886946c16$export$e5c5a5f917a5871c = Boolean(globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) ? external_React_namespaceObject.useLayoutEffect : ()=>{};
  460. ;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-id/dist/index.module.js
  461. const $1746a345f3d73bb7$var$useReactId = external_React_namespaceObject['useId'.toString()] || (()=>undefined
  462. );
  463. let $1746a345f3d73bb7$var$count = 0;
  464. function $1746a345f3d73bb7$export$f680877a34711e37(deterministicId) {
  465. const [id, setId] = external_React_namespaceObject.useState($1746a345f3d73bb7$var$useReactId()); // React versions older than 18 will have client-side ids only.
  466. $9f79659886946c16$export$e5c5a5f917a5871c(()=>{
  467. if (!deterministicId) setId((reactId)=>reactId !== null && reactId !== void 0 ? reactId : String($1746a345f3d73bb7$var$count++)
  468. );
  469. }, [
  470. deterministicId
  471. ]);
  472. return deterministicId || (id ? `radix-${id}` : '');
  473. }
  474. ;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-use-callback-ref/dist/index.module.js
  475. /**
  476. * A custom hook that converts a callback to a ref to avoid triggering re-renders when passed as a
  477. * prop or avoid re-executing effects when passed as a dependency
  478. */ function $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(callback) {
  479. const callbackRef = (0,external_React_namespaceObject.useRef)(callback);
  480. (0,external_React_namespaceObject.useEffect)(()=>{
  481. callbackRef.current = callback;
  482. }); // https://github.com/facebook/react/issues/19240
  483. return (0,external_React_namespaceObject.useMemo)(()=>(...args)=>{
  484. var _callbackRef$current;
  485. return (_callbackRef$current = callbackRef.current) === null || _callbackRef$current === void 0 ? void 0 : _callbackRef$current.call(callbackRef, ...args);
  486. }
  487. , []);
  488. }
  489. ;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-use-controllable-state/dist/index.module.js
  490. function $71cd76cc60e0454e$export$6f32135080cb4c3({ prop: prop , defaultProp: defaultProp , onChange: onChange = ()=>{} }) {
  491. const [uncontrolledProp, setUncontrolledProp] = $71cd76cc60e0454e$var$useUncontrolledState({
  492. defaultProp: defaultProp,
  493. onChange: onChange
  494. });
  495. const isControlled = prop !== undefined;
  496. const value1 = isControlled ? prop : uncontrolledProp;
  497. const handleChange = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onChange);
  498. const setValue = (0,external_React_namespaceObject.useCallback)((nextValue)=>{
  499. if (isControlled) {
  500. const setter = nextValue;
  501. const value = typeof nextValue === 'function' ? setter(prop) : nextValue;
  502. if (value !== prop) handleChange(value);
  503. } else setUncontrolledProp(nextValue);
  504. }, [
  505. isControlled,
  506. prop,
  507. setUncontrolledProp,
  508. handleChange
  509. ]);
  510. return [
  511. value1,
  512. setValue
  513. ];
  514. }
  515. function $71cd76cc60e0454e$var$useUncontrolledState({ defaultProp: defaultProp , onChange: onChange }) {
  516. const uncontrolledState = (0,external_React_namespaceObject.useState)(defaultProp);
  517. const [value] = uncontrolledState;
  518. const prevValueRef = (0,external_React_namespaceObject.useRef)(value);
  519. const handleChange = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onChange);
  520. (0,external_React_namespaceObject.useEffect)(()=>{
  521. if (prevValueRef.current !== value) {
  522. handleChange(value);
  523. prevValueRef.current = value;
  524. }
  525. }, [
  526. value,
  527. prevValueRef,
  528. handleChange
  529. ]);
  530. return uncontrolledState;
  531. }
  532. ;// CONCATENATED MODULE: external "ReactDOM"
  533. var external_ReactDOM_namespaceObject = window["ReactDOM"];
  534. var external_ReactDOM_default = /*#__PURE__*/__webpack_require__.n(external_ReactDOM_namespaceObject);
  535. ;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-slot/dist/index.module.js
  536. /* -------------------------------------------------------------------------------------------------
  537. * Slot
  538. * -----------------------------------------------------------------------------------------------*/ const $5e63c961fc1ce211$export$8c6ed5c666ac1360 = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{
  539. const { children: children , ...slotProps } = props;
  540. const childrenArray = external_React_namespaceObject.Children.toArray(children);
  541. const slottable = childrenArray.find($5e63c961fc1ce211$var$isSlottable);
  542. if (slottable) {
  543. // the new element to render is the one passed as a child of `Slottable`
  544. const newElement = slottable.props.children;
  545. const newChildren = childrenArray.map((child)=>{
  546. if (child === slottable) {
  547. // because the new element will be the one rendered, we are only interested
  548. // in grabbing its children (`newElement.props.children`)
  549. if (external_React_namespaceObject.Children.count(newElement) > 1) return external_React_namespaceObject.Children.only(null);
  550. return /*#__PURE__*/ (0,external_React_namespaceObject.isValidElement)(newElement) ? newElement.props.children : null;
  551. } else return child;
  552. });
  553. return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($5e63c961fc1ce211$var$SlotClone, _extends({}, slotProps, {
  554. ref: forwardedRef
  555. }), /*#__PURE__*/ (0,external_React_namespaceObject.isValidElement)(newElement) ? /*#__PURE__*/ (0,external_React_namespaceObject.cloneElement)(newElement, undefined, newChildren) : null);
  556. }
  557. return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($5e63c961fc1ce211$var$SlotClone, _extends({}, slotProps, {
  558. ref: forwardedRef
  559. }), children);
  560. });
  561. $5e63c961fc1ce211$export$8c6ed5c666ac1360.displayName = 'Slot';
  562. /* -------------------------------------------------------------------------------------------------
  563. * SlotClone
  564. * -----------------------------------------------------------------------------------------------*/ const $5e63c961fc1ce211$var$SlotClone = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{
  565. const { children: children , ...slotProps } = props;
  566. if (/*#__PURE__*/ (0,external_React_namespaceObject.isValidElement)(children)) return /*#__PURE__*/ (0,external_React_namespaceObject.cloneElement)(children, {
  567. ...$5e63c961fc1ce211$var$mergeProps(slotProps, children.props),
  568. ref: $6ed0406888f73fc4$export$43e446d32b3d21af(forwardedRef, children.ref)
  569. });
  570. return external_React_namespaceObject.Children.count(children) > 1 ? external_React_namespaceObject.Children.only(null) : null;
  571. });
  572. $5e63c961fc1ce211$var$SlotClone.displayName = 'SlotClone';
  573. /* -------------------------------------------------------------------------------------------------
  574. * Slottable
  575. * -----------------------------------------------------------------------------------------------*/ const $5e63c961fc1ce211$export$d9f1ccf0bdb05d45 = ({ children: children })=>{
  576. return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, children);
  577. };
  578. /* ---------------------------------------------------------------------------------------------- */ function $5e63c961fc1ce211$var$isSlottable(child) {
  579. return /*#__PURE__*/ (0,external_React_namespaceObject.isValidElement)(child) && child.type === $5e63c961fc1ce211$export$d9f1ccf0bdb05d45;
  580. }
  581. function $5e63c961fc1ce211$var$mergeProps(slotProps, childProps) {
  582. // all child props should override
  583. const overrideProps = {
  584. ...childProps
  585. };
  586. for(const propName in childProps){
  587. const slotPropValue = slotProps[propName];
  588. const childPropValue = childProps[propName];
  589. const isHandler = /^on[A-Z]/.test(propName); // if it's a handler, modify the override by composing the base handler
  590. if (isHandler) overrideProps[propName] = (...args)=>{
  591. childPropValue === null || childPropValue === void 0 || childPropValue(...args);
  592. slotPropValue === null || slotPropValue === void 0 || slotPropValue(...args);
  593. };
  594. else if (propName === 'style') overrideProps[propName] = {
  595. ...slotPropValue,
  596. ...childPropValue
  597. };
  598. else if (propName === 'className') overrideProps[propName] = [
  599. slotPropValue,
  600. childPropValue
  601. ].filter(Boolean).join(' ');
  602. }
  603. return {
  604. ...slotProps,
  605. ...overrideProps
  606. };
  607. }
  608. const $5e63c961fc1ce211$export$be92b6f5f03c0fe9 = (/* unused pure expression or super */ null && ($5e63c961fc1ce211$export$8c6ed5c666ac1360));
  609. ;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-primitive/dist/index.module.js
  610. const $8927f6f2acc4f386$var$NODES = [
  611. 'a',
  612. 'button',
  613. 'div',
  614. 'h2',
  615. 'h3',
  616. 'img',
  617. 'li',
  618. 'nav',
  619. 'ol',
  620. 'p',
  621. 'span',
  622. 'svg',
  623. 'ul'
  624. ]; // Temporary while we await merge of this fix:
  625. // https://github.com/DefinitelyTyped/DefinitelyTyped/pull/55396
  626. // prettier-ignore
  627. /* -------------------------------------------------------------------------------------------------
  628. * Primitive
  629. * -----------------------------------------------------------------------------------------------*/ const $8927f6f2acc4f386$export$250ffa63cdc0d034 = $8927f6f2acc4f386$var$NODES.reduce((primitive, node)=>{
  630. const Node = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{
  631. const { asChild: asChild , ...primitiveProps } = props;
  632. const Comp = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : node;
  633. (0,external_React_namespaceObject.useEffect)(()=>{
  634. window[Symbol.for('radix-ui')] = true;
  635. }, []);
  636. return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)(Comp, _extends({}, primitiveProps, {
  637. ref: forwardedRef
  638. }));
  639. });
  640. Node.displayName = `Primitive.${node}`;
  641. return {
  642. ...primitive,
  643. [node]: Node
  644. };
  645. }, {});
  646. /* -------------------------------------------------------------------------------------------------
  647. * Utils
  648. * -----------------------------------------------------------------------------------------------*/ /**
  649. * Flush custom event dispatch
  650. * https://github.com/radix-ui/primitives/pull/1378
  651. *
  652. * React batches *all* event handlers since version 18, this introduces certain considerations when using custom event types.
  653. *
  654. * Internally, React prioritises events in the following order:
  655. * - discrete
  656. * - continuous
  657. * - default
  658. *
  659. * https://github.com/facebook/react/blob/a8a4742f1c54493df00da648a3f9d26e3db9c8b5/packages/react-dom/src/events/ReactDOMEventListener.js#L294-L350
  660. *
  661. * `discrete` is an important distinction as updates within these events are applied immediately.
  662. * React however, is not able to infer the priority of custom event types due to how they are detected internally.
  663. * Because of this, it's possible for updates from custom events to be unexpectedly batched when
  664. * dispatched by another `discrete` event.
  665. *
  666. * In order to ensure that updates from custom events are applied predictably, we need to manually flush the batch.
  667. * This utility should be used when dispatching a custom event from within another `discrete` event, this utility
  668. * is not nessesary when dispatching known event types, or if dispatching a custom type inside a non-discrete event.
  669. * For example:
  670. *
  671. * dispatching a known click 👎
  672. * target.dispatchEvent(new Event(click))
  673. *
  674. * dispatching a custom type within a non-discrete event 👎
  675. * onScroll={(event) => event.target.dispatchEvent(new CustomEvent(customType))}
  676. *
  677. * dispatching a custom type within a `discrete` event 👍
  678. * onPointerDown={(event) => dispatchDiscreteCustomEvent(event.target, new CustomEvent(customType))}
  679. *
  680. * Note: though React classifies `focus`, `focusin` and `focusout` events as `discrete`, it's not recommended to use
  681. * this utility with them. This is because it's possible for those handlers to be called implicitly during render
  682. * e.g. when focus is within a component as it is unmounted, or when managing focus on mount.
  683. */ function $8927f6f2acc4f386$export$6d1a0317bde7de7f(target, event) {
  684. if (target) (0,external_ReactDOM_namespaceObject.flushSync)(()=>target.dispatchEvent(event)
  685. );
  686. }
  687. /* -----------------------------------------------------------------------------------------------*/ const $8927f6f2acc4f386$export$be92b6f5f03c0fe9 = (/* unused pure expression or super */ null && ($8927f6f2acc4f386$export$250ffa63cdc0d034));
  688. ;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-escape-keydown/dist/index.module.js
  689. /**
  690. * Listens for when the escape key is down
  691. */ function $addc16e1bbe58fd0$export$3a72a57244d6e765(onEscapeKeyDownProp) {
  692. const onEscapeKeyDown = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onEscapeKeyDownProp);
  693. (0,external_React_namespaceObject.useEffect)(()=>{
  694. const handleKeyDown = (event)=>{
  695. if (event.key === 'Escape') onEscapeKeyDown(event);
  696. };
  697. document.addEventListener('keydown', handleKeyDown);
  698. return ()=>document.removeEventListener('keydown', handleKeyDown)
  699. ;
  700. }, [
  701. onEscapeKeyDown
  702. ]);
  703. }
  704. ;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-dismissable-layer/dist/index.module.js
  705. /* -------------------------------------------------------------------------------------------------
  706. * DismissableLayer
  707. * -----------------------------------------------------------------------------------------------*/ const $5cb92bef7577960e$var$DISMISSABLE_LAYER_NAME = 'DismissableLayer';
  708. const $5cb92bef7577960e$var$CONTEXT_UPDATE = 'dismissableLayer.update';
  709. const $5cb92bef7577960e$var$POINTER_DOWN_OUTSIDE = 'dismissableLayer.pointerDownOutside';
  710. const $5cb92bef7577960e$var$FOCUS_OUTSIDE = 'dismissableLayer.focusOutside';
  711. let $5cb92bef7577960e$var$originalBodyPointerEvents;
  712. const $5cb92bef7577960e$var$DismissableLayerContext = /*#__PURE__*/ (0,external_React_namespaceObject.createContext)({
  713. layers: new Set(),
  714. layersWithOutsidePointerEventsDisabled: new Set(),
  715. branches: new Set()
  716. });
  717. const $5cb92bef7577960e$export$177fb62ff3ec1f22 = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{
  718. const { disableOutsidePointerEvents: disableOutsidePointerEvents = false , onEscapeKeyDown: onEscapeKeyDown , onPointerDownOutside: onPointerDownOutside , onFocusOutside: onFocusOutside , onInteractOutside: onInteractOutside , onDismiss: onDismiss , ...layerProps } = props;
  719. const context = (0,external_React_namespaceObject.useContext)($5cb92bef7577960e$var$DismissableLayerContext);
  720. const [node1, setNode] = (0,external_React_namespaceObject.useState)(null);
  721. const [, force] = (0,external_React_namespaceObject.useState)({});
  722. const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setNode(node)
  723. );
  724. const layers = Array.from(context.layers);
  725. const [highestLayerWithOutsidePointerEventsDisabled] = [
  726. ...context.layersWithOutsidePointerEventsDisabled
  727. ].slice(-1); // prettier-ignore
  728. const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled); // prettier-ignore
  729. const index = node1 ? layers.indexOf(node1) : -1;
  730. const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
  731. const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
  732. const pointerDownOutside = $5cb92bef7577960e$var$usePointerDownOutside((event)=>{
  733. const target = event.target;
  734. const isPointerDownOnBranch = [
  735. ...context.branches
  736. ].some((branch)=>branch.contains(target)
  737. );
  738. if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
  739. onPointerDownOutside === null || onPointerDownOutside === void 0 || onPointerDownOutside(event);
  740. onInteractOutside === null || onInteractOutside === void 0 || onInteractOutside(event);
  741. if (!event.defaultPrevented) onDismiss === null || onDismiss === void 0 || onDismiss();
  742. });
  743. const focusOutside = $5cb92bef7577960e$var$useFocusOutside((event)=>{
  744. const target = event.target;
  745. const isFocusInBranch = [
  746. ...context.branches
  747. ].some((branch)=>branch.contains(target)
  748. );
  749. if (isFocusInBranch) return;
  750. onFocusOutside === null || onFocusOutside === void 0 || onFocusOutside(event);
  751. onInteractOutside === null || onInteractOutside === void 0 || onInteractOutside(event);
  752. if (!event.defaultPrevented) onDismiss === null || onDismiss === void 0 || onDismiss();
  753. });
  754. $addc16e1bbe58fd0$export$3a72a57244d6e765((event)=>{
  755. const isHighestLayer = index === context.layers.size - 1;
  756. if (!isHighestLayer) return;
  757. onEscapeKeyDown === null || onEscapeKeyDown === void 0 || onEscapeKeyDown(event);
  758. if (!event.defaultPrevented && onDismiss) {
  759. event.preventDefault();
  760. onDismiss();
  761. }
  762. });
  763. (0,external_React_namespaceObject.useEffect)(()=>{
  764. if (!node1) return;
  765. if (disableOutsidePointerEvents) {
  766. if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
  767. $5cb92bef7577960e$var$originalBodyPointerEvents = document.body.style.pointerEvents;
  768. document.body.style.pointerEvents = 'none';
  769. }
  770. context.layersWithOutsidePointerEventsDisabled.add(node1);
  771. }
  772. context.layers.add(node1);
  773. $5cb92bef7577960e$var$dispatchUpdate();
  774. return ()=>{
  775. if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) document.body.style.pointerEvents = $5cb92bef7577960e$var$originalBodyPointerEvents;
  776. };
  777. }, [
  778. node1,
  779. disableOutsidePointerEvents,
  780. context
  781. ]);
  782. /**
  783. * We purposefully prevent combining this effect with the `disableOutsidePointerEvents` effect
  784. * because a change to `disableOutsidePointerEvents` would remove this layer from the stack
  785. * and add it to the end again so the layering order wouldn't be _creation order_.
  786. * We only want them to be removed from context stacks when unmounted.
  787. */ (0,external_React_namespaceObject.useEffect)(()=>{
  788. return ()=>{
  789. if (!node1) return;
  790. context.layers.delete(node1);
  791. context.layersWithOutsidePointerEventsDisabled.delete(node1);
  792. $5cb92bef7577960e$var$dispatchUpdate();
  793. };
  794. }, [
  795. node1,
  796. context
  797. ]);
  798. (0,external_React_namespaceObject.useEffect)(()=>{
  799. const handleUpdate = ()=>force({})
  800. ;
  801. document.addEventListener($5cb92bef7577960e$var$CONTEXT_UPDATE, handleUpdate);
  802. return ()=>document.removeEventListener($5cb92bef7577960e$var$CONTEXT_UPDATE, handleUpdate)
  803. ;
  804. }, []);
  805. return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, layerProps, {
  806. ref: composedRefs,
  807. style: {
  808. pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? 'auto' : 'none' : undefined,
  809. ...props.style
  810. },
  811. onFocusCapture: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onFocusCapture, focusOutside.onFocusCapture),
  812. onBlurCapture: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onBlurCapture, focusOutside.onBlurCapture),
  813. onPointerDownCapture: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerDownCapture, pointerDownOutside.onPointerDownCapture)
  814. }));
  815. });
  816. /*#__PURE__*/ Object.assign($5cb92bef7577960e$export$177fb62ff3ec1f22, {
  817. displayName: $5cb92bef7577960e$var$DISMISSABLE_LAYER_NAME
  818. });
  819. /* -------------------------------------------------------------------------------------------------
  820. * DismissableLayerBranch
  821. * -----------------------------------------------------------------------------------------------*/ const $5cb92bef7577960e$var$BRANCH_NAME = 'DismissableLayerBranch';
  822. const $5cb92bef7577960e$export$4d5eb2109db14228 = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{
  823. const context = (0,external_React_namespaceObject.useContext)($5cb92bef7577960e$var$DismissableLayerContext);
  824. const ref = (0,external_React_namespaceObject.useRef)(null);
  825. const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, ref);
  826. (0,external_React_namespaceObject.useEffect)(()=>{
  827. const node = ref.current;
  828. if (node) {
  829. context.branches.add(node);
  830. return ()=>{
  831. context.branches.delete(node);
  832. };
  833. }
  834. }, [
  835. context.branches
  836. ]);
  837. return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, props, {
  838. ref: composedRefs
  839. }));
  840. });
  841. /*#__PURE__*/ Object.assign($5cb92bef7577960e$export$4d5eb2109db14228, {
  842. displayName: $5cb92bef7577960e$var$BRANCH_NAME
  843. });
  844. /* -----------------------------------------------------------------------------------------------*/ /**
  845. * Listens for `pointerdown` outside a react subtree. We use `pointerdown` rather than `pointerup`
  846. * to mimic layer dismissing behaviour present in OS.
  847. * Returns props to pass to the node we want to check for outside events.
  848. */ function $5cb92bef7577960e$var$usePointerDownOutside(onPointerDownOutside) {
  849. const handlePointerDownOutside = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onPointerDownOutside);
  850. const isPointerInsideReactTreeRef = (0,external_React_namespaceObject.useRef)(false);
  851. const handleClickRef = (0,external_React_namespaceObject.useRef)(()=>{});
  852. (0,external_React_namespaceObject.useEffect)(()=>{
  853. const handlePointerDown = (event)=>{
  854. if (event.target && !isPointerInsideReactTreeRef.current) {
  855. const eventDetail = {
  856. originalEvent: event
  857. };
  858. function handleAndDispatchPointerDownOutsideEvent() {
  859. $5cb92bef7577960e$var$handleAndDispatchCustomEvent($5cb92bef7577960e$var$POINTER_DOWN_OUTSIDE, handlePointerDownOutside, eventDetail, {
  860. discrete: true
  861. });
  862. }
  863. /**
  864. * On touch devices, we need to wait for a click event because browsers implement
  865. * a ~350ms delay between the time the user stops touching the display and when the
  866. * browser executres events. We need to ensure we don't reactivate pointer-events within
  867. * this timeframe otherwise the browser may execute events that should have been prevented.
  868. *
  869. * Additionally, this also lets us deal automatically with cancellations when a click event
  870. * isn't raised because the page was considered scrolled/drag-scrolled, long-pressed, etc.
  871. *
  872. * This is why we also continuously remove the previous listener, because we cannot be
  873. * certain that it was raised, and therefore cleaned-up.
  874. */ if (event.pointerType === 'touch') {
  875. document.removeEventListener('click', handleClickRef.current);
  876. handleClickRef.current = handleAndDispatchPointerDownOutsideEvent;
  877. document.addEventListener('click', handleClickRef.current, {
  878. once: true
  879. });
  880. } else handleAndDispatchPointerDownOutsideEvent();
  881. }
  882. isPointerInsideReactTreeRef.current = false;
  883. };
  884. /**
  885. * if this hook executes in a component that mounts via a `pointerdown` event, the event
  886. * would bubble up to the document and trigger a `pointerDownOutside` event. We avoid
  887. * this by delaying the event listener registration on the document.
  888. * This is not React specific, but rather how the DOM works, ie:
  889. * ```
  890. * button.addEventListener('pointerdown', () => {
  891. * console.log('I will log');
  892. * document.addEventListener('pointerdown', () => {
  893. * console.log('I will also log');
  894. * })
  895. * });
  896. */ const timerId = window.setTimeout(()=>{
  897. document.addEventListener('pointerdown', handlePointerDown);
  898. }, 0);
  899. return ()=>{
  900. window.clearTimeout(timerId);
  901. document.removeEventListener('pointerdown', handlePointerDown);
  902. document.removeEventListener('click', handleClickRef.current);
  903. };
  904. }, [
  905. handlePointerDownOutside
  906. ]);
  907. return {
  908. // ensures we check React component tree (not just DOM tree)
  909. onPointerDownCapture: ()=>isPointerInsideReactTreeRef.current = true
  910. };
  911. }
  912. /**
  913. * Listens for when focus happens outside a react subtree.
  914. * Returns props to pass to the root (node) of the subtree we want to check.
  915. */ function $5cb92bef7577960e$var$useFocusOutside(onFocusOutside) {
  916. const handleFocusOutside = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onFocusOutside);
  917. const isFocusInsideReactTreeRef = (0,external_React_namespaceObject.useRef)(false);
  918. (0,external_React_namespaceObject.useEffect)(()=>{
  919. const handleFocus = (event)=>{
  920. if (event.target && !isFocusInsideReactTreeRef.current) {
  921. const eventDetail = {
  922. originalEvent: event
  923. };
  924. $5cb92bef7577960e$var$handleAndDispatchCustomEvent($5cb92bef7577960e$var$FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
  925. discrete: false
  926. });
  927. }
  928. };
  929. document.addEventListener('focusin', handleFocus);
  930. return ()=>document.removeEventListener('focusin', handleFocus)
  931. ;
  932. }, [
  933. handleFocusOutside
  934. ]);
  935. return {
  936. onFocusCapture: ()=>isFocusInsideReactTreeRef.current = true
  937. ,
  938. onBlurCapture: ()=>isFocusInsideReactTreeRef.current = false
  939. };
  940. }
  941. function $5cb92bef7577960e$var$dispatchUpdate() {
  942. const event = new CustomEvent($5cb92bef7577960e$var$CONTEXT_UPDATE);
  943. document.dispatchEvent(event);
  944. }
  945. function $5cb92bef7577960e$var$handleAndDispatchCustomEvent(name, handler, detail, { discrete: discrete }) {
  946. const target = detail.originalEvent.target;
  947. const event = new CustomEvent(name, {
  948. bubbles: false,
  949. cancelable: true,
  950. detail: detail
  951. });
  952. if (handler) target.addEventListener(name, handler, {
  953. once: true
  954. });
  955. if (discrete) $8927f6f2acc4f386$export$6d1a0317bde7de7f(target, event);
  956. else target.dispatchEvent(event);
  957. }
  958. const $5cb92bef7577960e$export$be92b6f5f03c0fe9 = (/* unused pure expression or super */ null && ($5cb92bef7577960e$export$177fb62ff3ec1f22));
  959. const $5cb92bef7577960e$export$aecb2ddcb55c95be = (/* unused pure expression or super */ null && ($5cb92bef7577960e$export$4d5eb2109db14228));
  960. ;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-focus-scope/dist/index.module.js
  961. const $d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT = 'focusScope.autoFocusOnMount';
  962. const $d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT = 'focusScope.autoFocusOnUnmount';
  963. const $d3863c46a17e8a28$var$EVENT_OPTIONS = {
  964. bubbles: false,
  965. cancelable: true
  966. };
  967. /* -------------------------------------------------------------------------------------------------
  968. * FocusScope
  969. * -----------------------------------------------------------------------------------------------*/ const $d3863c46a17e8a28$var$FOCUS_SCOPE_NAME = 'FocusScope';
  970. const $d3863c46a17e8a28$export$20e40289641fbbb6 = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{
  971. const { loop: loop = false , trapped: trapped = false , onMountAutoFocus: onMountAutoFocusProp , onUnmountAutoFocus: onUnmountAutoFocusProp , ...scopeProps } = props;
  972. const [container1, setContainer] = (0,external_React_namespaceObject.useState)(null);
  973. const onMountAutoFocus = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onMountAutoFocusProp);
  974. const onUnmountAutoFocus = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onUnmountAutoFocusProp);
  975. const lastFocusedElementRef = (0,external_React_namespaceObject.useRef)(null);
  976. const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setContainer(node)
  977. );
  978. const focusScope = (0,external_React_namespaceObject.useRef)({
  979. paused: false,
  980. pause () {
  981. this.paused = true;
  982. },
  983. resume () {
  984. this.paused = false;
  985. }
  986. }).current; // Takes care of trapping focus if focus is moved outside programmatically for example
  987. (0,external_React_namespaceObject.useEffect)(()=>{
  988. if (trapped) {
  989. function handleFocusIn(event) {
  990. if (focusScope.paused || !container1) return;
  991. const target = event.target;
  992. if (container1.contains(target)) lastFocusedElementRef.current = target;
  993. else $d3863c46a17e8a28$var$focus(lastFocusedElementRef.current, {
  994. select: true
  995. });
  996. }
  997. function handleFocusOut(event) {
  998. if (focusScope.paused || !container1) return;
  999. if (!container1.contains(event.relatedTarget)) $d3863c46a17e8a28$var$focus(lastFocusedElementRef.current, {
  1000. select: true
  1001. });
  1002. }
  1003. document.addEventListener('focusin', handleFocusIn);
  1004. document.addEventListener('focusout', handleFocusOut);
  1005. return ()=>{
  1006. document.removeEventListener('focusin', handleFocusIn);
  1007. document.removeEventListener('focusout', handleFocusOut);
  1008. };
  1009. }
  1010. }, [
  1011. trapped,
  1012. container1,
  1013. focusScope.paused
  1014. ]);
  1015. (0,external_React_namespaceObject.useEffect)(()=>{
  1016. if (container1) {
  1017. $d3863c46a17e8a28$var$focusScopesStack.add(focusScope);
  1018. const previouslyFocusedElement = document.activeElement;
  1019. const hasFocusedCandidate = container1.contains(previouslyFocusedElement);
  1020. if (!hasFocusedCandidate) {
  1021. const mountEvent = new CustomEvent($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, $d3863c46a17e8a28$var$EVENT_OPTIONS);
  1022. container1.addEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
  1023. container1.dispatchEvent(mountEvent);
  1024. if (!mountEvent.defaultPrevented) {
  1025. $d3863c46a17e8a28$var$focusFirst($d3863c46a17e8a28$var$removeLinks($d3863c46a17e8a28$var$getTabbableCandidates(container1)), {
  1026. select: true
  1027. });
  1028. if (document.activeElement === previouslyFocusedElement) $d3863c46a17e8a28$var$focus(container1);
  1029. }
  1030. }
  1031. return ()=>{
  1032. container1.removeEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, onMountAutoFocus); // We hit a react bug (fixed in v17) with focusing in unmount.
  1033. // We need to delay the focus a little to get around it for now.
  1034. // See: https://github.com/facebook/react/issues/17894
  1035. setTimeout(()=>{
  1036. const unmountEvent = new CustomEvent($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, $d3863c46a17e8a28$var$EVENT_OPTIONS);
  1037. container1.addEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
  1038. container1.dispatchEvent(unmountEvent);
  1039. if (!unmountEvent.defaultPrevented) $d3863c46a17e8a28$var$focus(previouslyFocusedElement !== null && previouslyFocusedElement !== void 0 ? previouslyFocusedElement : document.body, {
  1040. select: true
  1041. });
  1042. // we need to remove the listener after we `dispatchEvent`
  1043. container1.removeEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
  1044. $d3863c46a17e8a28$var$focusScopesStack.remove(focusScope);
  1045. }, 0);
  1046. };
  1047. }
  1048. }, [
  1049. container1,
  1050. onMountAutoFocus,
  1051. onUnmountAutoFocus,
  1052. focusScope
  1053. ]); // Takes care of looping focus (when tabbing whilst at the edges)
  1054. const handleKeyDown = (0,external_React_namespaceObject.useCallback)((event)=>{
  1055. if (!loop && !trapped) return;
  1056. if (focusScope.paused) return;
  1057. const isTabKey = event.key === 'Tab' && !event.altKey && !event.ctrlKey && !event.metaKey;
  1058. const focusedElement = document.activeElement;
  1059. if (isTabKey && focusedElement) {
  1060. const container = event.currentTarget;
  1061. const [first, last] = $d3863c46a17e8a28$var$getTabbableEdges(container);
  1062. const hasTabbableElementsInside = first && last; // we can only wrap focus if we have tabbable edges
  1063. if (!hasTabbableElementsInside) {
  1064. if (focusedElement === container) event.preventDefault();
  1065. } else {
  1066. if (!event.shiftKey && focusedElement === last) {
  1067. event.preventDefault();
  1068. if (loop) $d3863c46a17e8a28$var$focus(first, {
  1069. select: true
  1070. });
  1071. } else if (event.shiftKey && focusedElement === first) {
  1072. event.preventDefault();
  1073. if (loop) $d3863c46a17e8a28$var$focus(last, {
  1074. select: true
  1075. });
  1076. }
  1077. }
  1078. }
  1079. }, [
  1080. loop,
  1081. trapped,
  1082. focusScope.paused
  1083. ]);
  1084. return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
  1085. tabIndex: -1
  1086. }, scopeProps, {
  1087. ref: composedRefs,
  1088. onKeyDown: handleKeyDown
  1089. }));
  1090. });
  1091. /*#__PURE__*/ Object.assign($d3863c46a17e8a28$export$20e40289641fbbb6, {
  1092. displayName: $d3863c46a17e8a28$var$FOCUS_SCOPE_NAME
  1093. });
  1094. /* -------------------------------------------------------------------------------------------------
  1095. * Utils
  1096. * -----------------------------------------------------------------------------------------------*/ /**
  1097. * Attempts focusing the first element in a list of candidates.
  1098. * Stops when focus has actually moved.
  1099. */ function $d3863c46a17e8a28$var$focusFirst(candidates, { select: select = false } = {}) {
  1100. const previouslyFocusedElement = document.activeElement;
  1101. for (const candidate of candidates){
  1102. $d3863c46a17e8a28$var$focus(candidate, {
  1103. select: select
  1104. });
  1105. if (document.activeElement !== previouslyFocusedElement) return;
  1106. }
  1107. }
  1108. /**
  1109. * Returns the first and last tabbable elements inside a container.
  1110. */ function $d3863c46a17e8a28$var$getTabbableEdges(container) {
  1111. const candidates = $d3863c46a17e8a28$var$getTabbableCandidates(container);
  1112. const first = $d3863c46a17e8a28$var$findVisible(candidates, container);
  1113. const last = $d3863c46a17e8a28$var$findVisible(candidates.reverse(), container);
  1114. return [
  1115. first,
  1116. last
  1117. ];
  1118. }
  1119. /**
  1120. * Returns a list of potential tabbable candidates.
  1121. *
  1122. * NOTE: This is only a close approximation. For example it doesn't take into account cases like when
  1123. * elements are not visible. This cannot be worked out easily by just reading a property, but rather
  1124. * necessitate runtime knowledge (computed styles, etc). We deal with these cases separately.
  1125. *
  1126. * See: https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker
  1127. * Credit: https://github.com/discord/focus-layers/blob/master/src/util/wrapFocus.tsx#L1
  1128. */ function $d3863c46a17e8a28$var$getTabbableCandidates(container) {
  1129. const nodes = [];
  1130. const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
  1131. acceptNode: (node)=>{
  1132. const isHiddenInput = node.tagName === 'INPUT' && node.type === 'hidden';
  1133. if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP; // `.tabIndex` is not the same as the `tabindex` attribute. It works on the
  1134. // runtime's understanding of tabbability, so this automatically accounts
  1135. // for any kind of element that could be tabbed to.
  1136. return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
  1137. }
  1138. });
  1139. while(walker.nextNode())nodes.push(walker.currentNode); // we do not take into account the order of nodes with positive `tabIndex` as it
  1140. // hinders accessibility to have tab order different from visual order.
  1141. return nodes;
  1142. }
  1143. /**
  1144. * Returns the first visible element in a list.
  1145. * NOTE: Only checks visibility up to the `container`.
  1146. */ function $d3863c46a17e8a28$var$findVisible(elements, container) {
  1147. for (const element of elements){
  1148. // we stop checking if it's hidden at the `container` level (excluding)
  1149. if (!$d3863c46a17e8a28$var$isHidden(element, {
  1150. upTo: container
  1151. })) return element;
  1152. }
  1153. }
  1154. function $d3863c46a17e8a28$var$isHidden(node, { upTo: upTo }) {
  1155. if (getComputedStyle(node).visibility === 'hidden') return true;
  1156. while(node){
  1157. // we stop at `upTo` (excluding it)
  1158. if (upTo !== undefined && node === upTo) return false;
  1159. if (getComputedStyle(node).display === 'none') return true;
  1160. node = node.parentElement;
  1161. }
  1162. return false;
  1163. }
  1164. function $d3863c46a17e8a28$var$isSelectableInput(element) {
  1165. return element instanceof HTMLInputElement && 'select' in element;
  1166. }
  1167. function $d3863c46a17e8a28$var$focus(element, { select: select = false } = {}) {
  1168. // only focus if that element is focusable
  1169. if (element && element.focus) {
  1170. const previouslyFocusedElement = document.activeElement; // NOTE: we prevent scrolling on focus, to minimize jarring transitions for users
  1171. element.focus({
  1172. preventScroll: true
  1173. }); // only select if its not the same element, it supports selection and we need to select
  1174. if (element !== previouslyFocusedElement && $d3863c46a17e8a28$var$isSelectableInput(element) && select) element.select();
  1175. }
  1176. }
  1177. /* -------------------------------------------------------------------------------------------------
  1178. * FocusScope stack
  1179. * -----------------------------------------------------------------------------------------------*/ const $d3863c46a17e8a28$var$focusScopesStack = $d3863c46a17e8a28$var$createFocusScopesStack();
  1180. function $d3863c46a17e8a28$var$createFocusScopesStack() {
  1181. /** A stack of focus scopes, with the active one at the top */ let stack = [];
  1182. return {
  1183. add (focusScope) {
  1184. // pause the currently active focus scope (at the top of the stack)
  1185. const activeFocusScope = stack[0];
  1186. if (focusScope !== activeFocusScope) activeFocusScope === null || activeFocusScope === void 0 || activeFocusScope.pause();
  1187. // remove in case it already exists (because we'll re-add it at the top of the stack)
  1188. stack = $d3863c46a17e8a28$var$arrayRemove(stack, focusScope);
  1189. stack.unshift(focusScope);
  1190. },
  1191. remove (focusScope) {
  1192. var _stack$;
  1193. stack = $d3863c46a17e8a28$var$arrayRemove(stack, focusScope);
  1194. (_stack$ = stack[0]) === null || _stack$ === void 0 || _stack$.resume();
  1195. }
  1196. };
  1197. }
  1198. function $d3863c46a17e8a28$var$arrayRemove(array, item) {
  1199. const updatedArray = [
  1200. ...array
  1201. ];
  1202. const index = updatedArray.indexOf(item);
  1203. if (index !== -1) updatedArray.splice(index, 1);
  1204. return updatedArray;
  1205. }
  1206. function $d3863c46a17e8a28$var$removeLinks(items) {
  1207. return items.filter((item)=>item.tagName !== 'A'
  1208. );
  1209. }
  1210. const $d3863c46a17e8a28$export$be92b6f5f03c0fe9 = (/* unused pure expression or super */ null && ($d3863c46a17e8a28$export$20e40289641fbbb6));
  1211. ;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-portal/dist/index.module.js
  1212. /* -------------------------------------------------------------------------------------------------
  1213. * Portal
  1214. * -----------------------------------------------------------------------------------------------*/ const $f1701beae083dbae$var$PORTAL_NAME = 'Portal';
  1215. const $f1701beae083dbae$export$602eac185826482c = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{
  1216. var _globalThis$document;
  1217. const { container: container = globalThis === null || globalThis === void 0 ? void 0 : (_globalThis$document = globalThis.document) === null || _globalThis$document === void 0 ? void 0 : _globalThis$document.body , ...portalProps } = props;
  1218. return container ? /*#__PURE__*/ external_ReactDOM_default().createPortal(/*#__PURE__*/ (0,external_React_namespaceObject.createElement)($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, portalProps, {
  1219. ref: forwardedRef
  1220. })), container) : null;
  1221. });
  1222. /*#__PURE__*/ Object.assign($f1701beae083dbae$export$602eac185826482c, {
  1223. displayName: $f1701beae083dbae$var$PORTAL_NAME
  1224. });
  1225. /* -----------------------------------------------------------------------------------------------*/ const $f1701beae083dbae$export$be92b6f5f03c0fe9 = (/* unused pure expression or super */ null && ($f1701beae083dbae$export$602eac185826482c));
  1226. ;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-presence/dist/index.module.js
  1227. function $fe963b355347cc68$export$3e6543de14f8614f(initialState, machine) {
  1228. return (0,external_React_namespaceObject.useReducer)((state, event)=>{
  1229. const nextState = machine[state][event];
  1230. return nextState !== null && nextState !== void 0 ? nextState : state;
  1231. }, initialState);
  1232. }
  1233. const $921a889cee6df7e8$export$99c2b779aa4e8b8b = (props)=>{
  1234. const { present: present , children: children } = props;
  1235. const presence = $921a889cee6df7e8$var$usePresence(present);
  1236. const child = typeof children === 'function' ? children({
  1237. present: presence.isPresent
  1238. }) : external_React_namespaceObject.Children.only(children);
  1239. const ref = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(presence.ref, child.ref);
  1240. const forceMount = typeof children === 'function';
  1241. return forceMount || presence.isPresent ? /*#__PURE__*/ (0,external_React_namespaceObject.cloneElement)(child, {
  1242. ref: ref
  1243. }) : null;
  1244. };
  1245. $921a889cee6df7e8$export$99c2b779aa4e8b8b.displayName = 'Presence';
  1246. /* -------------------------------------------------------------------------------------------------
  1247. * usePresence
  1248. * -----------------------------------------------------------------------------------------------*/ function $921a889cee6df7e8$var$usePresence(present) {
  1249. const [node1, setNode] = (0,external_React_namespaceObject.useState)();
  1250. const stylesRef = (0,external_React_namespaceObject.useRef)({});
  1251. const prevPresentRef = (0,external_React_namespaceObject.useRef)(present);
  1252. const prevAnimationNameRef = (0,external_React_namespaceObject.useRef)('none');
  1253. const initialState = present ? 'mounted' : 'unmounted';
  1254. const [state, send] = $fe963b355347cc68$export$3e6543de14f8614f(initialState, {
  1255. mounted: {
  1256. UNMOUNT: 'unmounted',
  1257. ANIMATION_OUT: 'unmountSuspended'
  1258. },
  1259. unmountSuspended: {
  1260. MOUNT: 'mounted',
  1261. ANIMATION_END: 'unmounted'
  1262. },
  1263. unmounted: {
  1264. MOUNT: 'mounted'
  1265. }
  1266. });
  1267. (0,external_React_namespaceObject.useEffect)(()=>{
  1268. const currentAnimationName = $921a889cee6df7e8$var$getAnimationName(stylesRef.current);
  1269. prevAnimationNameRef.current = state === 'mounted' ? currentAnimationName : 'none';
  1270. }, [
  1271. state
  1272. ]);
  1273. $9f79659886946c16$export$e5c5a5f917a5871c(()=>{
  1274. const styles = stylesRef.current;
  1275. const wasPresent = prevPresentRef.current;
  1276. const hasPresentChanged = wasPresent !== present;
  1277. if (hasPresentChanged) {
  1278. const prevAnimationName = prevAnimationNameRef.current;
  1279. const currentAnimationName = $921a889cee6df7e8$var$getAnimationName(styles);
  1280. if (present) send('MOUNT');
  1281. else if (currentAnimationName === 'none' || (styles === null || styles === void 0 ? void 0 : styles.display) === 'none') // If there is no exit animation or the element is hidden, animations won't run
  1282. // so we unmount instantly
  1283. send('UNMOUNT');
  1284. else {
  1285. /**
  1286. * When `present` changes to `false`, we check changes to animation-name to
  1287. * determine whether an animation has started. We chose this approach (reading
  1288. * computed styles) because there is no `animationrun` event and `animationstart`
  1289. * fires after `animation-delay` has expired which would be too late.
  1290. */ const isAnimating = prevAnimationName !== currentAnimationName;
  1291. if (wasPresent && isAnimating) send('ANIMATION_OUT');
  1292. else send('UNMOUNT');
  1293. }
  1294. prevPresentRef.current = present;
  1295. }
  1296. }, [
  1297. present,
  1298. send
  1299. ]);
  1300. $9f79659886946c16$export$e5c5a5f917a5871c(()=>{
  1301. if (node1) {
  1302. /**
  1303. * Triggering an ANIMATION_OUT during an ANIMATION_IN will fire an `animationcancel`
  1304. * event for ANIMATION_IN after we have entered `unmountSuspended` state. So, we
  1305. * make sure we only trigger ANIMATION_END for the currently active animation.
  1306. */ const handleAnimationEnd = (event)=>{
  1307. const currentAnimationName = $921a889cee6df7e8$var$getAnimationName(stylesRef.current);
  1308. const isCurrentAnimation = currentAnimationName.includes(event.animationName);
  1309. if (event.target === node1 && isCurrentAnimation) // With React 18 concurrency this update is applied
  1310. // a frame after the animation ends, creating a flash of visible content.
  1311. // By manually flushing we ensure they sync within a frame, removing the flash.
  1312. (0,external_ReactDOM_namespaceObject.flushSync)(()=>send('ANIMATION_END')
  1313. );
  1314. };
  1315. const handleAnimationStart = (event)=>{
  1316. if (event.target === node1) // if animation occurred, store its name as the previous animation.
  1317. prevAnimationNameRef.current = $921a889cee6df7e8$var$getAnimationName(stylesRef.current);
  1318. };
  1319. node1.addEventListener('animationstart', handleAnimationStart);
  1320. node1.addEventListener('animationcancel', handleAnimationEnd);
  1321. node1.addEventListener('animationend', handleAnimationEnd);
  1322. return ()=>{
  1323. node1.removeEventListener('animationstart', handleAnimationStart);
  1324. node1.removeEventListener('animationcancel', handleAnimationEnd);
  1325. node1.removeEventListener('animationend', handleAnimationEnd);
  1326. };
  1327. } else // Transition to the unmounted state if the node is removed prematurely.
  1328. // We avoid doing so during cleanup as the node may change but still exist.
  1329. send('ANIMATION_END');
  1330. }, [
  1331. node1,
  1332. send
  1333. ]);
  1334. return {
  1335. isPresent: [
  1336. 'mounted',
  1337. 'unmountSuspended'
  1338. ].includes(state),
  1339. ref: (0,external_React_namespaceObject.useCallback)((node)=>{
  1340. if (node) stylesRef.current = getComputedStyle(node);
  1341. setNode(node);
  1342. }, [])
  1343. };
  1344. }
  1345. /* -----------------------------------------------------------------------------------------------*/ function $921a889cee6df7e8$var$getAnimationName(styles) {
  1346. return (styles === null || styles === void 0 ? void 0 : styles.animationName) || 'none';
  1347. }
  1348. ;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-focus-guards/dist/index.module.js
  1349. /** Number of components which have requested interest to have focus guards */ let $3db38b7d1fb3fe6a$var$count = 0;
  1350. function $3db38b7d1fb3fe6a$export$ac5b58043b79449b(props) {
  1351. $3db38b7d1fb3fe6a$export$b7ece24a22aeda8c();
  1352. return props.children;
  1353. }
  1354. /**
  1355. * Injects a pair of focus guards at the edges of the whole DOM tree
  1356. * to ensure `focusin` & `focusout` events can be caught consistently.
  1357. */ function $3db38b7d1fb3fe6a$export$b7ece24a22aeda8c() {
  1358. (0,external_React_namespaceObject.useEffect)(()=>{
  1359. var _edgeGuards$, _edgeGuards$2;
  1360. const edgeGuards = document.querySelectorAll('[data-radix-focus-guard]');
  1361. document.body.insertAdjacentElement('afterbegin', (_edgeGuards$ = edgeGuards[0]) !== null && _edgeGuards$ !== void 0 ? _edgeGuards$ : $3db38b7d1fb3fe6a$var$createFocusGuard());
  1362. document.body.insertAdjacentElement('beforeend', (_edgeGuards$2 = edgeGuards[1]) !== null && _edgeGuards$2 !== void 0 ? _edgeGuards$2 : $3db38b7d1fb3fe6a$var$createFocusGuard());
  1363. $3db38b7d1fb3fe6a$var$count++;
  1364. return ()=>{
  1365. if ($3db38b7d1fb3fe6a$var$count === 1) document.querySelectorAll('[data-radix-focus-guard]').forEach((node)=>node.remove()
  1366. );
  1367. $3db38b7d1fb3fe6a$var$count--;
  1368. };
  1369. }, []);
  1370. }
  1371. function $3db38b7d1fb3fe6a$var$createFocusGuard() {
  1372. const element = document.createElement('span');
  1373. element.setAttribute('data-radix-focus-guard', '');
  1374. element.tabIndex = 0;
  1375. element.style.cssText = 'outline: none; opacity: 0; position: fixed; pointer-events: none';
  1376. return element;
  1377. }
  1378. const $3db38b7d1fb3fe6a$export$be92b6f5f03c0fe9 = (/* unused pure expression or super */ null && ($3db38b7d1fb3fe6a$export$ac5b58043b79449b));
  1379. ;// CONCATENATED MODULE: ./node_modules/tslib/tslib.es6.mjs
  1380. /******************************************************************************
  1381. Copyright (c) Microsoft Corporation.
  1382. Permission to use, copy, modify, and/or distribute this software for any
  1383. purpose with or without fee is hereby granted.
  1384. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  1385. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  1386. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  1387. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  1388. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  1389. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  1390. PERFORMANCE OF THIS SOFTWARE.
  1391. ***************************************************************************** */
  1392. /* global Reflect, Promise, SuppressedError, Symbol */
  1393. var extendStatics = function(d, b) {
  1394. extendStatics = Object.setPrototypeOf ||
  1395. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  1396. function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
  1397. return extendStatics(d, b);
  1398. };
  1399. function __extends(d, b) {
  1400. if (typeof b !== "function" && b !== null)
  1401. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  1402. extendStatics(d, b);
  1403. function __() { this.constructor = d; }
  1404. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  1405. }
  1406. var __assign = function() {
  1407. __assign = Object.assign || function __assign(t) {
  1408. for (var s, i = 1, n = arguments.length; i < n; i++) {
  1409. s = arguments[i];
  1410. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  1411. }
  1412. return t;
  1413. }
  1414. return __assign.apply(this, arguments);
  1415. }
  1416. function __rest(s, e) {
  1417. var t = {};
  1418. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
  1419. t[p] = s[p];
  1420. if (s != null && typeof Object.getOwnPropertySymbols === "function")
  1421. for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
  1422. if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
  1423. t[p[i]] = s[p[i]];
  1424. }
  1425. return t;
  1426. }
  1427. function __decorate(decorators, target, key, desc) {
  1428. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  1429. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  1430. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  1431. return c > 3 && r && Object.defineProperty(target, key, r), r;
  1432. }
  1433. function __param(paramIndex, decorator) {
  1434. return function (target, key) { decorator(target, key, paramIndex); }
  1435. }
  1436. function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
  1437. function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
  1438. var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
  1439. var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
  1440. var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
  1441. var _, done = false;
  1442. for (var i = decorators.length - 1; i >= 0; i--) {
  1443. var context = {};
  1444. for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
  1445. for (var p in contextIn.access) context.access[p] = contextIn.access[p];
  1446. context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
  1447. var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
  1448. if (kind === "accessor") {
  1449. if (result === void 0) continue;
  1450. if (result === null || typeof result !== "object") throw new TypeError("Object expected");
  1451. if (_ = accept(result.get)) descriptor.get = _;
  1452. if (_ = accept(result.set)) descriptor.set = _;
  1453. if (_ = accept(result.init)) initializers.unshift(_);
  1454. }
  1455. else if (_ = accept(result)) {
  1456. if (kind === "field") initializers.unshift(_);
  1457. else descriptor[key] = _;
  1458. }
  1459. }
  1460. if (target) Object.defineProperty(target, contextIn.name, descriptor);
  1461. done = true;
  1462. };
  1463. function __runInitializers(thisArg, initializers, value) {
  1464. var useValue = arguments.length > 2;
  1465. for (var i = 0; i < initializers.length; i++) {
  1466. value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
  1467. }
  1468. return useValue ? value : void 0;
  1469. };
  1470. function __propKey(x) {
  1471. return typeof x === "symbol" ? x : "".concat(x);
  1472. };
  1473. function __setFunctionName(f, name, prefix) {
  1474. if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
  1475. return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
  1476. };
  1477. function __metadata(metadataKey, metadataValue) {
  1478. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
  1479. }
  1480. function __awaiter(thisArg, _arguments, P, generator) {
  1481. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  1482. return new (P || (P = Promise))(function (resolve, reject) {
  1483. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  1484. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  1485. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  1486. step((generator = generator.apply(thisArg, _arguments || [])).next());
  1487. });
  1488. }
  1489. function __generator(thisArg, body) {
  1490. var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
  1491. return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
  1492. function verb(n) { return function (v) { return step([n, v]); }; }
  1493. function step(op) {
  1494. if (f) throw new TypeError("Generator is already executing.");
  1495. while (g && (g = 0, op[0] && (_ = 0)), _) try {
  1496. if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
  1497. if (y = 0, t) op = [op[0] & 2, t.value];
  1498. switch (op[0]) {
  1499. case 0: case 1: t = op; break;
  1500. case 4: _.label++; return { value: op[1], done: false };
  1501. case 5: _.label++; y = op[1]; op = [0]; continue;
  1502. case 7: op = _.ops.pop(); _.trys.pop(); continue;
  1503. default:
  1504. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
  1505. if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
  1506. if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
  1507. if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
  1508. if (t[2]) _.ops.pop();
  1509. _.trys.pop(); continue;
  1510. }
  1511. op = body.call(thisArg, _);
  1512. } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
  1513. if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
  1514. }
  1515. }
  1516. var __createBinding = Object.create ? (function(o, m, k, k2) {
  1517. if (k2 === undefined) k2 = k;
  1518. var desc = Object.getOwnPropertyDescriptor(m, k);
  1519. if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
  1520. desc = { enumerable: true, get: function() { return m[k]; } };
  1521. }
  1522. Object.defineProperty(o, k2, desc);
  1523. }) : (function(o, m, k, k2) {
  1524. if (k2 === undefined) k2 = k;
  1525. o[k2] = m[k];
  1526. });
  1527. function __exportStar(m, o) {
  1528. for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
  1529. }
  1530. function __values(o) {
  1531. var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
  1532. if (m) return m.call(o);
  1533. if (o && typeof o.length === "number") return {
  1534. next: function () {
  1535. if (o && i >= o.length) o = void 0;
  1536. return { value: o && o[i++], done: !o };
  1537. }
  1538. };
  1539. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  1540. }
  1541. function __read(o, n) {
  1542. var m = typeof Symbol === "function" && o[Symbol.iterator];
  1543. if (!m) return o;
  1544. var i = m.call(o), r, ar = [], e;
  1545. try {
  1546. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
  1547. }
  1548. catch (error) { e = { error: error }; }
  1549. finally {
  1550. try {
  1551. if (r && !r.done && (m = i["return"])) m.call(i);
  1552. }
  1553. finally { if (e) throw e.error; }
  1554. }
  1555. return ar;
  1556. }
  1557. /** @deprecated */
  1558. function __spread() {
  1559. for (var ar = [], i = 0; i < arguments.length; i++)
  1560. ar = ar.concat(__read(arguments[i]));
  1561. return ar;
  1562. }
  1563. /** @deprecated */
  1564. function __spreadArrays() {
  1565. for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
  1566. for (var r = Array(s), k = 0, i = 0; i < il; i++)
  1567. for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
  1568. r[k] = a[j];
  1569. return r;
  1570. }
  1571. function __spreadArray(to, from, pack) {
  1572. if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
  1573. if (ar || !(i in from)) {
  1574. if (!ar) ar = Array.prototype.slice.call(from, 0, i);
  1575. ar[i] = from[i];
  1576. }
  1577. }
  1578. return to.concat(ar || Array.prototype.slice.call(from));
  1579. }
  1580. function __await(v) {
  1581. return this instanceof __await ? (this.v = v, this) : new __await(v);
  1582. }
  1583. function __asyncGenerator(thisArg, _arguments, generator) {
  1584. if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
  1585. var g = generator.apply(thisArg, _arguments || []), i, q = [];
  1586. return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
  1587. function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
  1588. function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
  1589. function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
  1590. function fulfill(value) { resume("next", value); }
  1591. function reject(value) { resume("throw", value); }
  1592. function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
  1593. }
  1594. function __asyncDelegator(o) {
  1595. var i, p;
  1596. return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
  1597. function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
  1598. }
  1599. function __asyncValues(o) {
  1600. if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
  1601. var m = o[Symbol.asyncIterator], i;
  1602. return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
  1603. function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
  1604. function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
  1605. }
  1606. function __makeTemplateObject(cooked, raw) {
  1607. if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
  1608. return cooked;
  1609. };
  1610. var __setModuleDefault = Object.create ? (function(o, v) {
  1611. Object.defineProperty(o, "default", { enumerable: true, value: v });
  1612. }) : function(o, v) {
  1613. o["default"] = v;
  1614. };
  1615. function __importStar(mod) {
  1616. if (mod && mod.__esModule) return mod;
  1617. var result = {};
  1618. if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  1619. __setModuleDefault(result, mod);
  1620. return result;
  1621. }
  1622. function __importDefault(mod) {
  1623. return (mod && mod.__esModule) ? mod : { default: mod };
  1624. }
  1625. function __classPrivateFieldGet(receiver, state, kind, f) {
  1626. if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
  1627. if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
  1628. return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
  1629. }
  1630. function __classPrivateFieldSet(receiver, state, value, kind, f) {
  1631. if (kind === "m") throw new TypeError("Private method is not writable");
  1632. if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
  1633. if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
  1634. return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
  1635. }
  1636. function __classPrivateFieldIn(state, receiver) {
  1637. if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
  1638. return typeof state === "function" ? receiver === state : state.has(receiver);
  1639. }
  1640. function __addDisposableResource(env, value, async) {
  1641. if (value !== null && value !== void 0) {
  1642. if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
  1643. var dispose;
  1644. if (async) {
  1645. if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
  1646. dispose = value[Symbol.asyncDispose];
  1647. }
  1648. if (dispose === void 0) {
  1649. if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
  1650. dispose = value[Symbol.dispose];
  1651. }
  1652. if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
  1653. env.stack.push({ value: value, dispose: dispose, async: async });
  1654. }
  1655. else if (async) {
  1656. env.stack.push({ async: true });
  1657. }
  1658. return value;
  1659. }
  1660. var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
  1661. var e = new Error(message);
  1662. return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
  1663. };
  1664. function __disposeResources(env) {
  1665. function fail(e) {
  1666. env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
  1667. env.hasError = true;
  1668. }
  1669. function next() {
  1670. while (env.stack.length) {
  1671. var rec = env.stack.pop();
  1672. try {
  1673. var result = rec.dispose && rec.dispose.call(rec.value);
  1674. if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
  1675. }
  1676. catch (e) {
  1677. fail(e);
  1678. }
  1679. }
  1680. if (env.hasError) throw env.error;
  1681. }
  1682. return next();
  1683. }
  1684. /* harmony default export */ var tslib_es6 = ({
  1685. __extends,
  1686. __assign,
  1687. __rest,
  1688. __decorate,
  1689. __param,
  1690. __metadata,
  1691. __awaiter,
  1692. __generator,
  1693. __createBinding,
  1694. __exportStar,
  1695. __values,
  1696. __read,
  1697. __spread,
  1698. __spreadArrays,
  1699. __spreadArray,
  1700. __await,
  1701. __asyncGenerator,
  1702. __asyncDelegator,
  1703. __asyncValues,
  1704. __makeTemplateObject,
  1705. __importStar,
  1706. __importDefault,
  1707. __classPrivateFieldGet,
  1708. __classPrivateFieldSet,
  1709. __classPrivateFieldIn,
  1710. __addDisposableResource,
  1711. __disposeResources,
  1712. });
  1713. ;// CONCATENATED MODULE: ./node_modules/react-remove-scroll-bar/dist/es2015/constants.js
  1714. var zeroRightClassName = 'right-scroll-bar-position';
  1715. var fullWidthClassName = 'width-before-scroll-bar';
  1716. var noScrollbarsClassName = 'with-scroll-bars-hidden';
  1717. /**
  1718. * Name of a CSS variable containing the amount of "hidden" scrollbar
  1719. * ! might be undefined ! use will fallback!
  1720. */
  1721. var removedBarSizeVariable = '--removed-body-scroll-bar-size';
  1722. ;// CONCATENATED MODULE: ./node_modules/use-callback-ref/dist/es2015/assignRef.js
  1723. /**
  1724. * Assigns a value for a given ref, no matter of the ref format
  1725. * @param {RefObject} ref - a callback function or ref object
  1726. * @param value - a new value
  1727. *
  1728. * @see https://github.com/theKashey/use-callback-ref#assignref
  1729. * @example
  1730. * const refObject = useRef();
  1731. * const refFn = (ref) => {....}
  1732. *
  1733. * assignRef(refObject, "refValue");
  1734. * assignRef(refFn, "refValue");
  1735. */
  1736. function assignRef(ref, value) {
  1737. if (typeof ref === 'function') {
  1738. ref(value);
  1739. }
  1740. else if (ref) {
  1741. ref.current = value;
  1742. }
  1743. return ref;
  1744. }
  1745. ;// CONCATENATED MODULE: ./node_modules/use-callback-ref/dist/es2015/useRef.js
  1746. /**
  1747. * creates a MutableRef with ref change callback
  1748. * @param initialValue - initial ref value
  1749. * @param {Function} callback - a callback to run when value changes
  1750. *
  1751. * @example
  1752. * const ref = useCallbackRef(0, (newValue, oldValue) => console.log(oldValue, '->', newValue);
  1753. * ref.current = 1;
  1754. * // prints 0 -> 1
  1755. *
  1756. * @see https://reactjs.org/docs/hooks-reference.html#useref
  1757. * @see https://github.com/theKashey/use-callback-ref#usecallbackref---to-replace-reactuseref
  1758. * @returns {MutableRefObject}
  1759. */
  1760. function useCallbackRef(initialValue, callback) {
  1761. var ref = (0,external_React_namespaceObject.useState)(function () { return ({
  1762. // value
  1763. value: initialValue,
  1764. // last callback
  1765. callback: callback,
  1766. // "memoized" public interface
  1767. facade: {
  1768. get current() {
  1769. return ref.value;
  1770. },
  1771. set current(value) {
  1772. var last = ref.value;
  1773. if (last !== value) {
  1774. ref.value = value;
  1775. ref.callback(value, last);
  1776. }
  1777. },
  1778. },
  1779. }); })[0];
  1780. // update callback
  1781. ref.callback = callback;
  1782. return ref.facade;
  1783. }
  1784. ;// CONCATENATED MODULE: ./node_modules/use-callback-ref/dist/es2015/useMergeRef.js
  1785. /**
  1786. * Merges two or more refs together providing a single interface to set their value
  1787. * @param {RefObject|Ref} refs
  1788. * @returns {MutableRefObject} - a new ref, which translates all changes to {refs}
  1789. *
  1790. * @see {@link mergeRefs} a version without buit-in memoization
  1791. * @see https://github.com/theKashey/use-callback-ref#usemergerefs
  1792. * @example
  1793. * const Component = React.forwardRef((props, ref) => {
  1794. * const ownRef = useRef();
  1795. * const domRef = useMergeRefs([ref, ownRef]); // 👈 merge together
  1796. * return <div ref={domRef}>...</div>
  1797. * }
  1798. */
  1799. function useMergeRefs(refs, defaultValue) {
  1800. return useCallbackRef(defaultValue || null, function (newValue) { return refs.forEach(function (ref) { return assignRef(ref, newValue); }); });
  1801. }
  1802. ;// CONCATENATED MODULE: ./node_modules/use-sidecar/dist/es2015/medium.js
  1803. function ItoI(a) {
  1804. return a;
  1805. }
  1806. function innerCreateMedium(defaults, middleware) {
  1807. if (middleware === void 0) { middleware = ItoI; }
  1808. var buffer = [];
  1809. var assigned = false;
  1810. var medium = {
  1811. read: function () {
  1812. if (assigned) {
  1813. throw new Error('Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.');
  1814. }
  1815. if (buffer.length) {
  1816. return buffer[buffer.length - 1];
  1817. }
  1818. return defaults;
  1819. },
  1820. useMedium: function (data) {
  1821. var item = middleware(data, assigned);
  1822. buffer.push(item);
  1823. return function () {
  1824. buffer = buffer.filter(function (x) { return x !== item; });
  1825. };
  1826. },
  1827. assignSyncMedium: function (cb) {
  1828. assigned = true;
  1829. while (buffer.length) {
  1830. var cbs = buffer;
  1831. buffer = [];
  1832. cbs.forEach(cb);
  1833. }
  1834. buffer = {
  1835. push: function (x) { return cb(x); },
  1836. filter: function () { return buffer; },
  1837. };
  1838. },
  1839. assignMedium: function (cb) {
  1840. assigned = true;
  1841. var pendingQueue = [];
  1842. if (buffer.length) {
  1843. var cbs = buffer;
  1844. buffer = [];
  1845. cbs.forEach(cb);
  1846. pendingQueue = buffer;
  1847. }
  1848. var executeQueue = function () {
  1849. var cbs = pendingQueue;
  1850. pendingQueue = [];
  1851. cbs.forEach(cb);
  1852. };
  1853. var cycle = function () { return Promise.resolve().then(executeQueue); };
  1854. cycle();
  1855. buffer = {
  1856. push: function (x) {
  1857. pendingQueue.push(x);
  1858. cycle();
  1859. },
  1860. filter: function (filter) {
  1861. pendingQueue = pendingQueue.filter(filter);
  1862. return buffer;
  1863. },
  1864. };
  1865. },
  1866. };
  1867. return medium;
  1868. }
  1869. function createMedium(defaults, middleware) {
  1870. if (middleware === void 0) { middleware = ItoI; }
  1871. return innerCreateMedium(defaults, middleware);
  1872. }
  1873. // eslint-disable-next-line @typescript-eslint/ban-types
  1874. function createSidecarMedium(options) {
  1875. if (options === void 0) { options = {}; }
  1876. var medium = innerCreateMedium(null);
  1877. medium.options = __assign({ async: true, ssr: false }, options);
  1878. return medium;
  1879. }
  1880. ;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/medium.js
  1881. var effectCar = createSidecarMedium();
  1882. ;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/UI.js
  1883. var nothing = function () {
  1884. return;
  1885. };
  1886. /**
  1887. * Removes scrollbar from the page and contain the scroll within the Lock
  1888. */
  1889. var RemoveScroll = external_React_namespaceObject.forwardRef(function (props, parentRef) {
  1890. var ref = external_React_namespaceObject.useRef(null);
  1891. var _a = external_React_namespaceObject.useState({
  1892. onScrollCapture: nothing,
  1893. onWheelCapture: nothing,
  1894. onTouchMoveCapture: nothing,
  1895. }), callbacks = _a[0], setCallbacks = _a[1];
  1896. var forwardProps = props.forwardProps, children = props.children, className = props.className, removeScrollBar = props.removeScrollBar, enabled = props.enabled, shards = props.shards, sideCar = props.sideCar, noIsolation = props.noIsolation, inert = props.inert, allowPinchZoom = props.allowPinchZoom, _b = props.as, Container = _b === void 0 ? 'div' : _b, rest = __rest(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as"]);
  1897. var SideCar = sideCar;
  1898. var containerRef = useMergeRefs([ref, parentRef]);
  1899. var containerProps = __assign(__assign({}, rest), callbacks);
  1900. return (external_React_namespaceObject.createElement(external_React_namespaceObject.Fragment, null,
  1901. enabled && (external_React_namespaceObject.createElement(SideCar, { sideCar: effectCar, removeScrollBar: removeScrollBar, shards: shards, noIsolation: noIsolation, inert: inert, setCallbacks: setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref })),
  1902. forwardProps ? (external_React_namespaceObject.cloneElement(external_React_namespaceObject.Children.only(children), __assign(__assign({}, containerProps), { ref: containerRef }))) : (external_React_namespaceObject.createElement(Container, __assign({}, containerProps, { className: className, ref: containerRef }), children))));
  1903. });
  1904. RemoveScroll.defaultProps = {
  1905. enabled: true,
  1906. removeScrollBar: true,
  1907. inert: false,
  1908. };
  1909. RemoveScroll.classNames = {
  1910. fullWidth: fullWidthClassName,
  1911. zeroRight: zeroRightClassName,
  1912. };
  1913. ;// CONCATENATED MODULE: ./node_modules/use-sidecar/dist/es2015/exports.js
  1914. var SideCar = function (_a) {
  1915. var sideCar = _a.sideCar, rest = __rest(_a, ["sideCar"]);
  1916. if (!sideCar) {
  1917. throw new Error('Sidecar: please provide `sideCar` property to import the right car');
  1918. }
  1919. var Target = sideCar.read();
  1920. if (!Target) {
  1921. throw new Error('Sidecar medium not found');
  1922. }
  1923. return external_React_namespaceObject.createElement(Target, __assign({}, rest));
  1924. };
  1925. SideCar.isSideCarExport = true;
  1926. function exportSidecar(medium, exported) {
  1927. medium.useMedium(exported);
  1928. return SideCar;
  1929. }
  1930. ;// CONCATENATED MODULE: ./node_modules/get-nonce/dist/es2015/index.js
  1931. var currentNonce;
  1932. var setNonce = function (nonce) {
  1933. currentNonce = nonce;
  1934. };
  1935. var getNonce = function () {
  1936. if (currentNonce) {
  1937. return currentNonce;
  1938. }
  1939. if (true) {
  1940. return __webpack_require__.nc;
  1941. }
  1942. return undefined;
  1943. };
  1944. ;// CONCATENATED MODULE: ./node_modules/react-style-singleton/dist/es2015/singleton.js
  1945. function makeStyleTag() {
  1946. if (!document)
  1947. return null;
  1948. var tag = document.createElement('style');
  1949. tag.type = 'text/css';
  1950. var nonce = getNonce();
  1951. if (nonce) {
  1952. tag.setAttribute('nonce', nonce);
  1953. }
  1954. return tag;
  1955. }
  1956. function injectStyles(tag, css) {
  1957. // @ts-ignore
  1958. if (tag.styleSheet) {
  1959. // @ts-ignore
  1960. tag.styleSheet.cssText = css;
  1961. }
  1962. else {
  1963. tag.appendChild(document.createTextNode(css));
  1964. }
  1965. }
  1966. function insertStyleTag(tag) {
  1967. var head = document.head || document.getElementsByTagName('head')[0];
  1968. head.appendChild(tag);
  1969. }
  1970. var stylesheetSingleton = function () {
  1971. var counter = 0;
  1972. var stylesheet = null;
  1973. return {
  1974. add: function (style) {
  1975. if (counter == 0) {
  1976. if ((stylesheet = makeStyleTag())) {
  1977. injectStyles(stylesheet, style);
  1978. insertStyleTag(stylesheet);
  1979. }
  1980. }
  1981. counter++;
  1982. },
  1983. remove: function () {
  1984. counter--;
  1985. if (!counter && stylesheet) {
  1986. stylesheet.parentNode && stylesheet.parentNode.removeChild(stylesheet);
  1987. stylesheet = null;
  1988. }
  1989. },
  1990. };
  1991. };
  1992. ;// CONCATENATED MODULE: ./node_modules/react-style-singleton/dist/es2015/hook.js
  1993. /**
  1994. * creates a hook to control style singleton
  1995. * @see {@link styleSingleton} for a safer component version
  1996. * @example
  1997. * ```tsx
  1998. * const useStyle = styleHookSingleton();
  1999. * ///
  2000. * useStyle('body { overflow: hidden}');
  2001. */
  2002. var styleHookSingleton = function () {
  2003. var sheet = stylesheetSingleton();
  2004. return function (styles, isDynamic) {
  2005. external_React_namespaceObject.useEffect(function () {
  2006. sheet.add(styles);
  2007. return function () {
  2008. sheet.remove();
  2009. };
  2010. }, [styles && isDynamic]);
  2011. };
  2012. };
  2013. ;// CONCATENATED MODULE: ./node_modules/react-style-singleton/dist/es2015/component.js
  2014. /**
  2015. * create a Component to add styles on demand
  2016. * - styles are added when first instance is mounted
  2017. * - styles are removed when the last instance is unmounted
  2018. * - changing styles in runtime does nothing unless dynamic is set. But with multiple components that can lead to the undefined behavior
  2019. */
  2020. var styleSingleton = function () {
  2021. var useStyle = styleHookSingleton();
  2022. var Sheet = function (_a) {
  2023. var styles = _a.styles, dynamic = _a.dynamic;
  2024. useStyle(styles, dynamic);
  2025. return null;
  2026. };
  2027. return Sheet;
  2028. };
  2029. ;// CONCATENATED MODULE: ./node_modules/react-style-singleton/dist/es2015/index.js
  2030. ;// CONCATENATED MODULE: ./node_modules/react-remove-scroll-bar/dist/es2015/utils.js
  2031. var zeroGap = {
  2032. left: 0,
  2033. top: 0,
  2034. right: 0,
  2035. gap: 0,
  2036. };
  2037. var parse = function (x) { return parseInt(x || '', 10) || 0; };
  2038. var getOffset = function (gapMode) {
  2039. var cs = window.getComputedStyle(document.body);
  2040. var left = cs[gapMode === 'padding' ? 'paddingLeft' : 'marginLeft'];
  2041. var top = cs[gapMode === 'padding' ? 'paddingTop' : 'marginTop'];
  2042. var right = cs[gapMode === 'padding' ? 'paddingRight' : 'marginRight'];
  2043. return [parse(left), parse(top), parse(right)];
  2044. };
  2045. var getGapWidth = function (gapMode) {
  2046. if (gapMode === void 0) { gapMode = 'margin'; }
  2047. if (typeof window === 'undefined') {
  2048. return zeroGap;
  2049. }
  2050. var offsets = getOffset(gapMode);
  2051. var documentWidth = document.documentElement.clientWidth;
  2052. var windowWidth = window.innerWidth;
  2053. return {
  2054. left: offsets[0],
  2055. top: offsets[1],
  2056. right: offsets[2],
  2057. gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0]),
  2058. };
  2059. };
  2060. ;// CONCATENATED MODULE: ./node_modules/react-remove-scroll-bar/dist/es2015/component.js
  2061. var Style = styleSingleton();
  2062. // important tip - once we measure scrollBar width and remove them
  2063. // we could not repeat this operation
  2064. // thus we are using style-singleton - only the first "yet correct" style will be applied.
  2065. var getStyles = function (_a, allowRelative, gapMode, important) {
  2066. var left = _a.left, top = _a.top, right = _a.right, gap = _a.gap;
  2067. if (gapMode === void 0) { gapMode = 'margin'; }
  2068. return "\n .".concat(noScrollbarsClassName, " {\n overflow: hidden ").concat(important, ";\n padding-right: ").concat(gap, "px ").concat(important, ";\n }\n body {\n overflow: hidden ").concat(important, ";\n overscroll-behavior: contain;\n ").concat([
  2069. allowRelative && "position: relative ".concat(important, ";"),
  2070. gapMode === 'margin' &&
  2071. "\n padding-left: ".concat(left, "px;\n padding-top: ").concat(top, "px;\n padding-right: ").concat(right, "px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(gap, "px ").concat(important, ";\n "),
  2072. gapMode === 'padding' && "padding-right: ".concat(gap, "px ").concat(important, ";"),
  2073. ]
  2074. .filter(Boolean)
  2075. .join(''), "\n }\n \n .").concat(zeroRightClassName, " {\n right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " {\n margin-right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(zeroRightClassName, " .").concat(zeroRightClassName, " {\n right: 0 ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " .").concat(fullWidthClassName, " {\n margin-right: 0 ").concat(important, ";\n }\n \n body {\n ").concat(removedBarSizeVariable, ": ").concat(gap, "px;\n }\n");
  2076. };
  2077. /**
  2078. * Removes page scrollbar and blocks page scroll when mounted
  2079. */
  2080. var RemoveScrollBar = function (props) {
  2081. var noRelative = props.noRelative, noImportant = props.noImportant, _a = props.gapMode, gapMode = _a === void 0 ? 'margin' : _a;
  2082. /*
  2083. gap will be measured on every component mount
  2084. however it will be used only by the "first" invocation
  2085. due to singleton nature of <Style
  2086. */
  2087. var gap = external_React_namespaceObject.useMemo(function () { return getGapWidth(gapMode); }, [gapMode]);
  2088. return external_React_namespaceObject.createElement(Style, { styles: getStyles(gap, !noRelative, gapMode, !noImportant ? '!important' : '') });
  2089. };
  2090. ;// CONCATENATED MODULE: ./node_modules/react-remove-scroll-bar/dist/es2015/index.js
  2091. ;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js
  2092. var passiveSupported = false;
  2093. if (typeof window !== 'undefined') {
  2094. try {
  2095. var options = Object.defineProperty({}, 'passive', {
  2096. get: function () {
  2097. passiveSupported = true;
  2098. return true;
  2099. },
  2100. });
  2101. // @ts-ignore
  2102. window.addEventListener('test', options, options);
  2103. // @ts-ignore
  2104. window.removeEventListener('test', options, options);
  2105. }
  2106. catch (err) {
  2107. passiveSupported = false;
  2108. }
  2109. }
  2110. var nonPassive = passiveSupported ? { passive: false } : false;
  2111. ;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/handleScroll.js
  2112. var elementCouldBeVScrolled = function (node) {
  2113. var styles = window.getComputedStyle(node);
  2114. return (styles.overflowY !== 'hidden' && // not-not-scrollable
  2115. !(styles.overflowY === styles.overflowX && styles.overflowY === 'visible') // scrollable
  2116. );
  2117. };
  2118. var elementCouldBeHScrolled = function (node) {
  2119. var styles = window.getComputedStyle(node);
  2120. return (styles.overflowX !== 'hidden' && // not-not-scrollable
  2121. !(styles.overflowY === styles.overflowX && styles.overflowX === 'visible') // scrollable
  2122. );
  2123. };
  2124. var locationCouldBeScrolled = function (axis, node) {
  2125. var current = node;
  2126. do {
  2127. // Skip over shadow root
  2128. if (typeof ShadowRoot !== 'undefined' && current instanceof ShadowRoot) {
  2129. current = current.host;
  2130. }
  2131. var isScrollable = elementCouldBeScrolled(axis, current);
  2132. if (isScrollable) {
  2133. var _a = getScrollVariables(axis, current), s = _a[1], d = _a[2];
  2134. if (s > d) {
  2135. return true;
  2136. }
  2137. }
  2138. current = current.parentNode;
  2139. } while (current && current !== document.body);
  2140. return false;
  2141. };
  2142. var getVScrollVariables = function (_a) {
  2143. var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;
  2144. return [
  2145. scrollTop,
  2146. scrollHeight,
  2147. clientHeight,
  2148. ];
  2149. };
  2150. var getHScrollVariables = function (_a) {
  2151. var scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth;
  2152. return [
  2153. scrollLeft,
  2154. scrollWidth,
  2155. clientWidth,
  2156. ];
  2157. };
  2158. var elementCouldBeScrolled = function (axis, node) {
  2159. return axis === 'v' ? elementCouldBeVScrolled(node) : elementCouldBeHScrolled(node);
  2160. };
  2161. var getScrollVariables = function (axis, node) {
  2162. return axis === 'v' ? getVScrollVariables(node) : getHScrollVariables(node);
  2163. };
  2164. var getDirectionFactor = function (axis, direction) {
  2165. /**
  2166. * If the element's direction is rtl (right-to-left), then scrollLeft is 0 when the scrollbar is at its rightmost position,
  2167. * and then increasingly negative as you scroll towards the end of the content.
  2168. * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollLeft
  2169. */
  2170. return axis === 'h' && direction === 'rtl' ? -1 : 1;
  2171. };
  2172. var handleScroll = function (axis, endTarget, event, sourceDelta, noOverscroll) {
  2173. var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction);
  2174. var delta = directionFactor * sourceDelta;
  2175. // find scrollable target
  2176. var target = event.target;
  2177. var targetInLock = endTarget.contains(target);
  2178. var shouldCancelScroll = false;
  2179. var isDeltaPositive = delta > 0;
  2180. var availableScroll = 0;
  2181. var availableScrollTop = 0;
  2182. do {
  2183. var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2];
  2184. var elementScroll = scroll_1 - capacity - directionFactor * position;
  2185. if (position || elementScroll) {
  2186. if (elementCouldBeScrolled(axis, target)) {
  2187. availableScroll += elementScroll;
  2188. availableScrollTop += position;
  2189. }
  2190. }
  2191. target = target.parentNode;
  2192. } while (
  2193. // portaled content
  2194. (!targetInLock && target !== document.body) ||
  2195. // self content
  2196. (targetInLock && (endTarget.contains(target) || endTarget === target)));
  2197. if (isDeltaPositive && ((noOverscroll && availableScroll === 0) || (!noOverscroll && delta > availableScroll))) {
  2198. shouldCancelScroll = true;
  2199. }
  2200. else if (!isDeltaPositive &&
  2201. ((noOverscroll && availableScrollTop === 0) || (!noOverscroll && -delta > availableScrollTop))) {
  2202. shouldCancelScroll = true;
  2203. }
  2204. return shouldCancelScroll;
  2205. };
  2206. ;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/SideEffect.js
  2207. var getTouchXY = function (event) {
  2208. return 'changedTouches' in event ? [event.changedTouches[0].clientX, event.changedTouches[0].clientY] : [0, 0];
  2209. };
  2210. var getDeltaXY = function (event) { return [event.deltaX, event.deltaY]; };
  2211. var extractRef = function (ref) {
  2212. return ref && 'current' in ref ? ref.current : ref;
  2213. };
  2214. var deltaCompare = function (x, y) { return x[0] === y[0] && x[1] === y[1]; };
  2215. var generateStyle = function (id) { return "\n .block-interactivity-".concat(id, " {pointer-events: none;}\n .allow-interactivity-").concat(id, " {pointer-events: all;}\n"); };
  2216. var idCounter = 0;
  2217. var lockStack = [];
  2218. function RemoveScrollSideCar(props) {
  2219. var shouldPreventQueue = external_React_namespaceObject.useRef([]);
  2220. var touchStartRef = external_React_namespaceObject.useRef([0, 0]);
  2221. var activeAxis = external_React_namespaceObject.useRef();
  2222. var id = external_React_namespaceObject.useState(idCounter++)[0];
  2223. var Style = external_React_namespaceObject.useState(function () { return styleSingleton(); })[0];
  2224. var lastProps = external_React_namespaceObject.useRef(props);
  2225. external_React_namespaceObject.useEffect(function () {
  2226. lastProps.current = props;
  2227. }, [props]);
  2228. external_React_namespaceObject.useEffect(function () {
  2229. if (props.inert) {
  2230. document.body.classList.add("block-interactivity-".concat(id));
  2231. var allow_1 = __spreadArray([props.lockRef.current], (props.shards || []).map(extractRef), true).filter(Boolean);
  2232. allow_1.forEach(function (el) { return el.classList.add("allow-interactivity-".concat(id)); });
  2233. return function () {
  2234. document.body.classList.remove("block-interactivity-".concat(id));
  2235. allow_1.forEach(function (el) { return el.classList.remove("allow-interactivity-".concat(id)); });
  2236. };
  2237. }
  2238. return;
  2239. }, [props.inert, props.lockRef.current, props.shards]);
  2240. var shouldCancelEvent = external_React_namespaceObject.useCallback(function (event, parent) {
  2241. if ('touches' in event && event.touches.length === 2) {
  2242. return !lastProps.current.allowPinchZoom;
  2243. }
  2244. var touch = getTouchXY(event);
  2245. var touchStart = touchStartRef.current;
  2246. var deltaX = 'deltaX' in event ? event.deltaX : touchStart[0] - touch[0];
  2247. var deltaY = 'deltaY' in event ? event.deltaY : touchStart[1] - touch[1];
  2248. var currentAxis;
  2249. var target = event.target;
  2250. var moveDirection = Math.abs(deltaX) > Math.abs(deltaY) ? 'h' : 'v';
  2251. // allow horizontal touch move on Range inputs. They will not cause any scroll
  2252. if ('touches' in event && moveDirection === 'h' && target.type === 'range') {
  2253. return false;
  2254. }
  2255. var canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
  2256. if (!canBeScrolledInMainDirection) {
  2257. return true;
  2258. }
  2259. if (canBeScrolledInMainDirection) {
  2260. currentAxis = moveDirection;
  2261. }
  2262. else {
  2263. currentAxis = moveDirection === 'v' ? 'h' : 'v';
  2264. canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
  2265. // other axis might be not scrollable
  2266. }
  2267. if (!canBeScrolledInMainDirection) {
  2268. return false;
  2269. }
  2270. if (!activeAxis.current && 'changedTouches' in event && (deltaX || deltaY)) {
  2271. activeAxis.current = currentAxis;
  2272. }
  2273. if (!currentAxis) {
  2274. return true;
  2275. }
  2276. var cancelingAxis = activeAxis.current || currentAxis;
  2277. return handleScroll(cancelingAxis, parent, event, cancelingAxis === 'h' ? deltaX : deltaY, true);
  2278. }, []);
  2279. var shouldPrevent = external_React_namespaceObject.useCallback(function (_event) {
  2280. var event = _event;
  2281. if (!lockStack.length || lockStack[lockStack.length - 1] !== Style) {
  2282. // not the last active
  2283. return;
  2284. }
  2285. var delta = 'deltaY' in event ? getDeltaXY(event) : getTouchXY(event);
  2286. var sourceEvent = shouldPreventQueue.current.filter(function (e) { return e.name === event.type && e.target === event.target && deltaCompare(e.delta, delta); })[0];
  2287. // self event, and should be canceled
  2288. if (sourceEvent && sourceEvent.should) {
  2289. event.preventDefault();
  2290. return;
  2291. }
  2292. // outside or shard event
  2293. if (!sourceEvent) {
  2294. var shardNodes = (lastProps.current.shards || [])
  2295. .map(extractRef)
  2296. .filter(Boolean)
  2297. .filter(function (node) { return node.contains(event.target); });
  2298. var shouldStop = shardNodes.length > 0 ? shouldCancelEvent(event, shardNodes[0]) : !lastProps.current.noIsolation;
  2299. if (shouldStop) {
  2300. event.preventDefault();
  2301. }
  2302. }
  2303. }, []);
  2304. var shouldCancel = external_React_namespaceObject.useCallback(function (name, delta, target, should) {
  2305. var event = { name: name, delta: delta, target: target, should: should };
  2306. shouldPreventQueue.current.push(event);
  2307. setTimeout(function () {
  2308. shouldPreventQueue.current = shouldPreventQueue.current.filter(function (e) { return e !== event; });
  2309. }, 1);
  2310. }, []);
  2311. var scrollTouchStart = external_React_namespaceObject.useCallback(function (event) {
  2312. touchStartRef.current = getTouchXY(event);
  2313. activeAxis.current = undefined;
  2314. }, []);
  2315. var scrollWheel = external_React_namespaceObject.useCallback(function (event) {
  2316. shouldCancel(event.type, getDeltaXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
  2317. }, []);
  2318. var scrollTouchMove = external_React_namespaceObject.useCallback(function (event) {
  2319. shouldCancel(event.type, getTouchXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
  2320. }, []);
  2321. external_React_namespaceObject.useEffect(function () {
  2322. lockStack.push(Style);
  2323. props.setCallbacks({
  2324. onScrollCapture: scrollWheel,
  2325. onWheelCapture: scrollWheel,
  2326. onTouchMoveCapture: scrollTouchMove,
  2327. });
  2328. document.addEventListener('wheel', shouldPrevent, nonPassive);
  2329. document.addEventListener('touchmove', shouldPrevent, nonPassive);
  2330. document.addEventListener('touchstart', scrollTouchStart, nonPassive);
  2331. return function () {
  2332. lockStack = lockStack.filter(function (inst) { return inst !== Style; });
  2333. document.removeEventListener('wheel', shouldPrevent, nonPassive);
  2334. document.removeEventListener('touchmove', shouldPrevent, nonPassive);
  2335. document.removeEventListener('touchstart', scrollTouchStart, nonPassive);
  2336. };
  2337. }, []);
  2338. var removeScrollBar = props.removeScrollBar, inert = props.inert;
  2339. return (external_React_namespaceObject.createElement(external_React_namespaceObject.Fragment, null,
  2340. inert ? external_React_namespaceObject.createElement(Style, { styles: generateStyle(id) }) : null,
  2341. removeScrollBar ? external_React_namespaceObject.createElement(RemoveScrollBar, { gapMode: "margin" }) : null));
  2342. }
  2343. ;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/sidecar.js
  2344. /* harmony default export */ var sidecar = (exportSidecar(effectCar, RemoveScrollSideCar));
  2345. ;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/Combination.js
  2346. var ReactRemoveScroll = external_React_namespaceObject.forwardRef(function (props, ref) { return (external_React_namespaceObject.createElement(RemoveScroll, __assign({}, props, { ref: ref, sideCar: sidecar }))); });
  2347. ReactRemoveScroll.classNames = RemoveScroll.classNames;
  2348. /* harmony default export */ var Combination = (ReactRemoveScroll);
  2349. ;// CONCATENATED MODULE: ./node_modules/aria-hidden/dist/es2015/index.js
  2350. var getDefaultParent = function (originalTarget) {
  2351. if (typeof document === 'undefined') {
  2352. return null;
  2353. }
  2354. var sampleTarget = Array.isArray(originalTarget) ? originalTarget[0] : originalTarget;
  2355. return sampleTarget.ownerDocument.body;
  2356. };
  2357. var counterMap = new WeakMap();
  2358. var uncontrolledNodes = new WeakMap();
  2359. var markerMap = {};
  2360. var lockCount = 0;
  2361. var unwrapHost = function (node) {
  2362. return node && (node.host || unwrapHost(node.parentNode));
  2363. };
  2364. var correctTargets = function (parent, targets) {
  2365. return targets
  2366. .map(function (target) {
  2367. if (parent.contains(target)) {
  2368. return target;
  2369. }
  2370. var correctedTarget = unwrapHost(target);
  2371. if (correctedTarget && parent.contains(correctedTarget)) {
  2372. return correctedTarget;
  2373. }
  2374. console.error('aria-hidden', target, 'in not contained inside', parent, '. Doing nothing');
  2375. return null;
  2376. })
  2377. .filter(function (x) { return Boolean(x); });
  2378. };
  2379. /**
  2380. * Marks everything except given node(or nodes) as aria-hidden
  2381. * @param {Element | Element[]} originalTarget - elements to keep on the page
  2382. * @param [parentNode] - top element, defaults to document.body
  2383. * @param {String} [markerName] - a special attribute to mark every node
  2384. * @param {String} [controlAttribute] - html Attribute to control
  2385. * @return {Undo} undo command
  2386. */
  2387. var applyAttributeToOthers = function (originalTarget, parentNode, markerName, controlAttribute) {
  2388. var targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
  2389. if (!markerMap[markerName]) {
  2390. markerMap[markerName] = new WeakMap();
  2391. }
  2392. var markerCounter = markerMap[markerName];
  2393. var hiddenNodes = [];
  2394. var elementsToKeep = new Set();
  2395. var elementsToStop = new Set(targets);
  2396. var keep = function (el) {
  2397. if (!el || elementsToKeep.has(el)) {
  2398. return;
  2399. }
  2400. elementsToKeep.add(el);
  2401. keep(el.parentNode);
  2402. };
  2403. targets.forEach(keep);
  2404. var deep = function (parent) {
  2405. if (!parent || elementsToStop.has(parent)) {
  2406. return;
  2407. }
  2408. Array.prototype.forEach.call(parent.children, function (node) {
  2409. if (elementsToKeep.has(node)) {
  2410. deep(node);
  2411. }
  2412. else {
  2413. var attr = node.getAttribute(controlAttribute);
  2414. var alreadyHidden = attr !== null && attr !== 'false';
  2415. var counterValue = (counterMap.get(node) || 0) + 1;
  2416. var markerValue = (markerCounter.get(node) || 0) + 1;
  2417. counterMap.set(node, counterValue);
  2418. markerCounter.set(node, markerValue);
  2419. hiddenNodes.push(node);
  2420. if (counterValue === 1 && alreadyHidden) {
  2421. uncontrolledNodes.set(node, true);
  2422. }
  2423. if (markerValue === 1) {
  2424. node.setAttribute(markerName, 'true');
  2425. }
  2426. if (!alreadyHidden) {
  2427. node.setAttribute(controlAttribute, 'true');
  2428. }
  2429. }
  2430. });
  2431. };
  2432. deep(parentNode);
  2433. elementsToKeep.clear();
  2434. lockCount++;
  2435. return function () {
  2436. hiddenNodes.forEach(function (node) {
  2437. var counterValue = counterMap.get(node) - 1;
  2438. var markerValue = markerCounter.get(node) - 1;
  2439. counterMap.set(node, counterValue);
  2440. markerCounter.set(node, markerValue);
  2441. if (!counterValue) {
  2442. if (!uncontrolledNodes.has(node)) {
  2443. node.removeAttribute(controlAttribute);
  2444. }
  2445. uncontrolledNodes.delete(node);
  2446. }
  2447. if (!markerValue) {
  2448. node.removeAttribute(markerName);
  2449. }
  2450. });
  2451. lockCount--;
  2452. if (!lockCount) {
  2453. // clear
  2454. counterMap = new WeakMap();
  2455. counterMap = new WeakMap();
  2456. uncontrolledNodes = new WeakMap();
  2457. markerMap = {};
  2458. }
  2459. };
  2460. };
  2461. /**
  2462. * Marks everything except given node(or nodes) as aria-hidden
  2463. * @param {Element | Element[]} originalTarget - elements to keep on the page
  2464. * @param [parentNode] - top element, defaults to document.body
  2465. * @param {String} [markerName] - a special attribute to mark every node
  2466. * @return {Undo} undo command
  2467. */
  2468. var hideOthers = function (originalTarget, parentNode, markerName) {
  2469. if (markerName === void 0) { markerName = 'data-aria-hidden'; }
  2470. var targets = Array.from(Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
  2471. var activeParentNode = parentNode || getDefaultParent(originalTarget);
  2472. if (!activeParentNode) {
  2473. return function () { return null; };
  2474. }
  2475. // we should not hide ariaLive elements - https://github.com/theKashey/aria-hidden/issues/10
  2476. targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll('[aria-live]')));
  2477. return applyAttributeToOthers(targets, activeParentNode, markerName, 'aria-hidden');
  2478. };
  2479. /**
  2480. * Marks everything except given node(or nodes) as inert
  2481. * @param {Element | Element[]} originalTarget - elements to keep on the page
  2482. * @param [parentNode] - top element, defaults to document.body
  2483. * @param {String} [markerName] - a special attribute to mark every node
  2484. * @return {Undo} undo command
  2485. */
  2486. var inertOthers = function (originalTarget, parentNode, markerName) {
  2487. if (markerName === void 0) { markerName = 'data-inert-ed'; }
  2488. var activeParentNode = parentNode || getDefaultParent(originalTarget);
  2489. if (!activeParentNode) {
  2490. return function () { return null; };
  2491. }
  2492. return applyAttributeToOthers(originalTarget, activeParentNode, markerName, 'inert');
  2493. };
  2494. /**
  2495. * @returns if current browser supports inert
  2496. */
  2497. var supportsInert = function () {
  2498. return typeof HTMLElement !== 'undefined' && HTMLElement.prototype.hasOwnProperty('inert');
  2499. };
  2500. /**
  2501. * Automatic function to "suppress" DOM elements - _hide_ or _inert_ in the best possible way
  2502. * @param {Element | Element[]} originalTarget - elements to keep on the page
  2503. * @param [parentNode] - top element, defaults to document.body
  2504. * @param {String} [markerName] - a special attribute to mark every node
  2505. * @return {Undo} undo command
  2506. */
  2507. var suppressOthers = function (originalTarget, parentNode, markerName) {
  2508. if (markerName === void 0) { markerName = 'data-suppressed'; }
  2509. return (supportsInert() ? inertOthers : hideOthers)(originalTarget, parentNode, markerName);
  2510. };
  2511. ;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-dialog/dist/index.module.js
  2512. /* -------------------------------------------------------------------------------------------------
  2513. * Dialog
  2514. * -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$DIALOG_NAME = 'Dialog';
  2515. const [$5d3850c4d0b4e6c7$var$createDialogContext, $5d3850c4d0b4e6c7$export$cc702773b8ea3e41] = $c512c27ab02ef895$export$50c7b4e9d9f19c1($5d3850c4d0b4e6c7$var$DIALOG_NAME);
  2516. const [$5d3850c4d0b4e6c7$var$DialogProvider, $5d3850c4d0b4e6c7$var$useDialogContext] = $5d3850c4d0b4e6c7$var$createDialogContext($5d3850c4d0b4e6c7$var$DIALOG_NAME);
  2517. const $5d3850c4d0b4e6c7$export$3ddf2d174ce01153 = (props)=>{
  2518. const { __scopeDialog: __scopeDialog , children: children , open: openProp , defaultOpen: defaultOpen , onOpenChange: onOpenChange , modal: modal = true } = props;
  2519. const triggerRef = (0,external_React_namespaceObject.useRef)(null);
  2520. const contentRef = (0,external_React_namespaceObject.useRef)(null);
  2521. const [open = false, setOpen] = $71cd76cc60e0454e$export$6f32135080cb4c3({
  2522. prop: openProp,
  2523. defaultProp: defaultOpen,
  2524. onChange: onOpenChange
  2525. });
  2526. return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($5d3850c4d0b4e6c7$var$DialogProvider, {
  2527. scope: __scopeDialog,
  2528. triggerRef: triggerRef,
  2529. contentRef: contentRef,
  2530. contentId: $1746a345f3d73bb7$export$f680877a34711e37(),
  2531. titleId: $1746a345f3d73bb7$export$f680877a34711e37(),
  2532. descriptionId: $1746a345f3d73bb7$export$f680877a34711e37(),
  2533. open: open,
  2534. onOpenChange: setOpen,
  2535. onOpenToggle: (0,external_React_namespaceObject.useCallback)(()=>setOpen((prevOpen)=>!prevOpen
  2536. )
  2537. , [
  2538. setOpen
  2539. ]),
  2540. modal: modal
  2541. }, children);
  2542. };
  2543. /*#__PURE__*/ Object.assign($5d3850c4d0b4e6c7$export$3ddf2d174ce01153, {
  2544. displayName: $5d3850c4d0b4e6c7$var$DIALOG_NAME
  2545. });
  2546. /* -------------------------------------------------------------------------------------------------
  2547. * DialogTrigger
  2548. * -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$TRIGGER_NAME = 'DialogTrigger';
  2549. const $5d3850c4d0b4e6c7$export$2e1e1122cf0cba88 = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{
  2550. const { __scopeDialog: __scopeDialog , ...triggerProps } = props;
  2551. const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$TRIGGER_NAME, __scopeDialog);
  2552. const composedTriggerRef = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, context.triggerRef);
  2553. return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($8927f6f2acc4f386$export$250ffa63cdc0d034.button, _extends({
  2554. type: "button",
  2555. "aria-haspopup": "dialog",
  2556. "aria-expanded": context.open,
  2557. "aria-controls": context.contentId,
  2558. "data-state": $5d3850c4d0b4e6c7$var$getState(context.open)
  2559. }, triggerProps, {
  2560. ref: composedTriggerRef,
  2561. onClick: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onClick, context.onOpenToggle)
  2562. }));
  2563. });
  2564. /*#__PURE__*/ Object.assign($5d3850c4d0b4e6c7$export$2e1e1122cf0cba88, {
  2565. displayName: $5d3850c4d0b4e6c7$var$TRIGGER_NAME
  2566. });
  2567. /* -------------------------------------------------------------------------------------------------
  2568. * DialogPortal
  2569. * -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$PORTAL_NAME = 'DialogPortal';
  2570. const [$5d3850c4d0b4e6c7$var$PortalProvider, $5d3850c4d0b4e6c7$var$usePortalContext] = $5d3850c4d0b4e6c7$var$createDialogContext($5d3850c4d0b4e6c7$var$PORTAL_NAME, {
  2571. forceMount: undefined
  2572. });
  2573. const $5d3850c4d0b4e6c7$export$dad7c95542bacce0 = (props)=>{
  2574. const { __scopeDialog: __scopeDialog , forceMount: forceMount , children: children , container: container } = props;
  2575. const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$PORTAL_NAME, __scopeDialog);
  2576. return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($5d3850c4d0b4e6c7$var$PortalProvider, {
  2577. scope: __scopeDialog,
  2578. forceMount: forceMount
  2579. }, external_React_namespaceObject.Children.map(children, (child)=>/*#__PURE__*/ (0,external_React_namespaceObject.createElement)($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
  2580. present: forceMount || context.open
  2581. }, /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($f1701beae083dbae$export$602eac185826482c, {
  2582. asChild: true,
  2583. container: container
  2584. }, child))
  2585. ));
  2586. };
  2587. /*#__PURE__*/ Object.assign($5d3850c4d0b4e6c7$export$dad7c95542bacce0, {
  2588. displayName: $5d3850c4d0b4e6c7$var$PORTAL_NAME
  2589. });
  2590. /* -------------------------------------------------------------------------------------------------
  2591. * DialogOverlay
  2592. * -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$OVERLAY_NAME = 'DialogOverlay';
  2593. const $5d3850c4d0b4e6c7$export$bd1d06c79be19e17 = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{
  2594. const portalContext = $5d3850c4d0b4e6c7$var$usePortalContext($5d3850c4d0b4e6c7$var$OVERLAY_NAME, props.__scopeDialog);
  2595. const { forceMount: forceMount = portalContext.forceMount , ...overlayProps } = props;
  2596. const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$OVERLAY_NAME, props.__scopeDialog);
  2597. return context.modal ? /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
  2598. present: forceMount || context.open
  2599. }, /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($5d3850c4d0b4e6c7$var$DialogOverlayImpl, _extends({}, overlayProps, {
  2600. ref: forwardedRef
  2601. }))) : null;
  2602. });
  2603. /*#__PURE__*/ Object.assign($5d3850c4d0b4e6c7$export$bd1d06c79be19e17, {
  2604. displayName: $5d3850c4d0b4e6c7$var$OVERLAY_NAME
  2605. });
  2606. const $5d3850c4d0b4e6c7$var$DialogOverlayImpl = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{
  2607. const { __scopeDialog: __scopeDialog , ...overlayProps } = props;
  2608. const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$OVERLAY_NAME, __scopeDialog);
  2609. return(/*#__PURE__*/ // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
  2610. // ie. when `Overlay` and `Content` are siblings
  2611. (0,external_React_namespaceObject.createElement)(Combination, {
  2612. as: $5e63c961fc1ce211$export$8c6ed5c666ac1360,
  2613. allowPinchZoom: true,
  2614. shards: [
  2615. context.contentRef
  2616. ]
  2617. }, /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
  2618. "data-state": $5d3850c4d0b4e6c7$var$getState(context.open)
  2619. }, overlayProps, {
  2620. ref: forwardedRef // We re-enable pointer-events prevented by `Dialog.Content` to allow scrolling the overlay.
  2621. ,
  2622. style: {
  2623. pointerEvents: 'auto',
  2624. ...overlayProps.style
  2625. }
  2626. }))));
  2627. });
  2628. /* -------------------------------------------------------------------------------------------------
  2629. * DialogContent
  2630. * -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$CONTENT_NAME = 'DialogContent';
  2631. const $5d3850c4d0b4e6c7$export$b6d9565de1e068cf = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{
  2632. const portalContext = $5d3850c4d0b4e6c7$var$usePortalContext($5d3850c4d0b4e6c7$var$CONTENT_NAME, props.__scopeDialog);
  2633. const { forceMount: forceMount = portalContext.forceMount , ...contentProps } = props;
  2634. const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$CONTENT_NAME, props.__scopeDialog);
  2635. return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
  2636. present: forceMount || context.open
  2637. }, context.modal ? /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($5d3850c4d0b4e6c7$var$DialogContentModal, _extends({}, contentProps, {
  2638. ref: forwardedRef
  2639. })) : /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($5d3850c4d0b4e6c7$var$DialogContentNonModal, _extends({}, contentProps, {
  2640. ref: forwardedRef
  2641. })));
  2642. });
  2643. /*#__PURE__*/ Object.assign($5d3850c4d0b4e6c7$export$b6d9565de1e068cf, {
  2644. displayName: $5d3850c4d0b4e6c7$var$CONTENT_NAME
  2645. });
  2646. /* -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$DialogContentModal = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{
  2647. const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$CONTENT_NAME, props.__scopeDialog);
  2648. const contentRef = (0,external_React_namespaceObject.useRef)(null);
  2649. const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, context.contentRef, contentRef); // aria-hide everything except the content (better supported equivalent to setting aria-modal)
  2650. (0,external_React_namespaceObject.useEffect)(()=>{
  2651. const content = contentRef.current;
  2652. if (content) return hideOthers(content);
  2653. }, []);
  2654. return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($5d3850c4d0b4e6c7$var$DialogContentImpl, _extends({}, props, {
  2655. ref: composedRefs // we make sure focus isn't trapped once `DialogContent` has been closed
  2656. ,
  2657. trapFocus: context.open,
  2658. disableOutsidePointerEvents: true,
  2659. onCloseAutoFocus: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onCloseAutoFocus, (event)=>{
  2660. var _context$triggerRef$c;
  2661. event.preventDefault();
  2662. (_context$triggerRef$c = context.triggerRef.current) === null || _context$triggerRef$c === void 0 || _context$triggerRef$c.focus();
  2663. }),
  2664. onPointerDownOutside: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerDownOutside, (event)=>{
  2665. const originalEvent = event.detail.originalEvent;
  2666. const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
  2667. const isRightClick = originalEvent.button === 2 || ctrlLeftClick; // If the event is a right-click, we shouldn't close because
  2668. // it is effectively as if we right-clicked the `Overlay`.
  2669. if (isRightClick) event.preventDefault();
  2670. }) // When focus is trapped, a `focusout` event may still happen.
  2671. ,
  2672. onFocusOutside: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onFocusOutside, (event)=>event.preventDefault()
  2673. )
  2674. }));
  2675. });
  2676. /* -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$DialogContentNonModal = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{
  2677. const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$CONTENT_NAME, props.__scopeDialog);
  2678. const hasInteractedOutsideRef = (0,external_React_namespaceObject.useRef)(false);
  2679. return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($5d3850c4d0b4e6c7$var$DialogContentImpl, _extends({}, props, {
  2680. ref: forwardedRef,
  2681. trapFocus: false,
  2682. disableOutsidePointerEvents: false,
  2683. onCloseAutoFocus: (event)=>{
  2684. var _props$onCloseAutoFoc;
  2685. (_props$onCloseAutoFoc = props.onCloseAutoFocus) === null || _props$onCloseAutoFoc === void 0 || _props$onCloseAutoFoc.call(props, event);
  2686. if (!event.defaultPrevented) {
  2687. var _context$triggerRef$c2;
  2688. if (!hasInteractedOutsideRef.current) (_context$triggerRef$c2 = context.triggerRef.current) === null || _context$triggerRef$c2 === void 0 || _context$triggerRef$c2.focus(); // Always prevent auto focus because we either focus manually or want user agent focus
  2689. event.preventDefault();
  2690. }
  2691. hasInteractedOutsideRef.current = false;
  2692. },
  2693. onInteractOutside: (event)=>{
  2694. var _props$onInteractOuts, _context$triggerRef$c3;
  2695. (_props$onInteractOuts = props.onInteractOutside) === null || _props$onInteractOuts === void 0 || _props$onInteractOuts.call(props, event);
  2696. if (!event.defaultPrevented) hasInteractedOutsideRef.current = true; // Prevent dismissing when clicking the trigger.
  2697. // As the trigger is already setup to close, without doing so would
  2698. // cause it to close and immediately open.
  2699. //
  2700. // We use `onInteractOutside` as some browsers also
  2701. // focus on pointer down, creating the same issue.
  2702. const target = event.target;
  2703. const targetIsTrigger = (_context$triggerRef$c3 = context.triggerRef.current) === null || _context$triggerRef$c3 === void 0 ? void 0 : _context$triggerRef$c3.contains(target);
  2704. if (targetIsTrigger) event.preventDefault();
  2705. }
  2706. }));
  2707. });
  2708. /* -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$DialogContentImpl = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{
  2709. const { __scopeDialog: __scopeDialog , trapFocus: trapFocus , onOpenAutoFocus: onOpenAutoFocus , onCloseAutoFocus: onCloseAutoFocus , ...contentProps } = props;
  2710. const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$CONTENT_NAME, __scopeDialog);
  2711. const contentRef = (0,external_React_namespaceObject.useRef)(null);
  2712. const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, contentRef); // Make sure the whole tree has focus guards as our `Dialog` will be
  2713. // the last element in the DOM (beacuse of the `Portal`)
  2714. $3db38b7d1fb3fe6a$export$b7ece24a22aeda8c();
  2715. return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($d3863c46a17e8a28$export$20e40289641fbbb6, {
  2716. asChild: true,
  2717. loop: true,
  2718. trapped: trapFocus,
  2719. onMountAutoFocus: onOpenAutoFocus,
  2720. onUnmountAutoFocus: onCloseAutoFocus
  2721. }, /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($5cb92bef7577960e$export$177fb62ff3ec1f22, _extends({
  2722. role: "dialog",
  2723. id: context.contentId,
  2724. "aria-describedby": context.descriptionId,
  2725. "aria-labelledby": context.titleId,
  2726. "data-state": $5d3850c4d0b4e6c7$var$getState(context.open)
  2727. }, contentProps, {
  2728. ref: composedRefs,
  2729. onDismiss: ()=>context.onOpenChange(false)
  2730. }))), false);
  2731. });
  2732. /* -------------------------------------------------------------------------------------------------
  2733. * DialogTitle
  2734. * -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$TITLE_NAME = 'DialogTitle';
  2735. const $5d3850c4d0b4e6c7$export$16f7638e4a34b909 = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{
  2736. const { __scopeDialog: __scopeDialog , ...titleProps } = props;
  2737. const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$TITLE_NAME, __scopeDialog);
  2738. return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($8927f6f2acc4f386$export$250ffa63cdc0d034.h2, _extends({
  2739. id: context.titleId
  2740. }, titleProps, {
  2741. ref: forwardedRef
  2742. }));
  2743. });
  2744. /*#__PURE__*/ Object.assign($5d3850c4d0b4e6c7$export$16f7638e4a34b909, {
  2745. displayName: $5d3850c4d0b4e6c7$var$TITLE_NAME
  2746. });
  2747. /* -------------------------------------------------------------------------------------------------
  2748. * DialogDescription
  2749. * -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$DESCRIPTION_NAME = 'DialogDescription';
  2750. const $5d3850c4d0b4e6c7$export$94e94c2ec2c954d5 = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{
  2751. const { __scopeDialog: __scopeDialog , ...descriptionProps } = props;
  2752. const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$DESCRIPTION_NAME, __scopeDialog);
  2753. return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($8927f6f2acc4f386$export$250ffa63cdc0d034.p, _extends({
  2754. id: context.descriptionId
  2755. }, descriptionProps, {
  2756. ref: forwardedRef
  2757. }));
  2758. });
  2759. /*#__PURE__*/ Object.assign($5d3850c4d0b4e6c7$export$94e94c2ec2c954d5, {
  2760. displayName: $5d3850c4d0b4e6c7$var$DESCRIPTION_NAME
  2761. });
  2762. /* -------------------------------------------------------------------------------------------------
  2763. * DialogClose
  2764. * -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$CLOSE_NAME = 'DialogClose';
  2765. const $5d3850c4d0b4e6c7$export$fba2fb7cd781b7ac = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{
  2766. const { __scopeDialog: __scopeDialog , ...closeProps } = props;
  2767. const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$CLOSE_NAME, __scopeDialog);
  2768. return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($8927f6f2acc4f386$export$250ffa63cdc0d034.button, _extends({
  2769. type: "button"
  2770. }, closeProps, {
  2771. ref: forwardedRef,
  2772. onClick: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onClick, ()=>context.onOpenChange(false)
  2773. )
  2774. }));
  2775. });
  2776. /*#__PURE__*/ Object.assign($5d3850c4d0b4e6c7$export$fba2fb7cd781b7ac, {
  2777. displayName: $5d3850c4d0b4e6c7$var$CLOSE_NAME
  2778. });
  2779. /* -----------------------------------------------------------------------------------------------*/ function $5d3850c4d0b4e6c7$var$getState(open) {
  2780. return open ? 'open' : 'closed';
  2781. }
  2782. const $5d3850c4d0b4e6c7$var$TITLE_WARNING_NAME = 'DialogTitleWarning';
  2783. const [$5d3850c4d0b4e6c7$export$69b62a49393917d6, $5d3850c4d0b4e6c7$var$useWarningContext] = $c512c27ab02ef895$export$fd42f52fd3ae1109($5d3850c4d0b4e6c7$var$TITLE_WARNING_NAME, {
  2784. contentName: $5d3850c4d0b4e6c7$var$CONTENT_NAME,
  2785. titleName: $5d3850c4d0b4e6c7$var$TITLE_NAME,
  2786. docsSlug: 'dialog'
  2787. });
  2788. const $5d3850c4d0b4e6c7$var$TitleWarning = ({ titleId: titleId })=>{
  2789. const titleWarningContext = $5d3850c4d0b4e6c7$var$useWarningContext($5d3850c4d0b4e6c7$var$TITLE_WARNING_NAME);
  2790. const MESSAGE = `\`${titleWarningContext.contentName}\` requires a \`${titleWarningContext.titleName}\` for the component to be accessible for screen reader users.
  2791. If you want to hide the \`${titleWarningContext.titleName}\`, you can wrap it with our VisuallyHidden component.
  2792. For more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`;
  2793. $67UHm$useEffect(()=>{
  2794. if (titleId) {
  2795. const hasTitle = document.getElementById(titleId);
  2796. if (!hasTitle) throw new Error(MESSAGE);
  2797. }
  2798. }, [
  2799. MESSAGE,
  2800. titleId
  2801. ]);
  2802. return null;
  2803. };
  2804. const $5d3850c4d0b4e6c7$var$DESCRIPTION_WARNING_NAME = 'DialogDescriptionWarning';
  2805. const $5d3850c4d0b4e6c7$var$DescriptionWarning = ({ contentRef: contentRef , descriptionId: descriptionId })=>{
  2806. const descriptionWarningContext = $5d3850c4d0b4e6c7$var$useWarningContext($5d3850c4d0b4e6c7$var$DESCRIPTION_WARNING_NAME);
  2807. const MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${descriptionWarningContext.contentName}}.`;
  2808. $67UHm$useEffect(()=>{
  2809. var _contentRef$current;
  2810. const describedById = (_contentRef$current = contentRef.current) === null || _contentRef$current === void 0 ? void 0 : _contentRef$current.getAttribute('aria-describedby'); // if we have an id and the user hasn't set aria-describedby={undefined}
  2811. if (descriptionId && describedById) {
  2812. const hasDescription = document.getElementById(descriptionId);
  2813. if (!hasDescription) console.warn(MESSAGE);
  2814. }
  2815. }, [
  2816. MESSAGE,
  2817. contentRef,
  2818. descriptionId
  2819. ]);
  2820. return null;
  2821. };
  2822. const $5d3850c4d0b4e6c7$export$be92b6f5f03c0fe9 = $5d3850c4d0b4e6c7$export$3ddf2d174ce01153;
  2823. const $5d3850c4d0b4e6c7$export$41fb9f06171c75f4 = (/* unused pure expression or super */ null && ($5d3850c4d0b4e6c7$export$2e1e1122cf0cba88));
  2824. const $5d3850c4d0b4e6c7$export$602eac185826482c = $5d3850c4d0b4e6c7$export$dad7c95542bacce0;
  2825. const $5d3850c4d0b4e6c7$export$c6fdb837b070b4ff = $5d3850c4d0b4e6c7$export$bd1d06c79be19e17;
  2826. const $5d3850c4d0b4e6c7$export$7c6e2c02157bb7d2 = $5d3850c4d0b4e6c7$export$b6d9565de1e068cf;
  2827. const $5d3850c4d0b4e6c7$export$f99233281efd08a0 = (/* unused pure expression or super */ null && ($5d3850c4d0b4e6c7$export$16f7638e4a34b909));
  2828. const $5d3850c4d0b4e6c7$export$393edc798c47379d = (/* unused pure expression or super */ null && ($5d3850c4d0b4e6c7$export$94e94c2ec2c954d5));
  2829. const $5d3850c4d0b4e6c7$export$f39c2d165cd861fe = (/* unused pure expression or super */ null && ($5d3850c4d0b4e6c7$export$fba2fb7cd781b7ac));
  2830. // EXTERNAL MODULE: ./node_modules/command-score/index.js
  2831. var command_score = __webpack_require__(8670);
  2832. ;// CONCATENATED MODULE: ./node_modules/cmdk/dist/index.mjs
  2833. var ue='[cmdk-list-sizer=""]',M='[cmdk-group=""]',N='[cmdk-group-items=""]',de='[cmdk-group-heading=""]',ee='[cmdk-item=""]',Z=`${ee}:not([aria-disabled="true"])`,z="cmdk-item-select",S="data-value",fe=(n,a)=>command_score(n,a),te=external_React_namespaceObject.createContext(void 0),k=()=>external_React_namespaceObject.useContext(te),re=external_React_namespaceObject.createContext(void 0),U=()=>external_React_namespaceObject.useContext(re),ne=external_React_namespaceObject.createContext(void 0),oe=external_React_namespaceObject.forwardRef((n,a)=>{let r=external_React_namespaceObject.useRef(null),o=x(()=>({search:"",value:"",filtered:{count:0,items:new Map,groups:new Set}})),u=x(()=>new Set),l=x(()=>new Map),p=x(()=>new Map),f=x(()=>new Set),d=ae(n),{label:v,children:E,value:R,onValueChange:w,filter:O,shouldFilter:ie,...D}=n,F=external_React_namespaceObject.useId(),g=external_React_namespaceObject.useId(),A=external_React_namespaceObject.useId(),y=ye();L(()=>{if(R!==void 0){let e=R.trim().toLowerCase();o.current.value=e,y(6,W),h.emit()}},[R]);let h=external_React_namespaceObject.useMemo(()=>({subscribe:e=>(f.current.add(e),()=>f.current.delete(e)),snapshot:()=>o.current,setState:(e,c,i)=>{var s,m,b;if(!Object.is(o.current[e],c)){if(o.current[e]=c,e==="search")j(),G(),y(1,V);else if(e==="value")if(((s=d.current)==null?void 0:s.value)!==void 0){(b=(m=d.current).onValueChange)==null||b.call(m,c);return}else i||y(5,W);h.emit()}},emit:()=>{f.current.forEach(e=>e())}}),[]),K=external_React_namespaceObject.useMemo(()=>({value:(e,c)=>{c!==p.current.get(e)&&(p.current.set(e,c),o.current.filtered.items.set(e,B(c)),y(2,()=>{G(),h.emit()}))},item:(e,c)=>(u.current.add(e),c&&(l.current.has(c)?l.current.get(c).add(e):l.current.set(c,new Set([e]))),y(3,()=>{j(),G(),o.current.value||V(),h.emit()}),()=>{p.current.delete(e),u.current.delete(e),o.current.filtered.items.delete(e),y(4,()=>{j(),V(),h.emit()})}),group:e=>(l.current.has(e)||l.current.set(e,new Set),()=>{p.current.delete(e),l.current.delete(e)}),filter:()=>d.current.shouldFilter,label:v||n["aria-label"],listId:F,inputId:A,labelId:g}),[]);function B(e){var i;let c=((i=d.current)==null?void 0:i.filter)??fe;return e?c(e,o.current.search):0}function G(){if(!r.current||!o.current.search||d.current.shouldFilter===!1)return;let e=o.current.filtered.items,c=[];o.current.filtered.groups.forEach(s=>{let m=l.current.get(s),b=0;m.forEach(P=>{let ce=e.get(P);b=Math.max(ce,b)}),c.push([s,b])});let i=r.current.querySelector(ue);I().sort((s,m)=>{let b=s.getAttribute(S),P=m.getAttribute(S);return(e.get(P)??0)-(e.get(b)??0)}).forEach(s=>{let m=s.closest(N);m?m.appendChild(s.parentElement===m?s:s.closest(`${N} > *`)):i.appendChild(s.parentElement===i?s:s.closest(`${N} > *`))}),c.sort((s,m)=>m[1]-s[1]).forEach(s=>{let m=r.current.querySelector(`${M}[${S}="${s[0]}"]`);m==null||m.parentElement.appendChild(m)})}function V(){let e=I().find(i=>!i.ariaDisabled),c=e==null?void 0:e.getAttribute(S);h.setState("value",c||void 0)}function j(){if(!o.current.search||d.current.shouldFilter===!1){o.current.filtered.count=u.current.size;return}o.current.filtered.groups=new Set;let e=0;for(let c of u.current){let i=p.current.get(c),s=B(i);o.current.filtered.items.set(c,s),s>0&&e++}for(let[c,i]of l.current)for(let s of i)if(o.current.filtered.items.get(s)>0){o.current.filtered.groups.add(c);break}o.current.filtered.count=e}function W(){var c,i,s;let e=_();e&&(((c=e.parentElement)==null?void 0:c.firstChild)===e&&((s=(i=e.closest(M))==null?void 0:i.querySelector(de))==null||s.scrollIntoView({block:"nearest"})),e.scrollIntoView({block:"nearest"}))}function _(){return r.current.querySelector(`${ee}[aria-selected="true"]`)}function I(){return Array.from(r.current.querySelectorAll(Z))}function q(e){let i=I()[e];i&&h.setState("value",i.getAttribute(S))}function $(e){var b;let c=_(),i=I(),s=i.findIndex(P=>P===c),m=i[s+e];(b=d.current)!=null&&b.loop&&(m=s+e<0?i[i.length-1]:s+e===i.length?i[0]:i[s+e]),m&&h.setState("value",m.getAttribute(S))}function J(e){let c=_(),i=c==null?void 0:c.closest(M),s;for(;i&&!s;)i=e>0?Se(i,M):Ce(
  2834. // EXTERNAL MODULE: ./node_modules/classnames/index.js
  2835. var classnames = __webpack_require__(4403);
  2836. var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
  2837. ;// CONCATENATED MODULE: external ["wp","data"]
  2838. var external_wp_data_namespaceObject = window["wp"]["data"];
  2839. ;// CONCATENATED MODULE: external ["wp","i18n"]
  2840. var external_wp_i18n_namespaceObject = window["wp"]["i18n"];
  2841. ;// CONCATENATED MODULE: external ["wp","components"]
  2842. var external_wp_components_namespaceObject = window["wp"]["components"];
  2843. ;// CONCATENATED MODULE: external ["wp","keyboardShortcuts"]
  2844. var external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"];
  2845. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js
  2846. /**
  2847. * WordPress dependencies
  2848. */
  2849. /** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */
  2850. /**
  2851. * Return an SVG icon.
  2852. *
  2853. * @param {IconProps} props icon is the SVG component to render
  2854. * size is a number specifiying the icon size in pixels
  2855. * Other props will be passed to wrapped SVG component
  2856. * @param {import('react').ForwardedRef<HTMLElement>} ref The forwarded ref to the SVG element.
  2857. *
  2858. * @return {JSX.Element} Icon component
  2859. */
  2860. function Icon({
  2861. icon,
  2862. size = 24,
  2863. ...props
  2864. }, ref) {
  2865. return (0,external_wp_element_namespaceObject.cloneElement)(icon, {
  2866. width: size,
  2867. height: size,
  2868. ...props,
  2869. ref
  2870. });
  2871. }
  2872. /* harmony default export */ var icon = ((0,external_wp_element_namespaceObject.forwardRef)(Icon));
  2873. ;// CONCATENATED MODULE: external ["wp","primitives"]
  2874. var external_wp_primitives_namespaceObject = window["wp"]["primitives"];
  2875. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/search.js
  2876. /**
  2877. * WordPress dependencies
  2878. */
  2879. const search = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  2880. xmlns: "http://www.w3.org/2000/svg",
  2881. viewBox: "0 0 24 24"
  2882. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  2883. 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"
  2884. }));
  2885. /* harmony default export */ var library_search = (search);
  2886. ;// CONCATENATED MODULE: ./node_modules/@wordpress/commands/build-module/store/reducer.js
  2887. /**
  2888. * WordPress dependencies
  2889. */
  2890. /**
  2891. * Reducer returning the registered commands
  2892. *
  2893. * @param {Object} state Current state.
  2894. * @param {Object} action Dispatched action.
  2895. *
  2896. * @return {Object} Updated state.
  2897. */
  2898. function commands(state = {}, action) {
  2899. switch (action.type) {
  2900. case 'REGISTER_COMMAND':
  2901. return {
  2902. ...state,
  2903. [action.name]: {
  2904. name: action.name,
  2905. label: action.label,
  2906. searchLabel: action.searchLabel,
  2907. context: action.context,
  2908. callback: action.callback,
  2909. icon: action.icon
  2910. }
  2911. };
  2912. case 'UNREGISTER_COMMAND':
  2913. {
  2914. const {
  2915. [action.name]: _,
  2916. ...remainingState
  2917. } = state;
  2918. return remainingState;
  2919. }
  2920. }
  2921. return state;
  2922. }
  2923. /**
  2924. * Reducer returning the command loaders
  2925. *
  2926. * @param {Object} state Current state.
  2927. * @param {Object} action Dispatched action.
  2928. *
  2929. * @return {Object} Updated state.
  2930. */
  2931. function commandLoaders(state = {}, action) {
  2932. switch (action.type) {
  2933. case 'REGISTER_COMMAND_LOADER':
  2934. return {
  2935. ...state,
  2936. [action.name]: {
  2937. name: action.name,
  2938. context: action.context,
  2939. hook: action.hook
  2940. }
  2941. };
  2942. case 'UNREGISTER_COMMAND_LOADER':
  2943. {
  2944. const {
  2945. [action.name]: _,
  2946. ...remainingState
  2947. } = state;
  2948. return remainingState;
  2949. }
  2950. }
  2951. return state;
  2952. }
  2953. /**
  2954. * Reducer returning the command palette open state.
  2955. *
  2956. * @param {Object} state Current state.
  2957. * @param {Object} action Dispatched action.
  2958. *
  2959. * @return {boolean} Updated state.
  2960. */
  2961. function isOpen(state = false, action) {
  2962. switch (action.type) {
  2963. case 'OPEN':
  2964. return true;
  2965. case 'CLOSE':
  2966. return false;
  2967. }
  2968. return state;
  2969. }
  2970. /**
  2971. * Reducer returning the command palette's active context.
  2972. *
  2973. * @param {Object} state Current state.
  2974. * @param {Object} action Dispatched action.
  2975. *
  2976. * @return {boolean} Updated state.
  2977. */
  2978. function context(state = 'root', action) {
  2979. switch (action.type) {
  2980. case 'SET_CONTEXT':
  2981. return action.context;
  2982. }
  2983. return state;
  2984. }
  2985. const reducer = (0,external_wp_data_namespaceObject.combineReducers)({
  2986. commands,
  2987. commandLoaders,
  2988. isOpen,
  2989. context
  2990. });
  2991. /* harmony default export */ var store_reducer = (reducer);
  2992. ;// CONCATENATED MODULE: ./node_modules/@wordpress/commands/build-module/store/actions.js
  2993. /** @typedef {import('@wordpress/keycodes').WPKeycodeModifier} WPKeycodeModifier */
  2994. /**
  2995. * Configuration of a registered keyboard shortcut.
  2996. *
  2997. * @typedef {Object} WPCommandConfig
  2998. *
  2999. * @property {string} name Command name.
  3000. * @property {string} label Command label.
  3001. * @property {string=} searchLabel Command search label.
  3002. * @property {string=} context Command context.
  3003. * @property {JSX.Element} icon Command icon.
  3004. * @property {Function} callback Command callback.
  3005. */
  3006. /**
  3007. * @typedef {(search: string) => WPCommandConfig[]} WPCommandLoaderHook hoo
  3008. */
  3009. /**
  3010. * Command loader config.
  3011. *
  3012. * @typedef {Object} WPCommandLoaderConfig
  3013. *
  3014. * @property {string} name Command loader name.
  3015. * @property {string=} context Command loader context.
  3016. * @property {WPCommandLoaderHook} hook Command loader hook.
  3017. */
  3018. /**
  3019. * Returns an action object used to register a new command.
  3020. *
  3021. * @param {WPCommandConfig} config Command config.
  3022. *
  3023. * @return {Object} action.
  3024. */
  3025. function registerCommand(config) {
  3026. return {
  3027. type: 'REGISTER_COMMAND',
  3028. ...config
  3029. };
  3030. }
  3031. /**
  3032. * Returns an action object used to unregister a command.
  3033. *
  3034. * @param {string} name Command name.
  3035. *
  3036. * @return {Object} action.
  3037. */
  3038. function unregisterCommand(name) {
  3039. return {
  3040. type: 'UNREGISTER_COMMAND',
  3041. name
  3042. };
  3043. }
  3044. /**
  3045. * Register command loader.
  3046. *
  3047. * @param {WPCommandLoaderConfig} config Command loader config.
  3048. *
  3049. * @return {Object} action.
  3050. */
  3051. function registerCommandLoader(config) {
  3052. return {
  3053. type: 'REGISTER_COMMAND_LOADER',
  3054. ...config
  3055. };
  3056. }
  3057. /**
  3058. * Unregister command loader hook.
  3059. *
  3060. * @param {string} name Command loader name.
  3061. *
  3062. * @return {Object} action.
  3063. */
  3064. function unregisterCommandLoader(name) {
  3065. return {
  3066. type: 'UNREGISTER_COMMAND_LOADER',
  3067. name
  3068. };
  3069. }
  3070. /**
  3071. * Opens the command palette.
  3072. *
  3073. * @return {Object} action.
  3074. */
  3075. function actions_open() {
  3076. return {
  3077. type: 'OPEN'
  3078. };
  3079. }
  3080. /**
  3081. * Closes the command palette.
  3082. *
  3083. * @return {Object} action.
  3084. */
  3085. function actions_close() {
  3086. return {
  3087. type: 'CLOSE'
  3088. };
  3089. }
  3090. ;// CONCATENATED MODULE: ./node_modules/rememo/rememo.js
  3091. /** @typedef {(...args: any[]) => *[]} GetDependants */
  3092. /** @typedef {() => void} Clear */
  3093. /**
  3094. * @typedef {{
  3095. * getDependants: GetDependants,
  3096. * clear: Clear
  3097. * }} EnhancedSelector
  3098. */
  3099. /**
  3100. * Internal cache entry.
  3101. *
  3102. * @typedef CacheNode
  3103. *
  3104. * @property {?CacheNode|undefined} [prev] Previous node.
  3105. * @property {?CacheNode|undefined} [next] Next node.
  3106. * @property {*[]} args Function arguments for cache entry.
  3107. * @property {*} val Function result.
  3108. */
  3109. /**
  3110. * @typedef Cache
  3111. *
  3112. * @property {Clear} clear Function to clear cache.
  3113. * @property {boolean} [isUniqueByDependants] Whether dependants are valid in
  3114. * considering cache uniqueness. A cache is unique if dependents are all arrays
  3115. * or objects.
  3116. * @property {CacheNode?} [head] Cache head.
  3117. * @property {*[]} [lastDependants] Dependants from previous invocation.
  3118. */
  3119. /**
  3120. * Arbitrary value used as key for referencing cache object in WeakMap tree.
  3121. *
  3122. * @type {{}}
  3123. */
  3124. var LEAF_KEY = {};
  3125. /**
  3126. * Returns the first argument as the sole entry in an array.
  3127. *
  3128. * @template T
  3129. *
  3130. * @param {T} value Value to return.
  3131. *
  3132. * @return {[T]} Value returned as entry in array.
  3133. */
  3134. function arrayOf(value) {
  3135. return [value];
  3136. }
  3137. /**
  3138. * Returns true if the value passed is object-like, or false otherwise. A value
  3139. * is object-like if it can support property assignment, e.g. object or array.
  3140. *
  3141. * @param {*} value Value to test.
  3142. *
  3143. * @return {boolean} Whether value is object-like.
  3144. */
  3145. function isObjectLike(value) {
  3146. return !!value && 'object' === typeof value;
  3147. }
  3148. /**
  3149. * Creates and returns a new cache object.
  3150. *
  3151. * @return {Cache} Cache object.
  3152. */
  3153. function createCache() {
  3154. /** @type {Cache} */
  3155. var cache = {
  3156. clear: function () {
  3157. cache.head = null;
  3158. },
  3159. };
  3160. return cache;
  3161. }
  3162. /**
  3163. * Returns true if entries within the two arrays are strictly equal by
  3164. * reference from a starting index.
  3165. *
  3166. * @param {*[]} a First array.
  3167. * @param {*[]} b Second array.
  3168. * @param {number} fromIndex Index from which to start comparison.
  3169. *
  3170. * @return {boolean} Whether arrays are shallowly equal.
  3171. */
  3172. function isShallowEqual(a, b, fromIndex) {
  3173. var i;
  3174. if (a.length !== b.length) {
  3175. return false;
  3176. }
  3177. for (i = fromIndex; i < a.length; i++) {
  3178. if (a[i] !== b[i]) {
  3179. return false;
  3180. }
  3181. }
  3182. return true;
  3183. }
  3184. /**
  3185. * Returns a memoized selector function. The getDependants function argument is
  3186. * called before the memoized selector and is expected to return an immutable
  3187. * reference or array of references on which the selector depends for computing
  3188. * its own return value. The memoize cache is preserved only as long as those
  3189. * dependant references remain the same. If getDependants returns a different
  3190. * reference(s), the cache is cleared and the selector value regenerated.
  3191. *
  3192. * @template {(...args: *[]) => *} S
  3193. *
  3194. * @param {S} selector Selector function.
  3195. * @param {GetDependants=} getDependants Dependant getter returning an array of
  3196. * references used in cache bust consideration.
  3197. */
  3198. /* harmony default export */ function rememo(selector, getDependants) {
  3199. /** @type {WeakMap<*,*>} */
  3200. var rootCache;
  3201. /** @type {GetDependants} */
  3202. var normalizedGetDependants = getDependants ? getDependants : arrayOf;
  3203. /**
  3204. * Returns the cache for a given dependants array. When possible, a WeakMap
  3205. * will be used to create a unique cache for each set of dependants. This
  3206. * is feasible due to the nature of WeakMap in allowing garbage collection
  3207. * to occur on entries where the key object is no longer referenced. Since
  3208. * WeakMap requires the key to be an object, this is only possible when the
  3209. * dependant is object-like. The root cache is created as a hierarchy where
  3210. * each top-level key is the first entry in a dependants set, the value a
  3211. * WeakMap where each key is the next dependant, and so on. This continues
  3212. * so long as the dependants are object-like. If no dependants are object-
  3213. * like, then the cache is shared across all invocations.
  3214. *
  3215. * @see isObjectLike
  3216. *
  3217. * @param {*[]} dependants Selector dependants.
  3218. *
  3219. * @return {Cache} Cache object.
  3220. */
  3221. function getCache(dependants) {
  3222. var caches = rootCache,
  3223. isUniqueByDependants = true,
  3224. i,
  3225. dependant,
  3226. map,
  3227. cache;
  3228. for (i = 0; i < dependants.length; i++) {
  3229. dependant = dependants[i];
  3230. // Can only compose WeakMap from object-like key.
  3231. if (!isObjectLike(dependant)) {
  3232. isUniqueByDependants = false;
  3233. break;
  3234. }
  3235. // Does current segment of cache already have a WeakMap?
  3236. if (caches.has(dependant)) {
  3237. // Traverse into nested WeakMap.
  3238. caches = caches.get(dependant);
  3239. } else {
  3240. // Create, set, and traverse into a new one.
  3241. map = new WeakMap();
  3242. caches.set(dependant, map);
  3243. caches = map;
  3244. }
  3245. }
  3246. // We use an arbitrary (but consistent) object as key for the last item
  3247. // in the WeakMap to serve as our running cache.
  3248. if (!caches.has(LEAF_KEY)) {
  3249. cache = createCache();
  3250. cache.isUniqueByDependants = isUniqueByDependants;
  3251. caches.set(LEAF_KEY, cache);
  3252. }
  3253. return caches.get(LEAF_KEY);
  3254. }
  3255. /**
  3256. * Resets root memoization cache.
  3257. */
  3258. function clear() {
  3259. rootCache = new WeakMap();
  3260. }
  3261. /* eslint-disable jsdoc/check-param-names */
  3262. /**
  3263. * The augmented selector call, considering first whether dependants have
  3264. * changed before passing it to underlying memoize function.
  3265. *
  3266. * @param {*} source Source object for derivation.
  3267. * @param {...*} extraArgs Additional arguments to pass to selector.
  3268. *
  3269. * @return {*} Selector result.
  3270. */
  3271. /* eslint-enable jsdoc/check-param-names */
  3272. function callSelector(/* source, ...extraArgs */) {
  3273. var len = arguments.length,
  3274. cache,
  3275. node,
  3276. i,
  3277. args,
  3278. dependants;
  3279. // Create copy of arguments (avoid leaking deoptimization).
  3280. args = new Array(len);
  3281. for (i = 0; i < len; i++) {
  3282. args[i] = arguments[i];
  3283. }
  3284. dependants = normalizedGetDependants.apply(null, args);
  3285. cache = getCache(dependants);
  3286. // If not guaranteed uniqueness by dependants (primitive type), shallow
  3287. // compare against last dependants and, if references have changed,
  3288. // destroy cache to recalculate result.
  3289. if (!cache.isUniqueByDependants) {
  3290. if (
  3291. cache.lastDependants &&
  3292. !isShallowEqual(dependants, cache.lastDependants, 0)
  3293. ) {
  3294. cache.clear();
  3295. }
  3296. cache.lastDependants = dependants;
  3297. }
  3298. node = cache.head;
  3299. while (node) {
  3300. // Check whether node arguments match arguments
  3301. if (!isShallowEqual(node.args, args, 1)) {
  3302. node = node.next;
  3303. continue;
  3304. }
  3305. // At this point we can assume we've found a match
  3306. // Surface matched node to head if not already
  3307. if (node !== cache.head) {
  3308. // Adjust siblings to point to each other.
  3309. /** @type {CacheNode} */ (node.prev).next = node.next;
  3310. if (node.next) {
  3311. node.next.prev = node.prev;
  3312. }
  3313. node.next = cache.head;
  3314. node.prev = null;
  3315. /** @type {CacheNode} */ (cache.head).prev = node;
  3316. cache.head = node;
  3317. }
  3318. // Return immediately
  3319. return node.val;
  3320. }
  3321. // No cached value found. Continue to insertion phase:
  3322. node = /** @type {CacheNode} */ ({
  3323. // Generate the result from original function
  3324. val: selector.apply(null, args),
  3325. });
  3326. // Avoid including the source object in the cache.
  3327. args[0] = null;
  3328. node.args = args;
  3329. // Don't need to check whether node is already head, since it would
  3330. // have been returned above already if it was
  3331. // Shift existing head down list
  3332. if (cache.head) {
  3333. cache.head.prev = node;
  3334. node.next = cache.head;
  3335. }
  3336. cache.head = node;
  3337. return node.val;
  3338. }
  3339. callSelector.getDependants = normalizedGetDependants;
  3340. callSelector.clear = clear;
  3341. clear();
  3342. return /** @type {S & EnhancedSelector} */ (callSelector);
  3343. }
  3344. ;// CONCATENATED MODULE: ./node_modules/@wordpress/commands/build-module/store/selectors.js
  3345. /**
  3346. * External dependencies
  3347. */
  3348. /**
  3349. * Returns the registered static commands.
  3350. *
  3351. * @param {Object} state State tree.
  3352. * @param {boolean} contextual Whether to return only contextual commands.
  3353. *
  3354. * @return {import('./actions').WPCommandConfig[]} The list of registered commands.
  3355. */
  3356. const getCommands = rememo((state, contextual = false) => Object.values(state.commands).filter(command => {
  3357. const isContextual = command.context && command.context === state.context;
  3358. return contextual ? isContextual : !isContextual;
  3359. }), state => [state.commands, state.context]);
  3360. /**
  3361. * Returns the registered command loaders.
  3362. *
  3363. * @param {Object} state State tree.
  3364. * @param {boolean} contextual Whether to return only contextual command loaders.
  3365. *
  3366. * @return {import('./actions').WPCommandLoaderConfig[]} The list of registered command loaders.
  3367. */
  3368. const getCommandLoaders = rememo((state, contextual = false) => Object.values(state.commandLoaders).filter(loader => {
  3369. const isContextual = loader.context && loader.context === state.context;
  3370. return contextual ? isContextual : !isContextual;
  3371. }), state => [state.commandLoaders, state.context]);
  3372. /**
  3373. * Returns whether the command palette is open.
  3374. *
  3375. * @param {Object} state State tree.
  3376. *
  3377. * @return {boolean} Returns whether the command palette is open.
  3378. */
  3379. function selectors_isOpen(state) {
  3380. return state.isOpen;
  3381. }
  3382. /**
  3383. * Returns whether the active context.
  3384. *
  3385. * @param {Object} state State tree.
  3386. *
  3387. * @return {string} Context.
  3388. */
  3389. function getContext(state) {
  3390. return state.context;
  3391. }
  3392. ;// CONCATENATED MODULE: ./node_modules/@wordpress/commands/build-module/store/private-actions.js
  3393. /**
  3394. * Sets the active context.
  3395. *
  3396. * @param {string} context Context.
  3397. *
  3398. * @return {Object} action.
  3399. */
  3400. function setContext(context) {
  3401. return {
  3402. type: 'SET_CONTEXT',
  3403. context
  3404. };
  3405. }
  3406. ;// CONCATENATED MODULE: external ["wp","privateApis"]
  3407. var external_wp_privateApis_namespaceObject = window["wp"]["privateApis"];
  3408. ;// CONCATENATED MODULE: ./node_modules/@wordpress/commands/build-module/lock-unlock.js
  3409. /**
  3410. * WordPress dependencies
  3411. */
  3412. const {
  3413. lock,
  3414. unlock
  3415. } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.', '@wordpress/commands');
  3416. ;// CONCATENATED MODULE: ./node_modules/@wordpress/commands/build-module/store/index.js
  3417. /**
  3418. * WordPress dependencies
  3419. */
  3420. /**
  3421. * Internal dependencies
  3422. */
  3423. const STORE_NAME = 'core/commands';
  3424. /**
  3425. * Store definition for the commands namespace.
  3426. *
  3427. * See how the Commands Store is being used in components like [site-hub](https://github.com/WordPress/gutenberg/blob/HEAD/packages/edit-site/src/components/site-hub/index.js#L23) and [document-actions](https://github.com/WordPress/gutenberg/blob/HEAD/packages/edit-post/src/components/header/document-actions/index.js#L14).
  3428. *
  3429. * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
  3430. *
  3431. * @type {Object}
  3432. *
  3433. * @example
  3434. * ```js
  3435. * import { store as commandsStore } from '@wordpress/commands';
  3436. * import { useDispatch } from '@wordpress/data';
  3437. * ...
  3438. * const { open: openCommandCenter } = useDispatch( commandsStore );
  3439. * ```
  3440. */
  3441. const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, {
  3442. reducer: store_reducer,
  3443. actions: actions_namespaceObject,
  3444. selectors: selectors_namespaceObject
  3445. });
  3446. (0,external_wp_data_namespaceObject.register)(store);
  3447. unlock(store).registerPrivateActions(private_actions_namespaceObject);
  3448. ;// CONCATENATED MODULE: ./node_modules/@wordpress/commands/build-module/components/command-menu.js
  3449. /**
  3450. * External dependencies
  3451. */
  3452. /**
  3453. * WordPress dependencies
  3454. */
  3455. /**
  3456. * Internal dependencies
  3457. */
  3458. function CommandMenuLoader({
  3459. name,
  3460. search,
  3461. hook,
  3462. setLoader,
  3463. close
  3464. }) {
  3465. var _hook;
  3466. const {
  3467. isLoading,
  3468. commands = []
  3469. } = (_hook = hook({
  3470. search
  3471. })) !== null && _hook !== void 0 ? _hook : {};
  3472. (0,external_wp_element_namespaceObject.useEffect)(() => {
  3473. setLoader(name, isLoading);
  3474. }, [setLoader, name, isLoading]);
  3475. if (!commands.length) {
  3476. return null;
  3477. }
  3478. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(Le.List, null, commands.map(command => {
  3479. var _command$searchLabel;
  3480. return (0,external_wp_element_namespaceObject.createElement)(Le.Item, {
  3481. key: command.name,
  3482. value: (_command$searchLabel = command.searchLabel) !== null && _command$searchLabel !== void 0 ? _command$searchLabel : command.label,
  3483. onSelect: () => command.callback({
  3484. close
  3485. }),
  3486. id: command.name
  3487. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
  3488. alignment: "left",
  3489. className: classnames_default()('commands-command-menu__item', {
  3490. 'has-icon': command.icon
  3491. })
  3492. }, command.icon && (0,external_wp_element_namespaceObject.createElement)(icon, {
  3493. icon: command.icon
  3494. }), (0,external_wp_element_namespaceObject.createElement)("span", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextHighlight, {
  3495. text: command.label,
  3496. highlight: search
  3497. }))));
  3498. })));
  3499. }
  3500. function CommandMenuLoaderWrapper({
  3501. hook,
  3502. search,
  3503. setLoader,
  3504. close
  3505. }) {
  3506. // The "hook" prop is actually a custom React hook
  3507. // so to avoid breaking the rules of hooks
  3508. // the CommandMenuLoaderWrapper component need to be
  3509. // remounted on each hook prop change
  3510. // We use the key state to make sure we do that properly.
  3511. const currentLoader = (0,external_wp_element_namespaceObject.useRef)(hook);
  3512. const [key, setKey] = (0,external_wp_element_namespaceObject.useState)(0);
  3513. (0,external_wp_element_namespaceObject.useEffect)(() => {
  3514. if (currentLoader.current !== hook) {
  3515. currentLoader.current = hook;
  3516. setKey(prevKey => prevKey + 1);
  3517. }
  3518. }, [hook]);
  3519. return (0,external_wp_element_namespaceObject.createElement)(CommandMenuLoader, {
  3520. key: key,
  3521. hook: currentLoader.current,
  3522. search: search,
  3523. setLoader: setLoader,
  3524. close: close
  3525. });
  3526. }
  3527. function CommandMenuGroup({
  3528. isContextual,
  3529. search,
  3530. setLoader,
  3531. close
  3532. }) {
  3533. const {
  3534. commands,
  3535. loaders
  3536. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  3537. const {
  3538. getCommands,
  3539. getCommandLoaders
  3540. } = select(store);
  3541. return {
  3542. commands: getCommands(isContextual),
  3543. loaders: getCommandLoaders(isContextual)
  3544. };
  3545. }, [isContextual]);
  3546. if (!commands.length && !loaders.length) {
  3547. return null;
  3548. }
  3549. return (0,external_wp_element_namespaceObject.createElement)(Le.Group, null, commands.map(command => {
  3550. var _command$searchLabel2;
  3551. return (0,external_wp_element_namespaceObject.createElement)(Le.Item, {
  3552. key: command.name,
  3553. value: (_command$searchLabel2 = command.searchLabel) !== null && _command$searchLabel2 !== void 0 ? _command$searchLabel2 : command.label,
  3554. onSelect: () => command.callback({
  3555. close
  3556. }),
  3557. id: command.name
  3558. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
  3559. alignment: "left",
  3560. className: classnames_default()('commands-command-menu__item', {
  3561. 'has-icon': command.icon
  3562. })
  3563. }, command.icon && (0,external_wp_element_namespaceObject.createElement)(icon, {
  3564. icon: command.icon
  3565. }), (0,external_wp_element_namespaceObject.createElement)("span", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextHighlight, {
  3566. text: command.label,
  3567. highlight: search
  3568. }))));
  3569. }), loaders.map(loader => (0,external_wp_element_namespaceObject.createElement)(CommandMenuLoaderWrapper, {
  3570. key: loader.name,
  3571. hook: loader.hook,
  3572. search: search,
  3573. setLoader: setLoader,
  3574. close: close
  3575. })));
  3576. }
  3577. function CommandInput({
  3578. isOpen,
  3579. search,
  3580. setSearch
  3581. }) {
  3582. const commandMenuInput = (0,external_wp_element_namespaceObject.useRef)();
  3583. const _value = T(state => state.value);
  3584. const selectedItemId = (0,external_wp_element_namespaceObject.useMemo)(() => {
  3585. const item = document.querySelector(`[cmdk-item=""][data-value="${_value}"]`);
  3586. return item?.getAttribute('id');
  3587. }, [_value]);
  3588. (0,external_wp_element_namespaceObject.useEffect)(() => {
  3589. // Focus the command palette input when mounting the modal.
  3590. if (isOpen) {
  3591. commandMenuInput.current.focus();
  3592. }
  3593. }, [isOpen]);
  3594. return (0,external_wp_element_namespaceObject.createElement)(Le.Input, {
  3595. ref: commandMenuInput,
  3596. value: search,
  3597. onValueChange: setSearch,
  3598. placeholder: (0,external_wp_i18n_namespaceObject.__)('Search for commands'),
  3599. "aria-activedescendant": selectedItemId,
  3600. icon: search
  3601. });
  3602. }
  3603. /**
  3604. * @ignore
  3605. */
  3606. function CommandMenu() {
  3607. const {
  3608. registerShortcut
  3609. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store);
  3610. const [search, setSearch] = (0,external_wp_element_namespaceObject.useState)('');
  3611. const isOpen = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isOpen(), []);
  3612. const {
  3613. open,
  3614. close
  3615. } = (0,external_wp_data_namespaceObject.useDispatch)(store);
  3616. const [loaders, setLoaders] = (0,external_wp_element_namespaceObject.useState)({});
  3617. (0,external_wp_element_namespaceObject.useEffect)(() => {
  3618. registerShortcut({
  3619. name: 'core/commands',
  3620. category: 'global',
  3621. description: (0,external_wp_i18n_namespaceObject.__)('Open the command palette.'),
  3622. keyCombination: {
  3623. modifier: 'primary',
  3624. character: 'k'
  3625. }
  3626. });
  3627. }, [registerShortcut]);
  3628. (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/commands', /** @type {import('react').KeyboardEventHandler} */
  3629. event => {
  3630. // Bails to avoid obscuring the effect of the preceding handler(s).
  3631. if (event.defaultPrevented) return;
  3632. event.preventDefault();
  3633. if (isOpen) {
  3634. close();
  3635. } else {
  3636. open();
  3637. }
  3638. }, {
  3639. bindGlobal: true
  3640. });
  3641. const setLoader = (0,external_wp_element_namespaceObject.useCallback)((name, value) => setLoaders(current => ({
  3642. ...current,
  3643. [name]: value
  3644. })), []);
  3645. const closeAndReset = () => {
  3646. setSearch('');
  3647. close();
  3648. };
  3649. if (!isOpen) {
  3650. return false;
  3651. }
  3652. const onKeyDown = event => {
  3653. if (
  3654. // Ignore keydowns from IMEs
  3655. event.nativeEvent.isComposing ||
  3656. // Workaround for Mac Safari where the final Enter/Backspace of an IME composition
  3657. // is `isComposing=false`, even though it's technically still part of the composition.
  3658. // These can only be detected by keyCode.
  3659. event.keyCode === 229) {
  3660. event.preventDefault();
  3661. }
  3662. };
  3663. const isLoading = Object.values(loaders).some(Boolean);
  3664. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
  3665. className: "commands-command-menu",
  3666. overlayClassName: "commands-command-menu__overlay",
  3667. onRequestClose: closeAndReset,
  3668. __experimentalHideHeader: true
  3669. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  3670. className: "commands-command-menu__container"
  3671. }, (0,external_wp_element_namespaceObject.createElement)(Le, {
  3672. label: (0,external_wp_i18n_namespaceObject.__)('Command palette'),
  3673. onKeyDown: onKeyDown
  3674. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  3675. className: "commands-command-menu__header"
  3676. }, (0,external_wp_element_namespaceObject.createElement)(icon, {
  3677. icon: library_search
  3678. }), (0,external_wp_element_namespaceObject.createElement)(CommandInput, {
  3679. search: search,
  3680. setSearch: setSearch,
  3681. isOpen: isOpen
  3682. })), (0,external_wp_element_namespaceObject.createElement)(Le.List, null, search && !isLoading && (0,external_wp_element_namespaceObject.createElement)(Le.Empty, null, (0,external_wp_i18n_namespaceObject.__)('No results found.')), (0,external_wp_element_namespaceObject.createElement)(CommandMenuGroup, {
  3683. search: search,
  3684. setLoader: setLoader,
  3685. close: closeAndReset,
  3686. isContextual: true
  3687. }), search && (0,external_wp_element_namespaceObject.createElement)(CommandMenuGroup, {
  3688. search: search,
  3689. setLoader: setLoader,
  3690. close: closeAndReset
  3691. })))));
  3692. }
  3693. ;// CONCATENATED MODULE: ./node_modules/@wordpress/commands/build-module/hooks/use-command-context.js
  3694. /**
  3695. * WordPress dependencies
  3696. */
  3697. /**
  3698. * Internal dependencies
  3699. */
  3700. /**
  3701. * Sets the active context of the command palette
  3702. *
  3703. * @param {string} context Context to set.
  3704. */
  3705. function useCommandContext(context) {
  3706. const {
  3707. getContext
  3708. } = (0,external_wp_data_namespaceObject.useSelect)(store);
  3709. const initialContext = (0,external_wp_element_namespaceObject.useRef)(getContext());
  3710. const {
  3711. setContext
  3712. } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
  3713. (0,external_wp_element_namespaceObject.useEffect)(() => {
  3714. setContext(context);
  3715. }, [context, setContext]);
  3716. // This effects ensures that on unmount, we restore the context
  3717. // that was set before the component actually mounts.
  3718. (0,external_wp_element_namespaceObject.useEffect)(() => {
  3719. const initialContextRef = initialContext.current;
  3720. return () => setContext(initialContextRef);
  3721. }, [setContext]);
  3722. }
  3723. ;// CONCATENATED MODULE: ./node_modules/@wordpress/commands/build-module/private-apis.js
  3724. /**
  3725. * Internal dependencies
  3726. */
  3727. /**
  3728. * @private
  3729. */
  3730. const privateApis = {};
  3731. lock(privateApis, {
  3732. useCommandContext: useCommandContext
  3733. });
  3734. ;// CONCATENATED MODULE: ./node_modules/@wordpress/commands/build-module/hooks/use-command.js
  3735. /**
  3736. * WordPress dependencies
  3737. */
  3738. /**
  3739. * Internal dependencies
  3740. */
  3741. /**
  3742. * Attach a command to the command palette. Used for static commands.
  3743. *
  3744. * @param {import('../store/actions').WPCommandConfig} command command config.
  3745. *
  3746. * @example
  3747. * ```js
  3748. * import { useCommand } from '@wordpress/commands';
  3749. * import { plus } from '@wordpress/icons';
  3750. *
  3751. * useCommand( {
  3752. * name: 'myplugin/my-command-name',
  3753. * label: __( 'Add new post' ),
  3754. * icon: plus,
  3755. * callback: ({ close }) => {
  3756. * document.location.href = 'post-new.php';
  3757. * close();
  3758. * },
  3759. * } );
  3760. * ```
  3761. */
  3762. function useCommand(command) {
  3763. const {
  3764. registerCommand,
  3765. unregisterCommand
  3766. } = (0,external_wp_data_namespaceObject.useDispatch)(store);
  3767. const currentCallback = (0,external_wp_element_namespaceObject.useRef)(command.callback);
  3768. (0,external_wp_element_namespaceObject.useEffect)(() => {
  3769. currentCallback.current = command.callback;
  3770. }, [command.callback]);
  3771. (0,external_wp_element_namespaceObject.useEffect)(() => {
  3772. registerCommand({
  3773. name: command.name,
  3774. context: command.context,
  3775. label: command.label,
  3776. searchLabel: command.searchLabel,
  3777. icon: command.icon,
  3778. callback: (...args) => currentCallback.current(...args)
  3779. });
  3780. return () => {
  3781. unregisterCommand(command.name);
  3782. };
  3783. }, [command.name, command.label, command.searchLabel, command.icon, command.context, registerCommand, unregisterCommand]);
  3784. }
  3785. ;// CONCATENATED MODULE: ./node_modules/@wordpress/commands/build-module/hooks/use-command-loader.js
  3786. /**
  3787. * WordPress dependencies
  3788. */
  3789. /**
  3790. * Internal dependencies
  3791. */
  3792. /**
  3793. * Attach a command loader to the command palette. Used for dynamic commands.
  3794. *
  3795. * @param {import('../store/actions').WPCommandLoaderConfig} loader command loader config.
  3796. *
  3797. * @example
  3798. * ```js
  3799. * import { useCommandLoader } from '@wordpress/commands';
  3800. * import { post, page, layout, symbolFilled } from '@wordpress/icons';
  3801. *
  3802. * const icons = {
  3803. * post,
  3804. * page,
  3805. * wp_template: layout,
  3806. * wp_template_part: symbolFilled,
  3807. * };
  3808. *
  3809. * function usePageSearchCommandLoader( { search } ) {
  3810. * // Retrieve the pages for the "search" term.
  3811. * const { records, isLoading } = useSelect( ( select ) => {
  3812. * const { getEntityRecords } = select( coreStore );
  3813. * const query = {
  3814. * search: !! search ? search : undefined,
  3815. * per_page: 10,
  3816. * orderby: search ? 'relevance' : 'date',
  3817. * };
  3818. * return {
  3819. * records: getEntityRecords( 'postType', 'page', query ),
  3820. * isLoading: ! select( coreStore ).hasFinishedResolution(
  3821. * 'getEntityRecords',
  3822. * 'postType', 'page', query ]
  3823. * ),
  3824. * };
  3825. * }, [ search ] );
  3826. *
  3827. * // Create the commands.
  3828. * const commands = useMemo( () => {
  3829. * return ( records ?? [] ).slice( 0, 10 ).map( ( record ) => {
  3830. * return {
  3831. * name: record.title?.rendered + ' ' + record.id,
  3832. * label: record.title?.rendered
  3833. * ? record.title?.rendered
  3834. * : __( '(no title)' ),
  3835. * icon: icons[ postType ],
  3836. * callback: ( { close } ) => {
  3837. * const args = {
  3838. * postType,
  3839. * postId: record.id,
  3840. * ...extraArgs,
  3841. * };
  3842. * document.location = addQueryArgs( 'site-editor.php', args );
  3843. * close();
  3844. * },
  3845. * };
  3846. * } );
  3847. * }, [ records, history ] );
  3848. *
  3849. * return {
  3850. * commands,
  3851. * isLoading,
  3852. * };
  3853. * }
  3854. *
  3855. * useCommandLoader( {
  3856. * name: 'myplugin/page-search',
  3857. * hook: usePageSearchCommandLoader,
  3858. * } );
  3859. * ```
  3860. */
  3861. function useCommandLoader(loader) {
  3862. const {
  3863. registerCommandLoader,
  3864. unregisterCommandLoader
  3865. } = (0,external_wp_data_namespaceObject.useDispatch)(store);
  3866. (0,external_wp_element_namespaceObject.useEffect)(() => {
  3867. registerCommandLoader({
  3868. name: loader.name,
  3869. hook: loader.hook,
  3870. context: loader.context
  3871. });
  3872. return () => {
  3873. unregisterCommandLoader(loader.name);
  3874. };
  3875. }, [loader.name, loader.hook, loader.context, registerCommandLoader, unregisterCommandLoader]);
  3876. }
  3877. ;// CONCATENATED MODULE: ./node_modules/@wordpress/commands/build-module/index.js
  3878. }();
  3879. (window.wp = window.wp || {}).commands = __webpack_exports__;
  3880. /******/ })()
  3881. ;