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