vendor: 1,243,335 bytes, lines 1-28317
1var __create = Object.create; 2var __defProp = Object.defineProperty; 3var __getOwnPropDesc = Object.getOwnPropertyDescriptor; 4var __getOwnPropNames = Object.getOwnPropertyNames; 5var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty; 6var __require = /* @__PURE__ */ ((x2) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(x2, { 7 get: (a2, b2) => (typeof require < "u" ? require : a2)[b2] 8}) : x2)(function(x2) { 9 if (typeof require < "u") return require.apply(this, arguments); 10 throw Error('Dynamic require of "' + x2 + '" is not supported'); 11}); 12var __esm = (fn, res, err) => function() { 13 if (err) throw err[0]; 14 try { 15 return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res; 16 } catch (e2) { 17 throw err = [e2], e2; 18 } 19}; 20var __commonJS = (cb, mod) => function() { 21 try { 22 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; 23 } catch (e2) { 24 throw mod = 0, e2; 25 } 26}; 27var __export = (target, all) => { 28 for (var name in all) 29 __defProp(target, name, { get: all[name], enumerable: !0 }); 30}, __copyProps = (to, from, except, desc) => { 31 if (from && typeof from == "object" || typeof from == "function") 32 for (let key of __getOwnPropNames(from)) 33 !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); 34 return to; 35}; 36var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( 37 // If the importer is in node compatibility mode or this is not an ESM 38 // file that has been converted to a CommonJS file using a Babel- 39 // compatible transform (i.e. "__esModule" has not been set), then set 40 // "default" to the CommonJS "module.exports" for node compatibility. 41 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target, 42 mod 43)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod); 44 45// global-externals:react 46var react_exports = {}; 47__export(react_exports, { 48 Children: () => Children, 49 Component: () => Component, 50 Fragment: () => Fragment, 51 Profiler: () => Profiler, 52 PureComponent: () => PureComponent, 53 StrictMode: () => StrictMode, 54 Suspense: () => Suspense, 55 __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: () => __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, 56 act: () => act, 57 cloneElement: () => cloneElement, 58 createContext: () => createContext, 59 createElement: () => createElement, 60 createFactory: () => createFactory, 61 createRef: () => createRef, 62 default: () => react_default, 63 forwardRef: () => forwardRef, 64 isValidElement: () => isValidElement, 65 lazy: () => lazy, 66 memo: () => memo, 67 startTransition: () => startTransition, 68 unstable_act: () => unstable_act, 69 useCallback: () => useCallback, 70 useContext: () => useContext, 71 useDebugValue: () => useDebugValue, 72 useDeferredValue: () => useDeferredValue, 73 useEffect: () => useEffect, 74 useId: () => useId, 75 useImperativeHandle: () => useImperativeHandle, 76 useInsertionEffect: () => useInsertionEffect, 77 useLayoutEffect: () => useLayoutEffect, 78 useMemo: () => useMemo, 79 useReducer: () => useReducer, 80 useRef: () => useRef, 81 useState: () => useState, 82 useSyncExternalStore: () => useSyncExternalStore, 83 useTransition: () => useTransition, 84 version: () => version 85}); 86var react_default, Children, Component, Fragment, Profiler, PureComponent, StrictMode, Suspense, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, act, cloneElement, createContext, createElement, createFactory, createRef, forwardRef, isValidElement, lazy, memo, startTransition, unstable_act, useCallback, useContext, useDebugValue, useDeferredValue, useEffect, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useReducer, useRef, useState, useSyncExternalStore, useTransition, version, init_react = __esm({ 87 "global-externals:react"() { 88 react_default = __REACT__, { Children, Component, Fragment, Profiler, PureComponent, StrictMode, Suspense, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, act, cloneElement, createContext, createElement, createFactory, createRef, forwardRef, isValidElement, lazy, memo, startTransition, unstable_act, useCallback, useContext, useDebugValue, useDeferredValue, useEffect, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useReducer, useRef, useState, useSyncExternalStore, useTransition, version } = __REACT__; 89 } 90}); 91 92// ../../node_modules/prop-types/lib/ReactPropTypesSecret.js 93var require_ReactPropTypesSecret = __commonJS({ 94 "../../node_modules/prop-types/lib/ReactPropTypesSecret.js"(exports, module) { 95 "use strict"; 96 var ReactPropTypesSecret = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"; 97 module.exports = ReactPropTypesSecret; 98 } 99}); 100 101// ../../node_modules/prop-types/factoryWithThrowingShims.js 102var require_factoryWithThrowingShims = __commonJS({ 103 "../../node_modules/prop-types/factoryWithThrowingShims.js"(exports, module) { 104 "use strict"; 105 var ReactPropTypesSecret = require_ReactPropTypesSecret(); 106 function emptyFunction() { 107 } 108 function emptyFunctionWithReset() { 109 } 110 emptyFunctionWithReset.resetWarningCache = emptyFunction; 111 module.exports = function() { 112 function shim(props, propName, componentName2, location2, propFullName, secret) { 113 if (secret !== ReactPropTypesSecret) { 114 var err = new Error( 115 "Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types" 116 ); 117 throw err.name = "Invariant Violation", err; 118 } 119 } 120 shim.isRequired = shim; 121 function getShim() { 122 return shim; 123 } 124 var ReactPropTypes = { 125 array: shim, 126 bigint: shim, 127 bool: shim, 128 func: shim, 129 number: shim, 130 object: shim, 131 string: shim, 132 symbol: shim, 133 any: shim, 134 arrayOf: getShim, 135 element: shim, 136 elementType: shim, 137 instanceOf: getShim, 138 node: shim, 139 objectOf: getShim, 140 oneOf: getShim, 141 oneOfType: getShim, 142 shape: getShim, 143 exact: getShim, 144 checkPropTypes: emptyFunctionWithReset, 145 resetWarningCache: emptyFunction 146 }; 147 return ReactPropTypes.PropTypes = ReactPropTypes, ReactPropTypes; 148 }; 149 } 150}); 151 152// ../../node_modules/prop-types/index.js 153var require_prop_types = __commonJS({ 154 "../../node_modules/prop-types/index.js"(exports, module) { 155 module.exports = require_factoryWithThrowingShims()(); 156 var ReactIs, throwOnDirectAccess; 157 } 158}); 159 160// ../../node_modules/react-fast-compare/index.js 161var require_react_fast_compare = __commonJS({ 162 "../../node_modules/react-fast-compare/index.js"(exports, module) { 163 var hasElementType = typeof Element < "u", hasMap = typeof Map == "function", hasSet = typeof Set == "function", hasArrayBuffer = typeof ArrayBuffer == "function" && !!ArrayBuffer.isView; 164 function equal3(a2, b2) { 165 if (a2 === b2) return !0; 166 if (a2 && b2 && typeof a2 == "object" && typeof b2 == "object") { 167 if (a2.constructor !== b2.constructor) return !1; 168 var length, i2, keys; 169 if (Array.isArray(a2)) { 170 if (length = a2.length, length != b2.length) return !1; 171 for (i2 = length; i2-- !== 0; ) 172 if (!equal3(a2[i2], b2[i2])) return !1; 173 return !0; 174 } 175 var it; 176 if (hasMap && a2 instanceof Map && b2 instanceof Map) { 177 if (a2.size !== b2.size) return !1; 178 for (it = a2.entries(); !(i2 = it.next()).done; ) 179 if (!b2.has(i2.value[0])) return !1; 180 for (it = a2.entries(); !(i2 = it.next()).done; ) 181 if (!equal3(i2.value[1], b2.get(i2.value[0]))) return !1; 182 return !0; 183 } 184 if (hasSet && a2 instanceof Set && b2 instanceof Set) { 185 if (a2.size !== b2.size) return !1; 186 for (it = a2.entries(); !(i2 = it.next()).done; ) 187 if (!b2.has(i2.value[0])) return !1; 188 return !0; 189 } 190 if (hasArrayBuffer && ArrayBuffer.isView(a2) && ArrayBuffer.isView(b2)) { 191 if (length = a2.length, length != b2.length) return !1; 192 for (i2 = length; i2-- !== 0; ) 193 if (a2[i2] !== b2[i2]) return !1; 194 return !0; 195 } 196 if (a2.constructor === RegExp) return a2.source === b2.source && a2.flags === b2.flags; 197 if (a2.valueOf !== Object.prototype.valueOf && typeof a2.valueOf == "function" && typeof b2.valueOf == "function") return a2.valueOf() === b2.valueOf(); 198 if (a2.toString !== Object.prototype.toString && typeof a2.toString == "function" && typeof b2.toString == "function") return a2.toString() === b2.toString(); 199 if (keys = Object.keys(a2), length = keys.length, length !== Object.keys(b2).length) return !1; 200 for (i2 = length; i2-- !== 0; ) 201 if (!Object.prototype.hasOwnProperty.call(b2, keys[i2])) return !1; 202 if (hasElementType && a2 instanceof Element) return !1; 203 for (i2 = length; i2-- !== 0; ) 204 if (!((keys[i2] === "_owner" || keys[i2] === "__v" || keys[i2] === "__o") && a2.$$typeof) && !equal3(a2[keys[i2]], b2[keys[i2]])) 205 return !1; 206 return !0; 207 } 208 return a2 !== a2 && b2 !== b2; 209 } 210 module.exports = function(a2, b2) { 211 try { 212 return equal3(a2, b2); 213 } catch (error) { 214 if ((error.message || "").match(/stack|recursion/i)) 215 return console.warn("react-fast-compare cannot handle circular refs"), !1; 216 throw error; 217 } 218 }; 219 } 220}); 221 222// ../../node_modules/invariant/browser.js 223var require_browser = __commonJS({ 224 "../../node_modules/invariant/browser.js"(exports, module) { 225 "use strict"; 226 var invariant = function(condition, format, a2, b2, c2, d2, e2, f2) { 227 if (!condition) { 228 var error; 229 if (format === void 0) 230 error = new Error( 231 "Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings." 232 ); 233 else { 234 var args = [a2, b2, c2, d2, e2, f2], argIndex = 0; 235 error = new Error( 236 format.replace(/%s/g, function() { 237 return args[argIndex++]; 238 }) 239 ), error.name = "Invariant Violation"; 240 } 241 throw error.framesToPop = 1, error; 242 } 243 }; 244 module.exports = invariant; 245 } 246}); 247 248// ../../node_modules/shallowequal/index.js 249var require_shallowequal = __commonJS({ 250 "../../node_modules/shallowequal/index.js"(exports, module) { 251 module.exports = function(objA, objB, compare, compareContext) { 252 var ret = compare ? compare.call(compareContext, objA, objB) : void 0; 253 if (ret !== void 0) 254 return !!ret; 255 if (objA === objB) 256 return !0; 257 if (typeof objA != "object" || !objA || typeof objB != "object" || !objB) 258 return !1; 259 var keysA = Object.keys(objA), keysB = Object.keys(objB); 260 if (keysA.length !== keysB.length) 261 return !1; 262 for (var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB), idx = 0; idx < keysA.length; idx++) { 263 var key = keysA[idx]; 264 if (!bHasOwnProperty(key)) 265 return !1; 266 var valueA = objA[key], valueB = objB[key]; 267 if (ret = compare ? compare.call(compareContext, valueA, valueB, key) : void 0, ret === !1 || ret === void 0 && valueA !== valueB) 268 return !1; 269 } 270 return !0; 271 }; 272 } 273}); 274 275// ../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js 276var require_use_sync_external_store_shim_production = __commonJS({ 277 "../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js"(exports) { 278 "use strict"; 279 var React = (init_react(), __toCommonJS(react_exports)); 280 function is4(x2, y2) { 281 return x2 === y2 && (x2 !== 0 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2; 282 } 283 var objectIs = typeof Object.is == "function" ? Object.is : is4, useState2 = React.useState, useEffect2 = React.useEffect, useLayoutEffect2 = React.useLayoutEffect, useDebugValue2 = React.useDebugValue; 284 function useSyncExternalStore$2(subscribe, getSnapshot) { 285 var value = getSnapshot(), _useState = useState2({ inst: { value, getSnapshot } }), inst = _useState[0].inst, forceUpdate = _useState[1]; 286 return useLayoutEffect2( 287 function() { 288 inst.value = value, inst.getSnapshot = getSnapshot, checkIfSnapshotChanged(inst) && forceUpdate({ inst }); 289 }, 290 [subscribe, value, getSnapshot] 291 ), useEffect2( 292 function() { 293 return checkIfSnapshotChanged(inst) && forceUpdate({ inst }), subscribe(function() { 294 checkIfSnapshotChanged(inst) && forceUpdate({ inst }); 295 }); 296 }, 297 [subscribe] 298 ), useDebugValue2(value), value; 299 } 300 function checkIfSnapshotChanged(inst) { 301 var latestGetSnapshot = inst.getSnapshot; 302 inst = inst.value; 303 try { 304 var nextValue = latestGetSnapshot(); 305 return !objectIs(inst, nextValue); 306 } catch { 307 return !0; 308 } 309 } 310 function useSyncExternalStore$1(subscribe, getSnapshot) { 311 return getSnapshot(); 312 } 313 var shim = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? useSyncExternalStore$1 : useSyncExternalStore$2; 314 exports.useSyncExternalStore = React.useSyncExternalStore !== void 0 ? React.useSyncExternalStore : shim; 315 } 316}); 317 318// ../../node_modules/use-sync-external-store/shim/index.js 319var require_shim = __commonJS({ 320 "../../node_modules/use-sync-external-store/shim/index.js"(exports, module) { 321 "use strict"; 322 module.exports = require_use_sync_external_store_shim_production(); 323 } 324}); 325 326// ../../node_modules/memoizerific/memoizerific.js 327var require_memoizerific = __commonJS({ 328 "../../node_modules/memoizerific/memoizerific.js"(exports, module) { 329 (function(f2) { 330 if (typeof exports == "object" && typeof module < "u") 331 module.exports = f2(); 332 else if (typeof define == "function" && define.amd) 333 define([], f2); 334 else { 335 var g2; 336 typeof window < "u" ? g2 = window : typeof global < "u" ? g2 = global : typeof self < "u" ? g2 = self : g2 = this, g2.memoizerific = f2(); 337 } 338 })(function() { 339 var define2, module2, exports2; 340 return (function e2(t2, n3, r4) { 341 function s2(o4, u2) { 342 if (!n3[o4]) { 343 if (!t2[o4]) { 344 var a2 = typeof __require == "function" && __require; 345 if (!u2 && a2) return a2(o4, !0); 346 if (i2) return i2(o4, !0); 347 var f2 = new Error("Cannot find module '" + o4 + "'"); 348 throw f2.code = "MODULE_NOT_FOUND", f2; 349 } 350 var l3 = n3[o4] = { exports: {} }; 351 t2[o4][0].call(l3.exports, function(e3) { 352 var n4 = t2[o4][1][e3]; 353 return s2(n4 || e3); 354 }, l3, l3.exports, e2, t2, n3, r4); 355 } 356 return n3[o4].exports; 357 } 358 for (var i2 = typeof __require == "function" && __require, o3 = 0; o3 < r4.length; o3++) s2(r4[o3]); 359 return s2; 360 })({ 1: [function(_dereq_, module3, exports3) { 361 module3.exports = function(forceSimilar) { 362 if (typeof Map != "function" || forceSimilar) { 363 var Similar = _dereq_("./similar"); 364 return new Similar(); 365 } else 366 return /* @__PURE__ */ new Map(); 367 }; 368 }, { "./similar": 2 }], 2: [function(_dereq_, module3, exports3) { 369 function Similar() { 370 return this.list = [], this.lastItem = void 0, this.size = 0, this; 371 } 372 Similar.prototype.get = function(key) { 373 var index; 374 if (this.lastItem && this.isEqual(this.lastItem.key, key)) 375 return this.lastItem.val; 376 if (index = this.indexOf(key), index >= 0) 377 return this.lastItem = this.list[index], this.list[index].val; 378 }, Similar.prototype.set = function(key, val) { 379 var index; 380 return this.lastItem && this.isEqual(this.lastItem.key, key) ? (this.lastItem.val = val, this) : (index = this.indexOf(key), index >= 0 ? (this.lastItem = this.list[index], this.list[index].val = val, this) : (this.lastItem = { key, val }, this.list.push(this.lastItem), this.size++, this)); 381 }, Similar.prototype.delete = function(key) { 382 var index; 383 if (this.lastItem && this.isEqual(this.lastItem.key, key) && (this.lastItem = void 0), index = this.indexOf(key), index >= 0) 384 return this.size--, this.list.splice(index, 1)[0]; 385 }, Similar.prototype.has = function(key) { 386 var index; 387 return this.lastItem && this.isEqual(this.lastItem.key, key) ? !0 : (index = this.indexOf(key), index >= 0 ? (this.lastItem = this.list[index], !0) : !1); 388 }, Similar.prototype.forEach = function(callback, thisArg) { 389 var i2; 390 for (i2 = 0; i2 < this.size; i2++) 391 callback.call(thisArg || this, this.list[i2].val, this.list[i2].key, this); 392 }, Similar.prototype.indexOf = function(key) { 393 var i2; 394 for (i2 = 0; i2 < this.size; i2++) 395 if (this.isEqual(this.list[i2].key, key)) 396 return i2; 397 return -1; 398 }, Similar.prototype.isEqual = function(val1, val2) { 399 return val1 === val2 || val1 !== val1 && val2 !== val2; 400 }, module3.exports = Similar; 401 }, {}], 3: [function(_dereq_, module3, exports3) { 402 var MapOrSimilar = _dereq_("map-or-similar"); 403 module3.exports = function(limit) { 404 var cache = new MapOrSimilar(!1), lru = []; 405 return function(fn) { 406 var memoizerific3 = function() { 407 var currentCache = cache, newMap, fnResult, argsLengthMinusOne = arguments.length - 1, lruPath = Array(argsLengthMinusOne + 1), isMemoized = !0, i2; 408 if ((memoizerific3.numArgs || memoizerific3.numArgs === 0) && memoizerific3.numArgs !== argsLengthMinusOne + 1) 409 throw new Error("Memoizerific functions should always be called with the same number of arguments"); 410 for (i2 = 0; i2 < argsLengthMinusOne; i2++) { 411 if (lruPath[i2] = { 412 cacheItem: currentCache, 413 arg: arguments[i2] 414 }, currentCache.has(arguments[i2])) { 415 currentCache = currentCache.get(arguments[i2]); 416 continue; 417 } 418 isMemoized = !1, newMap = new MapOrSimilar(!1), currentCache.set(arguments[i2], newMap), currentCache = newMap; 419 } 420 return isMemoized && (currentCache.has(arguments[argsLengthMinusOne]) ? fnResult = currentCache.get(arguments[argsLengthMinusOne]) : isMemoized = !1), isMemoized || (fnResult = fn.apply(null, arguments), currentCache.set(arguments[argsLengthMinusOne], fnResult)), limit > 0 && (lruPath[argsLengthMinusOne] = { 421 cacheItem: currentCache, 422 arg: arguments[argsLengthMinusOne] 423 }, isMemoized ? moveToMostRecentLru(lru, lruPath) : lru.push(lruPath), lru.length > limit && removeCachedResult(lru.shift())), memoizerific3.wasMemoized = isMemoized, memoizerific3.numArgs = argsLengthMinusOne + 1, fnResult; 424 }; 425 return memoizerific3.limit = limit, memoizerific3.wasMemoized = !1, memoizerific3.cache = cache, memoizerific3.lru = lru, memoizerific3; 426 }; 427 }; 428 function moveToMostRecentLru(lru, lruPath) { 429 var lruLen = lru.length, lruPathLen = lruPath.length, isMatch, i2, ii; 430 for (i2 = 0; i2 < lruLen; i2++) { 431 for (isMatch = !0, ii = 0; ii < lruPathLen; ii++) 432 if (!isEqual2(lru[i2][ii].arg, lruPath[ii].arg)) { 433 isMatch = !1; 434 break; 435 } 436 if (isMatch) 437 break; 438 } 439 lru.push(lru.splice(i2, 1)[0]); 440 } 441 function removeCachedResult(removedLru) { 442 var removedLruLen = removedLru.length, currentLru = removedLru[removedLruLen - 1], tmp, i2; 443 for (currentLru.cacheItem.delete(currentLru.arg), i2 = removedLruLen - 2; i2 >= 0 && (currentLru = removedLru[i2], tmp = currentLru.cacheItem.get(currentLru.arg), !tmp || !tmp.size); i2--) 444 currentLru.cacheItem.delete(currentLru.arg); 445 } 446 function isEqual2(val1, val2) { 447 return val1 === val2 || val1 !== val1 && val2 !== val2; 448 } 449 }, { "map-or-similar": 1 }] }, {}, [3])(3); 450 }); 451 } 452}); 453 454// ../../node_modules/picocolors/picocolors.browser.js 455var require_picocolors_browser = __commonJS({ 456 "../../node_modules/picocolors/picocolors.browser.js"(exports, module) { 457 var x2 = String, create4 = function() { 458 return { isColorSupported: !1, reset: x2, bold: x2, dim: x2, italic: x2, underline: x2, inverse: x2, hidden: x2, strikethrough: x2, black: x2, red: x2, green: x2, yellow: x2, blue: x2, magenta: x2, cyan: x2, white: x2, gray: x2, bgBlack: x2, bgRed: x2, bgGreen: x2, bgYellow: x2, bgBlue: x2, bgMagenta: x2, bgCyan: x2, bgWhite: x2, blackBright: x2, redBright: x2, greenBright: x2, yellowBright: x2, blueBright: x2, magentaBright: x2, cyanBright: x2, whiteBright: x2, bgBlackBright: x2, bgRedBright: x2, bgGreenBright: x2, bgYellowBright: x2, bgBlueBright: x2, bgMagentaBright: x2, bgCyanBright: x2, bgWhiteBright: x2 }; 459 }; 460 module.exports = create4(); 461 module.exports.createColors = create4; 462 } 463}); 464 465// ../../node_modules/scroll/index.js 466var require_scroll = __commonJS({ 467 "../../node_modules/scroll/index.js"(exports, module) { 468 var E_NOSCROLL = new Error("Element already at target scroll position"), E_CANCELLED = new Error("Scroll cancelled"), min = Math.min, ms = Date.now; 469 module.exports = { 470 left: make("scrollLeft"), 471 top: make("scrollTop") 472 }; 473 function make(prop) { 474 return function(el, to, opts, cb) { 475 opts = opts || {}, typeof opts == "function" && (cb = opts, opts = {}), typeof cb != "function" && (cb = noop6); 476 var start = ms(), from = el[prop], ease = opts.ease || inOutSine, duration = isNaN(opts.duration) ? 350 : +opts.duration, cancelled = !1; 477 return from === to ? cb(E_NOSCROLL, el[prop]) : requestAnimationFrame(animate), cancel; 478 function cancel() { 479 cancelled = !0; 480 } 481 function animate(timestamp) { 482 if (cancelled) return cb(E_CANCELLED, el[prop]); 483 var now = ms(), time = min(1, (now - start) / duration), eased = ease(time); 484 el[prop] = eased * (to - from) + from, time < 1 ? requestAnimationFrame(animate) : requestAnimationFrame(function() { 485 cb(null, el[prop]); 486 }); 487 } 488 }; 489 } 490 function inOutSine(n3) { 491 return 0.5 * (1 - Math.cos(Math.PI * n3)); 492 } 493 function noop6() { 494 } 495 } 496}); 497 498// ../../node_modules/scrollparent/scrollparent.js 499var require_scrollparent = __commonJS({ 500 "../../node_modules/scrollparent/scrollparent.js"(exports, module) { 501 (function(root2, factory) { 502 typeof define == "function" && define.amd ? define([], factory) : typeof module == "object" && module.exports ? module.exports = factory() : root2.Scrollparent = factory(); 503 })(exports, function() { 504 function isScrolling(node) { 505 var overflow = getComputedStyle(node, null).getPropertyValue("overflow"); 506 return overflow.indexOf("scroll") > -1 || overflow.indexOf("auto") > -1; 507 } 508 function scrollParent2(node) { 509 if (node instanceof HTMLElement || node instanceof SVGElement) { 510 for (var current = node.parentNode; current.parentNode; ) { 511 if (isScrolling(current)) 512 return current; 513 current = current.parentNode; 514 } 515 return document.scrollingElement || document.documentElement; 516 } 517 } 518 return scrollParent2; 519 }); 520 } 521}); 522 523// ../../node_modules/react-innertext/index.js 524var require_react_innertext = __commonJS({ 525 "../../node_modules/react-innertext/index.js"(exports, module) { 526 "use strict"; 527 var hasProps = function(jsx2) { 528 return Object.prototype.hasOwnProperty.call(jsx2, "props"); 529 }, reduceJsxToString = function(previous, current) { 530 return previous + innerText2(current); 531 }, innerText2 = function(jsx2) { 532 return jsx2 === null || typeof jsx2 == "boolean" || typeof jsx2 > "u" ? "" : typeof jsx2 == "number" ? jsx2.toString() : typeof jsx2 == "string" ? jsx2 : Array.isArray(jsx2) ? jsx2.reduce(reduceJsxToString, "") : hasProps(jsx2) && Object.prototype.hasOwnProperty.call(jsx2.props, "children") ? innerText2(jsx2.props.children) : ""; 533 }; 534 innerText2.default = innerText2; 535 module.exports = innerText2; 536 } 537}); 538 539// ../../node_modules/deepmerge/dist/cjs.js 540var require_cjs = __commonJS({ 541 "../../node_modules/deepmerge/dist/cjs.js"(exports, module) { 542 "use strict"; 543 var isMergeableObject = function(value) { 544 return isNonNullObject(value) && !isSpecial(value); 545 }; 546 function isNonNullObject(value) { 547 return !!value && typeof value == "object"; 548 } 549 function isSpecial(value) { 550 var stringValue = Object.prototype.toString.call(value); 551 return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value); 552 } 553 var canUseSymbol = typeof Symbol == "function" && Symbol.for, REACT_ELEMENT_TYPE = canUseSymbol ? /* @__PURE__ */ Symbol.for("react.element") : 60103; 554 function isReactElement(value) { 555 return value.$$typeof === REACT_ELEMENT_TYPE; 556 } 557 function emptyTarget(val) { 558 return Array.isArray(val) ? [] : {}; 559 } 560 function cloneUnlessOtherwiseSpecified(value, options2) { 561 return options2.clone !== !1 && options2.isMergeableObject(value) ? deepmerge4(emptyTarget(value), value, options2) : value; 562 } 563 function defaultArrayMerge(target, source, options2) { 564 return target.concat(source).map(function(element) { 565 return cloneUnlessOtherwiseSpecified(element, options2); 566 }); 567 } 568 function getMergeFunction(key, options2) { 569 if (!options2.customMerge) 570 return deepmerge4; 571 var customMerge = options2.customMerge(key); 572 return typeof customMerge == "function" ? customMerge : deepmerge4; 573 } 574 function getEnumerableOwnPropertySymbols(target) { 575 return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) { 576 return Object.propertyIsEnumerable.call(target, symbol); 577 }) : []; 578 } 579 function getKeys(target) { 580 return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target)); 581 } 582 function propertyIsOnObject(object, property) { 583 try { 584 return property in object; 585 } catch { 586 return !1; 587 } 588 } 589 function propertyIsUnsafe(target, key) { 590 return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key)); 591 } 592 function mergeObject(target, source, options2) { 593 var destination = {}; 594 return options2.isMergeableObject(target) && getKeys(target).forEach(function(key) { 595 destination[key] = cloneUnlessOtherwiseSpecified(target[key], options2); 596 }), getKeys(source).forEach(function(key) { 597 propertyIsUnsafe(target, key) || (propertyIsOnObject(target, key) && options2.isMergeableObject(source[key]) ? destination[key] = getMergeFunction(key, options2)(target[key], source[key], options2) : destination[key] = cloneUnlessOtherwiseSpecified(source[key], options2)); 598 }), destination; 599 } 600 function deepmerge4(target, source, options2) { 601 options2 = options2 || {}, options2.arrayMerge = options2.arrayMerge || defaultArrayMerge, options2.isMergeableObject = options2.isMergeableObject || isMergeableObject, options2.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified; 602 var sourceIsArray = Array.isArray(source), targetIsArray = Array.isArray(target), sourceAndTargetTypesMatch = sourceIsArray === targetIsArray; 603 return sourceAndTargetTypesMatch ? sourceIsArray ? options2.arrayMerge(target, source, options2) : mergeObject(target, source, options2) : cloneUnlessOtherwiseSpecified(source, options2); 604 } 605 deepmerge4.all = function(array, options2) { 606 if (!Array.isArray(array)) 607 throw new Error("first argument should be an array"); 608 return array.reduce(function(prev, next) { 609 return deepmerge4(prev, next, options2); 610 }, {}); 611 }; 612 var deepmerge_1 = deepmerge4; 613 module.exports = deepmerge_1; 614 } 615}); 616 617// ../../node_modules/downshift/node_modules/react-is/cjs/react-is.production.min.js 618var require_react_is_production_min = __commonJS({ 619 "../../node_modules/downshift/node_modules/react-is/cjs/react-is.production.min.js"(exports) { 620 "use strict"; 621 var b2 = /* @__PURE__ */ Symbol.for("react.element"), c2 = /* @__PURE__ */ Symbol.for("react.portal"), d2 = /* @__PURE__ */ Symbol.for("react.fragment"), e2 = /* @__PURE__ */ Symbol.for("react.strict_mode"), f2 = /* @__PURE__ */ Symbol.for("react.profiler"), g2 = /* @__PURE__ */ Symbol.for("react.provider"), h2 = /* @__PURE__ */ Symbol.for("react.context"), k2 = /* @__PURE__ */ Symbol.for("react.server_context"), l3 = /* @__PURE__ */ Symbol.for("react.forward_ref"), m2 = /* @__PURE__ */ Symbol.for("react.suspense"), n3 = /* @__PURE__ */ Symbol.for("react.suspense_list"), p2 = /* @__PURE__ */ Symbol.for("react.memo"), q2 = /* @__PURE__ */ Symbol.for("react.lazy"), t2 = /* @__PURE__ */ Symbol.for("react.offscreen"), u2; 622 u2 = /* @__PURE__ */ Symbol.for("react.module.reference"); 623 function v2(a2) { 624 if (typeof a2 == "object" && a2 !== null) { 625 var r4 = a2.$$typeof; 626 switch (r4) { 627 case b2: 628 switch (a2 = a2.type, a2) { 629 case d2: 630 case f2: 631 case e2: 632 case m2: 633 case n3: 634 return a2; 635 default: 636 switch (a2 = a2 && a2.$$typeof, a2) { 637 case k2: 638 case h2: 639 case l3: 640 case q2: 641 case p2: 642 case g2: 643 return a2; 644 default: 645 return r4; 646 } 647 } 648 case c2: 649 return r4; 650 } 651 } 652 } 653 exports.ContextConsumer = h2; 654 exports.ContextProvider = g2; 655 exports.Element = b2; 656 exports.ForwardRef = l3; 657 exports.Fragment = d2; 658 exports.Lazy = q2; 659 exports.Memo = p2; 660 exports.Portal = c2; 661 exports.Profiler = f2; 662 exports.StrictMode = e2; 663 exports.Suspense = m2; 664 exports.SuspenseList = n3; 665 exports.isAsyncMode = function() { 666 return !1; 667 }; 668 exports.isConcurrentMode = function() { 669 return !1; 670 }; 671 exports.isContextConsumer = function(a2) { 672 return v2(a2) === h2; 673 }; 674 exports.isContextProvider = function(a2) { 675 return v2(a2) === g2; 676 }; 677 exports.isElement = function(a2) { 678 return typeof a2 == "object" && a2 !== null && a2.$$typeof === b2; 679 }; 680 exports.isForwardRef = function(a2) { 681 return v2(a2) === l3; 682 }; 683 exports.isFragment = function(a2) { 684 return v2(a2) === d2; 685 }; 686 exports.isLazy = function(a2) { 687 return v2(a2) === q2; 688 }; 689 exports.isMemo = function(a2) { 690 return v2(a2) === p2; 691 }; 692 exports.isPortal = function(a2) { 693 return v2(a2) === c2; 694 }; 695 exports.isProfiler = function(a2) { 696 return v2(a2) === f2; 697 }; 698 exports.isStrictMode = function(a2) { 699 return v2(a2) === e2; 700 }; 701 exports.isSuspense = function(a2) { 702 return v2(a2) === m2; 703 }; 704 exports.isSuspenseList = function(a2) { 705 return v2(a2) === n3; 706 }; 707 exports.isValidElementType = function(a2) { 708 return typeof a2 == "string" || typeof a2 == "function" || a2 === d2 || a2 === f2 || a2 === e2 || a2 === m2 || a2 === n3 || a2 === t2 || typeof a2 == "object" && a2 !== null && (a2.$$typeof === q2 || a2.$$typeof === p2 || a2.$$typeof === g2 || a2.$$typeof === h2 || a2.$$typeof === l3 || a2.$$typeof === u2 || a2.getModuleId !== void 0); 709 }; 710 exports.typeOf = v2; 711 } 712}); 713 714// ../../node_modules/downshift/node_modules/react-is/index.js 715var require_react_is = __commonJS({ 716 "../../node_modules/downshift/node_modules/react-is/index.js"(exports, module) { 717 "use strict"; 718 module.exports = require_react_is_production_min(); 719 } 720}); 721 722// ../../node_modules/fuse.js/dist/fuse.js 723var require_fuse = __commonJS({ 724 "../../node_modules/fuse.js/dist/fuse.js"(exports, module) { 725 (function(e2, t2) { 726 typeof exports == "object" && typeof module == "object" ? module.exports = t2() : typeof define == "function" && define.amd ? define("Fuse", [], t2) : typeof exports == "object" ? exports.Fuse = t2() : e2.Fuse = t2(); 727 })(exports, function() { 728 return (function(e2) { 729 var t2 = {}; 730 function r4(n3) { 731 if (t2[n3]) return t2[n3].exports; 732 var o3 = t2[n3] = { i: n3, l: !1, exports: {} }; 733 return e2[n3].call(o3.exports, o3, o3.exports, r4), o3.l = !0, o3.exports; 734 } 735 return r4.m = e2, r4.c = t2, r4.d = function(e3, t3, n3) { 736 r4.o(e3, t3) || Object.defineProperty(e3, t3, { enumerable: !0, get: n3 }); 737 }, r4.r = function(e3) { 738 typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(e3, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(e3, "__esModule", { value: !0 }); 739 }, r4.t = function(e3, t3) { 740 if (1 & t3 && (e3 = r4(e3)), 8 & t3 || 4 & t3 && typeof e3 == "object" && e3 && e3.__esModule) return e3; 741 var n3 = /* @__PURE__ */ Object.create(null); 742 if (r4.r(n3), Object.defineProperty(n3, "default", { enumerable: !0, value: e3 }), 2 & t3 && typeof e3 != "string") for (var o3 in e3) r4.d(n3, o3, function(t4) { 743 return e3[t4]; 744 }.bind(null, o3)); 745 return n3; 746 }, r4.n = function(e3) { 747 var t3 = e3 && e3.__esModule ? function() { 748 return e3.default; 749 } : function() { 750 return e3; 751 }; 752 return r4.d(t3, "a", t3), t3; 753 }, r4.o = function(e3, t3) { 754 return Object.prototype.hasOwnProperty.call(e3, t3); 755 }, r4.p = "", r4(r4.s = 0); 756 })([function(e2, t2, r4) { 757 function n3(e3) { 758 return (n3 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e4) { 759 return typeof e4; 760 } : function(e4) { 761 return e4 && typeof Symbol == "function" && e4.constructor === Symbol && e4 !== Symbol.prototype ? "symbol" : typeof e4; 762 })(e3); 763 } 764 function o3(e3, t3) { 765 for (var r5 = 0; r5 < t3.length; r5++) { 766 var n4 = t3[r5]; 767 n4.enumerable = n4.enumerable || !1, n4.configurable = !0, "value" in n4 && (n4.writable = !0), Object.defineProperty(e3, n4.key, n4); 768 } 769 } 770 var i2 = r4(1), a2 = r4(7), s2 = a2.get, c2 = (a2.deepValue, a2.isArray), h2 = (function() { 771 function e3(t4, r6) { 772 var n4 = r6.location, o4 = n4 === void 0 ? 0 : n4, i3 = r6.distance, a4 = i3 === void 0 ? 100 : i3, c3 = r6.threshold, h3 = c3 === void 0 ? 0.6 : c3, l3 = r6.maxPatternLength, u2 = l3 === void 0 ? 32 : l3, f2 = r6.caseSensitive, v2 = f2 !== void 0 && f2, p2 = r6.tokenSeparator, d2 = p2 === void 0 ? / +/g : p2, g2 = r6.findAllMatches, y2 = g2 !== void 0 && g2, m2 = r6.minMatchCharLength, k2 = m2 === void 0 ? 1 : m2, b2 = r6.id, S2 = b2 === void 0 ? null : b2, x2 = r6.keys, M2 = x2 === void 0 ? [] : x2, _2 = r6.shouldSort, w2 = _2 === void 0 || _2, L3 = r6.getFn, A3 = L3 === void 0 ? s2 : L3, O2 = r6.sortFn, C2 = O2 === void 0 ? function(e4, t5) { 773 return e4.score - t5.score; 774 } : O2, j2 = r6.tokenize, P3 = j2 !== void 0 && j2, I2 = r6.matchAllTokens, F2 = I2 !== void 0 && I2, T3 = r6.includeMatches, N2 = T3 !== void 0 && T3, z2 = r6.includeScore, E2 = z2 !== void 0 && z2, W2 = r6.verbose, K2 = W2 !== void 0 && W2; 775 (function(e4, t5) { 776 if (!(e4 instanceof t5)) throw new TypeError("Cannot call a class as a function"); 777 })(this, e3), this.options = { location: o4, distance: a4, threshold: h3, maxPatternLength: u2, isCaseSensitive: v2, tokenSeparator: d2, findAllMatches: y2, minMatchCharLength: k2, id: S2, keys: M2, includeMatches: N2, includeScore: E2, shouldSort: w2, getFn: A3, sortFn: C2, verbose: K2, tokenize: P3, matchAllTokens: F2 }, this.setCollection(t4), this._processKeys(M2); 778 } 779 var t3, r5, a3; 780 return t3 = e3, (r5 = [{ key: "setCollection", value: function(e4) { 781 return this.list = e4, e4; 782 } }, { key: "_processKeys", value: function(e4) { 783 if (this._keyWeights = {}, this._keyNames = [], e4.length && typeof e4[0] == "string") for (var t4 = 0, r6 = e4.length; t4 < r6; t4 += 1) { 784 var n4 = e4[t4]; 785 this._keyWeights[n4] = 1, this._keyNames.push(n4); 786 } 787 else { 788 for (var o4 = null, i3 = null, a4 = 0, s3 = 0, c3 = e4.length; s3 < c3; s3 += 1) { 789 var h3 = e4[s3]; 790 if (!h3.hasOwnProperty("name")) throw new Error('Missing "name" property in key object'); 791 var l3 = h3.name; 792 if (this._keyNames.push(l3), !h3.hasOwnProperty("weight")) throw new Error('Missing "weight" property in key object'); 793 var u2 = h3.weight; 794 if (u2 < 0 || u2 > 1) throw new Error('"weight" property in key must bein the range of [0, 1)'); 795 i3 = i3 == null ? u2 : Math.max(i3, u2), o4 = o4 == null ? u2 : Math.min(o4, u2), this._keyWeights[l3] = u2, a4 += u2; 796 } 797 if (a4 > 1) throw new Error("Total of weights cannot exceed 1"); 798 } 799 } }, { key: "search", value: function(e4) { 800 var t4 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : { limit: !1 }; 801 this._log(`--------- 802Search pattern: "`.concat(e4, '"')); 803 var r6 = this._prepareSearchers(e4), n4 = r6.tokenSearchers, o4 = r6.fullSearcher, i3 = this._search(n4, o4); 804 return this._computeScore(i3), this.options.shouldSort && this._sort(i3), t4.limit && typeof t4.limit == "number" && (i3 = i3.slice(0, t4.limit)), this._format(i3); 805 } }, { key: "_prepareSearchers", value: function() { 806 var e4 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "", t4 = []; 807 if (this.options.tokenize) for (var r6 = e4.split(this.options.tokenSeparator), n4 = 0, o4 = r6.length; n4 < o4; n4 += 1) t4.push(new i2(r6[n4], this.options)); 808 return { tokenSearchers: t4, fullSearcher: new i2(e4, this.options) }; 809 } }, { key: "_search", value: function() { 810 var e4 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], t4 = arguments.length > 1 ? arguments[1] : void 0, r6 = this.list, n4 = {}, o4 = []; 811 if (typeof r6[0] == "string") { 812 for (var i3 = 0, a4 = r6.length; i3 < a4; i3 += 1) this._analyze({ key: "", value: r6[i3], record: i3, index: i3 }, { resultMap: n4, results: o4, tokenSearchers: e4, fullSearcher: t4 }); 813 return o4; 814 } 815 for (var s3 = 0, c3 = r6.length; s3 < c3; s3 += 1) for (var h3 = r6[s3], l3 = 0, u2 = this._keyNames.length; l3 < u2; l3 += 1) { 816 var f2 = this._keyNames[l3]; 817 this._analyze({ key: f2, value: this.options.getFn(h3, f2), record: h3, index: s3 }, { resultMap: n4, results: o4, tokenSearchers: e4, fullSearcher: t4 }); 818 } 819 return o4; 820 } }, { key: "_analyze", value: function(e4, t4) { 821 var r6 = this, n4 = e4.key, o4 = e4.arrayIndex, i3 = o4 === void 0 ? -1 : o4, a4 = e4.value, s3 = e4.record, h3 = e4.index, l3 = t4.tokenSearchers, u2 = l3 === void 0 ? [] : l3, f2 = t4.fullSearcher, v2 = t4.resultMap, p2 = v2 === void 0 ? {} : v2, d2 = t4.results, g2 = d2 === void 0 ? [] : d2; 822 (function e5(t5, o5, i4, a5) { 823 if (o5 != null) { 824 if (typeof o5 == "string") { 825 var s4 = !1, h4 = -1, l4 = 0; 826 r6._log(` 827Key: `.concat(n4 === "" ? "--" : n4)); 828 var v3 = f2.search(o5); 829 if (r6._log('Full text: "'.concat(o5, '", score: ').concat(v3.score)), r6.options.tokenize) { 830 for (var d3 = o5.split(r6.options.tokenSeparator), y2 = d3.length, m2 = [], k2 = 0, b2 = u2.length; k2 < b2; k2 += 1) { 831 var S2 = u2[k2]; 832 r6._log(` 833Pattern: "`.concat(S2.pattern, '"')); 834 for (var x2 = !1, M2 = 0; M2 < y2; M2 += 1) { 835 var _2 = d3[M2], w2 = S2.search(_2), L3 = {}; 836 w2.isMatch ? (L3[_2] = w2.score, s4 = !0, x2 = !0, m2.push(w2.score)) : (L3[_2] = 1, r6.options.matchAllTokens || m2.push(1)), r6._log('Token: "'.concat(_2, '", score: ').concat(L3[_2])); 837 } 838 x2 && (l4 += 1); 839 } 840 h4 = m2[0]; 841 for (var A3 = m2.length, O2 = 1; O2 < A3; O2 += 1) h4 += m2[O2]; 842 h4 /= A3, r6._log("Token score average:", h4); 843 } 844 var C2 = v3.score; 845 h4 > -1 && (C2 = (C2 + h4) / 2), r6._log("Score average:", C2); 846 var j2 = !r6.options.tokenize || !r6.options.matchAllTokens || l4 >= u2.length; 847 if (r6._log(` 848Check Matches: `.concat(j2)), (s4 || v3.isMatch) && j2) { 849 var P3 = { key: n4, arrayIndex: t5, value: o5, score: C2 }; 850 r6.options.includeMatches && (P3.matchedIndices = v3.matchedIndices); 851 var I2 = p2[a5]; 852 I2 ? I2.output.push(P3) : (p2[a5] = { item: i4, output: [P3] }, g2.push(p2[a5])); 853 } 854 } else if (c2(o5)) for (var F2 = 0, T3 = o5.length; F2 < T3; F2 += 1) e5(F2, o5[F2], i4, a5); 855 } 856 })(i3, a4, s3, h3); 857 } }, { key: "_computeScore", value: function(e4) { 858 this._log(` 859 860Computing score: 861`); 862 for (var t4 = this._keyWeights, r6 = !!Object.keys(t4).length, n4 = 0, o4 = e4.length; n4 < o4; n4 += 1) { 863 for (var i3 = e4[n4], a4 = i3.output, s3 = a4.length, c3 = 1, h3 = 0; h3 < s3; h3 += 1) { 864 var l3 = a4[h3], u2 = l3.key, f2 = r6 ? t4[u2] : 1, v2 = l3.score === 0 && t4 && t4[u2] > 0 ? Number.EPSILON : l3.score; 865 c3 *= Math.pow(v2, f2); 866 } 867 i3.score = c3, this._log(i3); 868 } 869 } }, { key: "_sort", value: function(e4) { 870 this._log(` 871 872Sorting....`), e4.sort(this.options.sortFn); 873 } }, { key: "_format", value: function(e4) { 874 var t4 = []; 875 if (this.options.verbose) { 876 var r6 = []; 877 this._log(` 878 879Output: 880 881`, JSON.stringify(e4, function(e5, t5) { 882 if (n3(t5) === "object" && t5 !== null) { 883 if (r6.indexOf(t5) !== -1) return; 884 r6.push(t5); 885 } 886 return t5; 887 }, 2)), r6 = null; 888 } 889 var o4 = []; 890 this.options.includeMatches && o4.push(function(e5, t5) { 891 var r7 = e5.output; 892 t5.matches = []; 893 for (var n4 = 0, o5 = r7.length; n4 < o5; n4 += 1) { 894 var i4 = r7[n4]; 895 if (i4.matchedIndices.length !== 0) { 896 var a5 = { indices: i4.matchedIndices, value: i4.value }; 897 i4.key && (a5.key = i4.key), i4.hasOwnProperty("arrayIndex") && i4.arrayIndex > -1 && (a5.arrayIndex = i4.arrayIndex), t5.matches.push(a5); 898 } 899 } 900 }), this.options.includeScore && o4.push(function(e5, t5) { 901 t5.score = e5.score; 902 }); 903 for (var i3 = 0, a4 = e4.length; i3 < a4; i3 += 1) { 904 var s3 = e4[i3]; 905 if (this.options.id && (s3.item = this.options.getFn(s3.item, this.options.id)[0]), o4.length) { 906 for (var c3 = { item: s3.item }, h3 = 0, l3 = o4.length; h3 < l3; h3 += 1) o4[h3](s3, c3); 907 t4.push(c3); 908 } else t4.push(s3.item); 909 } 910 return t4; 911 } }, { key: "_log", value: function() { 912 var e4; 913 this.options.verbose && (e4 = console).log.apply(e4, arguments); 914 } }]) && o3(t3.prototype, r5), a3 && o3(t3, a3), e3; 915 })(); 916 e2.exports = h2; 917 }, function(e2, t2, r4) { 918 function n3(e3, t3) { 919 for (var r5 = 0; r5 < t3.length; r5++) { 920 var n4 = t3[r5]; 921 n4.enumerable = n4.enumerable || !1, n4.configurable = !0, "value" in n4 && (n4.writable = !0), Object.defineProperty(e3, n4.key, n4); 922 } 923 } 924 var o3 = r4(2), i2 = r4(3), a2 = r4(6), s2 = (function() { 925 function e3(t4, r6) { 926 var n4 = r6.location, o4 = n4 === void 0 ? 0 : n4, i3 = r6.distance, s4 = i3 === void 0 ? 100 : i3, c2 = r6.threshold, h2 = c2 === void 0 ? 0.6 : c2, l3 = r6.maxPatternLength, u2 = l3 === void 0 ? 32 : l3, f2 = r6.isCaseSensitive, v2 = f2 !== void 0 && f2, p2 = r6.tokenSeparator, d2 = p2 === void 0 ? / +/g : p2, g2 = r6.findAllMatches, y2 = g2 !== void 0 && g2, m2 = r6.minMatchCharLength, k2 = m2 === void 0 ? 1 : m2, b2 = r6.includeMatches, S2 = b2 !== void 0 && b2; 927 (function(e4, t5) { 928 if (!(e4 instanceof t5)) throw new TypeError("Cannot call a class as a function"); 929 })(this, e3), this.options = { location: o4, distance: s4, threshold: h2, maxPatternLength: u2, isCaseSensitive: v2, tokenSeparator: d2, findAllMatches: y2, includeMatches: S2, minMatchCharLength: k2 }, this.pattern = v2 ? t4 : t4.toLowerCase(), this.pattern.length <= u2 && (this.patternAlphabet = a2(this.pattern)); 930 } 931 var t3, r5, s3; 932 return t3 = e3, (r5 = [{ key: "search", value: function(e4) { 933 var t4 = this.options, r6 = t4.isCaseSensitive, n4 = t4.includeMatches; 934 if (r6 || (e4 = e4.toLowerCase()), this.pattern === e4) { 935 var a3 = { isMatch: !0, score: 0 }; 936 return n4 && (a3.matchedIndices = [[0, e4.length - 1]]), a3; 937 } 938 var s4 = this.options, c2 = s4.maxPatternLength, h2 = s4.tokenSeparator; 939 if (this.pattern.length > c2) return o3(e4, this.pattern, h2); 940 var l3 = this.options, u2 = l3.location, f2 = l3.distance, v2 = l3.threshold, p2 = l3.findAllMatches, d2 = l3.minMatchCharLength; 941 return i2(e4, this.pattern, this.patternAlphabet, { location: u2, distance: f2, threshold: v2, findAllMatches: p2, minMatchCharLength: d2, includeMatches: n4 }); 942 } }]) && n3(t3.prototype, r5), s3 && n3(t3, s3), e3; 943 })(); 944 e2.exports = s2; 945 }, function(e2, t2) { 946 var r4 = /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g; 947 e2.exports = function(e3, t3) { 948 var n3 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : / +/g, o3 = new RegExp(t3.replace(r4, "\\$&").replace(n3, "|")), i2 = e3.match(o3), a2 = !!i2, s2 = []; 949 if (a2) for (var c2 = 0, h2 = i2.length; c2 < h2; c2 += 1) { 950 var l3 = i2[c2]; 951 s2.push([e3.indexOf(l3), l3.length - 1]); 952 } 953 return { score: a2 ? 0.5 : 1, isMatch: a2, matchedIndices: s2 }; 954 }; 955 }, function(e2, t2, r4) { 956 var n3 = r4(4), o3 = r4(5); 957 e2.exports = function(e3, t3, r5, i2) { 958 for (var a2 = i2.location, s2 = a2 === void 0 ? 0 : a2, c2 = i2.distance, h2 = c2 === void 0 ? 100 : c2, l3 = i2.threshold, u2 = l3 === void 0 ? 0.6 : l3, f2 = i2.findAllMatches, v2 = f2 !== void 0 && f2, p2 = i2.minMatchCharLength, d2 = p2 === void 0 ? 1 : p2, g2 = i2.includeMatches, y2 = g2 !== void 0 && g2, m2 = s2, k2 = e3.length, b2 = u2, S2 = e3.indexOf(t3, m2), x2 = t3.length, M2 = [], _2 = 0; _2 < k2; _2 += 1) M2[_2] = 0; 959 if (S2 !== -1) { 960 var w2 = n3(t3, { errors: 0, currentLocation: S2, expectedLocation: m2, distance: h2 }); 961 if (b2 = Math.min(w2, b2), (S2 = e3.lastIndexOf(t3, m2 + x2)) !== -1) { 962 var L3 = n3(t3, { errors: 0, currentLocation: S2, expectedLocation: m2, distance: h2 }); 963 b2 = Math.min(L3, b2); 964 } 965 } 966 S2 = -1; 967 for (var A3 = [], O2 = 1, C2 = x2 + k2, j2 = 1 << (x2 <= 31 ? x2 - 1 : 30), P3 = 0; P3 < x2; P3 += 1) { 968 for (var I2 = 0, F2 = C2; I2 < F2; ) 969 n3(t3, { errors: P3, currentLocation: m2 + F2, expectedLocation: m2, distance: h2 }) <= b2 ? I2 = F2 : C2 = F2, F2 = Math.floor((C2 - I2) / 2 + I2); 970 C2 = F2; 971 var T3 = Math.max(1, m2 - F2 + 1), N2 = v2 ? k2 : Math.min(m2 + F2, k2) + x2, z2 = Array(N2 + 2); 972 z2[N2 + 1] = (1 << P3) - 1; 973 for (var E2 = N2; E2 >= T3; E2 -= 1) { 974 var W2 = E2 - 1, K2 = r5[e3.charAt(W2)]; 975 if (K2 && (M2[W2] = 1), z2[E2] = (z2[E2 + 1] << 1 | 1) & K2, P3 !== 0 && (z2[E2] |= (A3[E2 + 1] | A3[E2]) << 1 | 1 | A3[E2 + 1]), z2[E2] & j2 && (O2 = n3(t3, { errors: P3, currentLocation: W2, expectedLocation: m2, distance: h2 })) <= b2) { 976 if (b2 = O2, (S2 = W2) <= m2) break; 977 T3 = Math.max(1, 2 * m2 - S2); 978 } 979 } 980 if (n3(t3, { errors: P3 + 1, currentLocation: m2, expectedLocation: m2, distance: h2 }) > b2) break; 981 A3 = z2; 982 } 983 var $ = { isMatch: S2 >= 0, score: O2 === 0 ? 1e-3 : O2 }; 984 return y2 && ($.matchedIndices = o3(M2, d2)), $; 985 }; 986 }, function(e2, t2) { 987 e2.exports = function(e3, t3) { 988 var r4 = t3.errors, n3 = r4 === void 0 ? 0 : r4, o3 = t3.currentLocation, i2 = o3 === void 0 ? 0 : o3, a2 = t3.expectedLocation, s2 = a2 === void 0 ? 0 : a2, c2 = t3.distance, h2 = c2 === void 0 ? 100 : c2, l3 = n3 / e3.length, u2 = Math.abs(s2 - i2); 989 return h2 ? l3 + u2 / h2 : u2 ? 1 : l3; 990 }; 991 }, function(e2, t2) { 992 e2.exports = function() { 993 for (var e3 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], t3 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1, r4 = [], n3 = -1, o3 = -1, i2 = 0, a2 = e3.length; i2 < a2; i2 += 1) { 994 var s2 = e3[i2]; 995 s2 && n3 === -1 ? n3 = i2 : s2 || n3 === -1 || ((o3 = i2 - 1) - n3 + 1 >= t3 && r4.push([n3, o3]), n3 = -1); 996 } 997 return e3[i2 - 1] && i2 - n3 >= t3 && r4.push([n3, i2 - 1]), r4; 998 }; 999 }, function(e2, t2) { 1000 e2.exports = function(e3) { 1001 for (var t3 = {}, r4 = e3.length, n3 = 0; n3 < r4; n3 += 1) t3[e3.charAt(n3)] = 0; 1002 for (var o3 = 0; o3 < r4; o3 += 1) t3[e3.charAt(o3)] |= 1 << r4 - o3 - 1; 1003 return t3; 1004 }; 1005 }, function(e2, t2) { 1006 var r4 = function(e3) { 1007 return Array.isArray ? Array.isArray(e3) : Object.prototype.toString.call(e3) === "[object Array]"; 1008 }, n3 = function(e3) { 1009 return e3 == null ? "" : (function(e4) { 1010 if (typeof e4 == "string") return e4; 1011 var t3 = e4 + ""; 1012 return t3 == "0" && 1 / e4 == -1 / 0 ? "-0" : t3; 1013 })(e3); 1014 }, o3 = function(e3) { 1015 return typeof e3 == "string"; 1016 }, i2 = function(e3) { 1017 return typeof e3 == "number"; 1018 }; 1019 e2.exports = { get: function(e3, t3) { 1020 var a2 = []; 1021 return (function e4(t4, s2) { 1022 if (s2) { 1023 var c2 = s2.indexOf("."), h2 = s2, l3 = null; 1024 c2 !== -1 && (h2 = s2.slice(0, c2), l3 = s2.slice(c2 + 1)); 1025 var u2 = t4[h2]; 1026 if (u2 != null) if (l3 || !o3(u2) && !i2(u2)) if (r4(u2)) for (var f2 = 0, v2 = u2.length; f2 < v2; f2 += 1) e4(u2[f2], l3); 1027 else l3 && e4(u2, l3); 1028 else a2.push(n3(u2)); 1029 } else a2.push(t4); 1030 })(e3, t3), a2; 1031 }, isArray: r4, isString: o3, isNum: i2, toString: n3 }; 1032 }]); 1033 }); 1034 } 1035}); 1036 1037// ../../node_modules/store2/dist/store2.js 1038var require_store2 = __commonJS({ 1039 "../../node_modules/store2/dist/store2.js"(exports, module) { 1040 (function(window2, define2) { 1041 var _2 = { 1042 version: "2.14.4", 1043 areas: {}, 1044 apis: {}, 1045 nsdelim: ".", 1046 // utilities 1047 inherit: function(api, o3) { 1048 for (var p2 in api) 1049 o3.hasOwnProperty(p2) || Object.defineProperty(o3, p2, Object.getOwnPropertyDescriptor(api, p2)); 1050 return o3; 1051 }, 1052 stringify: function(d2, fn) { 1053 return d2 === void 0 || typeof d2 == "function" ? d2 + "" : JSON.stringify(d2, fn || _2.replace); 1054 }, 1055 parse: function(s2, fn) { 1056 try { 1057 return JSON.parse(s2, fn || _2.revive); 1058 } catch { 1059 return s2; 1060 } 1061 }, 1062 // extension hooks 1063 fn: function(name, fn) { 1064 _2.storeAPI[name] = fn; 1065 for (var api in _2.apis) 1066 _2.apis[api][name] = fn; 1067 }, 1068 get: function(area, key) { 1069 return area.getItem(key); 1070 }, 1071 set: function(area, key, string) { 1072 area.setItem(key, string); 1073 }, 1074 remove: function(area, key) { 1075 area.removeItem(key); 1076 }, 1077 key: function(area, i2) { 1078 return area.key(i2); 1079 }, 1080 length: function(area) { 1081 return area.length; 1082 }, 1083 clear: function(area) { 1084 area.clear(); 1085 }, 1086 // core functions 1087 Store: function(id, area, namespace) { 1088 var store3 = _2.inherit(_2.storeAPI, function(key, data, overwrite) { 1089 return arguments.length === 0 ? store3.getAll() : typeof data == "function" ? store3.transact(key, data, overwrite) : data !== void 0 ? store3.set(key, data, overwrite) : typeof key == "string" || typeof key == "number" ? store3.get(key) : typeof key == "function" ? store3.each(key) : key ? store3.setAll(key, data) : store3.clear(); 1090 }); 1091 store3._id = id; 1092 try { 1093 var testKey = "__store2_test"; 1094 area.setItem(testKey, "ok"), store3._area = area, area.removeItem(testKey); 1095 } catch { 1096 store3._area = _2.storage("fake"); 1097 } 1098 return store3._ns = namespace || "", _2.areas[id] || (_2.areas[id] = store3._area), _2.apis[store3._ns + store3._id] || (_2.apis[store3._ns + store3._id] = store3), store3; 1099 }, 1100 storeAPI: { 1101 // admin functions 1102 area: function(id, area) { 1103 var store3 = this[id]; 1104 return (!store3 || !store3.area) && (store3 = _2.Store(id, area, this._ns), this[id] || (this[id] = store3)), store3; 1105 }, 1106 namespace: function(namespace, singleArea, delim) { 1107 if (delim = delim || this._delim || _2.nsdelim, !namespace) 1108 return this._ns ? this._ns.substring(0, this._ns.length - delim.length) : ""; 1109 var ns = namespace, store3 = this[ns]; 1110 if ((!store3 || !store3.namespace) && (store3 = _2.Store(this._id, this._area, this._ns + ns + delim), store3._delim = delim, this[ns] || (this[ns] = store3), !singleArea)) 1111 for (var name in _2.areas) 1112 store3.area(name, _2.areas[name]); 1113 return store3; 1114 }, 1115 isFake: function(force) { 1116 return force ? (this._real = this._area, this._area = _2.storage("fake")) : force === !1 && (this._area = this._real || this._area), this._area.name === "fake"; 1117 }, 1118 toString: function() { 1119 return "store" + (this._ns ? "." + this.namespace() : "") + "[" + this._id + "]"; 1120 }, 1121 // storage functions 1122 has: function(key) { 1123 return this._area.has ? this._area.has(this._in(key)) : this._in(key) in this._area; 1124 }, 1125 size: function() { 1126 return this.keys().length; 1127 }, 1128 each: function(fn, fill) { 1129 for (var i2 = 0, m2 = _2.length(this._area); i2 < m2; i2++) { 1130 var key = this._out(_2.key(this._area, i2)); 1131 if (key !== void 0 && fn.call(this, key, this.get(key), fill) === !1) 1132 break; 1133 m2 > _2.length(this._area) && (m2--, i2--); 1134 } 1135 return fill || this; 1136 }, 1137 keys: function(fillList) { 1138 return this.each(function(k2, v2, list) { 1139 list.push(k2); 1140 }, fillList || []); 1141 }, 1142 get: function(key, alt) { 1143 var s2 = _2.get(this._area, this._in(key)), fn; 1144 return typeof alt == "function" && (fn = alt, alt = null), s2 !== null ? _2.parse(s2, fn) : alt ?? s2; 1145 }, 1146 getAll: function(fillObj) { 1147 return this.each(function(k2, v2, all) { 1148 all[k2] = v2; 1149 }, fillObj || {}); 1150 }, 1151 transact: function(key, fn, alt) { 1152 var val = this.get(key, alt), ret = fn(val); 1153 return this.set(key, ret === void 0 ? val : ret), this; 1154 }, 1155 set: function(key, data, overwrite) { 1156 var d2 = this.get(key), replacer; 1157 return d2 != null && overwrite === !1 ? data : (typeof overwrite == "function" && (replacer = overwrite, overwrite = void 0), _2.set(this._area, this._in(key), _2.stringify(data, replacer), overwrite) || d2); 1158 }, 1159 setAll: function(data, overwrite) { 1160 var changed, val; 1161 for (var key in data) 1162 val = data[key], this.set(key, val, overwrite) !== val && (changed = !0); 1163 return changed; 1164 }, 1165 add: function(key, data, replacer) { 1166 var d2 = this.get(key); 1167 if (d2 instanceof Array) 1168 data = d2.concat(data); 1169 else if (d2 !== null) { 1170 var type = typeof d2; 1171 if (type === typeof data && type === "object") { 1172 for (var k2 in data) 1173 d2[k2] = data[k2]; 1174 data = d2; 1175 } else 1176 data = d2 + data; 1177 } 1178 return _2.set(this._area, this._in(key), _2.stringify(data, replacer)), data; 1179 }, 1180 remove: function(key, alt) { 1181 var d2 = this.get(key, alt); 1182 return _2.remove(this._area, this._in(key)), d2; 1183 }, 1184 clear: function() { 1185 return this._ns ? this.each(function(k2) { 1186 _2.remove(this._area, this._in(k2)); 1187 }, 1) : _2.clear(this._area), this; 1188 }, 1189 clearAll: function() { 1190 var area = this._area; 1191 for (var id in _2.areas) 1192 _2.areas.hasOwnProperty(id) && (this._area = _2.areas[id], this.clear()); 1193 return this._area = area, this; 1194 }, 1195 // internal use functions 1196 _in: function(k2) { 1197 return typeof k2 != "string" && (k2 = _2.stringify(k2)), this._ns ? this._ns + k2 : k2; 1198 }, 1199 _out: function(k2) { 1200 return this._ns ? k2 && k2.indexOf(this._ns) === 0 ? k2.substring(this._ns.length) : void 0 : ( 1201 // so each() knows to skip it 1202 k2 1203 ); 1204 } 1205 }, 1206 // end _.storeAPI 1207 storage: function(name) { 1208 return _2.inherit(_2.storageAPI, { items: {}, name }); 1209 }, 1210 storageAPI: { 1211 length: 0, 1212 has: function(k2) { 1213 return this.items.hasOwnProperty(k2); 1214 }, 1215 key: function(i2) { 1216 var c2 = 0; 1217 for (var k2 in this.items) 1218 if (this.has(k2) && i2 === c2++) 1219 return k2; 1220 }, 1221 setItem: function(k2, v2) { 1222 this.has(k2) || this.length++, this.items[k2] = v2; 1223 }, 1224 removeItem: function(k2) { 1225 this.has(k2) && (delete this.items[k2], this.length--); 1226 }, 1227 getItem: function(k2) { 1228 return this.has(k2) ? this.items[k2] : null; 1229 }, 1230 clear: function() { 1231 for (var k2 in this.items) 1232 this.removeItem(k2); 1233 } 1234 } 1235 // end _.storageAPI 1236 }, store2 = ( 1237 // safely set this up (throws error in IE10/32bit mode for local files) 1238 _2.Store("local", (function() { 1239 try { 1240 return localStorage; 1241 } catch { 1242 } 1243 })()) 1244 ); 1245 store2.local = store2, store2._ = _2, store2.area("session", (function() { 1246 try { 1247 return sessionStorage; 1248 } catch { 1249 } 1250 })()), store2.area("page", _2.storage("page")), typeof define2 == "function" && define2.amd !== void 0 ? define2("store2", [], function() { 1251 return store2; 1252 }) : typeof module < "u" && module.exports ? module.exports = store2 : (window2.store && (_2.conflict = window2.store), window2.store = store2); 1253 })(exports, exports && exports.define); 1254 } 1255}); 1256 1257// src/manager/runtime.tsx 1258init_react(); 1259 1260// global-externals:storybook/internal/channels 1261var channels_default = __STORYBOOK_CHANNELS__, { Channel, HEARTBEAT_INTERVAL, HEARTBEAT_MAX_LATENCY, PostMessageTransport, SERVER_CHANNEL_PATH, WebsocketTransport, clearChannel, createBrowserChannel, ensureChannel, getChannel, installNoopChannel, requireChannel, setChannel } = __STORYBOOK_CHANNELS__; 1262 1263// global-externals:storybook/internal/core-events 1264var core_events_default = __STORYBOOK_CORE_EVENTS__, { AI_PROMPT_NUDGE, AI_SETUP_ANALYTICS_REQUEST, AI_SETUP_ANALYTICS_RESPONSE, ARGTYPES_INFO_REQUEST, ARGTYPES_INFO_RESPONSE, CHANNEL_CREATED, CHANNEL_WS_DISCONNECT, CONFIG_ERROR, CREATE_NEW_STORYFILE_REQUEST, CREATE_NEW_STORYFILE_RESPONSE, CURRENT_STORY_WAS_SET, DOCS_PREPARED, DOCS_RENDERED, FILE_COMPONENT_SEARCH_REQUEST, FILE_COMPONENT_SEARCH_RESPONSE, FORCE_REMOUNT, FORCE_RE_RENDER, GHOST_STORIES_REQUEST, GHOST_STORIES_RESPONSE, GLOBALS_UPDATED, MANAGER_INERT_ATTRIBUTE_CHANGED, NAVIGATE_URL, OPEN_IN_EDITOR_REQUEST, OPEN_IN_EDITOR_RESPONSE, PLAY_FUNCTION_THREW_EXCEPTION, PRELOAD_ENTRIES, PREVIEW_BUILDER_PROGRESS, PREVIEW_INITIALIZED, PREVIEW_KEYDOWN, REGISTER_SUBSCRIPTION, REQUEST_WHATS_NEW_DATA, RESET_STORY_ARGS, RESULT_WHATS_NEW_DATA, SAVE_STORY_REQUEST, SAVE_STORY_RESPONSE, SELECT_STORY, SET_CONFIG, SET_CURRENT_STORY, SET_FILTER, SET_GLOBALS, SET_INDEX, SET_STORIES, SET_WHATS_NEW_CACHE, SHARED_STATE_CHANGED, SHARED_STATE_SET, SHARE_ISOLATE_MODE, SIDEBAR_FILTER_CHANGED, STORIES_COLLAPSE_ALL, STORIES_EXPAND_ALL, STORY_ARGS_UPDATED, STORY_CHANGED, STORY_ERRORED, STORY_FINISHED, STORY_HOT_UPDATED, STORY_INDEX_INVALIDATED, STORY_MISSING, STORY_PREPARED, STORY_RENDERED, STORY_RENDER_PHASE_CHANGED, STORY_SPECIFIED, STORY_THREW_EXCEPTION, STORY_UNCHANGED, TELEMETRY_ERROR, TOGGLE_WHATS_NEW_NOTIFICATIONS, UNHANDLED_ERRORS_WHILE_PLAYING, UPDATE_GLOBALS, UPDATE_QUERY_PARAMS, UPDATE_STORY_ARGS } = __STORYBOOK_CORE_EVENTS__; 1265 1266// ../../node_modules/@storybook/global/dist/index.mjs 1267var scope = (() => { 1268 let win; 1269 return typeof window < "u" ? win = window : typeof globalThis < "u" ? win = globalThis : typeof global < "u" ? win = global : typeof self < "u" ? win = self : win = {}, win; 1270})(); 1271 1272// global-externals:@storybook/icons 1273var icons_exports = {}; 1274__export(icons_exports, { 1275 AccessibilityAltIcon: () => AccessibilityAltIcon, 1276 AccessibilityIcon: () => AccessibilityIcon, 1277 AccessibilityIgnoredIcon: () => AccessibilityIgnoredIcon, 1278 AddIcon: () => AddIcon, 1279 AdminIcon: () => AdminIcon, 1280 AlertAltIcon: () => AlertAltIcon, 1281 AlertIcon: () => AlertIcon, 1282 AlignLeftIcon: () => AlignLeftIcon, 1283 AlignRightIcon: () => AlignRightIcon, 1284 AppleIcon: () => AppleIcon, 1285 ArrowBottomLeftIcon: () => ArrowBottomLeftIcon, 1286 ArrowBottomRightIcon: () => ArrowBottomRightIcon, 1287 ArrowDownIcon: () => ArrowDownIcon, 1288 ArrowLeftIcon: () => ArrowLeftIcon, 1289 ArrowRightIcon: () => ArrowRightIcon, 1290 ArrowSolidDownIcon: () => ArrowSolidDownIcon, 1291 ArrowSolidLeftIcon: () => ArrowSolidLeftIcon, 1292 ArrowSolidRightIcon: () => ArrowSolidRightIcon, 1293 ArrowSolidUpIcon: () => ArrowSolidUpIcon, 1294 ArrowTopLeftIcon: () => ArrowTopLeftIcon, 1295 ArrowTopRightIcon: () => ArrowTopRightIcon, 1296 ArrowUpIcon: () => ArrowUpIcon, 1297 AzureDevOpsIcon: () => AzureDevOpsIcon, 1298 BackIcon: () => BackIcon, 1299 BasketIcon: () => BasketIcon, 1300 BatchAcceptIcon: () => BatchAcceptIcon, 1301 BatchDenyIcon: () => BatchDenyIcon, 1302 BeakerIcon: () => BeakerIcon, 1303 BellIcon: () => BellIcon, 1304 BitbucketIcon: () => BitbucketIcon, 1305 BoldIcon: () => BoldIcon, 1306 BookIcon: () => BookIcon, 1307 BookmarkHollowIcon: () => BookmarkHollowIcon, 1308 BookmarkIcon: () => BookmarkIcon, 1309 BottomBarIcon: () => BottomBarIcon, 1310 BottomBarToggleIcon: () => BottomBarToggleIcon, 1311 BoxIcon: () => BoxIcon, 1312 BranchIcon: () => BranchIcon, 1313 BrowserIcon: () => BrowserIcon, 1314 BugIcon: () => BugIcon, 1315 ButtonIcon: () => ButtonIcon, 1316 CPUIcon: () => CPUIcon, 1317 CalendarIcon: () => CalendarIcon, 1318 CameraIcon: () => CameraIcon, 1319 CameraStabilizeIcon: () => CameraStabilizeIcon, 1320 CategoryIcon: () => CategoryIcon, 1321 CertificateIcon: () => CertificateIcon, 1322 ChangedIcon: () => ChangedIcon, 1323 ChatIcon: () => ChatIcon, 1324 CheckIcon: () => CheckIcon, 1325 ChecklistIcon: () => ChecklistIcon, 1326 ChevronDownIcon: () => ChevronDownIcon, 1327 ChevronLeftIcon: () => ChevronLeftIcon, 1328 ChevronRightIcon: () => ChevronRightIcon, 1329 ChevronSmallDownIcon: () => ChevronSmallDownIcon, 1330 ChevronSmallLeftIcon: () => ChevronSmallLeftIcon, 1331 ChevronSmallRightIcon: () => ChevronSmallRightIcon, 1332 ChevronSmallUpIcon: () => ChevronSmallUpIcon, 1333 ChevronUpIcon: () => ChevronUpIcon, 1334 ChromaticIcon: () => ChromaticIcon, 1335 ChromeIcon: () => ChromeIcon, 1336 CircleHollowIcon: () => CircleHollowIcon, 1337 CircleIcon: () => CircleIcon, 1338 ClearIcon: () => ClearIcon, 1339 CloseAltIcon: () => CloseAltIcon, 1340 CloseIcon: () => CloseIcon, 1341 CloudHollowIcon: () => CloudHollowIcon, 1342 CloudIcon: () => CloudIcon, 1343 CogIcon: () => CogIcon, 1344 CollapseIcon: () => CollapseIcon, 1345 CommandIcon: () => CommandIcon, 1346 CommentAddIcon: () => CommentAddIcon, 1347 CommentIcon: () => CommentIcon, 1348 CommentsIcon: () => CommentsIcon, 1349 CommitIcon: () => CommitIcon, 1350 CompassIcon: () => CompassIcon, 1351 ComponentDrivenIcon: () => ComponentDrivenIcon, 1352 ComponentIcon: () => ComponentIcon, 1353 ContrastIcon: () => ContrastIcon, 1354 ContrastIgnoredIcon: () => ContrastIgnoredIcon, 1355 ControlsIcon: () => ControlsIcon, 1356 CopyIcon: () => CopyIcon, 1357 CreditIcon: () => CreditIcon, 1358 CrossIcon: () => CrossIcon, 1359 DashboardIcon: () => DashboardIcon, 1360 DatabaseIcon: () => DatabaseIcon, 1361 DeleteIcon: () => DeleteIcon, 1362 DiamondIcon: () => DiamondIcon, 1363 DirectionIcon: () => DirectionIcon, 1364 DiscordIcon: () => DiscordIcon, 1365 DocChartIcon: () => DocChartIcon, 1366 DocListIcon: () => DocListIcon, 1367 DocumentIcon: () => DocumentIcon, 1368 DownloadIcon: () => DownloadIcon, 1369 DragIcon: () => DragIcon, 1370 EditIcon: () => EditIcon, 1371 EditorIcon: () => EditorIcon, 1372 EllipsisIcon: () => EllipsisIcon, 1373 EmailIcon: () => EmailIcon, 1374 ExpandAltIcon: () => ExpandAltIcon, 1375 ExpandIcon: () => ExpandIcon, 1376 EyeCloseIcon: () => EyeCloseIcon, 1377 EyeIcon: () => EyeIcon, 1378 FaceHappyIcon: () => FaceHappyIcon, 1379 FaceNeutralIcon: () => FaceNeutralIcon, 1380 FaceSadIcon: () => FaceSadIcon, 1381 FacebookIcon: () => FacebookIcon, 1382 FailedIcon: () => FailedIcon, 1383 FastForwardIcon: () => FastForwardIcon, 1384 FigmaIcon: () => FigmaIcon, 1385 FilesIcon: () => FilesIcon, 1386 FilterIcon: () => FilterIcon, 1387 FlagIcon: () => FlagIcon, 1388 FolderIcon: () => FolderIcon, 1389 FormIcon: () => FormIcon, 1390 GDriveIcon: () => GDriveIcon, 1391 GiftIcon: () => GiftIcon, 1392 GithubIcon: () => GithubIcon, 1393 GitlabIcon: () => GitlabIcon, 1394 GlobeIcon: () => GlobeIcon, 1395 GoogleIcon: () => GoogleIcon, 1396 GraphBarIcon: () => GraphBarIcon, 1397 GraphLineIcon: () => GraphLineIcon, 1398 GraphqlIcon: () => GraphqlIcon, 1399 GridAltIcon: () => GridAltIcon, 1400 GridIcon: () => GridIcon, 1401 GrowIcon: () => GrowIcon, 1402 HeartHollowIcon: () => HeartHollowIcon, 1403 HeartIcon: () => HeartIcon, 1404 HomeIcon: () => HomeIcon, 1405 HourglassIcon: () => HourglassIcon, 1406 InfoIcon: () => InfoIcon, 1407 ItalicIcon: () => ItalicIcon, 1408 JumpToIcon: () => JumpToIcon, 1409 KeyIcon: () => KeyIcon, 1410 LightningIcon: () => LightningIcon, 1411 LightningOffIcon: () => LightningOffIcon, 1412 LinkBrokenIcon: () => LinkBrokenIcon, 1413 LinkIcon: () => LinkIcon, 1414 LinkedinIcon: () => LinkedinIcon, 1415 LinuxIcon: () => LinuxIcon, 1416 ListOrderedIcon: () => ListOrderedIcon, 1417 ListUnorderedIcon: () => ListUnorderedIcon, 1418 LocationIcon: () => LocationIcon, 1419 LockIcon: () => LockIcon, 1420 MarkdownIcon: () => MarkdownIcon, 1421 MarkupIcon: () => MarkupIcon, 1422 MediumIcon: () => MediumIcon, 1423 MemoryIcon: () => MemoryIcon, 1424 MenuIcon: () => MenuIcon, 1425 MergeIcon: () => MergeIcon, 1426 MirrorIcon: () => MirrorIcon, 1427 MobileIcon: () => MobileIcon, 1428 MoonIcon: () => MoonIcon, 1429 NutIcon: () => NutIcon, 1430 OutboxIcon: () => OutboxIcon, 1431 OutlineIcon: () => OutlineIcon, 1432 PaintBrushAltIcon: () => PaintBrushAltIcon, 1433 PaintBrushIcon: () => PaintBrushIcon, 1434 PaperClipIcon: () => PaperClipIcon, 1435 ParagraphIcon: () => ParagraphIcon, 1436 PassedIcon: () => PassedIcon, 1437 PhoneIcon: () => PhoneIcon, 1438 PhotoDragIcon: () => PhotoDragIcon, 1439 PhotoIcon: () => PhotoIcon, 1440 PhotoStabilizeIcon: () => PhotoStabilizeIcon, 1441 PinAltIcon: () => PinAltIcon, 1442 PinIcon: () => PinIcon, 1443 PlayAllHollowIcon: () => PlayAllHollowIcon, 1444 PlayBackIcon: () => PlayBackIcon, 1445 PlayHollowIcon: () => PlayHollowIcon, 1446 PlayIcon: () => PlayIcon, 1447 PlayNextIcon: () => PlayNextIcon, 1448 PlusIcon: () => PlusIcon, 1449 PointerDefaultIcon: () => PointerDefaultIcon, 1450 PointerHandIcon: () => PointerHandIcon, 1451 PopOutIcon: () => PopOutIcon, 1452 PowerIcon: () => PowerIcon, 1453 PrintIcon: () => PrintIcon, 1454 ProceedIcon: () => ProceedIcon, 1455 ProfileIcon: () => ProfileIcon, 1456 PullRequestIcon: () => PullRequestIcon, 1457 QuestionIcon: () => QuestionIcon, 1458 RSSIcon: () => RSSIcon, 1459 RedirectIcon: () => RedirectIcon, 1460 ReduxIcon: () => ReduxIcon, 1461 RefreshIcon: () => RefreshIcon, 1462 ReplyIcon: () => ReplyIcon, 1463 RepoIcon: () => RepoIcon, 1464 RequestChangeIcon: () => RequestChangeIcon, 1465 RewindIcon: () => RewindIcon, 1466 RulerIcon: () => RulerIcon, 1467 SaveIcon: () => SaveIcon, 1468 SearchIcon: () => SearchIcon, 1469 ShareAltIcon: () => ShareAltIcon, 1470 ShareIcon: () => ShareIcon, 1471 ShieldIcon: () => ShieldIcon, 1472 SideBySideIcon: () => SideBySideIcon, 1473 SidebarAltIcon: () => SidebarAltIcon, 1474 SidebarAltToggleIcon: () => SidebarAltToggleIcon, 1475 SidebarIcon: () => SidebarIcon, 1476 SidebarToggleIcon: () => SidebarToggleIcon, 1477 SortDownIcon: () => SortDownIcon, 1478 SortUpIcon: () => SortUpIcon, 1479 SpeakerIcon: () => SpeakerIcon, 1480 StackedIcon: () => StackedIcon, 1481 StarHollowIcon: () => StarHollowIcon, 1482 StarIcon: () => StarIcon, 1483 StatusFailIcon: () => StatusFailIcon, 1484 StatusIcon: () => StatusIcon, 1485 StatusNewIcon: () => StatusNewIcon, 1486 StatusPassIcon: () => StatusPassIcon, 1487 StatusWarnIcon: () => StatusWarnIcon, 1488 StickerIcon: () => StickerIcon, 1489 StopAltHollowIcon: () => StopAltHollowIcon, 1490 StopAltIcon: () => StopAltIcon, 1491 StopIcon: () => StopIcon, 1492 StorybookIcon: () => StorybookIcon, 1493 StructureIcon: () => StructureIcon, 1494 SubtractIcon: () => SubtractIcon, 1495 SunIcon: () => SunIcon, 1496 SupportIcon: () => SupportIcon, 1497 SweepIcon: () => SweepIcon, 1498 SwitchAltIcon: () => SwitchAltIcon, 1499 SyncIcon: () => SyncIcon, 1500 TabletIcon: () => TabletIcon, 1501 ThumbsUpIcon: () => ThumbsUpIcon, 1502 TimeIcon: () => TimeIcon, 1503 TimerIcon: () => TimerIcon, 1504 TransferIcon: () => TransferIcon, 1505 TrashIcon: () => TrashIcon, 1506 TwitterIcon: () => TwitterIcon, 1507 TypeIcon: () => TypeIcon, 1508 UbuntuIcon: () => UbuntuIcon, 1509 UndoIcon: () => UndoIcon, 1510 UnfoldIcon: () => UnfoldIcon, 1511 UnlockIcon: () => UnlockIcon, 1512 UnpinIcon: () => UnpinIcon, 1513 UploadIcon: () => UploadIcon, 1514 UserAddIcon: () => UserAddIcon, 1515 UserAltIcon: () => UserAltIcon, 1516 UserIcon: () => UserIcon, 1517 UsersIcon: () => UsersIcon, 1518 VSCodeIcon: () => VSCodeIcon, 1519 VerifiedIcon: () => VerifiedIcon, 1520 VideoIcon: () => VideoIcon, 1521 WandIcon: () => WandIcon, 1522 WatchIcon: () => WatchIcon, 1523 WindowsIcon: () => WindowsIcon, 1524 WrenchIcon: () => WrenchIcon, 1525 XIcon: () => XIcon, 1526 YoutubeIcon: () => YoutubeIcon, 1527 ZoomIcon: () => ZoomIcon, 1528 ZoomOutIcon: () => ZoomOutIcon, 1529 ZoomResetIcon: () => ZoomResetIcon, 1530 default: () => icons_default, 1531 iconList: () => iconList 1532}); 1533var icons_default = __STORYBOOK_ICONS__, { AccessibilityAltIcon, AccessibilityIcon, AccessibilityIgnoredIcon, AddIcon, AdminIcon, AlertAltIcon, AlertIcon, AlignLeftIcon, AlignRightIcon, AppleIcon, ArrowBottomLeftIcon, ArrowBottomRightIcon, ArrowDownIcon, ArrowLeftIcon, ArrowRightIcon, ArrowSolidDownIcon, ArrowSolidLeftIcon, ArrowSolidRightIcon, ArrowSolidUpIcon, ArrowTopLeftIcon, ArrowTopRightIcon, ArrowUpIcon, AzureDevOpsIcon, BackIcon, BasketIcon, BatchAcceptIcon, BatchDenyIcon, BeakerIcon, BellIcon, BitbucketIcon, BoldIcon, BookIcon, BookmarkHollowIcon, BookmarkIcon, BottomBarIcon, BottomBarToggleIcon, BoxIcon, BranchIcon, BrowserIcon, BugIcon, ButtonIcon, CPUIcon, CalendarIcon, CameraIcon, CameraStabilizeIcon, CategoryIcon, CertificateIcon, ChangedIcon, ChatIcon, CheckIcon, ChecklistIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronSmallDownIcon, ChevronSmallLeftIcon, ChevronSmallRightIcon, ChevronSmallUpIcon, ChevronUpIcon, ChromaticIcon, ChromeIcon, CircleHollowIcon, CircleIcon, ClearIcon, CloseAltIcon, CloseIcon, CloudHollowIcon, CloudIcon, CogIcon, CollapseIcon, CommandIcon, CommentAddIcon, CommentIcon, CommentsIcon, CommitIcon, CompassIcon, ComponentDrivenIcon, ComponentIcon, ContrastIcon, ContrastIgnoredIcon, ControlsIcon, CopyIcon, CreditIcon, CrossIcon, DashboardIcon, DatabaseIcon, DeleteIcon, DiamondIcon, DirectionIcon, DiscordIcon, DocChartIcon, DocListIcon, DocumentIcon, DownloadIcon, DragIcon, EditIcon, EditorIcon, EllipsisIcon, EmailIcon, ExpandAltIcon, ExpandIcon, EyeCloseIcon, EyeIcon, FaceHappyIcon, FaceNeutralIcon, FaceSadIcon, FacebookIcon, FailedIcon, FastForwardIcon, FigmaIcon, FilesIcon, FilterIcon, FlagIcon, FolderIcon, FormIcon, GDriveIcon, GiftIcon, GithubIcon, GitlabIcon, GlobeIcon, GoogleIcon, GraphBarIcon, GraphLineIcon, GraphqlIcon, GridAltIcon, GridIcon, GrowIcon, HeartHollowIcon, HeartIcon, HomeIcon, HourglassIcon, InfoIcon, ItalicIcon, JumpToIcon, KeyIcon, LightningIcon, LightningOffIcon, LinkBrokenIcon, LinkIcon, LinkedinIcon, LinuxIcon, ListOrderedIcon, ListUnorderedIcon, LocationIcon, LockIcon, MarkdownIcon, MarkupIcon, MediumIcon, MemoryIcon, MenuIcon, MergeIcon, MirrorIcon, MobileIcon, MoonIcon, NutIcon, OutboxIcon, OutlineIcon, PaintBrushAltIcon, PaintBrushIcon, PaperClipIcon, ParagraphIcon, PassedIcon, PhoneIcon, PhotoDragIcon, PhotoIcon, PhotoStabilizeIcon, PinAltIcon, PinIcon, PlayAllHollowIcon, PlayBackIcon, PlayHollowIcon, PlayIcon, PlayNextIcon, PlusIcon, PointerDefaultIcon, PointerHandIcon, PopOutIcon, PowerIcon, PrintIcon, ProceedIcon, ProfileIcon, PullRequestIcon, QuestionIcon, RSSIcon, RedirectIcon, ReduxIcon, RefreshIcon, ReplyIcon, RepoIcon, RequestChangeIcon, RewindIcon, RulerIcon, SaveIcon, SearchIcon, ShareAltIcon, ShareIcon, ShieldIcon, SideBySideIcon, SidebarAltIcon, SidebarAltToggleIcon, SidebarIcon, SidebarToggleIcon, SortDownIcon, SortUpIcon, SpeakerIcon, StackedIcon, StarHollowIcon, StarIcon, StatusFailIcon, StatusIcon, StatusNewIcon, StatusPassIcon, StatusWarnIcon, StickerIcon, StopAltHollowIcon, StopAltIcon, StopIcon, StorybookIcon, StructureIcon, SubtractIcon, SunIcon, SupportIcon, SweepIcon, SwitchAltIcon, SyncIcon, TabletIcon, ThumbsUpIcon, TimeIcon, TimerIcon, TransferIcon, TrashIcon, TwitterIcon, TypeIcon, UbuntuIcon, UndoIcon, UnfoldIcon, UnlockIcon, UnpinIcon, UploadIcon, UserAddIcon, UserAltIcon, UserIcon, UsersIcon, VSCodeIcon, VerifiedIcon, VideoIcon, WandIcon, WatchIcon, WindowsIcon, WrenchIcon, XIcon, YoutubeIcon, ZoomIcon, ZoomOutIcon, ZoomResetIcon, iconList } = __STORYBOOK_ICONS__; 1534 1535// global-externals:storybook/manager-api 1536var manager_api_default = __STORYBOOK_API__, { ActiveTabs, Consumer, ManagerContext, Provider, RequestResponseError, Tag, addons, combineParameters, controlOrMetaKey, controlOrMetaSymbol, eventMatchesShortcut, eventToShortcut, experimental_MockUniversalStore, experimental_UniversalStore, experimental_getStatusStore, experimental_getTestProviderStore, experimental_requestResponse, experimental_useStatusStore, experimental_useTestProviderStore, experimental_useUniversalStore, getService, internal_checklistStore, internal_fullStatusStore, internal_fullTestProviderStore, internal_universalChecklistStore, internal_universalStatusStore, internal_universalTestProviderStore, isMacLike, isShortcutTaken, keyToSymbol, merge, mockChannel, optionOrAltSymbol, registerService, shortcutMatchesShortcut, shortcutToAriaKeyshortcuts, shortcutToHumanString, types, useAddonState, useArgTypes, useArgs, useChannel, useGlobalTypes, useGlobals, useParameter, useServiceCommand, useServiceQuery, useSharedState, useStoryPrepared, useStorybookApi, useStorybookState } = __STORYBOOK_API__; 1537 1538// global-externals:storybook/theming 1539var theming_default = __STORYBOOK_THEMING__, { CacheProvider, ClassNames, Global, ThemeProvider, background, color, convert, create, createCache, createGlobal, createReset, css, darken, ensure, getPreferredColorScheme, ignoreSsrWarning, isPropValid, jsx, keyframes, lighten, srOnlyStyles, srOnlyUnsetStyles, styled, themes, tokens, typography, useTheme, withTheme } = __STORYBOOK_THEMING__; 1540 1541// src/toolbar/components/ToolbarManager.tsx 1542init_react(); 1543 1544// global-externals:storybook/internal/components 1545var components_default = __STORYBOOK_COMPONENTS__, { A, AbstractToolbar, ActionBar, ActionList, AddonPanel, Badge, Bar, Blockquote, Button, Card, ClipboardCode, Code, Collapsible, DL, Div, DocumentWrapper, EmptyTabContent, ErrorFormatter, FlexBar, Form, H1, H2, H3, H4, H5, H6, HR, IconButton, Img, LI, Link, ListItem, Loader, Modal, ModalDecorator, OL, P, Placeholder, Popover, PopoverProvider, Pre, ProgressSpinner, ResetWrapper, ScrollArea, Select, Separator, Spaced, Span, StatelessTab, StatelessTabList, StatelessTabPanel, StatelessTabsView, StorybookIcon: StorybookIcon2, StorybookLogo, SyntaxHighlighter, TT, TabBar, TabButton, TabList, TabPanel, TabWrapper, Table, Tabs, TabsState, TabsView, ToggleButton, Toolbar, Tooltip, TooltipLinkList, TooltipMessage, TooltipNote, TooltipProvider, UL, WithTooltip, WithTooltipPure, Zoom, codeCommon, components, convertToReactAriaPlacement, createCopyToClipboardFunction, getStoryHref, interleaveSeparators, nameSpaceClassNames, resetComponents, useCopyButton, useTabsState, withReset } = __STORYBOOK_COMPONENTS__; 1546 1547// src/toolbar/utils/normalize-toolbar-arg-type.ts 1548var defaultItemValues = { 1549 type: "item", 1550 value: "" 1551}, normalizeArgType = (key, argType) => { 1552 let toolbar = argType.toolbar; 1553 return toolbar ? { 1554 ...argType, 1555 name: argType.name || key, 1556 description: argType.description || key, 1557 toolbar: { 1558 ...argType.toolbar, 1559 items: toolbar.items.map((_item) => { 1560 let item = typeof _item == "string" ? { value: _item, title: _item } : _item; 1561 return item.type === "reset" && toolbar.icon && (item.icon = toolbar.icon, item.hideIcon = !0, item.value = void 0), { ...defaultItemValues, ...item }; 1562 }) 1563 } 1564 } : null; 1565}; 1566 1567// src/toolbar/components/ToolbarMenuSelect.tsx 1568init_react(); 1569 1570// src/components/components/icon/icon.tsx 1571init_react(); 1572 1573// global-externals:storybook/internal/client-logger 1574var client_logger_default = __STORYBOOK_CLIENT_LOGGER__, { deprecate, logger, once, pretty } = __STORYBOOK_CLIENT_LOGGER__; 1575 1576// src/components/components/icon/icon.tsx 1577var NEW_ICON_MAP = icons_exports, Svg = styled.svg` 1578 display: inline-block; 1579 shape-rendering: inherit; 1580 vertical-align: middle; 1581 fill: currentColor; 1582 path { 1583 fill: currentColor; 1584 } 1585`, Icons = ({ 1586 icon, 1587 useSymbol, 1588 __suppressDeprecationWarning = !1, 1589 ...props 1590}) => { 1591 __suppressDeprecationWarning || deprecate( 1592 `Use of the deprecated Icons ${`(${icon})` || ""} component detected. Please use the @storybook/icons component directly. For more informations, see the migration notes at https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#icons-is-deprecated` 1593 ); 1594 let findIcon = icons[icon] || null; 1595 if (!findIcon) 1596 return logger.warn( 1597 `Use of an unknown prop ${`(${icon})` || ""} in the Icons component. The Icons component is deprecated. Please use the @storybook/icons component directly. For more informations, see the migration notes at https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#icons-is-deprecated` 1598 ), null; 1599 let Icon = NEW_ICON_MAP[findIcon]; 1600 return react_default.createElement(Icon, { ...props }); 1601}, Symbols = memo(function({ icons: keys = Object.keys(icons) }) { 1602 return react_default.createElement( 1603 Svg, 1604 { 1605 viewBox: "0 0 14 14", 1606 style: { position: "absolute", width: 0, height: 0 }, 1607 "data-chromatic": "ignore" 1608 }, 1609 keys.map((key) => react_default.createElement("symbol", { id: `icon--${key}`, key }, icons[key])) 1610 ); 1611}), icons = { 1612 user: "UserIcon", 1613 useralt: "UserAltIcon", 1614 useradd: "UserAddIcon", 1615 users: "UsersIcon", 1616 profile: "ProfileIcon", 1617 facehappy: "FaceHappyIcon", 1618 faceneutral: "FaceNeutralIcon", 1619 facesad: "FaceSadIcon", 1620 accessibility: "AccessibilityIcon", 1621 accessibilityalt: "AccessibilityAltIcon", 1622 accessibilityignored: "AccessibilityIgnoredIcon", 1623 arrowup: "ChevronUpIcon", 1624 arrowdown: "ChevronDownIcon", 1625 arrowleft: "ChevronLeftIcon", 1626 arrowright: "ChevronRightIcon", 1627 arrowupalt: "ArrowUpIcon", 1628 arrowdownalt: "ArrowDownIcon", 1629 arrowleftalt: "ArrowLeftIcon", 1630 arrowrightalt: "ArrowRightIcon", 1631 arrowtopleft: "ArrowTopLeftIcon", 1632 arrowtopright: "ArrowTopRightIcon", 1633 arrowbottomleft: "ArrowBottomLeftIcon", 1634 arrowbottomright: "ArrowBottomRightIcon", 1635 arrowsolidup: "ArrowSolidUpIcon", 1636 arrowsoliddown: "ArrowSolidDownIcon", 1637 arrowsolidleft: "ArrowSolidLeftIcon", 1638 arrowsolidright: "ArrowSolidRightIcon", 1639 chevronsmallup: "ChevronSmallUpIcon", 1640 chevronsmalldown: "ChevronSmallDownIcon", 1641 chevronsmallleft: "ChevronSmallLeftIcon", 1642 chevronsmallright: "ChevronSmallRightIcon", 1643 expandalt: "ExpandAltIcon", 1644 collapse: "CollapseIcon", 1645 expand: "ExpandIcon", 1646 unfold: "UnfoldIcon", 1647 transfer: "TransferIcon", 1648 redirect: "RedirectIcon", 1649 jumpto: "JumpToIcon", 1650 popout: "PopOutIcon", 1651 undo: "UndoIcon", 1652 reply: "ReplyIcon", 1653 sync: "SyncIcon", 1654 upload: "UploadIcon", 1655 download: "DownloadIcon", 1656 save: "SaveIcon", 1657 back: "BackIcon", 1658 proceed: "ProceedIcon", 1659 refresh: "RefreshIcon", 1660 globe: "GlobeIcon", 1661 compass: "CompassIcon", 1662 direction: "DirectionIcon", 1663 location: "LocationIcon", 1664 pin: "PinIcon", 1665 time: "TimeIcon", 1666 dashboard: "DashboardIcon", 1667 timer: "TimerIcon", 1668 home: "HomeIcon", 1669 admin: "AdminIcon", 1670 info: "InfoIcon", 1671 question: "QuestionIcon", 1672 support: "SupportIcon", 1673 bug: "BugIcon", 1674 alert: "AlertIcon", 1675 alertalt: "AlertAltIcon", 1676 email: "EmailIcon", 1677 phone: "PhoneIcon", 1678 link: "LinkIcon", 1679 unlink: "LinkBrokenIcon", 1680 bell: "BellIcon", 1681 rss: "RSSIcon", 1682 sharealt: "ShareAltIcon", 1683 share: "ShareIcon", 1684 circle: "CircleIcon", 1685 circlehollow: "CircleHollowIcon", 1686 diamond: "DiamondIcon", 1687 bookmarkhollow: "BookmarkHollowIcon", 1688 bookmark: "BookmarkIcon", 1689 hearthollow: "HeartHollowIcon", 1690 heart: "HeartIcon", 1691 starhollow: "StarHollowIcon", 1692 star: "StarIcon", 1693 certificate: "CertificateIcon", 1694 verified: "VerifiedIcon", 1695 thumbsup: "ThumbsUpIcon", 1696 shield: "ShieldIcon", 1697 basket: "BasketIcon", 1698 beaker: "BeakerIcon", 1699 hourglass: "HourglassIcon", 1700 flag: "FlagIcon", 1701 gift: "GiftIcon", 1702 sticker: "StickerIcon", 1703 cloudhollow: "CloudHollowIcon", 1704 cloud: "CloudIcon", 1705 edit: "EditIcon", 1706 editor: "EditorIcon", 1707 cog: "CogIcon", 1708 nut: "NutIcon", 1709 wrench: "WrenchIcon", 1710 wand: "WandIcon", 1711 ellipsis: "EllipsisIcon", 1712 check: "CheckIcon", 1713 checklist: "ChecklistIcon", 1714 form: "FormIcon", 1715 batchdeny: "BatchDenyIcon", 1716 batchaccept: "BatchAcceptIcon", 1717 controls: "ControlsIcon", 1718 plus: "PlusIcon", 1719 closeAlt: "CloseAltIcon", 1720 cross: "CrossIcon", 1721 trash: "TrashIcon", 1722 pinalt: "PinAltIcon", 1723 unpin: "UnpinIcon", 1724 add: "AddIcon", 1725 subtract: "SubtractIcon", 1726 close: "CloseIcon", 1727 delete: "DeleteIcon", 1728 passed: "PassedIcon", 1729 changed: "ChangedIcon", 1730 failed: "FailedIcon", 1731 status: "StatusIcon", 1732 statuspass: "StatusPassIcon", 1733 statusfail: "StatusFailIcon", 1734 statuswarn: "StatusWarnIcon", 1735 statusnew: "StatusNewIcon", 1736 clear: "ClearIcon", 1737 sweep: "SweepIcon", 1738 comment: "CommentIcon", 1739 commentadd: "CommentAddIcon", 1740 requestchange: "RequestChangeIcon", 1741 comments: "CommentsIcon", 1742 chat: "ChatIcon", 1743 lock: "LockIcon", 1744 unlock: "UnlockIcon", 1745 key: "KeyIcon", 1746 command: "CommandIcon", 1747 outbox: "OutboxIcon", 1748 credit: "CreditIcon", 1749 button: "ButtonIcon", 1750 type: "TypeIcon", 1751 pointerdefault: "PointerDefaultIcon", 1752 pointerhand: "PointerHandIcon", 1753 browser: "BrowserIcon", 1754 tablet: "TabletIcon", 1755 mobile: "MobileIcon", 1756 watch: "WatchIcon", 1757 sidebar: "SidebarIcon", 1758 sidebaralt: "SidebarAltIcon", 1759 sidebaralttoggle: "SidebarAltToggleIcon", 1760 sidebartoggle: "SidebarToggleIcon", 1761 bottombar: "BottomBarIcon", 1762 bottombartoggle: "BottomBarToggleIcon", 1763 cpu: "CPUIcon", 1764 database: "DatabaseIcon", 1765 memory: "MemoryIcon", 1766 structure: "StructureIcon", 1767 box: "BoxIcon", 1768 power: "PowerIcon", 1769 photo: "PhotoIcon", 1770 component: "ComponentIcon", 1771 grid: "GridIcon", 1772 gridalt: "GridAltIcon", 1773 outline: "OutlineIcon", 1774 photodrag: "PhotoDragIcon", 1775 photostabilize: "PhotoStabilizeIcon", 1776 drag: "DragIcon", 1777 search: "SearchIcon", 1778 zoom: "ZoomIcon", 1779 zoomout: "ZoomOutIcon", 1780 zoomreset: "ZoomResetIcon", 1781 eye: "EyeIcon", 1782 eyeclose: "EyeCloseIcon", 1783 lightning: "LightningIcon", 1784 lightningoff: "LightningOffIcon", 1785 contrast: "ContrastIcon", 1786 contrastignored: "ContrastIgnoredIcon", 1787 switchalt: "SwitchAltIcon", 1788 mirror: "MirrorIcon", 1789 grow: "GrowIcon", 1790 paintbrush: "PaintBrushIcon", 1791 paintbrushalt: "PaintBrushAltIcon", 1792 ruler: "RulerIcon", 1793 stop: "StopIcon", 1794 camera: "CameraIcon", 1795 camerastabilize: "CameraStabilizeIcon", 1796 video: "VideoIcon", 1797 speaker: "SpeakerIcon", 1798 play: "PlayIcon", 1799 playback: "PlayBackIcon", 1800 playnext: "PlayNextIcon", 1801 playhollow: "PlayHollowIcon", 1802 playallhollow: "PlayAllHollowIcon", 1803 rewind: "RewindIcon", 1804 fastforward: "FastForwardIcon", 1805 stopalt: "StopAltIcon", 1806 stopalthollow: "StopAltHollowIcon", 1807 sidebyside: "SideBySideIcon", 1808 stacked: "StackedIcon", 1809 sun: "SunIcon", 1810 moon: "MoonIcon", 1811 book: "BookIcon", 1812 document: "DocumentIcon", 1813 copy: "CopyIcon", 1814 category: "CategoryIcon", 1815 folder: "FolderIcon", 1816 files: "FilesIcon", 1817 print: "PrintIcon", 1818 graphline: "GraphLineIcon", 1819 calendar: "CalendarIcon", 1820 graphbar: "GraphBarIcon", 1821 menu: "MenuIcon", 1822 menualt: "MenuIcon", 1823 filter: "FilterIcon", 1824 sortup: "SortUpIcon", 1825 sortdown: "SortDownIcon", 1826 docchart: "DocChartIcon", 1827 doclist: "DocListIcon", 1828 markup: "MarkupIcon", 1829 bold: "BoldIcon", 1830 italic: "ItalicIcon", 1831 alignleft: "AlignLeftIcon", 1832 alignright: "AlignRightIcon", 1833 paperclip: "PaperClipIcon", 1834 listordered: "ListOrderedIcon", 1835 listunordered: "ListUnorderedIcon", 1836 paragraph: "ParagraphIcon", 1837 markdown: "MarkdownIcon", 1838 repository: "RepoIcon", 1839 commit: "CommitIcon", 1840 branch: "BranchIcon", 1841 pullrequest: "PullRequestIcon", 1842 merge: "MergeIcon", 1843 apple: "AppleIcon", 1844 linux: "LinuxIcon", 1845 ubuntu: "UbuntuIcon", 1846 windows: "WindowsIcon", 1847 storybook: "StorybookIcon", 1848 azuredevops: "AzureDevOpsIcon", 1849 bitbucket: "BitbucketIcon", 1850 chrome: "ChromeIcon", 1851 chromatic: "ChromaticIcon", 1852 componentdriven: "ComponentDrivenIcon", 1853 discord: "DiscordIcon", 1854 facebook: "FacebookIcon", 1855 figma: "FigmaIcon", 1856 gdrive: "GDriveIcon", 1857 github: "GithubIcon", 1858 gitlab: "GitlabIcon", 1859 google: "GoogleIcon", 1860 graphql: "GraphqlIcon", 1861 linkedin: "LinkedinIcon", 1862 medium: "MediumIcon", 1863 redux: "ReduxIcon", 1864 twitter: "TwitterIcon", 1865 x: "XIcon", 1866 youtube: "YoutubeIcon", 1867 vscode: "VSCodeIcon" 1868}; 1869 1870// src/toolbar/utils/get-selected.ts 1871var getSelectedItem = ({ currentValue, items }) => items.find((item) => item.value === currentValue && item.type !== "reset"); 1872 1873// src/toolbar/constants.ts 1874var TOOLBAR_ID = "toolbar"; 1875 1876// src/toolbar/utils/register-shortcuts.ts 1877var registerShortcuts = async (api, id, shortcuts) => { 1878 shortcuts.next && await api.setAddonShortcut(TOOLBAR_ID, { 1879 label: shortcuts.next.label, 1880 defaultShortcut: shortcuts.next.keys, 1881 actionName: `${id}:next`, 1882 action: shortcuts.next.action 1883 }), shortcuts.previous && await api.setAddonShortcut(TOOLBAR_ID, { 1884 label: shortcuts.previous.label, 1885 defaultShortcut: shortcuts.previous.keys, 1886 actionName: `${id}:previous`, 1887 action: shortcuts.previous.action 1888 }), shortcuts.reset && await api.setAddonShortcut(TOOLBAR_ID, { 1889 label: shortcuts.reset.label, 1890 defaultShortcut: shortcuts.reset.keys, 1891 actionName: `${id}:reset`, 1892 action: shortcuts.reset.action 1893 }); 1894}; 1895 1896// src/toolbar/components/ToolbarMenuSelect.tsx 1897var ToolbarMenuItemContainer = styled("div")({ 1898 width: "100%", 1899 display: "flex", 1900 alignItems: "center", 1901 gap: 8 1902}), ToolbarMenuItemMiddle = styled("div")({ 1903 flex: 1 1904}), ToolbarMenuSelect = ({ 1905 id, 1906 name, 1907 description, 1908 toolbar: { 1909 icon: _icon, 1910 items, 1911 title: _title, 1912 preventDynamicIcon, 1913 dynamicTitle = !0, 1914 shortcuts 1915 } 1916}) => { 1917 let api = useStorybookApi(), [globals, updateGlobals, storyGlobals] = useGlobals(), currentValue = globals[id], isOverridden = id in storyGlobals, icon = _icon, title2 = _title; 1918 preventDynamicIcon || (icon = getSelectedItem({ currentValue, items })?.icon || icon), dynamicTitle && (title2 = getSelectedItem({ currentValue, items })?.title || title2), !title2 && !icon && console.warn(`Toolbar '${name}' has no title or icon`); 1919 let resetItem = items.find((item) => item.type === "reset"), resetLabel = resetItem?.title, options2 = react_default.useMemo( 1920 () => items.filter((item) => item.type === "item").map((item) => { 1921 let itemTitle = item.title ?? item.value ?? "Untitled", iconComponent = !item.hideIcon && item.icon ? react_default.createElement(Icons, { icon: item.icon, __suppressDeprecationWarning: !0 }) : void 0; 1922 return item.right ? { 1923 title: itemTitle, 1924 value: item.value, 1925 children: react_default.createElement(ToolbarMenuItemContainer, null, iconComponent, react_default.createElement(ToolbarMenuItemMiddle, null, item.title ?? item.value), item.right) 1926 } : { 1927 title: itemTitle, 1928 value: item.value, 1929 icon: iconComponent 1930 }; 1931 }), 1932 [items] 1933 ); 1934 react_default.useEffect(() => { 1935 if (shortcuts) { 1936 let length = options2.length; 1937 registerShortcuts(api, id, { 1938 next: { 1939 ...shortcuts.next, 1940 action: () => { 1941 let idx = options2.findIndex((i2) => i2.value === globals[id]), nextIdx = idx < 0 ? 0 : (idx + 1) % length; 1942 updateGlobals({ [id]: options2[nextIdx].value }); 1943 } 1944 }, 1945 previous: { 1946 ...shortcuts.previous, 1947 action: () => { 1948 let idx = options2.findIndex((i2) => i2.value === globals[id]), previousIdx = idx < 0 ? length - 1 : (idx + length - 1) % length; 1949 updateGlobals({ [id]: options2[previousIdx].value }); 1950 } 1951 }, 1952 reset: { 1953 ...shortcuts.reset, 1954 action: () => { 1955 updateGlobals({ [id]: void 0 }); 1956 } 1957 } 1958 }); 1959 } 1960 }, [api, id, shortcuts, globals, options2, updateGlobals]); 1961 let ariaLabel = description || title2 || name || id; 1962 return react_default.createElement( 1963 Select, 1964 { 1965 defaultOptions: [currentValue], 1966 options: options2, 1967 disabled: isOverridden, 1968 ariaLabel, 1969 tooltip: ariaLabel, 1970 resetLabel, 1971 onReset: resetItem ? () => updateGlobals({ [id]: resetItem?.value }) : void 0, 1972 onSelect: (selected) => updateGlobals({ [id]: selected }), 1973 icon: icon && react_default.createElement(Icons, { icon, __suppressDeprecationWarning: !0 }), 1974 showSelectedOptionTitle: dynamicTitle 1975 }, 1976 title2 1977 ); 1978}; 1979 1980// src/toolbar/components/ToolbarManager.tsx 1981var ToolbarManager = () => { 1982 let globalTypes = useGlobalTypes(); 1983 return Object.keys(globalTypes).some((id) => !!globalTypes[id].toolbar) ? react_default.createElement(react_default.Fragment, null, react_default.createElement(Separator, null), Object.keys(globalTypes).map((id) => { 1984 let normalizedArgType = normalizeArgType(id, globalTypes[id]); 1985 return normalizedArgType && react_default.createElement(ToolbarMenuSelect, { key: id, id, ...normalizedArgType }); 1986 })) : null; 1987}; 1988 1989// src/manager/index.tsx 1990init_react(); 1991 1992// global-externals:react-dom/client 1993var client_default = __REACT_DOM_CLIENT__, { createRoot, hydrateRoot } = __REACT_DOM_CLIENT__; 1994 1995// global-externals:storybook/internal/manager-errors 1996var manager_errors_default = __STORYBOOK_CORE_EVENTS_MANAGER_ERRORS__, { Category, OpenServiceStaticSnapshotInvalidError, OpenServiceStaticSnapshotLoadError, ProviderDoesNotExtendBaseProviderError, StatusTypeIdMismatchError, UncaughtManagerError, UniversalStoreFollowerTimeoutError } = __STORYBOOK_CORE_EVENTS_MANAGER_ERRORS__; 1997 1998// global-externals:storybook/internal/router 1999var router_default = __STORYBOOK_ROUTER__, { BaseLocationProvider, DEEPLY_EQUAL, Link: Link2, Location, LocationProvider, Match, MemoryRouter, Route, buildArgsParam, deepDiff, getMatch, parsePath, queryFromLocation, stringifyQuery, useNavigate } = __STORYBOOK_ROUTER__; 2000 2001// ../../node_modules/react-helmet-async/lib/index.module.js 2002init_react(); 2003var import_prop_types = __toESM(require_prop_types()), import_react_fast_compare = __toESM(require_react_fast_compare()), import_invariant = __toESM(require_browser()), import_shallowequal = __toESM(require_shallowequal()); 2004function a() { 2005 return a = Object.assign || function(t2) { 2006 for (var e2 = 1; e2 < arguments.length; e2++) { 2007 var r4 = arguments[e2]; 2008 for (var n3 in r4) Object.prototype.hasOwnProperty.call(r4, n3) && (t2[n3] = r4[n3]); 2009 } 2010 return t2; 2011 }, a.apply(this, arguments); 2012} 2013function s(t2, e2) { 2014 t2.prototype = Object.create(e2.prototype), t2.prototype.constructor = t2, c(t2, e2); 2015} 2016function c(t2, e2) { 2017 return c = Object.setPrototypeOf || function(t3, e3) { 2018 return t3.__proto__ = e3, t3; 2019 }, c(t2, e2); 2020} 2021function u(t2, e2) { 2022 if (t2 == null) return {}; 2023 var r4, n3, i2 = {}, o3 = Object.keys(t2); 2024 for (n3 = 0; n3 < o3.length; n3++) e2.indexOf(r4 = o3[n3]) >= 0 || (i2[r4] = t2[r4]); 2025 return i2; 2026} 2027var l = { BASE: "base", BODY: "body", HEAD: "head", HTML: "html", LINK: "link", META: "meta", NOSCRIPT: "noscript", SCRIPT: "script", STYLE: "style", TITLE: "title", FRAGMENT: "Symbol(react.fragment)" }, p = { rel: ["amphtml", "canonical", "alternate"] }, f = { type: ["application/ld+json"] }, d = { charset: "", name: ["robots", "description"], property: ["og:type", "og:title", "og:url", "og:image", "og:image:alt", "og:description", "twitter:url", "twitter:title", "twitter:description", "twitter:image", "twitter:image:alt", "twitter:card", "twitter:site"] }, h = Object.keys(l).map(function(t2) { 2028 return l[t2]; 2029}), m = { accesskey: "accessKey", charset: "charSet", class: "className", contenteditable: "contentEditable", contextmenu: "contextMenu", "http-equiv": "httpEquiv", itemprop: "itemProp", tabindex: "tabIndex" }, y = Object.keys(m).reduce(function(t2, e2) { 2030 return t2[m[e2]] = e2, t2; 2031}, {}), T = function(t2, e2) { 2032 for (var r4 = t2.length - 1; r4 >= 0; r4 -= 1) { 2033 var n3 = t2[r4]; 2034 if (Object.prototype.hasOwnProperty.call(n3, e2)) return n3[e2]; 2035 } 2036 return null; 2037}, g = function(t2) { 2038 var e2 = T(t2, l.TITLE), r4 = T(t2, "titleTemplate"); 2039 if (Array.isArray(e2) && (e2 = e2.join("")), r4 && e2) return r4.replace(/%s/g, function() { 2040 return e2; 2041 }); 2042 var n3 = T(t2, "defaultTitle"); 2043 return e2 || n3 || void 0; 2044}, b = function(t2) { 2045 return T(t2, "onChangeClientState") || function() { 2046 }; 2047}, v = function(t2, e2) { 2048 return e2.filter(function(e3) { 2049 return e3[t2] !== void 0; 2050 }).map(function(e3) { 2051 return e3[t2]; 2052 }).reduce(function(t3, e3) { 2053 return a({}, t3, e3); 2054 }, {}); 2055}, A2 = function(t2, e2) { 2056 return e2.filter(function(t3) { 2057 return t3[l.BASE] !== void 0; 2058 }).map(function(t3) { 2059 return t3[l.BASE]; 2060 }).reverse().reduce(function(e3, r4) { 2061 if (!e3.length) for (var n3 = Object.keys(r4), i2 = 0; i2 < n3.length; i2 += 1) { 2062 var o3 = n3[i2].toLowerCase(); 2063 if (t2.indexOf(o3) !== -1 && r4[o3]) return e3.concat(r4); 2064 } 2065 return e3; 2066 }, []); 2067}, C = function(t2, e2, r4) { 2068 var n3 = {}; 2069 return r4.filter(function(e3) { 2070 return !!Array.isArray(e3[t2]) || (e3[t2] !== void 0 && console && typeof console.warn == "function" && console.warn("Helmet: " + t2 + ' should be of type "Array". Instead found type "' + typeof e3[t2] + '"'), !1); 2071 }).map(function(e3) { 2072 return e3[t2]; 2073 }).reverse().reduce(function(t3, r5) { 2074 var i2 = {}; 2075 r5.filter(function(t4) { 2076 for (var r6, o4 = Object.keys(t4), a2 = 0; a2 < o4.length; a2 += 1) { 2077 var s3 = o4[a2], c3 = s3.toLowerCase(); 2078 e2.indexOf(c3) === -1 || r6 === "rel" && t4[r6].toLowerCase() === "canonical" || c3 === "rel" && t4[c3].toLowerCase() === "stylesheet" || (r6 = c3), e2.indexOf(s3) === -1 || s3 !== "innerHTML" && s3 !== "cssText" && s3 !== "itemprop" || (r6 = s3); 2079 } 2080 if (!r6 || !t4[r6]) return !1; 2081 var u3 = t4[r6].toLowerCase(); 2082 return n3[r6] || (n3[r6] = {}), i2[r6] || (i2[r6] = {}), !n3[r6][u3] && (i2[r6][u3] = !0, !0); 2083 }).reverse().forEach(function(e3) { 2084 return t3.push(e3); 2085 }); 2086 for (var o3 = Object.keys(i2), s2 = 0; s2 < o3.length; s2 += 1) { 2087 var c2 = o3[s2], u2 = a({}, n3[c2], i2[c2]); 2088 n3[c2] = u2; 2089 } 2090 return t3; 2091 }, []).reverse(); 2092}, O = function(t2, e2) { 2093 if (Array.isArray(t2) && t2.length) { 2094 for (var r4 = 0; r4 < t2.length; r4 += 1) if (t2[r4][e2]) return !0; 2095 } 2096 return !1; 2097}, S = function(t2) { 2098 return Array.isArray(t2) ? t2.join("") : t2; 2099}, E = function(t2, e2) { 2100 return Array.isArray(t2) ? t2.reduce(function(t3, r4) { 2101 return (function(t4, e3) { 2102 for (var r5 = Object.keys(t4), n3 = 0; n3 < r5.length; n3 += 1) if (e3[r5[n3]] && e3[r5[n3]].includes(t4[r5[n3]])) return !0; 2103 return !1; 2104 })(r4, e2) ? t3.priority.push(r4) : t3.default.push(r4), t3; 2105 }, { priority: [], default: [] }) : { default: t2 }; 2106}, I = function(t2, e2) { 2107 var r4; 2108 return a({}, t2, ((r4 = {})[e2] = void 0, r4)); 2109}, P2 = [l.NOSCRIPT, l.SCRIPT, l.STYLE], w = function(t2, e2) { 2110 return e2 === void 0 && (e2 = !0), e2 === !1 ? String(t2) : String(t2).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'"); 2111}, x = function(t2) { 2112 return Object.keys(t2).reduce(function(e2, r4) { 2113 var n3 = t2[r4] !== void 0 ? r4 + '="' + t2[r4] + '"' : "" + r4; 2114 return e2 ? e2 + " " + n3 : n3; 2115 }, ""); 2116}, L = function(t2, e2) { 2117 return e2 === void 0 && (e2 = {}), Object.keys(t2).reduce(function(e3, r4) { 2118 return e3[m[r4] || r4] = t2[r4], e3; 2119 }, e2); 2120}, j = function(e2, r4) { 2121 return r4.map(function(r5, n3) { 2122 var i2, o3 = ((i2 = { key: n3 })["data-rh"] = !0, i2); 2123 return Object.keys(r5).forEach(function(t2) { 2124 var e3 = m[t2] || t2; 2125 e3 === "innerHTML" || e3 === "cssText" ? o3.dangerouslySetInnerHTML = { __html: r5.innerHTML || r5.cssText } : o3[e3] = r5[t2]; 2126 }), react_default.createElement(e2, o3); 2127 }); 2128}, M = function(e2, r4, n3) { 2129 switch (e2) { 2130 case l.TITLE: 2131 return { toComponent: function() { 2132 return n4 = r4.titleAttributes, (i2 = { key: e3 = r4.title })["data-rh"] = !0, o3 = L(n4, i2), [react_default.createElement(l.TITLE, o3, e3)]; 2133 var e3, n4, i2, o3; 2134 }, toString: function() { 2135 return (function(t2, e3, r5, n4) { 2136 var i2 = x(r5), o3 = S(e3); 2137 return i2 ? "<" + t2 + ' data-rh="true" ' + i2 + ">" + w(o3, n4) + "</" + t2 + ">" : "<" + t2 + ' data-rh="true">' + w(o3, n4) + "</" + t2 + ">"; 2138 })(e2, r4.title, r4.titleAttributes, n3); 2139 } }; 2140 case "bodyAttributes": 2141 case "htmlAttributes": 2142 return { toComponent: function() { 2143 return L(r4); 2144 }, toString: function() { 2145 return x(r4); 2146 } }; 2147 default: 2148 return { toComponent: function() { 2149 return j(e2, r4); 2150 }, toString: function() { 2151 return (function(t2, e3, r5) { 2152 return e3.reduce(function(e4, n4) { 2153 var i2 = Object.keys(n4).filter(function(t3) { 2154 return !(t3 === "innerHTML" || t3 === "cssText"); 2155 }).reduce(function(t3, e5) { 2156 var i3 = n4[e5] === void 0 ? e5 : e5 + '="' + w(n4[e5], r5) + '"'; 2157 return t3 ? t3 + " " + i3 : i3; 2158 }, ""), o3 = n4.innerHTML || n4.cssText || "", a2 = P2.indexOf(t2) === -1; 2159 return e4 + "<" + t2 + ' data-rh="true" ' + i2 + (a2 ? "/>" : ">" + o3 + "</" + t2 + ">"); 2160 }, ""); 2161 })(e2, r4, n3); 2162 } }; 2163 } 2164}, k = function(t2) { 2165 var e2 = t2.baseTag, r4 = t2.bodyAttributes, n3 = t2.encode, i2 = t2.htmlAttributes, o3 = t2.noscriptTags, a2 = t2.styleTags, s2 = t2.title, c2 = s2 === void 0 ? "" : s2, u2 = t2.titleAttributes, h2 = t2.linkTags, m2 = t2.metaTags, y2 = t2.scriptTags, T3 = { toComponent: function() { 2166 }, toString: function() { 2167 return ""; 2168 } }; 2169 if (t2.prioritizeSeoTags) { 2170 var g2 = (function(t3) { 2171 var e3 = t3.linkTags, r5 = t3.scriptTags, n4 = t3.encode, i3 = E(t3.metaTags, d), o4 = E(e3, p), a3 = E(r5, f); 2172 return { priorityMethods: { toComponent: function() { 2173 return [].concat(j(l.META, i3.priority), j(l.LINK, o4.priority), j(l.SCRIPT, a3.priority)); 2174 }, toString: function() { 2175 return M(l.META, i3.priority, n4) + " " + M(l.LINK, o4.priority, n4) + " " + M(l.SCRIPT, a3.priority, n4); 2176 } }, metaTags: i3.default, linkTags: o4.default, scriptTags: a3.default }; 2177 })(t2); 2178 T3 = g2.priorityMethods, h2 = g2.linkTags, m2 = g2.metaTags, y2 = g2.scriptTags; 2179 } 2180 return { priority: T3, base: M(l.BASE, e2, n3), bodyAttributes: M("bodyAttributes", r4, n3), htmlAttributes: M("htmlAttributes", i2, n3), link: M(l.LINK, h2, n3), meta: M(l.META, m2, n3), noscript: M(l.NOSCRIPT, o3, n3), script: M(l.SCRIPT, y2, n3), style: M(l.STYLE, a2, n3), title: M(l.TITLE, { title: c2, titleAttributes: u2 }, n3) }; 2181}, H = [], N = function(t2, e2) { 2182 var r4 = this; 2183 e2 === void 0 && (e2 = typeof document < "u"), this.instances = [], this.value = { setHelmet: function(t3) { 2184 r4.context.helmet = t3; 2185 }, helmetInstances: { get: function() { 2186 return r4.canUseDOM ? H : r4.instances; 2187 }, add: function(t3) { 2188 (r4.canUseDOM ? H : r4.instances).push(t3); 2189 }, remove: function(t3) { 2190 var e3 = (r4.canUseDOM ? H : r4.instances).indexOf(t3); 2191 (r4.canUseDOM ? H : r4.instances).splice(e3, 1); 2192 } } }, this.context = t2, this.canUseDOM = e2, e2 || (t2.helmet = k({ baseTag: [], bodyAttributes: {}, encodeSpecialCharacters: !0, htmlAttributes: {}, linkTags: [], metaTags: [], noscriptTags: [], scriptTags: [], styleTags: [], title: "", titleAttributes: {} })); 2193}, R = react_default.createContext({}), D = import_prop_types.default.shape({ setHelmet: import_prop_types.default.func, helmetInstances: import_prop_types.default.shape({ get: import_prop_types.default.func, add: import_prop_types.default.func, remove: import_prop_types.default.func }) }), U = typeof document < "u", q = (function(e2) { 2194 function r4(t2) { 2195 var n3; 2196 return (n3 = e2.call(this, t2) || this).helmetData = new N(n3.props.context, r4.canUseDOM), n3; 2197 } 2198 return s(r4, e2), r4.prototype.render = function() { 2199 return react_default.createElement(R.Provider, { value: this.helmetData.value }, this.props.children); 2200 }, r4; 2201})(Component); 2202q.canUseDOM = U, q.propTypes = { context: import_prop_types.default.shape({ helmet: import_prop_types.default.shape() }), children: import_prop_types.default.node.isRequired }, q.defaultProps = { context: {} }, q.displayName = "HelmetProvider"; 2203var Y = function(t2, e2) { 2204 var r4, n3 = document.head || document.querySelector(l.HEAD), i2 = n3.querySelectorAll(t2 + "[data-rh]"), o3 = [].slice.call(i2), a2 = []; 2205 return e2 && e2.length && e2.forEach(function(e3) { 2206 var n4 = document.createElement(t2); 2207 for (var i3 in e3) Object.prototype.hasOwnProperty.call(e3, i3) && (i3 === "innerHTML" ? n4.innerHTML = e3.innerHTML : i3 === "cssText" ? n4.styleSheet ? n4.styleSheet.cssText = e3.cssText : n4.appendChild(document.createTextNode(e3.cssText)) : n4.setAttribute(i3, e3[i3] === void 0 ? "" : e3[i3])); 2208 n4.setAttribute("data-rh", "true"), o3.some(function(t3, e4) { 2209 return r4 = e4, n4.isEqualNode(t3); 2210 }) ? o3.splice(r4, 1) : a2.push(n4); 2211 }), o3.forEach(function(t3) { 2212 return t3.parentNode.removeChild(t3); 2213 }), a2.forEach(function(t3) { 2214 return n3.appendChild(t3); 2215 }), { oldTags: o3, newTags: a2 }; 2216}, B = function(t2, e2) { 2217 var r4 = document.getElementsByTagName(t2)[0]; 2218 if (r4) { 2219 for (var n3 = r4.getAttribute("data-rh"), i2 = n3 ? n3.split(",") : [], o3 = [].concat(i2), a2 = Object.keys(e2), s2 = 0; s2 < a2.length; s2 += 1) { 2220 var c2 = a2[s2], u2 = e2[c2] || ""; 2221 r4.getAttribute(c2) !== u2 && r4.setAttribute(c2, u2), i2.indexOf(c2) === -1 && i2.push(c2); 2222 var l3 = o3.indexOf(c2); 2223 l3 !== -1 && o3.splice(l3, 1); 2224 } 2225 for (var p2 = o3.length - 1; p2 >= 0; p2 -= 1) r4.removeAttribute(o3[p2]); 2226 i2.length === o3.length ? r4.removeAttribute("data-rh") : r4.getAttribute("data-rh") !== a2.join(",") && r4.setAttribute("data-rh", a2.join(",")); 2227 } 2228}, K = function(t2, e2) { 2229 var r4 = t2.baseTag, n3 = t2.htmlAttributes, i2 = t2.linkTags, o3 = t2.metaTags, a2 = t2.noscriptTags, s2 = t2.onChangeClientState, c2 = t2.scriptTags, u2 = t2.styleTags, p2 = t2.title, f2 = t2.titleAttributes; 2230 B(l.BODY, t2.bodyAttributes), B(l.HTML, n3), (function(t3, e3) { 2231 t3 !== void 0 && document.title !== t3 && (document.title = S(t3)), B(l.TITLE, e3); 2232 })(p2, f2); 2233 var d2 = { baseTag: Y(l.BASE, r4), linkTags: Y(l.LINK, i2), metaTags: Y(l.META, o3), noscriptTags: Y(l.NOSCRIPT, a2), scriptTags: Y(l.SCRIPT, c2), styleTags: Y(l.STYLE, u2) }, h2 = {}, m2 = {}; 2234 Object.keys(d2).forEach(function(t3) { 2235 var e3 = d2[t3], r5 = e3.newTags, n4 = e3.oldTags; 2236 r5.length && (h2[t3] = r5), n4.length && (m2[t3] = d2[t3].oldTags); 2237 }), e2 && e2(), s2(t2, h2, m2); 2238}, _ = null, z = (function(t2) { 2239 function e2() { 2240 for (var e3, r5 = arguments.length, n3 = new Array(r5), i2 = 0; i2 < r5; i2++) n3[i2] = arguments[i2]; 2241 return (e3 = t2.call.apply(t2, [this].concat(n3)) || this).rendered = !1, e3; 2242 } 2243 s(e2, t2); 2244 var r4 = e2.prototype; 2245 return r4.shouldComponentUpdate = function(t3) { 2246 return !(0, import_shallowequal.default)(t3, this.props); 2247 }, r4.componentDidUpdate = function() { 2248 this.emitChange(); 2249 }, r4.componentWillUnmount = function() { 2250 this.props.context.helmetInstances.remove(this), this.emitChange(); 2251 }, r4.emitChange = function() { 2252 var t3, e3, r5 = this.props.context, n3 = r5.setHelmet, i2 = null, o3 = (t3 = r5.helmetInstances.get().map(function(t4) { 2253 var e4 = a({}, t4.props); 2254 return delete e4.context, e4; 2255 }), { baseTag: A2(["href"], t3), bodyAttributes: v("bodyAttributes", t3), defer: T(t3, "defer"), encode: T(t3, "encodeSpecialCharacters"), htmlAttributes: v("htmlAttributes", t3), linkTags: C(l.LINK, ["rel", "href"], t3), metaTags: C(l.META, ["name", "charset", "http-equiv", "property", "itemprop"], t3), noscriptTags: C(l.NOSCRIPT, ["innerHTML"], t3), onChangeClientState: b(t3), scriptTags: C(l.SCRIPT, ["src", "innerHTML"], t3), styleTags: C(l.STYLE, ["cssText"], t3), title: g(t3), titleAttributes: v("titleAttributes", t3), prioritizeSeoTags: O(t3, "prioritizeSeoTags") }); 2256 q.canUseDOM ? (e3 = o3, _ && cancelAnimationFrame(_), e3.defer ? _ = requestAnimationFrame(function() { 2257 K(e3, function() { 2258 _ = null; 2259 }); 2260 }) : (K(e3), _ = null)) : k && (i2 = k(o3)), n3(i2); 2261 }, r4.init = function() { 2262 this.rendered || (this.rendered = !0, this.props.context.helmetInstances.add(this), this.emitChange()); 2263 }, r4.render = function() { 2264 return this.init(), null; 2265 }, e2; 2266})(Component); 2267z.propTypes = { context: D.isRequired }, z.displayName = "HelmetDispatcher"; 2268var F = ["children"], G = ["children"], W = (function(e2) { 2269 function r4() { 2270 return e2.apply(this, arguments) || this; 2271 } 2272 s(r4, e2); 2273 var o3 = r4.prototype; 2274 return o3.shouldComponentUpdate = function(t2) { 2275 return !(0, import_react_fast_compare.default)(I(this.props, "helmetData"), I(t2, "helmetData")); 2276 }, o3.mapNestedChildrenToProps = function(t2, e3) { 2277 if (!e3) return null; 2278 switch (t2.type) { 2279 case l.SCRIPT: 2280 case l.NOSCRIPT: 2281 return { innerHTML: e3 }; 2282 case l.STYLE: 2283 return { cssText: e3 }; 2284 default: 2285 throw new Error("<" + t2.type + " /> elements are self-closing and can not contain children. Refer to our API for more information."); 2286 } 2287 }, o3.flattenArrayTypeChildren = function(t2) { 2288 var e3, r5 = t2.child, n3 = t2.arrayTypeChildren; 2289 return a({}, n3, ((e3 = {})[r5.type] = [].concat(n3[r5.type] || [], [a({}, t2.newChildProps, this.mapNestedChildrenToProps(r5, t2.nestedChildren))]), e3)); 2290 }, o3.mapObjectTypeChildren = function(t2) { 2291 var e3, r5, n3 = t2.child, i2 = t2.newProps, o4 = t2.newChildProps, s2 = t2.nestedChildren; 2292 switch (n3.type) { 2293 case l.TITLE: 2294 return a({}, i2, ((e3 = {})[n3.type] = s2, e3.titleAttributes = a({}, o4), e3)); 2295 case l.BODY: 2296 return a({}, i2, { bodyAttributes: a({}, o4) }); 2297 case l.HTML: 2298 return a({}, i2, { htmlAttributes: a({}, o4) }); 2299 default: 2300 return a({}, i2, ((r5 = {})[n3.type] = a({}, o4), r5)); 2301 } 2302 }, o3.mapArrayTypeChildrenToProps = function(t2, e3) { 2303 var r5 = a({}, e3); 2304 return Object.keys(t2).forEach(function(e4) { 2305 var n3; 2306 r5 = a({}, r5, ((n3 = {})[e4] = t2[e4], n3)); 2307 }), r5; 2308 }, o3.warnOnInvalidChildren = function(t2, e3) { 2309 return (0, import_invariant.default)(h.some(function(e4) { 2310 return t2.type === e4; 2311 }), typeof t2.type == "function" ? "You may be attempting to nest <Helmet> components within each other, which is not allowed. Refer to our API for more information." : "Only elements types " + h.join(", ") + " are allowed. Helmet does not support rendering <" + t2.type + "> elements. Refer to our API for more information."), (0, import_invariant.default)(!e3 || typeof e3 == "string" || Array.isArray(e3) && !e3.some(function(t3) { 2312 return typeof t3 != "string"; 2313 }), "Helmet expects a string as a child of <" + t2.type + ">. Did you forget to wrap your children in braces? ( <" + t2.type + ">{``}</" + t2.type + "> ) Refer to our API for more information."), !0; 2314 }, o3.mapChildrenToProps = function(e3, r5) { 2315 var n3 = this, i2 = {}; 2316 return react_default.Children.forEach(e3, function(t2) { 2317 if (t2 && t2.props) { 2318 var e4 = t2.props, o4 = e4.children, a2 = u(e4, F), s2 = Object.keys(a2).reduce(function(t3, e5) { 2319 return t3[y[e5] || e5] = a2[e5], t3; 2320 }, {}), c2 = t2.type; 2321 switch (typeof c2 == "symbol" ? c2 = c2.toString() : n3.warnOnInvalidChildren(t2, o4), c2) { 2322 case l.FRAGMENT: 2323 r5 = n3.mapChildrenToProps(o4, r5); 2324 break; 2325 case l.LINK: 2326 case l.META: 2327 case l.NOSCRIPT: 2328 case l.SCRIPT: 2329 case l.STYLE: 2330 i2 = n3.flattenArrayTypeChildren({ child: t2, arrayTypeChildren: i2, newChildProps: s2, nestedChildren: o4 }); 2331 break; 2332 default: 2333 r5 = n3.mapObjectTypeChildren({ child: t2, newProps: r5, newChildProps: s2, nestedChildren: o4 }); 2334 } 2335 } 2336 }), this.mapArrayTypeChildrenToProps(i2, r5); 2337 }, o3.render = function() { 2338 var e3 = this.props, r5 = e3.children, n3 = u(e3, G), i2 = a({}, n3), o4 = n3.helmetData; 2339 return r5 && (i2 = this.mapChildrenToProps(r5, i2)), !o4 || o4 instanceof N || (o4 = new N(o4.context, o4.instances)), o4 ? react_default.createElement(z, a({}, i2, { context: o4.value, helmetData: void 0 })) : react_default.createElement(R.Consumer, null, function(e4) { 2340 return react_default.createElement(z, a({}, i2, { context: e4 })); 2341 }); 2342 }, r4; 2343})(Component); 2344W.propTypes = { base: import_prop_types.default.object, bodyAttributes: import_prop_types.default.object, children: import_prop_types.default.oneOfType([import_prop_types.default.arrayOf(import_prop_types.default.node), import_prop_types.default.node]), defaultTitle: import_prop_types.default.string, defer: import_prop_types.default.bool, encodeSpecialCharacters: import_prop_types.default.bool, htmlAttributes: import_prop_types.default.object, link: import_prop_types.default.arrayOf(import_prop_types.default.object), meta: import_prop_types.default.arrayOf(import_prop_types.default.object), noscript: import_prop_types.default.arrayOf(import_prop_types.default.object), onChangeClientState: import_prop_types.default.func, script: import_prop_types.default.arrayOf(import_prop_types.default.object), style: import_prop_types.default.arrayOf(import_prop_types.default.object), title: import_prop_types.default.string, titleAttributes: import_prop_types.default.object, titleTemplate: import_prop_types.default.string, prioritizeSeoTags: import_prop_types.default.bool, helmetData: import_prop_types.default.object }, W.defaultProps = { defer: !0, encodeSpecialCharacters: !0, prioritizeSeoTags: !1 }, W.displayName = "Helmet"; 2345 2346// src/manager/App.tsx 2347init_react(); 2348 2349// src/shared/review/features.ts 2350var isReviewFeatureEnabled = (features) => features?.experimentalReview !== !1 && !!features?.changeDetection; 2351 2352// src/manager/components/error-boundary/ManagerErrorBoundary.tsx 2353init_react(); 2354 2355// ../../node_modules/@babel/runtime/helpers/esm/extends.js 2356function _extends() { 2357 return _extends = Object.assign ? Object.assign.bind() : function(n3) { 2358 for (var e2 = 1; e2 < arguments.length; e2++) { 2359 var t2 = arguments[e2]; 2360 for (var r4 in t2) ({}).hasOwnProperty.call(t2, r4) && (n3[r4] = t2[r4]); 2361 } 2362 return n3; 2363 }, _extends.apply(null, arguments); 2364} 2365 2366// ../../node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js 2367function _assertThisInitialized(e2) { 2368 if (e2 === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 2369 return e2; 2370} 2371 2372// ../../node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js 2373function _setPrototypeOf(t2, e2) { 2374 return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t3, e3) { 2375 return t3.__proto__ = e3, t3; 2376 }, _setPrototypeOf(t2, e2); 2377} 2378 2379// ../../node_modules/@babel/runtime/helpers/esm/inheritsLoose.js 2380function _inheritsLoose(t2, o3) { 2381 t2.prototype = Object.create(o3.prototype), t2.prototype.constructor = t2, _setPrototypeOf(t2, o3); 2382} 2383 2384// ../../node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js 2385function _getPrototypeOf(t2) { 2386 return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t3) { 2387 return t3.__proto__ || Object.getPrototypeOf(t3); 2388 }, _getPrototypeOf(t2); 2389} 2390 2391// ../../node_modules/@babel/runtime/helpers/esm/isNativeFunction.js 2392function _isNativeFunction(t2) { 2393 try { 2394 return Function.toString.call(t2).indexOf("[native code]") !== -1; 2395 } catch { 2396 return typeof t2 == "function"; 2397 } 2398} 2399 2400// ../../node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js 2401function _isNativeReflectConstruct() { 2402 try { 2403 var t2 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() { 2404 })); 2405 } catch { 2406 } 2407 return (_isNativeReflectConstruct = function() { 2408 return !!t2; 2409 })(); 2410} 2411 2412// ../../node_modules/@babel/runtime/helpers/esm/construct.js 2413function _construct(t2, e2, r4) { 2414 if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments); 2415 var o3 = [null]; 2416 o3.push.apply(o3, e2); 2417 var p2 = new (t2.bind.apply(t2, o3))(); 2418 return r4 && _setPrototypeOf(p2, r4.prototype), p2; 2419} 2420 2421// ../../node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js 2422function _wrapNativeSuper(t2) { 2423 var r4 = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0; 2424 return _wrapNativeSuper = function(t3) { 2425 if (t3 === null || !_isNativeFunction(t3)) return t3; 2426 if (typeof t3 != "function") throw new TypeError("Super expression must either be null or a function"); 2427 if (r4 !== void 0) { 2428 if (r4.has(t3)) return r4.get(t3); 2429 r4.set(t3, Wrapper8); 2430 } 2431 function Wrapper8() { 2432 return _construct(t3, arguments, _getPrototypeOf(this).constructor); 2433 } 2434 return Wrapper8.prototype = Object.create(t3.prototype, { 2435 constructor: { 2436 value: Wrapper8, 2437 enumerable: !1, 2438 writable: !0, 2439 configurable: !0 2440 } 2441 }), _setPrototypeOf(Wrapper8, t3); 2442 }, _wrapNativeSuper(t2); 2443} 2444 2445// ../../node_modules/polished/dist/polished.esm.js 2446var PolishedError = (function(_Error) { 2447 _inheritsLoose(PolishedError2, _Error); 2448 function PolishedError2(code) { 2449 var _this; 2450 if (1) 2451 _this = _Error.call(this, "An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#" + code + " for more information.") || this; 2452 else 2453 for (var _len2, args, _key2; _key2 < _len2; _key2++) 2454 ; 2455 return _assertThisInitialized(_this); 2456 } 2457 return PolishedError2; 2458})(_wrapNativeSuper(Error)); 2459function endsWith(string, suffix) { 2460 return string.substr(-suffix.length) === suffix; 2461} 2462var cssRegex$1 = /^([+-]?(?:\d+|\d*\.\d+))([a-z]*|%)$/; 2463function stripUnit(value) { 2464 if (typeof value != "string") return value; 2465 var matchedValue = value.match(cssRegex$1); 2466 return matchedValue ? parseFloat(value) : value; 2467} 2468var pxtoFactory = function(to) { 2469 return function(pxval, base) { 2470 base === void 0 && (base = "16px"); 2471 var newPxval = pxval, newBase = base; 2472 if (typeof pxval == "string") { 2473 if (!endsWith(pxval, "px")) 2474 throw new PolishedError(69, to, pxval); 2475 newPxval = stripUnit(pxval); 2476 } 2477 if (typeof base == "string") { 2478 if (!endsWith(base, "px")) 2479 throw new PolishedError(70, to, base); 2480 newBase = stripUnit(base); 2481 } 2482 if (typeof newPxval == "string") 2483 throw new PolishedError(71, pxval, to); 2484 if (typeof newBase == "string") 2485 throw new PolishedError(72, base, to); 2486 return "" + newPxval / newBase + to; 2487 }; 2488}, pixelsto = pxtoFactory, em = pixelsto("em"); 2489var rem = pixelsto("rem"); 2490function colorToInt(color2) { 2491 return Math.round(color2 * 255); 2492} 2493function convertToInt(red, green, blue) { 2494 return colorToInt(red) + "," + colorToInt(green) + "," + colorToInt(blue); 2495} 2496function hslToRgb(hue, saturation, lightness, convert2) { 2497 if (convert2 === void 0 && (convert2 = convertToInt), saturation === 0) 2498 return convert2(lightness, lightness, lightness); 2499 var huePrime = (hue % 360 + 360) % 360 / 60, chroma = (1 - Math.abs(2 * lightness - 1)) * saturation, secondComponent = chroma * (1 - Math.abs(huePrime % 2 - 1)), red = 0, green = 0, blue = 0; 2500 huePrime >= 0 && huePrime < 1 ? (red = chroma, green = secondComponent) : huePrime >= 1 && huePrime < 2 ? (red = secondComponent, green = chroma) : huePrime >= 2 && huePrime < 3 ? (green = chroma, blue = secondComponent) : huePrime >= 3 && huePrime < 4 ? (green = secondComponent, blue = chroma) : huePrime >= 4 && huePrime < 5 ? (red = secondComponent, blue = chroma) : huePrime >= 5 && huePrime < 6 && (red = chroma, blue = secondComponent); 2501 var lightnessModification = lightness - chroma / 2, finalRed = red + lightnessModification, finalGreen = green + lightnessModification, finalBlue = blue + lightnessModification; 2502 return convert2(finalRed, finalGreen, finalBlue); 2503} 2504var namedColorMap = { 2505 aliceblue: "f0f8ff", 2506 antiquewhite: "faebd7", 2507 aqua: "00ffff", 2508 aquamarine: "7fffd4", 2509 azure: "f0ffff", 2510 beige: "f5f5dc", 2511 bisque: "ffe4c4", 2512 black: "000", 2513 blanchedalmond: "ffebcd", 2514 blue: "0000ff", 2515 blueviolet: "8a2be2", 2516 brown: "a52a2a", 2517 burlywood: "deb887", 2518 cadetblue: "5f9ea0", 2519 chartreuse: "7fff00", 2520 chocolate: "d2691e", 2521 coral: "ff7f50", 2522 cornflowerblue: "6495ed", 2523 cornsilk: "fff8dc", 2524 crimson: "dc143c", 2525 cyan: "00ffff", 2526 darkblue: "00008b", 2527 darkcyan: "008b8b", 2528 darkgoldenrod: "b8860b", 2529 darkgray: "a9a9a9", 2530 darkgreen: "006400", 2531 darkgrey: "a9a9a9", 2532 darkkhaki: "bdb76b", 2533 darkmagenta: "8b008b", 2534 darkolivegreen: "556b2f", 2535 darkorange: "ff8c00", 2536 darkorchid: "9932cc", 2537 darkred: "8b0000", 2538 darksalmon: "e9967a", 2539 darkseagreen: "8fbc8f", 2540 darkslateblue: "483d8b", 2541 darkslategray: "2f4f4f", 2542 darkslategrey: "2f4f4f", 2543 darkturquoise: "00ced1", 2544 darkviolet: "9400d3", 2545 deeppink: "ff1493", 2546 deepskyblue: "00bfff", 2547 dimgray: "696969", 2548 dimgrey: "696969", 2549 dodgerblue: "1e90ff", 2550 firebrick: "b22222", 2551 floralwhite: "fffaf0", 2552 forestgreen: "228b22", 2553 fuchsia: "ff00ff", 2554 gainsboro: "dcdcdc", 2555 ghostwhite: "f8f8ff", 2556 gold: "ffd700", 2557 goldenrod: "daa520", 2558 gray: "808080", 2559 green: "008000", 2560 greenyellow: "adff2f", 2561 grey: "808080", 2562 honeydew: "f0fff0", 2563 hotpink: "ff69b4", 2564 indianred: "cd5c5c", 2565 indigo: "4b0082", 2566 ivory: "fffff0", 2567 khaki: "f0e68c", 2568 lavender: "e6e6fa", 2569 lavenderblush: "fff0f5", 2570 lawngreen: "7cfc00", 2571 lemonchiffon: "fffacd", 2572 lightblue: "add8e6", 2573 lightcoral: "f08080", 2574 lightcyan: "e0ffff", 2575 lightgoldenrodyellow: "fafad2", 2576 lightgray: "d3d3d3", 2577 lightgreen: "90ee90", 2578 lightgrey: "d3d3d3", 2579 lightpink: "ffb6c1", 2580 lightsalmon: "ffa07a", 2581 lightseagreen: "20b2aa", 2582 lightskyblue: "87cefa", 2583 lightslategray: "789", 2584 lightslategrey: "789", 2585 lightsteelblue: "b0c4de", 2586 lightyellow: "ffffe0", 2587 lime: "0f0", 2588 limegreen: "32cd32", 2589 linen: "faf0e6", 2590 magenta: "f0f", 2591 maroon: "800000", 2592 mediumaquamarine: "66cdaa", 2593 mediumblue: "0000cd", 2594 mediumorchid: "ba55d3", 2595 mediumpurple: "9370db", 2596 mediumseagreen: "3cb371", 2597 mediumslateblue: "7b68ee", 2598 mediumspringgreen: "00fa9a", 2599 mediumturquoise: "48d1cc", 2600 mediumvioletred: "c71585", 2601 midnightblue: "191970", 2602 mintcream: "f5fffa", 2603 mistyrose: "ffe4e1", 2604 moccasin: "ffe4b5", 2605 navajowhite: "ffdead", 2606 navy: "000080", 2607 oldlace: "fdf5e6", 2608 olive: "808000", 2609 olivedrab: "6b8e23", 2610 orange: "ffa500", 2611 orangered: "ff4500", 2612 orchid: "da70d6", 2613 palegoldenrod: "eee8aa", 2614 palegreen: "98fb98", 2615 paleturquoise: "afeeee", 2616 palevioletred: "db7093", 2617 papayawhip: "ffefd5", 2618 peachpuff: "ffdab9", 2619 peru: "cd853f", 2620 pink: "ffc0cb", 2621 plum: "dda0dd", 2622 powderblue: "b0e0e6", 2623 purple: "800080", 2624 rebeccapurple: "639", 2625 red: "f00", 2626 rosybrown: "bc8f8f", 2627 royalblue: "4169e1", 2628 saddlebrown: "8b4513", 2629 salmon: "fa8072", 2630 sandybrown: "f4a460", 2631 seagreen: "2e8b57", 2632 seashell: "fff5ee", 2633 sienna: "a0522d", 2634 silver: "c0c0c0", 2635 skyblue: "87ceeb", 2636 slateblue: "6a5acd", 2637 slategray: "708090", 2638 slategrey: "708090", 2639 snow: "fffafa", 2640 springgreen: "00ff7f", 2641 steelblue: "4682b4", 2642 tan: "d2b48c", 2643 teal: "008080", 2644 thistle: "d8bfd8", 2645 tomato: "ff6347", 2646 turquoise: "40e0d0", 2647 violet: "ee82ee", 2648 wheat: "f5deb3", 2649 white: "fff", 2650 whitesmoke: "f5f5f5", 2651 yellow: "ff0", 2652 yellowgreen: "9acd32" 2653}; 2654function nameToHex(color2) { 2655 if (typeof color2 != "string") return color2; 2656 var normalizedColorName = color2.toLowerCase(); 2657 return namedColorMap[normalizedColorName] ? "#" + namedColorMap[normalizedColorName] : color2; 2658} 2659var hexRegex = /^#[a-fA-F0-9]{6}$/, hexRgbaRegex = /^#[a-fA-F0-9]{8}$/, reducedHexRegex = /^#[a-fA-F0-9]{3}$/, reducedRgbaHexRegex = /^#[a-fA-F0-9]{4}$/, rgbRegex = /^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i, rgbaRegex = /^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i, hslRegex = /^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i, hslaRegex = /^hsl(?:a)?\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i; 2660function parseToRgb(color2) { 2661 if (typeof color2 != "string") 2662 throw new PolishedError(3); 2663 var normalizedColor = nameToHex(color2); 2664 if (normalizedColor.match(hexRegex)) 2665 return { 2666 red: parseInt("" + normalizedColor[1] + normalizedColor[2], 16), 2667 green: parseInt("" + normalizedColor[3] + normalizedColor[4], 16), 2668 blue: parseInt("" + normalizedColor[5] + normalizedColor[6], 16) 2669 }; 2670 if (normalizedColor.match(hexRgbaRegex)) { 2671 var alpha = parseFloat((parseInt("" + normalizedColor[7] + normalizedColor[8], 16) / 255).toFixed(2)); 2672 return { 2673 red: parseInt("" + normalizedColor[1] + normalizedColor[2], 16), 2674 green: parseInt("" + normalizedColor[3] + normalizedColor[4], 16), 2675 blue: parseInt("" + normalizedColor[5] + normalizedColor[6], 16), 2676 alpha 2677 }; 2678 } 2679 if (normalizedColor.match(reducedHexRegex)) 2680 return { 2681 red: parseInt("" + normalizedColor[1] + normalizedColor[1], 16), 2682 green: parseInt("" + normalizedColor[2] + normalizedColor[2], 16), 2683 blue: parseInt("" + normalizedColor[3] + normalizedColor[3], 16) 2684 }; 2685 if (normalizedColor.match(reducedRgbaHexRegex)) { 2686 var _alpha = parseFloat((parseInt("" + normalizedColor[4] + normalizedColor[4], 16) / 255).toFixed(2)); 2687 return { 2688 red: parseInt("" + normalizedColor[1] + normalizedColor[1], 16), 2689 green: parseInt("" + normalizedColor[2] + normalizedColor[2], 16), 2690 blue: parseInt("" + normalizedColor[3] + normalizedColor[3], 16), 2691 alpha: _alpha 2692 }; 2693 } 2694 var rgbMatched = rgbRegex.exec(normalizedColor); 2695 if (rgbMatched) 2696 return { 2697 red: parseInt("" + rgbMatched[1], 10), 2698 green: parseInt("" + rgbMatched[2], 10), 2699 blue: parseInt("" + rgbMatched[3], 10) 2700 }; 2701 var rgbaMatched = rgbaRegex.exec(normalizedColor.substring(0, 50)); 2702 if (rgbaMatched) 2703 return { 2704 red: parseInt("" + rgbaMatched[1], 10), 2705 green: parseInt("" + rgbaMatched[2], 10), 2706 blue: parseInt("" + rgbaMatched[3], 10), 2707 alpha: parseFloat("" + rgbaMatched[4]) > 1 ? parseFloat("" + rgbaMatched[4]) / 100 : parseFloat("" + rgbaMatched[4]) 2708 }; 2709 var hslMatched = hslRegex.exec(normalizedColor); 2710 if (hslMatched) { 2711 var hue = parseInt("" + hslMatched[1], 10), saturation = parseInt("" + hslMatched[2], 10) / 100, lightness = parseInt("" + hslMatched[3], 10) / 100, rgbColorString = "rgb(" + hslToRgb(hue, saturation, lightness) + ")", hslRgbMatched = rgbRegex.exec(rgbColorString); 2712 if (!hslRgbMatched) 2713 throw new PolishedError(4, normalizedColor, rgbColorString); 2714 return { 2715 red: parseInt("" + hslRgbMatched[1], 10), 2716 green: parseInt("" + hslRgbMatched[2], 10), 2717 blue: parseInt("" + hslRgbMatched[3], 10) 2718 }; 2719 } 2720 var hslaMatched = hslaRegex.exec(normalizedColor.substring(0, 50)); 2721 if (hslaMatched) { 2722 var _hue = parseInt("" + hslaMatched[1], 10), _saturation = parseInt("" + hslaMatched[2], 10) / 100, _lightness = parseInt("" + hslaMatched[3], 10) / 100, _rgbColorString = "rgb(" + hslToRgb(_hue, _saturation, _lightness) + ")", _hslRgbMatched = rgbRegex.exec(_rgbColorString); 2723 if (!_hslRgbMatched) 2724 throw new PolishedError(4, normalizedColor, _rgbColorString); 2725 return { 2726 red: parseInt("" + _hslRgbMatched[1], 10), 2727 green: parseInt("" + _hslRgbMatched[2], 10), 2728 blue: parseInt("" + _hslRgbMatched[3], 10), 2729 alpha: parseFloat("" + hslaMatched[4]) > 1 ? parseFloat("" + hslaMatched[4]) / 100 : parseFloat("" + hslaMatched[4]) 2730 }; 2731 } 2732 throw new PolishedError(5); 2733} 2734function rgbToHsl(color2) { 2735 var red = color2.red / 255, green = color2.green / 255, blue = color2.blue / 255, max = Math.max(red, green, blue), min = Math.min(red, green, blue), lightness = (max + min) / 2; 2736 if (max === min) 2737 return color2.alpha !== void 0 ? { 2738 hue: 0, 2739 saturation: 0, 2740 lightness, 2741 alpha: color2.alpha 2742 } : { 2743 hue: 0, 2744 saturation: 0, 2745 lightness 2746 }; 2747 var hue, delta = max - min, saturation = lightness > 0.5 ? delta / (2 - max - min) : delta / (max + min); 2748 switch (max) { 2749 case red: 2750 hue = (green - blue) / delta + (green < blue ? 6 : 0); 2751 break; 2752 case green: 2753 hue = (blue - red) / delta + 2; 2754 break; 2755 default: 2756 hue = (red - green) / delta + 4; 2757 break; 2758 } 2759 return hue *= 60, color2.alpha !== void 0 ? { 2760 hue, 2761 saturation, 2762 lightness, 2763 alpha: color2.alpha 2764 } : { 2765 hue, 2766 saturation, 2767 lightness 2768 }; 2769} 2770function parseToHsl(color2) { 2771 return rgbToHsl(parseToRgb(color2)); 2772} 2773var reduceHexValue = function(value) { 2774 return value.length === 7 && value[1] === value[2] && value[3] === value[4] && value[5] === value[6] ? "#" + value[1] + value[3] + value[5] : value; 2775}, reduceHexValue$1 = reduceHexValue; 2776function numberToHex(value) { 2777 var hex = value.toString(16); 2778 return hex.length === 1 ? "0" + hex : hex; 2779} 2780function colorToHex(color2) { 2781 return numberToHex(Math.round(color2 * 255)); 2782} 2783function convertToHex(red, green, blue) { 2784 return reduceHexValue$1("#" + colorToHex(red) + colorToHex(green) + colorToHex(blue)); 2785} 2786function hslToHex(hue, saturation, lightness) { 2787 return hslToRgb(hue, saturation, lightness, convertToHex); 2788} 2789function hsl(value, saturation, lightness) { 2790 if (typeof value == "number" && typeof saturation == "number" && typeof lightness == "number") 2791 return hslToHex(value, saturation, lightness); 2792 if (typeof value == "object" && saturation === void 0 && lightness === void 0) 2793 return hslToHex(value.hue, value.saturation, value.lightness); 2794 throw new PolishedError(1); 2795} 2796function hsla(value, saturation, lightness, alpha) { 2797 if (typeof value == "number" && typeof saturation == "number" && typeof lightness == "number" && typeof alpha == "number") 2798 return alpha >= 1 ? hslToHex(value, saturation, lightness) : "rgba(" + hslToRgb(value, saturation, lightness) + "," + alpha + ")"; 2799 if (typeof value == "object" && saturation === void 0 && lightness === void 0 && alpha === void 0) 2800 return value.alpha >= 1 ? hslToHex(value.hue, value.saturation, value.lightness) : "rgba(" + hslToRgb(value.hue, value.saturation, value.lightness) + "," + value.alpha + ")"; 2801 throw new PolishedError(2); 2802} 2803function rgb(value, green, blue) { 2804 if (typeof value == "number" && typeof green == "number" && typeof blue == "number") 2805 return reduceHexValue$1("#" + numberToHex(value) + numberToHex(green) + numberToHex(blue)); 2806 if (typeof value == "object" && green === void 0 && blue === void 0) 2807 return reduceHexValue$1("#" + numberToHex(value.red) + numberToHex(value.green) + numberToHex(value.blue)); 2808 throw new PolishedError(6); 2809} 2810function rgba(firstValue, secondValue, thirdValue, fourthValue) { 2811 if (typeof firstValue == "string" && typeof secondValue == "number") { 2812 var rgbValue = parseToRgb(firstValue); 2813 return "rgba(" + rgbValue.red + "," + rgbValue.green + "," + rgbValue.blue + "," + secondValue + ")"; 2814 } else { 2815 if (typeof firstValue == "number" && typeof secondValue == "number" && typeof thirdValue == "number" && typeof fourthValue == "number") 2816 return fourthValue >= 1 ? rgb(firstValue, secondValue, thirdValue) : "rgba(" + firstValue + "," + secondValue + "," + thirdValue + "," + fourthValue + ")"; 2817 if (typeof firstValue == "object" && secondValue === void 0 && thirdValue === void 0 && fourthValue === void 0) 2818 return firstValue.alpha >= 1 ? rgb(firstValue.red, firstValue.green, firstValue.blue) : "rgba(" + firstValue.red + "," + firstValue.green + "," + firstValue.blue + "," + firstValue.alpha + ")"; 2819 } 2820 throw new PolishedError(7); 2821} 2822var isRgb = function(color2) { 2823 return typeof color2.red == "number" && typeof color2.green == "number" && typeof color2.blue == "number" && (typeof color2.alpha != "number" || typeof color2.alpha > "u"); 2824}, isRgba = function(color2) { 2825 return typeof color2.red == "number" && typeof color2.green == "number" && typeof color2.blue == "number" && typeof color2.alpha == "number"; 2826}, isHsl = function(color2) { 2827 return typeof color2.hue == "number" && typeof color2.saturation == "number" && typeof color2.lightness == "number" && (typeof color2.alpha != "number" || typeof color2.alpha > "u"); 2828}, isHsla = function(color2) { 2829 return typeof color2.hue == "number" && typeof color2.saturation == "number" && typeof color2.lightness == "number" && typeof color2.alpha == "number"; 2830}; 2831function toColorString(color2) { 2832 if (typeof color2 != "object") throw new PolishedError(8); 2833 if (isRgba(color2)) return rgba(color2); 2834 if (isRgb(color2)) return rgb(color2); 2835 if (isHsla(color2)) return hsla(color2); 2836 if (isHsl(color2)) return hsl(color2); 2837 throw new PolishedError(8); 2838} 2839function curried(f2, length, acc) { 2840 return function() { 2841 var combined = acc.concat(Array.prototype.slice.call(arguments)); 2842 return combined.length >= length ? f2.apply(this, combined) : curried(f2, length, combined); 2843 }; 2844} 2845function curry(f2) { 2846 return curried(f2, f2.length, []); 2847} 2848function adjustHue(degree, color2) { 2849 if (color2 === "transparent") return color2; 2850 var hslColor = parseToHsl(color2); 2851 return toColorString(_extends({}, hslColor, { 2852 hue: hslColor.hue + parseFloat(degree) 2853 })); 2854} 2855var curriedAdjustHue = curry(adjustHue); 2856function guard(lowerBoundary, upperBoundary, value) { 2857 return Math.max(lowerBoundary, Math.min(upperBoundary, value)); 2858} 2859function darken2(amount, color2) { 2860 if (color2 === "transparent") return color2; 2861 var hslColor = parseToHsl(color2); 2862 return toColorString(_extends({}, hslColor, { 2863 lightness: guard(0, 1, hslColor.lightness - parseFloat(amount)) 2864 })); 2865} 2866var curriedDarken = curry(darken2), curriedDarken$1 = curriedDarken; 2867function desaturate(amount, color2) { 2868 if (color2 === "transparent") return color2; 2869 var hslColor = parseToHsl(color2); 2870 return toColorString(_extends({}, hslColor, { 2871 saturation: guard(0, 1, hslColor.saturation - parseFloat(amount)) 2872 })); 2873} 2874var curriedDesaturate = curry(desaturate); 2875function lighten2(amount, color2) { 2876 if (color2 === "transparent") return color2; 2877 var hslColor = parseToHsl(color2); 2878 return toColorString(_extends({}, hslColor, { 2879 lightness: guard(0, 1, hslColor.lightness + parseFloat(amount)) 2880 })); 2881} 2882var curriedLighten = curry(lighten2), curriedLighten$1 = curriedLighten; 2883function mix(weight, color2, otherColor) { 2884 if (color2 === "transparent") return otherColor; 2885 if (otherColor === "transparent") return color2; 2886 if (weight === 0) return otherColor; 2887 var parsedColor1 = parseToRgb(color2), color1 = _extends({}, parsedColor1, { 2888 alpha: typeof parsedColor1.alpha == "number" ? parsedColor1.alpha : 1 2889 }), parsedColor2 = parseToRgb(otherColor), color22 = _extends({}, parsedColor2, { 2890 alpha: typeof parsedColor2.alpha == "number" ? parsedColor2.alpha : 1 2891 }), alphaDelta = color1.alpha - color22.alpha, x2 = parseFloat(weight) * 2 - 1, y2 = x2 * alphaDelta === -1 ? x2 : x2 + alphaDelta, z2 = 1 + x2 * alphaDelta, weight1 = (y2 / z2 + 1) / 2, weight2 = 1 - weight1, mixedColor = { 2892 red: Math.floor(color1.red * weight1 + color22.red * weight2), 2893 green: Math.floor(color1.green * weight1 + color22.green * weight2), 2894 blue: Math.floor(color1.blue * weight1 + color22.blue * weight2), 2895 alpha: color1.alpha * parseFloat(weight) + color22.alpha * (1 - parseFloat(weight)) 2896 }; 2897 return rgba(mixedColor); 2898} 2899var curriedMix = curry(mix), mix$1 = curriedMix; 2900function opacify(amount, color2) { 2901 if (color2 === "transparent") return color2; 2902 var parsedColor = parseToRgb(color2), alpha = typeof parsedColor.alpha == "number" ? parsedColor.alpha : 1, colorWithAlpha = _extends({}, parsedColor, { 2903 alpha: guard(0, 1, (alpha * 100 + parseFloat(amount) * 100) / 100) 2904 }); 2905 return rgba(colorWithAlpha); 2906} 2907var curriedOpacify = curry(opacify); 2908function saturate(amount, color2) { 2909 if (color2 === "transparent") return color2; 2910 var hslColor = parseToHsl(color2); 2911 return toColorString(_extends({}, hslColor, { 2912 saturation: guard(0, 1, hslColor.saturation + parseFloat(amount)) 2913 })); 2914} 2915var curriedSaturate = curry(saturate); 2916function setHue(hue, color2) { 2917 return color2 === "transparent" ? color2 : toColorString(_extends({}, parseToHsl(color2), { 2918 hue: parseFloat(hue) 2919 })); 2920} 2921var curriedSetHue = curry(setHue); 2922function setLightness(lightness, color2) { 2923 return color2 === "transparent" ? color2 : toColorString(_extends({}, parseToHsl(color2), { 2924 lightness: parseFloat(lightness) 2925 })); 2926} 2927var curriedSetLightness = curry(setLightness); 2928function setSaturation(saturation, color2) { 2929 return color2 === "transparent" ? color2 : toColorString(_extends({}, parseToHsl(color2), { 2930 saturation: parseFloat(saturation) 2931 })); 2932} 2933var curriedSetSaturation = curry(setSaturation); 2934function shade(percentage, color2) { 2935 return color2 === "transparent" ? color2 : mix$1(parseFloat(percentage), "rgb(0, 0, 0)", color2); 2936} 2937var curriedShade = curry(shade); 2938function tint(percentage, color2) { 2939 return color2 === "transparent" ? color2 : mix$1(parseFloat(percentage), "rgb(255, 255, 255)", color2); 2940} 2941var curriedTint = curry(tint); 2942function transparentize(amount, color2) { 2943 if (color2 === "transparent") return color2; 2944 var parsedColor = parseToRgb(color2), alpha = typeof parsedColor.alpha == "number" ? parsedColor.alpha : 1, colorWithAlpha = _extends({}, parsedColor, { 2945 alpha: guard(0, 1, +(alpha * 100 - parseFloat(amount) * 100).toFixed(2) / 100) 2946 }); 2947 return rgba(colorWithAlpha); 2948} 2949var curriedTransparentize = curry(transparentize), curriedTransparentize$1 = curriedTransparentize; 2950 2951// src/manager/components/error-boundary/ManagerErrorBoundary.tsx 2952var Container = styled.div(({ theme }) => ({ 2953 display: "flex", 2954 justifyContent: "center", 2955 alignItems: "center", 2956 width: "100vw", 2957 height: "100vh", 2958 backgroundColor: theme.background.app, 2959 color: theme.color.defaultText, 2960 fontFamily: theme.typography.fonts.base 2961})), Content = styled.div(({ theme }) => ({ 2962 display: "flex", 2963 flexDirection: "column", 2964 justifyContent: "space-between", 2965 width: "80%", 2966 height: "80%", 2967 padding: 20, 2968 gap: 20, 2969 backgroundColor: theme.background.content, 2970 borderRadius: theme.appBorderRadius, 2971 border: `1px solid ${theme.color.negative}`, 2972 boxShadow: "0 0 64px rgba(0, 0, 0, 0.1)", 2973 overflow: "auto" 2974})), Info = styled.div(({ theme }) => ({ 2975 display: "flex", 2976 flexDirection: "column", 2977 alignItems: "start", 2978 gap: 15 2979})), Heading = styled.h1(({ theme }) => ({ 2980 display: "flex", 2981 alignItems: "center", 2982 margin: 0, 2983 gap: 10, 2984 fontSize: theme.typography.size.s2, 2985 fontWeight: theme.typography.weight.bold, 2986 color: theme.color.defaultText 2987})), SubHeading = styled.p(({ theme }) => ({ 2988 fontSize: theme.typography.size.s2, 2989 color: theme.textMutedColor, 2990 margin: 0, 2991 lineHeight: 1.4, 2992 textWrap: "balance" 2993})), ErrorWrapper = styled.div(({ theme }) => ({ 2994 display: "flex", 2995 flexDirection: "column-reverse", 2996 width: "100%", 2997 flex: "0 0 auto", 2998 border: `1px solid ${theme.appBorderColor}`, 2999 borderRadius: theme.appBorderRadius, 3000 pre: { 3001 borderRadius: 0 3002 } 3003})), CollapseToggle = styled.div(({ theme }) => ({ 3004 flex: "0 0 auto", 3005 display: "flex", 3006 alignItems: "center", 3007 gap: 10, 3008 height: 40, 3009 width: "100%", 3010 padding: "0 10px", 3011 cursor: "pointer", 3012 fontSize: theme.typography.size.s2, 3013 fontWeight: theme.typography.weight.bold, 3014 color: theme.color.defaultText, 3015 userSelect: "none", 3016 "&:hover": { 3017 backgroundColor: theme.base === "light" ? "rgba(0, 0, 0, 0.02)" : "rgba(255, 255, 255, 0.03)" 3018 }, 3019 svg: { 3020 color: theme.textMutedColor 3021 } 3022})), ErrorMessage = styled.pre(({ theme }) => ({ 3023 order: 1, 3024 padding: "11px 15px", 3025 margin: 0, 3026 fontSize: theme.typography.size.s1, 3027 color: theme.color.negativeText, 3028 backgroundColor: curriedTransparentize$1(theme.base === "light" ? 0.95 : 0.9, theme.color.negative), 3029 borderBottom: `1px solid ${theme.appBorderColor}`, 3030 whiteSpace: "pre-wrap", 3031 wordBreak: "break-word", 3032 fontFamily: theme.typography.fonts.mono, 3033 lineHeight: "18px" 3034})), ErrorStack = styled.pre(({ theme }) => ({ 3035 padding: 15, 3036 margin: 0, 3037 fontSize: theme.typography.size.s1, 3038 color: theme.textMutedColor, 3039 borderBottom: `1px solid ${theme.appBorderColor}`, 3040 borderRadius: 0, 3041 whiteSpace: "pre-wrap", 3042 wordBreak: "break-word", 3043 fontFamily: theme.typography.fonts.mono 3044})), ErrorFallback = ({ error, errorInfo }) => react_default.createElement(Container, { "data-testid": "manager-error-boundary" }, react_default.createElement(Content, null, react_default.createElement(Info, null, react_default.createElement(Heading, null, react_default.createElement(Badge, { status: "negative" }, "Error"), react_default.createElement("span", null, "Something went wrong")), react_default.createElement(SubHeading, null, "The Storybook Manager UI encountered an error. This is usually caused by custom addon code or configuration. Please check your browser console for more details. Try clearing browser storage if the issue persists."), react_default.createElement(Button, { asChild: !0, size: "medium" }, react_default.createElement("a", { href: window.location.origin + window.location.pathname.replace("iframe.html", "") }, react_default.createElement(SyncIcon, { size: 14 }), "Reload Storybook"))), react_default.createElement(ErrorWrapper, null, react_default.createElement(ErrorMessage, null, error.message || "Unknown error"), react_default.createElement( 3045 Collapsible, 3046 { 3047 collapsed: !0, 3048 summary: ({ isCollapsed, toggleCollapsed }) => react_default.createElement(CollapseToggle, { onClick: toggleCollapsed }, react_default.createElement(UnfoldIcon, null), isCollapsed ? "Expand error" : "Collapse error") 3049 }, 3050 (error.stack || errorInfo?.componentStack) && react_default.createElement(ErrorStack, null, error.stack, errorInfo?.componentStack && ` 3051 3052Component Stack:${errorInfo.componentStack}`) 3053)))), ManagerErrorBoundary = class extends Component { 3054 constructor(props) { 3055 super(props), this.state = { hasError: !1, error: null, errorInfo: null }; 3056 } 3057 static getDerivedStateFromError(error) { 3058 return { hasError: !0, error }; 3059 } 3060 componentDidCatch(error, errorInfo) { 3061 console.error("Storybook Manager UI Error:", error), console.error("Component Stack:", errorInfo.componentStack), this.setState({ errorInfo }), typeof globalThis.sendTelemetryError == "function" && globalThis.sendTelemetryError(error); 3062 } 3063 render() { 3064 let { hasError, error, errorInfo } = this.state, { children } = this.props; 3065 return hasError && error ? react_default.createElement(ErrorFallback, { error, errorInfo }) : children; 3066 } 3067}; 3068 3069// src/manager/components/layout/Layout.tsx 3070init_react(); 3071 3072// ../../node_modules/es-toolkit/dist/string/words.mjs 3073var CASE_SPLIT_PATTERN = new RegExp("\\p{Lu}?\\p{Ll}+|[0-9]+|\\p{Lu}+(?!\\p{Ll})|\\p{Emoji_Presentation}|\\p{Extended_Pictographic}|\\p{L}+", "gu"); 3074 3075// global-externals:storybook/theming/create 3076var create_default = __STORYBOOK_THEMING_CREATE__, { create: create2, themes: themes2 } = __STORYBOOK_THEMING_CREATE__; 3077 3078// src/shared/review/routes.ts 3079var REVIEW_COLLECTION_QUERY_PARAM = "collection", isReviewSummaryPath = (path) => path === "/review/" || path === "/review", isReviewCollectionStoryRoute = (path, customQueryParams) => !!path && path.startsWith("/story/") && customQueryParams?.[REVIEW_COLLECTION_QUERY_PARAM] !== void 0; 3080 3081// src/manager-api/modules/layout.ts 3082var { document: document2 } = scope; 3083var isPagesViewMode = (viewMode) => viewMode !== void 0 && viewMode !== "story" && viewMode !== "docs" && viewMode !== "review"; 3084var focusableUIElements = { 3085 addonPanel: "storybook-panel-region", 3086 storySearchField: "storybook-explorer-searchfield", 3087 storyListMenu: "storybook-explorer-menu", 3088 storyPanelRoot: "storybook-panel-root", 3089 showAddonPanel: "storybook-show-addon-panel", 3090 sidebarRegion: "storybook-sidebar-region", 3091 showSidebar: "storybook-show-sidebar" 3092}; 3093 3094// src/manager/constants.ts 3095var MEDIA_DESKTOP_BREAKPOINT = "@media (min-width: 600px)"; 3096 3097// src/manager/container/Notifications.tsx 3098init_react(); 3099 3100// src/manager/components/notifications/NotificationList.tsx 3101init_react(); 3102 3103// src/manager/components/layout/LayoutProvider.tsx 3104init_react(); 3105 3106// src/manager/hooks/useMedia.tsx 3107init_react(); 3108function useMediaQuery(query) { 3109 let getMatches = (queryMatch) => typeof window < "u" ? window.matchMedia(queryMatch).matches : !1, [matches, setMatches] = useState(getMatches(query)); 3110 function handleChange() { 3111 setMatches(getMatches(query)); 3112 } 3113 return useEffect(() => { 3114 let matchMedia = window.matchMedia(query); 3115 return handleChange(), matchMedia.addEventListener("change", handleChange), () => { 3116 matchMedia.removeEventListener("change", handleChange); 3117 }; 3118 }, [query]), matches; 3119} 3120 3121// src/manager/components/layout/LayoutProvider.tsx 3122var LayoutContext = createContext({ 3123 isMobileAboutOpen: !1, 3124 setMobileAboutOpen: () => { 3125 }, 3126 isMobilePanelOpen: !1, 3127 setMobilePanelOpen: () => { 3128 }, 3129 isDesktop: !1, 3130 isMobile: !1 3131}), LayoutProvider = ({ children, forceDesktop }) => { 3132 let [isMobileAboutOpen, setMobileAboutOpen] = useState(!1), [isMobilePanelOpen, setMobilePanelOpen] = useState(!1), isDesktop = forceDesktop ?? useMediaQuery(`(min-width: ${600}px)`), isMobile2 = !isDesktop, contextValue = useMemo( 3133 () => ({ 3134 isMobileAboutOpen, 3135 setMobileAboutOpen, 3136 isMobilePanelOpen, 3137 setMobilePanelOpen, 3138 isDesktop, 3139 isMobile: isMobile2 3140 }), 3141 [isMobileAboutOpen, isMobilePanelOpen, isDesktop, isMobile2] 3142 ); 3143 return react_default.createElement(LayoutContext.Provider, { value: contextValue }, children); 3144}, useLayout = () => useContext(LayoutContext); 3145 3146// src/manager/components/notifications/NotificationItem.tsx 3147init_react(); 3148var slideIn = keyframes({ 3149 "0%": { 3150 opacity: 0, 3151 transform: "translateY(30px)" 3152 }, 3153 "100%": { 3154 opacity: 1, 3155 transform: "translateY(0)" 3156 } 3157}), grow = keyframes({ 3158 "0%": { 3159 width: "0%" 3160 }, 3161 "100%": { 3162 width: "100%" 3163 } 3164}), Notification = styled.div( 3165 ({ theme }) => ({ 3166 position: "relative", 3167 display: "flex", 3168 border: `1px solid ${theme.appBorderColor}`, 3169 padding: "12px 6px 12px 12px", 3170 borderRadius: theme.appBorderRadius + 1, 3171 alignItems: "center", 3172 animation: `${slideIn} 500ms`, 3173 background: theme.base === "light" ? "hsla(203, 50%, 20%, .97)" : "hsla(203, 30%, 95%, .97)", 3174 boxShadow: "0 2px 5px 0 rgba(0, 0, 0, 0.05), 0 5px 15px 0 rgba(0, 0, 0, 0.1)", 3175 color: theme.color.inverseText, 3176 textDecoration: "none", 3177 overflow: "hidden", 3178 [MEDIA_DESKTOP_BREAKPOINT]: { 3179 boxShadow: `0 1px 2px 0 rgba(0, 0, 0, 0.05), 0px -5px 20px 10px ${theme.background.app}` 3180 } 3181 }), 3182 ({ duration, theme }) => duration && { 3183 "&::after": { 3184 content: '""', 3185 display: "block", 3186 position: "absolute", 3187 bottom: 0, 3188 left: 0, 3189 height: 3, 3190 background: theme.color.secondary, 3191 animation: `${grow} ${duration}ms linear forwards reverse` 3192 } 3193 } 3194), NotificationWithInteractiveStates = styled(Notification)({ 3195 cursor: "pointer", 3196 border: "none", 3197 outline: "none", 3198 textAlign: "left", 3199 transition: "all 150ms ease-out", 3200 transform: "translate3d(0, 0, 0)", 3201 "&:hover": { 3202 transform: "translate3d(0, -3px, 0)", 3203 boxShadow: "0 1px 3px 0 rgba(30,167,253,0.5), 0 2px 5px 0 rgba(0,0,0,0.05), 0 5px 15px 0 rgba(0,0,0,0.1)" 3204 }, 3205 "&:active": { 3206 transform: "translate3d(0, 0, 0)", 3207 boxShadow: "0 1px 3px 0 rgba(30,167,253,0.5), 0 2px 5px 0 rgba(0,0,0,0.05), 0 5px 15px 0 rgba(0,0,0,0.1)" 3208 }, 3209 "&:focus": { 3210 boxShadow: "rgba(2,156,253,1) 0 0 0 1px inset, 0 1px 3px 0 rgba(30,167,253,0.5), 0 2px 5px 0 rgba(0,0,0,0.05), 0 5px 15px 0 rgba(0,0,0,0.1)" 3211 } 3212}), NotificationButton = NotificationWithInteractiveStates.withComponent("div"), NotificationLink = NotificationWithInteractiveStates.withComponent(Link2), NotificationIconWrapper = styled.div({ 3213 display: "flex", 3214 marginRight: 10, 3215 alignItems: "center", 3216 svg: { 3217 width: 16, 3218 height: 16 3219 } 3220}), NotificationTextWrapper = styled.div(({ theme }) => ({ 3221 width: "100%", 3222 display: "flex", 3223 flexDirection: "column", 3224 color: theme.color.inverseText 3225})), Headline = styled.div(({ theme }) => ({ 3226 height: "100%", 3227 alignItems: "center", 3228 whiteSpace: "balance", 3229 overflow: "hidden", 3230 textOverflow: "ellipsis", 3231 fontSize: theme.typography.size.s1, 3232 lineHeight: "16px", 3233 fontWeight: theme.typography.weight.bold 3234})), SubHeadline = styled.div(({ theme }) => ({ 3235 color: curriedTransparentize$1(0.25, theme.color.inverseText), 3236 fontSize: theme.typography.size.s1 - 1, 3237 lineHeight: "14px", 3238 marginTop: 2, 3239 whiteSpace: "balance" 3240})), ItemContent = ({ 3241 icon, 3242 content: { headline, subHeadline } 3243}) => react_default.createElement(react_default.Fragment, null, !icon || react_default.createElement(NotificationIconWrapper, null, icon), react_default.createElement(NotificationTextWrapper, null, react_default.createElement(Headline, { title: headline }, headline), subHeadline && react_default.createElement(SubHeadline, null, subHeadline))), DismissButtonWrapper = styled(Button)(({ theme }) => ({ 3244 width: 28, 3245 alignSelf: "center", 3246 marginTop: 0, 3247 color: theme.base === "light" ? "rgba(255,255,255,0.7)" : " #999999" 3248})), DismissNotificationItem = ({ onDismiss }) => react_default.createElement( 3249 DismissButtonWrapper, 3250 { 3251 padding: "small", 3252 variant: "ghost", 3253 ariaLabel: "Dismiss notification", 3254 onClick: (e2) => { 3255 e2.preventDefault(), e2.stopPropagation(), onDismiss(); 3256 } 3257 }, 3258 react_default.createElement(CloseAltIcon, { size: 12 }) 3259), NotificationItemSpacer = styled.div({ 3260 height: 48 3261}), NotificationItem = ({ 3262 notification: { content, duration, link, onClear, onClick, id, icon }, 3263 onDismissNotification, 3264 zIndex 3265}) => { 3266 let onTimeout = useCallback(() => { 3267 onDismissNotification(id), onClear && onClear({ dismissed: !1, timeout: !0 }); 3268 }, [id, onDismissNotification, onClear]), timer = useRef(null); 3269 useEffect(() => { 3270 if (duration) 3271 return timer.current = setTimeout(onTimeout, duration), () => clearTimeout(timer.current); 3272 }, [duration, onTimeout]); 3273 let onDismiss = useCallback(() => { 3274 clearTimeout(timer.current), onDismissNotification(id), onClear && onClear({ dismissed: !0, timeout: !1 }); 3275 }, [id, onDismissNotification, onClear]); 3276 return link ? react_default.createElement(NotificationLink, { to: link, duration, style: { zIndex } }, react_default.createElement(ItemContent, { icon, content }), react_default.createElement(DismissNotificationItem, { onDismiss })) : onClick ? react_default.createElement( 3277 NotificationButton, 3278 { 3279 duration, 3280 onClick: () => onClick({ onDismiss }), 3281 style: { zIndex } 3282 }, 3283 react_default.createElement(ItemContent, { icon, content }), 3284 react_default.createElement(DismissNotificationItem, { onDismiss }) 3285 ) : react_default.createElement(Notification, { duration, style: { zIndex } }, react_default.createElement(ItemContent, { icon, content }), react_default.createElement(DismissNotificationItem, { onDismiss })); 3286}, NotificationItem_default = NotificationItem; 3287 3288// src/manager/components/notifications/NotificationList.tsx 3289var NotificationList = ({ 3290 notifications, 3291 clearNotification 3292}) => { 3293 let { isMobile: isMobile2 } = useLayout(); 3294 return react_default.createElement(List, { isMobile: isMobile2 }, notifications && notifications.map((notification, index) => react_default.createElement( 3295 NotificationItem_default, 3296 { 3297 key: notification.id, 3298 onDismissNotification: (id) => clearNotification(id), 3299 notification, 3300 zIndex: notifications.length - index 3301 } 3302 ))); 3303}, List = styled.div( 3304 { 3305 zIndex: 200, 3306 "> * + *": { 3307 marginTop: 12 3308 }, 3309 "&:empty": { 3310 display: "none" 3311 } 3312 }, 3313 ({ isMobile: isMobile2 }) => isMobile2 && { 3314 position: "fixed", 3315 bottom: 40, 3316 margin: 20 3317 } 3318); 3319 3320// src/manager/container/Notifications.tsx 3321var mapper = ({ state, api }) => ({ 3322 notifications: state.notifications, 3323 clearNotification: api.clearNotification 3324}), Notifications = (props) => react_default.createElement(Consumer, { filter: mapper }, (fromState) => react_default.createElement(NotificationList, { ...props, ...fromState })); 3325 3326// src/manager/components/mobile/navigation/MobileNavigation.tsx 3327init_react(); 3328 3329// ../../node_modules/@react-aria/utils/dist/useLayoutEffect.mjs 3330init_react(); 3331var $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c = typeof document < "u" ? react_default.useLayoutEffect : () => { 3332}; 3333 3334// ../../node_modules/@react-aria/utils/dist/useValueEffect.mjs 3335init_react(); 3336 3337// ../../node_modules/@react-aria/utils/dist/useId.mjs 3338init_react(); 3339 3340// ../../node_modules/@react-aria/ssr/dist/SSRProvider.mjs 3341init_react(); 3342var $b5e257d569688ac6$var$defaultContext = { 3343 prefix: String(Math.round(Math.random() * 1e10)), 3344 current: 0 3345}, $b5e257d569688ac6$var$SSRContext = react_default.createContext($b5e257d569688ac6$var$defaultContext), $b5e257d569688ac6$var$IsSSRContext = react_default.createContext(!1); 3346var $b5e257d569688ac6$var$canUseDOM = !!(typeof window < "u" && window.document && window.document.createElement), $b5e257d569688ac6$var$componentIds = /* @__PURE__ */ new WeakMap(); 3347function $b5e257d569688ac6$var$useCounter(isDisabled = !1) { 3348 let ctx = useContext($b5e257d569688ac6$var$SSRContext), ref = useRef(null); 3349 if (ref.current === null && !isDisabled) { 3350 var _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner, _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; 3351 let currentOwner = (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = react_default.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === void 0 || (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner = _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner === void 0 ? void 0 : _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner.current; 3352 if (currentOwner) { 3353 let prevComponentValue = $b5e257d569688ac6$var$componentIds.get(currentOwner); 3354 prevComponentValue == null ? $b5e257d569688ac6$var$componentIds.set(currentOwner, { 3355 id: ctx.current, 3356 state: currentOwner.memoizedState 3357 }) : currentOwner.memoizedState !== prevComponentValue.state && (ctx.current = prevComponentValue.id, $b5e257d569688ac6$var$componentIds.delete(currentOwner)); 3358 } 3359 ref.current = ++ctx.current; 3360 } 3361 return ref.current; 3362} 3363function $b5e257d569688ac6$var$useLegacySSRSafeId(defaultId) { 3364 let ctx = useContext($b5e257d569688ac6$var$SSRContext), counter = $b5e257d569688ac6$var$useCounter(!!defaultId), prefix = `react-aria${ctx.prefix}`; 3365 return defaultId || `${prefix}-${counter}`; 3366} 3367function $b5e257d569688ac6$var$useModernSSRSafeId(defaultId) { 3368 let id = react_default.useId(), [didSSR] = useState($b5e257d569688ac6$export$535bd6ca7f90a273()), prefix = didSSR ? "react-aria" : `react-aria${$b5e257d569688ac6$var$defaultContext.prefix}`; 3369 return defaultId || `${prefix}-${id}`; 3370} 3371var $b5e257d569688ac6$export$619500959fc48b26 = typeof react_default.useId == "function" ? $b5e257d569688ac6$var$useModernSSRSafeId : $b5e257d569688ac6$var$useLegacySSRSafeId; 3372function $b5e257d569688ac6$var$getSnapshot() { 3373 return !1; 3374} 3375function $b5e257d569688ac6$var$getServerSnapshot() { 3376 return !0; 3377} 3378function $b5e257d569688ac6$var$subscribe(onStoreChange) { 3379 return () => { 3380 }; 3381} 3382function $b5e257d569688ac6$export$535bd6ca7f90a273() { 3383 return typeof react_default.useSyncExternalStore == "function" ? react_default.useSyncExternalStore($b5e257d569688ac6$var$subscribe, $b5e257d569688ac6$var$getSnapshot, $b5e257d569688ac6$var$getServerSnapshot) : useContext($b5e257d569688ac6$var$IsSSRContext); 3384} 3385 3386// ../../node_modules/@react-aria/utils/dist/useId.mjs 3387var $bdb11010cef70236$var$canUseDOM = !!(typeof window < "u" && window.document && window.document.createElement), $bdb11010cef70236$export$d41a04c74483c6ef = /* @__PURE__ */ new Map(), $bdb11010cef70236$var$registry; 3388typeof FinalizationRegistry < "u" && ($bdb11010cef70236$var$registry = new FinalizationRegistry((heldValue) => { 3389 $bdb11010cef70236$export$d41a04c74483c6ef.delete(heldValue); 3390})); 3391function $bdb11010cef70236$export$f680877a34711e37(defaultId) { 3392 let [value, setValue] = useState(defaultId), nextId = useRef(null), res = $b5e257d569688ac6$export$619500959fc48b26(value), cleanupRef = useRef(null); 3393 if ($bdb11010cef70236$var$registry && $bdb11010cef70236$var$registry.register(cleanupRef, res), $bdb11010cef70236$var$canUseDOM) { 3394 let cacheIdRef = $bdb11010cef70236$export$d41a04c74483c6ef.get(res); 3395 cacheIdRef && !cacheIdRef.includes(nextId) ? cacheIdRef.push(nextId) : $bdb11010cef70236$export$d41a04c74483c6ef.set(res, [ 3396 nextId 3397 ]); 3398 } 3399 return $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => { 3400 let r4 = res; 3401 return () => { 3402 $bdb11010cef70236$var$registry && $bdb11010cef70236$var$registry.unregister(cleanupRef), $bdb11010cef70236$export$d41a04c74483c6ef.delete(r4); 3403 }; 3404 }, [ 3405 res 3406 ]), useEffect(() => { 3407 let newId = nextId.current; 3408 return newId && setValue(newId), () => { 3409 newId && (nextId.current = null); 3410 }; 3411 }), res; 3412} 3413function $bdb11010cef70236$export$cd8c9cb68f842629(idA, idB) { 3414 if (idA === idB) return idA; 3415 let setIdsA = $bdb11010cef70236$export$d41a04c74483c6ef.get(idA); 3416 if (setIdsA) 3417 return setIdsA.forEach((ref) => ref.current = idB), idB; 3418 let setIdsB = $bdb11010cef70236$export$d41a04c74483c6ef.get(idB); 3419 return setIdsB ? (setIdsB.forEach((ref) => ref.current = idA), idA) : idB; 3420} 3421 3422// ../../node_modules/@react-aria/utils/dist/chain.mjs 3423function $ff5963eb1fccf552$export$e08e3b67e392101e(...callbacks) { 3424 return (...args) => { 3425 for (let callback of callbacks) typeof callback == "function" && callback(...args); 3426 }; 3427} 3428 3429// ../../node_modules/@react-aria/utils/dist/domHelpers.mjs 3430var $431fbd86ca7dc216$export$b204af158042fbac = (el) => { 3431 var _el_ownerDocument; 3432 return (_el_ownerDocument = el?.ownerDocument) !== null && _el_ownerDocument !== void 0 ? _el_ownerDocument : document; 3433}, $431fbd86ca7dc216$export$f21a1ffae260145a = (el) => el && "window" in el && el.window === el ? el : $431fbd86ca7dc216$export$b204af158042fbac(el).defaultView || window; 3434function $431fbd86ca7dc216$var$isNode(value) { 3435 return value !== null && typeof value == "object" && "nodeType" in value && typeof value.nodeType == "number"; 3436} 3437function $431fbd86ca7dc216$export$af51f0f06c0f328a(node) { 3438 return $431fbd86ca7dc216$var$isNode(node) && node.nodeType === Node.DOCUMENT_FRAGMENT_NODE && "host" in node; 3439} 3440 3441// ../../node_modules/@react-stately/flags/dist/import.mjs 3442var $f4e2df6bd15f8569$var$_shadowDOM = !1; 3443function $f4e2df6bd15f8569$export$98658e8c59125e6a() { 3444 return $f4e2df6bd15f8569$var$_shadowDOM; 3445} 3446 3447// ../../node_modules/@react-aria/utils/dist/DOMFunctions.mjs 3448function $d4ee10de306f2510$export$4282f70798064fe0(node, otherNode) { 3449 if (!$f4e2df6bd15f8569$export$98658e8c59125e6a()) return otherNode && node ? node.contains(otherNode) : !1; 3450 if (!node || !otherNode) return !1; 3451 let currentNode = otherNode; 3452 for (; currentNode !== null; ) { 3453 if (currentNode === node) return !0; 3454 currentNode.tagName === "SLOT" && currentNode.assignedSlot ? currentNode = currentNode.assignedSlot.parentNode : $431fbd86ca7dc216$export$af51f0f06c0f328a(currentNode) ? currentNode = currentNode.host : currentNode = currentNode.parentNode; 3455 } 3456 return !1; 3457} 3458var $d4ee10de306f2510$export$cd4e5573fbe2b576 = (doc = document) => { 3459 var _activeElement_shadowRoot; 3460 if (!$f4e2df6bd15f8569$export$98658e8c59125e6a()) return doc.activeElement; 3461 let activeElement = doc.activeElement; 3462 for (; activeElement && "shadowRoot" in activeElement && (!((_activeElement_shadowRoot = activeElement.shadowRoot) === null || _activeElement_shadowRoot === void 0) && _activeElement_shadowRoot.activeElement); ) activeElement = activeElement.shadowRoot.activeElement; 3463 return activeElement; 3464}; 3465function $d4ee10de306f2510$export$e58f029f0fbfdb29(event) { 3466 return $f4e2df6bd15f8569$export$98658e8c59125e6a() && event.target.shadowRoot && event.composedPath ? event.composedPath()[0] : event.target; 3467} 3468 3469// ../../node_modules/clsx/dist/clsx.mjs 3470function r2(e2) { 3471 var t2, f2, n3 = ""; 3472 if (typeof e2 == "string" || typeof e2 == "number") n3 += e2; 3473 else if (typeof e2 == "object") if (Array.isArray(e2)) { 3474 var o3 = e2.length; 3475 for (t2 = 0; t2 < o3; t2++) e2[t2] && (f2 = r2(e2[t2])) && (n3 && (n3 += " "), n3 += f2); 3476 } else for (f2 in e2) e2[f2] && (n3 && (n3 += " "), n3 += f2); 3477 return n3; 3478} 3479function clsx() { 3480 for (var e2, t2, f2 = 0, n3 = "", o3 = arguments.length; f2 < o3; f2++) (e2 = arguments[f2]) && (t2 = r2(e2)) && (n3 && (n3 += " "), n3 += t2); 3481 return n3; 3482} 3483var clsx_default = clsx; 3484 3485// ../../node_modules/@react-aria/utils/dist/mergeProps.mjs 3486function $3ef42575df84b30b$export$9d1611c77c2fe928(...args) { 3487 let result = { 3488 ...args[0] 3489 }; 3490 for (let i2 = 1; i2 < args.length; i2++) { 3491 let props = args[i2]; 3492 for (let key in props) { 3493 let a2 = result[key], b2 = props[key]; 3494 typeof a2 == "function" && typeof b2 == "function" && // This is a lot faster than a regex. 3495 key[0] === "o" && key[1] === "n" && key.charCodeAt(2) >= /* 'A' */ 3496 65 && key.charCodeAt(2) <= /* 'Z' */ 3497 90 ? result[key] = $ff5963eb1fccf552$export$e08e3b67e392101e(a2, b2) : (key === "className" || key === "UNSAFE_className") && typeof a2 == "string" && typeof b2 == "string" ? result[key] = clsx_default(a2, b2) : key === "id" && a2 && b2 ? result.id = $bdb11010cef70236$export$cd8c9cb68f842629(a2, b2) : result[key] = b2 !== void 0 ? b2 : a2; 3498 } 3499 } 3500 return result; 3501} 3502 3503// ../../node_modules/@react-aria/utils/dist/mergeRefs.mjs 3504function $5dc95899b306f630$export$c9058316764c140e(...refs) { 3505 return refs.length === 1 && refs[0] ? refs[0] : (value) => { 3506 let hasCleanup = !1, cleanups = refs.map((ref) => { 3507 let cleanup = $5dc95899b306f630$var$setRef(ref, value); 3508 return hasCleanup || (hasCleanup = typeof cleanup == "function"), cleanup; 3509 }); 3510 if (hasCleanup) return () => { 3511 cleanups.forEach((cleanup, i2) => { 3512 typeof cleanup == "function" ? cleanup() : $5dc95899b306f630$var$setRef(refs[i2], null); 3513 }); 3514 }; 3515 }; 3516} 3517function $5dc95899b306f630$var$setRef(ref, value) { 3518 if (typeof ref == "function") return ref(value); 3519 ref != null && (ref.current = value); 3520} 3521 3522// ../../node_modules/@react-aria/utils/dist/filterDOMProps.mjs 3523var $65484d02dcb7eb3e$var$DOMPropNames = /* @__PURE__ */ new Set([ 3524 "id" 3525]), $65484d02dcb7eb3e$var$labelablePropNames = /* @__PURE__ */ new Set([ 3526 "aria-label", 3527 "aria-labelledby", 3528 "aria-describedby", 3529 "aria-details" 3530]), $65484d02dcb7eb3e$var$linkPropNames = /* @__PURE__ */ new Set([ 3531 "href", 3532 "hrefLang", 3533 "target", 3534 "rel", 3535 "download", 3536 "ping", 3537 "referrerPolicy" 3538]), $65484d02dcb7eb3e$var$globalAttrs = /* @__PURE__ */ new Set([ 3539 "dir", 3540 "lang", 3541 "hidden", 3542 "inert", 3543 "translate" 3544]), $65484d02dcb7eb3e$var$globalEvents = /* @__PURE__ */ new Set([ 3545 "onClick", 3546 "onAuxClick", 3547 "onContextMenu", 3548 "onDoubleClick", 3549 "onMouseDown", 3550 "onMouseEnter", 3551 "onMouseLeave", 3552 "onMouseMove", 3553 "onMouseOut", 3554 "onMouseOver", 3555 "onMouseUp", 3556 "onTouchCancel", 3557 "onTouchEnd", 3558 "onTouchMove", 3559 "onTouchStart", 3560 "onPointerDown", 3561 "onPointerMove", 3562 "onPointerUp", 3563 "onPointerCancel", 3564 "onPointerEnter", 3565 "onPointerLeave", 3566 "onPointerOver", 3567 "onPointerOut", 3568 "onGotPointerCapture", 3569 "onLostPointerCapture", 3570 "onScroll", 3571 "onWheel", 3572 "onAnimationStart", 3573 "onAnimationEnd", 3574 "onAnimationIteration", 3575 "onTransitionCancel", 3576 "onTransitionEnd", 3577 "onTransitionRun", 3578 "onTransitionStart" 3579]), $65484d02dcb7eb3e$var$propRe = /^(data-.*)$/; 3580function $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, opts = {}) { 3581 let { labelable, isLink, global: global2, events: events2 = global2, propNames } = opts, filteredProps = {}; 3582 for (let prop in props) Object.prototype.hasOwnProperty.call(props, prop) && ($65484d02dcb7eb3e$var$DOMPropNames.has(prop) || labelable && $65484d02dcb7eb3e$var$labelablePropNames.has(prop) || isLink && $65484d02dcb7eb3e$var$linkPropNames.has(prop) || global2 && $65484d02dcb7eb3e$var$globalAttrs.has(prop) || events2 && ($65484d02dcb7eb3e$var$globalEvents.has(prop) || prop.endsWith("Capture") && $65484d02dcb7eb3e$var$globalEvents.has(prop.slice(0, -7))) || propNames?.has(prop) || $65484d02dcb7eb3e$var$propRe.test(prop)) && (filteredProps[prop] = props[prop]); 3583 return filteredProps; 3584} 3585 3586// ../../node_modules/@react-aria/utils/dist/focusWithoutScrolling.mjs 3587function $7215afc6de606d6b$export$de79e2c695e052f3(element) { 3588 if ($7215afc6de606d6b$var$supportsPreventScroll()) element.focus({ 3589 preventScroll: !0 3590 }); 3591 else { 3592 let scrollableElements = $7215afc6de606d6b$var$getScrollableElements(element); 3593 element.focus(), $7215afc6de606d6b$var$restoreScrollPosition(scrollableElements); 3594 } 3595} 3596var $7215afc6de606d6b$var$supportsPreventScrollCached = null; 3597function $7215afc6de606d6b$var$supportsPreventScroll() { 3598 if ($7215afc6de606d6b$var$supportsPreventScrollCached == null) { 3599 $7215afc6de606d6b$var$supportsPreventScrollCached = !1; 3600 try { 3601 document.createElement("div").focus({ 3602 get preventScroll() { 3603 return $7215afc6de606d6b$var$supportsPreventScrollCached = !0, !0; 3604 } 3605 }); 3606 } catch { 3607 } 3608 } 3609 return $7215afc6de606d6b$var$supportsPreventScrollCached; 3610} 3611function $7215afc6de606d6b$var$getScrollableElements(element) { 3612 let parent = element.parentNode, scrollableElements = [], rootScrollingElement = document.scrollingElement || document.documentElement; 3613 for (; parent instanceof HTMLElement && parent !== rootScrollingElement; ) 3614 (parent.offsetHeight < parent.scrollHeight || parent.offsetWidth < parent.scrollWidth) && scrollableElements.push({ 3615 element: parent, 3616 scrollTop: parent.scrollTop, 3617 scrollLeft: parent.scrollLeft 3618 }), parent = parent.parentNode; 3619 return rootScrollingElement instanceof HTMLElement && scrollableElements.push({ 3620 element: rootScrollingElement, 3621 scrollTop: rootScrollingElement.scrollTop, 3622 scrollLeft: rootScrollingElement.scrollLeft 3623 }), scrollableElements; 3624} 3625function $7215afc6de606d6b$var$restoreScrollPosition(scrollableElements) { 3626 for (let { element, scrollTop, scrollLeft } of scrollableElements) 3627 element.scrollTop = scrollTop, element.scrollLeft = scrollLeft; 3628} 3629 3630// ../../node_modules/@react-aria/utils/dist/platform.mjs 3631function $c87311424ea30a05$var$testUserAgent(re2) { 3632 var _window_navigator_userAgentData; 3633 if (typeof window > "u" || window.navigator == null) return !1; 3634 let brands = (_window_navigator_userAgentData = window.navigator.userAgentData) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.brands; 3635 return Array.isArray(brands) && brands.some((brand) => re2.test(brand.brand)) || re2.test(window.navigator.userAgent); 3636} 3637function $c87311424ea30a05$var$testPlatform(re2) { 3638 var _window_navigator_userAgentData; 3639 return typeof window < "u" && window.navigator != null ? re2.test(((_window_navigator_userAgentData = window.navigator.userAgentData) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.platform) || window.navigator.platform) : !1; 3640} 3641function $c87311424ea30a05$var$cached(fn) { 3642 let res = null; 3643 return () => (res == null && (res = fn()), res); 3644} 3645var $c87311424ea30a05$export$9ac100e40613ea10 = $c87311424ea30a05$var$cached(function() { 3646 return $c87311424ea30a05$var$testPlatform(/^Mac/i); 3647}), $c87311424ea30a05$export$186c6964ca17d99 = $c87311424ea30a05$var$cached(function() { 3648 return $c87311424ea30a05$var$testPlatform(/^iPhone/i); 3649}), $c87311424ea30a05$export$7bef049ce92e4224 = $c87311424ea30a05$var$cached(function() { 3650 return $c87311424ea30a05$var$testPlatform(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support. 3651 $c87311424ea30a05$export$9ac100e40613ea10() && navigator.maxTouchPoints > 1; 3652}), $c87311424ea30a05$export$fedb369cb70207f1 = $c87311424ea30a05$var$cached(function() { 3653 return $c87311424ea30a05$export$186c6964ca17d99() || $c87311424ea30a05$export$7bef049ce92e4224(); 3654}), $c87311424ea30a05$export$e1865c3bedcd822b = $c87311424ea30a05$var$cached(function() { 3655 return $c87311424ea30a05$export$9ac100e40613ea10() || $c87311424ea30a05$export$fedb369cb70207f1(); 3656}), $c87311424ea30a05$export$78551043582a6a98 = $c87311424ea30a05$var$cached(function() { 3657 return $c87311424ea30a05$var$testUserAgent(/AppleWebKit/i) && !$c87311424ea30a05$export$6446a186d09e379e(); 3658}), $c87311424ea30a05$export$6446a186d09e379e = $c87311424ea30a05$var$cached(function() { 3659 return $c87311424ea30a05$var$testUserAgent(/Chrome/i); 3660}), $c87311424ea30a05$export$a11b0059900ceec8 = $c87311424ea30a05$var$cached(function() { 3661 return $c87311424ea30a05$var$testUserAgent(/Android/i); 3662}), $c87311424ea30a05$export$b7d78993b74f766d = $c87311424ea30a05$var$cached(function() { 3663 return $c87311424ea30a05$var$testUserAgent(/Firefox/i); 3664}); 3665 3666// ../../node_modules/@react-aria/utils/dist/openLink.mjs 3667init_react(); 3668var $ea8dcbcb9ea1b556$var$RouterContext = createContext({ 3669 isNative: !0, 3670 open: $ea8dcbcb9ea1b556$var$openSyntheticLink, 3671 useHref: (href) => href 3672}); 3673function $ea8dcbcb9ea1b556$export$95185d699e05d4d7(target, modifiers2, setOpening = !0) { 3674 var _window_event_type, _window_event; 3675 let { metaKey, ctrlKey, altKey, shiftKey } = modifiers2; 3676 $c87311424ea30a05$export$b7d78993b74f766d() && (!((_window_event = window.event) === null || _window_event === void 0 || (_window_event_type = _window_event.type) === null || _window_event_type === void 0) && _window_event_type.startsWith("key")) && target.target === "_blank" && ($c87311424ea30a05$export$9ac100e40613ea10() ? metaKey = !0 : ctrlKey = !0); 3677 let event = $c87311424ea30a05$export$78551043582a6a98() && $c87311424ea30a05$export$9ac100e40613ea10() && !$c87311424ea30a05$export$7bef049ce92e4224() ? new KeyboardEvent("keydown", { 3678 keyIdentifier: "Enter", 3679 metaKey, 3680 ctrlKey, 3681 altKey, 3682 shiftKey 3683 }) : new MouseEvent("click", { 3684 metaKey, 3685 ctrlKey, 3686 altKey, 3687 shiftKey, 3688 detail: 1, 3689 bubbles: !0, 3690 cancelable: !0 3691 }); 3692 $ea8dcbcb9ea1b556$export$95185d699e05d4d7.isOpening = setOpening, $7215afc6de606d6b$export$de79e2c695e052f3(target), target.dispatchEvent(event), $ea8dcbcb9ea1b556$export$95185d699e05d4d7.isOpening = !1; 3693} 3694$ea8dcbcb9ea1b556$export$95185d699e05d4d7.isOpening = !1; 3695function $ea8dcbcb9ea1b556$var$getSyntheticLink(target, open) { 3696 if (target instanceof HTMLAnchorElement) open(target); 3697 else if (target.hasAttribute("data-href")) { 3698 let link = document.createElement("a"); 3699 link.href = target.getAttribute("data-href"), target.hasAttribute("data-target") && (link.target = target.getAttribute("data-target")), target.hasAttribute("data-rel") && (link.rel = target.getAttribute("data-rel")), target.hasAttribute("data-download") && (link.download = target.getAttribute("data-download")), target.hasAttribute("data-ping") && (link.ping = target.getAttribute("data-ping")), target.hasAttribute("data-referrer-policy") && (link.referrerPolicy = target.getAttribute("data-referrer-policy")), target.appendChild(link), open(link), target.removeChild(link); 3700 } 3701} 3702function $ea8dcbcb9ea1b556$var$openSyntheticLink(target, modifiers2) { 3703 $ea8dcbcb9ea1b556$var$getSyntheticLink(target, (link) => $ea8dcbcb9ea1b556$export$95185d699e05d4d7(link, modifiers2)); 3704} 3705 3706// ../../node_modules/@react-aria/utils/dist/runAfterTransition.mjs 3707var $bbed8b41f857bcc0$var$transitionsByElement = /* @__PURE__ */ new Map(), $bbed8b41f857bcc0$var$transitionCallbacks = /* @__PURE__ */ new Set(); 3708function $bbed8b41f857bcc0$var$setupGlobalEvents() { 3709 if (typeof window > "u") return; 3710 function isTransitionEvent(event) { 3711 return "propertyName" in event; 3712 } 3713 let onTransitionStart = (e2) => { 3714 if (!isTransitionEvent(e2) || !e2.target) return; 3715 let transitions = $bbed8b41f857bcc0$var$transitionsByElement.get(e2.target); 3716 transitions || (transitions = /* @__PURE__ */ new Set(), $bbed8b41f857bcc0$var$transitionsByElement.set(e2.target, transitions), e2.target.addEventListener("transitioncancel", onTransitionEnd, { 3717 once: !0 3718 })), transitions.add(e2.propertyName); 3719 }, onTransitionEnd = (e2) => { 3720 if (!isTransitionEvent(e2) || !e2.target) return; 3721 let properties = $bbed8b41f857bcc0$var$transitionsByElement.get(e2.target); 3722 if (properties && (properties.delete(e2.propertyName), properties.size === 0 && (e2.target.removeEventListener("transitioncancel", onTransitionEnd), $bbed8b41f857bcc0$var$transitionsByElement.delete(e2.target)), $bbed8b41f857bcc0$var$transitionsByElement.size === 0)) { 3723 for (let cb of $bbed8b41f857bcc0$var$transitionCallbacks) cb(); 3724 $bbed8b41f857bcc0$var$transitionCallbacks.clear(); 3725 } 3726 }; 3727 document.body.addEventListener("transitionrun", onTransitionStart), document.body.addEventListener("transitionend", onTransitionEnd); 3728} 3729typeof document < "u" && (document.readyState !== "loading" ? $bbed8b41f857bcc0$var$setupGlobalEvents() : document.addEventListener("DOMContentLoaded", $bbed8b41f857bcc0$var$setupGlobalEvents)); 3730function $bbed8b41f857bcc0$var$cleanupDetachedElements() { 3731 for (let [eventTarget] of $bbed8b41f857bcc0$var$transitionsByElement) 3732 "isConnected" in eventTarget && !eventTarget.isConnected && $bbed8b41f857bcc0$var$transitionsByElement.delete(eventTarget); 3733} 3734function $bbed8b41f857bcc0$export$24490316f764c430(fn) { 3735 requestAnimationFrame(() => { 3736 $bbed8b41f857bcc0$var$cleanupDetachedElements(), $bbed8b41f857bcc0$var$transitionsByElement.size === 0 ? fn() : $bbed8b41f857bcc0$var$transitionCallbacks.add(fn); 3737 }); 3738} 3739 3740// ../../node_modules/@react-aria/utils/dist/useDrag1D.mjs 3741init_react(); 3742 3743// ../../node_modules/@react-aria/utils/dist/useGlobalListeners.mjs 3744init_react(); 3745function $03deb23ff14920c4$export$4eaf04e54aa8eed6() { 3746 let globalListeners = useRef(/* @__PURE__ */ new Map()), addGlobalListener = useCallback((eventTarget, type, listener, options2) => { 3747 let fn = options2?.once ? (...args) => { 3748 globalListeners.current.delete(listener), listener(...args); 3749 } : listener; 3750 globalListeners.current.set(listener, { 3751 type, 3752 eventTarget, 3753 fn, 3754 options: options2 3755 }), eventTarget.addEventListener(type, fn, options2); 3756 }, []), removeGlobalListener = useCallback((eventTarget, type, listener, options2) => { 3757 var _globalListeners_current_get; 3758 let fn = ((_globalListeners_current_get = globalListeners.current.get(listener)) === null || _globalListeners_current_get === void 0 ? void 0 : _globalListeners_current_get.fn) || listener; 3759 eventTarget.removeEventListener(type, fn, options2), globalListeners.current.delete(listener); 3760 }, []), removeAllGlobalListeners = useCallback(() => { 3761 globalListeners.current.forEach((value, key) => { 3762 removeGlobalListener(value.eventTarget, value.type, key, value.options); 3763 }); 3764 }, [ 3765 removeGlobalListener 3766 ]); 3767 return useEffect(() => removeAllGlobalListeners, [ 3768 removeAllGlobalListeners 3769 ]), { 3770 addGlobalListener, 3771 removeGlobalListener, 3772 removeAllGlobalListeners 3773 }; 3774} 3775 3776// ../../node_modules/@react-aria/utils/dist/useObjectRef.mjs 3777init_react(); 3778function $df56164dff5785e2$export$4338b53315abf666(ref) { 3779 let objRef = useRef(null), cleanupRef = useRef(void 0), refEffect = useCallback((instance) => { 3780 if (typeof ref == "function") { 3781 let refCallback = ref, refCleanup = refCallback(instance); 3782 return () => { 3783 typeof refCleanup == "function" ? refCleanup() : refCallback(null); 3784 }; 3785 } else if (ref) 3786 return ref.current = instance, () => { 3787 ref.current = null; 3788 }; 3789 }, [ 3790 ref 3791 ]); 3792 return useMemo(() => ({ 3793 get current() { 3794 return objRef.current; 3795 }, 3796 set current(value) { 3797 objRef.current = value, cleanupRef.current && (cleanupRef.current(), cleanupRef.current = void 0), value != null && (cleanupRef.current = refEffect(value)); 3798 } 3799 }), [ 3800 refEffect 3801 ]); 3802} 3803 3804// ../../node_modules/@react-aria/utils/dist/useEffectEvent.mjs 3805init_react(); 3806var $8ae05eaa5c114e9c$var$_React_useInsertionEffect, $8ae05eaa5c114e9c$var$useEarlyEffect = ($8ae05eaa5c114e9c$var$_React_useInsertionEffect = react_default.useInsertionEffect) !== null && $8ae05eaa5c114e9c$var$_React_useInsertionEffect !== void 0 ? $8ae05eaa5c114e9c$var$_React_useInsertionEffect : $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c; 3807function $8ae05eaa5c114e9c$export$7f54fc3180508a52(fn) { 3808 let ref = useRef(null); 3809 return $8ae05eaa5c114e9c$var$useEarlyEffect(() => { 3810 ref.current = fn; 3811 }, [ 3812 fn 3813 ]), useCallback((...args) => { 3814 let f2 = ref.current; 3815 return f2?.(...args); 3816 }, []); 3817} 3818 3819// ../../node_modules/@react-aria/utils/dist/useUpdateEffect.mjs 3820init_react(); 3821 3822// ../../node_modules/@react-aria/utils/dist/useUpdateLayoutEffect.mjs 3823init_react(); 3824 3825// ../../node_modules/@react-aria/utils/dist/useResizeObserver.mjs 3826init_react(); 3827function $9daab02d461809db$var$hasResizeObserver() { 3828 return typeof window.ResizeObserver < "u"; 3829} 3830function $9daab02d461809db$export$683480f191c0e3ea(options2) { 3831 let { ref, box, onResize } = options2, onResizeEvent = $8ae05eaa5c114e9c$export$7f54fc3180508a52(onResize); 3832 useEffect(() => { 3833 let element = ref?.current; 3834 if (element) 3835 if ($9daab02d461809db$var$hasResizeObserver()) { 3836 let resizeObserverInstance = new window.ResizeObserver((entries) => { 3837 entries.length && onResizeEvent(); 3838 }); 3839 return resizeObserverInstance.observe(element, { 3840 box 3841 }), () => { 3842 element && resizeObserverInstance.unobserve(element); 3843 }; 3844 } else 3845 return window.addEventListener("resize", onResizeEvent, !1), () => { 3846 window.removeEventListener("resize", onResizeEvent, !1); 3847 }; 3848 }, [ 3849 ref, 3850 box 3851 ]); 3852} 3853 3854// ../../node_modules/@react-aria/utils/dist/useSyncRef.mjs 3855function $e7801be82b4b2a53$export$4debdb1a3f0fa79e(context, ref) { 3856 $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => { 3857 if (context && context.ref && ref) 3858 return context.ref.current = ref.current, () => { 3859 context.ref && (context.ref.current = null); 3860 }; 3861 }); 3862} 3863 3864// ../../node_modules/@react-aria/utils/dist/useViewportSize.mjs 3865init_react(); 3866var $5df64b3807dc15ee$var$visualViewport = typeof document < "u" && window.visualViewport; 3867 3868// ../../node_modules/@react-aria/utils/dist/useDescription.mjs 3869init_react(); 3870 3871// ../../node_modules/@react-aria/utils/dist/useEvent.mjs 3872init_react(); 3873 3874// ../../node_modules/@react-aria/utils/dist/isVirtualEvent.mjs 3875function $6a7db85432448f7f$export$60278871457622de(event) { 3876 return event.pointerType === "" && event.isTrusted ? !0 : $c87311424ea30a05$export$a11b0059900ceec8() && event.pointerType ? event.type === "click" && event.buttons === 1 : event.detail === 0 && !event.pointerType; 3877} 3878function $6a7db85432448f7f$export$29bf1b5f2c56cf63(event) { 3879 return !$c87311424ea30a05$export$a11b0059900ceec8() && event.width === 0 && event.height === 0 || event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "mouse"; 3880} 3881 3882// ../../node_modules/@react-aria/utils/dist/useDeepMemo.mjs 3883init_react(); 3884 3885// ../../node_modules/@react-aria/utils/dist/useFormReset.mjs 3886init_react(); 3887 3888// ../../node_modules/@react-aria/utils/dist/useLoadMore.mjs 3889init_react(); 3890 3891// ../../node_modules/@react-aria/utils/dist/useLoadMoreSentinel.mjs 3892init_react(); 3893 3894// ../../node_modules/@react-aria/utils/dist/inertValue.mjs 3895init_react(); 3896 3897// global-externals:react-dom 3898var react_dom_default = __REACT_DOM__, { __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED2, createPortal, createRoot: createRoot2, findDOMNode, flushSync, hydrate, hydrateRoot: hydrateRoot2, render, unmountComponentAtNode, unstable_batchedUpdates, unstable_renderSubtreeIntoContainer, version: version2 } = __REACT_DOM__; 3899 3900// ../../node_modules/@react-aria/utils/dist/animation.mjs 3901init_react(); 3902function $d3f049242431219c$export$6d3443f2c48bfc20(ref, isReady = !0) { 3903 let [isEntering, setEntering] = useState(!0), isAnimationReady = isEntering && isReady; 3904 return $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => { 3905 if (isAnimationReady && ref.current && "getAnimations" in ref.current) 3906 for (let animation of ref.current.getAnimations()) animation instanceof CSSTransition && animation.cancel(); 3907 }, [ 3908 ref, 3909 isAnimationReady 3910 ]), $d3f049242431219c$var$useAnimation(ref, isAnimationReady, useCallback(() => setEntering(!1), [])), isAnimationReady; 3911} 3912function $d3f049242431219c$export$45fda7c47f93fd48(ref, isOpen) { 3913 let [exitState, setExitState] = useState(isOpen ? "open" : "closed"); 3914 switch (exitState) { 3915 case "open": 3916 isOpen || setExitState("exiting"); 3917 break; 3918 case "closed": 3919 case "exiting": 3920 isOpen && setExitState("open"); 3921 break; 3922 } 3923 let isExiting = exitState === "exiting"; 3924 return $d3f049242431219c$var$useAnimation(ref, isExiting, useCallback(() => { 3925 setExitState((state) => state === "exiting" ? "closed" : state); 3926 }, [])), isExiting; 3927} 3928function $d3f049242431219c$var$useAnimation(ref, isActive, onEnd) { 3929 $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => { 3930 if (isActive && ref.current) { 3931 if (!("getAnimations" in ref.current)) { 3932 onEnd(); 3933 return; 3934 } 3935 let animations = ref.current.getAnimations(); 3936 if (animations.length === 0) { 3937 onEnd(); 3938 return; 3939 } 3940 let canceled = !1; 3941 return Promise.all(animations.map((a2) => a2.finished)).then(() => { 3942 canceled || flushSync(() => { 3943 onEnd(); 3944 }); 3945 }).catch(() => { 3946 }), () => { 3947 canceled = !0; 3948 }; 3949 } 3950 }, [ 3951 ref, 3952 isActive, 3953 onEnd 3954 ]); 3955} 3956 3957// ../../node_modules/@react-aria/utils/dist/isElementVisible.mjs 3958var $7d2416ea0959daaa$var$supportsCheckVisibility = typeof Element < "u" && "checkVisibility" in Element.prototype; 3959function $7d2416ea0959daaa$var$isStyleVisible(element) { 3960 let windowObject = $431fbd86ca7dc216$export$f21a1ffae260145a(element); 3961 if (!(element instanceof windowObject.HTMLElement) && !(element instanceof windowObject.SVGElement)) return !1; 3962 let { display, visibility } = element.style, isVisible = display !== "none" && visibility !== "hidden" && visibility !== "collapse"; 3963 if (isVisible) { 3964 let { getComputedStyle: getComputedStyle2 } = element.ownerDocument.defaultView, { display: computedDisplay, visibility: computedVisibility } = getComputedStyle2(element); 3965 isVisible = computedDisplay !== "none" && computedVisibility !== "hidden" && computedVisibility !== "collapse"; 3966 } 3967 return isVisible; 3968} 3969function $7d2416ea0959daaa$var$isAttributeVisible(element, childElement) { 3970 return !element.hasAttribute("hidden") && // Ignore HiddenSelect when tree walking. 3971 !element.hasAttribute("data-react-aria-prevent-focus") && (element.nodeName === "DETAILS" && childElement && childElement.nodeName !== "SUMMARY" ? element.hasAttribute("open") : !0); 3972} 3973function $7d2416ea0959daaa$export$e989c0fffaa6b27a(element, childElement) { 3974 return $7d2416ea0959daaa$var$supportsCheckVisibility ? element.checkVisibility({ 3975 visibilityProperty: !0 3976 }) && !element.closest("[data-react-aria-prevent-focus]") : element.nodeName !== "#comment" && $7d2416ea0959daaa$var$isStyleVisible(element) && $7d2416ea0959daaa$var$isAttributeVisible(element, childElement) && (!element.parentElement || $7d2416ea0959daaa$export$e989c0fffaa6b27a(element.parentElement, element)); 3977} 3978 3979// ../../node_modules/@react-aria/utils/dist/isFocusable.mjs 3980var $b4b717babfbb907b$var$focusableElements = [ 3981 "input:not([disabled]):not([type=hidden])", 3982 "select:not([disabled])", 3983 "textarea:not([disabled])", 3984 "button:not([disabled])", 3985 "a[href]", 3986 "area[href]", 3987 "summary", 3988 "iframe", 3989 "object", 3990 "embed", 3991 "audio[controls]", 3992 "video[controls]", 3993 '[contenteditable]:not([contenteditable^="false"])', 3994 "permission" 3995], $b4b717babfbb907b$var$FOCUSABLE_ELEMENT_SELECTOR = $b4b717babfbb907b$var$focusableElements.join(":not([hidden]),") + ",[tabindex]:not([disabled]):not([hidden])"; 3996$b4b717babfbb907b$var$focusableElements.push('[tabindex]:not([tabindex="-1"]):not([disabled])'); 3997var $b4b717babfbb907b$var$TABBABLE_ELEMENT_SELECTOR = $b4b717babfbb907b$var$focusableElements.join(':not([hidden]):not([tabindex="-1"]),'); 3998function $b4b717babfbb907b$export$4c063cf1350e6fed(element) { 3999 return element.matches($b4b717babfbb907b$var$FOCUSABLE_ELEMENT_SELECTOR) && $7d2416ea0959daaa$export$e989c0fffaa6b27a(element) && !$b4b717babfbb907b$var$isInert(element); 4000} 4001function $b4b717babfbb907b$var$isInert(element) { 4002 let node = element; 4003 for (; node != null; ) { 4004 if (node instanceof node.ownerDocument.defaultView.HTMLElement && node.inert) return !0; 4005 node = node.parentElement; 4006 } 4007 return !1; 4008} 4009 4010// ../../node_modules/@react-stately/utils/dist/useControlledState.mjs 4011init_react(); 4012var $458b0a5536c1a7cf$var$_React_useInsertionEffect, $458b0a5536c1a7cf$var$useEarlyEffect = typeof document < "u" ? ($458b0a5536c1a7cf$var$_React_useInsertionEffect = react_default.useInsertionEffect) !== null && $458b0a5536c1a7cf$var$_React_useInsertionEffect !== void 0 ? $458b0a5536c1a7cf$var$_React_useInsertionEffect : react_default.useLayoutEffect : () => { 4013}; 4014function $458b0a5536c1a7cf$export$40bfa8c7b0832715(value, defaultValue, onChange) { 4015 let [stateValue, setStateValue] = useState(value || defaultValue), valueRef = useRef(stateValue), isControlledRef = useRef(value !== void 0), isControlled = value !== void 0; 4016 useEffect(() => { 4017 let wasControlled = isControlledRef.current; 4018 isControlledRef.current = isControlled; 4019 }, [ 4020 isControlled 4021 ]); 4022 let currentValue = isControlled ? value : stateValue; 4023 $458b0a5536c1a7cf$var$useEarlyEffect(() => { 4024 valueRef.current = currentValue; 4025 }); 4026 let [, forceUpdate] = useReducer(() => ({}), {}), setValue = useCallback((value2, ...args) => { 4027 let newValue = typeof value2 == "function" ? value2(valueRef.current) : value2; 4028 Object.is(valueRef.current, newValue) || (valueRef.current = newValue, setStateValue(newValue), forceUpdate(), onChange?.(newValue, ...args)); 4029 }, [ 4030 onChange 4031 ]); 4032 return [ 4033 currentValue, 4034 setValue 4035 ]; 4036} 4037 4038// ../../node_modules/@react-stately/utils/dist/number.mjs 4039function $9446cca9a3875146$export$7d15b64cf5a3a4c4(value, min = -1 / 0, max = 1 / 0) { 4040 return Math.min(Math.max(value, min), max); 4041} 4042 4043// ../../node_modules/@react-aria/landmark/dist/useLandmark.mjs 4044init_react(); 4045var import_shim = __toESM(require_shim(), 1), $a86207c5d7f7e1fb$var$LANDMARK_API_VERSION = 1, $a86207c5d7f7e1fb$var$landmarkSymbol = /* @__PURE__ */ Symbol.for("react-aria-landmark-manager"); 4046function $a86207c5d7f7e1fb$var$subscribe(fn) { 4047 return document.addEventListener("react-aria-landmark-manager-change", fn), () => document.removeEventListener("react-aria-landmark-manager-change", fn); 4048} 4049function $a86207c5d7f7e1fb$var$getLandmarkManager() { 4050 if (typeof document > "u") return null; 4051 let instance = document[$a86207c5d7f7e1fb$var$landmarkSymbol]; 4052 return instance && instance.version >= $a86207c5d7f7e1fb$var$LANDMARK_API_VERSION ? instance : (document[$a86207c5d7f7e1fb$var$landmarkSymbol] = new $a86207c5d7f7e1fb$var$LandmarkManager(), document.dispatchEvent(new CustomEvent("react-aria-landmark-manager-change")), document[$a86207c5d7f7e1fb$var$landmarkSymbol]); 4053} 4054function $a86207c5d7f7e1fb$var$useLandmarkManager() { 4055 return (0, import_shim.useSyncExternalStore)($a86207c5d7f7e1fb$var$subscribe, $a86207c5d7f7e1fb$var$getLandmarkManager, $a86207c5d7f7e1fb$var$getLandmarkManager); 4056} 4057var $a86207c5d7f7e1fb$var$LandmarkManager = class { 4058 setupIfNeeded() { 4059 this.isListening || (document.addEventListener("keydown", this.f6Handler, { 4060 capture: !0 4061 }), document.addEventListener("focusin", this.focusinHandler, { 4062 capture: !0 4063 }), document.addEventListener("focusout", this.focusoutHandler, { 4064 capture: !0 4065 }), this.isListening = !0); 4066 } 4067 teardownIfNeeded() { 4068 !this.isListening || this.landmarks.length > 0 || this.refCount > 0 || (document.removeEventListener("keydown", this.f6Handler, { 4069 capture: !0 4070 }), document.removeEventListener("focusin", this.focusinHandler, { 4071 capture: !0 4072 }), document.removeEventListener("focusout", this.focusoutHandler, { 4073 capture: !0 4074 }), this.isListening = !1); 4075 } 4076 focusLandmark(landmark, direction) { 4077 var _this_landmarks_find_focus, _this_landmarks_find; 4078 (_this_landmarks_find = this.landmarks.find((l3) => l3.ref.current === landmark)) === null || _this_landmarks_find === void 0 || (_this_landmarks_find_focus = _this_landmarks_find.focus) === null || _this_landmarks_find_focus === void 0 || _this_landmarks_find_focus.call(_this_landmarks_find, direction); 4079 } 4080 /** 4081 * Return set of landmarks with a specific role. 4082 */ 4083 getLandmarksByRole(role) { 4084 return new Set(this.landmarks.filter((l3) => l3.role === role)); 4085 } 4086 /** 4087 * Return first landmark with a specific role. 4088 */ 4089 getLandmarkByRole(role) { 4090 return this.landmarks.find((l3) => l3.role === role); 4091 } 4092 addLandmark(newLandmark) { 4093 if (this.setupIfNeeded(), this.landmarks.find((landmark) => landmark.ref === newLandmark.ref) || !newLandmark.ref.current) return; 4094 if (this.landmarks.filter((landmark) => landmark.role === "main").length > 1, this.landmarks.length === 0) { 4095 this.landmarks = [ 4096 newLandmark 4097 ], this.checkLabels(newLandmark.role); 4098 return; 4099 } 4100 let start = 0, end = this.landmarks.length - 1; 4101 for (; start <= end; ) { 4102 let mid = Math.floor((start + end) / 2), comparedPosition = newLandmark.ref.current.compareDocumentPosition(this.landmarks[mid].ref.current); 4103 !!(comparedPosition & Node.DOCUMENT_POSITION_PRECEDING || comparedPosition & Node.DOCUMENT_POSITION_CONTAINS) ? start = mid + 1 : end = mid - 1; 4104 } 4105 this.landmarks.splice(start, 0, newLandmark), this.checkLabels(newLandmark.role); 4106 } 4107 updateLandmark(landmark) { 4108 let index = this.landmarks.findIndex((l3) => l3.ref === landmark.ref); 4109 index >= 0 && (this.landmarks[index] = { 4110 ...this.landmarks[index], 4111 ...landmark 4112 }, this.checkLabels(this.landmarks[index].role)); 4113 } 4114 removeLandmark(ref) { 4115 this.landmarks = this.landmarks.filter((landmark) => landmark.ref !== ref), this.teardownIfNeeded(); 4116 } 4117 /** 4118 * Warn if there are 2+ landmarks with the same role but no label. 4119 * Labels for landmarks with the same role must also be unique. 4120 * 4121 * See https://www.w3.org/WAI/ARIA/apg/practices/landmark-regions/. 4122 */ 4123 checkLabels(role) { 4124 let landmarksWithRole = this.getLandmarksByRole(role); 4125 landmarksWithRole.size > 1 && [ 4126 ...landmarksWithRole 4127 ].filter((landmark) => !landmark.label).length > 0; 4128 } 4129 /** 4130 * Get the landmark that is the closest parent in the DOM. 4131 * Returns undefined if no parent is a landmark. 4132 */ 4133 closestLandmark(element) { 4134 let landmarkMap = new Map(this.landmarks.map((l3) => [ 4135 l3.ref.current, 4136 l3 4137 ])), currentElement = element; 4138 for (; currentElement && !landmarkMap.has(currentElement) && currentElement !== document.body && currentElement.parentElement; ) currentElement = currentElement.parentElement; 4139 return landmarkMap.get(currentElement); 4140 } 4141 /** 4142 * Gets the next landmark, in DOM focus order, or previous if backwards is specified. 4143 * If last landmark, next should be the first landmark. 4144 * If not inside a landmark, will return first landmark. 4145 * Returns undefined if there are no landmarks. 4146 */ 4147 getNextLandmark(element, { backward }) { 4148 var _this_landmarks_nextLandmarkIndex_ref_current; 4149 let currentLandmark = this.closestLandmark(element), nextLandmarkIndex = backward ? this.landmarks.length - 1 : 0; 4150 currentLandmark && (nextLandmarkIndex = this.landmarks.indexOf(currentLandmark) + (backward ? -1 : 1)); 4151 let wrapIfNeeded = () => { 4152 if (nextLandmarkIndex < 0) { 4153 if (!element.dispatchEvent(new CustomEvent("react-aria-landmark-navigation", { 4154 detail: { 4155 direction: "backward" 4156 }, 4157 bubbles: !0, 4158 cancelable: !0 4159 }))) return !0; 4160 nextLandmarkIndex = this.landmarks.length - 1; 4161 } else if (nextLandmarkIndex >= this.landmarks.length) { 4162 if (!element.dispatchEvent(new CustomEvent("react-aria-landmark-navigation", { 4163 detail: { 4164 direction: "forward" 4165 }, 4166 bubbles: !0, 4167 cancelable: !0 4168 }))) return !0; 4169 nextLandmarkIndex = 0; 4170 } 4171 return nextLandmarkIndex < 0 || nextLandmarkIndex >= this.landmarks.length; 4172 }; 4173 if (wrapIfNeeded()) return; 4174 let i2 = nextLandmarkIndex; 4175 for (; !((_this_landmarks_nextLandmarkIndex_ref_current = this.landmarks[nextLandmarkIndex].ref.current) === null || _this_landmarks_nextLandmarkIndex_ref_current === void 0) && _this_landmarks_nextLandmarkIndex_ref_current.closest("[aria-hidden=true]"); ) { 4176 if (nextLandmarkIndex += backward ? -1 : 1, wrapIfNeeded()) return; 4177 if (nextLandmarkIndex === i2) break; 4178 } 4179 return this.landmarks[nextLandmarkIndex]; 4180 } 4181 /** 4182 * Look at next landmark. If an element was previously focused inside, restore focus there. 4183 * If not, focus the landmark itself. 4184 * If no landmarks at all, or none with focusable elements, don't move focus. 4185 */ 4186 f6Handler(e2) { 4187 e2.key === "F6" && (e2.altKey ? this.focusMain() : this.navigate(e2.target, e2.shiftKey)) && (e2.preventDefault(), e2.stopPropagation()); 4188 } 4189 focusMain() { 4190 let main = this.getLandmarkByRole("main"); 4191 return main && main.ref.current && document.contains(main.ref.current) ? (this.focusLandmark(main.ref.current, "forward"), !0) : !1; 4192 } 4193 navigate(from, backward) { 4194 let nextLandmark = this.getNextLandmark(from, { 4195 backward 4196 }); 4197 if (!nextLandmark) return !1; 4198 if (nextLandmark.lastFocused) { 4199 let lastFocused = nextLandmark.lastFocused; 4200 if (document.body.contains(lastFocused)) 4201 return lastFocused.focus(), !0; 4202 } 4203 return nextLandmark.ref.current && document.contains(nextLandmark.ref.current) ? (this.focusLandmark(nextLandmark.ref.current, backward ? "backward" : "forward"), !0) : !1; 4204 } 4205 /** 4206 * Sets lastFocused for a landmark, if focus is moved within that landmark. 4207 * Lets the last focused landmark know it was blurred if something else is focused. 4208 */ 4209 focusinHandler(e2) { 4210 let currentLandmark = this.closestLandmark(e2.target); 4211 currentLandmark && currentLandmark.ref.current !== e2.target && this.updateLandmark({ 4212 ref: currentLandmark.ref, 4213 lastFocused: e2.target 4214 }); 4215 let previousFocusedElement = e2.relatedTarget; 4216 if (previousFocusedElement) { 4217 let closestPreviousLandmark = this.closestLandmark(previousFocusedElement); 4218 closestPreviousLandmark && closestPreviousLandmark.ref.current === previousFocusedElement && closestPreviousLandmark.blur(); 4219 } 4220 } 4221 /** 4222 * Track if the focus is lost to the body. If it is, do cleanup on the landmark that last had focus. 4223 */ 4224 focusoutHandler(e2) { 4225 let previousFocusedElement = e2.target, nextFocusedElement = e2.relatedTarget; 4226 if (!nextFocusedElement || nextFocusedElement === document) { 4227 let closestPreviousLandmark = this.closestLandmark(previousFocusedElement); 4228 closestPreviousLandmark && closestPreviousLandmark.ref.current === previousFocusedElement && closestPreviousLandmark.blur(); 4229 } 4230 } 4231 createLandmarkController() { 4232 let instance = this; 4233 return instance.refCount++, instance.setupIfNeeded(), { 4234 navigate(direction, opts) { 4235 let element = opts?.from || document.activeElement; 4236 return instance.navigate(element, direction === "backward"); 4237 }, 4238 focusNext(opts) { 4239 let element = opts?.from || document.activeElement; 4240 return instance.navigate(element, !1); 4241 }, 4242 focusPrevious(opts) { 4243 let element = opts?.from || document.activeElement; 4244 return instance.navigate(element, !0); 4245 }, 4246 focusMain() { 4247 return instance.focusMain(); 4248 }, 4249 dispose() { 4250 instance && (instance.refCount--, instance.teardownIfNeeded(), instance = null); 4251 } 4252 }; 4253 } 4254 registerLandmark(landmark) { 4255 return this.landmarks.find((l3) => l3.ref === landmark.ref) ? this.updateLandmark(landmark) : this.addLandmark(landmark), () => this.removeLandmark(landmark.ref); 4256 } 4257 constructor() { 4258 this.landmarks = [], this.isListening = !1, this.refCount = 0, this.version = $a86207c5d7f7e1fb$var$LANDMARK_API_VERSION, this.f6Handler = this.f6Handler.bind(this), this.focusinHandler = this.focusinHandler.bind(this), this.focusoutHandler = this.focusoutHandler.bind(this); 4259 } 4260}; 4261function $a86207c5d7f7e1fb$export$4cc632584fd87fae(props, ref) { 4262 let { role, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, focus } = props, manager = $a86207c5d7f7e1fb$var$useLandmarkManager(), label = ariaLabel || ariaLabelledby, [isLandmarkFocused, setIsLandmarkFocused] = useState(!1), defaultFocus = useCallback(() => { 4263 setIsLandmarkFocused(!0); 4264 }, [ 4265 setIsLandmarkFocused 4266 ]), blur = useCallback(() => { 4267 setIsLandmarkFocused(!1); 4268 }, [ 4269 setIsLandmarkFocused 4270 ]); 4271 return $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => { 4272 if (manager) return manager.registerLandmark({ 4273 ref, 4274 label, 4275 role, 4276 focus: focus || defaultFocus, 4277 blur 4278 }); 4279 }, [ 4280 manager, 4281 label, 4282 ref, 4283 role, 4284 focus, 4285 defaultFocus, 4286 blur 4287 ]), useEffect(() => { 4288 var _ref_current; 4289 isLandmarkFocused && ((_ref_current = ref.current) === null || _ref_current === void 0 || _ref_current.focus()); 4290 }, [ 4291 isLandmarkFocused, 4292 ref 4293 ]), { 4294 landmarkProps: { 4295 role, 4296 tabIndex: isLandmarkFocused ? -1 : void 0, 4297 "aria-label": ariaLabel, 4298 "aria-labelledby": ariaLabelledby 4299 } 4300 }; 4301} 4302 4303// src/manager/hooks/useLandmark.ts 4304function useLandmark(props, ref) { 4305 let { landmarkProps } = $a86207c5d7f7e1fb$export$4cc632584fd87fae(props, ref); 4306 return { 4307 landmarkProps: { 4308 ...landmarkProps, 4309 "data-sb-landmark": !0 4310 } 4311 }; 4312} 4313 4314// src/manager/components/mobile/navigation/MobileAddonsDrawer.tsx 4315init_react(); 4316var MobileAddonsDrawer = ({ 4317 children, 4318 id, 4319 isOpen, 4320 onOpenChange 4321}) => react_default.createElement( 4322 Modal, 4323 { 4324 ariaLabel: "Addon panel", 4325 transitionDuration: 300, 4326 variant: "bottom-drawer", 4327 height: "42dvh", 4328 id, 4329 open: isOpen, 4330 onOpenChange 4331 }, 4332 children 4333); 4334 4335// src/manager/components/mobile/navigation/MobileMenuDrawer.tsx 4336init_react(); 4337 4338// src/manager/components/mobile/about/MobileAbout.tsx 4339init_react(); 4340 4341// ../../node_modules/react-transition-state/dist/esm/hooks/useTransitionState.mjs 4342init_react(); 4343 4344// ../../node_modules/react-transition-state/dist/esm/hooks/utils.mjs 4345var STATUS = ["preEnter", "entering", "entered", "preExit", "exiting", "exited", "unmounted"], getState = (status) => ({ 4346 _s: status, 4347 status: STATUS[status], 4348 isEnter: status < 3, 4349 isMounted: status !== 6, 4350 isResolved: status === 2 || status > 4 4351}), startOrEnd = (unmounted) => unmounted ? 6 : 5, getEndStatus = (status, unmountOnExit) => { 4352 switch (status) { 4353 case 1: 4354 case 0: 4355 return 2; 4356 case 4: 4357 case 3: 4358 return startOrEnd(unmountOnExit); 4359 } 4360}, getTimeout = (timeout) => typeof timeout == "object" ? [timeout.enter, timeout.exit] : [timeout, timeout], nextTick = (transitState, status) => setTimeout(() => { 4361 isNaN(document.body.offsetTop) || transitState(status + 1); 4362}, 0); 4363 4364// ../../node_modules/react-transition-state/dist/esm/hooks/useTransitionState.mjs 4365var updateState = (status, setState, latestState, timeoutId, onChange) => { 4366 clearTimeout(timeoutId.current); 4367 let state = getState(status); 4368 setState(state), latestState.current = state, onChange && onChange({ 4369 current: state 4370 }); 4371}, useTransitionState = ({ 4372 enter = !0, 4373 exit = !0, 4374 preEnter, 4375 preExit, 4376 timeout, 4377 initialEntered, 4378 mountOnEnter, 4379 unmountOnExit, 4380 onStateChange: onChange 4381} = {}) => { 4382 let [state, setState] = useState(() => getState(initialEntered ? 2 : startOrEnd(mountOnEnter))), latestState = useRef(state), timeoutId = useRef(), [enterTimeout, exitTimeout] = getTimeout(timeout), endTransition = useCallback(() => { 4383 let status = getEndStatus(latestState.current._s, unmountOnExit); 4384 status && updateState(status, setState, latestState, timeoutId, onChange); 4385 }, [onChange, unmountOnExit]), toggle = useCallback((toEnter) => { 4386 let transitState = (status) => { 4387 switch (updateState(status, setState, latestState, timeoutId, onChange), status) { 4388 case 1: 4389 enterTimeout >= 0 && (timeoutId.current = setTimeout(endTransition, enterTimeout)); 4390 break; 4391 case 4: 4392 exitTimeout >= 0 && (timeoutId.current = setTimeout(endTransition, exitTimeout)); 4393 break; 4394 case 0: 4395 case 3: 4396 timeoutId.current = nextTick(transitState, status); 4397 break; 4398 } 4399 }, enterStage = latestState.current.isEnter; 4400 typeof toEnter != "boolean" && (toEnter = !enterStage), toEnter ? !enterStage && transitState(enter ? preEnter ? 0 : 1 : 2) : enterStage && transitState(exit ? preExit ? 3 : 4 : startOrEnd(unmountOnExit)); 4401 }, [endTransition, onChange, enter, exit, preEnter, preExit, enterTimeout, exitTimeout, unmountOnExit]); 4402 return [state, toggle, endTransition]; 4403}; 4404 4405// ../../node_modules/react-transition-state/dist/esm/hooks/useTransitionMap.mjs 4406init_react(); 4407var updateState2 = (key, status, setStateMap, latestStateMap, timeoutId, onChange) => { 4408 clearTimeout(timeoutId); 4409 let state = getState(status), stateMap = new Map(latestStateMap.current); 4410 stateMap.set(key, state), setStateMap(stateMap), latestStateMap.current = stateMap, onChange && onChange({ 4411 key, 4412 current: state 4413 }); 4414}, useTransitionMap = ({ 4415 allowMultiple, 4416 enter = !0, 4417 exit = !0, 4418 preEnter, 4419 preExit, 4420 timeout, 4421 initialEntered, 4422 mountOnEnter, 4423 unmountOnExit, 4424 onStateChange: onChange 4425} = {}) => { 4426 let [stateMap, setStateMap] = useState(/* @__PURE__ */ new Map()), latestStateMap = useRef(stateMap), configMap = useRef(/* @__PURE__ */ new Map()), [enterTimeout, exitTimeout] = getTimeout(timeout), setItem = useCallback((key, config) => { 4427 let { 4428 initialEntered: _initialEntered = initialEntered 4429 } = config || {}, status = _initialEntered ? 2 : startOrEnd(mountOnEnter); 4430 updateState2(key, status, setStateMap, latestStateMap), configMap.current.set(key, {}); 4431 }, [initialEntered, mountOnEnter]), deleteItem = useCallback((key) => { 4432 let newStateMap = new Map(latestStateMap.current); 4433 return newStateMap.delete(key) ? (setStateMap(newStateMap), latestStateMap.current = newStateMap, configMap.current.delete(key), !0) : !1; 4434 }, []), endTransition = useCallback((key) => { 4435 let stateObj = latestStateMap.current.get(key); 4436 if (!stateObj) 4437 return; 4438 let { 4439 timeoutId 4440 } = configMap.current.get(key), status = getEndStatus(stateObj._s, unmountOnExit); 4441 status && updateState2(key, status, setStateMap, latestStateMap, timeoutId, onChange); 4442 }, [onChange, unmountOnExit]), toggle = useCallback((key, toEnter) => { 4443 let stateObj = latestStateMap.current.get(key); 4444 if (!stateObj) 4445 return; 4446 let config = configMap.current.get(key), transitState = (status) => { 4447 switch (updateState2(key, status, setStateMap, latestStateMap, config.timeoutId, onChange), status) { 4448 case 1: 4449 enterTimeout >= 0 && (config.timeoutId = setTimeout(() => endTransition(key), enterTimeout)); 4450 break; 4451 case 4: 4452 exitTimeout >= 0 && (config.timeoutId = setTimeout(() => endTransition(key), exitTimeout)); 4453 break; 4454 case 0: 4455 case 3: 4456 config.timeoutId = nextTick(transitState, status); 4457 break; 4458 } 4459 }, enterStage = stateObj.isEnter; 4460 typeof toEnter != "boolean" && (toEnter = !enterStage), toEnter ? enterStage || (transitState(enter ? preEnter ? 0 : 1 : 2), !allowMultiple && latestStateMap.current.forEach((_2, _key) => _key !== key && toggle(_key, !1))) : enterStage && transitState(exit ? preExit ? 3 : 4 : startOrEnd(unmountOnExit)); 4461 }, [onChange, endTransition, allowMultiple, enter, exit, preEnter, preExit, enterTimeout, exitTimeout, unmountOnExit]), toggleAll = useCallback((toEnter) => { 4462 if (!(!allowMultiple && toEnter !== !1)) 4463 for (let key of latestStateMap.current.keys()) toggle(key, toEnter); 4464 }, [allowMultiple, toggle]); 4465 return { 4466 stateMap, 4467 toggle, 4468 toggleAll, 4469 endTransition, 4470 setItem, 4471 deleteItem 4472 }; 4473}; 4474 4475// src/manager/components/upgrade/UpgradeBlock.tsx 4476init_react(); 4477var UpgradeBlock = ({ onNavigateToWhatsNew }) => { 4478 let api = useStorybookApi(), [activeTab, setActiveTab] = useState("npm"); 4479 return react_default.createElement(Container2, null, react_default.createElement("strong", null, "You are on Storybook ", api.getCurrentVersion().version), react_default.createElement("p", null, "Run the following script to check for updates and upgrade to the latest version."), react_default.createElement(Tabs2, null, react_default.createElement(ButtonTab, { active: activeTab === "npm", onClick: () => setActiveTab("npm") }, "npm"), react_default.createElement(ButtonTab, { active: activeTab === "yarn", onClick: () => setActiveTab("yarn") }, "yarn"), react_default.createElement(ButtonTab, { active: activeTab === "pnpm", onClick: () => setActiveTab("pnpm") }, "pnpm")), react_default.createElement(Code2, null, activeTab === "npm" ? "npx storybook@latest upgrade" : `${activeTab} dlx storybook@latest upgrade`), onNavigateToWhatsNew && react_default.createElement(Link, { onClick: onNavigateToWhatsNew }, "See what's new in Storybook")); 4480}, Container2 = styled.div(({ theme }) => ({ 4481 border: "1px solid", 4482 borderRadius: 5, 4483 padding: 20, 4484 marginTop: 0, 4485 borderColor: theme.appBorderColor, 4486 fontSize: theme.typography.size.s2, 4487 width: "100%", 4488 [MEDIA_DESKTOP_BREAKPOINT]: { 4489 maxWidth: 400 4490 } 4491})), Tabs2 = styled.div({ 4492 display: "flex", 4493 gap: 2 4494}), Code2 = styled.pre(({ theme }) => ({ 4495 background: theme.base === "light" ? "rgba(0, 0, 0, 0.05)" : theme.appBorderColor, 4496 fontSize: theme.typography.size.s2 - 1, 4497 margin: "4px 0 16px" 4498})), ButtonTab = styled.button(({ theme, active }) => ({ 4499 all: "unset", 4500 alignItems: "center", 4501 gap: 10, 4502 color: theme.color.defaultText, 4503 fontSize: theme.typography.size.s2 - 1, 4504 borderBottom: "2px solid transparent", 4505 borderBottomColor: active ? theme.color.secondary : "none", 4506 padding: "0 10px 5px", 4507 marginBottom: "5px", 4508 cursor: "pointer" 4509})); 4510 4511// src/manager/components/mobile/about/MobileAbout.tsx 4512var MobileAbout = () => { 4513 let { isMobileAboutOpen, setMobileAboutOpen } = useLayout(), aboutRef = useRef(null), [state, toggle] = useTransitionState({ 4514 timeout: 300, 4515 mountOnEnter: !0, 4516 unmountOnExit: !0 4517 }); 4518 return useEffect(() => { 4519 toggle(isMobileAboutOpen); 4520 }, [isMobileAboutOpen, toggle]), state.isMounted ? react_default.createElement( 4521 Container3, 4522 { 4523 ref: aboutRef, 4524 $status: state.status, 4525 $transitionDuration: 300 4526 }, 4527 react_default.createElement(ScrollArea, { vertical: !0, offset: 3, scrollbarSize: 6 }, react_default.createElement(InnerArea, null, react_default.createElement( 4528 CloseButton, 4529 { 4530 onClick: () => setMobileAboutOpen(!1), 4531 ariaLabel: "Close about section", 4532 tooltip: "Close about section", 4533 variant: "ghost" 4534 }, 4535 react_default.createElement(ArrowLeftIcon, null), 4536 "Back" 4537 ), react_default.createElement(LinkContainer, null, react_default.createElement( 4538 LinkLine, 4539 { 4540 href: "https://github.com/storybookjs/storybook", 4541 target: "_blank", 4542 rel: "noopener noreferrer" 4543 }, 4544 react_default.createElement(LinkLeft, null, react_default.createElement(GithubIcon, null), react_default.createElement("span", null, "Github")), 4545 react_default.createElement(ShareAltIcon, { width: 12 }) 4546 ), react_default.createElement( 4547 LinkLine, 4548 { 4549 href: "https://storybook.js.org/docs/get-started/install?ref=ui", 4550 target: "_blank", 4551 rel: "noopener noreferrer" 4552 }, 4553 react_default.createElement(LinkLeft, null, react_default.createElement(StorybookIcon, null), react_default.createElement("span", null, "Documentation")), 4554 react_default.createElement(ShareAltIcon, { width: 12 }) 4555 )), react_default.createElement(UpgradeBlock, null), react_default.createElement(BottomText, null, "Open source software maintained by", " ", react_default.createElement(Link, { href: "https://chromatic.com", target: "_blank", rel: "noopener noreferrer" }, "Chromatic"), " ", "and the", " ", react_default.createElement( 4556 Link, 4557 { 4558 href: "https://github.com/storybookjs/storybook/graphs/contributors", 4559 rel: "noopener noreferrer" 4560 }, 4561 "Storybook Community" 4562 )))) 4563 ) : null; 4564}, slideFromRight = keyframes({ 4565 from: { 4566 opacity: 0, 4567 transform: "translate(20px, 0)" 4568 }, 4569 to: { 4570 opacity: 1, 4571 transform: "translate(0, 0)" 4572 } 4573}), slideToRight = keyframes({ 4574 from: { 4575 opacity: 1, 4576 transform: "translate(0, 0)" 4577 }, 4578 to: { 4579 opacity: 0, 4580 transform: "translate(20px, 0)" 4581 } 4582}), Container3 = styled.div( 4583 ({ theme, $status, $transitionDuration }) => ({ 4584 position: "absolute", 4585 width: "100%", 4586 height: "100%", 4587 borderRadius: "10px 10px 0 0", 4588 top: 0, 4589 left: 0, 4590 zIndex: 11, 4591 overflow: "auto", 4592 color: theme.color.defaultText, 4593 background: theme.background.content, 4594 animation: $status === "exiting" ? `${slideToRight} ${$transitionDuration}ms` : `${slideFromRight} ${$transitionDuration}ms` 4595 }) 4596), InnerArea = styled.div({ 4597 display: "flex", 4598 flexDirection: "column", 4599 gap: 20, 4600 padding: "25px 12px 20px" 4601}), LinkContainer = styled.div({}), LinkLine = styled.a(({ theme }) => ({ 4602 all: "unset", 4603 display: "flex", 4604 alignItems: "center", 4605 justifyContent: "space-between", 4606 fontSize: theme.typography.size.s2 - 1, 4607 borderBottom: `1px solid ${theme.appBorderColor}`, 4608 cursor: "pointer", 4609 padding: "0 10px", 4610 "&:last-child": { 4611 borderBottom: "none" 4612 } 4613})), LinkLeft = styled.div(({ theme }) => ({ 4614 display: "flex", 4615 alignItems: "center", 4616 fontSize: theme.typography.size.s2 - 1, 4617 height: 40, 4618 gap: 5 4619})), BottomText = styled.div(({ theme }) => ({ 4620 fontSize: theme.typography.size.s2 - 1, 4621 marginTop: 30 4622})), CloseButton = styled(Button)({ 4623 alignSelf: "start" 4624}); 4625 4626// src/manager/components/mobile/navigation/MobileMenuDrawer.tsx 4627var MobileMenuDrawer = ({ 4628 children, 4629 id, 4630 isOpen, 4631 onOpenChange 4632}) => react_default.createElement( 4633 Modal, 4634 { 4635 ariaLabel: "Menu", 4636 transitionDuration: 300, 4637 variant: "bottom-drawer", 4638 height: "80dvh", 4639 id, 4640 open: isOpen, 4641 onOpenChange 4642 }, 4643 children, 4644 react_default.createElement(MobileAbout, null) 4645); 4646 4647// src/manager/components/mobile/navigation/MobileNavigation.tsx 4648function combineIndexes(rootIndex, refs) { 4649 let combinedIndex = { ...rootIndex || {} }; 4650 return Object.values(refs).forEach((ref) => { 4651 ref.index && Object.assign(combinedIndex, ref.index); 4652 }), combinedIndex; 4653} 4654var useFullStoryName = () => { 4655 let { index, refs } = useStorybookState(), api = useStorybookApi(), currentStory = api.getCurrentStoryData(); 4656 if (!currentStory) 4657 return ""; 4658 let combinedIndex = combineIndexes(index, refs || {}), storyLabel = currentStory.renderLabel?.(currentStory, api), fullStoryName = typeof storyLabel == "string" ? storyLabel : currentStory.name, node = combinedIndex[currentStory.id]; 4659 for (; node && "parent" in node && node.parent && combinedIndex[node.parent] && fullStoryName.length < 24; ) { 4660 node = combinedIndex[node.parent]; 4661 let parentLabel = node.renderLabel?.(node, api); 4662 fullStoryName = `${typeof parentLabel == "string" ? parentLabel : node.name}/${fullStoryName}`; 4663 } 4664 return fullStoryName; 4665}, MobileBottomBarContent = ({ 4666 fullStoryName, 4667 isMobileMenuOpen, 4668 setMobileMenuOpen, 4669 isMobilePanelOpen, 4670 setMobilePanelOpen, 4671 showMenu, 4672 showPanel, 4673 navShortcut 4674}) => { 4675 let headingId = $bdb11010cef70236$export$f680877a34711e37(), sectionRef = useRef(null), { landmarkProps } = useLandmark( 4676 { "aria-labelledby": headingId, role: "banner" }, 4677 sectionRef 4678 ); 4679 return react_default.createElement(MobileBottomBar, { className: "sb-bar", ...landmarkProps, ref: sectionRef }, react_default.createElement("h2", { id: headingId, className: "sb-sr-only" }, "Navigation controls"), showMenu && react_default.createElement( 4680 BottomBarButton, 4681 { 4682 padding: "small", 4683 variant: "ghost", 4684 onClick: () => setMobileMenuOpen(!isMobileMenuOpen), 4685 ariaLabel: "Open navigation menu", 4686 "aria-expanded": isMobileMenuOpen, 4687 "aria-controls": isMobileMenuOpen ? "storybook-mobile-menu" : void 0, 4688 shortcut: navShortcut 4689 }, 4690 react_default.createElement(MenuIcon, null), 4691 react_default.createElement(Text, null, fullStoryName) 4692 ), react_default.createElement("span", { className: "sb-sr-only", "aria-current": "page" }, fullStoryName), showPanel && react_default.createElement( 4693 BottomBarButton, 4694 { 4695 padding: "small", 4696 variant: "ghost", 4697 onClick: () => setMobilePanelOpen(!0), 4698 ariaLabel: "Open addon panel", 4699 "aria-expanded": isMobilePanelOpen, 4700 "aria-controls": isMobilePanelOpen ? "storybook-mobile-addon-panel" : void 0 4701 }, 4702 react_default.createElement(BottomBarToggleIcon, null) 4703 )); 4704}, MobileNavigation = ({ 4705 menu, 4706 panel, 4707 showMenu = !0, 4708 showPanel, 4709 ...props 4710}) => { 4711 let { isMobilePanelOpen, setMobilePanelOpen } = useLayout(), fullStoryName = useFullStoryName(), api = useStorybookApi(), { layout, ui } = useStorybookState(), isMobileMenuOpen = layout.showMobileNavigation, setMobileMenuOpen = useCallback((open) => api.setMobileNavigation(open), [api]), apiRef = useRef(api); 4712 apiRef.current = api, useEffect(() => () => apiRef.current.setMobileNavigation(!1), []); 4713 let navShortcut = ui.enableShortcuts ?? !0 ? api.getShortcutKeys().toggleNav : void 0; 4714 return useLayoutEffect(() => { 4715 showMenu || setMobileMenuOpen(!1); 4716 }, [showMenu, setMobileMenuOpen]), react_default.createElement(Container4, { ...props }, showMenu && react_default.createElement( 4717 MobileMenuDrawer, 4718 { 4719 id: "storybook-mobile-menu", 4720 isOpen: isMobileMenuOpen, 4721 onOpenChange: setMobileMenuOpen 4722 }, 4723 menu 4724 ), react_default.createElement( 4725 MobileAddonsDrawer, 4726 { 4727 id: "storybook-mobile-addon-panel", 4728 isOpen: isMobilePanelOpen, 4729 onOpenChange: setMobilePanelOpen 4730 }, 4731 panel 4732 ), !isMobilePanelOpen && (showMenu || showPanel) && react_default.createElement( 4733 MobileBottomBarContent, 4734 { 4735 fullStoryName, 4736 isMobileMenuOpen, 4737 setMobileMenuOpen, 4738 isMobilePanelOpen, 4739 setMobilePanelOpen, 4740 showMenu, 4741 showPanel, 4742 navShortcut 4743 } 4744 )); 4745}, Container4 = styled.section(({ theme }) => ({ 4746 bottom: 0, 4747 left: 0, 4748 width: "100%", 4749 zIndex: 10, 4750 background: theme.barBg, 4751 borderTop: `1px solid ${theme.appBorderColor}` 4752})), MobileBottomBar = styled.header({ 4753 display: "flex", 4754 alignItems: "center", 4755 justifyContent: "space-between", 4756 width: "100%", 4757 height: 40, 4758 padding: "0 6px", 4759 /* Because Popper.js's tooltip is creating extra div layers, we have to 4760 * punch through them to configure the button to ellipsize. */ 4761 "& > *:first-child": { 4762 /* 6px padding * 2 + 28px for the orientation button */ 4763 maxWidth: "calc(100% - 40px)", 4764 "& > button": { 4765 maxWidth: "100%" 4766 }, 4767 "& > button p": { 4768 textOverflow: "ellipsis" 4769 } 4770 } 4771}), BottomBarButton = styled(Button)({ 4772 WebkitLineClamp: 1, 4773 flexShrink: 1, 4774 p: { 4775 textOverflow: "ellipsis" 4776 } 4777}), Text = styled.p({ 4778 display: "-webkit-box", 4779 WebkitLineClamp: 1, 4780 WebkitBoxOrient: "vertical", 4781 overflow: "hidden" 4782}); 4783 4784// src/manager/components/layout/MainAreaContainer.tsx 4785init_react(); 4786var PagesInnerContainer = styled.main(({ theme }) => ({ 4787 display: "flex", 4788 flexDirection: "column", 4789 gridRowStart: "sidebar-start", 4790 gridRowEnd: "-1", 4791 gridColumnStart: "sidebar-end", 4792 gridColumnEnd: "-1", 4793 backgroundColor: theme.appContentBg, 4794 zIndex: 1 4795})), PagesContainer = react_default.memo(function(props) { 4796 let { children } = props, mainRef = useRef(null), { landmarkProps } = useLandmark( 4797 { "aria-labelledby": "main-content-heading", role: "main" }, 4798 mainRef 4799 ); 4800 return react_default.createElement(PagesInnerContainer, { id: "main-content-wrapper", ref: mainRef, ...landmarkProps }, react_default.createElement("h2", { id: "main-content-heading", className: "sb-sr-only" }, "Main content"), children); 4801}), MainInnerContainer = styled.div(({ theme, shown }) => ({ 4802 flex: 1, 4803 position: "relative", 4804 backgroundColor: theme.appContentBg, 4805 display: shown ? "grid" : "none", 4806 // This is needed to make the content container fill the available space 4807 overflow: "auto", 4808 [MEDIA_DESKTOP_BREAKPOINT]: { 4809 flex: "auto", 4810 gridArea: "content" 4811 } 4812})), MainAreaContainer = react_default.memo(function({ 4813 showPages, 4814 slotMain, 4815 slotPages 4816}) { 4817 return react_default.createElement(react_default.Fragment, null, showPages ? react_default.createElement(PagesContainer, null, slotPages) : react_default.createElement(Match, { path: /(^\/story|docs|onboarding\/|^\/$)/, startsWith: !1 }, ({ match }) => react_default.createElement(MainInnerContainer, { shown: !!match }, slotMain))); 4818}); 4819 4820// src/manager/components/layout/PanelContainer.tsx 4821init_react(); 4822 4823// src/manager/components/layout/Drag.tsx 4824init_react(); 4825 4826// src/components/components/tooltip/TooltipNote.tsx 4827init_react(); 4828var DEFAULT_MAX_WIDTH = 260, Note = styled.div( 4829 ({ theme }) => ({ 4830 fontFamily: theme.typography.fonts.base, 4831 padding: "2px 6px", 4832 lineHeight: "16px", 4833 fontSize: 10, 4834 fontWeight: theme.typography.weight.bold, 4835 color: theme.color.lightest, 4836 boxShadow: "0 0 5px 0 rgba(0, 0, 0, 0.3)", 4837 borderRadius: 4, 4838 pointerEvents: "none", 4839 zIndex: -1, 4840 background: theme.base === "light" ? "rgba(60, 60, 60, 0.9)" : "rgba(0, 0, 0, 0.95)" 4841 }), 4842 ({ maxWidth }) => ({ maxWidth }) 4843), TooltipNote2 = ({ note, maxWidth = DEFAULT_MAX_WIDTH, ...props }) => react_default.createElement(Note, { maxWidth, ...props }, note); 4844 4845// src/components/components/tooltip/TooltipProvider.tsx 4846init_react(); 4847 4848// ../../node_modules/@react-aria/interactions/dist/utils.mjs 4849init_react(); 4850function $8a9cb279dc87e130$export$525bc4921d56d4a(nativeEvent) { 4851 let event = nativeEvent; 4852 return event.nativeEvent = nativeEvent, event.isDefaultPrevented = () => event.defaultPrevented, event.isPropagationStopped = () => event.cancelBubble, event.persist = () => { 4853 }, event; 4854} 4855function $8a9cb279dc87e130$export$c2b7abe5d61ec696(event, target) { 4856 Object.defineProperty(event, "target", { 4857 value: target 4858 }), Object.defineProperty(event, "currentTarget", { 4859 value: target 4860 }); 4861} 4862function $8a9cb279dc87e130$export$715c682d09d639cc(onBlur) { 4863 let stateRef = useRef({ 4864 isFocused: !1, 4865 observer: null 4866 }); 4867 $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => { 4868 let state = stateRef.current; 4869 return () => { 4870 state.observer && (state.observer.disconnect(), state.observer = null); 4871 }; 4872 }, []); 4873 let dispatchBlur = $8ae05eaa5c114e9c$export$7f54fc3180508a52((e2) => { 4874 onBlur?.(e2); 4875 }); 4876 return useCallback((e2) => { 4877 if (e2.target instanceof HTMLButtonElement || e2.target instanceof HTMLInputElement || e2.target instanceof HTMLTextAreaElement || e2.target instanceof HTMLSelectElement) { 4878 stateRef.current.isFocused = !0; 4879 let target = e2.target, onBlurHandler = (e3) => { 4880 if (stateRef.current.isFocused = !1, target.disabled) { 4881 let event = $8a9cb279dc87e130$export$525bc4921d56d4a(e3); 4882 dispatchBlur(event); 4883 } 4884 stateRef.current.observer && (stateRef.current.observer.disconnect(), stateRef.current.observer = null); 4885 }; 4886 target.addEventListener("focusout", onBlurHandler, { 4887 once: !0 4888 }), stateRef.current.observer = new MutationObserver(() => { 4889 if (stateRef.current.isFocused && target.disabled) { 4890 var _stateRef_current_observer; 4891 (_stateRef_current_observer = stateRef.current.observer) === null || _stateRef_current_observer === void 0 || _stateRef_current_observer.disconnect(); 4892 let relatedTargetEl = target === document.activeElement ? null : document.activeElement; 4893 target.dispatchEvent(new FocusEvent("blur", { 4894 relatedTarget: relatedTargetEl 4895 })), target.dispatchEvent(new FocusEvent("focusout", { 4896 bubbles: !0, 4897 relatedTarget: relatedTargetEl 4898 })); 4899 } 4900 }), stateRef.current.observer.observe(target, { 4901 attributes: !0, 4902 attributeFilter: [ 4903 "disabled" 4904 ] 4905 }); 4906 } 4907 }, [ 4908 dispatchBlur 4909 ]); 4910} 4911var $8a9cb279dc87e130$export$fda7da73ab5d4c48 = !1; 4912function $8a9cb279dc87e130$export$cabe61c495ee3649(target) { 4913 for (; target && !$b4b717babfbb907b$export$4c063cf1350e6fed(target); ) target = target.parentElement; 4914 let window2 = $431fbd86ca7dc216$export$f21a1ffae260145a(target), activeElement = window2.document.activeElement; 4915 if (!activeElement || activeElement === target) return; 4916 $8a9cb279dc87e130$export$fda7da73ab5d4c48 = !0; 4917 let isRefocusing = !1, onBlur = (e2) => { 4918 (e2.target === activeElement || isRefocusing) && e2.stopImmediatePropagation(); 4919 }, onFocusOut = (e2) => { 4920 (e2.target === activeElement || isRefocusing) && (e2.stopImmediatePropagation(), !target && !isRefocusing && (isRefocusing = !0, $7215afc6de606d6b$export$de79e2c695e052f3(activeElement), cleanup())); 4921 }, onFocus = (e2) => { 4922 (e2.target === target || isRefocusing) && e2.stopImmediatePropagation(); 4923 }, onFocusIn = (e2) => { 4924 (e2.target === target || isRefocusing) && (e2.stopImmediatePropagation(), isRefocusing || (isRefocusing = !0, $7215afc6de606d6b$export$de79e2c695e052f3(activeElement), cleanup())); 4925 }; 4926 window2.addEventListener("blur", onBlur, !0), window2.addEventListener("focusout", onFocusOut, !0), window2.addEventListener("focusin", onFocusIn, !0), window2.addEventListener("focus", onFocus, !0); 4927 let cleanup = () => { 4928 cancelAnimationFrame(raf), window2.removeEventListener("blur", onBlur, !0), window2.removeEventListener("focusout", onFocusOut, !0), window2.removeEventListener("focusin", onFocusIn, !0), window2.removeEventListener("focus", onFocus, !0), $8a9cb279dc87e130$export$fda7da73ab5d4c48 = !1, isRefocusing = !1; 4929 }, raf = requestAnimationFrame(cleanup); 4930 return cleanup; 4931} 4932 4933// ../../node_modules/@react-aria/interactions/dist/textSelection.mjs 4934var $14c0b72509d70225$var$state = "default", $14c0b72509d70225$var$savedUserSelect = "", $14c0b72509d70225$var$modifiedElementMap = /* @__PURE__ */ new WeakMap(); 4935function $14c0b72509d70225$export$16a4697467175487(target) { 4936 if ($c87311424ea30a05$export$fedb369cb70207f1()) { 4937 if ($14c0b72509d70225$var$state === "default") { 4938 let documentObject = $431fbd86ca7dc216$export$b204af158042fbac(target); 4939 $14c0b72509d70225$var$savedUserSelect = documentObject.documentElement.style.webkitUserSelect, documentObject.documentElement.style.webkitUserSelect = "none"; 4940 } 4941 $14c0b72509d70225$var$state = "disabled"; 4942 } else if (target instanceof HTMLElement || target instanceof SVGElement) { 4943 let property = "userSelect" in target.style ? "userSelect" : "webkitUserSelect"; 4944 $14c0b72509d70225$var$modifiedElementMap.set(target, target.style[property]), target.style[property] = "none"; 4945 } 4946} 4947function $14c0b72509d70225$export$b0d6fa1ab32e3295(target) { 4948 if ($c87311424ea30a05$export$fedb369cb70207f1()) { 4949 if ($14c0b72509d70225$var$state !== "disabled") return; 4950 $14c0b72509d70225$var$state = "restoring", setTimeout(() => { 4951 $bbed8b41f857bcc0$export$24490316f764c430(() => { 4952 if ($14c0b72509d70225$var$state === "restoring") { 4953 let documentObject = $431fbd86ca7dc216$export$b204af158042fbac(target); 4954 documentObject.documentElement.style.webkitUserSelect === "none" && (documentObject.documentElement.style.webkitUserSelect = $14c0b72509d70225$var$savedUserSelect || ""), $14c0b72509d70225$var$savedUserSelect = "", $14c0b72509d70225$var$state = "default"; 4955 } 4956 }); 4957 }, 300); 4958 } else if ((target instanceof HTMLElement || target instanceof SVGElement) && target && $14c0b72509d70225$var$modifiedElementMap.has(target)) { 4959 let targetOldUserSelect = $14c0b72509d70225$var$modifiedElementMap.get(target), property = "userSelect" in target.style ? "userSelect" : "webkitUserSelect"; 4960 target.style[property] === "none" && (target.style[property] = targetOldUserSelect), target.getAttribute("style") === "" && target.removeAttribute("style"), $14c0b72509d70225$var$modifiedElementMap.delete(target); 4961 } 4962} 4963 4964// ../../node_modules/@react-aria/interactions/dist/context.mjs 4965init_react(); 4966var $ae1eeba8b9eafd08$export$5165eccb35aaadb5 = react_default.createContext({ 4967 register: () => { 4968 } 4969}); 4970$ae1eeba8b9eafd08$export$5165eccb35aaadb5.displayName = "PressResponderContext"; 4971 4972// ../../node_modules/@swc/helpers/esm/_class_apply_descriptor_get.js 4973function _class_apply_descriptor_get(receiver, descriptor) { 4974 return descriptor.get ? descriptor.get.call(receiver) : descriptor.value; 4975} 4976 4977// ../../node_modules/@swc/helpers/esm/_class_extract_field_descriptor.js 4978function _class_extract_field_descriptor(receiver, privateMap, action) { 4979 if (!privateMap.has(receiver)) throw new TypeError("attempted to " + action + " private field on non-instance"); 4980 return privateMap.get(receiver); 4981} 4982 4983// ../../node_modules/@swc/helpers/esm/_class_private_field_get.js 4984function _class_private_field_get(receiver, privateMap) { 4985 var descriptor = _class_extract_field_descriptor(receiver, privateMap, "get"); 4986 return _class_apply_descriptor_get(receiver, descriptor); 4987} 4988 4989// ../../node_modules/@swc/helpers/esm/_check_private_redeclaration.js 4990function _check_private_redeclaration(obj, privateCollection) { 4991 if (privateCollection.has(obj)) 4992 throw new TypeError("Cannot initialize the same private elements twice on an object"); 4993} 4994 4995// ../../node_modules/@swc/helpers/esm/_class_private_field_init.js 4996function _class_private_field_init(obj, privateMap, value) { 4997 _check_private_redeclaration(obj, privateMap), privateMap.set(obj, value); 4998} 4999 5000// ../../node_modules/@swc/helpers/esm/_class_apply_descriptor_set.js 5001function _class_apply_descriptor_set(receiver, descriptor, value) { 5002 if (descriptor.set) descriptor.set.call(receiver, value); 5003 else { 5004 if (!descriptor.writable) 5005 throw new TypeError("attempted to set read only private field"); 5006 descriptor.value = value; 5007 } 5008} 5009 5010// ../../node_modules/@swc/helpers/esm/_class_private_field_set.js 5011function _class_private_field_set(receiver, privateMap, value) { 5012 var descriptor = _class_extract_field_descriptor(receiver, privateMap, "set"); 5013 return _class_apply_descriptor_set(receiver, descriptor, value), value; 5014} 5015 5016// ../../node_modules/@react-aria/interactions/dist/usePress.mjs 5017init_react(); 5018function $f6c31cce2adf654f$var$usePressResponderContext(props) { 5019 let context = useContext($ae1eeba8b9eafd08$export$5165eccb35aaadb5); 5020 if (context) { 5021 let { register, ...contextProps } = context; 5022 props = $3ef42575df84b30b$export$9d1611c77c2fe928(contextProps, props), register(); 5023 } 5024 return $e7801be82b4b2a53$export$4debdb1a3f0fa79e(context, props.ref), props; 5025} 5026var $f6c31cce2adf654f$var$_shouldStopPropagation = /* @__PURE__ */ new WeakMap(), $f6c31cce2adf654f$var$PressEvent = class { 5027 continuePropagation() { 5028 _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation, !1); 5029 } 5030 get shouldStopPropagation() { 5031 return _class_private_field_get(this, $f6c31cce2adf654f$var$_shouldStopPropagation); 5032 } 5033 constructor(type, pointerType, originalEvent, state) { 5034 _class_private_field_init(this, $f6c31cce2adf654f$var$_shouldStopPropagation, { 5035 writable: !0, 5036 value: void 0 5037 }), _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation, !0); 5038 var _state_target; 5039 let currentTarget = (_state_target = state?.target) !== null && _state_target !== void 0 ? _state_target : originalEvent.currentTarget, rect = currentTarget?.getBoundingClientRect(), x2, y2 = 0, clientX, clientY = null; 5040 originalEvent.clientX != null && originalEvent.clientY != null && (clientX = originalEvent.clientX, clientY = originalEvent.clientY), rect && (clientX != null && clientY != null ? (x2 = clientX - rect.left, y2 = clientY - rect.top) : (x2 = rect.width / 2, y2 = rect.height / 2)), this.type = type, this.pointerType = pointerType, this.target = originalEvent.currentTarget, this.shiftKey = originalEvent.shiftKey, this.metaKey = originalEvent.metaKey, this.ctrlKey = originalEvent.ctrlKey, this.altKey = originalEvent.altKey, this.x = x2, this.y = y2; 5041 } 5042}, $f6c31cce2adf654f$var$LINK_CLICKED = /* @__PURE__ */ Symbol("linkClicked"), $f6c31cce2adf654f$var$STYLE_ID = "react-aria-pressable-style", $f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE = "data-react-aria-pressable"; 5043function $f6c31cce2adf654f$export$45712eceda6fad21(props) { 5044 let { onPress, onPressChange, onPressStart, onPressEnd, onPressUp, onClick, isDisabled, isPressed: isPressedProp, preventFocusOnPress, shouldCancelOnPointerExit, allowTextSelectionOnPress, ref: domRef, ...domProps } = $f6c31cce2adf654f$var$usePressResponderContext(props), [isPressed, setPressed] = useState(!1), ref = useRef({ 5045 isPressed: !1, 5046 ignoreEmulatedMouseEvents: !1, 5047 didFirePressStart: !1, 5048 isTriggeringEvent: !1, 5049 activePointerId: null, 5050 target: null, 5051 isOverTarget: !1, 5052 pointerType: null, 5053 disposables: [] 5054 }), { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6(), triggerPressStart = $8ae05eaa5c114e9c$export$7f54fc3180508a52((originalEvent, pointerType) => { 5055 let state = ref.current; 5056 if (isDisabled || state.didFirePressStart) return !1; 5057 let shouldStopPropagation = !0; 5058 if (state.isTriggeringEvent = !0, onPressStart) { 5059 let event = new $f6c31cce2adf654f$var$PressEvent("pressstart", pointerType, originalEvent); 5060 onPressStart(event), shouldStopPropagation = event.shouldStopPropagation; 5061 } 5062 return onPressChange && onPressChange(!0), state.isTriggeringEvent = !1, state.didFirePressStart = !0, setPressed(!0), shouldStopPropagation; 5063 }), triggerPressEnd = $8ae05eaa5c114e9c$export$7f54fc3180508a52((originalEvent, pointerType, wasPressed = !0) => { 5064 let state = ref.current; 5065 if (!state.didFirePressStart) return !1; 5066 state.didFirePressStart = !1, state.isTriggeringEvent = !0; 5067 let shouldStopPropagation = !0; 5068 if (onPressEnd) { 5069 let event = new $f6c31cce2adf654f$var$PressEvent("pressend", pointerType, originalEvent); 5070 onPressEnd(event), shouldStopPropagation = event.shouldStopPropagation; 5071 } 5072 if (onPressChange && onPressChange(!1), setPressed(!1), onPress && wasPressed && !isDisabled) { 5073 let event = new $f6c31cce2adf654f$var$PressEvent("press", pointerType, originalEvent); 5074 onPress(event), shouldStopPropagation && (shouldStopPropagation = event.shouldStopPropagation); 5075 } 5076 return state.isTriggeringEvent = !1, shouldStopPropagation; 5077 }), triggerPressUp = $8ae05eaa5c114e9c$export$7f54fc3180508a52((originalEvent, pointerType) => { 5078 let state = ref.current; 5079 if (isDisabled) return !1; 5080 if (onPressUp) { 5081 state.isTriggeringEvent = !0; 5082 let event = new $f6c31cce2adf654f$var$PressEvent("pressup", pointerType, originalEvent); 5083 return onPressUp(event), state.isTriggeringEvent = !1, event.shouldStopPropagation; 5084 } 5085 return !0; 5086 }), cancel = $8ae05eaa5c114e9c$export$7f54fc3180508a52((e2) => { 5087 let state = ref.current; 5088 if (state.isPressed && state.target) { 5089 state.didFirePressStart && state.pointerType != null && triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e2), state.pointerType, !1), state.isPressed = !1, state.isOverTarget = !1, state.activePointerId = null, state.pointerType = null, removeAllGlobalListeners(), allowTextSelectionOnPress || $14c0b72509d70225$export$b0d6fa1ab32e3295(state.target); 5090 for (let dispose of state.disposables) dispose(); 5091 state.disposables = []; 5092 } 5093 }), cancelOnPointerExit = $8ae05eaa5c114e9c$export$7f54fc3180508a52((e2) => { 5094 shouldCancelOnPointerExit && cancel(e2); 5095 }), triggerClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52((e2) => { 5096 isDisabled || onClick?.(e2); 5097 }), triggerSyntheticClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52((e2, target) => { 5098 if (!isDisabled && onClick) { 5099 let event = new MouseEvent("click", e2); 5100 $8a9cb279dc87e130$export$c2b7abe5d61ec696(event, target), onClick($8a9cb279dc87e130$export$525bc4921d56d4a(event)); 5101 } 5102 }), pressProps = useMemo(() => { 5103 let state = ref.current, pressProps2 = { 5104 onKeyDown(e2) { 5105 if ($f6c31cce2adf654f$var$isValidKeyboardEvent(e2.nativeEvent, e2.currentTarget) && $d4ee10de306f2510$export$4282f70798064fe0(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29(e2.nativeEvent))) { 5106 var _state_metaKeyEvents; 5107 $f6c31cce2adf654f$var$shouldPreventDefaultKeyboard($d4ee10de306f2510$export$e58f029f0fbfdb29(e2.nativeEvent), e2.key) && e2.preventDefault(); 5108 let shouldStopPropagation = !0; 5109 if (!state.isPressed && !e2.repeat) { 5110 state.target = e2.currentTarget, state.isPressed = !0, state.pointerType = "keyboard", shouldStopPropagation = triggerPressStart(e2, "keyboard"); 5111 let originalTarget = e2.currentTarget, pressUp = (e3) => { 5112 $f6c31cce2adf654f$var$isValidKeyboardEvent(e3, originalTarget) && !e3.repeat && $d4ee10de306f2510$export$4282f70798064fe0(originalTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29(e3)) && state.target && triggerPressUp($f6c31cce2adf654f$var$createEvent(state.target, e3), "keyboard"); 5113 }; 5114 addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac(e2.currentTarget), "keyup", $ff5963eb1fccf552$export$e08e3b67e392101e(pressUp, onKeyUp), !0); 5115 } 5116 shouldStopPropagation && e2.stopPropagation(), e2.metaKey && $c87311424ea30a05$export$9ac100e40613ea10() && ((_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 || _state_metaKeyEvents.set(e2.key, e2.nativeEvent)); 5117 } else e2.key === "Meta" && (state.metaKeyEvents = /* @__PURE__ */ new Map()); 5118 }, 5119 onClick(e2) { 5120 if (!(e2 && !$d4ee10de306f2510$export$4282f70798064fe0(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29(e2.nativeEvent))) && e2 && e2.button === 0 && !state.isTriggeringEvent && !$ea8dcbcb9ea1b556$export$95185d699e05d4d7.isOpening) { 5121 let shouldStopPropagation = !0; 5122 if (isDisabled && e2.preventDefault(), !state.ignoreEmulatedMouseEvents && !state.isPressed && (state.pointerType === "virtual" || $6a7db85432448f7f$export$60278871457622de(e2.nativeEvent))) { 5123 let stopPressStart = triggerPressStart(e2, "virtual"), stopPressUp = triggerPressUp(e2, "virtual"), stopPressEnd = triggerPressEnd(e2, "virtual"); 5124 triggerClick(e2), shouldStopPropagation = stopPressStart && stopPressUp && stopPressEnd; 5125 } else if (state.isPressed && state.pointerType !== "keyboard") { 5126 let pointerType = state.pointerType || e2.nativeEvent.pointerType || "virtual", stopPressUp = triggerPressUp($f6c31cce2adf654f$var$createEvent(e2.currentTarget, e2), pointerType), stopPressEnd = triggerPressEnd($f6c31cce2adf654f$var$createEvent(e2.currentTarget, e2), pointerType, !0); 5127 shouldStopPropagation = stopPressUp && stopPressEnd, state.isOverTarget = !1, triggerClick(e2), cancel(e2); 5128 } 5129 state.ignoreEmulatedMouseEvents = !1, shouldStopPropagation && e2.stopPropagation(); 5130 } 5131 } 5132 }, onKeyUp = (e2) => { 5133 var _state_metaKeyEvents; 5134 if (state.isPressed && state.target && $f6c31cce2adf654f$var$isValidKeyboardEvent(e2, state.target)) { 5135 var _state_metaKeyEvents1; 5136 $f6c31cce2adf654f$var$shouldPreventDefaultKeyboard($d4ee10de306f2510$export$e58f029f0fbfdb29(e2), e2.key) && e2.preventDefault(); 5137 let target = $d4ee10de306f2510$export$e58f029f0fbfdb29(e2), wasPressed = $d4ee10de306f2510$export$4282f70798064fe0(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29(e2)); 5138 triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e2), "keyboard", wasPressed), wasPressed && triggerSyntheticClick(e2, state.target), removeAllGlobalListeners(), e2.key !== "Enter" && $f6c31cce2adf654f$var$isHTMLAnchorLink(state.target) && $d4ee10de306f2510$export$4282f70798064fe0(state.target, target) && !e2[$f6c31cce2adf654f$var$LINK_CLICKED] && (e2[$f6c31cce2adf654f$var$LINK_CLICKED] = !0, $ea8dcbcb9ea1b556$export$95185d699e05d4d7(state.target, e2, !1)), state.isPressed = !1, (_state_metaKeyEvents1 = state.metaKeyEvents) === null || _state_metaKeyEvents1 === void 0 || _state_metaKeyEvents1.delete(e2.key); 5139 } else if (e2.key === "Meta" && (!((_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0) && _state_metaKeyEvents.size)) { 5140 var _state_target; 5141 let events2 = state.metaKeyEvents; 5142 state.metaKeyEvents = void 0; 5143 for (let event of events2.values()) (_state_target = state.target) === null || _state_target === void 0 || _state_target.dispatchEvent(new KeyboardEvent("keyup", event)); 5144 } 5145 }; 5146 if (typeof PointerEvent < "u") { 5147 pressProps2.onPointerDown = (e2) => { 5148 if (e2.button !== 0 || !$d4ee10de306f2510$export$4282f70798064fe0(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29(e2.nativeEvent))) return; 5149 if ($6a7db85432448f7f$export$29bf1b5f2c56cf63(e2.nativeEvent)) { 5150 state.pointerType = "virtual"; 5151 return; 5152 } 5153 state.pointerType = e2.pointerType; 5154 let shouldStopPropagation = !0; 5155 if (!state.isPressed) { 5156 state.isPressed = !0, state.isOverTarget = !0, state.activePointerId = e2.pointerId, state.target = e2.currentTarget, allowTextSelectionOnPress || $14c0b72509d70225$export$16a4697467175487(state.target), shouldStopPropagation = triggerPressStart(e2, state.pointerType); 5157 let target = $d4ee10de306f2510$export$e58f029f0fbfdb29(e2.nativeEvent); 5158 "releasePointerCapture" in target && target.releasePointerCapture(e2.pointerId), addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac(e2.currentTarget), "pointerup", onPointerUp, !1), addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac(e2.currentTarget), "pointercancel", onPointerCancel, !1); 5159 } 5160 shouldStopPropagation && e2.stopPropagation(); 5161 }, pressProps2.onMouseDown = (e2) => { 5162 if ($d4ee10de306f2510$export$4282f70798064fe0(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29(e2.nativeEvent)) && e2.button === 0) { 5163 if (preventFocusOnPress) { 5164 let dispose = $8a9cb279dc87e130$export$cabe61c495ee3649(e2.target); 5165 dispose && state.disposables.push(dispose); 5166 } 5167 e2.stopPropagation(); 5168 } 5169 }, pressProps2.onPointerUp = (e2) => { 5170 !$d4ee10de306f2510$export$4282f70798064fe0(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29(e2.nativeEvent)) || state.pointerType === "virtual" || e2.button === 0 && !state.isPressed && triggerPressUp(e2, state.pointerType || e2.pointerType); 5171 }, pressProps2.onPointerEnter = (e2) => { 5172 e2.pointerId === state.activePointerId && state.target && !state.isOverTarget && state.pointerType != null && (state.isOverTarget = !0, triggerPressStart($f6c31cce2adf654f$var$createEvent(state.target, e2), state.pointerType)); 5173 }, pressProps2.onPointerLeave = (e2) => { 5174 e2.pointerId === state.activePointerId && state.target && state.isOverTarget && state.pointerType != null && (state.isOverTarget = !1, triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e2), state.pointerType, !1), cancelOnPointerExit(e2)); 5175 }; 5176 let onPointerUp = (e2) => { 5177 if (e2.pointerId === state.activePointerId && state.isPressed && e2.button === 0 && state.target) { 5178 if ($d4ee10de306f2510$export$4282f70798064fe0(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29(e2)) && state.pointerType != null) { 5179 let clicked = !1, timeout = setTimeout(() => { 5180 state.isPressed && state.target instanceof HTMLElement && (clicked ? cancel(e2) : ($7215afc6de606d6b$export$de79e2c695e052f3(state.target), state.target.click())); 5181 }, 80); 5182 addGlobalListener(e2.currentTarget, "click", () => clicked = !0, !0), state.disposables.push(() => clearTimeout(timeout)); 5183 } else cancel(e2); 5184 state.isOverTarget = !1; 5185 } 5186 }, onPointerCancel = (e2) => { 5187 cancel(e2); 5188 }; 5189 pressProps2.onDragStart = (e2) => { 5190 $d4ee10de306f2510$export$4282f70798064fe0(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29(e2.nativeEvent)) && cancel(e2); 5191 }; 5192 } 5193 return pressProps2; 5194 }, [ 5195 addGlobalListener, 5196 isDisabled, 5197 preventFocusOnPress, 5198 removeAllGlobalListeners, 5199 allowTextSelectionOnPress, 5200 cancel, 5201 cancelOnPointerExit, 5202 triggerPressEnd, 5203 triggerPressStart, 5204 triggerPressUp, 5205 triggerClick, 5206 triggerSyntheticClick 5207 ]); 5208 return useEffect(() => { 5209 if (!domRef) return; 5210 let ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac(domRef.current); 5211 if (!ownerDocument || !ownerDocument.head || ownerDocument.getElementById($f6c31cce2adf654f$var$STYLE_ID)) return; 5212 let style = ownerDocument.createElement("style"); 5213 style.id = $f6c31cce2adf654f$var$STYLE_ID, style.textContent = ` 5214@layer { 5215 [${$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE}] { 5216 touch-action: pan-x pan-y pinch-zoom; 5217 } 5218} 5219 `.trim(), ownerDocument.head.prepend(style); 5220 }, [ 5221 domRef 5222 ]), useEffect(() => { 5223 let state = ref.current; 5224 return () => { 5225 var _state_target; 5226 allowTextSelectionOnPress || $14c0b72509d70225$export$b0d6fa1ab32e3295((_state_target = state.target) !== null && _state_target !== void 0 ? _state_target : void 0); 5227 for (let dispose of state.disposables) dispose(); 5228 state.disposables = []; 5229 }; 5230 }, [ 5231 allowTextSelectionOnPress 5232 ]), { 5233 isPressed: isPressedProp || isPressed, 5234 pressProps: $3ef42575df84b30b$export$9d1611c77c2fe928(domProps, pressProps, { 5235 [$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE]: !0 5236 }) 5237 }; 5238} 5239function $f6c31cce2adf654f$var$isHTMLAnchorLink(target) { 5240 return target.tagName === "A" && target.hasAttribute("href"); 5241} 5242function $f6c31cce2adf654f$var$isValidKeyboardEvent(event, currentTarget) { 5243 let { key, code } = event, element = currentTarget, role = element.getAttribute("role"); 5244 return (key === "Enter" || key === " " || key === "Spacebar" || code === "Space") && !(element instanceof $431fbd86ca7dc216$export$f21a1ffae260145a(element).HTMLInputElement && !$f6c31cce2adf654f$var$isValidInputKey(element, key) || element instanceof $431fbd86ca7dc216$export$f21a1ffae260145a(element).HTMLTextAreaElement || element.isContentEditable) && // Links should only trigger with Enter key 5245 !((role === "link" || !role && $f6c31cce2adf654f$var$isHTMLAnchorLink(element)) && key !== "Enter"); 5246} 5247function $f6c31cce2adf654f$var$createEvent(target, e2) { 5248 let clientX = e2.clientX, clientY = e2.clientY; 5249 return { 5250 currentTarget: target, 5251 shiftKey: e2.shiftKey, 5252 ctrlKey: e2.ctrlKey, 5253 metaKey: e2.metaKey, 5254 altKey: e2.altKey, 5255 clientX, 5256 clientY 5257 }; 5258} 5259function $f6c31cce2adf654f$var$shouldPreventDefaultUp(target) { 5260 return target instanceof HTMLInputElement ? !1 : target instanceof HTMLButtonElement ? target.type !== "submit" && target.type !== "reset" : !$f6c31cce2adf654f$var$isHTMLAnchorLink(target); 5261} 5262function $f6c31cce2adf654f$var$shouldPreventDefaultKeyboard(target, key) { 5263 return target instanceof HTMLInputElement ? !$f6c31cce2adf654f$var$isValidInputKey(target, key) : $f6c31cce2adf654f$var$shouldPreventDefaultUp(target); 5264} 5265var $f6c31cce2adf654f$var$nonTextInputTypes = /* @__PURE__ */ new Set([ 5266 "checkbox", 5267 "radio", 5268 "range", 5269 "color", 5270 "file", 5271 "image", 5272 "button", 5273 "submit", 5274 "reset" 5275]); 5276function $f6c31cce2adf654f$var$isValidInputKey(target, key) { 5277 return target.type === "checkbox" || target.type === "radio" ? key === " " : $f6c31cce2adf654f$var$nonTextInputTypes.has(target.type); 5278} 5279 5280// ../../node_modules/@react-aria/interactions/dist/useFocusVisible.mjs 5281init_react(); 5282var $507fabe10e71c6fb$var$currentModality = null, $507fabe10e71c6fb$var$changeHandlers = /* @__PURE__ */ new Set(), $507fabe10e71c6fb$export$d90243b58daecda7 = /* @__PURE__ */ new Map(), $507fabe10e71c6fb$var$hasEventBeforeFocus = !1, $507fabe10e71c6fb$var$hasBlurredWindowRecently = !1; 5283function $507fabe10e71c6fb$var$triggerChangeHandlers(modality, e2) { 5284 for (let handler of $507fabe10e71c6fb$var$changeHandlers) handler(modality, e2); 5285} 5286function $507fabe10e71c6fb$var$isValidKey(e2) { 5287 return !(e2.metaKey || !$c87311424ea30a05$export$9ac100e40613ea10() && e2.altKey || e2.ctrlKey || e2.key === "Control" || e2.key === "Shift" || e2.key === "Meta"); 5288} 5289function $507fabe10e71c6fb$var$handleKeyboardEvent(e2) { 5290 $507fabe10e71c6fb$var$hasEventBeforeFocus = !0, $507fabe10e71c6fb$var$isValidKey(e2) && ($507fabe10e71c6fb$var$currentModality = "keyboard", $507fabe10e71c6fb$var$triggerChangeHandlers("keyboard", e2)); 5291} 5292function $507fabe10e71c6fb$var$handlePointerEvent(e2) { 5293 $507fabe10e71c6fb$var$currentModality = "pointer", (e2.type === "mousedown" || e2.type === "pointerdown") && ($507fabe10e71c6fb$var$hasEventBeforeFocus = !0, $507fabe10e71c6fb$var$triggerChangeHandlers("pointer", e2)); 5294} 5295function $507fabe10e71c6fb$var$handleClickEvent(e2) { 5296 $6a7db85432448f7f$export$60278871457622de(e2) && ($507fabe10e71c6fb$var$hasEventBeforeFocus = !0, $507fabe10e71c6fb$var$currentModality = "virtual"); 5297} 5298function $507fabe10e71c6fb$var$handleFocusEvent(e2) { 5299 e2.target === window || e2.target === document || $8a9cb279dc87e130$export$fda7da73ab5d4c48 || !e2.isTrusted || (!$507fabe10e71c6fb$var$hasEventBeforeFocus && !$507fabe10e71c6fb$var$hasBlurredWindowRecently && ($507fabe10e71c6fb$var$currentModality = "virtual", $507fabe10e71c6fb$var$triggerChangeHandlers("virtual", e2)), $507fabe10e71c6fb$var$hasEventBeforeFocus = !1, $507fabe10e71c6fb$var$hasBlurredWindowRecently = !1); 5300} 5301function $507fabe10e71c6fb$var$handleWindowBlur() { 5302 $8a9cb279dc87e130$export$fda7da73ab5d4c48 || ($507fabe10e71c6fb$var$hasEventBeforeFocus = !1, $507fabe10e71c6fb$var$hasBlurredWindowRecently = !0); 5303} 5304function $507fabe10e71c6fb$var$setupGlobalFocusEvents(element) { 5305 if (typeof window > "u" || typeof document > "u" || $507fabe10e71c6fb$export$d90243b58daecda7.get($431fbd86ca7dc216$export$f21a1ffae260145a(element))) return; 5306 let windowObject = $431fbd86ca7dc216$export$f21a1ffae260145a(element), documentObject = $431fbd86ca7dc216$export$b204af158042fbac(element), focus = windowObject.HTMLElement.prototype.focus; 5307 windowObject.HTMLElement.prototype.focus = function() { 5308 $507fabe10e71c6fb$var$hasEventBeforeFocus = !0, focus.apply(this, arguments); 5309 }, documentObject.addEventListener("keydown", $507fabe10e71c6fb$var$handleKeyboardEvent, !0), documentObject.addEventListener("keyup", $507fabe10e71c6fb$var$handleKeyboardEvent, !0), documentObject.addEventListener("click", $507fabe10e71c6fb$var$handleClickEvent, !0), windowObject.addEventListener("focus", $507fabe10e71c6fb$var$handleFocusEvent, !0), windowObject.addEventListener("blur", $507fabe10e71c6fb$var$handleWindowBlur, !1), typeof PointerEvent < "u" && (documentObject.addEventListener("pointerdown", $507fabe10e71c6fb$var$handlePointerEvent, !0), documentObject.addEventListener("pointermove", $507fabe10e71c6fb$var$handlePointerEvent, !0), documentObject.addEventListener("pointerup", $507fabe10e71c6fb$var$handlePointerEvent, !0)), windowObject.addEventListener("beforeunload", () => { 5310 $507fabe10e71c6fb$var$tearDownWindowFocusTracking(element); 5311 }, { 5312 once: !0 5313 }), $507fabe10e71c6fb$export$d90243b58daecda7.set(windowObject, { 5314 focus 5315 }); 5316} 5317var $507fabe10e71c6fb$var$tearDownWindowFocusTracking = (element, loadListener) => { 5318 let windowObject = $431fbd86ca7dc216$export$f21a1ffae260145a(element), documentObject = $431fbd86ca7dc216$export$b204af158042fbac(element); 5319 loadListener && documentObject.removeEventListener("DOMContentLoaded", loadListener), $507fabe10e71c6fb$export$d90243b58daecda7.has(windowObject) && (windowObject.HTMLElement.prototype.focus = $507fabe10e71c6fb$export$d90243b58daecda7.get(windowObject).focus, documentObject.removeEventListener("keydown", $507fabe10e71c6fb$var$handleKeyboardEvent, !0), documentObject.removeEventListener("keyup", $507fabe10e71c6fb$var$handleKeyboardEvent, !0), documentObject.removeEventListener("click", $507fabe10e71c6fb$var$handleClickEvent, !0), windowObject.removeEventListener("focus", $507fabe10e71c6fb$var$handleFocusEvent, !0), windowObject.removeEventListener("blur", $507fabe10e71c6fb$var$handleWindowBlur, !1), typeof PointerEvent < "u" && (documentObject.removeEventListener("pointerdown", $507fabe10e71c6fb$var$handlePointerEvent, !0), documentObject.removeEventListener("pointermove", $507fabe10e71c6fb$var$handlePointerEvent, !0), documentObject.removeEventListener("pointerup", $507fabe10e71c6fb$var$handlePointerEvent, !0)), $507fabe10e71c6fb$export$d90243b58daecda7.delete(windowObject)); 5320}; 5321function $507fabe10e71c6fb$export$2f1888112f558a7d(element) { 5322 let documentObject = $431fbd86ca7dc216$export$b204af158042fbac(element), loadListener; 5323 return documentObject.readyState !== "loading" ? $507fabe10e71c6fb$var$setupGlobalFocusEvents(element) : (loadListener = () => { 5324 $507fabe10e71c6fb$var$setupGlobalFocusEvents(element); 5325 }, documentObject.addEventListener("DOMContentLoaded", loadListener)), () => $507fabe10e71c6fb$var$tearDownWindowFocusTracking(element, loadListener); 5326} 5327typeof document < "u" && $507fabe10e71c6fb$export$2f1888112f558a7d(); 5328function $507fabe10e71c6fb$export$b9b3dfddab17db27() { 5329 return $507fabe10e71c6fb$var$currentModality !== "pointer"; 5330} 5331function $507fabe10e71c6fb$export$630ff653c5ada6a9() { 5332 return $507fabe10e71c6fb$var$currentModality; 5333} 5334 5335// ../../node_modules/@react-aria/interactions/dist/focusSafely.mjs 5336function $3ad3f6e1647bc98d$export$80f3e147d781571c(element) { 5337 let ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac(element), activeElement = $d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument); 5338 if ($507fabe10e71c6fb$export$630ff653c5ada6a9() === "virtual") { 5339 let lastFocusedElement = activeElement; 5340 $bbed8b41f857bcc0$export$24490316f764c430(() => { 5341 $d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument) === lastFocusedElement && element.isConnected && $7215afc6de606d6b$export$de79e2c695e052f3(element); 5342 }); 5343 } else $7215afc6de606d6b$export$de79e2c695e052f3(element); 5344} 5345 5346// ../../node_modules/@react-aria/interactions/dist/useFocus.mjs 5347init_react(); 5348function $a1ea59d68270f0dd$export$f8168d8dd8fd66e6(props) { 5349 let { isDisabled, onFocus: onFocusProp, onBlur: onBlurProp, onFocusChange } = props, onBlur = useCallback((e2) => { 5350 if (e2.target === e2.currentTarget) 5351 return onBlurProp && onBlurProp(e2), onFocusChange && onFocusChange(!1), !0; 5352 }, [ 5353 onBlurProp, 5354 onFocusChange 5355 ]), onSyntheticFocus = $8a9cb279dc87e130$export$715c682d09d639cc(onBlur), onFocus = useCallback((e2) => { 5356 let ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac(e2.target), activeElement = ownerDocument ? $d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument) : $d4ee10de306f2510$export$cd4e5573fbe2b576(); 5357 e2.target === e2.currentTarget && activeElement === $d4ee10de306f2510$export$e58f029f0fbfdb29(e2.nativeEvent) && (onFocusProp && onFocusProp(e2), onFocusChange && onFocusChange(!0), onSyntheticFocus(e2)); 5358 }, [ 5359 onFocusChange, 5360 onFocusProp, 5361 onSyntheticFocus 5362 ]); 5363 return { 5364 focusProps: { 5365 onFocus: !isDisabled && (onFocusProp || onFocusChange || onBlurProp) ? onFocus : void 0, 5366 onBlur: !isDisabled && (onBlurProp || onFocusChange) ? onBlur : void 0 5367 } 5368 }; 5369} 5370 5371// ../../node_modules/@react-aria/interactions/dist/createEventHandler.mjs 5372function $93925083ecbb358c$export$48d1ea6320830260(handler) { 5373 if (!handler) return; 5374 let shouldStopPropagation = !0; 5375 return (e2) => { 5376 let event = { 5377 ...e2, 5378 preventDefault() { 5379 e2.preventDefault(); 5380 }, 5381 isDefaultPrevented() { 5382 return e2.isDefaultPrevented(); 5383 }, 5384 stopPropagation() { 5385 shouldStopPropagation = !0; 5386 }, 5387 continuePropagation() { 5388 shouldStopPropagation = !1; 5389 }, 5390 isPropagationStopped() { 5391 return shouldStopPropagation; 5392 } 5393 }; 5394 handler(event), shouldStopPropagation && e2.stopPropagation(); 5395 }; 5396} 5397 5398// ../../node_modules/@react-aria/interactions/dist/useKeyboard.mjs 5399function $46d819fcbaf35654$export$8f71654801c2f7cd(props) { 5400 return { 5401 keyboardProps: props.isDisabled ? {} : { 5402 onKeyDown: $93925083ecbb358c$export$48d1ea6320830260(props.onKeyDown), 5403 onKeyUp: $93925083ecbb358c$export$48d1ea6320830260(props.onKeyUp) 5404 } 5405 }; 5406} 5407 5408// ../../node_modules/@react-aria/interactions/dist/useFocusable.mjs 5409init_react(); 5410var $f645667febf57a63$export$f9762fab77588ecb = react_default.createContext(null); 5411function $f645667febf57a63$var$useFocusableContext(ref) { 5412 let context = useContext($f645667febf57a63$export$f9762fab77588ecb) || {}; 5413 $e7801be82b4b2a53$export$4debdb1a3f0fa79e(context, ref); 5414 let { ref: _2, ...otherProps } = context; 5415 return otherProps; 5416} 5417var $f645667febf57a63$export$13f3202a3e5ddd5 = react_default.forwardRef(function(props, ref) { 5418 let { children, ...otherProps } = props, objRef = $df56164dff5785e2$export$4338b53315abf666(ref), context = { 5419 ...otherProps, 5420 ref: objRef 5421 }; 5422 return react_default.createElement($f645667febf57a63$export$f9762fab77588ecb.Provider, { 5423 value: context 5424 }, children); 5425}); 5426function $f645667febf57a63$export$4c014de7c8940b4c(props, domRef) { 5427 let { focusProps } = $a1ea59d68270f0dd$export$f8168d8dd8fd66e6(props), { keyboardProps } = $46d819fcbaf35654$export$8f71654801c2f7cd(props), interactions = $3ef42575df84b30b$export$9d1611c77c2fe928(focusProps, keyboardProps), domProps = $f645667febf57a63$var$useFocusableContext(domRef), interactionProps = props.isDisabled ? {} : domProps, autoFocusRef = useRef(props.autoFocus); 5428 useEffect(() => { 5429 autoFocusRef.current && domRef.current && $3ad3f6e1647bc98d$export$80f3e147d781571c(domRef.current), autoFocusRef.current = !1; 5430 }, [ 5431 domRef 5432 ]); 5433 let tabIndex = props.excludeFromTabOrder ? -1 : 0; 5434 return props.isDisabled && (tabIndex = void 0), { 5435 focusableProps: $3ef42575df84b30b$export$9d1611c77c2fe928({ 5436 ...interactions, 5437 tabIndex 5438 }, interactionProps) 5439 }; 5440} 5441var $f645667febf57a63$export$35a3bebf7ef2d934 = forwardRef(({ children, ...props }, ref) => { 5442 ref = $df56164dff5785e2$export$4338b53315abf666(ref); 5443 let { focusableProps } = $f645667febf57a63$export$4c014de7c8940b4c(props, ref), child = react_default.Children.only(children); 5444 useEffect(() => { 5445 }, [ 5446 ref, 5447 props.isDisabled 5448 ]); 5449 let childRef = parseInt(react_default.version, 10) < 19 ? child.ref : child.props.ref; 5450 return react_default.cloneElement(child, { 5451 ...$3ef42575df84b30b$export$9d1611c77c2fe928(focusableProps, child.props), 5452 // @ts-ignore 5453 ref: $5dc95899b306f630$export$c9058316764c140e(childRef, ref) 5454 }); 5455}); 5456 5457// ../../node_modules/@react-aria/interactions/dist/Pressable.mjs 5458init_react(); 5459var $3b117e43dc0ca95d$export$27c701ed9e449e99 = react_default.forwardRef(({ children, ...props }, ref) => { 5460 ref = $df56164dff5785e2$export$4338b53315abf666(ref); 5461 let { pressProps } = $f6c31cce2adf654f$export$45712eceda6fad21({ 5462 ...props, 5463 ref 5464 }), { focusableProps } = $f645667febf57a63$export$4c014de7c8940b4c(props, ref), child = react_default.Children.only(children); 5465 useEffect(() => { 5466 }, [ 5467 ref, 5468 props.isDisabled 5469 ]); 5470 let childRef = parseInt(react_default.version, 10) < 19 ? child.ref : child.props.ref; 5471 return react_default.cloneElement(child, { 5472 ...$3ef42575df84b30b$export$9d1611c77c2fe928(pressProps, focusableProps, child.props), 5473 // @ts-ignore 5474 ref: $5dc95899b306f630$export$c9058316764c140e(childRef, ref) 5475 }); 5476}); 5477 5478// ../../node_modules/@react-aria/interactions/dist/PressResponder.mjs 5479init_react(); 5480var $f1ab8c75478c6f73$export$3351871ee4b288b8 = react_default.forwardRef(({ children, ...props }, ref) => { 5481 let isRegistered = useRef(!1), prevContext = useContext($ae1eeba8b9eafd08$export$5165eccb35aaadb5); 5482 ref = $df56164dff5785e2$export$4338b53315abf666(ref || prevContext?.ref); 5483 let context = $3ef42575df84b30b$export$9d1611c77c2fe928(prevContext || {}, { 5484 ...props, 5485 ref, 5486 register() { 5487 isRegistered.current = !0, prevContext && prevContext.register(); 5488 } 5489 }); 5490 return $e7801be82b4b2a53$export$4debdb1a3f0fa79e(prevContext, ref), useEffect(() => { 5491 isRegistered.current || (isRegistered.current = !0); 5492 }, []), react_default.createElement($ae1eeba8b9eafd08$export$5165eccb35aaadb5.Provider, { 5493 value: context 5494 }, children); 5495}); 5496 5497// ../../node_modules/@react-aria/interactions/dist/useFocusWithin.mjs 5498init_react(); 5499 5500// ../../node_modules/@react-aria/interactions/dist/useHover.mjs 5501init_react(); 5502var $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents = !1, $6179b936705e76d3$var$hoverCount = 0; 5503function $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents() { 5504 $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents = !0, setTimeout(() => { 5505 $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents = !1; 5506 }, 50); 5507} 5508function $6179b936705e76d3$var$handleGlobalPointerEvent(e2) { 5509 e2.pointerType === "touch" && $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents(); 5510} 5511function $6179b936705e76d3$var$setupGlobalTouchEvents() { 5512 if (!(typeof document > "u")) 5513 return $6179b936705e76d3$var$hoverCount === 0 && typeof PointerEvent < "u" && document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent), $6179b936705e76d3$var$hoverCount++, () => { 5514 $6179b936705e76d3$var$hoverCount--, !($6179b936705e76d3$var$hoverCount > 0) && typeof PointerEvent < "u" && document.removeEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent); 5515 }; 5516} 5517function $6179b936705e76d3$export$ae780daf29e6d456(props) { 5518 let { onHoverStart, onHoverChange, onHoverEnd, isDisabled } = props, [isHovered, setHovered] = useState(!1), state = useRef({ 5519 isHovered: !1, 5520 ignoreEmulatedMouseEvents: !1, 5521 pointerType: "", 5522 target: null 5523 }).current; 5524 useEffect($6179b936705e76d3$var$setupGlobalTouchEvents, []); 5525 let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6(), { hoverProps, triggerHoverEnd } = useMemo(() => { 5526 let triggerHoverStart = (event, pointerType) => { 5527 if (state.pointerType = pointerType, isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target)) return; 5528 state.isHovered = !0; 5529 let target = event.currentTarget; 5530 state.target = target, addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac(event.target), "pointerover", (e2) => { 5531 state.isHovered && state.target && !$d4ee10de306f2510$export$4282f70798064fe0(state.target, e2.target) && triggerHoverEnd2(e2, e2.pointerType); 5532 }, { 5533 capture: !0 5534 }), onHoverStart && onHoverStart({ 5535 type: "hoverstart", 5536 target, 5537 pointerType 5538 }), onHoverChange && onHoverChange(!0), setHovered(!0); 5539 }, triggerHoverEnd2 = (event, pointerType) => { 5540 let target = state.target; 5541 state.pointerType = "", state.target = null, !(pointerType === "touch" || !state.isHovered || !target) && (state.isHovered = !1, removeAllGlobalListeners(), onHoverEnd && onHoverEnd({ 5542 type: "hoverend", 5543 target, 5544 pointerType 5545 }), onHoverChange && onHoverChange(!1), setHovered(!1)); 5546 }, hoverProps2 = {}; 5547 return typeof PointerEvent < "u" && (hoverProps2.onPointerEnter = (e2) => { 5548 $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents && e2.pointerType === "mouse" || triggerHoverStart(e2, e2.pointerType); 5549 }, hoverProps2.onPointerLeave = (e2) => { 5550 !isDisabled && e2.currentTarget.contains(e2.target) && triggerHoverEnd2(e2, e2.pointerType); 5551 }), { 5552 hoverProps: hoverProps2, 5553 triggerHoverEnd: triggerHoverEnd2 5554 }; 5555 }, [ 5556 onHoverStart, 5557 onHoverChange, 5558 onHoverEnd, 5559 isDisabled, 5560 state, 5561 addGlobalListener, 5562 removeAllGlobalListeners 5563 ]); 5564 return useEffect(() => { 5565 isDisabled && triggerHoverEnd({ 5566 currentTarget: state.target 5567 }, state.pointerType); 5568 }, [ 5569 isDisabled 5570 ]), { 5571 hoverProps, 5572 isHovered 5573 }; 5574} 5575 5576// ../../node_modules/@react-aria/interactions/dist/useInteractOutside.mjs 5577init_react(); 5578 5579// ../../node_modules/@react-aria/interactions/dist/useMove.mjs 5580init_react(); 5581 5582// ../../node_modules/@react-aria/interactions/dist/useScrollWheel.mjs 5583init_react(); 5584 5585// ../../node_modules/@react-aria/interactions/dist/useLongPress.mjs 5586init_react(); 5587 5588// ../../node_modules/react-aria-components/dist/utils.mjs 5589init_react(); 5590var $64fa3d84918910a7$export$c62b8e45d58ddad9 = /* @__PURE__ */ Symbol("default"); 5591function $64fa3d84918910a7$export$2881499e37b75b9a({ values, children }) { 5592 for (let [Context2, value] of values) 5593 children = react_default.createElement(Context2.Provider, { 5594 value 5595 }, children); 5596 return children; 5597} 5598function $64fa3d84918910a7$export$4d86445c2cf5e3(props) { 5599 let { className, style, children, defaultClassName, defaultChildren, defaultStyle, values } = props; 5600 return useMemo(() => { 5601 let computedClassName, computedStyle, computedChildren; 5602 return typeof className == "function" ? computedClassName = className({ 5603 ...values, 5604 defaultClassName 5605 }) : computedClassName = className, typeof style == "function" ? computedStyle = style({ 5606 ...values, 5607 defaultStyle: defaultStyle || {} 5608 }) : computedStyle = style, typeof children == "function" ? computedChildren = children({ 5609 ...values, 5610 defaultChildren 5611 }) : children == null ? computedChildren = defaultChildren : computedChildren = children, { 5612 className: computedClassName ?? defaultClassName, 5613 style: computedStyle || defaultStyle ? { 5614 ...defaultStyle, 5615 ...computedStyle 5616 } : void 0, 5617 children: computedChildren ?? defaultChildren, 5618 "data-rac": "" 5619 }; 5620 }, [ 5621 className, 5622 style, 5623 children, 5624 defaultClassName, 5625 defaultChildren, 5626 defaultStyle, 5627 values 5628 ]); 5629} 5630function $64fa3d84918910a7$export$fabf2dc03a41866e(context, slot) { 5631 let ctx = useContext(context); 5632 if (slot === null) 5633 return null; 5634 if (ctx && typeof ctx == "object" && "slots" in ctx && ctx.slots) { 5635 let slotKey = slot || $64fa3d84918910a7$export$c62b8e45d58ddad9; 5636 if (!ctx.slots[slotKey]) { 5637 let availableSlots = new Intl.ListFormat().format(Object.keys(ctx.slots).map((p2) => `"${p2}"`)), errorMessage = slot ? `Invalid slot "${slot}".` : "A slot prop is required."; 5638 throw new Error(`${errorMessage} Valid slot names are ${availableSlots}.`); 5639 } 5640 return ctx.slots[slotKey]; 5641 } 5642 return ctx; 5643} 5644function $64fa3d84918910a7$export$29f1550f4b0d4415(props, ref, context) { 5645 let ctx = $64fa3d84918910a7$export$fabf2dc03a41866e(context, props.slot) || {}, { ref: contextRef, ...contextProps } = ctx, mergedRef = $df56164dff5785e2$export$4338b53315abf666(useMemo(() => $5dc95899b306f630$export$c9058316764c140e(ref, contextRef), [ 5646 ref, 5647 contextRef 5648 ])), mergedProps = $3ef42575df84b30b$export$9d1611c77c2fe928(contextProps, props); 5649 return "style" in contextProps && contextProps.style && "style" in props && props.style && (typeof contextProps.style == "function" || typeof props.style == "function" ? mergedProps.style = (renderProps) => { 5650 let contextStyle = typeof contextProps.style == "function" ? contextProps.style(renderProps) : contextProps.style, defaultStyle = { 5651 ...renderProps.defaultStyle, 5652 ...contextStyle 5653 }, style = typeof props.style == "function" ? props.style({ 5654 ...renderProps, 5655 defaultStyle 5656 }) : props.style; 5657 return { 5658 ...defaultStyle, 5659 ...style 5660 }; 5661 } : mergedProps.style = { 5662 ...contextProps.style, 5663 ...props.style 5664 }), [ 5665 mergedProps, 5666 mergedRef 5667 ]; 5668} 5669 5670// ../../node_modules/react-aria-components/dist/OverlayArrow.mjs 5671init_react(); 5672var $44f671af83e7d9e0$export$2de4954e8ae13b9f = createContext({ 5673 placement: "bottom" 5674}), $44f671af83e7d9e0$export$746d02f47f4d381 = forwardRef(function(props, ref) { 5675 [props, ref] = $64fa3d84918910a7$export$29f1550f4b0d4415(props, ref, $44f671af83e7d9e0$export$2de4954e8ae13b9f); 5676 let placement = props.placement, style = { 5677 position: "absolute", 5678 transform: placement === "top" || placement === "bottom" ? "translateX(-50%)" : "translateY(-50%)" 5679 }; 5680 placement != null && (style[placement] = "100%"); 5681 let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({ 5682 ...props, 5683 defaultClassName: "react-aria-OverlayArrow", 5684 values: { 5685 placement 5686 } 5687 }); 5688 renderProps.style && Object.keys(renderProps.style).forEach((key) => renderProps.style[key] === void 0 && delete renderProps.style[key]); 5689 let DOMProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props); 5690 return react_default.createElement("div", { 5691 ...DOMProps, 5692 ...renderProps, 5693 style: { 5694 ...style, 5695 ...renderProps.style 5696 }, 5697 ref, 5698 "data-placement": placement 5699 }); 5700}); 5701 5702// ../../node_modules/@react-aria/tooltip/dist/useTooltip.mjs 5703function $326e436e94273fe1$export$1c4b08e0eca38426(props, state) { 5704 let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, { 5705 labelable: !0 5706 }), { hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456({ 5707 onHoverStart: () => state?.open(!0), 5708 onHoverEnd: () => state?.close() 5709 }); 5710 return { 5711 tooltipProps: $3ef42575df84b30b$export$9d1611c77c2fe928(domProps, hoverProps, { 5712 role: "tooltip" 5713 }) 5714 }; 5715} 5716 5717// ../../node_modules/@react-aria/tooltip/dist/useTooltipTrigger.mjs 5718init_react(); 5719function $4e1b34546679e357$export$a6da6c504e4bba8b(props, state, ref) { 5720 let { isDisabled, trigger } = props, tooltipId = $bdb11010cef70236$export$f680877a34711e37(), isHovered = useRef(!1), isFocused = useRef(!1), handleShow = () => { 5721 (isHovered.current || isFocused.current) && state.open(isFocused.current); 5722 }, handleHide = (immediate) => { 5723 !isHovered.current && !isFocused.current && state.close(immediate); 5724 }; 5725 useEffect(() => { 5726 let onKeyDown = (e2) => { 5727 ref && ref.current && e2.key === "Escape" && (e2.stopPropagation(), state.close(!0)); 5728 }; 5729 if (state.isOpen) 5730 return document.addEventListener("keydown", onKeyDown, !0), () => { 5731 document.removeEventListener("keydown", onKeyDown, !0); 5732 }; 5733 }, [ 5734 ref, 5735 state 5736 ]); 5737 let onHoverStart = () => { 5738 trigger !== "focus" && ($507fabe10e71c6fb$export$630ff653c5ada6a9() === "pointer" ? isHovered.current = !0 : isHovered.current = !1, handleShow()); 5739 }, onHoverEnd = () => { 5740 trigger !== "focus" && (isFocused.current = !1, isHovered.current = !1, handleHide()); 5741 }, onPressStart = () => { 5742 isFocused.current = !1, isHovered.current = !1, handleHide(!0); 5743 }, onFocus = () => { 5744 $507fabe10e71c6fb$export$b9b3dfddab17db27() && (isFocused.current = !0, handleShow()); 5745 }, onBlur = () => { 5746 isFocused.current = !1, isHovered.current = !1, handleHide(!0); 5747 }, { hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456({ 5748 isDisabled, 5749 onHoverStart, 5750 onHoverEnd 5751 }), { focusableProps } = $f645667febf57a63$export$4c014de7c8940b4c({ 5752 isDisabled, 5753 onFocus, 5754 onBlur 5755 }, ref); 5756 return { 5757 triggerProps: { 5758 "aria-describedby": state.isOpen ? tooltipId : void 0, 5759 ...$3ef42575df84b30b$export$9d1611c77c2fe928(focusableProps, hoverProps, { 5760 onPointerDown: onPressStart, 5761 onKeyDown: onPressStart 5762 }), 5763 tabIndex: void 0 5764 }, 5765 tooltipProps: { 5766 id: tooltipId 5767 } 5768 }; 5769} 5770 5771// ../../node_modules/@react-aria/overlays/dist/calculatePosition.mjs 5772var $edcf132a9284368a$var$AXIS = { 5773 top: "top", 5774 bottom: "top", 5775 left: "left", 5776 right: "left" 5777}, $edcf132a9284368a$var$FLIPPED_DIRECTION = { 5778 top: "bottom", 5779 bottom: "top", 5780 left: "right", 5781 right: "left" 5782}, $edcf132a9284368a$var$CROSS_AXIS = { 5783 top: "left", 5784 left: "top" 5785}, $edcf132a9284368a$var$AXIS_SIZE = { 5786 top: "height", 5787 left: "width" 5788}, $edcf132a9284368a$var$TOTAL_SIZE = { 5789 width: "totalWidth", 5790 height: "totalHeight" 5791}, $edcf132a9284368a$var$PARSED_PLACEMENT_CACHE = {}, $edcf132a9284368a$var$visualViewport = typeof document < "u" ? window.visualViewport : null; 5792function $edcf132a9284368a$var$getContainerDimensions(containerNode) { 5793 let width = 0, height = 0, totalWidth = 0, totalHeight = 0, top = 0, left = 0, scroll2 = {}; 5794 var _visualViewport_scale; 5795 let isPinchZoomedIn = ((_visualViewport_scale = $edcf132a9284368a$var$visualViewport?.scale) !== null && _visualViewport_scale !== void 0 ? _visualViewport_scale : 1) > 1; 5796 if (containerNode.tagName === "BODY") { 5797 let documentElement = document.documentElement; 5798 totalWidth = documentElement.clientWidth, totalHeight = documentElement.clientHeight; 5799 var _visualViewport_width; 5800 width = (_visualViewport_width = $edcf132a9284368a$var$visualViewport?.width) !== null && _visualViewport_width !== void 0 ? _visualViewport_width : totalWidth; 5801 var _visualViewport_height; 5802 height = (_visualViewport_height = $edcf132a9284368a$var$visualViewport?.height) !== null && _visualViewport_height !== void 0 ? _visualViewport_height : totalHeight, scroll2.top = documentElement.scrollTop || containerNode.scrollTop, scroll2.left = documentElement.scrollLeft || containerNode.scrollLeft, $edcf132a9284368a$var$visualViewport && (top = $edcf132a9284368a$var$visualViewport.offsetTop, left = $edcf132a9284368a$var$visualViewport.offsetLeft); 5803 } else 5804 ({ width, height, top, left } = $edcf132a9284368a$var$getOffset(containerNode, !1)), scroll2.top = containerNode.scrollTop, scroll2.left = containerNode.scrollLeft, totalWidth = width, totalHeight = height; 5805 if ($c87311424ea30a05$export$78551043582a6a98() && (containerNode.tagName === "BODY" || containerNode.tagName === "HTML") && isPinchZoomedIn) { 5806 scroll2.top = 0, scroll2.left = 0; 5807 var _visualViewport_pageTop; 5808 top = (_visualViewport_pageTop = $edcf132a9284368a$var$visualViewport?.pageTop) !== null && _visualViewport_pageTop !== void 0 ? _visualViewport_pageTop : 0; 5809 var _visualViewport_pageLeft; 5810 left = (_visualViewport_pageLeft = $edcf132a9284368a$var$visualViewport?.pageLeft) !== null && _visualViewport_pageLeft !== void 0 ? _visualViewport_pageLeft : 0; 5811 } 5812 return { 5813 width, 5814 height, 5815 totalWidth, 5816 totalHeight, 5817 scroll: scroll2, 5818 top, 5819 left 5820 }; 5821} 5822function $edcf132a9284368a$var$getScroll(node) { 5823 return { 5824 top: node.scrollTop, 5825 left: node.scrollLeft, 5826 width: node.scrollWidth, 5827 height: node.scrollHeight 5828 }; 5829} 5830function $edcf132a9284368a$var$getDelta(axis, offset2, size, boundaryDimensions, containerDimensions, padding, containerOffsetWithBoundary) { 5831 var _containerDimensions_scroll_axis; 5832 let containerScroll = (_containerDimensions_scroll_axis = containerDimensions.scroll[axis]) !== null && _containerDimensions_scroll_axis !== void 0 ? _containerDimensions_scroll_axis : 0, boundarySize = boundaryDimensions[$edcf132a9284368a$var$AXIS_SIZE[axis]], boundaryStartEdge = boundaryDimensions.scroll[$edcf132a9284368a$var$AXIS[axis]] + padding, boundaryEndEdge = boundarySize + boundaryDimensions.scroll[$edcf132a9284368a$var$AXIS[axis]] - padding, startEdgeOffset = offset2 - containerScroll + containerOffsetWithBoundary[axis] - boundaryDimensions[$edcf132a9284368a$var$AXIS[axis]], endEdgeOffset = offset2 - containerScroll + size + containerOffsetWithBoundary[axis] - boundaryDimensions[$edcf132a9284368a$var$AXIS[axis]]; 5833 return startEdgeOffset < boundaryStartEdge ? boundaryStartEdge - startEdgeOffset : endEdgeOffset > boundaryEndEdge ? Math.max(boundaryEndEdge - endEdgeOffset, boundaryStartEdge - startEdgeOffset) : 0; 5834} 5835function $edcf132a9284368a$var$getMargins(node) { 5836 let style = window.getComputedStyle(node); 5837 return { 5838 top: parseInt(style.marginTop, 10) || 0, 5839 bottom: parseInt(style.marginBottom, 10) || 0, 5840 left: parseInt(style.marginLeft, 10) || 0, 5841 right: parseInt(style.marginRight, 10) || 0 5842 }; 5843} 5844function $edcf132a9284368a$var$parsePlacement(input) { 5845 if ($edcf132a9284368a$var$PARSED_PLACEMENT_CACHE[input]) return $edcf132a9284368a$var$PARSED_PLACEMENT_CACHE[input]; 5846 let [placement, crossPlacement] = input.split(" "), axis = $edcf132a9284368a$var$AXIS[placement] || "right", crossAxis = $edcf132a9284368a$var$CROSS_AXIS[axis]; 5847 $edcf132a9284368a$var$AXIS[crossPlacement] || (crossPlacement = "center"); 5848 let size = $edcf132a9284368a$var$AXIS_SIZE[axis], crossSize = $edcf132a9284368a$var$AXIS_SIZE[crossAxis]; 5849 return $edcf132a9284368a$var$PARSED_PLACEMENT_CACHE[input] = { 5850 placement, 5851 crossPlacement, 5852 axis, 5853 crossAxis, 5854 size, 5855 crossSize 5856 }, $edcf132a9284368a$var$PARSED_PLACEMENT_CACHE[input]; 5857} 5858function $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, offset2, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset) { 5859 let { placement, crossPlacement, axis, crossAxis, size, crossSize } = placementInfo, position = {}; 5860 var _childOffset_crossAxis; 5861 position[crossAxis] = (_childOffset_crossAxis = childOffset[crossAxis]) !== null && _childOffset_crossAxis !== void 0 ? _childOffset_crossAxis : 0; 5862 var _childOffset_crossSize, _overlaySize_crossSize, _childOffset_crossSize1, _overlaySize_crossSize1; 5863 crossPlacement === "center" ? position[crossAxis] += (((_childOffset_crossSize = childOffset[crossSize]) !== null && _childOffset_crossSize !== void 0 ? _childOffset_crossSize : 0) - ((_overlaySize_crossSize = overlaySize[crossSize]) !== null && _overlaySize_crossSize !== void 0 ? _overlaySize_crossSize : 0)) / 2 : crossPlacement !== crossAxis && (position[crossAxis] += ((_childOffset_crossSize1 = childOffset[crossSize]) !== null && _childOffset_crossSize1 !== void 0 ? _childOffset_crossSize1 : 0) - ((_overlaySize_crossSize1 = overlaySize[crossSize]) !== null && _overlaySize_crossSize1 !== void 0 ? _overlaySize_crossSize1 : 0)), position[crossAxis] += crossOffset; 5864 let minPosition = childOffset[crossAxis] - overlaySize[crossSize] + arrowSize + arrowBoundaryOffset, maxPosition = childOffset[crossAxis] + childOffset[crossSize] - arrowSize - arrowBoundaryOffset; 5865 if (position[crossAxis] = $9446cca9a3875146$export$7d15b64cf5a3a4c4(position[crossAxis], minPosition, maxPosition), placement === axis) { 5866 let containerHeight = isContainerPositioned ? containerOffsetWithBoundary[size] : boundaryDimensions[$edcf132a9284368a$var$TOTAL_SIZE[size]]; 5867 position[$edcf132a9284368a$var$FLIPPED_DIRECTION[axis]] = Math.floor(containerHeight - childOffset[axis] + offset2); 5868 } else position[axis] = Math.floor(childOffset[axis] + childOffset[size] + offset2); 5869 return position; 5870} 5871function $edcf132a9284368a$var$getMaxHeight(position, boundaryDimensions, containerOffsetWithBoundary, isContainerPositioned, margins, padding, overlayHeight, heightGrowthDirection) { 5872 let containerHeight = isContainerPositioned ? containerOffsetWithBoundary.height : boundaryDimensions[$edcf132a9284368a$var$TOTAL_SIZE.height]; 5873 var _position_bottom; 5874 let overlayTop = position.top != null ? containerOffsetWithBoundary.top + position.top : containerOffsetWithBoundary.top + (containerHeight - ((_position_bottom = position.bottom) !== null && _position_bottom !== void 0 ? _position_bottom : 0) - overlayHeight); 5875 var _boundaryDimensions_scroll_top, _margins_top, _margins_bottom, _boundaryDimensions_scroll_top1, _margins_top1, _margins_bottom1; 5876 let maxHeight = heightGrowthDirection !== "top" ? ( 5877 // We want the distance between the top of the overlay to the bottom of the boundary 5878 Math.max(0, boundaryDimensions.height + boundaryDimensions.top + ((_boundaryDimensions_scroll_top = boundaryDimensions.scroll.top) !== null && _boundaryDimensions_scroll_top !== void 0 ? _boundaryDimensions_scroll_top : 0) - overlayTop - (((_margins_top = margins.top) !== null && _margins_top !== void 0 ? _margins_top : 0) + ((_margins_bottom = margins.bottom) !== null && _margins_bottom !== void 0 ? _margins_bottom : 0) + padding)) 5879 ) : Math.max(0, overlayTop + overlayHeight - (boundaryDimensions.top + ((_boundaryDimensions_scroll_top1 = boundaryDimensions.scroll.top) !== null && _boundaryDimensions_scroll_top1 !== void 0 ? _boundaryDimensions_scroll_top1 : 0)) - (((_margins_top1 = margins.top) !== null && _margins_top1 !== void 0 ? _margins_top1 : 0) + ((_margins_bottom1 = margins.bottom) !== null && _margins_bottom1 !== void 0 ? _margins_bottom1 : 0) + padding)); 5880 return Math.min(boundaryDimensions.height - padding * 2, maxHeight); 5881} 5882function $edcf132a9284368a$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding, placementInfo) { 5883 let { placement, axis, size } = placementInfo; 5884 var _boundaryDimensions_scroll_axis, _margins_axis; 5885 if (placement === axis) return Math.max(0, childOffset[axis] - boundaryDimensions[axis] - ((_boundaryDimensions_scroll_axis = boundaryDimensions.scroll[axis]) !== null && _boundaryDimensions_scroll_axis !== void 0 ? _boundaryDimensions_scroll_axis : 0) + containerOffsetWithBoundary[axis] - ((_margins_axis = margins[axis]) !== null && _margins_axis !== void 0 ? _margins_axis : 0) - margins[$edcf132a9284368a$var$FLIPPED_DIRECTION[axis]] - padding); 5886 var _margins_axis1; 5887 return Math.max(0, boundaryDimensions[size] + boundaryDimensions[axis] + boundaryDimensions.scroll[axis] - containerOffsetWithBoundary[axis] - childOffset[axis] - childOffset[size] - ((_margins_axis1 = margins[axis]) !== null && _margins_axis1 !== void 0 ? _margins_axis1 : 0) - margins[$edcf132a9284368a$var$FLIPPED_DIRECTION[axis]] - padding); 5888} 5889function $edcf132a9284368a$export$6839422d1f33cee9(placementInput, childOffset, overlaySize, scrollSize, margins, padding, flip2, boundaryDimensions, containerDimensions, containerOffsetWithBoundary, offset2, crossOffset, isContainerPositioned, userSetMaxHeight, arrowSize, arrowBoundaryOffset) { 5890 let placementInfo = $edcf132a9284368a$var$parsePlacement(placementInput), { size, crossAxis, crossSize, placement, crossPlacement } = placementInfo, position = $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, offset2, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset), normalizedOffset = offset2, space = $edcf132a9284368a$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding + offset2, placementInfo); 5891 if (flip2 && scrollSize[size] > space) { 5892 let flippedPlacementInfo = $edcf132a9284368a$var$parsePlacement(`${$edcf132a9284368a$var$FLIPPED_DIRECTION[placement]} ${crossPlacement}`), flippedPosition = $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions, overlaySize, flippedPlacementInfo, offset2, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset); 5893 $edcf132a9284368a$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding + offset2, flippedPlacementInfo) > space && (placementInfo = flippedPlacementInfo, position = flippedPosition, normalizedOffset = offset2); 5894 } 5895 let heightGrowthDirection = "bottom"; 5896 placementInfo.axis === "top" ? placementInfo.placement === "top" ? heightGrowthDirection = "top" : placementInfo.placement === "bottom" && (heightGrowthDirection = "bottom") : placementInfo.crossAxis === "top" && (placementInfo.crossPlacement === "top" ? heightGrowthDirection = "bottom" : placementInfo.crossPlacement === "bottom" && (heightGrowthDirection = "top")); 5897 let delta = $edcf132a9284368a$var$getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundaryDimensions, containerDimensions, padding, containerOffsetWithBoundary); 5898 position[crossAxis] += delta; 5899 let maxHeight = $edcf132a9284368a$var$getMaxHeight(position, boundaryDimensions, containerOffsetWithBoundary, isContainerPositioned, margins, padding, overlaySize.height, heightGrowthDirection); 5900 userSetMaxHeight && userSetMaxHeight < maxHeight && (maxHeight = userSetMaxHeight), overlaySize.height = Math.min(overlaySize.height, maxHeight), position = $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, normalizedOffset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset), delta = $edcf132a9284368a$var$getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundaryDimensions, containerDimensions, padding, containerOffsetWithBoundary), position[crossAxis] += delta; 5901 let arrowPosition = {}, origin = childOffset[crossAxis] - position[crossAxis] - margins[$edcf132a9284368a$var$AXIS[crossAxis]], preferredArrowPosition = origin + 0.5 * childOffset[crossSize], arrowMinPosition = arrowSize / 2 + arrowBoundaryOffset; 5902 var _margins_left, _margins_right, _margins_top, _margins_bottom; 5903 let overlayMargin = $edcf132a9284368a$var$AXIS[crossAxis] === "left" ? ((_margins_left = margins.left) !== null && _margins_left !== void 0 ? _margins_left : 0) + ((_margins_right = margins.right) !== null && _margins_right !== void 0 ? _margins_right : 0) : ((_margins_top = margins.top) !== null && _margins_top !== void 0 ? _margins_top : 0) + ((_margins_bottom = margins.bottom) !== null && _margins_bottom !== void 0 ? _margins_bottom : 0), arrowMaxPosition = overlaySize[crossSize] - overlayMargin - arrowSize / 2 - arrowBoundaryOffset, arrowOverlappingChildMinEdge = childOffset[crossAxis] + arrowSize / 2 - (position[crossAxis] + margins[$edcf132a9284368a$var$AXIS[crossAxis]]), arrowOverlappingChildMaxEdge = childOffset[crossAxis] + childOffset[crossSize] - arrowSize / 2 - (position[crossAxis] + margins[$edcf132a9284368a$var$AXIS[crossAxis]]), arrowPositionOverlappingChild = $9446cca9a3875146$export$7d15b64cf5a3a4c4(preferredArrowPosition, arrowOverlappingChildMinEdge, arrowOverlappingChildMaxEdge); 5904 arrowPosition[crossAxis] = $9446cca9a3875146$export$7d15b64cf5a3a4c4(arrowPositionOverlappingChild, arrowMinPosition, arrowMaxPosition), { placement, crossPlacement } = placementInfo, arrowSize ? origin = arrowPosition[crossAxis] : crossPlacement === "right" ? origin += childOffset[crossSize] : crossPlacement === "center" && (origin += childOffset[crossSize] / 2); 5905 let crossOrigin = placement === "left" || placement === "top" ? overlaySize[size] : 0, triggerAnchorPoint = { 5906 x: placement === "top" || placement === "bottom" ? origin : crossOrigin, 5907 y: placement === "left" || placement === "right" ? origin : crossOrigin 5908 }; 5909 return { 5910 position, 5911 maxHeight, 5912 arrowOffsetLeft: arrowPosition.left, 5913 arrowOffsetTop: arrowPosition.top, 5914 placement, 5915 triggerAnchorPoint 5916 }; 5917} 5918function $edcf132a9284368a$export$b3ceb0cbf1056d98(opts) { 5919 let { placement, targetNode, overlayNode, scrollNode, padding, shouldFlip, boundaryElement, offset: offset2, crossOffset, maxHeight, arrowSize = 0, arrowBoundaryOffset = 0 } = opts, container = overlayNode instanceof HTMLElement ? $edcf132a9284368a$var$getContainingBlock(overlayNode) : document.documentElement, isViewportContainer = container === document.documentElement, containerPositionStyle = window.getComputedStyle(container).position, isContainerPositioned = !!containerPositionStyle && containerPositionStyle !== "static", childOffset = isViewportContainer ? $edcf132a9284368a$var$getOffset(targetNode, !1) : $edcf132a9284368a$var$getPosition(targetNode, container, !1); 5920 if (!isViewportContainer) { 5921 let { marginTop, marginLeft } = window.getComputedStyle(targetNode); 5922 childOffset.top += parseInt(marginTop, 10) || 0, childOffset.left += parseInt(marginLeft, 10) || 0; 5923 } 5924 let overlaySize = $edcf132a9284368a$var$getOffset(overlayNode, !0), margins = $edcf132a9284368a$var$getMargins(overlayNode); 5925 var _margins_left, _margins_right; 5926 overlaySize.width += ((_margins_left = margins.left) !== null && _margins_left !== void 0 ? _margins_left : 0) + ((_margins_right = margins.right) !== null && _margins_right !== void 0 ? _margins_right : 0); 5927 var _margins_top, _margins_bottom; 5928 overlaySize.height += ((_margins_top = margins.top) !== null && _margins_top !== void 0 ? _margins_top : 0) + ((_margins_bottom = margins.bottom) !== null && _margins_bottom !== void 0 ? _margins_bottom : 0); 5929 let scrollSize = $edcf132a9284368a$var$getScroll(scrollNode), boundaryDimensions = $edcf132a9284368a$var$getContainerDimensions(boundaryElement), containerDimensions = $edcf132a9284368a$var$getContainerDimensions(container), containerOffsetWithBoundary = boundaryElement.tagName === "BODY" ? $edcf132a9284368a$var$getOffset(container, !1) : $edcf132a9284368a$var$getPosition(container, boundaryElement, !1); 5930 return container.tagName === "HTML" && boundaryElement.tagName === "BODY" && (containerDimensions.scroll.top = 0, containerDimensions.scroll.left = 0), $edcf132a9284368a$export$6839422d1f33cee9(placement, childOffset, overlaySize, scrollSize, margins, padding, shouldFlip, boundaryDimensions, containerDimensions, containerOffsetWithBoundary, offset2, crossOffset, isContainerPositioned, maxHeight, arrowSize, arrowBoundaryOffset); 5931} 5932function $edcf132a9284368a$export$4b834cebd9e5cebe(node, ignoreScale) { 5933 let { top, left, width, height } = node.getBoundingClientRect(); 5934 return ignoreScale && node instanceof node.ownerDocument.defaultView.HTMLElement && (width = node.offsetWidth, height = node.offsetHeight), { 5935 top, 5936 left, 5937 width, 5938 height 5939 }; 5940} 5941function $edcf132a9284368a$var$getOffset(node, ignoreScale) { 5942 let { top, left, width, height } = $edcf132a9284368a$export$4b834cebd9e5cebe(node, ignoreScale), { scrollTop, scrollLeft, clientTop, clientLeft } = document.documentElement; 5943 return { 5944 top: top + scrollTop - clientTop, 5945 left: left + scrollLeft - clientLeft, 5946 width, 5947 height 5948 }; 5949} 5950function $edcf132a9284368a$var$getPosition(node, parent, ignoreScale) { 5951 let style = window.getComputedStyle(node), offset2; 5952 if (style.position === "fixed") offset2 = $edcf132a9284368a$export$4b834cebd9e5cebe(node, ignoreScale); 5953 else { 5954 offset2 = $edcf132a9284368a$var$getOffset(node, ignoreScale); 5955 let parentOffset = $edcf132a9284368a$var$getOffset(parent, ignoreScale), parentStyle = window.getComputedStyle(parent); 5956 parentOffset.top += (parseInt(parentStyle.borderTopWidth, 10) || 0) - parent.scrollTop, parentOffset.left += (parseInt(parentStyle.borderLeftWidth, 10) || 0) - parent.scrollLeft, offset2.top -= parentOffset.top, offset2.left -= parentOffset.left; 5957 } 5958 return offset2.top -= parseInt(style.marginTop, 10) || 0, offset2.left -= parseInt(style.marginLeft, 10) || 0, offset2; 5959} 5960function $edcf132a9284368a$var$getContainingBlock(node) { 5961 let offsetParent = node.offsetParent; 5962 if (offsetParent && offsetParent === document.body && window.getComputedStyle(offsetParent).position === "static" && !$edcf132a9284368a$var$isContainingBlock(offsetParent) && (offsetParent = document.documentElement), offsetParent == null) 5963 for (offsetParent = node.parentElement; offsetParent && !$edcf132a9284368a$var$isContainingBlock(offsetParent); ) offsetParent = offsetParent.parentElement; 5964 return offsetParent || document.documentElement; 5965} 5966function $edcf132a9284368a$var$isContainingBlock(node) { 5967 let style = window.getComputedStyle(node); 5968 return style.transform !== "none" || /transform|perspective/.test(style.willChange) || style.filter !== "none" || style.contain === "paint" || "backdropFilter" in style && style.backdropFilter !== "none" || "WebkitBackdropFilter" in style && style.WebkitBackdropFilter !== "none"; 5969} 5970 5971// ../../node_modules/@react-aria/overlays/dist/useCloseOnScroll.mjs 5972init_react(); 5973var $dd149f63282afbbf$export$f6211563215e3b37 = /* @__PURE__ */ new WeakMap(); 5974function $dd149f63282afbbf$export$18fc8428861184da(opts) { 5975 let { triggerRef, isOpen, onClose } = opts; 5976 useEffect(() => { 5977 if (!isOpen || onClose === null) return; 5978 let onScroll = (e2) => { 5979 let target = e2.target; 5980 if (!triggerRef.current || target instanceof Node && !target.contains(triggerRef.current) || e2.target instanceof HTMLInputElement || e2.target instanceof HTMLTextAreaElement) return; 5981 let onCloseHandler = onClose || $dd149f63282afbbf$export$f6211563215e3b37.get(triggerRef.current); 5982 onCloseHandler && onCloseHandler(); 5983 }; 5984 return window.addEventListener("scroll", onScroll, !0), () => { 5985 window.removeEventListener("scroll", onScroll, !0); 5986 }; 5987 }, [ 5988 isOpen, 5989 onClose, 5990 triggerRef 5991 ]); 5992} 5993 5994// ../../node_modules/@react-aria/overlays/dist/useOverlayPosition.mjs 5995init_react(); 5996 5997// ../../node_modules/@react-aria/i18n/dist/utils.mjs 5998var $148a7a147e38ea7f$var$RTL_SCRIPTS = /* @__PURE__ */ new Set([ 5999 "Arab", 6000 "Syrc", 6001 "Samr", 6002 "Mand", 6003 "Thaa", 6004 "Mend", 6005 "Nkoo", 6006 "Adlm", 6007 "Rohg", 6008 "Hebr" 6009]), $148a7a147e38ea7f$var$RTL_LANGS = /* @__PURE__ */ new Set([ 6010 "ae", 6011 "ar", 6012 "arc", 6013 "bcc", 6014 "bqi", 6015 "ckb", 6016 "dv", 6017 "fa", 6018 "glk", 6019 "he", 6020 "ku", 6021 "mzn", 6022 "nqo", 6023 "pnb", 6024 "ps", 6025 "sd", 6026 "ug", 6027 "ur", 6028 "yi" 6029]); 6030function $148a7a147e38ea7f$export$702d680b21cbd764(localeString) { 6031 if (Intl.Locale) { 6032 let locale = new Intl.Locale(localeString).maximize(), textInfo = typeof locale.getTextInfo == "function" ? locale.getTextInfo() : locale.textInfo; 6033 if (textInfo) return textInfo.direction === "rtl"; 6034 if (locale.script) return $148a7a147e38ea7f$var$RTL_SCRIPTS.has(locale.script); 6035 } 6036 let lang = localeString.split("-")[0]; 6037 return $148a7a147e38ea7f$var$RTL_LANGS.has(lang); 6038} 6039 6040// ../../node_modules/@react-aria/i18n/dist/useDefaultLocale.mjs 6041init_react(); 6042var $1e5a04cdaf7d1af8$var$localeSymbol = /* @__PURE__ */ Symbol.for("react-aria.i18n.locale"); 6043function $1e5a04cdaf7d1af8$export$f09106e7c6677ec5() { 6044 let locale = typeof window < "u" && window[$1e5a04cdaf7d1af8$var$localeSymbol] || typeof navigator < "u" && (navigator.language || navigator.userLanguage) || "en-US"; 6045 try { 6046 Intl.DateTimeFormat.supportedLocalesOf([ 6047 locale 6048 ]); 6049 } catch { 6050 locale = "en-US"; 6051 } 6052 return { 6053 locale, 6054 direction: $148a7a147e38ea7f$export$702d680b21cbd764(locale) ? "rtl" : "ltr" 6055 }; 6056} 6057var $1e5a04cdaf7d1af8$var$currentLocale = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5(), $1e5a04cdaf7d1af8$var$listeners = /* @__PURE__ */ new Set(); 6058function $1e5a04cdaf7d1af8$var$updateLocale() { 6059 $1e5a04cdaf7d1af8$var$currentLocale = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5(); 6060 for (let listener of $1e5a04cdaf7d1af8$var$listeners) listener($1e5a04cdaf7d1af8$var$currentLocale); 6061} 6062function $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a() { 6063 let isSSR = $b5e257d569688ac6$export$535bd6ca7f90a273(), [defaultLocale2, setDefaultLocale] = useState($1e5a04cdaf7d1af8$var$currentLocale); 6064 return useEffect(() => ($1e5a04cdaf7d1af8$var$listeners.size === 0 && window.addEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale), $1e5a04cdaf7d1af8$var$listeners.add(setDefaultLocale), () => { 6065 $1e5a04cdaf7d1af8$var$listeners.delete(setDefaultLocale), $1e5a04cdaf7d1af8$var$listeners.size === 0 && window.removeEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale); 6066 }), []), isSSR ? { 6067 locale: "en-US", 6068 direction: "ltr" 6069 } : defaultLocale2; 6070} 6071 6072// ../../node_modules/@react-aria/i18n/dist/context.mjs 6073init_react(); 6074var $18f2051aff69b9bf$var$I18nContext = react_default.createContext(null); 6075function $18f2051aff69b9bf$export$43bb16f9c6d9e3f7() { 6076 let defaultLocale2 = $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a(); 6077 return useContext($18f2051aff69b9bf$var$I18nContext) || defaultLocale2; 6078} 6079 6080// ../../node_modules/tslib/tslib.es6.mjs 6081var extendStatics = function(d2, b2) { 6082 return extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) { 6083 d3.__proto__ = b3; 6084 } || function(d3, b3) { 6085 for (var p2 in b3) Object.prototype.hasOwnProperty.call(b3, p2) && (d3[p2] = b3[p2]); 6086 }, extendStatics(d2, b2); 6087}; 6088function __extends(d2, b2) { 6089 if (typeof b2 != "function" && b2 !== null) 6090 throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null"); 6091 extendStatics(d2, b2); 6092 function __() { 6093 this.constructor = d2; 6094 } 6095 d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __()); 6096} 6097var __assign = function() { 6098 return __assign = Object.assign || function(t2) { 6099 for (var s2, i2 = 1, n3 = arguments.length; i2 < n3; i2++) { 6100 s2 = arguments[i2]; 6101 for (var p2 in s2) Object.prototype.hasOwnProperty.call(s2, p2) && (t2[p2] = s2[p2]); 6102 } 6103 return t2; 6104 }, __assign.apply(this, arguments); 6105}; 6106function __rest(s2, e2) { 6107 var t2 = {}; 6108 for (var p2 in s2) Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0 && (t2[p2] = s2[p2]); 6109 if (s2 != null && typeof Object.getOwnPropertySymbols == "function") 6110 for (var i2 = 0, p2 = Object.getOwnPropertySymbols(s2); i2 < p2.length; i2++) 6111 e2.indexOf(p2[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i2]) && (t2[p2[i2]] = s2[p2[i2]]); 6112 return t2; 6113} 6114function __spreadArray(to, from, pack) { 6115 if (pack || arguments.length === 2) for (var i2 = 0, l3 = from.length, ar; i2 < l3; i2++) 6116 (ar || !(i2 in from)) && (ar || (ar = Array.prototype.slice.call(from, 0, i2)), ar[i2] = from[i2]); 6117 return to.concat(ar || Array.prototype.slice.call(from)); 6118} 6119 6120// ../../node_modules/@formatjs/fast-memoize/lib/index.js 6121function memoize(fn, options2) { 6122 var cache = options2 && options2.cache ? options2.cache : cacheDefault, serializer = options2 && options2.serializer ? options2.serializer : serializerDefault, strategy = options2 && options2.strategy ? options2.strategy : strategyDefault; 6123 return strategy(fn, { 6124 cache, 6125 serializer 6126 }); 6127} 6128function isPrimitive2(value) { 6129 return value == null || typeof value == "number" || typeof value == "boolean"; 6130} 6131function monadic(fn, cache, serializer, arg) { 6132 var cacheKey = isPrimitive2(arg) ? arg : serializer(arg), computedValue = cache.get(cacheKey); 6133 return typeof computedValue > "u" && (computedValue = fn.call(this, arg), cache.set(cacheKey, computedValue)), computedValue; 6134} 6135function variadic(fn, cache, serializer) { 6136 var args = Array.prototype.slice.call(arguments, 3), cacheKey = serializer(args), computedValue = cache.get(cacheKey); 6137 return typeof computedValue > "u" && (computedValue = fn.apply(this, args), cache.set(cacheKey, computedValue)), computedValue; 6138} 6139function assemble(fn, context, strategy, cache, serialize) { 6140 return strategy.bind(context, fn, cache, serialize); 6141} 6142function strategyDefault(fn, options2) { 6143 var strategy = fn.length === 1 ? monadic : variadic; 6144 return assemble(fn, this, strategy, options2.cache.create(), options2.serializer); 6145} 6146function strategyVariadic(fn, options2) { 6147 return assemble(fn, this, variadic, options2.cache.create(), options2.serializer); 6148} 6149function strategyMonadic(fn, options2) { 6150 return assemble(fn, this, monadic, options2.cache.create(), options2.serializer); 6151} 6152var serializerDefault = function() { 6153 return JSON.stringify(arguments); 6154}, ObjectWithoutPrototypeCache = ( 6155 /** @class */ 6156 (function() { 6157 function ObjectWithoutPrototypeCache2() { 6158 this.cache = /* @__PURE__ */ Object.create(null); 6159 } 6160 return ObjectWithoutPrototypeCache2.prototype.get = function(key) { 6161 return this.cache[key]; 6162 }, ObjectWithoutPrototypeCache2.prototype.set = function(key, value) { 6163 this.cache[key] = value; 6164 }, ObjectWithoutPrototypeCache2; 6165 })() 6166), cacheDefault = { 6167 create: function() { 6168 return new ObjectWithoutPrototypeCache(); 6169 } 6170}, strategies = { 6171 variadic: strategyVariadic, 6172 monadic: strategyMonadic 6173}; 6174 6175// ../../node_modules/@formatjs/icu-messageformat-parser/lib/error.js 6176var ErrorKind; 6177(function(ErrorKind2) { 6178 ErrorKind2[ErrorKind2.EXPECT_ARGUMENT_CLOSING_BRACE = 1] = "EXPECT_ARGUMENT_CLOSING_BRACE", ErrorKind2[ErrorKind2.EMPTY_ARGUMENT = 2] = "EMPTY_ARGUMENT", ErrorKind2[ErrorKind2.MALFORMED_ARGUMENT = 3] = "MALFORMED_ARGUMENT", ErrorKind2[ErrorKind2.EXPECT_ARGUMENT_TYPE = 4] = "EXPECT_ARGUMENT_TYPE", ErrorKind2[ErrorKind2.INVALID_ARGUMENT_TYPE = 5] = "INVALID_ARGUMENT_TYPE", ErrorKind2[ErrorKind2.EXPECT_ARGUMENT_STYLE = 6] = "EXPECT_ARGUMENT_STYLE", ErrorKind2[ErrorKind2.INVALID_NUMBER_SKELETON = 7] = "INVALID_NUMBER_SKELETON", ErrorKind2[ErrorKind2.INVALID_DATE_TIME_SKELETON = 8] = "INVALID_DATE_TIME_SKELETON", ErrorKind2[ErrorKind2.EXPECT_NUMBER_SKELETON = 9] = "EXPECT_NUMBER_SKELETON", ErrorKind2[ErrorKind2.EXPECT_DATE_TIME_SKELETON = 10] = "EXPECT_DATE_TIME_SKELETON", ErrorKind2[ErrorKind2.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE = 11] = "UNCLOSED_QUOTE_IN_ARGUMENT_STYLE", ErrorKind2[ErrorKind2.EXPECT_SELECT_ARGUMENT_OPTIONS = 12] = "EXPECT_SELECT_ARGUMENT_OPTIONS", ErrorKind2[ErrorKind2.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE = 13] = "EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE", ErrorKind2[ErrorKind2.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE = 14] = "INVALID_PLURAL_ARGUMENT_OFFSET_VALUE", ErrorKind2[ErrorKind2.EXPECT_SELECT_ARGUMENT_SELECTOR = 15] = "EXPECT_SELECT_ARGUMENT_SELECTOR", ErrorKind2[ErrorKind2.EXPECT_PLURAL_ARGUMENT_SELECTOR = 16] = "EXPECT_PLURAL_ARGUMENT_SELECTOR", ErrorKind2[ErrorKind2.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT = 17] = "EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT", ErrorKind2[ErrorKind2.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT = 18] = "EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT", ErrorKind2[ErrorKind2.INVALID_PLURAL_ARGUMENT_SELECTOR = 19] = "INVALID_PLURAL_ARGUMENT_SELECTOR", ErrorKind2[ErrorKind2.DUPLICATE_PLURAL_ARGUMENT_SELECTOR = 20] = "DUPLICATE_PLURAL_ARGUMENT_SELECTOR", ErrorKind2[ErrorKind2.DUPLICATE_SELECT_ARGUMENT_SELECTOR = 21] = "DUPLICATE_SELECT_ARGUMENT_SELECTOR", ErrorKind2[ErrorKind2.MISSING_OTHER_CLAUSE = 22] = "MISSING_OTHER_CLAUSE", ErrorKind2[ErrorKind2.INVALID_TAG = 23] = "INVALID_TAG", ErrorKind2[ErrorKind2.INVALID_TAG_NAME = 25] = "INVALID_TAG_NAME", ErrorKind2[ErrorKind2.UNMATCHED_CLOSING_TAG = 26] = "UNMATCHED_CLOSING_TAG", ErrorKind2[ErrorKind2.UNCLOSED_TAG = 27] = "UNCLOSED_TAG"; 6179})(ErrorKind || (ErrorKind = {})); 6180 6181// ../../node_modules/@formatjs/icu-messageformat-parser/lib/types.js 6182var TYPE; 6183(function(TYPE2) { 6184 TYPE2[TYPE2.literal = 0] = "literal", TYPE2[TYPE2.argument = 1] = "argument", TYPE2[TYPE2.number = 2] = "number", TYPE2[TYPE2.date = 3] = "date", TYPE2[TYPE2.time = 4] = "time", TYPE2[TYPE2.select = 5] = "select", TYPE2[TYPE2.plural = 6] = "plural", TYPE2[TYPE2.pound = 7] = "pound", TYPE2[TYPE2.tag = 8] = "tag"; 6185})(TYPE || (TYPE = {})); 6186var SKELETON_TYPE; 6187(function(SKELETON_TYPE2) { 6188 SKELETON_TYPE2[SKELETON_TYPE2.number = 0] = "number", SKELETON_TYPE2[SKELETON_TYPE2.dateTime = 1] = "dateTime"; 6189})(SKELETON_TYPE || (SKELETON_TYPE = {})); 6190function isLiteralElement(el) { 6191 return el.type === TYPE.literal; 6192} 6193function isArgumentElement(el) { 6194 return el.type === TYPE.argument; 6195} 6196function isNumberElement(el) { 6197 return el.type === TYPE.number; 6198} 6199function isDateElement(el) { 6200 return el.type === TYPE.date; 6201} 6202function isTimeElement(el) { 6203 return el.type === TYPE.time; 6204} 6205function isSelectElement(el) { 6206 return el.type === TYPE.select; 6207} 6208function isPluralElement(el) { 6209 return el.type === TYPE.plural; 6210} 6211function isPoundElement(el) { 6212 return el.type === TYPE.pound; 6213} 6214function isTagElement(el) { 6215 return el.type === TYPE.tag; 6216} 6217function isNumberSkeleton(el) { 6218 return !!(el && typeof el == "object" && el.type === SKELETON_TYPE.number); 6219} 6220function isDateTimeSkeleton(el) { 6221 return !!(el && typeof el == "object" && el.type === SKELETON_TYPE.dateTime); 6222} 6223 6224// ../../node_modules/@formatjs/icu-messageformat-parser/lib/regex.generated.js 6225var SPACE_SEPARATOR_REGEX = /[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/; 6226 6227// ../../node_modules/@formatjs/icu-skeleton-parser/lib/date-time.js 6228var DATE_TIME_REGEX = /(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g; 6229function parseDateTimeSkeleton(skeleton) { 6230 var result = {}; 6231 return skeleton.replace(DATE_TIME_REGEX, function(match) { 6232 var len = match.length; 6233 switch (match[0]) { 6234 // Era 6235 case "G": 6236 result.era = len === 4 ? "long" : len === 5 ? "narrow" : "short"; 6237 break; 6238 // Year 6239 case "y": 6240 result.year = len === 2 ? "2-digit" : "numeric"; 6241 break; 6242 case "Y": 6243 case "u": 6244 case "U": 6245 case "r": 6246 throw new RangeError("`Y/u/U/r` (year) patterns are not supported, use `y` instead"); 6247 // Quarter 6248 case "q": 6249 case "Q": 6250 throw new RangeError("`q/Q` (quarter) patterns are not supported"); 6251 // Month 6252 case "M": 6253 case "L": 6254 result.month = ["numeric", "2-digit", "short", "long", "narrow"][len - 1]; 6255 break; 6256 // Week 6257 case "w": 6258 case "W": 6259 throw new RangeError("`w/W` (week) patterns are not supported"); 6260 case "d": 6261 result.day = ["numeric", "2-digit"][len - 1]; 6262 break; 6263 case "D": 6264 case "F": 6265 case "g": 6266 throw new RangeError("`D/F/g` (day) patterns are not supported, use `d` instead"); 6267 // Weekday 6268 case "E": 6269 result.weekday = len === 4 ? "long" : len === 5 ? "narrow" : "short"; 6270 break; 6271 case "e": 6272 if (len < 4) 6273 throw new RangeError("`e..eee` (weekday) patterns are not supported"); 6274 result.weekday = ["short", "long", "narrow", "short"][len - 4]; 6275 break; 6276 case "c": 6277 if (len < 4) 6278 throw new RangeError("`c..ccc` (weekday) patterns are not supported"); 6279 result.weekday = ["short", "long", "narrow", "short"][len - 4]; 6280 break; 6281 // Period 6282 case "a": 6283 result.hour12 = !0; 6284 break; 6285 case "b": 6286 // am, pm, noon, midnight 6287 case "B": 6288 throw new RangeError("`b/B` (period) patterns are not supported, use `a` instead"); 6289 // Hour 6290 case "h": 6291 result.hourCycle = "h12", result.hour = ["numeric", "2-digit"][len - 1]; 6292 break; 6293 case "H": 6294 result.hourCycle = "h23", result.hour = ["numeric", "2-digit"][len - 1]; 6295 break; 6296 case "K": 6297 result.hourCycle = "h11", result.hour = ["numeric", "2-digit"][len - 1]; 6298 break; 6299 case "k": 6300 result.hourCycle = "h24", result.hour = ["numeric", "2-digit"][len - 1]; 6301 break; 6302 case "j": 6303 case "J": 6304 case "C": 6305 throw new RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead"); 6306 // Minute 6307 case "m": 6308 result.minute = ["numeric", "2-digit"][len - 1]; 6309 break; 6310 // Second 6311 case "s": 6312 result.second = ["numeric", "2-digit"][len - 1]; 6313 break; 6314 case "S": 6315 case "A": 6316 throw new RangeError("`S/A` (second) patterns are not supported, use `s` instead"); 6317 // Zone 6318 case "z": 6319 result.timeZoneName = len < 4 ? "short" : "long"; 6320 break; 6321 case "Z": 6322 // 1..3, 4, 5: The ISO8601 varios formats 6323 case "O": 6324 // 1, 4: milliseconds in day short, long 6325 case "v": 6326 // 1, 4: generic non-location format 6327 case "V": 6328 // 1, 2, 3, 4: time zone ID or city 6329 case "X": 6330 // 1, 2, 3, 4: The ISO8601 varios formats 6331 case "x": 6332 throw new RangeError("`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead"); 6333 } 6334 return ""; 6335 }), result; 6336} 6337 6338// ../../node_modules/@formatjs/icu-skeleton-parser/lib/regex.generated.js 6339var WHITE_SPACE_REGEX = /[\t-\r \x85\u200E\u200F\u2028\u2029]/i; 6340 6341// ../../node_modules/@formatjs/icu-skeleton-parser/lib/number.js 6342function parseNumberSkeletonFromString(skeleton) { 6343 if (skeleton.length === 0) 6344 throw new Error("Number skeleton cannot be empty"); 6345 for (var stringTokens = skeleton.split(WHITE_SPACE_REGEX).filter(function(x2) { 6346 return x2.length > 0; 6347 }), tokens2 = [], _i = 0, stringTokens_1 = stringTokens; _i < stringTokens_1.length; _i++) { 6348 var stringToken = stringTokens_1[_i], stemAndOptions = stringToken.split("/"); 6349 if (stemAndOptions.length === 0) 6350 throw new Error("Invalid number skeleton"); 6351 for (var stem = stemAndOptions[0], options2 = stemAndOptions.slice(1), _a2 = 0, options_1 = options2; _a2 < options_1.length; _a2++) { 6352 var option = options_1[_a2]; 6353 if (option.length === 0) 6354 throw new Error("Invalid number skeleton"); 6355 } 6356 tokens2.push({ stem, options: options2 }); 6357 } 6358 return tokens2; 6359} 6360function icuUnitToEcma(unit) { 6361 return unit.replace(/^(.*?)-/, ""); 6362} 6363var FRACTION_PRECISION_REGEX = /^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g, SIGNIFICANT_PRECISION_REGEX = /^(@+)?(\+|#+)?[rs]?$/g, INTEGER_WIDTH_REGEX = /(\*)(0+)|(#+)(0+)|(0+)/g, CONCISE_INTEGER_WIDTH_REGEX = /^(0+)$/; 6364function parseSignificantPrecision(str) { 6365 var result = {}; 6366 return str[str.length - 1] === "r" ? result.roundingPriority = "morePrecision" : str[str.length - 1] === "s" && (result.roundingPriority = "lessPrecision"), str.replace(SIGNIFICANT_PRECISION_REGEX, function(_2, g1, g2) { 6367 return typeof g2 != "string" ? (result.minimumSignificantDigits = g1.length, result.maximumSignificantDigits = g1.length) : g2 === "+" ? result.minimumSignificantDigits = g1.length : g1[0] === "#" ? result.maximumSignificantDigits = g1.length : (result.minimumSignificantDigits = g1.length, result.maximumSignificantDigits = g1.length + (typeof g2 == "string" ? g2.length : 0)), ""; 6368 }), result; 6369} 6370function parseSign(str) { 6371 switch (str) { 6372 case "sign-auto": 6373 return { 6374 signDisplay: "auto" 6375 }; 6376 case "sign-accounting": 6377 case "()": 6378 return { 6379 currencySign: "accounting" 6380 }; 6381 case "sign-always": 6382 case "+!": 6383 return { 6384 signDisplay: "always" 6385 }; 6386 case "sign-accounting-always": 6387 case "()!": 6388 return { 6389 signDisplay: "always", 6390 currencySign: "accounting" 6391 }; 6392 case "sign-except-zero": 6393 case "+?": 6394 return { 6395 signDisplay: "exceptZero" 6396 }; 6397 case "sign-accounting-except-zero": 6398 case "()?": 6399 return { 6400 signDisplay: "exceptZero", 6401 currencySign: "accounting" 6402 }; 6403 case "sign-never": 6404 case "+_": 6405 return { 6406 signDisplay: "never" 6407 }; 6408 } 6409} 6410function parseConciseScientificAndEngineeringStem(stem) { 6411 var result; 6412 if (stem[0] === "E" && stem[1] === "E" ? (result = { 6413 notation: "engineering" 6414 }, stem = stem.slice(2)) : stem[0] === "E" && (result = { 6415 notation: "scientific" 6416 }, stem = stem.slice(1)), result) { 6417 var signDisplay = stem.slice(0, 2); 6418 if (signDisplay === "+!" ? (result.signDisplay = "always", stem = stem.slice(2)) : signDisplay === "+?" && (result.signDisplay = "exceptZero", stem = stem.slice(2)), !CONCISE_INTEGER_WIDTH_REGEX.test(stem)) 6419 throw new Error("Malformed concise eng/scientific notation"); 6420 result.minimumIntegerDigits = stem.length; 6421 } 6422 return result; 6423} 6424function parseNotationOptions(opt) { 6425 var result = {}, signOpts = parseSign(opt); 6426 return signOpts || result; 6427} 6428function parseNumberSkeleton(tokens2) { 6429 for (var result = {}, _i = 0, tokens_1 = tokens2; _i < tokens_1.length; _i++) { 6430 var token = tokens_1[_i]; 6431 switch (token.stem) { 6432 case "percent": 6433 case "%": 6434 result.style = "percent"; 6435 continue; 6436 case "%x100": 6437 result.style = "percent", result.scale = 100; 6438 continue; 6439 case "currency": 6440 result.style = "currency", result.currency = token.options[0]; 6441 continue; 6442 case "group-off": 6443 case ",_": 6444 result.useGrouping = !1; 6445 continue; 6446 case "precision-integer": 6447 case ".": 6448 result.maximumFractionDigits = 0; 6449 continue; 6450 case "measure-unit": 6451 case "unit": 6452 result.style = "unit", result.unit = icuUnitToEcma(token.options[0]); 6453 continue; 6454 case "compact-short": 6455 case "K": 6456 result.notation = "compact", result.compactDisplay = "short"; 6457 continue; 6458 case "compact-long": 6459 case "KK": 6460 result.notation = "compact", result.compactDisplay = "long"; 6461 continue; 6462 case "scientific": 6463 result = __assign(__assign(__assign({}, result), { notation: "scientific" }), token.options.reduce(function(all, opt2) { 6464 return __assign(__assign({}, all), parseNotationOptions(opt2)); 6465 }, {})); 6466 continue; 6467 case "engineering": 6468 result = __assign(__assign(__assign({}, result), { notation: "engineering" }), token.options.reduce(function(all, opt2) { 6469 return __assign(__assign({}, all), parseNotationOptions(opt2)); 6470 }, {})); 6471 continue; 6472 case "notation-simple": 6473 result.notation = "standard"; 6474 continue; 6475 // https://github.com/unicode-org/icu/blob/master/icu4c/source/i18n/unicode/unumberformatter.h 6476 case "unit-width-narrow": 6477 result.currencyDisplay = "narrowSymbol", result.unitDisplay = "narrow"; 6478 continue; 6479 case "unit-width-short": 6480 result.currencyDisplay = "code", result.unitDisplay = "short"; 6481 continue; 6482 case "unit-width-full-name": 6483 result.currencyDisplay = "name", result.unitDisplay = "long"; 6484 continue; 6485 case "unit-width-iso-code": 6486 result.currencyDisplay = "symbol"; 6487 continue; 6488 case "scale": 6489 result.scale = parseFloat(token.options[0]); 6490 continue; 6491 case "rounding-mode-floor": 6492 result.roundingMode = "floor"; 6493 continue; 6494 case "rounding-mode-ceiling": 6495 result.roundingMode = "ceil"; 6496 continue; 6497 case "rounding-mode-down": 6498 result.roundingMode = "trunc"; 6499 continue; 6500 case "rounding-mode-up": 6501 result.roundingMode = "expand"; 6502 continue; 6503 case "rounding-mode-half-even": 6504 result.roundingMode = "halfEven"; 6505 continue; 6506 case "rounding-mode-half-down": 6507 result.roundingMode = "halfTrunc"; 6508 continue; 6509 case "rounding-mode-half-up": 6510 result.roundingMode = "halfExpand"; 6511 continue; 6512 // https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#integer-width 6513 case "integer-width": 6514 if (token.options.length > 1) 6515 throw new RangeError("integer-width stems only accept a single optional option"); 6516 token.options[0].replace(INTEGER_WIDTH_REGEX, function(_2, g1, g2, g3, g4, g5) { 6517 if (g1) 6518 result.minimumIntegerDigits = g2.length; 6519 else { 6520 if (g3 && g4) 6521 throw new Error("We currently do not support maximum integer digits"); 6522 if (g5) 6523 throw new Error("We currently do not support exact integer digits"); 6524 } 6525 return ""; 6526 }); 6527 continue; 6528 } 6529 if (CONCISE_INTEGER_WIDTH_REGEX.test(token.stem)) { 6530 result.minimumIntegerDigits = token.stem.length; 6531 continue; 6532 } 6533 if (FRACTION_PRECISION_REGEX.test(token.stem)) { 6534 if (token.options.length > 1) 6535 throw new RangeError("Fraction-precision stems only accept a single optional option"); 6536 token.stem.replace(FRACTION_PRECISION_REGEX, function(_2, g1, g2, g3, g4, g5) { 6537 return g2 === "*" ? result.minimumFractionDigits = g1.length : g3 && g3[0] === "#" ? result.maximumFractionDigits = g3.length : g4 && g5 ? (result.minimumFractionDigits = g4.length, result.maximumFractionDigits = g4.length + g5.length) : (result.minimumFractionDigits = g1.length, result.maximumFractionDigits = g1.length), ""; 6538 }); 6539 var opt = token.options[0]; 6540 opt === "w" ? result = __assign(__assign({}, result), { trailingZeroDisplay: "stripIfInteger" }) : opt && (result = __assign(__assign({}, result), parseSignificantPrecision(opt))); 6541 continue; 6542 } 6543 if (SIGNIFICANT_PRECISION_REGEX.test(token.stem)) { 6544 result = __assign(__assign({}, result), parseSignificantPrecision(token.stem)); 6545 continue; 6546 } 6547 var signOpts = parseSign(token.stem); 6548 signOpts && (result = __assign(__assign({}, result), signOpts)); 6549 var conciseScientificAndEngineeringOpts = parseConciseScientificAndEngineeringStem(token.stem); 6550 conciseScientificAndEngineeringOpts && (result = __assign(__assign({}, result), conciseScientificAndEngineeringOpts)); 6551 } 6552 return result; 6553} 6554 6555// ../../node_modules/@formatjs/icu-messageformat-parser/lib/time-data.generated.js 6556var timeData = { 6557 "001": [ 6558 "H", 6559 "h" 6560 ], 6561 419: [ 6562 "h", 6563 "H", 6564 "hB", 6565 "hb" 6566 ], 6567 AC: [ 6568 "H", 6569 "h", 6570 "hb", 6571 "hB" 6572 ], 6573 AD: [ 6574 "H", 6575 "hB" 6576 ], 6577 AE: [ 6578 "h", 6579 "hB", 6580 "hb", 6581 "H" 6582 ], 6583 AF: [ 6584 "H", 6585 "hb", 6586 "hB", 6587 "h" 6588 ], 6589 AG: [ 6590 "h", 6591 "hb", 6592 "H", 6593 "hB" 6594 ], 6595 AI: [ 6596 "H", 6597 "h", 6598 "hb", 6599 "hB" 6600 ], 6601 AL: [ 6602 "h", 6603 "H", 6604 "hB" 6605 ], 6606 AM: [ 6607 "H", 6608 "hB" 6609 ], 6610 AO: [ 6611 "H", 6612 "hB" 6613 ], 6614 AR: [ 6615 "h", 6616 "H", 6617 "hB", 6618 "hb" 6619 ], 6620 AS: [ 6621 "h", 6622 "H" 6623 ], 6624 AT: [ 6625 "H", 6626 "hB" 6627 ], 6628 AU: [ 6629 "h", 6630 "hb", 6631 "H", 6632 "hB" 6633 ], 6634 AW: [ 6635 "H", 6636 "hB" 6637 ], 6638 AX: [ 6639 "H" 6640 ], 6641 AZ: [ 6642 "H", 6643 "hB", 6644 "h" 6645 ], 6646 BA: [ 6647 "H", 6648 "hB", 6649 "h" 6650 ], 6651 BB: [ 6652 "h", 6653 "hb", 6654 "H", 6655 "hB" 6656 ], 6657 BD: [ 6658 "h", 6659 "hB", 6660 "H" 6661 ], 6662 BE: [ 6663 "H", 6664 "hB" 6665 ], 6666 BF: [ 6667 "H", 6668 "hB" 6669 ], 6670 BG: [ 6671 "H", 6672 "hB", 6673 "h" 6674 ], 6675 BH: [ 6676 "h", 6677 "hB", 6678 "hb", 6679 "H" 6680 ], 6681 BI: [ 6682 "H", 6683 "h" 6684 ], 6685 BJ: [ 6686 "H", 6687 "hB" 6688 ], 6689 BL: [ 6690 "H", 6691 "hB" 6692 ], 6693 BM: [ 6694 "h", 6695 "hb", 6696 "H", 6697 "hB" 6698 ], 6699 BN: [ 6700 "hb", 6701 "hB", 6702 "h", 6703 "H" 6704 ], 6705 BO: [ 6706 "h", 6707 "H", 6708 "hB", 6709 "hb" 6710 ], 6711 BQ: [ 6712 "H" 6713 ], 6714 BR: [ 6715 "H", 6716 "hB" 6717 ], 6718 BS: [ 6719 "h", 6720 "hb", 6721 "H", 6722 "hB" 6723 ], 6724 BT: [ 6725 "h", 6726 "H" 6727 ], 6728 BW: [ 6729 "H", 6730 "h", 6731 "hb", 6732 "hB" 6733 ], 6734 BY: [ 6735 "H", 6736 "h" 6737 ], 6738 BZ: [ 6739 "H", 6740 "h", 6741 "hb", 6742 "hB" 6743 ], 6744 CA: [ 6745 "h", 6746 "hb", 6747 "H", 6748 "hB" 6749 ], 6750 CC: [ 6751 "H", 6752 "h", 6753 "hb", 6754 "hB" 6755 ], 6756 CD: [ 6757 "hB", 6758 "H" 6759 ], 6760 CF: [ 6761 "H", 6762 "h", 6763 "hB" 6764 ], 6765 CG: [ 6766 "H", 6767 "hB" 6768 ], 6769 CH: [ 6770 "H", 6771 "hB", 6772 "h" 6773 ], 6774 CI: [ 6775 "H", 6776 "hB" 6777 ], 6778 CK: [ 6779 "H", 6780 "h", 6781 "hb", 6782 "hB" 6783 ], 6784 CL: [ 6785 "h", 6786 "H", 6787 "hB", 6788 "hb" 6789 ], 6790 CM: [ 6791 "H", 6792 "h", 6793 "hB" 6794 ], 6795 CN: [ 6796 "H", 6797 "hB", 6798 "hb", 6799 "h" 6800 ], 6801 CO: [ 6802 "h", 6803 "H", 6804 "hB", 6805 "hb" 6806 ], 6807 CP: [ 6808 "H" 6809 ], 6810 CR: [ 6811 "h", 6812 "H", 6813 "hB", 6814 "hb" 6815 ], 6816 CU: [ 6817 "h", 6818 "H", 6819 "hB", 6820 "hb" 6821 ], 6822 CV: [ 6823 "H", 6824 "hB" 6825 ], 6826 CW: [ 6827 "H", 6828 "hB" 6829 ], 6830 CX: [ 6831 "H", 6832 "h", 6833 "hb", 6834 "hB" 6835 ], 6836 CY: [ 6837 "h", 6838 "H", 6839 "hb", 6840 "hB" 6841 ], 6842 CZ: [ 6843 "H" 6844 ], 6845 DE: [ 6846 "H", 6847 "hB" 6848 ], 6849 DG: [ 6850 "H", 6851 "h", 6852 "hb", 6853 "hB" 6854 ], 6855 DJ: [ 6856 "h", 6857 "H" 6858 ], 6859 DK: [ 6860 "H" 6861 ], 6862 DM: [ 6863 "h", 6864 "hb", 6865 "H", 6866 "hB" 6867 ], 6868 DO: [ 6869 "h", 6870 "H", 6871 "hB", 6872 "hb" 6873 ], 6874 DZ: [ 6875 "h", 6876 "hB", 6877 "hb", 6878 "H" 6879 ], 6880 EA: [ 6881 "H", 6882 "h", 6883 "hB", 6884 "hb" 6885 ], 6886 EC: [ 6887 "h", 6888 "H", 6889 "hB", 6890 "hb" 6891 ], 6892 EE: [ 6893 "H", 6894 "hB" 6895 ], 6896 EG: [ 6897 "h", 6898 "hB", 6899 "hb", 6900 "H" 6901 ], 6902 EH: [ 6903 "h", 6904 "hB", 6905 "hb", 6906 "H" 6907 ], 6908 ER: [ 6909 "h", 6910 "H" 6911 ], 6912 ES: [ 6913 "H", 6914 "hB", 6915 "h", 6916 "hb" 6917 ], 6918 ET: [ 6919 "hB", 6920 "hb", 6921 "h", 6922 "H" 6923 ], 6924 FI: [ 6925 "H" 6926 ], 6927 FJ: [ 6928 "h", 6929 "hb", 6930 "H", 6931 "hB" 6932 ], 6933 FK: [ 6934 "H", 6935 "h", 6936 "hb", 6937 "hB" 6938 ], 6939 FM: [ 6940 "h", 6941 "hb", 6942 "H", 6943 "hB" 6944 ], 6945 FO: [ 6946 "H", 6947 "h" 6948 ], 6949 FR: [ 6950 "H", 6951 "hB" 6952 ], 6953 GA: [ 6954 "H", 6955 "hB" 6956 ], 6957 GB: [ 6958 "H", 6959 "h", 6960 "hb", 6961 "hB" 6962 ], 6963 GD: [ 6964 "h", 6965 "hb", 6966 "H", 6967 "hB" 6968 ], 6969 GE: [ 6970 "H", 6971 "hB", 6972 "h" 6973 ], 6974 GF: [ 6975 "H", 6976 "hB" 6977 ], 6978 GG: [ 6979 "H", 6980 "h", 6981 "hb", 6982 "hB" 6983 ], 6984 GH: [ 6985 "h", 6986 "H" 6987 ], 6988 GI: [ 6989 "H", 6990 "h", 6991 "hb", 6992 "hB" 6993 ], 6994 GL: [ 6995 "H", 6996 "h" 6997 ], 6998 GM: [ 6999 "h", 7000 "hb", 7001 "H", 7002 "hB" 7003 ], 7004 GN: [ 7005 "H", 7006 "hB" 7007 ], 7008 GP: [ 7009 "H", 7010 "hB" 7011 ], 7012 GQ: [ 7013 "H", 7014 "hB", 7015 "h", 7016 "hb" 7017 ], 7018 GR: [ 7019 "h", 7020 "H", 7021 "hb", 7022 "hB" 7023 ], 7024 GT: [ 7025 "h", 7026 "H", 7027 "hB", 7028 "hb" 7029 ], 7030 GU: [ 7031 "h", 7032 "hb", 7033 "H", 7034 "hB" 7035 ], 7036 GW: [ 7037 "H", 7038 "hB" 7039 ], 7040 GY: [ 7041 "h", 7042 "hb", 7043 "H", 7044 "hB" 7045 ], 7046 HK: [ 7047 "h", 7048 "hB", 7049 "hb", 7050 "H" 7051 ], 7052 HN: [ 7053 "h", 7054 "H", 7055 "hB", 7056 "hb" 7057 ], 7058 HR: [ 7059 "H", 7060 "hB" 7061 ], 7062 HU: [ 7063 "H", 7064 "h" 7065 ], 7066 IC: [ 7067 "H", 7068 "h", 7069 "hB", 7070 "hb" 7071 ], 7072 ID: [ 7073 "H" 7074 ], 7075 IE: [ 7076 "H", 7077 "h", 7078 "hb", 7079 "hB" 7080 ], 7081 IL: [ 7082 "H", 7083 "hB" 7084 ], 7085 IM: [ 7086 "H", 7087 "h", 7088 "hb", 7089 "hB" 7090 ], 7091 IN: [ 7092 "h", 7093 "H" 7094 ], 7095 IO: [ 7096 "H", 7097 "h", 7098 "hb", 7099 "hB" 7100 ], 7101 IQ: [ 7102 "h", 7103 "hB", 7104 "hb", 7105 "H" 7106 ], 7107 IR: [ 7108 "hB", 7109 "H" 7110 ], 7111 IS: [ 7112 "H" 7113 ], 7114 IT: [ 7115 "H", 7116 "hB" 7117 ], 7118 JE: [ 7119 "H", 7120 "h", 7121 "hb", 7122 "hB" 7123 ], 7124 JM: [ 7125 "h", 7126 "hb", 7127 "H", 7128 "hB" 7129 ], 7130 JO: [ 7131 "h", 7132 "hB", 7133 "hb", 7134 "H" 7135 ], 7136 JP: [ 7137 "H", 7138 "K", 7139 "h" 7140 ], 7141 KE: [ 7142 "hB", 7143 "hb", 7144 "H", 7145 "h" 7146 ], 7147 KG: [ 7148 "H", 7149 "h", 7150 "hB", 7151 "hb" 7152 ], 7153 KH: [ 7154 "hB", 7155 "h", 7156 "H", 7157 "hb" 7158 ], 7159 KI: [ 7160 "h", 7161 "hb", 7162 "H", 7163 "hB" 7164 ], 7165 KM: [ 7166 "H", 7167 "h", 7168 "hB", 7169 "hb" 7170 ], 7171 KN: [ 7172 "h", 7173 "hb", 7174 "H", 7175 "hB" 7176 ], 7177 KP: [ 7178 "h", 7179 "H", 7180 "hB", 7181 "hb" 7182 ], 7183 KR: [ 7184 "h", 7185 "H", 7186 "hB", 7187 "hb" 7188 ], 7189 KW: [ 7190 "h", 7191 "hB", 7192 "hb", 7193 "H" 7194 ], 7195 KY: [ 7196 "h", 7197 "hb", 7198 "H", 7199 "hB" 7200 ], 7201 KZ: [ 7202 "H", 7203 "hB" 7204 ], 7205 LA: [ 7206 "H", 7207 "hb", 7208 "hB", 7209 "h" 7210 ], 7211 LB: [ 7212 "h", 7213 "hB", 7214 "hb", 7215 "H" 7216 ], 7217 LC: [ 7218 "h", 7219 "hb", 7220 "H", 7221 "hB" 7222 ], 7223 LI: [ 7224 "H", 7225 "hB", 7226 "h" 7227 ], 7228 LK: [ 7229 "H", 7230 "h", 7231 "hB", 7232 "hb" 7233 ], 7234 LR: [ 7235 "h", 7236 "hb", 7237 "H", 7238 "hB" 7239 ], 7240 LS: [ 7241 "h", 7242 "H" 7243 ], 7244 LT: [ 7245 "H", 7246 "h", 7247 "hb", 7248 "hB" 7249 ], 7250 LU: [ 7251 "H", 7252 "h", 7253 "hB" 7254 ], 7255 LV: [ 7256 "H", 7257 "hB", 7258 "hb", 7259 "h" 7260 ], 7261 LY: [ 7262 "h", 7263 "hB", 7264 "hb", 7265 "H" 7266 ], 7267 MA: [ 7268 "H", 7269 "h", 7270 "hB", 7271 "hb" 7272 ], 7273 MC: [ 7274 "H", 7275 "hB" 7276 ], 7277 MD: [ 7278 "H", 7279 "hB" 7280 ], 7281 ME: [ 7282 "H", 7283 "hB", 7284 "h" 7285 ], 7286 MF: [ 7287 "H", 7288 "hB" 7289 ], 7290 MG: [ 7291 "H", 7292 "h" 7293 ], 7294 MH: [ 7295 "h", 7296 "hb", 7297 "H", 7298 "hB" 7299 ], 7300 MK: [ 7301 "H", 7302 "h", 7303 "hb", 7304 "hB" 7305 ], 7306 ML: [ 7307 "H" 7308 ], 7309 MM: [ 7310 "hB", 7311 "hb", 7312 "H", 7313 "h" 7314 ], 7315 MN: [ 7316 "H", 7317 "h", 7318 "hb", 7319 "hB" 7320 ], 7321 MO: [ 7322 "h", 7323 "hB", 7324 "hb", 7325 "H" 7326 ], 7327 MP: [ 7328 "h", 7329 "hb", 7330 "H", 7331 "hB" 7332 ], 7333 MQ: [ 7334 "H", 7335 "hB" 7336 ], 7337 MR: [ 7338 "h", 7339 "hB", 7340 "hb", 7341 "H" 7342 ], 7343 MS: [ 7344 "H", 7345 "h", 7346 "hb", 7347 "hB" 7348 ], 7349 MT: [ 7350 "H", 7351 "h" 7352 ], 7353 MU: [ 7354 "H", 7355 "h" 7356 ], 7357 MV: [ 7358 "H", 7359 "h" 7360 ], 7361 MW: [ 7362 "h", 7363 "hb", 7364 "H", 7365 "hB" 7366 ], 7367 MX: [ 7368 "h", 7369 "H", 7370 "hB", 7371 "hb" 7372 ], 7373 MY: [ 7374 "hb", 7375 "hB", 7376 "h", 7377 "H" 7378 ], 7379 MZ: [ 7380 "H", 7381 "hB" 7382 ], 7383 NA: [ 7384 "h", 7385 "H", 7386 "hB", 7387 "hb" 7388 ], 7389 NC: [ 7390 "H", 7391 "hB" 7392 ], 7393 NE: [ 7394 "H" 7395 ], 7396 NF: [ 7397 "H", 7398 "h", 7399 "hb", 7400 "hB" 7401 ], 7402 NG: [ 7403 "H", 7404 "h", 7405 "hb", 7406 "hB" 7407 ], 7408 NI: [ 7409 "h", 7410 "H", 7411 "hB", 7412 "hb" 7413 ], 7414 NL: [ 7415 "H", 7416 "hB" 7417 ], 7418 NO: [ 7419 "H", 7420 "h" 7421 ], 7422 NP: [ 7423 "H", 7424 "h", 7425 "hB" 7426 ], 7427 NR: [ 7428 "H", 7429 "h", 7430 "hb", 7431 "hB" 7432 ], 7433 NU: [ 7434 "H", 7435 "h", 7436 "hb", 7437 "hB" 7438 ], 7439 NZ: [ 7440 "h", 7441 "hb", 7442 "H", 7443 "hB" 7444 ], 7445 OM: [ 7446 "h", 7447 "hB", 7448 "hb", 7449 "H" 7450 ], 7451 PA: [ 7452 "h", 7453 "H", 7454 "hB", 7455 "hb" 7456 ], 7457 PE: [ 7458 "h", 7459 "H", 7460 "hB", 7461 "hb" 7462 ], 7463 PF: [ 7464 "H", 7465 "h", 7466 "hB" 7467 ], 7468 PG: [ 7469 "h", 7470 "H" 7471 ], 7472 PH: [ 7473 "h", 7474 "hB", 7475 "hb", 7476 "H" 7477 ], 7478 PK: [ 7479 "h", 7480 "hB", 7481 "H" 7482 ], 7483 PL: [ 7484 "H", 7485 "h" 7486 ], 7487 PM: [ 7488 "H", 7489 "hB" 7490 ], 7491 PN: [ 7492 "H", 7493 "h", 7494 "hb", 7495 "hB" 7496 ], 7497 PR: [ 7498 "h", 7499 "H", 7500 "hB", 7501 "hb" 7502 ], 7503 PS: [ 7504 "h", 7505 "hB", 7506 "hb", 7507 "H" 7508 ], 7509 PT: [ 7510 "H", 7511 "hB" 7512 ], 7513 PW: [ 7514 "h", 7515 "H" 7516 ], 7517 PY: [ 7518 "h", 7519 "H", 7520 "hB", 7521 "hb" 7522 ], 7523 QA: [ 7524 "h", 7525 "hB", 7526 "hb", 7527 "H" 7528 ], 7529 RE: [ 7530 "H", 7531 "hB" 7532 ], 7533 RO: [ 7534 "H", 7535 "hB" 7536 ], 7537 RS: [ 7538 "H", 7539 "hB", 7540 "h" 7541 ], 7542 RU: [ 7543 "H" 7544 ], 7545 RW: [ 7546 "H", 7547 "h" 7548 ], 7549 SA: [ 7550 "h", 7551 "hB", 7552 "hb", 7553 "H" 7554 ], 7555 SB: [ 7556 "h", 7557 "hb", 7558 "H", 7559 "hB" 7560 ], 7561 SC: [ 7562 "H", 7563 "h", 7564 "hB" 7565 ], 7566 SD: [ 7567 "h", 7568 "hB", 7569 "hb", 7570 "H" 7571 ], 7572 SE: [ 7573 "H" 7574 ], 7575 SG: [ 7576 "h", 7577 "hb", 7578 "H", 7579 "hB" 7580 ], 7581 SH: [ 7582 "H", 7583 "h", 7584 "hb", 7585 "hB" 7586 ], 7587 SI: [ 7588 "H", 7589 "hB" 7590 ], 7591 SJ: [ 7592 "H" 7593 ], 7594 SK: [ 7595 "H" 7596 ], 7597 SL: [ 7598 "h", 7599 "hb", 7600 "H", 7601 "hB" 7602 ], 7603 SM: [ 7604 "H", 7605 "h", 7606 "hB" 7607 ], 7608 SN: [ 7609 "H", 7610 "h", 7611 "hB" 7612 ], 7613 SO: [ 7614 "h", 7615 "H" 7616 ], 7617 SR: [ 7618 "H", 7619 "hB" 7620 ], 7621 SS: [ 7622 "h", 7623 "hb", 7624 "H", 7625 "hB" 7626 ], 7627 ST: [ 7628 "H", 7629 "hB" 7630 ], 7631 SV: [ 7632 "h", 7633 "H", 7634 "hB", 7635 "hb" 7636 ], 7637 SX: [ 7638 "H", 7639 "h", 7640 "hb", 7641 "hB" 7642 ], 7643 SY: [ 7644 "h", 7645 "hB", 7646 "hb", 7647 "H" 7648 ], 7649 SZ: [ 7650 "h", 7651 "hb", 7652 "H", 7653 "hB" 7654 ], 7655 TA: [ 7656 "H", 7657 "h", 7658 "hb", 7659 "hB" 7660 ], 7661 TC: [ 7662 "h", 7663 "hb", 7664 "H", 7665 "hB" 7666 ], 7667 TD: [ 7668 "h", 7669 "H", 7670 "hB" 7671 ], 7672 TF: [ 7673 "H", 7674 "h", 7675 "hB" 7676 ], 7677 TG: [ 7678 "H", 7679 "hB" 7680 ], 7681 TH: [ 7682 "H", 7683 "h" 7684 ], 7685 TJ: [ 7686 "H", 7687 "h" 7688 ], 7689 TL: [ 7690 "H", 7691 "hB", 7692 "hb", 7693 "h" 7694 ], 7695 TM: [ 7696 "H", 7697 "h" 7698 ], 7699 TN: [ 7700 "h", 7701 "hB", 7702 "hb", 7703 "H" 7704 ], 7705 TO: [ 7706 "h", 7707 "H" 7708 ], 7709 TR: [ 7710 "H", 7711 "hB" 7712 ], 7713 TT: [ 7714 "h", 7715 "hb", 7716 "H", 7717 "hB" 7718 ], 7719 TW: [ 7720 "hB", 7721 "hb", 7722 "h", 7723 "H" 7724 ], 7725 TZ: [ 7726 "hB", 7727 "hb", 7728 "H", 7729 "h" 7730 ], 7731 UA: [ 7732 "H", 7733 "hB", 7734 "h" 7735 ], 7736 UG: [ 7737 "hB", 7738 "hb", 7739 "H", 7740 "h" 7741 ], 7742 UM: [ 7743 "h", 7744 "hb", 7745 "H", 7746 "hB" 7747 ], 7748 US: [ 7749 "h", 7750 "hb", 7751 "H", 7752 "hB" 7753 ], 7754 UY: [ 7755 "h", 7756 "H", 7757 "hB", 7758 "hb" 7759 ], 7760 UZ: [ 7761 "H", 7762 "hB", 7763 "h" 7764 ], 7765 VA: [ 7766 "H", 7767 "h", 7768 "hB" 7769 ], 7770 VC: [ 7771 "h", 7772 "hb", 7773 "H", 7774 "hB" 7775 ], 7776 VE: [ 7777 "h", 7778 "H", 7779 "hB", 7780 "hb" 7781 ], 7782 VG: [ 7783 "h", 7784 "hb", 7785 "H", 7786 "hB" 7787 ], 7788 VI: [ 7789 "h", 7790 "hb", 7791 "H", 7792 "hB" 7793 ], 7794 VN: [ 7795 "H", 7796 "h" 7797 ], 7798 VU: [ 7799 "h", 7800 "H" 7801 ], 7802 WF: [ 7803 "H", 7804 "hB" 7805 ], 7806 WS: [ 7807 "h", 7808 "H" 7809 ], 7810 XK: [ 7811 "H", 7812 "hB", 7813 "h" 7814 ], 7815 YE: [ 7816 "h", 7817 "hB", 7818 "hb", 7819 "H" 7820 ], 7821 YT: [ 7822 "H", 7823 "hB" 7824 ], 7825 ZA: [ 7826 "H", 7827 "h", 7828 "hb", 7829 "hB" 7830 ], 7831 ZM: [ 7832 "h", 7833 "hb", 7834 "H", 7835 "hB" 7836 ], 7837 ZW: [ 7838 "H", 7839 "h" 7840 ], 7841 "af-ZA": [ 7842 "H", 7843 "h", 7844 "hB", 7845 "hb" 7846 ], 7847 "ar-001": [ 7848 "h", 7849 "hB", 7850 "hb", 7851 "H" 7852 ], 7853 "ca-ES": [ 7854 "H", 7855 "h", 7856 "hB" 7857 ], 7858 "en-001": [ 7859 "h", 7860 "hb", 7861 "H", 7862 "hB" 7863 ], 7864 "en-HK": [ 7865 "h", 7866 "hb", 7867 "H", 7868 "hB" 7869 ], 7870 "en-IL": [ 7871 "H", 7872 "h", 7873 "hb", 7874 "hB" 7875 ], 7876 "en-MY": [ 7877 "h", 7878 "hb", 7879 "H", 7880 "hB" 7881 ], 7882 "es-BR": [ 7883 "H", 7884 "h", 7885 "hB", 7886 "hb" 7887 ], 7888 "es-ES": [ 7889 "H", 7890 "h", 7891 "hB", 7892 "hb" 7893 ], 7894 "es-GQ": [ 7895 "H", 7896 "h", 7897 "hB", 7898 "hb" 7899 ], 7900 "fr-CA": [ 7901 "H", 7902 "h", 7903 "hB" 7904 ], 7905 "gl-ES": [ 7906 "H", 7907 "h", 7908 "hB" 7909 ], 7910 "gu-IN": [ 7911 "hB", 7912 "hb", 7913 "h", 7914 "H" 7915 ], 7916 "hi-IN": [ 7917 "hB", 7918 "h", 7919 "H" 7920 ], 7921 "it-CH": [ 7922 "H", 7923 "h", 7924 "hB" 7925 ], 7926 "it-IT": [ 7927 "H", 7928 "h", 7929 "hB" 7930 ], 7931 "kn-IN": [ 7932 "hB", 7933 "h", 7934 "H" 7935 ], 7936 "ml-IN": [ 7937 "hB", 7938 "h", 7939 "H" 7940 ], 7941 "mr-IN": [ 7942 "hB", 7943 "hb", 7944 "h", 7945 "H" 7946 ], 7947 "pa-IN": [ 7948 "hB", 7949 "hb", 7950 "h", 7951 "H" 7952 ], 7953 "ta-IN": [ 7954 "hB", 7955 "h", 7956 "hb", 7957 "H" 7958 ], 7959 "te-IN": [ 7960 "hB", 7961 "h", 7962 "H" 7963 ], 7964 "zu-ZA": [ 7965 "H", 7966 "hB", 7967 "hb", 7968 "h" 7969 ] 7970}; 7971 7972// ../../node_modules/@formatjs/icu-messageformat-parser/lib/date-time-pattern-generator.js 7973function getBestPattern(skeleton, locale) { 7974 for (var skeletonCopy = "", patternPos = 0; patternPos < skeleton.length; patternPos++) { 7975 var patternChar = skeleton.charAt(patternPos); 7976 if (patternChar === "j") { 7977 for (var extraLength = 0; patternPos + 1 < skeleton.length && skeleton.charAt(patternPos + 1) === patternChar; ) 7978 extraLength++, patternPos++; 7979 var hourLen = 1 + (extraLength & 1), dayPeriodLen = extraLength < 2 ? 1 : 3 + (extraLength >> 1), dayPeriodChar = "a", hourChar = getDefaultHourSymbolFromLocale(locale); 7980 for ((hourChar == "H" || hourChar == "k") && (dayPeriodLen = 0); dayPeriodLen-- > 0; ) 7981 skeletonCopy += dayPeriodChar; 7982 for (; hourLen-- > 0; ) 7983 skeletonCopy = hourChar + skeletonCopy; 7984 } else patternChar === "J" ? skeletonCopy += "H" : skeletonCopy += patternChar; 7985 } 7986 return skeletonCopy; 7987} 7988function getDefaultHourSymbolFromLocale(locale) { 7989 var hourCycle = locale.hourCycle; 7990 if (hourCycle === void 0 && // @ts-ignore hourCycle(s) is not identified yet 7991 locale.hourCycles && // @ts-ignore 7992 locale.hourCycles.length && (hourCycle = locale.hourCycles[0]), hourCycle) 7993 switch (hourCycle) { 7994 case "h24": 7995 return "k"; 7996 case "h23": 7997 return "H"; 7998 case "h12": 7999 return "h"; 8000 case "h11": 8001 return "K"; 8002 default: 8003 throw new Error("Invalid hourCycle"); 8004 } 8005 var languageTag = locale.language, regionTag; 8006 languageTag !== "root" && (regionTag = locale.maximize().region); 8007 var hourCycles = timeData[regionTag || ""] || timeData[languageTag || ""] || timeData["".concat(languageTag, "-001")] || timeData["001"]; 8008 return hourCycles[0]; 8009} 8010 8011// ../../node_modules/@formatjs/icu-messageformat-parser/lib/parser.js 8012var _a, SPACE_SEPARATOR_START_REGEX = new RegExp("^".concat(SPACE_SEPARATOR_REGEX.source, "*")), SPACE_SEPARATOR_END_REGEX = new RegExp("".concat(SPACE_SEPARATOR_REGEX.source, "*$")); 8013function createLocation(start, end) { 8014 return { start, end }; 8015} 8016var hasNativeStartsWith = !!String.prototype.startsWith && "_a".startsWith("a", 1), hasNativeFromCodePoint = !!String.fromCodePoint, hasNativeFromEntries = !!Object.fromEntries, hasNativeCodePointAt = !!String.prototype.codePointAt, hasTrimStart = !!String.prototype.trimStart, hasTrimEnd = !!String.prototype.trimEnd, hasNativeIsSafeInteger = !!Number.isSafeInteger, isSafeInteger = hasNativeIsSafeInteger ? Number.isSafeInteger : function(n3) { 8017 return typeof n3 == "number" && isFinite(n3) && Math.floor(n3) === n3 && Math.abs(n3) <= 9007199254740991; 8018}, REGEX_SUPPORTS_U_AND_Y = !0; 8019try { 8020 re = RE("([^\\p{White_Space}\\p{Pattern_Syntax}]*)", "yu"), REGEX_SUPPORTS_U_AND_Y = ((_a = re.exec("a")) === null || _a === void 0 ? void 0 : _a[0]) === "a"; 8021} catch { 8022 REGEX_SUPPORTS_U_AND_Y = !1; 8023} 8024var re, startsWith = hasNativeStartsWith ? ( 8025 // Native 8026 function(s2, search, position) { 8027 return s2.startsWith(search, position); 8028 } 8029) : ( 8030 // For IE11 8031 function(s2, search, position) { 8032 return s2.slice(position, position + search.length) === search; 8033 } 8034), fromCodePoint = hasNativeFromCodePoint ? String.fromCodePoint : ( 8035 // IE11 8036 function() { 8037 for (var codePoints = [], _i = 0; _i < arguments.length; _i++) 8038 codePoints[_i] = arguments[_i]; 8039 for (var elements = "", length = codePoints.length, i2 = 0, code; length > i2; ) { 8040 if (code = codePoints[i2++], code > 1114111) 8041 throw RangeError(code + " is not a valid code point"); 8042 elements += code < 65536 ? String.fromCharCode(code) : String.fromCharCode(((code -= 65536) >> 10) + 55296, code % 1024 + 56320); 8043 } 8044 return elements; 8045 } 8046), fromEntries = ( 8047 // native 8048 hasNativeFromEntries ? Object.fromEntries : ( 8049 // Ponyfill 8050 function(entries) { 8051 for (var obj = {}, _i = 0, entries_1 = entries; _i < entries_1.length; _i++) { 8052 var _a2 = entries_1[_i], k2 = _a2[0], v2 = _a2[1]; 8053 obj[k2] = v2; 8054 } 8055 return obj; 8056 } 8057 ) 8058), codePointAt = hasNativeCodePointAt ? ( 8059 // Native 8060 function(s2, index) { 8061 return s2.codePointAt(index); 8062 } 8063) : ( 8064 // IE 11 8065 function(s2, index) { 8066 var size = s2.length; 8067 if (!(index < 0 || index >= size)) { 8068 var first = s2.charCodeAt(index), second; 8069 return first < 55296 || first > 56319 || index + 1 === size || (second = s2.charCodeAt(index + 1)) < 56320 || second > 57343 ? first : (first - 55296 << 10) + (second - 56320) + 65536; 8070 } 8071 } 8072), trimStart = hasTrimStart ? ( 8073 // Native 8074 function(s2) { 8075 return s2.trimStart(); 8076 } 8077) : ( 8078 // Ponyfill 8079 function(s2) { 8080 return s2.replace(SPACE_SEPARATOR_START_REGEX, ""); 8081 } 8082), trimEnd = hasTrimEnd ? ( 8083 // Native 8084 function(s2) { 8085 return s2.trimEnd(); 8086 } 8087) : ( 8088 // Ponyfill 8089 function(s2) { 8090 return s2.replace(SPACE_SEPARATOR_END_REGEX, ""); 8091 } 8092); 8093function RE(s2, flag) { 8094 return new RegExp(s2, flag); 8095} 8096var matchIdentifierAtIndex; 8097REGEX_SUPPORTS_U_AND_Y ? (IDENTIFIER_PREFIX_RE_1 = RE("([^\\p{White_Space}\\p{Pattern_Syntax}]*)", "yu"), matchIdentifierAtIndex = function(s2, index) { 8098 var _a2; 8099 IDENTIFIER_PREFIX_RE_1.lastIndex = index; 8100 var match = IDENTIFIER_PREFIX_RE_1.exec(s2); 8101 return (_a2 = match[1]) !== null && _a2 !== void 0 ? _a2 : ""; 8102}) : matchIdentifierAtIndex = function(s2, index) { 8103 for (var match = []; ; ) { 8104 var c2 = codePointAt(s2, index); 8105 if (c2 === void 0 || _isWhiteSpace(c2) || _isPatternSyntax(c2)) 8106 break; 8107 match.push(c2), index += c2 >= 65536 ? 2 : 1; 8108 } 8109 return fromCodePoint.apply(void 0, match); 8110}; 8111var IDENTIFIER_PREFIX_RE_1, Parser = ( 8112 /** @class */ 8113 (function() { 8114 function Parser2(message, options2) { 8115 options2 === void 0 && (options2 = {}), this.message = message, this.position = { offset: 0, line: 1, column: 1 }, this.ignoreTag = !!options2.ignoreTag, this.locale = options2.locale, this.requiresOtherClause = !!options2.requiresOtherClause, this.shouldParseSkeletons = !!options2.shouldParseSkeletons; 8116 } 8117 return Parser2.prototype.parse = function() { 8118 if (this.offset() !== 0) 8119 throw Error("parser can only be used once"); 8120 return this.parseMessage(0, "", !1); 8121 }, Parser2.prototype.parseMessage = function(nestingLevel, parentArgType, expectingCloseTag) { 8122 for (var elements = []; !this.isEOF(); ) { 8123 var char = this.char(); 8124 if (char === 123) { 8125 var result = this.parseArgument(nestingLevel, expectingCloseTag); 8126 if (result.err) 8127 return result; 8128 elements.push(result.val); 8129 } else { 8130 if (char === 125 && nestingLevel > 0) 8131 break; 8132 if (char === 35 && (parentArgType === "plural" || parentArgType === "selectordinal")) { 8133 var position = this.clonePosition(); 8134 this.bump(), elements.push({ 8135 type: TYPE.pound, 8136 location: createLocation(position, this.clonePosition()) 8137 }); 8138 } else if (char === 60 && !this.ignoreTag && this.peek() === 47) { 8139 if (expectingCloseTag) 8140 break; 8141 return this.error(ErrorKind.UNMATCHED_CLOSING_TAG, createLocation(this.clonePosition(), this.clonePosition())); 8142 } else if (char === 60 && !this.ignoreTag && _isAlpha(this.peek() || 0)) { 8143 var result = this.parseTag(nestingLevel, parentArgType); 8144 if (result.err) 8145 return result; 8146 elements.push(result.val); 8147 } else { 8148 var result = this.parseLiteral(nestingLevel, parentArgType); 8149 if (result.err) 8150 return result; 8151 elements.push(result.val); 8152 } 8153 } 8154 } 8155 return { val: elements, err: null }; 8156 }, Parser2.prototype.parseTag = function(nestingLevel, parentArgType) { 8157 var startPosition = this.clonePosition(); 8158 this.bump(); 8159 var tagName = this.parseTagName(); 8160 if (this.bumpSpace(), this.bumpIf("/>")) 8161 return { 8162 val: { 8163 type: TYPE.literal, 8164 value: "<".concat(tagName, "/>"), 8165 location: createLocation(startPosition, this.clonePosition()) 8166 }, 8167 err: null 8168 }; 8169 if (this.bumpIf(">")) { 8170 var childrenResult = this.parseMessage(nestingLevel + 1, parentArgType, !0); 8171 if (childrenResult.err) 8172 return childrenResult; 8173 var children = childrenResult.val, endTagStartPosition = this.clonePosition(); 8174 if (this.bumpIf("</")) { 8175 if (this.isEOF() || !_isAlpha(this.char())) 8176 return this.error(ErrorKind.INVALID_TAG, createLocation(endTagStartPosition, this.clonePosition())); 8177 var closingTagNameStartPosition = this.clonePosition(), closingTagName = this.parseTagName(); 8178 return tagName !== closingTagName ? this.error(ErrorKind.UNMATCHED_CLOSING_TAG, createLocation(closingTagNameStartPosition, this.clonePosition())) : (this.bumpSpace(), this.bumpIf(">") ? { 8179 val: { 8180 type: TYPE.tag, 8181 value: tagName, 8182 children, 8183 location: createLocation(startPosition, this.clonePosition()) 8184 }, 8185 err: null 8186 } : this.error(ErrorKind.INVALID_TAG, createLocation(endTagStartPosition, this.clonePosition()))); 8187 } else 8188 return this.error(ErrorKind.UNCLOSED_TAG, createLocation(startPosition, this.clonePosition())); 8189 } else 8190 return this.error(ErrorKind.INVALID_TAG, createLocation(startPosition, this.clonePosition())); 8191 }, Parser2.prototype.parseTagName = function() { 8192 var startOffset = this.offset(); 8193 for (this.bump(); !this.isEOF() && _isPotentialElementNameChar(this.char()); ) 8194 this.bump(); 8195 return this.message.slice(startOffset, this.offset()); 8196 }, Parser2.prototype.parseLiteral = function(nestingLevel, parentArgType) { 8197 for (var start = this.clonePosition(), value = ""; ; ) { 8198 var parseQuoteResult = this.tryParseQuote(parentArgType); 8199 if (parseQuoteResult) { 8200 value += parseQuoteResult; 8201 continue; 8202 } 8203 var parseUnquotedResult = this.tryParseUnquoted(nestingLevel, parentArgType); 8204 if (parseUnquotedResult) { 8205 value += parseUnquotedResult; 8206 continue; 8207 } 8208 var parseLeftAngleResult = this.tryParseLeftAngleBracket(); 8209 if (parseLeftAngleResult) { 8210 value += parseLeftAngleResult; 8211 continue; 8212 } 8213 break; 8214 } 8215 var location2 = createLocation(start, this.clonePosition()); 8216 return { 8217 val: { type: TYPE.literal, value, location: location2 }, 8218 err: null 8219 }; 8220 }, Parser2.prototype.tryParseLeftAngleBracket = function() { 8221 return !this.isEOF() && this.char() === 60 && (this.ignoreTag || // If at the opening tag or closing tag position, bail. 8222 !_isAlphaOrSlash(this.peek() || 0)) ? (this.bump(), "<") : null; 8223 }, Parser2.prototype.tryParseQuote = function(parentArgType) { 8224 if (this.isEOF() || this.char() !== 39) 8225 return null; 8226 switch (this.peek()) { 8227 case 39: 8228 return this.bump(), this.bump(), "'"; 8229 // '{', '<', '>', '}' 8230 case 123: 8231 case 60: 8232 case 62: 8233 case 125: 8234 break; 8235 case 35: 8236 if (parentArgType === "plural" || parentArgType === "selectordinal") 8237 break; 8238 return null; 8239 default: 8240 return null; 8241 } 8242 this.bump(); 8243 var codePoints = [this.char()]; 8244 for (this.bump(); !this.isEOF(); ) { 8245 var ch = this.char(); 8246 if (ch === 39) 8247 if (this.peek() === 39) 8248 codePoints.push(39), this.bump(); 8249 else { 8250 this.bump(); 8251 break; 8252 } 8253 else 8254 codePoints.push(ch); 8255 this.bump(); 8256 } 8257 return fromCodePoint.apply(void 0, codePoints); 8258 }, Parser2.prototype.tryParseUnquoted = function(nestingLevel, parentArgType) { 8259 if (this.isEOF()) 8260 return null; 8261 var ch = this.char(); 8262 return ch === 60 || ch === 123 || ch === 35 && (parentArgType === "plural" || parentArgType === "selectordinal") || ch === 125 && nestingLevel > 0 ? null : (this.bump(), fromCodePoint(ch)); 8263 }, Parser2.prototype.parseArgument = function(nestingLevel, expectingCloseTag) { 8264 var openingBracePosition = this.clonePosition(); 8265 if (this.bump(), this.bumpSpace(), this.isEOF()) 8266 return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition())); 8267 if (this.char() === 125) 8268 return this.bump(), this.error(ErrorKind.EMPTY_ARGUMENT, createLocation(openingBracePosition, this.clonePosition())); 8269 var value = this.parseIdentifierIfPossible().value; 8270 if (!value) 8271 return this.error(ErrorKind.MALFORMED_ARGUMENT, createLocation(openingBracePosition, this.clonePosition())); 8272 if (this.bumpSpace(), this.isEOF()) 8273 return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition())); 8274 switch (this.char()) { 8275 // Simple argument: `{name}` 8276 case 125: 8277 return this.bump(), { 8278 val: { 8279 type: TYPE.argument, 8280 // value does not include the opening and closing braces. 8281 value, 8282 location: createLocation(openingBracePosition, this.clonePosition()) 8283 }, 8284 err: null 8285 }; 8286 // Argument with options: `{name, format, ...}` 8287 case 44: 8288 return this.bump(), this.bumpSpace(), this.isEOF() ? this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition())) : this.parseArgumentOptions(nestingLevel, expectingCloseTag, value, openingBracePosition); 8289 default: 8290 return this.error(ErrorKind.MALFORMED_ARGUMENT, createLocation(openingBracePosition, this.clonePosition())); 8291 } 8292 }, Parser2.prototype.parseIdentifierIfPossible = function() { 8293 var startingPosition = this.clonePosition(), startOffset = this.offset(), value = matchIdentifierAtIndex(this.message, startOffset), endOffset = startOffset + value.length; 8294 this.bumpTo(endOffset); 8295 var endPosition = this.clonePosition(), location2 = createLocation(startingPosition, endPosition); 8296 return { value, location: location2 }; 8297 }, Parser2.prototype.parseArgumentOptions = function(nestingLevel, expectingCloseTag, value, openingBracePosition) { 8298 var _a2, typeStartPosition = this.clonePosition(), argType = this.parseIdentifierIfPossible().value, typeEndPosition = this.clonePosition(); 8299 switch (argType) { 8300 case "": 8301 return this.error(ErrorKind.EXPECT_ARGUMENT_TYPE, createLocation(typeStartPosition, typeEndPosition)); 8302 case "number": 8303 case "date": 8304 case "time": { 8305 this.bumpSpace(); 8306 var styleAndLocation = null; 8307 if (this.bumpIf(",")) { 8308 this.bumpSpace(); 8309 var styleStartPosition = this.clonePosition(), result = this.parseSimpleArgStyleIfPossible(); 8310 if (result.err) 8311 return result; 8312 var style = trimEnd(result.val); 8313 if (style.length === 0) 8314 return this.error(ErrorKind.EXPECT_ARGUMENT_STYLE, createLocation(this.clonePosition(), this.clonePosition())); 8315 var styleLocation = createLocation(styleStartPosition, this.clonePosition()); 8316 styleAndLocation = { style, styleLocation }; 8317 } 8318 var argCloseResult = this.tryParseArgumentClose(openingBracePosition); 8319 if (argCloseResult.err) 8320 return argCloseResult; 8321 var location_1 = createLocation(openingBracePosition, this.clonePosition()); 8322 if (styleAndLocation && startsWith(styleAndLocation?.style, "::", 0)) { 8323 var skeleton = trimStart(styleAndLocation.style.slice(2)); 8324 if (argType === "number") { 8325 var result = this.parseNumberSkeletonFromString(skeleton, styleAndLocation.styleLocation); 8326 return result.err ? result : { 8327 val: { type: TYPE.number, value, location: location_1, style: result.val }, 8328 err: null 8329 }; 8330 } else { 8331 if (skeleton.length === 0) 8332 return this.error(ErrorKind.EXPECT_DATE_TIME_SKELETON, location_1); 8333 var dateTimePattern = skeleton; 8334 this.locale && (dateTimePattern = getBestPattern(skeleton, this.locale)); 8335 var style = { 8336 type: SKELETON_TYPE.dateTime, 8337 pattern: dateTimePattern, 8338 location: styleAndLocation.styleLocation, 8339 parsedOptions: this.shouldParseSkeletons ? parseDateTimeSkeleton(dateTimePattern) : {} 8340 }, type = argType === "date" ? TYPE.date : TYPE.time; 8341 return { 8342 val: { type, value, location: location_1, style }, 8343 err: null 8344 }; 8345 } 8346 } 8347 return { 8348 val: { 8349 type: argType === "number" ? TYPE.number : argType === "date" ? TYPE.date : TYPE.time, 8350 value, 8351 location: location_1, 8352 style: (_a2 = styleAndLocation?.style) !== null && _a2 !== void 0 ? _a2 : null 8353 }, 8354 err: null 8355 }; 8356 } 8357 case "plural": 8358 case "selectordinal": 8359 case "select": { 8360 var typeEndPosition_1 = this.clonePosition(); 8361 if (this.bumpSpace(), !this.bumpIf(",")) 8362 return this.error(ErrorKind.EXPECT_SELECT_ARGUMENT_OPTIONS, createLocation(typeEndPosition_1, __assign({}, typeEndPosition_1))); 8363 this.bumpSpace(); 8364 var identifierAndLocation = this.parseIdentifierIfPossible(), pluralOffset = 0; 8365 if (argType !== "select" && identifierAndLocation.value === "offset") { 8366 if (!this.bumpIf(":")) 8367 return this.error(ErrorKind.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, createLocation(this.clonePosition(), this.clonePosition())); 8368 this.bumpSpace(); 8369 var result = this.tryParseDecimalInteger(ErrorKind.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, ErrorKind.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE); 8370 if (result.err) 8371 return result; 8372 this.bumpSpace(), identifierAndLocation = this.parseIdentifierIfPossible(), pluralOffset = result.val; 8373 } 8374 var optionsResult = this.tryParsePluralOrSelectOptions(nestingLevel, argType, expectingCloseTag, identifierAndLocation); 8375 if (optionsResult.err) 8376 return optionsResult; 8377 var argCloseResult = this.tryParseArgumentClose(openingBracePosition); 8378 if (argCloseResult.err) 8379 return argCloseResult; 8380 var location_2 = createLocation(openingBracePosition, this.clonePosition()); 8381 return argType === "select" ? { 8382 val: { 8383 type: TYPE.select, 8384 value, 8385 options: fromEntries(optionsResult.val), 8386 location: location_2 8387 }, 8388 err: null 8389 } : { 8390 val: { 8391 type: TYPE.plural, 8392 value, 8393 options: fromEntries(optionsResult.val), 8394 offset: pluralOffset, 8395 pluralType: argType === "plural" ? "cardinal" : "ordinal", 8396 location: location_2 8397 }, 8398 err: null 8399 }; 8400 } 8401 default: 8402 return this.error(ErrorKind.INVALID_ARGUMENT_TYPE, createLocation(typeStartPosition, typeEndPosition)); 8403 } 8404 }, Parser2.prototype.tryParseArgumentClose = function(openingBracePosition) { 8405 return this.isEOF() || this.char() !== 125 ? this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition())) : (this.bump(), { val: !0, err: null }); 8406 }, Parser2.prototype.parseSimpleArgStyleIfPossible = function() { 8407 for (var nestedBraces = 0, startPosition = this.clonePosition(); !this.isEOF(); ) { 8408 var ch = this.char(); 8409 switch (ch) { 8410 case 39: { 8411 this.bump(); 8412 var apostrophePosition = this.clonePosition(); 8413 if (!this.bumpUntil("'")) 8414 return this.error(ErrorKind.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE, createLocation(apostrophePosition, this.clonePosition())); 8415 this.bump(); 8416 break; 8417 } 8418 case 123: { 8419 nestedBraces += 1, this.bump(); 8420 break; 8421 } 8422 case 125: { 8423 if (nestedBraces > 0) 8424 nestedBraces -= 1; 8425 else 8426 return { 8427 val: this.message.slice(startPosition.offset, this.offset()), 8428 err: null 8429 }; 8430 break; 8431 } 8432 default: 8433 this.bump(); 8434 break; 8435 } 8436 } 8437 return { 8438 val: this.message.slice(startPosition.offset, this.offset()), 8439 err: null 8440 }; 8441 }, Parser2.prototype.parseNumberSkeletonFromString = function(skeleton, location2) { 8442 var tokens2 = []; 8443 try { 8444 tokens2 = parseNumberSkeletonFromString(skeleton); 8445 } catch { 8446 return this.error(ErrorKind.INVALID_NUMBER_SKELETON, location2); 8447 } 8448 return { 8449 val: { 8450 type: SKELETON_TYPE.number, 8451 tokens: tokens2, 8452 location: location2, 8453 parsedOptions: this.shouldParseSkeletons ? parseNumberSkeleton(tokens2) : {} 8454 }, 8455 err: null 8456 }; 8457 }, Parser2.prototype.tryParsePluralOrSelectOptions = function(nestingLevel, parentArgType, expectCloseTag, parsedFirstIdentifier) { 8458 for (var _a2, hasOtherClause = !1, options2 = [], parsedSelectors = /* @__PURE__ */ new Set(), selector = parsedFirstIdentifier.value, selectorLocation = parsedFirstIdentifier.location; ; ) { 8459 if (selector.length === 0) { 8460 var startPosition = this.clonePosition(); 8461 if (parentArgType !== "select" && this.bumpIf("=")) { 8462 var result = this.tryParseDecimalInteger(ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR, ErrorKind.INVALID_PLURAL_ARGUMENT_SELECTOR); 8463 if (result.err) 8464 return result; 8465 selectorLocation = createLocation(startPosition, this.clonePosition()), selector = this.message.slice(startPosition.offset, this.offset()); 8466 } else 8467 break; 8468 } 8469 if (parsedSelectors.has(selector)) 8470 return this.error(parentArgType === "select" ? ErrorKind.DUPLICATE_SELECT_ARGUMENT_SELECTOR : ErrorKind.DUPLICATE_PLURAL_ARGUMENT_SELECTOR, selectorLocation); 8471 selector === "other" && (hasOtherClause = !0), this.bumpSpace(); 8472 var openingBracePosition = this.clonePosition(); 8473 if (!this.bumpIf("{")) 8474 return this.error(parentArgType === "select" ? ErrorKind.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT : ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT, createLocation(this.clonePosition(), this.clonePosition())); 8475 var fragmentResult = this.parseMessage(nestingLevel + 1, parentArgType, expectCloseTag); 8476 if (fragmentResult.err) 8477 return fragmentResult; 8478 var argCloseResult = this.tryParseArgumentClose(openingBracePosition); 8479 if (argCloseResult.err) 8480 return argCloseResult; 8481 options2.push([ 8482 selector, 8483 { 8484 value: fragmentResult.val, 8485 location: createLocation(openingBracePosition, this.clonePosition()) 8486 } 8487 ]), parsedSelectors.add(selector), this.bumpSpace(), _a2 = this.parseIdentifierIfPossible(), selector = _a2.value, selectorLocation = _a2.location; 8488 } 8489 return options2.length === 0 ? this.error(parentArgType === "select" ? ErrorKind.EXPECT_SELECT_ARGUMENT_SELECTOR : ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR, createLocation(this.clonePosition(), this.clonePosition())) : this.requiresOtherClause && !hasOtherClause ? this.error(ErrorKind.MISSING_OTHER_CLAUSE, createLocation(this.clonePosition(), this.clonePosition())) : { val: options2, err: null }; 8490 }, Parser2.prototype.tryParseDecimalInteger = function(expectNumberError, invalidNumberError) { 8491 var sign = 1, startingPosition = this.clonePosition(); 8492 this.bumpIf("+") || this.bumpIf("-") && (sign = -1); 8493 for (var hasDigits = !1, decimal = 0; !this.isEOF(); ) { 8494 var ch = this.char(); 8495 if (ch >= 48 && ch <= 57) 8496 hasDigits = !0, decimal = decimal * 10 + (ch - 48), this.bump(); 8497 else 8498 break; 8499 } 8500 var location2 = createLocation(startingPosition, this.clonePosition()); 8501 return hasDigits ? (decimal *= sign, isSafeInteger(decimal) ? { val: decimal, err: null } : this.error(invalidNumberError, location2)) : this.error(expectNumberError, location2); 8502 }, Parser2.prototype.offset = function() { 8503 return this.position.offset; 8504 }, Parser2.prototype.isEOF = function() { 8505 return this.offset() === this.message.length; 8506 }, Parser2.prototype.clonePosition = function() { 8507 return { 8508 offset: this.position.offset, 8509 line: this.position.line, 8510 column: this.position.column 8511 }; 8512 }, Parser2.prototype.char = function() { 8513 var offset2 = this.position.offset; 8514 if (offset2 >= this.message.length) 8515 throw Error("out of bound"); 8516 var code = codePointAt(this.message, offset2); 8517 if (code === void 0) 8518 throw Error("Offset ".concat(offset2, " is at invalid UTF-16 code unit boundary")); 8519 return code; 8520 }, Parser2.prototype.error = function(kind, location2) { 8521 return { 8522 val: null, 8523 err: { 8524 kind, 8525 message: this.message, 8526 location: location2 8527 } 8528 }; 8529 }, Parser2.prototype.bump = function() { 8530 if (!this.isEOF()) { 8531 var code = this.char(); 8532 code === 10 ? (this.position.line += 1, this.position.column = 1, this.position.offset += 1) : (this.position.column += 1, this.position.offset += code < 65536 ? 1 : 2); 8533 } 8534 }, Parser2.prototype.bumpIf = function(prefix) { 8535 if (startsWith(this.message, prefix, this.offset())) { 8536 for (var i2 = 0; i2 < prefix.length; i2++) 8537 this.bump(); 8538 return !0; 8539 } 8540 return !1; 8541 }, Parser2.prototype.bumpUntil = function(pattern) { 8542 var currentOffset = this.offset(), index = this.message.indexOf(pattern, currentOffset); 8543 return index >= 0 ? (this.bumpTo(index), !0) : (this.bumpTo(this.message.length), !1); 8544 }, Parser2.prototype.bumpTo = function(targetOffset) { 8545 if (this.offset() > targetOffset) 8546 throw Error("targetOffset ".concat(targetOffset, " must be greater than or equal to the current offset ").concat(this.offset())); 8547 for (targetOffset = Math.min(targetOffset, this.message.length); ; ) { 8548 var offset2 = this.offset(); 8549 if (offset2 === targetOffset) 8550 break; 8551 if (offset2 > targetOffset) 8552 throw Error("targetOffset ".concat(targetOffset, " is at invalid UTF-16 code unit boundary")); 8553 if (this.bump(), this.isEOF()) 8554 break; 8555 } 8556 }, Parser2.prototype.bumpSpace = function() { 8557 for (; !this.isEOF() && _isWhiteSpace(this.char()); ) 8558 this.bump(); 8559 }, Parser2.prototype.peek = function() { 8560 if (this.isEOF()) 8561 return null; 8562 var code = this.char(), offset2 = this.offset(), nextCode = this.message.charCodeAt(offset2 + (code >= 65536 ? 2 : 1)); 8563 return nextCode ?? null; 8564 }, Parser2; 8565 })() 8566); 8567function _isAlpha(codepoint) { 8568 return codepoint >= 97 && codepoint <= 122 || codepoint >= 65 && codepoint <= 90; 8569} 8570function _isAlphaOrSlash(codepoint) { 8571 return _isAlpha(codepoint) || codepoint === 47; 8572} 8573function _isPotentialElementNameChar(c2) { 8574 return c2 === 45 || c2 === 46 || c2 >= 48 && c2 <= 57 || c2 === 95 || c2 >= 97 && c2 <= 122 || c2 >= 65 && c2 <= 90 || c2 == 183 || c2 >= 192 && c2 <= 214 || c2 >= 216 && c2 <= 246 || c2 >= 248 && c2 <= 893 || c2 >= 895 && c2 <= 8191 || c2 >= 8204 && c2 <= 8205 || c2 >= 8255 && c2 <= 8256 || c2 >= 8304 && c2 <= 8591 || c2 >= 11264 && c2 <= 12271 || c2 >= 12289 && c2 <= 55295 || c2 >= 63744 && c2 <= 64975 || c2 >= 65008 && c2 <= 65533 || c2 >= 65536 && c2 <= 983039; 8575} 8576function _isWhiteSpace(c2) { 8577 return c2 >= 9 && c2 <= 13 || c2 === 32 || c2 === 133 || c2 >= 8206 && c2 <= 8207 || c2 === 8232 || c2 === 8233; 8578} 8579function _isPatternSyntax(c2) { 8580 return c2 >= 33 && c2 <= 35 || c2 === 36 || c2 >= 37 && c2 <= 39 || c2 === 40 || c2 === 41 || c2 === 42 || c2 === 43 || c2 === 44 || c2 === 45 || c2 >= 46 && c2 <= 47 || c2 >= 58 && c2 <= 59 || c2 >= 60 && c2 <= 62 || c2 >= 63 && c2 <= 64 || c2 === 91 || c2 === 92 || c2 === 93 || c2 === 94 || c2 === 96 || c2 === 123 || c2 === 124 || c2 === 125 || c2 === 126 || c2 === 161 || c2 >= 162 && c2 <= 165 || c2 === 166 || c2 === 167 || c2 === 169 || c2 === 171 || c2 === 172 || c2 === 174 || c2 === 176 || c2 === 177 || c2 === 182 || c2 === 187 || c2 === 191 || c2 === 215 || c2 === 247 || c2 >= 8208 && c2 <= 8213 || c2 >= 8214 && c2 <= 8215 || c2 === 8216 || c2 === 8217 || c2 === 8218 || c2 >= 8219 && c2 <= 8220 || c2 === 8221 || c2 === 8222 || c2 === 8223 || c2 >= 8224 && c2 <= 8231 || c2 >= 8240 && c2 <= 8248 || c2 === 8249 || c2 === 8250 || c2 >= 8251 && c2 <= 8254 || c2 >= 8257 && c2 <= 8259 || c2 === 8260 || c2 === 8261 || c2 === 8262 || c2 >= 8263 && c2 <= 8273 || c2 === 8274 || c2 === 8275 || c2 >= 8277 && c2 <= 8286 || c2 >= 8592 && c2 <= 8596 || c2 >= 8597 && c2 <= 8601 || c2 >= 8602 && c2 <= 8603 || c2 >= 8604 && c2 <= 8607 || c2 === 8608 || c2 >= 8609 && c2 <= 8610 || c2 === 8611 || c2 >= 8612 && c2 <= 8613 || c2 === 8614 || c2 >= 8615 && c2 <= 8621 || c2 === 8622 || c2 >= 8623 && c2 <= 8653 || c2 >= 8654 && c2 <= 8655 || c2 >= 8656 && c2 <= 8657 || c2 === 8658 || c2 === 8659 || c2 === 8660 || c2 >= 8661 && c2 <= 8691 || c2 >= 8692 && c2 <= 8959 || c2 >= 8960 && c2 <= 8967 || c2 === 8968 || c2 === 8969 || c2 === 8970 || c2 === 8971 || c2 >= 8972 && c2 <= 8991 || c2 >= 8992 && c2 <= 8993 || c2 >= 8994 && c2 <= 9e3 || c2 === 9001 || c2 === 9002 || c2 >= 9003 && c2 <= 9083 || c2 === 9084 || c2 >= 9085 && c2 <= 9114 || c2 >= 9115 && c2 <= 9139 || c2 >= 9140 && c2 <= 9179 || c2 >= 9180 && c2 <= 9185 || c2 >= 9186 && c2 <= 9254 || c2 >= 9255 && c2 <= 9279 || c2 >= 9280 && c2 <= 9290 || c2 >= 9291 && c2 <= 9311 || c2 >= 9472 && c2 <= 9654 || c2 === 9655 || c2 >= 9656 && c2 <= 9664 || c2 === 9665 || c2 >= 9666 && c2 <= 9719 || c2 >= 9720 && c2 <= 9727 || c2 >= 9728 && c2 <= 9838 || c2 === 9839 || c2 >= 9840 && c2 <= 10087 || c2 === 10088 || c2 === 10089 || c2 === 10090 || c2 === 10091 || c2 === 10092 || c2 === 10093 || c2 === 10094 || c2 === 10095 || c2 === 10096 || c2 === 10097 || c2 === 10098 || c2 === 10099 || c2 === 10100 || c2 === 10101 || c2 >= 10132 && c2 <= 10175 || c2 >= 10176 && c2 <= 10180 || c2 === 10181 || c2 === 10182 || c2 >= 10183 && c2 <= 10213 || c2 === 10214 || c2 === 10215 || c2 === 10216 || c2 === 10217 || c2 === 10218 || c2 === 10219 || c2 === 10220 || c2 === 10221 || c2 === 10222 || c2 === 10223 || c2 >= 10224 && c2 <= 10239 || c2 >= 10240 && c2 <= 10495 || c2 >= 10496 && c2 <= 10626 || c2 === 10627 || c2 === 10628 || c2 === 10629 || c2 === 10630 || c2 === 10631 || c2 === 10632 || c2 === 10633 || c2 === 10634 || c2 === 10635 || c2 === 10636 || c2 === 10637 || c2 === 10638 || c2 === 10639 || c2 === 10640 || c2 === 10641 || c2 === 10642 || c2 === 10643 || c2 === 10644 || c2 === 10645 || c2 === 10646 || c2 === 10647 || c2 === 10648 || c2 >= 10649 && c2 <= 10711 || c2 === 10712 || c2 === 10713 || c2 === 10714 || c2 === 10715 || c2 >= 10716 && c2 <= 10747 || c2 === 10748 || c2 === 10749 || c2 >= 10750 && c2 <= 11007 || c2 >= 11008 && c2 <= 11055 || c2 >= 11056 && c2 <= 11076 || c2 >= 11077 && c2 <= 11078 || c2 >= 11079 && c2 <= 11084 || c2 >= 11085 && c2 <= 11123 || c2 >= 11124 && c2 <= 11125 || c2 >= 11126 && c2 <= 11157 || c2 === 11158 || c2 >= 11159 && c2 <= 11263 || c2 >= 11776 && c2 <= 11777 || c2 === 11778 || c2 === 11779 || c2 === 11780 || c2 === 11781 || c2 >= 11782 && c2 <= 11784 || c2 === 11785 || c2 === 11786 || c2 === 11787 || c2 === 11788 || c2 === 11789 || c2 >= 11790 && c2 <= 11798 || c2 === 11799 || c2 >= 11800 && c2 <= 11801 || c2 === 11802 || c2 === 11803 || c2 === 11804 || c2 === 11805 || c2 >= 11806 && c2 <= 11807 || c2 === 11808 || c2 === 11809 || c2 === 11810 || c2 === 11811 || c2 === 11812 || c2 === 11813 || c2 === 11814 || c2 === 11815 || c2 === 11816 || c2 === 11817 || c2 >= 11818 && c2 <= 11822 || c2 === 11823 || c2 >= 11824 && c2 <= 11833 || c2 >= 11834 && c2 <= 11835 || c2 >= 11836 && c2 <= 11839 || c2 === 11840 || c2 === 11841 || c2 === 11842 || c2 >= 11843 && c2 <= 11855 || c2 >= 11856 && c2 <= 11857 || c2 === 11858 || c2 >= 11859 && c2 <= 11903 || c2 >= 12289 && c2 <= 12291 || c2 === 12296 || c2 === 12297 || c2 === 12298 || c2 === 12299 || c2 === 12300 || c2 === 12301 || c2 === 12302 || c2 === 12303 || c2 === 12304 || c2 === 12305 || c2 >= 12306 && c2 <= 12307 || c2 === 12308 || c2 === 12309 || c2 === 12310 || c2 === 12311 || c2 === 12312 || c2 === 12313 || c2 === 12314 || c2 === 12315 || c2 === 12316 || c2 === 12317 || c2 >= 12318 && c2 <= 12319 || c2 === 12320 || c2 === 12336 || c2 === 64830 || c2 === 64831 || c2 >= 65093 && c2 <= 65094; 8581} 8582 8583// ../../node_modules/@formatjs/icu-messageformat-parser/lib/index.js 8584function pruneLocation(els) { 8585 els.forEach(function(el) { 8586 if (delete el.location, isSelectElement(el) || isPluralElement(el)) 8587 for (var k2 in el.options) 8588 delete el.options[k2].location, pruneLocation(el.options[k2].value); 8589 else isNumberElement(el) && isNumberSkeleton(el.style) || (isDateElement(el) || isTimeElement(el)) && isDateTimeSkeleton(el.style) ? delete el.style.location : isTagElement(el) && pruneLocation(el.children); 8590 }); 8591} 8592function parse(message, opts) { 8593 opts === void 0 && (opts = {}), opts = __assign({ shouldParseSkeletons: !0, requiresOtherClause: !0 }, opts); 8594 var result = new Parser(message, opts).parse(); 8595 if (result.err) { 8596 var error = SyntaxError(ErrorKind[result.err.kind]); 8597 throw error.location = result.err.location, error.originalMessage = result.err.message, error; 8598 } 8599 return opts?.captureLocation || pruneLocation(result.val), result.val; 8600} 8601 8602// ../../node_modules/intl-messageformat/lib/src/error.js 8603var ErrorCode; 8604(function(ErrorCode2) { 8605 ErrorCode2.MISSING_VALUE = "MISSING_VALUE", ErrorCode2.INVALID_VALUE = "INVALID_VALUE", ErrorCode2.MISSING_INTL_API = "MISSING_INTL_API"; 8606})(ErrorCode || (ErrorCode = {})); 8607var FormatError = ( 8608 /** @class */ 8609 (function(_super) { 8610 __extends(FormatError2, _super); 8611 function FormatError2(msg, code, originalMessage) { 8612 var _this = _super.call(this, msg) || this; 8613 return _this.code = code, _this.originalMessage = originalMessage, _this; 8614 } 8615 return FormatError2.prototype.toString = function() { 8616 return "[formatjs Error: ".concat(this.code, "] ").concat(this.message); 8617 }, FormatError2; 8618 })(Error) 8619); 8620var InvalidValueError = ( 8621 /** @class */ 8622 (function(_super) { 8623 __extends(InvalidValueError2, _super); 8624 function InvalidValueError2(variableId, value, options2, originalMessage) { 8625 return _super.call(this, 'Invalid values for "'.concat(variableId, '": "').concat(value, '". Options are "').concat(Object.keys(options2).join('", "'), '"'), ErrorCode.INVALID_VALUE, originalMessage) || this; 8626 } 8627 return InvalidValueError2; 8628 })(FormatError) 8629); 8630var InvalidValueTypeError = ( 8631 /** @class */ 8632 (function(_super) { 8633 __extends(InvalidValueTypeError2, _super); 8634 function InvalidValueTypeError2(value, type, originalMessage) { 8635 return _super.call(this, 'Value for "'.concat(value, '" must be of type ').concat(type), ErrorCode.INVALID_VALUE, originalMessage) || this; 8636 } 8637 return InvalidValueTypeError2; 8638 })(FormatError) 8639); 8640var MissingValueError = ( 8641 /** @class */ 8642 (function(_super) { 8643 __extends(MissingValueError2, _super); 8644 function MissingValueError2(variableId, originalMessage) { 8645 return _super.call(this, 'The intl string context variable "'.concat(variableId, '" was not provided to the string "').concat(originalMessage, '"'), ErrorCode.MISSING_VALUE, originalMessage) || this; 8646 } 8647 return MissingValueError2; 8648 })(FormatError) 8649); 8650 8651// ../../node_modules/intl-messageformat/lib/src/formatters.js 8652var PART_TYPE; 8653(function(PART_TYPE2) { 8654 PART_TYPE2[PART_TYPE2.literal = 0] = "literal", PART_TYPE2[PART_TYPE2.object = 1] = "object"; 8655})(PART_TYPE || (PART_TYPE = {})); 8656function mergeLiteral(parts) { 8657 return parts.length < 2 ? parts : parts.reduce(function(all, part) { 8658 var lastPart = all[all.length - 1]; 8659 return !lastPart || lastPart.type !== PART_TYPE.literal || part.type !== PART_TYPE.literal ? all.push(part) : lastPart.value += part.value, all; 8660 }, []); 8661} 8662function isFormatXMLElementFn(el) { 8663 return typeof el == "function"; 8664} 8665function formatToParts(els, locales, formatters, formats, values, currentPluralValue, originalMessage) { 8666 if (els.length === 1 && isLiteralElement(els[0])) 8667 return [ 8668 { 8669 type: PART_TYPE.literal, 8670 value: els[0].value 8671 } 8672 ]; 8673 for (var result = [], _i = 0, els_1 = els; _i < els_1.length; _i++) { 8674 var el = els_1[_i]; 8675 if (isLiteralElement(el)) { 8676 result.push({ 8677 type: PART_TYPE.literal, 8678 value: el.value 8679 }); 8680 continue; 8681 } 8682 if (isPoundElement(el)) { 8683 typeof currentPluralValue == "number" && result.push({ 8684 type: PART_TYPE.literal, 8685 value: formatters.getNumberFormat(locales).format(currentPluralValue) 8686 }); 8687 continue; 8688 } 8689 var varName = el.value; 8690 if (!(values && varName in values)) 8691 throw new MissingValueError(varName, originalMessage); 8692 var value = values[varName]; 8693 if (isArgumentElement(el)) { 8694 (!value || typeof value == "string" || typeof value == "number") && (value = typeof value == "string" || typeof value == "number" ? String(value) : ""), result.push({ 8695 type: typeof value == "string" ? PART_TYPE.literal : PART_TYPE.object, 8696 value 8697 }); 8698 continue; 8699 } 8700 if (isDateElement(el)) { 8701 var style = typeof el.style == "string" ? formats.date[el.style] : isDateTimeSkeleton(el.style) ? el.style.parsedOptions : void 0; 8702 result.push({ 8703 type: PART_TYPE.literal, 8704 value: formatters.getDateTimeFormat(locales, style).format(value) 8705 }); 8706 continue; 8707 } 8708 if (isTimeElement(el)) { 8709 var style = typeof el.style == "string" ? formats.time[el.style] : isDateTimeSkeleton(el.style) ? el.style.parsedOptions : formats.time.medium; 8710 result.push({ 8711 type: PART_TYPE.literal, 8712 value: formatters.getDateTimeFormat(locales, style).format(value) 8713 }); 8714 continue; 8715 } 8716 if (isNumberElement(el)) { 8717 var style = typeof el.style == "string" ? formats.number[el.style] : isNumberSkeleton(el.style) ? el.style.parsedOptions : void 0; 8718 style && style.scale && (value = value * (style.scale || 1)), result.push({ 8719 type: PART_TYPE.literal, 8720 value: formatters.getNumberFormat(locales, style).format(value) 8721 }); 8722 continue; 8723 } 8724 if (isTagElement(el)) { 8725 var children = el.children, value_1 = el.value, formatFn = values[value_1]; 8726 if (!isFormatXMLElementFn(formatFn)) 8727 throw new InvalidValueTypeError(value_1, "function", originalMessage); 8728 var parts = formatToParts(children, locales, formatters, formats, values, currentPluralValue), chunks = formatFn(parts.map(function(p2) { 8729 return p2.value; 8730 })); 8731 Array.isArray(chunks) || (chunks = [chunks]), result.push.apply(result, chunks.map(function(c2) { 8732 return { 8733 type: typeof c2 == "string" ? PART_TYPE.literal : PART_TYPE.object, 8734 value: c2 8735 }; 8736 })); 8737 } 8738 if (isSelectElement(el)) { 8739 var opt = el.options[value] || el.options.other; 8740 if (!opt) 8741 throw new InvalidValueError(el.value, value, Object.keys(el.options), originalMessage); 8742 result.push.apply(result, formatToParts(opt.value, locales, formatters, formats, values)); 8743 continue; 8744 } 8745 if (isPluralElement(el)) { 8746 var opt = el.options["=".concat(value)]; 8747 if (!opt) { 8748 if (!Intl.PluralRules) 8749 throw new FormatError(`Intl.PluralRules is not available in this environment. 8750Try polyfilling it using "@formatjs/intl-pluralrules" 8751`, ErrorCode.MISSING_INTL_API, originalMessage); 8752 var rule = formatters.getPluralRules(locales, { type: el.pluralType }).select(value - (el.offset || 0)); 8753 opt = el.options[rule] || el.options.other; 8754 } 8755 if (!opt) 8756 throw new InvalidValueError(el.value, value, Object.keys(el.options), originalMessage); 8757 result.push.apply(result, formatToParts(opt.value, locales, formatters, formats, values, value - (el.offset || 0))); 8758 continue; 8759 } 8760 } 8761 return mergeLiteral(result); 8762} 8763 8764// ../../node_modules/intl-messageformat/lib/src/core.js 8765function mergeConfig(c1, c2) { 8766 return c2 ? __assign(__assign(__assign({}, c1 || {}), c2 || {}), Object.keys(c1).reduce(function(all, k2) { 8767 return all[k2] = __assign(__assign({}, c1[k2]), c2[k2] || {}), all; 8768 }, {})) : c1; 8769} 8770function mergeConfigs(defaultConfig, configs) { 8771 return configs ? Object.keys(defaultConfig).reduce(function(all, k2) { 8772 return all[k2] = mergeConfig(defaultConfig[k2], configs[k2]), all; 8773 }, __assign({}, defaultConfig)) : defaultConfig; 8774} 8775function createFastMemoizeCache(store2) { 8776 return { 8777 create: function() { 8778 return { 8779 get: function(key) { 8780 return store2[key]; 8781 }, 8782 set: function(key, value) { 8783 store2[key] = value; 8784 } 8785 }; 8786 } 8787 }; 8788} 8789function createDefaultFormatters(cache) { 8790 return cache === void 0 && (cache = { 8791 number: {}, 8792 dateTime: {}, 8793 pluralRules: {} 8794 }), { 8795 getNumberFormat: memoize(function() { 8796 for (var _a2, args = [], _i = 0; _i < arguments.length; _i++) 8797 args[_i] = arguments[_i]; 8798 return new ((_a2 = Intl.NumberFormat).bind.apply(_a2, __spreadArray([void 0], args, !1)))(); 8799 }, { 8800 cache: createFastMemoizeCache(cache.number), 8801 strategy: strategies.variadic 8802 }), 8803 getDateTimeFormat: memoize(function() { 8804 for (var _a2, args = [], _i = 0; _i < arguments.length; _i++) 8805 args[_i] = arguments[_i]; 8806 return new ((_a2 = Intl.DateTimeFormat).bind.apply(_a2, __spreadArray([void 0], args, !1)))(); 8807 }, { 8808 cache: createFastMemoizeCache(cache.dateTime), 8809 strategy: strategies.variadic 8810 }), 8811 getPluralRules: memoize(function() { 8812 for (var _a2, args = [], _i = 0; _i < arguments.length; _i++) 8813 args[_i] = arguments[_i]; 8814 return new ((_a2 = Intl.PluralRules).bind.apply(_a2, __spreadArray([void 0], args, !1)))(); 8815 }, { 8816 cache: createFastMemoizeCache(cache.pluralRules), 8817 strategy: strategies.variadic 8818 }) 8819 }; 8820} 8821var IntlMessageFormat = ( 8822 /** @class */ 8823 (function() { 8824 function IntlMessageFormat2(message, locales, overrideFormats, opts) { 8825 locales === void 0 && (locales = IntlMessageFormat2.defaultLocale); 8826 var _this = this; 8827 if (this.formatterCache = { 8828 number: {}, 8829 dateTime: {}, 8830 pluralRules: {} 8831 }, this.format = function(values) { 8832 var parts = _this.formatToParts(values); 8833 if (parts.length === 1) 8834 return parts[0].value; 8835 var result = parts.reduce(function(all, part) { 8836 return !all.length || part.type !== PART_TYPE.literal || typeof all[all.length - 1] != "string" ? all.push(part.value) : all[all.length - 1] += part.value, all; 8837 }, []); 8838 return result.length <= 1 ? result[0] || "" : result; 8839 }, this.formatToParts = function(values) { 8840 return formatToParts(_this.ast, _this.locales, _this.formatters, _this.formats, values, void 0, _this.message); 8841 }, this.resolvedOptions = function() { 8842 var _a3; 8843 return { 8844 locale: ((_a3 = _this.resolvedLocale) === null || _a3 === void 0 ? void 0 : _a3.toString()) || Intl.NumberFormat.supportedLocalesOf(_this.locales)[0] 8845 }; 8846 }, this.getAst = function() { 8847 return _this.ast; 8848 }, this.locales = locales, this.resolvedLocale = IntlMessageFormat2.resolveLocale(locales), typeof message == "string") { 8849 if (this.message = message, !IntlMessageFormat2.__parse) 8850 throw new TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`"); 8851 var _a2 = opts || {}, formatters = _a2.formatters, parseOpts = __rest(_a2, ["formatters"]); 8852 this.ast = IntlMessageFormat2.__parse(message, __assign(__assign({}, parseOpts), { locale: this.resolvedLocale })); 8853 } else 8854 this.ast = message; 8855 if (!Array.isArray(this.ast)) 8856 throw new TypeError("A message must be provided as a String or AST."); 8857 this.formats = mergeConfigs(IntlMessageFormat2.formats, overrideFormats), this.formatters = opts && opts.formatters || createDefaultFormatters(this.formatterCache); 8858 } 8859 return Object.defineProperty(IntlMessageFormat2, "defaultLocale", { 8860 get: function() { 8861 return IntlMessageFormat2.memoizedDefaultLocale || (IntlMessageFormat2.memoizedDefaultLocale = new Intl.NumberFormat().resolvedOptions().locale), IntlMessageFormat2.memoizedDefaultLocale; 8862 }, 8863 enumerable: !1, 8864 configurable: !0 8865 }), IntlMessageFormat2.memoizedDefaultLocale = null, IntlMessageFormat2.resolveLocale = function(locales) { 8866 if (!(typeof Intl.Locale > "u")) { 8867 var supportedLocales = Intl.NumberFormat.supportedLocalesOf(locales); 8868 return supportedLocales.length > 0 ? new Intl.Locale(supportedLocales[0]) : new Intl.Locale(typeof locales == "string" ? locales : locales[0]); 8869 } 8870 }, IntlMessageFormat2.__parse = parse, IntlMessageFormat2.formats = { 8871 number: { 8872 integer: { 8873 maximumFractionDigits: 0 8874 }, 8875 currency: { 8876 style: "currency" 8877 }, 8878 percent: { 8879 style: "percent" 8880 } 8881 }, 8882 date: { 8883 short: { 8884 month: "numeric", 8885 day: "numeric", 8886 year: "2-digit" 8887 }, 8888 medium: { 8889 month: "short", 8890 day: "numeric", 8891 year: "numeric" 8892 }, 8893 long: { 8894 month: "long", 8895 day: "numeric", 8896 year: "numeric" 8897 }, 8898 full: { 8899 weekday: "long", 8900 month: "long", 8901 day: "numeric", 8902 year: "numeric" 8903 } 8904 }, 8905 time: { 8906 short: { 8907 hour: "numeric", 8908 minute: "numeric" 8909 }, 8910 medium: { 8911 hour: "numeric", 8912 minute: "numeric", 8913 second: "numeric" 8914 }, 8915 long: { 8916 hour: "numeric", 8917 minute: "numeric", 8918 second: "numeric", 8919 timeZoneName: "short" 8920 }, 8921 full: { 8922 hour: "numeric", 8923 minute: "numeric", 8924 second: "numeric", 8925 timeZoneName: "short" 8926 } 8927 } 8928 }, IntlMessageFormat2; 8929 })() 8930); 8931 8932// ../../node_modules/@react-aria/i18n/dist/useMessageFormatter.mjs 8933init_react(); 8934 8935// ../../node_modules/@react-aria/i18n/dist/useLocalizedStringFormatter.mjs 8936init_react(); 8937 8938// ../../node_modules/@react-aria/i18n/dist/useListFormatter.mjs 8939init_react(); 8940 8941// ../../node_modules/@internationalized/date/dist/string.mjs 8942var $fae977aafc393c5c$var$requiredDurationTimeGroups = [ 8943 "hours", 8944 "minutes", 8945 "seconds" 8946], $fae977aafc393c5c$var$requiredDurationGroups = [ 8947 "years", 8948 "months", 8949 "weeks", 8950 "days", 8951 ...$fae977aafc393c5c$var$requiredDurationTimeGroups 8952]; 8953 8954// ../../node_modules/@internationalized/date/dist/HebrewCalendar.mjs 8955var $7c5f6fbf42389787$var$HOUR_PARTS = 1080, $7c5f6fbf42389787$var$DAY_PARTS = 24 * $7c5f6fbf42389787$var$HOUR_PARTS, $7c5f6fbf42389787$var$MONTH_DAYS = 29, $7c5f6fbf42389787$var$MONTH_FRACT = 12 * $7c5f6fbf42389787$var$HOUR_PARTS + 793, $7c5f6fbf42389787$var$MONTH_PARTS = $7c5f6fbf42389787$var$MONTH_DAYS * $7c5f6fbf42389787$var$DAY_PARTS + $7c5f6fbf42389787$var$MONTH_FRACT; 8956 8957// ../../node_modules/@react-aria/i18n/dist/useDateFormatter.mjs 8958init_react(); 8959 8960// ../../node_modules/@internationalized/number/dist/NumberFormatter.mjs 8961var $488c6ddbf4ef74c2$var$supportsSignDisplay = !1; 8962try { 8963 $488c6ddbf4ef74c2$var$supportsSignDisplay = new Intl.NumberFormat("de-DE", { 8964 signDisplay: "exceptZero" 8965 }).resolvedOptions().signDisplay === "exceptZero"; 8966} catch { 8967} 8968var $488c6ddbf4ef74c2$var$supportsUnit = !1; 8969try { 8970 $488c6ddbf4ef74c2$var$supportsUnit = new Intl.NumberFormat("de-DE", { 8971 style: "unit", 8972 unit: "degree" 8973 }).resolvedOptions().style === "unit"; 8974} catch { 8975} 8976 8977// ../../node_modules/@internationalized/number/dist/NumberParser.mjs 8978var $6c7bd7858deea686$var$CURRENCY_SIGN_REGEX = new RegExp("^.*\\(.*\\).*$"); 8979 8980// ../../node_modules/@react-aria/i18n/dist/useNumberFormatter.mjs 8981init_react(); 8982 8983// ../../node_modules/@react-aria/i18n/dist/useFilter.mjs 8984init_react(); 8985 8986// ../../node_modules/@react-aria/overlays/dist/useOverlayPosition.mjs 8987var $2a41e45df1593e64$var$visualViewport = typeof document < "u" ? window.visualViewport : null; 8988function $2a41e45df1593e64$export$d39e1813b3bdd0e1(props) { 8989 let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7(), { arrowSize, targetRef, overlayRef, arrowRef, scrollRef = overlayRef, placement = "bottom", containerPadding = 12, shouldFlip = !0, boundaryElement = typeof document < "u" ? document.body : null, offset: offset2 = 0, crossOffset = 0, shouldUpdatePosition = !0, isOpen = !0, onClose, maxHeight, arrowBoundaryOffset = 0 } = props, [position, setPosition] = useState(null), deps = [ 8990 shouldUpdatePosition, 8991 placement, 8992 overlayRef.current, 8993 targetRef.current, 8994 arrowRef?.current, 8995 scrollRef.current, 8996 containerPadding, 8997 shouldFlip, 8998 boundaryElement, 8999 offset2, 9000 crossOffset, 9001 isOpen, 9002 direction, 9003 maxHeight, 9004 arrowBoundaryOffset, 9005 arrowSize 9006 ], lastScale = useRef($2a41e45df1593e64$var$visualViewport?.scale); 9007 useEffect(() => { 9008 isOpen && (lastScale.current = $2a41e45df1593e64$var$visualViewport?.scale); 9009 }, [ 9010 isOpen 9011 ]); 9012 let updatePosition = useCallback(() => { 9013 if (shouldUpdatePosition === !1 || !isOpen || !overlayRef.current || !targetRef.current || !boundaryElement || $2a41e45df1593e64$var$visualViewport?.scale !== lastScale.current) return; 9014 let anchor = null; 9015 if (scrollRef.current && scrollRef.current.contains(document.activeElement)) { 9016 var _document_activeElement; 9017 let anchorRect = (_document_activeElement = document.activeElement) === null || _document_activeElement === void 0 ? void 0 : _document_activeElement.getBoundingClientRect(), scrollRect = scrollRef.current.getBoundingClientRect(); 9018 var _anchorRect_top; 9019 if (anchor = { 9020 type: "top", 9021 offset: ((_anchorRect_top = anchorRect?.top) !== null && _anchorRect_top !== void 0 ? _anchorRect_top : 0) - scrollRect.top 9022 }, anchor.offset > scrollRect.height / 2) { 9023 anchor.type = "bottom"; 9024 var _anchorRect_bottom; 9025 anchor.offset = ((_anchorRect_bottom = anchorRect?.bottom) !== null && _anchorRect_bottom !== void 0 ? _anchorRect_bottom : 0) - scrollRect.bottom; 9026 } 9027 } 9028 let overlay = overlayRef.current; 9029 if (!maxHeight && overlayRef.current) { 9030 var _window_visualViewport; 9031 overlay.style.top = "0px", overlay.style.bottom = ""; 9032 var _window_visualViewport_height; 9033 overlay.style.maxHeight = ((_window_visualViewport_height = (_window_visualViewport = window.visualViewport) === null || _window_visualViewport === void 0 ? void 0 : _window_visualViewport.height) !== null && _window_visualViewport_height !== void 0 ? _window_visualViewport_height : window.innerHeight) + "px"; 9034 } 9035 let position2 = $edcf132a9284368a$export$b3ceb0cbf1056d98({ 9036 placement: $2a41e45df1593e64$var$translateRTL(placement, direction), 9037 overlayNode: overlayRef.current, 9038 targetNode: targetRef.current, 9039 scrollNode: scrollRef.current || overlayRef.current, 9040 padding: containerPadding, 9041 shouldFlip, 9042 boundaryElement, 9043 offset: offset2, 9044 crossOffset, 9045 maxHeight, 9046 arrowSize: arrowSize ?? (arrowRef?.current ? $edcf132a9284368a$export$4b834cebd9e5cebe(arrowRef.current, !0).width : 0), 9047 arrowBoundaryOffset 9048 }); 9049 if (position2.position) { 9050 if (overlay.style.top = "", overlay.style.bottom = "", overlay.style.left = "", overlay.style.right = "", Object.keys(position2.position).forEach((key) => overlay.style[key] = position2.position[key] + "px"), overlay.style.maxHeight = position2.maxHeight != null ? position2.maxHeight + "px" : "", anchor && document.activeElement && scrollRef.current) { 9051 let anchorRect = document.activeElement.getBoundingClientRect(), scrollRect = scrollRef.current.getBoundingClientRect(), newOffset = anchorRect[anchor.type] - scrollRect[anchor.type]; 9052 scrollRef.current.scrollTop += newOffset - anchor.offset; 9053 } 9054 setPosition(position2); 9055 } 9056 }, deps); 9057 $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(updatePosition, deps), $2a41e45df1593e64$var$useResize(updatePosition), $9daab02d461809db$export$683480f191c0e3ea({ 9058 ref: overlayRef, 9059 onResize: updatePosition 9060 }), $9daab02d461809db$export$683480f191c0e3ea({ 9061 ref: targetRef, 9062 onResize: updatePosition 9063 }); 9064 let isResizing = useRef(!1); 9065 $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => { 9066 let timeout, onResize = () => { 9067 isResizing.current = !0, clearTimeout(timeout), timeout = setTimeout(() => { 9068 isResizing.current = !1; 9069 }, 500), updatePosition(); 9070 }, onScroll = () => { 9071 isResizing.current && onResize(); 9072 }; 9073 return $2a41e45df1593e64$var$visualViewport?.addEventListener("resize", onResize), $2a41e45df1593e64$var$visualViewport?.addEventListener("scroll", onScroll), () => { 9074 $2a41e45df1593e64$var$visualViewport?.removeEventListener("resize", onResize), $2a41e45df1593e64$var$visualViewport?.removeEventListener("scroll", onScroll); 9075 }; 9076 }, [ 9077 updatePosition 9078 ]); 9079 let close = useCallback(() => { 9080 isResizing.current || onClose?.(); 9081 }, [ 9082 onClose, 9083 isResizing 9084 ]); 9085 $dd149f63282afbbf$export$18fc8428861184da({ 9086 triggerRef: targetRef, 9087 isOpen, 9088 onClose: onClose && close 9089 }); 9090 var _position_maxHeight, _position_placement, _position_triggerAnchorPoint; 9091 return { 9092 overlayProps: { 9093 style: { 9094 position: position ? "absolute" : "fixed", 9095 top: position ? void 0 : 0, 9096 left: position ? void 0 : 0, 9097 zIndex: 1e5, 9098 ...position?.position, 9099 maxHeight: (_position_maxHeight = position?.maxHeight) !== null && _position_maxHeight !== void 0 ? _position_maxHeight : "100vh" 9100 } 9101 }, 9102 placement: (_position_placement = position?.placement) !== null && _position_placement !== void 0 ? _position_placement : null, 9103 triggerAnchorPoint: (_position_triggerAnchorPoint = position?.triggerAnchorPoint) !== null && _position_triggerAnchorPoint !== void 0 ? _position_triggerAnchorPoint : null, 9104 arrowProps: { 9105 "aria-hidden": "true", 9106 role: "presentation", 9107 style: { 9108 left: position?.arrowOffsetLeft, 9109 top: position?.arrowOffsetTop 9110 } 9111 }, 9112 updatePosition 9113 }; 9114} 9115function $2a41e45df1593e64$var$useResize(onResize) { 9116 $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => (window.addEventListener("resize", onResize, !1), () => { 9117 window.removeEventListener("resize", onResize, !1); 9118 }), [ 9119 onResize 9120 ]); 9121} 9122function $2a41e45df1593e64$var$translateRTL(position, direction) { 9123 return direction === "rtl" ? position.replace("start", "right").replace("end", "left") : position.replace("start", "left").replace("end", "right"); 9124} 9125 9126// ../../node_modules/@react-aria/focus/dist/FocusScope.mjs 9127init_react(); 9128var $9bf71ea28793e738$var$FocusContext = react_default.createContext(null); 9129function $9bf71ea28793e738$var$isElementInScope(element, scope2) { 9130 return !element || !scope2 ? !1 : scope2.some((node) => node.contains(element)); 9131} 9132var $9bf71ea28793e738$var$Tree = class _$9bf71ea28793e738$var$Tree { 9133 get size() { 9134 return this.fastMap.size; 9135 } 9136 getTreeNode(data) { 9137 return this.fastMap.get(data); 9138 } 9139 addTreeNode(scopeRef, parent, nodeToRestore) { 9140 let parentNode = this.fastMap.get(parent ?? null); 9141 if (!parentNode) return; 9142 let node = new $9bf71ea28793e738$var$TreeNode({ 9143 scopeRef 9144 }); 9145 parentNode.addChild(node), node.parent = parentNode, this.fastMap.set(scopeRef, node), nodeToRestore && (node.nodeToRestore = nodeToRestore); 9146 } 9147 addNode(node) { 9148 this.fastMap.set(node.scopeRef, node); 9149 } 9150 removeTreeNode(scopeRef) { 9151 if (scopeRef === null) return; 9152 let node = this.fastMap.get(scopeRef); 9153 if (!node) return; 9154 let parentNode = node.parent; 9155 for (let current of this.traverse()) current !== node && node.nodeToRestore && current.nodeToRestore && node.scopeRef && node.scopeRef.current && $9bf71ea28793e738$var$isElementInScope(current.nodeToRestore, node.scopeRef.current) && (current.nodeToRestore = node.nodeToRestore); 9156 let children = node.children; 9157 parentNode && (parentNode.removeChild(node), children.size > 0 && children.forEach((child) => parentNode && parentNode.addChild(child))), this.fastMap.delete(node.scopeRef); 9158 } 9159 // Pre Order Depth First 9160 *traverse(node = this.root) { 9161 if (node.scopeRef != null && (yield node), node.children.size > 0) for (let child of node.children) yield* this.traverse(child); 9162 } 9163 clone() { 9164 var _node_parent; 9165 let newTree = new _$9bf71ea28793e738$var$Tree(); 9166 var _node_parent_scopeRef; 9167 for (let node of this.traverse()) newTree.addTreeNode(node.scopeRef, (_node_parent_scopeRef = (_node_parent = node.parent) === null || _node_parent === void 0 ? void 0 : _node_parent.scopeRef) !== null && _node_parent_scopeRef !== void 0 ? _node_parent_scopeRef : null, node.nodeToRestore); 9168 return newTree; 9169 } 9170 constructor() { 9171 this.fastMap = /* @__PURE__ */ new Map(), this.root = new $9bf71ea28793e738$var$TreeNode({ 9172 scopeRef: null 9173 }), this.fastMap.set(null, this.root); 9174 } 9175}, $9bf71ea28793e738$var$TreeNode = class { 9176 addChild(node) { 9177 this.children.add(node), node.parent = this; 9178 } 9179 removeChild(node) { 9180 this.children.delete(node), node.parent = void 0; 9181 } 9182 constructor(props) { 9183 this.children = /* @__PURE__ */ new Set(), this.contain = !1, this.scopeRef = props.scopeRef; 9184 } 9185}, $9bf71ea28793e738$export$d06fae2ee68b101e = new $9bf71ea28793e738$var$Tree(); 9186 9187// ../../node_modules/@react-aria/focus/dist/useFocusRing.mjs 9188init_react(); 9189 9190// ../../node_modules/@react-aria/focus/dist/FocusRing.mjs 9191init_react(); 9192 9193// ../../node_modules/@react-aria/focus/dist/useHasTabbableChild.mjs 9194init_react(); 9195 9196// ../../node_modules/@react-aria/overlays/dist/useOverlay.mjs 9197init_react(); 9198 9199// ../../node_modules/@react-aria/overlays/dist/useOverlayTrigger.mjs 9200init_react(); 9201 9202// ../../node_modules/@react-aria/overlays/dist/usePreventScroll.mjs 9203var $49c51c25361d4cd2$var$visualViewport = typeof document < "u" && window.visualViewport; 9204 9205// ../../node_modules/@react-aria/overlays/dist/PortalProvider.mjs 9206init_react(); 9207var $96b38030c423d352$export$60d741e20e0aa309 = createContext({}); 9208function $96b38030c423d352$export$9fc1347d4195ccb3() { 9209 var _useContext; 9210 return (_useContext = useContext($96b38030c423d352$export$60d741e20e0aa309)) !== null && _useContext !== void 0 ? _useContext : {}; 9211} 9212 9213// ../../node_modules/@react-aria/overlays/dist/useModal.mjs 9214init_react(); 9215var $f57aed4a881a3485$var$Context = react_default.createContext(null); 9216function $f57aed4a881a3485$export$178405afcd8c5eb(props) { 9217 let { children } = props, parent = useContext($f57aed4a881a3485$var$Context), [modalCount, setModalCount] = useState(0), context = useMemo(() => ({ 9218 parent, 9219 modalCount, 9220 addModal() { 9221 setModalCount((count) => count + 1), parent && parent.addModal(); 9222 }, 9223 removeModal() { 9224 setModalCount((count) => count - 1), parent && parent.removeModal(); 9225 } 9226 }), [ 9227 parent, 9228 modalCount 9229 ]); 9230 return react_default.createElement($f57aed4a881a3485$var$Context.Provider, { 9231 value: context 9232 }, children); 9233} 9234function $f57aed4a881a3485$export$d9aaed4c3ece1bc0() { 9235 let context = useContext($f57aed4a881a3485$var$Context); 9236 return { 9237 modalProviderProps: { 9238 "aria-hidden": context && context.modalCount > 0 ? !0 : void 0 9239 } 9240 }; 9241} 9242function $f57aed4a881a3485$var$OverlayContainerDOM(props) { 9243 let { modalProviderProps } = $f57aed4a881a3485$export$d9aaed4c3ece1bc0(); 9244 return react_default.createElement("div", { 9245 "data-overlay-container": !0, 9246 ...props, 9247 ...modalProviderProps 9248 }); 9249} 9250function $f57aed4a881a3485$export$bf688221f59024e5(props) { 9251 return react_default.createElement($f57aed4a881a3485$export$178405afcd8c5eb, null, react_default.createElement($f57aed4a881a3485$var$OverlayContainerDOM, props)); 9252} 9253function $f57aed4a881a3485$export$b47c3594eab58386(props) { 9254 let isSSR = $b5e257d569688ac6$export$535bd6ca7f90a273(), { portalContainer = isSSR ? null : document.body, ...rest2 } = props, { getContainer } = $96b38030c423d352$export$9fc1347d4195ccb3(); 9255 if (!props.portalContainer && getContainer && (portalContainer = getContainer()), react_default.useEffect(() => { 9256 if (portalContainer?.closest("[data-overlay-container]")) throw new Error("An OverlayContainer must not be inside another container. Please change the portalContainer prop."); 9257 }, [ 9258 portalContainer 9259 ]), !portalContainer) return null; 9260 let contents = react_default.createElement($f57aed4a881a3485$export$bf688221f59024e5, rest2); 9261 return react_dom_default.createPortal(contents, portalContainer); 9262} 9263 9264// ../../node_modules/@react-aria/overlays/dist/ar-AE.mjs 9265var $773d5888b972f1cf$exports = {}; 9266$773d5888b972f1cf$exports = { 9267 dismiss: "\u062A\u062C\u0627\u0647\u0644" 9268}; 9269 9270// ../../node_modules/@react-aria/overlays/dist/bg-BG.mjs 9271var $d11f19852b941573$exports = {}; 9272$d11f19852b941573$exports = { 9273 dismiss: "\u041E\u0442\u0445\u0432\u044A\u0440\u043B\u044F\u043D\u0435" 9274}; 9275 9276// ../../node_modules/@react-aria/overlays/dist/cs-CZ.mjs 9277var $b983974c2ee1efb3$exports = {}; 9278$b983974c2ee1efb3$exports = { 9279 dismiss: "Odstranit" 9280}; 9281 9282// ../../node_modules/@react-aria/overlays/dist/da-DK.mjs 9283var $5809cc9d4e92de73$exports = {}; 9284$5809cc9d4e92de73$exports = { 9285 dismiss: "Luk" 9286}; 9287 9288// ../../node_modules/@react-aria/overlays/dist/de-DE.mjs 9289var $c68c2e4fc74398d1$exports = {}; 9290$c68c2e4fc74398d1$exports = { 9291 dismiss: "Schlie\xDFen" 9292}; 9293 9294// ../../node_modules/@react-aria/overlays/dist/el-GR.mjs 9295var $0898b4c153db2b77$exports = {}; 9296$0898b4c153db2b77$exports = { 9297 dismiss: "\u0391\u03C0\u03CC\u03C1\u03C1\u03B9\u03C8\u03B7" 9298}; 9299 9300// ../../node_modules/@react-aria/overlays/dist/en-US.mjs 9301var $6d74810286a15183$exports = {}; 9302$6d74810286a15183$exports = { 9303 dismiss: "Dismiss" 9304}; 9305 9306// ../../node_modules/@react-aria/overlays/dist/es-ES.mjs 9307var $309d73dc65f78055$exports = {}; 9308$309d73dc65f78055$exports = { 9309 dismiss: "Descartar" 9310}; 9311 9312// ../../node_modules/@react-aria/overlays/dist/et-EE.mjs 9313var $44ad94f7205cf593$exports = {}; 9314$44ad94f7205cf593$exports = { 9315 dismiss: "L\xF5peta" 9316}; 9317 9318// ../../node_modules/@react-aria/overlays/dist/fi-FI.mjs 9319var $7c28f5687f0779a9$exports = {}; 9320$7c28f5687f0779a9$exports = { 9321 dismiss: "Hylk\xE4\xE4" 9322}; 9323 9324// ../../node_modules/@react-aria/overlays/dist/fr-FR.mjs 9325var $e6d75df4b68bd73a$exports = {}; 9326$e6d75df4b68bd73a$exports = { 9327 dismiss: "Rejeter" 9328}; 9329 9330// ../../node_modules/@react-aria/overlays/dist/he-IL.mjs 9331var $87505c9dab186d0f$exports = {}; 9332$87505c9dab186d0f$exports = { 9333 dismiss: "\u05D4\u05EA\u05E2\u05DC\u05DD" 9334}; 9335 9336// ../../node_modules/@react-aria/overlays/dist/hr-HR.mjs 9337var $553439c3ffb3e492$exports = {}; 9338$553439c3ffb3e492$exports = { 9339 dismiss: "Odbaci" 9340}; 9341 9342// ../../node_modules/@react-aria/overlays/dist/hu-HU.mjs 9343var $74cf411061b983a2$exports = {}; 9344$74cf411061b983a2$exports = { 9345 dismiss: "Elutas\xEDt\xE1s" 9346}; 9347 9348// ../../node_modules/@react-aria/overlays/dist/it-IT.mjs 9349var $e933f298574dc435$exports = {}; 9350$e933f298574dc435$exports = { 9351 dismiss: "Ignora" 9352}; 9353 9354// ../../node_modules/@react-aria/overlays/dist/ja-JP.mjs 9355var $ac91fc9fe02f71f6$exports = {}; 9356$ac91fc9fe02f71f6$exports = { 9357 dismiss: "\u9589\u3058\u308B" 9358}; 9359 9360// ../../node_modules/@react-aria/overlays/dist/ko-KR.mjs 9361var $52b96f86422025af$exports = {}; 9362$52b96f86422025af$exports = { 9363 dismiss: "\uBB34\uC2DC" 9364}; 9365 9366// ../../node_modules/@react-aria/overlays/dist/lt-LT.mjs 9367var $c0d724c3e51dafa6$exports = {}; 9368$c0d724c3e51dafa6$exports = { 9369 dismiss: "Atmesti" 9370}; 9371 9372// ../../node_modules/@react-aria/overlays/dist/lv-LV.mjs 9373var $c92899672a3fe72e$exports = {}; 9374$c92899672a3fe72e$exports = { 9375 dismiss: "Ner\u0101d\u012Bt" 9376}; 9377 9378// ../../node_modules/@react-aria/overlays/dist/nb-NO.mjs 9379var $9f576b39d8e7a9d6$exports = {}; 9380$9f576b39d8e7a9d6$exports = { 9381 dismiss: "Lukk" 9382}; 9383 9384// ../../node_modules/@react-aria/overlays/dist/nl-NL.mjs 9385var $9d025808aeec81a7$exports = {}; 9386$9d025808aeec81a7$exports = { 9387 dismiss: "Negeren" 9388}; 9389 9390// ../../node_modules/@react-aria/overlays/dist/pl-PL.mjs 9391var $fce709921e2c0fa6$exports = {}; 9392$fce709921e2c0fa6$exports = { 9393 dismiss: "Zignoruj" 9394}; 9395 9396// ../../node_modules/@react-aria/overlays/dist/pt-BR.mjs 9397var $2599cf0c4ab37f59$exports = {}; 9398$2599cf0c4ab37f59$exports = { 9399 dismiss: "Descartar" 9400}; 9401 9402// ../../node_modules/@react-aria/overlays/dist/pt-PT.mjs 9403var $3c220ae7ef8a35fd$exports = {}; 9404$3c220ae7ef8a35fd$exports = { 9405 dismiss: "Dispensar" 9406}; 9407 9408// ../../node_modules/@react-aria/overlays/dist/ro-RO.mjs 9409var $93562b5094072f54$exports = {}; 9410$93562b5094072f54$exports = { 9411 dismiss: "Revocare" 9412}; 9413 9414// ../../node_modules/@react-aria/overlays/dist/ru-RU.mjs 9415var $cd9e2abd0d06c7b4$exports = {}; 9416$cd9e2abd0d06c7b4$exports = { 9417 dismiss: "\u041F\u0440\u043E\u043F\u0443\u0441\u0442\u0438\u0442\u044C" 9418}; 9419 9420// ../../node_modules/@react-aria/overlays/dist/sk-SK.mjs 9421var $45375701f409adf1$exports = {}; 9422$45375701f409adf1$exports = { 9423 dismiss: "Zru\u0161i\u0165" 9424}; 9425 9426// ../../node_modules/@react-aria/overlays/dist/sl-SI.mjs 9427var $27fab53a576de9dd$exports = {}; 9428$27fab53a576de9dd$exports = { 9429 dismiss: "Opusti" 9430}; 9431 9432// ../../node_modules/@react-aria/overlays/dist/sr-SP.mjs 9433var $4438748d9952e7c7$exports = {}; 9434$4438748d9952e7c7$exports = { 9435 dismiss: "Odbaci" 9436}; 9437 9438// ../../node_modules/@react-aria/overlays/dist/sv-SE.mjs 9439var $0936d7347ef4da4c$exports = {}; 9440$0936d7347ef4da4c$exports = { 9441 dismiss: "Avvisa" 9442}; 9443 9444// ../../node_modules/@react-aria/overlays/dist/tr-TR.mjs 9445var $29700c92185d38f8$exports = {}; 9446$29700c92185d38f8$exports = { 9447 dismiss: "Kapat" 9448}; 9449 9450// ../../node_modules/@react-aria/overlays/dist/uk-UA.mjs 9451var $662ccaf2be4c25b3$exports = {}; 9452$662ccaf2be4c25b3$exports = { 9453 dismiss: "\u0421\u043A\u0430\u0441\u0443\u0432\u0430\u0442\u0438" 9454}; 9455 9456// ../../node_modules/@react-aria/overlays/dist/zh-CN.mjs 9457var $d80a27deda7cdb3c$exports = {}; 9458$d80a27deda7cdb3c$exports = { 9459 dismiss: "\u53D6\u6D88" 9460}; 9461 9462// ../../node_modules/@react-aria/overlays/dist/zh-TW.mjs 9463var $2b2734393847c884$exports = {}; 9464$2b2734393847c884$exports = { 9465 dismiss: "\u95DC\u9589" 9466}; 9467 9468// ../../node_modules/@react-aria/overlays/dist/intlStrings.mjs 9469var $a2f21f5f14f60553$exports = {}; 9470$a2f21f5f14f60553$exports = { 9471 "ar-AE": $773d5888b972f1cf$exports, 9472 "bg-BG": $d11f19852b941573$exports, 9473 "cs-CZ": $b983974c2ee1efb3$exports, 9474 "da-DK": $5809cc9d4e92de73$exports, 9475 "de-DE": $c68c2e4fc74398d1$exports, 9476 "el-GR": $0898b4c153db2b77$exports, 9477 "en-US": $6d74810286a15183$exports, 9478 "es-ES": $309d73dc65f78055$exports, 9479 "et-EE": $44ad94f7205cf593$exports, 9480 "fi-FI": $7c28f5687f0779a9$exports, 9481 "fr-FR": $e6d75df4b68bd73a$exports, 9482 "he-IL": $87505c9dab186d0f$exports, 9483 "hr-HR": $553439c3ffb3e492$exports, 9484 "hu-HU": $74cf411061b983a2$exports, 9485 "it-IT": $e933f298574dc435$exports, 9486 "ja-JP": $ac91fc9fe02f71f6$exports, 9487 "ko-KR": $52b96f86422025af$exports, 9488 "lt-LT": $c0d724c3e51dafa6$exports, 9489 "lv-LV": $c92899672a3fe72e$exports, 9490 "nb-NO": $9f576b39d8e7a9d6$exports, 9491 "nl-NL": $9d025808aeec81a7$exports, 9492 "pl-PL": $fce709921e2c0fa6$exports, 9493 "pt-BR": $2599cf0c4ab37f59$exports, 9494 "pt-PT": $3c220ae7ef8a35fd$exports, 9495 "ro-RO": $93562b5094072f54$exports, 9496 "ru-RU": $cd9e2abd0d06c7b4$exports, 9497 "sk-SK": $45375701f409adf1$exports, 9498 "sl-SI": $27fab53a576de9dd$exports, 9499 "sr-SP": $4438748d9952e7c7$exports, 9500 "sv-SE": $0936d7347ef4da4c$exports, 9501 "tr-TR": $29700c92185d38f8$exports, 9502 "uk-UA": $662ccaf2be4c25b3$exports, 9503 "zh-CN": $d80a27deda7cdb3c$exports, 9504 "zh-TW": $2b2734393847c884$exports 9505}; 9506 9507// ../../node_modules/@react-aria/overlays/dist/DismissButton.mjs 9508init_react(); 9509 9510// ../../node_modules/@react-aria/visually-hidden/dist/VisuallyHidden.mjs 9511init_react(); 9512 9513// ../../node_modules/@react-aria/overlays/dist/ariaHideOutside.mjs 9514var $5e3802645cc19319$var$supportsInert = typeof HTMLElement < "u" && "inert" in HTMLElement.prototype; 9515 9516// ../../node_modules/@react-aria/overlays/dist/usePopover.mjs 9517init_react(); 9518 9519// ../../node_modules/@react-aria/overlays/dist/Overlay.mjs 9520init_react(); 9521var $337b884510726a0d$export$a2200b96afd16271 = react_default.createContext(null); 9522 9523// ../../node_modules/@react-aria/overlays/dist/useModalOverlay.mjs 9524init_react(); 9525 9526// ../../node_modules/@react-stately/tooltip/dist/useTooltipTriggerState.mjs 9527init_react(); 9528 9529// ../../node_modules/@react-stately/overlays/dist/useOverlayTriggerState.mjs 9530init_react(); 9531function $fc909762b330b746$export$61c6a8c84e605fb6(props) { 9532 let [isOpen, setOpen] = $458b0a5536c1a7cf$export$40bfa8c7b0832715(props.isOpen, props.defaultOpen || !1, props.onOpenChange), open = useCallback(() => { 9533 setOpen(!0); 9534 }, [ 9535 setOpen 9536 ]), close = useCallback(() => { 9537 setOpen(!1); 9538 }, [ 9539 setOpen 9540 ]), toggle = useCallback(() => { 9541 setOpen(!isOpen); 9542 }, [ 9543 setOpen, 9544 isOpen 9545 ]); 9546 return { 9547 isOpen, 9548 setOpen, 9549 open, 9550 close, 9551 toggle 9552 }; 9553} 9554 9555// ../../node_modules/@react-stately/tooltip/dist/useTooltipTriggerState.mjs 9556var $8796f90736e175cb$var$TOOLTIP_DELAY = 1500, $8796f90736e175cb$var$TOOLTIP_COOLDOWN = 500, $8796f90736e175cb$var$tooltips = {}, $8796f90736e175cb$var$tooltipId = 0, $8796f90736e175cb$var$globalWarmedUp = !1, $8796f90736e175cb$var$globalWarmUpTimeout = null, $8796f90736e175cb$var$globalCooldownTimeout = null; 9557function $8796f90736e175cb$export$4d40659c25ecb50b(props = {}) { 9558 let { delay: delay2 = $8796f90736e175cb$var$TOOLTIP_DELAY, closeDelay = $8796f90736e175cb$var$TOOLTIP_COOLDOWN } = props, { isOpen, open, close } = $fc909762b330b746$export$61c6a8c84e605fb6(props), id = useMemo(() => `${++$8796f90736e175cb$var$tooltipId}`, []), closeTimeout = useRef(null), closeCallback = useRef(close), ensureTooltipEntry = () => { 9559 $8796f90736e175cb$var$tooltips[id] = hideTooltip; 9560 }, closeOpenTooltips = () => { 9561 for (let hideTooltipId in $8796f90736e175cb$var$tooltips) hideTooltipId !== id && ($8796f90736e175cb$var$tooltips[hideTooltipId](!0), delete $8796f90736e175cb$var$tooltips[hideTooltipId]); 9562 }, showTooltip = () => { 9563 closeTimeout.current && clearTimeout(closeTimeout.current), closeTimeout.current = null, closeOpenTooltips(), ensureTooltipEntry(), $8796f90736e175cb$var$globalWarmedUp = !0, open(), $8796f90736e175cb$var$globalWarmUpTimeout && (clearTimeout($8796f90736e175cb$var$globalWarmUpTimeout), $8796f90736e175cb$var$globalWarmUpTimeout = null), $8796f90736e175cb$var$globalCooldownTimeout && (clearTimeout($8796f90736e175cb$var$globalCooldownTimeout), $8796f90736e175cb$var$globalCooldownTimeout = null); 9564 }, hideTooltip = (immediate) => { 9565 immediate || closeDelay <= 0 ? (closeTimeout.current && clearTimeout(closeTimeout.current), closeTimeout.current = null, closeCallback.current()) : closeTimeout.current || (closeTimeout.current = setTimeout(() => { 9566 closeTimeout.current = null, closeCallback.current(); 9567 }, closeDelay)), $8796f90736e175cb$var$globalWarmUpTimeout && (clearTimeout($8796f90736e175cb$var$globalWarmUpTimeout), $8796f90736e175cb$var$globalWarmUpTimeout = null), $8796f90736e175cb$var$globalWarmedUp && ($8796f90736e175cb$var$globalCooldownTimeout && clearTimeout($8796f90736e175cb$var$globalCooldownTimeout), $8796f90736e175cb$var$globalCooldownTimeout = setTimeout(() => { 9568 delete $8796f90736e175cb$var$tooltips[id], $8796f90736e175cb$var$globalCooldownTimeout = null, $8796f90736e175cb$var$globalWarmedUp = !1; 9569 }, Math.max($8796f90736e175cb$var$TOOLTIP_COOLDOWN, closeDelay))); 9570 }, warmupTooltip = () => { 9571 closeOpenTooltips(), ensureTooltipEntry(), !isOpen && !$8796f90736e175cb$var$globalWarmUpTimeout && !$8796f90736e175cb$var$globalWarmedUp ? $8796f90736e175cb$var$globalWarmUpTimeout = setTimeout(() => { 9572 $8796f90736e175cb$var$globalWarmUpTimeout = null, $8796f90736e175cb$var$globalWarmedUp = !0, showTooltip(); 9573 }, delay2) : isOpen || showTooltip(); 9574 }; 9575 return useEffect(() => { 9576 closeCallback.current = close; 9577 }, [ 9578 close 9579 ]), useEffect(() => () => { 9580 closeTimeout.current && clearTimeout(closeTimeout.current), $8796f90736e175cb$var$tooltips[id] && delete $8796f90736e175cb$var$tooltips[id]; 9581 }, [ 9582 id 9583 ]), { 9584 isOpen, 9585 open: (immediate) => { 9586 !immediate && delay2 > 0 && !closeTimeout.current ? warmupTooltip() : showTooltip(); 9587 }, 9588 close: hideTooltip 9589 }; 9590} 9591 9592// ../../node_modules/react-aria-components/dist/Tooltip.mjs 9593init_react(); 9594var $4e3b923658d69c60$export$7a7623236eec67fa = createContext(null), $4e3b923658d69c60$export$39ae08fa83328b12 = createContext(null); 9595function $4e3b923658d69c60$export$8c610744efcf8a1d(props) { 9596 let state = $8796f90736e175cb$export$4d40659c25ecb50b(props), ref = useRef(null), { triggerProps, tooltipProps } = $4e1b34546679e357$export$a6da6c504e4bba8b(props, state, ref); 9597 return react_default.createElement($64fa3d84918910a7$export$2881499e37b75b9a, { 9598 values: [ 9599 [ 9600 $4e3b923658d69c60$export$7a7623236eec67fa, 9601 state 9602 ], 9603 [ 9604 $4e3b923658d69c60$export$39ae08fa83328b12, 9605 { 9606 ...tooltipProps, 9607 triggerRef: ref 9608 } 9609 ] 9610 ] 9611 }, react_default.createElement($f645667febf57a63$export$13f3202a3e5ddd5, { 9612 ...triggerProps, 9613 ref 9614 }, props.children)); 9615} 9616var $4e3b923658d69c60$export$28c660c63b792dea = forwardRef(function({ UNSTABLE_portalContainer, ...props }, ref) { 9617 [props, ref] = $64fa3d84918910a7$export$29f1550f4b0d4415(props, ref, $4e3b923658d69c60$export$39ae08fa83328b12); 9618 let contextState = useContext($4e3b923658d69c60$export$7a7623236eec67fa), localState = $8796f90736e175cb$export$4d40659c25ecb50b(props), state = props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState, isExiting = $d3f049242431219c$export$45fda7c47f93fd48(ref, state.isOpen) || props.isExiting || !1; 9619 return !state.isOpen && !isExiting ? null : react_default.createElement($f57aed4a881a3485$export$b47c3594eab58386, { 9620 portalContainer: UNSTABLE_portalContainer 9621 }, react_default.createElement($4e3b923658d69c60$var$TooltipInner, { 9622 ...props, 9623 tooltipRef: ref, 9624 isExiting 9625 })); 9626}); 9627function $4e3b923658d69c60$var$TooltipInner(props) { 9628 let state = useContext($4e3b923658d69c60$export$7a7623236eec67fa), arrowRef = useRef(null), { overlayProps, arrowProps, placement, triggerAnchorPoint } = $2a41e45df1593e64$export$d39e1813b3bdd0e1({ 9629 placement: props.placement || "top", 9630 targetRef: props.triggerRef, 9631 overlayRef: props.tooltipRef, 9632 arrowRef, 9633 offset: props.offset, 9634 crossOffset: props.crossOffset, 9635 isOpen: state.isOpen, 9636 arrowBoundaryOffset: props.arrowBoundaryOffset, 9637 shouldFlip: props.shouldFlip, 9638 containerPadding: props.containerPadding, 9639 onClose: () => state.close(!0) 9640 }), isEntering = $d3f049242431219c$export$6d3443f2c48bfc20(props.tooltipRef, !!placement) || props.isEntering || !1, renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({ 9641 ...props, 9642 defaultClassName: "react-aria-Tooltip", 9643 values: { 9644 placement, 9645 isEntering, 9646 isExiting: props.isExiting, 9647 state 9648 } 9649 }); 9650 props = $3ef42575df84b30b$export$9d1611c77c2fe928(props, overlayProps); 9651 let { tooltipProps } = $326e436e94273fe1$export$1c4b08e0eca38426(props, state), DOMProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, { 9652 global: !0 9653 }); 9654 return react_default.createElement("div", { 9655 ...$3ef42575df84b30b$export$9d1611c77c2fe928(DOMProps, renderProps, tooltipProps), 9656 ref: props.tooltipRef, 9657 style: { 9658 ...overlayProps.style, 9659 "--trigger-anchor-point": triggerAnchorPoint ? `${triggerAnchorPoint.x}px ${triggerAnchorPoint.y}px` : void 0, 9660 ...renderProps.style 9661 }, 9662 "data-placement": placement ?? void 0, 9663 "data-entering": isEntering || void 0, 9664 "data-exiting": props.isExiting || void 0 9665 }, react_default.createElement($44f671af83e7d9e0$export$2de4954e8ae13b9f.Provider, { 9666 value: { 9667 ...arrowProps, 9668 placement, 9669 ref: arrowRef 9670 } 9671 }, renderProps.children)); 9672} 9673 9674// src/components/components/shared/overlayHelpers.tsx 9675init_react(); 9676var import_memoizerific = __toESM(require_memoizerific(), 1); 9677var convertToReactAriaPlacement2 = (0, import_memoizerific.default)(1e3)((p2) => p2 === "left-end" ? "left bottom" : p2 === "right-end" ? "right bottom" : p2 === "left-start" ? "left top" : p2 === "right-start" ? "right top" : p2.replace("-", " ")), Container5 = styled.div({ 9678 width: 500, 9679 height: 500, 9680 paddingTop: 100, 9681 overflowY: "scroll", 9682 background: "#eee", 9683 position: "relative" 9684}), Trigger = forwardRef((props, ref) => react_default.createElement( 9685 "button", 9686 { 9687 ...props, 9688 ref, 9689 style: { 9690 width: 120, 9691 height: 50, 9692 margin: 10 9693 } 9694 } 9695)); 9696Trigger.displayName = "Trigger"; 9697 9698// src/components/components/tooltip/TooltipProvider.tsx 9699var TooltipProvider2 = ({ 9700 triggerOnFocusOnly = !1, 9701 placement: placementProp = "top", 9702 offset: offset2 = 8, 9703 tooltip, 9704 children, 9705 defaultVisible, 9706 startOpen, 9707 delayShow = 400, 9708 delayHide = 200, 9709 visible, 9710 onVisibleChange, 9711 ...props 9712}) => { 9713 let placement = convertToReactAriaPlacement2(placementProp), child = react_default.Children.only(children); 9714 startOpen !== void 0 && deprecate("The `startOpen` prop is deprecated. Please use `defaultVisible` instead."); 9715 let [isOpen, setIsOpen] = useState(defaultVisible ?? startOpen ?? !1), onOpenChange = useCallback( 9716 (isOpen2) => { 9717 setIsOpen(isOpen2), onVisibleChange?.(isOpen2); 9718 }, 9719 [onVisibleChange] 9720 ); 9721 return react_default.createElement( 9722 $4e3b923658d69c60$export$8c610744efcf8a1d, 9723 { 9724 delay: delayShow, 9725 closeDelay: delayHide, 9726 isOpen: visible ?? isOpen, 9727 onOpenChange, 9728 trigger: triggerOnFocusOnly ? "focus" : void 0, 9729 ...props 9730 }, 9731 react_default.createElement($f645667febf57a63$export$35a3bebf7ef2d934, null, react_default.cloneElement(child, { "aria-describedby": null })), 9732 react_default.createElement( 9733 $4e3b923658d69c60$export$28c660c63b792dea, 9734 { 9735 "data-testid": "tooltip", 9736 placement, 9737 offset: offset2, 9738 onOpenChange, 9739 style: { outline: "none" }, 9740 ...props 9741 }, 9742 tooltip 9743 ) 9744 ); 9745}; 9746 9747// src/manager/components/layout/Drag.tsx 9748var oppositePosition = { 9749 left: "right", 9750 right: "left", 9751 top: "bottom", 9752 bottom: "top" 9753}, Drag = forwardRef(function(props, ref) { 9754 let { 9755 overlapping, 9756 position, 9757 "aria-label": ariaLabel, 9758 "aria-valuenow": ariaValueNow, 9759 "aria-valuemax": ariaValueMax, 9760 ...rest2 9761 } = props, orientation = position === "left" || position === "right" ? "vertical" : "horizontal", tooltipNote = orientation === "vertical" ? "\u2190 \u2192 to resize" : "\u2191 \u2193 to resize"; 9762 return react_default.createElement( 9763 TooltipProvider2, 9764 { 9765 triggerOnFocusOnly: !0, 9766 placement: oppositePosition[position], 9767 tooltip: react_default.createElement(TooltipNote2, { note: tooltipNote }) 9768 }, 9769 react_default.createElement( 9770 DragHandle, 9771 { 9772 ref, 9773 $orientation: orientation, 9774 $overlapping: overlapping, 9775 $position: position, 9776 role: "separator", 9777 tabIndex: 0, 9778 "aria-orientation": orientation, 9779 "aria-label": ariaLabel, 9780 "aria-valuenow": ariaValueNow, 9781 "aria-valuemin": 0, 9782 "aria-valuemax": ariaValueMax, 9783 ...rest2 9784 } 9785 ) 9786 ); 9787}), DragHandle = styled.div( 9788 ({ theme }) => ({ 9789 position: "absolute", 9790 opacity: 0, 9791 transition: "opacity 0.2s ease-in-out", 9792 zIndex: 100, 9793 "&:after": { 9794 content: '""', 9795 display: "block", 9796 backgroundColor: theme.color.secondary 9797 }, 9798 "&:hover": { 9799 opacity: 1 9800 } 9801 }), 9802 ({ theme, $orientation = "vertical" }) => ({ 9803 "&:focus-visible": { 9804 opacity: 1, 9805 outline: "2px solid transparent", 9806 ...$orientation === "horizontal" ? { height: 7 } : { width: 7 }, 9807 boxShadow: `inset 0 0 0 4px ${theme.color.secondary}`, 9808 "@media (forced-colors: active)": { 9809 outline: "2px solid Highlight" 9810 } 9811 } 9812 }), 9813 ({ $orientation = "vertical", $overlapping = !0, $position = "left" }) => $orientation === "vertical" ? { 9814 // This is an old code smell, where 10px matches the sidebar and 13px matches the addon panel. 9815 // It should be tidied up at some point. 9816 width: $overlapping ? $position === "left" ? 10 : 13 : 7, 9817 height: "100%", 9818 top: 0, 9819 right: $position === "left" ? -7 : void 0, 9820 left: $position === "right" ? -7 : void 0, 9821 "&:after": { 9822 width: 1, 9823 height: "100%", 9824 marginLeft: $position === "left" ? 3 : 6 9825 }, 9826 "&:hover": { 9827 cursor: "col-resize" 9828 } 9829 } : { 9830 width: "100%", 9831 height: $overlapping ? 13 : 7, 9832 top: $position === "bottom" ? -7 : void 0, 9833 bottom: $position === "top" ? -7 : void 0, 9834 left: 0, 9835 "&:after": { 9836 width: "100%", 9837 height: 1, 9838 marginTop: 6 9839 }, 9840 "&:hover": { 9841 cursor: "row-resize" 9842 } 9843 } 9844); 9845 9846// src/manager/components/layout/PanelContainer.tsx 9847var Container6 = styled.div(({ theme, position }) => ({ 9848 gridArea: "panel", 9849 position: "relative", 9850 backgroundColor: theme.appContentBg, 9851 borderTop: position === "bottom" ? `1px solid ${theme.appBorderColor}` : void 0, 9852 borderLeft: position === "right" ? `1px solid ${theme.appBorderColor}` : void 0 9853})), PanelSlot = styled.div({ 9854 height: "100%" 9855}), PanelContainer = react_default.memo(function(props) { 9856 let { children, bottomPanelHeight, rightPanelWidth, panelMaxSize, panelResizerRef, position } = props, shouldHidePanelContent = position === "bottom" ? bottomPanelHeight === 0 : rightPanelWidth === 0; 9857 return react_default.createElement(Container6, { position }, react_default.createElement( 9858 Drag, 9859 { 9860 ref: panelResizerRef, 9861 position, 9862 overlapping: position === "bottom" ? !!bottomPanelHeight : !!rightPanelWidth, 9863 "aria-label": "Addon panel resize handle", 9864 "aria-valuenow": position === "bottom" ? bottomPanelHeight : rightPanelWidth, 9865 "aria-valuemax": panelMaxSize 9866 } 9867 ), react_default.createElement( 9868 PanelSlot, 9869 { 9870 hidden: shouldHidePanelContent ? !0 : void 0, 9871 "aria-hidden": shouldHidePanelContent ? !0 : void 0 9872 }, 9873 children 9874 )); 9875}); 9876 9877// src/manager/components/layout/SidebarContainer.tsx 9878init_react(); 9879var Container7 = styled.div(({ theme }) => ({ 9880 backgroundColor: theme.appBg, 9881 gridArea: "sidebar", 9882 position: "relative", 9883 borderRight: `1px solid ${theme.appBorderColor}` 9884})), SidebarSlot = styled.div({ 9885 height: "100%" 9886}), SidebarContainer = react_default.memo(function(props) { 9887 let { children, navSize, sidebarMaxWidth, sidebarResizerRef } = props, shouldHideSidebarContent = navSize === 0; 9888 return react_default.createElement(Container7, null, react_default.createElement( 9889 SidebarSlot, 9890 { 9891 hidden: shouldHideSidebarContent ? !0 : void 0, 9892 "aria-hidden": shouldHideSidebarContent ? !0 : void 0 9893 }, 9894 children 9895 ), react_default.createElement( 9896 Drag, 9897 { 9898 ref: sidebarResizerRef, 9899 position: "left", 9900 "aria-label": "Sidebar resize handle", 9901 "aria-valuenow": navSize, 9902 "aria-valuemax": sidebarMaxWidth 9903 } 9904 )); 9905}); 9906 9907// src/manager/components/layout/useDragging.ts 9908init_react(); 9909var SNAP_THRESHOLD_PX = 30, STIFFNESS = 0.9, KEYBOARD_STEP_PX = 10, KEYBOARD_SHIFT_MULTIPLIER = 5, RESIZE_KEYS = ["ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", "Home", "End"]; 9910function clamp(value, min, max) { 9911 return Math.min(Math.max(value, min), max); 9912} 9913function interpolate(relativeValue, min, max) { 9914 return min + (max - min) * relativeValue; 9915} 9916function computeSidebarMaxWidth(panelPosition, rightPanelWidth, showPanel) { 9917 if (typeof window > "u") 9918 return 0; 9919 let panelWidth = showPanel ? panelPosition === "right" ? rightPanelWidth : 360 : 0; 9920 return Math.max(window.innerWidth - 100 - panelWidth, 0); 9921} 9922function computePanelMaxSize(panelPosition, navSize) { 9923 return typeof window > "u" ? 0 : Math.max(panelPosition === "bottom" ? window.innerHeight - 40 : window.innerWidth - 100 - navSize, 0); 9924} 9925function applyResizeKeyboard(state, sizeKey, key, step, minSize, maxSize, increaseKey, decreaseKey) { 9926 let currentSize = state[sizeKey]; 9927 switch (key) { 9928 case increaseKey: 9929 return { ...state, [sizeKey]: clamp(currentSize + step, minSize, maxSize) }; 9930 case decreaseKey: 9931 let effectivelyComputed = clamp(currentSize - step, 0, maxSize); 9932 return { ...state, [sizeKey]: effectivelyComputed < minSize ? 0 : effectivelyComputed }; 9933 case "Home": 9934 return { ...state, [sizeKey]: 0 }; 9935 case "End": 9936 return { ...state, [sizeKey]: maxSize }; 9937 default: 9938 return state; 9939 } 9940} 9941function useDragging({ 9942 setState, 9943 showPanel, 9944 isDesktop, 9945 navSize, 9946 rightPanelWidth, 9947 panelPosition 9948}) { 9949 let panelResizerRef = useRef(null), sidebarResizerRef = useRef(null), sidebarMaxWidth = computeSidebarMaxWidth(panelPosition, rightPanelWidth, showPanel), panelMaxSize = computePanelMaxSize(panelPosition, navSize); 9950 return useEffect(() => { 9951 let panelResizer = panelResizerRef.current, sidebarResizer = sidebarResizerRef.current, draggedElement = null, onDragStart = (e2) => { 9952 e2.preventDefault(), e2.currentTarget === panelResizer ? draggedElement = panelResizer : e2.currentTarget === sidebarResizer && (draggedElement = sidebarResizer), setState((state) => ({ 9953 ...state, 9954 isDragging: !0, 9955 dragCursor: draggedElement === panelResizer && state.panelPosition === "bottom" ? "row-resize" : "col-resize" 9956 })), window.addEventListener("mousemove", onDrag), window.addEventListener("mouseup", onDragEnd); 9957 }, onDragEnd = () => { 9958 setState((state) => { 9959 if (draggedElement === sidebarResizer && state.navSize < 240 && state.navSize > 0) 9960 return { 9961 ...state, 9962 isDragging: !1, 9963 navSize: 240 9964 }; 9965 if (draggedElement === panelResizer) { 9966 if (state.panelPosition === "right" && state.rightPanelWidth < 270 && state.rightPanelWidth > 0) 9967 return { 9968 ...state, 9969 isDragging: !1, 9970 rightPanelWidth: 270 9971 }; 9972 if (state.panelPosition === "bottom" && state.bottomPanelHeight < 40 && state.bottomPanelHeight > 0) 9973 return { 9974 ...state, 9975 isDragging: !1, 9976 bottomPanelHeight: 40 9977 }; 9978 } 9979 return { 9980 ...state, 9981 isDragging: !1 9982 }; 9983 }), window.removeEventListener("mousemove", onDrag), window.removeEventListener("mouseup", onDragEnd), draggedElement = null; 9984 }, onDrag = (e2) => { 9985 if (e2.buttons === 0) { 9986 onDragEnd(); 9987 return; 9988 } 9989 setState((state) => { 9990 if (draggedElement === sidebarResizer) { 9991 let sidebarDragX = e2.clientX; 9992 return sidebarDragX === state.navSize ? state : sidebarDragX <= SNAP_THRESHOLD_PX ? { 9993 ...state, 9994 navSize: 0 9995 } : sidebarDragX <= 240 ? { 9996 ...state, 9997 navSize: interpolate(STIFFNESS, sidebarDragX, 240) 9998 } : { 9999 ...state, 10000 navSize: clamp( 10001 sidebarDragX, 10002 0, 10003 computeSidebarMaxWidth(state.panelPosition, state.rightPanelWidth, showPanel) 10004 ) 10005 }; 10006 } 10007 if (draggedElement === panelResizer) { 10008 let sizeAxisState = state.panelPosition === "bottom" ? "bottomPanelHeight" : "rightPanelWidth", panelDragSize = state.panelPosition === "bottom" ? ( 10009 // @ts-expect-error (non strict) 10010 e2.view.innerHeight - e2.clientY 10011 ) : ( 10012 // @ts-expect-error (non strict) 10013 e2.view.innerWidth - e2.clientX 10014 ), minimumSize = state.panelPosition === "bottom" ? 40 : 270; 10015 return panelDragSize === state[sizeAxisState] ? state : panelDragSize <= SNAP_THRESHOLD_PX ? { 10016 ...state, 10017 [sizeAxisState]: 0 10018 } : panelDragSize <= minimumSize ? { 10019 ...state, 10020 [sizeAxisState]: interpolate(STIFFNESS, panelDragSize, minimumSize) 10021 } : { 10022 ...state, 10023 [sizeAxisState]: clamp( 10024 panelDragSize, 10025 0, 10026 computePanelMaxSize(state.panelPosition, state.navSize) 10027 ) 10028 }; 10029 } 10030 return state; 10031 }); 10032 }, onSidebarKeyDown = (e2) => { 10033 if (!RESIZE_KEYS.includes(e2.key)) 10034 return; 10035 e2.preventDefault(); 10036 let step = e2.shiftKey ? KEYBOARD_STEP_PX * KEYBOARD_SHIFT_MULTIPLIER : KEYBOARD_STEP_PX; 10037 setState( 10038 (state) => applyResizeKeyboard( 10039 state, 10040 "navSize", 10041 e2.key, 10042 step, 10043 240, 10044 computeSidebarMaxWidth(state.panelPosition, state.rightPanelWidth, showPanel), 10045 "ArrowRight", 10046 "ArrowLeft" 10047 ) 10048 ); 10049 }, onPanelKeyDown = (e2) => { 10050 if (!RESIZE_KEYS.includes(e2.key)) 10051 return; 10052 e2.preventDefault(); 10053 let step = e2.shiftKey ? KEYBOARD_STEP_PX * KEYBOARD_SHIFT_MULTIPLIER : KEYBOARD_STEP_PX; 10054 setState( 10055 (state) => applyResizeKeyboard( 10056 state, 10057 state.panelPosition === "bottom" ? "bottomPanelHeight" : "rightPanelWidth", 10058 e2.key, 10059 step, 10060 state.panelPosition === "bottom" ? 40 : 270, 10061 computePanelMaxSize(state.panelPosition, state.navSize), 10062 state.panelPosition === "bottom" ? "ArrowUp" : "ArrowLeft", 10063 state.panelPosition === "bottom" ? "ArrowDown" : "ArrowRight" 10064 ) 10065 ); 10066 }; 10067 return panelResizer?.addEventListener("mousedown", onDragStart), sidebarResizer?.addEventListener("mousedown", onDragStart), panelResizer?.addEventListener("keydown", onPanelKeyDown), sidebarResizer?.addEventListener("keydown", onSidebarKeyDown), () => { 10068 panelResizer?.removeEventListener("mousedown", onDragStart), sidebarResizer?.removeEventListener("mousedown", onDragStart), panelResizer?.removeEventListener("keydown", onPanelKeyDown), sidebarResizer?.removeEventListener("keydown", onSidebarKeyDown); 10069 }; 10070 }, [ 10071 // we need to rerun this effect when the panel is shown/hidden or when changing between mobile/desktop to re-attach the event listeners 10072 showPanel, 10073 isDesktop, 10074 setState 10075 ]), { panelResizerRef, sidebarResizerRef, sidebarMaxWidth, panelMaxSize }; 10076} 10077 10078// src/manager/components/layout/useLandmarkIndicator.ts 10079init_react(); 10080function findActiveLandmarkElement() { 10081 let currentElement = document.activeElement, landmarkElement = null; 10082 for (; currentElement; ) { 10083 if (currentElement instanceof HTMLElement && currentElement.hasAttribute("data-sb-landmark")) { 10084 landmarkElement = currentElement; 10085 break; 10086 } 10087 currentElement = currentElement.parentElement; 10088 } 10089 return landmarkElement; 10090} 10091function useRegionFocusAnimation() { 10092 let theme = useTheme(), reducedMotion = useMediaQuery("(prefers-reduced-motion: reduce)"), currentAnimationRef = useRef(null); 10093 return (elementToAnimate) => { 10094 if (elementToAnimate && (currentAnimationRef.current && (currentAnimationRef.current.cancel(), currentAnimationRef.current = null), !reducedMotion)) { 10095 let animation = elementToAnimate.animate( 10096 [{ border: `2px solid ${theme.color.primary}` }, { border: "2px solid transparent" }], 10097 { 10098 duration: 1500, 10099 pseudoElement: "::after" 10100 } 10101 ); 10102 currentAnimationRef.current = animation, animation.onfinish = () => { 10103 currentAnimationRef.current = null; 10104 }; 10105 } 10106 }; 10107} 10108function useLandmarkIndicator() { 10109 let animateLandmark = useRegionFocusAnimation(); 10110 useEffect(() => { 10111 let handleKeyDown = (e2) => { 10112 if (e2.key !== "F6") 10113 return; 10114 let landmarkElement = findActiveLandmarkElement(); 10115 landmarkElement && animateLandmark(landmarkElement); 10116 }; 10117 return document.addEventListener("keydown", handleKeyDown, { capture: !0 }), () => { 10118 document.removeEventListener("keydown", handleKeyDown, { capture: !0 }); 10119 }; 10120 }, [animateLandmark]); 10121} 10122 10123// src/manager/components/layout/Layout.tsx 10124var layoutStateIsEqual = (state, other) => state.navSize === other.navSize && state.bottomPanelHeight === other.bottomPanelHeight && state.rightPanelWidth === other.rightPanelWidth && state.panelPosition === other.panelPosition, useLayoutSyncingState = ({ 10125 api, 10126 managerLayoutState, 10127 setManagerLayoutState, 10128 isDesktop, 10129 hasTab 10130}) => { 10131 let prevManagerLayoutStateRef = react_default.useRef(managerLayoutState), [internalDraggingSizeState, setInternalDraggingSizeState] = useState({ 10132 ...managerLayoutState, 10133 isDragging: !1, 10134 dragCursor: "col-resize" 10135 }); 10136 useEffect(() => { 10137 internalDraggingSizeState.isDragging || // don't interrupt user's drag 10138 layoutStateIsEqual(managerLayoutState, prevManagerLayoutStateRef.current) || (prevManagerLayoutStateRef.current = managerLayoutState, setInternalDraggingSizeState((state) => ({ ...state, ...managerLayoutState }))); 10139 }, [internalDraggingSizeState.isDragging, managerLayoutState, setInternalDraggingSizeState]), useLayoutEffect(() => { 10140 if (internalDraggingSizeState.isDragging || // wait with syncing managerLayoutState until user is done dragging 10141 layoutStateIsEqual(managerLayoutState, internalDraggingSizeState)) 10142 return; 10143 let nextState = { 10144 navSize: internalDraggingSizeState.navSize, 10145 bottomPanelHeight: internalDraggingSizeState.bottomPanelHeight, 10146 rightPanelWidth: internalDraggingSizeState.rightPanelWidth 10147 }; 10148 prevManagerLayoutStateRef.current = { 10149 ...prevManagerLayoutStateRef.current, 10150 ...nextState 10151 }, setManagerLayoutState(nextState); 10152 }, [internalDraggingSizeState, setManagerLayoutState]); 10153 let isPagesShown = isPagesViewMode(managerLayoutState.viewMode), isPanelShown = managerLayoutState.viewMode === "story" && !hasTab, { navSize, rightPanelWidth, bottomPanelHeight } = internalDraggingSizeState.isDragging ? internalDraggingSizeState : managerLayoutState, customisedNavSize = api.getNavSizeWithCustomisations?.(navSize) ?? navSize, customisedShowPanel = api.getShowPanelWithCustomisations?.(isPanelShown) ?? isPanelShown, { panelResizerRef, sidebarResizerRef, sidebarMaxWidth, panelMaxSize } = useDragging({ 10154 setState: setInternalDraggingSizeState, 10155 isDesktop, 10156 navSize: customisedNavSize, 10157 showPanel: customisedShowPanel, 10158 rightPanelWidth, 10159 panelPosition: managerLayoutState.panelPosition 10160 }); 10161 return { 10162 navSize: customisedNavSize, 10163 rightPanelWidth, 10164 bottomPanelHeight, 10165 panelPosition: managerLayoutState.panelPosition, 10166 panelResizerRef, 10167 sidebarResizerRef, 10168 sidebarMaxWidth, 10169 panelMaxSize, 10170 showPages: isPagesShown, 10171 showPanel: customisedShowPanel, 10172 isDragging: internalDraggingSizeState.isDragging, 10173 dragCursor: internalDraggingSizeState.dragCursor 10174 }; 10175}, OrderedMobileNavigation = styled(MobileNavigation)({ 10176 order: 1 10177}), Layout = ({ managerLayoutState, setManagerLayoutState, hasTab, ...slots }) => { 10178 let { isDesktop, isMobile: isMobile2 } = useLayout(), api = useStorybookApi(); 10179 useStorybookState(); 10180 let showSidebar = api.getNavAvailability() === "shown", { 10181 navSize, 10182 rightPanelWidth, 10183 bottomPanelHeight, 10184 panelPosition, 10185 panelResizerRef, 10186 sidebarResizerRef, 10187 sidebarMaxWidth, 10188 panelMaxSize, 10189 showPages, 10190 showPanel, 10191 isDragging, 10192 dragCursor 10193 } = useLayoutSyncingState({ api, managerLayoutState, setManagerLayoutState, isDesktop, hasTab }); 10194 return useLandmarkIndicator(), react_default.createElement( 10195 LayoutContainer, 10196 { 10197 panelPosition: managerLayoutState.panelPosition, 10198 showPanel, 10199 showSidebar, 10200 style: { 10201 "--nav-width": `${navSize}px`, 10202 "--right-panel-width": `${rightPanelWidth}px`, 10203 "--bottom-panel-height": `${bottomPanelHeight}px` 10204 } 10205 }, 10206 react_default.createElement(react_default.Fragment, null, isDesktop && showSidebar && react_default.createElement( 10207 SidebarContainer, 10208 { 10209 navSize, 10210 sidebarMaxWidth, 10211 sidebarResizerRef 10212 }, 10213 slots.slotSidebar 10214 ), isMobile2 && !showPages && react_default.createElement( 10215 OrderedMobileNavigation, 10216 { 10217 menu: slots.slotSidebar, 10218 panel: slots.slotPanel, 10219 showMenu: showSidebar, 10220 showPanel 10221 } 10222 ), react_default.createElement( 10223 MainAreaContainer, 10224 { 10225 showPages, 10226 slotMain: slots.slotMain, 10227 slotPages: slots.slotPages 10228 } 10229 ), slots.slotOverlay && react_default.createElement(ContentOverlayCell, null, slots.slotOverlay), isDesktop && showPanel && react_default.createElement( 10230 PanelContainer, 10231 { 10232 bottomPanelHeight, 10233 rightPanelWidth, 10234 panelMaxSize, 10235 panelResizerRef, 10236 position: panelPosition 10237 }, 10238 slots.slotPanel 10239 ), isMobile2 && !showPages && react_default.createElement(Notifications, null)), 10240 isDragging && react_default.createElement(DragShield, { style: { cursor: dragCursor } }) 10241 ); 10242}, ContentOverlayCell = styled.div({ 10243 position: "absolute", 10244 inset: 0, 10245 pointerEvents: "none", 10246 zIndex: 2, 10247 [MEDIA_DESKTOP_BREAKPOINT]: { 10248 position: "relative", 10249 inset: "auto", 10250 gridArea: "content" 10251 } 10252}), DragShield = styled.div({ 10253 position: "fixed", 10254 inset: 0, 10255 zIndex: 10 10256}), LayoutContainer = styled.div(({ panelPosition, showPanel, showSidebar }) => ({ 10257 position: "relative", 10258 width: "100%", 10259 height: ["100vh", "100dvh"], 10260 overflow: "hidden", 10261 display: "flex", 10262 flexDirection: "column", 10263 colorScheme: "light dark", 10264 [MEDIA_DESKTOP_BREAKPOINT]: { 10265 display: "grid", 10266 gap: 0, 10267 gridTemplateColumns: showSidebar ? `minmax(0, var(--nav-width)) minmax(${100}px, 1fr) minmax(0, var(--right-panel-width))` : `minmax(${100}px, 1fr) minmax(0, var(--right-panel-width))`, 10268 gridTemplateRows: "1fr minmax(0, var(--bottom-panel-height))", 10269 gridTemplateAreas: !showSidebar && !showPanel ? `"content content" 10270 "content content"` : !showSidebar && showPanel ? panelPosition === "right" ? `"content panel" 10271 "content panel"` : `"content content" 10272 "panel panel"` : showPanel ? panelPosition === "right" ? `"sidebar content panel" 10273 "sidebar content panel"` : `"sidebar content content" 10274 "sidebar panel panel"` : `"sidebar content content" 10275 "sidebar content content"` 10276 } 10277})); 10278 10279// src/manager/components/review/components/ReviewPersistentLayer.tsx 10280init_react(); 10281 10282// src/manager/components/review/screens/ReviewSummaryHost.tsx 10283init_react(); 10284 10285// src/shared/review/events.ts 10286var REVIEW_NAMESPACE = "storybook/review", REVIEW_EVENTS = { 10287 // tab → core-server: a review page (summary or detail) was viewed; forwarded to telemetry. 10288 PAGEVIEW: `${REVIEW_NAMESPACE}/pageview` 10289}; 10290 10291// src/manager/components/review/constants.ts 10292var PAGE_ID = `${REVIEW_NAMESPACE}/page`, REVIEW_CHANGES_URL = "/review/", REVIEW_MODE_SESSION_KEY = `${REVIEW_NAMESPACE}/review-mode`, PRE_REVIEW_RETURN_KEY = `${REVIEW_NAMESPACE}/pre-review-return`, AUTO_ENTERED_SESSION_KEY = `${REVIEW_NAMESPACE}/auto-entered`, autoEnteredLatchValue = (createdAt) => String(createdAt ?? "unknown"), VISITED_REVIEW_CREATED_AT_KEY = `${REVIEW_NAMESPACE}/visited-created-at`, NOTIFIED_REVIEW_CREATED_AT_KEY = `${REVIEW_NAMESPACE}/notified-created-at`, REVIEW_AVAILABLE_NOTIFICATION_ID = `${REVIEW_NAMESPACE}/review-available`, reviewAvailableNotificationId = (createdAt) => `${REVIEW_AVAILABLE_NOTIFICATION_ID}/${createdAt}`; 10293 10294// src/manager/components/review/review-context.ts 10295init_react(); 10296var noop2 = () => { 10297}, emptyReviewContextValue = { 10298 review: null, 10299 pendingReview: null, 10300 storyInfo: {}, 10301 flattenedEntries: [], 10302 newlyAddedStoryIds: /* @__PURE__ */ new Set(), 10303 activeEntry: null, 10304 activeIndex: -1, 10305 isSummaryVisible: !1, 10306 banner: null, 10307 isInReviewMode: !1, 10308 openSummary: noop2, 10309 openEntry: noop2, 10310 leaveReview: noop2, 10311 dismiss: noop2 10312}, ReviewContext = createContext(emptyReviewContextValue), useReviewContext = () => useContext(ReviewContext); 10313 10314// src/manager/components/review/session-store.ts 10315var sessionStore = { 10316 read(key) { 10317 try { 10318 return sessionStorage.getItem(key); 10319 } catch { 10320 return null; 10321 } 10322 }, 10323 write(key, value) { 10324 try { 10325 sessionStorage.setItem(key, value); 10326 } catch { 10327 } 10328 }, 10329 remove(key) { 10330 try { 10331 sessionStorage.removeItem(key); 10332 } catch { 10333 } 10334 } 10335}; 10336 10337// src/manager/components/review/screens/SummaryScreen.tsx 10338init_react(); 10339 10340// src/manager/components/review/components/AttentionBanner.tsx 10341init_react(); 10342 10343// src/manager/components/review/components/CopyButton.tsx 10344init_react(); 10345function CopyButton({ 10346 children, 10347 childrenOnCopy, 10348 content, 10349 onCopy, 10350 ariaLabel, 10351 ariaLabelOnCopy, 10352 duration, 10353 ...buttonProps 10354}) { 10355 let { children: buttonChildren, buttonProps: copyButtonProps } = useCopyButton({ 10356 children, 10357 childrenOnCopy, 10358 content, 10359 onCopy, 10360 ariaLabel, 10361 ariaLabelOnCopy, 10362 duration 10363 }); 10364 return react_default.createElement(Button, { ...buttonProps, ...copyButtonProps }, buttonChildren); 10365} 10366 10367// src/manager/components/review/components/AttentionBanner.tsx 10368var STALE_REFRESH_PROMPT = "Generate a fresh review including my latest changes using the review-create tool.", Region = styled.div({ 10369 flexShrink: 0 10370}), Bar2 = styled.div(({ theme }) => ({ 10371 display: "flex", 10372 alignItems: "center", 10373 justifyContent: "center", 10374 gap: 8, 10375 flexShrink: 0, 10376 padding: "4px 16px", 10377 background: theme.background.hoverable, 10378 color: theme.color.defaultText, 10379 borderBottom: `1px solid ${theme.appBorderColor}`, 10380 fontSize: theme.typography.size.s2, 10381 minHeight: 40 10382})), PopoverContent = styled.div({ 10383 padding: 15, 10384 width: 280, 10385 boxSizing: "border-box" 10386}), Title = styled.div(({ theme }) => ({ 10387 fontWeight: theme.typography.weight.bold 10388})), Message = styled.div(({ theme }) => ({ 10389 color: theme.color.defaultText, 10390 lineHeight: "18px", 10391 display: "flex", 10392 flexDirection: "column", 10393 alignItems: "flex-start", 10394 gap: 8 10395})), Prompt = styled.p(({ theme }) => ({ 10396 margin: 0, 10397 fontFamily: theme.typography.fonts.mono, 10398 fontSize: theme.typography.size.s1 - 1, 10399 padding: "6px 10px", 10400 background: theme.background.app, 10401 boxShadow: `inset 0 0 0 1px ${theme.appBorderColor}`, 10402 borderRadius: theme.appBorderRadius 10403})), AttentionBanner = (props) => { 10404 let { kind } = props, regionRef = useRef(null), { landmarkProps } = useLandmark( 10405 { role: "region", "aria-label": "Review status" }, 10406 regionRef 10407 ); 10408 if (kind === "pending-update") { 10409 let { onAccept } = props; 10410 return react_default.createElement(Region, { ref: regionRef, ...landmarkProps }, react_default.createElement(Bar2, { role: "status", "aria-live": "polite" }, react_default.createElement("span", null, "A new review is available."), react_default.createElement(Button, { variant: "solid", padding: "small", onClick: onAccept }, "Update"))); 10411 } 10412 return react_default.createElement(Region, { ref: regionRef, ...landmarkProps }, react_default.createElement(Bar2, { role: "status", "aria-live": "polite" }, react_default.createElement("span", null, "Code changes detected. This review may be stale.", " ", react_default.createElement( 10413 PopoverProvider, 10414 { 10415 ariaLabel: "Prompt to refresh stale review", 10416 placement: "bottom", 10417 padding: 0, 10418 popover: react_default.createElement(PopoverContent, null, react_default.createElement(Message, null, react_default.createElement(Title, null, "Prompt for your agent to refresh this review:"), react_default.createElement(Prompt, null, STALE_REFRESH_PROMPT), react_default.createElement( 10419 CopyButton, 10420 { 10421 appearance: "agentic", 10422 padding: "small", 10423 ariaLabel: "Copy prompt to refresh this review", 10424 ariaLabelOnCopy: "Prompt copied to clipboard", 10425 content: STALE_REFRESH_PROMPT, 10426 childrenOnCopy: react_default.createElement(react_default.Fragment, null, react_default.createElement(CheckIcon, null), " Copy prompt") 10427 }, 10428 react_default.createElement(CopyIcon, null), 10429 "Copy prompt" 10430 ))) 10431 }, 10432 react_default.createElement(Link, null, react_default.createElement("strong", null, "Ask your agent to refresh it.")) 10433 )))); 10434}; 10435 10436// src/manager/components/review/components/CollectionGrid.tsx 10437init_react(); 10438 10439// src/viewport/constants.ts 10440var ADDON_ID = "storybook/viewport", PARAM_KEY = "viewport", PANEL_ID = `${ADDON_ID}/panel`, TOOL_ID = `${ADDON_ID}/tool`, RESPONSIVE_VIEWPORT_VALUE = "100pct-100pct"; 10441 10442// src/shared/constants/iframe-resize.ts 10443var IFRAME_RESIZE_CONTEXT = "iframe.resize", IFRAME_RESIZE_REQUEST_CONTEXT = "iframe.resize.request", isPositiveFinite = (value) => typeof value == "number" && Number.isFinite(value) && value > 0, parseViewport = (value) => { 10444 if (!value || typeof value != "object") 10445 return; 10446 let viewport = value; 10447 if (typeof viewport.name != "string" || typeof viewport.value != "string") 10448 return; 10449 let parsed = { 10450 name: viewport.name, 10451 value: viewport.value 10452 }; 10453 if (viewport.width !== void 0) { 10454 if (!isPositiveFinite(viewport.width)) 10455 return; 10456 parsed.width = viewport.width; 10457 } 10458 if (viewport.height !== void 0) { 10459 if (!isPositiveFinite(viewport.height)) 10460 return; 10461 parsed.height = viewport.height; 10462 } 10463 return parsed; 10464}, parseIframeResizeMessage = (data) => { 10465 try { 10466 let parsed = typeof data == "string" ? JSON.parse(data) : data; 10467 if (parsed?.context !== IFRAME_RESIZE_CONTEXT || !isPositiveFinite(parsed.width) || !isPositiveFinite(parsed.height)) 10468 return null; 10469 let viewport = parseViewport(parsed.viewport); 10470 return parsed.viewport !== void 0 && viewport === void 0 ? null : { 10471 width: parsed.width, 10472 height: parsed.height, 10473 ...viewport ? { viewport } : {} 10474 }; 10475 } catch { 10476 return null; 10477 } 10478}, hasFixedViewportDimensions = (viewport) => !!viewport && viewport.value !== RESPONSIVE_VIEWPORT_VALUE && typeof viewport.width == "number" && viewport.width > 0 && typeof viewport.height == "number" && viewport.height > 0, iframeResizeViewportsEqual = (left, right) => left === right ? !0 : !left || !right ? !left && !right : left.name === right.name && left.value === right.value && left.width === right.width && left.height === right.height, iframeResizeDimensionsEqual = (left, right) => !left || left.width !== right.width || left.height !== right.height ? !1 : iframeResizeViewportsEqual(left.viewport, right.viewport); 10479 10480// src/manager/components/review/review-types.ts 10481var fallbackStoryInfo = (storyId) => { 10482 let separator = storyId.indexOf("--"); 10483 return separator === -1 ? { title: storyId, name: "Story" } : { 10484 title: storyId.slice(0, separator), 10485 name: storyId.slice(separator + 2) || "Story" 10486 }; 10487}; 10488 10489// src/manager/components/review/components/usePreviewThumbnail.ts 10490init_react(); 10491 10492// src/manager/components/review/components/previewScheduler.ts 10493var activePreviewLoads = 0, previewQueue = []; 10494function startTask(task) { 10495 task.state = "started", activePreviewLoads += 1, task.deadline = setTimeout(() => releaseTask(task), 1500), task.start(); 10496} 10497function startQueuedPreviews() { 10498 for (; activePreviewLoads < 3 && previewQueue.length > 0; ) 10499 startTask(previewQueue.shift()); 10500} 10501function releaseTask(task) { 10502 task.state !== "released" && (task.state === "started" ? (clearTimeout(task.deadline), activePreviewLoads -= 1) : previewQueue.splice(previewQueue.indexOf(task), 1), task.state = "released", startQueuedPreviews()); 10503} 10504function enqueuePreview(start) { 10505 let task = { start, state: "queued" }; 10506 return previewQueue.push(task), startQueuedPreviews(), { 10507 forceStart: () => { 10508 task.state === "queued" && (previewQueue.splice(previewQueue.indexOf(task), 1), startTask(task)); 10509 }, 10510 release: () => releaseTask(task) 10511 }; 10512} 10513 10514// src/manager/components/review/components/previewThumbnailState.ts 10515var initialThumbnailState = { 10516 phase: "idle", 10517 src: void 0, 10518 dimensions: null, 10519 bootId: 0 10520}, isThumbnailLoading = ({ phase }) => phase === "queued" || phase === "booting" || phase === "measured", thumbnailReducer = (state, event) => { 10521 switch (event.type) { 10522 case "enqueued": 10523 return { ...state, phase: "queued", dimensions: null }; 10524 case "started": 10525 return state.phase !== "queued" ? state : { ...state, phase: "booting", src: event.src, bootId: state.bootId + 1 }; 10526 case "resized": { 10527 if (state.phase === "booting" || state.phase === "measured") { 10528 let unchanged = iframeResizeDimensionsEqual(state.dimensions, event.dimensions); 10529 return state.phase === "measured" && unchanged ? state : { 10530 ...state, 10531 phase: "measured", 10532 dimensions: unchanged ? state.dimensions : event.dimensions 10533 }; 10534 } 10535 return state.phase === "settled" ? iframeResizeDimensionsEqual(state.dimensions, event.dimensions) ? state : { ...state, dimensions: event.dimensions } : state; 10536 } 10537 case "settled": 10538 return state.phase === "booting" || state.phase === "measured" ? { ...state, phase: "settled" } : state; 10539 case "evicted": 10540 return state.phase === "idle" ? state : { ...initialThumbnailState, bootId: state.bootId }; 10541 } 10542}; 10543 10544// src/manager/components/review/components/usePreviewThumbnail.ts 10545var PREVIEW_SCALE_SETTLE_FALLBACK_MS = 1500 * 3, PREVIEW_MOUNT_ROOT_MARGIN = "50% 0px", PREVIEW_EVICT_ROOT_MARGIN = "150% 0px", getScrollRoot = (element) => { 10546 let radixViewport = element.closest("[data-radix-scroll-area-viewport]"); 10547 if (radixViewport) 10548 return radixViewport; 10549 let current = element.parentElement; 10550 for (; current; ) { 10551 let { overflowY } = window.getComputedStyle(current); 10552 if (overflowY === "auto" || overflowY === "scroll") 10553 return current; 10554 current = current.parentElement; 10555 } 10556 return null; 10557}, usePreviewThumbnail = ({ 10558 storyId, 10559 getPreviewHref, 10560 summaryHidden = !1 10561}) => { 10562 let cellRef = useRef(null), iframeRef = useRef(null), [isInView, setIsInView] = useState(!1), [state, dispatch] = useReducer(thumbnailReducer, initialThumbnailState), handleRef = useRef(null), settleRafRef = useRef({ raf1: 0, raf2: 0 }), { src, bootId } = state; 10563 useEffect(() => { 10564 let host = cellRef.current; 10565 if (!host || summaryHidden) 10566 return; 10567 let scrollRoot = getScrollRoot(host), root2 = scrollRoot && scrollRoot.clientHeight > 0 ? scrollRoot : null, mountObserver = new IntersectionObserver( 10568 ([entry]) => { 10569 entry.isIntersecting && setIsInView(!0); 10570 }, 10571 { root: root2, rootMargin: PREVIEW_MOUNT_ROOT_MARGIN } 10572 ), evictObserver = new IntersectionObserver( 10573 ([entry]) => { 10574 entry.isIntersecting || setIsInView(!1); 10575 }, 10576 { root: root2, rootMargin: PREVIEW_EVICT_ROOT_MARGIN } 10577 ); 10578 return mountObserver.observe(host), evictObserver.observe(host), () => { 10579 mountObserver.disconnect(), evictObserver.disconnect(); 10580 }; 10581 }, [summaryHidden]), useEffect(() => { 10582 isInView || dispatch({ type: "evicted" }); 10583 }, [isInView]), useEffect(() => { 10584 if (!isInView) 10585 return; 10586 let previewHref = getPreviewHref(storyId); 10587 dispatch({ type: "enqueued" }); 10588 let handle = enqueuePreview(() => { 10589 dispatch({ type: "started", src: previewHref }); 10590 }); 10591 return handleRef.current = handle, () => { 10592 handle.release(), handleRef.current = null; 10593 }; 10594 }, [isInView, storyId, getPreviewHref]), useEffect(() => { 10595 if (!src) 10596 return; 10597 let timer = setTimeout(() => dispatch({ type: "settled" }), PREVIEW_SCALE_SETTLE_FALLBACK_MS); 10598 return () => clearTimeout(timer); 10599 }, [bootId, src]); 10600 let handleResize = useCallback((dimensions) => { 10601 dispatch({ type: "resized", dimensions }), cancelAnimationFrame(settleRafRef.current.raf1), cancelAnimationFrame(settleRafRef.current.raf2), settleRafRef.current.raf1 = requestAnimationFrame(() => { 10602 settleRafRef.current.raf2 = requestAnimationFrame(() => { 10603 dispatch({ type: "settled" }); 10604 }); 10605 }); 10606 }, []); 10607 useEffect(() => { 10608 let rafs = settleRafRef.current; 10609 return () => { 10610 cancelAnimationFrame(rafs.raf1), cancelAnimationFrame(rafs.raf2); 10611 }; 10612 }, []), useLayoutEffect(() => { 10613 if (!src) 10614 return; 10615 let iframe = iframeRef.current; 10616 if (!iframe) 10617 return; 10618 let onMessage = (event) => { 10619 if (event.source === null || event.source !== iframe.contentWindow) 10620 return; 10621 let dimensions = parseIframeResizeMessage(event.data); 10622 dimensions && handleResize(dimensions); 10623 }; 10624 window.addEventListener("message", onMessage); 10625 let requestRemeasure = () => { 10626 try { 10627 iframe.contentWindow?.postMessage( 10628 JSON.stringify({ context: IFRAME_RESIZE_REQUEST_CONTEXT }), 10629 "*" 10630 ); 10631 } catch { 10632 } 10633 }; 10634 return requestRemeasure(), iframe.addEventListener("load", requestRemeasure), () => { 10635 window.removeEventListener("message", onMessage), iframe.removeEventListener("load", requestRemeasure); 10636 }; 10637 }, [src, handleResize]); 10638 let finishCurrent = useCallback(() => { 10639 handleRef.current?.release(); 10640 }, []), forceStartCurrent = useCallback(() => { 10641 handleRef.current?.forceStart(); 10642 }, []); 10643 return { 10644 cellRef, 10645 iframeRef, 10646 src, 10647 isPreviewLoading: isThumbnailLoading(state), 10648 rememberedDimensions: state.dimensions, 10649 forceStartCurrent, 10650 finishCurrent 10651 }; 10652}; 10653 10654// src/manager/components/review/components/CollectionGrid.tsx 10655var band = (cols) => { 10656 let cap = cols * 2; 10657 return { 10658 gridTemplateColumns: `repeat(${cols}, minmax(0, 1fr))`, 10659 [`&:not([data-show-all]):has(> [data-cell]:nth-child(${cap + 1})) > [data-cell]:nth-child(n + ${cap})`]: { 10660 display: "none" 10661 }, 10662 [`&:not([data-show-all]):has(> [data-cell]:nth-child(${cap + 1})) > [data-review-all]`]: { 10663 display: "flex" 10664 } 10665 }; 10666}, GridContainer = styled.div({ 10667 containerType: "inline-size", 10668 containerName: "review-grid" 10669}), Grid = styled.div({ 10670 display: "grid", 10671 alignItems: "stretch", 10672 gap: 12, 10673 padding: 12, 10674 gridTemplateColumns: "minmax(0, 1fr)", 10675 "@container review-grid (max-width: 629.98px)": band(1), 10676 "@container review-grid (min-width: 630px) and (max-width: 844.98px)": band(2), 10677 "@container review-grid (min-width: 845px) and (max-width: 1259.98px)": band(3), 10678 "@container review-grid (min-width: 1260px)": band(4) 10679}), Cell = styled.div({ 10680 display: "flex", 10681 flexDirection: "column", 10682 minWidth: 0, 10683 overflow: "hidden" 10684}), FrameShell = styled.div({ 10685 width: "100%", 10686 minWidth: 0, 10687 maxWidth: "100%", 10688 aspectRatio: "3 / 2", 10689 position: "relative" 10690}), DEFAULT_CONTENT_WIDTH = 300, THUMBNAIL_BOOTSTRAP_SCALE = 0.5, getPreviewFrameLayout = (dimensions) => dimensions ? hasFixedViewportDimensions(dimensions.viewport) ? { 10691 style: { 10692 "--vp-w": dimensions.viewport.width, 10693 "--vp-h": dimensions.viewport.height 10694 }, 10695 viewportFill: !0 10696} : { style: { "--content-w": dimensions.width }, viewportFill: !1 } : { 10697 style: { "--scale": THUMBNAIL_BOOTSTRAP_SCALE }, 10698 viewportFill: !1 10699}, Frame = styled.a(({ theme }) => ({ 10700 position: "absolute", 10701 inset: 0, 10702 display: "block", 10703 boxSizing: "border-box", 10704 containerType: "inline-size", 10705 containerName: "preview-frame", 10706 "--content-w": DEFAULT_CONTENT_WIDTH, 10707 "--fit-w": "calc(100cqw / (var(--content-w) * 1px))", 10708 "--fit": "min(1, var(--fit-w))", 10709 "--scale": "max(0.5, min(1, round(down, var(--fit), 0.25)))", 10710 "--vp-scale": "calc(100cqw / (var(--vp-w) * 1px))", 10711 borderRadius: 6, 10712 overflow: "hidden", 10713 background: theme.background.app, 10714 border: `1px solid ${theme.appBorderColor}`, 10715 transition: "border-color 120ms ease", 10716 textDecoration: "none", 10717 outline: "none", 10718 "& [data-preview-scale]": { 10719 position: "absolute", 10720 top: 0, 10721 left: 0, 10722 transformOrigin: "top left" 10723 }, 10724 "&[data-viewport-fill] [data-preview-scale]": { 10725 width: "calc(var(--vp-w) * 1px)", 10726 height: "calc(var(--vp-h) * 1px)", 10727 transform: "scale(var(--vp-scale))" 10728 }, 10729 "&:not([data-viewport-fill]) [data-preview-scale]": { 10730 width: "calc(100% / var(--scale))", 10731 height: "calc(100% / var(--scale))", 10732 transform: "scale(var(--scale))" 10733 }, 10734 "&[href]:hover": { 10735 borderColor: theme.color.secondary 10736 }, 10737 "&:focus-visible": { 10738 outline: `${theme.barSelectedColor} solid 2px`, 10739 outlineOffset: -2 10740 } 10741})), Preview = styled.iframe(({ theme }) => ({ 10742 display: "block", 10743 width: "100%", 10744 height: "100%", 10745 background: theme.background.preview, 10746 border: 0, 10747 pointerEvents: "none" 10748})), PreviewLoading = styled.div(({ theme }) => ({ 10749 position: "absolute", 10750 inset: 0, 10751 zIndex: 1, 10752 display: "grid", 10753 placeItems: "center", 10754 background: theme.background.app, 10755 pointerEvents: "none" 10756})), ActionBar2 = styled.div({ 10757 display: "flex", 10758 alignItems: "center", 10759 justifyContent: "space-between", 10760 gap: 8, 10761 minHeight: 36, 10762 marginTop: "auto" 10763}), Label = styled.div({ 10764 display: "flex", 10765 alignItems: "center", 10766 gap: 4, 10767 flex: 1, 10768 minWidth: 0, 10769 marginLeft: 10, 10770 overflow: "hidden" 10771}), LabelComponent = styled.span({ 10772 fontWeight: 700, 10773 whiteSpace: "nowrap", 10774 flexShrink: 0, 10775 maxWidth: "60%", 10776 overflow: "hidden", 10777 textOverflow: "ellipsis" 10778}), LabelSeparator = styled.span(({ theme }) => ({ 10779 color: theme.textMutedColor, 10780 flexShrink: 0 10781})), LabelStory = styled.span({ 10782 whiteSpace: "nowrap", 10783 overflow: "hidden", 10784 textOverflow: "ellipsis", 10785 marginRight: 4 10786}), NewBadge = styled(Badge)({ 10787 flexShrink: 0 10788}), ReviewAllCell = styled(Cell)({ 10789 display: "none" 10790}), ReviewAllShell = styled.div({ 10791 width: "100%", 10792 minWidth: 0, 10793 maxWidth: "100%", 10794 aspectRatio: "3 / 2", 10795 minHeight: 50 10796}), ReviewAllFrame = styled.div(({ theme }) => ({ 10797 display: "grid", 10798 placeItems: "center", 10799 width: "100%", 10800 height: "100%", 10801 boxSizing: "border-box", 10802 borderRadius: 6, 10803 background: theme.background.app, 10804 border: `1px dashed ${theme.appBorderColor}` 10805})), deriveStoryInfo = (info) => ({ 10806 component: info.title.split("/").pop() ?? info.title, 10807 name: info.name 10808}), StoryPreviewCell = ({ storyId, href, info, getPreviewHref, summaryHidden = !1 }) => { 10809 let { 10810 cellRef, 10811 iframeRef, 10812 src, 10813 isPreviewLoading, 10814 rememberedDimensions, 10815 forceStartCurrent, 10816 finishCurrent 10817 } = usePreviewThumbnail({ storyId, getPreviewHref, summaryHidden }), { component, name } = deriveStoryInfo(info), readableTitle = `${component} \u2013 ${name}`, { style: frameStyle, viewportFill } = getPreviewFrameLayout(rememberedDimensions), preview = src ? react_default.createElement("div", { "data-preview-scale": !0 }, react_default.createElement( 10818 Preview, 10819 { 10820 ref: iframeRef, 10821 title: readableTitle, 10822 src, 10823 "data-content-width": rememberedDimensions?.width, 10824 "data-content-height": rememberedDimensions?.height, 10825 tabIndex: -1, 10826 scrolling: "no", 10827 onLoad: finishCurrent, 10828 onError: finishCurrent 10829 } 10830 )) : null; 10831 return react_default.createElement(Cell, { ref: cellRef, role: "listitem", "data-cell": !0, "data-testid": "review-collection-grid-cell" }, react_default.createElement(FrameShell, null, react_default.createElement( 10832 Frame, 10833 { 10834 as: href ? "a" : "div", 10835 ...href ? { href } : {}, 10836 "data-testid": "review-collection-grid-frame", 10837 "data-viewport-fill": viewportFill || void 0, 10838 style: frameStyle, 10839 "aria-label": href ? `Review story ${readableTitle}` : void 0, 10840 onMouseEnter: forceStartCurrent, 10841 onFocus: forceStartCurrent 10842 }, 10843 isPreviewLoading ? react_default.createElement(PreviewLoading, { "data-testid": "review-preview-loading" }, react_default.createElement(Loader, null)) : null, 10844 preview 10845 )), react_default.createElement(ActionBar2, null, react_default.createElement(Label, null, react_default.createElement(LabelComponent, null, component), react_default.createElement(LabelSeparator, null, "/"), react_default.createElement(LabelStory, null, name), info.changeStatus === "new" || info.isNewlyAdded ? react_default.createElement(NewBadge, { status: "positive", compact: !0 }, "New") : null))); 10846}, CollectionGrid = ({ 10847 storyIds, 10848 getStoryHref: getStoryHref2, 10849 getStoryPreviewHref, 10850 showAll = !1, 10851 onShowAll, 10852 storyInfo, 10853 summaryHidden = !1 10854}) => react_default.createElement(GridContainer, null, react_default.createElement(Grid, { role: "list", "data-show-all": showAll || void 0, "data-testid": "review-collection-grid" }, storyIds.map((storyId, storyIndex) => { 10855 let info = storyInfo[storyId] ?? fallbackStoryInfo(storyId); 10856 return react_default.createElement( 10857 StoryPreviewCell, 10858 { 10859 key: storyId, 10860 storyId, 10861 href: getStoryHref2?.(storyId, storyIndex), 10862 info, 10863 getPreviewHref: getStoryPreviewHref, 10864 summaryHidden 10865 } 10866 ); 10867}), react_default.createElement(ReviewAllCell, { role: "presentation", "data-review-all": !0 }, react_default.createElement(ReviewAllShell, null, react_default.createElement(ReviewAllFrame, null, react_default.createElement(Button, { size: "medium", onClick: () => onShowAll?.() }, "Review all ", storyIds.length))), react_default.createElement(ActionBar2, { "aria-hidden": "true" })))); 10868 10869// src/manager/components/review/components/Markdown.tsx 10870init_react(); 10871var createInlinePattern = () => /(\*\*([\s\S]+?)\*\*|\*([\s\S]+?)\*|_([\s\S]+?)_|`([\s\S]+?)`)/g, parseInline = (text) => { 10872 let nodes = [], pattern = createInlinePattern(), lastIndex = 0, key = 0, match; 10873 for (; (match = pattern.exec(text)) !== null; ) { 10874 match.index > lastIndex && nodes.push(text.slice(lastIndex, match.index)); 10875 let [token, , bold, italicStar, italicUnderscore, code] = match; 10876 bold !== void 0 ? nodes.push(react_default.createElement("strong", { key: key++ }, parseInline(bold))) : italicStar !== void 0 ? nodes.push(react_default.createElement("em", { key: key++ }, parseInline(italicStar))) : italicUnderscore !== void 0 ? nodes.push(react_default.createElement("em", { key: key++ }, parseInline(italicUnderscore))) : code !== void 0 && nodes.push(react_default.createElement("code", { key: key++ }, code)), lastIndex = match.index + token.length; 10877 } 10878 return lastIndex < text.length && nodes.push(text.slice(lastIndex)), nodes; 10879}, Markdown = ({ children }) => { 10880 let paragraphs = children.split(/\n{2,}/).filter((paragraph) => paragraph.trim() !== ""); 10881 return react_default.createElement(react_default.Fragment, null, paragraphs.map((paragraph, index) => react_default.createElement("p", { key: index }, parseInline(paragraph)))); 10882}; 10883 10884// src/manager/components/review/components/ReviewHeader.tsx 10885init_react(); 10886var Root = styled.header(({ theme, $variant }) => ({ 10887 containerType: "inline-size", 10888 containerName: "review-header", 10889 display: "flex", 10890 flexDirection: "column", 10891 flexShrink: 0, 10892 width: "100%", 10893 background: $variant === "toolbar" ? theme.barBg : theme.background.content, 10894 color: theme.color.defaultText, 10895 ...$variant === "page" ? { borderBottom: `1px solid ${theme.appBorderColor}` } : {} 10896})), TopRow = styled.div(({ $variant }) => ({ 10897 display: "flex", 10898 flexWrap: "wrap", 10899 flexDirection: "row", 10900 alignItems: "center", 10901 gap: 8, 10902 padding: $variant === "toolbar" ? "16px 16px 8px 16px" : "16px", 10903 minHeight: 40 10904})), Main = styled.div({ 10905 display: "flex", 10906 flexDirection: "row", 10907 alignItems: "center", 10908 gap: 8, 10909 flex: "1 1 auto", 10910 minWidth: 0 10911}), Leading = styled.div({ 10912 display: "flex", 10913 alignItems: "center", 10914 alignSelf: "flex-start", 10915 flexShrink: 0 10916}), TextBlock = styled.div({ 10917 display: "flex", 10918 flexDirection: "column", 10919 flexGrow: 1, 10920 minWidth: 0 10921}), Title2 = styled.h1(({ theme }) => ({ 10922 margin: "2px 0", 10923 minWidth: 0, 10924 overflow: "hidden", 10925 textOverflow: "ellipsis", 10926 whiteSpace: "nowrap", 10927 fontSize: theme.typography.size.m1, 10928 fontWeight: theme.typography.weight.bold, 10929 lineHeight: "24px" 10930})), Subtitle = styled.div(({ theme }) => ({ 10931 display: "flex", 10932 flexWrap: "wrap", 10933 alignItems: "center", 10934 gap: 8, 10935 color: theme.textMutedColor, 10936 fontSize: theme.typography.size.s2, 10937 lineHeight: "20px" 10938})), Actions = styled.div({ 10939 display: "flex", 10940 flexWrap: "wrap", 10941 alignItems: "center", 10942 justifyContent: "flex-end", 10943 gap: 6, 10944 flex: "0 1 auto", 10945 marginLeft: "auto" 10946}), SecondRow = styled.div({ 10947 display: "flex", 10948 alignItems: "center", 10949 gap: 8, 10950 padding: "0 16px 2px 16px", 10951 minHeight: 39 10952}), ReviewHeader = ({ 10953 leading, 10954 title: title2, 10955 subtitle, 10956 actions, 10957 secondRow, 10958 variant = "page" 10959}) => { 10960 let titleId = $bdb11010cef70236$export$f680877a34711e37(), regionRef = useRef(null), { landmarkProps } = useLandmark({ "aria-labelledby": titleId, role: "banner" }, regionRef); 10961 return react_default.createElement(Root, { $variant: variant, ref: regionRef, ...landmarkProps }, react_default.createElement(TopRow, { $variant: variant }, react_default.createElement(Main, null, leading ? react_default.createElement(Leading, null, leading) : null, react_default.createElement(TextBlock, null, react_default.createElement(Title2, { id: titleId }, title2), subtitle ? react_default.createElement(Subtitle, null, subtitle) : null)), actions ? react_default.createElement(Actions, null, actions) : null), secondRow ? react_default.createElement(SecondRow, null, secondRow) : null); 10962}; 10963 10964// src/manager/components/review/review-navigation.ts 10965var prettifyComponentId = (componentId) => componentId.split(/[-/]/).filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" "), buildReviewChangesSummaryHref = () => `?path=${REVIEW_CHANGES_URL}`, STORYBOOK_ROOT_HREF = "/", buildSummaryBackHref = (returnSearch) => returnSearch || STORYBOOK_ROOT_HREF, REVIEW_SUMMARY_BACK_ATTR = "data-review-summary-back", buildReviewStoryTarget = (entry) => `/story/${entry.storyId}&${REVIEW_COLLECTION_QUERY_PARAM}=${entry.collectionIndex}`, buildReviewStoryHref = (entry) => `?path=${buildReviewStoryTarget(entry)}`, parseReviewStoryHref = (href) => { 10966 if (!href.startsWith("?path=/story/")) 10967 return null; 10968 let query = href.startsWith("?") ? href.slice(1) : href, params = new URLSearchParams(query), path = params.get("path"); 10969 if (!path?.startsWith("/story/")) 10970 return null; 10971 let storyId = path.slice(7), collectionIndex = parseCollectionIndex( 10972 params.get(REVIEW_COLLECTION_QUERY_PARAM) ?? void 0 10973 ); 10974 return !storyId || collectionIndex === void 0 ? null : { storyId, collectionIndex }; 10975}, isReviewReturnSearch = (search) => { 10976 let normalized = search.startsWith("?") ? search.slice(1) : search, params = new URLSearchParams(normalized), path = params.get("path") ?? ""; 10977 return isReviewSummaryPath(path) || path.startsWith(REVIEW_CHANGES_URL) ? !0 : path.startsWith("/story/") && params.has(REVIEW_COLLECTION_QUERY_PARAM); 10978}, parseStoryIdFromPath = (path) => path.startsWith("/story/") && path.slice(7) || null, parseCollectionIndex = (value) => { 10979 if (value === void 0 || !/^\d+$/.test(value)) 10980 return; 10981 let parsed = Number(value); 10982 return Number.isInteger(parsed) ? parsed : void 0; 10983}, resolveActiveNavEntry = (entries, storyId, collectionIndex) => { 10984 if (entries.length === 0) 10985 return null; 10986 if (collectionIndex !== void 0) { 10987 let exact = entries.find( 10988 (entry) => entry.storyId === storyId && entry.collectionIndex === collectionIndex 10989 ); 10990 if (exact) 10991 return exact; 10992 } 10993 return entries.find((entry) => entry.storyId === storyId) ?? null; 10994}, resolveNavIndex = (entries, active) => entries.findIndex( 10995 (entry) => entry.storyId === active.storyId && entry.collectionIndex === active.collectionIndex 10996); 10997 10998// src/manager/components/review/screens/SummaryScreen.tsx 10999var MarkdownWrapper = styled(DocumentWrapper)(({ theme }) => ({ 11000 color: theme.color.defaultText, 11001 p: { 11002 margin: 0 11003 }, 11004 "p + p": { 11005 marginTop: 10 11006 }, 11007 code: { 11008 color: "inherit", 11009 verticalAlign: "text-bottom", 11010 fontSize: "0.85em", 11011 margin: 0, 11012 padding: "0 4px", 11013 background: "transparent", 11014 border: "none", 11015 boxShadow: `inset 0 0 0 1px ${theme.appBorderColor}`, 11016 borderRadius: theme.appBorderRadius 11017 } 11018})), Page = styled.div(({ theme }) => ({ 11019 display: "flex", 11020 flexDirection: "column", 11021 height: "100dvh", 11022 minHeight: 0, 11023 overflow: "hidden", 11024 background: theme.background.app, 11025 color: theme.color.defaultText, 11026 fontFamily: theme.typography.fonts.base, 11027 fontSize: theme.typography.size.s2 11028})), Empty = styled.div(({ theme }) => ({ 11029 display: "flex", 11030 flexDirection: "column", 11031 gap: 16, 11032 alignItems: "center", 11033 justifyContent: "center", 11034 height: "100dvh", 11035 color: theme.color.defaultText, 11036 "& > div": { 11037 display: "flex", 11038 alignItems: "center", 11039 gap: 8 11040 } 11041})), ListScroll = styled.div({ 11042 flex: 1, 11043 minHeight: 0 11044}), Main2 = styled.main({ 11045 display: "flex", 11046 flexDirection: "column", 11047 gap: 12, 11048 padding: 12, 11049 // Cards must keep their intrinsic height so the list scrolls; without this 11050 // the default flex-shrink collapses them to fit the viewport and Card's 11051 // overflow:hidden clips the content at the bottom. 11052 "& > *": { 11053 flexShrink: 0 11054 } 11055}), SummaryCard = styled(Card)({ 11056 display: "flex", 11057 alignItems: "flex-start", 11058 padding: "9px 12px", 11059 gap: 10, 11060 svg: { 11061 flexShrink: 0, 11062 marginTop: 4 11063 } 11064}), SummaryLandmark = ({ children }) => { 11065 let asideRef = useRef(null), { landmarkProps } = useLandmark( 11066 { role: "complementary", "aria-label": "Summary" }, 11067 asideRef 11068 ); 11069 return react_default.createElement("aside", { ref: asideRef, ...landmarkProps }, children); 11070}, SummaryContent = styled(MarkdownWrapper)({ 11071 flex: 1, 11072 minWidth: 0, 11073 // Keep the "Summary:" heading and the first description paragraph on the same 11074 // line, matching the previous inline "**Summary:** …" rendering. 11075 "& > p:first-of-type": { 11076 display: "inline" 11077 } 11078}), SummaryHeading = styled.h2(({ theme }) => ({ 11079 // Double the ampersand to outrank the DocumentWrapper's `.wrapper h2` rule 11080 // (specificity 0,1,1), which would otherwise enlarge this and add a bottom 11081 // border, so the label stays identical to the inline bold it replaces. 11082 "&&": { 11083 display: "inline", 11084 margin: 0, 11085 padding: 0, 11086 fontSize: "inherit", 11087 fontWeight: theme.typography.weight.bold, 11088 lineHeight: "inherit", 11089 color: "inherit", 11090 border: "none" 11091 } 11092})), CardHead = styled.div({ 11093 display: "flex", 11094 alignItems: "center", 11095 justifyContent: "space-between", 11096 gap: 8, 11097 padding: "6px 10px 6px 12px", 11098 minHeight: 40, 11099 cursor: "pointer" 11100}), CardTitle = styled.h2(({ theme }) => ({ 11101 minWidth: 0, 11102 margin: 0, 11103 overflow: "hidden", 11104 textOverflow: "ellipsis", 11105 whiteSpace: "nowrap", 11106 fontSize: "inherit", 11107 fontWeight: theme.typography.weight.bold, 11108 lineHeight: "20px", 11109 color: theme.color.defaultText 11110})), CardControls = styled.div({ 11111 display: "flex", 11112 alignItems: "center", 11113 justifyContent: "flex-end", 11114 gap: 6, 11115 flexShrink: 0 11116}), CardCount = styled.span(({ theme }) => ({ 11117 minWidth: 28, 11118 fontFamily: theme.typography.fonts.mono, 11119 fontSize: theme.typography.size.s2 - 1, 11120 lineHeight: "20px", 11121 textAlign: "center", 11122 color: theme.textMutedColor 11123})), ToggleChevronIcon = styled(ChevronSmallDownIcon)({ 11124 transition: "transform 160ms ease" 11125}), CardRationale = styled(MarkdownWrapper)(({ theme }) => ({ 11126 color: theme.textMutedColor, 11127 margin: "0 12px" 11128})), Footer = styled.div(({ theme }) => ({ 11129 color: theme.textMutedColor, 11130 padding: "10px 10px 30px", 11131 fontSize: theme.typography.size.s2, 11132 textAlign: "center", 11133 textWrap: "balance" 11134})), CollectionLandmark = ({ 11135 titleId, 11136 children 11137}) => { 11138 let regionRef = useRef(null), { landmarkProps } = useLandmark({ role: "region", "aria-labelledby": titleId }, regionRef); 11139 return react_default.createElement("section", { ref: regionRef, ...landmarkProps }, children); 11140}, FooterLandmark = ({ children }) => { 11141 let regionRef = useRef(null), { landmarkProps } = useLandmark( 11142 { role: "contentinfo", "aria-label": "About this review" }, 11143 regionRef 11144 ); 11145 return react_default.createElement(Footer, { as: "section", ref: regionRef, ...landmarkProps }, children); 11146}, pluralize = (count, singular, plural = `${singular}s`) => `${count} ${count === 1 ? singular : plural}`, formatCreatedAgo = (createdAt, nowMs) => { 11147 let elapsedMs = Math.max(0, nowMs - createdAt); 11148 if (elapsedMs < 6e4) 11149 return "just now"; 11150 let elapsedMinutes = Math.floor(elapsedMs / 6e4); 11151 return elapsedMinutes < 60 ? `${elapsedMinutes}m ago` : `${Math.floor(elapsedMinutes / 60)}h ago`; 11152}, SummaryScreen = ({ 11153 state, 11154 storyInfo = {}, 11155 getStoryPreviewHref, 11156 banner = null, 11157 summaryHidden = !1, 11158 onDismiss, 11159 returnSearch = null 11160}) => { 11161 let [expandedCollections, setExpandedCollections] = useState(() => /* @__PURE__ */ new Set()), [showAllCollections, setShowAllCollections] = useState(() => /* @__PURE__ */ new Set()), [showNewOnly, setShowNewOnly] = useState(!1), [nowMs, setNowMs] = useState(() => Date.now()); 11162 useEffect(() => { 11163 let intervalId = window.setInterval(() => { 11164 setNowMs(Date.now()); 11165 }, 1e4); 11166 return () => window.clearInterval(intervalId); 11167 }, []), useLayoutEffect(() => { 11168 if (!state) { 11169 setExpandedCollections(/* @__PURE__ */ new Set()), setShowAllCollections(/* @__PURE__ */ new Set()); 11170 return; 11171 } 11172 setExpandedCollections(new Set(state.collections.map((_2, index) => index))), setShowAllCollections(/* @__PURE__ */ new Set()); 11173 }, [state?.createdAt]); 11174 let newStoryCount = useMemo( 11175 () => new Set( 11176 (state?.collections ?? []).flatMap((c2) => c2.storyIds).filter((id) => storyInfo[id]?.isNewlyAdded) 11177 ).size, 11178 [state, storyInfo] 11179 ), visibleCollections = useMemo( 11180 () => (state?.collections ?? []).map((collection, index) => { 11181 let storyIds = showNewOnly ? collection.storyIds.filter((id) => storyInfo[id]?.isNewlyAdded) : collection.storyIds; 11182 return { collection, index, storyIds }; 11183 }).filter((entry) => entry.storyIds.length > 0), 11184 [state?.collections, showNewOnly, storyInfo] 11185 ); 11186 if (!state) 11187 return react_default.createElement(Empty, null, react_default.createElement("span", null, "Waiting for the agent to display a review\u2026"), react_default.createElement("div", null, react_default.createElement( 11188 CopyButton, 11189 { 11190 appearance: "agentic", 11191 padding: "small", 11192 ariaLabel: "Copy prompt to refresh this review", 11193 ariaLabelOnCopy: "Prompt copied to clipboard", 11194 content: "Generate a Storybook review including my latest changes using the review-create tool.", 11195 childrenOnCopy: react_default.createElement(react_default.Fragment, null, react_default.createElement(CheckIcon, null), " Copy prompt") 11196 }, 11197 react_default.createElement(CopyIcon, null), 11198 "Copy prompt" 11199 ), react_default.createElement(Button, { padding: "small", onClick: onDismiss, ariaLabel: "Close review screen" }, react_default.createElement(CloseIcon, null), "Close"))); 11200 let storyCount = new Set(state.collections.flatMap((collection) => collection.storyIds)).size, createdAgo = state.createdAt ? formatCreatedAgo(state.createdAt, nowMs) : null, toggleCollection = (index) => { 11201 setExpandedCollections((previous) => { 11202 let next = new Set(previous); 11203 return next.has(index) ? next.delete(index) : next.add(index), next; 11204 }); 11205 }, markCollectionShowAll = (index) => { 11206 setShowAllCollections( 11207 (previous) => previous.has(index) ? previous : new Set(previous).add(index) 11208 ); 11209 }; 11210 return react_default.createElement(Page, null, banner && react_default.createElement(AttentionBanner, { ...banner }), react_default.createElement( 11211 ReviewHeader, 11212 { 11213 leading: react_default.createElement(Button, { variant: "ghost", size: "small", padding: "small", ariaLabel: "Exit review", asChild: !0 }, react_default.createElement("a", { href: buildSummaryBackHref(returnSearch), [REVIEW_SUMMARY_BACK_ATTR]: "" }, react_default.createElement(ChevronSmallLeftIcon, null), react_default.createElement(StorybookIcon, null))), 11214 title: state.title, 11215 subtitle: react_default.createElement(react_default.Fragment, null, react_default.createElement("span", null, "Showing ", pluralize(storyCount, "story", "stories"), " for quick review"), createdAgo ? react_default.createElement(react_default.Fragment, null, react_default.createElement("span", null, "\u2022"), react_default.createElement("span", null, createdAgo)) : null), 11216 actions: newStoryCount > 0 ? react_default.createElement( 11217 ToggleButton, 11218 { 11219 variant: "ghost", 11220 size: "small", 11221 padding: "small", 11222 ariaLabel: !1, 11223 tooltip: "Toggle filtering of new stories", 11224 pressed: showNewOnly, 11225 onClick: () => setShowNewOnly((v2) => !v2) 11226 }, 11227 newStoryCount, 11228 " new" 11229 ) : null 11230 } 11231 ), react_default.createElement(ListScroll, null, react_default.createElement(ScrollArea, { vertical: !0 }, react_default.createElement(Main2, null, react_default.createElement(SummaryLandmark, null, react_default.createElement(SummaryCard, { color: "agentic" }, react_default.createElement(WandIcon, null), react_default.createElement(SummaryContent, null, react_default.createElement(SummaryHeading, null, "Summary:"), " ", react_default.createElement(Markdown, null, state.description)))), visibleCollections.length === 0 ? react_default.createElement(Footer, null, showNewOnly ? "No new stories found." : "No collections found.") : visibleCollections.map(({ collection, index, storyIds }) => { 11232 let isExpanded = expandedCollections.has(index), titleId = `review-collection-title-${index}`; 11233 return react_default.createElement(CollectionLandmark, { key: `${collection.title}-${index}`, titleId }, react_default.createElement(Card, null, react_default.createElement( 11234 Collapsible, 11235 { 11236 collapsed: !isExpanded, 11237 summary: react_default.createElement(CardHead, { onClick: () => toggleCollection(index) }, react_default.createElement(CardTitle, { id: titleId }, collection.title), react_default.createElement(CardControls, null, react_default.createElement( 11238 CardCount, 11239 { 11240 "aria-label": pluralize(storyIds.length, "story", "stories") 11241 }, 11242 storyIds.length 11243 ), react_default.createElement( 11244 IconButton, 11245 { 11246 variant: "ghost", 11247 size: "small", 11248 padding: "small", 11249 ariaLabel: isExpanded ? `Collapse collection ${collection.title}` : `Expand collection ${collection.title}`, 11250 "aria-expanded": isExpanded, 11251 onClick: (event) => { 11252 event.stopPropagation(), toggleCollection(index); 11253 } 11254 }, 11255 react_default.createElement( 11256 ToggleChevronIcon, 11257 { 11258 style: { transform: `rotate(${isExpanded ? -180 : 0}deg)` } 11259 } 11260 ) 11261 ))) 11262 }, 11263 collection.rationale ? react_default.createElement(CardRationale, null, react_default.createElement(Markdown, null, collection.rationale)) : null, 11264 react_default.createElement( 11265 CollectionGrid, 11266 { 11267 storyIds, 11268 showAll: showAllCollections.has(index), 11269 onShowAll: () => markCollectionShowAll(index), 11270 storyInfo, 11271 getStoryHref: (storyId) => buildReviewStoryHref({ collectionIndex: index, storyId }), 11272 getStoryPreviewHref, 11273 summaryHidden 11274 } 11275 ) 11276 ))); 11277 }), react_default.createElement(FooterLandmark, null, "This review shows the ", pluralize(storyCount, "story", "stories"), " most relevant for you to spot-check right now. Because this is AI-curated, results may be inaccurate or incomplete."))))); 11278}; 11279 11280// src/manager/components/review/screens/ReviewSummaryHost.tsx 11281var SummaryHost = styled.div(({ $visible }) => ({ 11282 position: "absolute", 11283 inset: 0, 11284 display: "flex", 11285 flexDirection: "column", 11286 overflow: "hidden", 11287 visibility: $visible ? "visible" : "hidden", 11288 pointerEvents: $visible ? "auto" : "none" 11289})), ReviewSummaryHost = () => { 11290 let api = useStorybookApi(), { review, storyInfo, banner, isInReviewMode, isSummaryVisible, dismiss } = useReviewContext(), getStoryPreviewHref = useCallback( 11291 (storyId) => api.getStoryHrefs(storyId, { embed: !0, freeze: !0 }).previewHref, 11292 [api] 11293 ); 11294 return !isSummaryVisible && !isInReviewMode ? null : react_default.createElement( 11295 SummaryHost, 11296 { 11297 ref: (node) => { 11298 node && (node.inert = !isSummaryVisible); 11299 }, 11300 $visible: isSummaryVisible, 11301 "aria-hidden": isSummaryVisible ? void 0 : !0, 11302 "data-review-summary": isSummaryVisible ? "visible" : "hidden" 11303 }, 11304 react_default.createElement( 11305 SummaryScreen, 11306 { 11307 state: review, 11308 storyInfo, 11309 getStoryPreviewHref, 11310 banner, 11311 summaryHidden: !isSummaryVisible, 11312 onDismiss: dismiss, 11313 returnSearch: sessionStore.read(PRE_REVIEW_RETURN_KEY) 11314 } 11315 ) 11316 ); 11317}; 11318 11319// src/manager/components/review/useReviewNavigationInterceptor.ts 11320init_react(); 11321var isReviewStoryHref = (href) => href.startsWith("?path=/story/") && href.includes(`${REVIEW_COLLECTION_QUERY_PARAM}=`), isReviewSummaryHref = (href) => href === buildReviewChangesSummaryHref(), useReviewNavigationInterceptor = () => { 11322 let { openSummary, openEntry, leaveReview } = useReviewContext(); 11323 useEffect(() => { 11324 let onClick = (event) => { 11325 if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) 11326 return; 11327 let { target } = event, anchor = target instanceof Element ? target.closest("a") : null, href = anchor?.getAttribute("href"); 11328 if (!href) 11329 return; 11330 if (anchor?.hasAttribute(REVIEW_SUMMARY_BACK_ATTR)) { 11331 event.preventDefault(), leaveReview(); 11332 return; 11333 } 11334 if (!isReviewStoryHref(href) && !isReviewSummaryHref(href)) 11335 return; 11336 if (event.preventDefault(), isReviewSummaryHref(href)) { 11337 openSummary(); 11338 return; 11339 } 11340 let entry = parseReviewStoryHref(href); 11341 entry && openEntry(entry); 11342 }; 11343 return document.addEventListener("click", onClick), () => document.removeEventListener("click", onClick); 11344 }, [openSummary, openEntry, leaveReview]); 11345}; 11346 11347// src/manager/components/review/components/ReviewNotification.tsx 11348init_react(); 11349 11350// src/manager/components/review/review-notification.ts 11351var isUnseen = (createdAt) => createdAt !== void 0 && sessionStore.read(VISITED_REVIEW_CREATED_AT_KEY) !== String(createdAt), readVisitedCreatedAt = () => { 11352 let raw = sessionStore.read(VISITED_REVIEW_CREATED_AT_KEY); 11353 if (raw === null) 11354 return; 11355 let visited = Number(raw); 11356 return Number.isFinite(visited) ? visited : void 0; 11357}, isSupersededByVisit = (createdAt) => { 11358 let visited = readVisitedCreatedAt(); 11359 return createdAt !== void 0 && visited !== void 0 && visited > createdAt; 11360}, readNotifiedCreatedAt = () => { 11361 let raw = sessionStore.read(NOTIFIED_REVIEW_CREATED_AT_KEY); 11362 if (raw === null) 11363 return; 11364 let notified = Number(raw); 11365 return Number.isFinite(notified) ? notified : void 0; 11366}, isOnReviewRoute = (path, collectionIndex) => isReviewSummaryPath(path) || path.startsWith("/story/") && collectionIndex !== void 0, shouldSkipArrivalNotification = (path, collectionIndex, review, displayed, deferred) => isOnReviewRoute(path, collectionIndex) ? deferred?.createdAt !== void 0 && deferred.createdAt === review.createdAt ? !0 : displayed?.createdAt !== void 0 && displayed.createdAt === review.createdAt : !1, pickReviewToNotify = (displayed, deferred) => deferred?.createdAt !== void 0 && isUnseen(deferred.createdAt) ? deferred : displayed?.createdAt !== void 0 && isUnseen(displayed.createdAt) && !isSupersededByVisit(displayed.createdAt) ? displayed : null, shouldAutoAcceptOnRoute = (path, collectionIndex, candidate, displayed, deferred) => { 11367 let createdAt = candidate.createdAt; 11368 return !(createdAt === void 0 || !isUnseen(createdAt) || displayed?.createdAt !== createdAt || !isOnReviewRoute(path, collectionIndex) || deferred?.createdAt !== void 0 && deferred.createdAt !== displayed.createdAt); 11369}, clearReviewNotifications = (api, ...createdAts) => { 11370 for (let createdAt of new Set( 11371 createdAts.filter((value) => value != null) 11372 )) 11373 api.clearNotification(reviewAvailableNotificationId(createdAt)); 11374 api.clearNotification(REVIEW_AVAILABLE_NOTIFICATION_ID); 11375}, acceptReviewNotification = (api, createdAt) => { 11376 createdAt !== void 0 && (clearReviewNotifications(api, createdAt), sessionStore.write(VISITED_REVIEW_CREATED_AT_KEY, String(createdAt)), sessionStore.write(NOTIFIED_REVIEW_CREATED_AT_KEY, String(createdAt))); 11377}, clearReviewNotificationsOnDismiss = (api, displayed, deferred) => { 11378 clearReviewNotifications(api, displayed?.createdAt, deferred?.createdAt, readNotifiedCreatedAt()), sessionStore.remove(VISITED_REVIEW_CREATED_AT_KEY), sessionStore.remove(NOTIFIED_REVIEW_CREATED_AT_KEY); 11379}, claimNotificationSlot = (api, createdAt, ...extraCreatedAts) => !isUnseen(createdAt) || readNotifiedCreatedAt() === createdAt ? !1 : (clearReviewNotifications(api, readNotifiedCreatedAt(), ...extraCreatedAts), sessionStore.write(NOTIFIED_REVIEW_CREATED_AT_KEY, String(createdAt)), !0), readCollectionIndex = (queryParams) => parseCollectionIndex(queryParams?.[REVIEW_COLLECTION_QUERY_PARAM]); 11380 11381// src/manager/components/review/components/ReviewNotification.tsx 11382var ReviewNotification = () => { 11383 let api = useStorybookApi(), { path, customQueryParams } = useStorybookState(), { review: displayed, pendingReview: deferred, banner, openSummary } = useReviewContext(), collectionIndex = readCollectionIndex(customQueryParams), deferredRef = useRef(deferred); 11384 deferredRef.current = deferred; 11385 let bannerRef = useRef(banner); 11386 bannerRef.current = banner; 11387 let handleNotificationClick = useCallback( 11388 (createdAt) => { 11389 let pendingReview = deferredRef.current, currentBanner = bannerRef.current; 11390 if (pendingReview?.createdAt === createdAt && currentBanner?.kind === "pending-update") { 11391 currentBanner.onAccept(); 11392 return; 11393 } 11394 acceptReviewNotification(api, createdAt), openSummary(); 11395 }, 11396 [api, openSummary] 11397 ); 11398 return useLayoutEffect(() => { 11399 let review = pickReviewToNotify(displayed, deferred); 11400 if (!review) 11401 return; 11402 if (shouldAutoAcceptOnRoute(path, collectionIndex, review, displayed, deferred)) { 11403 acceptReviewNotification(api, review.createdAt); 11404 return; 11405 } 11406 if (shouldSkipArrivalNotification(path, collectionIndex, review, displayed, deferred)) 11407 return; 11408 let createdAt = review.createdAt; 11409 createdAt === void 0 || !claimNotificationSlot(api, createdAt, displayed?.createdAt, deferred?.createdAt) || api.addNotification({ 11410 id: reviewAvailableNotificationId(createdAt), 11411 content: { 11412 headline: "New review available", 11413 subHeadline: review.title ?? "Open the curated review to spot-check your changes" 11414 }, 11415 icon: react_default.createElement(WandIcon, null), 11416 onClick: ({ onDismiss }) => { 11417 handleNotificationClick(createdAt), onDismiss(); 11418 } 11419 }); 11420 }, [api, collectionIndex, handleNotificationClick, displayed, deferred, path]), null; 11421}; 11422 11423// src/manager/components/review/components/ReviewPersistentLayer.tsx 11424var ReviewPersistentLayer = () => (useReviewNavigationInterceptor(), react_default.createElement(react_default.Fragment, null, react_default.createElement(ReviewNotification, null), react_default.createElement(ReviewSummaryHost, null))); 11425 11426// src/manager/components/review/components/ReviewProvider.tsx 11427init_react(); 11428 11429// global-externals:storybook/internal/types 11430var types_default = __STORYBOOK_TYPES__, { Addon_TypesEnum, CHANGE_DETECTION_STATUS_TYPE_ID, CoreWebpackCompiler, Feature, NON_AGGREGATED_STATUS_TYPE_IDS, REVIEW_EVENTS: REVIEW_EVENTS2, REVIEW_NAMESPACE: REVIEW_NAMESPACE2, REVIEW_STATUS_TYPE_ID, SupportedBuilder, SupportedFramework, SupportedLanguage, SupportedRenderer } = __STORYBOOK_TYPES__; 11431 11432// src/manager/components/review/review-status.ts 11433var REVIEWING_STATUS_VALUE = "status-value:reviewing", collectReviewStoryIds = (review) => { 11434 let storyIds = /* @__PURE__ */ new Set(); 11435 for (let collection of review.collections) 11436 for (let storyId of collection.storyIds) 11437 storyIds.add(storyId); 11438 return storyIds; 11439}, createReviewStatus = (storyId) => ({ 11440 storyId, 11441 typeId: REVIEW_STATUS_TYPE_ID, 11442 value: REVIEWING_STATUS_VALUE, 11443 title: "", 11444 description: "", 11445 sidebarContextMenu: !1 11446}), applyReviewStatuses = (statusStore, storyIds) => { 11447 statusStore.unset(), storyIds.size > 0 && statusStore.set([...storyIds].map(createReviewStatus)); 11448}, clearReviewStatuses = (statusStore) => { 11449 statusStore.unset(); 11450}; 11451 11452// src/manager/components/review/review-mode.ts 11453var FILTERS_SNAPSHOT_SESSION_KEY = `${REVIEW_NAMESPACE}/filters-snapshot`, stripReviewingStatusFilter = (filters) => ({ 11454 ...filters, 11455 includedStatusFilters: filters.includedStatusFilters.filter( 11456 (value) => value !== REVIEWING_STATUS_VALUE 11457 ), 11458 excludedStatusFilters: filters.excludedStatusFilters.filter( 11459 (value) => value !== REVIEWING_STATUS_VALUE 11460 ) 11461}), readJson = (key) => { 11462 let raw = sessionStore.read(key); 11463 if (raw === null) 11464 return null; 11465 try { 11466 return JSON.parse(raw); 11467 } catch { 11468 return null; 11469 } 11470}, enterReviewMode = async (api, filters, mode) => { 11471 if (!mode.isActive()) { 11472 sessionStore.write( 11473 FILTERS_SNAPSHOT_SESSION_KEY, 11474 JSON.stringify(stripReviewingStatusFilter(filters)) 11475 ), mode.setActive(!0); 11476 try { 11477 await api.setAllTagFilters([], []), await api.setAllStatusFilters([REVIEWING_STATUS_VALUE], []); 11478 } catch (error) { 11479 throw mode.setActive(!1), sessionStore.remove(FILTERS_SNAPSHOT_SESSION_KEY), error; 11480 } 11481 } 11482}, exitReviewMode = async (api, mode) => { 11483 let filters = readJson(FILTERS_SNAPSHOT_SESSION_KEY); 11484 if (filters) { 11485 let restored = stripReviewingStatusFilter(filters); 11486 await api.setAllTagFilters(restored.includedTagFilters, restored.excludedTagFilters), await api.setAllStatusFilters(restored.includedStatusFilters, restored.excludedStatusFilters); 11487 } else 11488 await api.removeStatusFilters([REVIEWING_STATUS_VALUE]); 11489 sessionStore.remove(FILTERS_SNAPSHOT_SESSION_KEY), mode.setActive(!1); 11490}; 11491 11492// src/manager/components/review/review-actions.ts 11493var navigateToReviewEntry = (api, navigate, entry, filters, mode) => { 11494 enterReviewMode(api, filters, mode), api.setQueryParams({ [REVIEW_COLLECTION_QUERY_PARAM]: String(entry.collectionIndex) }), navigate(buildReviewStoryTarget(entry)); 11495}, navigateToReviewSummary = (api, navigate, filters, mode) => { 11496 enterReviewMode(api, filters, mode), api.setQueryParams({ [REVIEW_COLLECTION_QUERY_PARAM]: null }), navigate(REVIEW_CHANGES_URL); 11497}, navigateOutOfReview = async (api, navigate, returnSearch, mode, { visitCreatedAt, onExitingChange } = {}) => { 11498 api.setQueryParams({ [REVIEW_COLLECTION_QUERY_PARAM]: null }), onExitingChange?.(!0); 11499 try { 11500 if (await exitReviewMode(api, mode), visitCreatedAt !== void 0 && acceptReviewNotification(api, visitCreatedAt), returnSearch && !isReviewReturnSearch(returnSearch)) { 11501 navigate(returnSearch.startsWith("?") ? returnSearch : `?${returnSearch}`, { plain: !0 }); 11502 return; 11503 } 11504 api.selectFirstStory(); 11505 } finally { 11506 onExitingChange?.(!1); 11507 } 11508}, dismissReview = async () => { 11509 try { 11510 await getService("core/review", { internal: !0 }).commands.dismissReview(void 0); 11511 } catch (error) { 11512 logger.error("Failed to dismiss review", error); 11513 } 11514}, acceptPendingReview = async (api, navigate, filters, mode, pending) => { 11515 if (pending) { 11516 try { 11517 await getService("core/review", { internal: !0 }).commands.acceptPending(void 0); 11518 } catch (error) { 11519 logger.error("Failed to accept pending review", error); 11520 return; 11521 } 11522 acceptReviewNotification(api, pending.createdAt), sessionStore.write(AUTO_ENTERED_SESSION_KEY, autoEnteredLatchValue(pending.createdAt)), enterReviewMode(api, filters, mode), navigate(buildReviewChangesSummaryHref(), { plain: !0 }); 11523 } 11524}; 11525 11526// src/manager/components/review/review-story-info.ts 11527var getStoryChangeStatus = (allStatuses, storyId) => { 11528 let changeValue = Object.values(allStatuses[storyId] ?? {}).find( 11529 (status) => status.typeId === CHANGE_DETECTION_STATUS_TYPE_ID 11530 )?.value; 11531 if (changeValue === "status-value:new") 11532 return "new"; 11533 if (changeValue === "status-value:modified") 11534 return "modified"; 11535}, buildNewlyAddedStoryIds = (state, allStatuses) => { 11536 let ids = /* @__PURE__ */ new Set(), isChangeDetectedNew = (storyId) => Object.values(allStatuses[storyId] ?? {}).some((status) => status.value === "status-value:new"); 11537 for (let collection of state.collections) 11538 for (let storyId of collection.storyIds) 11539 isChangeDetectedNew(storyId) && ids.add(storyId); 11540 return ids; 11541}, resolveStoryTitleAndName = (storyId, internalIndex, index, api) => { 11542 let fromInternal = internalIndex?.entries[storyId]; 11543 if (fromInternal?.type === "story" && fromInternal.title) 11544 return { title: fromInternal.title, name: fromInternal.name }; 11545 let direct = index?.[storyId], entry = direct?.type === "story" ? direct : index ? api.findLeafEntry(index, storyId) : void 0; 11546 return entry?.type === "story" && entry.title ? { title: entry.title, name: entry.name } : fallbackStoryInfo(storyId); 11547}, buildStoryInfo = (state, index, internalIndex, api, allStatuses, newlyAddedStoryIds) => { 11548 let info = {}; 11549 for (let collection of state.collections) 11550 for (let storyId of collection.storyIds) 11551 storyId in info || (info[storyId] = { 11552 ...resolveStoryTitleAndName(storyId, internalIndex, index, api), 11553 isNewlyAdded: newlyAddedStoryIds.has(storyId) || void 0, 11554 changeStatus: getStoryChangeStatus(allStatuses, storyId) 11555 }); 11556 return info; 11557}; 11558 11559// src/manager/components/review/useReviewFiltersRef.ts 11560init_react(); 11561var useReviewFiltersRef = () => { 11562 let { includedStatusFilters, excludedStatusFilters, includedTagFilters, excludedTagFilters } = useStorybookState(), filtersRef = useRef({ 11563 includedStatusFilters: [], 11564 excludedStatusFilters: [], 11565 includedTagFilters: [], 11566 excludedTagFilters: [] 11567 }); 11568 return filtersRef.current = { 11569 includedStatusFilters: includedStatusFilters ?? [], 11570 excludedStatusFilters: excludedStatusFilters ?? [], 11571 includedTagFilters: includedTagFilters ?? [], 11572 excludedTagFilters: excludedTagFilters ?? [] 11573 }, filtersRef; 11574}; 11575 11576// src/manager/components/review/components/ReviewProvider.tsx 11577var reviewStatusStore = experimental_getStatusStore(REVIEW_STATUS_TYPE_ID), EMPTY_ENTRIES = [], ReviewProvider = ({ children }) => { 11578 let api = useStorybookApi(), navigate = useNavigate(), { index, internal_index, path, viewMode, customQueryParams, location: location2 } = useStorybookState(), reviewService = getService("core/review", { internal: !0 }), { data: currentData } = useServiceQuery(reviewService.queries.current), { data: pendingData } = useServiceQuery(reviewService.queries.pending), { data: entriesData } = useServiceQuery(reviewService.queries.flattenedEntries), { data: bannerKind } = useServiceQuery(reviewService.queries.bannerKind), review = currentData ?? null, pendingReview = pendingData ?? null, flattenedEntries = entriesData ?? EMPTY_ENTRIES, [isInReviewMode, setIsInReviewMode] = useState( 11579 () => sessionStore.read(REVIEW_MODE_SESSION_KEY) === "1" 11580 ), isInReviewModeRef = useRef(isInReviewMode), mode = useMemo( 11581 () => ({ 11582 isActive: () => isInReviewModeRef.current, 11583 setActive: (active) => { 11584 isInReviewModeRef.current = active, active ? sessionStore.write(REVIEW_MODE_SESSION_KEY, "1") : sessionStore.remove(REVIEW_MODE_SESSION_KEY), setIsInReviewMode(active); 11585 } 11586 }), 11587 [] 11588 ), isExitingRef = useRef(!1), setExiting = useCallback((exiting) => { 11589 isExitingRef.current = exiting; 11590 }, []), lastPageviewKeyRef = useRef(null), lastProjectedRef = useRef({ current: null, pending: null }), collectionParam = customQueryParams?.[REVIEW_COLLECTION_QUERY_PARAM], filtersRef = useReviewFiltersRef(), isSummaryVisible = isReviewSummaryPath(path), isSummaryVisibleRef = useRef(isSummaryVisible); 11591 isSummaryVisibleRef.current = isSummaryVisible, useEffect(() => { 11592 if (currentData === void 0) 11593 return; 11594 let previous = lastProjectedRef.current; 11595 if (lastProjectedRef.current = { current: currentData, pending: pendingData ?? null }, currentData === null) { 11596 if (previous.current === null && previous.pending === null) 11597 return; 11598 clearReviewStatuses(reviewStatusStore), sessionStore.remove(AUTO_ENTERED_SESSION_KEY), clearReviewNotificationsOnDismiss(api, previous.current, previous.pending), (isInReviewModeRef.current || isSummaryVisibleRef.current) && navigateOutOfReview(api, navigate, sessionStore.read(PRE_REVIEW_RETURN_KEY), mode, { 11599 onExitingChange: setExiting 11600 }); 11601 return; 11602 } 11603 }, [api, navigate, mode, setExiting, currentData, pendingData]), useEffect(() => { 11604 review && applyReviewStatuses(reviewStatusStore, collectReviewStoryIds(review)); 11605 }, [review]); 11606 let allStatuses = experimental_useStatusStore(), newlyAddedStoryIds = useMemo( 11607 () => review ? buildNewlyAddedStoryIds(review, allStatuses) : /* @__PURE__ */ new Set(), 11608 [allStatuses, review] 11609 ), storyInfo = useMemo( 11610 () => review ? buildStoryInfo(review, index, internal_index, api, allStatuses, newlyAddedStoryIds) : {}, 11611 [allStatuses, api, index, internal_index, newlyAddedStoryIds, review] 11612 ), collectionIndex = parseCollectionIndex(collectionParam), storyIdFromPath = parseStoryIdFromPath(path), activeEntry = review && storyIdFromPath ? resolveActiveNavEntry(flattenedEntries, storyIdFromPath, collectionIndex) : null, activeIndex = activeEntry ? resolveNavIndex(flattenedEntries, activeEntry) : -1, openSummary = useCallback(() => { 11613 navigateToReviewSummary(api, navigate, filtersRef.current, mode); 11614 }, [api, navigate, filtersRef, mode]), openEntry = useCallback( 11615 (entry) => { 11616 navigateToReviewEntry(api, navigate, entry, filtersRef.current, mode); 11617 }, 11618 [api, navigate, filtersRef, mode] 11619 ), reviewCreatedAt = review?.createdAt, leaveReview = useCallback(() => { 11620 navigateOutOfReview(api, navigate, sessionStore.read(PRE_REVIEW_RETURN_KEY), mode, { 11621 visitCreatedAt: reviewCreatedAt, 11622 onExitingChange: setExiting 11623 }); 11624 }, [api, navigate, mode, reviewCreatedAt, setExiting]), hasReview = review !== null, dismiss = useCallback(() => { 11625 if (!hasReview) { 11626 navigateOutOfReview(api, navigate, sessionStore.read(PRE_REVIEW_RETURN_KEY), mode, { 11627 onExitingChange: setExiting 11628 }); 11629 return; 11630 } 11631 dismissReview(); 11632 }, [api, navigate, mode, hasReview, setExiting]), onAcceptPendingUpdate = useCallback(() => { 11633 acceptPendingReview(api, navigate, filtersRef.current, mode, pendingReview); 11634 }, [api, navigate, filtersRef, mode, pendingReview]), banner = useMemo( 11635 () => bannerKind === "pending-update" ? { kind: "pending-update", onAccept: onAcceptPendingUpdate } : bannerKind === "stale" ? { kind: "stale" } : null, 11636 [bannerKind, onAcceptPendingUpdate] 11637 ); 11638 useEffect(() => { 11639 if (!review) { 11640 lastPageviewKeyRef.current = null; 11641 return; 11642 } 11643 let page = null, key = null; 11644 isSummaryVisible ? (page = "summary", key = "summary") : isInReviewMode && activeEntry && (page = "detail", key = `detail:${activeEntry.storyId}`), !(!page || key === lastPageviewKeyRef.current) && (lastPageviewKeyRef.current = key, api.emit(REVIEW_EVENTS.PAGEVIEW, { page, reviewCreatedAt: review.createdAt })); 11645 }, [review, isSummaryVisible, isInReviewMode, activeEntry, api]), useEffect(() => { 11646 if (!review || !isSummaryVisible || mode.isActive() || isExitingRef.current) 11647 return; 11648 let latch = autoEnteredLatchValue(review.createdAt); 11649 sessionStore.read(AUTO_ENTERED_SESSION_KEY) !== latch && (sessionStore.write(AUTO_ENTERED_SESSION_KEY, latch), enterReviewMode(api, filtersRef.current, mode)); 11650 }, [review, isSummaryVisible, api, filtersRef, mode]), useEffect(() => { 11651 if (isInReviewMode || viewMode !== "story" && viewMode !== "docs") 11652 return; 11653 let search = location2?.search; 11654 search && !isReviewReturnSearch(search) && sessionStore.write(PRE_REVIEW_RETURN_KEY, search); 11655 }, [isInReviewMode, viewMode, location2?.search]); 11656 let value = useMemo( 11657 () => ({ 11658 review, 11659 pendingReview, 11660 storyInfo, 11661 flattenedEntries, 11662 newlyAddedStoryIds, 11663 activeEntry, 11664 activeIndex, 11665 isSummaryVisible, 11666 banner, 11667 isInReviewMode, 11668 openSummary, 11669 openEntry, 11670 leaveReview, 11671 dismiss 11672 }), 11673 [ 11674 review, 11675 pendingReview, 11676 storyInfo, 11677 flattenedEntries, 11678 newlyAddedStoryIds, 11679 activeEntry, 11680 activeIndex, 11681 isSummaryVisible, 11682 banner, 11683 isInReviewMode, 11684 openSummary, 11685 openEntry, 11686 leaveReview, 11687 dismiss 11688 ] 11689 ); 11690 return react_default.createElement(ReviewContext.Provider, { value }, children); 11691}; 11692 11693// src/manager/container/Panel.tsx 11694init_react(); 11695 11696// src/core-events/index.ts 11697var events = /* @__PURE__ */ ((events2) => (events2.CHANNEL_WS_DISCONNECT = "channelWSDisconnect", events2.CHANNEL_CREATED = "channelCreated", events2.CONFIG_ERROR = "configError", events2.STORY_INDEX_INVALIDATED = "storyIndexInvalidated", events2.STORY_SPECIFIED = "storySpecified", events2.SET_CONFIG = "setConfig", events2.SET_STORIES = "setStories", events2.SET_INDEX = "setIndex", events2.SET_CURRENT_STORY = "setCurrentStory", events2.CURRENT_STORY_WAS_SET = "currentStoryWasSet", events2.FORCE_RE_RENDER = "forceReRender", events2.FORCE_REMOUNT = "forceRemount", events2.PRELOAD_ENTRIES = "preloadStories", events2.STORY_PREPARED = "storyPrepared", events2.DOCS_PREPARED = "docsPrepared", events2.STORY_CHANGED = "storyChanged", events2.STORY_UNCHANGED = "storyUnchanged", events2.STORY_RENDERED = "storyRendered", events2.STORY_FINISHED = "storyFinished", events2.STORY_MISSING = "storyMissing", events2.STORY_ERRORED = "storyErrored", events2.STORY_THREW_EXCEPTION = "storyThrewException", events2.STORY_RENDER_PHASE_CHANGED = "storyRenderPhaseChanged", events2.STORY_HOT_UPDATED = "storyHotUpdated", events2.PLAY_FUNCTION_THREW_EXCEPTION = "playFunctionThrewException", events2.UNHANDLED_ERRORS_WHILE_PLAYING = "unhandledErrorsWhilePlaying", events2.UPDATE_STORY_ARGS = "updateStoryArgs", events2.STORY_ARGS_UPDATED = "storyArgsUpdated", events2.RESET_STORY_ARGS = "resetStoryArgs", events2.SET_FILTER = "setFilter", events2.SET_GLOBALS = "setGlobals", events2.UPDATE_GLOBALS = "updateGlobals", events2.GLOBALS_UPDATED = "globalsUpdated", events2.REGISTER_SUBSCRIPTION = "registerSubscription", events2.PREVIEW_INITIALIZED = "previewInitialized", events2.PREVIEW_KEYDOWN = "previewKeydown", events2.PREVIEW_BUILDER_PROGRESS = "preview_builder_progress", events2.SELECT_STORY = "selectStory", events2.STORIES_COLLAPSE_ALL = "storiesCollapseAll", events2.STORIES_EXPAND_ALL = "storiesExpandAll", events2.DOCS_RENDERED = "docsRendered", events2.SHARED_STATE_CHANGED = "sharedStateChanged", events2.SHARED_STATE_SET = "sharedStateSet", events2.NAVIGATE_URL = "navigateUrl", events2.UPDATE_QUERY_PARAMS = "updateQueryParams", events2.REQUEST_WHATS_NEW_DATA = "requestWhatsNewData", events2.RESULT_WHATS_NEW_DATA = "resultWhatsNewData", events2.SET_WHATS_NEW_CACHE = "setWhatsNewCache", events2.TOGGLE_WHATS_NEW_NOTIFICATIONS = "toggleWhatsNewNotifications", events2.TELEMETRY_ERROR = "telemetryError", events2.FILE_COMPONENT_SEARCH_REQUEST = "fileComponentSearchRequest", events2.FILE_COMPONENT_SEARCH_RESPONSE = "fileComponentSearchResponse", events2.SAVE_STORY_REQUEST = "saveStoryRequest", events2.SAVE_STORY_RESPONSE = "saveStoryResponse", events2.ARGTYPES_INFO_REQUEST = "argtypesInfoRequest", events2.ARGTYPES_INFO_RESPONSE = "argtypesInfoResponse", events2.CREATE_NEW_STORYFILE_REQUEST = "createNewStoryfileRequest", events2.CREATE_NEW_STORYFILE_RESPONSE = "createNewStoryfileResponse", events2.GHOST_STORIES_REQUEST = "ghostStoriesRequest", events2.GHOST_STORIES_RESPONSE = "ghostStoriesResponse", events2.AI_SETUP_ANALYTICS_RESPONSE = "aiSetupAnalyticsResponse", events2.AI_SETUP_ANALYTICS_REQUEST = "aiSetupAnalyticsRequest", events2.OPEN_IN_EDITOR_REQUEST = "openInEditorRequest", events2.OPEN_IN_EDITOR_RESPONSE = "openInEditorResponse", events2.MANAGER_INERT_ATTRIBUTE_CHANGED = "managerInertAttributeChanged", events2.SHARE_ISOLATE_MODE = "shareIsolateMode", events2.AI_PROMPT_NUDGE = "aiPromptNudge", events2.SIDEBAR_FILTER_CHANGED = "sidebarFilterChanged", events2))(events || {}); 11698var { 11699 CHANNEL_WS_DISCONNECT: CHANNEL_WS_DISCONNECT2, 11700 CHANNEL_CREATED: CHANNEL_CREATED2, 11701 CONFIG_ERROR: CONFIG_ERROR2, 11702 CREATE_NEW_STORYFILE_REQUEST: CREATE_NEW_STORYFILE_REQUEST2, 11703 CREATE_NEW_STORYFILE_RESPONSE: CREATE_NEW_STORYFILE_RESPONSE2, 11704 CURRENT_STORY_WAS_SET: CURRENT_STORY_WAS_SET2, 11705 DOCS_PREPARED: DOCS_PREPARED2, 11706 DOCS_RENDERED: DOCS_RENDERED2, 11707 FILE_COMPONENT_SEARCH_REQUEST: FILE_COMPONENT_SEARCH_REQUEST2, 11708 FILE_COMPONENT_SEARCH_RESPONSE: FILE_COMPONENT_SEARCH_RESPONSE2, 11709 FORCE_RE_RENDER: FORCE_RE_RENDER2, 11710 FORCE_REMOUNT: FORCE_REMOUNT2, 11711 GLOBALS_UPDATED: GLOBALS_UPDATED2, 11712 NAVIGATE_URL: NAVIGATE_URL2, 11713 PLAY_FUNCTION_THREW_EXCEPTION: PLAY_FUNCTION_THREW_EXCEPTION2, 11714 UNHANDLED_ERRORS_WHILE_PLAYING: UNHANDLED_ERRORS_WHILE_PLAYING2, 11715 PRELOAD_ENTRIES: PRELOAD_ENTRIES2, 11716 PREVIEW_INITIALIZED: PREVIEW_INITIALIZED2, 11717 PREVIEW_BUILDER_PROGRESS: PREVIEW_BUILDER_PROGRESS2, 11718 PREVIEW_KEYDOWN: PREVIEW_KEYDOWN2, 11719 REGISTER_SUBSCRIPTION: REGISTER_SUBSCRIPTION2, 11720 RESET_STORY_ARGS: RESET_STORY_ARGS2, 11721 SELECT_STORY: SELECT_STORY2, 11722 SET_CONFIG: SET_CONFIG2, 11723 SET_CURRENT_STORY: SET_CURRENT_STORY2, 11724 SET_FILTER: SET_FILTER2, 11725 SET_GLOBALS: SET_GLOBALS2, 11726 SET_INDEX: SET_INDEX2, 11727 SET_STORIES: SET_STORIES2, 11728 SHARED_STATE_CHANGED: SHARED_STATE_CHANGED2, 11729 SHARED_STATE_SET: SHARED_STATE_SET2, 11730 STORIES_COLLAPSE_ALL: STORIES_COLLAPSE_ALL2, 11731 STORIES_EXPAND_ALL: STORIES_EXPAND_ALL2, 11732 STORY_ARGS_UPDATED: STORY_ARGS_UPDATED2, 11733 STORY_CHANGED: STORY_CHANGED2, 11734 STORY_ERRORED: STORY_ERRORED2, 11735 STORY_INDEX_INVALIDATED: STORY_INDEX_INVALIDATED2, 11736 STORY_MISSING: STORY_MISSING2, 11737 STORY_PREPARED: STORY_PREPARED2, 11738 STORY_RENDER_PHASE_CHANGED: STORY_RENDER_PHASE_CHANGED2, 11739 STORY_RENDERED: STORY_RENDERED2, 11740 STORY_FINISHED: STORY_FINISHED2, 11741 STORY_SPECIFIED: STORY_SPECIFIED2, 11742 STORY_THREW_EXCEPTION: STORY_THREW_EXCEPTION2, 11743 STORY_UNCHANGED: STORY_UNCHANGED2, 11744 STORY_HOT_UPDATED: STORY_HOT_UPDATED2, 11745 UPDATE_GLOBALS: UPDATE_GLOBALS2, 11746 UPDATE_QUERY_PARAMS: UPDATE_QUERY_PARAMS2, 11747 UPDATE_STORY_ARGS: UPDATE_STORY_ARGS2, 11748 REQUEST_WHATS_NEW_DATA: REQUEST_WHATS_NEW_DATA2, 11749 RESULT_WHATS_NEW_DATA: RESULT_WHATS_NEW_DATA2, 11750 SET_WHATS_NEW_CACHE: SET_WHATS_NEW_CACHE2, 11751 TOGGLE_WHATS_NEW_NOTIFICATIONS: TOGGLE_WHATS_NEW_NOTIFICATIONS2, 11752 TELEMETRY_ERROR: TELEMETRY_ERROR2, 11753 SAVE_STORY_REQUEST: SAVE_STORY_REQUEST2, 11754 SAVE_STORY_RESPONSE: SAVE_STORY_RESPONSE2, 11755 ARGTYPES_INFO_REQUEST: ARGTYPES_INFO_REQUEST2, 11756 ARGTYPES_INFO_RESPONSE: ARGTYPES_INFO_RESPONSE2, 11757 GHOST_STORIES_REQUEST: GHOST_STORIES_REQUEST2, 11758 GHOST_STORIES_RESPONSE: GHOST_STORIES_RESPONSE2, 11759 AI_SETUP_ANALYTICS_RESPONSE: AI_SETUP_ANALYTICS_RESPONSE2, 11760 AI_SETUP_ANALYTICS_REQUEST: AI_SETUP_ANALYTICS_REQUEST2, 11761 OPEN_IN_EDITOR_REQUEST: OPEN_IN_EDITOR_REQUEST2, 11762 OPEN_IN_EDITOR_RESPONSE: OPEN_IN_EDITOR_RESPONSE2, 11763 MANAGER_INERT_ATTRIBUTE_CHANGED: MANAGER_INERT_ATTRIBUTE_CHANGED2, 11764 SHARE_ISOLATE_MODE: SHARE_ISOLATE_MODE2, 11765 AI_PROMPT_NUDGE: AI_PROMPT_NUDGE2, 11766 SIDEBAR_FILTER_CHANGED: SIDEBAR_FILTER_CHANGED2 11767} = events; 11768 11769// src/manager/components/panel/Panel.tsx 11770init_react(); 11771var TabErrorBoundary = class extends Component { 11772 constructor(props) { 11773 super(props), this.state = { hasError: !1 }; 11774 } 11775 static getDerivedStateFromError() { 11776 return { hasError: !0 }; 11777 } 11778 componentDidCatch(error, info) { 11779 console.error("Error rendering addon panel"), console.error(error), console.error(info.componentStack); 11780 } 11781 render() { 11782 let { hasError } = this.state; 11783 if (hasError) 11784 return react_default.createElement( 11785 EmptyTabContent, 11786 { 11787 title: "This addon has errors", 11788 description: "Check your browser logs and addon code to pinpoint what went wrong. This issue was not caused by Storybook." 11789 } 11790 ); 11791 let { children } = this.props; 11792 return children; 11793 } 11794}, Aside = styled.aside({ 11795 height: "100%", 11796 display: "flex", 11797 flexDirection: "column" 11798}); 11799function renderChild(RenderProp) { 11800 return react_default.createElement(RenderProp, { active: !0 }); 11801} 11802var PreRenderAddons = ({ panels }) => Object.entries(panels).map(([k2, v2]) => react_default.createElement(StatelessTabPanel, { key: k2, name: k2, hasScrollbar: !1 }, react_default.createElement(TabErrorBoundary, { key: k2 }, renderChild(v2.render)))), AddonPanel2 = react_default.memo(({ panels, shortcuts, actions, selectedPanel = null, panelPosition = "right" }) => { 11803 let { isDesktop, setMobilePanelOpen } = useLayout(), emptyState = react_default.createElement( 11804 EmptyTabContent, 11805 { 11806 title: "Storybook add-ons", 11807 description: react_default.createElement(react_default.Fragment, null, "Integrate your tools with Storybook to connect workflows and unlock advanced features."), 11808 footer: react_default.createElement(Link, { href: "https://storybook.js.org/addons?ref=ui", target: "_blank", withArrow: !0 }, react_default.createElement(DocumentIcon, null), " Explore integrations catalog") 11809 } 11810 ), tools = useMemo( 11811 () => react_default.createElement(ActionsWrapper, null, isDesktop ? react_default.createElement(react_default.Fragment, null, react_default.createElement( 11812 Button, 11813 { 11814 key: "position", 11815 padding: "small", 11816 variant: "ghost", 11817 onClick: actions.togglePosition, 11818 ariaLabel: panelPosition === "bottom" ? "Move addon panel to right" : "Move addon panel to bottom", 11819 ariaDescription: "Changes the location of the addon panel to the bottom or right of the screen, but does not have any effect on its content.", 11820 shortcut: shortcuts.panelPosition 11821 }, 11822 panelPosition === "bottom" ? react_default.createElement(SidebarAltIcon, null) : react_default.createElement(BottomBarIcon, null) 11823 ), react_default.createElement( 11824 Button, 11825 { 11826 key: "visibility", 11827 padding: "small", 11828 variant: "ghost", 11829 onClick: actions.toggleVisibility, 11830 ariaLabel: "Hide addon panel", 11831 shortcut: shortcuts.togglePanel 11832 }, 11833 react_default.createElement(CloseIcon, null) 11834 )) : react_default.createElement( 11835 Button, 11836 { 11837 padding: "small", 11838 variant: "ghost", 11839 onClick: () => setMobilePanelOpen(!1), 11840 ariaLabel: "Close addon panel" 11841 }, 11842 react_default.createElement(CloseIcon, null) 11843 )), 11844 [actions, isDesktop, panelPosition, setMobilePanelOpen, shortcuts] 11845 ), asideRef = useRef(null), { landmarkProps } = useLandmark( 11846 { "aria-labelledby": "storybook-panel-heading", role: "region" }, 11847 asideRef 11848 ); 11849 return react_default.createElement(Aside, { ref: asideRef, id: focusableUIElements.addonPanel, ...landmarkProps }, react_default.createElement("h2", { id: "storybook-panel-heading", className: "sb-sr-only" }, "Addon panel"), react_default.createElement( 11850 StatelessTabsView, 11851 { 11852 id: focusableUIElements.storyPanelRoot, 11853 showToolsWhenEmpty: !0, 11854 emptyState, 11855 selected: selectedPanel ?? void 0, 11856 onSelectionChange: (id) => actions.onSelect(id), 11857 tools 11858 }, 11859 react_default.createElement(StatelessTabList, { "aria-label": "Available addons" }, Object.entries(panels).map(([k2, v2]) => react_default.createElement(StatelessTab, { key: k2, name: k2 }, typeof v2.title == "function" ? react_default.createElement(v2.title, null) : v2.title))), 11860 Object.keys(panels).length ? react_default.createElement(PreRenderAddons, { panels }) : null 11861 )); 11862}); 11863AddonPanel2.displayName = "AddonPanel"; 11864var ActionsWrapper = styled.div({ 11865 display: "flex", 11866 alignItems: "center", 11867 gap: 6 11868}); 11869 11870// src/manager/container/Panel.tsx 11871var Panel = (props) => { 11872 let api = useStorybookApi(), state = useStorybookState(), [story, setStory] = useState(api.getCurrentStoryData()); 11873 useChannel( 11874 { 11875 [STORY_PREPARED2]: () => { 11876 setStory(api.getCurrentStoryData()); 11877 } 11878 }, 11879 [] 11880 ); 11881 let { parameters, type } = story ?? {}, panelActions = useMemo( 11882 () => ({ 11883 onSelect: (panel) => api.setSelectedPanel(panel), 11884 toggleVisibility: async () => { 11885 let wasPanelShown = api.getIsPanelShown(); 11886 api.togglePanel(), wasPanelShown && await api.focusOnUIElement(focusableUIElements.showAddonPanel) === !1 && document.body.focus(); 11887 }, 11888 togglePosition: () => api.togglePanelPosition() 11889 }), 11890 [api] 11891 ), panels = useMemo(() => { 11892 let allPanels = api.getElements(Addon_TypesEnum.PANEL); 11893 if (!allPanels || type !== "story") 11894 return allPanels; 11895 let filteredPanels = {}; 11896 return Object.entries(allPanels).forEach(([id, p2]) => { 11897 let { paramKey } = p2; 11898 paramKey && parameters && parameters[paramKey] && parameters[paramKey].disable || p2.disabled === !0 || typeof p2.disabled == "function" && p2.disabled(parameters) || (filteredPanels[id] = p2); 11899 }), filteredPanels; 11900 }, [api, type, parameters]); 11901 return react_default.createElement( 11902 AddonPanel2, 11903 { 11904 panels, 11905 selectedPanel: api.getSelectedPanel(), 11906 panelPosition: state.layout.panelPosition, 11907 actions: panelActions, 11908 shortcuts: api.getShortcutKeys(), 11909 ...props 11910 } 11911 ); 11912}, Panel_default = Panel; 11913 11914// src/manager/container/Preview.tsx 11915init_react(); 11916var import_memoizerific2 = __toESM(require_memoizerific(), 1); 11917 11918// src/manager/components/preview/Preview.tsx 11919init_react(); 11920 11921// src/manager/components/review/components/ReviewToolbarHeader.tsx 11922init_react(); 11923 11924// src/manager/components/review/components/ReviewCollectionPicker.tsx 11925init_react(); 11926var derivePickerLabel = (storyId, info) => { 11927 if (info) 11928 return { component: info.title.split("/").pop() ?? info.title, story: info.name }; 11929 let [componentId, ...rest2] = storyId.split("--"); 11930 return { 11931 component: prettifyComponentId(componentId), 11932 story: prettifyComponentId(rest2.join("--")) || "Story" 11933 }; 11934}, ReviewCollectionPicker = ({ 11935 entries, 11936 activeEntry, 11937 storyInfo, 11938 children 11939}) => { 11940 let { openEntry } = useReviewContext(), options2 = entries.map((entry, index) => { 11941 let { component, story } = derivePickerLabel(entry.storyId, storyInfo[entry.storyId]); 11942 return { value: index, title: component, description: story }; 11943 }), activeValue = resolveNavIndex(entries, activeEntry), [nextStory, setNextStory] = react_default.useState(void 0); 11944 return useEffect(() => { 11945 nextStory && openEntry(nextStory); 11946 }, [nextStory, openEntry]), react_default.createElement( 11947 Select, 11948 { 11949 ariaLabel: "Select story", 11950 size: "small", 11951 padding: "small", 11952 options: options2, 11953 defaultOptions: activeValue >= 0 ? activeValue : void 0, 11954 showSelectedOptionTitle: !1, 11955 onSelect: (value) => { 11956 let entry = typeof value == "number" ? entries[value] : void 0; 11957 setNextStory(entry); 11958 } 11959 }, 11960 children 11961 ); 11962}; 11963 11964// src/manager/components/review/components/ReviewToolbarHeader.tsx 11965var Root2 = styled.div(({ theme }) => ({ 11966 display: "flex", 11967 flexDirection: "column", 11968 flexShrink: 0, 11969 width: "100%", 11970 background: theme.background.content, 11971 zIndex: 4 11972})), HeaderWrap = styled.div({ 11973 position: "relative", 11974 flexShrink: 0 11975}), ProgressBar = styled.div(({ theme }) => ({ 11976 position: "absolute", 11977 top: 0, 11978 left: 0, 11979 zIndex: 1, 11980 width: "100%", 11981 height: 3, 11982 overflow: "hidden", 11983 background: theme.background.app 11984})), ProgressFill = styled.div(({ theme }) => ({ 11985 position: "absolute", 11986 insetBlock: 0, 11987 left: 0, 11988 background: theme.color.secondary, 11989 transition: "width 200ms ease" 11990})), SubtitleStrong = styled.span(({ theme }) => ({ 11991 fontWeight: 700, 11992 color: theme.color.defaultText 11993})), SubtitleSeparator = styled.span(({ theme }) => ({ 11994 color: theme.color.defaultText 11995})), SubtitleText = styled.span(({ theme }) => ({ 11996 color: theme.color.defaultText 11997})), Counter = styled.span(({ theme }) => ({ 11998 fontVariantNumeric: "tabular-nums", 11999 fontFamily: theme.typography.fonts.mono, 12000 fontWeight: theme.typography.weight.regular 12001})), NavButton = ({ 12002 entry, 12003 ariaLabel, 12004 icon 12005}) => entry ? react_default.createElement(Button, { variant: "ghost", size: "small", padding: "small", ariaLabel, asChild: !0 }, react_default.createElement("a", { href: buildReviewStoryHref(entry) }, icon)) : react_default.createElement(Button, { variant: "ghost", size: "small", padding: "small", ariaLabel, disabled: !0 }, icon), componentName = (componentTitle) => componentTitle.split("/").map((part) => part.trim()).filter(Boolean).pop() ?? componentTitle, ReviewToolbarHeader = () => { 12006 let { 12007 review, 12008 banner, 12009 storyInfo, 12010 flattenedEntries, 12011 newlyAddedStoryIds, 12012 activeEntry, 12013 activeIndex 12014 } = useReviewContext(); 12015 if (!review || !activeEntry || activeIndex < 0) 12016 return null; 12017 let collectionTitle = review.collections[activeEntry.collectionIndex]?.title ?? "Review", totalStories = flattenedEntries.length, hasPrevious = activeIndex > 0, hasNext = activeIndex < totalStories - 1, previousEntry = hasPrevious ? flattenedEntries[activeIndex - 1] : null, nextEntry = hasNext ? flattenedEntries[activeIndex + 1] : null, progress = totalStories > 1 ? activeIndex / (totalStories - 1) : 0, currentStoryInfo = storyInfo[activeEntry.storyId], isNewlyAdded = newlyAddedStoryIds.has(activeEntry.storyId), metadataSubtitle = currentStoryInfo?.title && currentStoryInfo.name ? react_default.createElement(react_default.Fragment, null, react_default.createElement(SubtitleStrong, null, componentName(currentStoryInfo.title)), react_default.createElement(SubtitleSeparator, null, "/"), react_default.createElement(SubtitleText, null, currentStoryInfo.name)) : null, subtitle = metadataSubtitle || isNewlyAdded ? react_default.createElement(react_default.Fragment, null, metadataSubtitle, isNewlyAdded ? react_default.createElement(Badge, { status: "positive" }, "New") : null) : void 0; 12018 return react_default.createElement(Root2, { "data-testid": "review-toolbar-header" }, banner && react_default.createElement(AttentionBanner, { ...banner }), react_default.createElement(HeaderWrap, null, react_default.createElement( 12019 ProgressBar, 12020 { 12021 role: "progressbar", 12022 "aria-label": "Review progress", 12023 "aria-valuenow": activeIndex + 1, 12024 "aria-valuemin": 1, 12025 "aria-valuemax": totalStories, 12026 "data-testid": "review-progress" 12027 }, 12028 react_default.createElement( 12029 ProgressFill, 12030 { 12031 "data-testid": "review-progress-fill", 12032 style: { width: `${progress * 100}%` } 12033 } 12034 ) 12035 ), react_default.createElement( 12036 ReviewHeader, 12037 { 12038 variant: "toolbar", 12039 leading: react_default.createElement(Button, { variant: "ghost", size: "small", padding: "small", ariaLabel: "Back to review", asChild: !0 }, react_default.createElement("a", { href: buildReviewChangesSummaryHref() }, react_default.createElement(ChevronSmallLeftIcon, null), react_default.createElement(WandIcon, null))), 12040 title: collectionTitle, 12041 subtitle, 12042 actions: react_default.createElement(react_default.Fragment, null, react_default.createElement( 12043 ReviewCollectionPicker, 12044 { 12045 entries: flattenedEntries, 12046 activeEntry, 12047 storyInfo 12048 }, 12049 react_default.createElement(Counter, null, activeIndex + 1, "/", totalStories) 12050 ), react_default.createElement( 12051 NavButton, 12052 { 12053 entry: previousEntry, 12054 ariaLabel: "Previous story", 12055 icon: react_default.createElement(ChevronSmallLeftIcon, null) 12056 } 12057 ), react_default.createElement( 12058 NavButton, 12059 { 12060 entry: nextEntry, 12061 ariaLabel: "Next story", 12062 icon: react_default.createElement(ChevronSmallRightIcon, null) 12063 } 12064 )) 12065 } 12066 ))); 12067}; 12068 12069// src/manager/components/preview/FramesRenderer.tsx 12070init_react(); 12071 12072// src/manager/components/preview/Viewport.tsx 12073init_react(); 12074 12075// src/viewport/useViewport.ts 12076init_react(); 12077 12078// src/viewport/defaults.ts 12079var MINIMAL_VIEWPORTS = { 12080 mobile1: { 12081 name: "Small mobile", 12082 styles: { 12083 height: "568px", 12084 width: "320px" 12085 }, 12086 type: "mobile" 12087 }, 12088 mobile2: { 12089 name: "Large mobile", 12090 styles: { 12091 height: "896px", 12092 width: "414px" 12093 }, 12094 type: "mobile" 12095 }, 12096 tablet: { 12097 name: "Tablet", 12098 styles: { 12099 height: "1112px", 12100 width: "834px" 12101 }, 12102 type: "tablet" 12103 }, 12104 desktop: { 12105 name: "Desktop", 12106 styles: { 12107 height: "1024px", 12108 width: "1280px" 12109 }, 12110 type: "desktop" 12111 } 12112}; 12113 12114// src/viewport/resolveViewport.ts 12115var VIEWPORT_MIN_WIDTH = 40, VIEWPORT_MIN_HEIGHT = 40, URL_VALUE_PATTERN = /^([0-9]{1,4})([a-z]{0,4})-([0-9]{1,4})([a-z]{0,4})$/, normalizeGlobal = (value, defaultIsRotated) => typeof value == "string" ? { value, isRotated: defaultIsRotated } : { value: value?.value, isRotated: value?.isRotated ?? defaultIsRotated }, resolveViewport = ({ 12116 globals, 12117 storyGlobals, 12118 userGlobals, 12119 options: options2, 12120 lastSelectedOption, 12121 disable = !1, 12122 viewMode 12123}) => { 12124 if (viewMode !== "story") 12125 return { 12126 name: "Responsive", 12127 type: "desktop", 12128 width: "100%", 12129 height: "100%", 12130 value: RESPONSIVE_VIEWPORT_VALUE, 12131 option: void 0, 12132 isCustom: !1, 12133 isDefault: !0, 12134 isLocked: !0, 12135 isRotated: !1 12136 }; 12137 let global2 = normalizeGlobal(globals?.[PARAM_KEY]), userGlobal = normalizeGlobal(userGlobals?.[PARAM_KEY]), storyGlobal = normalizeGlobal(storyGlobals?.[PARAM_KEY]), storyHasViewport = PARAM_KEY in storyGlobals, primaryGlobal = storyHasViewport ? storyGlobal : userGlobal, secondaryGlobal = storyHasViewport ? userGlobal : storyGlobal, value = primaryGlobal?.value ?? secondaryGlobal?.value ?? global2?.value, isRotated = primaryGlobal?.isRotated ?? secondaryGlobal?.isRotated ?? global2?.isRotated ?? !1, keys = Object.keys(options2), isLocked = disable || PARAM_KEY in storyGlobals || !keys.length, [match, vx, ux, vy, uy] = value?.match(URL_VALUE_PATTERN) || []; 12138 if (match) { 12139 let x2 = ux && ux !== "px" ? vx : Math.max(Number(vx), VIEWPORT_MIN_WIDTH), y2 = uy && uy !== "px" ? vy : Math.max(Number(vy), VIEWPORT_MIN_HEIGHT), width = `${x2}${ux === "pct" ? "%" : ux || "px"}`, height = `${y2}${uy === "pct" ? "%" : uy || "px"}`, selection = lastSelectedOption ? options2[lastSelectedOption] : void 0; 12140 return { 12141 name: selection?.name ?? "Custom", 12142 type: selection?.type ?? "other", 12143 width: isRotated ? height : width, 12144 height: isRotated ? width : height, 12145 value: match, 12146 option: void 0, 12147 isCustom: !0, 12148 isDefault: !1, 12149 isLocked, 12150 isRotated 12151 }; 12152 } 12153 if (value && keys.length) { 12154 let { name, styles: styles2, type = "other" } = options2[value] ?? options2[keys[0]]; 12155 return { 12156 name, 12157 type, 12158 width: isRotated ? styles2.height : styles2.width, 12159 height: isRotated ? styles2.width : styles2.height, 12160 value, 12161 option: value, 12162 isCustom: !1, 12163 isDefault: !1, 12164 isLocked, 12165 isRotated 12166 }; 12167 } 12168 return { 12169 name: "Responsive", 12170 type: "desktop", 12171 width: "100%", 12172 height: "100%", 12173 value: RESPONSIVE_VIEWPORT_VALUE, 12174 option: void 0, 12175 isCustom: !1, 12176 isDefault: !0, 12177 isLocked, 12178 isRotated: !1 12179 }; 12180}; 12181 12182// src/viewport/useViewport.ts 12183var cycle = (viewports, current, direction = 1) => { 12184 let keys = Object.keys(viewports), nextIndex = (current ? keys.indexOf(current) : -1) + direction; 12185 return nextIndex < 0 ? keys[keys.length - 1] : nextIndex >= keys.length ? keys[0] : keys[nextIndex]; 12186}, normalizeGlobal2 = (value, defaultIsRotated) => typeof value == "string" ? { value, isRotated: defaultIsRotated } : { value: value?.value, isRotated: value?.isRotated ?? defaultIsRotated }, useViewport = () => { 12187 let api = useStorybookApi(), { viewMode } = api.getUrlState(), lastSelectedOption = useRef(), parameter = useParameter(PARAM_KEY), [globals, updateGlobals, storyGlobals, userGlobals] = useGlobals(); 12188 useEffect(() => { 12189 if (parameter && "defaultViewport" in parameter) { 12190 let value2 = parameter.defaultViewport; 12191 deprecate( 12192 `The \`viewport.defaultViewport\` parameter was removed in Storybook 10. Use \`globals: { viewport: ${JSON.stringify(value2)} }\` instead, or run \`npx storybook automigrate\` to update your code automatically.` 12193 ); 12194 } 12195 }, [parameter]); 12196 let { options: options2 = MINIMAL_VIEWPORTS, disable = !1 } = parameter || {}, { name, type, width, height, value, option, isCustom, isDefault, isLocked, isRotated } = resolveViewport({ 12197 globals, 12198 storyGlobals, 12199 userGlobals, 12200 options: options2, 12201 lastSelectedOption: lastSelectedOption.current, 12202 disable, 12203 viewMode 12204 }), update2 = useCallback( 12205 (input) => updateGlobals({ [PARAM_KEY]: normalizeGlobal2(input, !1) }), 12206 [updateGlobals] 12207 ), resize = useCallback( 12208 (width2, height2) => { 12209 let w2 = width2.replace(/px$/, "").replace(/%$/, "pct"), h2 = height2.replace(/px$/, "").replace(/%$/, "pct"), value2 = isRotated ? `${h2}-${w2}` : `${w2}-${h2}`; 12210 update2({ value: value2, isRotated }); 12211 }, 12212 [update2, isRotated] 12213 ); 12214 return useEffect(() => { 12215 parameter && option && (Object.hasOwn(options2, option) ? lastSelectedOption.current = option : (lastSelectedOption.current = void 0, PARAM_KEY in storyGlobals || update2({ value: void 0, isRotated: !1 }))); 12216 }, [parameter, storyGlobals, options2, option, update2]), useEffect(() => { 12217 api.setAddonShortcut(ADDON_ID, { 12218 label: "Next viewport", 12219 defaultShortcut: ["alt", "V"], 12220 actionName: "next", 12221 action: () => update2({ value: cycle(options2, lastSelectedOption.current), isRotated }) 12222 }), api.setAddonShortcut(ADDON_ID, { 12223 label: "Previous viewport", 12224 defaultShortcut: ["alt", "shift", "V"], 12225 actionName: "previous", 12226 action: () => update2({ value: cycle(options2, lastSelectedOption.current, -1), isRotated }) 12227 }), api.setAddonShortcut(ADDON_ID, { 12228 label: "Reset viewport", 12229 defaultShortcut: ["alt", "control", "V"], 12230 actionName: "reset", 12231 action: () => update2({ value: void 0, isRotated: !1 }) 12232 }); 12233 }, [api, update2, options2, isRotated]), useMemo( 12234 () => ({ 12235 name, 12236 type, 12237 width, 12238 height, 12239 value, 12240 option, 12241 isCustom, 12242 isDefault, 12243 isLocked, 12244 isRotated, 12245 options: options2, 12246 lastSelectedOption: lastSelectedOption.current, 12247 resize, 12248 reset: () => update2({ value: void 0, isRotated: !1 }), 12249 rotate: () => update2({ value, isRotated: !isRotated }), 12250 select: (value2) => update2({ value: value2, isRotated }) 12251 }), 12252 [ 12253 name, 12254 type, 12255 width, 12256 height, 12257 value, 12258 option, 12259 isCustom, 12260 isDefault, 12261 isRotated, 12262 isLocked, 12263 options2, 12264 resize, 12265 update2 12266 ] 12267 ); 12268}; 12269 12270// src/manager/components/preview/Iframe.tsx 12271init_react(); 12272var StyledIframe = styled.iframe(({ theme }) => ({ 12273 backgroundColor: theme.background.preview, 12274 display: "block", 12275 boxSizing: "content-box", 12276 height: "100%", 12277 width: "100%", 12278 border: "none", 12279 transition: "background-position 0s, visibility 0s", 12280 backgroundPosition: "-1px -1px, -1px -1px, -1px -1px, -1px -1px", 12281 margin: "auto" 12282})); 12283function IFrame(props) { 12284 let { active, id, title: title2, src, allowFullScreen, scale, ...rest2 } = props, iFrameRef = react_default.useRef(null); 12285 return react_default.createElement(Zoom.IFrame, { scale, active, iFrameRef }, react_default.createElement( 12286 StyledIframe, 12287 { 12288 "data-is-storybook": active ? "true" : "false", 12289 onLoad: (e2) => e2.currentTarget.setAttribute("data-is-loaded", "true"), 12290 id, 12291 title: title2, 12292 src, 12293 allow: "clipboard-write;", 12294 allowFullScreen, 12295 ref: iFrameRef, 12296 ...rest2 12297 } 12298 )); 12299} 12300 12301// src/manager/components/preview/NumericInput.tsx 12302init_react(); 12303var Wrapper = styled.div( 12304 ({ after: after2, before: before2, theme }) => ({ 12305 position: "relative", 12306 display: "flex", 12307 alignItems: "center", 12308 width: "100%", 12309 height: 32, 12310 paddingInline: 9, 12311 fontSize: theme.typography.size.s1, 12312 color: theme.textMutedColor, 12313 background: theme.input.background, 12314 boxShadow: `${theme.input.border} 0 0 0 1px inset`, 12315 borderRadius: theme.input.borderRadius, 12316 svg: { 12317 display: "block" 12318 }, 12319 input: { 12320 width: "100%", 12321 height: "100%", 12322 minHeight: "100%", 12323 flex: "1 1 auto", 12324 paddingInline: 0, 12325 fontSize: "inherit", 12326 background: "transparent", 12327 border: "none", 12328 boxShadow: "none", 12329 color: theme.input.color, 12330 "&:focus, &:focus-visible": { 12331 boxShadow: "none", 12332 outline: "none" 12333 } 12334 }, 12335 "input:disabled": { 12336 background: "transparent" 12337 }, 12338 "input + div": { 12339 paddingInline: 0, 12340 fontSize: "inherit" 12341 }, 12342 "&:has(input:focus-visible)": { 12343 outline: `2px solid ${theme.color.secondary}`, 12344 outlineOffset: -2 12345 }, 12346 "&:has(input:disabled)": { 12347 background: theme.base === "light" ? theme.color.lighter : theme.input.background, 12348 cursor: "not-allowed" 12349 }, 12350 ...after2 && { paddingRight: 2 }, 12351 ...before2 && { paddingLeft: 2 } 12352 }) 12353), NumericInput = forwardRef(function({ 12354 label, 12355 before: before2, 12356 after: after2, 12357 value, 12358 setValue, 12359 minValue = -1 / 0, 12360 maxValue = 1 / 0, 12361 step = 1, 12362 unit: fixedUnit, 12363 baseUnit = fixedUnit, 12364 className, 12365 style, 12366 ...props 12367}, forwardedRef) { 12368 let baseUnitRegex = useMemo(() => baseUnit && new RegExp(`${baseUnit}$`), [baseUnit]), inputId = $bdb11010cef70236$export$f680877a34711e37(), inputRef = useRef(null), [inputValue, setInputValue] = useState( 12369 baseUnitRegex ? value.replace(baseUnitRegex, "") : value 12370 ), id = props.id || inputId; 12371 useImperativeHandle(forwardedRef, () => inputRef.current); 12372 let parseValue = useCallback( 12373 (value2) => { 12374 let [, inputValue2, unit = fixedUnit || baseUnit || ""] = value2.match(/(-?\d+(?:\.\d+)?)(\%|[a-z]{1,4})?$/) || []; 12375 return { number: Math.max(minValue, Math.min(parseFloat(inputValue2), maxValue)), unit }; 12376 }, 12377 [minValue, maxValue, fixedUnit, baseUnit] 12378 ), updateValue = useCallback( 12379 (value2) => { 12380 let { number, unit } = parseValue(value2); 12381 Number.isNaN(number) ? setInputValue(value2) : (setInputValue(`${number}${unit === baseUnit ? "" : unit}`), setValue(`${number}${unit}`)); 12382 }, 12383 [parseValue, setValue, baseUnit] 12384 ), onChange = useCallback( 12385 (e2) => updateValue(e2.target.value), 12386 [updateValue] 12387 ), setInputSelection = useCallback(() => { 12388 requestAnimationFrame(() => { 12389 let input = inputRef.current, index = input?.value.search(/[^-\d.]/) ?? -1; 12390 input && index >= 0 && input.setSelectionRange(index, index); 12391 }); 12392 }, []), updateInputValue = useCallback( 12393 () => setInputValue(baseUnitRegex ? value.replace(baseUnitRegex, "") : value), 12394 [value, baseUnitRegex] 12395 ); 12396 return useEffect(() => { 12397 inputRef.current !== document.activeElement && updateInputValue(); 12398 }, [updateInputValue]), useEffect(() => { 12399 let handleKeyDown = (e2) => { 12400 if (e2.key !== "ArrowUp" && e2.key !== "ArrowDown") 12401 return; 12402 e2.preventDefault(); 12403 let { number, unit } = parseValue(inputValue); 12404 if (!Number.isNaN(number)) { 12405 let delta = e2.shiftKey ? step * 10 : step; 12406 updateValue(`${e2.key === "ArrowUp" ? number + delta : number - delta}${unit}`), setInputSelection(); 12407 } 12408 }, input = inputRef.current; 12409 if (input) 12410 return input.addEventListener("keydown", handleKeyDown), () => input.removeEventListener("keydown", handleKeyDown); 12411 }, [inputValue, parseValue, setInputSelection, step, updateValue]), react_default.createElement(Wrapper, { after: after2, before: before2, className, style }, before2 && react_default.createElement("div", null, before2), label && react_default.createElement("label", { htmlFor: id, className: "sb-sr-only" }, label), react_default.createElement( 12412 Form.Input, 12413 { 12414 ...props, 12415 id, 12416 ref: inputRef, 12417 value: inputValue, 12418 suffix: fixedUnit || inputValue && baseUnit, 12419 onChange, 12420 onFocus: setInputSelection, 12421 onBlur: updateInputValue 12422 } 12423 ), after2 && react_default.createElement("div", null, after2)); 12424}); 12425 12426// src/manager/components/preview/Viewport.tsx 12427var ViewportWrapper = styled.div(({ active, isDefault, theme }) => ({ 12428 gridArea: "1 / 1", 12429 alignSelf: "start", 12430 justifySelf: "start", 12431 display: active ? "inline-flex" : "none", 12432 flexDirection: "column", 12433 gap: 6, 12434 width: "100%", 12435 height: "100%", 12436 paddingTop: isDefault ? 0 : 6, 12437 paddingBottom: isDefault ? 0 : 40, 12438 paddingInline: isDefault ? 0 : 40, 12439 '&:has([data-size-input="width"]:focus-visible)': { 12440 "[data-dragging]": { 12441 borderRightColor: theme.color.secondary, 12442 boxShadow: `4px 0 5px -2px ${theme.background.hoverable}` 12443 } 12444 }, 12445 '&:has([data-size-input="height"]:focus-visible)': { 12446 "[data-dragging]": { 12447 borderBottomColor: theme.color.secondary, 12448 boxShadow: `0 4px 5px -2px ${theme.background.hoverable}` 12449 } 12450 } 12451})), ViewportControls = styled.div({ 12452 display: "flex", 12453 gap: 6 12454}), ViewportDimensions = styled.div({ 12455 display: "flex", 12456 gap: 2 12457}), FrameWrapper = styled.div(({ isDefault, "data-dragging": dragging, theme }) => ({ 12458 position: "relative", 12459 minWidth: VIEWPORT_MIN_WIDTH, 12460 minHeight: VIEWPORT_MIN_HEIGHT, 12461 boxSizing: "content-box", 12462 // we're sizing the contents, not the box itself 12463 border: `1px solid ${theme.button.border}`, 12464 borderWidth: isDefault ? 0 : 1, 12465 borderRadius: isDefault ? 0 : 4, 12466 transition: "border-color 0.2s, box-shadow 0.2s", 12467 '&:has([data-side="right"]:hover), &[data-dragging="right"]': { 12468 borderRightColor: theme.color.secondary, 12469 boxShadow: `4px 0 5px -2px ${theme.background.hoverable}`, 12470 '[data-side="right"]::after': { 12471 opacity: 1 12472 } 12473 }, 12474 '&:has([data-side="bottom"]:hover), &[data-dragging="bottom"]': { 12475 borderBottomColor: theme.color.secondary, 12476 boxShadow: `0 4px 5px -2px ${theme.background.hoverable}`, 12477 '[data-side="bottom"]::after': { 12478 opacity: 1 12479 } 12480 }, 12481 '&:has([data-side="both"]:hover), &[data-dragging="both"]': { 12482 boxShadow: `3px 3px 5px -2px ${theme.background.hoverable}`, 12483 "&::after, [data-side]::after": { 12484 opacity: 1 12485 } 12486 }, 12487 "&::after": { 12488 content: '""', 12489 display: "block", 12490 position: "absolute", 12491 pointerEvents: "none", 12492 bottom: 1, 12493 right: 1, 12494 width: 12, 12495 height: 12, 12496 opacity: 0, 12497 transition: "opacity 0.2s", 12498 background: `linear-gradient(to top left, 12499 rgba(0,0,0,0) 0%, 12500 rgba(0,0,0,0) calc(25% - 1px), 12501 ${theme.color.secondary} 25%, 12502 rgba(0,0,0,0) calc(25% + 1px), 12503 rgba(0,0,0,0) calc(45% - 1px), 12504 ${theme.color.secondary} 45%, 12505 rgba(0,0,0,0) calc(45% + 1px), 12506 rgba(0,0,0,0) 100%)` 12507 }, 12508 iframe: { 12509 pointerEvents: dragging === "none" ? "auto" : "none" 12510 } 12511})), DragHandle2 = styled.div( 12512 { display: "none" }, 12513 ({ theme, isDefault }) => !isDefault && { 12514 display: "block", 12515 position: "absolute", 12516 fontSize: 10, 12517 '&[data-side="both"]': { 12518 right: -12, 12519 bottom: -12, 12520 width: 25, 12521 height: 25, 12522 cursor: "nwse-resize" 12523 }, 12524 '&[data-side="bottom"]': { 12525 left: 0, 12526 right: 13, 12527 bottom: -12, 12528 height: 20, 12529 cursor: "row-resize", 12530 "&::after": { 12531 content: "attr(data-value)", 12532 position: "absolute", 12533 top: "50%", 12534 left: "50%", 12535 transform: "translate(-50%, -50%)", 12536 borderRadius: 4, 12537 backgroundColor: theme.background.hoverable, 12538 padding: "2px 4px", 12539 opacity: 0, 12540 transition: "opacity 0.2s" 12541 } 12542 }, 12543 '&[data-side="right"]': { 12544 top: 0, 12545 right: -12, 12546 bottom: 13, 12547 width: 20, 12548 cursor: "col-resize", 12549 "&::after": { 12550 content: "attr(data-value)", 12551 position: "absolute", 12552 top: "50%", 12553 left: "50%", 12554 transform: "translate(-50%, -50%)", 12555 borderRadius: 4, 12556 backgroundColor: theme.background.hoverable, 12557 padding: "2px 4px", 12558 opacity: 0, 12559 transition: "opacity 0.2s" 12560 } 12561 } 12562 } 12563), ScrollEdge = styled.div({ 12564 position: "absolute", 12565 pointerEvents: "none", 12566 width: 0, 12567 height: 0, 12568 '&[data-edge="right"]': { 12569 right: -40, 12570 height: "100%" 12571 }, 12572 '&[data-edge="bottom"]': { 12573 bottom: -40, 12574 width: "100%" 12575 }, 12576 '&[data-edge="both"]': { 12577 right: -40, 12578 bottom: -40 12579 } 12580}), SizeInput = styled(NumericInput)({ 12581 width: 85, 12582 height: 28, 12583 minHeight: 28 12584}), Viewport = ({ 12585 active, 12586 id, 12587 src, 12588 scale 12589}) => { 12590 let { width, height, isCustom, isDefault, lastSelectedOption, resize, rotate, select } = useViewport(), [dragging, setDragging] = useState("none"), targetRef = useRef(null), dragRefX = useRef(null), dragRefY = useRef(null), dragRefXY = useRef(null), dragSide = useRef("none"), dragStart = useRef(), dragScrollTarget = useRef(null); 12591 useEffect(() => { 12592 let onDrag = (e2) => { 12593 if (!(!targetRef.current || !dragStart.current)) { 12594 if (dragRefX.current && (dragSide.current === "both" || dragSide.current === "right")) { 12595 let newWidth = Math.max(VIEWPORT_MIN_WIDTH, dragStart.current[0] + e2.clientX); 12596 targetRef.current.style.width = `${newWidth}px`, dragRefX.current.dataset.value = `${Math.round(newWidth / scale)}`; 12597 } 12598 if (dragRefY.current && (dragSide.current === "both" || dragSide.current === "bottom")) { 12599 let newHeight = Math.max(VIEWPORT_MIN_HEIGHT, dragStart.current[1] + e2.clientY); 12600 targetRef.current.style.height = `${newHeight}px`, dragRefY.current.dataset.value = `${Math.round(newHeight / scale)}`; 12601 } 12602 dragScrollTarget.current && dragScrollTarget.current.scrollIntoView({ block: "center", inline: "center" }); 12603 } 12604 }, onEnd = () => { 12605 if (window.removeEventListener("mouseup", onEnd), window.removeEventListener("mousemove", onDrag), setDragging("none"), dragStart.current = void 0, targetRef.current) { 12606 let { clientWidth, clientHeight, dataset } = targetRef.current, scale2 = Number(dataset.scale) || 1; 12607 resize(`${Math.round(clientWidth / scale2)}px`, `${Math.round(clientHeight / scale2)}px`); 12608 } 12609 }, onStart = (e2) => { 12610 e2.preventDefault(), window.addEventListener("mouseup", onEnd), window.addEventListener("mousemove", onDrag), dragSide.current = e2.currentTarget.dataset.side, dragStart.current = [ 12611 (targetRef.current?.clientWidth ?? 0) - e2.clientX, 12612 (targetRef.current?.clientHeight ?? 0) - e2.clientY 12613 ], dragScrollTarget.current = targetRef.current?.querySelector( 12614 `[data-edge="${dragSide.current}"]` 12615 ), setDragging(dragSide.current); 12616 }, handles = [dragRefX.current, dragRefY.current, dragRefXY.current]; 12617 return handles.forEach((el) => el?.addEventListener("mousedown", onStart)), () => handles.forEach((el) => el?.removeEventListener("mousedown", onStart)); 12618 }, [resize, scale]); 12619 let dimensions = useMemo(() => { 12620 let [, nx = "", ux = "px"] = width.match(/^(\d+(?:\.\d+)?)(\%|[a-z]{1,4})?$/) || [], [, ny = "", uy = "px"] = height.match(/^(\d+(?:\.\d+)?)(\%|[a-z]{1,4})?$/) || []; 12621 return { 12622 frame: { 12623 width: `calc(${width} * ${scale})`, 12624 height: `calc(${height} * ${scale})` 12625 }, 12626 display: { 12627 width: `${nx || width}${ux === "px" ? "" : ux}`, 12628 height: `${ny || height}${uy === "px" ? "" : uy}` 12629 }, 12630 locked: { 12631 width: !nx || !ny, 12632 height: !nx || !ny 12633 } 12634 }; 12635 }, [width, height, scale]); 12636 return react_default.createElement(ViewportWrapper, { key: id, active, isDefault }, !isDefault && react_default.createElement(ViewportControls, null, react_default.createElement(ViewportDimensions, null, react_default.createElement( 12637 SizeInput, 12638 { 12639 "aria-label": "Viewport width", 12640 "data-size-input": "width", 12641 label: "Viewport width", 12642 before: react_default.createElement(ActionList.Action, { size: "small", readOnly: !0, "aria-hidden": !0 }, "W"), 12643 value: width, 12644 minValue: 0, 12645 setValue: (value) => resize(value, height), 12646 disabled: dimensions.locked.width 12647 } 12648 ), react_default.createElement( 12649 ActionList.Button, 12650 { 12651 key: "viewport-rotate", 12652 size: "small", 12653 padding: "small", 12654 ariaLabel: "Rotate viewport", 12655 onClick: rotate 12656 }, 12657 react_default.createElement(TransferIcon, null) 12658 ), react_default.createElement( 12659 SizeInput, 12660 { 12661 "aria-label": "Viewport height", 12662 "data-size-input": "height", 12663 label: "Viewport height", 12664 before: react_default.createElement(ActionList.Action, { size: "small", readOnly: !0, "aria-hidden": !0 }, "H"), 12665 value: height, 12666 minValue: 0, 12667 setValue: (value) => resize(width, value), 12668 disabled: dimensions.locked.height 12669 } 12670 ), isCustom && lastSelectedOption && react_default.createElement( 12671 ActionList.Button, 12672 { 12673 key: "viewport-restore", 12674 size: "small", 12675 padding: "small", 12676 ariaLabel: "Restore viewport", 12677 onClick: () => select(lastSelectedOption) 12678 }, 12679 react_default.createElement(UndoIcon, null) 12680 ))), react_default.createElement( 12681 FrameWrapper, 12682 { 12683 isDefault, 12684 "data-dragging": dragging, 12685 "data-scale": scale, 12686 style: isDefault ? { height: "100%", width: "100%" } : dimensions.frame, 12687 ref: targetRef 12688 }, 12689 react_default.createElement( 12690 "div", 12691 { 12692 style: { 12693 height: `${1 / scale * 100}%`, 12694 width: `${1 / scale * 100}%`, 12695 transform: scale !== 1 ? `scale(${scale})` : "none", 12696 transformOrigin: "top left" 12697 } 12698 }, 12699 react_default.createElement(IFrame, { allowFullScreen: !0, active, key: id, id, title: id, src, scale: 1 }), 12700 !isDefault && react_default.createElement(react_default.Fragment, null, react_default.createElement(ScrollEdge, { "data-edge": "right" }), react_default.createElement(ScrollEdge, { "data-edge": "bottom" }), react_default.createElement(ScrollEdge, { "data-edge": "both" })) 12701 ), 12702 !dimensions.locked.width && react_default.createElement( 12703 DragHandle2, 12704 { 12705 ref: dragRefX, 12706 isDefault, 12707 "data-side": "right", 12708 "data-value": dimensions.display.width 12709 } 12710 ), 12711 !dimensions.locked.height && react_default.createElement( 12712 DragHandle2, 12713 { 12714 ref: dragRefY, 12715 isDefault, 12716 "data-side": "bottom", 12717 "data-value": dimensions.display.height 12718 } 12719 ), 12720 !dimensions.locked.width && !dimensions.locked.height && react_default.createElement(DragHandle2, { ref: dragRefXY, isDefault, "data-side": "both" }) 12721 )); 12722}; 12723 12724// src/manager/components/preview/FramesRenderer.tsx 12725var getActive = (refId, refs) => refId && refs[refId] ? `storybook-ref-${refId}` : "storybook-preview-iframe", SkipToSidebarLink = styled(Button)(({ theme }) => ({ 12726 display: "none", 12727 "@media (min-width: 600px)": { 12728 position: "absolute", 12729 display: "block", 12730 top: 10, 12731 right: 15, 12732 padding: "10px 15px", 12733 fontSize: theme.typography.size.s1, 12734 transform: "translateY(-100px)", 12735 "&:focus": { 12736 transform: "translateY(0)", 12737 zIndex: 1 12738 } 12739 } 12740})), whenSidebarIsVisible = ({ api, state }) => ({ 12741 isFullscreen: api.getIsFullscreen(), 12742 isNavShown: api.getNavAvailability() === "shown", 12743 selectedStoryId: state.storyId 12744}), styles = { 12745 '#root [data-is-storybook="false"]': { 12746 display: "none" 12747 }, 12748 '#root [data-is-storybook="true"]': { 12749 display: "block" 12750 } 12751}, FramesRenderer = ({ 12752 api, 12753 refs, 12754 scale, 12755 viewMode = "story", 12756 refId, 12757 queryParams = {}, 12758 storyId = "*" 12759}) => { 12760 let version3 = refs[refId]?.version, active = getActive(refId, refs), { current: frames } = useRef({}), refsToLoad = Object.values(refs).filter((ref) => ref.type === "auto-inject" || ref.id === refId, {}); 12761 return frames["storybook-preview-iframe"] || (frames["storybook-preview-iframe"] = api.getStoryHrefs(storyId, { 12762 queryParams: { ...queryParams, ...version3 && { version: version3 } }, 12763 refId: void 0, 12764 viewMode 12765 }).previewHref), refsToLoad.forEach((ref) => { 12766 let id = `storybook-ref-${ref.id}`; 12767 frames[id]?.startsWith(`${ref.url.replace(/\/?$/, "/")}iframe.html`) || (frames[id] = api.getStoryHrefs(storyId, { 12768 queryParams: { ...queryParams, ...version3 && { version: version3 } }, 12769 refId: ref.id, 12770 viewMode 12771 }).previewHref); 12772 }), react_default.createElement(Fragment, null, react_default.createElement(Global, { styles }), react_default.createElement(Consumer, { filter: whenSidebarIsVisible }, ({ isFullscreen, isNavShown, selectedStoryId }) => isFullscreen || !isNavShown || !selectedStoryId ? null : react_default.createElement(SkipToSidebarLink, { ariaLabel: !1, asChild: !0 }, react_default.createElement("a", { href: `#${selectedStoryId}`, tabIndex: 0 }, "Skip to sidebar"))), Object.entries(frames).map(([id, src]) => react_default.createElement(Viewport, { key: id, id, src, active: id === active, scale }))); 12773}; 12774 12775// src/manager/components/preview/Toolbar.tsx 12776init_react(); 12777var fullScreenMapper = ({ api, state }) => ({ 12778 toggle: api.toggleFullscreen, 12779 isFullscreen: api.getIsFullscreen(), 12780 shortcut: api.getShortcutKeys().fullScreen, 12781 hasPanel: Object.keys(api.getElements(Addon_TypesEnum.PANEL)).length > 0, 12782 singleStory: state.singleStory, 12783 isNavUnavailable: api.getNavAvailability() === "unavailable" 12784}), fullScreenTool = { 12785 title: "fullscreen", 12786 id: "fullscreen", 12787 type: types.TOOL, 12788 // @ts-expect-error (non strict) 12789 match: (p2) => ["story", "docs"].includes(p2.viewMode), 12790 render: () => { 12791 let { isMobile: isMobile2 } = useLayout(); 12792 return isMobile2 ? null : react_default.createElement(Consumer, { filter: fullScreenMapper }, ({ toggle, isFullscreen, shortcut, hasPanel, singleStory, isNavUnavailable }) => !isNavUnavailable && (!singleStory || singleStory && hasPanel) && react_default.createElement( 12793 Button, 12794 { 12795 key: "full", 12796 padding: "small", 12797 variant: "ghost", 12798 onClick: () => toggle(), 12799 ariaLabel: isFullscreen ? "Exit full screen" : "Enter full screen", 12800 shortcut 12801 }, 12802 isFullscreen ? react_default.createElement(CloseIcon, null) : react_default.createElement(ExpandIcon, null) 12803 )); 12804 } 12805}, ToolbarComp = react_default.memo(function({ 12806 isShown, 12807 tools, 12808 toolsExtra, 12809 tabs, 12810 tabState 12811}) { 12812 let sectionRef = useRef(null), { landmarkProps } = useLandmark( 12813 { "aria-labelledby": "sb-preview-toolbar-title", role: "region" }, 12814 sectionRef 12815 ); 12816 return isShown && (tabs || tools || toolsExtra) ? react_default.createElement( 12817 StyledSection, 12818 { 12819 className: "sb-bar", 12820 key: "toolbar", 12821 "data-testid": "sb-preview-toolbar", 12822 ref: sectionRef, 12823 ...landmarkProps 12824 }, 12825 react_default.createElement("h2", { id: "sb-preview-toolbar-title", className: "sb-sr-only" }, "Toolbar"), 12826 tabs.length > 1 ? react_default.createElement(react_default.Fragment, null, react_default.createElement(TabList, { state: tabState }), react_default.createElement(Separator, null)) : null, 12827 react_default.createElement(StyledToolbar, null, react_default.createElement(Tools, { key: "left", list: tools }), react_default.createElement(Tools, { key: "right", list: toolsExtra })) 12828 ) : null; 12829}), Tools = react_default.memo(function({ list }) { 12830 return react_default.createElement(ToolGroup, null, list.filter(Boolean).map(({ render: Render, id, ...t2 }, index) => ( 12831 // @ts-expect-error (Converted from ts-ignore) 12832 react_default.createElement(Render, { key: id || t2.key || `f-${index}` }) 12833 ))); 12834}); 12835function toolbarItemHasBeenExcluded(item, entry) { 12836 let parameters = entry?.type === "story" && entry?.prepared ? entry?.parameters : {}, toolbarItemsFromStoryParameters = "toolbar" in parameters ? parameters.toolbar : void 0, { toolbar: toolbarItemsFromAddonsConfig } = addons.getConfig(), toolbarItems = merge( 12837 toolbarItemsFromAddonsConfig || {}, 12838 toolbarItemsFromStoryParameters || {} 12839 ); 12840 return toolbarItems ? !!toolbarItems[item?.id]?.hidden : !1; 12841} 12842function filterToolsSide(tools, entry, viewMode, location2, path, tabId) { 12843 let filter = (item) => item && (!item.match || item.match({ 12844 storyId: entry?.id, 12845 refId: entry?.refId, 12846 viewMode, 12847 location: location2, 12848 path, 12849 tabId 12850 })) && !toolbarItemHasBeenExcluded(item, entry); 12851 return tools.filter(filter); 12852} 12853var StyledSection = styled.section(({ theme }) => ({ 12854 position: "relative", 12855 display: "flex", 12856 alignItems: "center", 12857 color: theme.barTextColor, 12858 width: "100%", 12859 flexShrink: 0, 12860 overflowX: "auto", 12861 overflowY: "hidden", 12862 boxShadow: `${theme.appBorderColor} 0 -1px 0 0 inset`, 12863 background: theme.barBg, 12864 scrollbarColor: `${theme.barTextColor} ${theme.barBg}`, 12865 scrollbarWidth: "thin", 12866 zIndex: 4 12867})), StyledToolbar = styled(AbstractToolbar)({ 12868 flex: 1, 12869 display: "flex", 12870 justifyContent: "space-between", 12871 flexWrap: "nowrap", 12872 flexShrink: 0, 12873 height: 40, 12874 marginInline: 10, 12875 gap: 30 12876}), ToolGroup = styled.div({ 12877 display: "flex", 12878 whiteSpace: "nowrap", 12879 flexBasis: "auto", 12880 gap: 6, 12881 alignItems: "center" 12882}); 12883 12884// src/manager/components/preview/Wrappers.tsx 12885init_react(); 12886 12887// src/manager/components/preview/utils/components.ts 12888var PreviewContainer = styled.div({ 12889 display: "flex", 12890 flexDirection: "column", 12891 width: "100%", 12892 height: "100%", 12893 overflow: "hidden" 12894}), FrameWrap = styled.main(({ theme }) => ({ 12895 overflow: "auto", 12896 width: "100%", 12897 zIndex: 3, 12898 background: theme.background.app, 12899 flex: 1 12900})), CanvasWrap = styled.div( 12901 { 12902 alignContent: "center", 12903 alignItems: "center", 12904 justifyContent: "center", 12905 justifyItems: "center", 12906 overflow: "auto", 12907 gridTemplateColumns: "100%", 12908 gridTemplateRows: "100%", 12909 position: "relative", 12910 width: "100%", 12911 height: "100%" 12912 }, 12913 ({ show }) => ({ display: show ? "grid" : "none" }) 12914), UnstyledLink = styled(Link2)({ 12915 color: "inherit", 12916 textDecoration: "inherit", 12917 display: "inline-block" 12918}), DesktopOnly = styled.span({ 12919 // Hides full screen icon at mobile breakpoint defined in app.js 12920 "@media (max-width: 599px)": { 12921 display: "none" 12922 } 12923}), IframeWrapper = styled.div(({ theme }) => ({ 12924 alignContent: "center", 12925 alignItems: "center", 12926 justifyContent: "center", 12927 justifyItems: "center", 12928 overflow: "auto", 12929 display: "grid", 12930 gridTemplateColumns: "100%", 12931 gridTemplateRows: "100%", 12932 position: "relative", 12933 width: "100%", 12934 height: "100%" 12935})), LoaderWrapper = styled.div(({ theme }) => ({ 12936 position: "absolute", 12937 top: 0, 12938 left: 0, 12939 bottom: 0, 12940 right: 0, 12941 background: theme.background.preview, 12942 zIndex: 1 12943})); 12944 12945// src/manager/components/preview/Wrappers.tsx 12946var ApplyWrappers = ({ 12947 wrappers, 12948 id, 12949 storyId, 12950 children 12951}) => react_default.createElement(Fragment, null, wrappers.reduceRight( 12952 (acc, wrapper, index) => react_default.createElement(wrapper.render, { index, children: acc, id, storyId }), 12953 children 12954)), defaultWrappers = [ 12955 { 12956 id: "iframe-wrapper", 12957 type: Addon_TypesEnum.PREVIEW, 12958 render: (p2) => react_default.createElement(IframeWrapper, { id: "storybook-preview-wrapper" }, p2.children) 12959 } 12960]; 12961 12962// src/manager/components/preview/tools/zoom.tsx 12963init_react(); 12964 12965// src/manager/components/Shortcut.tsx 12966init_react(); 12967var Wrapper2 = styled.span(({ theme }) => ({ 12968 display: "inline-flex", 12969 alignItems: "center", 12970 justifyContent: "center", 12971 height: 16, 12972 fontSize: "11px", 12973 fontWeight: theme.typography.weight.regular, 12974 background: theme.base === "light" ? "rgba(0,0,0,0.05)" : "rgba(255,255,255,0.05)", 12975 color: theme.base === "light" ? theme.color.dark : theme.textMutedColor, 12976 borderRadius: 2, 12977 userSelect: "none", 12978 pointerEvents: "none", 12979 padding: "0 4px" 12980})), Key = styled.kbd(({ theme }) => ({ 12981 padding: 0, 12982 fontFamily: theme.typography.fonts.base, 12983 verticalAlign: "middle", 12984 "& + &": { 12985 marginLeft: 6 12986 } 12987})), Shortcut = ({ keys }) => react_default.createElement(Wrapper2, null, (keys ?? []).map((key) => react_default.createElement(Key, { key }, shortcutToHumanString([key])))); 12988 12989// src/manager/components/preview/tools/zoom.tsx 12990var ZOOM_LEVELS = [0.25, 0.5, 0.75, 0.9, 1, 1.1, 1.25, 1.5, 2, 3, 4, 8], INITIAL_ZOOM_LEVEL = 1, ZoomButton = styled(ToggleButton)({ 12991 minWidth: 48 12992}), ZoomResetButton = styled(ActionList.Button)( 12993 ({ $isInitialValue }) => ({ 12994 visibility: $isInitialValue ? "hidden" : void 0 12995 }) 12996), Context = createContext({ value: INITIAL_ZOOM_LEVEL, set: (v2) => { 12997} }), ZoomInput = styled(NumericInput)({ 12998 input: { 12999 width: 100 13000 } 13001}), ZoomConsumer = Context.Consumer, ZoomProvider = class extends Component { 13002 constructor() { 13003 super(...arguments); 13004 this.state = { 13005 value: INITIAL_ZOOM_LEVEL 13006 }; 13007 this.set = (value) => this.setState({ value }); 13008 } 13009 render() { 13010 let { children, shouldScale } = this.props, { set } = this, { value } = this.state; 13011 return react_default.createElement(Context.Provider, { value: { value: shouldScale ? value : INITIAL_ZOOM_LEVEL, set } }, children); 13012 } 13013}, Zoom2 = memo(function({ value, zoomIn, zoomOut, zoomTo, zoomBy }) { 13014 let inputRef = useRef(null); 13015 return react_default.createElement( 13016 PopoverProvider, 13017 { 13018 padding: "none", 13019 onVisibleChange: (isVisible) => { 13020 isVisible && requestAnimationFrame(() => inputRef.current?.select()); 13021 }, 13022 popover: react_default.createElement(react_default.Fragment, null, react_default.createElement(ActionList, null, react_default.createElement(ActionList.Item, null, react_default.createElement( 13023 ZoomInput, 13024 { 13025 "aria-label": "Zoom percentage", 13026 ref: inputRef, 13027 unit: "%", 13028 before: react_default.createElement(ActionList.Button, { size: "small", padding: "small", readOnly: !0, "aria-hidden": !0 }, react_default.createElement(ZoomIcon, null)), 13029 after: react_default.createElement( 13030 ZoomResetButton, 13031 { 13032 size: "small", 13033 padding: "small", 13034 $isInitialValue: value === INITIAL_ZOOM_LEVEL, 13035 onClick: () => zoomTo(INITIAL_ZOOM_LEVEL), 13036 ariaLabel: "Reset zoom", 13037 "aria-hidden": value === INITIAL_ZOOM_LEVEL 13038 }, 13039 react_default.createElement(UndoIcon, null) 13040 ), 13041 value: `${Math.round(value * 100)}%`, 13042 minValue: 1, 13043 maxValue: 800, 13044 setValue: (value2) => { 13045 let zoomLevel = parseInt(value2, 10) / 100; 13046 Number.isNaN(zoomLevel) || zoomTo(zoomLevel); 13047 } 13048 } 13049 ))), react_default.createElement(ActionList, null, react_default.createElement(ActionList.Item, null, react_default.createElement( 13050 ActionList.Action, 13051 { 13052 onClick: zoomIn, 13053 ariaLabel: "Zoom in", 13054 disabled: value >= ZOOM_LEVELS.at(-1) 13055 }, 13056 react_default.createElement(ActionList.Text, null, "Zoom in"), 13057 react_default.createElement(Shortcut, { keys: ["alt", "+"] }) 13058 )), react_default.createElement(ActionList.Item, null, react_default.createElement( 13059 ActionList.Action, 13060 { 13061 onClick: zoomOut, 13062 ariaLabel: "Zoom out", 13063 disabled: value <= ZOOM_LEVELS.at(0) 13064 }, 13065 react_default.createElement(ActionList.Text, null, "Zoom out"), 13066 react_default.createElement(Shortcut, { keys: ["alt", "-"] }) 13067 )), react_default.createElement(ActionList.Item, { active: value === 0.5 }, react_default.createElement(ActionList.Action, { onClick: () => zoomTo(0.5), ariaLabel: "Zoom to 50%" }, react_default.createElement(ActionList.Text, null, "50%"))), react_default.createElement(ActionList.Item, { active: value === 1 }, react_default.createElement(ActionList.Action, { onClick: () => zoomTo(1), ariaLabel: "Zoom to 100%" }, react_default.createElement(ActionList.Text, null, "100%"), react_default.createElement(Shortcut, { keys: ["alt", "0"] }))), react_default.createElement(ActionList.Item, { active: value === 2 }, react_default.createElement(ActionList.Action, { onClick: () => zoomTo(2), ariaLabel: "Zoom to 200%" }, "200%")))) 13068 }, 13069 react_default.createElement( 13070 ZoomButton, 13071 { 13072 padding: "small", 13073 variant: "ghost", 13074 ariaLabel: "Change zoom level", 13075 pressed: value !== INITIAL_ZOOM_LEVEL, 13076 onKeyDown: (e2) => { 13077 e2.key === "ArrowDown" ? (zoomBy(e2.getModifierState("Shift") ? -0.1 : -0.01), e2.preventDefault()) : e2.key === "ArrowUp" ? (zoomBy(e2.getModifierState("Shift") ? 0.1 : 0.01), e2.preventDefault()) : e2.key === "PageDown" ? (zoomOut(), e2.preventDefault()) : e2.key === "PageUp" ? (zoomIn(), e2.preventDefault()) : e2.key === "Home" ? (zoomTo(ZOOM_LEVELS[ZOOM_LEVELS.length - 1]), e2.preventDefault()) : e2.key === "End" && (zoomTo(ZOOM_LEVELS[0]), e2.preventDefault()); 13078 }, 13079 onWheel: (e2) => { 13080 e2.deltaY < 0 ? zoomIn() : e2.deltaY > 0 && zoomOut(), e2.preventDefault(); 13081 } 13082 }, 13083 Math.round(value * 100), 13084 "%" 13085 ) 13086 ); 13087}), ZoomWrapper = memo(function({ set, value }) { 13088 let api = useStorybookApi(), zoomIn = useCallback(() => { 13089 let higherZoomLevel = ZOOM_LEVELS.find((level) => level > value); 13090 higherZoomLevel && set(higherZoomLevel); 13091 }, [set, value]), zoomOut = useCallback(() => { 13092 let lowerZoomLevel = ZOOM_LEVELS.findLast((level) => level < value); 13093 lowerZoomLevel && set(lowerZoomLevel); 13094 }, [set, value]), zoomBy = useCallback( 13095 (delta) => { 13096 let min = ZOOM_LEVELS[0], max = ZOOM_LEVELS[ZOOM_LEVELS.length - 1]; 13097 set(Math.max(min, Math.min(max, value + delta))); 13098 }, 13099 [set, value] 13100 ), zoomTo = useCallback( 13101 (value2) => { 13102 set(value2); 13103 }, 13104 [set] 13105 ); 13106 return useEffect(() => { 13107 api.setAddonShortcut("zoom", { 13108 label: "Zoom to 100%", 13109 defaultShortcut: ["alt", "0"], 13110 actionName: "zoomReset", 13111 action: () => zoomTo(1) 13112 }), api.setAddonShortcut("zoom", { 13113 label: "Zoom in", 13114 defaultShortcut: ["alt", "="], 13115 actionName: "zoomIn", 13116 action: zoomIn 13117 }), api.setAddonShortcut("zoom", { 13118 label: "Zoom in", 13119 defaultShortcut: ["alt", "+"], 13120 actionName: "zoomPlus", 13121 action: zoomIn 13122 }), api.setAddonShortcut("zoom", { 13123 label: "Zoom out", 13124 defaultShortcut: ["alt", "-"], 13125 actionName: "zoomOut", 13126 action: zoomOut 13127 }); 13128 }, [api, zoomIn, zoomOut, zoomTo]), react_default.createElement(Zoom2, { key: "zoom", value, zoomIn, zoomOut, zoomTo, zoomBy }); 13129}), zoomTool = { 13130 title: "zoom", 13131 id: "zoom", 13132 type: types.TOOL, 13133 match: ({ viewMode, tabId }) => viewMode === "story" && !tabId, 13134 render: () => react_default.createElement(ZoomConsumer, null, (zoomContext) => react_default.createElement(ZoomWrapper, { ...zoomContext })) 13135}; 13136 13137// src/manager/components/preview/Preview.tsx 13138var canvasMapper = ({ state, api }) => ({ 13139 api, 13140 storyId: state.storyId, 13141 refId: state.refId, 13142 viewMode: state.viewMode, 13143 customCanvas: api.renderPreview, 13144 queryParams: state.customQueryParams, 13145 getElements: api.getElements, 13146 entry: api.getData(state.storyId, state.refId), 13147 previewInitialized: state.previewInitialized, 13148 refs: state.refs 13149}), createCanvasTab = () => ({ 13150 id: "canvas", 13151 type: types.TAB, 13152 title: "Canvas", 13153 route: ({ storyId, refId }) => refId ? `/story/${refId}_${storyId}` : `/story/${storyId}`, 13154 match: ({ viewMode }) => !!(viewMode && viewMode.match(/^(story|docs)$/)), 13155 render: () => null 13156}), Preview2 = react_default.memo(function(props) { 13157 let { 13158 api, 13159 id: previewId, 13160 options: options2, 13161 viewMode, 13162 storyId, 13163 entry = void 0, 13164 description, 13165 baseUrl, 13166 withLoader = !0, 13167 tools, 13168 toolsExtra, 13169 tabs, 13170 wrappers, 13171 tabId, 13172 path, 13173 queryParams 13174 } = props, tabState = useTabsState({ 13175 selected: tabId ?? "canvas", 13176 onSelectionChange: (key) => { 13177 api.applyQueryParams({ tab: key === "canvas" ? void 0 : key }); 13178 }, 13179 tabs: tabs.map((tab, index) => ({ 13180 id: tab.id ?? `tab-${index}`, 13181 title: tab.title, 13182 isDisabled: !!tab.disabled, 13183 children: () => tab.render({ active: !0 }) 13184 })) 13185 }); 13186 tabs.length > 1 && deprecate("Addon tabs are deprecated and will be removed in Storybook 11."); 13187 let tabContent = tabs.find((tab) => tab.id === tabId)?.render, shouldScale = viewMode === "story", { showToolbar } = options2, customisedShowToolbar = api.getShowToolbarWithCustomisations(showToolbar), isReviewCollectionStory = isReviewFeatureEnabled(scope.FEATURES) && isReviewCollectionStoryRoute(path, queryParams), previousStoryId = useRef(storyId); 13188 useEffect(() => { 13189 if (entry && viewMode) { 13190 if (storyId === previousStoryId.current) 13191 return; 13192 if (previousStoryId.current = storyId, viewMode.match(/docs|story/)) { 13193 let { refId, id } = entry; 13194 api.emit(SET_CURRENT_STORY, { 13195 storyId: id, 13196 viewMode, 13197 options: { target: refId } 13198 }); 13199 } 13200 } 13201 }, [entry, viewMode, storyId, api]); 13202 let mainRef = useRef(null), { landmarkProps } = useLandmark( 13203 { "aria-labelledby": "main-preview-heading", role: "main" }, 13204 mainRef 13205 ); 13206 return react_default.createElement(Fragment, null, previewId === "main" && react_default.createElement(W, { key: "description" }, react_default.createElement("title", null, description)), react_default.createElement(ZoomProvider, { shouldScale }, react_default.createElement(PreviewContainer, null, customisedShowToolbar && isReviewCollectionStory ? react_default.createElement(ReviewToolbarHeader, null) : null, react_default.createElement( 13207 ToolbarComp, 13208 { 13209 key: "tools", 13210 isShown: customisedShowToolbar, 13211 tabs, 13212 tabState, 13213 tools, 13214 toolsExtra 13215 } 13216 ), react_default.createElement(FrameWrap, { ref: mainRef, ...landmarkProps }, react_default.createElement("h2", { id: "main-preview-heading", className: "sb-sr-only" }, "Main preview area"), tabContent && react_default.createElement(IframeWrapper, null, tabContent({ active: !0 })), react_default.createElement(CanvasWrap, { show: !tabId || tabId === "canvas" }, react_default.createElement(Canvas, { withLoader, baseUrl, wrappers })))))); 13217}); 13218var Canvas = ({ baseUrl, withLoader, wrappers }) => react_default.createElement(Consumer, { filter: canvasMapper }, ({ 13219 api, 13220 entry, 13221 refs, 13222 customCanvas, 13223 storyId, 13224 refId, 13225 viewMode, 13226 queryParams, 13227 previewInitialized 13228}) => { 13229 let id = "canvas", [progress, setProgress] = useState(void 0); 13230 useEffect(() => { 13231 if (scope.CONFIG_TYPE === "DEVELOPMENT") 13232 try { 13233 addons.getChannel().on(PREVIEW_BUILDER_PROGRESS, (options2) => { 13234 setProgress(options2); 13235 }); 13236 } catch { 13237 } 13238 }, []); 13239 let refLoading = !!refs[refId] && !refs[refId].previewInitialized, isBuilding = !(progress?.value === 1 || progress === void 0), rootLoading = !refId && (!previewInitialized || isBuilding), isLoading = entry && refLoading || rootLoading; 13240 return react_default.createElement(ZoomConsumer, null, ({ value: scale }) => react_default.createElement(react_default.Fragment, null, withLoader && isLoading && react_default.createElement(LoaderWrapper, null, react_default.createElement(Loader, { id: "preview-loader", role: "progressbar", progress })), react_default.createElement(ApplyWrappers, { id, storyId, viewMode, wrappers }, customCanvas ? customCanvas(storyId, viewMode, id, baseUrl, scale, queryParams) : react_default.createElement( 13241 FramesRenderer, 13242 { 13243 api, 13244 refs, 13245 scale, 13246 entry, 13247 viewMode, 13248 refId, 13249 queryParams, 13250 storyId 13251 } 13252 )))); 13253}); 13254function filterTabs(panels, parameters) { 13255 let { previewTabs } = addons.getConfig(), parametersTabs = parameters ? parameters.previewTabs : void 0; 13256 if (previewTabs || parametersTabs) { 13257 let tabs = merge(previewTabs || {}, parametersTabs || {}), arrTabs = Object.keys(tabs).map((key, index) => ({ 13258 index, 13259 ...typeof tabs[key] == "string" ? { title: tabs[key] } : tabs[key], 13260 id: key 13261 })); 13262 return panels.filter((panel) => { 13263 let t2 = arrTabs.find((tab) => tab.id === panel.id); 13264 return t2 === void 0 || t2.id === "canvas" || !t2.hidden; 13265 }).map((panel, index) => ({ ...panel, index })).sort((p1, p2) => { 13266 let tab_1 = arrTabs.find((tab) => tab.id === p1.id), index_1 = tab_1 ? tab_1.index : arrTabs.length + p1.index, tab_2 = arrTabs.find((tab) => tab.id === p2.id), index_2 = tab_2 ? tab_2.index : arrTabs.length + p2.index; 13267 return index_1 - index_2; 13268 }).map((panel) => { 13269 let t2 = arrTabs.find((tab) => tab.id === panel.id); 13270 return t2 ? { 13271 ...panel, 13272 title: t2.title || panel.title, 13273 disabled: t2.disabled, 13274 hidden: t2.hidden 13275 } : panel; 13276 }); 13277 } 13278 return panels; 13279} 13280 13281// src/manager/components/preview/tools/addons.tsx 13282init_react(); 13283var SHOW_ADDON_PANEL_BUTTON_ID = "storybook-show-addon-panel", menuMapper = ({ api, state }) => ({ 13284 isVisible: api.getIsPanelShown(), 13285 singleStory: state.singleStory, 13286 panelPosition: state.layout.panelPosition, 13287 showPanel: async (forceFocus) => { 13288 api.togglePanel(!0), api.focusOnUIElement(focusableUIElements.addonPanel, { 13289 forceFocus, 13290 poll: !0 13291 }); 13292 } 13293}), addonsTool = { 13294 title: "addons", 13295 id: "addons", 13296 type: types.TOOL, 13297 match: ({ viewMode, tabId }) => viewMode === "story" && !tabId, 13298 render: () => react_default.createElement(Consumer, { filter: menuMapper }, ({ isVisible, showPanel, singleStory, panelPosition }) => !singleStory && !isVisible && react_default.createElement(react_default.Fragment, null, react_default.createElement( 13299 Button, 13300 { 13301 padding: "small", 13302 variant: "ghost", 13303 ariaLabel: "Show addon panel", 13304 id: SHOW_ADDON_PANEL_BUTTON_ID, 13305 key: "addons", 13306 onClick: () => showPanel(!1), 13307 onKeyDown: (e2) => { 13308 (e2.key === "Enter" || e2.key === " ") && (e2.preventDefault(), showPanel(!0)); 13309 } 13310 }, 13311 panelPosition === "bottom" ? react_default.createElement(BottomBarIcon, null) : react_default.createElement(SidebarAltIcon, null) 13312 ))) 13313}; 13314 13315// src/manager/components/preview/tools/menu.tsx 13316init_react(); 13317var menuMapper2 = ({ api, state }) => ({ 13318 navAvailability: api.getNavAvailability(), 13319 singleStory: state.singleStory, 13320 showSidebar: async (forceFocus) => { 13321 api.toggleNav(!0), api.focusOnUIElement(focusableUIElements.sidebarRegion, { 13322 forceFocus, 13323 poll: !0 13324 }); 13325 } 13326}), menuTool = { 13327 title: "menu", 13328 id: "menu", 13329 type: types.TOOL, 13330 // @ts-expect-error (non strict) 13331 match: ({ viewMode }) => ["story", "docs"].includes(viewMode), 13332 render: () => react_default.createElement(Consumer, { filter: menuMapper2 }, ({ navAvailability, showSidebar, singleStory }) => !singleStory && navAvailability === "hidden" && react_default.createElement(react_default.Fragment, null, react_default.createElement( 13333 Button, 13334 { 13335 padding: "small", 13336 variant: "ghost", 13337 ariaLabel: "Show sidebar", 13338 id: focusableUIElements.showSidebar, 13339 key: "menu", 13340 onClick: () => showSidebar(!1), 13341 onKeyDown: (e2) => { 13342 (e2.key === "Enter" || e2.key === " ") && (e2.preventDefault(), showSidebar(!0)); 13343 } 13344 }, 13345 react_default.createElement(MenuIcon, null) 13346 ), react_default.createElement(Separator, null))) 13347}; 13348 13349// src/manager/components/preview/tools/open-in-editor.tsx 13350init_react(); 13351var mapper2 = ({ state, api }) => { 13352 let { storyId, refId } = state, entry = api.getData(storyId, refId); 13353 return { 13354 storyId, 13355 isCompositionStory: !!refId, 13356 importPath: entry?.importPath 13357 }; 13358}, openInEditorTool = { 13359 title: "open-in-editor", 13360 id: "open-in-editor", 13361 type: types.TOOL, 13362 match: ({ viewMode, tabId }) => scope.CONFIG_TYPE === "DEVELOPMENT" && (viewMode === "story" || viewMode === "docs") && !tabId, 13363 render: () => react_default.createElement(Consumer, { filter: mapper2 }, ({ importPath, isCompositionStory }) => { 13364 let api = useStorybookApi(); 13365 return isCompositionStory || !importPath ? null : react_default.createElement( 13366 Button, 13367 { 13368 key: "open-in-editor", 13369 onClick: () => api.openInEditor({ 13370 file: importPath 13371 }), 13372 ariaLabel: "Open in editor", 13373 padding: "small", 13374 variant: "ghost" 13375 }, 13376 react_default.createElement(EditorIcon, null) 13377 ); 13378 }) 13379}; 13380 13381// src/manager/components/preview/tools/remount.tsx 13382init_react(); 13383var StyledAnimatedButton = styled(Button)(({ theme, animating, disabled }) => ({ 13384 opacity: disabled ? 0.5 : 1, 13385 svg: { 13386 animation: animating ? `${theme.animation.rotate360} 1000ms ease-out` : void 0 13387 } 13388})), menuMapper3 = ({ api, state }) => { 13389 let { storyId } = state; 13390 return { 13391 storyId, 13392 remount: () => api.emit(FORCE_REMOUNT, { storyId: state.storyId }), 13393 api 13394 }; 13395}, remountTool = { 13396 title: "remount", 13397 id: "remount", 13398 type: types.TOOL, 13399 match: ({ viewMode, tabId }) => viewMode === "story" && !tabId, 13400 render: () => react_default.createElement(Consumer, { filter: menuMapper3 }, ({ remount, storyId, api }) => { 13401 let [isAnimating, setIsAnimating] = useState(!1), remountComponent = () => { 13402 storyId && remount(); 13403 }; 13404 return useEffect(() => { 13405 let handler = () => setIsAnimating(!0); 13406 return api.on(FORCE_REMOUNT, handler), () => api.off?.(FORCE_REMOUNT, handler); 13407 }, [api]), react_default.createElement( 13408 StyledAnimatedButton, 13409 { 13410 key: "remount", 13411 padding: "small", 13412 variant: "ghost", 13413 ariaLabel: "Reload story", 13414 onClick: remountComponent, 13415 onAnimationEnd: () => setIsAnimating(!1), 13416 animating: isAnimating, 13417 disabled: !storyId 13418 }, 13419 react_default.createElement(SyncIcon, null) 13420 ); 13421 }) 13422}; 13423 13424// src/manager/components/preview/tools/share.tsx 13425init_react(); 13426 13427// ../../node_modules/qrcode.react/lib/esm/index.js 13428init_react(); 13429var __defProp2 = Object.defineProperty, __getOwnPropSymbols = Object.getOwnPropertySymbols, __hasOwnProp2 = Object.prototype.hasOwnProperty, __propIsEnum = Object.prototype.propertyIsEnumerable, __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues = (a2, b2) => { 13430 for (var prop in b2 || (b2 = {})) 13431 __hasOwnProp2.call(b2, prop) && __defNormalProp(a2, prop, b2[prop]); 13432 if (__getOwnPropSymbols) 13433 for (var prop of __getOwnPropSymbols(b2)) 13434 __propIsEnum.call(b2, prop) && __defNormalProp(a2, prop, b2[prop]); 13435 return a2; 13436}, __objRest = (source, exclude) => { 13437 var target = {}; 13438 for (var prop in source) 13439 __hasOwnProp2.call(source, prop) && exclude.indexOf(prop) < 0 && (target[prop] = source[prop]); 13440 if (source != null && __getOwnPropSymbols) 13441 for (var prop of __getOwnPropSymbols(source)) 13442 exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop) && (target[prop] = source[prop]); 13443 return target; 13444}; 13445var qrcodegen; 13446((qrcodegen2) => { 13447 let _QrCode = class _QrCode2 { 13448 /*-- Constructor (low level) and fields --*/ 13449 // Creates a new QR Code with the given version number, 13450 // error correction level, data codeword bytes, and mask number. 13451 // This is a low-level API that most users should not use directly. 13452 // A mid-level API is the encodeSegments() function. 13453 constructor(version3, errorCorrectionLevel, dataCodewords, msk) { 13454 if (this.version = version3, this.errorCorrectionLevel = errorCorrectionLevel, this.modules = [], this.isFunction = [], version3 < _QrCode2.MIN_VERSION || version3 > _QrCode2.MAX_VERSION) 13455 throw new RangeError("Version value out of range"); 13456 if (msk < -1 || msk > 7) 13457 throw new RangeError("Mask value out of range"); 13458 this.size = version3 * 4 + 17; 13459 let row = []; 13460 for (let i2 = 0; i2 < this.size; i2++) 13461 row.push(!1); 13462 for (let i2 = 0; i2 < this.size; i2++) 13463 this.modules.push(row.slice()), this.isFunction.push(row.slice()); 13464 this.drawFunctionPatterns(); 13465 let allCodewords = this.addEccAndInterleave(dataCodewords); 13466 if (this.drawCodewords(allCodewords), msk == -1) { 13467 let minPenalty = 1e9; 13468 for (let i2 = 0; i2 < 8; i2++) { 13469 this.applyMask(i2), this.drawFormatBits(i2); 13470 let penalty = this.getPenaltyScore(); 13471 penalty < minPenalty && (msk = i2, minPenalty = penalty), this.applyMask(i2); 13472 } 13473 } 13474 assert(0 <= msk && msk <= 7), this.mask = msk, this.applyMask(msk), this.drawFormatBits(msk), this.isFunction = []; 13475 } 13476 /*-- Static factory functions (high level) --*/ 13477 // Returns a QR Code representing the given Unicode text string at the given error correction level. 13478 // As a conservative upper bound, this function is guaranteed to succeed for strings that have 738 or fewer 13479 // Unicode code points (not UTF-16 code units) if the low error correction level is used. The smallest possible 13480 // QR Code version is automatically chosen for the output. The ECC level of the result may be higher than the 13481 // ecl argument if it can be done without increasing the version. 13482 static encodeText(text, ecl) { 13483 let segs = qrcodegen2.QrSegment.makeSegments(text); 13484 return _QrCode2.encodeSegments(segs, ecl); 13485 } 13486 // Returns a QR Code representing the given binary data at the given error correction level. 13487 // This function always encodes using the binary segment mode, not any text mode. The maximum number of 13488 // bytes allowed is 2953. The smallest possible QR Code version is automatically chosen for the output. 13489 // The ECC level of the result may be higher than the ecl argument if it can be done without increasing the version. 13490 static encodeBinary(data, ecl) { 13491 let seg = qrcodegen2.QrSegment.makeBytes(data); 13492 return _QrCode2.encodeSegments([seg], ecl); 13493 } 13494 /*-- Static factory functions (mid level) --*/ 13495 // Returns a QR Code representing the given segments with the given encoding parameters. 13496 // The smallest possible QR Code version within the given range is automatically 13497 // chosen for the output. Iff boostEcl is true, then the ECC level of the result 13498 // may be higher than the ecl argument if it can be done without increasing the 13499 // version. The mask number is either between 0 to 7 (inclusive) to force that 13500 // mask, or -1 to automatically choose an appropriate mask (which may be slow). 13501 // This function allows the user to create a custom sequence of segments that switches 13502 // between modes (such as alphanumeric and byte) to encode text in less space. 13503 // This is a mid-level API; the high-level API is encodeText() and encodeBinary(). 13504 static encodeSegments(segs, ecl, minVersion = 1, maxVersion = 40, mask = -1, boostEcl = !0) { 13505 if (!(_QrCode2.MIN_VERSION <= minVersion && minVersion <= maxVersion && maxVersion <= _QrCode2.MAX_VERSION) || mask < -1 || mask > 7) 13506 throw new RangeError("Invalid value"); 13507 let version3, dataUsedBits; 13508 for (version3 = minVersion; ; version3++) { 13509 let dataCapacityBits2 = _QrCode2.getNumDataCodewords(version3, ecl) * 8, usedBits = QrSegment.getTotalBits(segs, version3); 13510 if (usedBits <= dataCapacityBits2) { 13511 dataUsedBits = usedBits; 13512 break; 13513 } 13514 if (version3 >= maxVersion) 13515 throw new RangeError("Data too long"); 13516 } 13517 for (let newEcl of [_QrCode2.Ecc.MEDIUM, _QrCode2.Ecc.QUARTILE, _QrCode2.Ecc.HIGH]) 13518 boostEcl && dataUsedBits <= _QrCode2.getNumDataCodewords(version3, newEcl) * 8 && (ecl = newEcl); 13519 let bb = []; 13520 for (let seg of segs) { 13521 appendBits(seg.mode.modeBits, 4, bb), appendBits(seg.numChars, seg.mode.numCharCountBits(version3), bb); 13522 for (let b2 of seg.getData()) 13523 bb.push(b2); 13524 } 13525 assert(bb.length == dataUsedBits); 13526 let dataCapacityBits = _QrCode2.getNumDataCodewords(version3, ecl) * 8; 13527 assert(bb.length <= dataCapacityBits), appendBits(0, Math.min(4, dataCapacityBits - bb.length), bb), appendBits(0, (8 - bb.length % 8) % 8, bb), assert(bb.length % 8 == 0); 13528 for (let padByte = 236; bb.length < dataCapacityBits; padByte ^= 253) 13529 appendBits(padByte, 8, bb); 13530 let dataCodewords = []; 13531 for (; dataCodewords.length * 8 < bb.length; ) 13532 dataCodewords.push(0); 13533 return bb.forEach((b2, i2) => dataCodewords[i2 >>> 3] |= b2 << 7 - (i2 & 7)), new _QrCode2(version3, ecl, dataCodewords, mask); 13534 } 13535 /*-- Accessor methods --*/ 13536 // Returns the color of the module (pixel) at the given coordinates, which is false 13537 // for light or true for dark. The top left corner has the coordinates (x=0, y=0). 13538 // If the given coordinates are out of bounds, then false (light) is returned. 13539 getModule(x2, y2) { 13540 return 0 <= x2 && x2 < this.size && 0 <= y2 && y2 < this.size && this.modules[y2][x2]; 13541 } 13542 // Modified to expose modules for easy access 13543 getModules() { 13544 return this.modules; 13545 } 13546 /*-- Private helper methods for constructor: Drawing function modules --*/ 13547 // Reads this object's version field, and draws and marks all function modules. 13548 drawFunctionPatterns() { 13549 for (let i2 = 0; i2 < this.size; i2++) 13550 this.setFunctionModule(6, i2, i2 % 2 == 0), this.setFunctionModule(i2, 6, i2 % 2 == 0); 13551 this.drawFinderPattern(3, 3), this.drawFinderPattern(this.size - 4, 3), this.drawFinderPattern(3, this.size - 4); 13552 let alignPatPos = this.getAlignmentPatternPositions(), numAlign = alignPatPos.length; 13553 for (let i2 = 0; i2 < numAlign; i2++) 13554 for (let j2 = 0; j2 < numAlign; j2++) 13555 i2 == 0 && j2 == 0 || i2 == 0 && j2 == numAlign - 1 || i2 == numAlign - 1 && j2 == 0 || this.drawAlignmentPattern(alignPatPos[i2], alignPatPos[j2]); 13556 this.drawFormatBits(0), this.drawVersion(); 13557 } 13558 // Draws two copies of the format bits (with its own error correction code) 13559 // based on the given mask and this object's error correction level field. 13560 drawFormatBits(mask) { 13561 let data = this.errorCorrectionLevel.formatBits << 3 | mask, rem2 = data; 13562 for (let i2 = 0; i2 < 10; i2++) 13563 rem2 = rem2 << 1 ^ (rem2 >>> 9) * 1335; 13564 let bits = (data << 10 | rem2) ^ 21522; 13565 assert(bits >>> 15 == 0); 13566 for (let i2 = 0; i2 <= 5; i2++) 13567 this.setFunctionModule(8, i2, getBit(bits, i2)); 13568 this.setFunctionModule(8, 7, getBit(bits, 6)), this.setFunctionModule(8, 8, getBit(bits, 7)), this.setFunctionModule(7, 8, getBit(bits, 8)); 13569 for (let i2 = 9; i2 < 15; i2++) 13570 this.setFunctionModule(14 - i2, 8, getBit(bits, i2)); 13571 for (let i2 = 0; i2 < 8; i2++) 13572 this.setFunctionModule(this.size - 1 - i2, 8, getBit(bits, i2)); 13573 for (let i2 = 8; i2 < 15; i2++) 13574 this.setFunctionModule(8, this.size - 15 + i2, getBit(bits, i2)); 13575 this.setFunctionModule(8, this.size - 8, !0); 13576 } 13577 // Draws two copies of the version bits (with its own error correction code), 13578 // based on this object's version field, iff 7 <= version <= 40. 13579 drawVersion() { 13580 if (this.version < 7) 13581 return; 13582 let rem2 = this.version; 13583 for (let i2 = 0; i2 < 12; i2++) 13584 rem2 = rem2 << 1 ^ (rem2 >>> 11) * 7973; 13585 let bits = this.version << 12 | rem2; 13586 assert(bits >>> 18 == 0); 13587 for (let i2 = 0; i2 < 18; i2++) { 13588 let color2 = getBit(bits, i2), a2 = this.size - 11 + i2 % 3, b2 = Math.floor(i2 / 3); 13589 this.setFunctionModule(a2, b2, color2), this.setFunctionModule(b2, a2, color2); 13590 } 13591 } 13592 // Draws a 9*9 finder pattern including the border separator, 13593 // with the center module at (x, y). Modules can be out of bounds. 13594 drawFinderPattern(x2, y2) { 13595 for (let dy = -4; dy <= 4; dy++) 13596 for (let dx = -4; dx <= 4; dx++) { 13597 let dist = Math.max(Math.abs(dx), Math.abs(dy)), xx = x2 + dx, yy = y2 + dy; 13598 0 <= xx && xx < this.size && 0 <= yy && yy < this.size && this.setFunctionModule(xx, yy, dist != 2 && dist != 4); 13599 } 13600 } 13601 // Draws a 5*5 alignment pattern, with the center module 13602 // at (x, y). All modules must be in bounds. 13603 drawAlignmentPattern(x2, y2) { 13604 for (let dy = -2; dy <= 2; dy++) 13605 for (let dx = -2; dx <= 2; dx++) 13606 this.setFunctionModule(x2 + dx, y2 + dy, Math.max(Math.abs(dx), Math.abs(dy)) != 1); 13607 } 13608 // Sets the color of a module and marks it as a function module. 13609 // Only used by the constructor. Coordinates must be in bounds. 13610 setFunctionModule(x2, y2, isDark) { 13611 this.modules[y2][x2] = isDark, this.isFunction[y2][x2] = !0; 13612 } 13613 /*-- Private helper methods for constructor: Codewords and masking --*/ 13614 // Returns a new byte string representing the given data with the appropriate error correction 13615 // codewords appended to it, based on this object's version and error correction level. 13616 addEccAndInterleave(data) { 13617 let ver = this.version, ecl = this.errorCorrectionLevel; 13618 if (data.length != _QrCode2.getNumDataCodewords(ver, ecl)) 13619 throw new RangeError("Invalid argument"); 13620 let numBlocks = _QrCode2.NUM_ERROR_CORRECTION_BLOCKS[ecl.ordinal][ver], blockEccLen = _QrCode2.ECC_CODEWORDS_PER_BLOCK[ecl.ordinal][ver], rawCodewords = Math.floor(_QrCode2.getNumRawDataModules(ver) / 8), numShortBlocks = numBlocks - rawCodewords % numBlocks, shortBlockLen = Math.floor(rawCodewords / numBlocks), blocks = [], rsDiv = _QrCode2.reedSolomonComputeDivisor(blockEccLen); 13621 for (let i2 = 0, k2 = 0; i2 < numBlocks; i2++) { 13622 let dat = data.slice(k2, k2 + shortBlockLen - blockEccLen + (i2 < numShortBlocks ? 0 : 1)); 13623 k2 += dat.length; 13624 let ecc = _QrCode2.reedSolomonComputeRemainder(dat, rsDiv); 13625 i2 < numShortBlocks && dat.push(0), blocks.push(dat.concat(ecc)); 13626 } 13627 let result = []; 13628 for (let i2 = 0; i2 < blocks[0].length; i2++) 13629 blocks.forEach((block, j2) => { 13630 (i2 != shortBlockLen - blockEccLen || j2 >= numShortBlocks) && result.push(block[i2]); 13631 }); 13632 return assert(result.length == rawCodewords), result; 13633 } 13634 // Draws the given sequence of 8-bit codewords (data and error correction) onto the entire 13635 // data area of this QR Code. Function modules need to be marked off before this is called. 13636 drawCodewords(data) { 13637 if (data.length != Math.floor(_QrCode2.getNumRawDataModules(this.version) / 8)) 13638 throw new RangeError("Invalid argument"); 13639 let i2 = 0; 13640 for (let right = this.size - 1; right >= 1; right -= 2) { 13641 right == 6 && (right = 5); 13642 for (let vert = 0; vert < this.size; vert++) 13643 for (let j2 = 0; j2 < 2; j2++) { 13644 let x2 = right - j2, y2 = (right + 1 & 2) == 0 ? this.size - 1 - vert : vert; 13645 !this.isFunction[y2][x2] && i2 < data.length * 8 && (this.modules[y2][x2] = getBit(data[i2 >>> 3], 7 - (i2 & 7)), i2++); 13646 } 13647 } 13648 assert(i2 == data.length * 8); 13649 } 13650 // XORs the codeword modules in this QR Code with the given mask pattern. 13651 // The function modules must be marked and the codeword bits must be drawn 13652 // before masking. Due to the arithmetic of XOR, calling applyMask() with 13653 // the same mask value a second time will undo the mask. A final well-formed 13654 // QR Code needs exactly one (not zero, two, etc.) mask applied. 13655 applyMask(mask) { 13656 if (mask < 0 || mask > 7) 13657 throw new RangeError("Mask value out of range"); 13658 for (let y2 = 0; y2 < this.size; y2++) 13659 for (let x2 = 0; x2 < this.size; x2++) { 13660 let invert2; 13661 switch (mask) { 13662 case 0: 13663 invert2 = (x2 + y2) % 2 == 0; 13664 break; 13665 case 1: 13666 invert2 = y2 % 2 == 0; 13667 break; 13668 case 2: 13669 invert2 = x2 % 3 == 0; 13670 break; 13671 case 3: 13672 invert2 = (x2 + y2) % 3 == 0; 13673 break; 13674 case 4: 13675 invert2 = (Math.floor(x2 / 3) + Math.floor(y2 / 2)) % 2 == 0; 13676 break; 13677 case 5: 13678 invert2 = x2 * y2 % 2 + x2 * y2 % 3 == 0; 13679 break; 13680 case 6: 13681 invert2 = (x2 * y2 % 2 + x2 * y2 % 3) % 2 == 0; 13682 break; 13683 case 7: 13684 invert2 = ((x2 + y2) % 2 + x2 * y2 % 3) % 2 == 0; 13685 break; 13686 default: 13687 throw new Error("Unreachable"); 13688 } 13689 !this.isFunction[y2][x2] && invert2 && (this.modules[y2][x2] = !this.modules[y2][x2]); 13690 } 13691 } 13692 // Calculates and returns the penalty score based on state of this QR Code's current modules. 13693 // This is used by the automatic mask choice algorithm to find the mask pattern that yields the lowest score. 13694 getPenaltyScore() { 13695 let result = 0; 13696 for (let y2 = 0; y2 < this.size; y2++) { 13697 let runColor = !1, runX = 0, runHistory = [0, 0, 0, 0, 0, 0, 0]; 13698 for (let x2 = 0; x2 < this.size; x2++) 13699 this.modules[y2][x2] == runColor ? (runX++, runX == 5 ? result += _QrCode2.PENALTY_N1 : runX > 5 && result++) : (this.finderPenaltyAddHistory(runX, runHistory), runColor || (result += this.finderPenaltyCountPatterns(runHistory) * _QrCode2.PENALTY_N3), runColor = this.modules[y2][x2], runX = 1); 13700 result += this.finderPenaltyTerminateAndCount(runColor, runX, runHistory) * _QrCode2.PENALTY_N3; 13701 } 13702 for (let x2 = 0; x2 < this.size; x2++) { 13703 let runColor = !1, runY = 0, runHistory = [0, 0, 0, 0, 0, 0, 0]; 13704 for (let y2 = 0; y2 < this.size; y2++) 13705 this.modules[y2][x2] == runColor ? (runY++, runY == 5 ? result += _QrCode2.PENALTY_N1 : runY > 5 && result++) : (this.finderPenaltyAddHistory(runY, runHistory), runColor || (result += this.finderPenaltyCountPatterns(runHistory) * _QrCode2.PENALTY_N3), runColor = this.modules[y2][x2], runY = 1); 13706 result += this.finderPenaltyTerminateAndCount(runColor, runY, runHistory) * _QrCode2.PENALTY_N3; 13707 } 13708 for (let y2 = 0; y2 < this.size - 1; y2++) 13709 for (let x2 = 0; x2 < this.size - 1; x2++) { 13710 let color2 = this.modules[y2][x2]; 13711 color2 == this.modules[y2][x2 + 1] && color2 == this.modules[y2 + 1][x2] && color2 == this.modules[y2 + 1][x2 + 1] && (result += _QrCode2.PENALTY_N2); 13712 } 13713 let dark = 0; 13714 for (let row of this.modules) 13715 dark = row.reduce((sum, color2) => sum + (color2 ? 1 : 0), dark); 13716 let total = this.size * this.size, k2 = Math.ceil(Math.abs(dark * 20 - total * 10) / total) - 1; 13717 return assert(0 <= k2 && k2 <= 9), result += k2 * _QrCode2.PENALTY_N4, assert(0 <= result && result <= 2568888), result; 13718 } 13719 /*-- Private helper functions --*/ 13720 // Returns an ascending list of positions of alignment patterns for this version number. 13721 // Each position is in the range [0,177), and are used on both the x and y axes. 13722 // This could be implemented as lookup table of 40 variable-length lists of integers. 13723 getAlignmentPatternPositions() { 13724 if (this.version == 1) 13725 return []; 13726 { 13727 let numAlign = Math.floor(this.version / 7) + 2, step = this.version == 32 ? 26 : Math.ceil((this.version * 4 + 4) / (numAlign * 2 - 2)) * 2, result = [6]; 13728 for (let pos = this.size - 7; result.length < numAlign; pos -= step) 13729 result.splice(1, 0, pos); 13730 return result; 13731 } 13732 } 13733 // Returns the number of data bits that can be stored in a QR Code of the given version number, after 13734 // all function modules are excluded. This includes remainder bits, so it might not be a multiple of 8. 13735 // The result is in the range [208, 29648]. This could be implemented as a 40-entry lookup table. 13736 static getNumRawDataModules(ver) { 13737 if (ver < _QrCode2.MIN_VERSION || ver > _QrCode2.MAX_VERSION) 13738 throw new RangeError("Version number out of range"); 13739 let result = (16 * ver + 128) * ver + 64; 13740 if (ver >= 2) { 13741 let numAlign = Math.floor(ver / 7) + 2; 13742 result -= (25 * numAlign - 10) * numAlign - 55, ver >= 7 && (result -= 36); 13743 } 13744 return assert(208 <= result && result <= 29648), result; 13745 } 13746 // Returns the number of 8-bit data (i.e. not error correction) codewords contained in any 13747 // QR Code of the given version number and error correction level, with remainder bits discarded. 13748 // This stateless pure function could be implemented as a (40*4)-cell lookup table. 13749 static getNumDataCodewords(ver, ecl) { 13750 return Math.floor(_QrCode2.getNumRawDataModules(ver) / 8) - _QrCode2.ECC_CODEWORDS_PER_BLOCK[ecl.ordinal][ver] * _QrCode2.NUM_ERROR_CORRECTION_BLOCKS[ecl.ordinal][ver]; 13751 } 13752 // Returns a Reed-Solomon ECC generator polynomial for the given degree. This could be 13753 // implemented as a lookup table over all possible parameter values, instead of as an algorithm. 13754 static reedSolomonComputeDivisor(degree) { 13755 if (degree < 1 || degree > 255) 13756 throw new RangeError("Degree out of range"); 13757 let result = []; 13758 for (let i2 = 0; i2 < degree - 1; i2++) 13759 result.push(0); 13760 result.push(1); 13761 let root2 = 1; 13762 for (let i2 = 0; i2 < degree; i2++) { 13763 for (let j2 = 0; j2 < result.length; j2++) 13764 result[j2] = _QrCode2.reedSolomonMultiply(result[j2], root2), j2 + 1 < result.length && (result[j2] ^= result[j2 + 1]); 13765 root2 = _QrCode2.reedSolomonMultiply(root2, 2); 13766 } 13767 return result; 13768 } 13769 // Returns the Reed-Solomon error correction codeword for the given data and divisor polynomials. 13770 static reedSolomonComputeRemainder(data, divisor) { 13771 let result = divisor.map((_2) => 0); 13772 for (let b2 of data) { 13773 let factor = b2 ^ result.shift(); 13774 result.push(0), divisor.forEach((coef, i2) => result[i2] ^= _QrCode2.reedSolomonMultiply(coef, factor)); 13775 } 13776 return result; 13777 } 13778 // Returns the product of the two given field elements modulo GF(2^8/0x11D). The arguments and result 13779 // are unsigned 8-bit integers. This could be implemented as a lookup table of 256*256 entries of uint8. 13780 static reedSolomonMultiply(x2, y2) { 13781 if (x2 >>> 8 || y2 >>> 8) 13782 throw new RangeError("Byte out of range"); 13783 let z2 = 0; 13784 for (let i2 = 7; i2 >= 0; i2--) 13785 z2 = z2 << 1 ^ (z2 >>> 7) * 285, z2 ^= (y2 >>> i2 & 1) * x2; 13786 return assert(z2 >>> 8 == 0), z2; 13787 } 13788 // Can only be called immediately after a light run is added, and 13789 // returns either 0, 1, or 2. A helper function for getPenaltyScore(). 13790 finderPenaltyCountPatterns(runHistory) { 13791 let n3 = runHistory[1]; 13792 assert(n3 <= this.size * 3); 13793 let core = n3 > 0 && runHistory[2] == n3 && runHistory[3] == n3 * 3 && runHistory[4] == n3 && runHistory[5] == n3; 13794 return (core && runHistory[0] >= n3 * 4 && runHistory[6] >= n3 ? 1 : 0) + (core && runHistory[6] >= n3 * 4 && runHistory[0] >= n3 ? 1 : 0); 13795 } 13796 // Must be called at the end of a line (row or column) of modules. A helper function for getPenaltyScore(). 13797 finderPenaltyTerminateAndCount(currentRunColor, currentRunLength, runHistory) { 13798 return currentRunColor && (this.finderPenaltyAddHistory(currentRunLength, runHistory), currentRunLength = 0), currentRunLength += this.size, this.finderPenaltyAddHistory(currentRunLength, runHistory), this.finderPenaltyCountPatterns(runHistory); 13799 } 13800 // Pushes the given value to the front and drops the last value. A helper function for getPenaltyScore(). 13801 finderPenaltyAddHistory(currentRunLength, runHistory) { 13802 runHistory[0] == 0 && (currentRunLength += this.size), runHistory.pop(), runHistory.unshift(currentRunLength); 13803 } 13804 }; 13805 _QrCode.MIN_VERSION = 1, _QrCode.MAX_VERSION = 40, _QrCode.PENALTY_N1 = 3, _QrCode.PENALTY_N2 = 3, _QrCode.PENALTY_N3 = 40, _QrCode.PENALTY_N4 = 10, _QrCode.ECC_CODEWORDS_PER_BLOCK = [ 13806 // Version: (note that index 0 is for padding, and is set to an illegal value) 13807 //0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 Error correction level 13808 [-1, 7, 10, 15, 20, 26, 18, 20, 24, 30, 18, 20, 24, 26, 30, 22, 24, 28, 30, 28, 28, 28, 28, 30, 30, 26, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30], 13809 // Low 13810 [-1, 10, 16, 26, 18, 24, 16, 18, 22, 22, 26, 30, 22, 22, 24, 24, 28, 28, 26, 26, 26, 26, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28], 13811 // Medium 13812 [-1, 13, 22, 18, 26, 18, 24, 18, 22, 20, 24, 28, 26, 24, 20, 30, 24, 28, 28, 26, 30, 28, 30, 30, 30, 30, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30], 13813 // Quartile 13814 [-1, 17, 28, 22, 16, 22, 28, 26, 26, 24, 28, 24, 28, 22, 24, 24, 30, 28, 28, 26, 28, 30, 24, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30] 13815 // High 13816 ], _QrCode.NUM_ERROR_CORRECTION_BLOCKS = [ 13817 // Version: (note that index 0 is for padding, and is set to an illegal value) 13818 //0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 Error correction level 13819 [-1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 4, 6, 6, 6, 6, 7, 8, 8, 9, 9, 10, 12, 12, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 24, 25], 13820 // Low 13821 [-1, 1, 1, 1, 2, 2, 4, 4, 4, 5, 5, 5, 8, 9, 9, 10, 10, 11, 13, 14, 16, 17, 17, 18, 20, 21, 23, 25, 26, 28, 29, 31, 33, 35, 37, 38, 40, 43, 45, 47, 49], 13822 // Medium 13823 [-1, 1, 1, 2, 2, 4, 4, 6, 6, 8, 8, 8, 10, 12, 16, 12, 17, 16, 18, 21, 20, 23, 23, 25, 27, 29, 34, 34, 35, 38, 40, 43, 45, 48, 51, 53, 56, 59, 62, 65, 68], 13824 // Quartile 13825 [-1, 1, 1, 2, 4, 4, 4, 5, 6, 8, 8, 11, 11, 16, 16, 18, 16, 19, 21, 25, 25, 25, 34, 30, 32, 35, 37, 40, 42, 45, 48, 51, 54, 57, 60, 63, 66, 70, 74, 77, 81] 13826 // High 13827 ]; 13828 let QrCode = _QrCode; 13829 qrcodegen2.QrCode = _QrCode; 13830 function appendBits(val, len, bb) { 13831 if (len < 0 || len > 31 || val >>> len) 13832 throw new RangeError("Value out of range"); 13833 for (let i2 = len - 1; i2 >= 0; i2--) 13834 bb.push(val >>> i2 & 1); 13835 } 13836 function getBit(x2, i2) { 13837 return (x2 >>> i2 & 1) != 0; 13838 } 13839 function assert(cond) { 13840 if (!cond) 13841 throw new Error("Assertion error"); 13842 } 13843 let _QrSegment = class _QrSegment2 { 13844 /*-- Constructor (low level) and fields --*/ 13845 // Creates a new QR Code segment with the given attributes and data. 13846 // The character count (numChars) must agree with the mode and the bit buffer length, 13847 // but the constraint isn't checked. The given bit buffer is cloned and stored. 13848 constructor(mode, numChars, bitData) { 13849 if (this.mode = mode, this.numChars = numChars, this.bitData = bitData, numChars < 0) 13850 throw new RangeError("Invalid argument"); 13851 this.bitData = bitData.slice(); 13852 } 13853 /*-- Static factory functions (mid level) --*/ 13854 // Returns a segment representing the given binary data encoded in 13855 // byte mode. All input byte arrays are acceptable. Any text string 13856 // can be converted to UTF-8 bytes and encoded as a byte mode segment. 13857 static makeBytes(data) { 13858 let bb = []; 13859 for (let b2 of data) 13860 appendBits(b2, 8, bb); 13861 return new _QrSegment2(_QrSegment2.Mode.BYTE, data.length, bb); 13862 } 13863 // Returns a segment representing the given string of decimal digits encoded in numeric mode. 13864 static makeNumeric(digits) { 13865 if (!_QrSegment2.isNumeric(digits)) 13866 throw new RangeError("String contains non-numeric characters"); 13867 let bb = []; 13868 for (let i2 = 0; i2 < digits.length; ) { 13869 let n3 = Math.min(digits.length - i2, 3); 13870 appendBits(parseInt(digits.substring(i2, i2 + n3), 10), n3 * 3 + 1, bb), i2 += n3; 13871 } 13872 return new _QrSegment2(_QrSegment2.Mode.NUMERIC, digits.length, bb); 13873 } 13874 // Returns a segment representing the given text string encoded in alphanumeric mode. 13875 // The characters allowed are: 0 to 9, A to Z (uppercase only), space, 13876 // dollar, percent, asterisk, plus, hyphen, period, slash, colon. 13877 static makeAlphanumeric(text) { 13878 if (!_QrSegment2.isAlphanumeric(text)) 13879 throw new RangeError("String contains unencodable characters in alphanumeric mode"); 13880 let bb = [], i2; 13881 for (i2 = 0; i2 + 2 <= text.length; i2 += 2) { 13882 let temp = _QrSegment2.ALPHANUMERIC_CHARSET.indexOf(text.charAt(i2)) * 45; 13883 temp += _QrSegment2.ALPHANUMERIC_CHARSET.indexOf(text.charAt(i2 + 1)), appendBits(temp, 11, bb); 13884 } 13885 return i2 < text.length && appendBits(_QrSegment2.ALPHANUMERIC_CHARSET.indexOf(text.charAt(i2)), 6, bb), new _QrSegment2(_QrSegment2.Mode.ALPHANUMERIC, text.length, bb); 13886 } 13887 // Returns a new mutable list of zero or more segments to represent the given Unicode text string. 13888 // The result may use various segment modes and switch modes to optimize the length of the bit stream. 13889 static makeSegments(text) { 13890 return text == "" ? [] : _QrSegment2.isNumeric(text) ? [_QrSegment2.makeNumeric(text)] : _QrSegment2.isAlphanumeric(text) ? [_QrSegment2.makeAlphanumeric(text)] : [_QrSegment2.makeBytes(_QrSegment2.toUtf8ByteArray(text))]; 13891 } 13892 // Returns a segment representing an Extended Channel Interpretation 13893 // (ECI) designator with the given assignment value. 13894 static makeEci(assignVal) { 13895 let bb = []; 13896 if (assignVal < 0) 13897 throw new RangeError("ECI assignment value out of range"); 13898 if (assignVal < 128) 13899 appendBits(assignVal, 8, bb); 13900 else if (assignVal < 16384) 13901 appendBits(2, 2, bb), appendBits(assignVal, 14, bb); 13902 else if (assignVal < 1e6) 13903 appendBits(6, 3, bb), appendBits(assignVal, 21, bb); 13904 else 13905 throw new RangeError("ECI assignment value out of range"); 13906 return new _QrSegment2(_QrSegment2.Mode.ECI, 0, bb); 13907 } 13908 // Tests whether the given string can be encoded as a segment in numeric mode. 13909 // A string is encodable iff each character is in the range 0 to 9. 13910 static isNumeric(text) { 13911 return _QrSegment2.NUMERIC_REGEX.test(text); 13912 } 13913 // Tests whether the given string can be encoded as a segment in alphanumeric mode. 13914 // A string is encodable iff each character is in the following set: 0 to 9, A to Z 13915 // (uppercase only), space, dollar, percent, asterisk, plus, hyphen, period, slash, colon. 13916 static isAlphanumeric(text) { 13917 return _QrSegment2.ALPHANUMERIC_REGEX.test(text); 13918 } 13919 /*-- Methods --*/ 13920 // Returns a new copy of the data bits of this segment. 13921 getData() { 13922 return this.bitData.slice(); 13923 } 13924 // (Package-private) Calculates and returns the number of bits needed to encode the given segments at 13925 // the given version. The result is infinity if a segment has too many characters to fit its length field. 13926 static getTotalBits(segs, version3) { 13927 let result = 0; 13928 for (let seg of segs) { 13929 let ccbits = seg.mode.numCharCountBits(version3); 13930 if (seg.numChars >= 1 << ccbits) 13931 return 1 / 0; 13932 result += 4 + ccbits + seg.bitData.length; 13933 } 13934 return result; 13935 } 13936 // Returns a new array of bytes representing the given string encoded in UTF-8. 13937 static toUtf8ByteArray(str) { 13938 str = encodeURI(str); 13939 let result = []; 13940 for (let i2 = 0; i2 < str.length; i2++) 13941 str.charAt(i2) != "%" ? result.push(str.charCodeAt(i2)) : (result.push(parseInt(str.substring(i2 + 1, i2 + 3), 16)), i2 += 2); 13942 return result; 13943 } 13944 }; 13945 _QrSegment.NUMERIC_REGEX = /^[0-9]*$/, _QrSegment.ALPHANUMERIC_REGEX = /^[A-Z0-9 $%*+.\/:-]*$/, _QrSegment.ALPHANUMERIC_CHARSET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:"; 13946 let QrSegment = _QrSegment; 13947 qrcodegen2.QrSegment = _QrSegment; 13948})(qrcodegen || (qrcodegen = {})); 13949((qrcodegen2) => { 13950 let QrCode; 13951 ((QrCode2) => { 13952 let _Ecc = class { 13953 // The QR Code can tolerate about 30% erroneous codewords 13954 /*-- Constructor and fields --*/ 13955 constructor(ordinal, formatBits) { 13956 this.ordinal = ordinal, this.formatBits = formatBits; 13957 } 13958 }; 13959 _Ecc.LOW = new _Ecc(0, 1), _Ecc.MEDIUM = new _Ecc(1, 0), _Ecc.QUARTILE = new _Ecc(2, 3), _Ecc.HIGH = new _Ecc(3, 2); 13960 let Ecc = _Ecc; 13961 QrCode2.Ecc = _Ecc; 13962 })(QrCode = qrcodegen2.QrCode || (qrcodegen2.QrCode = {})); 13963})(qrcodegen || (qrcodegen = {})); 13964((qrcodegen2) => { 13965 let QrSegment; 13966 ((QrSegment2) => { 13967 let _Mode = class { 13968 /*-- Constructor and fields --*/ 13969 constructor(modeBits, numBitsCharCount) { 13970 this.modeBits = modeBits, this.numBitsCharCount = numBitsCharCount; 13971 } 13972 /*-- Method --*/ 13973 // (Package-private) Returns the bit width of the character count field for a segment in 13974 // this mode in a QR Code at the given version number. The result is in the range [0, 16]. 13975 numCharCountBits(ver) { 13976 return this.numBitsCharCount[Math.floor((ver + 7) / 17)]; 13977 } 13978 }; 13979 _Mode.NUMERIC = new _Mode(1, [10, 12, 14]), _Mode.ALPHANUMERIC = new _Mode(2, [9, 11, 13]), _Mode.BYTE = new _Mode(4, [8, 16, 16]), _Mode.KANJI = new _Mode(8, [8, 10, 12]), _Mode.ECI = new _Mode(7, [0, 0, 0]); 13980 let Mode = _Mode; 13981 QrSegment2.Mode = _Mode; 13982 })(QrSegment = qrcodegen2.QrSegment || (qrcodegen2.QrSegment = {})); 13983})(qrcodegen || (qrcodegen = {})); 13984var qrcodegen_default = qrcodegen; 13985var ERROR_LEVEL_MAP = { 13986 L: qrcodegen_default.QrCode.Ecc.LOW, 13987 M: qrcodegen_default.QrCode.Ecc.MEDIUM, 13988 Q: qrcodegen_default.QrCode.Ecc.QUARTILE, 13989 H: qrcodegen_default.QrCode.Ecc.HIGH 13990}, DEFAULT_SIZE = 128, DEFAULT_LEVEL = "L", DEFAULT_BGCOLOR = "#FFFFFF", DEFAULT_FGCOLOR = "#000000", DEFAULT_INCLUDEMARGIN = !1, DEFAULT_MINVERSION = 1, SPEC_MARGIN_SIZE = 4, DEFAULT_MARGIN_SIZE = 0, DEFAULT_IMG_SCALE = 0.1; 13991function generatePath(modules, margin = 0) { 13992 let ops = []; 13993 return modules.forEach(function(row, y2) { 13994 let start = null; 13995 row.forEach(function(cell, x2) { 13996 if (!cell && start !== null) { 13997 ops.push( 13998 `M${start + margin} ${y2 + margin}h${x2 - start}v1H${start + margin}z` 13999 ), start = null; 14000 return; 14001 } 14002 if (x2 === row.length - 1) { 14003 if (!cell) 14004 return; 14005 start === null ? ops.push(`M${x2 + margin},${y2 + margin} h1v1H${x2 + margin}z`) : ops.push( 14006 `M${start + margin},${y2 + margin} h${x2 + 1 - start}v1H${start + margin}z` 14007 ); 14008 return; 14009 } 14010 cell && start === null && (start = x2); 14011 }); 14012 }), ops.join(""); 14013} 14014function excavateModules(modules, excavation) { 14015 return modules.slice().map((row, y2) => y2 < excavation.y || y2 >= excavation.y + excavation.h ? row : row.map((cell, x2) => x2 < excavation.x || x2 >= excavation.x + excavation.w ? cell : !1)); 14016} 14017function getImageSettings(cells, size, margin, imageSettings) { 14018 if (imageSettings == null) 14019 return null; 14020 let numCells = cells.length + margin * 2, defaultSize = Math.floor(size * DEFAULT_IMG_SCALE), scale = numCells / size, w2 = (imageSettings.width || defaultSize) * scale, h2 = (imageSettings.height || defaultSize) * scale, x2 = imageSettings.x == null ? cells.length / 2 - w2 / 2 : imageSettings.x * scale, y2 = imageSettings.y == null ? cells.length / 2 - h2 / 2 : imageSettings.y * scale, opacity = imageSettings.opacity == null ? 1 : imageSettings.opacity, excavation = null; 14021 if (imageSettings.excavate) { 14022 let floorX = Math.floor(x2), floorY = Math.floor(y2), ceilW = Math.ceil(w2 + x2 - floorX), ceilH = Math.ceil(h2 + y2 - floorY); 14023 excavation = { x: floorX, y: floorY, w: ceilW, h: ceilH }; 14024 } 14025 let crossOrigin = imageSettings.crossOrigin; 14026 return { x: x2, y: y2, h: h2, w: w2, excavation, opacity, crossOrigin }; 14027} 14028function getMarginSize(includeMargin, marginSize) { 14029 return marginSize != null ? Math.max(Math.floor(marginSize), 0) : includeMargin ? SPEC_MARGIN_SIZE : DEFAULT_MARGIN_SIZE; 14030} 14031function useQRCode({ 14032 value, 14033 level, 14034 minVersion, 14035 includeMargin, 14036 marginSize, 14037 imageSettings, 14038 size, 14039 boostLevel 14040}) { 14041 let qrcode = react_default.useMemo(() => { 14042 let segments = (Array.isArray(value) ? value : [value]).reduce((accum, v2) => (accum.push(...qrcodegen_default.QrSegment.makeSegments(v2)), accum), []); 14043 return qrcodegen_default.QrCode.encodeSegments( 14044 segments, 14045 ERROR_LEVEL_MAP[level], 14046 minVersion, 14047 void 0, 14048 void 0, 14049 boostLevel 14050 ); 14051 }, [value, level, minVersion, boostLevel]), { cells, margin, numCells, calculatedImageSettings } = react_default.useMemo(() => { 14052 let cells2 = qrcode.getModules(), margin2 = getMarginSize(includeMargin, marginSize), numCells2 = cells2.length + margin2 * 2, calculatedImageSettings2 = getImageSettings( 14053 cells2, 14054 size, 14055 margin2, 14056 imageSettings 14057 ); 14058 return { 14059 cells: cells2, 14060 margin: margin2, 14061 numCells: numCells2, 14062 calculatedImageSettings: calculatedImageSettings2 14063 }; 14064 }, [qrcode, size, imageSettings, includeMargin, marginSize]); 14065 return { 14066 qrcode, 14067 margin, 14068 cells, 14069 numCells, 14070 calculatedImageSettings 14071 }; 14072} 14073var SUPPORTS_PATH2D = (function() { 14074 try { 14075 new Path2D().addPath(new Path2D()); 14076 } catch { 14077 return !1; 14078 } 14079 return !0; 14080})(), QRCodeCanvas = react_default.forwardRef( 14081 function(props, forwardedRef) { 14082 let _a2 = props, { 14083 value, 14084 size = DEFAULT_SIZE, 14085 level = DEFAULT_LEVEL, 14086 bgColor = DEFAULT_BGCOLOR, 14087 fgColor = DEFAULT_FGCOLOR, 14088 includeMargin = DEFAULT_INCLUDEMARGIN, 14089 minVersion = DEFAULT_MINVERSION, 14090 boostLevel, 14091 marginSize, 14092 imageSettings 14093 } = _a2, _b = __objRest(_a2, [ 14094 "value", 14095 "size", 14096 "level", 14097 "bgColor", 14098 "fgColor", 14099 "includeMargin", 14100 "minVersion", 14101 "boostLevel", 14102 "marginSize", 14103 "imageSettings" 14104 ]), { style } = _b, otherProps = __objRest(_b, ["style"]), imgSrc = imageSettings?.src, _canvas = react_default.useRef(null), _image = react_default.useRef(null), setCanvasRef = react_default.useCallback( 14105 (node) => { 14106 _canvas.current = node, typeof forwardedRef == "function" ? forwardedRef(node) : forwardedRef && (forwardedRef.current = node); 14107 }, 14108 [forwardedRef] 14109 ), [isImgLoaded, setIsImageLoaded] = react_default.useState(!1), { margin, cells, numCells, calculatedImageSettings } = useQRCode({ 14110 value, 14111 level, 14112 minVersion, 14113 boostLevel, 14114 includeMargin, 14115 marginSize, 14116 imageSettings, 14117 size 14118 }); 14119 react_default.useEffect(() => { 14120 if (_canvas.current != null) { 14121 let canvas = _canvas.current, ctx = canvas.getContext("2d"); 14122 if (!ctx) 14123 return; 14124 let cellsToDraw = cells, image = _image.current, haveImageToRender = calculatedImageSettings != null && image !== null && image.complete && image.naturalHeight !== 0 && image.naturalWidth !== 0; 14125 haveImageToRender && calculatedImageSettings.excavation != null && (cellsToDraw = excavateModules( 14126 cells, 14127 calculatedImageSettings.excavation 14128 )); 14129 let pixelRatio = window.devicePixelRatio || 1; 14130 canvas.height = canvas.width = size * pixelRatio; 14131 let scale = size / numCells * pixelRatio; 14132 ctx.scale(scale, scale), ctx.fillStyle = bgColor, ctx.fillRect(0, 0, numCells, numCells), ctx.fillStyle = fgColor, SUPPORTS_PATH2D ? ctx.fill(new Path2D(generatePath(cellsToDraw, margin))) : cells.forEach(function(row, rdx) { 14133 row.forEach(function(cell, cdx) { 14134 cell && ctx.fillRect(cdx + margin, rdx + margin, 1, 1); 14135 }); 14136 }), calculatedImageSettings && (ctx.globalAlpha = calculatedImageSettings.opacity), haveImageToRender && ctx.drawImage( 14137 image, 14138 calculatedImageSettings.x + margin, 14139 calculatedImageSettings.y + margin, 14140 calculatedImageSettings.w, 14141 calculatedImageSettings.h 14142 ); 14143 } 14144 }), react_default.useEffect(() => { 14145 setIsImageLoaded(!1); 14146 }, [imgSrc]); 14147 let canvasStyle = __spreadValues({ height: size, width: size }, style), img = null; 14148 return imgSrc != null && (img = react_default.createElement( 14149 "img", 14150 { 14151 src: imgSrc, 14152 key: imgSrc, 14153 style: { display: "none" }, 14154 onLoad: () => { 14155 setIsImageLoaded(!0); 14156 }, 14157 ref: _image, 14158 crossOrigin: calculatedImageSettings?.crossOrigin 14159 } 14160 )), react_default.createElement(react_default.Fragment, null, react_default.createElement( 14161 "canvas", 14162 __spreadValues({ 14163 style: canvasStyle, 14164 height: size, 14165 width: size, 14166 ref: setCanvasRef, 14167 role: "img" 14168 }, otherProps) 14169 ), img); 14170 } 14171); 14172QRCodeCanvas.displayName = "QRCodeCanvas"; 14173var QRCodeSVG = react_default.forwardRef( 14174 function(props, forwardedRef) { 14175 let _a2 = props, { 14176 value, 14177 size = DEFAULT_SIZE, 14178 level = DEFAULT_LEVEL, 14179 bgColor = DEFAULT_BGCOLOR, 14180 fgColor = DEFAULT_FGCOLOR, 14181 includeMargin = DEFAULT_INCLUDEMARGIN, 14182 minVersion = DEFAULT_MINVERSION, 14183 boostLevel, 14184 title: title2, 14185 marginSize, 14186 imageSettings 14187 } = _a2, otherProps = __objRest(_a2, [ 14188 "value", 14189 "size", 14190 "level", 14191 "bgColor", 14192 "fgColor", 14193 "includeMargin", 14194 "minVersion", 14195 "boostLevel", 14196 "title", 14197 "marginSize", 14198 "imageSettings" 14199 ]), { margin, cells, numCells, calculatedImageSettings } = useQRCode({ 14200 value, 14201 level, 14202 minVersion, 14203 boostLevel, 14204 includeMargin, 14205 marginSize, 14206 imageSettings, 14207 size 14208 }), cellsToDraw = cells, image = null; 14209 imageSettings != null && calculatedImageSettings != null && (calculatedImageSettings.excavation != null && (cellsToDraw = excavateModules( 14210 cells, 14211 calculatedImageSettings.excavation 14212 )), image = react_default.createElement( 14213 "image", 14214 { 14215 href: imageSettings.src, 14216 height: calculatedImageSettings.h, 14217 width: calculatedImageSettings.w, 14218 x: calculatedImageSettings.x + margin, 14219 y: calculatedImageSettings.y + margin, 14220 preserveAspectRatio: "none", 14221 opacity: calculatedImageSettings.opacity, 14222 crossOrigin: calculatedImageSettings.crossOrigin 14223 } 14224 )); 14225 let fgPath = generatePath(cellsToDraw, margin); 14226 return react_default.createElement( 14227 "svg", 14228 __spreadValues({ 14229 height: size, 14230 width: size, 14231 viewBox: `0 0 ${numCells} ${numCells}`, 14232 ref: forwardedRef, 14233 role: "img" 14234 }, otherProps), 14235 !!title2 && react_default.createElement("title", null, title2), 14236 react_default.createElement( 14237 "path", 14238 { 14239 fill: bgColor, 14240 d: `M0,0 h${numCells}v${numCells}H0z`, 14241 shapeRendering: "crispEdges" 14242 } 14243 ), 14244 react_default.createElement("path", { fill: fgColor, d: fgPath, shapeRendering: "crispEdges" }), 14245 image 14246 ); 14247 } 14248); 14249QRCodeSVG.displayName = "QRCodeSVG"; 14250 14251// src/manager/components/preview/tools/share.tsx 14252var mapper3 = ({ api, state }) => { 14253 let { storyId, refId } = state; 14254 return { api, refId, storyId }; 14255}, QRContainer = styled.div( 14256 () => ({ 14257 display: "flex", 14258 flexDirection: "column", 14259 padding: 8, 14260 width: 300, 14261 maxWidth: 300, 14262 gap: 8 14263 }) 14264), QRRow = styled.div(() => ({ 14265 display: "flex", 14266 alignItems: "center" 14267})), ShareLinkInput = styled.input(({ theme }) => ({ 14268 width: "100%", 14269 border: `1px solid ${theme.appBorderColor}`, 14270 borderRadius: 4, 14271 padding: "6px 8px", 14272 fontSize: theme.typography.size.s1, 14273 color: theme.color.defaultText, 14274 backgroundColor: theme.background.app, 14275 outline: "none", 14276 textOverflow: "ellipsis", 14277 overflow: "hidden", 14278 whiteSpace: "nowrap", 14279 "&:focus": { 14280 borderColor: theme.color.secondary 14281 } 14282})), QRImageContainer = styled.div(() => ({ 14283 width: 64, 14284 height: 64, 14285 marginRight: 12, 14286 backgroundColor: "white", 14287 padding: 2 14288})); 14289var QRContent = styled.div(() => ({})), QRTitle = styled.div(({ theme }) => ({ 14290 fontWeight: theme.typography.weight.bold, 14291 fontSize: theme.typography.size.s1, 14292 marginBottom: 4 14293})), QRDescription = styled.div(({ theme }) => ({ 14294 fontSize: theme.typography.size.s1, 14295 color: theme.textMutedColor 14296})), isolationModeTool = { 14297 title: "isolation mode", 14298 id: "isolationMode", 14299 type: types.TOOLEXTRA, 14300 match: ({ viewMode, tabId }) => viewMode === "story" && !tabId, 14301 render: () => react_default.createElement(Consumer, { filter: mapper3 }, ({ api, storyId, refId }) => storyId ? react_default.createElement( 14302 Button, 14303 { 14304 padding: "small", 14305 variant: "ghost", 14306 ariaLabel: "Open in isolation mode", 14307 tooltip: "Open in isolation mode", 14308 onClick: () => { 14309 let originHrefs = api.getStoryHrefs(storyId, { 14310 base: "origin", 14311 refId, 14312 inheritArgs: !0 14313 }); 14314 window.open(originHrefs.previewHref, "_blank", "noopener,noreferrer"), api.emit(SHARE_ISOLATE_MODE, originHrefs.previewHref); 14315 } 14316 }, 14317 react_default.createElement(PopOutIcon, null) 14318 ) : null) 14319}; 14320 14321// src/manager/container/Preview.tsx 14322var defaultTabs = [createCanvasTab()], defaultTools = [menuTool, remountTool], defaultToolsExtra = [ 14323 isolationModeTool, 14324 zoomTool, 14325 addonsTool, 14326 fullScreenTool, 14327 openInEditorTool 14328], emptyTabsList = [], memoizedTabs = (0, import_memoizerific2.default)(1)( 14329 (_2, tabElements, parameters, showTabs) => showTabs ? filterTabs([...defaultTabs, ...Object.values(tabElements)], parameters) : emptyTabsList 14330), memoizedTools = (0, import_memoizerific2.default)(1)( 14331 (_2, toolElements, filterProps) => filterToolsSide([...defaultTools, ...Object.values(toolElements)], ...filterProps) 14332), memoizedExtra = (0, import_memoizerific2.default)(1)( 14333 (_2, extraElements, filterProps) => filterToolsSide([...defaultToolsExtra, ...Object.values(extraElements)], ...filterProps) 14334), memoizedWrapper = (0, import_memoizerific2.default)(1)((_2, previewElements) => [ 14335 ...defaultWrappers, 14336 ...Object.values(previewElements) 14337]), { PREVIEW_URL } = scope, splitTitleAddExtraSpace = (input) => input.split("/").join(" / ").replace(/\s\s/, " "), getDescription = (item) => { 14338 if (item?.type === "story" || item?.type === "docs") { 14339 let { title: title2, name } = item; 14340 return title2 && name ? splitTitleAddExtraSpace(`${title2} - ${name} \u22C5 Storybook`) : "Storybook"; 14341 } 14342 return item?.name ? `${item.name} \u22C5 Storybook` : "Storybook"; 14343}, mapper4 = ({ 14344 api, 14345 state 14346 // @ts-expect-error (non strict) 14347}) => { 14348 let { layout, location: location2, customQueryParams, storyId, refs, viewMode, path, refId } = state, entry = api.getData(storyId, refId), tabsList = Object.values(api.getElements(Addon_TypesEnum.TAB)), wrapperList = Object.values(api.getElements(Addon_TypesEnum.PREVIEW)), toolsList = Object.values(api.getElements(Addon_TypesEnum.TOOL)), toolsExtraList = Object.values(api.getElements(Addon_TypesEnum.TOOLEXTRA)), tabId = api.getQueryParam("tab"), tools = memoizedTools(toolsList.length, api.getElements(Addon_TypesEnum.TOOL), [ 14349 entry, 14350 viewMode, 14351 location2, 14352 path, 14353 // @ts-expect-error (non strict) 14354 tabId 14355 ]), toolsExtra = memoizedExtra( 14356 toolsExtraList.length, 14357 api.getElements(Addon_TypesEnum.TOOLEXTRA), 14358 // @ts-expect-error (non strict) 14359 [entry, viewMode, location2, path, tabId] 14360 ); 14361 return { 14362 api, 14363 entry, 14364 options: layout, 14365 description: getDescription(entry), 14366 viewMode, 14367 refs, 14368 storyId, 14369 baseUrl: PREVIEW_URL || "iframe.html", 14370 path, 14371 queryParams: customQueryParams, 14372 tools, 14373 toolsExtra, 14374 tabs: memoizedTabs( 14375 tabsList.length, 14376 api.getElements(Addon_TypesEnum.TAB), 14377 entry ? entry.parameters : void 0, 14378 layout.showTabs 14379 ), 14380 wrappers: memoizedWrapper( 14381 wrapperList.length, 14382 api.getElements(Addon_TypesEnum.PREVIEW) 14383 ), 14384 tabId 14385 }; 14386}, PreviewConnected = react_default.memo(function(props) { 14387 return react_default.createElement(Consumer, { filter: mapper4 }, (fromState) => react_default.createElement(Preview2, { ...props, ...fromState })); 14388}), Preview_default = PreviewConnected; 14389 14390// src/manager/container/Sidebar.tsx 14391init_react(); 14392 14393// src/manager/components/sidebar/Sidebar.tsx 14394init_react(); 14395 14396// src/manager/components/sidebar/ChecklistWidget.tsx 14397init_react(); 14398 14399// src/manager/components/Optional/Optional.tsx 14400init_react(); 14401var Wrapper3 = styled.div({ 14402 display: "inline-grid", 14403 gridTemplateColumns: "max-content", 14404 overflow: "hidden" 14405}), Content2 = styled.div(({ isHidden }) => ({ 14406 display: "inline-block", 14407 gridArea: "1/1", 14408 opacity: isHidden === null ? 0 : 1, 14409 visibility: isHidden ? "hidden" : "visible" 14410})), Optional = ({ 14411 content, 14412 fallback 14413}) => { 14414 let contentRef = useRef(null), wrapperRef = useRef(null), [hidden, setHidden] = useState(null), contentWidth = useRef(contentRef.current?.offsetWidth ?? 0), wrapperWidth = useRef(wrapperRef.current?.offsetWidth ?? 0); 14415 return useEffect(() => { 14416 if (contentRef.current && wrapperRef.current) { 14417 let resizeObserver = new ResizeObserver(() => { 14418 wrapperWidth.current = wrapperRef.current?.offsetWidth || wrapperWidth.current, contentWidth.current = contentRef.current?.offsetWidth || contentWidth.current, setHidden(contentWidth.current > wrapperWidth.current); 14419 }); 14420 return resizeObserver.observe(wrapperRef.current), () => resizeObserver.disconnect(); 14421 } 14422 }, []), react_default.createElement(Wrapper3, { ref: wrapperRef }, react_default.createElement(Content2, { isHidden: hidden, ref: contentRef }, content), fallback && react_default.createElement(Content2, { isHidden: !hidden }, fallback)); 14423}; 14424 14425// src/manager/components/Particles/Particles.tsx 14426init_react(); 14427var Shape = styled.svg(({ color: color2 }) => ({ 14428 fill: color2, 14429 position: "absolute", 14430 inset: "0", 14431 margin: "auto", 14432 width: "12px", 14433 height: "12px", 14434 pointerEvents: "none" 14435})), Donut = (props) => react_default.createElement(Shape, { viewBox: "0 0 90 90", xmlns: "http://www.w3.org/2000/svg", color: "red", ...props }, react_default.createElement("path", { d: "M45 0c24.853 0 45 20.147 45 45S69.853 90 45 90 0 69.853 0 45 20.147 0 45 0zm.5 27C35.283 27 27 35.283 27 45.5S35.283 64 45.5 64 64 55.717 64 45.5 55.717 27 45.5 27z" })), L2 = (props) => react_default.createElement(Shape, { viewBox: "0 0 55 89", xmlns: "http://www.w3.org/2000/svg", color: "#66BF3C", ...props }, react_default.createElement("path", { d: "M55 3v83a3 3 0 01-3 3H3a3 3 0 01-3-3V64a3 3 0 013-3h21a3 3 0 003-3V3a3 3 0 013-3h22a3 3 0 013 3z" })), Slice = (props) => react_default.createElement(Shape, { viewBox: "0 0 92 92", xmlns: "http://www.w3.org/2000/svg", color: "#FF4785", ...props }, react_default.createElement("path", { d: "M92 89V3c0-3-2.056-3-3-3C39.294 0 0 39.294 0 89c0 0 0 3 3 3h86a3 3 0 003-3z" })), Square = ({ style, ...props }) => react_default.createElement( 14436 Shape, 14437 { 14438 viewBox: "0 0 90 90", 14439 xmlns: "http://www.w3.org/2000/svg", 14440 color: "#1EA7FD", 14441 ...props, 14442 style: { borderRadius: 5, ...style } 14443 }, 14444 react_default.createElement("path", { d: "M0 0h90v90H0z" }) 14445), Triangle = (props) => react_default.createElement(Shape, { viewBox: "0 0 96 88", xmlns: "http://www.w3.org/2000/svg", color: "#FFAE00", ...props }, react_default.createElement("path", { d: "M50.63 1.785l44.928 81.77A3 3 0 0192.928 88H3.072a3 3 0 01-2.629-4.445l44.929-81.77a3 3 0 015.258 0z" })), T2 = (props) => react_default.createElement(Shape, { viewBox: "0 0 92 62", xmlns: "http://www.w3.org/2000/svg", color: "#FC521F", ...props }, react_default.createElement("path", { d: "M63 3v25a3 3 0 003 3h23a3 3 0 013 3v25a3 3 0 01-3 3H3a3 3 0 01-3-3V34a3 3 0 013-3h24a3 3 0 003-3V3a3 3 0 013-3h27a3 3 0 013 3z" })), Z = (props) => react_default.createElement(Shape, { viewBox: "0 0 56 90", xmlns: "http://www.w3.org/2000/svg", color: "#6F2CAC", ...props }, react_default.createElement("path", { d: "M28 3v25a3 3 0 003 3h22a3 3 0 013 3v53a3 3 0 01-3 3H31a3 3 0 01-3-3V62a3 3 0 00-3-3H3a3 3 0 01-3-3V3a3 3 0 013-3h22a3 3 0 013 3z" })), fadeToTransparent = keyframes` 14446 to { 14447 opacity: 0; 14448 } 14449`, disperse = keyframes` 14450 to { 14451 transform: translate( 14452 calc(cos(var(--angle)) * var(--distance)), 14453 calc(sin(var(--angle)) * var(--distance)) 14454 ) rotate(var(--rotation)); 14455 } 14456`, slideDown = keyframes` 14457 to { 14458 transform: translateY(50px); 14459 } 14460`, Container8 = styled.div({ 14461 position: "absolute", 14462 display: "flex", 14463 flexDirection: "row", 14464 flexWrap: "wrap", 14465 gap: 10, 14466 "--particle-curve": "cubic-bezier(0.2, 0.56, 0, 1)", 14467 animation: `${slideDown} 1000ms forwards cubic-bezier(0.587, -0.381, 0.583, 0.599)`, 14468 animationDelay: "150ms", 14469 zIndex: 999, 14470 svg: { 14471 width: 15, 14472 height: 15, 14473 animation: `${fadeToTransparent} var(--fade-duration) forwards, ${disperse} 1000ms forwards var(--particle-curve)` 14474 } 14475}), FADE_DURATION = 1200, NUM_OF_PARTICLES = 8, JITTER = 15, random = (min, max) => Math.random() * (max - min) + min, sortRandomly = (array) => array.sort(() => Math.random() - 0.5), Particles = memo(function({ 14476 anchor: Anchor 14477}) { 14478 let anchorRef = useRef(null), [left, setLeft] = useState(0), [top, setTop] = useState(0), shapes = sortRandomly([Donut, L2, Slice, Square, Triangle, T2, Z]), colors = sortRandomly([ 14479 "#FF0000", 14480 "#FF4787", 14481 "#66BF3C", 14482 "#1EA7FD", 14483 "#FC521F", 14484 "#6F2CAC", 14485 "#FFAE00" 14486 ]); 14487 return useLayoutEffect(() => { 14488 let rect = anchorRef.current?.getBoundingClientRect(); 14489 rect && (setLeft(rect.left + rect.width / 2), setTop(rect.top + rect.height / 2)); 14490 }, []), react_default.createElement("div", { ref: anchorRef }, react_default.createElement(Anchor, null), createPortal( 14491 react_default.createElement(Container8, { style: { top: top + "px", left: left + "px" } }, shapes.map((Particle, index) => { 14492 let angle = 360 / NUM_OF_PARTICLES * index + random(-JITTER, JITTER), distance = random(50, 80), rotation = random(-360, 360), style = { 14493 "--angle": angle + "deg", 14494 "--distance": distance + "px", 14495 "--rotation": rotation + "deg", 14496 "--fade-duration": FADE_DURATION + "ms" 14497 }; 14498 return react_default.createElement(Particle, { key: Particle.name, style, color: colors[index] }); 14499 })), 14500 document.getElementById("root") ?? document.body 14501 )); 14502}); 14503 14504// src/manager/components/TextFlip.tsx 14505init_react(); 14506var slideIn2 = keyframes({ 14507 from: { 14508 transform: "translateY(var(--slide-in-from))", 14509 opacity: 0 14510 } 14511}), slideOut = keyframes({ 14512 to: { 14513 transform: "translateY(var(--slide-out-to))", 14514 opacity: 0 14515 } 14516}), Container9 = styled.div({ 14517 display: "inline-grid", 14518 gridTemplateColumns: "1fr", 14519 justifyContent: "center", 14520 alignItems: "center" 14521}), Placeholder2 = styled.div({ 14522 gridArea: "1 / 1", 14523 userSelect: "none", 14524 visibility: "hidden" 14525}), Text2 = styled.span(({ duration, isExiting, isEntering, reverse }) => { 14526 let animation; 14527 return isExiting ? animation = `${slideOut} ${duration}ms forwards` : isEntering && (animation = `${slideIn2} ${duration}ms forwards`), { 14528 gridArea: "1 / 1", 14529 animation, 14530 pointerEvents: isExiting ? "none" : "auto", 14531 userSelect: isExiting ? "none" : "text", 14532 "--slide-in-from": reverse ? "-100%" : "100%", 14533 "--slide-out-to": reverse ? "100%" : "-100%", 14534 "@media (prefers-reduced-motion: reduce)": { 14535 animation: "none", 14536 opacity: isExiting ? 0 : 1, 14537 transform: "translateY(0)" 14538 } 14539 }; 14540}), TextFlip = ({ 14541 text, 14542 duration = 250, 14543 placeholder, 14544 ...props 14545}) => { 14546 let textRef = useRef(text), [staleValue, setStaleValue] = useState(text), isAnimating = text !== staleValue, reverse = isAnimating && numericCompare(staleValue, text); 14547 return textRef.current = text, react_default.createElement(Container9, { ...props }, isAnimating && react_default.createElement( 14548 Text2, 14549 { 14550 "aria-hidden": !0, 14551 duration, 14552 reverse, 14553 isExiting: !0, 14554 onAnimationEnd: () => setStaleValue(textRef.current) 14555 }, 14556 staleValue 14557 ), react_default.createElement(Text2, { duration, reverse, isEntering: isAnimating }, text), placeholder && react_default.createElement(Placeholder2, { "aria-hidden": !0 }, placeholder)); 14558}; 14559function numericCompare(a2, b2) { 14560 let na = Number(a2), nb = Number(b2); 14561 return Number.isNaN(na) || Number.isNaN(nb) ? a2.localeCompare(b2, void 0, { numeric: !0 }) > 0 : na > nb; 14562} 14563 14564// src/manager/components/sidebar/useChecklist.ts 14565init_react(); 14566 14567// ../../node_modules/es-toolkit/dist/function/debounce.mjs 14568function debounce(func, debounceMs, { signal, edges } = {}) { 14569 let pendingThis, pendingArgs = null, leading = edges != null && edges.includes("leading"), trailing = edges == null || edges.includes("trailing"), invoke = () => { 14570 pendingArgs !== null && (func.apply(pendingThis, pendingArgs), pendingThis = void 0, pendingArgs = null); 14571 }, onTimerEnd = () => { 14572 trailing && invoke(), cancel(); 14573 }, timeoutId = null, schedule = () => { 14574 timeoutId != null && clearTimeout(timeoutId), timeoutId = setTimeout(() => { 14575 timeoutId = null, onTimerEnd(); 14576 }, debounceMs); 14577 }, cancelTimer = () => { 14578 timeoutId !== null && (clearTimeout(timeoutId), timeoutId = null); 14579 }, cancel = () => { 14580 cancelTimer(), pendingThis = void 0, pendingArgs = null; 14581 }, flush = () => { 14582 invoke(); 14583 }, debounced = function(...args) { 14584 if (signal?.aborted) 14585 return; 14586 pendingThis = this, pendingArgs = args; 14587 let isFirstCall = timeoutId == null; 14588 schedule(), leading && isFirstCall && invoke(); 14589 }; 14590 return debounced.schedule = schedule, debounced.cancel = cancel, debounced.flush = flush, signal?.addEventListener("abort", cancel, { once: !0 }), debounced; 14591} 14592 14593// ../../node_modules/es-toolkit/dist/function/partial.mjs 14594function partial(func, ...partialArgs) { 14595 return partialImpl(func, placeholderSymbol, ...partialArgs); 14596} 14597function partialImpl(func, placeholder, ...partialArgs) { 14598 let partialed = function(...providedArgs) { 14599 let providedArgsIndex = 0, substitutedArgs = partialArgs.slice().map((arg) => arg === placeholder ? providedArgs[providedArgsIndex++] : arg), remainingArgs = providedArgs.slice(providedArgsIndex); 14600 return func.apply(this, substitutedArgs.concat(remainingArgs)); 14601 }; 14602 return func.prototype && (partialed.prototype = Object.create(func.prototype)), partialed; 14603} 14604var placeholderSymbol = /* @__PURE__ */ Symbol("partial.placeholder"); 14605partial.placeholder = placeholderSymbol; 14606 14607// ../../node_modules/es-toolkit/dist/function/partialRight.mjs 14608function partialRight(func, ...partialArgs) { 14609 return partialRightImpl(func, placeholderSymbol2, ...partialArgs); 14610} 14611function partialRightImpl(func, placeholder, ...partialArgs) { 14612 let partialedRight = function(...providedArgs) { 14613 let placeholderLength = partialArgs.filter((arg) => arg === placeholder).length, rangeLength = Math.max(providedArgs.length - placeholderLength, 0), remainingArgs = providedArgs.slice(0, rangeLength), providedArgsIndex = rangeLength, substitutedArgs = partialArgs.slice().map((arg) => arg === placeholder ? providedArgs[providedArgsIndex++] : arg); 14614 return func.apply(this, remainingArgs.concat(substitutedArgs)); 14615 }; 14616 return func.prototype && (partialedRight.prototype = Object.create(func.prototype)), partialedRight; 14617} 14618var placeholderSymbol2 = /* @__PURE__ */ Symbol("partialRight.placeholder"); 14619partialRight.placeholder = placeholderSymbol2; 14620 14621// ../../node_modules/es-toolkit/dist/function/retry.mjs 14622var DEFAULT_RETRIES = Number.POSITIVE_INFINITY; 14623 14624// ../../node_modules/es-toolkit/dist/function/throttle.mjs 14625function throttle(func, throttleMs, { signal, edges = ["leading", "trailing"] } = {}) { 14626 let pendingAt = null, debounced = debounce(function(...args) { 14627 pendingAt = Date.now(), func.apply(this, args); 14628 }, throttleMs, { signal, edges }), throttled = function(...args) { 14629 if (pendingAt == null && (pendingAt = Date.now()), Date.now() - pendingAt >= throttleMs) { 14630 pendingAt = Date.now(), func.apply(this, args), debounced.cancel(), debounced.schedule(); 14631 return; 14632 } 14633 debounced.apply(this, args); 14634 }; 14635 return throttled.cancel = debounced.cancel, throttled.flush = debounced.flush, throttled; 14636} 14637 14638// src/shared/checklist-store/checklistData.tsx 14639init_react(); 14640 14641// ../addons/a11y/src/constants.ts 14642var ADDON_ID2 = "storybook/a11y", PANEL_ID2 = `${ADDON_ID2}/panel`; 14643var UI_STATE_ID = `${ADDON_ID2}/ui`, RESULT = `${ADDON_ID2}/result`, REQUEST = `${ADDON_ID2}/request`, RUNNING = `${ADDON_ID2}/running`, ERROR = `${ADDON_ID2}/error`, MANUAL = `${ADDON_ID2}/manual`, SELECT = `${ADDON_ID2}/select`, DOCUMENTATION_LINK = "writing-tests/accessibility-testing", DOCUMENTATION_DISCREPANCY_LINK = `${DOCUMENTATION_LINK}#why-are-my-tests-failing-in-different-environments`; 14644 14645// ../addons/onboarding/src/constants.ts 14646var ADDON_ID3 = "storybook/onboarding", ADDON_ONBOARDING_CHANNEL = `${ADDON_ID3}/channel`; 14647 14648// src/component-testing/constants.ts 14649var ADDON_ID4 = "storybook/interactions", PANEL_ID3 = `${ADDON_ID4}/panel`; 14650var DOCUMENTATION_LINK2 = "writing-tests/integrations/vitest-addon", DOCUMENTATION_DISCREPANCY_LINK2 = `${DOCUMENTATION_LINK2}#what-happens-when-there-are-different-test-results-in-multiple-environments`; 14651 14652// ../addons/vitest/src/constants.ts 14653var ADDON_ID5 = "storybook/test", TEST_PROVIDER_ID = `${ADDON_ID5}/test-provider`, STORYBOOK_ADDON_TEST_CHANNEL = `${ADDON_ID5}/channel`; 14654var DOCUMENTATION_LINK3 = "writing-tests/integrations/vitest-addon", DOCUMENTATION_FATAL_ERROR_LINK = `${DOCUMENTATION_LINK3}#what-happens-if-vitest-itself-has-an-error`; 14655var storeOptions = { 14656 id: ADDON_ID5, 14657 initialState: { 14658 config: { 14659 coverage: !1, 14660 a11y: !1 14661 }, 14662 watching: !1, 14663 cancelling: !1, 14664 fatalError: void 0, 14665 index: { entries: {}, v: 5 }, 14666 previewAnnotations: [], 14667 currentRun: { 14668 triggeredBy: void 0, 14669 config: { 14670 coverage: !1, 14671 a11y: !1 14672 }, 14673 componentTestStatuses: [], 14674 a11yStatuses: [], 14675 a11yReports: {}, 14676 reports: {}, 14677 componentTestCount: { 14678 success: 0, 14679 error: 0 14680 }, 14681 a11yCount: { 14682 success: 0, 14683 warning: 0, 14684 error: 0 14685 }, 14686 storyIds: void 0, 14687 totalTestCount: void 0, 14688 startedAt: void 0, 14689 finishedAt: void 0, 14690 unhandledErrors: [], 14691 coverageSummary: void 0 14692 } 14693 } 14694}; 14695var STORE_CHANNEL_EVENT_NAME = `UNIVERSAL_STORE:${storeOptions.id}`; 14696var TRIGGER_TEST_RUN_REQUEST = `${ADDON_ID5}/trigger-test-run-request`, TRIGGER_TEST_RUN_RESPONSE = `${ADDON_ID5}/trigger-test-run-response`; 14697 14698// src/server-errors.ts 14699var import_picocolors = __toESM(require_picocolors_browser(), 1); 14700 14701// src/shared/status-store/index.ts 14702var STATUS_VALUE_PREFIX = "status-value:"; 14703var statusValueShortName = (value) => value === "status-value:affected" ? "related" : value.slice(STATUS_VALUE_PREFIX.length), statusValueDescription = (value) => ({ 14704 "status-value:pending": "Stories with pending status", 14705 "status-value:success": "Stories with passing tests", 14706 "status-value:new": "Newly added stories", 14707 "status-value:modified": "Stories closely linked to code changes", 14708 "status-value:affected": "Stories likely to be affected by code changes", 14709 "status-value:reviewing": "Stories included in the active review", 14710 "status-value:warning": "Stories with warnings", 14711 "status-value:error": "Stories with failing tests", 14712 "status-value:unknown": "Stories with unknown status" 14713})[value]; 14714function countStatusesByValue(allStatuses) { 14715 let counts = {}; 14716 for (let statusByTypeId of Object.values(allStatuses)) 14717 for (let status of Object.values(statusByTypeId)) 14718 counts[status.value] = (counts[status.value] ?? 0) + 1; 14719 return counts; 14720} 14721 14722// src/cli/AddonVitestService.constants.ts 14723var SUPPORTED_FRAMEWORKS = [ 14724 "angular-vite" /* ANGULAR_VITE */, 14725 "html-vite" /* HTML_VITE */, 14726 "nextjs-vite" /* NEXTJS_VITE */, 14727 "preact-vite" /* PREACT_VITE */, 14728 "react-native-web-vite" /* REACT_NATIVE_WEB_VITE */, 14729 "react-vite" /* REACT_VITE */, 14730 "solid" /* SOLID */, 14731 "svelte-vite" /* SVELTE_VITE */, 14732 "sveltekit" /* SVELTEKIT */, 14733 "vue3-vite" /* VUE3_VITE */, 14734 "web-components-vite" /* WEB_COMPONENTS_VITE */, 14735 "tanstack-react" /* TANSTACK_REACT */ 14736]; 14737 14738// src/docs-tools/shared.ts 14739var ADDON_ID6 = "storybook/docs", PANEL_ID4 = `${ADDON_ID6}/panel`; 14740var SNIPPET_RENDERED = `${ADDON_ID6}/snippet-rendered`; 14741 14742// src/manager/components/TourGuide/TourGuide.tsx 14743init_react(); 14744 14745// ../../node_modules/react-joyride/dist/index.mjs 14746init_react(); 14747 14748// ../../node_modules/@gilbarbara/deep-equal/dist/index.mjs 14749function isOfType(type) { 14750 return (value) => typeof value === type; 14751} 14752var isFunction2 = isOfType("function"), isNull2 = (value) => value === null, isRegex = (value) => Object.prototype.toString.call(value).slice(8, -1) === "RegExp", isObject = (value) => !isUndefined2(value) && !isNull2(value) && (isFunction2(value) || typeof value == "object"), isUndefined2 = isOfType("undefined"); 14753function equalArray(left, right) { 14754 let { length } = left; 14755 if (length !== right.length) 14756 return !1; 14757 for (let index = length; index-- !== 0; ) 14758 if (!equal(left[index], right[index])) 14759 return !1; 14760 return !0; 14761} 14762function equalArrayBuffer(left, right) { 14763 if (left.byteLength !== right.byteLength) 14764 return !1; 14765 let view1 = new DataView(left.buffer), view2 = new DataView(right.buffer), index = left.byteLength; 14766 for (; index--; ) 14767 if (view1.getUint8(index) !== view2.getUint8(index)) 14768 return !1; 14769 return !0; 14770} 14771function equalMap(left, right) { 14772 if (left.size !== right.size) 14773 return !1; 14774 for (let index of left.entries()) 14775 if (!right.has(index[0])) 14776 return !1; 14777 for (let index of left.entries()) 14778 if (!equal(index[1], right.get(index[0]))) 14779 return !1; 14780 return !0; 14781} 14782function equalSet(left, right) { 14783 if (left.size !== right.size) 14784 return !1; 14785 for (let index of left.entries()) 14786 if (!right.has(index[0])) 14787 return !1; 14788 return !0; 14789} 14790function equal(left, right) { 14791 if (left === right) 14792 return !0; 14793 if (left && isObject(left) && right && isObject(right)) { 14794 if (left.constructor !== right.constructor) 14795 return !1; 14796 if (Array.isArray(left) && Array.isArray(right)) 14797 return equalArray(left, right); 14798 if (left instanceof Map && right instanceof Map) 14799 return equalMap(left, right); 14800 if (left instanceof Set && right instanceof Set) 14801 return equalSet(left, right); 14802 if (ArrayBuffer.isView(left) && ArrayBuffer.isView(right)) 14803 return equalArrayBuffer(left, right); 14804 if (isRegex(left) && isRegex(right)) 14805 return left.source === right.source && left.flags === right.flags; 14806 if (left.valueOf !== Object.prototype.valueOf) 14807 return left.valueOf() === right.valueOf(); 14808 if (left.toString !== Object.prototype.toString) 14809 return left.toString() === right.toString(); 14810 let leftKeys = Object.keys(left), rightKeys = Object.keys(right); 14811 if (leftKeys.length !== rightKeys.length) 14812 return !1; 14813 for (let index = leftKeys.length; index-- !== 0; ) 14814 if (!Object.prototype.hasOwnProperty.call(right, leftKeys[index])) 14815 return !1; 14816 for (let index = leftKeys.length; index-- !== 0; ) { 14817 let key = leftKeys[index]; 14818 if (!(key === "_owner" && left.$$typeof) && !equal(left[key], right[key])) 14819 return !1; 14820 } 14821 return !0; 14822 } 14823 return Number.isNaN(left) && Number.isNaN(right) ? !0 : left === right; 14824} 14825 14826// ../../node_modules/is-lite/dist/index.mjs 14827var objectTypes = [ 14828 "Array", 14829 "ArrayBuffer", 14830 "AsyncFunction", 14831 "AsyncGenerator", 14832 "AsyncGeneratorFunction", 14833 "Date", 14834 "Error", 14835 "Function", 14836 "Generator", 14837 "GeneratorFunction", 14838 "HTMLElement", 14839 "Map", 14840 "Object", 14841 "Promise", 14842 "RegExp", 14843 "Set", 14844 "WeakMap", 14845 "WeakSet" 14846], primitiveTypes = [ 14847 "bigint", 14848 "boolean", 14849 "null", 14850 "number", 14851 "string", 14852 "symbol", 14853 "undefined" 14854]; 14855function getObjectType(value) { 14856 let objectTypeName = Object.prototype.toString.call(value).slice(8, -1); 14857 if (/HTML\w+Element/.test(objectTypeName)) 14858 return "HTMLElement"; 14859 if (isObjectType(objectTypeName)) 14860 return objectTypeName; 14861} 14862function isObjectOfType(type) { 14863 return (value) => getObjectType(value) === type; 14864} 14865function isObjectType(name) { 14866 return objectTypes.includes(name); 14867} 14868function isOfType2(type) { 14869 return (value) => typeof value === type; 14870} 14871function isPrimitiveType(name) { 14872 return primitiveTypes.includes(name); 14873} 14874var DOM_PROPERTIES_TO_CHECK = [ 14875 "innerHTML", 14876 "ownerDocument", 14877 "style", 14878 "attributes", 14879 "nodeValue" 14880]; 14881function is(value) { 14882 if (value === null) 14883 return "null"; 14884 switch (typeof value) { 14885 case "bigint": 14886 return "bigint"; 14887 case "boolean": 14888 return "boolean"; 14889 case "number": 14890 return "number"; 14891 case "string": 14892 return "string"; 14893 case "symbol": 14894 return "symbol"; 14895 case "undefined": 14896 return "undefined"; 14897 default: 14898 } 14899 if (is.array(value)) 14900 return "Array"; 14901 if (is.plainFunction(value)) 14902 return "Function"; 14903 let tagType = getObjectType(value); 14904 return tagType || "Object"; 14905} 14906is.array = Array.isArray; 14907is.arrayOf = (target, predicate) => !is.array(target) && !is.function(predicate) ? !1 : target.every((d2) => predicate(d2)); 14908is.asyncGeneratorFunction = (value) => getObjectType(value) === "AsyncGeneratorFunction"; 14909is.asyncFunction = isObjectOfType("AsyncFunction"); 14910is.bigint = isOfType2("bigint"); 14911is.boolean = (value) => value === !0 || value === !1; 14912is.date = isObjectOfType("Date"); 14913is.defined = (value) => !is.undefined(value); 14914is.domElement = (value) => is.object(value) && !is.plainObject(value) && value.nodeType === 1 && is.string(value.nodeName) && DOM_PROPERTIES_TO_CHECK.every((property) => property in value); 14915is.empty = (value) => is.string(value) && value.length === 0 || is.array(value) && value.length === 0 || is.object(value) && !is.map(value) && !is.set(value) && Object.keys(value).length === 0 || is.set(value) && value.size === 0 || is.map(value) && value.size === 0; 14916is.error = isObjectOfType("Error"); 14917is.function = isOfType2("function"); 14918is.generator = (value) => is.iterable(value) && is.function(value.next) && is.function(value.throw); 14919is.generatorFunction = isObjectOfType("GeneratorFunction"); 14920is.instanceOf = (instance, class_) => !instance || !class_ ? !1 : Object.getPrototypeOf(instance) === class_.prototype; 14921is.iterable = (value) => !is.nullOrUndefined(value) && is.function(value[Symbol.iterator]); 14922is.map = isObjectOfType("Map"); 14923is.nan = (value) => Number.isNaN(value); 14924is.null = (value) => value === null; 14925is.nullOrUndefined = (value) => is.null(value) || is.undefined(value); 14926is.number = (value) => isOfType2("number")(value) && !is.nan(value); 14927is.numericString = (value) => is.string(value) && value.length > 0 && !Number.isNaN(Number(value)); 14928is.object = (value) => !is.nullOrUndefined(value) && (is.function(value) || typeof value == "object"); 14929is.oneOf = (target, value) => is.array(target) ? target.indexOf(value) > -1 : !1; 14930is.plainFunction = isObjectOfType("Function"); 14931is.plainObject = (value) => { 14932 if (getObjectType(value) !== "Object") 14933 return !1; 14934 let prototype = Object.getPrototypeOf(value); 14935 return prototype === null || prototype === Object.getPrototypeOf({}); 14936}; 14937is.primitive = (value) => is.null(value) || isPrimitiveType(typeof value); 14938is.promise = isObjectOfType("Promise"); 14939is.propertyOf = (target, key, predicate) => { 14940 if (!is.object(target) || !key) 14941 return !1; 14942 let value = target[key]; 14943 return is.function(predicate) ? predicate(value) : is.defined(value); 14944}; 14945is.regexp = isObjectOfType("RegExp"); 14946is.set = isObjectOfType("Set"); 14947is.string = isOfType2("string"); 14948is.symbol = isOfType2("symbol"); 14949is.undefined = isOfType2("undefined"); 14950is.weakMap = isObjectOfType("WeakMap"); 14951is.weakSet = isObjectOfType("WeakSet"); 14952var src_default = is; 14953 14954// ../../node_modules/react-joyride/node_modules/tree-changes/dist/index.mjs 14955function canHaveLength(...arguments_) { 14956 return arguments_.every((d2) => src_default.string(d2) || src_default.array(d2) || src_default.plainObject(d2)); 14957} 14958function checkEquality(left, right, value) { 14959 return isSameType(left, right) ? [left, right].every(src_default.array) ? !left.some(hasValue(value)) && right.some(hasValue(value)) : [left, right].every(src_default.plainObject) ? !Object.entries(left).some(hasEntry(value)) && Object.entries(right).some(hasEntry(value)) : right === value : !1; 14960} 14961function compareNumbers(previousData, data, options2) { 14962 let { actual, key, previous, type } = options2, left = nested(previousData, key), right = nested(data, key), changed = [left, right].every(src_default.number) && (type === "increased" ? left < right : left > right); 14963 return src_default.undefined(actual) || (changed = changed && right === actual), src_default.undefined(previous) || (changed = changed && left === previous), changed; 14964} 14965function compareValues(previousData, data, options2) { 14966 let { key, type, value } = options2, left = nested(previousData, key), right = nested(data, key), primary = type === "added" ? left : right, secondary = type === "added" ? right : left; 14967 if (!src_default.nullOrUndefined(value)) { 14968 if (src_default.defined(primary)) { 14969 if (src_default.array(primary) || src_default.plainObject(primary)) 14970 return checkEquality(primary, secondary, value); 14971 } else 14972 return equal(secondary, value); 14973 return !1; 14974 } 14975 return [left, right].every(src_default.array) ? !secondary.every(isEqualPredicate(primary)) : [left, right].every(src_default.plainObject) ? hasExtraKeys(Object.keys(primary), Object.keys(secondary)) : ![left, right].every((d2) => src_default.primitive(d2) && src_default.defined(d2)) && (type === "added" ? !src_default.defined(left) && src_default.defined(right) : src_default.defined(left) && !src_default.defined(right)); 14976} 14977function getIterables(previousData, data, { key } = {}) { 14978 let left = nested(previousData, key), right = nested(data, key); 14979 if (!isSameType(left, right)) 14980 throw new TypeError("Inputs have different types"); 14981 if (!canHaveLength(left, right)) 14982 throw new TypeError("Inputs don't have length"); 14983 return [left, right].every(src_default.plainObject) && (left = Object.keys(left), right = Object.keys(right)), [left, right]; 14984} 14985function hasEntry(input) { 14986 return ([key, value]) => src_default.array(input) ? equal(input, value) || input.some((d2) => equal(d2, value) || src_default.array(value) && isEqualPredicate(value)(d2)) : src_default.plainObject(input) && input[key] ? !!input[key] && equal(input[key], value) : equal(input, value); 14987} 14988function hasExtraKeys(left, right) { 14989 return right.some((d2) => !left.includes(d2)); 14990} 14991function hasValue(input) { 14992 return (value) => src_default.array(input) ? input.some((d2) => equal(d2, value) || src_default.array(value) && isEqualPredicate(value)(d2)) : equal(input, value); 14993} 14994function includesOrEqualsTo(previousValue, value) { 14995 return src_default.array(previousValue) ? previousValue.some((d2) => equal(d2, value)) : equal(previousValue, value); 14996} 14997function isEqualPredicate(data) { 14998 return (value) => data.some((d2) => equal(d2, value)); 14999} 15000function isSameType(...arguments_) { 15001 return arguments_.every(src_default.array) || arguments_.every(src_default.number) || arguments_.every(src_default.plainObject) || arguments_.every(src_default.string); 15002} 15003function nested(data, property) { 15004 return src_default.plainObject(data) || src_default.array(data) ? src_default.string(property) ? property.split(".").reduce((acc, d2) => acc && acc[d2], data) : src_default.number(property) ? data[property] : data : data; 15005} 15006function treeChanges(previousData, data) { 15007 if ([previousData, data].some(src_default.nullOrUndefined)) 15008 throw new Error("Missing required parameters"); 15009 if (![previousData, data].every((d2) => src_default.plainObject(d2) || src_default.array(d2))) 15010 throw new Error("Expected plain objects or array"); 15011 return { added: (key, value) => { 15012 try { 15013 return compareValues(previousData, data, { key, type: "added", value }); 15014 } catch { 15015 return !1; 15016 } 15017 }, changed: (key, actual, previous) => { 15018 try { 15019 let left = nested(previousData, key), right = nested(data, key), hasActual = src_default.defined(actual), hasPrevious = src_default.defined(previous); 15020 if (hasActual || hasPrevious) { 15021 let leftComparator = hasPrevious ? includesOrEqualsTo(previous, left) : !includesOrEqualsTo(actual, left), rightComparator = includesOrEqualsTo(actual, right); 15022 return leftComparator && rightComparator; 15023 } 15024 return [left, right].every(src_default.array) || [left, right].every(src_default.plainObject) ? !equal(left, right) : left !== right; 15025 } catch { 15026 return !1; 15027 } 15028 }, changedFrom: (key, previous, actual) => { 15029 if (!src_default.defined(key)) 15030 return !1; 15031 try { 15032 let left = nested(previousData, key), right = nested(data, key), hasActual = src_default.defined(actual); 15033 return includesOrEqualsTo(previous, left) && (hasActual ? includesOrEqualsTo(actual, right) : !hasActual); 15034 } catch { 15035 return !1; 15036 } 15037 }, decreased: (key, actual, previous) => { 15038 if (!src_default.defined(key)) 15039 return !1; 15040 try { 15041 return compareNumbers(previousData, data, { key, actual, previous, type: "decreased" }); 15042 } catch { 15043 return !1; 15044 } 15045 }, emptied: (key) => { 15046 try { 15047 let [left, right] = getIterables(previousData, data, { key }); 15048 return !!left.length && !right.length; 15049 } catch { 15050 return !1; 15051 } 15052 }, filled: (key) => { 15053 try { 15054 let [left, right] = getIterables(previousData, data, { key }); 15055 return !left.length && !!right.length; 15056 } catch { 15057 return !1; 15058 } 15059 }, increased: (key, actual, previous) => { 15060 if (!src_default.defined(key)) 15061 return !1; 15062 try { 15063 return compareNumbers(previousData, data, { key, actual, previous, type: "increased" }); 15064 } catch { 15065 return !1; 15066 } 15067 }, removed: (key, value) => { 15068 try { 15069 return compareValues(previousData, data, { key, type: "removed", value }); 15070 } catch { 15071 return !1; 15072 } 15073 } }; 15074} 15075 15076// ../../node_modules/react-joyride/dist/index.mjs 15077var import_scroll = __toESM(require_scroll(), 1), import_scrollparent = __toESM(require_scrollparent(), 1); 15078init_react(); 15079var import_react_innertext = __toESM(require_react_innertext(), 1); 15080var import_deepmerge2 = __toESM(require_cjs(), 1); 15081var import_deepmerge3 = __toESM(require_cjs(), 1); 15082init_react(); 15083init_react(); 15084init_react(); 15085init_react(); 15086 15087// ../../node_modules/react-floater/es/index.js 15088init_react(); 15089var import_prop_types2 = __toESM(require_prop_types()); 15090 15091// ../../node_modules/popper.js/dist/esm/popper.js 15092var isBrowser2 = typeof window < "u" && typeof document < "u" && typeof navigator < "u", timeoutDuration = (function() { 15093 for (var longerTimeoutBrowsers = ["Edge", "Trident", "Firefox"], i2 = 0; i2 < longerTimeoutBrowsers.length; i2 += 1) 15094 if (isBrowser2 && navigator.userAgent.indexOf(longerTimeoutBrowsers[i2]) >= 0) 15095 return 1; 15096 return 0; 15097})(); 15098function microtaskDebounce(fn) { 15099 var called = !1; 15100 return function() { 15101 called || (called = !0, window.Promise.resolve().then(function() { 15102 called = !1, fn(); 15103 })); 15104 }; 15105} 15106function taskDebounce(fn) { 15107 var scheduled = !1; 15108 return function() { 15109 scheduled || (scheduled = !0, setTimeout(function() { 15110 scheduled = !1, fn(); 15111 }, timeoutDuration)); 15112 }; 15113} 15114var supportsMicroTasks = isBrowser2 && window.Promise, debounce2 = supportsMicroTasks ? microtaskDebounce : taskDebounce; 15115function isFunction3(functionToCheck) { 15116 var getType = {}; 15117 return functionToCheck && getType.toString.call(functionToCheck) === "[object Function]"; 15118} 15119function getStyleComputedProperty(element, property) { 15120 if (element.nodeType !== 1) 15121 return []; 15122 var window2 = element.ownerDocument.defaultView, css2 = window2.getComputedStyle(element, null); 15123 return property ? css2[property] : css2; 15124} 15125function getParentNode(element) { 15126 return element.nodeName === "HTML" ? element : element.parentNode || element.host; 15127} 15128function getScrollParent(element) { 15129 if (!element) 15130 return document.body; 15131 switch (element.nodeName) { 15132 case "HTML": 15133 case "BODY": 15134 return element.ownerDocument.body; 15135 case "#document": 15136 return element.body; 15137 } 15138 var _getStyleComputedProp = getStyleComputedProperty(element), overflow = _getStyleComputedProp.overflow, overflowX = _getStyleComputedProp.overflowX, overflowY = _getStyleComputedProp.overflowY; 15139 return /(auto|scroll|overlay)/.test(overflow + overflowY + overflowX) ? element : getScrollParent(getParentNode(element)); 15140} 15141function getReferenceNode(reference) { 15142 return reference && reference.referenceNode ? reference.referenceNode : reference; 15143} 15144var isIE11 = isBrowser2 && !!(window.MSInputMethodContext && document.documentMode), isIE10 = isBrowser2 && /MSIE 10/.test(navigator.userAgent); 15145function isIE(version3) { 15146 return version3 === 11 ? isIE11 : version3 === 10 ? isIE10 : isIE11 || isIE10; 15147} 15148function getOffsetParent(element) { 15149 if (!element) 15150 return document.documentElement; 15151 for (var noOffsetParent = isIE(10) ? document.body : null, offsetParent = element.offsetParent || null; offsetParent === noOffsetParent && element.nextElementSibling; ) 15152 offsetParent = (element = element.nextElementSibling).offsetParent; 15153 var nodeName = offsetParent && offsetParent.nodeName; 15154 return !nodeName || nodeName === "BODY" || nodeName === "HTML" ? element ? element.ownerDocument.documentElement : document.documentElement : ["TH", "TD", "TABLE"].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, "position") === "static" ? getOffsetParent(offsetParent) : offsetParent; 15155} 15156function isOffsetContainer(element) { 15157 var nodeName = element.nodeName; 15158 return nodeName === "BODY" ? !1 : nodeName === "HTML" || getOffsetParent(element.firstElementChild) === element; 15159} 15160function getRoot(node) { 15161 return node.parentNode !== null ? getRoot(node.parentNode) : node; 15162} 15163function findCommonOffsetParent(element1, element2) { 15164 if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) 15165 return document.documentElement; 15166 var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING, start = order ? element1 : element2, end = order ? element2 : element1, range = document.createRange(); 15167 range.setStart(start, 0), range.setEnd(end, 0); 15168 var commonAncestorContainer = range.commonAncestorContainer; 15169 if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) 15170 return isOffsetContainer(commonAncestorContainer) ? commonAncestorContainer : getOffsetParent(commonAncestorContainer); 15171 var element1root = getRoot(element1); 15172 return element1root.host ? findCommonOffsetParent(element1root.host, element2) : findCommonOffsetParent(element1, getRoot(element2).host); 15173} 15174function getScroll(element) { 15175 var side = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "top", upperSide = side === "top" ? "scrollTop" : "scrollLeft", nodeName = element.nodeName; 15176 if (nodeName === "BODY" || nodeName === "HTML") { 15177 var html = element.ownerDocument.documentElement, scrollingElement = element.ownerDocument.scrollingElement || html; 15178 return scrollingElement[upperSide]; 15179 } 15180 return element[upperSide]; 15181} 15182function includeScroll(rect, element) { 15183 var subtract = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1, scrollTop = getScroll(element, "top"), scrollLeft = getScroll(element, "left"), modifier = subtract ? -1 : 1; 15184 return rect.top += scrollTop * modifier, rect.bottom += scrollTop * modifier, rect.left += scrollLeft * modifier, rect.right += scrollLeft * modifier, rect; 15185} 15186function getBordersSize(styles2, axis) { 15187 var sideA = axis === "x" ? "Left" : "Top", sideB = sideA === "Left" ? "Right" : "Bottom"; 15188 return parseFloat(styles2["border" + sideA + "Width"]) + parseFloat(styles2["border" + sideB + "Width"]); 15189} 15190function getSize(axis, body, html, computedStyle) { 15191 return Math.max(body["offset" + axis], body["scroll" + axis], html["client" + axis], html["offset" + axis], html["scroll" + axis], isIE(10) ? parseInt(html["offset" + axis]) + parseInt(computedStyle["margin" + (axis === "Height" ? "Top" : "Left")]) + parseInt(computedStyle["margin" + (axis === "Height" ? "Bottom" : "Right")]) : 0); 15192} 15193function getWindowSizes(document11) { 15194 var body = document11.body, html = document11.documentElement, computedStyle = isIE(10) && getComputedStyle(html); 15195 return { 15196 height: getSize("Height", body, html, computedStyle), 15197 width: getSize("Width", body, html, computedStyle) 15198 }; 15199} 15200var classCallCheck = function(instance, Constructor) { 15201 if (!(instance instanceof Constructor)) 15202 throw new TypeError("Cannot call a class as a function"); 15203}, createClass = /* @__PURE__ */ (function() { 15204 function defineProperties(target, props) { 15205 for (var i2 = 0; i2 < props.length; i2++) { 15206 var descriptor = props[i2]; 15207 descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor); 15208 } 15209 } 15210 return function(Constructor, protoProps, staticProps) { 15211 return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor; 15212 }; 15213})(), defineProperty = function(obj, key, value) { 15214 return key in obj ? Object.defineProperty(obj, key, { 15215 value, 15216 enumerable: !0, 15217 configurable: !0, 15218 writable: !0 15219 }) : obj[key] = value, obj; 15220}, _extends2 = Object.assign || function(target) { 15221 for (var i2 = 1; i2 < arguments.length; i2++) { 15222 var source = arguments[i2]; 15223 for (var key in source) 15224 Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]); 15225 } 15226 return target; 15227}; 15228function getClientRect(offsets) { 15229 return _extends2({}, offsets, { 15230 right: offsets.left + offsets.width, 15231 bottom: offsets.top + offsets.height 15232 }); 15233} 15234function getBoundingClientRect(element) { 15235 var rect = {}; 15236 try { 15237 if (isIE(10)) { 15238 rect = element.getBoundingClientRect(); 15239 var scrollTop = getScroll(element, "top"), scrollLeft = getScroll(element, "left"); 15240 rect.top += scrollTop, rect.left += scrollLeft, rect.bottom += scrollTop, rect.right += scrollLeft; 15241 } else 15242 rect = element.getBoundingClientRect(); 15243 } catch { 15244 } 15245 var result = { 15246 left: rect.left, 15247 top: rect.top, 15248 width: rect.right - rect.left, 15249 height: rect.bottom - rect.top 15250 }, sizes = element.nodeName === "HTML" ? getWindowSizes(element.ownerDocument) : {}, width = sizes.width || element.clientWidth || result.width, height = sizes.height || element.clientHeight || result.height, horizScrollbar = element.offsetWidth - width, vertScrollbar = element.offsetHeight - height; 15251 if (horizScrollbar || vertScrollbar) { 15252 var styles2 = getStyleComputedProperty(element); 15253 horizScrollbar -= getBordersSize(styles2, "x"), vertScrollbar -= getBordersSize(styles2, "y"), result.width -= horizScrollbar, result.height -= vertScrollbar; 15254 } 15255 return getClientRect(result); 15256} 15257function getOffsetRectRelativeToArbitraryNode(children, parent) { 15258 var fixedPosition = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1, isIE102 = isIE(10), isHTML = parent.nodeName === "HTML", childrenRect = getBoundingClientRect(children), parentRect = getBoundingClientRect(parent), scrollParent2 = getScrollParent(children), styles2 = getStyleComputedProperty(parent), borderTopWidth = parseFloat(styles2.borderTopWidth), borderLeftWidth = parseFloat(styles2.borderLeftWidth); 15259 fixedPosition && isHTML && (parentRect.top = Math.max(parentRect.top, 0), parentRect.left = Math.max(parentRect.left, 0)); 15260 var offsets = getClientRect({ 15261 top: childrenRect.top - parentRect.top - borderTopWidth, 15262 left: childrenRect.left - parentRect.left - borderLeftWidth, 15263 width: childrenRect.width, 15264 height: childrenRect.height 15265 }); 15266 if (offsets.marginTop = 0, offsets.marginLeft = 0, !isIE102 && isHTML) { 15267 var marginTop = parseFloat(styles2.marginTop), marginLeft = parseFloat(styles2.marginLeft); 15268 offsets.top -= borderTopWidth - marginTop, offsets.bottom -= borderTopWidth - marginTop, offsets.left -= borderLeftWidth - marginLeft, offsets.right -= borderLeftWidth - marginLeft, offsets.marginTop = marginTop, offsets.marginLeft = marginLeft; 15269 } 15270 return (isIE102 && !fixedPosition ? parent.contains(scrollParent2) : parent === scrollParent2 && scrollParent2.nodeName !== "BODY") && (offsets = includeScroll(offsets, parent)), offsets; 15271} 15272function getViewportOffsetRectRelativeToArtbitraryNode(element) { 15273 var excludeScroll = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, html = element.ownerDocument.documentElement, relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html), width = Math.max(html.clientWidth, window.innerWidth || 0), height = Math.max(html.clientHeight, window.innerHeight || 0), scrollTop = excludeScroll ? 0 : getScroll(html), scrollLeft = excludeScroll ? 0 : getScroll(html, "left"), offset2 = { 15274 top: scrollTop - relativeOffset.top + relativeOffset.marginTop, 15275 left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft, 15276 width, 15277 height 15278 }; 15279 return getClientRect(offset2); 15280} 15281function isFixed(element) { 15282 var nodeName = element.nodeName; 15283 if (nodeName === "BODY" || nodeName === "HTML") 15284 return !1; 15285 if (getStyleComputedProperty(element, "position") === "fixed") 15286 return !0; 15287 var parentNode = getParentNode(element); 15288 return parentNode ? isFixed(parentNode) : !1; 15289} 15290function getFixedPositionOffsetParent(element) { 15291 if (!element || !element.parentElement || isIE()) 15292 return document.documentElement; 15293 for (var el = element.parentElement; el && getStyleComputedProperty(el, "transform") === "none"; ) 15294 el = el.parentElement; 15295 return el || document.documentElement; 15296} 15297function getBoundaries(popper, reference, padding, boundariesElement) { 15298 var fixedPosition = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !1, boundaries = { top: 0, left: 0 }, offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference)); 15299 if (boundariesElement === "viewport") 15300 boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition); 15301 else { 15302 var boundariesNode = void 0; 15303 boundariesElement === "scrollParent" ? (boundariesNode = getScrollParent(getParentNode(reference)), boundariesNode.nodeName === "BODY" && (boundariesNode = popper.ownerDocument.documentElement)) : boundariesElement === "window" ? boundariesNode = popper.ownerDocument.documentElement : boundariesNode = boundariesElement; 15304 var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition); 15305 if (boundariesNode.nodeName === "HTML" && !isFixed(offsetParent)) { 15306 var _getWindowSizes = getWindowSizes(popper.ownerDocument), height = _getWindowSizes.height, width = _getWindowSizes.width; 15307 boundaries.top += offsets.top - offsets.marginTop, boundaries.bottom = height + offsets.top, boundaries.left += offsets.left - offsets.marginLeft, boundaries.right = width + offsets.left; 15308 } else 15309 boundaries = offsets; 15310 } 15311 padding = padding || 0; 15312 var isPaddingNumber = typeof padding == "number"; 15313 return boundaries.left += isPaddingNumber ? padding : padding.left || 0, boundaries.top += isPaddingNumber ? padding : padding.top || 0, boundaries.right -= isPaddingNumber ? padding : padding.right || 0, boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0, boundaries; 15314} 15315function getArea(_ref) { 15316 var width = _ref.width, height = _ref.height; 15317 return width * height; 15318} 15319function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) { 15320 var padding = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : 0; 15321 if (placement.indexOf("auto") === -1) 15322 return placement; 15323 var boundaries = getBoundaries(popper, reference, padding, boundariesElement), rects = { 15324 top: { 15325 width: boundaries.width, 15326 height: refRect.top - boundaries.top 15327 }, 15328 right: { 15329 width: boundaries.right - refRect.right, 15330 height: boundaries.height 15331 }, 15332 bottom: { 15333 width: boundaries.width, 15334 height: boundaries.bottom - refRect.bottom 15335 }, 15336 left: { 15337 width: refRect.left - boundaries.left, 15338 height: boundaries.height 15339 } 15340 }, sortedAreas = Object.keys(rects).map(function(key) { 15341 return _extends2({ 15342 key 15343 }, rects[key], { 15344 area: getArea(rects[key]) 15345 }); 15346 }).sort(function(a2, b2) { 15347 return b2.area - a2.area; 15348 }), filteredAreas = sortedAreas.filter(function(_ref2) { 15349 var width = _ref2.width, height = _ref2.height; 15350 return width >= popper.clientWidth && height >= popper.clientHeight; 15351 }), computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key, variation = placement.split("-")[1]; 15352 return computedPlacement + (variation ? "-" + variation : ""); 15353} 15354function getReferenceOffsets(state, popper, reference) { 15355 var fixedPosition = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null, commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference)); 15356 return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition); 15357} 15358function getOuterSizes(element) { 15359 var window2 = element.ownerDocument.defaultView, styles2 = window2.getComputedStyle(element), x2 = parseFloat(styles2.marginTop || 0) + parseFloat(styles2.marginBottom || 0), y2 = parseFloat(styles2.marginLeft || 0) + parseFloat(styles2.marginRight || 0), result = { 15360 width: element.offsetWidth + y2, 15361 height: element.offsetHeight + x2 15362 }; 15363 return result; 15364} 15365function getOppositePlacement(placement) { 15366 var hash = { left: "right", right: "left", bottom: "top", top: "bottom" }; 15367 return placement.replace(/left|right|bottom|top/g, function(matched) { 15368 return hash[matched]; 15369 }); 15370} 15371function getPopperOffsets(popper, referenceOffsets, placement) { 15372 placement = placement.split("-")[0]; 15373 var popperRect = getOuterSizes(popper), popperOffsets = { 15374 width: popperRect.width, 15375 height: popperRect.height 15376 }, isHoriz = ["right", "left"].indexOf(placement) !== -1, mainSide = isHoriz ? "top" : "left", secondarySide = isHoriz ? "left" : "top", measurement = isHoriz ? "height" : "width", secondaryMeasurement = isHoriz ? "width" : "height"; 15377 return popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2, placement === secondarySide ? popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement] : popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)], popperOffsets; 15378} 15379function find(arr, check) { 15380 return Array.prototype.find ? arr.find(check) : arr.filter(check)[0]; 15381} 15382function findIndex(arr, prop, value) { 15383 if (Array.prototype.findIndex) 15384 return arr.findIndex(function(cur) { 15385 return cur[prop] === value; 15386 }); 15387 var match = find(arr, function(obj) { 15388 return obj[prop] === value; 15389 }); 15390 return arr.indexOf(match); 15391} 15392function runModifiers(modifiers2, data, ends) { 15393 var modifiersToRun = ends === void 0 ? modifiers2 : modifiers2.slice(0, findIndex(modifiers2, "name", ends)); 15394 return modifiersToRun.forEach(function(modifier) { 15395 modifier.function && console.warn("`modifier.function` is deprecated, use `modifier.fn`!"); 15396 var fn = modifier.function || modifier.fn; 15397 modifier.enabled && isFunction3(fn) && (data.offsets.popper = getClientRect(data.offsets.popper), data.offsets.reference = getClientRect(data.offsets.reference), data = fn(data, modifier)); 15398 }), data; 15399} 15400function update() { 15401 if (!this.state.isDestroyed) { 15402 var data = { 15403 instance: this, 15404 styles: {}, 15405 arrowStyles: {}, 15406 attributes: {}, 15407 flipped: !1, 15408 offsets: {} 15409 }; 15410 data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed), data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding), data.originalPlacement = data.placement, data.positionFixed = this.options.positionFixed, data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement), data.offsets.popper.position = this.options.positionFixed ? "fixed" : "absolute", data = runModifiers(this.modifiers, data), this.state.isCreated ? this.options.onUpdate(data) : (this.state.isCreated = !0, this.options.onCreate(data)); 15411 } 15412} 15413function isModifierEnabled(modifiers2, modifierName) { 15414 return modifiers2.some(function(_ref) { 15415 var name = _ref.name, enabled = _ref.enabled; 15416 return enabled && name === modifierName; 15417 }); 15418} 15419function getSupportedPropertyName(property) { 15420 for (var prefixes = [!1, "ms", "Webkit", "Moz", "O"], upperProp = property.charAt(0).toUpperCase() + property.slice(1), i2 = 0; i2 < prefixes.length; i2++) { 15421 var prefix = prefixes[i2], toCheck = prefix ? "" + prefix + upperProp : property; 15422 if (typeof document.body.style[toCheck] < "u") 15423 return toCheck; 15424 } 15425 return null; 15426} 15427function destroy() { 15428 return this.state.isDestroyed = !0, isModifierEnabled(this.modifiers, "applyStyle") && (this.popper.removeAttribute("x-placement"), this.popper.style.position = "", this.popper.style.top = "", this.popper.style.left = "", this.popper.style.right = "", this.popper.style.bottom = "", this.popper.style.willChange = "", this.popper.style[getSupportedPropertyName("transform")] = ""), this.disableEventListeners(), this.options.removeOnDestroy && this.popper.parentNode.removeChild(this.popper), this; 15429} 15430function getWindow(element) { 15431 var ownerDocument = element.ownerDocument; 15432 return ownerDocument ? ownerDocument.defaultView : window; 15433} 15434function attachToScrollParents(scrollParent2, event, callback, scrollParents) { 15435 var isBody = scrollParent2.nodeName === "BODY", target = isBody ? scrollParent2.ownerDocument.defaultView : scrollParent2; 15436 target.addEventListener(event, callback, { passive: !0 }), isBody || attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents), scrollParents.push(target); 15437} 15438function setupEventListeners(reference, options2, state, updateBound) { 15439 state.updateBound = updateBound, getWindow(reference).addEventListener("resize", state.updateBound, { passive: !0 }); 15440 var scrollElement = getScrollParent(reference); 15441 return attachToScrollParents(scrollElement, "scroll", state.updateBound, state.scrollParents), state.scrollElement = scrollElement, state.eventsEnabled = !0, state; 15442} 15443function enableEventListeners() { 15444 this.state.eventsEnabled || (this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate)); 15445} 15446function removeEventListeners(reference, state) { 15447 return getWindow(reference).removeEventListener("resize", state.updateBound), state.scrollParents.forEach(function(target) { 15448 target.removeEventListener("scroll", state.updateBound); 15449 }), state.updateBound = null, state.scrollParents = [], state.scrollElement = null, state.eventsEnabled = !1, state; 15450} 15451function disableEventListeners() { 15452 this.state.eventsEnabled && (cancelAnimationFrame(this.scheduleUpdate), this.state = removeEventListeners(this.reference, this.state)); 15453} 15454function isNumeric(n3) { 15455 return n3 !== "" && !isNaN(parseFloat(n3)) && isFinite(n3); 15456} 15457function setStyles(element, styles2) { 15458 Object.keys(styles2).forEach(function(prop) { 15459 var unit = ""; 15460 ["width", "height", "top", "right", "bottom", "left"].indexOf(prop) !== -1 && isNumeric(styles2[prop]) && (unit = "px"), element.style[prop] = styles2[prop] + unit; 15461 }); 15462} 15463function setAttributes(element, attributes) { 15464 Object.keys(attributes).forEach(function(prop) { 15465 var value = attributes[prop]; 15466 value !== !1 ? element.setAttribute(prop, attributes[prop]) : element.removeAttribute(prop); 15467 }); 15468} 15469function applyStyle(data) { 15470 return setStyles(data.instance.popper, data.styles), setAttributes(data.instance.popper, data.attributes), data.arrowElement && Object.keys(data.arrowStyles).length && setStyles(data.arrowElement, data.arrowStyles), data; 15471} 15472function applyStyleOnLoad(reference, popper, options2, modifierOptions, state) { 15473 var referenceOffsets = getReferenceOffsets(state, popper, reference, options2.positionFixed), placement = computeAutoPlacement(options2.placement, referenceOffsets, popper, reference, options2.modifiers.flip.boundariesElement, options2.modifiers.flip.padding); 15474 return popper.setAttribute("x-placement", placement), setStyles(popper, { position: options2.positionFixed ? "fixed" : "absolute" }), options2; 15475} 15476function getRoundedOffsets(data, shouldRound) { 15477 var _data$offsets = data.offsets, popper = _data$offsets.popper, reference = _data$offsets.reference, round = Math.round, floor = Math.floor, noRound = function(v2) { 15478 return v2; 15479 }, referenceWidth = round(reference.width), popperWidth = round(popper.width), isVertical = ["left", "right"].indexOf(data.placement) !== -1, isVariation = data.placement.indexOf("-") !== -1, sameWidthParity = referenceWidth % 2 === popperWidth % 2, bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1, horizontalToInteger = shouldRound ? isVertical || isVariation || sameWidthParity ? round : floor : noRound, verticalToInteger = shouldRound ? round : noRound; 15480 return { 15481 left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left), 15482 top: verticalToInteger(popper.top), 15483 bottom: verticalToInteger(popper.bottom), 15484 right: horizontalToInteger(popper.right) 15485 }; 15486} 15487var isFirefox = isBrowser2 && /Firefox/i.test(navigator.userAgent); 15488function computeStyle(data, options2) { 15489 var x2 = options2.x, y2 = options2.y, popper = data.offsets.popper, legacyGpuAccelerationOption = find(data.instance.modifiers, function(modifier) { 15490 return modifier.name === "applyStyle"; 15491 }).gpuAcceleration; 15492 legacyGpuAccelerationOption !== void 0 && console.warn("WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!"); 15493 var gpuAcceleration = legacyGpuAccelerationOption !== void 0 ? legacyGpuAccelerationOption : options2.gpuAcceleration, offsetParent = getOffsetParent(data.instance.popper), offsetParentRect = getBoundingClientRect(offsetParent), styles2 = { 15494 position: popper.position 15495 }, offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox), sideA = x2 === "bottom" ? "top" : "bottom", sideB = y2 === "right" ? "left" : "right", prefixedProperty = getSupportedPropertyName("transform"), left = void 0, top = void 0; 15496 if (sideA === "bottom" ? offsetParent.nodeName === "HTML" ? top = -offsetParent.clientHeight + offsets.bottom : top = -offsetParentRect.height + offsets.bottom : top = offsets.top, sideB === "right" ? offsetParent.nodeName === "HTML" ? left = -offsetParent.clientWidth + offsets.right : left = -offsetParentRect.width + offsets.right : left = offsets.left, gpuAcceleration && prefixedProperty) 15497 styles2[prefixedProperty] = "translate3d(" + left + "px, " + top + "px, 0)", styles2[sideA] = 0, styles2[sideB] = 0, styles2.willChange = "transform"; 15498 else { 15499 var invertTop = sideA === "bottom" ? -1 : 1, invertLeft = sideB === "right" ? -1 : 1; 15500 styles2[sideA] = top * invertTop, styles2[sideB] = left * invertLeft, styles2.willChange = sideA + ", " + sideB; 15501 } 15502 var attributes = { 15503 "x-placement": data.placement 15504 }; 15505 return data.attributes = _extends2({}, attributes, data.attributes), data.styles = _extends2({}, styles2, data.styles), data.arrowStyles = _extends2({}, data.offsets.arrow, data.arrowStyles), data; 15506} 15507function isModifierRequired(modifiers2, requestingName, requestedName) { 15508 var requesting = find(modifiers2, function(_ref) { 15509 var name = _ref.name; 15510 return name === requestingName; 15511 }), isRequired = !!requesting && modifiers2.some(function(modifier) { 15512 return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order; 15513 }); 15514 if (!isRequired) { 15515 var _requesting = "`" + requestingName + "`", requested = "`" + requestedName + "`"; 15516 console.warn(requested + " modifier is required by " + _requesting + " modifier in order to work, be sure to include it before " + _requesting + "!"); 15517 } 15518 return isRequired; 15519} 15520function arrow(data, options2) { 15521 var _data$offsets$arrow; 15522 if (!isModifierRequired(data.instance.modifiers, "arrow", "keepTogether")) 15523 return data; 15524 var arrowElement = options2.element; 15525 if (typeof arrowElement == "string") { 15526 if (arrowElement = data.instance.popper.querySelector(arrowElement), !arrowElement) 15527 return data; 15528 } else if (!data.instance.popper.contains(arrowElement)) 15529 return console.warn("WARNING: `arrow.element` must be child of its popper element!"), data; 15530 var placement = data.placement.split("-")[0], _data$offsets = data.offsets, popper = _data$offsets.popper, reference = _data$offsets.reference, isVertical = ["left", "right"].indexOf(placement) !== -1, len = isVertical ? "height" : "width", sideCapitalized = isVertical ? "Top" : "Left", side = sideCapitalized.toLowerCase(), altSide = isVertical ? "left" : "top", opSide = isVertical ? "bottom" : "right", arrowElementSize = getOuterSizes(arrowElement)[len]; 15531 reference[opSide] - arrowElementSize < popper[side] && (data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize)), reference[side] + arrowElementSize > popper[opSide] && (data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide]), data.offsets.popper = getClientRect(data.offsets.popper); 15532 var center = reference[side] + reference[len] / 2 - arrowElementSize / 2, css2 = getStyleComputedProperty(data.instance.popper), popperMarginSide = parseFloat(css2["margin" + sideCapitalized]), popperBorderSide = parseFloat(css2["border" + sideCapitalized + "Width"]), sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide; 15533 return sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0), data.arrowElement = arrowElement, data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ""), _data$offsets$arrow), data; 15534} 15535function getOppositeVariation(variation) { 15536 return variation === "end" ? "start" : variation === "start" ? "end" : variation; 15537} 15538var placements = ["auto-start", "auto", "auto-end", "top-start", "top", "top-end", "right-start", "right", "right-end", "bottom-end", "bottom", "bottom-start", "left-end", "left", "left-start"], validPlacements = placements.slice(3); 15539function clockwise(placement) { 15540 var counter = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, index = validPlacements.indexOf(placement), arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index)); 15541 return counter ? arr.reverse() : arr; 15542} 15543var BEHAVIORS = { 15544 FLIP: "flip", 15545 CLOCKWISE: "clockwise", 15546 COUNTERCLOCKWISE: "counterclockwise" 15547}; 15548function flip(data, options2) { 15549 if (isModifierEnabled(data.instance.modifiers, "inner") || data.flipped && data.placement === data.originalPlacement) 15550 return data; 15551 var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options2.padding, options2.boundariesElement, data.positionFixed), placement = data.placement.split("-")[0], placementOpposite = getOppositePlacement(placement), variation = data.placement.split("-")[1] || "", flipOrder = []; 15552 switch (options2.behavior) { 15553 case BEHAVIORS.FLIP: 15554 flipOrder = [placement, placementOpposite]; 15555 break; 15556 case BEHAVIORS.CLOCKWISE: 15557 flipOrder = clockwise(placement); 15558 break; 15559 case BEHAVIORS.COUNTERCLOCKWISE: 15560 flipOrder = clockwise(placement, !0); 15561 break; 15562 default: 15563 flipOrder = options2.behavior; 15564 } 15565 return flipOrder.forEach(function(step, index) { 15566 if (placement !== step || flipOrder.length === index + 1) 15567 return data; 15568 placement = data.placement.split("-")[0], placementOpposite = getOppositePlacement(placement); 15569 var popperOffsets = data.offsets.popper, refOffsets = data.offsets.reference, floor = Math.floor, overlapsRef = placement === "left" && floor(popperOffsets.right) > floor(refOffsets.left) || placement === "right" && floor(popperOffsets.left) < floor(refOffsets.right) || placement === "top" && floor(popperOffsets.bottom) > floor(refOffsets.top) || placement === "bottom" && floor(popperOffsets.top) < floor(refOffsets.bottom), overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left), overflowsRight = floor(popperOffsets.right) > floor(boundaries.right), overflowsTop = floor(popperOffsets.top) < floor(boundaries.top), overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom), overflowsBoundaries = placement === "left" && overflowsLeft || placement === "right" && overflowsRight || placement === "top" && overflowsTop || placement === "bottom" && overflowsBottom, isVertical = ["top", "bottom"].indexOf(placement) !== -1, flippedVariationByRef = !!options2.flipVariations && (isVertical && variation === "start" && overflowsLeft || isVertical && variation === "end" && overflowsRight || !isVertical && variation === "start" && overflowsTop || !isVertical && variation === "end" && overflowsBottom), flippedVariationByContent = !!options2.flipVariationsByContent && (isVertical && variation === "start" && overflowsRight || isVertical && variation === "end" && overflowsLeft || !isVertical && variation === "start" && overflowsBottom || !isVertical && variation === "end" && overflowsTop), flippedVariation = flippedVariationByRef || flippedVariationByContent; 15570 (overlapsRef || overflowsBoundaries || flippedVariation) && (data.flipped = !0, (overlapsRef || overflowsBoundaries) && (placement = flipOrder[index + 1]), flippedVariation && (variation = getOppositeVariation(variation)), data.placement = placement + (variation ? "-" + variation : ""), data.offsets.popper = _extends2({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement)), data = runModifiers(data.instance.modifiers, data, "flip")); 15571 }), data; 15572} 15573function keepTogether(data) { 15574 var _data$offsets = data.offsets, popper = _data$offsets.popper, reference = _data$offsets.reference, placement = data.placement.split("-")[0], floor = Math.floor, isVertical = ["top", "bottom"].indexOf(placement) !== -1, side = isVertical ? "right" : "bottom", opSide = isVertical ? "left" : "top", measurement = isVertical ? "width" : "height"; 15575 return popper[side] < floor(reference[opSide]) && (data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement]), popper[opSide] > floor(reference[side]) && (data.offsets.popper[opSide] = floor(reference[side])), data; 15576} 15577function toValue(str, measurement, popperOffsets, referenceOffsets) { 15578 var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/), value = +split[1], unit = split[2]; 15579 if (!value) 15580 return str; 15581 if (unit.indexOf("%") === 0) { 15582 var element = void 0; 15583 unit === "%p" ? element = popperOffsets : element = referenceOffsets; 15584 var rect = getClientRect(element); 15585 return rect[measurement] / 100 * value; 15586 } else if (unit === "vh" || unit === "vw") { 15587 var size = void 0; 15588 return unit === "vh" ? size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0) : size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0), size / 100 * value; 15589 } else 15590 return value; 15591} 15592function parseOffset(offset2, popperOffsets, referenceOffsets, basePlacement) { 15593 var offsets = [0, 0], useHeight = ["right", "left"].indexOf(basePlacement) !== -1, fragments = offset2.split(/(\+|\-)/).map(function(frag) { 15594 return frag.trim(); 15595 }), divider = fragments.indexOf(find(fragments, function(frag) { 15596 return frag.search(/,|\s/) !== -1; 15597 })); 15598 fragments[divider] && fragments[divider].indexOf(",") === -1 && console.warn("Offsets separated by white space(s) are deprecated, use a comma (,) instead."); 15599 var splitRegex = /\s*,\s*|\s+/, ops = divider !== -1 ? [fragments.slice(0, divider).concat([fragments[divider].split(splitRegex)[0]]), [fragments[divider].split(splitRegex)[1]].concat(fragments.slice(divider + 1))] : [fragments]; 15600 return ops = ops.map(function(op, index) { 15601 var measurement = (index === 1 ? !useHeight : useHeight) ? "height" : "width", mergeWithPrevious = !1; 15602 return op.reduce(function(a2, b2) { 15603 return a2[a2.length - 1] === "" && ["+", "-"].indexOf(b2) !== -1 ? (a2[a2.length - 1] = b2, mergeWithPrevious = !0, a2) : mergeWithPrevious ? (a2[a2.length - 1] += b2, mergeWithPrevious = !1, a2) : a2.concat(b2); 15604 }, []).map(function(str) { 15605 return toValue(str, measurement, popperOffsets, referenceOffsets); 15606 }); 15607 }), ops.forEach(function(op, index) { 15608 op.forEach(function(frag, index2) { 15609 isNumeric(frag) && (offsets[index] += frag * (op[index2 - 1] === "-" ? -1 : 1)); 15610 }); 15611 }), offsets; 15612} 15613function offset(data, _ref) { 15614 var offset2 = _ref.offset, placement = data.placement, _data$offsets = data.offsets, popper = _data$offsets.popper, reference = _data$offsets.reference, basePlacement = placement.split("-")[0], offsets = void 0; 15615 return isNumeric(+offset2) ? offsets = [+offset2, 0] : offsets = parseOffset(offset2, popper, reference, basePlacement), basePlacement === "left" ? (popper.top += offsets[0], popper.left -= offsets[1]) : basePlacement === "right" ? (popper.top += offsets[0], popper.left += offsets[1]) : basePlacement === "top" ? (popper.left += offsets[0], popper.top -= offsets[1]) : basePlacement === "bottom" && (popper.left += offsets[0], popper.top += offsets[1]), data.popper = popper, data; 15616} 15617function preventOverflow(data, options2) { 15618 var boundariesElement = options2.boundariesElement || getOffsetParent(data.instance.popper); 15619 data.instance.reference === boundariesElement && (boundariesElement = getOffsetParent(boundariesElement)); 15620 var transformProp = getSupportedPropertyName("transform"), popperStyles = data.instance.popper.style, top = popperStyles.top, left = popperStyles.left, transform = popperStyles[transformProp]; 15621 popperStyles.top = "", popperStyles.left = "", popperStyles[transformProp] = ""; 15622 var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options2.padding, boundariesElement, data.positionFixed); 15623 popperStyles.top = top, popperStyles.left = left, popperStyles[transformProp] = transform, options2.boundaries = boundaries; 15624 var order = options2.priority, popper = data.offsets.popper, check = { 15625 primary: function(placement) { 15626 var value = popper[placement]; 15627 return popper[placement] < boundaries[placement] && !options2.escapeWithReference && (value = Math.max(popper[placement], boundaries[placement])), defineProperty({}, placement, value); 15628 }, 15629 secondary: function(placement) { 15630 var mainSide = placement === "right" ? "left" : "top", value = popper[mainSide]; 15631 return popper[placement] > boundaries[placement] && !options2.escapeWithReference && (value = Math.min(popper[mainSide], boundaries[placement] - (placement === "right" ? popper.width : popper.height))), defineProperty({}, mainSide, value); 15632 } 15633 }; 15634 return order.forEach(function(placement) { 15635 var side = ["left", "top"].indexOf(placement) !== -1 ? "primary" : "secondary"; 15636 popper = _extends2({}, popper, check[side](placement)); 15637 }), data.offsets.popper = popper, data; 15638} 15639function shift(data) { 15640 var placement = data.placement, basePlacement = placement.split("-")[0], shiftvariation = placement.split("-")[1]; 15641 if (shiftvariation) { 15642 var _data$offsets = data.offsets, reference = _data$offsets.reference, popper = _data$offsets.popper, isVertical = ["bottom", "top"].indexOf(basePlacement) !== -1, side = isVertical ? "left" : "top", measurement = isVertical ? "width" : "height", shiftOffsets = { 15643 start: defineProperty({}, side, reference[side]), 15644 end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement]) 15645 }; 15646 data.offsets.popper = _extends2({}, popper, shiftOffsets[shiftvariation]); 15647 } 15648 return data; 15649} 15650function hide(data) { 15651 if (!isModifierRequired(data.instance.modifiers, "hide", "preventOverflow")) 15652 return data; 15653 var refRect = data.offsets.reference, bound = find(data.instance.modifiers, function(modifier) { 15654 return modifier.name === "preventOverflow"; 15655 }).boundaries; 15656 if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) { 15657 if (data.hide === !0) 15658 return data; 15659 data.hide = !0, data.attributes["x-out-of-boundaries"] = ""; 15660 } else { 15661 if (data.hide === !1) 15662 return data; 15663 data.hide = !1, data.attributes["x-out-of-boundaries"] = !1; 15664 } 15665 return data; 15666} 15667function inner(data) { 15668 var placement = data.placement, basePlacement = placement.split("-")[0], _data$offsets = data.offsets, popper = _data$offsets.popper, reference = _data$offsets.reference, isHoriz = ["left", "right"].indexOf(basePlacement) !== -1, subtractLength = ["top", "left"].indexOf(basePlacement) === -1; 15669 return popper[isHoriz ? "left" : "top"] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? "width" : "height"] : 0), data.placement = getOppositePlacement(placement), data.offsets.popper = getClientRect(popper), data; 15670} 15671var modifiers = { 15672 /** 15673 * Modifier used to shift the popper on the start or end of its reference 15674 * element.<br /> 15675 * It will read the variation of the `placement` property.<br /> 15676 * It can be one either `-end` or `-start`. 15677 * @memberof modifiers 15678 * @inner 15679 */ 15680 shift: { 15681 /** @prop {number} order=100 - Index used to define the order of execution */ 15682 order: 100, 15683 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 15684 enabled: !0, 15685 /** @prop {ModifierFn} */ 15686 fn: shift 15687 }, 15688 /** 15689 * The `offset` modifier can shift your popper on both its axis. 15690 * 15691 * It accepts the following units: 15692 * - `px` or unit-less, interpreted as pixels 15693 * - `%` or `%r`, percentage relative to the length of the reference element 15694 * - `%p`, percentage relative to the length of the popper element 15695 * - `vw`, CSS viewport width unit 15696 * - `vh`, CSS viewport height unit 15697 * 15698 * For length is intended the main axis relative to the placement of the popper.<br /> 15699 * This means that if the placement is `top` or `bottom`, the length will be the 15700 * `width`. In case of `left` or `right`, it will be the `height`. 15701 * 15702 * You can provide a single value (as `Number` or `String`), or a pair of values 15703 * as `String` divided by a comma or one (or more) white spaces.<br /> 15704 * The latter is a deprecated method because it leads to confusion and will be 15705 * removed in v2.<br /> 15706 * Additionally, it accepts additions and subtractions between different units. 15707 * Note that multiplications and divisions aren't supported. 15708 * 15709 * Valid examples are: 15710 * ``` 15711 * 10 15712 * '10%' 15713 * '10, 10' 15714 * '10%, 10' 15715 * '10 + 10%' 15716 * '10 - 5vh + 3%' 15717 * '-10px + 5vh, 5px - 6%' 15718 * ``` 15719 * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap 15720 * > with their reference element, unfortunately, you will have to disable the `flip` modifier. 15721 * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373). 15722 * 15723 * @memberof modifiers 15724 * @inner 15725 */ 15726 offset: { 15727 /** @prop {number} order=200 - Index used to define the order of execution */ 15728 order: 200, 15729 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 15730 enabled: !0, 15731 /** @prop {ModifierFn} */ 15732 fn: offset, 15733 /** @prop {Number|String} offset=0 15734 * The offset value as described in the modifier description 15735 */ 15736 offset: 0 15737 }, 15738 /** 15739 * Modifier used to prevent the popper from being positioned outside the boundary. 15740 * 15741 * A scenario exists where the reference itself is not within the boundaries.<br /> 15742 * We can say it has "escaped the boundaries" — or just "escaped".<br /> 15743 * In this case we need to decide whether the popper should either: 15744 * 15745 * - detach from the reference and remain "trapped" in the boundaries, or 15746 * - if it should ignore the boundary and "escape with its reference" 15747 * 15748 * When `escapeWithReference` is set to`true` and reference is completely 15749 * outside its boundaries, the popper will overflow (or completely leave) 15750 * the boundaries in order to remain attached to the edge of the reference. 15751 * 15752 * @memberof modifiers 15753 * @inner 15754 */ 15755 preventOverflow: { 15756 /** @prop {number} order=300 - Index used to define the order of execution */ 15757 order: 300, 15758 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 15759 enabled: !0, 15760 /** @prop {ModifierFn} */ 15761 fn: preventOverflow, 15762 /** 15763 * @prop {Array} [priority=['left','right','top','bottom']] 15764 * Popper will try to prevent overflow following these priorities by default, 15765 * then, it could overflow on the left and on top of the `boundariesElement` 15766 */ 15767 priority: ["left", "right", "top", "bottom"], 15768 /** 15769 * @prop {number} padding=5 15770 * Amount of pixel used to define a minimum distance between the boundaries 15771 * and the popper. This makes sure the popper always has a little padding 15772 * between the edges of its container 15773 */ 15774 padding: 5, 15775 /** 15776 * @prop {String|HTMLElement} boundariesElement='scrollParent' 15777 * Boundaries used by the modifier. Can be `scrollParent`, `window`, 15778 * `viewport` or any DOM element. 15779 */ 15780 boundariesElement: "scrollParent" 15781 }, 15782 /** 15783 * Modifier used to make sure the reference and its popper stay near each other 15784 * without leaving any gap between the two. Especially useful when the arrow is 15785 * enabled and you want to ensure that it points to its reference element. 15786 * It cares only about the first axis. You can still have poppers with margin 15787 * between the popper and its reference element. 15788 * @memberof modifiers 15789 * @inner 15790 */ 15791 keepTogether: { 15792 /** @prop {number} order=400 - Index used to define the order of execution */ 15793 order: 400, 15794 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 15795 enabled: !0, 15796 /** @prop {ModifierFn} */ 15797 fn: keepTogether 15798 }, 15799 /** 15800 * This modifier is used to move the `arrowElement` of the popper to make 15801 * sure it is positioned between the reference element and its popper element. 15802 * It will read the outer size of the `arrowElement` node to detect how many 15803 * pixels of conjunction are needed. 15804 * 15805 * It has no effect if no `arrowElement` is provided. 15806 * @memberof modifiers 15807 * @inner 15808 */ 15809 arrow: { 15810 /** @prop {number} order=500 - Index used to define the order of execution */ 15811 order: 500, 15812 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 15813 enabled: !0, 15814 /** @prop {ModifierFn} */ 15815 fn: arrow, 15816 /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */ 15817 element: "[x-arrow]" 15818 }, 15819 /** 15820 * Modifier used to flip the popper's placement when it starts to overlap its 15821 * reference element. 15822 * 15823 * Requires the `preventOverflow` modifier before it in order to work. 15824 * 15825 * **NOTE:** this modifier will interrupt the current update cycle and will 15826 * restart it if it detects the need to flip the placement. 15827 * @memberof modifiers 15828 * @inner 15829 */ 15830 flip: { 15831 /** @prop {number} order=600 - Index used to define the order of execution */ 15832 order: 600, 15833 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 15834 enabled: !0, 15835 /** @prop {ModifierFn} */ 15836 fn: flip, 15837 /** 15838 * @prop {String|Array} behavior='flip' 15839 * The behavior used to change the popper's placement. It can be one of 15840 * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid 15841 * placements (with optional variations) 15842 */ 15843 behavior: "flip", 15844 /** 15845 * @prop {number} padding=5 15846 * The popper will flip if it hits the edges of the `boundariesElement` 15847 */ 15848 padding: 5, 15849 /** 15850 * @prop {String|HTMLElement} boundariesElement='viewport' 15851 * The element which will define the boundaries of the popper position. 15852 * The popper will never be placed outside of the defined boundaries 15853 * (except if `keepTogether` is enabled) 15854 */ 15855 boundariesElement: "viewport", 15856 /** 15857 * @prop {Boolean} flipVariations=false 15858 * The popper will switch placement variation between `-start` and `-end` when 15859 * the reference element overlaps its boundaries. 15860 * 15861 * The original placement should have a set variation. 15862 */ 15863 flipVariations: !1, 15864 /** 15865 * @prop {Boolean} flipVariationsByContent=false 15866 * The popper will switch placement variation between `-start` and `-end` when 15867 * the popper element overlaps its reference boundaries. 15868 * 15869 * The original placement should have a set variation. 15870 */ 15871 flipVariationsByContent: !1 15872 }, 15873 /** 15874 * Modifier used to make the popper flow toward the inner of the reference element. 15875 * By default, when this modifier is disabled, the popper will be placed outside 15876 * the reference element. 15877 * @memberof modifiers 15878 * @inner 15879 */ 15880 inner: { 15881 /** @prop {number} order=700 - Index used to define the order of execution */ 15882 order: 700, 15883 /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */ 15884 enabled: !1, 15885 /** @prop {ModifierFn} */ 15886 fn: inner 15887 }, 15888 /** 15889 * Modifier used to hide the popper when its reference element is outside of the 15890 * popper boundaries. It will set a `x-out-of-boundaries` attribute which can 15891 * be used to hide with a CSS selector the popper when its reference is 15892 * out of boundaries. 15893 * 15894 * Requires the `preventOverflow` modifier before it in order to work. 15895 * @memberof modifiers 15896 * @inner 15897 */ 15898 hide: { 15899 /** @prop {number} order=800 - Index used to define the order of execution */ 15900 order: 800, 15901 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 15902 enabled: !0, 15903 /** @prop {ModifierFn} */ 15904 fn: hide 15905 }, 15906 /** 15907 * Computes the style that will be applied to the popper element to gets 15908 * properly positioned. 15909 * 15910 * Note that this modifier will not touch the DOM, it just prepares the styles 15911 * so that `applyStyle` modifier can apply it. This separation is useful 15912 * in case you need to replace `applyStyle` with a custom implementation. 15913 * 15914 * This modifier has `850` as `order` value to maintain backward compatibility 15915 * with previous versions of Popper.js. Expect the modifiers ordering method 15916 * to change in future major versions of the library. 15917 * 15918 * @memberof modifiers 15919 * @inner 15920 */ 15921 computeStyle: { 15922 /** @prop {number} order=850 - Index used to define the order of execution */ 15923 order: 850, 15924 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 15925 enabled: !0, 15926 /** @prop {ModifierFn} */ 15927 fn: computeStyle, 15928 /** 15929 * @prop {Boolean} gpuAcceleration=true 15930 * If true, it uses the CSS 3D transformation to position the popper. 15931 * Otherwise, it will use the `top` and `left` properties 15932 */ 15933 gpuAcceleration: !0, 15934 /** 15935 * @prop {string} [x='bottom'] 15936 * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin. 15937 * Change this if your popper should grow in a direction different from `bottom` 15938 */ 15939 x: "bottom", 15940 /** 15941 * @prop {string} [x='left'] 15942 * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin. 15943 * Change this if your popper should grow in a direction different from `right` 15944 */ 15945 y: "right" 15946 }, 15947 /** 15948 * Applies the computed styles to the popper element. 15949 * 15950 * All the DOM manipulations are limited to this modifier. This is useful in case 15951 * you want to integrate Popper.js inside a framework or view library and you 15952 * want to delegate all the DOM manipulations to it. 15953 * 15954 * Note that if you disable this modifier, you must make sure the popper element 15955 * has its position set to `absolute` before Popper.js can do its work! 15956 * 15957 * Just disable this modifier and define your own to achieve the desired effect. 15958 * 15959 * @memberof modifiers 15960 * @inner 15961 */ 15962 applyStyle: { 15963 /** @prop {number} order=900 - Index used to define the order of execution */ 15964 order: 900, 15965 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 15966 enabled: !0, 15967 /** @prop {ModifierFn} */ 15968 fn: applyStyle, 15969 /** @prop {Function} */ 15970 onLoad: applyStyleOnLoad, 15971 /** 15972 * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier 15973 * @prop {Boolean} gpuAcceleration=true 15974 * If true, it uses the CSS 3D transformation to position the popper. 15975 * Otherwise, it will use the `top` and `left` properties 15976 */ 15977 gpuAcceleration: void 0 15978 } 15979}, Defaults = { 15980 /** 15981 * Popper's placement. 15982 * @prop {Popper.placements} placement='bottom' 15983 */ 15984 placement: "bottom", 15985 /** 15986 * Set this to true if you want popper to position it self in 'fixed' mode 15987 * @prop {Boolean} positionFixed=false 15988 */ 15989 positionFixed: !1, 15990 /** 15991 * Whether events (resize, scroll) are initially enabled. 15992 * @prop {Boolean} eventsEnabled=true 15993 */ 15994 eventsEnabled: !0, 15995 /** 15996 * Set to true if you want to automatically remove the popper when 15997 * you call the `destroy` method. 15998 * @prop {Boolean} removeOnDestroy=false 15999 */ 16000 removeOnDestroy: !1, 16001 /** 16002 * Callback called when the popper is created.<br /> 16003 * By default, it is set to no-op.<br /> 16004 * Access Popper.js instance with `data.instance`. 16005 * @prop {onCreate} 16006 */ 16007 onCreate: function() { 16008 }, 16009 /** 16010 * Callback called when the popper is updated. This callback is not called 16011 * on the initialization/creation of the popper, but only on subsequent 16012 * updates.<br /> 16013 * By default, it is set to no-op.<br /> 16014 * Access Popper.js instance with `data.instance`. 16015 * @prop {onUpdate} 16016 */ 16017 onUpdate: function() { 16018 }, 16019 /** 16020 * List of modifiers used to modify the offsets before they are applied to the popper. 16021 * They provide most of the functionalities of Popper.js. 16022 * @prop {modifiers} 16023 */ 16024 modifiers 16025}, Popper = (function() { 16026 function Popper2(reference, popper) { 16027 var _this = this, options2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; 16028 classCallCheck(this, Popper2), this.scheduleUpdate = function() { 16029 return requestAnimationFrame(_this.update); 16030 }, this.update = debounce2(this.update.bind(this)), this.options = _extends2({}, Popper2.Defaults, options2), this.state = { 16031 isDestroyed: !1, 16032 isCreated: !1, 16033 scrollParents: [] 16034 }, this.reference = reference && reference.jquery ? reference[0] : reference, this.popper = popper && popper.jquery ? popper[0] : popper, this.options.modifiers = {}, Object.keys(_extends2({}, Popper2.Defaults.modifiers, options2.modifiers)).forEach(function(name) { 16035 _this.options.modifiers[name] = _extends2({}, Popper2.Defaults.modifiers[name] || {}, options2.modifiers ? options2.modifiers[name] : {}); 16036 }), this.modifiers = Object.keys(this.options.modifiers).map(function(name) { 16037 return _extends2({ 16038 name 16039 }, _this.options.modifiers[name]); 16040 }).sort(function(a2, b2) { 16041 return a2.order - b2.order; 16042 }), this.modifiers.forEach(function(modifierOptions) { 16043 modifierOptions.enabled && isFunction3(modifierOptions.onLoad) && modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state); 16044 }), this.update(); 16045 var eventsEnabled = this.options.eventsEnabled; 16046 eventsEnabled && this.enableEventListeners(), this.state.eventsEnabled = eventsEnabled; 16047 } 16048 return createClass(Popper2, [{ 16049 key: "update", 16050 value: function() { 16051 return update.call(this); 16052 } 16053 }, { 16054 key: "destroy", 16055 value: function() { 16056 return destroy.call(this); 16057 } 16058 }, { 16059 key: "enableEventListeners", 16060 value: function() { 16061 return enableEventListeners.call(this); 16062 } 16063 }, { 16064 key: "disableEventListeners", 16065 value: function() { 16066 return disableEventListeners.call(this); 16067 } 16068 /** 16069 * Schedules an update. It will run on the next UI update available. 16070 * @method scheduleUpdate 16071 * @memberof Popper 16072 */ 16073 /** 16074 * Collection of utilities useful when writing custom modifiers. 16075 * Starting from version 1.7, this method is available only if you 16076 * include `popper-utils.js` before `popper.js`. 16077 * 16078 * **DEPRECATION**: This way to access PopperUtils is deprecated 16079 * and will be removed in v2! Use the PopperUtils module directly instead. 16080 * Due to the high instability of the methods contained in Utils, we can't 16081 * guarantee them to follow semver. Use them at your own risk! 16082 * @static 16083 * @private 16084 * @type {Object} 16085 * @deprecated since version 1.8 16086 * @member Utils 16087 * @memberof Popper 16088 */ 16089 }]), Popper2; 16090})(); 16091Popper.Utils = (typeof window < "u" ? window : global).PopperUtils; 16092Popper.placements = placements; 16093Popper.Defaults = Defaults; 16094var popper_default = Popper; 16095 16096// ../../node_modules/react-floater/es/index.js 16097var import_deepmerge = __toESM(require_cjs()); 16098 16099// ../../node_modules/react-floater/node_modules/is-lite/esm/index.js 16100var DOM_PROPERTIES_TO_CHECK2 = [ 16101 "innerHTML", 16102 "ownerDocument", 16103 "style", 16104 "attributes", 16105 "nodeValue" 16106], objectTypes2 = [ 16107 "Array", 16108 "ArrayBuffer", 16109 "AsyncFunction", 16110 "AsyncGenerator", 16111 "AsyncGeneratorFunction", 16112 "Date", 16113 "Error", 16114 "Function", 16115 "Generator", 16116 "GeneratorFunction", 16117 "HTMLElement", 16118 "Map", 16119 "Object", 16120 "Promise", 16121 "RegExp", 16122 "Set", 16123 "WeakMap", 16124 "WeakSet" 16125], primitiveTypes2 = [ 16126 "bigint", 16127 "boolean", 16128 "null", 16129 "number", 16130 "string", 16131 "symbol", 16132 "undefined" 16133]; 16134function getObjectType2(value) { 16135 var objectTypeName = Object.prototype.toString.call(value).slice(8, -1); 16136 if (/HTML\w+Element/.test(objectTypeName)) 16137 return "HTMLElement"; 16138 if (isObjectType2(objectTypeName)) 16139 return objectTypeName; 16140} 16141function isObjectOfType2(type) { 16142 return function(value) { 16143 return getObjectType2(value) === type; 16144 }; 16145} 16146function isObjectType2(name) { 16147 return objectTypes2.includes(name); 16148} 16149function isOfType3(type) { 16150 return function(value) { 16151 return typeof value === type; 16152 }; 16153} 16154function isPrimitiveType2(name) { 16155 return primitiveTypes2.includes(name); 16156} 16157function is2(value) { 16158 if (value === null) 16159 return "null"; 16160 switch (typeof value) { 16161 case "bigint": 16162 return "bigint"; 16163 case "boolean": 16164 return "boolean"; 16165 case "number": 16166 return "number"; 16167 case "string": 16168 return "string"; 16169 case "symbol": 16170 return "symbol"; 16171 case "undefined": 16172 return "undefined"; 16173 default: 16174 } 16175 if (is2.array(value)) 16176 return "Array"; 16177 if (is2.plainFunction(value)) 16178 return "Function"; 16179 var tagType = getObjectType2(value); 16180 return tagType || "Object"; 16181} 16182is2.array = Array.isArray; 16183is2.arrayOf = function(target, predicate) { 16184 return !is2.array(target) && !is2.function(predicate) ? !1 : target.every(function(d2) { 16185 return predicate(d2); 16186 }); 16187}; 16188is2.asyncGeneratorFunction = function(value) { 16189 return getObjectType2(value) === "AsyncGeneratorFunction"; 16190}; 16191is2.asyncFunction = isObjectOfType2("AsyncFunction"); 16192is2.bigint = isOfType3("bigint"); 16193is2.boolean = function(value) { 16194 return value === !0 || value === !1; 16195}; 16196is2.date = isObjectOfType2("Date"); 16197is2.defined = function(value) { 16198 return !is2.undefined(value); 16199}; 16200is2.domElement = function(value) { 16201 return is2.object(value) && !is2.plainObject(value) && value.nodeType === 1 && is2.string(value.nodeName) && DOM_PROPERTIES_TO_CHECK2.every(function(property) { 16202 return property in value; 16203 }); 16204}; 16205is2.empty = function(value) { 16206 return is2.string(value) && value.length === 0 || is2.array(value) && value.length === 0 || is2.object(value) && !is2.map(value) && !is2.set(value) && Object.keys(value).length === 0 || is2.set(value) && value.size === 0 || is2.map(value) && value.size === 0; 16207}; 16208is2.error = isObjectOfType2("Error"); 16209is2.function = isOfType3("function"); 16210is2.generator = function(value) { 16211 return is2.iterable(value) && is2.function(value.next) && is2.function(value.throw); 16212}; 16213is2.generatorFunction = isObjectOfType2("GeneratorFunction"); 16214is2.instanceOf = function(instance, class_) { 16215 return !instance || !class_ ? !1 : Object.getPrototypeOf(instance) === class_.prototype; 16216}; 16217is2.iterable = function(value) { 16218 return !is2.nullOrUndefined(value) && is2.function(value[Symbol.iterator]); 16219}; 16220is2.map = isObjectOfType2("Map"); 16221is2.nan = function(value) { 16222 return Number.isNaN(value); 16223}; 16224is2.null = function(value) { 16225 return value === null; 16226}; 16227is2.nullOrUndefined = function(value) { 16228 return is2.null(value) || is2.undefined(value); 16229}; 16230is2.number = function(value) { 16231 return isOfType3("number")(value) && !is2.nan(value); 16232}; 16233is2.numericString = function(value) { 16234 return is2.string(value) && value.length > 0 && !Number.isNaN(Number(value)); 16235}; 16236is2.object = function(value) { 16237 return !is2.nullOrUndefined(value) && (is2.function(value) || typeof value == "object"); 16238}; 16239is2.oneOf = function(target, value) { 16240 return is2.array(target) ? target.indexOf(value) > -1 : !1; 16241}; 16242is2.plainFunction = isObjectOfType2("Function"); 16243is2.plainObject = function(value) { 16244 if (getObjectType2(value) !== "Object") 16245 return !1; 16246 var prototype = Object.getPrototypeOf(value); 16247 return prototype === null || prototype === Object.getPrototypeOf({}); 16248}; 16249is2.primitive = function(value) { 16250 return is2.null(value) || isPrimitiveType2(typeof value); 16251}; 16252is2.promise = isObjectOfType2("Promise"); 16253is2.propertyOf = function(target, key, predicate) { 16254 if (!is2.object(target) || !key) 16255 return !1; 16256 var value = target[key]; 16257 return is2.function(predicate) ? predicate(value) : is2.defined(value); 16258}; 16259is2.regexp = isObjectOfType2("RegExp"); 16260is2.set = isObjectOfType2("Set"); 16261is2.string = isOfType3("string"); 16262is2.symbol = isOfType3("symbol"); 16263is2.undefined = isOfType3("undefined"); 16264is2.weakMap = isObjectOfType2("WeakMap"); 16265is2.weakSet = isObjectOfType2("WeakSet"); 16266var esm_default = is2; 16267 16268// ../../node_modules/tree-changes/node_modules/@gilbarbara/deep-equal/esm/helpers.js 16269function isOfType4(type) { 16270 return function(value) { 16271 return typeof value === type; 16272 }; 16273} 16274var isFunction4 = isOfType4("function"), isNull3 = function(value) { 16275 return value === null; 16276}, isRegex2 = function(value) { 16277 return Object.prototype.toString.call(value).slice(8, -1) === "RegExp"; 16278}, isObject2 = function(value) { 16279 return !isUndefined3(value) && !isNull3(value) && (isFunction4(value) || typeof value == "object"); 16280}, isUndefined3 = isOfType4("undefined"); 16281 16282// ../../node_modules/tree-changes/node_modules/@gilbarbara/deep-equal/esm/index.js 16283var __values = function(o3) { 16284 var s2 = typeof Symbol == "function" && Symbol.iterator, m2 = s2 && o3[s2], i2 = 0; 16285 if (m2) return m2.call(o3); 16286 if (o3 && typeof o3.length == "number") return { 16287 next: function() { 16288 return o3 && i2 >= o3.length && (o3 = void 0), { value: o3 && o3[i2++], done: !o3 }; 16289 } 16290 }; 16291 throw new TypeError(s2 ? "Object is not iterable." : "Symbol.iterator is not defined."); 16292}; 16293function equalArray2(left, right) { 16294 var length = left.length; 16295 if (length !== right.length) 16296 return !1; 16297 for (var index = length; index-- !== 0; ) 16298 if (!equal2(left[index], right[index])) 16299 return !1; 16300 return !0; 16301} 16302function equalArrayBuffer2(left, right) { 16303 if (left.byteLength !== right.byteLength) 16304 return !1; 16305 for (var view1 = new DataView(left.buffer), view2 = new DataView(right.buffer), index = left.byteLength; index--; ) 16306 if (view1.getUint8(index) !== view2.getUint8(index)) 16307 return !1; 16308 return !0; 16309} 16310function equalMap2(left, right) { 16311 var e_1, _a2, e_2, _b; 16312 if (left.size !== right.size) 16313 return !1; 16314 try { 16315 for (var _c = __values(left.entries()), _d = _c.next(); !_d.done; _d = _c.next()) { 16316 var index = _d.value; 16317 if (!right.has(index[0])) 16318 return !1; 16319 } 16320 } catch (e_1_1) { 16321 e_1 = { error: e_1_1 }; 16322 } finally { 16323 try { 16324 _d && !_d.done && (_a2 = _c.return) && _a2.call(_c); 16325 } finally { 16326 if (e_1) throw e_1.error; 16327 } 16328 } 16329 try { 16330 for (var _e = __values(left.entries()), _f = _e.next(); !_f.done; _f = _e.next()) { 16331 var index = _f.value; 16332 if (!equal2(index[1], right.get(index[0]))) 16333 return !1; 16334 } 16335 } catch (e_2_1) { 16336 e_2 = { error: e_2_1 }; 16337 } finally { 16338 try { 16339 _f && !_f.done && (_b = _e.return) && _b.call(_e); 16340 } finally { 16341 if (e_2) throw e_2.error; 16342 } 16343 } 16344 return !0; 16345} 16346function equalSet2(left, right) { 16347 var e_3, _a2; 16348 if (left.size !== right.size) 16349 return !1; 16350 try { 16351 for (var _b = __values(left.entries()), _c = _b.next(); !_c.done; _c = _b.next()) { 16352 var index = _c.value; 16353 if (!right.has(index[0])) 16354 return !1; 16355 } 16356 } catch (e_3_1) { 16357 e_3 = { error: e_3_1 }; 16358 } finally { 16359 try { 16360 _c && !_c.done && (_a2 = _b.return) && _a2.call(_b); 16361 } finally { 16362 if (e_3) throw e_3.error; 16363 } 16364 } 16365 return !0; 16366} 16367function equal2(left, right) { 16368 if (left === right) 16369 return !0; 16370 if (left && isObject2(left) && right && isObject2(right)) { 16371 if (left.constructor !== right.constructor) 16372 return !1; 16373 if (Array.isArray(left) && Array.isArray(right)) 16374 return equalArray2(left, right); 16375 if (left instanceof Map && right instanceof Map) 16376 return equalMap2(left, right); 16377 if (left instanceof Set && right instanceof Set) 16378 return equalSet2(left, right); 16379 if (ArrayBuffer.isView(left) && ArrayBuffer.isView(right)) 16380 return equalArrayBuffer2(left, right); 16381 if (isRegex2(left) && isRegex2(right)) 16382 return left.source === right.source && left.flags === right.flags; 16383 if (left.valueOf !== Object.prototype.valueOf) 16384 return left.valueOf() === right.valueOf(); 16385 if (left.toString !== Object.prototype.toString) 16386 return left.toString() === right.toString(); 16387 var leftKeys = Object.keys(left), rightKeys = Object.keys(right); 16388 if (leftKeys.length !== rightKeys.length) 16389 return !1; 16390 for (var index = leftKeys.length; index-- !== 0; ) 16391 if (!Object.prototype.hasOwnProperty.call(right, leftKeys[index])) 16392 return !1; 16393 for (var index = leftKeys.length; index-- !== 0; ) { 16394 var key = leftKeys[index]; 16395 if (!(key === "_owner" && left.$$typeof) && !equal2(left[key], right[key])) 16396 return !1; 16397 } 16398 return !0; 16399 } 16400 return Number.isNaN(left) && Number.isNaN(right) ? !0 : left === right; 16401} 16402 16403// ../../node_modules/tree-changes/node_modules/is-lite/esm/index.js 16404var DOM_PROPERTIES_TO_CHECK3 = [ 16405 "innerHTML", 16406 "ownerDocument", 16407 "style", 16408 "attributes", 16409 "nodeValue" 16410], objectTypes3 = [ 16411 "Array", 16412 "ArrayBuffer", 16413 "AsyncFunction", 16414 "AsyncGenerator", 16415 "AsyncGeneratorFunction", 16416 "Date", 16417 "Error", 16418 "Function", 16419 "Generator", 16420 "GeneratorFunction", 16421 "HTMLElement", 16422 "Map", 16423 "Object", 16424 "Promise", 16425 "RegExp", 16426 "Set", 16427 "WeakMap", 16428 "WeakSet" 16429], primitiveTypes3 = [ 16430 "bigint", 16431 "boolean", 16432 "null", 16433 "number", 16434 "string", 16435 "symbol", 16436 "undefined" 16437]; 16438function getObjectType3(value) { 16439 var objectTypeName = Object.prototype.toString.call(value).slice(8, -1); 16440 if (/HTML\w+Element/.test(objectTypeName)) 16441 return "HTMLElement"; 16442 if (isObjectType3(objectTypeName)) 16443 return objectTypeName; 16444} 16445function isObjectOfType3(type) { 16446 return function(value) { 16447 return getObjectType3(value) === type; 16448 }; 16449} 16450function isObjectType3(name) { 16451 return objectTypes3.includes(name); 16452} 16453function isOfType5(type) { 16454 return function(value) { 16455 return typeof value === type; 16456 }; 16457} 16458function isPrimitiveType3(name) { 16459 return primitiveTypes3.includes(name); 16460} 16461function is3(value) { 16462 if (value === null) 16463 return "null"; 16464 switch (typeof value) { 16465 case "bigint": 16466 return "bigint"; 16467 case "boolean": 16468 return "boolean"; 16469 case "number": 16470 return "number"; 16471 case "string": 16472 return "string"; 16473 case "symbol": 16474 return "symbol"; 16475 case "undefined": 16476 return "undefined"; 16477 default: 16478 } 16479 if (is3.array(value)) 16480 return "Array"; 16481 if (is3.plainFunction(value)) 16482 return "Function"; 16483 var tagType = getObjectType3(value); 16484 return tagType || "Object"; 16485} 16486is3.array = Array.isArray; 16487is3.arrayOf = function(target, predicate) { 16488 return !is3.array(target) && !is3.function(predicate) ? !1 : target.every(function(d2) { 16489 return predicate(d2); 16490 }); 16491}; 16492is3.asyncGeneratorFunction = function(value) { 16493 return getObjectType3(value) === "AsyncGeneratorFunction"; 16494}; 16495is3.asyncFunction = isObjectOfType3("AsyncFunction"); 16496is3.bigint = isOfType5("bigint"); 16497is3.boolean = function(value) { 16498 return value === !0 || value === !1; 16499}; 16500is3.date = isObjectOfType3("Date"); 16501is3.defined = function(value) { 16502 return !is3.undefined(value); 16503}; 16504is3.domElement = function(value) { 16505 return is3.object(value) && !is3.plainObject(value) && value.nodeType === 1 && is3.string(value.nodeName) && DOM_PROPERTIES_TO_CHECK3.every(function(property) { 16506 return property in value; 16507 }); 16508}; 16509is3.empty = function(value) { 16510 return is3.string(value) && value.length === 0 || is3.array(value) && value.length === 0 || is3.object(value) && !is3.map(value) && !is3.set(value) && Object.keys(value).length === 0 || is3.set(value) && value.size === 0 || is3.map(value) && value.size === 0; 16511}; 16512is3.error = isObjectOfType3("Error"); 16513is3.function = isOfType5("function"); 16514is3.generator = function(value) { 16515 return is3.iterable(value) && is3.function(value.next) && is3.function(value.throw); 16516}; 16517is3.generatorFunction = isObjectOfType3("GeneratorFunction"); 16518is3.instanceOf = function(instance, class_) { 16519 return !instance || !class_ ? !1 : Object.getPrototypeOf(instance) === class_.prototype; 16520}; 16521is3.iterable = function(value) { 16522 return !is3.nullOrUndefined(value) && is3.function(value[Symbol.iterator]); 16523}; 16524is3.map = isObjectOfType3("Map"); 16525is3.nan = function(value) { 16526 return Number.isNaN(value); 16527}; 16528is3.null = function(value) { 16529 return value === null; 16530}; 16531is3.nullOrUndefined = function(value) { 16532 return is3.null(value) || is3.undefined(value); 16533}; 16534is3.number = function(value) { 16535 return isOfType5("number")(value) && !is3.nan(value); 16536}; 16537is3.numericString = function(value) { 16538 return is3.string(value) && value.length > 0 && !Number.isNaN(Number(value)); 16539}; 16540is3.object = function(value) { 16541 return !is3.nullOrUndefined(value) && (is3.function(value) || typeof value == "object"); 16542}; 16543is3.oneOf = function(target, value) { 16544 return is3.array(target) ? target.indexOf(value) > -1 : !1; 16545}; 16546is3.plainFunction = isObjectOfType3("Function"); 16547is3.plainObject = function(value) { 16548 if (getObjectType3(value) !== "Object") 16549 return !1; 16550 var prototype = Object.getPrototypeOf(value); 16551 return prototype === null || prototype === Object.getPrototypeOf({}); 16552}; 16553is3.primitive = function(value) { 16554 return is3.null(value) || isPrimitiveType3(typeof value); 16555}; 16556is3.promise = isObjectOfType3("Promise"); 16557is3.propertyOf = function(target, key, predicate) { 16558 if (!is3.object(target) || !key) 16559 return !1; 16560 var value = target[key]; 16561 return is3.function(predicate) ? predicate(value) : is3.defined(value); 16562}; 16563is3.regexp = isObjectOfType3("RegExp"); 16564is3.set = isObjectOfType3("Set"); 16565is3.string = isOfType5("string"); 16566is3.symbol = isOfType5("symbol"); 16567is3.undefined = isOfType5("undefined"); 16568is3.weakMap = isObjectOfType3("WeakMap"); 16569is3.weakSet = isObjectOfType3("WeakSet"); 16570var esm_default2 = is3; 16571 16572// ../../node_modules/tree-changes/esm/helpers.js 16573function canHaveLength2() { 16574 for (var arguments_ = [], _i = 0; _i < arguments.length; _i++) 16575 arguments_[_i] = arguments[_i]; 16576 return arguments_.every(function(d2) { 16577 return esm_default2.string(d2) || esm_default2.array(d2) || esm_default2.plainObject(d2); 16578 }); 16579} 16580function checkEquality2(left, right, value) { 16581 return isSameType2(left, right) ? [left, right].every(esm_default2.array) ? !left.some(hasValue2(value)) && right.some(hasValue2(value)) : [left, right].every(esm_default2.plainObject) ? !Object.entries(left).some(hasEntry2(value)) && Object.entries(right).some(hasEntry2(value)) : right === value : !1; 16582} 16583function compareNumbers2(previousData, data, options2) { 16584 var actual = options2.actual, key = options2.key, previous = options2.previous, type = options2.type, left = nested2(previousData, key), right = nested2(data, key), changed = [left, right].every(esm_default2.number) && (type === "increased" ? left < right : left > right); 16585 return esm_default2.undefined(actual) || (changed = changed && right === actual), esm_default2.undefined(previous) || (changed = changed && left === previous), changed; 16586} 16587function compareValues2(previousData, data, options2) { 16588 var key = options2.key, type = options2.type, value = options2.value, left = nested2(previousData, key), right = nested2(data, key), primary = type === "added" ? left : right, secondary = type === "added" ? right : left; 16589 if (!esm_default2.nullOrUndefined(value)) { 16590 if (esm_default2.defined(primary)) { 16591 if (esm_default2.array(primary) || esm_default2.plainObject(primary)) 16592 return checkEquality2(primary, secondary, value); 16593 } else 16594 return equal2(secondary, value); 16595 return !1; 16596 } 16597 return [left, right].every(esm_default2.array) ? !secondary.every(isEqualPredicate2(primary)) : [left, right].every(esm_default2.plainObject) ? hasExtraKeys2(Object.keys(primary), Object.keys(secondary)) : ![left, right].every(function(d2) { 16598 return esm_default2.primitive(d2) && esm_default2.defined(d2); 16599 }) && (type === "added" ? !esm_default2.defined(left) && esm_default2.defined(right) : esm_default2.defined(left) && !esm_default2.defined(right)); 16600} 16601function getIterables2(previousData, data, _a2) { 16602 var _b = _a2 === void 0 ? {} : _a2, key = _b.key, left = nested2(previousData, key), right = nested2(data, key); 16603 if (!isSameType2(left, right)) 16604 throw new TypeError("Inputs have different types"); 16605 if (!canHaveLength2(left, right)) 16606 throw new TypeError("Inputs don't have length"); 16607 return [left, right].every(esm_default2.plainObject) && (left = Object.keys(left), right = Object.keys(right)), [left, right]; 16608} 16609function hasEntry2(input) { 16610 return function(_a2) { 16611 var key = _a2[0], value = _a2[1]; 16612 return esm_default2.array(input) ? equal2(input, value) || input.some(function(d2) { 16613 return equal2(d2, value) || esm_default2.array(value) && isEqualPredicate2(value)(d2); 16614 }) : esm_default2.plainObject(input) && input[key] ? !!input[key] && equal2(input[key], value) : equal2(input, value); 16615 }; 16616} 16617function hasExtraKeys2(left, right) { 16618 return right.some(function(d2) { 16619 return !left.includes(d2); 16620 }); 16621} 16622function hasValue2(input) { 16623 return function(value) { 16624 return esm_default2.array(input) ? input.some(function(d2) { 16625 return equal2(d2, value) || esm_default2.array(value) && isEqualPredicate2(value)(d2); 16626 }) : equal2(input, value); 16627 }; 16628} 16629function includesOrEqualsTo2(previousValue, value) { 16630 return esm_default2.array(previousValue) ? previousValue.some(function(d2) { 16631 return equal2(d2, value); 16632 }) : equal2(previousValue, value); 16633} 16634function isEqualPredicate2(data) { 16635 return function(value) { 16636 return data.some(function(d2) { 16637 return equal2(d2, value); 16638 }); 16639 }; 16640} 16641function isSameType2() { 16642 for (var arguments_ = [], _i = 0; _i < arguments.length; _i++) 16643 arguments_[_i] = arguments[_i]; 16644 return arguments_.every(esm_default2.array) || arguments_.every(esm_default2.number) || arguments_.every(esm_default2.plainObject) || arguments_.every(esm_default2.string); 16645} 16646function nested2(data, property) { 16647 if (esm_default2.plainObject(data) || esm_default2.array(data)) { 16648 if (esm_default2.string(property)) { 16649 var props = property.split("."); 16650 return props.reduce(function(acc, d2) { 16651 return acc && acc[d2]; 16652 }, data); 16653 } 16654 return esm_default2.number(property) ? data[property] : data; 16655 } 16656 return data; 16657} 16658 16659// ../../node_modules/tree-changes/esm/index.js 16660function treeChanges2(previousData, data) { 16661 if ([previousData, data].some(esm_default2.nullOrUndefined)) 16662 throw new Error("Missing required parameters"); 16663 if (![previousData, data].every(function(d2) { 16664 return esm_default2.plainObject(d2) || esm_default2.array(d2); 16665 })) 16666 throw new Error("Expected plain objects or array"); 16667 var added = function(key, value) { 16668 try { 16669 return compareValues2(previousData, data, { key, type: "added", value }); 16670 } catch { 16671 return !1; 16672 } 16673 }, changed = function(key, actual, previous) { 16674 try { 16675 var left = nested2(previousData, key), right = nested2(data, key), hasActual = esm_default2.defined(actual), hasPrevious = esm_default2.defined(previous); 16676 if (hasActual || hasPrevious) { 16677 var leftComparator = hasPrevious ? includesOrEqualsTo2(previous, left) : !includesOrEqualsTo2(actual, left), rightComparator = includesOrEqualsTo2(actual, right); 16678 return leftComparator && rightComparator; 16679 } 16680 return [left, right].every(esm_default2.array) || [left, right].every(esm_default2.plainObject) ? !equal2(left, right) : left !== right; 16681 } catch { 16682 return !1; 16683 } 16684 }, changedFrom = function(key, previous, actual) { 16685 if (!esm_default2.defined(key)) 16686 return !1; 16687 try { 16688 var left = nested2(previousData, key), right = nested2(data, key), hasActual = esm_default2.defined(actual); 16689 return includesOrEqualsTo2(previous, left) && (hasActual ? includesOrEqualsTo2(actual, right) : !hasActual); 16690 } catch { 16691 return !1; 16692 } 16693 }, changedTo = function(key, actual) { 16694 return esm_default2.defined(key) ? changed(key, actual) : !1; 16695 }, decreased = function(key, actual, previous) { 16696 if (!esm_default2.defined(key)) 16697 return !1; 16698 try { 16699 return compareNumbers2(previousData, data, { key, actual, previous, type: "decreased" }); 16700 } catch { 16701 return !1; 16702 } 16703 }, emptied = function(key) { 16704 try { 16705 var _a2 = getIterables2(previousData, data, { key }), left = _a2[0], right = _a2[1]; 16706 return !!left.length && !right.length; 16707 } catch { 16708 return !1; 16709 } 16710 }, filled = function(key) { 16711 try { 16712 var _a2 = getIterables2(previousData, data, { key }), left = _a2[0], right = _a2[1]; 16713 return !left.length && !!right.length; 16714 } catch { 16715 return !1; 16716 } 16717 }, increased = function(key, actual, previous) { 16718 if (!esm_default2.defined(key)) 16719 return !1; 16720 try { 16721 return compareNumbers2(previousData, data, { key, actual, previous, type: "increased" }); 16722 } catch { 16723 return !1; 16724 } 16725 }, removed = function(key, value) { 16726 try { 16727 return compareValues2(previousData, data, { key, type: "removed", value }); 16728 } catch { 16729 return !1; 16730 } 16731 }; 16732 return { added, changed, changedFrom, changedTo, decreased, emptied, filled, increased, removed }; 16733} 16734 16735// ../../node_modules/react-floater/es/index.js 16736function ownKeys(e2, r4) { 16737 var t2 = Object.keys(e2); 16738 if (Object.getOwnPropertySymbols) { 16739 var o3 = Object.getOwnPropertySymbols(e2); 16740 r4 && (o3 = o3.filter(function(r5) { 16741 return Object.getOwnPropertyDescriptor(e2, r5).enumerable; 16742 })), t2.push.apply(t2, o3); 16743 } 16744 return t2; 16745} 16746function _objectSpread2(e2) { 16747 for (var r4 = 1; r4 < arguments.length; r4++) { 16748 var t2 = arguments[r4] != null ? arguments[r4] : {}; 16749 r4 % 2 ? ownKeys(Object(t2), !0).forEach(function(r5) { 16750 _defineProperty(e2, r5, t2[r5]); 16751 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys(Object(t2)).forEach(function(r5) { 16752 Object.defineProperty(e2, r5, Object.getOwnPropertyDescriptor(t2, r5)); 16753 }); 16754 } 16755 return e2; 16756} 16757function _classCallCheck(instance, Constructor) { 16758 if (!(instance instanceof Constructor)) 16759 throw new TypeError("Cannot call a class as a function"); 16760} 16761function _defineProperties(target, props) { 16762 for (var i2 = 0; i2 < props.length; i2++) { 16763 var descriptor = props[i2]; 16764 descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); 16765 } 16766} 16767function _createClass(Constructor, protoProps, staticProps) { 16768 return protoProps && _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), Object.defineProperty(Constructor, "prototype", { 16769 writable: !1 16770 }), Constructor; 16771} 16772function _defineProperty(obj, key, value) { 16773 return key = _toPropertyKey(key), key in obj ? Object.defineProperty(obj, key, { 16774 value, 16775 enumerable: !0, 16776 configurable: !0, 16777 writable: !0 16778 }) : obj[key] = value, obj; 16779} 16780function _inherits(subClass, superClass) { 16781 if (typeof superClass != "function" && superClass !== null) 16782 throw new TypeError("Super expression must either be null or a function"); 16783 subClass.prototype = Object.create(superClass && superClass.prototype, { 16784 constructor: { 16785 value: subClass, 16786 writable: !0, 16787 configurable: !0 16788 } 16789 }), Object.defineProperty(subClass, "prototype", { 16790 writable: !1 16791 }), superClass && _setPrototypeOf2(subClass, superClass); 16792} 16793function _getPrototypeOf2(o3) { 16794 return _getPrototypeOf2 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(o4) { 16795 return o4.__proto__ || Object.getPrototypeOf(o4); 16796 }, _getPrototypeOf2(o3); 16797} 16798function _setPrototypeOf2(o3, p2) { 16799 return _setPrototypeOf2 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(o4, p3) { 16800 return o4.__proto__ = p3, o4; 16801 }, _setPrototypeOf2(o3, p2); 16802} 16803function _isNativeReflectConstruct2() { 16804 if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham) return !1; 16805 if (typeof Proxy == "function") return !0; 16806 try { 16807 return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() { 16808 })), !0; 16809 } catch { 16810 return !1; 16811 } 16812} 16813function _objectWithoutPropertiesLoose(source, excluded) { 16814 if (source == null) return {}; 16815 var target = {}, sourceKeys = Object.keys(source), key, i2; 16816 for (i2 = 0; i2 < sourceKeys.length; i2++) 16817 key = sourceKeys[i2], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]); 16818 return target; 16819} 16820function _objectWithoutProperties(source, excluded) { 16821 if (source == null) return {}; 16822 var target = _objectWithoutPropertiesLoose(source, excluded), key, i2; 16823 if (Object.getOwnPropertySymbols) { 16824 var sourceSymbolKeys = Object.getOwnPropertySymbols(source); 16825 for (i2 = 0; i2 < sourceSymbolKeys.length; i2++) 16826 key = sourceSymbolKeys[i2], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]); 16827 } 16828 return target; 16829} 16830function _assertThisInitialized2(self2) { 16831 if (self2 === void 0) 16832 throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 16833 return self2; 16834} 16835function _possibleConstructorReturn(self2, call) { 16836 if (call && (typeof call == "object" || typeof call == "function")) 16837 return call; 16838 if (call !== void 0) 16839 throw new TypeError("Derived constructors may only return object or undefined"); 16840 return _assertThisInitialized2(self2); 16841} 16842function _createSuper(Derived) { 16843 var hasNativeReflectConstruct = _isNativeReflectConstruct2(); 16844 return function() { 16845 var Super = _getPrototypeOf2(Derived), result; 16846 if (hasNativeReflectConstruct) { 16847 var NewTarget = _getPrototypeOf2(this).constructor; 16848 result = Reflect.construct(Super, arguments, NewTarget); 16849 } else 16850 result = Super.apply(this, arguments); 16851 return _possibleConstructorReturn(this, result); 16852 }; 16853} 16854function _toPrimitive(input, hint) { 16855 if (typeof input != "object" || input === null) return input; 16856 var prim = input[Symbol.toPrimitive]; 16857 if (prim !== void 0) { 16858 var res = prim.call(input, hint || "default"); 16859 if (typeof res != "object") return res; 16860 throw new TypeError("@@toPrimitive must return a primitive value."); 16861 } 16862 return (hint === "string" ? String : Number)(input); 16863} 16864function _toPropertyKey(arg) { 16865 var key = _toPrimitive(arg, "string"); 16866 return typeof key == "symbol" ? key : String(key); 16867} 16868var DEFAULTS = { flip: { padding: 20 }, preventOverflow: { padding: 10 } }, VALIDATOR_ARG_ERROR_MESSAGE = "The typeValidator argument must be a function with the signature function(props, propName, componentName).", MESSAGE_ARG_ERROR_MESSAGE = "The error message is optional, but must be a string if provided."; 16869function propIsRequired(condition, props, propName, componentName2) { 16870 return typeof condition == "boolean" ? condition : typeof condition == "function" ? condition(props, propName, componentName2) : condition ? !!condition : !1; 16871} 16872function propExists(props, propName) { 16873 return Object.hasOwnProperty.call(props, propName); 16874} 16875function missingPropError(props, propName, componentName2, message) { 16876 return message ? new Error(message) : new Error("Required ".concat(props[propName], " `").concat(propName, "` was not specified in `").concat(componentName2, "`.")); 16877} 16878function guardAgainstInvalidArgTypes(typeValidator, message) { 16879 if (typeof typeValidator != "function") 16880 throw new TypeError(VALIDATOR_ARG_ERROR_MESSAGE); 16881 if (message && typeof message != "string") 16882 throw new TypeError(MESSAGE_ARG_ERROR_MESSAGE); 16883} 16884function isRequiredIf(typeValidator, condition, message) { 16885 return guardAgainstInvalidArgTypes(typeValidator, message), function(props, propName, componentName2) { 16886 for (var _len = arguments.length, rest2 = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) 16887 rest2[_key - 3] = arguments[_key]; 16888 return propIsRequired(condition, props, propName, componentName2) ? propExists(props, propName) ? typeValidator.apply(void 0, [props, propName, componentName2].concat(rest2)) : missingPropError(props, propName, componentName2, message) : typeValidator.apply(void 0, [props, propName, componentName2].concat(rest2)); 16889 }; 16890} 16891var STATUS2 = { INIT: "init", IDLE: "idle", OPENING: "opening", OPEN: "open", CLOSING: "closing", ERROR: "error" }, isReact16 = react_dom_default.createPortal !== void 0; 16892function canUseDOM() { 16893 return !!(typeof window < "u" && window.document && window.document.createElement); 16894} 16895function isMobile() { 16896 return "ontouchstart" in window && /Mobi/.test(navigator.userAgent); 16897} 16898function log(_ref) { 16899 var title2 = _ref.title, data = _ref.data, _ref$warn = _ref.warn, warn = _ref$warn === void 0 ? !1 : _ref$warn, _ref$debug = _ref.debug, debug = _ref$debug === void 0 ? !1 : _ref$debug, logFn = warn ? console.warn || console.error : console.log; 16900 debug && title2 && data && (console.groupCollapsed("%creact-floater: ".concat(title2), "color: #9b00ff; font-weight: bold; font-size: 12px;"), Array.isArray(data) ? data.forEach(function(d2) { 16901 esm_default.plainObject(d2) && d2.key ? logFn.apply(console, [d2.key, d2.value]) : logFn.apply(console, [d2]); 16902 }) : logFn.apply(console, [data]), console.groupEnd()); 16903} 16904function on(element, event, cb) { 16905 var capture = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1; 16906 element.addEventListener(event, cb, capture); 16907} 16908function off(element, event, cb) { 16909 var capture = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1; 16910 element.removeEventListener(event, cb, capture); 16911} 16912function once3(element, event, cb) { 16913 var capture = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1, _nextCB; 16914 _nextCB = function(e2) { 16915 cb(e2), off(element, event, _nextCB); 16916 }, on(element, event, _nextCB, capture); 16917} 16918function noop3() { 16919} 16920var ReactFloaterPortal = (function(_React$Component) { 16921 _inherits(ReactFloaterPortal2, _React$Component); 16922 var _super = _createSuper(ReactFloaterPortal2); 16923 function ReactFloaterPortal2() { 16924 return _classCallCheck(this, ReactFloaterPortal2), _super.apply(this, arguments); 16925 } 16926 return _createClass(ReactFloaterPortal2, [{ key: "componentDidMount", value: function() { 16927 canUseDOM() && (this.node || this.appendNode(), isReact16 || this.renderPortal()); 16928 } }, { key: "componentDidUpdate", value: function() { 16929 canUseDOM() && (isReact16 || this.renderPortal()); 16930 } }, { key: "componentWillUnmount", value: function() { 16931 !canUseDOM() || !this.node || (isReact16 || react_dom_default.unmountComponentAtNode(this.node), this.node && this.node.parentNode === document.body && (document.body.removeChild(this.node), this.node = void 0)); 16932 } }, { key: "appendNode", value: function() { 16933 var _this$props = this.props, id = _this$props.id, zIndex = _this$props.zIndex; 16934 this.node || (this.node = document.createElement("div"), id && (this.node.id = id), zIndex && (this.node.style.zIndex = zIndex), document.body.appendChild(this.node)); 16935 } }, { key: "renderPortal", value: function() { 16936 if (!canUseDOM()) return null; 16937 var _this$props2 = this.props, children = _this$props2.children, setRef = _this$props2.setRef; 16938 if (this.node || this.appendNode(), isReact16) 16939 return react_dom_default.createPortal(children, this.node); 16940 var portal = react_dom_default.unstable_renderSubtreeIntoContainer(this, children.length > 1 ? react_default.createElement("div", null, children) : children[0], this.node); 16941 return setRef(portal), null; 16942 } }, { key: "renderReact16", value: function() { 16943 var _this$props3 = this.props, hasChildren = _this$props3.hasChildren, placement = _this$props3.placement, target = _this$props3.target; 16944 return hasChildren ? this.renderPortal() : target || placement === "center" ? this.renderPortal() : null; 16945 } }, { key: "render", value: function() { 16946 return isReact16 ? this.renderReact16() : null; 16947 } }]), ReactFloaterPortal2; 16948})(react_default.Component); 16949_defineProperty(ReactFloaterPortal, "propTypes", { children: import_prop_types2.default.oneOfType([import_prop_types2.default.element, import_prop_types2.default.array]), hasChildren: import_prop_types2.default.bool, id: import_prop_types2.default.oneOfType([import_prop_types2.default.string, import_prop_types2.default.number]), placement: import_prop_types2.default.string, setRef: import_prop_types2.default.func.isRequired, target: import_prop_types2.default.oneOfType([import_prop_types2.default.object, import_prop_types2.default.string]), zIndex: import_prop_types2.default.number }); 16950var FloaterArrow = (function(_React$Component) { 16951 _inherits(FloaterArrow2, _React$Component); 16952 var _super = _createSuper(FloaterArrow2); 16953 function FloaterArrow2() { 16954 return _classCallCheck(this, FloaterArrow2), _super.apply(this, arguments); 16955 } 16956 return _createClass(FloaterArrow2, [{ key: "parentStyle", get: function() { 16957 var _this$props = this.props, placement = _this$props.placement, styles2 = _this$props.styles, length = styles2.arrow.length, arrow2 = { pointerEvents: "none", position: "absolute", width: "100%" }; 16958 return placement.startsWith("top") ? (arrow2.bottom = 0, arrow2.left = 0, arrow2.right = 0, arrow2.height = length) : placement.startsWith("bottom") ? (arrow2.left = 0, arrow2.right = 0, arrow2.top = 0, arrow2.height = length) : placement.startsWith("left") ? (arrow2.right = 0, arrow2.top = 0, arrow2.bottom = 0) : placement.startsWith("right") && (arrow2.left = 0, arrow2.top = 0), arrow2; 16959 } }, { key: "render", value: function() { 16960 var _this$props2 = this.props, placement = _this$props2.placement, setArrowRef = _this$props2.setArrowRef, styles2 = _this$props2.styles, _styles$arrow = styles2.arrow, color2 = _styles$arrow.color, display = _styles$arrow.display, length = _styles$arrow.length, margin = _styles$arrow.margin, position = _styles$arrow.position, spread2 = _styles$arrow.spread, arrowStyles = { display, position }, points, x2 = spread2, y2 = length; 16961 return placement.startsWith("top") ? (points = "0,0 ".concat(x2 / 2, ",").concat(y2, " ").concat(x2, ",0"), arrowStyles.bottom = 0, arrowStyles.marginLeft = margin, arrowStyles.marginRight = margin) : placement.startsWith("bottom") ? (points = "".concat(x2, ",").concat(y2, " ").concat(x2 / 2, ",0 0,").concat(y2), arrowStyles.top = 0, arrowStyles.marginLeft = margin, arrowStyles.marginRight = margin) : placement.startsWith("left") ? (y2 = spread2, x2 = length, points = "0,0 ".concat(x2, ",").concat(y2 / 2, " 0,").concat(y2), arrowStyles.right = 0, arrowStyles.marginTop = margin, arrowStyles.marginBottom = margin) : placement.startsWith("right") && (y2 = spread2, x2 = length, points = "".concat(x2, ",").concat(y2, " ").concat(x2, ",0 0,").concat(y2 / 2), arrowStyles.left = 0, arrowStyles.marginTop = margin, arrowStyles.marginBottom = margin), react_default.createElement("div", { className: "__floater__arrow", style: this.parentStyle }, react_default.createElement("span", { ref: setArrowRef, style: arrowStyles }, react_default.createElement("svg", { width: x2, height: y2, version: "1.1", xmlns: "http://www.w3.org/2000/svg" }, react_default.createElement("polygon", { points, fill: color2 })))); 16962 } }]), FloaterArrow2; 16963})(react_default.Component); 16964_defineProperty(FloaterArrow, "propTypes", { placement: import_prop_types2.default.string.isRequired, setArrowRef: import_prop_types2.default.func.isRequired, styles: import_prop_types2.default.object.isRequired }); 16965var _excluded$1 = ["color", "height", "width"]; 16966function FloaterCloseBtn(_ref) { 16967 var handleClick = _ref.handleClick, styles2 = _ref.styles, color2 = styles2.color, height = styles2.height, width = styles2.width, style = _objectWithoutProperties(styles2, _excluded$1); 16968 return react_default.createElement("button", { "aria-label": "close", onClick: handleClick, style, type: "button" }, react_default.createElement("svg", { width: "".concat(width, "px"), height: "".concat(height, "px"), viewBox: "0 0 18 18", version: "1.1", xmlns: "http://www.w3.org/2000/svg", preserveAspectRatio: "xMidYMid" }, react_default.createElement("g", null, react_default.createElement("path", { d: "M8.13911129,9.00268191 L0.171521827,17.0258467 C-0.0498027049,17.248715 -0.0498027049,17.6098394 0.171521827,17.8327545 C0.28204354,17.9443526 0.427188206,17.9998706 0.572051765,17.9998706 C0.71714958,17.9998706 0.862013139,17.9443526 0.972581703,17.8327545 L9.0000937,9.74924618 L17.0276057,17.8327545 C17.1384085,17.9443526 17.2832721,17.9998706 17.4281356,17.9998706 C17.5729992,17.9998706 17.718097,17.9443526 17.8286656,17.8327545 C18.0499901,17.6098862 18.0499901,17.2487618 17.8286656,17.0258467 L9.86135722,9.00268191 L17.8340066,0.973848225 C18.0553311,0.750979934 18.0553311,0.389855532 17.8340066,0.16694039 C17.6126821,-0.0556467968 17.254037,-0.0556467968 17.0329467,0.16694039 L9.00042166,8.25611765 L0.967006424,0.167268345 C0.745681892,-0.0553188426 0.387317931,-0.0553188426 0.165993399,0.167268345 C-0.0553311331,0.390136635 -0.0553311331,0.751261038 0.165993399,0.974176179 L8.13920499,9.00268191 L8.13911129,9.00268191 Z", fill: color2 })))); 16969} 16970FloaterCloseBtn.propTypes = { handleClick: import_prop_types2.default.func.isRequired, styles: import_prop_types2.default.object.isRequired }; 16971function FloaterContainer(_ref) { 16972 var content = _ref.content, footer = _ref.footer, handleClick = _ref.handleClick, open = _ref.open, positionWrapper = _ref.positionWrapper, showCloseButton = _ref.showCloseButton, title2 = _ref.title, styles2 = _ref.styles, output = { content: react_default.isValidElement(content) ? content : react_default.createElement("div", { className: "__floater__content", style: styles2.content }, content) }; 16973 return title2 && (output.title = react_default.isValidElement(title2) ? title2 : react_default.createElement("div", { className: "__floater__title", style: styles2.title }, title2)), footer && (output.footer = react_default.isValidElement(footer) ? footer : react_default.createElement("div", { className: "__floater__footer", style: styles2.footer }, footer)), (showCloseButton || positionWrapper) && !esm_default.boolean(open) && (output.close = react_default.createElement(FloaterCloseBtn, { styles: styles2.close, handleClick })), react_default.createElement("div", { className: "__floater__container", style: styles2.container }, output.close, output.title, output.content, output.footer); 16974} 16975FloaterContainer.propTypes = { content: import_prop_types2.default.node.isRequired, footer: import_prop_types2.default.node, handleClick: import_prop_types2.default.func.isRequired, open: import_prop_types2.default.bool, positionWrapper: import_prop_types2.default.bool.isRequired, showCloseButton: import_prop_types2.default.bool.isRequired, styles: import_prop_types2.default.object.isRequired, title: import_prop_types2.default.node }; 16976var Floater = (function(_React$Component) { 16977 _inherits(Floater2, _React$Component); 16978 var _super = _createSuper(Floater2); 16979 function Floater2() { 16980 return _classCallCheck(this, Floater2), _super.apply(this, arguments); 16981 } 16982 return _createClass(Floater2, [{ key: "style", get: function() { 16983 var _this$props = this.props, disableAnimation = _this$props.disableAnimation, component = _this$props.component, placement = _this$props.placement, hideArrow = _this$props.hideArrow, status = _this$props.status, styles2 = _this$props.styles, length = styles2.arrow.length, floater = styles2.floater, floaterCentered = styles2.floaterCentered, floaterClosing = styles2.floaterClosing, floaterOpening = styles2.floaterOpening, floaterWithAnimation = styles2.floaterWithAnimation, floaterWithComponent = styles2.floaterWithComponent, element = {}; 16984 return hideArrow || (placement.startsWith("top") ? element.padding = "0 0 ".concat(length, "px") : placement.startsWith("bottom") ? element.padding = "".concat(length, "px 0 0") : placement.startsWith("left") ? element.padding = "0 ".concat(length, "px 0 0") : placement.startsWith("right") && (element.padding = "0 0 0 ".concat(length, "px"))), [STATUS2.OPENING, STATUS2.OPEN].indexOf(status) !== -1 && (element = _objectSpread2(_objectSpread2({}, element), floaterOpening)), status === STATUS2.CLOSING && (element = _objectSpread2(_objectSpread2({}, element), floaterClosing)), status === STATUS2.OPEN && !disableAnimation && (element = _objectSpread2(_objectSpread2({}, element), floaterWithAnimation)), placement === "center" && (element = _objectSpread2(_objectSpread2({}, element), floaterCentered)), component && (element = _objectSpread2(_objectSpread2({}, element), floaterWithComponent)), _objectSpread2(_objectSpread2({}, floater), element); 16985 } }, { key: "render", value: function() { 16986 var _this$props2 = this.props, component = _this$props2.component, closeFn = _this$props2.handleClick, hideArrow = _this$props2.hideArrow, setFloaterRef = _this$props2.setFloaterRef, status = _this$props2.status, output = {}, classes = ["__floater"]; 16987 return component ? react_default.isValidElement(component) ? output.content = react_default.cloneElement(component, { closeFn }) : output.content = component({ closeFn }) : output.content = react_default.createElement(FloaterContainer, this.props), status === STATUS2.OPEN && classes.push("__floater__open"), hideArrow || (output.arrow = react_default.createElement(FloaterArrow, this.props)), react_default.createElement("div", { ref: setFloaterRef, className: classes.join(" "), style: this.style }, react_default.createElement("div", { className: "__floater__body" }, output.content, output.arrow)); 16988 } }]), Floater2; 16989})(react_default.Component); 16990_defineProperty(Floater, "propTypes", { component: import_prop_types2.default.oneOfType([import_prop_types2.default.func, import_prop_types2.default.element]), content: import_prop_types2.default.node, disableAnimation: import_prop_types2.default.bool.isRequired, footer: import_prop_types2.default.node, handleClick: import_prop_types2.default.func.isRequired, hideArrow: import_prop_types2.default.bool.isRequired, open: import_prop_types2.default.bool, placement: import_prop_types2.default.string.isRequired, positionWrapper: import_prop_types2.default.bool.isRequired, setArrowRef: import_prop_types2.default.func.isRequired, setFloaterRef: import_prop_types2.default.func.isRequired, showCloseButton: import_prop_types2.default.bool, status: import_prop_types2.default.string.isRequired, styles: import_prop_types2.default.object.isRequired, title: import_prop_types2.default.node }); 16991var ReactFloaterWrapper = (function(_React$Component) { 16992 _inherits(ReactFloaterWrapper2, _React$Component); 16993 var _super = _createSuper(ReactFloaterWrapper2); 16994 function ReactFloaterWrapper2() { 16995 return _classCallCheck(this, ReactFloaterWrapper2), _super.apply(this, arguments); 16996 } 16997 return _createClass(ReactFloaterWrapper2, [{ key: "render", value: function() { 16998 var _this$props = this.props, children = _this$props.children, handleClick = _this$props.handleClick, handleMouseEnter = _this$props.handleMouseEnter, handleMouseLeave = _this$props.handleMouseLeave, setChildRef = _this$props.setChildRef, setWrapperRef = _this$props.setWrapperRef, style = _this$props.style, styles2 = _this$props.styles, element; 16999 if (children) 17000 if (react_default.Children.count(children) === 1) 17001 if (!react_default.isValidElement(children)) 17002 element = react_default.createElement("span", null, children); 17003 else { 17004 var refProp = esm_default.function(children.type) ? "innerRef" : "ref"; 17005 element = react_default.cloneElement(react_default.Children.only(children), _defineProperty({}, refProp, setChildRef)); 17006 } 17007 else 17008 element = children; 17009 return element ? react_default.createElement("span", { ref: setWrapperRef, style: _objectSpread2(_objectSpread2({}, styles2), style), onClick: handleClick, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave }, element) : null; 17010 } }]), ReactFloaterWrapper2; 17011})(react_default.Component); 17012_defineProperty(ReactFloaterWrapper, "propTypes", { children: import_prop_types2.default.node, handleClick: import_prop_types2.default.func.isRequired, handleMouseEnter: import_prop_types2.default.func.isRequired, handleMouseLeave: import_prop_types2.default.func.isRequired, setChildRef: import_prop_types2.default.func.isRequired, setWrapperRef: import_prop_types2.default.func.isRequired, style: import_prop_types2.default.object, styles: import_prop_types2.default.object.isRequired }); 17013var defaultOptions = { zIndex: 100 }; 17014function getStyles(styles2) { 17015 var options2 = (0, import_deepmerge.default)(defaultOptions, styles2.options || {}); 17016 return { wrapper: { cursor: "help", display: "inline-flex", flexDirection: "column", zIndex: options2.zIndex }, wrapperPosition: { left: -1e3, position: "absolute", top: -1e3, visibility: "hidden" }, floater: { display: "inline-block", filter: "drop-shadow(0 0 3px rgba(0, 0, 0, 0.3))", maxWidth: 300, opacity: 0, position: "relative", transition: "opacity 0.3s", visibility: "hidden", zIndex: options2.zIndex }, floaterOpening: { opacity: 1, visibility: "visible" }, floaterWithAnimation: { opacity: 1, transition: "opacity 0.3s, transform 0.2s", visibility: "visible" }, floaterWithComponent: { maxWidth: "100%" }, floaterClosing: { opacity: 0, visibility: "visible" }, floaterCentered: { left: "50%", position: "fixed", top: "50%", transform: "translate(-50%, -50%)" }, container: { backgroundColor: "#fff", color: "#666", minHeight: 60, minWidth: 200, padding: 20, position: "relative", zIndex: 10 }, title: { borderBottom: "1px solid #555", color: "#555", fontSize: 18, marginBottom: 5, paddingBottom: 6, paddingRight: 18 }, content: { fontSize: 15 }, close: { backgroundColor: "transparent", border: 0, borderRadius: 0, color: "#555", fontSize: 0, height: 15, outline: "none", padding: 10, position: "absolute", right: 0, top: 0, width: 15, WebkitAppearance: "none" }, footer: { borderTop: "1px solid #ccc", fontSize: 13, marginTop: 10, paddingTop: 5 }, arrow: { color: "#fff", display: "inline-flex", length: 16, margin: 8, position: "absolute", spread: 32 }, options: options2 }; 17017} 17018var _excluded = ["arrow", "flip", "offset"], POSITIONING_PROPS = ["position", "top", "right", "bottom", "left"], ReactFloater = (function(_React$Component) { 17019 _inherits(ReactFloater2, _React$Component); 17020 var _super = _createSuper(ReactFloater2); 17021 function ReactFloater2(props) { 17022 var _this; 17023 return _classCallCheck(this, ReactFloater2), _this = _super.call(this, props), _defineProperty(_assertThisInitialized2(_this), "setArrowRef", function(ref) { 17024 _this.arrowRef = ref; 17025 }), _defineProperty(_assertThisInitialized2(_this), "setChildRef", function(ref) { 17026 _this.childRef = ref; 17027 }), _defineProperty(_assertThisInitialized2(_this), "setFloaterRef", function(ref) { 17028 _this.floaterRef = ref; 17029 }), _defineProperty(_assertThisInitialized2(_this), "setWrapperRef", function(ref) { 17030 _this.wrapperRef = ref; 17031 }), _defineProperty(_assertThisInitialized2(_this), "handleTransitionEnd", function() { 17032 var status = _this.state.status, callback = _this.props.callback; 17033 _this.wrapperPopper && _this.wrapperPopper.instance.update(), _this.setState({ status: status === STATUS2.OPENING ? STATUS2.OPEN : STATUS2.IDLE }, function() { 17034 var newStatus = _this.state.status; 17035 callback(newStatus === STATUS2.OPEN ? "open" : "close", _this.props); 17036 }); 17037 }), _defineProperty(_assertThisInitialized2(_this), "handleClick", function() { 17038 var _this$props = _this.props, event = _this$props.event, open = _this$props.open; 17039 if (!esm_default.boolean(open)) { 17040 var _this$state = _this.state, positionWrapper = _this$state.positionWrapper, status = _this$state.status; 17041 (_this.event === "click" || _this.event === "hover" && positionWrapper) && (log({ title: "click", data: [{ event, status: status === STATUS2.OPEN ? "closing" : "opening" }], debug: _this.debug }), _this.toggle()); 17042 } 17043 }), _defineProperty(_assertThisInitialized2(_this), "handleMouseEnter", function() { 17044 var _this$props2 = _this.props, event = _this$props2.event, open = _this$props2.open; 17045 if (!(esm_default.boolean(open) || isMobile())) { 17046 var status = _this.state.status; 17047 _this.event === "hover" && status === STATUS2.IDLE && (log({ title: "mouseEnter", data: [{ key: "originalEvent", value: event }], debug: _this.debug }), clearTimeout(_this.eventDelayTimeout), _this.toggle()); 17048 } 17049 }), _defineProperty(_assertThisInitialized2(_this), "handleMouseLeave", function() { 17050 var _this$props3 = _this.props, event = _this$props3.event, eventDelay = _this$props3.eventDelay, open = _this$props3.open; 17051 if (!(esm_default.boolean(open) || isMobile())) { 17052 var _this$state2 = _this.state, status = _this$state2.status, positionWrapper = _this$state2.positionWrapper; 17053 _this.event === "hover" && (log({ title: "mouseLeave", data: [{ key: "originalEvent", value: event }], debug: _this.debug }), eventDelay ? [STATUS2.OPENING, STATUS2.OPEN].indexOf(status) !== -1 && !positionWrapper && !_this.eventDelayTimeout && (_this.eventDelayTimeout = setTimeout(function() { 17054 delete _this.eventDelayTimeout, _this.toggle(); 17055 }, eventDelay * 1e3)) : _this.toggle(STATUS2.IDLE)); 17056 } 17057 }), _this.state = { currentPlacement: props.placement, needsUpdate: !1, positionWrapper: props.wrapperOptions.position && !!props.target, status: STATUS2.INIT, statusWrapper: STATUS2.INIT }, _this._isMounted = !1, _this.hasMounted = !1, canUseDOM() && window.addEventListener("load", function() { 17058 _this.popper && _this.popper.instance.update(), _this.wrapperPopper && _this.wrapperPopper.instance.update(); 17059 }), _this; 17060 } 17061 return _createClass(ReactFloater2, [{ key: "componentDidMount", value: function() { 17062 if (canUseDOM()) { 17063 var positionWrapper = this.state.positionWrapper, _this$props5 = this.props, children = _this$props5.children, open = _this$props5.open, target = _this$props5.target; 17064 this._isMounted = !0, log({ title: "init", data: { hasChildren: !!children, hasTarget: !!target, isControlled: esm_default.boolean(open), positionWrapper, target: this.target, floater: this.floaterRef }, debug: this.debug }), this.hasMounted || (this.initPopper(), this.hasMounted = !0), !children && target && esm_default.boolean(open); 17065 } 17066 } }, { key: "componentDidUpdate", value: function(prevProps, prevState) { 17067 if (canUseDOM()) { 17068 var _this$props6 = this.props, autoOpen = _this$props6.autoOpen, open = _this$props6.open, target = _this$props6.target, wrapperOptions = _this$props6.wrapperOptions, _treeChanges = treeChanges2(prevState, this.state), changedFrom = _treeChanges.changedFrom, changed = _treeChanges.changed; 17069 if (prevProps.open !== open) { 17070 var forceStatus; 17071 esm_default.boolean(open) && (forceStatus = open ? STATUS2.OPENING : STATUS2.CLOSING), this.toggle(forceStatus); 17072 } 17073 (prevProps.wrapperOptions.position !== wrapperOptions.position || prevProps.target !== target) && this.changeWrapperPosition(this.props), changed("status", STATUS2.IDLE) && open ? this.toggle(STATUS2.OPEN) : changedFrom("status", STATUS2.INIT, STATUS2.IDLE) && autoOpen && this.toggle(STATUS2.OPEN), this.popper && changed("status", STATUS2.OPENING) && this.popper.instance.update(), this.floaterRef && (changed("status", STATUS2.OPENING) || changed("status", STATUS2.CLOSING)) && once3(this.floaterRef, "transitionend", this.handleTransitionEnd), changed("needsUpdate", !0) && this.rebuildPopper(); 17074 } 17075 } }, { key: "componentWillUnmount", value: function() { 17076 canUseDOM() && (this._isMounted = !1, this.popper && this.popper.instance.destroy(), this.wrapperPopper && this.wrapperPopper.instance.destroy()); 17077 } }, { key: "initPopper", value: function() { 17078 var _this2 = this, target = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.target, positionWrapper = this.state.positionWrapper, _this$props7 = this.props, disableFlip = _this$props7.disableFlip, getPopper = _this$props7.getPopper, hideArrow = _this$props7.hideArrow, offset2 = _this$props7.offset, placement = _this$props7.placement, wrapperOptions = _this$props7.wrapperOptions, flipBehavior = placement === "top" || placement === "bottom" ? "flip" : ["right", "bottom-end", "top-end", "left", "top-start", "bottom-start"]; 17079 if (placement === "center") 17080 this.setState({ status: STATUS2.IDLE }); 17081 else if (target && this.floaterRef) { 17082 var _this$options = this.options, arrow2 = _this$options.arrow, flip2 = _this$options.flip, offsetOptions = _this$options.offset, rest2 = _objectWithoutProperties(_this$options, _excluded); 17083 new popper_default(target, this.floaterRef, { placement, modifiers: _objectSpread2({ arrow: _objectSpread2({ enabled: !hideArrow, element: this.arrowRef }, arrow2), flip: _objectSpread2({ enabled: !disableFlip, behavior: flipBehavior }, flip2), offset: _objectSpread2({ offset: "0, ".concat(offset2, "px") }, offsetOptions) }, rest2), onCreate: function(data) { 17084 var _this2$floaterRef; 17085 if (_this2.popper = data, !((_this2$floaterRef = _this2.floaterRef) !== null && _this2$floaterRef !== void 0 && _this2$floaterRef.isConnected)) { 17086 _this2.setState({ needsUpdate: !0 }); 17087 return; 17088 } 17089 getPopper(data, "floater"), _this2._isMounted && _this2.setState({ currentPlacement: data.placement, status: STATUS2.IDLE }), placement !== data.placement && setTimeout(function() { 17090 data.instance.update(); 17091 }, 1); 17092 }, onUpdate: function(data) { 17093 _this2.popper = data; 17094 var currentPlacement = _this2.state.currentPlacement; 17095 _this2._isMounted && data.placement !== currentPlacement && _this2.setState({ currentPlacement: data.placement }); 17096 } }); 17097 } 17098 if (positionWrapper) { 17099 var wrapperOffset = esm_default.undefined(wrapperOptions.offset) ? 0 : wrapperOptions.offset; 17100 new popper_default(this.target, this.wrapperRef, { placement: wrapperOptions.placement || placement, modifiers: { arrow: { enabled: !1 }, offset: { offset: "0, ".concat(wrapperOffset, "px") }, flip: { enabled: !1 } }, onCreate: function(data) { 17101 _this2.wrapperPopper = data, _this2._isMounted && _this2.setState({ statusWrapper: STATUS2.IDLE }), getPopper(data, "wrapper"), placement !== data.placement && setTimeout(function() { 17102 data.instance.update(); 17103 }, 1); 17104 } }); 17105 } 17106 } }, { key: "rebuildPopper", value: function() { 17107 var _this3 = this; 17108 this.floaterRefInterval = setInterval(function() { 17109 var _this3$floaterRef; 17110 (_this3$floaterRef = _this3.floaterRef) !== null && _this3$floaterRef !== void 0 && _this3$floaterRef.isConnected && (clearInterval(_this3.floaterRefInterval), _this3.setState({ needsUpdate: !1 }), _this3.initPopper()); 17111 }, 50); 17112 } }, { key: "changeWrapperPosition", value: function(_ref) { 17113 var target = _ref.target, wrapperOptions = _ref.wrapperOptions; 17114 this.setState({ positionWrapper: wrapperOptions.position && !!target }); 17115 } }, { key: "toggle", value: function(forceStatus) { 17116 var status = this.state.status, nextStatus = status === STATUS2.OPEN ? STATUS2.CLOSING : STATUS2.OPENING; 17117 esm_default.undefined(forceStatus) || (nextStatus = forceStatus), this.setState({ status: nextStatus }); 17118 } }, { key: "debug", get: function() { 17119 var debug = this.props.debug; 17120 return debug || canUseDOM() && "ReactFloaterDebug" in window && !!window.ReactFloaterDebug; 17121 } }, { key: "event", get: function() { 17122 var _this$props8 = this.props, disableHoverToClick = _this$props8.disableHoverToClick, event = _this$props8.event; 17123 return event === "hover" && isMobile() && !disableHoverToClick ? "click" : event; 17124 } }, { key: "options", get: function() { 17125 var options2 = this.props.options; 17126 return (0, import_deepmerge.default)(DEFAULTS, options2 || {}); 17127 } }, { key: "styles", get: function() { 17128 var _this4 = this, _this$state3 = this.state, status = _this$state3.status, positionWrapper = _this$state3.positionWrapper, statusWrapper = _this$state3.statusWrapper, styles2 = this.props.styles, nextStyles = (0, import_deepmerge.default)(getStyles(styles2), styles2); 17129 if (positionWrapper) { 17130 var wrapperStyles; 17131 [STATUS2.IDLE].indexOf(status) === -1 || [STATUS2.IDLE].indexOf(statusWrapper) === -1 ? wrapperStyles = nextStyles.wrapperPosition : wrapperStyles = this.wrapperPopper.styles, nextStyles.wrapper = _objectSpread2(_objectSpread2({}, nextStyles.wrapper), wrapperStyles); 17132 } 17133 if (this.target) { 17134 var targetStyles = window.getComputedStyle(this.target); 17135 this.wrapperStyles ? nextStyles.wrapper = _objectSpread2(_objectSpread2({}, nextStyles.wrapper), this.wrapperStyles) : ["relative", "static"].indexOf(targetStyles.position) === -1 && (this.wrapperStyles = {}, positionWrapper || (POSITIONING_PROPS.forEach(function(d2) { 17136 _this4.wrapperStyles[d2] = targetStyles[d2]; 17137 }), nextStyles.wrapper = _objectSpread2(_objectSpread2({}, nextStyles.wrapper), this.wrapperStyles), this.target.style.position = "relative", this.target.style.top = "auto", this.target.style.right = "auto", this.target.style.bottom = "auto", this.target.style.left = "auto")); 17138 } 17139 return nextStyles; 17140 } }, { key: "target", get: function() { 17141 if (!canUseDOM()) return null; 17142 var target = this.props.target; 17143 return target ? esm_default.domElement(target) ? target : document.querySelector(target) : this.childRef || this.wrapperRef; 17144 } }, { key: "render", value: function() { 17145 var _this$state4 = this.state, currentPlacement = _this$state4.currentPlacement, positionWrapper = _this$state4.positionWrapper, status = _this$state4.status, _this$props9 = this.props, children = _this$props9.children, component = _this$props9.component, content = _this$props9.content, disableAnimation = _this$props9.disableAnimation, footer = _this$props9.footer, hideArrow = _this$props9.hideArrow, id = _this$props9.id, open = _this$props9.open, showCloseButton = _this$props9.showCloseButton, style = _this$props9.style, target = _this$props9.target, title2 = _this$props9.title, wrapper = react_default.createElement(ReactFloaterWrapper, { handleClick: this.handleClick, handleMouseEnter: this.handleMouseEnter, handleMouseLeave: this.handleMouseLeave, setChildRef: this.setChildRef, setWrapperRef: this.setWrapperRef, style, styles: this.styles.wrapper }, children), output = {}; 17146 return positionWrapper ? output.wrapperInPortal = wrapper : output.wrapperAsChildren = wrapper, react_default.createElement("span", null, react_default.createElement(ReactFloaterPortal, { hasChildren: !!children, id, placement: currentPlacement, setRef: this.setFloaterRef, target, zIndex: this.styles.options.zIndex }, react_default.createElement(Floater, { component, content, disableAnimation, footer, handleClick: this.handleClick, hideArrow: hideArrow || currentPlacement === "center", open, placement: currentPlacement, positionWrapper, setArrowRef: this.setArrowRef, setFloaterRef: this.setFloaterRef, showCloseButton, status, styles: this.styles, title: title2 }), output.wrapperInPortal), output.wrapperAsChildren); 17147 } }]), ReactFloater2; 17148})(react_default.Component); 17149_defineProperty(ReactFloater, "propTypes", { autoOpen: import_prop_types2.default.bool, callback: import_prop_types2.default.func, children: import_prop_types2.default.node, component: isRequiredIf(import_prop_types2.default.oneOfType([import_prop_types2.default.func, import_prop_types2.default.element]), function(props) { 17150 return !props.content; 17151}), content: isRequiredIf(import_prop_types2.default.node, function(props) { 17152 return !props.component; 17153}), debug: import_prop_types2.default.bool, disableAnimation: import_prop_types2.default.bool, disableFlip: import_prop_types2.default.bool, disableHoverToClick: import_prop_types2.default.bool, event: import_prop_types2.default.oneOf(["hover", "click"]), eventDelay: import_prop_types2.default.number, footer: import_prop_types2.default.node, getPopper: import_prop_types2.default.func, hideArrow: import_prop_types2.default.bool, id: import_prop_types2.default.oneOfType([import_prop_types2.default.string, import_prop_types2.default.number]), offset: import_prop_types2.default.number, open: import_prop_types2.default.bool, options: import_prop_types2.default.object, placement: import_prop_types2.default.oneOf(["top", "top-start", "top-end", "bottom", "bottom-start", "bottom-end", "left", "left-start", "left-end", "right", "right-start", "right-end", "auto", "center"]), showCloseButton: import_prop_types2.default.bool, style: import_prop_types2.default.object, styles: import_prop_types2.default.object, target: import_prop_types2.default.oneOfType([import_prop_types2.default.object, import_prop_types2.default.string]), title: import_prop_types2.default.node, wrapperOptions: import_prop_types2.default.shape({ offset: import_prop_types2.default.number, placement: import_prop_types2.default.oneOf(["top", "top-start", "top-end", "bottom", "bottom-start", "bottom-end", "left", "left-start", "left-end", "right", "right-start", "right-end", "auto"]), position: import_prop_types2.default.bool }) }); 17154_defineProperty(ReactFloater, "defaultProps", { autoOpen: !1, callback: noop3, debug: !1, disableAnimation: !1, disableFlip: !1, disableHoverToClick: !1, event: "click", eventDelay: 0.4, getPopper: noop3, hideArrow: !1, offset: 15, placement: "bottom", showCloseButton: !1, styles: {}, target: null, wrapperOptions: { position: !1 } }); 17155 17156// ../../node_modules/react-joyride/dist/index.mjs 17157init_react(); 17158init_react(); 17159init_react(); 17160init_react(); 17161var __defProp3 = Object.defineProperty, __defNormalProp2 = (obj, key, value) => key in obj ? __defProp3(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __publicField = (obj, key, value) => __defNormalProp2(obj, typeof key != "symbol" ? key + "" : key, value), ACTIONS = { 17162 INIT: "init", 17163 START: "start", 17164 STOP: "stop", 17165 RESET: "reset", 17166 PREV: "prev", 17167 NEXT: "next", 17168 GO: "go", 17169 CLOSE: "close", 17170 SKIP: "skip", 17171 UPDATE: "update" 17172}, EVENTS = { 17173 TOUR_START: "tour:start", 17174 STEP_BEFORE: "step:before", 17175 BEACON: "beacon", 17176 TOOLTIP: "tooltip", 17177 STEP_AFTER: "step:after", 17178 TOUR_END: "tour:end", 17179 TOUR_STATUS: "tour:status", 17180 TARGET_NOT_FOUND: "error:target_not_found", 17181 ERROR: "error" 17182}, LIFECYCLE = { 17183 INIT: "init", 17184 READY: "ready", 17185 BEACON: "beacon", 17186 TOOLTIP: "tooltip", 17187 COMPLETE: "complete", 17188 ERROR: "error" 17189}; 17190var STATUS3 = { 17191 IDLE: "idle", 17192 READY: "ready", 17193 WAITING: "waiting", 17194 RUNNING: "running", 17195 PAUSED: "paused", 17196 SKIPPED: "skipped", 17197 FINISHED: "finished", 17198 ERROR: "error" 17199}; 17200function canUseDOM2() { 17201 var _a2; 17202 return !!(typeof window < "u" && ((_a2 = window.document) != null && _a2.createElement)); 17203} 17204function getClientRect2(element) { 17205 return element ? element.getBoundingClientRect() : null; 17206} 17207function getDocumentHeight(median = !1) { 17208 let { body, documentElement } = document; 17209 if (!body || !documentElement) 17210 return 0; 17211 if (median) { 17212 let heights = [ 17213 body.scrollHeight, 17214 body.offsetHeight, 17215 documentElement.clientHeight, 17216 documentElement.scrollHeight, 17217 documentElement.offsetHeight 17218 ].sort((a2, b2) => a2 - b2), middle = Math.floor(heights.length / 2); 17219 return heights.length % 2 === 0 ? (heights[middle - 1] + heights[middle]) / 2 : heights[middle]; 17220 } 17221 return Math.max( 17222 body.scrollHeight, 17223 body.offsetHeight, 17224 documentElement.clientHeight, 17225 documentElement.scrollHeight, 17226 documentElement.offsetHeight 17227 ); 17228} 17229function getElement(element) { 17230 if (typeof element == "string") 17231 try { 17232 return document.querySelector(element); 17233 } catch { 17234 return null; 17235 } 17236 return element; 17237} 17238function getStyleComputedProperty2(el) { 17239 return !el || el.nodeType !== 1 ? null : getComputedStyle(el); 17240} 17241function getScrollParent2(element, skipFix, forListener) { 17242 if (!element) 17243 return scrollDocument(); 17244 let parent = (0, import_scrollparent.default)(element); 17245 if (parent) { 17246 if (parent.isSameNode(scrollDocument())) 17247 return forListener ? document : scrollDocument(); 17248 if (!(parent.scrollHeight > parent.offsetHeight) && !skipFix) 17249 return parent.style.overflow = "initial", scrollDocument(); 17250 } 17251 return parent; 17252} 17253function hasCustomScrollParent(element, skipFix) { 17254 if (!element) 17255 return !1; 17256 let parent = getScrollParent2(element, skipFix); 17257 return parent ? !parent.isSameNode(scrollDocument()) : !1; 17258} 17259function hasCustomOffsetParent(element) { 17260 return element.offsetParent !== document.body; 17261} 17262function hasPosition(el, type = "fixed") { 17263 if (!el || !(el instanceof HTMLElement)) 17264 return !1; 17265 let { nodeName } = el, styles2 = getStyleComputedProperty2(el); 17266 return nodeName === "BODY" || nodeName === "HTML" ? !1 : styles2 && styles2.position === type ? !0 : el.parentNode ? hasPosition(el.parentNode, type) : !1; 17267} 17268function isElementVisible(element) { 17269 var _a2; 17270 if (!element) 17271 return !1; 17272 let parentElement = element; 17273 for (; parentElement && parentElement !== document.body; ) { 17274 if (parentElement instanceof HTMLElement) { 17275 let { display, visibility } = getComputedStyle(parentElement); 17276 if (display === "none" || visibility === "hidden") 17277 return !1; 17278 } 17279 parentElement = (_a2 = parentElement.parentElement) != null ? _a2 : null; 17280 } 17281 return !0; 17282} 17283function getElementPosition(element, offset2, skipFix) { 17284 var _a2, _b, _c; 17285 let elementRect = getClientRect2(element), parent = getScrollParent2(element, skipFix), hasScrollParent = hasCustomScrollParent(element, skipFix), isFixedTarget = hasPosition(element), parentTop = 0, top = (_a2 = elementRect?.top) != null ? _a2 : 0; 17286 if (hasScrollParent && isFixedTarget) { 17287 let offsetTop = (_b = element?.offsetTop) != null ? _b : 0, parentScrollTop = (_c = parent?.scrollTop) != null ? _c : 0; 17288 top = offsetTop - parentScrollTop; 17289 } else parent instanceof HTMLElement && (parentTop = parent.scrollTop, !hasScrollParent && !hasPosition(element) && (top += parentTop), parent.isSameNode(scrollDocument()) || (top += scrollDocument().scrollTop)); 17290 return Math.floor(top - offset2); 17291} 17292function getScrollTo(element, offset2, skipFix) { 17293 var _a2; 17294 if (!element) 17295 return 0; 17296 let { offsetTop = 0, scrollTop = 0 } = (_a2 = (0, import_scrollparent.default)(element)) != null ? _a2 : {}, top = element.getBoundingClientRect().top + scrollTop; 17297 offsetTop && (hasCustomScrollParent(element, skipFix) || hasCustomOffsetParent(element)) && (top -= offsetTop); 17298 let output = Math.floor(top - offset2); 17299 return output < 0 ? 0 : output; 17300} 17301function scrollDocument() { 17302 var _a2; 17303 return (_a2 = document.scrollingElement) != null ? _a2 : document.documentElement; 17304} 17305function scrollTo(value, options2) { 17306 let { duration, element } = options2; 17307 return new Promise((resolve, reject) => { 17308 let { scrollTop } = element, limit = value > scrollTop ? value - scrollTop : scrollTop - value; 17309 import_scroll.default.top(element, value, { duration: limit < 100 ? 50 : duration }, (error) => error && error.message !== "Element already at target scroll position" ? reject(error) : resolve()); 17310 }); 17311} 17312var isReact162 = createPortal !== void 0; 17313function getBrowser(userAgent = navigator.userAgent) { 17314 let browser = userAgent; 17315 return typeof window > "u" ? browser = "node" : document.documentMode ? browser = "ie" : /Edge/.test(userAgent) ? browser = "edge" : window.opera || userAgent.includes(" OPR/") ? browser = "opera" : typeof window.InstallTrigger < "u" ? browser = "firefox" : window.chrome ? browser = "chrome" : /(Version\/([\d._]+).*Safari|CriOS|FxiOS| Mobile\/)/.test(userAgent) && (browser = "safari"), browser; 17316} 17317function getObjectType4(value) { 17318 return Object.prototype.toString.call(value).slice(8, -1).toLowerCase(); 17319} 17320function getReactNodeText(input, options2 = {}) { 17321 let { defaultValue, step, steps } = options2, text = (0, import_react_innertext.default)(input); 17322 if (text) 17323 (text.includes("{step}") || text.includes("{steps}")) && step && steps && (text = text.replace("{step}", step.toString()).replace("{steps}", steps.toString())); 17324 else if (isValidElement(input) && !Object.values(input.props).length && getObjectType4(input.type) === "function") { 17325 let component = input.type({}); 17326 text = getReactNodeText(component, options2); 17327 } else 17328 text = (0, import_react_innertext.default)(defaultValue); 17329 return text; 17330} 17331function hasValidKeys(object, keys) { 17332 return !src_default.plainObject(object) || !src_default.array(keys) ? !1 : Object.keys(object).every((d2) => keys.includes(d2)); 17333} 17334function hexToRGB(hex) { 17335 let shorthandRegex = /^#?([\da-f])([\da-f])([\da-f])$/i, properHex = hex.replace(shorthandRegex, (_m, r4, g2, b2) => r4 + r4 + g2 + g2 + b2 + b2), result = /^#?([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i.exec(properHex); 17336 return result ? [parseInt(result[1], 16), parseInt(result[2], 16), parseInt(result[3], 16)] : []; 17337} 17338function hideBeacon(step) { 17339 return step.disableBeacon || step.placement === "center"; 17340} 17341function isLegacy() { 17342 return !["chrome", "safari", "firefox", "opera"].includes(getBrowser()); 17343} 17344function log2({ data, debug = !1, title: title2, warn = !1 }) { 17345 let logFn = warn ? console.warn || console.error : console.log; 17346 debug && (title2 && data ? (console.groupCollapsed( 17347 `%creact-joyride: ${title2}`, 17348 "color: #ff0044; font-weight: bold; font-size: 12px;" 17349 ), Array.isArray(data) ? data.forEach((d2) => { 17350 src_default.plainObject(d2) && d2.key ? logFn.apply(console, [d2.key, d2.value]) : logFn.apply(console, [d2]); 17351 }) : logFn.apply(console, [data]), console.groupEnd()) : console.error("Missing title or data props")); 17352} 17353function objectKeys(input) { 17354 return Object.keys(input); 17355} 17356function omit2(input, ...filter) { 17357 if (!src_default.plainObject(input)) 17358 throw new TypeError("Expected an object"); 17359 let output = {}; 17360 for (let key in input) 17361 ({}).hasOwnProperty.call(input, key) && (filter.includes(key) || (output[key] = input[key])); 17362 return output; 17363} 17364function pick2(input, ...filter) { 17365 if (!src_default.plainObject(input)) 17366 throw new TypeError("Expected an object"); 17367 if (!filter.length) 17368 return input; 17369 let output = {}; 17370 for (let key in input) 17371 ({}).hasOwnProperty.call(input, key) && filter.includes(key) && (output[key] = input[key]); 17372 return output; 17373} 17374function replaceLocaleContent(input, step, steps) { 17375 let replacer = (text) => text.replace("{step}", String(step)).replace("{steps}", String(steps)); 17376 if (getObjectType4(input) === "string") 17377 return replacer(input); 17378 if (!isValidElement(input)) 17379 return input; 17380 let { children } = input.props; 17381 if (getObjectType4(children) === "string" && children.includes("{step}")) 17382 return cloneElement(input, { 17383 children: replacer(children) 17384 }); 17385 if (Array.isArray(children)) 17386 return cloneElement(input, { 17387 children: children.map((child) => typeof child == "string" ? replacer(child) : replaceLocaleContent(child, step, steps)) 17388 }); 17389 if (getObjectType4(input.type) === "function" && !Object.values(input.props).length) { 17390 let component = input.type({}); 17391 return replaceLocaleContent(component, step, steps); 17392 } 17393 return input; 17394} 17395function shouldScroll(options2) { 17396 let { isFirstStep, lifecycle, previousLifecycle, scrollToFirstStep, step, target } = options2; 17397 return !step.disableScrolling && (!isFirstStep || scrollToFirstStep || lifecycle === LIFECYCLE.TOOLTIP) && step.placement !== "center" && (!step.isFixed || !hasPosition(target)) && // fixed steps don't need to scroll 17398 previousLifecycle !== lifecycle && [LIFECYCLE.BEACON, LIFECYCLE.TOOLTIP].includes(lifecycle); 17399} 17400var defaultFloaterProps = { 17401 options: { 17402 preventOverflow: { 17403 boundariesElement: "scrollParent" 17404 } 17405 }, 17406 wrapperOptions: { 17407 offset: -18, 17408 position: !0 17409 } 17410}, defaultLocale = { 17411 back: "Back", 17412 close: "Close", 17413 last: "Last", 17414 next: "Next", 17415 nextLabelWithProgress: "Next (Step {step} of {steps})", 17416 open: "Open the dialog", 17417 skip: "Skip" 17418}, defaultStep = { 17419 event: "click", 17420 placement: "bottom", 17421 offset: 10, 17422 disableBeacon: !1, 17423 disableCloseOnEsc: !1, 17424 disableOverlay: !1, 17425 disableOverlayClose: !1, 17426 disableScrollParentFix: !1, 17427 disableScrolling: !1, 17428 hideBackButton: !1, 17429 hideCloseButton: !1, 17430 hideFooter: !1, 17431 isFixed: !1, 17432 locale: defaultLocale, 17433 showProgress: !1, 17434 showSkipButton: !1, 17435 spotlightClicks: !1, 17436 spotlightPadding: 10 17437}, defaultProps = { 17438 continuous: !1, 17439 debug: !1, 17440 disableCloseOnEsc: !1, 17441 disableOverlay: !1, 17442 disableOverlayClose: !1, 17443 disableScrolling: !1, 17444 disableScrollParentFix: !1, 17445 getHelpers: void 0, 17446 hideBackButton: !1, 17447 run: !0, 17448 scrollOffset: 20, 17449 scrollDuration: 300, 17450 scrollToFirstStep: !1, 17451 showSkipButton: !1, 17452 showProgress: !1, 17453 spotlightClicks: !1, 17454 spotlightPadding: 10, 17455 steps: [] 17456}, defaultOptions2 = { 17457 arrowColor: "#fff", 17458 backgroundColor: "#fff", 17459 beaconSize: 36, 17460 overlayColor: "rgba(0, 0, 0, 0.5)", 17461 primaryColor: "#f04", 17462 spotlightShadow: "0 0 15px rgba(0, 0, 0, 0.5)", 17463 textColor: "#333", 17464 width: 380, 17465 zIndex: 100 17466}, buttonBase = { 17467 backgroundColor: "transparent", 17468 border: 0, 17469 borderRadius: 0, 17470 color: "#555", 17471 cursor: "pointer", 17472 fontSize: 16, 17473 lineHeight: 1, 17474 padding: 8, 17475 WebkitAppearance: "none" 17476}, spotlight = { 17477 borderRadius: 4, 17478 position: "absolute" 17479}; 17480function getStyles2(props, step) { 17481 var _a2, _b, _c, _d, _e; 17482 let { floaterProps, styles: styles2 } = props, mergedFloaterProps = (0, import_deepmerge3.default)((_a2 = step.floaterProps) != null ? _a2 : {}, floaterProps ?? {}), mergedStyles = (0, import_deepmerge3.default)(styles2 ?? {}, (_b = step.styles) != null ? _b : {}), options2 = (0, import_deepmerge3.default)(defaultOptions2, mergedStyles.options || {}), hideBeacon2 = step.placement === "center" || step.disableBeacon, { width } = options2; 17483 window.innerWidth > 480 && (width = 380), "width" in options2 && (width = typeof options2.width == "number" && window.innerWidth < options2.width ? window.innerWidth - 30 : options2.width); 17484 let overlay = { 17485 bottom: 0, 17486 left: 0, 17487 overflow: "hidden", 17488 position: "absolute", 17489 right: 0, 17490 top: 0, 17491 zIndex: options2.zIndex 17492 }, defaultStyles = { 17493 beacon: { 17494 ...buttonBase, 17495 display: hideBeacon2 ? "none" : "inline-block", 17496 height: options2.beaconSize, 17497 position: "relative", 17498 width: options2.beaconSize, 17499 zIndex: options2.zIndex 17500 }, 17501 beaconInner: { 17502 animation: "joyride-beacon-inner 1.2s infinite ease-in-out", 17503 backgroundColor: options2.primaryColor, 17504 borderRadius: "50%", 17505 display: "block", 17506 height: "50%", 17507 left: "50%", 17508 opacity: 0.7, 17509 position: "absolute", 17510 top: "50%", 17511 transform: "translate(-50%, -50%)", 17512 width: "50%" 17513 }, 17514 beaconOuter: { 17515 animation: "joyride-beacon-outer 1.2s infinite ease-in-out", 17516 backgroundColor: `rgba(${hexToRGB(options2.primaryColor).join(",")}, 0.2)`, 17517 border: `2px solid ${options2.primaryColor}`, 17518 borderRadius: "50%", 17519 boxSizing: "border-box", 17520 display: "block", 17521 height: "100%", 17522 left: 0, 17523 opacity: 0.9, 17524 position: "absolute", 17525 top: 0, 17526 transformOrigin: "center", 17527 width: "100%" 17528 }, 17529 tooltip: { 17530 backgroundColor: options2.backgroundColor, 17531 borderRadius: 5, 17532 boxSizing: "border-box", 17533 color: options2.textColor, 17534 fontSize: 16, 17535 maxWidth: "100%", 17536 padding: 15, 17537 position: "relative", 17538 width 17539 }, 17540 tooltipContainer: { 17541 lineHeight: 1.4, 17542 textAlign: "center" 17543 }, 17544 tooltipTitle: { 17545 fontSize: 18, 17546 margin: 0 17547 }, 17548 tooltipContent: { 17549 padding: "20px 10px" 17550 }, 17551 tooltipFooter: { 17552 alignItems: "center", 17553 display: "flex", 17554 justifyContent: "flex-end", 17555 marginTop: 15 17556 }, 17557 tooltipFooterSpacer: { 17558 flex: 1 17559 }, 17560 buttonNext: { 17561 ...buttonBase, 17562 backgroundColor: options2.primaryColor, 17563 borderRadius: 4, 17564 color: "#fff" 17565 }, 17566 buttonBack: { 17567 ...buttonBase, 17568 color: options2.primaryColor, 17569 marginLeft: "auto", 17570 marginRight: 5 17571 }, 17572 buttonClose: { 17573 ...buttonBase, 17574 color: options2.textColor, 17575 height: 14, 17576 padding: 15, 17577 position: "absolute", 17578 right: 0, 17579 top: 0, 17580 width: 14 17581 }, 17582 buttonSkip: { 17583 ...buttonBase, 17584 color: options2.textColor, 17585 fontSize: 14 17586 }, 17587 overlay: { 17588 ...overlay, 17589 backgroundColor: options2.overlayColor, 17590 mixBlendMode: "hard-light" 17591 }, 17592 overlayLegacy: { 17593 ...overlay 17594 }, 17595 overlayLegacyCenter: { 17596 ...overlay, 17597 backgroundColor: options2.overlayColor 17598 }, 17599 spotlight: { 17600 ...spotlight, 17601 backgroundColor: "gray" 17602 }, 17603 spotlightLegacy: { 17604 ...spotlight, 17605 boxShadow: `0 0 0 9999px ${options2.overlayColor}, ${options2.spotlightShadow}` 17606 }, 17607 floaterStyles: { 17608 arrow: { 17609 color: (_e = (_d = (_c = mergedFloaterProps?.styles) == null ? void 0 : _c.arrow) == null ? void 0 : _d.color) != null ? _e : options2.arrowColor 17610 }, 17611 options: { 17612 zIndex: options2.zIndex + 100 17613 } 17614 }, 17615 options: options2 17616 }; 17617 return (0, import_deepmerge3.default)(defaultStyles, mergedStyles); 17618} 17619function getTourProps(props) { 17620 return pick2( 17621 props, 17622 "beaconComponent", 17623 "disableCloseOnEsc", 17624 "disableOverlay", 17625 "disableOverlayClose", 17626 "disableScrolling", 17627 "disableScrollParentFix", 17628 "floaterProps", 17629 "hideBackButton", 17630 "hideCloseButton", 17631 "locale", 17632 "showProgress", 17633 "showSkipButton", 17634 "spotlightClicks", 17635 "spotlightPadding", 17636 "styles", 17637 "tooltipComponent" 17638 ); 17639} 17640function getMergedStep(props, currentStep) { 17641 var _a2, _b, _c, _d, _e, _f; 17642 let step = currentStep ?? {}, mergedStep = import_deepmerge2.default.all([defaultStep, getTourProps(props), step], { 17643 isMergeableObject: src_default.plainObject 17644 }), mergedStyles = getStyles2(props, mergedStep), scrollParent2 = hasCustomScrollParent( 17645 getElement(mergedStep.target), 17646 mergedStep.disableScrollParentFix 17647 ), floaterProps = import_deepmerge2.default.all([ 17648 defaultFloaterProps, 17649 (_a2 = props.floaterProps) != null ? _a2 : {}, 17650 (_b = mergedStep.floaterProps) != null ? _b : {} 17651 ]); 17652 return floaterProps.offset = mergedStep.offset, floaterProps.styles = (0, import_deepmerge2.default)((_c = floaterProps.styles) != null ? _c : {}, mergedStyles.floaterStyles), floaterProps.offset += (_e = (_d = props.spotlightPadding) != null ? _d : mergedStep.spotlightPadding) != null ? _e : 0, mergedStep.placementBeacon && floaterProps.wrapperOptions && (floaterProps.wrapperOptions.placement = mergedStep.placementBeacon), scrollParent2 && floaterProps.options.preventOverflow && (floaterProps.options.preventOverflow.boundariesElement = "window"), { 17653 ...mergedStep, 17654 locale: import_deepmerge2.default.all([defaultLocale, (_f = props.locale) != null ? _f : {}, mergedStep.locale || {}]), 17655 floaterProps, 17656 styles: omit2(mergedStyles, "floaterStyles") 17657 }; 17658} 17659function validateStep(step, debug = !1) { 17660 return src_default.plainObject(step) ? step.target ? !0 : (log2({ 17661 title: "validateStep", 17662 data: "target is missing from the step", 17663 warn: !0, 17664 debug 17665 }), !1) : (log2({ 17666 title: "validateStep", 17667 data: "step must be an object", 17668 warn: !0, 17669 debug 17670 }), !1); 17671} 17672function validateSteps(steps, debug = !1) { 17673 return src_default.array(steps) ? steps.every((d2) => validateStep(d2, debug)) : (log2({ 17674 title: "validateSteps", 17675 data: "steps must be an array", 17676 warn: !0, 17677 debug 17678 }), !1); 17679} 17680var defaultState = { 17681 action: "init", 17682 controlled: !1, 17683 index: 0, 17684 lifecycle: LIFECYCLE.INIT, 17685 origin: null, 17686 size: 0, 17687 status: STATUS3.IDLE 17688}, validKeys = objectKeys(omit2(defaultState, "controlled", "size")), Store = class { 17689 constructor(options2) { 17690 __publicField(this, "beaconPopper"), __publicField(this, "tooltipPopper"), __publicField(this, "data", /* @__PURE__ */ new Map()), __publicField(this, "listener"), __publicField(this, "store", /* @__PURE__ */ new Map()), __publicField(this, "addListener", (listener) => { 17691 this.listener = listener; 17692 }), __publicField(this, "setSteps", (steps2) => { 17693 let { size, status } = this.getState(), state = { 17694 size: steps2.length, 17695 status 17696 }; 17697 this.data.set("steps", steps2), status === STATUS3.WAITING && !size && steps2.length && (state.status = STATUS3.RUNNING), this.setState(state); 17698 }), __publicField(this, "getPopper", (name) => name === "beacon" ? this.beaconPopper : this.tooltipPopper), __publicField(this, "setPopper", (name, popper) => { 17699 name === "beacon" ? this.beaconPopper = popper : this.tooltipPopper = popper; 17700 }), __publicField(this, "cleanupPoppers", () => { 17701 this.beaconPopper = null, this.tooltipPopper = null; 17702 }), __publicField(this, "close", (origin = null) => { 17703 let { index, status } = this.getState(); 17704 status === STATUS3.RUNNING && this.setState({ 17705 ...this.getNextState({ action: ACTIONS.CLOSE, index: index + 1, origin }) 17706 }); 17707 }), __publicField(this, "go", (nextIndex) => { 17708 let { controlled, status } = this.getState(); 17709 if (controlled || status !== STATUS3.RUNNING) 17710 return; 17711 let step = this.getSteps()[nextIndex]; 17712 this.setState({ 17713 ...this.getNextState({ action: ACTIONS.GO, index: nextIndex }), 17714 status: step ? status : STATUS3.FINISHED 17715 }); 17716 }), __publicField(this, "info", () => this.getState()), __publicField(this, "next", () => { 17717 let { index, status } = this.getState(); 17718 status === STATUS3.RUNNING && this.setState(this.getNextState({ action: ACTIONS.NEXT, index: index + 1 })); 17719 }), __publicField(this, "open", () => { 17720 let { status } = this.getState(); 17721 status === STATUS3.RUNNING && this.setState({ 17722 ...this.getNextState({ action: ACTIONS.UPDATE, lifecycle: LIFECYCLE.TOOLTIP }) 17723 }); 17724 }), __publicField(this, "prev", () => { 17725 let { index, status } = this.getState(); 17726 status === STATUS3.RUNNING && this.setState({ 17727 ...this.getNextState({ action: ACTIONS.PREV, index: index - 1 }) 17728 }); 17729 }), __publicField(this, "reset", (restart = !1) => { 17730 let { controlled } = this.getState(); 17731 controlled || this.setState({ 17732 ...this.getNextState({ action: ACTIONS.RESET, index: 0 }), 17733 status: restart ? STATUS3.RUNNING : STATUS3.READY 17734 }); 17735 }), __publicField(this, "skip", () => { 17736 let { status } = this.getState(); 17737 status === STATUS3.RUNNING && this.setState({ 17738 action: ACTIONS.SKIP, 17739 lifecycle: LIFECYCLE.INIT, 17740 status: STATUS3.SKIPPED 17741 }); 17742 }), __publicField(this, "start", (nextIndex) => { 17743 let { index, size } = this.getState(); 17744 this.setState({ 17745 ...this.getNextState( 17746 { 17747 action: ACTIONS.START, 17748 index: src_default.number(nextIndex) ? nextIndex : index 17749 }, 17750 !0 17751 ), 17752 status: size ? STATUS3.RUNNING : STATUS3.WAITING 17753 }); 17754 }), __publicField(this, "stop", (advance = !1) => { 17755 let { index, status } = this.getState(); 17756 [STATUS3.FINISHED, STATUS3.SKIPPED].includes(status) || this.setState({ 17757 ...this.getNextState({ action: ACTIONS.STOP, index: index + (advance ? 1 : 0) }), 17758 status: STATUS3.PAUSED 17759 }); 17760 }), __publicField(this, "update", (state) => { 17761 var _a2, _b; 17762 if (!hasValidKeys(state, validKeys)) 17763 throw new Error(`State is not valid. Valid keys: ${validKeys.join(", ")}`); 17764 this.setState({ 17765 ...this.getNextState( 17766 { 17767 ...this.getState(), 17768 ...state, 17769 action: (_a2 = state.action) != null ? _a2 : ACTIONS.UPDATE, 17770 origin: (_b = state.origin) != null ? _b : null 17771 }, 17772 !0 17773 ) 17774 }); 17775 }); 17776 let { continuous = !1, stepIndex, steps = [] } = options2 ?? {}; 17777 this.setState( 17778 { 17779 action: ACTIONS.INIT, 17780 controlled: src_default.number(stepIndex), 17781 continuous, 17782 index: src_default.number(stepIndex) ? stepIndex : 0, 17783 lifecycle: LIFECYCLE.INIT, 17784 origin: null, 17785 status: steps.length ? STATUS3.READY : STATUS3.IDLE 17786 }, 17787 !0 17788 ), this.beaconPopper = null, this.tooltipPopper = null, this.listener = null, this.setSteps(steps); 17789 } 17790 getState() { 17791 return this.store.size ? { 17792 action: this.store.get("action") || "", 17793 controlled: this.store.get("controlled") || !1, 17794 index: parseInt(this.store.get("index"), 10), 17795 lifecycle: this.store.get("lifecycle") || "", 17796 origin: this.store.get("origin") || null, 17797 size: this.store.get("size") || 0, 17798 status: this.store.get("status") || "" 17799 } : { ...defaultState }; 17800 } 17801 getNextState(state, force = !1) { 17802 var _a2, _b, _c, _d, _e; 17803 let { action, controlled, index, size, status } = this.getState(), newIndex = src_default.number(state.index) ? state.index : index, nextIndex = controlled && !force ? index : Math.min(Math.max(newIndex, 0), size); 17804 return { 17805 action: (_a2 = state.action) != null ? _a2 : action, 17806 controlled, 17807 index: nextIndex, 17808 lifecycle: (_b = state.lifecycle) != null ? _b : LIFECYCLE.INIT, 17809 origin: (_c = state.origin) != null ? _c : null, 17810 size: (_d = state.size) != null ? _d : size, 17811 status: nextIndex === size ? STATUS3.FINISHED : (_e = state.status) != null ? _e : status 17812 }; 17813 } 17814 getSteps() { 17815 let steps = this.data.get("steps"); 17816 return Array.isArray(steps) ? steps : []; 17817 } 17818 hasUpdatedState(oldState) { 17819 let before2 = JSON.stringify(oldState), after2 = JSON.stringify(this.getState()); 17820 return before2 !== after2; 17821 } 17822 setState(nextState, initial = !1) { 17823 let state = this.getState(), { 17824 action, 17825 index, 17826 lifecycle, 17827 origin = null, 17828 size, 17829 status 17830 } = { 17831 ...state, 17832 ...nextState 17833 }; 17834 this.store.set("action", action), this.store.set("index", index), this.store.set("lifecycle", lifecycle), this.store.set("origin", origin), this.store.set("size", size), this.store.set("status", status), initial && (this.store.set("controlled", nextState.controlled), this.store.set("continuous", nextState.continuous)), this.listener && this.hasUpdatedState(state) && this.listener(this.getState()); 17835 } 17836 getHelpers() { 17837 return { 17838 close: this.close, 17839 go: this.go, 17840 info: this.info, 17841 next: this.next, 17842 open: this.open, 17843 prev: this.prev, 17844 reset: this.reset, 17845 skip: this.skip 17846 }; 17847 } 17848}; 17849function createStore(options2) { 17850 return new Store(options2); 17851} 17852function JoyrideSpotlight({ styles: styles2 }) { 17853 return createElement( 17854 "div", 17855 { 17856 key: "JoyrideSpotlight", 17857 className: "react-joyride__spotlight", 17858 "data-test-id": "spotlight", 17859 style: styles2 17860 } 17861 ); 17862} 17863var Spotlight_default = JoyrideSpotlight, JoyrideOverlay = class extends Component { 17864 constructor() { 17865 super(...arguments), __publicField(this, "isActive", !1), __publicField(this, "resizeTimeout"), __publicField(this, "scrollTimeout"), __publicField(this, "scrollParent"), __publicField(this, "state", { 17866 isScrolling: !1, 17867 mouseOverSpotlight: !1, 17868 showSpotlight: !0 17869 }), __publicField(this, "hideSpotlight", () => { 17870 let { continuous, disableOverlay, lifecycle } = this.props, hiddenLifecycles = [ 17871 LIFECYCLE.INIT, 17872 LIFECYCLE.BEACON, 17873 LIFECYCLE.COMPLETE, 17874 LIFECYCLE.ERROR 17875 ]; 17876 return disableOverlay || (continuous ? hiddenLifecycles.includes(lifecycle) : lifecycle !== LIFECYCLE.TOOLTIP); 17877 }), __publicField(this, "handleMouseMove", (event) => { 17878 let { mouseOverSpotlight } = this.state, { height, left, position, top, width } = this.spotlightStyles, offsetY = position === "fixed" ? event.clientY : event.pageY, offsetX = position === "fixed" ? event.clientX : event.pageX, inSpotlightHeight = offsetY >= top && offsetY <= top + height, inSpotlight = offsetX >= left && offsetX <= left + width && inSpotlightHeight; 17879 inSpotlight !== mouseOverSpotlight && this.updateState({ mouseOverSpotlight: inSpotlight }); 17880 }), __publicField(this, "handleScroll", () => { 17881 let { target } = this.props, element = getElement(target); 17882 if (this.scrollParent !== document) { 17883 let { isScrolling } = this.state; 17884 isScrolling || this.updateState({ isScrolling: !0, showSpotlight: !1 }), clearTimeout(this.scrollTimeout), this.scrollTimeout = window.setTimeout(() => { 17885 this.updateState({ isScrolling: !1, showSpotlight: !0 }); 17886 }, 50); 17887 } else hasPosition(element, "sticky") && this.updateState({}); 17888 }), __publicField(this, "handleResize", () => { 17889 clearTimeout(this.resizeTimeout), this.resizeTimeout = window.setTimeout(() => { 17890 this.isActive && this.forceUpdate(); 17891 }, 100); 17892 }); 17893 } 17894 componentDidMount() { 17895 let { debug, disableScrolling, disableScrollParentFix = !1, target } = this.props, element = getElement(target); 17896 this.scrollParent = getScrollParent2(element ?? document.body, disableScrollParentFix, !0), this.isActive = !0, window.addEventListener("resize", this.handleResize); 17897 } 17898 componentDidUpdate(previousProps) { 17899 var _a2; 17900 let { disableScrollParentFix, lifecycle, spotlightClicks, target } = this.props, { changed } = treeChanges(previousProps, this.props); 17901 if (changed("target") || changed("disableScrollParentFix")) { 17902 let element = getElement(target); 17903 this.scrollParent = getScrollParent2(element ?? document.body, disableScrollParentFix, !0); 17904 } 17905 changed("lifecycle", LIFECYCLE.TOOLTIP) && ((_a2 = this.scrollParent) == null || _a2.addEventListener("scroll", this.handleScroll, { passive: !0 }), setTimeout(() => { 17906 let { isScrolling } = this.state; 17907 isScrolling || this.updateState({ showSpotlight: !0 }); 17908 }, 100)), (changed("spotlightClicks") || changed("disableOverlay") || changed("lifecycle")) && (spotlightClicks && lifecycle === LIFECYCLE.TOOLTIP ? window.addEventListener("mousemove", this.handleMouseMove, !1) : lifecycle !== LIFECYCLE.TOOLTIP && window.removeEventListener("mousemove", this.handleMouseMove)); 17909 } 17910 componentWillUnmount() { 17911 var _a2; 17912 this.isActive = !1, window.removeEventListener("mousemove", this.handleMouseMove), window.removeEventListener("resize", this.handleResize), clearTimeout(this.resizeTimeout), clearTimeout(this.scrollTimeout), (_a2 = this.scrollParent) == null || _a2.removeEventListener("scroll", this.handleScroll); 17913 } 17914 get overlayStyles() { 17915 let { mouseOverSpotlight } = this.state, { disableOverlayClose, placement, styles: styles2 } = this.props, baseStyles = styles2.overlay; 17916 return isLegacy() && (baseStyles = placement === "center" ? styles2.overlayLegacyCenter : styles2.overlayLegacy), { 17917 cursor: disableOverlayClose ? "default" : "pointer", 17918 height: getDocumentHeight(), 17919 pointerEvents: mouseOverSpotlight ? "none" : "auto", 17920 ...baseStyles 17921 }; 17922 } 17923 get spotlightStyles() { 17924 var _a2, _b, _c; 17925 let { showSpotlight } = this.state, { 17926 disableScrollParentFix = !1, 17927 spotlightClicks, 17928 spotlightPadding = 0, 17929 styles: styles2, 17930 target 17931 } = this.props, element = getElement(target), elementRect = getClientRect2(element), isFixedTarget = hasPosition(element), top = getElementPosition(element, spotlightPadding, disableScrollParentFix); 17932 return { 17933 ...isLegacy() ? styles2.spotlightLegacy : styles2.spotlight, 17934 height: Math.round(((_a2 = elementRect?.height) != null ? _a2 : 0) + spotlightPadding * 2), 17935 left: Math.round(((_b = elementRect?.left) != null ? _b : 0) - spotlightPadding), 17936 opacity: showSpotlight ? 1 : 0, 17937 pointerEvents: spotlightClicks ? "none" : "auto", 17938 position: isFixedTarget ? "fixed" : "absolute", 17939 top, 17940 transition: "opacity 0.2s", 17941 width: Math.round(((_c = elementRect?.width) != null ? _c : 0) + spotlightPadding * 2) 17942 }; 17943 } 17944 updateState(state) { 17945 this.isActive && this.setState((previousState) => ({ ...previousState, ...state })); 17946 } 17947 render() { 17948 let { showSpotlight } = this.state, { onClickOverlay, placement } = this.props, { hideSpotlight, overlayStyles, spotlightStyles } = this; 17949 if (hideSpotlight()) 17950 return null; 17951 let spotlight2 = placement !== "center" && showSpotlight && createElement(Spotlight_default, { styles: spotlightStyles }); 17952 if (getBrowser() === "safari") { 17953 let { mixBlendMode, zIndex, ...safariOverlay } = overlayStyles; 17954 spotlight2 = createElement("div", { style: { ...safariOverlay } }, spotlight2), delete overlayStyles.backgroundColor; 17955 } 17956 return createElement( 17957 "div", 17958 { 17959 className: "react-joyride__overlay", 17960 "data-test-id": "overlay", 17961 onClick: onClickOverlay, 17962 role: "presentation", 17963 style: overlayStyles 17964 }, 17965 spotlight2 17966 ); 17967 } 17968}, JoyridePortal = class extends Component { 17969 constructor() { 17970 super(...arguments), __publicField(this, "node", null); 17971 } 17972 componentDidMount() { 17973 let { id } = this.props; 17974 canUseDOM2() && (this.node = document.createElement("div"), this.node.id = id, document.body.appendChild(this.node), isReact162 || this.renderReact15()); 17975 } 17976 componentDidUpdate() { 17977 canUseDOM2() && (isReact162 || this.renderReact15()); 17978 } 17979 componentWillUnmount() { 17980 !canUseDOM2() || !this.node || (isReact162 || unmountComponentAtNode(this.node), this.node.parentNode === document.body && (document.body.removeChild(this.node), this.node = null)); 17981 } 17982 renderReact15() { 17983 if (!canUseDOM2()) 17984 return; 17985 let { children } = this.props; 17986 this.node && unstable_renderSubtreeIntoContainer(this, children, this.node); 17987 } 17988 renderReact16() { 17989 if (!canUseDOM2() || !isReact162) 17990 return null; 17991 let { children } = this.props; 17992 return this.node ? createPortal(children, this.node) : null; 17993 } 17994 render() { 17995 return isReact162 ? this.renderReact16() : null; 17996 } 17997}, Scope = class { 17998 constructor(element, options2) { 17999 if (__publicField(this, "element"), __publicField(this, "options"), __publicField(this, "canBeTabbed", (element2) => { 18000 let { tabIndex } = element2; 18001 return tabIndex === null || tabIndex < 0 ? !1 : this.canHaveFocus(element2); 18002 }), __publicField(this, "canHaveFocus", (element2) => { 18003 let validTabNodes = /input|select|textarea|button|object/, nodeName = element2.nodeName.toLowerCase(); 18004 return (validTabNodes.test(nodeName) && !element2.getAttribute("disabled") || nodeName === "a" && !!element2.getAttribute("href")) && this.isVisible(element2); 18005 }), __publicField(this, "findValidTabElements", () => [].slice.call(this.element.querySelectorAll("*"), 0).filter(this.canBeTabbed)), __publicField(this, "handleKeyDown", (event) => { 18006 let { code = "Tab" } = this.options; 18007 event.code === code && this.interceptTab(event); 18008 }), __publicField(this, "interceptTab", (event) => { 18009 event.preventDefault(); 18010 let elements = this.findValidTabElements(), { shiftKey } = event; 18011 if (!elements.length) 18012 return; 18013 let x2 = document.activeElement ? elements.indexOf(document.activeElement) : 0; 18014 x2 === -1 || !shiftKey && x2 + 1 === elements.length ? x2 = 0 : shiftKey && x2 === 0 ? x2 = elements.length - 1 : x2 += shiftKey ? -1 : 1, elements[x2].focus(); 18015 }), __publicField(this, "isHidden", (element2) => { 18016 let noSize = element2.offsetWidth <= 0 && element2.offsetHeight <= 0, style = window.getComputedStyle(element2); 18017 return noSize && !element2.innerHTML ? !0 : noSize && style.getPropertyValue("overflow") !== "visible" || style.getPropertyValue("display") === "none"; 18018 }), __publicField(this, "isVisible", (element2) => { 18019 let parentElement = element2; 18020 for (; parentElement; ) 18021 if (parentElement instanceof HTMLElement) { 18022 if (parentElement === document.body) 18023 break; 18024 if (this.isHidden(parentElement)) 18025 return !1; 18026 parentElement = parentElement.parentNode; 18027 } 18028 return !0; 18029 }), __publicField(this, "removeScope", () => { 18030 window.removeEventListener("keydown", this.handleKeyDown); 18031 }), __publicField(this, "checkFocus", (target) => { 18032 document.activeElement !== target && (target.focus(), window.requestAnimationFrame(() => this.checkFocus(target))); 18033 }), __publicField(this, "setFocus", () => { 18034 let { selector } = this.options; 18035 if (!selector) 18036 return; 18037 let target = this.element.querySelector(selector); 18038 target && window.requestAnimationFrame(() => this.checkFocus(target)); 18039 }), !(element instanceof HTMLElement)) 18040 throw new TypeError("Invalid parameter: element must be an HTMLElement"); 18041 this.element = element, this.options = options2, window.addEventListener("keydown", this.handleKeyDown, !1), this.setFocus(); 18042 } 18043}, JoyrideBeacon = class extends Component { 18044 constructor(props) { 18045 if (super(props), __publicField(this, "beacon", null), __publicField(this, "setBeaconRef", (c2) => { 18046 this.beacon = c2; 18047 }), props.beaconComponent) 18048 return; 18049 let head = document.head || document.getElementsByTagName("head")[0], style = document.createElement("style"); 18050 style.id = "joyride-beacon-animation", props.nonce && style.setAttribute("nonce", props.nonce), style.appendChild(document.createTextNode(` 18051 @keyframes joyride-beacon-inner { 18052 20% { 18053 opacity: 0.9; 18054 } 18055 18056 90% { 18057 opacity: 0.7; 18058 } 18059 } 18060 18061 @keyframes joyride-beacon-outer { 18062 0% { 18063 transform: scale(1); 18064 } 18065 18066 45% { 18067 opacity: 0.7; 18068 transform: scale(0.75); 18069 } 18070 18071 100% { 18072 opacity: 0.9; 18073 transform: scale(1); 18074 } 18075 } 18076 `)), head.appendChild(style); 18077 } 18078 componentDidMount() { 18079 let { shouldFocus } = this.props; 18080 setTimeout(() => { 18081 src_default.domElement(this.beacon) && shouldFocus && this.beacon.focus(); 18082 }, 0); 18083 } 18084 componentWillUnmount() { 18085 let style = document.getElementById("joyride-beacon-animation"); 18086 style?.parentNode && style.parentNode.removeChild(style); 18087 } 18088 render() { 18089 let { 18090 beaconComponent, 18091 continuous, 18092 index, 18093 isLastStep, 18094 locale, 18095 onClickOrHover, 18096 size, 18097 step, 18098 styles: styles2 18099 } = this.props, title2 = getReactNodeText(locale.open), sharedProps = { 18100 "aria-label": title2, 18101 onClick: onClickOrHover, 18102 onMouseEnter: onClickOrHover, 18103 ref: this.setBeaconRef, 18104 title: title2 18105 }, component; 18106 return beaconComponent ? component = createElement( 18107 beaconComponent, 18108 { 18109 continuous, 18110 index, 18111 isLastStep, 18112 size, 18113 step, 18114 ...sharedProps 18115 } 18116 ) : component = createElement( 18117 "button", 18118 { 18119 key: "JoyrideBeacon", 18120 className: "react-joyride__beacon", 18121 "data-test-id": "button-beacon", 18122 style: styles2.beacon, 18123 type: "button", 18124 ...sharedProps 18125 }, 18126 createElement("span", { style: styles2.beaconInner }), 18127 createElement("span", { style: styles2.beaconOuter }) 18128 ), component; 18129 } 18130}; 18131function JoyrideTooltipCloseButton({ styles: styles2, ...props }) { 18132 let { color: color2, height, width, ...style } = styles2; 18133 return react_default.createElement("button", { style, type: "button", ...props }, react_default.createElement( 18134 "svg", 18135 { 18136 height: typeof height == "number" ? `${height}px` : height, 18137 preserveAspectRatio: "xMidYMid", 18138 version: "1.1", 18139 viewBox: "0 0 18 18", 18140 width: typeof width == "number" ? `${width}px` : width, 18141 xmlns: "http://www.w3.org/2000/svg" 18142 }, 18143 react_default.createElement("g", null, react_default.createElement( 18144 "path", 18145 { 18146 d: "M8.13911129,9.00268191 L0.171521827,17.0258467 C-0.0498027049,17.248715 -0.0498027049,17.6098394 0.171521827,17.8327545 C0.28204354,17.9443526 0.427188206,17.9998706 0.572051765,17.9998706 C0.71714958,17.9998706 0.862013139,17.9443526 0.972581703,17.8327545 L9.0000937,9.74924618 L17.0276057,17.8327545 C17.1384085,17.9443526 17.2832721,17.9998706 17.4281356,17.9998706 C17.5729992,17.9998706 17.718097,17.9443526 17.8286656,17.8327545 C18.0499901,17.6098862 18.0499901,17.2487618 17.8286656,17.0258467 L9.86135722,9.00268191 L17.8340066,0.973848225 C18.0553311,0.750979934 18.0553311,0.389855532 17.8340066,0.16694039 C17.6126821,-0.0556467968 17.254037,-0.0556467968 17.0329467,0.16694039 L9.00042166,8.25611765 L0.967006424,0.167268345 C0.745681892,-0.0553188426 0.387317931,-0.0553188426 0.165993399,0.167268345 C-0.0553311331,0.390136635 -0.0553311331,0.751261038 0.165993399,0.974176179 L8.13920499,9.00268191 L8.13911129,9.00268191 Z", 18147 fill: color2 18148 } 18149 )) 18150 )); 18151} 18152var CloseButton_default = JoyrideTooltipCloseButton; 18153function JoyrideTooltipContainer(props) { 18154 let { backProps, closeProps, index, isLastStep, primaryProps, skipProps, step, tooltipProps } = props, { content, hideBackButton, hideCloseButton, hideFooter, showSkipButton, styles: styles2, title: title2 } = step, output = {}; 18155 return output.primary = createElement( 18156 "button", 18157 { 18158 "data-test-id": "button-primary", 18159 style: styles2.buttonNext, 18160 type: "button", 18161 ...primaryProps 18162 } 18163 ), showSkipButton && !isLastStep && (output.skip = createElement( 18164 "button", 18165 { 18166 "aria-live": "off", 18167 "data-test-id": "button-skip", 18168 style: styles2.buttonSkip, 18169 type: "button", 18170 ...skipProps 18171 } 18172 )), !hideBackButton && index > 0 && (output.back = createElement("button", { "data-test-id": "button-back", style: styles2.buttonBack, type: "button", ...backProps })), output.close = !hideCloseButton && createElement(CloseButton_default, { "data-test-id": "button-close", styles: styles2.buttonClose, ...closeProps }), createElement( 18173 "div", 18174 { 18175 key: "JoyrideTooltip", 18176 "aria-label": getReactNodeText(title2 ?? content), 18177 className: "react-joyride__tooltip", 18178 style: styles2.tooltip, 18179 ...tooltipProps 18180 }, 18181 createElement("div", { style: styles2.tooltipContainer }, title2 && createElement("h1", { "aria-label": getReactNodeText(title2), style: styles2.tooltipTitle }, title2), createElement("div", { style: styles2.tooltipContent }, content)), 18182 !hideFooter && createElement("div", { style: styles2.tooltipFooter }, createElement("div", { style: styles2.tooltipFooterSpacer }, output.skip), output.back, output.primary), 18183 output.close 18184 ); 18185} 18186var Container_default = JoyrideTooltipContainer, JoyrideTooltip = class extends Component { 18187 constructor() { 18188 super(...arguments), __publicField(this, "handleClickBack", (event) => { 18189 event.preventDefault(); 18190 let { helpers } = this.props; 18191 helpers.prev(); 18192 }), __publicField(this, "handleClickClose", (event) => { 18193 event.preventDefault(); 18194 let { helpers } = this.props; 18195 helpers.close("button_close"); 18196 }), __publicField(this, "handleClickPrimary", (event) => { 18197 event.preventDefault(); 18198 let { continuous, helpers } = this.props; 18199 if (!continuous) { 18200 helpers.close("button_primary"); 18201 return; 18202 } 18203 helpers.next(); 18204 }), __publicField(this, "handleClickSkip", (event) => { 18205 event.preventDefault(); 18206 let { helpers } = this.props; 18207 helpers.skip(); 18208 }), __publicField(this, "getElementsProps", () => { 18209 let { continuous, index, isLastStep, setTooltipRef, size, step } = this.props, { back, close, last, next, nextLabelWithProgress, skip } = step.locale, backText = getReactNodeText(back), closeText = getReactNodeText(close), lastText = getReactNodeText(last), nextText = getReactNodeText(next), skipText = getReactNodeText(skip), primary = close, primaryText = closeText; 18210 if (continuous) { 18211 if (primary = next, primaryText = nextText, step.showProgress && !isLastStep) { 18212 let labelWithProgress = getReactNodeText(nextLabelWithProgress, { 18213 step: index + 1, 18214 steps: size 18215 }); 18216 primary = replaceLocaleContent(nextLabelWithProgress, index + 1, size), primaryText = labelWithProgress; 18217 } 18218 isLastStep && (primary = last, primaryText = lastText); 18219 } 18220 return { 18221 backProps: { 18222 "aria-label": backText, 18223 children: back, 18224 "data-action": "back", 18225 onClick: this.handleClickBack, 18226 role: "button", 18227 title: backText 18228 }, 18229 closeProps: { 18230 "aria-label": closeText, 18231 children: close, 18232 "data-action": "close", 18233 onClick: this.handleClickClose, 18234 role: "button", 18235 title: closeText 18236 }, 18237 primaryProps: { 18238 "aria-label": primaryText, 18239 children: primary, 18240 "data-action": "primary", 18241 onClick: this.handleClickPrimary, 18242 role: "button", 18243 title: primaryText 18244 }, 18245 skipProps: { 18246 "aria-label": skipText, 18247 children: skip, 18248 "data-action": "skip", 18249 onClick: this.handleClickSkip, 18250 role: "button", 18251 title: skipText 18252 }, 18253 tooltipProps: { 18254 "aria-modal": !0, 18255 ref: setTooltipRef, 18256 role: "alertdialog" 18257 } 18258 }; 18259 }); 18260 } 18261 render() { 18262 let { continuous, index, isLastStep, setTooltipRef, size, step } = this.props, { beaconComponent, tooltipComponent, ...cleanStep } = step, component; 18263 if (tooltipComponent) { 18264 let renderProps = { 18265 ...this.getElementsProps(), 18266 continuous, 18267 index, 18268 isLastStep, 18269 size, 18270 step: cleanStep, 18271 setTooltipRef 18272 }; 18273 component = createElement(tooltipComponent, { ...renderProps }); 18274 } else 18275 component = createElement( 18276 Container_default, 18277 { 18278 ...this.getElementsProps(), 18279 continuous, 18280 index, 18281 isLastStep, 18282 size, 18283 step 18284 } 18285 ); 18286 return component; 18287 } 18288}, JoyrideStep = class extends Component { 18289 constructor() { 18290 super(...arguments), __publicField(this, "scope", null), __publicField(this, "tooltip", null), __publicField(this, "handleClickHoverBeacon", (event) => { 18291 let { step, store: store2 } = this.props; 18292 event.type === "mouseenter" && step.event !== "hover" || store2.update({ lifecycle: LIFECYCLE.TOOLTIP }); 18293 }), __publicField(this, "setTooltipRef", (element) => { 18294 this.tooltip = element; 18295 }), __publicField(this, "setPopper", (popper, type) => { 18296 var _a2; 18297 let { action, lifecycle, step, store: store2 } = this.props; 18298 type === "wrapper" ? store2.setPopper("beacon", popper) : store2.setPopper("tooltip", popper), store2.getPopper("beacon") && (store2.getPopper("tooltip") || step.placement === "center") && lifecycle === LIFECYCLE.INIT && store2.update({ 18299 action, 18300 lifecycle: LIFECYCLE.READY 18301 }), (_a2 = step.floaterProps) != null && _a2.getPopper && step.floaterProps.getPopper(popper, type); 18302 }), __publicField(this, "renderTooltip", (renderProps) => { 18303 let { continuous, helpers, index, size, step } = this.props; 18304 return createElement( 18305 JoyrideTooltip, 18306 { 18307 continuous, 18308 helpers, 18309 index, 18310 isLastStep: index + 1 === size, 18311 setTooltipRef: this.setTooltipRef, 18312 size, 18313 step, 18314 ...renderProps 18315 } 18316 ); 18317 }); 18318 } 18319 componentDidMount() { 18320 let { debug, index } = this.props; 18321 log2({ 18322 title: `step:${index}`, 18323 data: [{ key: "props", value: this.props }], 18324 debug 18325 }); 18326 } 18327 componentDidUpdate(previousProps) { 18328 var _a2; 18329 let { 18330 action, 18331 callback, 18332 continuous, 18333 controlled, 18334 debug, 18335 helpers, 18336 index, 18337 lifecycle, 18338 shouldScroll: shouldScroll2, 18339 status, 18340 step, 18341 store: store2 18342 } = this.props, { changed, changedFrom } = treeChanges(previousProps, this.props), state = helpers.info(), skipBeacon = continuous && action !== ACTIONS.CLOSE && (index > 0 || action === ACTIONS.PREV), hasStoreChanged = changed("action") || changed("index") || changed("lifecycle") || changed("status"), isInitial = changedFrom("lifecycle", [LIFECYCLE.TOOLTIP, LIFECYCLE.INIT], LIFECYCLE.INIT), isAfterAction = changed("action", [ 18343 ACTIONS.NEXT, 18344 ACTIONS.PREV, 18345 ACTIONS.SKIP, 18346 ACTIONS.CLOSE 18347 ]), isControlled = controlled && index === previousProps.index; 18348 if (isAfterAction && (isInitial || isControlled) && callback({ 18349 ...state, 18350 index: previousProps.index, 18351 lifecycle: LIFECYCLE.COMPLETE, 18352 step: previousProps.step, 18353 type: EVENTS.STEP_AFTER 18354 }), step.placement === "center" && status === STATUS3.RUNNING && changed("index") && action !== ACTIONS.START && lifecycle === LIFECYCLE.INIT && store2.update({ lifecycle: LIFECYCLE.READY }), hasStoreChanged) { 18355 let element = getElement(step.target), elementExists = !!element; 18356 elementExists && isElementVisible(element) ? (changedFrom("status", STATUS3.READY, STATUS3.RUNNING) || changedFrom("lifecycle", LIFECYCLE.INIT, LIFECYCLE.READY)) && callback({ 18357 ...state, 18358 step, 18359 type: EVENTS.STEP_BEFORE 18360 }) : (console.warn(elementExists ? "Target not visible" : "Target not mounted", step), callback({ 18361 ...state, 18362 type: EVENTS.TARGET_NOT_FOUND, 18363 step 18364 }), controlled || store2.update({ index: index + (action === ACTIONS.PREV ? -1 : 1) })); 18365 } 18366 changedFrom("lifecycle", LIFECYCLE.INIT, LIFECYCLE.READY) && store2.update({ 18367 lifecycle: hideBeacon(step) || skipBeacon ? LIFECYCLE.TOOLTIP : LIFECYCLE.BEACON 18368 }), changed("index") && log2({ 18369 title: `step:${lifecycle}`, 18370 data: [{ key: "props", value: this.props }], 18371 debug 18372 }), changed("lifecycle", LIFECYCLE.BEACON) && callback({ 18373 ...state, 18374 step, 18375 type: EVENTS.BEACON 18376 }), changed("lifecycle", LIFECYCLE.TOOLTIP) && (callback({ 18377 ...state, 18378 step, 18379 type: EVENTS.TOOLTIP 18380 }), shouldScroll2 && this.tooltip && (this.scope = new Scope(this.tooltip, { selector: "[data-action=primary]" }), this.scope.setFocus())), changedFrom("lifecycle", [LIFECYCLE.TOOLTIP, LIFECYCLE.INIT], LIFECYCLE.INIT) && ((_a2 = this.scope) == null || _a2.removeScope(), store2.cleanupPoppers()); 18381 } 18382 componentWillUnmount() { 18383 var _a2; 18384 (_a2 = this.scope) == null || _a2.removeScope(); 18385 } 18386 get open() { 18387 let { lifecycle, step } = this.props; 18388 return hideBeacon(step) || lifecycle === LIFECYCLE.TOOLTIP; 18389 } 18390 render() { 18391 let { continuous, debug, index, nonce, shouldScroll: shouldScroll2, size, step } = this.props, target = getElement(step.target); 18392 return !validateStep(step) || !src_default.domElement(target) ? null : createElement("div", { key: `JoyrideStep-${index}`, className: "react-joyride__step" }, createElement( 18393 ReactFloater, 18394 { 18395 ...step.floaterProps, 18396 component: this.renderTooltip, 18397 debug, 18398 getPopper: this.setPopper, 18399 id: `react-joyride-step-${index}`, 18400 open: this.open, 18401 placement: step.placement, 18402 target: step.target 18403 }, 18404 createElement( 18405 JoyrideBeacon, 18406 { 18407 beaconComponent: step.beaconComponent, 18408 continuous, 18409 index, 18410 isLastStep: index + 1 === size, 18411 locale: step.locale, 18412 nonce, 18413 onClickOrHover: this.handleClickHoverBeacon, 18414 shouldFocus: shouldScroll2, 18415 size, 18416 step, 18417 styles: step.styles 18418 } 18419 ) 18420 )); 18421 } 18422}, Joyride = class extends Component { 18423 constructor(props) { 18424 super(props), __publicField(this, "helpers"), __publicField(this, "store"), __publicField(this, "callback", (data) => { 18425 let { callback } = this.props; 18426 src_default.function(callback) && callback(data); 18427 }), __publicField(this, "handleKeyboard", (event) => { 18428 let { index, lifecycle } = this.state, { steps } = this.props, step = steps[index]; 18429 lifecycle === LIFECYCLE.TOOLTIP && event.code === "Escape" && step && !step.disableCloseOnEsc && this.store.close("keyboard"); 18430 }), __publicField(this, "handleClickOverlay", () => { 18431 let { index } = this.state, { steps } = this.props; 18432 getMergedStep(this.props, steps[index]).disableOverlayClose || this.helpers.close("overlay"); 18433 }), __publicField(this, "syncState", (state) => { 18434 this.setState(state); 18435 }); 18436 let { debug, getHelpers, run = !0, stepIndex } = props; 18437 this.store = createStore({ 18438 ...props, 18439 controlled: run && src_default.number(stepIndex) 18440 }), this.helpers = this.store.getHelpers(); 18441 let { addListener } = this.store; 18442 log2({ 18443 title: "init", 18444 data: [ 18445 { key: "props", value: this.props }, 18446 { key: "state", value: this.state } 18447 ], 18448 debug 18449 }), addListener(this.syncState), getHelpers && getHelpers(this.helpers), this.state = this.store.getState(); 18450 } 18451 componentDidMount() { 18452 if (!canUseDOM2()) 18453 return; 18454 let { debug, disableCloseOnEsc, run, steps } = this.props, { start } = this.store; 18455 validateSteps(steps, debug) && run && start(), disableCloseOnEsc || document.body.addEventListener("keydown", this.handleKeyboard, { passive: !0 }); 18456 } 18457 componentDidUpdate(previousProps, previousState) { 18458 if (!canUseDOM2()) 18459 return; 18460 let { action, controlled, index, status } = this.state, { debug, run, stepIndex, steps } = this.props, { stepIndex: previousStepIndex, steps: previousSteps } = previousProps, { reset, setSteps, start, stop, update: update2 } = this.store, { changed: changedProps } = treeChanges(previousProps, this.props), { changed, changedFrom } = treeChanges(previousState, this.state), step = getMergedStep(this.props, steps[index]), stepsChanged = !equal(previousSteps, steps), stepIndexChanged = src_default.number(stepIndex) && changedProps("stepIndex"), target = getElement(step.target); 18461 if (stepsChanged && (validateSteps(steps, debug) ? setSteps(steps) : console.warn("Steps are not valid", steps)), changedProps("run") && (run ? start(stepIndex) : stop()), stepIndexChanged) { 18462 let nextAction = src_default.number(previousStepIndex) && previousStepIndex < stepIndex ? ACTIONS.NEXT : ACTIONS.PREV; 18463 action === ACTIONS.STOP && (nextAction = ACTIONS.START), [STATUS3.FINISHED, STATUS3.SKIPPED].includes(status) || update2({ 18464 action: action === ACTIONS.CLOSE ? ACTIONS.CLOSE : nextAction, 18465 index: stepIndex, 18466 lifecycle: LIFECYCLE.INIT 18467 }); 18468 } 18469 !controlled && status === STATUS3.RUNNING && index === 0 && !target && (this.store.update({ index: index + 1 }), this.callback({ 18470 ...this.state, 18471 type: EVENTS.TARGET_NOT_FOUND, 18472 step 18473 })); 18474 let callbackData = { 18475 ...this.state, 18476 index, 18477 step 18478 }; 18479 if (changed("action", [ 18480 ACTIONS.NEXT, 18481 ACTIONS.PREV, 18482 ACTIONS.SKIP, 18483 ACTIONS.CLOSE 18484 ]) && changed("status", STATUS3.PAUSED)) { 18485 let previousStep = getMergedStep(this.props, steps[previousState.index]); 18486 this.callback({ 18487 ...callbackData, 18488 index: previousState.index, 18489 lifecycle: LIFECYCLE.COMPLETE, 18490 step: previousStep, 18491 type: EVENTS.STEP_AFTER 18492 }); 18493 } 18494 if (changed("status", [STATUS3.FINISHED, STATUS3.SKIPPED])) { 18495 let previousStep = getMergedStep(this.props, steps[previousState.index]); 18496 controlled || this.callback({ 18497 ...callbackData, 18498 index: previousState.index, 18499 lifecycle: LIFECYCLE.COMPLETE, 18500 step: previousStep, 18501 type: EVENTS.STEP_AFTER 18502 }), this.callback({ 18503 ...callbackData, 18504 type: EVENTS.TOUR_END, 18505 // Return the last step when the tour is finished 18506 step: previousStep, 18507 index: previousState.index 18508 }), reset(); 18509 } else changedFrom("status", [STATUS3.IDLE, STATUS3.READY], STATUS3.RUNNING) ? this.callback({ 18510 ...callbackData, 18511 type: EVENTS.TOUR_START 18512 }) : (changed("status") || changed("action", ACTIONS.RESET)) && this.callback({ 18513 ...callbackData, 18514 type: EVENTS.TOUR_STATUS 18515 }); 18516 this.scrollToStep(previousState); 18517 } 18518 componentWillUnmount() { 18519 let { disableCloseOnEsc } = this.props; 18520 disableCloseOnEsc || document.body.removeEventListener("keydown", this.handleKeyboard); 18521 } 18522 scrollToStep(previousState) { 18523 let { index, lifecycle, status } = this.state, { 18524 debug, 18525 disableScrollParentFix = !1, 18526 scrollDuration, 18527 scrollOffset = 20, 18528 scrollToFirstStep = !1, 18529 steps 18530 } = this.props, step = getMergedStep(this.props, steps[index]), target = getElement(step.target), shouldScrollToStep = shouldScroll({ 18531 isFirstStep: index === 0, 18532 lifecycle, 18533 previousLifecycle: previousState.lifecycle, 18534 scrollToFirstStep, 18535 step, 18536 target 18537 }); 18538 if (status === STATUS3.RUNNING && shouldScrollToStep) { 18539 let hasCustomScroll = hasCustomScrollParent(target, disableScrollParentFix), scrollParent2 = getScrollParent2(target, disableScrollParentFix), scrollY = Math.floor(getScrollTo(target, scrollOffset, disableScrollParentFix)) || 0; 18540 log2({ 18541 title: "scrollToStep", 18542 data: [ 18543 { key: "index", value: index }, 18544 { key: "lifecycle", value: lifecycle }, 18545 { key: "status", value: status } 18546 ], 18547 debug 18548 }); 18549 let beaconPopper = this.store.getPopper("beacon"), tooltipPopper = this.store.getPopper("tooltip"); 18550 if (lifecycle === LIFECYCLE.BEACON && beaconPopper) { 18551 let { offsets, placement } = beaconPopper; 18552 !["bottom"].includes(placement) && !hasCustomScroll && (scrollY = Math.floor(offsets.popper.top - scrollOffset)); 18553 } else if (lifecycle === LIFECYCLE.TOOLTIP && tooltipPopper) { 18554 let { flipped, offsets, placement } = tooltipPopper; 18555 ["top", "right", "left"].includes(placement) && !flipped && !hasCustomScroll ? scrollY = Math.floor(offsets.popper.top - scrollOffset) : scrollY -= step.spotlightPadding; 18556 } 18557 scrollY = scrollY >= 0 ? scrollY : 0, status === STATUS3.RUNNING && scrollTo(scrollY, { element: scrollParent2, duration: scrollDuration }).then( 18558 () => { 18559 setTimeout(() => { 18560 var _a2; 18561 (_a2 = this.store.getPopper("tooltip")) == null || _a2.instance.update(); 18562 }, 10); 18563 } 18564 ); 18565 } 18566 } 18567 render() { 18568 if (!canUseDOM2()) 18569 return null; 18570 let { index, lifecycle, status } = this.state, { 18571 continuous = !1, 18572 debug = !1, 18573 nonce, 18574 scrollToFirstStep = !1, 18575 steps 18576 } = this.props, isRunning = status === STATUS3.RUNNING, content = {}; 18577 if (isRunning && steps[index]) { 18578 let step = getMergedStep(this.props, steps[index]); 18579 content.step = createElement( 18580 JoyrideStep, 18581 { 18582 ...this.state, 18583 callback: this.callback, 18584 continuous, 18585 debug, 18586 helpers: this.helpers, 18587 nonce, 18588 shouldScroll: !step.disableScrolling && (index !== 0 || scrollToFirstStep), 18589 step, 18590 store: this.store 18591 } 18592 ), content.overlay = createElement(JoyridePortal, { id: "react-joyride-portal" }, createElement( 18593 JoyrideOverlay, 18594 { 18595 ...step, 18596 continuous, 18597 debug, 18598 lifecycle, 18599 onClickOverlay: this.handleClickOverlay 18600 } 18601 )); 18602 } 18603 return createElement("div", { className: "react-joyride" }, content.step, content.overlay); 18604 } 18605}; 18606__publicField(Joyride, "defaultProps", defaultProps); 18607var components_default2 = Joyride; 18608 18609// src/manager/components/TourGuide/HighlightElement.tsx 18610init_react(); 18611var HIGHLIGHT_KEYFRAMES_ID = "storybook-highlight-element-keyframes", keyframes2 = ` 18612 @keyframes sb-highlight-pulsate { 18613 0% { 18614 box-shadow: rgba(2,156,253,1) 0 0 2px 1px, 0 0 0 0 rgba(2, 156, 253, 0.7), 0 0 0 0 rgba(2, 156, 253, 0.4); 18615 } 18616 50% { 18617 box-shadow: rgba(2,156,253,1) 0 0 2px 1px, 0 0 0 20px rgba(2, 156, 253, 0), 0 0 0 40px rgba(2, 156, 253, 0); 18618 } 18619 100% { 18620 box-shadow: rgba(2,156,253,1) 0 0 2px 1px, 0 0 0 0 rgba(2, 156, 253, 0), 0 0 0 0 rgba(2, 156, 253, 0); 18621 } 18622 } 18623`, createOverlay = (element) => { 18624 let overlay = document.createElement("div"); 18625 return overlay.id = "storybook-highlight-element", overlay.style.position = "fixed", overlay.style.pointerEvents = "none", overlay.style.zIndex = "2147483647", overlay.style.transition = "opacity 0.2s ease-in-out", requestAnimationFrame(() => { 18626 updateOverlayStyles(element, overlay), element.scrollIntoView({ behavior: "smooth", block: "center" }); 18627 }), overlay; 18628}, updateOverlayStyles = (element, overlay) => { 18629 let rect = element.getBoundingClientRect(), computedStyle = window.getComputedStyle(element); 18630 overlay.style.top = `${rect.top}px`, overlay.style.left = `${rect.left}px`, overlay.style.width = `${rect.width}px`, overlay.style.height = `${rect.height}px`, overlay.style.borderRadius = computedStyle.borderRadius; 18631}, findScrollableAncestors = (element) => { 18632 let scrollableAncestors = [window], parent = element.parentElement; 18633 for (; parent; ) { 18634 let style = window.getComputedStyle(parent); 18635 (style.overflow === "auto" || style.overflow === "scroll" || style.overflowX === "auto" || style.overflowX === "scroll" || style.overflowY === "auto" || style.overflowY === "scroll") && scrollableAncestors.push(parent), parent = parent.parentElement; 18636 } 18637 return scrollableAncestors; 18638}; 18639function HighlightElement({ 18640 targetSelector, 18641 pulsating = !1 18642}) { 18643 return useEffect(() => { 18644 let element = document.querySelector(targetSelector); 18645 if (!element || !element.parentElement) 18646 return; 18647 let overlay = document.body.appendChild(createOverlay(element)); 18648 if (pulsating) { 18649 if (!document.getElementById(HIGHLIGHT_KEYFRAMES_ID)) { 18650 let style = document.createElement("style"); 18651 style.id = HIGHLIGHT_KEYFRAMES_ID, style.innerHTML = keyframes2, document.head.appendChild(style); 18652 } 18653 overlay.style.animation = "sb-highlight-pulsate 3s infinite", overlay.style.transformOrigin = "center", overlay.style.animationTimingFunction = "ease-in-out"; 18654 } else 18655 overlay.style.boxShadow = "rgba(2,156,253,1) 0 0 2px 1px"; 18656 let scrollTimeout = null, handleScroll = () => { 18657 overlay.parentElement && overlay.remove(), scrollTimeout !== null && clearTimeout(scrollTimeout), scrollTimeout = window.setTimeout(() => { 18658 element && (updateOverlayStyles(element, overlay), overlay.style.opacity = "0", document.body.appendChild(overlay), requestAnimationFrame(() => overlay.style.opacity = "1")); 18659 }, 150); 18660 }, resizeObserver = new ResizeObserver( 18661 () => overlay.parentElement && updateOverlayStyles(element, overlay) 18662 ); 18663 resizeObserver.observe(window.document.body), resizeObserver.observe(element); 18664 let scrollContainers = findScrollableAncestors(element); 18665 return scrollContainers.forEach( 18666 (el) => el.addEventListener("scroll", handleScroll, { passive: !0 }) 18667 ), scrollContainers.filter((el) => el !== window).forEach((el) => resizeObserver.observe(el)), () => { 18668 scrollTimeout !== null && clearTimeout(scrollTimeout), overlay.parentElement && overlay.remove(), scrollContainers.forEach((el) => el.removeEventListener("scroll", handleScroll)), resizeObserver.disconnect(); 18669 }; 18670 }, [targetSelector, pulsating]), null; 18671} 18672 18673// src/manager/components/TourGuide/TourTooltip.tsx 18674init_react(); 18675var ONBOARDING_ARROW_STYLE_ID = "storybook-onboarding-arrow-style", TooltipBody = styled.div` 18676 padding: 15px; 18677 border-radius: 5px; 18678`, Wrapper4 = styled.div` 18679 display: flex; 18680 flex-direction: column; 18681 align-items: flex-start; 18682`, TooltipHeader = styled.div` 18683 display: flex; 18684 align-items: center; 18685 align-self: stretch; 18686 justify-content: space-between; 18687 margin: -5px -5px 5px 0; 18688`, TooltipTitle = styled.div` 18689 line-height: 18px; 18690 font-weight: 700; 18691 font-size: 14px; 18692 margin: 5px 5px 5px 0; 18693`, TooltipContent = styled.p` 18694 font-size: 14px; 18695 line-height: 18px; 18696 text-align: start; 18697 text-wrap: balance; 18698 margin: 0; 18699 margin-top: 5px; 18700`, TooltipFooter = styled.div` 18701 display: flex; 18702 align-items: center; 18703 justify-content: space-between; 18704 margin-top: 15px; 18705`, Count = styled.span` 18706 font-size: 13px; 18707`, NextButton = styled(Button)(({ theme }) => ({ 18708 background: theme.color.lightest, 18709 border: "none", 18710 boxShadow: "none", 18711 color: theme.base === "light" ? theme.color.secondary : curriedDarken$1(0.18, theme.color.secondary), 18712 "&:hover, &:focus": { 18713 background: curriedTransparentize$1(0.1, theme.color.lightest), 18714 color: theme.base === "light" ? curriedLighten$1(0.1, theme.color.secondary) : curriedDarken$1(0.3, theme.color.secondary) 18715 } 18716})), TourTooltip = ({ 18717 index, 18718 size, 18719 step, 18720 closeProps, 18721 primaryProps, 18722 tooltipProps 18723}) => (useEffect(() => { 18724 let style = document.createElement("style"); 18725 return style.id = ONBOARDING_ARROW_STYLE_ID, style.innerHTML = ` 18726 .__floater__arrow { container-type: size; } 18727 .__floater__arrow span { background: ${color.secondary}; } 18728 .__floater__arrow span::before, .__floater__arrow span::after { 18729 content: ''; 18730 display: block; 18731 width: 2px; 18732 height: 2px; 18733 background: ${color.secondary}; 18734 box-shadow: 0 0 0 2px ${color.secondary}; 18735 border-radius: 3px; 18736 flex: 0 0 2px; 18737 } 18738 @container (min-height: 1px) { 18739 .__floater__arrow span { flex-direction: column; } 18740 } 18741 `, document.head.appendChild(style), () => document.getElementById(ONBOARDING_ARROW_STYLE_ID)?.remove(); 18742}, []), react_default.createElement(TooltipBody, { ...tooltipProps, style: step.styles?.tooltip }, react_default.createElement(Wrapper4, null, react_default.createElement(TooltipHeader, null, step.title && react_default.createElement(TooltipTitle, null, step.title), react_default.createElement( 18743 Button, 18744 { 18745 ...closeProps, 18746 onClick: closeProps.onClick, 18747 variant: "solid", 18748 padding: "small", 18749 ariaLabel: "Close" 18750 }, 18751 react_default.createElement(CloseAltIcon, null) 18752)), react_default.createElement(TooltipContent, null, step.content)), react_default.createElement(TooltipFooter, { id: "buttonNext" }, react_default.createElement(Count, null, index + 1, " of ", size), !step.hideNextButton && react_default.createElement(NextButton, { ...primaryProps }, index + 1 === size ? "Done" : "Next")))); 18753 18754// src/manager/components/TourGuide/TourGuide.tsx 18755var TourGuide = ({ 18756 step, 18757 steps, 18758 onNext, 18759 onComplete, 18760 onDismiss 18761}) => { 18762 let [stepIndex, setStepIndex] = useState(step ? null : 0), theme = useTheme(), timeoutRef = useRef(void 0), updateStepIndex = useCallback((index) => { 18763 clearTimeout(timeoutRef.current), setStepIndex((current) => index === -1 ? null : current === null || current === index ? index : (timeoutRef.current = setTimeout(setStepIndex, 300, index), null)); 18764 }, []); 18765 useEffect( 18766 () => step ? updateStepIndex(steps.findIndex(({ key }) => key === step)) : void 0, 18767 [step, steps, updateStepIndex] 18768 ); 18769 let mappedSteps = useMemo(() => steps.map((step2, index) => { 18770 let next = () => updateStepIndex(index + 1); 18771 return { 18772 disableBeacon: !0, 18773 disableOverlay: !0, 18774 spotlightClicks: !0, 18775 offset: 0, 18776 ...step2, 18777 content: react_default.createElement(react_default.Fragment, null, step2.content, step2.highlight && react_default.createElement(HighlightElement, { targetSelector: step2.highlight, pulsating: !0 })), 18778 onNext: step2.onNext ? () => step2.onNext?.({ next }) : onNext && (() => onNext?.({ next })) 18779 }; 18780 }), [steps, onNext, updateStepIndex]), callback = useCallback( 18781 (data) => { 18782 data.action === ACTIONS.NEXT && data.lifecycle === "complete" && (data.index === data.size - 1 ? onComplete?.() : data.step?.onNext ? data.step.onNext() : updateStepIndex(data.index + 1)), data.action === ACTIONS.CLOSE && onDismiss?.(); 18783 }, 18784 [onComplete, onDismiss, updateStepIndex] 18785 ); 18786 return stepIndex === null ? null : react_default.createElement( 18787 components_default2, 18788 { 18789 continuous: !0, 18790 steps: mappedSteps, 18791 stepIndex, 18792 spotlightPadding: 0, 18793 disableCloseOnEsc: !0, 18794 disableOverlayClose: !0, 18795 disableScrolling: !0, 18796 callback, 18797 tooltipComponent: TourTooltip, 18798 floaterProps: { 18799 disableAnimation: !0, 18800 styles: { 18801 arrow: { 18802 length: 20, 18803 spread: 2 18804 }, 18805 floater: { 18806 filter: theme.base === "light" ? "drop-shadow(0px 5px 5px rgba(0,0,0,0.05)) drop-shadow(0 1px 3px rgba(0,0,0,0.1))" : "drop-shadow(#fff5 0px 0px 0.5px) drop-shadow(#fff5 0px 0px 0.5px)" 18807 } 18808 } 18809 }, 18810 styles: { 18811 overlay: { 18812 mixBlendMode: "unset", 18813 backgroundColor: steps[stepIndex]?.target === "body" ? "rgba(27, 28, 29, 0.2)" : "none" 18814 }, 18815 spotlight: { 18816 backgroundColor: "none", 18817 border: `solid 2px ${theme.base === "light" ? theme.color.secondary : curriedDarken$1(0.18, theme.color.secondary)}`, 18818 boxShadow: "0px 0px 0px 9999px rgba(27, 28, 29, 0.2)" 18819 }, 18820 tooltip: { 18821 width: 280, 18822 color: theme.color.lightest, 18823 background: theme.base === "light" ? theme.color.secondary : curriedDarken$1(0.18, theme.color.secondary) 18824 }, 18825 options: { 18826 zIndex: 9998, 18827 primaryColor: theme.base === "light" ? theme.color.secondary : curriedDarken$1(0.18, theme.color.secondary), 18828 arrowColor: theme.base === "light" ? theme.color.secondary : curriedDarken$1(0.18, theme.color.secondary) 18829 } 18830 } 18831 } 18832 ); 18833}, root = null; 18834TourGuide.render = (props) => { 18835 let container = document.getElementById("storybook-tour"); 18836 container || (container = document.createElement("div"), container.id = "storybook-tour", document.body.appendChild(container)), root = root ?? createRoot(container), root.render( 18837 props ? react_default.createElement(ThemeProvider, { theme: convert(themes.light) }, react_default.createElement( 18838 TourGuide, 18839 { 18840 ...props, 18841 onComplete: () => { 18842 props.onComplete?.(), root?.render(null), root = null; 18843 }, 18844 onDismiss: () => { 18845 props.onDismiss?.(), root?.render(null), root = null; 18846 } 18847 } 18848 )) : null 18849 ); 18850}; 18851 18852// src/manager/hooks/useLocation.ts 18853init_react(); 18854var LocationMonitor = { 18855 _currentHref: globalThis.window?.location.href ?? "", 18856 _intervalId: null, 18857 _listeners: /* @__PURE__ */ new Set(), 18858 start() { 18859 this._intervalId === null && (this._intervalId = setInterval(() => { 18860 let newLocation = globalThis.window.location; 18861 newLocation.href !== this._currentHref && (this._currentHref = newLocation.href, this._listeners.forEach((listener) => listener(newLocation))); 18862 }, 100)); 18863 }, 18864 stop() { 18865 this._intervalId !== null && (clearInterval(this._intervalId), this._intervalId = null); 18866 }, 18867 subscribe(...listeners) { 18868 return listeners.forEach((listener) => this._listeners.add(listener)), this.start(), () => { 18869 listeners.forEach((listener) => this._listeners.delete(listener)), this._listeners.size === 0 && this.stop(); 18870 }; 18871 } 18872}, useLocationHash = () => { 18873 let [hash, setHash] = useState(globalThis.window?.location.hash ?? ""); 18874 return useEffect(() => LocationMonitor.subscribe((location2) => setHash(location2.hash)), []), hash.slice(1); 18875}; 18876 18877// src/shared/utils/ai-prompts.ts 18878var DEFAULT_STORYBOOK_EXECUTOR = "npx storybook"; 18879function getAiSetupPrompt(executor = DEFAULT_STORYBOOK_EXECUTOR) { 18880 return `Run \`${executor} ai setup\` and follow its instructions precisely.`; 18881} 18882 18883// src/shared/checklist-store/checklistData.tsx 18884var CodeWrapper = styled.div(({ theme }) => ({ 18885 alignSelf: "stretch", 18886 background: theme.background.content, 18887 borderRadius: theme.appBorderRadius, 18888 margin: "5px 0", 18889 padding: 10, 18890 fontSize: theme.typography.size.s1, 18891 ".linenumber": { 18892 opacity: 0.5 18893 } 18894})), CodeSnippet = (props) => react_default.createElement(ThemeProvider, { theme: convert(themes.dark) }, react_default.createElement(CodeWrapper, null, react_default.createElement(SyntaxHighlighter, { ...props }))), isExample = (id) => id.startsWith("example-") || id.startsWith("configure-your-project--"), subscribeToIndex = (condition) => ({ api, done }) => { 18895 let check = () => condition( 18896 Object.entries(api.getIndex()?.entries || {}).reduce( 18897 (acc, [id, entry]) => isExample(entry.id) ? acc : Object.assign(acc, { [id]: entry }), 18898 {} 18899 ) 18900 ); 18901 if (check()) 18902 done(); 18903 else 18904 return api.once(PREVIEW_INITIALIZED, () => check() && done()), api.on(STORY_INDEX_INVALIDATED, () => check() && done()); 18905}, checklistData = { 18906 sections: [ 18907 { 18908 id: "basics", 18909 title: "Storybook basics", 18910 items: [ 18911 { 18912 id: "aiSetup", 18913 label: "Set up with AI", 18914 icon: WandIcon, 18915 available: ({ storeState }) => !!storeState.aiOptIn && storeState.items.aiSetup?.status !== "done", 18916 criteria: "ai setup command has not been run yet", 18917 showOnGuidePage: !1, 18918 action: { 18919 label: "Copy prompt", 18920 copyContent: getAiSetupPrompt(), 18921 onClick: ({ api }) => { 18922 api.emit(AI_PROMPT_NUDGE, { id: "setup", origin: "onboarding-checklist-side" }); 18923 } 18924 } 18925 }, 18926 { 18927 id: "guidedTour", 18928 label: "Take the guided tour", 18929 available: ({ index }) => !!index && "example-button--primary" in index && !!globalThis?.FEATURES?.controls && addons.experimental_getRegisteredAddons().includes(ADDON_ID3), 18930 criteria: "Guided tour is completed", 18931 subscribe: ({ api, accept }) => api.on(ADDON_ONBOARDING_CHANNEL, ({ step, type }) => { 18932 type !== "dismiss" && ["6:IntentSurvey", "7:FinishedOnboarding"].includes(step) && accept(); 18933 }), 18934 action: { 18935 label: "Start", 18936 onClick: ({ api }) => { 18937 api.toggleNav(!0); 18938 let path = api.getUrlState().path || ""; 18939 path.startsWith("/story/") ? document.location.href = `/?path=${path}&onboarding=true` : document.location.href = "/?onboarding=true"; 18940 } 18941 } 18942 }, 18943 { 18944 id: "onboardingSurvey", 18945 label: "Complete the onboarding survey", 18946 available: () => addons.experimental_getRegisteredAddons().includes(ADDON_ID3), 18947 afterCompletion: "immutable", 18948 criteria: "Onboarding survey is completed", 18949 subscribe: ({ api, accept }) => api.on(ADDON_ONBOARDING_CHANNEL, ({ type }) => type === "survey" && accept()), 18950 action: { 18951 label: "Open", 18952 onClick: ({ api }) => { 18953 let path = api.getUrlState().path || ""; 18954 document.location.href = `/?path=${path}&onboarding=survey`; 18955 } 18956 } 18957 }, 18958 { 18959 id: "renderComponent", 18960 label: "Render your first component", 18961 criteria: "A story finished rendering successfully", 18962 subscribe: ({ api, done }) => api.on( 18963 STORY_FINISHED, 18964 ({ storyId, status }) => status === "success" && !isExample(storyId) && done() 18965 ), 18966 content: ({ api }) => react_default.createElement(react_default.Fragment, null, react_default.createElement("p", null, "Storybook renders your components in isolation, using stories. That allows you to work on the bit of UI you need, without worrying about the rest of the app."), react_default.createElement("p", null, "Rendering your components can often require", " ", react_default.createElement( 18967 Link, 18968 { 18969 href: api.getDocsUrl({ 18970 subpath: "writing-stories/decorators", 18971 renderer: !0, 18972 ref: "guide" 18973 }), 18974 target: "_blank" 18975 }, 18976 "setting up surrounding context in decorators" 18977 ), " ", "or", " ", react_default.createElement( 18978 Link, 18979 { 18980 href: api.getDocsUrl({ 18981 subpath: "configure/styling-and-css", 18982 renderer: !0, 18983 ref: "guide" 18984 }), 18985 target: "_blank" 18986 }, 18987 "applying global styles" 18988 ), ". Once you've got it working for one component, you're ready to make Storybook the home for all of your UI."), react_default.createElement("p", null, "Stories are written in CSF, a format specifically designed to help with UI development. Here's an example:"), react_default.createElement(CodeSnippet, { language: "typescript" }, `// Button.stories.ts 18989// Replace your-framework with the framework you are using, e.g. react-vite, nextjs, nextjs-vite, etc. 18990import type { Meta, StoryObj } from '@storybook/your-framework'; 18991 18992import { Button } from './Button'; 18993 18994const meta = { 18995 // \u{1F447} The component you're working on 18996 component: Button, 18997} satisfies Meta<typeof Button>; 18998 18999export default meta; 19000// \u{1F447} Type helper to reduce boilerplate 19001type Story = StoryObj<typeof meta>; 19002 19003// \u{1F447} A story named Primary that renders \`<Button primary label="Button" />\` 19004export const Primary: Story = { 19005 args: { 19006 primary: true, 19007 label: 'Button', 19008 }, 19009};`), react_default.createElement("p", null, react_default.createElement( 19010 Link, 19011 { 19012 href: api.getDocsUrl({ 19013 subpath: "writing-stories", 19014 renderer: !0, 19015 ref: "guide" 19016 }), 19017 target: "_blank", 19018 withArrow: !0 19019 }, 19020 "Learn more about stories" 19021 ))) 19022 }, 19023 { 19024 id: "moreComponents", 19025 label: "Add 5 components", 19026 content: ({ api }) => react_default.createElement(react_default.Fragment, null, react_default.createElement("p", null, "Storybook gets better as you add more components. Start with the easy ones, like Button or Avatar, and work your way up to more complex components, like Select, Autocomplete, or even full pages."), react_default.createElement( 19027 "img", 19028 { 19029 src: api.getDocsUrl({ 19030 asset: "onboarding/sidebar-components.png", 19031 ref: "guide" 19032 }), 19033 alt: "Components in the sidebar" 19034 } 19035 ), react_default.createElement("p", null, react_default.createElement( 19036 Link, 19037 { 19038 href: api.getDocsUrl({ 19039 subpath: "get-started/whats-a-story#create-a-new-story", 19040 renderer: !0, 19041 ref: "guide" 19042 }), 19043 target: "_blank", 19044 withArrow: !0 19045 }, 19046 "Learn how to add components without writing any code" 19047 ))), 19048 criteria: "At least 5 components exist in the index", 19049 subscribe: subscribeToIndex((entries) => { 19050 let stories = Object.values(entries).filter( 19051 (entry) => entry.type === "story" 19052 ); 19053 return new Set(stories.map(({ title: title2 }) => title2)).size >= 5; 19054 }) 19055 }, 19056 { 19057 id: "moreStories", 19058 label: "Add 20 stories", 19059 content: ({ api }) => react_default.createElement(react_default.Fragment, null, react_default.createElement("p", null, "More stories for your components means better documentation and more test coverage."), react_default.createElement( 19060 "img", 19061 { 19062 src: api.getDocsUrl({ 19063 asset: "onboarding/sidebar-many-stories.png", 19064 ref: "guide" 19065 }), 19066 alt: "Stories in the sidebar" 19067 } 19068 ), react_default.createElement("p", null, react_default.createElement( 19069 Link, 19070 { 19071 href: api.getDocsUrl({ 19072 subpath: "essentials/controls#creating-and-editing-stories-from-controls", 19073 renderer: !0, 19074 ref: "guide" 19075 }), 19076 target: "_blank", 19077 withArrow: !0 19078 }, 19079 "Learn how to use Controls to add stories without writing any code" 19080 ))), 19081 criteria: "At least 20 stories exist in the index", 19082 subscribe: subscribeToIndex((entries) => Object.values(entries).filter( 19083 (entry) => entry.type === "story" 19084 ).length >= 20) 19085 }, 19086 { 19087 id: "whatsNewStorybook10", 19088 label: "See what's new", 19089 criteria: "What's New page is opened", 19090 action: { 19091 label: "Go", 19092 onClick: ({ api }) => api.navigate("/settings/whats-new") 19093 }, 19094 subscribe: ({ accept }) => LocationMonitor.subscribe((l3) => l3.search.endsWith("/settings/whats-new") && accept()) 19095 } 19096 ] 19097 }, 19098 { 19099 id: "development", 19100 title: "Development", 19101 items: [ 19102 { 19103 id: "controls", 19104 label: "Change a story with Controls", 19105 available: () => !!globalThis?.FEATURES?.controls, 19106 criteria: "Story args are updated", 19107 subscribe: ({ api, done }) => api.on(STORY_ARGS_UPDATED, done), 19108 content: ({ api }) => react_default.createElement(react_default.Fragment, null, react_default.createElement("p", null, "When you change the value of one of the inputs in the Controls table, the story automatically updates to reflect that change. It's a great way to explore how a component handles various inputs."), react_default.createElement( 19109 "img", 19110 { 19111 src: api.getDocsUrl({ 19112 asset: "api/doc-block-controls.png", 19113 ref: "guide" 19114 }), 19115 alt: "Screenshot of Controls block" 19116 } 19117 ), react_default.createElement("strong", null, "Take it further"), react_default.createElement("p", null, "Read the", " ", react_default.createElement( 19118 Link, 19119 { 19120 href: api.getDocsUrl({ 19121 subpath: "essentials/controls", 19122 renderer: !0, 19123 ref: "guide" 19124 }), 19125 target: "_blank" 19126 }, 19127 "Controls documentation" 19128 ), " ", "to learn:"), react_default.createElement("ul", null, react_default.createElement("li", null, "How to use the Controls panel to edit or save a new story"), react_default.createElement("li", null, "How to configure the table"))) 19129 }, 19130 { 19131 id: "viewports", 19132 label: "Check responsiveness with Viewports", 19133 available: () => !!globalThis?.FEATURES?.viewport, 19134 criteria: "Viewport global is updated", 19135 subscribe: ({ api, done }) => api.on(UPDATE_GLOBALS, ({ globals }) => globals?.viewport && done()), 19136 content: ({ api }) => react_default.createElement(react_default.Fragment, null, react_default.createElement("p", null, "Many UI components need to be responsive to the viewport size. Storybook has built-in support for previewing stories in various device sizes."), react_default.createElement( 19137 "img", 19138 { 19139 src: api.getDocsUrl({ 19140 asset: "onboarding/viewports-menu.png", 19141 ref: "guide" 19142 }), 19143 alt: "Screenshot of Viewports menu" 19144 } 19145 ), react_default.createElement("strong", null, "Take it further"), react_default.createElement("p", null, "Read the", " ", react_default.createElement( 19146 Link, 19147 { 19148 href: api.getDocsUrl({ 19149 subpath: "essentials/viewport", 19150 renderer: !0, 19151 ref: "guide" 19152 }), 19153 target: "_blank" 19154 }, 19155 "Viewports documentation" 19156 ), " ", "to learn:"), react_default.createElement("ul", null, react_default.createElement("li", null, "How to configure which viewports are available"), react_default.createElement("li", null, "How to force a story to ", react_default.createElement("em", null, "always"), " render in a specific viewport"))) 19157 }, 19158 { 19159 id: "organizeStories", 19160 label: "Group your components", 19161 criteria: "A root node exists in the index", 19162 subscribe: subscribeToIndex( 19163 (entries) => Object.values(entries).some(({ title: title2 }) => title2.includes("/")) 19164 ), 19165 content: ({ api }) => react_default.createElement(react_default.Fragment, null, react_default.createElement("p", null, "It's helpful for projects to organize their sidebar into groups. We're big fans of Atomic Design (atoms, molecules, organisms, pages), but we've also seen organization by domain (profile, billing, dashboard, etc). Being organized helps everyone use your Storybook more effectively."), react_default.createElement("p", null, "You can create a section like so:"), react_default.createElement(CodeSnippet, { language: "typescript" }, `// Button.stories.js 19166 19167export default { 19168 component: Button, 19169- title: 'Button', // You may not have this 19170+ title: 'Atoms/Button', 19171}`), react_default.createElement("p", null, "Which would look like:"), react_default.createElement( 19172 "img", 19173 { 19174 src: api.getDocsUrl({ 19175 asset: "onboarding/sidebar-with-groups.png", 19176 ref: "guide" 19177 }), 19178 alt: "Grouped components in the sidebar" 19179 } 19180 ), react_default.createElement("strong", null, "Take it further"), react_default.createElement("p", null, "Read the", " ", react_default.createElement( 19181 Link, 19182 { 19183 href: api.getDocsUrl({ 19184 subpath: "writing-stories/naming-components-and-hierarchy", 19185 renderer: !0, 19186 ref: "guide" 19187 }), 19188 target: "_blank" 19189 }, 19190 "story organization documentation" 19191 ), " ", "to learn:"), react_default.createElement("ul", null, react_default.createElement("li", null, "The full hierarchy available"), react_default.createElement("li", null, "How to configure the sorting of your stories"))) 19192 } 19193 ] 19194 }, 19195 { 19196 id: "share", 19197 title: "Share", 19198 items: [ 19199 { 19200 id: "shareStorybook", 19201 label: "Share your Storybook for feedback", 19202 available: () => addons.experimental_getRegisteredAddons(Addon_TypesEnum.TOOLEXTRA).includes("chromaui/addon-visual-tests/share-tool"), 19203 criteria: "User has shared their Storybook", 19204 subscribe: ({ api, done }) => { 19205 let SHARE_PROGRESS_KEY = "chromaui/addon-visual-tests/shareProgress"; 19206 return api.on("experimental_useSharedState_setValue", (key, value) => { 19207 key === SHARE_PROGRESS_KEY && value?.status === "complete" && done(); 19208 }); 19209 }, 19210 action: { 19211 label: "Share", 19212 onClick: () => document.getElementById("chromatic-share-button")?.click() 19213 }, 19214 content: () => react_default.createElement(react_default.Fragment, null, react_default.createElement("p", null, "Share your Storybook with your team in one click using Chromatic. Click the", " ", react_default.createElement("strong", null, "Share"), " button in the toolbar to publish and get a shareable link."), react_default.createElement("strong", null, "Take it further"), react_default.createElement("p", null, "Read the", " ", react_default.createElement(Link, { href: "https://www.chromatic.com/docs/sharing", target: "_blank", withArrow: !0 }, "sharing documentation"))) 19215 }, 19216 { 19217 id: "publishStorybook", 19218 label: "Publish your Storybook for feedback", 19219 available: () => !addons.experimental_getRegisteredAddons(Addon_TypesEnum.TOOLEXTRA).includes("chromaui/addon-visual-tests/share-tool"), 19220 criteria: "User has published their Storybook", 19221 content: ({ api }) => react_default.createElement(react_default.Fragment, null, react_default.createElement("p", null, "Publishing your Storybook is easy and unlocks super clear review cycles and other collaborative workflows."), react_default.createElement("p", null, "Run ", react_default.createElement("code", null, "npx storybook build"), " in CI and deploy it using services like", " ", react_default.createElement(Link, { href: "https://chromatic.com", target: "_blank" }, "Chromatic"), ",", " ", react_default.createElement(Link, { href: "https://vercel.com", target: "_blank", rel: "noopener noreferrer" }, "Vercel"), ", or", " ", react_default.createElement(Link, { href: "https://www.netlify.com", target: "_blank", rel: "noopener noreferrer" }, "Netlify"), "."), react_default.createElement("strong", null, "Take it further"), react_default.createElement("p", null, "Read the", " ", react_default.createElement( 19222 Link, 19223 { 19224 href: api.getDocsUrl({ 19225 subpath: "sharing/publish-storybook", 19226 renderer: !0, 19227 ref: "guide" 19228 }), 19229 target: "_blank", 19230 withArrow: !0 19231 }, 19232 "publishing documentation" 19233 ))) 19234 } 19235 ] 19236 }, 19237 { 19238 id: "testing", 19239 title: "Testing", 19240 items: [ 19241 { 19242 id: "installVitest", 19243 label: "Install Vitest addon", 19244 afterCompletion: "unavailable", 19245 available: () => !!globalThis.STORYBOOK_FRAMEWORK && SUPPORTED_FRAMEWORKS.includes(globalThis.STORYBOOK_FRAMEWORK), 19246 criteria: "@storybook/addon-vitest registered in .storybook/main.js|ts", 19247 subscribe: ({ done }) => { 19248 addons.experimental_getRegisteredAddons().includes(ADDON_ID5) && done(); 19249 }, 19250 content: ({ api }) => react_default.createElement(react_default.Fragment, null, react_default.createElement("p", null, "Run this command to install the Vitest addon, enabling you to run component tests on your stories inside Storybook\u2019s UI:"), react_default.createElement(CodeSnippet, { language: "bash" }, "npx storybook add @storybook/addon-vitest"), react_default.createElement("p", null, react_default.createElement("em", null, "Restart your Storybook after installing the addon.")), react_default.createElement( 19251 "img", 19252 { 19253 src: api.getDocsUrl({ 19254 asset: "writing-tests/testing-ui-overview.png", 19255 ref: "guide" 19256 }), 19257 alt: "Storybook app with story status indicators, testing widget, and addon panel annotated" 19258 } 19259 ), react_default.createElement("p", null, react_default.createElement( 19260 Link, 19261 { 19262 href: api.getDocsUrl({ 19263 subpath: "writing-tests/integrations/vitest-addon", 19264 renderer: !0, 19265 ref: "guide" 19266 }), 19267 target: "_blank", 19268 withArrow: !0 19269 }, 19270 "Learn more about the Vitest addon" 19271 ))) 19272 }, 19273 { 19274 id: "runTests", 19275 after: ["installVitest"], 19276 label: "Test your components", 19277 criteria: "Component tests are run from the test widget in the sidebar", 19278 subscribe: ({ done }) => internal_universalTestProviderStore.onStateChange((state) => { 19279 state["storybook/test"] === "test-provider-state:running" && (TourGuide.render(null), done()); 19280 }), 19281 action: { 19282 label: "Start", 19283 onClick: ({ api }) => { 19284 api.toggleNav(!0), TourGuide.render({ 19285 // eslint-disable-next-line @typescript-eslint/ban-ts-comment 19286 // @ts-ignore Circular reference in Step type 19287 steps: [ 19288 { 19289 title: "Testing widget", 19290 content: "Run tests right from your Storybook sidebar using the testing widget.", 19291 placement: "right-end", 19292 target: "#storybook-testing-module", 19293 highlight: "#storybook-testing-module", 19294 onNext: ({ next }) => { 19295 let toggle = document.getElementById("testing-module-collapse-toggle"); 19296 toggle?.getAttribute("aria-label") === "Expand testing module" ? (toggle.click(), setTimeout(next, 300)) : next(); 19297 } 19298 }, 19299 { 19300 title: "Start a test run", 19301 content: "Start a test run at the click of a button using Vitest.", 19302 placement: "right", 19303 target: '[data-module-id="storybook/test/test-provider"] button[aria-label="Start test run"]', 19304 highlight: '[data-module-id="storybook/test/test-provider"] button[aria-label="Start test run"]', 19305 hideNextButton: !0 19306 } 19307 ] 19308 }); 19309 } 19310 }, 19311 content: ({ api }) => react_default.createElement(react_default.Fragment, null, react_default.createElement("p", null, "Stories make great test cases. You can quickly test all of your stories directly from the test widget, at the bottom of the sidebar."), react_default.createElement( 19312 "img", 19313 { 19314 src: api.getDocsUrl({ 19315 asset: "onboarding/test-widget-with-failures.png", 19316 ref: "guide" 19317 }), 19318 alt: "Test widget showing test failures" 19319 } 19320 ), react_default.createElement("p", null, "Use the menu on a story or component to see details about a test failure or run tests for just that selection."), react_default.createElement( 19321 "img", 19322 { 19323 src: api.getDocsUrl({ 19324 asset: "writing-tests/context-menu.png", 19325 ref: "guide" 19326 }), 19327 alt: "Screenshot of story sidebar item with open menu" 19328 } 19329 ), react_default.createElement("strong", null, "Take it further"), react_default.createElement("p", null, "Read the", " ", react_default.createElement( 19330 Link, 19331 { 19332 href: api.getDocsUrl({ 19333 subpath: "writing-tests#component-tests", 19334 renderer: !0, 19335 ref: "guide" 19336 }), 19337 target: "_blank" 19338 }, 19339 "component testing documentation" 19340 ), " ", "to learn:"), react_default.createElement("ul", null, react_default.createElement("li", null, "About helpful features, like watch mode and sidebar filtering"), react_default.createElement("li", null, "How to run tests via CLI and in CI"), react_default.createElement("li", null, "About other capabilities, like accessibility checks and code coverage reporting"))) 19341 }, 19342 { 19343 id: "writeInteractions", 19344 label: "Test functionality with interactions", 19345 available: () => !!globalThis?.FEATURES?.interactions, 19346 criteria: "At least one story with a play or test function", 19347 subscribe: subscribeToIndex( 19348 (entries) => Object.values(entries).some( 19349 (entry) => entry.tags?.includes(Tag.PLAY_FN) || entry.tags?.includes(Tag.TEST_FN) 19350 ) 19351 ), 19352 content: ({ api }) => react_default.createElement(react_default.Fragment, null, react_default.createElement("p", null, "When you need to test non-visual or particularly complex behavior of a component, add a play function."), react_default.createElement(CodeSnippet, { language: "typescript" }, `// Button.stories.ts 19353// Replace your-framework with the framework you are using, e.g. react-vite, nextjs, nextjs-vite, etc. 19354import type { Meta, StoryObj } from '@storybook/your-framework'; 19355import { expect, fn } from 'storybook/test'; 19356 19357import { Button } from './Button'; 19358 19359const meta = { 19360 component: Button, 19361 args: { 19362 // \u{1F447} Provide a mock function to spy on 19363 onClick: fn(), 19364 }, 19365} satisfies Meta<typeof Button>; 19366 19367export default meta; 19368type Story = StoryObj<typeof meta>; 19369 19370export const Disabled: Story = { 19371 args: { 19372 disabled: true, 19373 label: 'Button', 19374 }, 19375 play: async function({ args, canvas, userEvent }) { 19376 const button = canvas.getByRole('button', { name: /button/i }); 19377 19378 // \u{1F447} Simulate behavior 19379 await userEvent.click(button); 19380 19381 // \u{1F447} Make assertions 19382 await expect(button).toHaveAttribute('aria-disabled', 'true'); 19383 await expect(args.onClick).not.toHaveBeenCalled(); 19384 } 19385};`), react_default.createElement("p", null, "You can interact with and debug each step defined in a play function within the Interactions panel."), react_default.createElement( 19386 "img", 19387 { 19388 src: api.getDocsUrl({ 19389 asset: "writing-tests/interaction-test-pass.png", 19390 ref: "guide" 19391 }), 19392 alt: "Storybook with a LoginForm component and passing interactions in the Interactions panel" 19393 } 19394 ), react_default.createElement("strong", null, "Take it further"), react_default.createElement("p", null, "Read the", " ", react_default.createElement( 19395 Link, 19396 { 19397 href: api.getDocsUrl({ 19398 subpath: "writing-tests/interaction-testing", 19399 renderer: !0, 19400 ref: "guide" 19401 }), 19402 target: "_blank" 19403 }, 19404 "interaction testing documentation" 19405 ), " ", "to learn:"), react_default.createElement("ul", null, react_default.createElement("li", null, "The full ", react_default.createElement("code", null, "play"), " function API"), react_default.createElement("li", null, "How to run code before and after tests"), react_default.createElement("li", null, "How to group interactions into steps"))) 19406 }, 19407 { 19408 id: "installA11y", 19409 label: "Install Accessibility addon", 19410 afterCompletion: "unavailable", 19411 criteria: "@storybook/addon-a11y registered in .storybook/main.js|ts", 19412 subscribe: ({ done }) => { 19413 addons.experimental_getRegisteredAddons().includes(ADDON_ID2) && done(); 19414 }, 19415 content: ({ api }) => react_default.createElement(react_default.Fragment, null, react_default.createElement("p", null, "Accessibility tests help ensure your UI is usable by everyone, no matter their ability."), react_default.createElement("p", null, "If you are not yet using the accessibility addon, run this command to install and set it up, enabling you to run accessibility checks alongside your component tests:"), react_default.createElement(CodeSnippet, { language: "bash" }, "npx storybook add @storybook/addon-a11y"), react_default.createElement("p", null, react_default.createElement("em", null, "Restart your Storybook after installing the addon.")), react_default.createElement("p", null, react_default.createElement( 19416 Link, 19417 { 19418 href: api.getDocsUrl({ 19419 subpath: "writing-tests/accessibility-testing", 19420 renderer: !0, 19421 ref: "guide" 19422 }), 19423 target: "_blank", 19424 withArrow: !0 19425 }, 19426 "Learn more about the Accessibility addon" 19427 ))) 19428 }, 19429 { 19430 id: "accessibilityTests", 19431 after: ["installA11y"], 19432 label: "Run accessibility tests", 19433 criteria: "Accessibility tests are run from the test widget in the sidebar", 19434 subscribe: ({ api, done }) => api.on( 19435 STORYBOOK_ADDON_TEST_CHANNEL, 19436 ({ type, payload }) => type === "test-run-completed" && payload.config.a11y && done() 19437 ), 19438 content: ({ api }) => react_default.createElement(react_default.Fragment, null, react_default.createElement("p", null, "Expand the test widget, check the Accessibility checkbox, and click the Run component tests button."), react_default.createElement( 19439 "img", 19440 { 19441 src: api.getDocsUrl({ 19442 asset: "writing-tests/test-widget-a11y-enabled.png", 19443 ref: "guide" 19444 }), 19445 alt: "Testing widget with accessibility activated" 19446 } 19447 ), react_default.createElement("p", null, "If there are any failures, you can use the Accessibility panel to debug any violations."), react_default.createElement( 19448 "img", 19449 { 19450 src: api.getDocsUrl({ 19451 asset: "writing-tests/addon-a11y-debug-violations.png", 19452 ref: "guide" 19453 }), 19454 alt: "Storybook app with accessibility panel open, showing violations and an interactive popover on the violating elements in the preview" 19455 } 19456 ), react_default.createElement("strong", null, "Take it further"), react_default.createElement("p", null, "Read the", " ", react_default.createElement( 19457 Link, 19458 { 19459 href: api.getDocsUrl({ 19460 subpath: "writing-tests/accessibility-testing", 19461 renderer: !0, 19462 ref: "guide" 19463 }), 19464 target: "_blank" 19465 }, 19466 "accessibility testing documentation" 19467 ), " ", "to learn:"), react_default.createElement("ul", null, react_default.createElement("li", null, "The recommended workflow"), react_default.createElement("li", null, "How to run accessibility tests via CLI and in CI"), react_default.createElement("li", null, "How to configure accessibility checks"))) 19468 }, 19469 { 19470 id: "installChromatic", 19471 label: "Install Visual Tests addon", 19472 afterCompletion: "unavailable", 19473 available: () => !0, 19474 // TODO check for compatibility with the project (not React Native) 19475 criteria: "@chromatic-com/storybook registered in .storybook/main.js|ts", 19476 subscribe: ({ done }) => { 19477 addons.experimental_getRegisteredAddons().includes("chromaui/addon-visual-tests") && done(); 19478 }, 19479 content: ({ api }) => react_default.createElement(react_default.Fragment, null, react_default.createElement("p", null, "Visual tests verify the appearance of your UI components."), react_default.createElement("p", null, "If you are not yet using the visual tests addon, run this command to install and set it up, enabling you to run visual tests on your stories (this requires a free Chromatic account):"), react_default.createElement(CodeSnippet, { language: "bash" }, "npx storybook add @chromatic-com/storybook"), react_default.createElement("p", null, react_default.createElement("em", null, "Restart your Storybook after installing the addon.")), react_default.createElement("p", null, react_default.createElement( 19480 Link, 19481 { 19482 href: api.getDocsUrl({ 19483 subpath: "writing-tests/visual-testing", 19484 renderer: !0, 19485 ref: "guide" 19486 }), 19487 target: "_blank", 19488 withArrow: !0 19489 }, 19490 "Learn more about the Visual Tests addon" 19491 ))) 19492 }, 19493 { 19494 id: "visualTests", 19495 after: ["installChromatic"], 19496 label: "Run visual tests", 19497 criteria: "Visual tests are run from the test widget in the sidebar or the Visual Tests panel", 19498 subscribe: ({ api, done }) => api.on("chromaui/addon-visual-tests/startBuild", done), 19499 content: ({ api }) => react_default.createElement(react_default.Fragment, null, react_default.createElement("p", null, "Expand the test widget and click the Run visual tests button."), react_default.createElement( 19500 "img", 19501 { 19502 src: api.getDocsUrl({ 19503 asset: "writing-tests/test-widget-expanded-with-vta.png", 19504 ref: "guide" 19505 }), 19506 alt: "Expanded testing widget, showing the Visual tests section" 19507 } 19508 ), react_default.createElement("p", null, "You can use the Visual tests panel to verify the resulting diffs as either an unexpected change which needs fixed or an expected change which can then be accepted and become the new baseline."), react_default.createElement( 19509 "img", 19510 { 19511 src: api.getDocsUrl({ 19512 asset: "writing-tests/vta-run-from-panel.png", 19513 ref: "guide" 19514 }), 19515 alt: "Visual tests addon panel showing a diff from the baseline" 19516 } 19517 ), react_default.createElement("strong", null, "Take it further"), react_default.createElement("p", null, "Read the", " ", react_default.createElement( 19518 Link, 19519 { 19520 href: api.getDocsUrl({ 19521 subpath: "writing-tests/visual-testing", 19522 renderer: !0, 19523 ref: "guide" 19524 }), 19525 target: "_blank" 19526 }, 19527 "visual testing documentation" 19528 ), " ", "to learn:"), react_default.createElement("ul", null, react_default.createElement("li", null, "How to automate your visual tests in CI"))) 19529 }, 19530 { 19531 id: "coverage", 19532 after: ["installVitest"], 19533 label: "Generate a coverage report", 19534 criteria: "Generate a coverage report", 19535 subscribe: ({ api, done }) => api.on( 19536 STORYBOOK_ADDON_TEST_CHANNEL, 19537 ({ type, payload }) => type === "test-run-completed" && payload.config.coverage && done() 19538 ), 19539 content: ({ api }) => react_default.createElement(react_default.Fragment, null, react_default.createElement("p", null, "Coverage reports show you which code is\u2014and, more importantly\u2014isn't executed while running your component tests. You use it to be sure you're testing the right things."), react_default.createElement("p", null, "To generate a coverage report, expand the test widget in the sidebar and check the Coverage checkbox. The next time you run component tests, it will generate an interactive report, which you can view by clicking the results summary in the test widget."), react_default.createElement( 19540 "img", 19541 { 19542 src: api.getDocsUrl({ 19543 asset: "writing-tests/test-widget-coverage-summary.png", 19544 ref: "guide" 19545 }), 19546 alt: "Test widget with coverage summary" 19547 } 19548 ), react_default.createElement("strong", null, "Take it further"), react_default.createElement("p", null, "Read the", " ", react_default.createElement( 19549 Link, 19550 { 19551 href: api.getDocsUrl({ 19552 subpath: "writing-tests/test-coverage", 19553 renderer: !0, 19554 ref: "guide" 19555 }), 19556 target: "_blank" 19557 }, 19558 "test coverage documentation" 19559 ), " ", "to learn:"), react_default.createElement("ul", null, react_default.createElement("li", null, "How to automate reporting in CI"), react_default.createElement("li", null, "How to configure the coverage results"))) 19560 }, 19561 { 19562 id: "ciTests", 19563 label: "Automate tests in CI", 19564 criteria: "Have a CI workflow that runs component tests, either with Vitest or Chromatic", 19565 content: ({ api }) => react_default.createElement(react_default.Fragment, null, react_default.createElement("p", null, "Automating component tests in CI is the best tool ensuring the quality and reliability of your project."), react_default.createElement("p", null, "You can automate all of Storybook's tests by using Chromatic or by running the", react_default.createElement("code", null, "vitest --project storybook"), " command in your CI scripts."), react_default.createElement( 19566 "img", 19567 { 19568 src: api.getDocsUrl({ 19569 asset: "writing-tests/test-ci-workflow-pr-status-checks.png", 19570 ref: "guide" 19571 }), 19572 alt: 'GitHub pull request status checks, with a failing "UI Tests / test" check' 19573 } 19574 ), react_default.createElement("strong", null, "Take it further"), react_default.createElement("p", null, "Read the", " ", react_default.createElement( 19575 Link, 19576 { 19577 href: api.getDocsUrl({ 19578 subpath: "writing-tests/in-ci", 19579 renderer: !0, 19580 ref: "guide" 19581 }), 19582 target: "_blank" 19583 }, 19584 "testing in CI documentation" 19585 ), " ", "to learn:"), react_default.createElement("ul", null, react_default.createElement("li", null, "How to test in your CI platform (GitHub Actions, Circle CI, etc.)"), react_default.createElement("li", null, "How to debug test failures in a published Storybook"), react_default.createElement("li", null, "How to run your other Vitest tests alongside your Storybook tests"))) 19586 } 19587 ] 19588 }, 19589 { 19590 id: "document", 19591 title: "Document", 19592 items: [ 19593 { 19594 id: "installDocs", 19595 label: "Install Docs addon", 19596 afterCompletion: "unavailable", 19597 criteria: "@storybook/addon-docs registered in .storybook/main.js|ts", 19598 subscribe: ({ done }) => { 19599 addons.experimental_getRegisteredAddons().includes(ADDON_ID6) && done(); 19600 }, 19601 content: ({ api }) => react_default.createElement(react_default.Fragment, null, react_default.createElement("p", null, "Storybook Docs transforms your Storybook stories into component documentation. Add the Docs addon to your Storybook project to get started:"), react_default.createElement(CodeSnippet, { language: "bash" }, "npx storybook add @storybook/addon-docs"), react_default.createElement("p", null, react_default.createElement("em", null, "Restart your Storybook after installing the addon.")), react_default.createElement("p", null, react_default.createElement( 19602 Link, 19603 { 19604 href: api.getDocsUrl({ 19605 subpath: "writing-docs", 19606 renderer: !0, 19607 ref: "guide" 19608 }), 19609 target: "_blank", 19610 withArrow: !0 19611 }, 19612 "Learn more about Storybook Docs" 19613 ))) 19614 }, 19615 { 19616 id: "autodocs", 19617 after: ["installDocs"], 19618 label: "Automatically document your components", 19619 criteria: "At least one component with the autodocs tag applied", 19620 subscribe: subscribeToIndex( 19621 (entries) => Object.values(entries).some((entry) => entry.tags?.includes(Tag.AUTODOCS)) 19622 ), 19623 content: ({ api }) => react_default.createElement(react_default.Fragment, null, react_default.createElement("p", null, "Add the autodocs tag to a component's meta to automatically generate documentation for that component, complete with examples, source code, an API table, and a description."), react_default.createElement(CodeSnippet, { language: "typescript" }, `// Button.stories.js 19624 19625const meta = { 19626 component: Button, 19627 tags: ['autodocs'], // \u{1F448} Add this tag 19628} 19629 19630export default meta;`), react_default.createElement("p", null, "That tag can also be applied in ", react_default.createElement("code", null, ".storybook/preview.ts"), ", to generate documentation for ", react_default.createElement("em", null, "all"), " components."), react_default.createElement( 19631 "img", 19632 { 19633 src: api.getDocsUrl({ 19634 asset: "writing-docs/autodocs.png", 19635 ref: "guide" 19636 }), 19637 alt: "Storybook autodocs page, showing a title, description, primary story, controls table, and additional stories" 19638 } 19639 ), react_default.createElement("strong", null, "Take it further"), react_default.createElement("p", null, "Read the", " ", react_default.createElement( 19640 Link, 19641 { 19642 href: api.getDocsUrl({ 19643 subpath: "writing-docs/autodocs", 19644 renderer: !0, 19645 ref: "guide" 19646 }), 19647 target: "_blank" 19648 }, 19649 "autodocs documentation" 19650 ), " ", "to learn:"), react_default.createElement("ul", null, react_default.createElement("li", null, "How to generate a table of contents"), react_default.createElement("li", null, "How to enhance your component documentation with JSDoc comments"), react_default.createElement("li", null, "How to customize the generated page"))) 19651 }, 19652 { 19653 id: "mdxDocs", 19654 after: ["installDocs"], 19655 label: "Custom content with MDX", 19656 criteria: "At least one MDX page", 19657 subscribe: subscribeToIndex( 19658 (entries) => Object.values(entries).some((entry) => entry.type === "docs") 19659 ), 19660 content: ({ api }) => react_default.createElement(react_default.Fragment, null, react_default.createElement("p", null, "You can use MDX (markdown + React components) to provide an introduction to your project, document things like design tokens, or go beyond the automatic documentation for your components."), react_default.createElement("p", null, "For a start, create an ", react_default.createElement("code", null, "introduction.mdx"), " file and (using markdown and Storybook's", " ", react_default.createElement( 19661 Link, 19662 { 19663 href: api.getDocsUrl({ 19664 subpath: "writing-docs/doc-blocks", 19665 renderer: !0, 19666 ref: "guide" 19667 }), 19668 target: "_blank" 19669 }, 19670 "doc blocks" 19671 ), ") write a usage guide for your project."), react_default.createElement(CodeSnippet, { language: "jsx" }, `{ /* introduction.mdx */ } 19672import { Meta, Title, Subtitle } from '@storybook/addon-docs/blocks'; 19673 19674<Meta title="Get started" /> 19675 19676<Title>Get started with My Awesome Project</Title> 19677 19678<Subtitle>It's really awesome</Subtitle> 19679 19680My Awesome Project is designed to work with Your Awesome Project seamlessly. 19681Follow this guide and you'll be ready in no time. 19682 19683## Install 19684 19685\`\`\`sh 19686npm install @my/awesome-project 19687\`\`\``), react_default.createElement("strong", null, "Take it further"), react_default.createElement("p", null, "Read the", " ", react_default.createElement( 19688 Link, 19689 { 19690 href: api.getDocsUrl({ 19691 subpath: "writing-docs/mdx", 19692 renderer: !0, 19693 ref: "guide" 19694 }), 19695 target: "_blank" 19696 }, 19697 "MDX documentation" 19698 ), " ", "to learn:"), react_default.createElement("ul", null, react_default.createElement("li", null, "How to reference stories in your content"), react_default.createElement("li", null, "How to import and display markdown files, such as READMEs"))) 19699 } 19700 ] 19701 } 19702 ] 19703}; 19704 19705// src/manager/components/sidebar/useChecklist.ts 19706var subscriptions = /* @__PURE__ */ new Map(), useStoryIndex = () => { 19707 let state = useStorybookState(), [index, setIndex] = useState(() => state.index), updateIndex = useMemo(() => throttle(setIndex, 500), []); 19708 return useEffect(() => updateIndex(state.index), [state.index, updateIndex]), useEffect(() => () => updateIndex.cancel?.(), [updateIndex]), index; 19709}, checkAvailable = (item, itemsById, context) => { 19710 if (item.available && !item.available(context)) 19711 return !1; 19712 for (let afterId of item.after ?? []) 19713 if (itemsById[afterId] && !checkAvailable(itemsById[afterId], itemsById, context)) 19714 return !1; 19715 return !0; 19716}, checkSkipped = (item, itemsById, state) => { 19717 if (state[item.id].status === "skipped") 19718 return !0; 19719 for (let afterId of item.after ?? []) 19720 if (itemsById[afterId] && checkSkipped(itemsById[afterId], itemsById, state)) 19721 return !0; 19722 return !1; 19723}, getAncestorIds = (item, itemsById) => !item.after || item.after.length === 0 ? [] : item.after.flatMap((afterId) => { 19724 let afterItem = itemsById[afterId]; 19725 return afterItem ? [...getAncestorIds(afterItem, itemsById), afterId] : []; 19726}), checkLockedBy = (item, itemsById, state) => getAncestorIds(item, itemsById).find( 19727 (id) => state[id].status !== "accepted" && state[id].status !== "done" 19728), useChecklist = () => { 19729 let api = useStorybookApi(), index = useStoryIndex(), [checklistState] = experimental_useUniversalStore(internal_universalChecklistStore), { loaded, items, widget } = checklistState, { status } = internal_universalChecklistStore, [initialized, setInitialized] = useState(!1), [ready, setReady] = useState(!1), debounceReady = useMemo(() => debounce(() => setReady(!0), 500), []), itemsById = useMemo(() => Object.fromEntries( 19730 checklistData.sections.flatMap( 19731 ({ items: items2, id: sectionId, title: sectionTitle }, sectionIndex) => items2.map(({ id, ...item }, itemIndex) => [id, { id, itemIndex, sectionId, sectionIndex, sectionTitle, ...item }]) 19732 ) 19733 ), []), allItems = useMemo(() => Object.values(itemsById).map((item) => { 19734 let { status: status2, mutedAt } = items[item.id], isOpen = status2 === "open", isAccepted = status2 === "accepted", isDone = status2 === "done", isCompleted = isAccepted || isDone, isSkipped = !isCompleted && checkSkipped(item, itemsById, items), isMuted = !!mutedAt || !!widget.disable, isAvailable = isCompleted ? item.afterCompletion !== "unavailable" : checkAvailable(item, itemsById, { api, index, item, storeState: checklistState }), isLockedBy = checkLockedBy(item, itemsById, items), isImmutable = isCompleted && item.afterCompletion === "immutable"; 19735 return { 19736 ...item, 19737 isAvailable, 19738 isOpen, 19739 isLockedBy, 19740 isImmutable, 19741 isReady: isOpen && isAvailable && !isMuted && !isLockedBy, 19742 isCompleted, 19743 isAccepted, 19744 isDone, 19745 isSkipped, 19746 isMuted 19747 }; 19748 }), [itemsById, items, widget, api, index, checklistState]), itemCollections = useMemo(() => { 19749 let availableItems = allItems.filter((item) => item.isAvailable), openItems = availableItems.filter((item) => item.isOpen), readyItems = openItems.filter((item) => item.isReady), nextItems = Object.values( 19750 readyItems.reduce((acc, item) => (acc[item.sectionId] ??= [], acc[item.sectionId].push({ ...item, itemIndex: acc[item.sectionId].length }), acc), {}) 19751 ).flat().sort((a2, b2) => a2.itemIndex - b2.itemIndex).slice(0, 3).sort((a2, b2) => a2.sectionIndex - b2.sectionIndex), progress = availableItems.length ? Math.round((availableItems.length - openItems.length) / availableItems.length * 100) : 100; 19752 return { availableItems, openItems, readyItems, nextItems, progress }; 19753 }, [allItems]); 19754 return useEffect(() => { 19755 if (!(!loaded || status !== experimental_UniversalStore.Status.READY)) 19756 for (let item of allItems) { 19757 if (!item.subscribe) 19758 continue; 19759 let subscribed = subscriptions.has(item.id); 19760 if (item.isOpen && item.isAvailable && !subscribed) 19761 subscriptions.set( 19762 item.id, 19763 item.subscribe({ 19764 api, 19765 item, 19766 accept: () => internal_checklistStore.accept(item.id), 19767 done: () => internal_checklistStore.done(item.id), 19768 skip: () => internal_checklistStore.skip(item.id) 19769 }) 19770 ); 19771 else if (subscribed && !(item.isOpen && item.isAvailable)) { 19772 let unsubscribe = subscriptions.get(item.id); 19773 subscriptions.delete(item.id), typeof unsubscribe == "function" && unsubscribe(); 19774 } 19775 } 19776 }, [api, loaded, status, allItems]), useEffect(() => { 19777 let initialize = () => setInitialized(!0), timeout = setTimeout(initialize, 1e3); 19778 return api.once(PREVIEW_INITIALIZED, initialize), () => { 19779 clearTimeout(timeout), api.off(PREVIEW_INITIALIZED, initialize); 19780 }; 19781 }, [api]), useEffect(() => { 19782 initialized && items && status === experimental_UniversalStore.Status.READY && debounceReady(); 19783 }, [initialized, items, status, debounceReady]), { 19784 ready, 19785 allItems, 19786 ...itemCollections, 19787 ...internal_checklistStore, 19788 ...checklistState 19789 }; 19790}; 19791 19792// src/shared/useCopyButton.ts 19793init_react(); 19794 19795// ../../node_modules/@react-aria/live-announcer/dist/LiveAnnouncer.mjs 19796var $319e236875307eab$var$liveAnnouncer = null; 19797function $319e236875307eab$export$a9b970dcc4ae71a9(message, assertiveness = "assertive", timeout = 7e3) { 19798 $319e236875307eab$var$liveAnnouncer ? $319e236875307eab$var$liveAnnouncer.announce(message, assertiveness, timeout) : ($319e236875307eab$var$liveAnnouncer = new $319e236875307eab$var$LiveAnnouncer(), (typeof IS_REACT_ACT_ENVIRONMENT == "boolean" ? IS_REACT_ACT_ENVIRONMENT : typeof jest < "u") ? $319e236875307eab$var$liveAnnouncer.announce(message, assertiveness, timeout) : setTimeout(() => { 19799 $319e236875307eab$var$liveAnnouncer?.isAttached() && $319e236875307eab$var$liveAnnouncer?.announce(message, assertiveness, timeout); 19800 }, 100)); 19801} 19802function $319e236875307eab$export$d10ae4f68404609a(assertiveness) { 19803 $319e236875307eab$var$liveAnnouncer && $319e236875307eab$var$liveAnnouncer.clear(assertiveness); 19804} 19805var $319e236875307eab$var$LiveAnnouncer = class { 19806 isAttached() { 19807 var _this_node; 19808 return (_this_node = this.node) === null || _this_node === void 0 ? void 0 : _this_node.isConnected; 19809 } 19810 createLog(ariaLive) { 19811 let node = document.createElement("div"); 19812 return node.setAttribute("role", "log"), node.setAttribute("aria-live", ariaLive), node.setAttribute("aria-relevant", "additions"), node; 19813 } 19814 destroy() { 19815 this.node && (document.body.removeChild(this.node), this.node = null); 19816 } 19817 announce(message, assertiveness = "assertive", timeout = 7e3) { 19818 var _this_assertiveLog, _this_politeLog; 19819 if (!this.node) return; 19820 let node = document.createElement("div"); 19821 typeof message == "object" ? (node.setAttribute("role", "img"), node.setAttribute("aria-labelledby", message["aria-labelledby"])) : node.textContent = message, assertiveness === "assertive" ? (_this_assertiveLog = this.assertiveLog) === null || _this_assertiveLog === void 0 || _this_assertiveLog.appendChild(node) : (_this_politeLog = this.politeLog) === null || _this_politeLog === void 0 || _this_politeLog.appendChild(node), message !== "" && setTimeout(() => { 19822 node.remove(); 19823 }, timeout); 19824 } 19825 clear(assertiveness) { 19826 this.node && ((!assertiveness || assertiveness === "assertive") && this.assertiveLog && (this.assertiveLog.innerHTML = ""), (!assertiveness || assertiveness === "polite") && this.politeLog && (this.politeLog.innerHTML = "")); 19827 } 19828 constructor() { 19829 this.node = null, this.assertiveLog = null, this.politeLog = null, typeof document < "u" && (this.node = document.createElement("div"), this.node.dataset.liveAnnouncer = "true", Object.assign(this.node.style, { 19830 border: 0, 19831 clip: "rect(0 0 0 0)", 19832 clipPath: "inset(50%)", 19833 height: "1px", 19834 margin: "-1px", 19835 overflow: "hidden", 19836 padding: 0, 19837 position: "absolute", 19838 width: "1px", 19839 whiteSpace: "nowrap" 19840 }), this.assertiveLog = this.createLog("assertive"), this.node.appendChild(this.assertiveLog), this.politeLog = this.createLog("polite"), this.node.appendChild(this.politeLog), document.body.prepend(this.node)); 19841 } 19842}; 19843 19844// src/shared/useCopyButton.ts 19845function useCopyButton2({ 19846 children = "Copy", 19847 childrenOnCopy = "Copied!", 19848 content, 19849 onCopy, 19850 ariaLabel = !1, 19851 ariaLabelOnCopy = !1, 19852 duration = 3e3 19853}) { 19854 let [copied, setCopied] = useState(!1), timerRef = useRef(null); 19855 useEffect( 19856 () => () => { 19857 timerRef.current && clearTimeout(timerRef.current); 19858 }, 19859 [] 19860 ); 19861 let handleClick = useCallback( 19862 (e2) => { 19863 timerRef.current && clearTimeout(timerRef.current); 19864 let announcement = typeof ariaLabelOnCopy == "string" ? ariaLabelOnCopy : "Copied to clipboard"; 19865 navigator.clipboard?.writeText(content).then(() => { 19866 onCopy?.(e2), setCopied(!0), $319e236875307eab$export$a9b970dcc4ae71a9(announcement, "polite"), timerRef.current = setTimeout(() => { 19867 setCopied(!1), $319e236875307eab$export$d10ae4f68404609a("polite"), timerRef.current = null; 19868 }, duration); 19869 }); 19870 }, 19871 [content, onCopy, ariaLabelOnCopy, duration] 19872 ); 19873 return { 19874 // @ts-expect-error - TypeScript is not realising T is constrained identically in both interfaces. 19875 children: copied ? childrenOnCopy : children, 19876 buttonProps: useMemo( 19877 () => ({ 19878 onClick: handleClick, 19879 ariaLabel: copied ? ariaLabelOnCopy : ariaLabel 19880 }), 19881 [handleClick, copied, ariaLabelOnCopy, ariaLabel] 19882 ) 19883 }; 19884} 19885 19886// src/manager/components/sidebar/ChecklistWidget.tsx 19887var fadeScaleIn = keyframes` 19888 from { 19889 opacity: 0; 19890 transform: scale(0.7); 19891 } 19892 to { 19893 opacity: 1; 19894 transform: scale(1); 19895 } 19896`, expand = keyframes` 19897 from { 19898 transform: scaleX(0); 19899 } 19900 to { 19901 transform: scaleX(1); 19902 } 19903`, useTransitionArray = (array, subset, options2) => { 19904 let keyFnRef = useRef(options2.keyFn), { setItem, toggle, stateMap } = useTransitionMap({ 19905 allowMultiple: !0, 19906 mountOnEnter: !0, 19907 unmountOnExit: !0, 19908 preEnter: !0, 19909 ...options2 19910 }); 19911 return useEffect(() => { 19912 let keyFn = keyFnRef.current; 19913 array.forEach((task) => setItem(keyFn(task))); 19914 }, [array, setItem]), useEffect(() => { 19915 let keyFn = keyFnRef.current; 19916 array.forEach((task) => toggle(keyFn(task), subset.map(keyFn).includes(keyFn(task)))); 19917 }, [array, subset, toggle]), Array.from(stateMap).map( 19918 ([key, value]) => [array.find((item) => keyFnRef.current(item) === key), value] 19919 ); 19920}, CollapsibleWithMargin = styled(Collapsible)(({ collapsed }) => ({ 19921 marginTop: collapsed ? 0 : 16 19922})), HoverCard = styled(Card)({ 19923 "&:hover #checklist-module-collapse-toggle": { 19924 opacity: 1 19925 } 19926}), CollapseToggle2 = styled(ActionList.Button)({ 19927 opacity: 0, 19928 transition: "opacity var(--transition-duration, 0.2s)", 19929 "&:focus, &:hover": { 19930 opacity: 1 19931 } 19932}), ProgressCircle = styled(ProgressSpinner)(({ theme }) => ({ 19933 color: theme.color.secondary 19934})), Checked = styled(StatusPassIcon)(({ theme }) => ({ 19935 padding: 1, 19936 borderRadius: "50%", 19937 background: theme.color.positive, 19938 color: theme.background.content, 19939 animation: `${fadeScaleIn} 500ms forwards` 19940})), ItemLabel = styled.span( 19941 ({ theme, isCompleted, isSkipped }) => ({ 19942 position: "relative", 19943 margin: "0 -2px", 19944 padding: "0 2px", 19945 color: isSkipped ? theme.color.mediumdark : isCompleted ? theme.base === "dark" ? theme.color.positive : theme.color.positiveText : theme.color.defaultText, 19946 transition: "color 500ms" 19947 }), 19948 ({ theme, isSkipped }) => isSkipped && { 19949 alignSelf: "flex-start", 19950 "&:after": { 19951 content: '""', 19952 position: "absolute", 19953 top: "50%", 19954 left: 0, 19955 width: "100%", 19956 height: 1, 19957 background: theme.color.mediumdark, 19958 animation: `${expand} 500ms forwards`, 19959 transformOrigin: "left" 19960 } 19961 } 19962), title = (progress) => { 19963 switch (!0) { 19964 case progress < 50: 19965 return "Get started"; 19966 case progress < 75: 19967 return "Level up"; 19968 default: 19969 return "Become an expert"; 19970 } 19971}, OpenGuideButton = ({ 19972 children, 19973 afterClick 19974}) => { 19975 let api = useStorybookApi(); 19976 return react_default.createElement( 19977 ActionList.Action, 19978 { 19979 ariaLabel: "Open onboarding guide", 19980 onClick: (e2) => { 19981 e2.stopPropagation(), api.navigate("/settings/guide"), afterClick?.(); 19982 } 19983 }, 19984 react_default.createElement(ActionList.Icon, null, react_default.createElement(ListUnorderedIcon, null)), 19985 children 19986 ); 19987}, CopyButton2 = ({ 19988 label, 19989 copyContent, 19990 onClick, 19991 ...props 19992}) => { 19993 let { children: copyChildren, buttonProps: copyButtonProps } = useCopyButton2({ 19994 children: label, 19995 childrenOnCopy: react_default.createElement(react_default.Fragment, null, react_default.createElement(CheckIcon, null), " Copied!"), 19996 onCopy: onClick, 19997 content: copyContent 19998 }); 19999 return react_default.createElement(ActionList.Button, { ...props, ...copyButtonProps }, copyChildren); 20000}, ChecklistWidget = () => { 20001 let api = useStorybookApi(), { loaded, ready, allItems, nextItems, progress, accept, mute, items } = useChecklist(), [renderItems, setRenderItems] = useState(nextItems), [animated, setAnimated] = useState(!1); 20002 useEffect(() => { 20003 if (ready) { 20004 let timeout = setTimeout(setAnimated, 1e3, !0); 20005 return () => clearTimeout(timeout); 20006 } 20007 }, [ready]), useEffect(() => { 20008 if (!animated) { 20009 setRenderItems(nextItems); 20010 return; 20011 } 20012 setRenderItems((current) => { 20013 let animateOut = !1, prevItems = current.map((item) => { 20014 let { status } = items[item.id], isAccepted = status === "accepted", isDone = status === "done", isSkipped = status === "skipped"; 20015 return animateOut = animateOut || isAccepted || isDone || isSkipped, { ...item, isCompleted: isAccepted || isDone, isAccepted, isDone, isSkipped }; 20016 }); 20017 return animateOut ? prevItems : nextItems; 20018 }); 20019 let timeout = setTimeout(setRenderItems, 2e3, nextItems); 20020 return () => clearTimeout(timeout); 20021 }, [animated, nextItems, items]); 20022 let hasItems = renderItems.length > 0, transitionItems = useTransitionArray(allItems, renderItems, { 20023 keyFn: (item) => item.id, 20024 timeout: animated ? 300 : 0 20025 }); 20026 return api.getIsNavShown() ? react_default.createElement(CollapsibleWithMargin, { collapsed: !hasItems || !loaded }, react_default.createElement(HoverCard, { id: "storybook-checklist-widget", outlineAnimation: "rainbow" }, react_default.createElement( 20027 Collapsible, 20028 { 20029 storageKey: "checklist-widget", 20030 initialCollapsed: !hasItems, 20031 disabled: !hasItems, 20032 summary: ({ isCollapsed, toggleCollapsed, toggleProps }) => react_default.createElement(ActionList, { as: "div", onClick: toggleCollapsed }, react_default.createElement(ActionList.Item, { as: "div" }, react_default.createElement(ActionList.Item, { as: "div", style: { flexShrink: 1 } }, loaded && react_default.createElement( 20033 Optional, 20034 { 20035 content: react_default.createElement(OpenGuideButton, null, react_default.createElement("strong", null, title(progress))), 20036 fallback: react_default.createElement(OpenGuideButton, null) 20037 } 20038 )), react_default.createElement(ActionList.Item, { as: "div" }, react_default.createElement( 20039 CollapseToggle2, 20040 { 20041 ...toggleProps, 20042 id: "checklist-module-collapse-toggle", 20043 ariaLabel: `${isCollapsed ? "Expand" : "Collapse"} onboarding guide` 20044 }, 20045 react_default.createElement( 20046 ChevronSmallUpIcon, 20047 { 20048 style: { 20049 transform: isCollapsed ? "rotate(180deg)" : "none", 20050 transition: "transform 250ms", 20051 willChange: "auto" 20052 } 20053 } 20054 ) 20055 ), loaded && react_default.createElement( 20056 PopoverProvider, 20057 { 20058 ariaLabel: "Onboarding guide menu", 20059 padding: 0, 20060 popover: ({ onHide }) => react_default.createElement(ActionList, null, react_default.createElement(ActionList.Item, null, react_default.createElement(OpenGuideButton, { afterClick: onHide }, react_default.createElement(ActionList.Text, null, "Open full guide"))), react_default.createElement(ActionList.Item, null, react_default.createElement( 20061 ActionList.Action, 20062 { 20063 ariaLabel: !1, 20064 onClick: (e2) => { 20065 e2.stopPropagation(), mute(allItems.map(({ id }) => id)), onHide(); 20066 } 20067 }, 20068 react_default.createElement(ActionList.Icon, null, react_default.createElement(EyeCloseIcon, null)), 20069 react_default.createElement(ActionList.Text, null, "Remove from sidebar") 20070 ))) 20071 }, 20072 react_default.createElement( 20073 ActionList.Button, 20074 { 20075 ariaLabel: `${progress}% completed`, 20076 onClick: (e2) => e2.stopPropagation() 20077 }, 20078 react_default.createElement( 20079 ProgressCircle, 20080 { 20081 percentage: progress, 20082 running: !1, 20083 size: 16, 20084 width: 1.5 20085 } 20086 ), 20087 react_default.createElement(TextFlip, { text: `${progress}%`, placeholder: "00%" }) 20088 ) 20089 )))) 20090 }, 20091 react_default.createElement(ActionList, null, transitionItems.map( 20092 ([item, { status, isMounted }]) => isMounted && react_default.createElement(ActionList.HoverItem, { key: item.id, targetId: item.id, transitionStatus: status }, react_default.createElement( 20093 ActionList.Action, 20094 { 20095 ariaLabel: `Open onboarding guide for ${item.label}`, 20096 onClick: () => api.navigate(`/settings/guide#${item.id}`) 20097 }, 20098 react_default.createElement(ActionList.Icon, null, item.isCompleted && animated ? react_default.createElement(Particles, { anchor: Checked, key: item.id }) : item.icon ? react_default.createElement(item.icon, null) : react_default.createElement(CircleHollowIcon, null)), 20099 react_default.createElement(ActionList.Text, null, react_default.createElement(ItemLabel, { isCompleted: item.isCompleted, isSkipped: item.isSkipped }, item.label)) 20100 ), item.action && (item.action.copyContent ? react_default.createElement( 20101 CopyButton2, 20102 { 20103 "data-target-id": item.id, 20104 label: item.action.label, 20105 copyContent: item.action.copyContent, 20106 onClick: (e2) => { 20107 e2.stopPropagation(), item.action?.onClick({ 20108 api, 20109 accept: () => accept(item.id) 20110 }); 20111 } 20112 } 20113 ) : react_default.createElement( 20114 ActionList.Button, 20115 { 20116 "data-target-id": item.id, 20117 ariaLabel: !1, 20118 onClick: (e2) => { 20119 e2.stopPropagation(), item.action?.onClick({ 20120 api, 20121 accept: () => accept(item.id) 20122 }); 20123 } 20124 }, 20125 item.action.label 20126 ))) 20127 )) 20128 ))) : null; 20129}; 20130 20131// src/manager/components/sidebar/CreateNewStoryFileModal.tsx 20132init_react(); 20133 20134// src/manager/hooks/useDebounce.ts 20135init_react(); 20136function useDebounce(value, delay2) { 20137 let [debouncedValue, setDebouncedValue] = useState(value); 20138 return useEffect(() => { 20139 let handler = setTimeout(() => { 20140 setDebouncedValue(value); 20141 }, delay2); 20142 return () => { 20143 clearTimeout(handler); 20144 }; 20145 }, [value, delay2]), debouncedValue; 20146} 20147 20148// src/manager/components/sidebar/FileSearchModal.tsx 20149init_react(); 20150 20151// src/manager/hooks/useMeasure.tsx 20152init_react(); 20153function useMeasure() { 20154 let [dimensions, setDimensions] = react_default.useState({ 20155 width: null, 20156 height: null 20157 }), prevObserver = react_default.useRef(null); 20158 return [react_default.useCallback((node) => { 20159 if (prevObserver.current && (prevObserver.current.disconnect(), prevObserver.current = null), node?.nodeType === Node.ELEMENT_NODE) { 20160 let observer = new ResizeObserver(([entry]) => { 20161 if (entry && entry.borderBoxSize) { 20162 let { inlineSize: width, blockSize: height } = entry.borderBoxSize[0]; 20163 setDimensions({ width, height }); 20164 } 20165 }); 20166 observer.observe(node), prevObserver.current = observer; 20167 } 20168 }, []), dimensions]; 20169} 20170 20171// src/manager/components/sidebar/FileSearchList.tsx 20172init_react(); 20173 20174// ../../node_modules/@tanstack/react-virtual/dist/esm/index.js 20175init_react(); 20176 20177// ../../node_modules/@tanstack/virtual-core/dist/esm/utils.js 20178function memo2(getDeps, fn, opts) { 20179 let deps = opts.initialDeps ?? [], result; 20180 function memoizedFunction() { 20181 var _a2, _b, _c, _d; 20182 let depTime; 20183 opts.key && ((_a2 = opts.debug) != null && _a2.call(opts)) && (depTime = Date.now()); 20184 let newDeps = getDeps(); 20185 if (!(newDeps.length !== deps.length || newDeps.some((dep, index) => deps[index] !== dep))) 20186 return result; 20187 deps = newDeps; 20188 let resultTime; 20189 if (opts.key && ((_b = opts.debug) != null && _b.call(opts)) && (resultTime = Date.now()), result = fn(...newDeps), opts.key && ((_c = opts.debug) != null && _c.call(opts))) { 20190 let depEndTime = Math.round((Date.now() - depTime) * 100) / 100, resultEndTime = Math.round((Date.now() - resultTime) * 100) / 100, resultFpsPercentage = resultEndTime / 16, pad = (str, num) => { 20191 for (str = String(str); str.length < num; ) 20192 str = " " + str; 20193 return str; 20194 }; 20195 console.info( 20196 `%c\u23F1 ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`, 20197 ` 20198 font-size: .6rem; 20199 font-weight: bold; 20200 color: hsl(${Math.max( 20201 0, 20202 Math.min(120 - 120 * resultFpsPercentage, 120) 20203 )}deg 100% 31%);`, 20204 opts?.key 20205 ); 20206 } 20207 return (_d = opts?.onChange) == null || _d.call(opts, result), result; 20208 } 20209 return memoizedFunction.updateDeps = (newDeps) => { 20210 deps = newDeps; 20211 }, memoizedFunction; 20212} 20213function notUndefined(value, msg) { 20214 if (value === void 0) 20215 throw new Error(`Unexpected undefined${msg ? `: ${msg}` : ""}`); 20216 return value; 20217} 20218var approxEqual = (a2, b2) => Math.abs(a2 - b2) < 1.01, debounce3 = (targetWindow, fn, ms) => { 20219 let timeoutId; 20220 return function(...args) { 20221 targetWindow.clearTimeout(timeoutId), timeoutId = targetWindow.setTimeout(() => fn.apply(this, args), ms); 20222 }; 20223}; 20224 20225// ../../node_modules/@tanstack/virtual-core/dist/esm/index.js 20226var getRect = (element) => { 20227 let { offsetWidth, offsetHeight } = element; 20228 return { width: offsetWidth, height: offsetHeight }; 20229}, defaultKeyExtractor = (index) => index, defaultRangeExtractor = (range) => { 20230 let start = Math.max(range.startIndex - range.overscan, 0), end = Math.min(range.endIndex + range.overscan, range.count - 1), arr = []; 20231 for (let i2 = start; i2 <= end; i2++) 20232 arr.push(i2); 20233 return arr; 20234}, observeElementRect = (instance, cb) => { 20235 let element = instance.scrollElement; 20236 if (!element) 20237 return; 20238 let targetWindow = instance.targetWindow; 20239 if (!targetWindow) 20240 return; 20241 let handler = (rect) => { 20242 let { width, height } = rect; 20243 cb({ width: Math.round(width), height: Math.round(height) }); 20244 }; 20245 if (handler(getRect(element)), !targetWindow.ResizeObserver) 20246 return () => { 20247 }; 20248 let observer = new targetWindow.ResizeObserver((entries) => { 20249 let run = () => { 20250 let entry = entries[0]; 20251 if (entry?.borderBoxSize) { 20252 let box = entry.borderBoxSize[0]; 20253 if (box) { 20254 handler({ width: box.inlineSize, height: box.blockSize }); 20255 return; 20256 } 20257 } 20258 handler(getRect(element)); 20259 }; 20260 instance.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(run) : run(); 20261 }); 20262 return observer.observe(element, { box: "border-box" }), () => { 20263 observer.unobserve(element); 20264 }; 20265}, addEventListenerOptions = { 20266 passive: !0 20267}; 20268var supportsScrollend = typeof window > "u" ? !0 : "onscrollend" in window, observeElementOffset = (instance, cb) => { 20269 let element = instance.scrollElement; 20270 if (!element) 20271 return; 20272 let targetWindow = instance.targetWindow; 20273 if (!targetWindow) 20274 return; 20275 let offset2 = 0, fallback = instance.options.useScrollendEvent && supportsScrollend ? () => { 20276 } : debounce3( 20277 targetWindow, 20278 () => { 20279 cb(offset2, !1); 20280 }, 20281 instance.options.isScrollingResetDelay 20282 ), createHandler = (isScrolling) => () => { 20283 let { horizontal, isRtl } = instance.options; 20284 offset2 = horizontal ? element.scrollLeft * (isRtl && -1 || 1) : element.scrollTop, fallback(), cb(offset2, isScrolling); 20285 }, handler = createHandler(!0), endHandler = createHandler(!1); 20286 endHandler(), element.addEventListener("scroll", handler, addEventListenerOptions); 20287 let registerScrollendEvent = instance.options.useScrollendEvent && supportsScrollend; 20288 return registerScrollendEvent && element.addEventListener("scrollend", endHandler, addEventListenerOptions), () => { 20289 element.removeEventListener("scroll", handler), registerScrollendEvent && element.removeEventListener("scrollend", endHandler); 20290 }; 20291}; 20292var measureElement = (element, entry, instance) => { 20293 if (entry?.borderBoxSize) { 20294 let box = entry.borderBoxSize[0]; 20295 if (box) 20296 return Math.round( 20297 box[instance.options.horizontal ? "inlineSize" : "blockSize"] 20298 ); 20299 } 20300 return element[instance.options.horizontal ? "offsetWidth" : "offsetHeight"]; 20301}; 20302var elementScroll = (offset2, { 20303 adjustments = 0, 20304 behavior 20305}, instance) => { 20306 var _a2, _b; 20307 let toOffset = offset2 + adjustments; 20308 (_b = (_a2 = instance.scrollElement) == null ? void 0 : _a2.scrollTo) == null || _b.call(_a2, { 20309 [instance.options.horizontal ? "left" : "top"]: toOffset, 20310 behavior 20311 }); 20312}, Virtualizer = class { 20313 constructor(opts) { 20314 this.unsubs = [], this.scrollElement = null, this.targetWindow = null, this.isScrolling = !1, this.measurementsCache = [], this.itemSizeCache = /* @__PURE__ */ new Map(), this.pendingMeasuredCacheIndexes = [], this.scrollRect = null, this.scrollOffset = null, this.scrollDirection = null, this.scrollAdjustments = 0, this.elementsCache = /* @__PURE__ */ new Map(), this.observer = /* @__PURE__ */ (() => { 20315 let _ro = null, get2 = () => _ro || (!this.targetWindow || !this.targetWindow.ResizeObserver ? null : _ro = new this.targetWindow.ResizeObserver((entries) => { 20316 entries.forEach((entry) => { 20317 let run = () => { 20318 this._measureElement(entry.target, entry); 20319 }; 20320 this.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(run) : run(); 20321 }); 20322 })); 20323 return { 20324 disconnect: () => { 20325 var _a2; 20326 (_a2 = get2()) == null || _a2.disconnect(), _ro = null; 20327 }, 20328 observe: (target) => { 20329 var _a2; 20330 return (_a2 = get2()) == null ? void 0 : _a2.observe(target, { box: "border-box" }); 20331 }, 20332 unobserve: (target) => { 20333 var _a2; 20334 return (_a2 = get2()) == null ? void 0 : _a2.unobserve(target); 20335 } 20336 }; 20337 })(), this.range = null, this.setOptions = (opts2) => { 20338 Object.entries(opts2).forEach(([key, value]) => { 20339 typeof value > "u" && delete opts2[key]; 20340 }), this.options = { 20341 debug: !1, 20342 initialOffset: 0, 20343 overscan: 1, 20344 paddingStart: 0, 20345 paddingEnd: 0, 20346 scrollPaddingStart: 0, 20347 scrollPaddingEnd: 0, 20348 horizontal: !1, 20349 getItemKey: defaultKeyExtractor, 20350 rangeExtractor: defaultRangeExtractor, 20351 onChange: () => { 20352 }, 20353 measureElement, 20354 initialRect: { width: 0, height: 0 }, 20355 scrollMargin: 0, 20356 gap: 0, 20357 indexAttribute: "data-index", 20358 initialMeasurementsCache: [], 20359 lanes: 1, 20360 isScrollingResetDelay: 150, 20361 enabled: !0, 20362 isRtl: !1, 20363 useScrollendEvent: !1, 20364 useAnimationFrameWithResizeObserver: !1, 20365 ...opts2 20366 }; 20367 }, this.notify = (sync) => { 20368 var _a2, _b; 20369 (_b = (_a2 = this.options).onChange) == null || _b.call(_a2, this, sync); 20370 }, this.maybeNotify = memo2( 20371 () => (this.calculateRange(), [ 20372 this.isScrolling, 20373 this.range ? this.range.startIndex : null, 20374 this.range ? this.range.endIndex : null 20375 ]), 20376 (isScrolling) => { 20377 this.notify(isScrolling); 20378 }, 20379 { 20380 key: !1, 20381 debug: () => this.options.debug, 20382 initialDeps: [ 20383 this.isScrolling, 20384 this.range ? this.range.startIndex : null, 20385 this.range ? this.range.endIndex : null 20386 ] 20387 } 20388 ), this.cleanup = () => { 20389 this.unsubs.filter(Boolean).forEach((d2) => d2()), this.unsubs = [], this.observer.disconnect(), this.scrollElement = null, this.targetWindow = null; 20390 }, this._didMount = () => () => { 20391 this.cleanup(); 20392 }, this._willUpdate = () => { 20393 var _a2; 20394 let scrollElement = this.options.enabled ? this.options.getScrollElement() : null; 20395 if (this.scrollElement !== scrollElement) { 20396 if (this.cleanup(), !scrollElement) { 20397 this.maybeNotify(); 20398 return; 20399 } 20400 this.scrollElement = scrollElement, this.scrollElement && "ownerDocument" in this.scrollElement ? this.targetWindow = this.scrollElement.ownerDocument.defaultView : this.targetWindow = ((_a2 = this.scrollElement) == null ? void 0 : _a2.window) ?? null, this.elementsCache.forEach((cached) => { 20401 this.observer.observe(cached); 20402 }), this._scrollToOffset(this.getScrollOffset(), { 20403 adjustments: void 0, 20404 behavior: void 0 20405 }), this.unsubs.push( 20406 this.options.observeElementRect(this, (rect) => { 20407 this.scrollRect = rect, this.maybeNotify(); 20408 }) 20409 ), this.unsubs.push( 20410 this.options.observeElementOffset(this, (offset2, isScrolling) => { 20411 this.scrollAdjustments = 0, this.scrollDirection = isScrolling ? this.getScrollOffset() < offset2 ? "forward" : "backward" : null, this.scrollOffset = offset2, this.isScrolling = isScrolling, this.maybeNotify(); 20412 }) 20413 ); 20414 } 20415 }, this.getSize = () => this.options.enabled ? (this.scrollRect = this.scrollRect ?? this.options.initialRect, this.scrollRect[this.options.horizontal ? "width" : "height"]) : (this.scrollRect = null, 0), this.getScrollOffset = () => this.options.enabled ? (this.scrollOffset = this.scrollOffset ?? (typeof this.options.initialOffset == "function" ? this.options.initialOffset() : this.options.initialOffset), this.scrollOffset) : (this.scrollOffset = null, 0), this.getFurthestMeasurement = (measurements, index) => { 20416 let furthestMeasurementsFound = /* @__PURE__ */ new Map(), furthestMeasurements = /* @__PURE__ */ new Map(); 20417 for (let m2 = index - 1; m2 >= 0; m2--) { 20418 let measurement = measurements[m2]; 20419 if (furthestMeasurementsFound.has(measurement.lane)) 20420 continue; 20421 let previousFurthestMeasurement = furthestMeasurements.get( 20422 measurement.lane 20423 ); 20424 if (previousFurthestMeasurement == null || measurement.end > previousFurthestMeasurement.end ? furthestMeasurements.set(measurement.lane, measurement) : measurement.end < previousFurthestMeasurement.end && furthestMeasurementsFound.set(measurement.lane, !0), furthestMeasurementsFound.size === this.options.lanes) 20425 break; 20426 } 20427 return furthestMeasurements.size === this.options.lanes ? Array.from(furthestMeasurements.values()).sort((a2, b2) => a2.end === b2.end ? a2.index - b2.index : a2.end - b2.end)[0] : void 0; 20428 }, this.getMeasurementOptions = memo2( 20429 () => [ 20430 this.options.count, 20431 this.options.paddingStart, 20432 this.options.scrollMargin, 20433 this.options.getItemKey, 20434 this.options.enabled 20435 ], 20436 (count, paddingStart, scrollMargin, getItemKey, enabled) => (this.pendingMeasuredCacheIndexes = [], { 20437 count, 20438 paddingStart, 20439 scrollMargin, 20440 getItemKey, 20441 enabled 20442 }), 20443 { 20444 key: !1 20445 } 20446 ), this.getMeasurements = memo2( 20447 () => [this.getMeasurementOptions(), this.itemSizeCache], 20448 ({ count, paddingStart, scrollMargin, getItemKey, enabled }, itemSizeCache) => { 20449 if (!enabled) 20450 return this.measurementsCache = [], this.itemSizeCache.clear(), []; 20451 this.measurementsCache.length === 0 && (this.measurementsCache = this.options.initialMeasurementsCache, this.measurementsCache.forEach((item) => { 20452 this.itemSizeCache.set(item.key, item.size); 20453 })); 20454 let min = this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0; 20455 this.pendingMeasuredCacheIndexes = []; 20456 let measurements = this.measurementsCache.slice(0, min); 20457 for (let i2 = min; i2 < count; i2++) { 20458 let key = getItemKey(i2), furthestMeasurement = this.options.lanes === 1 ? measurements[i2 - 1] : this.getFurthestMeasurement(measurements, i2), start = furthestMeasurement ? furthestMeasurement.end + this.options.gap : paddingStart + scrollMargin, measuredSize = itemSizeCache.get(key), size = typeof measuredSize == "number" ? measuredSize : this.options.estimateSize(i2), end = start + size, lane = furthestMeasurement ? furthestMeasurement.lane : i2 % this.options.lanes; 20459 measurements[i2] = { 20460 index: i2, 20461 start, 20462 size, 20463 end, 20464 key, 20465 lane 20466 }; 20467 } 20468 return this.measurementsCache = measurements, measurements; 20469 }, 20470 { 20471 key: !1, 20472 debug: () => this.options.debug 20473 } 20474 ), this.calculateRange = memo2( 20475 () => [ 20476 this.getMeasurements(), 20477 this.getSize(), 20478 this.getScrollOffset(), 20479 this.options.lanes 20480 ], 20481 (measurements, outerSize, scrollOffset, lanes) => this.range = measurements.length > 0 && outerSize > 0 ? calculateRange({ 20482 measurements, 20483 outerSize, 20484 scrollOffset, 20485 lanes 20486 }) : null, 20487 { 20488 key: !1, 20489 debug: () => this.options.debug 20490 } 20491 ), this.getVirtualIndexes = memo2( 20492 () => { 20493 let startIndex = null, endIndex = null, range = this.calculateRange(); 20494 return range && (startIndex = range.startIndex, endIndex = range.endIndex), this.maybeNotify.updateDeps([this.isScrolling, startIndex, endIndex]), [ 20495 this.options.rangeExtractor, 20496 this.options.overscan, 20497 this.options.count, 20498 startIndex, 20499 endIndex 20500 ]; 20501 }, 20502 (rangeExtractor, overscan, count, startIndex, endIndex) => startIndex === null || endIndex === null ? [] : rangeExtractor({ 20503 startIndex, 20504 endIndex, 20505 overscan, 20506 count 20507 }), 20508 { 20509 key: !1, 20510 debug: () => this.options.debug 20511 } 20512 ), this.indexFromElement = (node) => { 20513 let attributeName = this.options.indexAttribute, indexStr = node.getAttribute(attributeName); 20514 return indexStr ? parseInt(indexStr, 10) : (console.warn( 20515 `Missing attribute name '${attributeName}={index}' on measured element.` 20516 ), -1); 20517 }, this._measureElement = (node, entry) => { 20518 let index = this.indexFromElement(node), item = this.measurementsCache[index]; 20519 if (!item) 20520 return; 20521 let key = item.key, prevNode = this.elementsCache.get(key); 20522 prevNode !== node && (prevNode && this.observer.unobserve(prevNode), this.observer.observe(node), this.elementsCache.set(key, node)), node.isConnected && this.resizeItem(index, this.options.measureElement(node, entry, this)); 20523 }, this.resizeItem = (index, size) => { 20524 let item = this.measurementsCache[index]; 20525 if (!item) 20526 return; 20527 let itemSize = this.itemSizeCache.get(item.key) ?? item.size, delta = size - itemSize; 20528 delta !== 0 && ((this.shouldAdjustScrollPositionOnItemSizeChange !== void 0 ? this.shouldAdjustScrollPositionOnItemSizeChange(item, delta, this) : item.start < this.getScrollOffset() + this.scrollAdjustments) && this._scrollToOffset(this.getScrollOffset(), { 20529 adjustments: this.scrollAdjustments += delta, 20530 behavior: void 0 20531 }), this.pendingMeasuredCacheIndexes.push(item.index), this.itemSizeCache = new Map(this.itemSizeCache.set(item.key, size)), this.notify(!1)); 20532 }, this.measureElement = (node) => { 20533 if (!node) { 20534 this.elementsCache.forEach((cached, key) => { 20535 cached.isConnected || (this.observer.unobserve(cached), this.elementsCache.delete(key)); 20536 }); 20537 return; 20538 } 20539 this._measureElement(node, void 0); 20540 }, this.getVirtualItems = memo2( 20541 () => [this.getVirtualIndexes(), this.getMeasurements()], 20542 (indexes, measurements) => { 20543 let virtualItems = []; 20544 for (let k2 = 0, len = indexes.length; k2 < len; k2++) { 20545 let i2 = indexes[k2], measurement = measurements[i2]; 20546 virtualItems.push(measurement); 20547 } 20548 return virtualItems; 20549 }, 20550 { 20551 key: !1, 20552 debug: () => this.options.debug 20553 } 20554 ), this.getVirtualItemForOffset = (offset2) => { 20555 let measurements = this.getMeasurements(); 20556 if (measurements.length !== 0) 20557 return notUndefined( 20558 measurements[findNearestBinarySearch( 20559 0, 20560 measurements.length - 1, 20561 (index) => notUndefined(measurements[index]).start, 20562 offset2 20563 )] 20564 ); 20565 }, this.getOffsetForAlignment = (toOffset, align, itemSize = 0) => { 20566 let size = this.getSize(), scrollOffset = this.getScrollOffset(); 20567 align === "auto" && (align = toOffset >= scrollOffset + size ? "end" : "start"), align === "center" ? toOffset += (itemSize - size) / 2 : align === "end" && (toOffset -= size); 20568 let maxOffset = this.getTotalSize() + this.options.scrollMargin - size; 20569 return Math.max(Math.min(maxOffset, toOffset), 0); 20570 }, this.getOffsetForIndex = (index, align = "auto") => { 20571 index = Math.max(0, Math.min(index, this.options.count - 1)); 20572 let item = this.measurementsCache[index]; 20573 if (!item) 20574 return; 20575 let size = this.getSize(), scrollOffset = this.getScrollOffset(); 20576 if (align === "auto") 20577 if (item.end >= scrollOffset + size - this.options.scrollPaddingEnd) 20578 align = "end"; 20579 else if (item.start <= scrollOffset + this.options.scrollPaddingStart) 20580 align = "start"; 20581 else 20582 return [scrollOffset, align]; 20583 let toOffset = align === "end" ? item.end + this.options.scrollPaddingEnd : item.start - this.options.scrollPaddingStart; 20584 return [ 20585 this.getOffsetForAlignment(toOffset, align, item.size), 20586 align 20587 ]; 20588 }, this.isDynamicMode = () => this.elementsCache.size > 0, this.scrollToOffset = (toOffset, { align = "start", behavior } = {}) => { 20589 behavior === "smooth" && this.isDynamicMode() && console.warn( 20590 "The `smooth` scroll behavior is not fully supported with dynamic size." 20591 ), this._scrollToOffset(this.getOffsetForAlignment(toOffset, align), { 20592 adjustments: void 0, 20593 behavior 20594 }); 20595 }, this.scrollToIndex = (index, { align: initialAlign = "auto", behavior } = {}) => { 20596 behavior === "smooth" && this.isDynamicMode() && console.warn( 20597 "The `smooth` scroll behavior is not fully supported with dynamic size." 20598 ), index = Math.max(0, Math.min(index, this.options.count - 1)); 20599 let attempts = 0, maxAttempts = 10, tryScroll = (currentAlign) => { 20600 if (!this.targetWindow) return; 20601 let offsetInfo = this.getOffsetForIndex(index, currentAlign); 20602 if (!offsetInfo) { 20603 console.warn("Failed to get offset for index:", index); 20604 return; 20605 } 20606 let [offset2, align] = offsetInfo; 20607 this._scrollToOffset(offset2, { adjustments: void 0, behavior }), this.targetWindow.requestAnimationFrame(() => { 20608 let currentOffset = this.getScrollOffset(), afterInfo = this.getOffsetForIndex(index, align); 20609 if (!afterInfo) { 20610 console.warn("Failed to get offset for index:", index); 20611 return; 20612 } 20613 approxEqual(afterInfo[0], currentOffset) || scheduleRetry(align); 20614 }); 20615 }, scheduleRetry = (align) => { 20616 this.targetWindow && (attempts++, attempts < maxAttempts ? this.targetWindow.requestAnimationFrame(() => tryScroll(align)) : console.warn( 20617 `Failed to scroll to index ${index} after ${maxAttempts} attempts.` 20618 )); 20619 }; 20620 tryScroll(initialAlign); 20621 }, this.scrollBy = (delta, { behavior } = {}) => { 20622 behavior === "smooth" && this.isDynamicMode() && console.warn( 20623 "The `smooth` scroll behavior is not fully supported with dynamic size." 20624 ), this._scrollToOffset(this.getScrollOffset() + delta, { 20625 adjustments: void 0, 20626 behavior 20627 }); 20628 }, this.getTotalSize = () => { 20629 var _a2; 20630 let measurements = this.getMeasurements(), end; 20631 if (measurements.length === 0) 20632 end = this.options.paddingStart; 20633 else if (this.options.lanes === 1) 20634 end = ((_a2 = measurements[measurements.length - 1]) == null ? void 0 : _a2.end) ?? 0; 20635 else { 20636 let endByLane = Array(this.options.lanes).fill(null), endIndex = measurements.length - 1; 20637 for (; endIndex >= 0 && endByLane.some((val) => val === null); ) { 20638 let item = measurements[endIndex]; 20639 endByLane[item.lane] === null && (endByLane[item.lane] = item.end), endIndex--; 20640 } 20641 end = Math.max(...endByLane.filter((val) => val !== null)); 20642 } 20643 return Math.max( 20644 end - this.options.scrollMargin + this.options.paddingEnd, 20645 0 20646 ); 20647 }, this._scrollToOffset = (offset2, { 20648 adjustments, 20649 behavior 20650 }) => { 20651 this.options.scrollToFn(offset2, { behavior, adjustments }, this); 20652 }, this.measure = () => { 20653 this.itemSizeCache = /* @__PURE__ */ new Map(), this.notify(!1); 20654 }, this.setOptions(opts); 20655 } 20656}, findNearestBinarySearch = (low, high, getCurrentValue, value) => { 20657 for (; low <= high; ) { 20658 let middle = (low + high) / 2 | 0, currentValue = getCurrentValue(middle); 20659 if (currentValue < value) 20660 low = middle + 1; 20661 else if (currentValue > value) 20662 high = middle - 1; 20663 else 20664 return middle; 20665 } 20666 return low > 0 ? low - 1 : 0; 20667}; 20668function calculateRange({ 20669 measurements, 20670 outerSize, 20671 scrollOffset, 20672 lanes 20673}) { 20674 let lastIndex = measurements.length - 1, getOffset = (index) => measurements[index].start; 20675 if (measurements.length <= lanes) 20676 return { 20677 startIndex: 0, 20678 endIndex: lastIndex 20679 }; 20680 let startIndex = findNearestBinarySearch( 20681 0, 20682 lastIndex, 20683 getOffset, 20684 scrollOffset 20685 ), endIndex = startIndex; 20686 if (lanes === 1) 20687 for (; endIndex < lastIndex && measurements[endIndex].end < scrollOffset + outerSize; ) 20688 endIndex++; 20689 else if (lanes > 1) { 20690 let endPerLane = Array(lanes).fill(0); 20691 for (; endIndex < lastIndex && endPerLane.some((pos) => pos < scrollOffset + outerSize); ) { 20692 let item = measurements[endIndex]; 20693 endPerLane[item.lane] = item.end, endIndex++; 20694 } 20695 let startPerLane = Array(lanes).fill(scrollOffset + outerSize); 20696 for (; startIndex >= 0 && startPerLane.some((pos) => pos >= scrollOffset); ) { 20697 let item = measurements[startIndex]; 20698 startPerLane[item.lane] = item.start, startIndex--; 20699 } 20700 startIndex = Math.max(0, startIndex - startIndex % lanes), endIndex = Math.min(lastIndex, endIndex + (lanes - 1 - endIndex % lanes)); 20701 } 20702 return { startIndex, endIndex }; 20703} 20704 20705// ../../node_modules/@tanstack/react-virtual/dist/esm/index.js 20706var useIsomorphicLayoutEffect = typeof document < "u" ? useLayoutEffect : useEffect; 20707function useVirtualizerBase(options2) { 20708 let rerender = useReducer(() => ({}), {})[1], resolvedOptions = { 20709 ...options2, 20710 onChange: (instance2, sync) => { 20711 var _a2; 20712 sync ? flushSync(rerender) : rerender(), (_a2 = options2.onChange) == null || _a2.call(options2, instance2, sync); 20713 } 20714 }, [instance] = useState( 20715 () => new Virtualizer(resolvedOptions) 20716 ); 20717 return instance.setOptions(resolvedOptions), useIsomorphicLayoutEffect(() => instance._didMount(), []), useIsomorphicLayoutEffect(() => instance._willUpdate()), instance; 20718} 20719function useVirtualizer(options2) { 20720 return useVirtualizerBase({ 20721 observeElementRect, 20722 observeElementOffset, 20723 scrollToFn: elementScroll, 20724 ...options2 20725 }); 20726} 20727 20728// src/manager/components/sidebar/FIleSearchList.utils.tsx 20729init_react(); 20730var useArrowKeyNavigation = ({ 20731 parentRef, 20732 rowVirtualizer, 20733 selectedItem 20734}) => { 20735 useEffect(() => { 20736 let handleArrowKeys = (event) => { 20737 if (!parentRef.current) 20738 return; 20739 let maxIndex = rowVirtualizer.options.count, activeElement = document.activeElement, rowIndex = parseInt(activeElement.getAttribute("data-index") || "-1", 10), isActiveElementInput = activeElement.tagName === "INPUT", getFirstElement = () => document.querySelector('[data-index="0"]'), getLastElement = () => document.querySelector(`[data-index="${maxIndex - 1}"]`); 20740 if (event.code === "ArrowDown" && activeElement) { 20741 if (event.stopPropagation(), isActiveElementInput) { 20742 getFirstElement()?.focus(); 20743 return; 20744 } 20745 if (rowIndex === maxIndex - 1) { 20746 flushSync(() => { 20747 rowVirtualizer.scrollToIndex(0, { align: "start" }); 20748 }), setTimeout(() => { 20749 getFirstElement()?.focus(); 20750 }, 100); 20751 return; 20752 } 20753 if (selectedItem === rowIndex) { 20754 document.querySelector( 20755 `[data-index-position="${selectedItem}_first"]` 20756 )?.focus(); 20757 return; 20758 } 20759 if (selectedItem !== null && activeElement.getAttribute("data-index-position")?.includes("last")) { 20760 document.querySelector( 20761 `[data-index="${selectedItem + 1}"]` 20762 )?.focus(); 20763 return; 20764 } 20765 activeElement.nextElementSibling?.focus(); 20766 } 20767 if (event.code === "ArrowUp" && activeElement) { 20768 if (isActiveElementInput) { 20769 flushSync(() => { 20770 rowVirtualizer.scrollToIndex(maxIndex - 1, { align: "start" }); 20771 }), setTimeout(() => { 20772 getLastElement()?.focus(); 20773 }, 100); 20774 return; 20775 } 20776 if (selectedItem !== null && activeElement.getAttribute("data-index-position")?.includes("first")) { 20777 document.querySelector( 20778 `[data-index="${selectedItem}"]` 20779 )?.focus(); 20780 return; 20781 } 20782 activeElement.previousElementSibling?.focus(); 20783 } 20784 }; 20785 return document.addEventListener("keydown", handleArrowKeys, { capture: !0 }), () => { 20786 document.removeEventListener("keydown", handleArrowKeys, { capture: !0 }); 20787 }; 20788 }, [rowVirtualizer, selectedItem, parentRef]); 20789}; 20790 20791// src/manager/components/sidebar/FileList.tsx 20792var FileListWrapper = styled("div")(({ theme }) => ({ 20793 marginTop: "-16px", 20794 // after element which fades out the list 20795 "&::after": { 20796 content: '""', 20797 position: "fixed", 20798 pointerEvents: "none", 20799 bottom: 0, 20800 left: 0, 20801 right: 0, 20802 height: "80px", 20803 background: `linear-gradient(${rgba(theme.barBg, 0)} 10%, ${theme.barBg} 80%)` 20804 } 20805})), FileList = styled("div")({ 20806 height: "280px", 20807 overflow: "auto", 20808 msOverflowStyle: "none", 20809 scrollbarWidth: "none", 20810 position: "relative", 20811 "::-webkit-scrollbar": { 20812 display: "none" 20813 } 20814}), FileListLi = styled("li")(({ theme }) => ({ 20815 ":focus-visible": { 20816 outline: "none", 20817 ".file-list-item": { 20818 borderRadius: "4px", 20819 background: theme.base === "dark" ? "rgba(255,255,255,.1)" : theme.color.mediumlight, 20820 "> svg": { 20821 display: "flex" 20822 } 20823 } 20824 } 20825})), FileListItem = styled("div")({ 20826 display: "flex", 20827 flexDirection: "column", 20828 position: "relative" 20829}), FileListItemContentWrapper = styled.div(({ theme, selected, disabled, error }) => ({ 20830 display: "flex", 20831 alignItems: "flex-start", 20832 gap: "8px", 20833 alignSelf: "stretch", 20834 padding: "8px 16px", 20835 cursor: "pointer", 20836 borderRadius: "4px", 20837 ...selected && { 20838 borderRadius: "4px", 20839 background: theme.base === "dark" ? "rgba(255,255,255,.1)" : theme.color.mediumlight, 20840 "> svg": { 20841 display: "flex" 20842 } 20843 }, 20844 ...disabled && { 20845 cursor: "not-allowed", 20846 div: { 20847 color: `${theme.textMutedColor} !important` 20848 } 20849 }, 20850 ...error && { 20851 background: theme.base === "light" ? "#00000011" : "#00000033" 20852 }, 20853 "&:hover": { 20854 background: error ? "#00000022" : theme.base === "dark" ? "rgba(255,255,255,.1)" : theme.color.mediumlight, 20855 "> svg": { 20856 display: "flex" 20857 } 20858 } 20859})), FileListUl = styled("ul")({ 20860 margin: 0, 20861 padding: "0 0 0 0", 20862 width: "100%", 20863 position: "relative" 20864}), FileListItemContent = styled("div")({ 20865 display: "flex", 20866 flexDirection: "column", 20867 alignItems: "flex-start", 20868 width: "calc(100% - 50px)" 20869}), FileListIconWrapper = styled("div")(({ theme, error }) => ({ 20870 color: error ? theme.color.negativeText : theme.color.secondary 20871})), FileListItemLabel = styled("div")(({ theme, error }) => ({ 20872 color: error ? theme.color.negativeText : theme.base === "dark" ? theme.color.lighter : theme.color.darkest, 20873 fontSize: "14px", 20874 whiteSpace: "nowrap", 20875 textOverflow: "ellipsis", 20876 overflow: "hidden", 20877 maxWidth: "100%" 20878})), FileListItemPath = styled("div")(({ theme }) => ({ 20879 color: theme.textMutedColor, 20880 fontSize: "14px", 20881 whiteSpace: "nowrap", 20882 textOverflow: "ellipsis", 20883 overflow: "hidden", 20884 maxWidth: "100%" 20885})), FileListExport = styled("ul")({ 20886 margin: 0, 20887 padding: 0 20888}), FileListItemExport = styled("li")(({ theme, error }) => ({ 20889 padding: "8px 16px 8px 58px", 20890 display: "flex", 20891 gap: "8px", 20892 alignItems: "center", 20893 justifyContent: "space-between", 20894 fontSize: "14px", 20895 cursor: "pointer", 20896 borderRadius: "4px", 20897 ":focus-visible": { 20898 outline: "none" 20899 }, 20900 ...error && { 20901 background: "#F9ECEC", 20902 color: theme.color.negativeText 20903 }, 20904 "&:hover,:focus-visible": { 20905 background: error ? "#F9ECEC" : theme.base === "dark" ? "rgba(255, 255, 255, 0.1)" : theme.color.mediumlight, 20906 "> svg": { 20907 display: "flex" 20908 } 20909 }, 20910 "> div > svg": { 20911 color: error ? theme.color.negativeText : theme.color.secondary 20912 } 20913})), FileListItemExportName = styled("div")({ 20914 display: "flex", 20915 alignItems: "center", 20916 gap: "8px", 20917 width: "calc(100% - 20px)" 20918}), FileListItemExportNameContent = styled("span")(({ theme }) => ({ 20919 whiteSpace: "nowrap", 20920 textOverflow: "ellipsis", 20921 overflow: "hidden", 20922 display: "inline-block", 20923 color: theme.base === "dark" ? theme.color.lightest : theme.color.darkest 20924})), FileListItemExportNameContentWithExport = styled(FileListItemExportNameContent)({ 20925 maxWidth: "calc(100% - 120px)" 20926}), DefaultExport = styled("span")(({ theme }) => ({ 20927 display: "inline-block", 20928 padding: `1px ${theme.appBorderRadius}px`, 20929 borderRadius: "2px", 20930 fontSize: "10px", 20931 color: theme.color.defaultText, 20932 backgroundColor: theme.base === "dark" ? "rgba(255, 255, 255, 0.1)" : "#F2F4F5" 20933})), NoResults = styled("div")(({ theme }) => ({ 20934 textAlign: "center", 20935 maxWidth: "334px", 20936 margin: "16px auto 50px auto", 20937 fontSize: "14px", 20938 color: theme.base === "dark" ? theme.color.lightest : "#000" 20939})), NoResultsDescription = styled("p")(({ theme }) => ({ 20940 margin: 0, 20941 color: theme.textMutedColor 20942})); 20943 20944// src/manager/components/sidebar/FileSearchListSkeleton.tsx 20945init_react(); 20946var FileListItemContentWrapperSkeleton = styled("div")(({ theme }) => ({ 20947 display: "flex", 20948 alignItems: "flex-start", 20949 gap: "8px", 20950 alignSelf: "stretch", 20951 padding: "8px 16px" 20952})), FileListItemContentSkeleton = styled("div")({ 20953 display: "flex", 20954 flexDirection: "column", 20955 alignItems: "flex-start", 20956 width: "100%", 20957 borderRadius: "3px" 20958}), FileListIconWrapperSkeleton = styled.div(({ theme }) => ({ 20959 width: "14px", 20960 height: "14px", 20961 borderRadius: "3px", 20962 marginTop: "1px", 20963 background: theme.base === "dark" ? "rgba(255,255,255,.1)" : "rgba(0,0,0,.1)", 20964 animation: `${theme.animation.glow} 1.5s ease-in-out infinite` 20965})), FileListItemSkeleton = styled.div(({ theme }) => ({ 20966 height: "16px", 20967 borderRadius: "3px", 20968 background: theme.base === "dark" ? "rgba(255,255,255,.1)" : "rgba(0,0,0,.1)", 20969 animation: `${theme.animation.glow} 1.5s ease-in-out infinite`, 20970 width: "100%", 20971 maxWidth: "100%", 20972 "+ div": { 20973 marginTop: "6px" 20974 } 20975})), FileSearchListLoadingSkeleton = () => react_default.createElement(FileList, null, [1, 2, 3].map((result) => react_default.createElement(FileListItem, { key: result }, react_default.createElement(FileListItemContentWrapperSkeleton, null, react_default.createElement(FileListIconWrapperSkeleton, null), react_default.createElement(FileListItemContentSkeleton, null, react_default.createElement(FileListItemSkeleton, { style: { width: "90px" } }), react_default.createElement(FileListItemSkeleton, { style: { width: "300px" } })))))); 20976 20977// src/manager/components/sidebar/FileSearchList.tsx 20978var TreeExpandIconStyled = styled(ChevronSmallRightIcon)(({ theme }) => ({ 20979 color: theme.textMutedColor, 20980 marginTop: 2 20981})), TreeCollapseIconStyled = styled(ChevronSmallDownIcon)(({ theme }) => ({ 20982 color: theme.textMutedColor, 20983 marginTop: 2 20984})), FileSearchList = memo(function({ 20985 isLoading, 20986 searchResults, 20987 onNewStory, 20988 errorItemId 20989}) { 20990 let [selectedItem, setSelectedItem] = useState(null), parentRef = react_default.useRef(), sortedSearchResults = useMemo(() => [...searchResults ?? []].sort((a2, b2) => { 20991 let isALowPriority = a2.exportedComponents === null || a2.exportedComponents?.length === 0, hasAStory = a2.storyFileExists, isBLowPriority = b2.exportedComponents === null || b2.exportedComponents?.length === 0, hasBStory = b2.storyFileExists; 20992 return hasAStory && !hasBStory ? -1 : hasBStory && !hasAStory || isALowPriority && !isBLowPriority ? 1 : !isALowPriority && isBLowPriority ? -1 : 0; 20993 }), [searchResults]), count = searchResults?.length || 0, rowVirtualizer = useVirtualizer({ 20994 count, 20995 // @ts-expect-error (non strict) 20996 getScrollElement: () => parentRef.current, 20997 paddingStart: 16, 20998 paddingEnd: 40, 20999 estimateSize: () => 54, 21000 overscan: 2 21001 }); 21002 useArrowKeyNavigation({ rowVirtualizer, parentRef, selectedItem }); 21003 let handleFileItemSelection = useCallback( 21004 ({ virtualItem, searchResult, itemId }) => { 21005 searchResult?.exportedComponents?.length > 1 ? setSelectedItem((sItem) => sItem === virtualItem.index ? null : virtualItem.index) : searchResult?.exportedComponents?.length === 1 && onNewStory({ 21006 componentExportName: searchResult.exportedComponents[0].name, 21007 componentFilePath: searchResult.filepath, 21008 componentIsDefaultExport: searchResult.exportedComponents[0].default, 21009 selectedItemId: itemId, 21010 componentExportCount: 1 21011 }); 21012 }, 21013 [onNewStory] 21014 ), handleFileItemComponentSelection = useCallback( 21015 ({ searchResult, component, id }) => { 21016 onNewStory({ 21017 componentExportName: component.name, 21018 componentFilePath: searchResult.filepath, 21019 componentIsDefaultExport: component.default, 21020 selectedItemId: id, 21021 // @ts-expect-error (non strict) 21022 componentExportCount: searchResult.exportedComponents.length 21023 }); 21024 }, 21025 [onNewStory] 21026 ), ListItem2 = useCallback( 21027 ({ 21028 virtualItem, 21029 selected, 21030 searchResult, 21031 noExports 21032 }) => { 21033 let itemError = errorItemId === searchResult.filepath, itemSelected = selected === virtualItem.index, tooltip = noExports ? "We can't evaluate exports for this file. Automatic story creation is disabled." : void 0; 21034 return react_default.createElement( 21035 FileListItem, 21036 { 21037 "aria-expanded": itemSelected, 21038 "aria-controls": `file-list-export-${virtualItem.index}`, 21039 id: `file-list-item-wrapper-${virtualItem.index}` 21040 }, 21041 react_default.createElement( 21042 TooltipProvider, 21043 { 21044 tooltip: tooltip ? react_default.createElement(TooltipNote, { note: tooltip }) : void 0, 21045 placement: "top-start", 21046 delayHide: 100, 21047 delayShow: 200 21048 }, 21049 react_default.createElement( 21050 FileListItemContentWrapper, 21051 { 21052 className: "file-list-item", 21053 selected: itemSelected, 21054 error: itemError, 21055 disabled: noExports 21056 }, 21057 itemSelected ? react_default.createElement(TreeCollapseIconStyled, { size: 14 }) : react_default.createElement(TreeExpandIconStyled, { size: 14 }), 21058 react_default.createElement(FileListIconWrapper, { error: itemError }, react_default.createElement(ComponentIcon, null)), 21059 react_default.createElement(FileListItemContent, null, react_default.createElement(FileListItemLabel, { error: itemError }, searchResult.filepath.split("/").at(-1)), react_default.createElement(FileListItemPath, null, searchResult.filepath)) 21060 ) 21061 ), 21062 searchResult?.exportedComponents?.length > 1 && itemSelected && react_default.createElement( 21063 FileListExport, 21064 { 21065 role: "region", 21066 id: `file-list-export-${virtualItem.index}`, 21067 "aria-labelledby": `file-list-item-wrapper-${virtualItem.index}`, 21068 onClick: (e2) => { 21069 e2.stopPropagation(); 21070 }, 21071 onKeyUp: (e2) => { 21072 e2.key === "Enter" && e2.stopPropagation(); 21073 } 21074 }, 21075 searchResult.exportedComponents?.map((component, itemExportId) => { 21076 let itemExportError = errorItemId === `${searchResult.filepath}_${itemExportId}`, position = itemExportId === 0 ? "first" : ( 21077 // @ts-expect-error (non strict) 21078 itemExportId === searchResult.exportedComponents.length - 1 ? "last" : "middle" 21079 ); 21080 return react_default.createElement( 21081 FileListItemExport, 21082 { 21083 tabIndex: 0, 21084 "data-index-position": `${virtualItem.index}_${position}`, 21085 key: component.name, 21086 error: itemExportError, 21087 onClick: () => { 21088 handleFileItemComponentSelection({ 21089 searchResult, 21090 component, 21091 id: `${searchResult.filepath}_${itemExportId}` 21092 }); 21093 }, 21094 onKeyUp: (event) => { 21095 event.key === "Enter" && handleFileItemComponentSelection({ 21096 searchResult, 21097 component, 21098 id: `${searchResult.filepath}_${itemExportId}` 21099 }); 21100 } 21101 }, 21102 react_default.createElement(FileListItemExportName, null, react_default.createElement(BookmarkHollowIcon, null), component.default ? react_default.createElement(react_default.Fragment, null, react_default.createElement(FileListItemExportNameContentWithExport, null, searchResult.filepath.split("/").at(-1)?.split(".")?.at(0)), react_default.createElement(DefaultExport, null, "Default export")) : react_default.createElement(FileListItemExportNameContent, null, component.name)) 21103 ); 21104 }) 21105 ) 21106 ); 21107 }, 21108 [handleFileItemComponentSelection, errorItemId] 21109 ); 21110 return isLoading && (searchResults === null || searchResults?.length === 0) ? react_default.createElement(FileSearchListLoadingSkeleton, null) : searchResults?.length === 0 ? react_default.createElement(NoResults, null, react_default.createElement("p", null, "We could not find any file with that name"), react_default.createElement(NoResultsDescription, null, "You may want to try using different keywords, check for typos, and adjust your filters")) : sortedSearchResults?.length > 0 ? react_default.createElement(FileListWrapper, null, react_default.createElement(FileList, { ref: parentRef }, react_default.createElement( 21111 FileListUl, 21112 { 21113 style: { 21114 height: `${rowVirtualizer.getTotalSize()}px` 21115 } 21116 }, 21117 rowVirtualizer.getVirtualItems().map((virtualItem) => { 21118 let searchResult = sortedSearchResults[virtualItem.index], noExports = searchResult.exportedComponents === null || searchResult.exportedComponents?.length === 0, itemProps = {}; 21119 return react_default.createElement( 21120 FileListLi, 21121 { 21122 key: virtualItem.key, 21123 "data-index": virtualItem.index, 21124 ref: rowVirtualizer.measureElement, 21125 onClick: () => { 21126 handleFileItemSelection({ 21127 virtualItem, 21128 itemId: searchResult.filepath, 21129 searchResult 21130 }); 21131 }, 21132 onKeyUp: (event) => { 21133 event.key === "Enter" && handleFileItemSelection({ 21134 virtualItem, 21135 itemId: searchResult.filepath, 21136 searchResult 21137 }); 21138 }, 21139 style: { 21140 position: "absolute", 21141 top: 0, 21142 left: 0, 21143 width: "100%", 21144 transform: `translateY(${virtualItem.start}px)` 21145 }, 21146 tabIndex: 0 21147 }, 21148 react_default.createElement( 21149 ListItem2, 21150 { 21151 ...itemProps, 21152 key: virtualItem.index, 21153 searchResult, 21154 selected: selectedItem, 21155 virtualItem, 21156 noExports 21157 } 21158 ) 21159 ); 21160 }) 21161 ))) : null; 21162}); 21163 21164// src/manager/components/sidebar/FileSearchModal.tsx 21165var MODAL_HEIGHT = 418, ModalStyled = styled(Modal)(() => ({ 21166 boxShadow: "none", 21167 background: "transparent", 21168 overflow: "visible" 21169})), ModalChild = styled.div(({ theme, height }) => ({ 21170 backgroundColor: theme.background.bar, 21171 borderRadius: 6, 21172 boxShadow: "rgba(255, 255, 255, 0.05) 0 0 0 1px inset, rgba(14, 18, 22, 0.35) 0px 10px 18px -10px", 21173 padding: "16px", 21174 transition: "height 0.3s", 21175 height: height ? `${height + 32}px` : "auto", 21176 overflow: "hidden" 21177})), ModalContent = styled(Modal.Content)(({ theme }) => ({ 21178 margin: 0, 21179 color: theme.color.defaultText 21180})), ModalInput = styled(Form.Input)(({ theme }) => ({ 21181 paddingLeft: 40, 21182 paddingRight: 28, 21183 fontSize: 14, 21184 height: 40, 21185 ...theme.base === "light" && { 21186 color: theme.color.darkest 21187 }, 21188 "::placeholder": { 21189 color: theme.color.mediumdark 21190 }, 21191 "&:invalid:not(:placeholder-shown)": { 21192 boxShadow: `${theme.color.negative} 0 0 0 1px inset` 21193 }, 21194 "&::-webkit-search-decoration, &::-webkit-search-cancel-button, &::-webkit-search-results-button, &::-webkit-search-results-decoration": { 21195 display: "none" 21196 } 21197})), SearchField = styled.div({ 21198 display: "flex", 21199 flexDirection: "column", 21200 flexGrow: 1, 21201 position: "relative" 21202}), SearchIconWrapper = styled.div(({ theme }) => ({ 21203 position: "absolute", 21204 top: 0, 21205 left: 16, 21206 zIndex: 1, 21207 pointerEvents: "none", 21208 color: theme.darkest, 21209 display: "flex", 21210 alignItems: "center", 21211 height: "100%" 21212})), LoadingIcon = styled.div(({ theme }) => ({ 21213 position: "absolute", 21214 top: 0, 21215 right: 16, 21216 zIndex: 1, 21217 color: theme.darkest, 21218 display: "flex", 21219 alignItems: "center", 21220 height: "100%", 21221 "@keyframes spin": { 21222 from: { transform: "rotate(0deg)" }, 21223 to: { transform: "rotate(360deg)" } 21224 }, 21225 animation: "spin 1s linear infinite" 21226})), ModalError = styled(Modal.Error)({ 21227 position: "absolute", 21228 padding: "8px 40px 8px 16px", 21229 bottom: 0, 21230 maxHeight: "initial", 21231 width: "100%", 21232 div: { 21233 wordBreak: "break-word" 21234 }, 21235 "> div": { 21236 padding: 0 21237 } 21238}), ModalErrorCloseIcon = styled(CloseAltIcon)({ 21239 position: "absolute", 21240 top: 4, 21241 right: -24, 21242 cursor: "pointer" 21243}), FileSearchModal = ({ 21244 open, 21245 onOpenChange, 21246 fileSearchQuery, 21247 setFileSearchQuery, 21248 isLoading, 21249 error, 21250 searchResults, 21251 onCreateNewStory, 21252 setError 21253}) => { 21254 let [modalContentRef, modalContentDimensions] = useMeasure(), [modalMaxHeight, setModalMaxHeight] = useState(modalContentDimensions.height), [, startTransition2] = useTransition(), [searchInputValue, setSearchInputValue] = useState(fileSearchQuery); 21255 return useEffect(() => { 21256 modalMaxHeight < modalContentDimensions.height && setModalMaxHeight(modalContentDimensions.height); 21257 }, [modalContentDimensions.height, modalMaxHeight]), react_default.createElement( 21258 ModalStyled, 21259 { 21260 ariaLabel: "Add a new story", 21261 height: MODAL_HEIGHT, 21262 width: 440, 21263 open, 21264 onOpenChange 21265 }, 21266 react_default.createElement(ModalChild, { height: fileSearchQuery === "" ? modalContentDimensions.height : modalMaxHeight }, react_default.createElement(ModalContent, { ref: modalContentRef }, react_default.createElement(Modal.Header, null, react_default.createElement(Modal.Title, null, "Add a new story"), react_default.createElement(Modal.Description, null, "We will create a new story for your component")), react_default.createElement(SearchField, null, react_default.createElement(SearchIconWrapper, null, react_default.createElement(SearchIcon, null)), react_default.createElement( 21267 ModalInput, 21268 { 21269 placeholder: "./components/**/*.tsx", 21270 type: "search", 21271 required: !0, 21272 autoFocus: !0, 21273 value: searchInputValue, 21274 onChange: (e2) => { 21275 let newValue = e2.target.value; 21276 setSearchInputValue(newValue), startTransition2(() => { 21277 setFileSearchQuery(newValue); 21278 }); 21279 } 21280 } 21281 ), isLoading && react_default.createElement(LoadingIcon, null, react_default.createElement(SyncIcon, null))), react_default.createElement( 21282 FileSearchList, 21283 { 21284 errorItemId: error?.selectedItemId, 21285 isLoading, 21286 searchResults, 21287 onNewStory: onCreateNewStory 21288 } 21289 ))), 21290 error && fileSearchQuery !== "" && react_default.createElement(ModalError, null, react_default.createElement("div", null, error.error), react_default.createElement( 21291 ModalErrorCloseIcon, 21292 { 21293 onClick: () => { 21294 setError(null); 21295 } 21296 } 21297 )) 21298 ); 21299}; 21300 21301// src/manager/utils/trySelectStory.ts 21302async function trySelectStory(selectStory, storyId, attempt = 1) { 21303 if (attempt > 10) 21304 throw new Error("We could not select the new story. Please try again."); 21305 try { 21306 selectStory(storyId); 21307 } catch { 21308 return await new Promise((resolve) => setTimeout(resolve, 500)), trySelectStory(selectStory, storyId, attempt + 1); 21309 } 21310} 21311 21312// src/manager/components/sidebar/CreateNewStoryFileModal.tsx 21313var isRendererReact = scope.STORYBOOK_RENDERER === "react", CreateNewStoryFileModal = ({ open, onOpenChange }) => { 21314 let [isLoading, setLoading] = useState(!1), [fileSearchQuery, setFileSearchQuery] = useState(""), fileSearchQueryDebounced = useDebounce(fileSearchQuery, 600), fileSearchQueryDeferred = useDeferredValue(fileSearchQueryDebounced), emittedValue = useRef(null), [error, setError] = useState( 21315 null 21316 ), api = useStorybookApi(), hasRunGhostStoriesFlow = useRef(!1), [searchResults, setSearchResults] = useState(null), handleSuccessfullyCreatedStory = useCallback( 21317 (componentExportName) => { 21318 api.addNotification({ 21319 id: "create-new-story-file-success", 21320 content: { 21321 headline: "Story file created", 21322 subHeadline: `${componentExportName} was created` 21323 }, 21324 duration: 8e3, 21325 icon: react_default.createElement(CheckIcon, null) 21326 }), onOpenChange(!1); 21327 }, 21328 [api, onOpenChange] 21329 ), handleStoryAlreadyExists = useCallback(() => { 21330 api.addNotification({ 21331 id: "create-new-story-file-error", 21332 content: { 21333 headline: "Story already exists", 21334 subHeadline: "Successfully navigated to existing story" 21335 }, 21336 duration: 8e3, 21337 icon: react_default.createElement(CheckIcon, null) 21338 }), onOpenChange(!1); 21339 }, [api, onOpenChange]), handleFileSearch = useCallback(() => { 21340 setLoading(!0); 21341 let channel2 = addons.getChannel(), set = (data) => { 21342 data.id === fileSearchQueryDeferred && (data.success ? setSearchResults(data.payload.files) : setError({ error: data.error }), channel2.off(FILE_COMPONENT_SEARCH_RESPONSE, set), setLoading(!1), emittedValue.current = null); 21343 }; 21344 return channel2.on(FILE_COMPONENT_SEARCH_RESPONSE, set), fileSearchQueryDeferred !== "" && emittedValue.current !== fileSearchQueryDeferred ? (emittedValue.current = fileSearchQueryDeferred, channel2.emit(FILE_COMPONENT_SEARCH_REQUEST, { 21345 id: fileSearchQueryDeferred, 21346 payload: {} 21347 })) : (setSearchResults(null), setLoading(!1)), () => { 21348 channel2.off(FILE_COMPONENT_SEARCH_RESPONSE, set); 21349 }; 21350 }, [fileSearchQueryDeferred]), handleCreateNewStory = useCallback( 21351 async ({ 21352 componentExportName, 21353 componentFilePath, 21354 componentIsDefaultExport, 21355 componentExportCount, 21356 selectedItemId 21357 }) => { 21358 try { 21359 let channel2 = addons.getChannel(), createNewStoryResult = await experimental_requestResponse(channel2, CREATE_NEW_STORYFILE_REQUEST, CREATE_NEW_STORYFILE_RESPONSE, { 21360 componentExportName, 21361 componentFilePath, 21362 componentIsDefaultExport, 21363 componentExportCount 21364 }); 21365 setError(null); 21366 let storyId = createNewStoryResult.storyId; 21367 await trySelectStory(api.selectStory, storyId), handleSuccessfullyCreatedStory(componentExportName), handleFileSearch(); 21368 } catch (e2) { 21369 if (e2?.payload?.type === "STORY_FILE_EXISTS") { 21370 let err = e2; 21371 await trySelectStory(api.selectStory, err.payload.kind), handleStoryAlreadyExists(); 21372 } else 21373 setError({ selectedItemId, error: e2?.message }); 21374 } 21375 }, 21376 [api?.selectStory, handleSuccessfullyCreatedStory, handleFileSearch, handleStoryAlreadyExists] 21377 ); 21378 useEffect(() => { 21379 setError(null); 21380 }, [fileSearchQueryDeferred]), useEffect(() => handleFileSearch(), [handleFileSearch]); 21381 let executeGhostStoriesFlow = useCallback(async () => { 21382 addons.getChannel().emit(GHOST_STORIES_REQUEST); 21383 }, []); 21384 return useEffect(() => { 21385 open && isRendererReact && !hasRunGhostStoriesFlow.current && (hasRunGhostStoriesFlow.current = !0, executeGhostStoriesFlow()); 21386 }, [open, executeGhostStoriesFlow]), react_default.createElement( 21387 FileSearchModal, 21388 { 21389 error, 21390 fileSearchQuery, 21391 fileSearchQueryDeferred, 21392 onCreateNewStory: handleCreateNewStory, 21393 isLoading, 21394 onOpenChange, 21395 open, 21396 searchResults, 21397 setError, 21398 setFileSearchQuery 21399 } 21400 ); 21401}; 21402 21403// src/manager/components/sidebar/Explorer.tsx 21404init_react(); 21405 21406// src/manager/components/sidebar/HighlightStyles.tsx 21407init_react(); 21408var HighlightStyles = ({ refId, itemId }) => react_default.createElement( 21409 Global, 21410 { 21411 styles: ({ color: color2 }) => { 21412 let background2 = curriedTransparentize$1(0.85, color2.secondary); 21413 return { 21414 [`[data-ref-id="${refId}"][data-item-id="${itemId}"]:not([data-selected="true"])`]: { 21415 '&[data-nodetype="component"], &[data-nodetype="group"]': { 21416 background: background2, 21417 "&:hover, &:focus": { background: background2 } 21418 }, 21419 '&[data-nodetype="story"], &[data-nodetype="document"], &[data-nodetype="test"]': { 21420 color: color2.defaultText, 21421 background: background2, 21422 "&:hover, &:focus": { background: background2 } 21423 } 21424 } 21425 }; 21426 } 21427 } 21428); 21429 21430// src/manager/components/sidebar/Refs.tsx 21431init_react(); 21432 21433// src/shared/constants/tags.ts 21434var Tag2 = { 21435 /** Indicates that autodocs should be generated for this component */ 21436 AUTODOCS: "autodocs", 21437 /** MDX documentation attached to a component's stories file */ 21438 ATTACHED_MDX: "attached-mdx", 21439 /** Standalone MDX documentation not attached to stories */ 21440 UNATTACHED_MDX: "unattached-mdx", 21441 /** Story has a play function */ 21442 PLAY_FN: "play-fn", 21443 /** Story has a test function */ 21444 TEST_FN: "test-fn", 21445 /** Development environment tag */ 21446 DEV: "dev", 21447 /** Test environment tag */ 21448 TEST: "test", 21449 /** Manifest generation tag */ 21450 MANIFEST: "manifest" 21451}, BUILT_IN_FILTERS = { 21452 _docs: (entry, excluded) => excluded ? entry.type !== "docs" : entry.type === "docs", 21453 _play: (entry, excluded) => excluded ? entry.type !== "story" || !entry.tags?.includes(Tag2.PLAY_FN) : entry.type === "story" && !!entry.tags?.includes(Tag2.PLAY_FN), 21454 _test: (entry, excluded) => excluded ? entry.type !== "story" || entry.subtype !== "test" : entry.type === "story" && entry.subtype === "test" 21455}, USER_TAG_FILTER = (tag) => (entry, excluded) => excluded ? !entry.tags?.includes(tag) : !!entry.tags?.includes(tag); 21456 21457// src/shared/utils/story-index-filters.ts 21458var getActiveFilterCount = ({ 21459 includedTagFilters, 21460 excludedTagFilters, 21461 includedStatusFilters, 21462 excludedStatusFilters 21463}) => (includedTagFilters?.length ?? 0) + (excludedTagFilters?.length ?? 0) + (includedStatusFilters?.length ?? 0) + (excludedStatusFilters?.length ?? 0); 21464 21465// src/manager/utils/tree.ts 21466var import_memoizerific3 = __toESM(require_memoizerific(), 1); 21467var { document: document3, window: globalWindow } = scope, createId = (itemId, refId) => !refId || refId === DEFAULT_REF_ID ? itemId : `${refId}_${itemId}`, getLink = (item, refId) => `${document3.location.pathname}?path=/${item.type}/${createId(item.id, refId)}`; 21468var get = (0, import_memoizerific3.default)(1e3)((id, dataset) => dataset[id]), getParent = (0, import_memoizerific3.default)(1e3)((id, dataset) => { 21469 let item = get(id, dataset); 21470 return item && item.type !== "root" ? get(item.parent, dataset) : void 0; 21471}), getParents = (0, import_memoizerific3.default)(1e3)((id, dataset) => { 21472 let parent = getParent(id, dataset); 21473 return parent ? [parent, ...getParents(parent.id, dataset)] : []; 21474}), getAncestorIds2 = (0, import_memoizerific3.default)(1e3)( 21475 (data, id) => getParents(id, data).map((item) => item.id) 21476), getDescendantIds = (0, import_memoizerific3.default)(1e3)((data, id, skipLeafs) => { 21477 let entry = data[id]; 21478 return !entry || !("children" in entry) || !entry.children ? [] : entry.children.reduce((acc, childId) => { 21479 let child = data[childId]; 21480 return !child || skipLeafs && (child.type === "story" || child.type === "docs") || acc.push(childId, ...getDescendantIds(data, childId, skipLeafs)), acc; 21481 }, []); 21482}); 21483function getPath(item, ref) { 21484 let parent = item.type !== "root" && item.parent ? ref.index[item.parent] : null; 21485 return parent ? [...getPath(parent, ref), parent.name] : ref.id === DEFAULT_REF_ID ? [] : [ref.title || ref.id]; 21486} 21487var searchItem = (item, ref) => ({ ...item, refId: ref.id, path: getPath(item, ref) }); 21488function cycle2(array, index, delta) { 21489 let next = index + delta % array.length; 21490 return next < 0 && (next = array.length + next), next >= array.length && (next -= array.length), next; 21491} 21492var scrollIntoView = (element, center = !1) => { 21493 if (!element) 21494 return; 21495 let { top, bottom } = element.getBoundingClientRect(); 21496 if (!top || !bottom) 21497 return; 21498 let bottomOffset = document3?.querySelector("#sidebar-bottom-wrapper")?.getBoundingClientRect().top || globalWindow.innerHeight || document3.documentElement.clientHeight; 21499 bottom > bottomOffset && element.scrollIntoView({ block: center ? "center" : "nearest" }); 21500}, getStateType = (isLoading, isAuthRequired, isError2, isEmpty) => { 21501 switch (!0) { 21502 case isAuthRequired: 21503 return "auth"; 21504 case isError2: 21505 return "error"; 21506 case isLoading: 21507 return "loading"; 21508 case isEmpty: 21509 return "empty"; 21510 default: 21511 return "ready"; 21512 } 21513}, isAncestor = (element, maybeAncestor) => !element || !maybeAncestor ? !1 : element === maybeAncestor ? !0 : isAncestor(element.parentElement || void 0, maybeAncestor), removeNoiseFromName = (storyName) => storyName.replaceAll(/(\s|-|_)/gi, ""), isStoryHoistable = (storyName, componentName2) => removeNoiseFromName(storyName) === removeNoiseFromName(componentName2); 21514 21515// src/manager/components/sidebar/RefBlocks.tsx 21516init_react(); 21517 21518// src/manager/components/sidebar/Loader.tsx 21519init_react(); 21520var LOADER_SEQUENCE = [0, 0, 1, 1, 2, 3, 3, 3, 1, 1, 1, 2, 2, 2, 3], Loadingitem = styled.div( 21521 { 21522 cursor: "progress", 21523 fontSize: 13, 21524 height: "16px", 21525 marginTop: 4, 21526 marginBottom: 4, 21527 alignItems: "center", 21528 overflow: "hidden" 21529 }, 21530 ({ depth = 0 }) => ({ 21531 marginLeft: depth * 15, 21532 maxWidth: 85 - depth * 5 21533 }), 21534 ({ theme }) => theme.animation.inlineGlow, 21535 ({ theme }) => ({ 21536 background: theme.appBorderColor 21537 }) 21538), Contained = styled.div({ 21539 display: "flex", 21540 flexDirection: "column", 21541 paddingLeft: 20, 21542 paddingRight: 20 21543}), Loader2 = ({ size }) => { 21544 let repeats = Math.ceil(size / LOADER_SEQUENCE.length), sequence = Array.from(Array(repeats)).fill(LOADER_SEQUENCE).flat().slice(0, size); 21545 return react_default.createElement(Fragment, null, sequence.map((depth, index) => react_default.createElement(Loadingitem, { depth, key: index }))); 21546}; 21547 21548// src/manager/components/sidebar/NoResults.tsx 21549var NoResults2 = styled.div(({ theme }) => ({ 21550 display: "flex", 21551 flexDirection: "column", 21552 textAlign: "center", 21553 textWrap: "balance", 21554 gap: 4, 21555 padding: "20px 0", 21556 lineHeight: "18px", 21557 fontSize: `${theme.typography.size.s2}px`, 21558 color: theme.color.defaultText, 21559 small: { 21560 color: theme.textMutedColor, 21561 fontSize: `${theme.typography.size.s1}px` 21562 }, 21563 button: { 21564 marginTop: 8, 21565 alignSelf: "center" 21566 } 21567})); 21568 21569// src/manager/components/sidebar/RefBlocks.tsx 21570var { window: globalWindow2 } = scope, TextStyle = styled.div(({ theme }) => ({ 21571 fontSize: theme.typography.size.s2, 21572 lineHeight: "20px", 21573 margin: 0 21574})), Text3 = styled.div(({ theme }) => ({ 21575 fontSize: theme.typography.size.s2, 21576 lineHeight: "20px", 21577 margin: 0, 21578 code: { 21579 fontSize: theme.typography.size.s1 21580 }, 21581 ul: { 21582 paddingLeft: 20, 21583 marginTop: 8, 21584 marginBottom: 8 21585 } 21586})), ErrorDisplay = styled.pre( 21587 { 21588 boxSizing: "border-box", 21589 borderRadius: 8, 21590 overflow: "auto", 21591 whiteSpace: "pre" 21592 }, 21593 ({ isMobile: isMobile2 }) => isMobile2 ? { 21594 maxWidth: "calc(100vw - 40px)" 21595 } : { 21596 minWidth: 420, 21597 maxWidth: 640 21598 }, 21599 ({ theme }) => ({ 21600 color: theme.color.dark 21601 }) 21602), AuthBlock = ({ loginUrl, id }) => { 21603 let [isAuthAttempted, setAuthAttempted] = useState(!1), refresh = useCallback(() => { 21604 globalWindow2.document.location.reload(); 21605 }, []), open = useCallback((e2) => { 21606 e2.preventDefault(); 21607 let childWindow = globalWindow2.open(loginUrl, `storybook_auth_${id}`, "resizable,scrollbars"), timer = setInterval(() => { 21608 childWindow ? childWindow.closed && (clearInterval(timer), setAuthAttempted(!0)) : (logger.error("unable to access loginUrl window"), clearInterval(timer)); 21609 }, 1e3); 21610 }, []); 21611 return react_default.createElement(Contained, null, react_default.createElement(Spaced, null, isAuthAttempted ? react_default.createElement(Fragment, null, react_default.createElement(Text3, null, "Authentication on ", react_default.createElement("strong", null, loginUrl), " concluded. Refresh the page to fetch this Storybook."), react_default.createElement("div", null, react_default.createElement(Button, { ariaLabel: !1, size: "small", variant: "outline", onClick: refresh }, react_default.createElement(SyncIcon, null), "Refresh now"))) : react_default.createElement(Fragment, null, react_default.createElement(Text3, null, "Sign in to browse this Storybook."), react_default.createElement("div", null, react_default.createElement(Button, { size: "small", variant: "outline", onClick: open }, react_default.createElement(LockIcon, null), "Sign in"))))); 21612}, ErrorBlock = ({ error }) => { 21613 let { isMobile: isMobile2 } = useLayout(); 21614 return react_default.createElement(Contained, null, react_default.createElement(Spaced, null, react_default.createElement(TextStyle, null, "Oh no! Something went wrong loading this Storybook.", react_default.createElement("br", null), react_default.createElement( 21615 PopoverProvider, 21616 { 21617 ariaLabel: "Error details", 21618 hasCloseButton: !0, 21619 offset: isMobile2 ? 0 : 8, 21620 placement: isMobile2 ? "bottom-end" : "bottom-start", 21621 popover: react_default.createElement(ErrorDisplay, { isMobile: isMobile2 }, react_default.createElement(ErrorFormatter, { error })) 21622 }, 21623 react_default.createElement(Link, null, "View error ", react_default.createElement(ChevronDownIcon, null)) 21624 ), " ", react_default.createElement(Link, { href: "https://storybook.js.org/docs?ref=ui", cancel: !1, target: "_blank" }, "View docs")))); 21625}, FlexSpaced = styled(Spaced)({ 21626 display: "flex" 21627}), WideSpaced = styled(Spaced)({ 21628 flex: 1 21629}), EmptyBlock = ({ 21630 isMain, 21631 hasEntries, 21632 activeFilterCount 21633}) => { 21634 let api = useStorybookApi(); 21635 return react_default.createElement(Contained, null, react_default.createElement(FlexSpaced, { col: 1 }, react_default.createElement(WideSpaced, null, hasEntries ? react_default.createElement(NoResults2, null, react_default.createElement("strong", null, "No stories found"), activeFilterCount > 0 ? react_default.createElement("small", null, "Your selected filters did not match any stories.") : react_default.createElement("small", null, "Try adding some stories!"), activeFilterCount > 0 ? react_default.createElement( 21636 Button, 21637 { 21638 ariaLabel: !1, 21639 size: "small", 21640 variant: "outline", 21641 onClick: async () => { 21642 await api.setAllTagFilters([], []), await api.resetStatusFilters(); 21643 } 21644 }, 21645 react_default.createElement(SweepIcon, null), 21646 "Clear filters" 21647 ) : null) : isMain ? react_default.createElement(Text3, null, "Oh no! Your Storybook is empty. This can happen when:", react_default.createElement("ul", null, react_default.createElement("li", null, "Your", " ", react_default.createElement( 21648 Link, 21649 { 21650 href: "https://storybook.js.org/docs/api/main-config/main-config-stories?ref=ui", 21651 cancel: !1, 21652 target: "_blank" 21653 }, 21654 "stories glob configuration" 21655 ), " ", "does not match any files.", " "), react_default.createElement("li", null, "You have", " ", react_default.createElement( 21656 Link, 21657 { 21658 href: "https://storybook.js.org/docs/writing-stories?ref=ui", 21659 cancel: !1, 21660 target: "_blank" 21661 }, 21662 "no stories defined" 21663 ), " ", "in your story files.", " "))) : react_default.createElement(Text3, null, "This composed Storybook is empty. Perhaps no stories match your selected filters.")))); 21664}, LoaderBlock = ({ isMain }) => react_default.createElement(Contained, null, react_default.createElement(Loader2, { size: isMain ? 17 : 5 })); 21665 21666// src/manager/components/sidebar/RefIndicator.tsx 21667init_react(); 21668var { document: document4, window: globalWindow3 } = scope, IndicatorPlacement = styled.div(({ theme }) => ({ 21669 height: 16, 21670 display: "flex", 21671 alignItems: "center", 21672 "& > * + *": { 21673 marginLeft: theme.layoutMargin 21674 } 21675})), IndicatorClickTarget = styled(Button)(({ theme }) => ({ 21676 color: theme.textMutedColor, 21677 svg: { 21678 height: 14, 21679 width: 14, 21680 padding: 2, 21681 transition: "all 150ms ease-out", 21682 color: "inherit" 21683 } 21684})), MessageTitle = styled.span(({ theme }) => ({ 21685 fontWeight: theme.typography.weight.bold 21686})), StyledMessage = styled.a(({ theme }) => ({ 21687 textDecoration: "none", 21688 lineHeight: "16px", 21689 padding: 15, 21690 display: "flex", 21691 flexDirection: "row", 21692 alignItems: "flex-start", 21693 color: theme.color.defaultText, 21694 "&:not(:last-child)": { 21695 borderBottom: `1px solid ${theme.appBorderColor}` 21696 }, 21697 "&:hover": { 21698 background: theme.background.hoverable, 21699 color: theme.color.defaultText 21700 }, 21701 "&:link, &:active, &:focus": { 21702 color: theme.color.defaultText 21703 }, 21704 "&:focus-visible": { 21705 background: theme.background.hoverable, 21706 borderRadius: 8, 21707 boxShadow: `inset 0 0 0 2px ${theme.color.secondary}`, 21708 outline: "none" 21709 }, 21710 "& > *": { 21711 flex: 1 21712 }, 21713 "& > svg": { 21714 marginTop: 3, 21715 width: 16, 21716 height: 16, 21717 marginRight: 10, 21718 flex: "unset" 21719 } 21720})), Message2 = ({ href, blank = !0, children, onClick }) => react_default.createElement(StyledMessage, { href, target: blank ? "_blank" : void 0, onClick }, children), MessageWrapper = styled.div( 21721 ({ isMobile: isMobile2 }) => ({ 21722 width: isMobile2 ? "calc(100vw - 20px)" : 280, 21723 boxSizing: "border-box", 21724 borderRadius: 8, 21725 overflow: "hidden" 21726 }), 21727 ({ theme }) => ({ 21728 color: theme.color.dark 21729 }) 21730), SubtleSelect = styled(Select)(({ theme }) => ({ 21731 background: "transparent", 21732 color: theme.color.defaultText, 21733 fontSize: theme.typography.size.s1, 21734 fontWeight: theme.typography.weight.regular 21735})), RefIndicator = react_default.memo( 21736 forwardRef( 21737 ({ state, ...ref }, forwardedRef) => { 21738 let api = useStorybookApi(), { isMobile: isMobile2 } = useLayout(), list = useMemo(() => Object.values(ref.index || {}), [ref.index]), componentCount = useMemo( 21739 () => list.filter((v2) => v2.type === "component").length, 21740 [list] 21741 ), leafCount = useMemo( 21742 () => list.filter((v2) => v2.type === "docs" || v2.type === "story").length, 21743 [list] 21744 ), currentVersion = useMemo(() => { 21745 if (ref.versions) 21746 return Object.entries(ref.versions).find(([, v2]) => v2 === ref.url)?.[0]; 21747 }, [ref.versions, ref.url]); 21748 return react_default.createElement(IndicatorPlacement, { ref: forwardedRef }, react_default.createElement( 21749 PopoverProvider, 21750 { 21751 ariaLabel: "Composed Storybook status", 21752 placement: isMobile2 ? "bottom" : "bottom-start", 21753 padding: 0, 21754 popover: () => react_default.createElement(MessageWrapper, { isMobile: isMobile2 }, react_default.createElement(Spaced, { row: 0 }, state === "loading" && react_default.createElement(LoadingMessage, { url: ref.url }), (state === "error" || state === "empty") && react_default.createElement(ErrorOccurredMessage, { url: ref.url }), state === "ready" && react_default.createElement(react_default.Fragment, null, react_default.createElement(ReadyMessage, { url: ref.url, componentCount, leafCount }), ref.sourceUrl && react_default.createElement(SourceCodeMessage, { url: ref.sourceUrl })), state === "auth" && react_default.createElement(LoginRequiredMessage, { ...ref }), ref.type === "auto-inject" && state !== "error" && react_default.createElement(PerformanceDegradedMessage, null), state !== "loading" && react_default.createElement(ReadDocsMessage, null))) 21755 }, 21756 react_default.createElement( 21757 IndicatorClickTarget, 21758 { 21759 variant: "ghost", 21760 padding: "small", 21761 size: "small", 21762 "data-action": "toggle-indicator", 21763 ariaLabel: "Extra actions" 21764 }, 21765 react_default.createElement(GlobeIcon, null) 21766 ) 21767 ), ref.versions && Object.keys(ref.versions).length ? react_default.createElement(react_default.Fragment, null, react_default.createElement( 21768 SubtleSelect, 21769 { 21770 padding: "small", 21771 size: "small", 21772 ariaLabel: "Version", 21773 tooltip: "Choose version", 21774 defaultOptions: currentVersion, 21775 onSelect: (item) => { 21776 let href = ref.versions?.[item]; 21777 href && api.changeRefVersion(ref.id, href); 21778 }, 21779 options: Object.entries(ref.versions).map(([id, href]) => ({ 21780 value: id, 21781 title: id, 21782 href 21783 })) 21784 }, 21785 "version" 21786 )) : null); 21787 } 21788 ) 21789), ReadyMessage = ({ url, componentCount, leafCount }) => { 21790 let theme = useTheme(); 21791 return react_default.createElement(Message2, { href: url.replace(/\/?$/, "/index.html") }, react_default.createElement(GlobeIcon, { color: theme.color.secondary }), react_default.createElement("div", null, react_default.createElement(MessageTitle, null, "View external Storybook"), react_default.createElement("div", null, "Explore ", componentCount, " components and ", leafCount, " stories in a new browser tab."))); 21792}, SourceCodeMessage = ({ url }) => { 21793 let theme = useTheme(); 21794 return react_default.createElement(Message2, { href: url }, react_default.createElement(MarkupIcon, { color: theme.color.secondary }), react_default.createElement("div", null, react_default.createElement(MessageTitle, null, "View source code"))); 21795}, LoginRequiredMessage = ({ loginUrl, id }) => { 21796 let theme = useTheme(), open = useCallback( 21797 (e2) => { 21798 e2.preventDefault(); 21799 let childWindow = globalWindow3.open( 21800 loginUrl, 21801 `storybook_auth_${id}`, 21802 "resizable,scrollbars" 21803 ), timer = setInterval(() => { 21804 childWindow ? childWindow.closed && (clearInterval(timer), document4.location.reload()) : clearInterval(timer); 21805 }, 1e3); 21806 }, 21807 [id, loginUrl] 21808 ); 21809 return react_default.createElement(Message2, { onClick: open, blank: !1 }, react_default.createElement(LockIcon, { color: theme.color.gold }), react_default.createElement("div", null, react_default.createElement(MessageTitle, null, "Log in required"), react_default.createElement("div", null, "You need to authenticate to view this Storybook's components."))); 21810}, ReadDocsMessage = () => { 21811 let theme = useTheme(); 21812 return react_default.createElement(Message2, { href: "https://storybook.js.org/docs/sharing/storybook-composition?ref=ui" }, react_default.createElement(DocumentIcon, { color: theme.color.green }), react_default.createElement("div", null, react_default.createElement(MessageTitle, null, "Read Composition docs"), react_default.createElement("div", null, "Learn how to combine multiple Storybooks into one."))); 21813}, ErrorOccurredMessage = ({ url }) => { 21814 let theme = useTheme(); 21815 return react_default.createElement(Message2, { href: url.replace(/\/?$/, "/index.html") }, react_default.createElement(AlertIcon, { color: theme.color.negative }), react_default.createElement("div", null, react_default.createElement(MessageTitle, null, "Something went wrong"), react_default.createElement("div", null, "This external Storybook didn't load. Debug it in a new tab now."))); 21816}, LoadingMessage = ({ url }) => { 21817 let theme = useTheme(); 21818 return react_default.createElement(Message2, { href: url.replace(/\/?$/, "/index.html") }, react_default.createElement(TimeIcon, { color: theme.color.secondary }), react_default.createElement("div", null, react_default.createElement(MessageTitle, null, "Please wait"), react_default.createElement("div", null, "This Storybook is loading."))); 21819}, PerformanceDegradedMessage = () => { 21820 let theme = useTheme(); 21821 return react_default.createElement(Message2, { href: "https://storybook.js.org/docs/sharing/storybook-composition?ref=ui" }, react_default.createElement(LightningIcon, { color: theme.color.gold }), react_default.createElement("div", null, react_default.createElement(MessageTitle, null, "Reduce lag"), react_default.createElement("div", null, "Learn how to speed up Composition performance."))); 21822}; 21823 21824// src/manager/components/sidebar/Tree.tsx 21825init_react(); 21826 21827// src/manager/utils/status.tsx 21828init_react(); 21829var import_memoizerific4 = __toESM(require_memoizerific(), 1); 21830 21831// src/manager/components/sidebar/IconSymbols.tsx 21832init_react(); 21833var Svg2 = styled.svg` 21834 position: absolute; 21835 width: 0; 21836 height: 0; 21837 display: inline-block; 21838 shape-rendering: inherit; 21839 vertical-align: middle; 21840`, GROUP_ID = "icon--group", COMPONENT_ID = "icon--component", DOCUMENT_ID = "icon--document", STORY_ID = "icon--story", TEST_ID = "icon--test", SUCCESS_ID = "icon--success", ERROR_ID = "icon--error", WARNING_ID = "icon--warning", DOT_ID = "icon--dot", NEW_ID = "icon--new", MODIFIED_ID = "icon--modified", AFFECTED_ID = "icon--affected", REVIEWING_ID = "icon--reviewing", IconSymbols = () => react_default.createElement(Svg2, { "data-chromatic": "ignore" }, react_default.createElement("symbol", { id: GROUP_ID }, react_default.createElement( 21841 "path", 21842 { 21843 fillRule: "evenodd", 21844 clipRule: "evenodd", 21845 d: "M6.586 3.504l-1.5-1.5H1v9h12v-7.5H6.586zm.414-1L5.793 1.297a1 1 0 00-.707-.293H.5a.5.5 0 00-.5.5v10a.5.5 0 00.5.5h13a.5.5 0 00.5-.5v-8.5a.5.5 0 00-.5-.5H7z", 21846 fill: "currentColor" 21847 } 21848)), react_default.createElement("symbol", { id: COMPONENT_ID }, react_default.createElement( 21849 "path", 21850 { 21851 fillRule: "evenodd", 21852 clipRule: "evenodd", 21853 d: "M3.5 1.004a2.5 2.5 0 00-2.5 2.5v7a2.5 2.5 0 002.5 2.5h7a2.5 2.5 0 002.5-2.5v-7a2.5 2.5 0 00-2.5-2.5h-7zm8.5 5.5H7.5v-4.5h3a1.5 1.5 0 011.5 1.5v3zm0 1v3a1.5 1.5 0 01-1.5 1.5h-3v-4.5H12zm-5.5 4.5v-4.5H2v3a1.5 1.5 0 001.5 1.5h3zM2 6.504h4.5v-4.5h-3a1.5 1.5 0 00-1.5 1.5v3z", 21854 fill: "currentColor" 21855 } 21856)), react_default.createElement("symbol", { id: DOCUMENT_ID }, react_default.createElement( 21857 "path", 21858 { 21859 d: "M4 5.5a.5.5 0 01.5-.5h5a.5.5 0 010 1h-5a.5.5 0 01-.5-.5zM4.5 7.5a.5.5 0 000 1h5a.5.5 0 000-1h-5zM4 10.5a.5.5 0 01.5-.5h5a.5.5 0 010 1h-5a.5.5 0 01-.5-.5z", 21860 fill: "currentColor" 21861 } 21862), react_default.createElement( 21863 "path", 21864 { 21865 fillRule: "evenodd", 21866 clipRule: "evenodd", 21867 d: "M1.5 0a.5.5 0 00-.5.5v13a.5.5 0 00.5.5h11a.5.5 0 00.5-.5V3.207a.5.5 0 00-.146-.353L10.146.146A.5.5 0 009.793 0H1.5zM2 1h7.5v2a.5.5 0 00.5.5h2V13H2V1z", 21868 fill: "currentColor" 21869 } 21870)), react_default.createElement("symbol", { id: STORY_ID }, react_default.createElement( 21871 "path", 21872 { 21873 fillRule: "evenodd", 21874 clipRule: "evenodd", 21875 d: "M3.5 0h7a.5.5 0 01.5.5v13a.5.5 0 01-.454.498.462.462 0 01-.371-.118L7 11.159l-3.175 2.72a.46.46 0 01-.379.118A.5.5 0 013 13.5V.5a.5.5 0 01.5-.5zM4 12.413l2.664-2.284a.454.454 0 01.377-.128.498.498 0 01.284.12L10 12.412V1H4v11.413z", 21876 fill: "currentColor" 21877 } 21878)), react_default.createElement("symbol", { id: TEST_ID }, react_default.createElement( 21879 "path", 21880 { 21881 fillRule: "evenodd", 21882 clipRule: "evenodd", 21883 d: "M4.5 2h.75v3.866l-3.034 5.26A1.25 1.25 0 003.299 13H10.7a1.25 1.25 0 001.083-1.875L8.75 5.866V2h.75a.5.5 0 100-1h-5a.5.5 0 000 1zm1.75 4V2h1.5v4.134l.067.116L8.827 8H5.173l1.01-1.75.067-.116V6zM4.597 9l-1.515 2.625A.25.25 0 003.3 12H10.7a.25.25 0 00.217-.375L9.404 9H4.597z", 21884 fill: "currentColor" 21885 } 21886)), react_default.createElement("symbol", { id: SUCCESS_ID }, react_default.createElement( 21887 "path", 21888 { 21889 fillRule: "evenodd", 21890 clipRule: "evenodd", 21891 d: "M10.854 4.146a.5.5 0 010 .708l-5 5a.5.5 0 01-.708 0l-2-2a.5.5 0 11.708-.708L5.5 8.793l4.646-4.647a.5.5 0 01.708 0z", 21892 fill: "currentColor" 21893 } 21894)), react_default.createElement("symbol", { id: ERROR_ID }, react_default.createElement( 21895 "path", 21896 { 21897 fillRule: "evenodd", 21898 clipRule: "evenodd", 21899 d: "M7 4a3 3 0 100 6 3 3 0 000-6zM3 7a4 4 0 118 0 4 4 0 01-8 0z", 21900 fill: "currentColor" 21901 } 21902)), react_default.createElement("symbol", { id: WARNING_ID }, react_default.createElement( 21903 "path", 21904 { 21905 fillRule: "evenodd", 21906 clipRule: "evenodd", 21907 d: "M7.206 3.044a.498.498 0 01.23.212l3.492 5.985a.494.494 0 01.006.507.497.497 0 01-.443.252H3.51a.499.499 0 01-.437-.76l3.492-5.984a.497.497 0 01.642-.212zM7 4.492L4.37 9h5.26L7 4.492z", 21908 fill: "currentColor" 21909 } 21910)), react_default.createElement("symbol", { id: DOT_ID }, react_default.createElement("circle", { cx: "3", cy: "3", r: "3", fill: "currentColor" })), react_default.createElement("symbol", { id: NEW_ID }, react_default.createElement("rect", { x: "6", y: "3.5", width: "2", height: "7", rx: "1", fill: "currentColor" }), react_default.createElement("rect", { x: "3.5", y: "6", width: "7", height: "2", rx: "1", fill: "currentColor" })), react_default.createElement("symbol", { id: MODIFIED_ID }, react_default.createElement("circle", { cx: "7", cy: "7", r: "3", fill: "currentColor" })), react_default.createElement("symbol", { id: AFFECTED_ID }, react_default.createElement("circle", { cx: "7", cy: "7", r: "3", fill: "currentColor" })), react_default.createElement("symbol", { id: REVIEWING_ID }, react_default.createElement( 21911 "path", 21912 { 21913 d: "M7.052 3.004c.01 0 .02 0 .03.002.004 0 .01.003.015.004a.493.493 0 01.051.013l.043.015a.497.497 0 01.089.049l.03.023c.015.012.029.023.042.036.012.012.023.026.035.04l.023.03c.01.015.019.03.027.047.008.014.016.028.022.043.006.014.01.028.015.043.005.017.01.034.013.051l.005.017.03.182A3.5 3.5 0 0010.4 6.476l.182.03c.005 0 .01.003.016.004a.494.494 0 01.051.013l.043.015a.503.503 0 01.089.049l.03.023c.015.012.029.023.042.036.012.012.023.026.035.04l.023.03c.01.015.019.03.027.047.008.014.016.028.022.043l.014.04.014.054.005.017c.002.01 0 .019.001.028.002.018.004.036.004.054 0 .018-.002.035-.004.053v.03l-.006.015a.479.479 0 01-.013.051l-.015.043a.507.507 0 01-.049.089l-.023.03-.035.042-.042.035-.03.023a.503.503 0 01-.046.027c-.014.008-.028.016-.043.022-.014.006-.028.01-.043.015a.491.491 0 01-.051.013l-.016.005-.182.03A3.5 3.5 0 007.522 10.4l-.03.182c0 .005-.004.01-.005.016a.491.491 0 01-.013.051l-.015.043a.503.503 0 01-.049.089l-.023.03-.035.042-.041.035-.03.023a.507.507 0 01-.047.027c-.014.008-.028.016-.043.022-.014.006-.028.01-.043.015a.479.479 0 01-.051.013l-.016.005c-.01.002-.02 0-.03.001-.017.002-.034.004-.052.004-.018 0-.036-.002-.054-.004h-.028c-.006-.002-.011-.005-.017-.006a.503.503 0 01-.051-.013l-.043-.015a.505.505 0 01-.089-.049l-.03-.023c-.015-.012-.029-.023-.041-.035-.013-.013-.024-.027-.036-.042l-.023-.03a.503.503 0 01-.027-.046c-.008-.014-.016-.028-.022-.043-.006-.014-.01-.028-.015-.043a.494.494 0 01-.013-.051l-.004-.016-.03-.182a3.5 3.5 0 00-2.877-2.877l-.182-.03c-.006 0-.011-.004-.017-.005a.493.493 0 01-.051-.013l-.043-.015a.492.492 0 01-.089-.049l-.03-.023c-.015-.012-.029-.023-.041-.035-.013-.013-.024-.027-.036-.041l-.023-.03a.497.497 0 01-.027-.047c-.008-.014-.016-.028-.022-.043-.006-.013-.01-.028-.015-.043a.493.493 0 01-.013-.051l-.004-.016c-.002-.01-.001-.02-.002-.03C3.002 7.035 3 7.018 3 7c0-.018.002-.036.004-.054 0-.009 0-.019.002-.028 0-.006.003-.011.004-.017l.015-.054.013-.04a.498.498 0 01.049-.089l.023-.03.026-.032.02-.02.03-.025.03-.023a.498.498 0 01.047-.027c.014-.008.028-.016.043-.022.014-.006.028-.01.043-.015A.493.493 0 013.4 6.51l.017-.004.182-.03a3.5 3.5 0 002.877-2.877l.03-.182c0-.006.003-.011.004-.017a.493.493 0 01.013-.051l.015-.043a.498.498 0 01.049-.089l.023-.03.026-.032.02-.02.03-.025.03-.023a.498.498 0 01.047-.027c.014-.008.028-.016.043-.022.014-.006.028-.01.043-.015A.493.493 0 016.9 3.01l.017-.004c.01-.002.019-.001.028-.002C6.963 3.002 6.981 3 7 3c.018 0 .035.002.053.004z", 21914 fill: "currentColor" 21915 } 21916))), UseSymbol = ({ type }) => type === "group" ? react_default.createElement("use", { xlinkHref: `#${GROUP_ID}` }) : type === "component" ? react_default.createElement("use", { xlinkHref: `#${COMPONENT_ID}` }) : type === "document" ? react_default.createElement("use", { xlinkHref: `#${DOCUMENT_ID}` }) : type === "story" ? react_default.createElement("use", { xlinkHref: `#${STORY_ID}` }) : type === "test" ? react_default.createElement("use", { xlinkHref: `#${TEST_ID}` }) : type === "success" ? react_default.createElement("use", { xlinkHref: `#${SUCCESS_ID}` }) : type === "error" ? react_default.createElement("use", { xlinkHref: `#${ERROR_ID}` }) : type === "warning" ? react_default.createElement("use", { xlinkHref: `#${WARNING_ID}` }) : type === "dot" ? react_default.createElement("use", { xlinkHref: `#${DOT_ID}` }) : type === "new" ? react_default.createElement("use", { xlinkHref: `#${NEW_ID}` }) : type === "reviewing" ? react_default.createElement("use", { xlinkHref: `#${REVIEWING_ID}` }) : type === "modified" ? react_default.createElement("use", { xlinkHref: `#${MODIFIED_ID}` }) : type === "affected" ? react_default.createElement("use", { xlinkHref: `#${AFFECTED_ID}` }) : null; 21917 21918// src/manager/utils/status.tsx 21919var SmallIcons = styled(CircleIcon)({ 21920 // specificity hack 21921 "&&&": { 21922 width: 6, 21923 height: 6 21924 } 21925}), LoadingIcons = styled(SmallIcons)(({ theme: { animation } }) => ({ 21926 // specificity hack 21927 animation: `${animation.glow} 1.5s ease-in-out infinite` 21928})), statusPriority = [ 21929 "status-value:unknown", 21930 "status-value:pending", 21931 "status-value:success", 21932 "status-value:affected", 21933 "status-value:reviewing", 21934 "status-value:modified", 21935 "status-value:new", 21936 "status-value:warning", 21937 "status-value:error" 21938], getStatus = (0, import_memoizerific4.default)(10)((theme, status) => { 21939 let defaultIconColor = theme.base === "light" ? curriedTransparentize$1(0.3, theme.color.defaultText) : curriedTransparentize$1(0.6, theme.color.defaultText); 21940 return { 21941 "status-value:unknown": { 21942 icon: null, 21943 iconColor: defaultIconColor, 21944 textColor: null 21945 }, 21946 "status-value:pending": { 21947 icon: react_default.createElement(LoadingIcons, { key: "icon" }), 21948 iconColor: defaultIconColor, 21949 textColor: "currentColor" 21950 }, 21951 "status-value:success": { 21952 icon: react_default.createElement("svg", { key: "icon", viewBox: "0 0 14 14", width: "14", height: "14" }, react_default.createElement(UseSymbol, { type: "success" })), 21953 iconColor: theme.color.positive, 21954 textColor: "currentColor" 21955 }, 21956 "status-value:new": { 21957 icon: react_default.createElement("svg", { key: "icon", viewBox: "0 0 14 14", width: "14", height: "14" }, react_default.createElement(UseSymbol, { type: "new" })), 21958 iconColor: theme.fgColor.accent, 21959 textColor: null 21960 }, 21961 "status-value:modified": { 21962 icon: react_default.createElement("svg", { key: "icon", viewBox: "0 0 14 14", width: "14", height: "14" }, react_default.createElement(UseSymbol, { type: "modified" })), 21963 iconColor: theme.fgColor.accent, 21964 textColor: null 21965 }, 21966 "status-value:affected": { 21967 icon: react_default.createElement("svg", { key: "icon", viewBox: "0 0 14 14", width: "14", height: "14" }, react_default.createElement(UseSymbol, { type: "affected" })), 21968 iconColor: theme.fgColor.accent, 21969 textColor: null 21970 }, 21971 "status-value:reviewing": { 21972 icon: react_default.createElement("svg", { key: "icon", viewBox: "0 0 14 14", width: "14", height: "14" }, react_default.createElement(UseSymbol, { type: "reviewing" })), 21973 iconColor: theme.fgColor.agentic, 21974 textColor: null 21975 }, 21976 "status-value:warning": { 21977 icon: react_default.createElement("svg", { key: "icon", viewBox: "0 0 14 14", width: "14", height: "14" }, react_default.createElement(UseSymbol, { type: "warning" })), 21978 iconColor: theme.color.warning, 21979 textColor: theme.fgColor.warning 21980 }, 21981 "status-value:error": { 21982 icon: react_default.createElement("svg", { key: "icon", viewBox: "0 0 14 14", width: "14", height: "14" }, react_default.createElement(UseSymbol, { type: "error" })), 21983 iconColor: theme.color.negative, 21984 textColor: theme.fgColor.negative 21985 } 21986 }[status]; 21987}), shouldShowChangeStatus = (changeStatus, isModifiedFilterActive) => changeStatus !== "status-value:unknown" && changeStatus !== "status-value:affected" && (changeStatus !== "status-value:modified" || isModifiedFilterActive), isAggregatedTestStatus = (status) => !NON_AGGREGATED_STATUS_TYPE_IDS.includes(status.typeId); 21988function getSidebarVisibleStatus({ 21989 theme, 21990 item, 21991 statuses, 21992 groupDualStatus, 21993 isModifiedFilterActive 21994}) { 21995 let statusByType = statuses ?? {}; 21996 if (item.type === "group" || item.type === "component" || item.type === "story" && item.children && item.children.length > 0) { 21997 let { changeStatus: localChange, testStatus: localTest } = getChangeDetectionStatus(statusByType), groupDual = groupDualStatus?.[item.id] ?? { 21998 change: "status-value:unknown", 21999 test: "status-value:unknown" 22000 }, branchChange = getMostCriticalStatusValue([localChange, groupDual.change]), branchTest = getMostCriticalStatusValue([localTest, groupDual.test]); 22001 return shouldShowChangeStatus(branchChange, isModifiedFilterActive) ? { icon: getStatus(theme, branchChange).icon, status: branchChange } : { icon: getStatus(theme, branchTest).icon, status: branchTest }; 22002 } 22003 if (item.type === "story" && !(item.children && item.children.length > 0) && item.subtype !== "test" || item.type === "docs") { 22004 let { changeStatus, testStatus } = getChangeDetectionStatus(statusByType); 22005 return shouldShowChangeStatus(changeStatus, isModifiedFilterActive) ? { icon: getStatus(theme, changeStatus).icon, status: changeStatus } : { icon: getStatus(theme, testStatus).icon, status: testStatus }; 22006 } 22007 let leafStatuses = Object.values(statusByType).filter( 22008 (status) => isAggregatedTestStatus(status) || status.value === "status-value:new" 22009 ), leafStatus = getMostCriticalStatusValue(leafStatuses.map((s2) => s2.value)); 22010 return { icon: getStatus(theme, leafStatus).icon, status: leafStatus }; 22011} 22012function getChangeDetectionStatus(statuses) { 22013 let changeValues = Object.values(statuses).filter((status) => status.typeId === CHANGE_DETECTION_STATUS_TYPE_ID).map((status) => status.value), testValues = Object.values(statuses).filter(isAggregatedTestStatus).map((status) => status.value); 22014 return { 22015 changeStatus: getMostCriticalStatusValue(changeValues), 22016 testStatus: getMostCriticalStatusValue(testValues) 22017 }; 22018} 22019var getMostCriticalStatusValue = (statusValues) => statusPriority.reduce( 22020 (acc, value) => statusValues.includes(value) ? value : acc, 22021 "status-value:unknown" 22022), statusesExcludingReview = (statuses) => statuses.filter((status) => status.typeId !== REVIEW_STATUS_TYPE_ID); 22023function getGroupStatus(collapsedData, allStatuses) { 22024 return Object.values(collapsedData).reduce((acc, item) => { 22025 if (item.type === "group" || item.type === "component" || item.type === "story") { 22026 let leafs = getDescendantIds(collapsedData, item.id, !1).map((id) => collapsedData[id]).filter((i2) => i2.type === "story"), combinedStatus = getMostCriticalStatusValue( 22027 statusesExcludingReview( 22028 leafs.flatMap( 22029 (story) => Object.values(allStatuses[story.id] || {}) 22030 ) 22031 ).map((s2) => s2.value) 22032 ); 22033 combinedStatus && (acc[item.id] = combinedStatus); 22034 } 22035 return acc; 22036 }, {}); 22037} 22038function getGroupDualStatus(collapsedData, allStatuses) { 22039 return Object.values(collapsedData).reduce((acc, item) => { 22040 if (item.type === "group" || item.type === "component" || item.type === "story") { 22041 let allDescendantStatuses = getDescendantIds(collapsedData, item.id, !1).map((id) => collapsedData[id]).filter((i2) => i2.type === "story").flatMap( 22042 (story) => Object.values(allStatuses[story.id] || {}) 22043 ), changeValues = allDescendantStatuses.filter((s2) => s2.typeId === CHANGE_DETECTION_STATUS_TYPE_ID).map((s2) => s2.value), testValues = allDescendantStatuses.filter(isAggregatedTestStatus).map((s2) => s2.value); 22044 acc[item.id] = { 22045 change: getMostCriticalStatusValue(changeValues), 22046 test: getMostCriticalStatusValue(testValues) 22047 }; 22048 } 22049 return acc; 22050 }, {}); 22051} 22052 22053// src/manager/components/sidebar/ContextMenu.tsx 22054init_react(); 22055 22056// src/manager/components/sidebar/StatusButton.tsx 22057init_react(); 22058var withStatusColor = ({ theme, status }) => ({ 22059 color: getStatus(theme, status).iconColor ?? void 0 22060}), StatusLabel = styled.div(withStatusColor, { 22061 margin: 3 22062}), StyledButton = styled(Button)( 22063 withStatusColor, 22064 ({ theme, height, width }) => ({ 22065 transition: "none", 22066 display: "inline-flex", 22067 alignItems: "center", 22068 justifyContent: "center", 22069 width: width || 28, 22070 height: height || 28, 22071 "&:hover": { 22072 color: theme.color.secondary, 22073 background: theme.base === "dark" ? curriedDarken$1(0.3, theme.color.secondary) : curriedLighten$1(0.4, theme.color.secondary) 22074 }, 22075 '[data-selected="true"] &': { 22076 background: theme.base === "dark" ? curriedDarken$1(0.18, theme.color.secondary) : theme.color.secondary, 22077 boxShadow: `0 0 5px 5px ${theme.base === "dark" ? curriedDarken$1(0.18, theme.color.secondary) : theme.color.secondary}`, 22078 "&:hover": { 22079 background: theme.base === "dark" ? curriedDarken$1(0.1, theme.color.secondary) : theme.color.secondary 22080 } 22081 }, 22082 "&:focus": { 22083 color: theme.color.secondary, 22084 borderColor: theme.color.secondary, 22085 outlineOffset: -2, 22086 "&:not(:focus-visible)": { 22087 borderColor: "transparent" 22088 } 22089 } 22090 }), 22091 ({ theme, selectedItem }) => selectedItem && { 22092 "&:hover": { 22093 boxShadow: `inset 0 0 0 2px ${theme.color.secondary}`, 22094 background: "rgba(255, 255, 255, 0.2)" 22095 } 22096 } 22097), StatusButton = forwardRef((props, ref) => react_default.createElement(StyledButton, { variant: "ghost", padding: "small", ...props, ref })); 22098StatusButton.displayName = "StatusButton"; 22099 22100// src/manager/components/sidebar/ContextMenu.tsx 22101var empty = { 22102 onMouseEnter: () => { 22103 }, 22104 node: null 22105}, FloatingStatusButton = styled(StatusButton)({ 22106 background: "var(--tree-node-background-hover)", 22107 boxShadow: "0 0 5px 5px var(--tree-node-background-hover)", 22108 position: "absolute", 22109 right: 0, 22110 zIndex: 1, 22111 "&:focus-visible": { 22112 outlineOffset: -2 22113 } 22114}), useContextMenu = (context, links, api, visibleStatus) => { 22115 let [hoverCount, setHoverCount] = useState(0), [isOpen, setIsOpen] = useState(!1), exportName = context && "exportName" in context ? context.exportName ?? "" : "", { children: copyText, buttonProps: copyButtonProps } = useCopyButton2({ 22116 children: "Copy story name", 22117 content: exportName 22118 }), openInEditorShortcut = api.getShortcutKeys()?.openInEditor, topLinks = useMemo(() => { 22119 let defaultLinks = []; 22120 return context && "importPath" in context && context.importPath && defaultLinks.push({ 22121 id: "open-in-editor", 22122 title: "Open in editor", 22123 icon: react_default.createElement(EditorIcon, null), 22124 right: openInEditorShortcut ? react_default.createElement(Shortcut, { keys: openInEditorShortcut }) : null, 22125 onClick: (e2) => { 22126 context.importPath && (e2.preventDefault(), api.openInEditor({ file: context.importPath })); 22127 } 22128 }), context.type === "story" && defaultLinks.push({ 22129 id: "copy-story-name", 22130 title: copyText, 22131 icon: react_default.createElement(CopyIcon, null), 22132 // TODO: bring this back once we want to add shortcuts for this 22133 // right: 22134 // enableShortcuts && shortcutKeys.copyStoryName ? ( 22135 // <Shortcut keys={shortcutKeys.copyStoryName} /> 22136 // ) : null, 22137 onClick: (e2) => { 22138 e2.preventDefault(), copyButtonProps.onClick(e2); 22139 } 22140 }), defaultLinks; 22141 }, [api, context, copyText, copyButtonProps, openInEditorShortcut]), handlers = useMemo(() => ({ 22142 onMouseEnter: () => { 22143 setHoverCount((c2) => c2 + 1); 22144 }, 22145 onOpen: (event) => { 22146 event.stopPropagation(), setIsOpen(!0); 22147 }, 22148 onClose: () => { 22149 setIsOpen(!1); 22150 } 22151 }), []), providerLinks = useMemo(() => { 22152 let registeredTestProviders = api.getElements(Addon_TypesEnum.experimental_TEST_PROVIDER); 22153 return hoverCount ? generateTestProviderLinks(registeredTestProviders, context) : []; 22154 }, [api, context, hoverCount]), shouldRender = !context.refId && (providerLinks.length > 0 || links.length > 0 || topLinks.length > 0), buttonStatus = visibleStatus?.status ?? "status-value:unknown", menuIcon = visibleStatus?.icon ?? react_default.createElement(EllipsisIcon, null); 22155 return useMemo(() => globalThis.CONFIG_TYPE !== "DEVELOPMENT" ? empty : { 22156 onMouseEnter: handlers.onMouseEnter, 22157 node: shouldRender ? react_default.createElement( 22158 PopoverProvider, 22159 { 22160 ariaLabel: "Context menu", 22161 placement: "bottom-end", 22162 defaultVisible: !1, 22163 visible: isOpen, 22164 onVisibleChange: setIsOpen, 22165 popover: react_default.createElement(LiveContextMenu, { context, links: [...topLinks, ...links] }), 22166 hasChrome: !0, 22167 padding: 0 22168 }, 22169 react_default.createElement( 22170 FloatingStatusButton, 22171 { 22172 "data-displayed": isOpen ? "on" : "off", 22173 "data-testid": "context-menu", 22174 ariaLabel: "Open context menu", 22175 type: "button", 22176 status: buttonStatus, 22177 onClick: handlers.onOpen 22178 }, 22179 menuIcon 22180 ) 22181 ) : null 22182 }, [context, handlers, isOpen, shouldRender, links, topLinks, buttonStatus, menuIcon]); 22183}, LiveContextMenu = ({ 22184 context, 22185 links, 22186 ...rest2 22187}) => { 22188 let registeredTestProviders = useStorybookApi().getElements( 22189 Addon_TypesEnum.experimental_TEST_PROVIDER 22190 ), providerLinks = generateTestProviderLinks(registeredTestProviders, context), all = (Array.isArray(links[0]) || links.length === 0 ? links : [links]).concat([providerLinks]); 22191 return react_default.createElement(TooltipLinkList, { ...rest2, links: all }); 22192}; 22193function generateTestProviderLinks(registeredTestProviders, context) { 22194 return Object.entries(registeredTestProviders).map(([testProviderId, state]) => { 22195 if (!state) 22196 return null; 22197 let content = state.sidebarContextMenu?.({ context }); 22198 return content ? { 22199 id: testProviderId, 22200 content 22201 } : null; 22202 }).filter(Boolean); 22203} 22204 22205// src/manager/components/sidebar/StatusContext.tsx 22206init_react(); 22207var StatusContext = createContext({}); 22208 22209// src/manager/components/sidebar/TreeNode.tsx 22210init_react(); 22211 22212// src/manager/components/sidebar/components/CollapseIcon.tsx 22213init_react(); 22214var CollapseIconWrapper = styled.div(({ theme, isExpanded }) => ({ 22215 width: 8, 22216 height: 8, 22217 display: "flex", 22218 justifyContent: "center", 22219 alignItems: "center", 22220 transform: isExpanded ? "rotateZ(90deg)" : "none", 22221 transition: "transform .1s ease-out", 22222 color: theme.textMutedColor 22223})), CollapseIcon2 = (props) => react_default.createElement(CollapseIconWrapper, { ...props }, react_default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "8", height: "8", fill: "none" }, react_default.createElement( 22224 "path", 22225 { 22226 fill: "currentColor", 22227 fillRule: "evenodd", 22228 clipRule: "evenodd", 22229 d: "M1.896 7.146a.5.5 0 1 0 .708.708l3.5-3.5a.5.5 0 0 0 0-.708l-3.5-3.5a.5.5 0 1 0-.708.708L5.043 4 1.896 7.146Z" 22230 } 22231))); 22232 22233// src/manager/components/sidebar/TreeNode.tsx 22234var TypeIcon2 = styled.svg(({ theme, type }) => ({ 22235 width: 14, 22236 height: 14, 22237 flex: "0 0 auto", 22238 color: type === "group" ? theme.base === "dark" ? theme.color.primary : theme.color.ultraviolet : type === "component" ? theme.color.secondary : type === "document" ? theme.base === "dark" ? theme.color.gold : "#ff8300" : type === "story" ? theme.color.seafoam : type === "heading" ? theme.color.secondary : type === "test" ? theme.color.green : "currentColor" 22239})), commonNodeStyles = ({ 22240 theme, 22241 depth = 0, 22242 isExpandable = !1 22243}) => ({ 22244 flex: 1, 22245 width: "100%", 22246 cursor: "pointer", 22247 display: "flex", 22248 alignItems: "start", 22249 textAlign: "left", 22250 textDecoration: "none", 22251 border: "none", 22252 color: "inherit", 22253 fontSize: `${theme.typography.size.s2}px`, 22254 fontWeight: "inherit", 22255 background: "transparent", 22256 minHeight: 28, 22257 borderRadius: 4, 22258 gap: 6, 22259 paddingLeft: `${(isExpandable ? 8 : 22) + depth * 18}px`, 22260 paddingTop: 5, 22261 paddingBottom: 4, 22262 paddingRight: 6, 22263 overflowWrap: "break-word", 22264 wordWrap: "break-word", 22265 wordBreak: "break-word" 22266}), BranchNode = styled.button(commonNodeStyles), LeafNode = styled.a(commonNodeStyles), RootNode = styled.div({ 22267 display: "flex", 22268 alignItems: "center", 22269 justifyContent: "space-between", 22270 marginTop: 16, 22271 marginBottom: 4, 22272 "&:first-of-type": { 22273 marginTop: 0 22274 } 22275}), Wrapper5 = styled.div({ 22276 display: "flex", 22277 alignItems: "center", 22278 gap: 6, 22279 marginTop: 2 22280}), GroupNode = react_default.memo(function({ 22281 children, 22282 isExpanded = !1, 22283 isExpandable = !1, 22284 ...props 22285}) { 22286 return react_default.createElement(BranchNode, { isExpandable, tabIndex: -1, ...props }, react_default.createElement(Wrapper5, null, isExpandable && react_default.createElement(CollapseIcon2, { isExpanded }), react_default.createElement(TypeIcon2, { viewBox: "0 0 14 14", width: "14", height: "14", type: "group" }, react_default.createElement(UseSymbol, { type: "group" }))), children); 22287}), ComponentNode = react_default.memo( 22288 function({ 22289 theme, 22290 children, 22291 isExpanded = !1, 22292 isExpandable = !1, 22293 isSelected, 22294 ...props 22295 }) { 22296 return react_default.createElement(BranchNode, { isExpandable, tabIndex: -1, ...props }, react_default.createElement(Wrapper5, null, isExpandable && react_default.createElement(CollapseIcon2, { isExpanded }), react_default.createElement(TypeIcon2, { viewBox: "0 0 14 14", width: "12", height: "12", type: "component" }, react_default.createElement(UseSymbol, { type: "component" }))), children); 22297 } 22298), DocumentNode = react_default.memo(function({ theme, children, docsMode, ...props }) { 22299 return react_default.createElement(LeafNode, { tabIndex: -1, rel: "canonical", ...props }, react_default.createElement(Wrapper5, null, react_default.createElement(TypeIcon2, { viewBox: "0 0 14 14", width: "12", height: "12", type: "document" }, react_default.createElement(UseSymbol, { type: "document" }))), children); 22300}), StoryBranchNode = react_default.memo( 22301 function({ 22302 theme, 22303 children, 22304 isExpandable = !1, 22305 isExpanded = !1, 22306 isSelected, 22307 ...props 22308 }) { 22309 return react_default.createElement(BranchNode, { isExpandable, tabIndex: -1, ...props }, react_default.createElement(Wrapper5, null, isExpandable && react_default.createElement(CollapseIcon2, { isExpanded }), react_default.createElement(TypeIcon2, { viewBox: "0 0 14 14", width: "12", height: "12", type: "story" }, react_default.createElement(UseSymbol, { type: "story" }))), children); 22310 } 22311), StoryLeafNode = react_default.memo(function({ 22312 theme, 22313 children, 22314 ...props 22315}) { 22316 return react_default.createElement(LeafNode, { tabIndex: -1, rel: "canonical", ...props }, react_default.createElement(Wrapper5, null, react_default.createElement(TypeIcon2, { viewBox: "0 0 14 14", width: "12", height: "12", type: "story" }, react_default.createElement(UseSymbol, { type: "story" }))), children); 22317}), TestNode = react_default.memo(function({ 22318 theme, 22319 children, 22320 ...props 22321}) { 22322 return react_default.createElement(LeafNode, { tabIndex: -1, rel: "canonical", ...props }, react_default.createElement(Wrapper5, null, react_default.createElement(TypeIcon2, { viewBox: "0 0 14 14", width: "12", height: "12", type: "test" }, react_default.createElement(UseSymbol, { type: "test" }))), children); 22323}); 22324 22325// src/manager/components/sidebar/useExpanded.ts 22326init_react(); 22327 22328// src/manager/keybinding.ts 22329var codeToKeyMap = { 22330 // event.code => event.key 22331 Space: " ", 22332 Slash: "/", 22333 ArrowLeft: "ArrowLeft", 22334 ArrowUp: "ArrowUp", 22335 ArrowRight: "ArrowRight", 22336 ArrowDown: "ArrowDown", 22337 Escape: "Escape", 22338 Enter: "Enter" 22339}, allFalse = { alt: !1, ctrl: !1, meta: !1, shift: !1 }, matchesModifiers = (modifiers2, event) => { 22340 let { alt, ctrl, meta, shift: shift2 } = modifiers2 === !1 ? allFalse : modifiers2; 22341 return !(typeof alt == "boolean" && alt !== event.altKey || typeof ctrl == "boolean" && ctrl !== event.ctrlKey || typeof meta == "boolean" && meta !== event.metaKey || typeof shift2 == "boolean" && shift2 !== event.shiftKey); 22342}, matchesKeyCode = (code, event) => event.code ? event.code === code : event.key === codeToKeyMap[code]; 22343 22344// src/manager/components/sidebar/useExpanded.ts 22345var { document: document5 } = scope, initializeExpanded = ({ 22346 refId, 22347 data, 22348 initialExpanded, 22349 highlightedRef, 22350 rootIds, 22351 selectedStoryId 22352}) => { 22353 let selectedStory = selectedStoryId && data[selectedStoryId], candidates = [...rootIds]; 22354 return highlightedRef.current?.refId === refId && candidates.push(...getAncestorIds2(data, highlightedRef.current?.itemId)), selectedStory && "children" in selectedStory && selectedStory.children?.length && candidates.push(selectedStoryId), candidates.reduce( 22355 // @ts-expect-error (non strict) 22356 (acc, id) => Object.assign(acc, { [id]: id in initialExpanded ? initialExpanded[id] : !0 }), 22357 {} 22358 ); 22359}, noop4 = () => { 22360}, useExpanded = ({ 22361 containerRef, 22362 isBrowsing, 22363 refId, 22364 data, 22365 initialExpanded, 22366 rootIds, 22367 highlightedRef, 22368 setHighlightedItemId, 22369 selectedStoryId, 22370 onSelectStoryId 22371}) => { 22372 let api = useStorybookApi(), [expanded, setExpanded] = useReducer( 22373 (state, { ids, value }) => ids.reduce((acc, id) => Object.assign(acc, { [id]: value }), { ...state }), 22374 // @ts-expect-error (non strict) 22375 { refId, data, highlightedRef, rootIds, initialExpanded, selectedStoryId }, 22376 initializeExpanded 22377 ), getElementByDataItemId = useCallback( 22378 (id) => containerRef.current?.querySelector(`[data-item-id="${id}"]`), 22379 [containerRef] 22380 ), highlightElement = useCallback( 22381 (element) => { 22382 setHighlightedItemId(element.getAttribute("data-item-id")), scrollIntoView(element); 22383 }, 22384 [setHighlightedItemId] 22385 ), updateExpanded = useCallback( 22386 ({ ids, value }) => { 22387 if (setExpanded({ ids, value }), ids.length === 1) { 22388 let element = containerRef.current?.querySelector( 22389 `[data-item-id="${ids[0]}"][data-ref-id="${refId}"]` 22390 ); 22391 element && highlightElement(element); 22392 } 22393 }, 22394 [containerRef, highlightElement, refId] 22395 ); 22396 useEffect(() => { 22397 setExpanded({ ids: getAncestorIds2(data, selectedStoryId), value: !0 }); 22398 }, [data, selectedStoryId]); 22399 let collapseAll = useCallback(() => { 22400 let ids = Object.keys(data).filter((id) => !rootIds.includes(id)); 22401 setExpanded({ ids, value: !1 }); 22402 }, [data, rootIds]), expandAll = useCallback(() => { 22403 setExpanded({ ids: Object.keys(data), value: !0 }); 22404 }, [data]); 22405 return useEffect(() => api ? (api.on(STORIES_COLLAPSE_ALL, collapseAll), api.on(STORIES_EXPAND_ALL, expandAll), () => { 22406 api.off(STORIES_COLLAPSE_ALL, collapseAll), api.off(STORIES_EXPAND_ALL, expandAll); 22407 }) : noop4, [api, collapseAll, expandAll]), useEffect(() => { 22408 let menuElement = document5.getElementById("storybook-explorer-menu"), navigateTree = throttle((event) => { 22409 let highlightedItemId = highlightedRef.current?.refId === refId && highlightedRef.current?.itemId; 22410 if (!isBrowsing || !containerRef.current || !highlightedItemId || event.repeat || !matchesModifiers(!1, event)) 22411 return; 22412 let isEnter = matchesKeyCode("Enter", event), isSpace = matchesKeyCode("Space", event), isArrowLeft = matchesKeyCode("ArrowLeft", event), isArrowRight = matchesKeyCode("ArrowRight", event); 22413 if (!(isEnter || isSpace || isArrowLeft || isArrowRight)) 22414 return; 22415 let highlightedElement = getElementByDataItemId(highlightedItemId); 22416 if (!highlightedElement || highlightedElement.getAttribute("data-ref-id") !== refId) 22417 return; 22418 let target = event.target; 22419 if (!isAncestor(menuElement, target) && !isAncestor(target, menuElement)) 22420 return; 22421 if (target.hasAttribute("data-action")) { 22422 if (isEnter || isSpace) 22423 return; 22424 target.blur(); 22425 } 22426 let type = highlightedElement.getAttribute("data-nodetype"); 22427 type && (isEnter || isSpace) && ["component", "story", "document", "test"].includes(type) && onSelectStoryId(highlightedItemId); 22428 let isExpanded = highlightedElement.getAttribute("aria-expanded"); 22429 if (isArrowLeft) { 22430 if (isExpanded === "true") { 22431 setExpanded({ ids: [highlightedItemId], value: !1 }); 22432 return; 22433 } 22434 let parentId = highlightedElement.getAttribute("data-parent-id"), parentElement = parentId && getElementByDataItemId(parentId); 22435 if (parentElement && parentElement.getAttribute("data-highlightable") === "true") { 22436 highlightElement(parentElement); 22437 return; 22438 } 22439 setExpanded({ ids: getDescendantIds(data, highlightedItemId, !0), value: !1 }); 22440 return; 22441 } 22442 isArrowRight && (isExpanded === "false" ? updateExpanded({ ids: [highlightedItemId], value: !0 }) : isExpanded === "true" && updateExpanded({ ids: getDescendantIds(data, highlightedItemId, !0), value: !0 })); 22443 }, 60); 22444 return document5.addEventListener("keydown", navigateTree), () => document5.removeEventListener("keydown", navigateTree); 22445 }, [ 22446 containerRef, 22447 isBrowsing, 22448 refId, 22449 data, 22450 highlightedRef, 22451 setHighlightedItemId, 22452 onSelectStoryId 22453 ]), [expanded, updateExpanded]; 22454}; 22455 22456// src/manager/components/sidebar/Tree.tsx 22457var CollapseButton = styled(Button)(({ theme }) => ({ 22458 fontSize: `${theme.typography.size.s1 - 1}px`, 22459 fontWeight: theme.typography.weight.bold, 22460 letterSpacing: "0.16em", 22461 textTransform: "uppercase", 22462 color: theme.textMutedColor, 22463 padding: "0 8px" 22464})), LeafNodeStyleWrapper = styled.div(({ theme }) => ({ 22465 position: "relative", 22466 display: "flex", 22467 justifyContent: "space-between", 22468 alignItems: "flex-start", 22469 color: theme.color.defaultText, 22470 background: "transparent", 22471 minHeight: 28, 22472 borderRadius: 4, 22473 overflow: "hidden", 22474 "--tree-node-background-hover": theme.background.content, 22475 [MEDIA_DESKTOP_BREAKPOINT]: { 22476 "--tree-node-background-hover": theme.background.app 22477 }, 22478 "&:hover, &:focus": { 22479 "--tree-node-background-hover": theme.background.hoverable, 22480 background: "var(--tree-node-background-hover)", 22481 outline: "none" 22482 }, 22483 '& [data-displayed="off"]': { 22484 visibility: "hidden" 22485 }, 22486 '&:hover [data-displayed="off"]': { 22487 visibility: "visible" 22488 }, 22489 '& [data-displayed="on"] + *': { 22490 visibility: "hidden" 22491 }, 22492 '&:hover [data-displayed="off"] + *': { 22493 visibility: "hidden" 22494 }, 22495 '&[data-selected="true"]': { 22496 color: theme.color.lightest, 22497 background: theme.base === "dark" ? curriedDarken$1(0.18, theme.color.secondary) : theme.color.secondary, 22498 fontWeight: theme.typography.weight.bold, 22499 "&&:hover, &&:focus": { 22500 background: theme.base === "dark" ? curriedDarken$1(0.18, theme.color.secondary) : theme.color.secondary 22501 }, 22502 svg: { color: theme.color.lightest } 22503 }, 22504 a: { color: "currentColor" } 22505})), SkipToContentLink = styled(Button)(({ theme }) => ({ 22506 display: "none", 22507 "@media (min-width: 600px)": { 22508 display: "block", 22509 fontSize: "10px", 22510 overflow: "hidden", 22511 width: 1, 22512 height: "20px", 22513 boxSizing: "border-box", 22514 opacity: 0, 22515 padding: 0, 22516 "&:focus": { 22517 opacity: 1, 22518 padding: "5px 10px", 22519 background: "white", 22520 color: theme.color.secondary, 22521 width: "auto" 22522 } 22523 } 22524})), StatusSlots = styled.div({ 22525 display: "flex", 22526 alignItems: "center" 22527}); 22528var getStatusLabel = (status) => status.split(":")[1].replace(/^./, (char) => char.toUpperCase()), Node2 = react_default.memo(function(props) { 22529 let { 22530 item, 22531 statuses, 22532 groupDualStatus, 22533 refId, 22534 docsMode, 22535 isOrphan, 22536 isDisplayed, 22537 isSelected, 22538 isFullyExpanded, 22539 setFullyExpanded, 22540 isExpanded, 22541 setExpanded, 22542 onSelectStoryId, 22543 api, 22544 isModifiedFilterActive 22545 } = props, theme = useTheme(), { isDesktop, isMobile: isMobile2 } = useLayout(), statusLinks = useMemo(() => item.type === "story" || item.type === "docs" ? Object.entries(statuses).filter(([, status]) => status.sidebarContextMenu !== !1).filter(([, status]) => status.typeId !== REVIEW_STATUS_TYPE_ID).sort((a2, b2) => statusPriority.indexOf(a2[1].value) - statusPriority.indexOf(b2[1].value)).map(([typeId, status]) => ({ 22546 id: typeId, 22547 title: status.title, 22548 description: status.description, 22549 "aria-label": `Test status for ${status.title}: ${status.value}`, 22550 icon: getStatus(theme, status.value).icon, 22551 onClick: () => { 22552 onSelectStoryId(item.id), internal_fullStatusStore.selectStatuses([status]); 22553 } 22554 })) : [], [item.id, item.type, onSelectStoryId, statuses, theme]), visibleStatus = useMemo( 22555 () => getSidebarVisibleStatus({ 22556 theme, 22557 item, 22558 statuses, 22559 groupDualStatus, 22560 isModifiedFilterActive 22561 }), 22562 [theme, item, statuses, groupDualStatus, isModifiedFilterActive] 22563 ), contextMenu = useContextMenu(item, statusLinks, api, visibleStatus); 22564 refId !== "storybook_internal" && (contextMenu = { node: null, onMouseEnter: () => { 22565 } }); 22566 let id = createId(item.id, refId); 22567 if (item.type === "story" && !("children" in item && item.children) && (!("subtype" in item) || item.subtype !== "test") || item.type === "docs") { 22568 let LeafNode3 = item.type === "docs" ? DocumentNode : StoryLeafNode, { changeStatus, testStatus } = getChangeDetectionStatus(statuses || {}), leafChangeIcon = shouldShowChangeStatus(changeStatus, isModifiedFilterActive) ? getStatus(theme, changeStatus).icon : null, { icon: testIcon } = getStatus(theme, testStatus), overallStoryStatus = getMostCriticalStatusValue([changeStatus, testStatus]), { textColor } = getStatus(theme, overallStoryStatus); 22569 return react_default.createElement( 22570 LeafNodeStyleWrapper, 22571 { 22572 key: id, 22573 className: "sidebar-item", 22574 "data-selected": isSelected, 22575 "data-ref-id": refId, 22576 "data-item-id": item.id, 22577 "data-parent-id": item.parent, 22578 "data-nodetype": item.type === "docs" ? "document" : "story", 22579 "data-highlightable": isDisplayed, 22580 onMouseEnter: contextMenu.onMouseEnter 22581 }, 22582 react_default.createElement( 22583 LeafNode3, 22584 { 22585 style: isSelected ? {} : { color: textColor }, 22586 href: getLink(item, refId), 22587 id, 22588 depth: isOrphan ? item.depth : item.depth - 1, 22589 onClick: (event) => { 22590 event.preventDefault(), onSelectStoryId(item.id), isMobile2 && api.setMobileNavigation(!1); 22591 }, 22592 ...item.type === "docs" && { docsMode } 22593 }, 22594 item.renderLabel?.(item, api) || item.name 22595 ), 22596 isSelected && react_default.createElement(SkipToContentLink, { asChild: !0, ariaLabel: !1 }, react_default.createElement("a", { href: "#storybook-preview-wrapper" }, "Skip to content")), 22597 contextMenu.node, 22598 leafChangeIcon && testIcon ? react_default.createElement(StatusSlots, null, react_default.createElement( 22599 StatusButton, 22600 { 22601 ariaLabel: `Change status: ${getStatusLabel(changeStatus)}`, 22602 "data-testid": "tree-change-status-button", 22603 type: "button", 22604 status: changeStatus, 22605 selectedItem: isSelected 22606 }, 22607 leafChangeIcon 22608 ), react_default.createElement( 22609 StatusButton, 22610 { 22611 ariaLabel: `Test status: ${getStatusLabel(testStatus)}`, 22612 "data-testid": "tree-status-button", 22613 type: "button", 22614 status: testStatus, 22615 selectedItem: isSelected 22616 }, 22617 testIcon 22618 )) : leafChangeIcon ? react_default.createElement( 22619 StatusButton, 22620 { 22621 ariaLabel: `Change status: ${getStatusLabel(changeStatus)}`, 22622 "data-testid": "tree-change-status-button", 22623 type: "button", 22624 status: changeStatus, 22625 selectedItem: isSelected 22626 }, 22627 leafChangeIcon 22628 ) : testIcon ? react_default.createElement( 22629 StatusButton, 22630 { 22631 ariaLabel: `Test status: ${getStatusLabel(testStatus)}`, 22632 "data-testid": "tree-status-button", 22633 type: "button", 22634 status: testStatus, 22635 selectedItem: isSelected 22636 }, 22637 testIcon 22638 ) : null 22639 ); 22640 } 22641 if (item.type === "root") 22642 return react_default.createElement( 22643 RootNode, 22644 { 22645 key: id, 22646 id, 22647 className: "sidebar-subheading", 22648 "data-ref-id": refId, 22649 "data-item-id": item.id, 22650 "data-nodetype": "root" 22651 }, 22652 react_default.createElement( 22653 CollapseButton, 22654 { 22655 variant: "ghost", 22656 ariaLabel: isExpanded ? "Collapse" : "Expand", 22657 "data-action": "collapse-root", 22658 onClick: (event) => { 22659 event.preventDefault(), setExpanded({ ids: [item.id], value: !isExpanded }); 22660 }, 22661 "aria-expanded": isExpanded 22662 }, 22663 react_default.createElement(CollapseIcon2, { isExpanded }), 22664 item.renderLabel?.(item, api) || item.name 22665 ), 22666 isExpanded && react_default.createElement( 22667 Button, 22668 { 22669 padding: "small", 22670 variant: "ghost", 22671 className: "sidebar-subheading-action", 22672 ariaLabel: isFullyExpanded ? "Collapse all" : "Expand all", 22673 "data-action": "expand-all", 22674 "data-expanded": isFullyExpanded, 22675 onClick: (event) => { 22676 event.preventDefault(), setFullyExpanded(); 22677 } 22678 }, 22679 isFullyExpanded ? react_default.createElement(CollapseIcon, null) : react_default.createElement(ExpandAltIcon, null) 22680 ) 22681 ); 22682 if (item.type === "component" || item.type === "group" || item.type === "story" && "children" in item && item.children) { 22683 let { children = [] } = item, BranchNode2 = { component: ComponentNode, group: GroupNode, story: StoryBranchNode }[item.type], { changeStatus: localChange, testStatus: localTest } = getChangeDetectionStatus( 22684 statuses || {} 22685 ), groupDual = groupDualStatus?.[item.id] || { 22686 change: "status-value:unknown", 22687 test: "status-value:unknown" 22688 }, branchChange = getMostCriticalStatusValue([localChange, groupDual.change]), branchTest = getMostCriticalStatusValue([localTest, groupDual.test]), branchChangeIcon = shouldShowChangeStatus(branchChange, isModifiedFilterActive) ? getStatus(theme, branchChange).icon : null, branchTestIcon = getStatus(theme, branchTest).icon, overallStatus = getMostCriticalStatusValue([branchChange, branchTest]), color2 = overallStatus ? getStatus(theme, overallStatus).textColor : null; 22689 return react_default.createElement( 22690 LeafNodeStyleWrapper, 22691 { 22692 key: id, 22693 className: "sidebar-item", 22694 "data-selected": isSelected, 22695 "data-ref-id": refId, 22696 "data-item-id": item.id, 22697 "data-parent-id": item.parent, 22698 "data-nodetype": item.type, 22699 "data-highlightable": isDisplayed, 22700 onMouseEnter: contextMenu.onMouseEnter 22701 }, 22702 react_default.createElement( 22703 BranchNode2, 22704 { 22705 id, 22706 style: color2 && !isSelected ? { color: color2 } : {}, 22707 "aria-controls": children.join(" "), 22708 "aria-expanded": isExpanded, 22709 depth: isOrphan ? item.depth : item.depth - 1, 22710 isExpandable: children.length > 0, 22711 isExpanded, 22712 onClick: (event) => { 22713 event.preventDefault(), item.type === "story" ? (onSelectStoryId(item.id), (!isExpanded || isSelected) && setExpanded({ ids: [item.id], value: !isExpanded })) : item.type === "component" ? (!isExpanded && isDesktop && onSelectStoryId(item.id), setExpanded({ ids: [item.id], value: !isExpanded })) : setExpanded({ ids: [item.id], value: !isExpanded }); 22714 }, 22715 onMouseEnter: () => { 22716 (item.type === "component" || item.type === "story") && api.emit(PRELOAD_ENTRIES, { 22717 ids: [children[0]], 22718 options: { target: refId } 22719 }); 22720 } 22721 }, 22722 item.renderLabel?.(item, api) || item.name 22723 ), 22724 isSelected && react_default.createElement(SkipToContentLink, { asChild: !0, ariaLabel: !1 }, react_default.createElement("a", { href: "#storybook-preview-wrapper" }, "Skip to content")), 22725 contextMenu.node, 22726 branchChangeIcon && branchTestIcon ? react_default.createElement(StatusSlots, null, react_default.createElement( 22727 StatusButton, 22728 { 22729 ariaLabel: `Change status: ${getStatusLabel(branchChange)}`, 22730 "data-testid": "tree-change-status-button", 22731 type: "button", 22732 status: branchChange, 22733 selectedItem: isSelected 22734 }, 22735 branchChangeIcon 22736 ), react_default.createElement( 22737 StatusButton, 22738 { 22739 ariaLabel: `Test status: ${getStatusLabel(branchTest)}`, 22740 "data-testid": "tree-status-button", 22741 type: "button", 22742 status: branchTest, 22743 selectedItem: isSelected 22744 }, 22745 branchTestIcon 22746 )) : branchChangeIcon ? react_default.createElement( 22747 StatusButton, 22748 { 22749 ariaLabel: `Change status: ${getStatusLabel(branchChange)}`, 22750 "data-testid": "tree-change-status-button", 22751 type: "button", 22752 status: branchChange, 22753 selectedItem: isSelected 22754 }, 22755 branchChangeIcon 22756 ) : branchTestIcon ? react_default.createElement( 22757 StatusButton, 22758 { 22759 ariaLabel: `Test status: ${getStatusLabel(branchTest)}`, 22760 "data-testid": "tree-status-button", 22761 type: "button", 22762 status: branchTest, 22763 selectedItem: isSelected 22764 }, 22765 branchTestIcon 22766 ) : null 22767 ); 22768 } 22769 let isTest = item.type === "story" && item.subtype === "test", LeafNode2 = isTest ? TestNode : { docs: DocumentNode, story: StoryLeafNode }[item.type], nodeType = isTest ? "test" : { docs: "document", story: "story" }[item.type], leafStatuses = Object.fromEntries( 22770 Object.entries(statuses || {}).filter( 22771 ([, status]) => status.typeId !== CHANGE_DETECTION_STATUS_TYPE_ID || status.value === "status-value:new" 22772 ) 22773 ), leafStatus = getMostCriticalStatusValue(Object.values(leafStatuses).map((s2) => s2.value)), { icon: leafIcon, textColor: leafColor } = getStatus(theme, leafStatus), leafStatusButton = leafIcon ? react_default.createElement( 22774 StatusButton, 22775 { 22776 ariaLabel: `Status: ${getStatusLabel(leafStatus)}`, 22777 "data-testid": "tree-status-button", 22778 role: "status", 22779 type: "button", 22780 status: leafStatus, 22781 selectedItem: isSelected 22782 }, 22783 leafIcon 22784 ) : null; 22785 return react_default.createElement( 22786 LeafNodeStyleWrapper, 22787 { 22788 key: id, 22789 className: "sidebar-item", 22790 "data-selected": isSelected, 22791 "data-ref-id": refId, 22792 "data-item-id": item.id, 22793 "data-parent-id": item.parent, 22794 "data-nodetype": nodeType, 22795 "data-highlightable": isDisplayed, 22796 onMouseEnter: contextMenu.onMouseEnter 22797 }, 22798 react_default.createElement( 22799 LeafNode2, 22800 { 22801 style: leafColor && !isSelected ? { color: leafColor } : {}, 22802 href: getLink(item, refId), 22803 id, 22804 depth: isOrphan ? item.depth : item.depth - 1, 22805 onClick: (event) => { 22806 event.preventDefault(), onSelectStoryId(item.id), isMobile2 && api.setMobileNavigation(!1); 22807 } 22808 }, 22809 item.renderLabel?.(item, api) || item.name 22810 ), 22811 isSelected && react_default.createElement(SkipToContentLink, { ariaLabel: !1, asChild: !0 }, react_default.createElement("a", { href: "#storybook-preview-wrapper" }, "Skip to content")), 22812 contextMenu.node, 22813 leafStatusButton 22814 ); 22815}), Root3 = react_default.memo(function({ 22816 setExpanded, 22817 isFullyExpanded, 22818 expandableDescendants, 22819 ...props 22820}) { 22821 let setFullyExpanded = useCallback( 22822 () => setExpanded({ ids: expandableDescendants, value: !isFullyExpanded }), 22823 [setExpanded, isFullyExpanded, expandableDescendants] 22824 ); 22825 return react_default.createElement( 22826 Node2, 22827 { 22828 ...props, 22829 setExpanded, 22830 isFullyExpanded, 22831 setFullyExpanded 22832 } 22833 ); 22834}), Tree = react_default.memo(function({ 22835 isBrowsing, 22836 refId, 22837 data, 22838 allStatuses, 22839 docsMode, 22840 highlightedRef, 22841 setHighlightedItemId, 22842 selectedStoryId, 22843 onSelectStoryId 22844}) { 22845 let containerRef = useRef(null), api = useStorybookApi(), isModifiedFilterActive = (useStorybookState().includedStatusFilters ?? []).includes("status-value:modified"), [rootIds, orphanIds, initialExpanded] = useMemo( 22846 () => Object.keys(data).reduce( 22847 (acc, id) => { 22848 let item = data[id]; 22849 return item.type === "root" ? acc[0].push(id) : item.parent || acc[1].push(id), item.type === "root" && item.startCollapsed && (acc[2][id] = !1), acc; 22850 }, 22851 [[], [], {}] 22852 ), 22853 [data] 22854 ), { expandableDescendants } = useMemo(() => [...orphanIds, ...rootIds].reduce( 22855 (acc, nodeId) => (acc.expandableDescendants[nodeId] = getDescendantIds(data, nodeId, !1).filter( 22856 (d2) => !["story", "docs"].includes(data[d2].type) 22857 ), acc), 22858 { orphansFirst: [], expandableDescendants: {} } 22859 ), [data, rootIds, orphanIds]), singleStoryComponentIds = useMemo(() => Object.keys(data).filter((id) => { 22860 let entry = data[id]; 22861 if (entry.type !== "component") 22862 return !1; 22863 let { children = [], name } = entry; 22864 if (children.length !== 1) 22865 return !1; 22866 let onlyChild = data[children[0]]; 22867 return onlyChild.type === "docs" ? !0 : onlyChild.type === "story" && onlyChild.subtype === "story" ? isStoryHoistable(onlyChild.name, name) : !1; 22868 }), [data]), collapsedItems = useMemo( 22869 () => Object.keys(data).filter((id) => !singleStoryComponentIds.includes(id)), 22870 [data, singleStoryComponentIds] 22871 ), collapsedData = useMemo(() => singleStoryComponentIds.reduce( 22872 (acc, id) => { 22873 let { children, parent, name } = data[id], [childId] = children; 22874 if (parent) { 22875 let siblings = [...data[parent].children]; 22876 siblings[siblings.indexOf(id)] = childId, acc[parent] = { ...data[parent], children: siblings }; 22877 } 22878 return acc[childId] = { 22879 ...data[childId], 22880 name, 22881 parent, 22882 depth: data[childId].depth - 1 22883 }, acc; 22884 }, 22885 { ...data } 22886 ), [data, singleStoryComponentIds]), ancestry = useMemo(() => collapsedItems.reduce( 22887 (acc, id) => Object.assign(acc, { [id]: getAncestorIds2(collapsedData, id) }), 22888 {} 22889 ), [collapsedItems, collapsedData]), [expanded, setExpanded] = useExpanded({ 22890 // @ts-expect-error (non strict) 22891 containerRef, 22892 isBrowsing, 22893 refId, 22894 data: collapsedData, 22895 initialExpanded, 22896 rootIds, 22897 highlightedRef, 22898 setHighlightedItemId, 22899 selectedStoryId, 22900 onSelectStoryId 22901 }), groupStatus = useMemo( 22902 () => getGroupStatus(collapsedData, allStatuses ?? {}), 22903 [collapsedData, allStatuses] 22904 ), groupDualStatus = useMemo( 22905 () => getGroupDualStatus(collapsedData, allStatuses ?? {}), 22906 [collapsedData, allStatuses] 22907 ), treeItems = useMemo(() => collapsedItems.map((itemId) => { 22908 let item = collapsedData[itemId], id = createId(itemId, refId); 22909 if (item.type === "root") { 22910 let descendants = expandableDescendants[item.id], isFullyExpanded = descendants.every((d2) => expanded[d2]); 22911 return ( 22912 // @ts-expect-error (TODO) 22913 react_default.createElement( 22914 Root3, 22915 { 22916 api, 22917 key: id, 22918 item, 22919 refId, 22920 collapsedData, 22921 isOrphan: !1, 22922 isDisplayed: !0, 22923 isSelected: selectedStoryId === itemId, 22924 isExpanded: !!expanded[itemId], 22925 setExpanded, 22926 isFullyExpanded, 22927 expandableDescendants: descendants, 22928 onSelectStoryId, 22929 isModifiedFilterActive 22930 } 22931 ) 22932 ); 22933 } 22934 let isDisplayed = !item.parent || ancestry[itemId].every((a2) => expanded[a2]); 22935 return isDisplayed === !1 ? null : react_default.createElement( 22936 Node2, 22937 { 22938 api, 22939 collapsedData, 22940 key: id, 22941 item, 22942 statuses: allStatuses?.[itemId] ?? {}, 22943 groupDualStatus, 22944 refId, 22945 docsMode, 22946 isOrphan: orphanIds.some((oid) => itemId === oid || itemId.startsWith(`${oid}-`)), 22947 isDisplayed, 22948 isSelected: selectedStoryId === itemId, 22949 isExpanded: !!expanded[itemId], 22950 setExpanded, 22951 onSelectStoryId, 22952 isModifiedFilterActive 22953 } 22954 ); 22955 }), [ 22956 ancestry, 22957 api, 22958 collapsedData, 22959 collapsedItems, 22960 docsMode, 22961 expandableDescendants, 22962 expanded, 22963 groupDualStatus, 22964 isModifiedFilterActive, 22965 onSelectStoryId, 22966 orphanIds, 22967 refId, 22968 selectedStoryId, 22969 setExpanded, 22970 allStatuses 22971 ]); 22972 return react_default.createElement(StatusContext.Provider, { value: { data, allStatuses, groupStatus } }, react_default.createElement("div", { ref: containerRef }, treeItems)); 22973}); 22974 22975// src/manager/components/sidebar/Refs.tsx 22976var Wrapper6 = styled.div(({ isMain }) => ({ 22977 position: "relative", 22978 marginTop: isMain ? void 0 : 0 22979})), RefHead = styled.div(({ theme }) => ({ 22980 fontWeight: theme.typography.weight.bold, 22981 fontSize: theme.typography.size.s2, 22982 // Similar to ListItem.tsx 22983 textDecoration: "none", 22984 lineHeight: "16px", 22985 display: "flex", 22986 alignItems: "center", 22987 justifyContent: "space-between", 22988 background: "transparent", 22989 width: "100%", 22990 marginTop: 20, 22991 paddingTop: 16, 22992 paddingBottom: 12, 22993 borderTop: `1px solid ${theme.appBorderColor}`, 22994 color: theme.color.defaultText 22995})), RefTitle = styled.div({ 22996 textOverflow: "ellipsis", 22997 whiteSpace: "nowrap", 22998 flex: 1, 22999 overflow: "hidden", 23000 marginLeft: 2 23001}), CollapseButton2 = styled.button(({ theme }) => ({ 23002 all: "unset", 23003 display: "flex", 23004 padding: "0px 8px", 23005 gap: 6, 23006 alignItems: "center", 23007 cursor: "pointer", 23008 overflow: "hidden", 23009 "&:focus": { 23010 borderColor: theme.color.secondary, 23011 "span:first-of-type": { 23012 borderLeftColor: theme.color.secondary 23013 } 23014 } 23015})), Ref = react_default.memo(function(props) { 23016 let storybookState = useStorybookState(), api = useStorybookApi(), { 23017 filteredIndex: index, 23018 id: refId, 23019 title: title2 = refId, 23020 isLoading: isLoadingMain, 23021 isBrowsing, 23022 hasEntries, 23023 selectedStoryId, 23024 highlightedRef, 23025 setHighlighted, 23026 loginUrl, 23027 type, 23028 expanded = !0, 23029 indexError, 23030 previewInitialized, 23031 allStatuses 23032 } = props, length = useMemo(() => index ? Object.keys(index).length : 0, [index]), indicatorRef = useRef(null), isMain = refId === DEFAULT_REF_ID, isLoading = isLoadingMain || (type === "auto-inject" && !previewInitialized || type === "server-checked") || type === "unknown", isError2 = !!indexError, isEmpty = !isLoading && length === 0, isAuthRequired = !!loginUrl && length === 0, activeFilterCount = getActiveFilterCount(storybookState), state = getStateType(isLoading, isAuthRequired, isError2, isEmpty), [isExpanded, setExpanded] = useState(expanded); 23033 useEffect(() => { 23034 index && selectedStoryId && index[selectedStoryId] && setExpanded(!0); 23035 }, [index, selectedStoryId]); 23036 let handleClick = useCallback(() => setExpanded((value) => !value), []), setHighlightedItemId = useCallback( 23037 (itemId) => setHighlighted({ itemId, refId }), 23038 [setHighlighted, refId] 23039 ), onSelectStoryId = useCallback( 23040 (storyId) => api?.selectStory(storyId, void 0, { ref: isMain ? void 0 : refId }), 23041 [api, isMain, refId] 23042 ); 23043 return react_default.createElement(react_default.Fragment, null, isMain || react_default.createElement( 23044 RefHead, 23045 { 23046 "aria-label": `${isExpanded ? "Hide" : "Show"} ${title2} stories`, 23047 "aria-expanded": isExpanded 23048 }, 23049 react_default.createElement(CollapseButton2, { "data-action": "collapse-ref", onClick: handleClick }, react_default.createElement(CollapseIcon2, { isExpanded }), react_default.createElement(RefTitle, { title: title2 }, title2)), 23050 react_default.createElement(RefIndicator, { ...props, state, ref: indicatorRef }) 23051 ), isExpanded && react_default.createElement(Wrapper6, { "data-title": title2, isMain }, state === "auth" && react_default.createElement(AuthBlock, { id: refId, loginUrl }), state === "error" && react_default.createElement(ErrorBlock, { error: indexError }), state === "loading" && react_default.createElement(LoaderBlock, { isMain }), state === "empty" && react_default.createElement( 23052 EmptyBlock, 23053 { 23054 isMain, 23055 hasEntries, 23056 activeFilterCount 23057 } 23058 ), state === "ready" && react_default.createElement( 23059 Tree, 23060 { 23061 allStatuses, 23062 isBrowsing, 23063 isMain, 23064 refId, 23065 data: index, 23066 docsMode: storybookState.docsOptions.docsMode, 23067 selectedStoryId, 23068 onSelectStoryId, 23069 highlightedRef, 23070 setHighlightedItemId 23071 } 23072 ))); 23073}); 23074 23075// src/manager/components/sidebar/useHighlighted.ts 23076init_react(); 23077var { document: document6, window: globalWindow4 } = scope, fromSelection = (selection) => selection ? { itemId: selection.storyId, refId: selection.refId } : null, scrollToSelector = (selector, options2 = {}, _attempt = 1) => { 23078 let { containerRef, center = !1, attempts = 3, delay: delay2 = 500 } = options2, element = (containerRef ? containerRef.current : document6)?.querySelector(selector); 23079 element ? scrollIntoView(element, center) : _attempt <= attempts && setTimeout(scrollToSelector, delay2, selector, options2, _attempt + 1); 23080}, useHighlighted = ({ 23081 containerRef, 23082 isLoading, 23083 isBrowsing, 23084 selected 23085}) => { 23086 let initialHighlight = fromSelection(selected), highlightedRef = useRef(initialHighlight), [highlighted, setHighlighted] = useState(initialHighlight), api = useStorybookApi(), updateHighlighted = useCallback( 23087 (highlight) => { 23088 highlightedRef.current = highlight, setHighlighted(highlight); 23089 }, 23090 [highlightedRef] 23091 ), highlightElement = useCallback( 23092 (element, center = !1) => { 23093 let itemId = element.getAttribute("data-item-id"), refId = element.getAttribute("data-ref-id"); 23094 !itemId || !refId || (updateHighlighted({ itemId, refId }), scrollIntoView(element, center)); 23095 }, 23096 [updateHighlighted] 23097 ); 23098 return useEffect(() => { 23099 let highlight = fromSelection(selected); 23100 updateHighlighted(highlight), highlight && scrollToSelector(`[data-item-id="${highlight.itemId}"][data-ref-id="${highlight.refId}"]`, { 23101 containerRef, 23102 center: !0 23103 }); 23104 }, [containerRef, selected, updateHighlighted]), useEffect(() => { 23105 let menuElement = document6.getElementById("storybook-explorer-menu"), lastRequestId, navigateTree = (event) => { 23106 if (isLoading || !isBrowsing || !containerRef.current || !matchesModifiers(!1, event)) 23107 return; 23108 let isArrowUp = matchesKeyCode("ArrowUp", event), isArrowDown = matchesKeyCode("ArrowDown", event); 23109 if (!(isArrowUp || isArrowDown)) 23110 return; 23111 let requestId = globalWindow4.requestAnimationFrame(() => { 23112 globalWindow4.cancelAnimationFrame(lastRequestId), lastRequestId = requestId; 23113 let target = event.target; 23114 if (!isAncestor(menuElement, target) && !isAncestor(target, menuElement)) 23115 return; 23116 target.hasAttribute("data-action") && target.blur(); 23117 let highlightable = Array.from( 23118 containerRef.current?.querySelectorAll("[data-highlightable=true]") || [] 23119 ), currentIndex = highlightable.findIndex( 23120 (el) => el.getAttribute("data-item-id") === highlightedRef.current?.itemId && el.getAttribute("data-ref-id") === highlightedRef.current?.refId 23121 ), nextIndex = cycle2(highlightable, currentIndex, isArrowUp ? -1 : 1), didRunAround = isArrowUp ? nextIndex === highlightable.length - 1 : nextIndex === 0; 23122 if (highlightElement(highlightable[nextIndex], didRunAround), highlightable[nextIndex].getAttribute("data-nodetype") === "component") { 23123 let { itemId, refId } = highlightedRef.current, item = api.resolveStory(itemId, refId === "storybook_internal" ? void 0 : refId); 23124 item?.type === "component" && api.emit(PRELOAD_ENTRIES, { 23125 ids: [item.children[0]], 23126 options: { target: refId } 23127 }); 23128 } 23129 }); 23130 }; 23131 return document6.addEventListener("keydown", navigateTree), () => document6.removeEventListener("keydown", navigateTree); 23132 }, [api, containerRef, isLoading, isBrowsing, highlightedRef, highlightElement]), [highlighted, updateHighlighted, highlightedRef]; 23133}; 23134 23135// src/manager/components/sidebar/Explorer.tsx 23136var Explorer = react_default.memo(function({ 23137 hasEntries, 23138 isLoading, 23139 isBrowsing, 23140 isHidden, 23141 dataset, 23142 selected, 23143 ...restProps 23144}) { 23145 let containerRef = useRef(null), [highlighted, setHighlighted, highlightedRef] = useHighlighted({ 23146 containerRef, 23147 isLoading, 23148 isBrowsing, 23149 selected 23150 }), { landmarkProps } = useLandmark( 23151 { "aria-labelledby": "storybook-explorer-tree-heading", role: "navigation" }, 23152 containerRef 23153 ); 23154 return react_default.createElement( 23155 "nav", 23156 { 23157 hidden: isHidden || void 0, 23158 "aria-hidden": isHidden || void 0, 23159 className: isBrowsing ? void 0 : "sb-sr-only", 23160 ref: containerRef, 23161 id: "storybook-explorer-tree", 23162 "data-highlighted-ref-id": highlighted?.refId, 23163 "data-highlighted-item-id": highlighted?.itemId, 23164 ...landmarkProps, 23165 ...restProps 23166 }, 23167 react_default.createElement("h2", { id: "storybook-explorer-tree-heading", className: "sb-sr-only" }, "Stories"), 23168 highlighted && react_default.createElement(HighlightStyles, { ...highlighted }), 23169 dataset.entries.map(([refId, ref]) => react_default.createElement( 23170 Ref, 23171 { 23172 ...ref, 23173 key: refId, 23174 isLoading, 23175 isBrowsing, 23176 hasEntries, 23177 selectedStoryId: selected?.refId === ref.id ? selected.storyId : null, 23178 highlightedRef, 23179 setHighlighted 23180 } 23181 )) 23182 ); 23183}); 23184 23185// src/manager/components/sidebar/Filter.tsx 23186init_react(); 23187 23188// src/manager/components/sidebar/FilterPanel.tsx 23189init_react(); 23190 23191// src/manager/components/sidebar/FilterPanelLink.tsx 23192init_react(); 23193var MutedText = styled.span(({ theme }) => ({ 23194 color: theme.textMutedColor 23195})), StatusIcon2 = styled.span(({ $iconColor }) => ({ 23196 display: "contents", 23197 color: $iconColor ?? void 0, 23198 "> svg": { 23199 transform: "scale(1.3)" 23200 } 23201})), createFilterLink = ({ 23202 id, 23203 type, 23204 title: title2, 23205 tooltip, 23206 count, 23207 icon, 23208 isIncluded, 23209 isExcluded, 23210 onCheckboxChange, 23211 onInvert 23212}) => { 23213 let isChecked = isIncluded || isExcluded, toggleLabel = `${type} filter: ${isExcluded ? `exclude ${title2}` : title2}`, toggleTooltip = tooltip ?? `${isChecked ? "Remove" : "Add"} ${type} filter: ${title2}`, invertButtonLabel = `${isExcluded ? "Include" : "Exclude"} ${type}: ${title2}`; 23214 return { 23215 id: `filter-${type}-${id}`, 23216 content: react_default.createElement(ActionList.HoverItem, { targetId: `filter-${type}-${id}` }, react_default.createElement(ActionList.Action, { as: "label", ariaLabel: !1, tabIndex: -1, tooltip: toggleTooltip }, react_default.createElement(ActionList.Icon, null, isExcluded ? react_default.createElement(DeleteIcon, null) : isIncluded ? null : icon, react_default.createElement( 23217 Form.Checkbox, 23218 { 23219 checked: isChecked, 23220 onChange: onCheckboxChange, 23221 "data-tag": title2, 23222 "aria-label": toggleLabel 23223 } 23224 )), react_default.createElement(ActionList.Text, null, react_default.createElement("span", null, title2, isExcluded && react_default.createElement(MutedText, null, " (excluded)"))), isExcluded ? react_default.createElement("s", null, count) : react_default.createElement("span", null, count)), react_default.createElement( 23225 ActionList.Button, 23226 { 23227 "data-target-id": `filter-${type}-${id}`, 23228 ariaLabel: invertButtonLabel, 23229 onClick: onInvert 23230 }, 23231 react_default.createElement("span", { style: { minWidth: 45 } }, isExcluded ? "Include" : "Exclude") 23232 )) 23233 }; 23234}; 23235 23236// src/manager/components/sidebar/FilterPanel.utils.ts 23237var BUILT_IN_TAGS = /* @__PURE__ */ new Set([ 23238 "dev", 23239 "test", 23240 "autodocs", 23241 "attached-mdx", 23242 "unattached-mdx", 23243 "play-fn", 23244 "test-fn", 23245 "manifest" 23246]), STATUS_DISPLAY_ORDER = [ 23247 "status-value:new", 23248 "status-value:modified", 23249 "status-value:affected", 23250 "status-value:reviewing" 23251], areFiltersEqual = (left, right) => left.length === right.length && (/* @__PURE__ */ new Set([...left, ...right])).size === left.length, getFilterFunction = (tag) => Object.hasOwn(BUILT_IN_FILTERS, tag) ? BUILT_IN_FILTERS[tag] : USER_TAG_FILTER(tag); 23252 23253// src/manager/components/sidebar/useFilterData.tsx 23254init_react(); 23255var BUILT_IN_FILTER_DEFS = [ 23256 { id: "_docs", title: "Documentation", icon: react_default.createElement(DocumentIcon, { color: color.gold }), tag: "_docs" }, 23257 { id: "_play", title: "Play", icon: react_default.createElement(PlayHollowIcon, { color: color.seafoam }), tag: "_play" }, 23258 { id: "_test", title: "Testing", icon: react_default.createElement(BeakerIcon, { color: color.green }), tag: "_test" } 23259]; 23260function useTagFilterEntries(indexJson) { 23261 return useMemo(() => { 23262 let entries = Object.values(indexJson.entries), userTagsCounts = entries.reduce((acc, entry) => (entry.tags?.forEach((tag) => { 23263 BUILT_IN_TAGS.has(tag) || (acc[tag] = (acc[tag] || 0) + 1); 23264 }), acc), {}), tagEntries = Object.entries(userTagsCounts).map(([tag, count]) => ({ 23265 id: tag, 23266 type: "tag", 23267 title: tag, 23268 count, 23269 icon: null 23270 })), getBuiltInCount = (filterFn) => entries.filter((entry) => filterFn?.(entry)).length; 23271 return { builtInEntries: BUILT_IN_FILTER_DEFS.map((def) => ({ 23272 id: def.id, 23273 type: "built-in", 23274 title: def.title, 23275 icon: def.icon, 23276 count: getBuiltInCount(getFilterFunction(def.tag)) 23277 })), tagEntries }; 23278 }, [indexJson.entries]); 23279} 23280function useStatusFilterEntries(allStatuses) { 23281 return useMemo(() => { 23282 let changeDetectionEnabled = !!globalThis?.FEATURES?.changeDetection, counts = countStatusesByValue(allStatuses), reviewingCount = counts["status-value:reviewing"] ?? 0; 23283 return !changeDetectionEnabled && reviewingCount === 0 ? [] : (changeDetectionEnabled ? STATUS_DISPLAY_ORDER : ["status-value:reviewing"]).map((statusValue) => ({ 23284 statusValue, 23285 shortName: statusValueShortName(statusValue), 23286 description: statusValueDescription(statusValue), 23287 count: counts[statusValue] ?? 0 23288 })).filter((entry) => entry.statusValue !== "status-value:reviewing" || entry.count > 0); 23289 }, [allStatuses]); 23290} 23291 23292// src/manager/components/sidebar/FilterPanel.tsx 23293var Wrapper7 = styled.div({ 23294 minWidth: 240, 23295 maxWidth: 300, 23296 maxHeight: 15.5 * 32 + 8, 23297 // 15.5 items at 32px each + 8px padding 23298 overflow: "hidden", 23299 overflowY: "auto", 23300 scrollbarWidth: "thin" 23301}), FilterPanel = ({ 23302 api, 23303 indexJson, 23304 defaultIncludedFilters, 23305 defaultExcludedFilters, 23306 includedFilters, 23307 excludedFilters, 23308 allStatuses, 23309 includedStatusFilters, 23310 excludedStatusFilters 23311}) => { 23312 let theme = useTheme(), { builtInEntries, tagEntries } = useTagFilterEntries(indexJson), statusEntries = useStatusFilterEntries(allStatuses), toTagFilterItem = useCallback( 23313 (entry) => { 23314 if (entry.count === 0 && entry.type === "built-in") return null; 23315 let isIncluded = includedFilters.includes(entry.id), isExcluded = excludedFilters.includes(entry.id), isChecked = isIncluded || isExcluded; 23316 return { 23317 id: entry.id, 23318 type: entry.type, 23319 title: entry.title, 23320 count: entry.count, 23321 icon: entry.icon, 23322 isIncluded, 23323 isExcluded, 23324 onCheckboxChange: () => { 23325 isChecked ? api.removeTagFilters([entry.id]) : api.addTagFilters([entry.id], !1); 23326 }, 23327 onInvert: () => api.addTagFilters([entry.id], !isExcluded) 23328 }; 23329 }, 23330 [api, includedFilters, excludedFilters] 23331 ), toStatusFilterItem = useCallback( 23332 (entry) => { 23333 let isRelated = entry.statusValue === "status-value:affected", shortName = isRelated ? "related" : entry.shortName, isIncluded = includedStatusFilters.includes(entry.statusValue), isExcluded = excludedStatusFilters.includes(entry.statusValue), isChecked = isIncluded || isExcluded, { icon: statusIconEl, iconColor } = getStatus(theme, entry.statusValue), icon = isRelated ? react_default.createElement("span", { "aria-hidden": "true" }) : statusIconEl ? react_default.createElement(StatusIcon2, { $iconColor: iconColor }, statusIconEl) : null; 23334 return { 23335 id: shortName, 23336 type: "status", 23337 title: shortName.charAt(0).toUpperCase() + shortName.slice(1), 23338 tooltip: entry.description, 23339 count: entry.count, 23340 icon, 23341 isIncluded, 23342 isExcluded, 23343 onCheckboxChange: () => { 23344 isChecked ? api.removeStatusFilters([entry.statusValue]) : api.addStatusFilters([entry.statusValue], !1); 23345 }, 23346 onInvert: () => api.addStatusFilters([entry.statusValue], !isExcluded) 23347 }; 23348 }, 23349 [api, includedStatusFilters, excludedStatusFilters, theme] 23350 ), builtInItems = useMemo( 23351 () => builtInEntries.sort((a2, b2) => a2.id.localeCompare(b2.id)).map(toTagFilterItem).filter((f2) => f2 !== null), 23352 [builtInEntries, toTagFilterItem] 23353 ), tagItems = useMemo( 23354 () => tagEntries.sort((a2, b2) => a2.id.localeCompare(b2.id)).map(toTagFilterItem).filter((f2) => f2 !== null), 23355 [tagEntries, toTagFilterItem] 23356 ), statusItems = useMemo( 23357 () => statusEntries.map(toStatusFilterItem), 23358 [statusEntries, toStatusFilterItem] 23359 ), changeDetectionStatusItems = useMemo( 23360 () => statusItems.filter((item) => item.id !== "reviewing"), 23361 [statusItems] 23362 ), reviewingStatusItems = useMemo( 23363 () => statusItems.filter((item) => item.id === "reviewing"), 23364 [statusItems] 23365 ), filterIds = useMemo( 23366 () => [...builtInEntries.map((e2) => e2.id), ...tagEntries.map((e2) => e2.id)], 23367 [builtInEntries, tagEntries] 23368 ), setAllFilters = useCallback( 23369 (selected) => api.setAllTagFilters(selected ? filterIds : [], []), 23370 [api, filterIds] 23371 ), isDefaultSelection = areFiltersEqual(includedFilters, defaultIncludedFilters) && areFiltersEqual(excludedFilters, defaultExcludedFilters), hasDefaultSelection = defaultIncludedFilters.length > 0 || defaultExcludedFilters.length > 0, isNothingSelectedYet = includedFilters.length === 0 && excludedFilters.length === 0 && includedStatusFilters.length === 0 && excludedStatusFilters.length === 0, hasItems = builtInItems.length > 0 || tagItems.length > 0; 23372 return react_default.createElement(Wrapper7, null, hasItems && react_default.createElement(ActionList, { as: "div" }, react_default.createElement(ActionList.Item, { as: "div" }, isNothingSelectedYet ? react_default.createElement( 23373 ActionList.Button, 23374 { 23375 ariaLabel: !1, 23376 id: "select-all", 23377 key: "select-all", 23378 onClick: () => setAllFilters(!0) 23379 }, 23380 react_default.createElement(BatchAcceptIcon, null), 23381 react_default.createElement(ActionList.Text, null, "Select all") 23382 ) : react_default.createElement( 23383 ActionList.Button, 23384 { 23385 ariaLabel: !1, 23386 id: "deselect-all", 23387 key: "deselect-all", 23388 onClick: async () => { 23389 await setAllFilters(!1), await api.resetStatusFilters(); 23390 } 23391 }, 23392 react_default.createElement(SweepIcon, null), 23393 react_default.createElement(ActionList.Text, null, "Clear filters") 23394 ), hasDefaultSelection && react_default.createElement( 23395 ActionList.Button, 23396 { 23397 id: "reset-filters", 23398 key: "reset-filters", 23399 onClick: () => api.resetTagFilters(), 23400 ariaLabel: "Reset filters", 23401 tooltip: "Reset to default selection", 23402 disabled: isDefaultSelection 23403 }, 23404 react_default.createElement(UndoIcon, null) 23405 ))), reviewingStatusItems.length > 0 && react_default.createElement(ActionList, null, reviewingStatusItems.map((item) => { 23406 let link = createFilterLink(item); 23407 return react_default.createElement(Fragment, { key: link.id }, link.content); 23408 })), builtInItems.length > 0 && react_default.createElement(ActionList, null, builtInItems.map((item) => { 23409 let link = createFilterLink(item); 23410 return react_default.createElement(Fragment, { key: link.id }, link.content); 23411 })), changeDetectionStatusItems.length > 0 && react_default.createElement(ActionList, null, changeDetectionStatusItems.map((item) => { 23412 let link = createFilterLink(item); 23413 return react_default.createElement(Fragment, { key: link.id }, link.content); 23414 })), tagItems.length > 0 && react_default.createElement(ActionList, null, tagItems.map((item) => { 23415 let link = createFilterLink(item); 23416 return react_default.createElement(Fragment, { key: link.id }, link.content); 23417 })), tagItems.length === 0 && react_default.createElement(ActionList, { as: "div" }, react_default.createElement(ActionList.Item, { as: "div" }, react_default.createElement( 23418 ActionList.Link, 23419 { 23420 ariaLabel: !1, 23421 href: api.getDocsUrl({ subpath: "writing-stories/tags#custom-tags" }), 23422 target: "_blank" 23423 }, 23424 react_default.createElement(ActionList.Icon, null, react_default.createElement(DocumentIcon, null)), 23425 react_default.createElement(ActionList.Text, null, react_default.createElement("span", null, "Learn how to add tags")), 23426 react_default.createElement(ActionList.Icon, null, react_default.createElement(ShareAltIcon, null)) 23427 )))); 23428}; 23429 23430// src/manager/components/sidebar/Filter.tsx 23431var StyledButton2 = styled(Button)(({ $isHighlighted, theme }) => ({ 23432 "&:focus-visible": { 23433 outlineOffset: 4 23434 }, 23435 ...$isHighlighted && { 23436 background: theme.background.hoverable, 23437 color: theme.color.secondary 23438 } 23439})), TagSelected = styled(Badge)(({ theme }) => ({ 23440 position: "absolute", 23441 top: 7, 23442 right: 7, 23443 transform: "translate(50%, -50%)", 23444 display: "flex", 23445 alignItems: "center", 23446 justifyContent: "center", 23447 padding: 3, 23448 height: 6, 23449 minWidth: 6, 23450 lineHeight: "px", 23451 boxShadow: `${theme.barSelectedColor} 0 0 0 1px inset`, 23452 fontSize: theme.typography.size.s1 - 1, 23453 background: theme.barSelectedColor, 23454 color: theme.color.inverseText 23455})), filterMapper = ({ api, state }) => ({ 23456 api, 23457 indexJson: state.internal_index, 23458 activeFilterCount: getActiveFilterCount(state), 23459 defaultIncludedFilters: state.defaultIncludedTagFilters, 23460 defaultExcludedFilters: state.defaultExcludedTagFilters, 23461 includedFilters: state.includedTagFilters, 23462 excludedFilters: state.excludedTagFilters, 23463 includedStatusFilters: state.includedStatusFilters ?? [], 23464 excludedStatusFilters: state.excludedStatusFilters ?? [] 23465}), FilterInner = ({ 23466 api, 23467 indexJson, 23468 activeFilterCount, 23469 defaultIncludedFilters, 23470 defaultExcludedFilters, 23471 includedFilters, 23472 excludedFilters, 23473 includedStatusFilters, 23474 excludedStatusFilters 23475}) => { 23476 let [expanded, setExpanded] = useState(!1), allStatuses = experimental_useStatusStore(), handleToggleExpand = useCallback( 23477 (event) => { 23478 event.preventDefault(), setExpanded(!expanded); 23479 }, 23480 [expanded] 23481 ); 23482 return react_default.createElement( 23483 PopoverProvider, 23484 { 23485 ariaLabel: "Tag filters", 23486 placement: "bottom", 23487 onVisibleChange: setExpanded, 23488 offset: 8, 23489 padding: 0, 23490 popover: () => react_default.createElement( 23491 FilterPanel, 23492 { 23493 api, 23494 indexJson, 23495 defaultIncludedFilters, 23496 defaultExcludedFilters, 23497 includedFilters, 23498 excludedFilters, 23499 allStatuses, 23500 includedStatusFilters, 23501 excludedStatusFilters 23502 } 23503 ) 23504 }, 23505 react_default.createElement( 23506 StyledButton2, 23507 { 23508 key: "tags", 23509 ariaLabel: activeFilterCount ? `${activeFilterCount} active tag ${activeFilterCount !== 1 ? "filters" : "filter"}` : "Tag filters", 23510 ariaDescription: "Filter the items shown in a sidebar based on the tags applied to them.", 23511 variant: "ghost", 23512 padding: "small", 23513 $isHighlighted: activeFilterCount > 0, 23514 onClick: handleToggleExpand 23515 }, 23516 react_default.createElement(FilterIcon, null), 23517 activeFilterCount > 0 && react_default.createElement(TagSelected, null) 23518 ) 23519 ); 23520}, Filter = () => react_default.createElement(Consumer, { filter: filterMapper }, ({ 23521 api, 23522 indexJson, 23523 activeFilterCount, 23524 defaultIncludedFilters, 23525 defaultExcludedFilters, 23526 includedFilters, 23527 excludedFilters, 23528 includedStatusFilters, 23529 excludedStatusFilters 23530}) => indexJson ? react_default.createElement( 23531 FilterInner, 23532 { 23533 api, 23534 indexJson, 23535 activeFilterCount, 23536 defaultIncludedFilters, 23537 defaultExcludedFilters, 23538 includedFilters, 23539 excludedFilters, 23540 includedStatusFilters, 23541 excludedStatusFilters 23542 } 23543) : null); 23544 23545// src/manager/components/sidebar/Heading.tsx 23546init_react(); 23547 23548// src/manager/components/sidebar/Brand.tsx 23549init_react(); 23550var StorybookLogoStyled = styled(StorybookLogo)(({ theme }) => ({ 23551 width: "auto", 23552 height: "22px !important", 23553 display: "block", 23554 color: theme.base === "light" ? theme.color.defaultText : theme.color.lightest 23555})), Img2 = styled.img({ 23556 display: "block", 23557 maxWidth: "150px !important", 23558 maxHeight: "100px" 23559}), LogoLink = styled.a(({ theme }) => ({ 23560 display: "inline-flex", 23561 alignItems: "center", 23562 height: "100%", 23563 margin: "-3px -4px", 23564 padding: "2px 3px", 23565 border: "1px solid transparent", 23566 borderRadius: 3, 23567 color: "inherit", 23568 textDecoration: "none", 23569 "&:focus-visible": { 23570 outline: `2px solid ${theme.color.secondary}`, 23571 outlineOffset: 2 23572 } 23573})), Brand = withTheme(({ theme }) => { 23574 let { title: title2 = "Storybook", url = "./", image, target } = theme.brand, targetValue = target || (url === "./" ? "" : "_blank"); 23575 if (image === null) 23576 return title2 === null ? null : url ? react_default.createElement(LogoLink, { href: url, target: targetValue, dangerouslySetInnerHTML: { __html: title2 } }) : react_default.createElement("div", { dangerouslySetInnerHTML: { __html: title2 } }); 23577 let logo = image ? react_default.createElement(Img2, { src: image, alt: title2 }) : react_default.createElement(StorybookLogoStyled, { alt: title2 }); 23578 return url ? react_default.createElement(LogoLink, { title: title2, href: url, target: targetValue }, logo) : react_default.createElement("div", null, logo); 23579}); 23580 23581// src/manager/components/sidebar/Menu.tsx 23582init_react(); 23583var buttonStyleAdditions = ({ 23584 highlighted, 23585 isMobile: isMobile2, 23586 theme 23587}) => css` 23588 position: relative; 23589 overflow: visible; 23590 margin-top: 0; 23591 z-index: 1; 23592 ${isMobile2 && ` 23593 width: 36px; 23594 height: 36px; 23595 `} 23596 ${highlighted && ` 23597 &:before, 23598 &:after { 23599 content: ''; 23600 position: absolute; 23601 top: 6px; 23602 right: 6px; 23603 width: 5px; 23604 height: 5px; 23605 z-index: 2; 23606 border-radius: 50%; 23607 background: ${theme.background.app}; 23608 border: 1px solid ${theme.background.app}; 23609 box-shadow: 0 0 0 2px ${theme.background.app}; 23610 } 23611 &:after { 23612 background: ${theme.color.positive}; 23613 border: 1px solid rgba(0, 0, 0, 0.1); 23614 box-shadow: 0 0 0 2px ${theme.background.app}; 23615 } 23616 &:hover:after, 23617 &:focus-visible:after { 23618 box-shadow: 0 0 0 2px ${curriedTransparentize$1(0.88, theme.color.secondary)}; 23619 } 23620 `} 23621`, Container10 = styled.div({ 23622 minWidth: 250 23623}), SidebarButton = styled(Button)(buttonStyleAdditions), SidebarToggleButton = styled(ToggleButton)(buttonStyleAdditions), MenuButtonGroup = styled.div({ 23624 display: "flex", 23625 gap: 6 23626}), SidebarMenuList = ({ menu, onHide }) => react_default.createElement(Container10, null, menu.filter((links) => links.length).flatMap((links) => react_default.createElement(ActionList, { key: links.map((link) => link.id).join("_") }, links.map((link) => { 23627 let linkContent = react_default.createElement(react_default.Fragment, null, (link.icon || link.input) && react_default.createElement(ActionList.Icon, null, link.icon || link.input), (link.title || link.center) && react_default.createElement(ActionList.Text, null, link.title || link.center), link.right); 23628 return react_default.createElement(ActionList.Item, { key: link.id, active: link.active }, react_default.createElement( 23629 ActionList.Action, 23630 { 23631 asChild: !!link.href, 23632 ariaLabel: !1, 23633 id: `list-item-${link.id}`, 23634 disabled: link.disabled, 23635 onClick: (e2) => { 23636 if (link.disabled) { 23637 e2.preventDefault(); 23638 return; 23639 } 23640 link.href && link.internal && e2.preventDefault(), link.onClick?.(e2, { 23641 id: link.id, 23642 active: link.active, 23643 disabled: link.disabled, 23644 title: link.title, 23645 href: link.href 23646 }), link.closeOnClick && onHide(); 23647 } 23648 }, 23649 link.href ? react_default.createElement( 23650 "a", 23651 { 23652 href: link.href, 23653 target: link.internal ? void 0 : "_blank", 23654 rel: link.internal ? "canonical" : "noreferrer" 23655 }, 23656 linkContent 23657 ) : linkContent 23658 )); 23659})))), SidebarMenu = ({ menu, isHighlighted, onClick }) => { 23660 let [isTooltipVisible, setIsTooltipVisible] = useState(!1), { isMobile: isMobile2 } = useLayout(), api = useStorybookApi(); 23661 return isMobile2 ? react_default.createElement(MenuButtonGroup, null, react_default.createElement( 23662 SidebarButton, 23663 { 23664 padding: "small", 23665 variant: "ghost", 23666 ariaLabel: "About Storybook", 23667 highlighted: !!isHighlighted, 23668 onClick: (e2) => { 23669 onClick?.(e2), e2.preventDefault(); 23670 }, 23671 isMobile: !0, 23672 asChild: !0 23673 }, 23674 react_default.createElement("a", { href: "./?path=/settings/about", rel: "canonical" }, react_default.createElement(CogIcon, null)) 23675 ), react_default.createElement( 23676 SidebarButton, 23677 { 23678 padding: "small", 23679 variant: "ghost", 23680 ariaLabel: "Close menu", 23681 highlighted: !1, 23682 onClick: () => api.setMobileNavigation(!1), 23683 isMobile: !0 23684 }, 23685 react_default.createElement(CloseIcon, null) 23686 )) : react_default.createElement( 23687 PopoverProvider, 23688 { 23689 ariaLabel: "Storybook menu", 23690 placement: "bottom-start", 23691 padding: 0, 23692 popover: ({ onHide }) => react_default.createElement(SidebarMenuList, { onHide, menu }), 23693 onVisibleChange: setIsTooltipVisible 23694 }, 23695 react_default.createElement( 23696 SidebarToggleButton, 23697 { 23698 ariaLabel: "Settings", 23699 pressed: isTooltipVisible, 23700 highlighted: !!isHighlighted, 23701 padding: "small", 23702 variant: "ghost", 23703 size: "medium", 23704 isMobile: !1 23705 }, 23706 react_default.createElement(CogIcon, null) 23707 ) 23708 ); 23709}; 23710 23711// src/manager/components/sidebar/Heading.tsx 23712var BrandArea = styled.div(({ theme }) => ({ 23713 fontSize: theme.typography.size.s2, 23714 fontWeight: theme.typography.weight.bold, 23715 color: theme.color.defaultText, 23716 marginRight: 20, 23717 display: "flex", 23718 width: "100%", 23719 alignItems: "center", 23720 minHeight: 22, 23721 "& > * > *": { 23722 maxWidth: "100%" 23723 }, 23724 "& > *": { 23725 maxWidth: "100%", 23726 height: "auto", 23727 display: "block", 23728 flex: "1 1 auto" 23729 } 23730})), HeadingWrapper = styled.div({ 23731 display: "flex", 23732 alignItems: "center", 23733 justifyContent: "space-between", 23734 position: "relative", 23735 minHeight: 42, 23736 paddingLeft: 8 23737}), SkipToCanvasLink = styled(Button)(({ theme }) => ({ 23738 display: "none", 23739 "@media (min-width: 600px)": { 23740 display: "block", 23741 position: "absolute", 23742 fontSize: theme.typography.size.s1, 23743 border: 0, 23744 width: 1, 23745 height: 1, 23746 padding: 0, 23747 margin: -1, 23748 overflow: "hidden", 23749 clip: "rect(0, 0, 0, 0)", 23750 whiteSpace: "nowrap", 23751 wordWrap: "normal", 23752 opacity: 0, 23753 transition: "opacity 150ms ease-out", 23754 "&:focus": { 23755 width: "100%", 23756 height: "inherit", 23757 padding: "10px 15px", 23758 margin: 0, 23759 clip: "unset", 23760 overflow: "unset", 23761 opacity: 1, 23762 zIndex: 3 23763 } 23764 } 23765})), Heading2 = ({ 23766 menuHighlighted = !1, 23767 menu, 23768 skipLinkHref, 23769 isLoading, 23770 onMenuClick, 23771 ...props 23772}) => react_default.createElement(HeadingWrapper, { ...props }, skipLinkHref && react_default.createElement(SkipToCanvasLink, { ariaLabel: !1, asChild: !0 }, react_default.createElement("a", { href: skipLinkHref, tabIndex: 0 }, "Skip to content")), react_default.createElement(BrandArea, null, react_default.createElement(Brand, null)), react_default.createElement(SidebarMenu, { menu, isHighlighted: menuHighlighted, onClick: onMenuClick })); 23773 23774// src/manager/components/sidebar/ReviewWidget.tsx 23775init_react(); 23776var HEADING_ID = "storybook-review-widget-heading", Region2 = styled.section({ 23777 width: "100%" 23778}), HeaderContent = styled(ActionList.Text)({ 23779 display: "flex", 23780 flexDirection: "row", 23781 justifyContent: "flex-start", 23782 alignItems: "center", 23783 gap: 6, 23784 // Reserve room for the dismiss button, which is positioned in the top-right 23785 // corner so it comes last in the tab order (after the review action). 23786 paddingRight: 24 23787}), HeaderTitle = styled.h2(({ theme }) => ({ 23788 margin: 0, 23789 color: theme.color.defaultText, 23790 fontWeight: theme.typography.weight.bold, 23791 fontSize: theme.typography.size.s1, 23792 lineHeight: `${theme.typography.size.s3}px` 23793})), AgenticIcon = styled(WandIcon)(({ theme }) => ({ 23794 color: theme.fgColor.agentic 23795})), DismissButton = styled(ActionList.Button)({ 23796 position: "absolute", 23797 top: 4, 23798 right: 4, 23799 zIndex: 1 23800}), DismissIcon = styled(CloseAltIcon)({ 23801 padding: 1 23802}), useActiveReviewStoryCount = () => { 23803 let { review } = useReviewContext(); 23804 return useMemo(() => review ? collectReviewStoryIds(review).size : 0, [review]); 23805}, useActiveReviewTitle = () => { 23806 let { review } = useReviewContext(); 23807 return review?.title ?? null; 23808}, ReviewWidget = () => { 23809 let api = useStorybookApi(), { openSummary, dismiss } = useReviewContext(), storyCount = useActiveReviewStoryCount(), reviewTitle = useActiveReviewTitle(), regionRef = useRef(null), { landmarkProps } = useLandmark( 23810 { role: "region", "aria-labelledby": HEADING_ID }, 23811 regionRef 23812 ); 23813 if (!api.getIsNavShown() || storyCount === 0) 23814 return null; 23815 let onOpen = () => { 23816 openSummary(); 23817 }, onDismiss = (event) => { 23818 event.stopPropagation(), dismiss(); 23819 }, storyLabel = storyCount === 1 ? "story" : "stories"; 23820 return react_default.createElement(Region2, { ref: regionRef, ...landmarkProps }, react_default.createElement(Card, { color: "agentic", outlineAnimation: "spin", id: "storybook-review-widget" }, react_default.createElement(ActionList, { as: "div" }, react_default.createElement(ActionList.Item, { as: "div" }, react_default.createElement(HeaderContent, null, react_default.createElement(AgenticIcon, { "aria-hidden": !0 }), react_default.createElement(HeaderTitle, { id: HEADING_ID }, "Quick review")))), react_default.createElement(ActionList, { as: "div" }, react_default.createElement(ActionList.Item, { as: "div" }, react_default.createElement( 23821 ActionList.Action, 23822 { 23823 ariaLabel: reviewTitle ? `Review ${storyCount} ${storyLabel}: ${reviewTitle}` : `Review ${storyCount} ${storyLabel}`, 23824 disableAllTooltips: !0, 23825 appearance: "agentic", 23826 onClick: onOpen 23827 }, 23828 react_default.createElement(ActionList.Text, null, react_default.createElement("strong", null, "Review ", storyCount, " ", storyLabel), reviewTitle ? react_default.createElement("small", null, reviewTitle) : null) 23829 ))), react_default.createElement(DismissButton, { appearance: "agentic", ariaLabel: "Dismiss review", onClick: onDismiss }, react_default.createElement(DismissIcon, null)))); 23830}, ReviewWidget_default = ReviewWidget; 23831 23832// src/manager/components/sidebar/Search.tsx 23833init_react(); 23834 23835// ../../node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js 23836function _objectWithoutPropertiesLoose2(r4, e2) { 23837 if (r4 == null) return {}; 23838 var t2 = {}; 23839 for (var n3 in r4) if ({}.hasOwnProperty.call(r4, n3)) { 23840 if (e2.indexOf(n3) !== -1) continue; 23841 t2[n3] = r4[n3]; 23842 } 23843 return t2; 23844} 23845 23846// ../../node_modules/downshift/dist/downshift.esm.js 23847var import_prop_types3 = __toESM(require_prop_types()); 23848init_react(); 23849var import_react_is = __toESM(require_react_is()); 23850 23851// ../../node_modules/compute-scroll-into-view/dist/index.js 23852var t = (t2) => typeof t2 == "object" && t2 != null && t2.nodeType === 1, e = (t2, e2) => (!e2 || t2 !== "hidden") && t2 !== "visible" && t2 !== "clip", n2 = (t2, n3) => { 23853 if (t2.clientHeight < t2.scrollHeight || t2.clientWidth < t2.scrollWidth) { 23854 let o3 = getComputedStyle(t2, null); 23855 return e(o3.overflowY, n3) || e(o3.overflowX, n3) || ((t3) => { 23856 let e2 = ((t4) => { 23857 if (!t4.ownerDocument || !t4.ownerDocument.defaultView) return null; 23858 try { 23859 return t4.ownerDocument.defaultView.frameElement; 23860 } catch { 23861 return null; 23862 } 23863 })(t3); 23864 return !!e2 && (e2.clientHeight < t3.scrollHeight || e2.clientWidth < t3.scrollWidth); 23865 })(t2); 23866 } 23867 return !1; 23868}, o2 = (t2, e2, n3, o3, l3, r4, i2, s2) => r4 < t2 && i2 > e2 || r4 > t2 && i2 < e2 ? 0 : r4 <= t2 && s2 <= n3 || i2 >= e2 && s2 >= n3 ? r4 - t2 - o3 : i2 > e2 && s2 < n3 || r4 < t2 && s2 > n3 ? i2 - e2 + l3 : 0, l2 = (t2) => { 23869 let e2 = t2.parentElement; 23870 return e2 ?? (t2.getRootNode().host || null); 23871}, r3 = (e2, r4) => { 23872 var i2, s2, d2, h2; 23873 if (typeof document > "u") return []; 23874 let { scrollMode: c2, block: f2, inline: u2, boundary: a2, skipOverflowHiddenElements: g2 } = r4, p2 = typeof a2 == "function" ? a2 : (t2) => t2 !== a2; 23875 if (!t(e2)) throw new TypeError("Invalid target"); 23876 let m2 = document.scrollingElement || document.documentElement, w2 = [], W2 = e2; 23877 for (; t(W2) && p2(W2); ) { 23878 if (W2 = l2(W2), W2 === m2) { 23879 w2.push(W2); 23880 break; 23881 } 23882 W2 != null && W2 === document.body && n2(W2) && !n2(document.documentElement) || W2 != null && n2(W2, g2) && w2.push(W2); 23883 } 23884 let b2 = (s2 = (i2 = window.visualViewport) == null ? void 0 : i2.width) != null ? s2 : innerWidth, H7 = (h2 = (d2 = window.visualViewport) == null ? void 0 : d2.height) != null ? h2 : innerHeight, { scrollX: y2, scrollY: M2 } = window, { height: v2, width: E2, top: x2, right: C2, bottom: I2, left: R2 } = e2.getBoundingClientRect(), { top: T3, right: B2, bottom: F2, left: V } = ((t2) => { 23885 let e3 = window.getComputedStyle(t2); 23886 return { top: parseFloat(e3.scrollMarginTop) || 0, right: parseFloat(e3.scrollMarginRight) || 0, bottom: parseFloat(e3.scrollMarginBottom) || 0, left: parseFloat(e3.scrollMarginLeft) || 0 }; 23887 })(e2), k2 = f2 === "start" || f2 === "nearest" ? x2 - T3 : f2 === "end" ? I2 + F2 : x2 + v2 / 2 - T3 + F2, D2 = u2 === "center" ? R2 + E2 / 2 - V + B2 : u2 === "end" ? C2 + B2 : R2 - V, L3 = []; 23888 for (let t2 = 0; t2 < w2.length; t2++) { 23889 let e3 = w2[t2], { height: l3, width: r5, top: i3, right: s3, bottom: d3, left: h3 } = e3.getBoundingClientRect(); 23890 if (c2 === "if-needed" && x2 >= 0 && R2 >= 0 && I2 <= H7 && C2 <= b2 && (e3 === m2 && !n2(e3) || x2 >= i3 && I2 <= d3 && R2 >= h3 && C2 <= s3)) return L3; 23891 let a3 = getComputedStyle(e3), g3 = parseInt(a3.borderLeftWidth, 10), p3 = parseInt(a3.borderTopWidth, 10), W3 = parseInt(a3.borderRightWidth, 10), T4 = parseInt(a3.borderBottomWidth, 10), B3 = 0, F3 = 0, V2 = "offsetWidth" in e3 ? e3.offsetWidth - e3.clientWidth - g3 - W3 : 0, S2 = "offsetHeight" in e3 ? e3.offsetHeight - e3.clientHeight - p3 - T4 : 0, X = "offsetWidth" in e3 ? e3.offsetWidth === 0 ? 0 : r5 / e3.offsetWidth : 0, Y2 = "offsetHeight" in e3 ? e3.offsetHeight === 0 ? 0 : l3 / e3.offsetHeight : 0; 23892 if (m2 === e3) B3 = f2 === "start" ? k2 : f2 === "end" ? k2 - H7 : f2 === "nearest" ? o2(M2, M2 + H7, H7, p3, T4, M2 + k2, M2 + k2 + v2, v2) : k2 - H7 / 2, F3 = u2 === "start" ? D2 : u2 === "center" ? D2 - b2 / 2 : u2 === "end" ? D2 - b2 : o2(y2, y2 + b2, b2, g3, W3, y2 + D2, y2 + D2 + E2, E2), B3 = Math.max(0, B3 + M2), F3 = Math.max(0, F3 + y2); 23893 else { 23894 B3 = f2 === "start" ? k2 - i3 - p3 : f2 === "end" ? k2 - d3 + T4 + S2 : f2 === "nearest" ? o2(i3, d3, l3, p3, T4 + S2, k2, k2 + v2, v2) : k2 - (i3 + l3 / 2) + S2 / 2, F3 = u2 === "start" ? D2 - h3 - g3 : u2 === "center" ? D2 - (h3 + r5 / 2) + V2 / 2 : u2 === "end" ? D2 - s3 + W3 + V2 : o2(h3, s3, r5, g3, W3 + V2, D2, D2 + E2, E2); 23895 let { scrollLeft: t3, scrollTop: n3 } = e3; 23896 B3 = Y2 === 0 ? 0 : Math.max(0, Math.min(n3 + B3 / Y2, e3.scrollHeight - l3 / Y2 + S2)), F3 = X === 0 ? 0 : Math.max(0, Math.min(t3 + F3 / X, e3.scrollWidth - r5 / X + V2)), k2 += n3 - B3, D2 += t3 - F3; 23897 } 23898 L3.push({ el: e3, top: B3, left: F3 }); 23899 } 23900 return L3; 23901}; 23902 23903// ../../node_modules/downshift/dist/downshift.esm.js 23904var idCounter = 0; 23905function cbToCb(cb) { 23906 return typeof cb == "function" ? cb : noop5; 23907} 23908function noop5() { 23909} 23910function scrollIntoView2(node, menuNode) { 23911 if (node) { 23912 var actions = r3(node, { 23913 boundary: menuNode, 23914 block: "nearest", 23915 scrollMode: "if-needed" 23916 }); 23917 actions.forEach(function(_ref) { 23918 var el = _ref.el, top = _ref.top, left = _ref.left; 23919 el.scrollTop = top, el.scrollLeft = left; 23920 }); 23921 } 23922} 23923function isOrContainsNode(parent, child, environment) { 23924 var result = parent === child || child instanceof environment.Node && parent.contains && parent.contains(child); 23925 return result; 23926} 23927function debounce4(fn, time) { 23928 var timeoutId; 23929 function cancel() { 23930 timeoutId && clearTimeout(timeoutId); 23931 } 23932 function wrapper() { 23933 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) 23934 args[_key] = arguments[_key]; 23935 cancel(), timeoutId = setTimeout(function() { 23936 timeoutId = null, fn.apply(void 0, args); 23937 }, time); 23938 } 23939 return wrapper.cancel = cancel, wrapper; 23940} 23941function callAllEventHandlers() { 23942 for (var _len2 = arguments.length, fns = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) 23943 fns[_key2] = arguments[_key2]; 23944 return function(event) { 23945 for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) 23946 args[_key3 - 1] = arguments[_key3]; 23947 return fns.some(function(fn) { 23948 return fn && fn.apply(void 0, [event].concat(args)), event.preventDownshiftDefault || event.hasOwnProperty("nativeEvent") && event.nativeEvent.preventDownshiftDefault; 23949 }); 23950 }; 23951} 23952function handleRefs() { 23953 for (var _len4 = arguments.length, refs = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) 23954 refs[_key4] = arguments[_key4]; 23955 return function(node) { 23956 refs.forEach(function(ref) { 23957 typeof ref == "function" ? ref(node) : ref && (ref.current = node); 23958 }); 23959 }; 23960} 23961function generateId() { 23962 return String(idCounter++); 23963} 23964function getA11yStatusMessage(_ref2) { 23965 var isOpen = _ref2.isOpen, resultCount = _ref2.resultCount, previousResultCount = _ref2.previousResultCount; 23966 return isOpen ? resultCount ? resultCount !== previousResultCount ? resultCount + " result" + (resultCount === 1 ? " is" : "s are") + " available, use up and down arrow keys to navigate. Press Enter key to select." : "" : "No results are available." : ""; 23967} 23968function unwrapArray(arg, defaultValue) { 23969 return arg = Array.isArray(arg) ? ( 23970 /* istanbul ignore next (preact) */ 23971 arg[0] 23972 ) : arg, !arg && defaultValue ? defaultValue : arg; 23973} 23974function isDOMElement(element) { 23975 return typeof element.type == "string"; 23976} 23977function getElementProps(element) { 23978 return element.props; 23979} 23980var stateKeys = ["highlightedIndex", "inputValue", "isOpen", "selectedItem", "type"]; 23981function pickState(state) { 23982 state === void 0 && (state = {}); 23983 var result = {}; 23984 return stateKeys.forEach(function(k2) { 23985 state.hasOwnProperty(k2) && (result[k2] = state[k2]); 23986 }), result; 23987} 23988function getState2(state, props) { 23989 return !state || !props ? state : Object.keys(state).reduce(function(prevState, key) { 23990 return prevState[key] = isControlledProp(props, key) ? props[key] : state[key], prevState; 23991 }, {}); 23992} 23993function isControlledProp(props, key) { 23994 return props[key] !== void 0; 23995} 23996function normalizeArrowKey(event) { 23997 var key = event.key, keyCode = event.keyCode; 23998 return keyCode >= 37 && keyCode <= 40 && key.indexOf("Arrow") !== 0 ? "Arrow" + key : key; 23999} 24000function getHighlightedIndex(start, offset2, items, isItemDisabled2, circular) { 24001 circular === void 0 && (circular = !1); 24002 var count = items.length; 24003 if (count === 0) 24004 return -1; 24005 var itemsLastIndex = count - 1; 24006 (typeof start != "number" || start < 0 || start > itemsLastIndex) && (start = offset2 > 0 ? -1 : itemsLastIndex + 1); 24007 var current = start + offset2; 24008 current < 0 ? current = circular ? itemsLastIndex : 0 : current > itemsLastIndex && (current = circular ? 0 : itemsLastIndex); 24009 var highlightedIndex = getNonDisabledIndex(current, offset2 < 0, items, isItemDisabled2, circular); 24010 return highlightedIndex === -1 ? start >= count ? -1 : start : highlightedIndex; 24011} 24012function getNonDisabledIndex(start, backwards, items, isItemDisabled2, circular) { 24013 circular === void 0 && (circular = !1); 24014 var count = items.length; 24015 if (backwards) { 24016 for (var index = start; index >= 0; index--) 24017 if (!isItemDisabled2(items[index], index)) 24018 return index; 24019 } else 24020 for (var _index = start; _index < count; _index++) 24021 if (!isItemDisabled2(items[_index], _index)) 24022 return _index; 24023 return circular ? getNonDisabledIndex(backwards ? count - 1 : 0, backwards, items, isItemDisabled2) : -1; 24024} 24025function targetWithinDownshift(target, downshiftElements, environment, checkActiveElement) { 24026 return checkActiveElement === void 0 && (checkActiveElement = !0), environment && downshiftElements.some(function(contextNode) { 24027 return contextNode && (isOrContainsNode(contextNode, target, environment) || checkActiveElement && isOrContainsNode(contextNode, environment.document.activeElement, environment)); 24028 }); 24029} 24030var cleanupStatus = debounce4(function(documentProp) { 24031 getStatusDiv(documentProp).textContent = ""; 24032}, 500); 24033function getStatusDiv(documentProp) { 24034 var statusDiv = documentProp.getElementById("a11y-status-message"); 24035 return statusDiv || (statusDiv = documentProp.createElement("div"), statusDiv.setAttribute("id", "a11y-status-message"), statusDiv.setAttribute("role", "status"), statusDiv.setAttribute("aria-live", "polite"), statusDiv.setAttribute("aria-relevant", "additions text"), Object.assign(statusDiv.style, { 24036 border: "0", 24037 clip: "rect(0 0 0 0)", 24038 height: "1px", 24039 margin: "-1px", 24040 overflow: "hidden", 24041 padding: "0", 24042 position: "absolute", 24043 width: "1px" 24044 }), documentProp.body.appendChild(statusDiv), statusDiv); 24045} 24046function setStatus(status, documentProp) { 24047 if (!(!status || !documentProp)) { 24048 var div = getStatusDiv(documentProp); 24049 div.textContent = status, cleanupStatus(documentProp); 24050 } 24051} 24052function cleanupStatusDiv(documentProp) { 24053 var statusDiv = documentProp?.getElementById("a11y-status-message"); 24054 statusDiv && statusDiv.remove(); 24055} 24056var unknown = 0, mouseUp = 1, itemMouseEnter = 2, keyDownArrowUp = 3, keyDownArrowDown = 4, keyDownEscape = 5, keyDownEnter = 6, keyDownHome = 7, keyDownEnd = 8, clickItem = 9, blurInput = 10, changeInput = 11, keyDownSpaceButton = 12, clickButton = 13, blurButton = 14, controlledPropUpdatedSelectedItem = 15, touchEnd = 16, stateChangeTypes$3 = Object.freeze({ 24057 __proto__: null, 24058 blurButton, 24059 blurInput, 24060 changeInput, 24061 clickButton, 24062 clickItem, 24063 controlledPropUpdatedSelectedItem, 24064 itemMouseEnter, 24065 keyDownArrowDown, 24066 keyDownArrowUp, 24067 keyDownEnd, 24068 keyDownEnter, 24069 keyDownEscape, 24070 keyDownHome, 24071 keyDownSpaceButton, 24072 mouseUp, 24073 touchEnd, 24074 unknown 24075}), _excluded$3 = ["refKey", "ref"], _excluded2$3 = ["onClick", "onPress", "onKeyDown", "onKeyUp", "onBlur"], _excluded3$2 = ["onKeyDown", "onBlur", "onChange", "onInput", "onChangeText"], _excluded4$2 = ["refKey", "ref"], _excluded5 = ["onMouseMove", "onMouseDown", "onClick", "onPress", "index", "item"], Downshift = (function() { 24076 var Downshift2 = (function(_Component) { 24077 function Downshift3(_props) { 24078 var _this; 24079 _this = _Component.call(this, _props) || this, _this.id = _this.props.id || "downshift-" + generateId(), _this.menuId = _this.props.menuId || _this.id + "-menu", _this.labelId = _this.props.labelId || _this.id + "-label", _this.inputId = _this.props.inputId || _this.id + "-input", _this.getItemId = _this.props.getItemId || function(index) { 24080 return _this.id + "-item-" + index; 24081 }, _this.items = [], _this.itemCount = null, _this.previousResultCount = 0, _this.timeoutIds = [], _this.internalSetTimeout = function(fn, time) { 24082 var id = setTimeout(function() { 24083 _this.timeoutIds = _this.timeoutIds.filter(function(i2) { 24084 return i2 !== id; 24085 }), fn(); 24086 }, time); 24087 _this.timeoutIds.push(id); 24088 }, _this.setItemCount = function(count) { 24089 _this.itemCount = count; 24090 }, _this.unsetItemCount = function() { 24091 _this.itemCount = null; 24092 }, _this.isItemDisabled = function(_item, index) { 24093 var currentElementNode = _this.getItemNodeFromIndex(index); 24094 return currentElementNode && currentElementNode.hasAttribute("disabled"); 24095 }, _this.setHighlightedIndex = function(highlightedIndex, otherStateToSet) { 24096 highlightedIndex === void 0 && (highlightedIndex = _this.props.defaultHighlightedIndex), otherStateToSet === void 0 && (otherStateToSet = {}), otherStateToSet = pickState(otherStateToSet), _this.internalSetState(_extends({ 24097 highlightedIndex 24098 }, otherStateToSet)); 24099 }, _this.clearSelection = function(cb) { 24100 _this.internalSetState({ 24101 selectedItem: null, 24102 inputValue: "", 24103 highlightedIndex: _this.props.defaultHighlightedIndex, 24104 isOpen: _this.props.defaultIsOpen 24105 }, cb); 24106 }, _this.selectItem = function(item, otherStateToSet, cb) { 24107 otherStateToSet = pickState(otherStateToSet), _this.internalSetState(_extends({ 24108 isOpen: _this.props.defaultIsOpen, 24109 highlightedIndex: _this.props.defaultHighlightedIndex, 24110 selectedItem: item, 24111 inputValue: _this.props.itemToString(item) 24112 }, otherStateToSet), cb); 24113 }, _this.selectItemAtIndex = function(itemIndex, otherStateToSet, cb) { 24114 var item = _this.items[itemIndex]; 24115 item != null && _this.selectItem(item, otherStateToSet, cb); 24116 }, _this.selectHighlightedItem = function(otherStateToSet, cb) { 24117 return _this.selectItemAtIndex(_this.getState().highlightedIndex, otherStateToSet, cb); 24118 }, _this.internalSetState = function(stateToSet, cb) { 24119 var isItemSelected, onChangeArg, onStateChangeArg = {}, isStateToSetFunction = typeof stateToSet == "function"; 24120 return !isStateToSetFunction && stateToSet.hasOwnProperty("inputValue") && _this.props.onInputValueChange(stateToSet.inputValue, _extends({}, _this.getStateAndHelpers(), stateToSet)), _this.setState(function(state) { 24121 var _newStateToSet; 24122 state = _this.getState(state); 24123 var newStateToSet = isStateToSetFunction ? stateToSet(state) : stateToSet; 24124 newStateToSet = _this.props.stateReducer(state, newStateToSet), isItemSelected = newStateToSet.hasOwnProperty("selectedItem"); 24125 var nextState = {}; 24126 return isItemSelected && newStateToSet.selectedItem !== state.selectedItem && (onChangeArg = newStateToSet.selectedItem), (_newStateToSet = newStateToSet).type || (_newStateToSet.type = unknown), Object.keys(newStateToSet).forEach(function(key) { 24127 state[key] !== newStateToSet[key] && (onStateChangeArg[key] = newStateToSet[key]), key !== "type" && (newStateToSet[key], isControlledProp(_this.props, key) || (nextState[key] = newStateToSet[key])); 24128 }), isStateToSetFunction && newStateToSet.hasOwnProperty("inputValue") && _this.props.onInputValueChange(newStateToSet.inputValue, _extends({}, _this.getStateAndHelpers(), newStateToSet)), nextState; 24129 }, function() { 24130 cbToCb(cb)(); 24131 var hasMoreStateThanType = Object.keys(onStateChangeArg).length > 1; 24132 hasMoreStateThanType && _this.props.onStateChange(onStateChangeArg, _this.getStateAndHelpers()), isItemSelected && _this.props.onSelect(stateToSet.selectedItem, _this.getStateAndHelpers()), onChangeArg !== void 0 && _this.props.onChange(onChangeArg, _this.getStateAndHelpers()), _this.props.onUserAction(onStateChangeArg, _this.getStateAndHelpers()); 24133 }); 24134 }, _this.rootRef = function(node) { 24135 return _this._rootNode = node; 24136 }, _this.getRootProps = function(_temp, _temp2) { 24137 var _extends22, _ref = _temp === void 0 ? {} : _temp, _ref$refKey = _ref.refKey, refKey = _ref$refKey === void 0 ? "ref" : _ref$refKey, ref = _ref.ref, rest2 = _objectWithoutPropertiesLoose2(_ref, _excluded$3), _ref2 = _temp2 === void 0 ? {} : _temp2, _ref2$suppressRefErro = _ref2.suppressRefError, suppressRefError = _ref2$suppressRefErro === void 0 ? !1 : _ref2$suppressRefErro; 24138 _this.getRootProps.called = !0, _this.getRootProps.refKey = refKey, _this.getRootProps.suppressRefError = suppressRefError; 24139 var _this$getState = _this.getState(), isOpen = _this$getState.isOpen; 24140 return _extends((_extends22 = {}, _extends22[refKey] = handleRefs(ref, _this.rootRef), _extends22.role = "combobox", _extends22["aria-expanded"] = isOpen, _extends22["aria-haspopup"] = "listbox", _extends22["aria-owns"] = isOpen ? _this.menuId : void 0, _extends22["aria-labelledby"] = _this.labelId, _extends22), rest2); 24141 }, _this.keyDownHandlers = { 24142 ArrowDown: function(event) { 24143 var _this2 = this; 24144 if (event.preventDefault(), this.getState().isOpen) { 24145 var amount = event.shiftKey ? 5 : 1; 24146 this.moveHighlightedIndex(amount, { 24147 type: keyDownArrowDown 24148 }); 24149 } else 24150 this.internalSetState({ 24151 isOpen: !0, 24152 type: keyDownArrowDown 24153 }, function() { 24154 var itemCount = _this2.getItemCount(); 24155 if (itemCount > 0) { 24156 var _this2$getState = _this2.getState(), highlightedIndex = _this2$getState.highlightedIndex, nextHighlightedIndex = getHighlightedIndex(highlightedIndex, 1, { 24157 length: itemCount 24158 }, _this2.isItemDisabled, !0); 24159 _this2.setHighlightedIndex(nextHighlightedIndex, { 24160 type: keyDownArrowDown 24161 }); 24162 } 24163 }); 24164 }, 24165 ArrowUp: function(event) { 24166 var _this3 = this; 24167 if (event.preventDefault(), this.getState().isOpen) { 24168 var amount = event.shiftKey ? -5 : -1; 24169 this.moveHighlightedIndex(amount, { 24170 type: keyDownArrowUp 24171 }); 24172 } else 24173 this.internalSetState({ 24174 isOpen: !0, 24175 type: keyDownArrowUp 24176 }, function() { 24177 var itemCount = _this3.getItemCount(); 24178 if (itemCount > 0) { 24179 var _this3$getState = _this3.getState(), highlightedIndex = _this3$getState.highlightedIndex, nextHighlightedIndex = getHighlightedIndex(highlightedIndex, -1, { 24180 length: itemCount 24181 }, _this3.isItemDisabled, !0); 24182 _this3.setHighlightedIndex(nextHighlightedIndex, { 24183 type: keyDownArrowUp 24184 }); 24185 } 24186 }); 24187 }, 24188 Enter: function(event) { 24189 if (event.which !== 229) { 24190 var _this$getState2 = this.getState(), isOpen = _this$getState2.isOpen, highlightedIndex = _this$getState2.highlightedIndex; 24191 if (isOpen && highlightedIndex != null) { 24192 event.preventDefault(); 24193 var item = this.items[highlightedIndex], itemNode = this.getItemNodeFromIndex(highlightedIndex); 24194 if (item == null || itemNode && itemNode.hasAttribute("disabled")) 24195 return; 24196 this.selectHighlightedItem({ 24197 type: keyDownEnter 24198 }); 24199 } 24200 } 24201 }, 24202 Escape: function(event) { 24203 event.preventDefault(), this.reset(_extends({ 24204 type: keyDownEscape 24205 }, !this.state.isOpen && { 24206 selectedItem: null, 24207 inputValue: "" 24208 })); 24209 } 24210 }, _this.buttonKeyDownHandlers = _extends({}, _this.keyDownHandlers, { 24211 " ": function(event) { 24212 event.preventDefault(), this.toggleMenu({ 24213 type: keyDownSpaceButton 24214 }); 24215 } 24216 }), _this.inputKeyDownHandlers = _extends({}, _this.keyDownHandlers, { 24217 Home: function(event) { 24218 var _this$getState3 = this.getState(), isOpen = _this$getState3.isOpen; 24219 if (isOpen) { 24220 event.preventDefault(); 24221 var itemCount = this.getItemCount(); 24222 if (!(itemCount <= 0 || !isOpen)) { 24223 var newHighlightedIndex = getNonDisabledIndex(0, !1, { 24224 length: itemCount 24225 }, this.isItemDisabled); 24226 this.setHighlightedIndex(newHighlightedIndex, { 24227 type: keyDownHome 24228 }); 24229 } 24230 } 24231 }, 24232 End: function(event) { 24233 var _this$getState4 = this.getState(), isOpen = _this$getState4.isOpen; 24234 if (isOpen) { 24235 event.preventDefault(); 24236 var itemCount = this.getItemCount(); 24237 if (!(itemCount <= 0 || !isOpen)) { 24238 var newHighlightedIndex = getNonDisabledIndex(itemCount - 1, !0, { 24239 length: itemCount 24240 }, this.isItemDisabled); 24241 this.setHighlightedIndex(newHighlightedIndex, { 24242 type: keyDownEnd 24243 }); 24244 } 24245 } 24246 } 24247 }), _this.getToggleButtonProps = function(_temp3) { 24248 var _ref3 = _temp3 === void 0 ? {} : _temp3, onClick = _ref3.onClick; 24249 _ref3.onPress; 24250 var onKeyDown = _ref3.onKeyDown, onKeyUp = _ref3.onKeyUp, onBlur = _ref3.onBlur, rest2 = _objectWithoutPropertiesLoose2(_ref3, _excluded2$3), _this$getState5 = _this.getState(), isOpen = _this$getState5.isOpen, enabledEventHandlers = { 24251 onClick: callAllEventHandlers(onClick, _this.buttonHandleClick), 24252 onKeyDown: callAllEventHandlers(onKeyDown, _this.buttonHandleKeyDown), 24253 onKeyUp: callAllEventHandlers(onKeyUp, _this.buttonHandleKeyUp), 24254 onBlur: callAllEventHandlers(onBlur, _this.buttonHandleBlur) 24255 }, eventHandlers = rest2.disabled ? {} : enabledEventHandlers; 24256 return _extends({ 24257 type: "button", 24258 role: "button", 24259 "aria-label": isOpen ? "close menu" : "open menu", 24260 "aria-haspopup": !0, 24261 "data-toggle": !0 24262 }, eventHandlers, rest2); 24263 }, _this.buttonHandleKeyUp = function(event) { 24264 event.preventDefault(); 24265 }, _this.buttonHandleKeyDown = function(event) { 24266 var key = normalizeArrowKey(event); 24267 _this.buttonKeyDownHandlers[key] && _this.buttonKeyDownHandlers[key].call(_this, event); 24268 }, _this.buttonHandleClick = function(event) { 24269 if (event.preventDefault(), _this.props.environment) { 24270 var _this$props$environme = _this.props.environment.document, body = _this$props$environme.body, activeElement = _this$props$environme.activeElement; 24271 body && body === activeElement && event.target.focus(); 24272 } 24273 _this.internalSetTimeout(function() { 24274 return _this.toggleMenu({ 24275 type: clickButton 24276 }); 24277 }); 24278 }, _this.buttonHandleBlur = function(event) { 24279 var blurTarget = event.target; 24280 _this.internalSetTimeout(function() { 24281 if (!(_this.isMouseDown || !_this.props.environment)) { 24282 var activeElement = _this.props.environment.document.activeElement; 24283 (activeElement == null || activeElement.id !== _this.inputId) && activeElement !== blurTarget && _this.reset({ 24284 type: blurButton 24285 }); 24286 } 24287 }); 24288 }, _this.getLabelProps = function(props) { 24289 return _extends({ 24290 htmlFor: _this.inputId, 24291 id: _this.labelId 24292 }, props); 24293 }, _this.getInputProps = function(_temp4) { 24294 var _ref4 = _temp4 === void 0 ? {} : _temp4, onKeyDown = _ref4.onKeyDown, onBlur = _ref4.onBlur, onChange = _ref4.onChange, onInput = _ref4.onInput; 24295 _ref4.onChangeText; 24296 var rest2 = _objectWithoutPropertiesLoose2(_ref4, _excluded3$2), onChangeKey, eventHandlers = {}; 24297 onChangeKey = "onChange"; 24298 var _this$getState6 = _this.getState(), inputValue = _this$getState6.inputValue, isOpen = _this$getState6.isOpen, highlightedIndex = _this$getState6.highlightedIndex; 24299 if (!rest2.disabled) { 24300 var _eventHandlers; 24301 eventHandlers = (_eventHandlers = {}, _eventHandlers[onChangeKey] = callAllEventHandlers(onChange, onInput, _this.inputHandleChange), _eventHandlers.onKeyDown = callAllEventHandlers(onKeyDown, _this.inputHandleKeyDown), _eventHandlers.onBlur = callAllEventHandlers(onBlur, _this.inputHandleBlur), _eventHandlers); 24302 } 24303 return _extends({ 24304 "aria-autocomplete": "list", 24305 "aria-activedescendant": isOpen && typeof highlightedIndex == "number" && highlightedIndex >= 0 ? _this.getItemId(highlightedIndex) : void 0, 24306 "aria-controls": isOpen ? _this.menuId : void 0, 24307 "aria-labelledby": rest2 && rest2["aria-label"] ? void 0 : _this.labelId, 24308 // https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion 24309 // revert back since autocomplete="nope" is ignored on latest Chrome and Opera 24310 autoComplete: "off", 24311 value: inputValue, 24312 id: _this.inputId 24313 }, eventHandlers, rest2); 24314 }, _this.inputHandleKeyDown = function(event) { 24315 var key = normalizeArrowKey(event); 24316 key && _this.inputKeyDownHandlers[key] && _this.inputKeyDownHandlers[key].call(_this, event); 24317 }, _this.inputHandleChange = function(event) { 24318 _this.internalSetState({ 24319 type: changeInput, 24320 isOpen: !0, 24321 inputValue: event.target.value, 24322 highlightedIndex: _this.props.defaultHighlightedIndex 24323 }); 24324 }, _this.inputHandleBlur = function() { 24325 _this.internalSetTimeout(function() { 24326 var _activeElement$datase; 24327 if (!(_this.isMouseDown || !_this.props.environment)) { 24328 var activeElement = _this.props.environment.document.activeElement, downshiftButtonIsActive = (activeElement == null || (_activeElement$datase = activeElement.dataset) == null ? void 0 : _activeElement$datase.toggle) && _this._rootNode && _this._rootNode.contains(activeElement); 24329 downshiftButtonIsActive || _this.reset({ 24330 type: blurInput 24331 }); 24332 } 24333 }); 24334 }, _this.menuRef = function(node) { 24335 _this._menuNode = node; 24336 }, _this.getMenuProps = function(_temp5, _temp6) { 24337 var _extends3, _ref5 = _temp5 === void 0 ? {} : _temp5, _ref5$refKey = _ref5.refKey, refKey = _ref5$refKey === void 0 ? "ref" : _ref5$refKey, ref = _ref5.ref, props = _objectWithoutPropertiesLoose2(_ref5, _excluded4$2), _ref6 = _temp6 === void 0 ? {} : _temp6, _ref6$suppressRefErro = _ref6.suppressRefError, suppressRefError = _ref6$suppressRefErro === void 0 ? !1 : _ref6$suppressRefErro; 24338 return _this.getMenuProps.called = !0, _this.getMenuProps.refKey = refKey, _this.getMenuProps.suppressRefError = suppressRefError, _extends((_extends3 = {}, _extends3[refKey] = handleRefs(ref, _this.menuRef), _extends3.role = "listbox", _extends3["aria-labelledby"] = props && props["aria-label"] ? void 0 : _this.labelId, _extends3.id = _this.menuId, _extends3), props); 24339 }, _this.getItemProps = function(_temp7) { 24340 var _enabledEventHandlers, _ref7 = _temp7 === void 0 ? {} : _temp7, onMouseMove = _ref7.onMouseMove, onMouseDown = _ref7.onMouseDown, onClick = _ref7.onClick; 24341 _ref7.onPress; 24342 var index = _ref7.index, _ref7$item = _ref7.item, item = _ref7$item === void 0 ? ( 24343 /* istanbul ignore next */ 24344 void 0 24345 ) : _ref7$item, rest2 = _objectWithoutPropertiesLoose2(_ref7, _excluded5); 24346 index === void 0 ? (_this.items.push(item), index = _this.items.indexOf(item)) : _this.items[index] = item; 24347 var onSelectKey = "onClick", customClickHandler = onClick, enabledEventHandlers = (_enabledEventHandlers = { 24348 // onMouseMove is used over onMouseEnter here. onMouseMove 24349 // is only triggered on actual mouse movement while onMouseEnter 24350 // can fire on DOM changes, interrupting keyboard navigation 24351 onMouseMove: callAllEventHandlers(onMouseMove, function() { 24352 index !== _this.getState().highlightedIndex && (_this.setHighlightedIndex(index, { 24353 type: itemMouseEnter 24354 }), _this.avoidScrolling = !0, _this.internalSetTimeout(function() { 24355 return _this.avoidScrolling = !1; 24356 }, 250)); 24357 }), 24358 onMouseDown: callAllEventHandlers(onMouseDown, function(event) { 24359 event.preventDefault(); 24360 }) 24361 }, _enabledEventHandlers[onSelectKey] = callAllEventHandlers(customClickHandler, function() { 24362 _this.selectItemAtIndex(index, { 24363 type: clickItem 24364 }); 24365 }), _enabledEventHandlers), eventHandlers = rest2.disabled ? { 24366 onMouseDown: enabledEventHandlers.onMouseDown 24367 } : enabledEventHandlers; 24368 return _extends({ 24369 id: _this.getItemId(index), 24370 role: "option", 24371 "aria-selected": _this.getState().highlightedIndex === index 24372 }, eventHandlers, rest2); 24373 }, _this.clearItems = function() { 24374 _this.items = []; 24375 }, _this.reset = function(otherStateToSet, cb) { 24376 otherStateToSet === void 0 && (otherStateToSet = {}), otherStateToSet = pickState(otherStateToSet), _this.internalSetState(function(_ref8) { 24377 var selectedItem = _ref8.selectedItem; 24378 return _extends({ 24379 isOpen: _this.props.defaultIsOpen, 24380 highlightedIndex: _this.props.defaultHighlightedIndex, 24381 inputValue: _this.props.itemToString(selectedItem) 24382 }, otherStateToSet); 24383 }, cb); 24384 }, _this.toggleMenu = function(otherStateToSet, cb) { 24385 otherStateToSet === void 0 && (otherStateToSet = {}), otherStateToSet = pickState(otherStateToSet), _this.internalSetState(function(_ref9) { 24386 var isOpen = _ref9.isOpen; 24387 return _extends({ 24388 isOpen: !isOpen 24389 }, isOpen && { 24390 highlightedIndex: _this.props.defaultHighlightedIndex 24391 }, otherStateToSet); 24392 }, function() { 24393 var _this$getState7 = _this.getState(), isOpen = _this$getState7.isOpen, highlightedIndex = _this$getState7.highlightedIndex; 24394 isOpen && _this.getItemCount() > 0 && typeof highlightedIndex == "number" && _this.setHighlightedIndex(highlightedIndex, otherStateToSet), cbToCb(cb)(); 24395 }); 24396 }, _this.openMenu = function(cb) { 24397 _this.internalSetState({ 24398 isOpen: !0 24399 }, cb); 24400 }, _this.closeMenu = function(cb) { 24401 _this.internalSetState({ 24402 isOpen: !1 24403 }, cb); 24404 }, _this.updateStatus = debounce4(function() { 24405 var _this$props; 24406 if ((_this$props = _this.props) != null && (_this$props = _this$props.environment) != null && _this$props.document) { 24407 var state = _this.getState(), item = _this.items[state.highlightedIndex], resultCount = _this.getItemCount(), status = _this.props.getA11yStatusMessage(_extends({ 24408 itemToString: _this.props.itemToString, 24409 previousResultCount: _this.previousResultCount, 24410 resultCount, 24411 highlightedItem: item 24412 }, state)); 24413 _this.previousResultCount = resultCount, setStatus(status, _this.props.environment.document); 24414 } 24415 }, 200); 24416 var _this$props2 = _this.props, defaultHighlightedIndex = _this$props2.defaultHighlightedIndex, _this$props2$initialH = _this$props2.initialHighlightedIndex, _highlightedIndex = _this$props2$initialH === void 0 ? defaultHighlightedIndex : _this$props2$initialH, defaultIsOpen = _this$props2.defaultIsOpen, _this$props2$initialI = _this$props2.initialIsOpen, _isOpen = _this$props2$initialI === void 0 ? defaultIsOpen : _this$props2$initialI, _this$props2$initialI2 = _this$props2.initialInputValue, _inputValue = _this$props2$initialI2 === void 0 ? "" : _this$props2$initialI2, _this$props2$initialS = _this$props2.initialSelectedItem, _selectedItem = _this$props2$initialS === void 0 ? null : _this$props2$initialS, _state = _this.getState({ 24417 highlightedIndex: _highlightedIndex, 24418 isOpen: _isOpen, 24419 inputValue: _inputValue, 24420 selectedItem: _selectedItem 24421 }); 24422 return _state.selectedItem != null && _this.props.initialInputValue === void 0 && (_state.inputValue = _this.props.itemToString(_state.selectedItem)), _this.state = _state, _this; 24423 } 24424 _inheritsLoose(Downshift3, _Component); 24425 var _proto = Downshift3.prototype; 24426 return _proto.internalClearTimeouts = function() { 24427 this.timeoutIds.forEach(function(id) { 24428 clearTimeout(id); 24429 }), this.timeoutIds = []; 24430 }, _proto.getState = function(stateToMerge) { 24431 return stateToMerge === void 0 && (stateToMerge = this.state), getState2(stateToMerge, this.props); 24432 }, _proto.getItemCount = function() { 24433 var itemCount = this.items.length; 24434 return this.itemCount != null ? itemCount = this.itemCount : this.props.itemCount !== void 0 && (itemCount = this.props.itemCount), itemCount; 24435 }, _proto.getItemNodeFromIndex = function(index) { 24436 return this.props.environment ? this.props.environment.document.getElementById(this.getItemId(index)) : null; 24437 }, _proto.scrollHighlightedItemIntoView = function() { 24438 { 24439 var node = this.getItemNodeFromIndex(this.getState().highlightedIndex); 24440 this.props.scrollIntoView(node, this._menuNode); 24441 } 24442 }, _proto.moveHighlightedIndex = function(amount, otherStateToSet) { 24443 var itemCount = this.getItemCount(), _this$getState8 = this.getState(), highlightedIndex = _this$getState8.highlightedIndex; 24444 if (itemCount > 0) { 24445 var nextHighlightedIndex = getHighlightedIndex(highlightedIndex, amount, { 24446 length: itemCount 24447 }, this.isItemDisabled, !0); 24448 this.setHighlightedIndex(nextHighlightedIndex, otherStateToSet); 24449 } 24450 }, _proto.getStateAndHelpers = function() { 24451 var _this$getState9 = this.getState(), highlightedIndex = _this$getState9.highlightedIndex, inputValue = _this$getState9.inputValue, selectedItem = _this$getState9.selectedItem, isOpen = _this$getState9.isOpen, itemToString2 = this.props.itemToString, id = this.id, getRootProps = this.getRootProps, getToggleButtonProps = this.getToggleButtonProps, getLabelProps = this.getLabelProps, getMenuProps = this.getMenuProps, getInputProps = this.getInputProps, getItemProps = this.getItemProps, openMenu = this.openMenu, closeMenu = this.closeMenu, toggleMenu = this.toggleMenu, selectItem = this.selectItem, selectItemAtIndex = this.selectItemAtIndex, selectHighlightedItem = this.selectHighlightedItem, setHighlightedIndex = this.setHighlightedIndex, clearSelection = this.clearSelection, clearItems = this.clearItems, reset = this.reset, setItemCount = this.setItemCount, unsetItemCount = this.unsetItemCount, setState = this.internalSetState; 24452 return { 24453 // prop getters 24454 getRootProps, 24455 getToggleButtonProps, 24456 getLabelProps, 24457 getMenuProps, 24458 getInputProps, 24459 getItemProps, 24460 // actions 24461 reset, 24462 openMenu, 24463 closeMenu, 24464 toggleMenu, 24465 selectItem, 24466 selectItemAtIndex, 24467 selectHighlightedItem, 24468 setHighlightedIndex, 24469 clearSelection, 24470 clearItems, 24471 setItemCount, 24472 unsetItemCount, 24473 setState, 24474 // props 24475 itemToString: itemToString2, 24476 // derived 24477 id, 24478 // state 24479 highlightedIndex, 24480 inputValue, 24481 isOpen, 24482 selectedItem 24483 }; 24484 }, _proto.componentDidMount = function() { 24485 var _this4 = this; 24486 if (!this.props.environment) 24487 this.cleanup = function() { 24488 _this4.internalClearTimeouts(); 24489 }; 24490 else { 24491 var onMouseDown = function() { 24492 _this4.isMouseDown = !0; 24493 }, onMouseUp = function(event) { 24494 _this4.isMouseDown = !1; 24495 var contextWithinDownshift = targetWithinDownshift(event.target, [_this4._rootNode, _this4._menuNode], _this4.props.environment); 24496 !contextWithinDownshift && _this4.getState().isOpen && _this4.reset({ 24497 type: mouseUp 24498 }, function() { 24499 return _this4.props.onOuterClick(_this4.getStateAndHelpers()); 24500 }); 24501 }, onTouchStart = function() { 24502 _this4.isTouchMove = !1; 24503 }, onTouchMove = function() { 24504 _this4.isTouchMove = !0; 24505 }, onTouchEnd = function(event) { 24506 var contextWithinDownshift = targetWithinDownshift(event.target, [_this4._rootNode, _this4._menuNode], _this4.props.environment, !1); 24507 !_this4.isTouchMove && !contextWithinDownshift && _this4.getState().isOpen && _this4.reset({ 24508 type: touchEnd 24509 }, function() { 24510 return _this4.props.onOuterClick(_this4.getStateAndHelpers()); 24511 }); 24512 }, environment = this.props.environment; 24513 environment.addEventListener("mousedown", onMouseDown), environment.addEventListener("mouseup", onMouseUp), environment.addEventListener("touchstart", onTouchStart), environment.addEventListener("touchmove", onTouchMove), environment.addEventListener("touchend", onTouchEnd), this.cleanup = function() { 24514 _this4.internalClearTimeouts(), _this4.updateStatus.cancel(), environment.removeEventListener("mousedown", onMouseDown), environment.removeEventListener("mouseup", onMouseUp), environment.removeEventListener("touchstart", onTouchStart), environment.removeEventListener("touchmove", onTouchMove), environment.removeEventListener("touchend", onTouchEnd); 24515 }; 24516 } 24517 }, _proto.shouldScroll = function(prevState, prevProps) { 24518 var _ref0 = this.props.highlightedIndex === void 0 ? this.getState() : this.props, currentHighlightedIndex = _ref0.highlightedIndex, _ref1 = prevProps.highlightedIndex === void 0 ? prevState : prevProps, prevHighlightedIndex = _ref1.highlightedIndex, scrollWhenOpen = currentHighlightedIndex && this.getState().isOpen && !prevState.isOpen, scrollWhenNavigating = currentHighlightedIndex !== prevHighlightedIndex; 24519 return scrollWhenOpen || scrollWhenNavigating; 24520 }, _proto.componentDidUpdate = function(prevProps, prevState) { 24521 isControlledProp(this.props, "selectedItem") && this.props.selectedItemChanged(prevProps.selectedItem, this.props.selectedItem) && this.internalSetState({ 24522 type: controlledPropUpdatedSelectedItem, 24523 inputValue: this.props.itemToString(this.props.selectedItem) 24524 }), !this.avoidScrolling && this.shouldScroll(prevState, prevProps) && this.scrollHighlightedItemIntoView(), this.updateStatus(); 24525 }, _proto.componentWillUnmount = function() { 24526 this.cleanup(); 24527 }, _proto.render = function() { 24528 var children = unwrapArray(this.props.children, noop5); 24529 this.clearItems(), this.getRootProps.called = !1, this.getRootProps.refKey = void 0, this.getRootProps.suppressRefError = void 0, this.getMenuProps.called = !1, this.getMenuProps.refKey = void 0, this.getMenuProps.suppressRefError = void 0, this.getLabelProps.called = !1, this.getInputProps.called = !1; 24530 var element = unwrapArray(children(this.getStateAndHelpers())); 24531 if (!element) 24532 return null; 24533 if (this.getRootProps.called || this.props.suppressRefError) 24534 return element; 24535 if (isDOMElement(element)) 24536 return cloneElement(element, this.getRootProps(getElementProps(element))); 24537 }, Downshift3; 24538 })(Component); 24539 return Downshift2.defaultProps = { 24540 defaultHighlightedIndex: null, 24541 defaultIsOpen: !1, 24542 getA11yStatusMessage, 24543 itemToString: function(i2) { 24544 return i2 == null ? "" : String(i2); 24545 }, 24546 onStateChange: noop5, 24547 onInputValueChange: noop5, 24548 onUserAction: noop5, 24549 onChange: noop5, 24550 onSelect: noop5, 24551 onOuterClick: noop5, 24552 selectedItemChanged: function(prevItem, item) { 24553 return prevItem !== item; 24554 }, 24555 environment: ( 24556 /* istanbul ignore next (ssr) */ 24557 typeof window > "u" ? void 0 : window 24558 ), 24559 stateReducer: function(state, stateToSet) { 24560 return stateToSet; 24561 }, 24562 suppressRefError: !1, 24563 scrollIntoView: scrollIntoView2 24564 }, Downshift2.stateChangeTypes = stateChangeTypes$3, Downshift2; 24565})(); 24566var dropdownDefaultStateValues = { 24567 highlightedIndex: -1, 24568 isOpen: !1, 24569 selectedItem: null, 24570 inputValue: "" 24571}; 24572function callOnChangeProps(action, state, newState) { 24573 var props = action.props, type = action.type, changes = {}; 24574 Object.keys(state).forEach(function(key) { 24575 invokeOnChangeHandler(key, action, state, newState), newState[key] !== state[key] && (changes[key] = newState[key]); 24576 }), props.onStateChange && Object.keys(changes).length && props.onStateChange(_extends({ 24577 type 24578 }, changes)); 24579} 24580function invokeOnChangeHandler(key, action, state, newState) { 24581 var props = action.props, type = action.type, handler = "on" + capitalizeString(key) + "Change"; 24582 props[handler] && newState[key] !== void 0 && newState[key] !== state[key] && props[handler](_extends({ 24583 type 24584 }, newState)); 24585} 24586function stateReducer(s2, a2) { 24587 return a2.changes; 24588} 24589var updateA11yStatus = debounce4(function(status, document11) { 24590 setStatus(status, document11); 24591}, 200), useIsomorphicLayoutEffect2 = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u" ? useLayoutEffect : useEffect, useElementIds = "useId" in react_default ? function(_ref) { 24592 var id = _ref.id, labelId = _ref.labelId, menuId = _ref.menuId, getItemId = _ref.getItemId, toggleButtonId = _ref.toggleButtonId, inputId = _ref.inputId, reactId = "downshift-" + react_default.useId(); 24593 id || (id = reactId); 24594 var elementIdsRef = useRef({ 24595 labelId: labelId || id + "-label", 24596 menuId: menuId || id + "-menu", 24597 getItemId: getItemId || function(index) { 24598 return id + "-item-" + index; 24599 }, 24600 toggleButtonId: toggleButtonId || id + "-toggle-button", 24601 inputId: inputId || id + "-input" 24602 }); 24603 return elementIdsRef.current; 24604} : function(_ref2) { 24605 var _ref2$id = _ref2.id, id = _ref2$id === void 0 ? "downshift-" + generateId() : _ref2$id, labelId = _ref2.labelId, menuId = _ref2.menuId, getItemId = _ref2.getItemId, toggleButtonId = _ref2.toggleButtonId, inputId = _ref2.inputId, elementIdsRef = useRef({ 24606 labelId: labelId || id + "-label", 24607 menuId: menuId || id + "-menu", 24608 getItemId: getItemId || function(index) { 24609 return id + "-item-" + index; 24610 }, 24611 toggleButtonId: toggleButtonId || id + "-toggle-button", 24612 inputId: inputId || id + "-input" 24613 }); 24614 return elementIdsRef.current; 24615}; 24616function getItemAndIndex(itemProp, indexProp, items, errorMessage) { 24617 var item, index; 24618 if (itemProp === void 0) { 24619 if (indexProp === void 0) 24620 throw new Error(errorMessage); 24621 item = items[indexProp], index = indexProp; 24622 } else 24623 index = indexProp === void 0 ? items.indexOf(itemProp) : indexProp, item = itemProp; 24624 return [item, index]; 24625} 24626function isAcceptedCharacterKey(key) { 24627 return /^\S{1}$/.test(key); 24628} 24629function capitalizeString(string) { 24630 return "" + string.slice(0, 1).toUpperCase() + string.slice(1); 24631} 24632function useLatestRef(val) { 24633 var ref = useRef(val); 24634 return ref.current = val, ref; 24635} 24636function useEnhancedReducer(reducer, props, createInitialState, isStateEqual2) { 24637 var prevStateRef = useRef(), actionRef = useRef(), enhancedReducer = useCallback(function(state2, action2) { 24638 actionRef.current = action2, state2 = getState2(state2, action2.props); 24639 var changes = reducer(state2, action2), newState = action2.props.stateReducer(state2, _extends({}, action2, { 24640 changes 24641 })); 24642 return newState; 24643 }, [reducer]), _useReducer = useReducer(enhancedReducer, props, createInitialState), state = _useReducer[0], dispatch = _useReducer[1], propsRef = useLatestRef(props), dispatchWithProps = useCallback(function(action2) { 24644 return dispatch(_extends({ 24645 props: propsRef.current 24646 }, action2)); 24647 }, [propsRef]), action = actionRef.current; 24648 return useEffect(function() { 24649 var prevState = getState2(prevStateRef.current, action?.props), shouldCallOnChangeProps = action && prevStateRef.current && !isStateEqual2(prevState, state); 24650 shouldCallOnChangeProps && callOnChangeProps(action, prevState, state), prevStateRef.current = state; 24651 }, [state, action, isStateEqual2]), [state, dispatchWithProps]; 24652} 24653function useControlledReducer$1(reducer, props, createInitialState, isStateEqual2) { 24654 var _useEnhancedReducer = useEnhancedReducer(reducer, props, createInitialState, isStateEqual2), state = _useEnhancedReducer[0], dispatch = _useEnhancedReducer[1]; 24655 return [getState2(state, props), dispatch]; 24656} 24657var defaultProps$3 = { 24658 itemToString: function(item) { 24659 return item ? String(item) : ""; 24660 }, 24661 itemToKey: function(item) { 24662 return item; 24663 }, 24664 stateReducer, 24665 scrollIntoView: scrollIntoView2, 24666 environment: ( 24667 /* istanbul ignore next (ssr) */ 24668 typeof window > "u" ? void 0 : window 24669 ) 24670}; 24671function getDefaultValue$1(props, propKey, defaultStateValues2) { 24672 defaultStateValues2 === void 0 && (defaultStateValues2 = dropdownDefaultStateValues); 24673 var defaultValue = props["default" + capitalizeString(propKey)]; 24674 return defaultValue !== void 0 ? defaultValue : defaultStateValues2[propKey]; 24675} 24676function getInitialValue$1(props, propKey, defaultStateValues2) { 24677 defaultStateValues2 === void 0 && (defaultStateValues2 = dropdownDefaultStateValues); 24678 var value = props[propKey]; 24679 if (value !== void 0) 24680 return value; 24681 var initialValue = props["initial" + capitalizeString(propKey)]; 24682 return initialValue !== void 0 ? initialValue : getDefaultValue$1(props, propKey, defaultStateValues2); 24683} 24684function getInitialState$2(props) { 24685 var selectedItem = getInitialValue$1(props, "selectedItem"), isOpen = getInitialValue$1(props, "isOpen"), highlightedIndex = getInitialHighlightedIndex(props), inputValue = getInitialValue$1(props, "inputValue"); 24686 return { 24687 highlightedIndex: highlightedIndex < 0 && selectedItem && isOpen ? props.items.findIndex(function(item) { 24688 return props.itemToKey(item) === props.itemToKey(selectedItem); 24689 }) : highlightedIndex, 24690 isOpen, 24691 selectedItem, 24692 inputValue 24693 }; 24694} 24695function getHighlightedIndexOnOpen(props, state, offset2) { 24696 var items = props.items, initialHighlightedIndex = props.initialHighlightedIndex, defaultHighlightedIndex = props.defaultHighlightedIndex, isItemDisabled2 = props.isItemDisabled, itemToKey2 = props.itemToKey, selectedItem = state.selectedItem, highlightedIndex = state.highlightedIndex; 24697 return items.length === 0 ? -1 : initialHighlightedIndex !== void 0 && highlightedIndex === initialHighlightedIndex && !isItemDisabled2(items[initialHighlightedIndex], initialHighlightedIndex) ? initialHighlightedIndex : defaultHighlightedIndex !== void 0 && !isItemDisabled2(items[defaultHighlightedIndex], defaultHighlightedIndex) ? defaultHighlightedIndex : selectedItem ? items.findIndex(function(item) { 24698 return itemToKey2(selectedItem) === itemToKey2(item); 24699 }) : offset2 < 0 && !isItemDisabled2(items[items.length - 1], items.length - 1) ? items.length - 1 : offset2 > 0 && !isItemDisabled2(items[0], 0) ? 0 : -1; 24700} 24701function useMouseAndTouchTracker(environment, handleBlur, downshiftElementsRefs) { 24702 var mouseAndTouchTrackersRef = useRef({ 24703 isMouseDown: !1, 24704 isTouchMove: !1, 24705 isTouchEnd: !1 24706 }); 24707 return useEffect(function() { 24708 if (!environment) 24709 return noop5; 24710 var downshiftElements = downshiftElementsRefs.map(function(ref) { 24711 return ref.current; 24712 }); 24713 function onMouseDown() { 24714 mouseAndTouchTrackersRef.current.isTouchEnd = !1, mouseAndTouchTrackersRef.current.isMouseDown = !0; 24715 } 24716 function onMouseUp(event) { 24717 mouseAndTouchTrackersRef.current.isMouseDown = !1, targetWithinDownshift(event.target, downshiftElements, environment) || handleBlur(); 24718 } 24719 function onTouchStart() { 24720 mouseAndTouchTrackersRef.current.isTouchEnd = !1, mouseAndTouchTrackersRef.current.isTouchMove = !1; 24721 } 24722 function onTouchMove() { 24723 mouseAndTouchTrackersRef.current.isTouchMove = !0; 24724 } 24725 function onTouchEnd(event) { 24726 mouseAndTouchTrackersRef.current.isTouchEnd = !0, !mouseAndTouchTrackersRef.current.isTouchMove && !targetWithinDownshift(event.target, downshiftElements, environment, !1) && handleBlur(); 24727 } 24728 return environment.addEventListener("mousedown", onMouseDown), environment.addEventListener("mouseup", onMouseUp), environment.addEventListener("touchstart", onTouchStart), environment.addEventListener("touchmove", onTouchMove), environment.addEventListener("touchend", onTouchEnd), function() { 24729 environment.removeEventListener("mousedown", onMouseDown), environment.removeEventListener("mouseup", onMouseUp), environment.removeEventListener("touchstart", onTouchStart), environment.removeEventListener("touchmove", onTouchMove), environment.removeEventListener("touchend", onTouchEnd); 24730 }; 24731 }, [downshiftElementsRefs, environment, handleBlur]), mouseAndTouchTrackersRef.current; 24732} 24733var useGetterPropsCalledChecker = function() { 24734 return noop5; 24735}; 24736function useA11yMessageStatus(getA11yStatusMessage2, options2, dependencyArray, environment) { 24737 environment === void 0 && (environment = {}); 24738 var document11 = environment.document, isInitialMount = useIsInitialMount(); 24739 useEffect(function() { 24740 if (!(!getA11yStatusMessage2 || isInitialMount || !document11)) { 24741 var status = getA11yStatusMessage2(options2); 24742 updateA11yStatus(status, document11); 24743 } 24744 }, dependencyArray), useEffect(function() { 24745 return function() { 24746 updateA11yStatus.cancel(), cleanupStatusDiv(document11); 24747 }; 24748 }, [document11]); 24749} 24750function useScrollIntoView(_ref3) { 24751 var highlightedIndex = _ref3.highlightedIndex, isOpen = _ref3.isOpen, itemRefs = _ref3.itemRefs, getItemNodeFromIndex = _ref3.getItemNodeFromIndex, menuElement = _ref3.menuElement, scrollIntoViewProp = _ref3.scrollIntoView, shouldScrollRef = useRef(!0); 24752 return useIsomorphicLayoutEffect2(function() { 24753 highlightedIndex < 0 || !isOpen || !Object.keys(itemRefs.current).length || (shouldScrollRef.current === !1 ? shouldScrollRef.current = !0 : scrollIntoViewProp(getItemNodeFromIndex(highlightedIndex), menuElement)); 24754 }, [highlightedIndex]), shouldScrollRef; 24755} 24756var useControlPropsValidator = noop5; 24757function getChangesOnSelection(props, highlightedIndex, inputValue) { 24758 var _props$items; 24759 inputValue === void 0 && (inputValue = !0); 24760 var shouldSelect = ((_props$items = props.items) == null ? void 0 : _props$items.length) && highlightedIndex >= 0; 24761 return _extends({ 24762 isOpen: !1, 24763 highlightedIndex: -1 24764 }, shouldSelect && _extends({ 24765 selectedItem: props.items[highlightedIndex], 24766 isOpen: getDefaultValue$1(props, "isOpen"), 24767 highlightedIndex: getDefaultValue$1(props, "highlightedIndex") 24768 }, inputValue && { 24769 inputValue: props.itemToString(props.items[highlightedIndex]) 24770 })); 24771} 24772function isDropdownsStateEqual(prevState, newState) { 24773 return prevState.isOpen === newState.isOpen && prevState.inputValue === newState.inputValue && prevState.highlightedIndex === newState.highlightedIndex && prevState.selectedItem === newState.selectedItem; 24774} 24775function useIsInitialMount() { 24776 var isInitialMountRef = react_default.useRef(!0); 24777 return react_default.useEffect(function() { 24778 return isInitialMountRef.current = !1, function() { 24779 isInitialMountRef.current = !0; 24780 }; 24781 }, []), isInitialMountRef.current; 24782} 24783function getDefaultHighlightedIndex(props) { 24784 var highlightedIndex = getDefaultValue$1(props, "highlightedIndex"); 24785 return highlightedIndex > -1 && props.isItemDisabled(props.items[highlightedIndex], highlightedIndex) ? -1 : highlightedIndex; 24786} 24787function getInitialHighlightedIndex(props) { 24788 var highlightedIndex = getInitialValue$1(props, "highlightedIndex"); 24789 return highlightedIndex > -1 && props.isItemDisabled(props.items[highlightedIndex], highlightedIndex) ? -1 : highlightedIndex; 24790} 24791var commonPropTypes = { 24792 environment: import_prop_types3.default.shape({ 24793 addEventListener: import_prop_types3.default.func.isRequired, 24794 removeEventListener: import_prop_types3.default.func.isRequired, 24795 document: import_prop_types3.default.shape({ 24796 createElement: import_prop_types3.default.func.isRequired, 24797 getElementById: import_prop_types3.default.func.isRequired, 24798 activeElement: import_prop_types3.default.any.isRequired, 24799 body: import_prop_types3.default.any.isRequired 24800 }).isRequired, 24801 Node: import_prop_types3.default.func.isRequired 24802 }), 24803 itemToString: import_prop_types3.default.func, 24804 itemToKey: import_prop_types3.default.func, 24805 stateReducer: import_prop_types3.default.func 24806}, commonDropdownPropTypes = _extends({}, commonPropTypes, { 24807 getA11yStatusMessage: import_prop_types3.default.func, 24808 highlightedIndex: import_prop_types3.default.number, 24809 defaultHighlightedIndex: import_prop_types3.default.number, 24810 initialHighlightedIndex: import_prop_types3.default.number, 24811 isOpen: import_prop_types3.default.bool, 24812 defaultIsOpen: import_prop_types3.default.bool, 24813 initialIsOpen: import_prop_types3.default.bool, 24814 selectedItem: import_prop_types3.default.any, 24815 initialSelectedItem: import_prop_types3.default.any, 24816 defaultSelectedItem: import_prop_types3.default.any, 24817 id: import_prop_types3.default.string, 24818 labelId: import_prop_types3.default.string, 24819 menuId: import_prop_types3.default.string, 24820 getItemId: import_prop_types3.default.func, 24821 toggleButtonId: import_prop_types3.default.string, 24822 onSelectedItemChange: import_prop_types3.default.func, 24823 onHighlightedIndexChange: import_prop_types3.default.func, 24824 onStateChange: import_prop_types3.default.func, 24825 onIsOpenChange: import_prop_types3.default.func, 24826 scrollIntoView: import_prop_types3.default.func 24827}); 24828function downshiftCommonReducer(state, action, stateChangeTypes2) { 24829 var type = action.type, props = action.props, changes; 24830 switch (type) { 24831 case stateChangeTypes2.ItemMouseMove: 24832 changes = { 24833 highlightedIndex: action.disabled ? -1 : action.index 24834 }; 24835 break; 24836 case stateChangeTypes2.MenuMouseLeave: 24837 changes = { 24838 highlightedIndex: -1 24839 }; 24840 break; 24841 case stateChangeTypes2.ToggleButtonClick: 24842 case stateChangeTypes2.FunctionToggleMenu: 24843 changes = { 24844 isOpen: !state.isOpen, 24845 highlightedIndex: state.isOpen ? -1 : getHighlightedIndexOnOpen(props, state, 0) 24846 }; 24847 break; 24848 case stateChangeTypes2.FunctionOpenMenu: 24849 changes = { 24850 isOpen: !0, 24851 highlightedIndex: getHighlightedIndexOnOpen(props, state, 0) 24852 }; 24853 break; 24854 case stateChangeTypes2.FunctionCloseMenu: 24855 changes = { 24856 isOpen: !1 24857 }; 24858 break; 24859 case stateChangeTypes2.FunctionSetHighlightedIndex: 24860 changes = { 24861 highlightedIndex: props.isItemDisabled(props.items[action.highlightedIndex], action.highlightedIndex) ? -1 : action.highlightedIndex 24862 }; 24863 break; 24864 case stateChangeTypes2.FunctionSetInputValue: 24865 changes = { 24866 inputValue: action.inputValue 24867 }; 24868 break; 24869 case stateChangeTypes2.FunctionReset: 24870 changes = { 24871 highlightedIndex: getDefaultHighlightedIndex(props), 24872 isOpen: getDefaultValue$1(props, "isOpen"), 24873 selectedItem: getDefaultValue$1(props, "selectedItem"), 24874 inputValue: getDefaultValue$1(props, "inputValue") 24875 }; 24876 break; 24877 default: 24878 throw new Error("Reducer called without proper action type."); 24879 } 24880 return _extends({}, state, changes); 24881} 24882function getItemIndexByCharacterKey(_a2) { 24883 for (var keysSoFar = _a2.keysSoFar, highlightedIndex = _a2.highlightedIndex, items = _a2.items, itemToString2 = _a2.itemToString, isItemDisabled2 = _a2.isItemDisabled, lowerCasedKeysSoFar = keysSoFar.toLowerCase(), index = 0; index < items.length; index++) { 24884 var offsetIndex = (index + highlightedIndex + (keysSoFar.length < 2 ? 1 : 0)) % items.length, item = items[offsetIndex]; 24885 if (item !== void 0 && itemToString2(item).toLowerCase().startsWith(lowerCasedKeysSoFar) && !isItemDisabled2(item, offsetIndex)) 24886 return offsetIndex; 24887 } 24888 return highlightedIndex; 24889} 24890var propTypes$2 = __assign(__assign({}, commonDropdownPropTypes), { items: import_prop_types3.default.array.isRequired, isItemDisabled: import_prop_types3.default.func }), defaultProps$2 = __assign(__assign({}, defaultProps$3), { isItemDisabled: function() { 24891 return !1; 24892} }), validatePropTypes$2 = noop5, ToggleButtonClick$1 = 0, ToggleButtonKeyDownArrowDown = 1, ToggleButtonKeyDownArrowUp = 2, ToggleButtonKeyDownCharacter = 3, ToggleButtonKeyDownEscape = 4, ToggleButtonKeyDownHome = 5, ToggleButtonKeyDownEnd = 6, ToggleButtonKeyDownEnter = 7, ToggleButtonKeyDownSpaceButton = 8, ToggleButtonKeyDownPageUp = 9, ToggleButtonKeyDownPageDown = 10, ToggleButtonBlur = 11, MenuMouseLeave$1 = 12, ItemMouseMove$1 = 13, ItemClick$1 = 14, FunctionToggleMenu$1 = 15, FunctionOpenMenu$1 = 16, FunctionCloseMenu$1 = 17, FunctionSetHighlightedIndex$1 = 18, FunctionSelectItem$1 = 19, FunctionSetInputValue$1 = 20, FunctionReset$2 = 21, stateChangeTypes$2 = Object.freeze({ 24893 __proto__: null, 24894 FunctionCloseMenu: FunctionCloseMenu$1, 24895 FunctionOpenMenu: FunctionOpenMenu$1, 24896 FunctionReset: FunctionReset$2, 24897 FunctionSelectItem: FunctionSelectItem$1, 24898 FunctionSetHighlightedIndex: FunctionSetHighlightedIndex$1, 24899 FunctionSetInputValue: FunctionSetInputValue$1, 24900 FunctionToggleMenu: FunctionToggleMenu$1, 24901 ItemClick: ItemClick$1, 24902 ItemMouseMove: ItemMouseMove$1, 24903 MenuMouseLeave: MenuMouseLeave$1, 24904 ToggleButtonBlur, 24905 ToggleButtonClick: ToggleButtonClick$1, 24906 ToggleButtonKeyDownArrowDown, 24907 ToggleButtonKeyDownArrowUp, 24908 ToggleButtonKeyDownCharacter, 24909 ToggleButtonKeyDownEnd, 24910 ToggleButtonKeyDownEnter, 24911 ToggleButtonKeyDownEscape, 24912 ToggleButtonKeyDownHome, 24913 ToggleButtonKeyDownPageDown, 24914 ToggleButtonKeyDownPageUp, 24915 ToggleButtonKeyDownSpaceButton 24916}); 24917function downshiftSelectReducer(state, action) { 24918 var _props$items, type = action.type, props = action.props, altKey = action.altKey, changes; 24919 switch (type) { 24920 case ItemClick$1: 24921 changes = { 24922 isOpen: getDefaultValue$1(props, "isOpen"), 24923 highlightedIndex: getDefaultHighlightedIndex(props), 24924 selectedItem: props.items[action.index] 24925 }; 24926 break; 24927 case ToggleButtonKeyDownCharacter: 24928 { 24929 var lowercasedKey = action.key, inputValue = "" + state.inputValue + lowercasedKey, prevHighlightedIndex = !state.isOpen && state.selectedItem ? props.items.findIndex(function(item) { 24930 return props.itemToKey(item) === props.itemToKey(state.selectedItem); 24931 }) : state.highlightedIndex, highlightedIndex = getItemIndexByCharacterKey({ 24932 keysSoFar: inputValue, 24933 highlightedIndex: prevHighlightedIndex, 24934 items: props.items, 24935 itemToString: props.itemToString, 24936 isItemDisabled: props.isItemDisabled 24937 }); 24938 changes = { 24939 inputValue, 24940 highlightedIndex, 24941 isOpen: !0 24942 }; 24943 } 24944 break; 24945 case ToggleButtonKeyDownArrowDown: 24946 { 24947 var _highlightedIndex = state.isOpen ? getHighlightedIndex(state.highlightedIndex, 1, props.items, props.isItemDisabled) : altKey && state.selectedItem == null ? -1 : getHighlightedIndexOnOpen(props, state, 1); 24948 changes = { 24949 highlightedIndex: _highlightedIndex, 24950 isOpen: !0 24951 }; 24952 } 24953 break; 24954 case ToggleButtonKeyDownArrowUp: 24955 if (state.isOpen && altKey) 24956 changes = getChangesOnSelection(props, state.highlightedIndex, !1); 24957 else { 24958 var _highlightedIndex2 = state.isOpen ? getHighlightedIndex(state.highlightedIndex, -1, props.items, props.isItemDisabled) : getHighlightedIndexOnOpen(props, state, -1); 24959 changes = { 24960 highlightedIndex: _highlightedIndex2, 24961 isOpen: !0 24962 }; 24963 } 24964 break; 24965 // only triggered when menu is open. 24966 case ToggleButtonKeyDownEnter: 24967 case ToggleButtonKeyDownSpaceButton: 24968 changes = getChangesOnSelection(props, state.highlightedIndex, !1); 24969 break; 24970 case ToggleButtonKeyDownHome: 24971 changes = { 24972 highlightedIndex: getNonDisabledIndex(0, !1, props.items, props.isItemDisabled), 24973 isOpen: !0 24974 }; 24975 break; 24976 case ToggleButtonKeyDownEnd: 24977 changes = { 24978 highlightedIndex: getNonDisabledIndex(props.items.length - 1, !0, props.items, props.isItemDisabled), 24979 isOpen: !0 24980 }; 24981 break; 24982 case ToggleButtonKeyDownPageUp: 24983 changes = { 24984 highlightedIndex: getHighlightedIndex(state.highlightedIndex, -10, props.items, props.isItemDisabled) 24985 }; 24986 break; 24987 case ToggleButtonKeyDownPageDown: 24988 changes = { 24989 highlightedIndex: getHighlightedIndex(state.highlightedIndex, 10, props.items, props.isItemDisabled) 24990 }; 24991 break; 24992 case ToggleButtonKeyDownEscape: 24993 changes = { 24994 isOpen: !1, 24995 highlightedIndex: -1 24996 }; 24997 break; 24998 case ToggleButtonBlur: 24999 changes = _extends({ 25000 isOpen: !1, 25001 highlightedIndex: -1 25002 }, state.highlightedIndex >= 0 && ((_props$items = props.items) == null ? void 0 : _props$items.length) && { 25003 selectedItem: props.items[state.highlightedIndex] 25004 }); 25005 break; 25006 case FunctionSelectItem$1: 25007 changes = { 25008 selectedItem: action.selectedItem 25009 }; 25010 break; 25011 default: 25012 return downshiftCommonReducer(state, action, stateChangeTypes$2); 25013 } 25014 return _extends({}, state, changes); 25015} 25016var _excluded$2 = ["onClick"], _excluded2$2 = ["onMouseLeave", "refKey", "ref"], _excluded3$1 = ["onBlur", "onClick", "onPress", "onKeyDown", "refKey", "ref"], _excluded4$1 = ["item", "index", "onMouseMove", "onClick", "onMouseDown", "onPress", "refKey", "disabled", "ref"]; 25017useSelect.stateChangeTypes = stateChangeTypes$2; 25018function useSelect(userProps) { 25019 userProps === void 0 && (userProps = {}), validatePropTypes$2(userProps, useSelect); 25020 var props = _extends({}, defaultProps$2, userProps), scrollIntoView3 = props.scrollIntoView, environment = props.environment, getA11yStatusMessage2 = props.getA11yStatusMessage, _useControlledReducer = useControlledReducer$1(downshiftSelectReducer, props, getInitialState$2, isDropdownsStateEqual), state = _useControlledReducer[0], dispatch = _useControlledReducer[1], isOpen = state.isOpen, highlightedIndex = state.highlightedIndex, selectedItem = state.selectedItem, inputValue = state.inputValue, toggleButtonRef = useRef(null), menuRef = useRef(null), itemRefs = useRef({}), clearTimeoutRef = useRef(null), elementIds = useElementIds(props), latest = useLatestRef({ 25021 state, 25022 props 25023 }), getItemNodeFromIndex = useCallback(function(index) { 25024 return itemRefs.current[elementIds.getItemId(index)]; 25025 }, [elementIds]); 25026 useA11yMessageStatus(getA11yStatusMessage2, state, [isOpen, highlightedIndex, selectedItem, inputValue], environment); 25027 var shouldScrollRef = useScrollIntoView({ 25028 menuElement: menuRef.current, 25029 highlightedIndex, 25030 isOpen, 25031 itemRefs, 25032 scrollIntoView: scrollIntoView3, 25033 getItemNodeFromIndex 25034 }); 25035 useEffect(function() { 25036 return clearTimeoutRef.current = debounce4(function(outerDispatch) { 25037 outerDispatch({ 25038 type: FunctionSetInputValue$1, 25039 inputValue: "" 25040 }); 25041 }, 500), function() { 25042 clearTimeoutRef.current.cancel(); 25043 }; 25044 }, []), useEffect(function() { 25045 inputValue && clearTimeoutRef.current(dispatch); 25046 }, [dispatch, inputValue]), useControlPropsValidator({ 25047 props, 25048 state 25049 }), useEffect(function() { 25050 var focusOnOpen = getInitialValue$1(props, "isOpen"); 25051 focusOnOpen && toggleButtonRef.current && toggleButtonRef.current.focus(); 25052 }, []); 25053 var mouseAndTouchTrackers = useMouseAndTouchTracker(environment, useCallback(function() { 25054 latest.current.state.isOpen && dispatch({ 25055 type: ToggleButtonBlur 25056 }); 25057 }, [dispatch, latest]), useMemo(function() { 25058 return [menuRef, toggleButtonRef]; 25059 }, [menuRef.current, toggleButtonRef.current])), setGetterPropCallInfo = useGetterPropsCalledChecker("getMenuProps", "getToggleButtonProps"); 25060 useEffect(function() { 25061 isOpen || (itemRefs.current = {}); 25062 }, [isOpen]); 25063 var toggleButtonKeyDownHandlers = useMemo(function() { 25064 return { 25065 ArrowDown: function(event) { 25066 event.preventDefault(), dispatch({ 25067 type: ToggleButtonKeyDownArrowDown, 25068 altKey: event.altKey 25069 }); 25070 }, 25071 ArrowUp: function(event) { 25072 event.preventDefault(), dispatch({ 25073 type: ToggleButtonKeyDownArrowUp, 25074 altKey: event.altKey 25075 }); 25076 }, 25077 Home: function(event) { 25078 event.preventDefault(), dispatch({ 25079 type: ToggleButtonKeyDownHome 25080 }); 25081 }, 25082 End: function(event) { 25083 event.preventDefault(), dispatch({ 25084 type: ToggleButtonKeyDownEnd 25085 }); 25086 }, 25087 Escape: function() { 25088 latest.current.state.isOpen && dispatch({ 25089 type: ToggleButtonKeyDownEscape 25090 }); 25091 }, 25092 Enter: function(event) { 25093 event.preventDefault(), dispatch({ 25094 type: latest.current.state.isOpen ? ToggleButtonKeyDownEnter : ToggleButtonClick$1 25095 }); 25096 }, 25097 PageUp: function(event) { 25098 latest.current.state.isOpen && (event.preventDefault(), dispatch({ 25099 type: ToggleButtonKeyDownPageUp 25100 })); 25101 }, 25102 PageDown: function(event) { 25103 latest.current.state.isOpen && (event.preventDefault(), dispatch({ 25104 type: ToggleButtonKeyDownPageDown 25105 })); 25106 }, 25107 " ": function(event) { 25108 event.preventDefault(); 25109 var currentState = latest.current.state; 25110 if (!currentState.isOpen) { 25111 dispatch({ 25112 type: ToggleButtonClick$1 25113 }); 25114 return; 25115 } 25116 currentState.inputValue ? dispatch({ 25117 type: ToggleButtonKeyDownCharacter, 25118 key: " " 25119 }) : dispatch({ 25120 type: ToggleButtonKeyDownSpaceButton 25121 }); 25122 } 25123 }; 25124 }, [dispatch, latest]), toggleMenu = useCallback(function() { 25125 dispatch({ 25126 type: FunctionToggleMenu$1 25127 }); 25128 }, [dispatch]), closeMenu = useCallback(function() { 25129 dispatch({ 25130 type: FunctionCloseMenu$1 25131 }); 25132 }, [dispatch]), openMenu = useCallback(function() { 25133 dispatch({ 25134 type: FunctionOpenMenu$1 25135 }); 25136 }, [dispatch]), setHighlightedIndex = useCallback(function(newHighlightedIndex) { 25137 dispatch({ 25138 type: FunctionSetHighlightedIndex$1, 25139 highlightedIndex: newHighlightedIndex 25140 }); 25141 }, [dispatch]), selectItem = useCallback(function(newSelectedItem) { 25142 dispatch({ 25143 type: FunctionSelectItem$1, 25144 selectedItem: newSelectedItem 25145 }); 25146 }, [dispatch]), reset = useCallback(function() { 25147 dispatch({ 25148 type: FunctionReset$2 25149 }); 25150 }, [dispatch]), setInputValue = useCallback(function(newInputValue) { 25151 dispatch({ 25152 type: FunctionSetInputValue$1, 25153 inputValue: newInputValue 25154 }); 25155 }, [dispatch]), getLabelProps = useCallback(function(_temp) { 25156 var _ref = _temp === void 0 ? {} : _temp, onClick = _ref.onClick, labelProps = _objectWithoutPropertiesLoose2(_ref, _excluded$2), labelHandleClick = function() { 25157 var _toggleButtonRef$curr; 25158 (_toggleButtonRef$curr = toggleButtonRef.current) == null || _toggleButtonRef$curr.focus(); 25159 }; 25160 return _extends({ 25161 id: elementIds.labelId, 25162 htmlFor: elementIds.toggleButtonId, 25163 onClick: callAllEventHandlers(onClick, labelHandleClick) 25164 }, labelProps); 25165 }, [elementIds]), getMenuProps = useCallback(function(_temp2, _temp3) { 25166 var _extends22, _ref2 = _temp2 === void 0 ? {} : _temp2, onMouseLeave = _ref2.onMouseLeave, _ref2$refKey = _ref2.refKey, refKey = _ref2$refKey === void 0 ? "ref" : _ref2$refKey, ref = _ref2.ref, rest2 = _objectWithoutPropertiesLoose2(_ref2, _excluded2$2), _ref3 = _temp3 === void 0 ? {} : _temp3, _ref3$suppressRefErro = _ref3.suppressRefError, suppressRefError = _ref3$suppressRefErro === void 0 ? !1 : _ref3$suppressRefErro, menuHandleMouseLeave = function() { 25167 dispatch({ 25168 type: MenuMouseLeave$1 25169 }); 25170 }; 25171 return setGetterPropCallInfo("getMenuProps", suppressRefError, refKey, menuRef), _extends((_extends22 = {}, _extends22[refKey] = handleRefs(ref, function(menuNode) { 25172 menuRef.current = menuNode; 25173 }), _extends22.id = elementIds.menuId, _extends22.role = "listbox", _extends22["aria-labelledby"] = rest2 && rest2["aria-label"] ? void 0 : "" + elementIds.labelId, _extends22.onMouseLeave = callAllEventHandlers(onMouseLeave, menuHandleMouseLeave), _extends22), rest2); 25174 }, [dispatch, setGetterPropCallInfo, elementIds]), getToggleButtonProps = useCallback(function(_temp4, _temp5) { 25175 var _extends3, _ref4 = _temp4 === void 0 ? {} : _temp4, onBlur = _ref4.onBlur, onClick = _ref4.onClick; 25176 _ref4.onPress; 25177 var onKeyDown = _ref4.onKeyDown, _ref4$refKey = _ref4.refKey, refKey = _ref4$refKey === void 0 ? "ref" : _ref4$refKey, ref = _ref4.ref, rest2 = _objectWithoutPropertiesLoose2(_ref4, _excluded3$1), _ref5 = _temp5 === void 0 ? {} : _temp5, _ref5$suppressRefErro = _ref5.suppressRefError, suppressRefError = _ref5$suppressRefErro === void 0 ? !1 : _ref5$suppressRefErro, latestState = latest.current.state, toggleButtonHandleClick = function() { 25178 dispatch({ 25179 type: ToggleButtonClick$1 25180 }); 25181 }, toggleButtonHandleBlur = function() { 25182 latestState.isOpen && !mouseAndTouchTrackers.isMouseDown && dispatch({ 25183 type: ToggleButtonBlur 25184 }); 25185 }, toggleButtonHandleKeyDown = function(event) { 25186 var key = normalizeArrowKey(event); 25187 key && toggleButtonKeyDownHandlers[key] ? toggleButtonKeyDownHandlers[key](event) : isAcceptedCharacterKey(key) && dispatch({ 25188 type: ToggleButtonKeyDownCharacter, 25189 key 25190 }); 25191 }, toggleProps = _extends((_extends3 = {}, _extends3[refKey] = handleRefs(ref, function(toggleButtonNode) { 25192 toggleButtonRef.current = toggleButtonNode; 25193 }), _extends3["aria-activedescendant"] = latestState.isOpen && latestState.highlightedIndex > -1 ? elementIds.getItemId(latestState.highlightedIndex) : "", _extends3["aria-controls"] = elementIds.menuId, _extends3["aria-expanded"] = latest.current.state.isOpen, _extends3["aria-haspopup"] = "listbox", _extends3["aria-labelledby"] = rest2 && rest2["aria-label"] ? void 0 : "" + elementIds.labelId, _extends3.id = elementIds.toggleButtonId, _extends3.role = "combobox", _extends3.tabIndex = 0, _extends3.onBlur = callAllEventHandlers(onBlur, toggleButtonHandleBlur), _extends3), rest2); 25194 return rest2.disabled || (toggleProps.onClick = callAllEventHandlers(onClick, toggleButtonHandleClick), toggleProps.onKeyDown = callAllEventHandlers(onKeyDown, toggleButtonHandleKeyDown)), setGetterPropCallInfo("getToggleButtonProps", suppressRefError, refKey, toggleButtonRef), toggleProps; 25195 }, [dispatch, elementIds, latest, mouseAndTouchTrackers, setGetterPropCallInfo, toggleButtonKeyDownHandlers]), getItemProps = useCallback(function(_temp6) { 25196 var _extends4, _ref6 = _temp6 === void 0 ? {} : _temp6, itemProp = _ref6.item, indexProp = _ref6.index, onMouseMove = _ref6.onMouseMove, onClick = _ref6.onClick, onMouseDown = _ref6.onMouseDown; 25197 _ref6.onPress; 25198 var _ref6$refKey = _ref6.refKey, refKey = _ref6$refKey === void 0 ? "ref" : _ref6$refKey, disabledProp = _ref6.disabled, ref = _ref6.ref, rest2 = _objectWithoutPropertiesLoose2(_ref6, _excluded4$1); 25199 disabledProp !== void 0 && console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useSelect.'); 25200 var _latest$current = latest.current, latestState = _latest$current.state, latestProps = _latest$current.props, _getItemAndIndex = getItemAndIndex(itemProp, indexProp, latestProps.items, "Pass either item or index to getItemProps!"), item = _getItemAndIndex[0], index = _getItemAndIndex[1], disabled = latestProps.isItemDisabled(item, index), itemHandleMouseMove = function() { 25201 mouseAndTouchTrackers.isTouchEnd || index === latestState.highlightedIndex || (shouldScrollRef.current = !1, dispatch({ 25202 type: ItemMouseMove$1, 25203 index, 25204 disabled 25205 })); 25206 }, itemHandleClick = function() { 25207 dispatch({ 25208 type: ItemClick$1, 25209 index 25210 }); 25211 }, itemHandleMouseDown = function(e2) { 25212 return e2.preventDefault(); 25213 }, itemProps = _extends((_extends4 = {}, _extends4[refKey] = handleRefs(ref, function(itemNode) { 25214 itemNode && (itemRefs.current[elementIds.getItemId(index)] = itemNode); 25215 }), _extends4["aria-disabled"] = disabled, _extends4["aria-selected"] = item === latestState.selectedItem, _extends4.id = elementIds.getItemId(index), _extends4.role = "option", _extends4), rest2); 25216 return disabled || (itemProps.onClick = callAllEventHandlers(onClick, itemHandleClick)), itemProps.onMouseMove = callAllEventHandlers(onMouseMove, itemHandleMouseMove), itemProps.onMouseDown = callAllEventHandlers(onMouseDown, itemHandleMouseDown), itemProps; 25217 }, [latest, elementIds, mouseAndTouchTrackers, shouldScrollRef, dispatch]); 25218 return { 25219 // prop getters. 25220 getToggleButtonProps, 25221 getLabelProps, 25222 getMenuProps, 25223 getItemProps, 25224 // actions. 25225 toggleMenu, 25226 openMenu, 25227 closeMenu, 25228 setHighlightedIndex, 25229 selectItem, 25230 reset, 25231 setInputValue, 25232 // state. 25233 highlightedIndex, 25234 isOpen, 25235 selectedItem, 25236 inputValue 25237 }; 25238} 25239var InputKeyDownArrowDown = 0, InputKeyDownArrowUp = 1, InputKeyDownEscape = 2, InputKeyDownHome = 3, InputKeyDownEnd = 4, InputKeyDownPageUp = 5, InputKeyDownPageDown = 6, InputKeyDownEnter = 7, InputChange = 8, InputBlur = 9, InputClick = 10, MenuMouseLeave = 11, ItemMouseMove = 12, ItemClick = 13, ToggleButtonClick = 14, FunctionToggleMenu = 15, FunctionOpenMenu = 16, FunctionCloseMenu = 17, FunctionSetHighlightedIndex = 18, FunctionSelectItem = 19, FunctionSetInputValue = 20, FunctionReset$1 = 21, ControlledPropUpdatedSelectedItem = 22, stateChangeTypes$1 = Object.freeze({ 25240 __proto__: null, 25241 ControlledPropUpdatedSelectedItem, 25242 FunctionCloseMenu, 25243 FunctionOpenMenu, 25244 FunctionReset: FunctionReset$1, 25245 FunctionSelectItem, 25246 FunctionSetHighlightedIndex, 25247 FunctionSetInputValue, 25248 FunctionToggleMenu, 25249 InputBlur, 25250 InputChange, 25251 InputClick, 25252 InputKeyDownArrowDown, 25253 InputKeyDownArrowUp, 25254 InputKeyDownEnd, 25255 InputKeyDownEnter, 25256 InputKeyDownEscape, 25257 InputKeyDownHome, 25258 InputKeyDownPageDown, 25259 InputKeyDownPageUp, 25260 ItemClick, 25261 ItemMouseMove, 25262 MenuMouseLeave, 25263 ToggleButtonClick 25264}); 25265function getInitialState$1(props) { 25266 var initialState = getInitialState$2(props), selectedItem = initialState.selectedItem, inputValue = initialState.inputValue; 25267 return inputValue === "" && selectedItem && props.defaultInputValue === void 0 && props.initialInputValue === void 0 && props.inputValue === void 0 && (inputValue = props.itemToString(selectedItem)), _extends({}, initialState, { 25268 inputValue 25269 }); 25270} 25271var propTypes$1 = _extends({}, commonDropdownPropTypes, { 25272 items: import_prop_types3.default.array.isRequired, 25273 isItemDisabled: import_prop_types3.default.func, 25274 inputValue: import_prop_types3.default.string, 25275 defaultInputValue: import_prop_types3.default.string, 25276 initialInputValue: import_prop_types3.default.string, 25277 inputId: import_prop_types3.default.string, 25278 onInputValueChange: import_prop_types3.default.func 25279}); 25280function useControlledReducer(reducer, props, createInitialState, isStateEqual2) { 25281 var previousSelectedItemRef = useRef(), _useEnhancedReducer = useEnhancedReducer(reducer, props, createInitialState, isStateEqual2), state = _useEnhancedReducer[0], dispatch = _useEnhancedReducer[1], isInitialMount = useIsInitialMount(); 25282 return useEffect(function() { 25283 if (isControlledProp(props, "selectedItem")) { 25284 if (!isInitialMount) { 25285 var shouldCallDispatch = props.itemToKey(props.selectedItem) !== props.itemToKey(previousSelectedItemRef.current); 25286 shouldCallDispatch && dispatch({ 25287 type: ControlledPropUpdatedSelectedItem, 25288 inputValue: props.itemToString(props.selectedItem) 25289 }); 25290 } 25291 previousSelectedItemRef.current = state.selectedItem === previousSelectedItemRef.current ? props.selectedItem : state.selectedItem; 25292 } 25293 }, [state.selectedItem, props.selectedItem]), [getState2(state, props), dispatch]; 25294} 25295var validatePropTypes$1 = noop5, defaultProps$1 = _extends({}, defaultProps$3, { 25296 isItemDisabled: function() { 25297 return !1; 25298 } 25299}); 25300function downshiftUseComboboxReducer(state, action) { 25301 var _props$items, type = action.type, props = action.props, altKey = action.altKey, changes; 25302 switch (type) { 25303 case ItemClick: 25304 changes = { 25305 isOpen: getDefaultValue$1(props, "isOpen"), 25306 highlightedIndex: getDefaultHighlightedIndex(props), 25307 selectedItem: props.items[action.index], 25308 inputValue: props.itemToString(props.items[action.index]) 25309 }; 25310 break; 25311 case InputKeyDownArrowDown: 25312 state.isOpen ? changes = { 25313 highlightedIndex: getHighlightedIndex(state.highlightedIndex, 1, props.items, props.isItemDisabled, !0) 25314 } : changes = { 25315 highlightedIndex: altKey && state.selectedItem == null ? -1 : getHighlightedIndexOnOpen(props, state, 1), 25316 isOpen: props.items.length >= 0 25317 }; 25318 break; 25319 case InputKeyDownArrowUp: 25320 state.isOpen ? altKey ? changes = getChangesOnSelection(props, state.highlightedIndex) : changes = { 25321 highlightedIndex: getHighlightedIndex(state.highlightedIndex, -1, props.items, props.isItemDisabled, !0) 25322 } : changes = { 25323 highlightedIndex: getHighlightedIndexOnOpen(props, state, -1), 25324 isOpen: props.items.length >= 0 25325 }; 25326 break; 25327 case InputKeyDownEnter: 25328 changes = getChangesOnSelection(props, state.highlightedIndex); 25329 break; 25330 case InputKeyDownEscape: 25331 changes = _extends({ 25332 isOpen: !1, 25333 highlightedIndex: -1 25334 }, !state.isOpen && { 25335 selectedItem: null, 25336 inputValue: "" 25337 }); 25338 break; 25339 case InputKeyDownPageUp: 25340 changes = { 25341 highlightedIndex: getHighlightedIndex(state.highlightedIndex, -10, props.items, props.isItemDisabled, !0) 25342 }; 25343 break; 25344 case InputKeyDownPageDown: 25345 changes = { 25346 highlightedIndex: getHighlightedIndex(state.highlightedIndex, 10, props.items, props.isItemDisabled, !0) 25347 }; 25348 break; 25349 case InputKeyDownHome: 25350 changes = { 25351 highlightedIndex: getNonDisabledIndex(0, !1, props.items, props.isItemDisabled) 25352 }; 25353 break; 25354 case InputKeyDownEnd: 25355 changes = { 25356 highlightedIndex: getNonDisabledIndex(props.items.length - 1, !0, props.items, props.isItemDisabled) 25357 }; 25358 break; 25359 case InputBlur: 25360 changes = _extends({ 25361 isOpen: !1, 25362 highlightedIndex: -1 25363 }, state.highlightedIndex >= 0 && ((_props$items = props.items) == null ? void 0 : _props$items.length) && action.selectItem && { 25364 selectedItem: props.items[state.highlightedIndex], 25365 inputValue: props.itemToString(props.items[state.highlightedIndex]) 25366 }); 25367 break; 25368 case InputChange: 25369 changes = { 25370 isOpen: !0, 25371 highlightedIndex: getDefaultHighlightedIndex(props), 25372 inputValue: action.inputValue 25373 }; 25374 break; 25375 case InputClick: 25376 changes = { 25377 isOpen: !state.isOpen, 25378 highlightedIndex: state.isOpen ? -1 : getHighlightedIndexOnOpen(props, state, 0) 25379 }; 25380 break; 25381 case FunctionSelectItem: 25382 changes = { 25383 selectedItem: action.selectedItem, 25384 inputValue: props.itemToString(action.selectedItem) 25385 }; 25386 break; 25387 case ControlledPropUpdatedSelectedItem: 25388 changes = { 25389 inputValue: action.inputValue 25390 }; 25391 break; 25392 default: 25393 return downshiftCommonReducer(state, action, stateChangeTypes$1); 25394 } 25395 return _extends({}, state, changes); 25396} 25397var _excluded$12 = ["onMouseLeave", "refKey", "ref"], _excluded2$1 = ["item", "index", "refKey", "ref", "onMouseMove", "onMouseDown", "onClick", "onPress", "disabled"], _excluded3 = ["onClick", "onPress", "refKey", "ref"], _excluded4 = ["onKeyDown", "onChange", "onInput", "onBlur", "onChangeText", "onClick", "refKey", "ref"]; 25398useCombobox.stateChangeTypes = stateChangeTypes$1; 25399function useCombobox(userProps) { 25400 userProps === void 0 && (userProps = {}), validatePropTypes$1(userProps, useCombobox); 25401 var props = _extends({}, defaultProps$1, userProps), items = props.items, scrollIntoView3 = props.scrollIntoView, environment = props.environment, getA11yStatusMessage2 = props.getA11yStatusMessage, _useControlledReducer = useControlledReducer(downshiftUseComboboxReducer, props, getInitialState$1, isDropdownsStateEqual), state = _useControlledReducer[0], dispatch = _useControlledReducer[1], isOpen = state.isOpen, highlightedIndex = state.highlightedIndex, selectedItem = state.selectedItem, inputValue = state.inputValue, menuRef = useRef(null), itemRefs = useRef({}), inputRef = useRef(null), toggleButtonRef = useRef(null), isInitialMount = useIsInitialMount(), elementIds = useElementIds(props), previousResultCountRef = useRef(), latest = useLatestRef({ 25402 state, 25403 props 25404 }), getItemNodeFromIndex = useCallback(function(index) { 25405 return itemRefs.current[elementIds.getItemId(index)]; 25406 }, [elementIds]); 25407 useA11yMessageStatus(getA11yStatusMessage2, state, [isOpen, highlightedIndex, selectedItem, inputValue], environment); 25408 var shouldScrollRef = useScrollIntoView({ 25409 menuElement: menuRef.current, 25410 highlightedIndex, 25411 isOpen, 25412 itemRefs, 25413 scrollIntoView: scrollIntoView3, 25414 getItemNodeFromIndex 25415 }); 25416 useControlPropsValidator({ 25417 props, 25418 state 25419 }), useEffect(function() { 25420 var focusOnOpen = getInitialValue$1(props, "isOpen"); 25421 focusOnOpen && inputRef.current && inputRef.current.focus(); 25422 }, []), useEffect(function() { 25423 isInitialMount || (previousResultCountRef.current = items.length); 25424 }); 25425 var mouseAndTouchTrackers = useMouseAndTouchTracker(environment, useCallback(function() { 25426 latest.current.state.isOpen && dispatch({ 25427 type: InputBlur, 25428 selectItem: !1 25429 }); 25430 }, [dispatch, latest]), useMemo(function() { 25431 return [menuRef, toggleButtonRef, inputRef]; 25432 }, [menuRef.current, toggleButtonRef.current, inputRef.current])), setGetterPropCallInfo = useGetterPropsCalledChecker("getInputProps", "getMenuProps"); 25433 useEffect(function() { 25434 isOpen || (itemRefs.current = {}); 25435 }, [isOpen]), useEffect(function() { 25436 var _inputRef$current; 25437 !isOpen || !(environment != null && environment.document) || !(inputRef != null && (_inputRef$current = inputRef.current) != null && _inputRef$current.focus) || environment.document.activeElement !== inputRef.current && inputRef.current.focus(); 25438 }, [isOpen, environment]); 25439 var inputKeyDownHandlers = useMemo(function() { 25440 return { 25441 ArrowDown: function(event) { 25442 event.preventDefault(), dispatch({ 25443 type: InputKeyDownArrowDown, 25444 altKey: event.altKey 25445 }); 25446 }, 25447 ArrowUp: function(event) { 25448 event.preventDefault(), dispatch({ 25449 type: InputKeyDownArrowUp, 25450 altKey: event.altKey 25451 }); 25452 }, 25453 Home: function(event) { 25454 latest.current.state.isOpen && (event.preventDefault(), dispatch({ 25455 type: InputKeyDownHome 25456 })); 25457 }, 25458 End: function(event) { 25459 latest.current.state.isOpen && (event.preventDefault(), dispatch({ 25460 type: InputKeyDownEnd 25461 })); 25462 }, 25463 Escape: function(event) { 25464 var latestState = latest.current.state; 25465 (latestState.isOpen || latestState.inputValue || latestState.selectedItem || latestState.highlightedIndex > -1) && (event.preventDefault(), dispatch({ 25466 type: InputKeyDownEscape 25467 })); 25468 }, 25469 Enter: function(event) { 25470 var latestState = latest.current.state; 25471 !latestState.isOpen || event.which === 229 || (event.preventDefault(), dispatch({ 25472 type: InputKeyDownEnter 25473 })); 25474 }, 25475 PageUp: function(event) { 25476 latest.current.state.isOpen && (event.preventDefault(), dispatch({ 25477 type: InputKeyDownPageUp 25478 })); 25479 }, 25480 PageDown: function(event) { 25481 latest.current.state.isOpen && (event.preventDefault(), dispatch({ 25482 type: InputKeyDownPageDown 25483 })); 25484 } 25485 }; 25486 }, [dispatch, latest]), getLabelProps = useCallback(function(labelProps) { 25487 return _extends({ 25488 id: elementIds.labelId, 25489 htmlFor: elementIds.inputId 25490 }, labelProps); 25491 }, [elementIds]), getMenuProps = useCallback(function(_temp, _temp2) { 25492 var _extends22, _ref = _temp === void 0 ? {} : _temp, onMouseLeave = _ref.onMouseLeave, _ref$refKey = _ref.refKey, refKey = _ref$refKey === void 0 ? "ref" : _ref$refKey, ref = _ref.ref, rest2 = _objectWithoutPropertiesLoose2(_ref, _excluded$12), _ref2 = _temp2 === void 0 ? {} : _temp2, _ref2$suppressRefErro = _ref2.suppressRefError, suppressRefError = _ref2$suppressRefErro === void 0 ? !1 : _ref2$suppressRefErro; 25493 return setGetterPropCallInfo("getMenuProps", suppressRefError, refKey, menuRef), _extends((_extends22 = {}, _extends22[refKey] = handleRefs(ref, function(menuNode) { 25494 menuRef.current = menuNode; 25495 }), _extends22.id = elementIds.menuId, _extends22.role = "listbox", _extends22["aria-labelledby"] = rest2 && rest2["aria-label"] ? void 0 : "" + elementIds.labelId, _extends22.onMouseLeave = callAllEventHandlers(onMouseLeave, function() { 25496 dispatch({ 25497 type: MenuMouseLeave 25498 }); 25499 }), _extends22), rest2); 25500 }, [dispatch, setGetterPropCallInfo, elementIds]), getItemProps = useCallback(function(_temp3) { 25501 var _extends3, _ref4, _ref3 = _temp3 === void 0 ? {} : _temp3, itemProp = _ref3.item, indexProp = _ref3.index, _ref3$refKey = _ref3.refKey, refKey = _ref3$refKey === void 0 ? "ref" : _ref3$refKey, ref = _ref3.ref, onMouseMove = _ref3.onMouseMove, onMouseDown = _ref3.onMouseDown, onClick = _ref3.onClick; 25502 _ref3.onPress; 25503 var disabledProp = _ref3.disabled, rest2 = _objectWithoutPropertiesLoose2(_ref3, _excluded2$1); 25504 disabledProp !== void 0 && console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.'); 25505 var _latest$current = latest.current, latestProps = _latest$current.props, latestState = _latest$current.state, _getItemAndIndex = getItemAndIndex(itemProp, indexProp, latestProps.items, "Pass either item or index to getItemProps!"), item = _getItemAndIndex[0], index = _getItemAndIndex[1], disabled = latestProps.isItemDisabled(item, index), onSelectKey = "onClick", customClickHandler = onClick, itemHandleMouseMove = function() { 25506 mouseAndTouchTrackers.isTouchEnd || index === latestState.highlightedIndex || (shouldScrollRef.current = !1, dispatch({ 25507 type: ItemMouseMove, 25508 index, 25509 disabled 25510 })); 25511 }, itemHandleClick = function() { 25512 dispatch({ 25513 type: ItemClick, 25514 index 25515 }); 25516 }, itemHandleMouseDown = function(e2) { 25517 return e2.preventDefault(); 25518 }; 25519 return _extends((_extends3 = {}, _extends3[refKey] = handleRefs(ref, function(itemNode) { 25520 itemNode && (itemRefs.current[elementIds.getItemId(index)] = itemNode); 25521 }), _extends3["aria-disabled"] = disabled, _extends3["aria-selected"] = index === latestState.highlightedIndex, _extends3.id = elementIds.getItemId(index), _extends3.role = "option", _extends3), !disabled && (_ref4 = {}, _ref4[onSelectKey] = callAllEventHandlers(customClickHandler, itemHandleClick), _ref4), { 25522 onMouseMove: callAllEventHandlers(onMouseMove, itemHandleMouseMove), 25523 onMouseDown: callAllEventHandlers(onMouseDown, itemHandleMouseDown) 25524 }, rest2); 25525 }, [dispatch, elementIds, latest, mouseAndTouchTrackers, shouldScrollRef]), getToggleButtonProps = useCallback(function(_temp4) { 25526 var _extends4, _ref5 = _temp4 === void 0 ? {} : _temp4, onClick = _ref5.onClick; 25527 _ref5.onPress; 25528 var _ref5$refKey = _ref5.refKey, refKey = _ref5$refKey === void 0 ? "ref" : _ref5$refKey, ref = _ref5.ref, rest2 = _objectWithoutPropertiesLoose2(_ref5, _excluded3), latestState = latest.current.state, toggleButtonHandleClick = function() { 25529 dispatch({ 25530 type: ToggleButtonClick 25531 }); 25532 }; 25533 return _extends((_extends4 = {}, _extends4[refKey] = handleRefs(ref, function(toggleButtonNode) { 25534 toggleButtonRef.current = toggleButtonNode; 25535 }), _extends4["aria-controls"] = elementIds.menuId, _extends4["aria-expanded"] = latestState.isOpen, _extends4.id = elementIds.toggleButtonId, _extends4.tabIndex = -1, _extends4), !rest2.disabled && _extends({}, { 25536 onClick: callAllEventHandlers(onClick, toggleButtonHandleClick) 25537 }), rest2); 25538 }, [dispatch, latest, elementIds]), getInputProps = useCallback(function(_temp5, _temp6) { 25539 var _extends5, _ref6 = _temp5 === void 0 ? {} : _temp5, onKeyDown = _ref6.onKeyDown, onChange = _ref6.onChange, onInput = _ref6.onInput, onBlur = _ref6.onBlur; 25540 _ref6.onChangeText; 25541 var onClick = _ref6.onClick, _ref6$refKey = _ref6.refKey, refKey = _ref6$refKey === void 0 ? "ref" : _ref6$refKey, ref = _ref6.ref, rest2 = _objectWithoutPropertiesLoose2(_ref6, _excluded4), _ref7 = _temp6 === void 0 ? {} : _temp6, _ref7$suppressRefErro = _ref7.suppressRefError, suppressRefError = _ref7$suppressRefErro === void 0 ? !1 : _ref7$suppressRefErro; 25542 setGetterPropCallInfo("getInputProps", suppressRefError, refKey, inputRef); 25543 var latestState = latest.current.state, inputHandleKeyDown = function(event) { 25544 var key = normalizeArrowKey(event); 25545 key && inputKeyDownHandlers[key] && inputKeyDownHandlers[key](event); 25546 }, inputHandleChange = function(event) { 25547 dispatch({ 25548 type: InputChange, 25549 inputValue: event.target.value 25550 }); 25551 }, inputHandleBlur = function(event) { 25552 if (environment != null && environment.document && latestState.isOpen && !mouseAndTouchTrackers.isMouseDown) { 25553 var isBlurByTabChange = event.relatedTarget === null && environment.document.activeElement !== environment.document.body; 25554 dispatch({ 25555 type: InputBlur, 25556 selectItem: !isBlurByTabChange 25557 }); 25558 } 25559 }, inputHandleClick = function() { 25560 dispatch({ 25561 type: InputClick 25562 }); 25563 }, onChangeKey = "onChange", eventHandlers = {}; 25564 if (!rest2.disabled) { 25565 var _eventHandlers; 25566 eventHandlers = (_eventHandlers = {}, _eventHandlers[onChangeKey] = callAllEventHandlers(onChange, onInput, inputHandleChange), _eventHandlers.onKeyDown = callAllEventHandlers(onKeyDown, inputHandleKeyDown), _eventHandlers.onBlur = callAllEventHandlers(onBlur, inputHandleBlur), _eventHandlers.onClick = callAllEventHandlers(onClick, inputHandleClick), _eventHandlers); 25567 } 25568 return _extends((_extends5 = {}, _extends5[refKey] = handleRefs(ref, function(inputNode) { 25569 inputRef.current = inputNode; 25570 }), _extends5["aria-activedescendant"] = latestState.isOpen && latestState.highlightedIndex > -1 ? elementIds.getItemId(latestState.highlightedIndex) : "", _extends5["aria-autocomplete"] = "list", _extends5["aria-controls"] = elementIds.menuId, _extends5["aria-expanded"] = latestState.isOpen, _extends5["aria-labelledby"] = rest2 && rest2["aria-label"] ? void 0 : elementIds.labelId, _extends5.autoComplete = "off", _extends5.id = elementIds.inputId, _extends5.role = "combobox", _extends5.value = latestState.inputValue, _extends5), eventHandlers, rest2); 25571 }, [dispatch, elementIds, environment, inputKeyDownHandlers, latest, mouseAndTouchTrackers, setGetterPropCallInfo]), toggleMenu = useCallback(function() { 25572 dispatch({ 25573 type: FunctionToggleMenu 25574 }); 25575 }, [dispatch]), closeMenu = useCallback(function() { 25576 dispatch({ 25577 type: FunctionCloseMenu 25578 }); 25579 }, [dispatch]), openMenu = useCallback(function() { 25580 dispatch({ 25581 type: FunctionOpenMenu 25582 }); 25583 }, [dispatch]), setHighlightedIndex = useCallback(function(newHighlightedIndex) { 25584 dispatch({ 25585 type: FunctionSetHighlightedIndex, 25586 highlightedIndex: newHighlightedIndex 25587 }); 25588 }, [dispatch]), selectItem = useCallback(function(newSelectedItem) { 25589 dispatch({ 25590 type: FunctionSelectItem, 25591 selectedItem: newSelectedItem 25592 }); 25593 }, [dispatch]), setInputValue = useCallback(function(newInputValue) { 25594 dispatch({ 25595 type: FunctionSetInputValue, 25596 inputValue: newInputValue 25597 }); 25598 }, [dispatch]), reset = useCallback(function() { 25599 dispatch({ 25600 type: FunctionReset$1 25601 }); 25602 }, [dispatch]); 25603 return { 25604 // prop getters. 25605 getItemProps, 25606 getLabelProps, 25607 getMenuProps, 25608 getInputProps, 25609 getToggleButtonProps, 25610 // actions. 25611 toggleMenu, 25612 openMenu, 25613 closeMenu, 25614 setHighlightedIndex, 25615 setInputValue, 25616 selectItem, 25617 reset, 25618 // state. 25619 highlightedIndex, 25620 isOpen, 25621 selectedItem, 25622 inputValue 25623 }; 25624} 25625var defaultStateValues = { 25626 activeIndex: -1, 25627 selectedItems: [] 25628}; 25629function getInitialValue(props, propKey) { 25630 return getInitialValue$1(props, propKey, defaultStateValues); 25631} 25632function getDefaultValue(props, propKey) { 25633 return getDefaultValue$1(props, propKey, defaultStateValues); 25634} 25635function getInitialState(props) { 25636 var activeIndex = getInitialValue(props, "activeIndex"), selectedItems = getInitialValue(props, "selectedItems"); 25637 return { 25638 activeIndex, 25639 selectedItems 25640 }; 25641} 25642function isKeyDownOperationPermitted(event) { 25643 if (event.shiftKey || event.metaKey || event.ctrlKey || event.altKey) 25644 return !1; 25645 var element = event.target; 25646 return !(element instanceof HTMLInputElement && // if element is a text input 25647 element.value !== "" && // and we have text in it 25648 // and cursor is either not at the start or is currently highlighting text. 25649 (element.selectionStart !== 0 || element.selectionEnd !== 0)); 25650} 25651function isStateEqual(prevState, newState) { 25652 return prevState.selectedItems === newState.selectedItems && prevState.activeIndex === newState.activeIndex; 25653} 25654var propTypes = { 25655 stateReducer: commonPropTypes.stateReducer, 25656 itemToKey: commonPropTypes.itemToKey, 25657 environment: commonPropTypes.environment, 25658 selectedItems: import_prop_types3.default.array, 25659 initialSelectedItems: import_prop_types3.default.array, 25660 defaultSelectedItems: import_prop_types3.default.array, 25661 getA11yStatusMessage: import_prop_types3.default.func, 25662 activeIndex: import_prop_types3.default.number, 25663 initialActiveIndex: import_prop_types3.default.number, 25664 defaultActiveIndex: import_prop_types3.default.number, 25665 onActiveIndexChange: import_prop_types3.default.func, 25666 onSelectedItemsChange: import_prop_types3.default.func, 25667 keyNavigationNext: import_prop_types3.default.string, 25668 keyNavigationPrevious: import_prop_types3.default.string 25669}, defaultProps2 = { 25670 itemToKey: defaultProps$3.itemToKey, 25671 stateReducer: defaultProps$3.stateReducer, 25672 environment: defaultProps$3.environment, 25673 keyNavigationNext: "ArrowRight", 25674 keyNavigationPrevious: "ArrowLeft" 25675}, validatePropTypes = noop5, SelectedItemClick = 0, SelectedItemKeyDownDelete = 1, SelectedItemKeyDownBackspace = 2, SelectedItemKeyDownNavigationNext = 3, SelectedItemKeyDownNavigationPrevious = 4, DropdownKeyDownNavigationPrevious = 5, DropdownKeyDownBackspace = 6, DropdownClick = 7, FunctionAddSelectedItem = 8, FunctionRemoveSelectedItem = 9, FunctionSetSelectedItems = 10, FunctionSetActiveIndex = 11, FunctionReset = 12, stateChangeTypes = Object.freeze({ 25676 __proto__: null, 25677 DropdownClick, 25678 DropdownKeyDownBackspace, 25679 DropdownKeyDownNavigationPrevious, 25680 FunctionAddSelectedItem, 25681 FunctionRemoveSelectedItem, 25682 FunctionReset, 25683 FunctionSetActiveIndex, 25684 FunctionSetSelectedItems, 25685 SelectedItemClick, 25686 SelectedItemKeyDownBackspace, 25687 SelectedItemKeyDownDelete, 25688 SelectedItemKeyDownNavigationNext, 25689 SelectedItemKeyDownNavigationPrevious 25690}); 25691function downshiftMultipleSelectionReducer(state, action) { 25692 var type = action.type, index = action.index, props = action.props, selectedItem = action.selectedItem, activeIndex = state.activeIndex, selectedItems = state.selectedItems, changes; 25693 switch (type) { 25694 case SelectedItemClick: 25695 changes = { 25696 activeIndex: index 25697 }; 25698 break; 25699 case SelectedItemKeyDownNavigationPrevious: 25700 changes = { 25701 activeIndex: activeIndex - 1 < 0 ? 0 : activeIndex - 1 25702 }; 25703 break; 25704 case SelectedItemKeyDownNavigationNext: 25705 changes = { 25706 activeIndex: activeIndex + 1 >= selectedItems.length ? -1 : activeIndex + 1 25707 }; 25708 break; 25709 case SelectedItemKeyDownBackspace: 25710 case SelectedItemKeyDownDelete: { 25711 if (activeIndex < 0) 25712 break; 25713 var newActiveIndex = activeIndex; 25714 selectedItems.length === 1 ? newActiveIndex = -1 : activeIndex === selectedItems.length - 1 && (newActiveIndex = selectedItems.length - 2), changes = _extends({ 25715 selectedItems: [].concat(selectedItems.slice(0, activeIndex), selectedItems.slice(activeIndex + 1)) 25716 }, { 25717 activeIndex: newActiveIndex 25718 }); 25719 break; 25720 } 25721 case DropdownKeyDownNavigationPrevious: 25722 changes = { 25723 activeIndex: selectedItems.length - 1 25724 }; 25725 break; 25726 case DropdownKeyDownBackspace: 25727 changes = { 25728 selectedItems: selectedItems.slice(0, selectedItems.length - 1) 25729 }; 25730 break; 25731 case FunctionAddSelectedItem: 25732 changes = { 25733 selectedItems: [].concat(selectedItems, [selectedItem]) 25734 }; 25735 break; 25736 case DropdownClick: 25737 changes = { 25738 activeIndex: -1 25739 }; 25740 break; 25741 case FunctionRemoveSelectedItem: { 25742 var _newActiveIndex = activeIndex, selectedItemIndex = selectedItems.findIndex(function(item) { 25743 return props.itemToKey(item) === props.itemToKey(selectedItem); 25744 }); 25745 if (selectedItemIndex < 0) 25746 break; 25747 selectedItems.length === 1 ? _newActiveIndex = -1 : selectedItemIndex === selectedItems.length - 1 && (_newActiveIndex = selectedItems.length - 2), changes = { 25748 selectedItems: [].concat(selectedItems.slice(0, selectedItemIndex), selectedItems.slice(selectedItemIndex + 1)), 25749 activeIndex: _newActiveIndex 25750 }; 25751 break; 25752 } 25753 case FunctionSetSelectedItems: { 25754 var newSelectedItems = action.selectedItems; 25755 changes = { 25756 selectedItems: newSelectedItems 25757 }; 25758 break; 25759 } 25760 case FunctionSetActiveIndex: { 25761 var _newActiveIndex2 = action.activeIndex; 25762 changes = { 25763 activeIndex: _newActiveIndex2 25764 }; 25765 break; 25766 } 25767 case FunctionReset: 25768 changes = { 25769 activeIndex: getDefaultValue(props, "activeIndex"), 25770 selectedItems: getDefaultValue(props, "selectedItems") 25771 }; 25772 break; 25773 default: 25774 throw new Error("Reducer called without proper action type."); 25775 } 25776 return _extends({}, state, changes); 25777} 25778var _excluded2 = ["refKey", "ref", "onClick", "onKeyDown", "selectedItem", "index"], _excluded22 = ["refKey", "ref", "onKeyDown", "onClick", "preventKeyAction"]; 25779useMultipleSelection.stateChangeTypes = stateChangeTypes; 25780function useMultipleSelection(userProps) { 25781 userProps === void 0 && (userProps = {}), validatePropTypes(userProps, useMultipleSelection); 25782 var props = _extends({}, defaultProps2, userProps), getA11yStatusMessage2 = props.getA11yStatusMessage, environment = props.environment, keyNavigationNext = props.keyNavigationNext, keyNavigationPrevious = props.keyNavigationPrevious, _useControlledReducer = useControlledReducer$1(downshiftMultipleSelectionReducer, props, getInitialState, isStateEqual), state = _useControlledReducer[0], dispatch = _useControlledReducer[1], activeIndex = state.activeIndex, selectedItems = state.selectedItems, isInitialMount = useIsInitialMount(), dropdownRef = useRef(null), selectedItemRefs = useRef(); 25783 selectedItemRefs.current = []; 25784 var latest = useLatestRef({ 25785 state, 25786 props 25787 }); 25788 useA11yMessageStatus(getA11yStatusMessage2, state, [activeIndex, selectedItems], environment), useEffect(function() { 25789 isInitialMount || (activeIndex === -1 && dropdownRef.current ? dropdownRef.current.focus() : selectedItemRefs.current[activeIndex] && selectedItemRefs.current[activeIndex].focus()); 25790 }, [activeIndex]), useControlPropsValidator({ 25791 props, 25792 state 25793 }); 25794 var setGetterPropCallInfo = useGetterPropsCalledChecker("getDropdownProps"), selectedItemKeyDownHandlers = useMemo(function() { 25795 var _ref; 25796 return _ref = {}, _ref[keyNavigationPrevious] = function() { 25797 dispatch({ 25798 type: SelectedItemKeyDownNavigationPrevious 25799 }); 25800 }, _ref[keyNavigationNext] = function() { 25801 dispatch({ 25802 type: SelectedItemKeyDownNavigationNext 25803 }); 25804 }, _ref.Delete = function() { 25805 dispatch({ 25806 type: SelectedItemKeyDownDelete 25807 }); 25808 }, _ref.Backspace = function() { 25809 dispatch({ 25810 type: SelectedItemKeyDownBackspace 25811 }); 25812 }, _ref; 25813 }, [dispatch, keyNavigationNext, keyNavigationPrevious]), dropdownKeyDownHandlers = useMemo(function() { 25814 var _ref2; 25815 return _ref2 = {}, _ref2[keyNavigationPrevious] = function(event) { 25816 isKeyDownOperationPermitted(event) && dispatch({ 25817 type: DropdownKeyDownNavigationPrevious 25818 }); 25819 }, _ref2.Backspace = function(event) { 25820 isKeyDownOperationPermitted(event) && dispatch({ 25821 type: DropdownKeyDownBackspace 25822 }); 25823 }, _ref2; 25824 }, [dispatch, keyNavigationPrevious]), getSelectedItemProps = useCallback(function(_temp) { 25825 var _extends22, _ref3 = _temp === void 0 ? {} : _temp, _ref3$refKey = _ref3.refKey, refKey = _ref3$refKey === void 0 ? "ref" : _ref3$refKey, ref = _ref3.ref, onClick = _ref3.onClick, onKeyDown = _ref3.onKeyDown, selectedItemProp = _ref3.selectedItem, indexProp = _ref3.index, rest2 = _objectWithoutPropertiesLoose2(_ref3, _excluded2), latestState = latest.current.state, _getItemAndIndex = getItemAndIndex(selectedItemProp, indexProp, latestState.selectedItems, "Pass either item or index to getSelectedItemProps!"), index = _getItemAndIndex[1], isFocusable = index > -1 && index === latestState.activeIndex, selectedItemHandleClick = function() { 25826 dispatch({ 25827 type: SelectedItemClick, 25828 index 25829 }); 25830 }, selectedItemHandleKeyDown = function(event) { 25831 var key = normalizeArrowKey(event); 25832 key && selectedItemKeyDownHandlers[key] && selectedItemKeyDownHandlers[key](event); 25833 }; 25834 return _extends((_extends22 = {}, _extends22[refKey] = handleRefs(ref, function(selectedItemNode) { 25835 selectedItemNode && selectedItemRefs.current.push(selectedItemNode); 25836 }), _extends22.tabIndex = isFocusable ? 0 : -1, _extends22.onClick = callAllEventHandlers(onClick, selectedItemHandleClick), _extends22.onKeyDown = callAllEventHandlers(onKeyDown, selectedItemHandleKeyDown), _extends22), rest2); 25837 }, [dispatch, latest, selectedItemKeyDownHandlers]), getDropdownProps = useCallback(function(_temp2, _temp3) { 25838 var _extends3, _ref4 = _temp2 === void 0 ? {} : _temp2, _ref4$refKey = _ref4.refKey, refKey = _ref4$refKey === void 0 ? "ref" : _ref4$refKey, ref = _ref4.ref, onKeyDown = _ref4.onKeyDown, onClick = _ref4.onClick, _ref4$preventKeyActio = _ref4.preventKeyAction, preventKeyAction = _ref4$preventKeyActio === void 0 ? !1 : _ref4$preventKeyActio, rest2 = _objectWithoutPropertiesLoose2(_ref4, _excluded22), _ref5 = _temp3 === void 0 ? {} : _temp3, _ref5$suppressRefErro = _ref5.suppressRefError, suppressRefError = _ref5$suppressRefErro === void 0 ? !1 : _ref5$suppressRefErro; 25839 setGetterPropCallInfo("getDropdownProps", suppressRefError, refKey, dropdownRef); 25840 var dropdownHandleKeyDown = function(event) { 25841 var key = normalizeArrowKey(event); 25842 key && dropdownKeyDownHandlers[key] && dropdownKeyDownHandlers[key](event); 25843 }, dropdownHandleClick = function() { 25844 dispatch({ 25845 type: DropdownClick 25846 }); 25847 }; 25848 return _extends((_extends3 = {}, _extends3[refKey] = handleRefs(ref, function(dropdownNode) { 25849 dropdownNode && (dropdownRef.current = dropdownNode); 25850 }), _extends3), !preventKeyAction && { 25851 onKeyDown: callAllEventHandlers(onKeyDown, dropdownHandleKeyDown), 25852 onClick: callAllEventHandlers(onClick, dropdownHandleClick) 25853 }, rest2); 25854 }, [dispatch, dropdownKeyDownHandlers, setGetterPropCallInfo]), addSelectedItem = useCallback(function(selectedItem) { 25855 dispatch({ 25856 type: FunctionAddSelectedItem, 25857 selectedItem 25858 }); 25859 }, [dispatch]), removeSelectedItem = useCallback(function(selectedItem) { 25860 dispatch({ 25861 type: FunctionRemoveSelectedItem, 25862 selectedItem 25863 }); 25864 }, [dispatch]), setSelectedItems = useCallback(function(newSelectedItems) { 25865 dispatch({ 25866 type: FunctionSetSelectedItems, 25867 selectedItems: newSelectedItems 25868 }); 25869 }, [dispatch]), setActiveIndex = useCallback(function(newActiveIndex) { 25870 dispatch({ 25871 type: FunctionSetActiveIndex, 25872 activeIndex: newActiveIndex 25873 }); 25874 }, [dispatch]), reset = useCallback(function() { 25875 dispatch({ 25876 type: FunctionReset 25877 }); 25878 }, [dispatch]); 25879 return { 25880 getSelectedItemProps, 25881 getDropdownProps, 25882 addSelectedItem, 25883 removeSelectedItem, 25884 setSelectedItems, 25885 setActiveIndex, 25886 reset, 25887 selectedItems, 25888 activeIndex 25889 }; 25890} 25891 25892// src/manager/components/sidebar/Search.tsx 25893var import_fuse = __toESM(require_fuse(), 1); 25894 25895// src/manager/components/sidebar/types.ts 25896function isExpandType(x2) { 25897 return !!(x2 && x2.showAll); 25898} 25899function isSearchResult(x2) { 25900 return !!(x2 && x2.item); 25901} 25902 25903// src/manager/components/sidebar/Search.tsx 25904var { document: document7 } = scope, DEFAULT_MAX_SEARCH_RESULTS = 50, options = { 25905 shouldSort: !0, 25906 tokenize: !0, 25907 findAllMatches: !0, 25908 includeScore: !0, 25909 includeMatches: !0, 25910 threshold: 0.2, 25911 location: 0, 25912 distance: 100, 25913 maxPatternLength: 32, 25914 minMatchCharLength: 1, 25915 keys: [ 25916 { name: "name", weight: 0.6 }, 25917 { name: "path", weight: 0.3 }, 25918 { name: "anchors.title", weight: 0.1 } 25919 ] 25920}, SearchBar = styled.div({ 25921 display: "flex", 25922 flexDirection: "row", 25923 columnGap: 6 25924}), ScreenReaderLabel = styled.label({ 25925 position: "absolute", 25926 left: -1e4, 25927 top: "auto", 25928 width: 1, 25929 height: 1, 25930 overflow: "hidden" 25931}), SearchField2 = styled.div(({ theme, isMobile: isMobile2 }) => ({ 25932 display: "flex", 25933 flexDirection: "row", 25934 alignItems: "center", 25935 padding: isMobile2 ? 4 : 2, 25936 flexGrow: 1, 25937 height: isMobile2 ? 36 : 32, 25938 width: "100%", 25939 boxShadow: `${theme.button.border} 0 0 0 1px inset`, 25940 borderRadius: theme.appBorderRadius + 2, 25941 "&:has(input:focus), &:has(input:active)": { 25942 background: theme.background.app, 25943 outline: `2px solid ${theme.color.secondary}`, 25944 outlineOffset: 2 25945 } 25946})), IconWrapper = styled.div(({ theme, onClick }) => ({ 25947 cursor: onClick ? "pointer" : "default", 25948 flex: "0 0 28px", 25949 height: "100%", 25950 pointerEvents: onClick ? "auto" : "none", 25951 color: theme.textMutedColor, 25952 display: "flex", 25953 alignItems: "center", 25954 justifyContent: "center" 25955})), Input = styled.input(({ theme, isMobile: isMobile2 }) => ({ 25956 appearance: "none", 25957 height: 28, 25958 width: "100%", 25959 padding: 0, 25960 border: 0, 25961 background: "transparent", 25962 fontSize: isMobile2 ? "16px" : `${theme.typography.size.s1 + 1}px`, 25963 fontFamily: "inherit", 25964 transition: "all 150ms", 25965 color: theme.color.defaultText, 25966 outline: 0, 25967 "&::placeholder": { 25968 color: theme.textMutedColor, 25969 opacity: 1 25970 }, 25971 "&:valid ~ code, &:focus ~ code": { 25972 display: "none" 25973 }, 25974 "&:invalid ~ svg": { 25975 display: "none" 25976 }, 25977 "&:valid ~ svg": { 25978 display: "block" 25979 }, 25980 "&::-ms-clear": { 25981 display: "none" 25982 }, 25983 "&::-webkit-search-decoration, &::-webkit-search-cancel-button, &::-webkit-search-results-button, &::-webkit-search-results-decoration": { 25984 display: "none" 25985 } 25986})), FocusKey = styled.code(({ theme }) => ({ 25987 margin: 5, 25988 marginTop: 6, 25989 height: 16, 25990 fontFamily: theme.typography.fonts.base, 25991 lineHeight: "16px", 25992 textAlign: "center", 25993 fontSize: "11px", 25994 color: theme.base === "light" ? theme.color.dark : theme.textMutedColor, 25995 userSelect: "none", 25996 pointerEvents: "none", 25997 display: "flex", 25998 alignItems: "center", 25999 gap: 4, 26000 flexShrink: 0 26001})), FocusKeyCmd = styled.span({ 26002 fontSize: "14px" 26003}), Actions2 = styled.div({ 26004 display: "flex", 26005 alignItems: "center", 26006 gap: 2 26007}), FocusContainer = styled.div({ outline: 0 }), Search = react_default.memo(function({ 26008 children, 26009 dataset, 26010 enableShortcuts = !0, 26011 getLastViewed, 26012 initialQuery = "", 26013 searchBarContent, 26014 searchFieldContent 26015}) { 26016 let api = useStorybookApi(), inputRef = useRef(null), [inputPlaceholder, setPlaceholder] = useState("Find components"), [allComponents, showAllComponents] = useState(!1), searchShortcut = api ? shortcutToHumanString(api.getShortcutKeys().search) : "/", makeFuse = useCallback(() => { 26017 let list = []; 26018 for (let [refId, { index, allStatuses }] of dataset.entries) { 26019 if (!index) 26020 continue; 26021 let groupStatus = getGroupStatus(index || {}, allStatuses ?? {}), datasetValues = Object.values(index); 26022 for (let datasetValue of datasetValues) { 26023 let storyStatuses = allStatuses?.[datasetValue.id], status = (storyStatuses ? getMostCriticalStatusValue( 26024 Object.values(storyStatuses).filter((status2) => status2.typeId !== REVIEW_STATUS_TYPE_ID).map((status2) => status2.value) 26025 ) : null) ?? groupStatus[datasetValue.id] ?? null; 26026 if (datasetValue.type !== "docs" || !globalThis?.FEATURES?.experimentalSearchDocsHeadings) { 26027 list.push({ 26028 ...searchItem(datasetValue, dataset.hash[refId]), 26029 status 26030 }); 26031 continue; 26032 } 26033 let { anchors, ...baseSearchItem } = searchItem(datasetValue, dataset.hash[refId]); 26034 list.push({ 26035 ...baseSearchItem, 26036 status 26037 }), anchors?.forEach((anchor) => { 26038 let namePostfix = baseSearchItem.path?.[0] === anchor.title ? "" : ` / ${anchor.title}`; 26039 list.push({ 26040 ...baseSearchItem, 26041 anchors: [anchor], 26042 // Fuse requires unique ids, so suffix the entry id with the anchor's DOM id 26043 id: `${datasetValue.id}#${anchor.id}`, 26044 name: `${datasetValue.name}${namePostfix}`, 26045 status 26046 }); 26047 }); 26048 } 26049 } 26050 return new import_fuse.default(list, options); 26051 }, [dataset]), getResults = useCallback( 26052 (input) => { 26053 let fuse = makeFuse(); 26054 if (!input) 26055 return []; 26056 let results = [], resultIds = /* @__PURE__ */ new Set(), allMatches = fuse.search(input).filter(({ item }) => item.type === "component" || item.type === "docs" || item.type === "story"), docsParentIds = /* @__PURE__ */ new Set(); 26057 allMatches.forEach(({ item }) => { 26058 item.type === "docs" && item.parent && docsParentIds.add(item.parent); 26059 }); 26060 let pendingDocsReplacements = /* @__PURE__ */ new Set(), distinctResults = allMatches.filter(({ item }) => item.type === "component" && docsParentIds.has(item.id) ? (resultIds.has(item.id) || (resultIds.add(item.id), pendingDocsReplacements.add(item.id)), !1) : item.type === "docs" && item.parent && pendingDocsReplacements.has(item.parent) ? (pendingDocsReplacements.delete(item.parent), resultIds.add(item.id), !0) : resultIds.has(item.parent) ? !1 : (resultIds.add(item.id), item.type === "docs" && item.parent && resultIds.add(item.parent), !0)); 26061 return distinctResults.length && (results = distinctResults.slice(0, allComponents ? 1e3 : DEFAULT_MAX_SEARCH_RESULTS), distinctResults.length > DEFAULT_MAX_SEARCH_RESULTS && !allComponents && results.push({ 26062 showAll: () => showAllComponents(!0), 26063 totalCount: distinctResults.length, 26064 moreCount: distinctResults.length - DEFAULT_MAX_SEARCH_RESULTS 26065 })), results; 26066 }, 26067 [allComponents, makeFuse] 26068 ), onSelect = useCallback( 26069 (selectedItem) => { 26070 if (selectedItem) { 26071 if (isSearchResult(selectedItem)) { 26072 let { id: rawId, refId } = selectedItem.item, [storyId, anchor] = rawId.split("#"); 26073 api?.selectStory(storyId, void 0, { 26074 // @ts-expect-error (non strict) 26075 ref: refId !== DEFAULT_REF_ID && refId, 26076 scrollTo: anchor 26077 }), inputRef.current.blur(), showAllComponents(!1); 26078 return; 26079 } 26080 isExpandType(selectedItem) && selectedItem.showAll(); 26081 } 26082 }, 26083 [api] 26084 ), onInputValueChange = useCallback((inputValue, stateAndHelpers) => { 26085 showAllComponents(!1); 26086 }, []), stateReducer2 = useCallback( 26087 (state, changes) => { 26088 switch (changes.type) { 26089 case Downshift.stateChangeTypes.blurInput: 26090 return { 26091 ...changes, 26092 // Prevent clearing the input on blur 26093 inputValue: state.inputValue, 26094 // Return to the tree view after selecting an item 26095 isOpen: !!state.inputValue && !state.selectedItem 26096 }; 26097 case Downshift.stateChangeTypes.mouseUp: 26098 return state; 26099 case Downshift.stateChangeTypes.keyDownEscape: 26100 return state.inputValue ? { ...changes, inputValue: "", isOpen: !0, selectedItem: null } : { ...changes, isOpen: !1, selectedItem: null }; 26101 case Downshift.stateChangeTypes.clickItem: 26102 case Downshift.stateChangeTypes.keyDownEnter: 26103 return isSearchResult(changes.selectedItem) ? { ...changes, inputValue: state.inputValue } : isExpandType(changes.selectedItem) ? state : changes; 26104 default: 26105 return changes; 26106 } 26107 }, 26108 [] 26109 ), { isMobile: isMobile2 } = useLayout(), searchLandmarkRef = useRef(null), { landmarkProps } = useLandmark({ role: "search" }, searchLandmarkRef); 26110 return react_default.createElement( 26111 Downshift, 26112 { 26113 initialInputValue: initialQuery, 26114 stateReducer: stateReducer2, 26115 itemToString: (result) => result?.item?.name || "", 26116 scrollIntoView: (e2) => scrollIntoView(e2), 26117 onSelect, 26118 onInputValueChange 26119 }, 26120 ({ 26121 isOpen, 26122 openMenu, 26123 closeMenu, 26124 inputValue, 26125 getInputProps, 26126 getItemProps, 26127 getLabelProps, 26128 getMenuProps, 26129 getRootProps, 26130 highlightedIndex, 26131 reset 26132 }) => { 26133 let input = inputValue ? inputValue.trim() : "", results = input ? getResults(input) : [], lastViewed = !input && getLastViewed(); 26134 lastViewed && lastViewed.length && (results = lastViewed.reduce((acc, { storyId, refId, anchor }) => { 26135 let data = dataset.hash[refId]; 26136 if (data && data.index && data.index[storyId]) { 26137 let story = data.index[storyId], item = story.type === "story" ? data.index[story.parent] : story, entryId = anchor ? `${item.id}#${anchor}` : item.id; 26138 if (!acc.some((res) => res.item.refId === refId && res.item.id === entryId)) { 26139 let baseItem = searchItem(item, dataset.hash[refId]), resultItem = baseItem; 26140 if (anchor && item.type === "docs") { 26141 let matchingAnchor = item.anchors?.find((a2) => a2.id === anchor); 26142 if (matchingAnchor) { 26143 let namePostfix = baseItem.path?.[0] === matchingAnchor.title ? "" : ` / ${matchingAnchor.title}`; 26144 resultItem = { 26145 ...baseItem, 26146 id: entryId, 26147 name: `${item.name}${namePostfix}` 26148 }; 26149 } 26150 } 26151 acc.push({ item: resultItem, matches: [], score: 0 }); 26152 } 26153 } 26154 return acc; 26155 }, [])); 26156 let inputId = "storybook-explorer-searchfield", inputProps = getInputProps({ 26157 id: inputId, 26158 ref: inputRef, 26159 required: !0, 26160 type: "search", 26161 placeholder: inputPlaceholder, 26162 onFocus: () => { 26163 openMenu(), setPlaceholder("Type to find..."); 26164 }, 26165 onBlur: () => setPlaceholder("Find components"), 26166 onKeyDown: (e2) => { 26167 e2.key === "Escape" && inputValue.length === 0 && inputRef.current.blur(); 26168 } 26169 }), labelProps = getLabelProps({ 26170 htmlFor: inputId 26171 }); 26172 return react_default.createElement(react_default.Fragment, null, react_default.createElement(ScreenReaderLabel, { ...labelProps }, "Search for components"), react_default.createElement(SearchBar, { ref: searchLandmarkRef, ...landmarkProps }, react_default.createElement( 26173 SearchField2, 26174 { 26175 ...getRootProps({ refKey: "" }, { suppressRefError: !0 }), 26176 isMobile: isMobile2, 26177 className: "search-field" 26178 }, 26179 react_default.createElement(IconWrapper, null, react_default.createElement(SearchIcon, null)), 26180 react_default.createElement(Input, { ...inputProps, isMobile: isMobile2 }), 26181 !isMobile2 && enableShortcuts && !isOpen && react_default.createElement(FocusKey, null, searchShortcut === "\u2318 K" ? react_default.createElement(react_default.Fragment, null, react_default.createElement(FocusKeyCmd, null, "\u2318"), "K") : searchShortcut), 26182 react_default.createElement(Actions2, null, input && react_default.createElement( 26183 Button, 26184 { 26185 padding: "small", 26186 variant: "ghost", 26187 ariaLabel: "Clear search", 26188 onClick: () => { 26189 reset({ inputValue: "" }), closeMenu(), inputRef.current?.focus(); 26190 } 26191 }, 26192 react_default.createElement(CloseIcon, null) 26193 ), searchFieldContent) 26194 ), searchBarContent), react_default.createElement(FocusContainer, { tabIndex: 0, id: "storybook-explorer-menu" }, children({ 26195 query: input, 26196 results, 26197 isNavVisible: !isOpen && document7.activeElement !== inputRef.current, 26198 isNavReachable: !isOpen || input.length === 0, 26199 isSearchResultRendered: isOpen, 26200 closeMenu, 26201 getMenuProps, 26202 getItemProps, 26203 highlightedIndex 26204 }))); 26205 } 26206 ); 26207}); 26208 26209// src/manager/components/sidebar/SearchResults.tsx 26210init_react(); 26211var { document: document8 } = scope, ResultsList = styled.ol({ 26212 listStyle: "none", 26213 margin: 0, 26214 padding: 0 26215}), ResultRow = styled.li(({ theme, isHighlighted }) => ({ 26216 width: "100%", 26217 border: "none", 26218 cursor: "pointer", 26219 display: "flex", 26220 alignItems: "start", 26221 justifyContent: "space-between", 26222 textAlign: "left", 26223 color: "inherit", 26224 fontSize: `${theme.typography.size.s2}px`, 26225 background: isHighlighted ? theme.background.hoverable : "transparent", 26226 minHeight: 28, 26227 borderRadius: 4, 26228 gap: 6, 26229 paddingTop: 7, 26230 paddingBottom: 7, 26231 paddingLeft: 8, 26232 paddingRight: 8, 26233 "&:hover, &:focus": { 26234 background: curriedTransparentize$1(0.93, theme.color.secondary), 26235 outline: "none" 26236 } 26237})), IconWrapper2 = styled.div({ 26238 marginTop: 2 26239}), ResultRowContent = styled.div({ 26240 flex: 1, 26241 display: "flex", 26242 flexDirection: "column" 26243}), Mark = styled.mark(({ theme }) => ({ 26244 background: "transparent", 26245 color: theme.color.secondary, 26246 "@media (forced-colors: active)": { 26247 color: "HighlightText", 26248 background: "Highlight" 26249 } 26250})), MoreWrapper = styled.div({ 26251 marginTop: 8 26252}), RecentlyOpenedTitle = styled.div(({ theme }) => ({ 26253 display: "flex", 26254 justifyContent: "space-between", 26255 fontSize: `${theme.typography.size.s1 - 1}px`, 26256 fontWeight: theme.typography.weight.bold, 26257 minHeight: 28, 26258 letterSpacing: "0.16em", 26259 textTransform: "uppercase", 26260 color: theme.textMutedColor, 26261 marginBottom: 4, 26262 alignItems: "center", 26263 ".search-result-recentlyOpened-clear": { 26264 visibility: "hidden" 26265 }, 26266 "&:hover": { 26267 ".search-result-recentlyOpened-clear": { 26268 visibility: "visible" 26269 } 26270 } 26271})), Highlight = react_default.memo(function({ 26272 children, 26273 match 26274}) { 26275 if (!match) 26276 return children; 26277 let { value, indices } = match, { nodes: result } = indices.reduce( 26278 ({ cursor, nodes }, [start, end], index, { length }) => (nodes.push(react_default.createElement("span", { key: `${index}-1` }, value.slice(cursor, start))), nodes.push(react_default.createElement(Mark, { key: `${index}-2` }, value.slice(start, end + 1))), index === length - 1 && nodes.push(react_default.createElement("span", { key: `${index}-3` }, value.slice(end + 1))), { cursor: end + 1, nodes }), 26279 { cursor: 0, nodes: [] } 26280 ); 26281 return react_default.createElement("span", null, result); 26282}), Title3 = styled.div({ 26283 display: "grid", 26284 justifyContent: "start", 26285 gridAutoColumns: "auto", 26286 gridAutoFlow: "column", 26287 "& > span": { 26288 display: "block", 26289 whiteSpace: "nowrap", 26290 overflow: "hidden", 26291 textOverflow: "ellipsis" 26292 } 26293}), Path = styled.div(({ theme }) => ({ 26294 display: "grid", 26295 justifyContent: "start", 26296 gridAutoColumns: "auto", 26297 gridAutoFlow: "column", 26298 fontSize: `${theme.typography.size.s1 - 1}px`, 26299 "& > span": { 26300 display: "block", 26301 whiteSpace: "nowrap", 26302 overflow: "hidden", 26303 textOverflow: "ellipsis" 26304 }, 26305 "& > span + span": { 26306 "&:before": { 26307 content: "' / '", 26308 whiteSpace: "pre" 26309 } 26310 } 26311})), Result = react_default.memo(function({ item, matches, onClick, ...props }) { 26312 let theme = useTheme(), click = useCallback( 26313 (event) => { 26314 event.preventDefault(), onClick?.(event); 26315 }, 26316 [onClick] 26317 ), api = useStorybookApi(); 26318 useEffect(() => { 26319 api && props.isHighlighted && item.type === "component" && api.emit(PRELOAD_ENTRIES, { ids: [item.children[0]] }, { options: { target: item.refId } }); 26320 }, [api, props.isHighlighted, item]); 26321 let nameMatch = matches.find((match) => match.key === "name"), pathMatches = matches.filter((match) => match.key === "path"), icon = item.status ? getStatus(theme, item.status).icon : null; 26322 return react_default.createElement(ResultRow, { ...props, onClick: click }, react_default.createElement(IconWrapper2, null, item.type === "component" && react_default.createElement(TypeIcon2, { viewBox: "0 0 14 14", width: "14", height: "14", type: "component" }, react_default.createElement(UseSymbol, { type: "component" })), item.type === "story" && react_default.createElement(TypeIcon2, { viewBox: "0 0 14 14", width: "14", height: "14", type: item.subtype }, react_default.createElement(UseSymbol, { type: item.subtype })), !(item.type === "component" || item.type === "story") && react_default.createElement(TypeIcon2, { viewBox: "0 0 14 14", width: "14", height: "14", type: "document" }, react_default.createElement(UseSymbol, { type: "document" }))), react_default.createElement(ResultRowContent, { className: "search-result-item--label" }, react_default.createElement(Title3, null, react_default.createElement(Highlight, { match: nameMatch }, item.name)), react_default.createElement(Path, null, item.path.map((group, index) => react_default.createElement("span", { key: index }, react_default.createElement(Highlight, { match: pathMatches.find((match) => match.arrayIndex === index) }, group))))), item.status ? react_default.createElement(StatusLabel, { status: item.status }, icon) : null); 26323}), SearchResults = react_default.memo(function({ 26324 query, 26325 results, 26326 closeMenu, 26327 getMenuProps, 26328 getItemProps, 26329 highlightedIndex, 26330 isLoading = !1, 26331 enableShortcuts = !0, 26332 clearLastViewed 26333}) { 26334 let api = useStorybookApi(); 26335 useEffect(() => { 26336 let handleEscape = (event) => { 26337 if (!(!enableShortcuts || isLoading || event.repeat) && matchesModifiers(!1, event) && matchesKeyCode("Escape", event)) { 26338 if (event.target?.id === "storybook-explorer-searchfield") 26339 return; 26340 event.preventDefault(), closeMenu(); 26341 } 26342 }; 26343 return document8.addEventListener("keydown", handleEscape), () => document8.removeEventListener("keydown", handleEscape); 26344 }, [closeMenu, enableShortcuts, isLoading]); 26345 let mouseOverHandler = useCallback((event) => { 26346 if (!api) 26347 return; 26348 let currentTarget = event.currentTarget, storyId = currentTarget.getAttribute("data-id"), refId = currentTarget.getAttribute("data-refid"), item = api.resolveStory(storyId, refId === "storybook_internal" ? void 0 : refId); 26349 item?.type === "component" && api.emit(PRELOAD_ENTRIES, { 26350 // @ts-expect-error (TODO) 26351 ids: [item.isLeaf ? item.id : item.children[0]], 26352 options: { target: refId } 26353 }); 26354 }, []), handleClearLastViewed = () => { 26355 clearLastViewed(), closeMenu(); 26356 }; 26357 return react_default.createElement(ResultsList, { ...getMenuProps(), key: "results-list" }, results.length > 0 && !query && react_default.createElement(RecentlyOpenedTitle, { className: "search-result-recentlyOpened" }, "Recently opened", react_default.createElement( 26358 Button, 26359 { 26360 padding: "small", 26361 variant: "ghost", 26362 className: "search-result-recentlyOpened-clear", 26363 onClick: handleClearLastViewed, 26364 ariaLabel: "Clear recently opened items" 26365 }, 26366 react_default.createElement(TrashIcon, null) 26367 )), results.length === 0 && query && react_default.createElement("li", null, react_default.createElement(NoResults2, null, react_default.createElement("strong", null, "No components found"), react_default.createElement("small", null, "Find components by name or path."))), results.map((result, index) => { 26368 if (isExpandType(result)) { 26369 let props = { ...results, ...getItemProps({ key: index, index, item: result }) }, { key: key2, ...rest2 } = props; 26370 return react_default.createElement(MoreWrapper, { key: "search-result-expand" }, react_default.createElement(Button, { key: key2, ...rest2, size: "small" }, "Show ", result.moreCount, " more results")); 26371 } 26372 let { item } = result, key = `${item.refId}::${item.id}`; 26373 return react_default.createElement( 26374 Result, 26375 { 26376 ...result, 26377 ...getItemProps({ key, index, item: result }), 26378 isHighlighted: highlightedIndex === index, 26379 key, 26380 "data-id": result.item.id, 26381 "data-refid": result.item.refId, 26382 onMouseOver: mouseOverHandler, 26383 className: "search-result-item" 26384 } 26385 ); 26386 })); 26387}); 26388 26389// src/manager/components/sidebar/SidebarBottom.tsx 26390init_react(); 26391 26392// src/manager/components/sidebar/TestingWidget.tsx 26393init_react(); 26394 26395// src/manager/components/sidebar/useDynamicFavicon.ts 26396init_react(); 26397var STATUSES = ["active", "critical", "negative", "positive", "warning"], initialIcon, getFaviconUrl = (initialHref = "./favicon.svg", status) => { 26398 initialIcon ??= initialHref; 26399 let href = initialIcon + (status && STATUSES.includes(status) ? `?status=${status}` : ""); 26400 return new Promise((resolve) => { 26401 let img = new Image(); 26402 img.onload = () => resolve({ href, status }), img.onerror = () => resolve({ href: initialIcon, status }), img.src = href; 26403 }); 26404}, useDynamicFavicon = (status) => { 26405 let links = useRef(document.head.querySelectorAll("link[rel*='icon']")); 26406 useEffect(() => { 26407 let isMounted = !0, [element, ...others] = links.current; 26408 if (element && !others.length) 26409 return getFaviconUrl(element.href, status).then( 26410 (result) => { 26411 isMounted && result.status === status && element.dataset.status !== status && (element.href = result.href, result.status ? element.dataset.status = result.status : delete element.dataset.status); 26412 }, 26413 () => { 26414 isMounted && (element.href = initialIcon); 26415 } 26416 ), () => { 26417 isMounted = !1, element.href = initialIcon; 26418 }; 26419 }, [status]); 26420}; 26421 26422// src/manager/components/sidebar/TestingWidget.tsx 26423var DEFAULT_HEIGHT = 500, HoverCard2 = styled(Card)({ 26424 display: "flex", 26425 flexDirection: "column-reverse", 26426 "&:hover #testing-module-collapse-toggle": { 26427 opacity: 1 26428 } 26429}), Collapsible2 = styled.div(({ theme }) => ({ 26430 overflow: "hidden", 26431 boxShadow: `inset 0 -1px 0 ${theme.appBorderColor}` 26432})), Content3 = styled.div({ 26433 display: "flex", 26434 flexDirection: "column" 26435}), Bar3 = styled.div(({ onClick }) => ({ 26436 display: "flex", 26437 width: "100%", 26438 cursor: onClick ? "pointer" : "default", 26439 userSelect: "none", 26440 alignItems: "center", 26441 justifyContent: "space-between", 26442 overflow: "hidden", 26443 padding: 4, 26444 gap: 4 26445})), Action = styled.div({ 26446 display: "flex", 26447 flexBasis: "100%", 26448 containerType: "inline-size" 26449}), Filters = styled.div({ 26450 display: "flex", 26451 justifyContent: "flex-end", 26452 gap: 4 26453}), CollapseToggle3 = styled(ActionList.Button)({ 26454 opacity: 0, 26455 transition: "opacity 250ms", 26456 "&:focus, &:hover": { 26457 opacity: 1 26458 } 26459}), RunButton = ({ 26460 children, 26461 isRunning, 26462 onRunAll, 26463 ...props 26464}) => react_default.createElement( 26465 ActionList.Button, 26466 { 26467 ariaLabel: isRunning ? "Running..." : "Run tests", 26468 tooltip: isRunning ? "Running tests..." : "Start all tests", 26469 disabled: isRunning, 26470 onClick: (e2) => { 26471 e2.stopPropagation(), onRunAll(); 26472 }, 26473 ...props 26474 }, 26475 react_default.createElement(ActionList.Icon, null, react_default.createElement(PlayAllHollowIcon, null)), 26476 children 26477), StatusButton2 = styled(ActionList.Toggle)( 26478 { minWidth: 28, outlineOffset: -2 }, 26479 ({ pressed, status, theme }) => !pressed && (theme.base === "light" ? { 26480 background: { 26481 negative: theme.background.negative, 26482 warning: theme.background.warning 26483 }[status], 26484 color: { 26485 negative: theme.color.negativeText, 26486 warning: theme.color.warningText 26487 }[status] 26488 } : { 26489 background: { 26490 negative: `${theme.color.negative}22`, 26491 warning: `${theme.color.warning}22` 26492 }[status], 26493 color: { 26494 negative: theme.color.negative, 26495 warning: theme.color.warning 26496 }[status] 26497 }) 26498), TestProvider = styled.div(({ theme }) => ({ 26499 padding: 4, 26500 "&:not(:last-child)": { 26501 boxShadow: `inset 0 -1px 0 ${theme.appBorderColor}` 26502 } 26503})), TestingWidget = ({ 26504 registeredTestProviders, 26505 testProviderStates, 26506 hasStatuses, 26507 clearStatuses, 26508 onRunAll, 26509 errorCount, 26510 errorsActive, 26511 setErrorsActive, 26512 warningCount, 26513 warningsActive, 26514 setWarningsActive, 26515 successCount 26516}) => { 26517 let timeoutRef = useRef(null), contentRef = useRef(null), [maxHeight, setMaxHeight] = useState(DEFAULT_HEIGHT), [isCollapsed, setCollapsed] = useState(!0), [isChangingCollapse, setChangingCollapse] = useState(!1), [isUpdated, setIsUpdated] = useState(!1), settingsUpdatedTimeoutRef = useRef(); 26518 useEffect(() => { 26519 let unsubscribe = internal_fullTestProviderStore.onSettingsChanged(() => { 26520 setIsUpdated(!0), clearTimeout(settingsUpdatedTimeoutRef.current), settingsUpdatedTimeoutRef.current = setTimeout(() => { 26521 setIsUpdated(!1); 26522 }, 1e3); 26523 }); 26524 return () => { 26525 unsubscribe(), clearTimeout(settingsUpdatedTimeoutRef.current); 26526 }; 26527 }, []), useEffect(() => { 26528 if (contentRef.current) { 26529 setMaxHeight(contentRef.current?.getBoundingClientRect().height || DEFAULT_HEIGHT); 26530 let resizeObserver = new ResizeObserver(() => { 26531 requestAnimationFrame(() => { 26532 if (contentRef.current && !isCollapsed) { 26533 let height = contentRef.current?.getBoundingClientRect().height || DEFAULT_HEIGHT; 26534 setMaxHeight(height); 26535 } 26536 }); 26537 }); 26538 return resizeObserver.observe(contentRef.current), () => resizeObserver.disconnect(); 26539 } 26540 }, [isCollapsed]); 26541 let toggleCollapsed = useCallback((event, value) => { 26542 event?.stopPropagation(), setChangingCollapse(!0), setCollapsed((s2) => value ?? !s2), timeoutRef.current && clearTimeout(timeoutRef.current), timeoutRef.current = setTimeout(() => { 26543 setChangingCollapse(!1); 26544 }, 250); 26545 }, []), isRunning = Object.values(testProviderStates).some( 26546 (testProviderState) => testProviderState === "test-provider-state:running" 26547 ), isCrashed = Object.values(testProviderStates).some( 26548 (testProviderState) => testProviderState === "test-provider-state:crashed" 26549 ), hasTestProviders = Object.values(registeredTestProviders).length > 0; 26550 useEffect(() => { 26551 isCrashed && isCollapsed && toggleCollapsed(void 0, !1); 26552 }, [isCrashed, isCollapsed, toggleCollapsed]), useDynamicFavicon( 26553 isCrashed ? "critical" : errorCount > 0 ? "negative" : warningCount > 0 ? "warning" : isRunning ? "active" : successCount > 0 ? "positive" : void 0 26554 ); 26555 let cardRef = useRef(null), { landmarkProps } = useLandmark( 26556 { "aria-labelledby": "storybook-testing-widget-heading", role: "region" }, 26557 cardRef 26558 ); 26559 return !hasTestProviders && !errorCount && !warningCount ? null : react_default.createElement( 26560 HoverCard2, 26561 { 26562 id: "storybook-testing-module", 26563 "data-updated": isUpdated, 26564 outlineAnimation: isRunning ? "spin" : "none", 26565 outlineColor: isCrashed || isRunning && errorCount > 0 ? "negative" : isUpdated ? "positive" : void 0, 26566 ref: cardRef, 26567 outlineAttrs: landmarkProps 26568 }, 26569 react_default.createElement("h2", { id: "storybook-testing-widget-heading", className: "sb-sr-only" }, "Component tests"), 26570 react_default.createElement(Bar3, { ...hasTestProviders ? { onClick: (e2) => toggleCollapsed(e2) } : {} }, react_default.createElement(Action, null, hasTestProviders && react_default.createElement( 26571 Optional, 26572 { 26573 content: react_default.createElement(RunButton, { isRunning, onRunAll }, isRunning ? "Running..." : "Run tests"), 26574 fallback: react_default.createElement(RunButton, { isRunning, onRunAll }) 26575 } 26576 )), react_default.createElement(Filters, null, hasTestProviders && react_default.createElement( 26577 CollapseToggle3, 26578 { 26579 onClick: (e2) => toggleCollapsed(e2), 26580 id: "testing-module-collapse-toggle", 26581 ariaLabel: isCollapsed ? "Expand testing module" : "Collapse testing module" 26582 }, 26583 react_default.createElement( 26584 ChevronSmallUpIcon, 26585 { 26586 style: { 26587 transform: isCollapsed ? "none" : "rotate(180deg)", 26588 transition: "transform 250ms" 26589 } 26590 } 26591 ) 26592 ), errorCount > 0 && react_default.createElement( 26593 StatusButton2, 26594 { 26595 id: "errors-found-filter", 26596 size: "medium", 26597 variant: "ghost", 26598 padding: errorCount < 10 ? "medium" : "small", 26599 status: "negative", 26600 pressed: errorsActive, 26601 onClick: (e2) => { 26602 e2.stopPropagation(), setErrorsActive(!errorsActive); 26603 }, 26604 ariaLabel: `Filter main navigation to show ${errorCount} tests with errors`, 26605 tooltip: errorsActive ? "Clear test error filter" : `Filter sidebar to show ${errorCount} tests with errors` 26606 }, 26607 errorCount < 1e3 ? errorCount : "999+" 26608 ), warningCount > 0 && react_default.createElement( 26609 StatusButton2, 26610 { 26611 id: "warnings-found-filter", 26612 size: "medium", 26613 variant: "ghost", 26614 padding: warningCount < 10 ? "medium" : "small", 26615 status: "warning", 26616 pressed: warningsActive, 26617 onClick: (e2) => { 26618 e2.stopPropagation(), setWarningsActive(!warningsActive); 26619 }, 26620 ariaLabel: `Filter main navigation to show ${warningCount} tests with warnings`, 26621 tooltip: warningsActive ? "Clear test warning filter" : `Filter sidebar to show ${warningCount} tests with warnings` 26622 }, 26623 warningCount < 1e3 ? warningCount : "999+" 26624 ), hasStatuses && react_default.createElement( 26625 ActionList.Button, 26626 { 26627 id: "clear-statuses", 26628 onClick: (e2) => { 26629 e2.stopPropagation(), clearStatuses(); 26630 }, 26631 disabled: isRunning, 26632 ariaLabel: isRunning ? "Can't clear statuses while tests are running" : "Clear all statuses" 26633 }, 26634 react_default.createElement(SweepIcon, null) 26635 ))), 26636 hasTestProviders && react_default.createElement( 26637 Collapsible2, 26638 { 26639 "data-testid": "collapse", 26640 ...isCollapsed && { inert: "" }, 26641 style: { 26642 transition: isChangingCollapse ? "max-height 250ms" : "max-height 0ms", 26643 display: hasTestProviders ? "block" : "none", 26644 maxHeight: isCollapsed ? 0 : maxHeight 26645 } 26646 }, 26647 react_default.createElement(Content3, { ref: contentRef }, Object.values(registeredTestProviders).map((registeredTestProvider) => { 26648 let { render: Render, id } = registeredTestProvider; 26649 return Render ? react_default.createElement(TestProvider, { key: id, "data-module-id": id }, react_default.createElement(Render, null)) : (once.warn( 26650 `No render function found for test provider with id '${id}', skipping...` 26651 ), null); 26652 })) 26653 ) 26654 ); 26655}; 26656 26657// src/manager/components/sidebar/SidebarBottom.tsx 26658var SIDEBAR_BOTTOM_SPACER_ID = "sidebar-bottom-spacer", SIDEBAR_BOTTOM_WRAPPER_ID = "sidebar-bottom-wrapper", filterNone = () => !0, filterWarn = ({ statuses = {} }) => Object.values(statuses).some(({ value }) => value === "status-value:warning"), filterError = ({ statuses = {} }) => Object.values(statuses).some(({ value }) => value === "status-value:error"), filterBoth = ({ statuses = {} }) => Object.values(statuses).some( 26659 ({ value }) => ["status-value:warning", "status-value:error"].includes(value) 26660), getFilter = (warningsActive = !1, errorsActive = !1) => warningsActive && errorsActive ? filterBoth : warningsActive ? filterWarn : errorsActive ? filterError : filterNone, Spacer = styled.div({ 26661 pointerEvents: "none" 26662}), Content4 = styled.div(({ theme }) => ({ 26663 position: "absolute", 26664 zIndex: 1, 26665 bottom: 0, 26666 left: 0, 26667 right: 0, 26668 padding: 12, 26669 display: "flex", 26670 flexDirection: "column", 26671 gap: 12, 26672 color: theme.color.defaultText, 26673 fontSize: theme.typography.size.s1, 26674 "&:empty": { 26675 display: "none" 26676 }, 26677 "--card-box-shadow": `0 1px 2px 0 rgba(0, 0, 0, 0.05), 0px -5px 20px 10px ${theme.background.app}`, 26678 // Integrators can use these to style their custom additions 26679 "--sb-sidebar-bottom-card-background": theme.background.content, 26680 "--sb-sidebar-bottom-card-border": `1px solid ${theme.appBorderColor}`, 26681 "--sb-sidebar-bottom-card-border-radius": `${theme.appBorderRadius + 1}px`, 26682 "--sb-sidebar-bottom-card-box-shadow": `0 1px 2px 0 rgba(0, 0, 0, 0.05), 0px -5px 20px 10px ${theme.background.app}` 26683})), SidebarBottomBase = ({ 26684 api, 26685 notifications = [], 26686 errorCount, 26687 warningCount, 26688 successCount, 26689 hasStatuses, 26690 isDevelopment, 26691 testProviderStates, 26692 registeredTestProviders, 26693 onRunAll 26694}) => { 26695 let spacerRef = useRef(null), wrapperRef = useRef(null), [warningsActive, setWarningsActive] = useState(!1), [errorsActive, setErrorsActive] = useState(!1); 26696 return useEffect(() => { 26697 if (spacerRef.current && wrapperRef.current) { 26698 let resizeObserver = new ResizeObserver(() => { 26699 spacerRef.current && wrapperRef.current && (spacerRef.current.style.height = `${wrapperRef.current.scrollHeight}px`); 26700 }); 26701 return resizeObserver.observe(wrapperRef.current), () => resizeObserver.disconnect(); 26702 } 26703 }, []), useEffect(() => { 26704 let filter = getFilter(warningCount > 0 && warningsActive, errorCount > 0 && errorsActive); 26705 api.experimental_setFilters({ "sidebar-bottom-filter": filter }); 26706 }, [api, warningCount, errorCount, warningsActive, errorsActive]), !warningCount && !errorCount && Object.values(registeredTestProviders).length === 0 && notifications.length === 0 ? null : react_default.createElement(Fragment, null, react_default.createElement(Spacer, { id: SIDEBAR_BOTTOM_SPACER_ID, ref: spacerRef }), react_default.createElement(Content4, { id: SIDEBAR_BOTTOM_WRAPPER_ID, ref: wrapperRef }, react_default.createElement(NotificationList, { notifications, clearNotification: api.clearNotification }), isDevelopment && react_default.createElement( 26707 TestingWidget, 26708 { 26709 registeredTestProviders, 26710 testProviderStates, 26711 onRunAll: () => { 26712 onRunAll(), setErrorsActive(!1), setWarningsActive(!1); 26713 }, 26714 hasStatuses, 26715 clearStatuses: () => { 26716 api.clearStatuses(), setErrorsActive(!1), setWarningsActive(!1); 26717 }, 26718 errorCount, 26719 errorsActive, 26720 setErrorsActive, 26721 warningCount, 26722 warningsActive, 26723 setWarningsActive, 26724 successCount 26725 } 26726 ))); 26727}, SidebarBottom = ({ isDevelopment }) => { 26728 let api = useStorybookApi(), registeredTestProviders = api.getElements(Addon_TypesEnum.experimental_TEST_PROVIDER), { notifications } = useStorybookState(), { hasStatuses, errorCount, warningCount, successCount } = experimental_useStatusStore( 26729 (statuses) => Object.values(statuses).reduce( 26730 (result, storyStatuses) => (Object.values(storyStatuses).forEach((status) => { 26731 result.hasStatuses = !0, status.value === "status-value:error" && (result.errorCount += 1), status.value === "status-value:warning" && (result.warningCount += 1), status.value === "status-value:success" && (result.successCount += 1); 26732 }), result), 26733 { errorCount: 0, warningCount: 0, successCount: 0, hasStatuses: !1 } 26734 ) 26735 ), testProviderStates = experimental_useTestProviderStore(); 26736 return react_default.createElement( 26737 SidebarBottomBase, 26738 { 26739 api, 26740 notifications, 26741 hasStatuses, 26742 errorCount, 26743 warningCount, 26744 successCount, 26745 isDevelopment, 26746 testProviderStates, 26747 registeredTestProviders, 26748 onRunAll: internal_fullTestProviderStore.runAll 26749 } 26750 ); 26751}; 26752 26753// src/manager/components/sidebar/useLastViewed.ts 26754init_react(); 26755var import_store2 = __toESM(require_store2(), 1), save = debounce((value) => import_store2.default.set("lastViewedStoryIds", value), 1e3), useLastViewed = (selection) => { 26756 let initialLastViewedStoryIds = useMemo(() => { 26757 let items = import_store2.default.get("lastViewedStoryIds"); 26758 return !items || !Array.isArray(items) ? [] : items.some((item) => typeof item == "object" && item.storyId && item.refId) ? items : []; 26759 }, []), lastViewedRef = useRef(initialLastViewedStoryIds), updateLastViewed = useCallback( 26760 (story) => { 26761 let items = lastViewedRef.current, index = items.findIndex( 26762 ({ storyId, refId, anchor }) => storyId === story.storyId && refId === story.refId && anchor === story.anchor 26763 ); 26764 index !== 0 && (index === -1 ? lastViewedRef.current = [story, ...items] : lastViewedRef.current = [story, ...items.slice(0, index), ...items.slice(index + 1)], save(lastViewedRef.current)); 26765 }, 26766 [lastViewedRef] 26767 ); 26768 return useEffect(() => { 26769 selection && updateLastViewed(selection); 26770 }, [selection]), { 26771 getLastViewed: useCallback(() => lastViewedRef.current, [lastViewedRef]), 26772 clearLastViewed: useCallback(() => { 26773 lastViewedRef.current = lastViewedRef.current.slice(0, 1), save(lastViewedRef.current); 26774 }, [lastViewedRef]) 26775 }; 26776}; 26777 26778// src/manager/components/sidebar/Sidebar.tsx 26779var DEFAULT_REF_ID = "storybook_internal", Container11 = styled.header(({ theme }) => ({ 26780 position: "absolute", 26781 zIndex: 1, 26782 left: 0, 26783 top: 0, 26784 bottom: 0, 26785 right: 0, 26786 width: "100%", 26787 height: "100%", 26788 display: "flex", 26789 flexDirection: "column", 26790 background: theme.background.content, 26791 [MEDIA_DESKTOP_BREAKPOINT]: { 26792 background: theme.background.app 26793 } 26794})), Stack = styled.div({ 26795 display: "flex", 26796 flexDirection: "column", 26797 gap: 16, 26798 padding: "16px 12px 20px 12px" 26799}), CreateNewStoryButton = styled(Button)(({ theme, isMobile: isMobile2 }) => ({ 26800 color: theme.textMutedColor, 26801 width: isMobile2 ? 36 : 32, 26802 height: isMobile2 ? 36 : 32, 26803 borderRadius: theme.appBorderRadius + 2 26804})), useCombination = (index, indexError, previewInitialized, allStatuses, refs) => { 26805 let hash = useMemo( 26806 () => ({ 26807 [DEFAULT_REF_ID]: { 26808 index, 26809 filteredIndex: index, 26810 indexError, 26811 previewInitialized, 26812 allStatuses, 26813 title: null, 26814 id: DEFAULT_REF_ID, 26815 url: "iframe.html" 26816 }, 26817 ...refs 26818 }), 26819 [refs, index, indexError, previewInitialized, allStatuses] 26820 ); 26821 return useMemo(() => ({ hash, entries: Object.entries(hash) }), [hash]); 26822}, isRendererReact2 = scope.STORYBOOK_RENDERER === "react", Sidebar = react_default.memo(function({ 26823 // @ts-expect-error (non strict) 26824 storyId = null, 26825 refId = DEFAULT_REF_ID, 26826 anchor, 26827 index, 26828 indexJson, 26829 indexError, 26830 allStatuses, 26831 previewInitialized, 26832 menu, 26833 menuHighlighted = !1, 26834 enableShortcuts = !0, 26835 isDevelopment = scope.CONFIG_TYPE === "DEVELOPMENT", 26836 refs = {}, 26837 onMenuClick, 26838 showCreateStoryButton = isDevelopment && isRendererReact2 26839}) { 26840 let [isFileSearchModalOpen, setIsFileSearchModalOpen] = useState(!1), selected = useMemo( 26841 () => storyId ? { storyId, refId, anchor } : null, 26842 [storyId, refId, anchor] 26843 ), dataset = useCombination(index, indexError, previewInitialized, allStatuses, refs), isLoading = !index && !indexError, hasEntries = Object.keys(indexJson?.entries ?? {}).length > 0, lastViewedProps = useLastViewed(selected), { isMobile: isMobile2 } = useLayout(), api = useStorybookApi(), { viewMode } = api.getUrlState(), headerRef = useRef(null), { landmarkProps } = useLandmark( 26844 { "aria-labelledby": "global-site-h1", role: "banner" }, 26845 headerRef 26846 ), skipLinkHref = isPagesViewMode(viewMode) ? "#main-content-wrapper" : "#storybook-preview-wrapper", showReviewWidget = useActiveReviewStoryCount() > 0, showOnboardingChecklist = !isLoading && scope.CONFIG_TYPE === "DEVELOPMENT" && scope.FEATURES?.sidebarOnboardingChecklist !== !1 && !showReviewWidget; 26847 return react_default.createElement( 26848 Container11, 26849 { 26850 className: "container sidebar-container", 26851 id: focusableUIElements.sidebarRegion, 26852 ref: headerRef, 26853 ...landmarkProps 26854 }, 26855 react_default.createElement("h1", { id: "global-site-h1", className: "sb-sr-only" }, "Storybook"), 26856 react_default.createElement(IconSymbols, null), 26857 react_default.createElement(ScrollArea, { vertical: !0, offset: 3, scrollbarSize: 6, scrollPadding: "4rem" }, react_default.createElement(Stack, null, react_default.createElement("div", null, react_default.createElement( 26858 Heading2, 26859 { 26860 className: "sidebar-header", 26861 menuHighlighted, 26862 menu, 26863 skipLinkHref, 26864 isLoading, 26865 onMenuClick 26866 } 26867 ), showOnboardingChecklist ? react_default.createElement(ChecklistWidget, null) : null), !isLoading && showReviewWidget ? react_default.createElement(ReviewWidget_default, null) : null, react_default.createElement( 26868 Search, 26869 { 26870 dataset, 26871 enableShortcuts, 26872 searchBarContent: showCreateStoryButton && react_default.createElement(react_default.Fragment, null, react_default.createElement( 26873 CreateNewStoryButton, 26874 { 26875 isMobile: isMobile2, 26876 onClick: () => { 26877 setIsFileSearchModalOpen(!0); 26878 }, 26879 ariaLabel: "Create a new story", 26880 variant: "outline", 26881 padding: "small" 26882 }, 26883 react_default.createElement(PlusIcon, null) 26884 ), react_default.createElement( 26885 CreateNewStoryFileModal, 26886 { 26887 open: isFileSearchModalOpen, 26888 onOpenChange: setIsFileSearchModalOpen 26889 } 26890 )), 26891 searchFieldContent: react_default.createElement(Filter, null), 26892 ...lastViewedProps 26893 }, 26894 ({ 26895 query, 26896 results, 26897 isNavVisible, 26898 isNavReachable, 26899 isSearchResultRendered, 26900 closeMenu, 26901 getMenuProps, 26902 getItemProps, 26903 highlightedIndex 26904 }) => react_default.createElement(react_default.Fragment, null, react_default.createElement( 26905 Explorer, 26906 { 26907 dataset, 26908 selected, 26909 isLoading, 26910 isBrowsing: isNavVisible, 26911 isHidden: !isNavReachable, 26912 hasEntries 26913 } 26914 ), isSearchResultRendered && react_default.createElement( 26915 SearchResults, 26916 { 26917 query, 26918 results, 26919 closeMenu, 26920 getMenuProps, 26921 getItemProps, 26922 highlightedIndex, 26923 enableShortcuts, 26924 isLoading, 26925 clearLastViewed: lastViewedProps.clearLastViewed 26926 } 26927 )) 26928 )), isMobile2 || isLoading ? null : react_default.createElement(SidebarBottom, { isDevelopment })) 26929 ); 26930}); 26931 26932// src/manager/container/Menu.tsx 26933init_react(); 26934var ProgressCircle2 = styled(ProgressSpinner)(({ theme }) => ({ 26935 color: theme.color.secondary 26936})), useMenu = ({ 26937 api, 26938 showToolbar, 26939 isPanelShown, 26940 isNavShown, 26941 enableShortcuts 26942}) => { 26943 let shortcutKeys = api.getShortcutKeys(), { progress } = useChecklist(), about = useMemo( 26944 () => ({ 26945 id: "about", 26946 title: "About your Storybook", 26947 onClick: () => api.changeSettingsTab("about"), 26948 href: "./?path=/settings/about", 26949 internal: !0, 26950 closeOnClick: !0, 26951 icon: react_default.createElement(InfoIcon, null) 26952 }), 26953 [api] 26954 ), guide = useMemo( 26955 () => ({ 26956 id: "guide", 26957 title: "Onboarding guide", 26958 onClick: () => api.changeSettingsTab("guide"), 26959 href: "./?path=/settings/guide", 26960 internal: !0, 26961 closeOnClick: !0, 26962 icon: react_default.createElement(ListUnorderedIcon, null), 26963 right: progress < 100 && react_default.createElement(ActionList.Button, { as: "div", readOnly: !0, padding: "none", ariaLabel: `${progress}% completed` }, react_default.createElement(ProgressCircle2, { percentage: progress, running: !1, size: 16, width: 1.5 }), progress, "%") 26964 }), 26965 [api, progress] 26966 ), shortcuts = useMemo( 26967 () => ({ 26968 id: "shortcuts", 26969 title: "Keyboard shortcuts", 26970 onClick: () => api.changeSettingsTab("shortcuts"), 26971 href: "./?path=/settings/shortcuts", 26972 internal: !0, 26973 closeOnClick: !0, 26974 right: enableShortcuts ? react_default.createElement(Shortcut, { keys: shortcutKeys.shortcutsPage }) : null, 26975 icon: react_default.createElement(CommandIcon, null) 26976 }), 26977 [api, enableShortcuts, shortcutKeys.shortcutsPage] 26978 ), sidebarToggle = useMemo( 26979 () => ({ 26980 id: "S", 26981 title: "Show sidebar", 26982 onClick: () => api.toggleNav(), 26983 closeOnClick: !0, 26984 active: isNavShown, 26985 right: enableShortcuts ? react_default.createElement(Shortcut, { keys: shortcutKeys.toggleNav }) : null, 26986 icon: isNavShown ? react_default.createElement(CheckIcon, null) : react_default.createElement(react_default.Fragment, null) 26987 }), 26988 [api, enableShortcuts, shortcutKeys, isNavShown] 26989 ), toolbarToogle = useMemo( 26990 () => ({ 26991 id: "T", 26992 title: "Show toolbar", 26993 onClick: () => api.toggleToolbar(), 26994 active: showToolbar, 26995 right: enableShortcuts ? react_default.createElement(Shortcut, { keys: shortcutKeys.toolbar }) : null, 26996 icon: showToolbar ? react_default.createElement(CheckIcon, null) : react_default.createElement(react_default.Fragment, null) 26997 }), 26998 [api, enableShortcuts, shortcutKeys, showToolbar] 26999 ), addonsToggle = useMemo( 27000 () => ({ 27001 id: "A", 27002 title: "Show addons panel", 27003 onClick: () => api.togglePanel(), 27004 active: isPanelShown, 27005 right: enableShortcuts ? react_default.createElement(Shortcut, { keys: shortcutKeys.togglePanel }) : null, 27006 icon: isPanelShown ? react_default.createElement(CheckIcon, null) : react_default.createElement(react_default.Fragment, null) 27007 }), 27008 [api, enableShortcuts, shortcutKeys, isPanelShown] 27009 ), up = useMemo( 27010 () => ({ 27011 id: "up", 27012 title: "Previous component", 27013 onClick: () => api.jumpToComponent(-1), 27014 right: enableShortcuts ? react_default.createElement(Shortcut, { keys: shortcutKeys.prevComponent }) : null, 27015 icon: react_default.createElement(react_default.Fragment, null) 27016 }), 27017 [api, enableShortcuts, shortcutKeys] 27018 ), down = useMemo( 27019 () => ({ 27020 id: "down", 27021 title: "Next component", 27022 onClick: () => api.jumpToComponent(1), 27023 right: enableShortcuts ? react_default.createElement(Shortcut, { keys: shortcutKeys.nextComponent }) : null, 27024 icon: react_default.createElement(react_default.Fragment, null) 27025 }), 27026 [api, enableShortcuts, shortcutKeys] 27027 ), prev = useMemo( 27028 () => ({ 27029 id: "prev", 27030 title: "Previous story", 27031 onClick: () => api.jumpToStory(-1), 27032 right: enableShortcuts ? react_default.createElement(Shortcut, { keys: shortcutKeys.prevStory }) : null, 27033 icon: react_default.createElement(react_default.Fragment, null) 27034 }), 27035 [api, enableShortcuts, shortcutKeys] 27036 ), next = useMemo( 27037 () => ({ 27038 id: "next", 27039 title: "Next story", 27040 onClick: () => api.jumpToStory(1), 27041 right: enableShortcuts ? react_default.createElement(Shortcut, { keys: shortcutKeys.nextStory }) : null, 27042 icon: react_default.createElement(react_default.Fragment, null) 27043 }), 27044 [api, enableShortcuts, shortcutKeys] 27045 ), collapse = useMemo( 27046 () => ({ 27047 id: "collapse", 27048 title: "Collapse all", 27049 onClick: () => api.emit(STORIES_COLLAPSE_ALL), 27050 right: enableShortcuts ? react_default.createElement(Shortcut, { keys: shortcutKeys.collapseAll }) : null, 27051 icon: react_default.createElement(react_default.Fragment, null) 27052 }), 27053 [api, enableShortcuts, shortcutKeys] 27054 ), documentation = useMemo(() => ({ 27055 id: "documentation", 27056 title: "Documentation", 27057 closeOnClick: !0, 27058 href: api.getDocsUrl({ versioned: !0, renderer: !0 }), 27059 right: react_default.createElement(ActionList.Icon, null, react_default.createElement(ShareAltIcon, null)), 27060 icon: react_default.createElement(DocumentIcon, null) 27061 }), [api]), getAddonsShortcuts = useCallback(() => { 27062 let addonsShortcuts = api.getAddonsShortcuts(), keys = shortcutKeys; 27063 return Object.entries(addonsShortcuts).filter(([_2, { showInMenu }]) => showInMenu).map(([actionName, { label, action }]) => ({ 27064 id: actionName, 27065 title: label, 27066 onClick: () => action(), 27067 right: enableShortcuts && keys[actionName] ? react_default.createElement(Shortcut, { keys: keys[actionName] }) : null 27068 })); 27069 }, [api, enableShortcuts, shortcutKeys]); 27070 return useMemo( 27071 () => [ 27072 [ 27073 about, 27074 ...scope.CONFIG_TYPE === "DEVELOPMENT" && scope.FEATURES?.menuOnboardingChecklist !== !1 ? [guide] : [], 27075 ...enableShortcuts ? [shortcuts] : [] 27076 ], 27077 [sidebarToggle, toolbarToogle, addonsToggle, up, down, prev, next, collapse], 27078 getAddonsShortcuts(), 27079 [documentation] 27080 ], 27081 [ 27082 about, 27083 guide, 27084 documentation, 27085 shortcuts, 27086 sidebarToggle, 27087 toolbarToogle, 27088 addonsToggle, 27089 up, 27090 down, 27091 prev, 27092 next, 27093 collapse, 27094 getAddonsShortcuts, 27095 enableShortcuts 27096 ] 27097 ); 27098}; 27099 27100// src/manager/container/Sidebar.tsx 27101var Sidebar3 = react_default.memo(function({ onMenuClick }) { 27102 return react_default.createElement(Consumer, { filter: ({ state, api }) => { 27103 let { 27104 ui: { name, url, enableShortcuts }, 27105 viewMode, 27106 storyId, 27107 refId, 27108 location: location2, 27109 layout: { showToolbar }, 27110 // FIXME: This is the actual `index.json` index where the `index` below 27111 // is actually the stories hash. We should fix this up and make it consistent. 27112 internal_index, 27113 filteredIndex: index, 27114 indexError, 27115 previewInitialized, 27116 refs 27117 } = state, whatsNewNotificationsEnabled = state.whatsNewData?.status === "SUCCESS" && !state.disableWhatsNewNotifications; 27118 return { 27119 api, 27120 title: name, 27121 url, 27122 indexJson: internal_index, 27123 index, 27124 indexError, 27125 previewInitialized, 27126 refs, 27127 storyId, 27128 refId, 27129 anchor: location2?.hash ? location2.hash.slice(1) : void 0, 27130 viewMode, 27131 showToolbar, 27132 isPanelShown: api.getIsPanelShown(), 27133 isNavShown: api.getIsNavShown(), 27134 menuHighlighted: whatsNewNotificationsEnabled && api.isWhatsNewUnread(), 27135 enableShortcuts 27136 }; 27137 } }, ({ api, showToolbar, isPanelShown, isNavShown, enableShortcuts, ...state }) => { 27138 let menu = useMenu({ api, showToolbar, isPanelShown, isNavShown, enableShortcuts }), allStatuses = experimental_useStatusStore(); 27139 return react_default.createElement( 27140 Sidebar, 27141 { 27142 ...state, 27143 menu, 27144 onMenuClick, 27145 allStatuses, 27146 enableShortcuts 27147 } 27148 ); 27149 }); 27150}), Sidebar_default = Sidebar3; 27151 27152// src/manager/App.tsx 27153var MainPreview = () => { 27154 let { isSummaryVisible } = useReviewContext(); 27155 return isSummaryVisible ? null : react_default.createElement(Preview_default, { id: "main", withLoader: !0 }); 27156}, App = ({ managerLayoutState, setManagerLayoutState, pages, hasTab }) => { 27157 let { setMobileAboutOpen } = useLayout(), { enableShortcuts = !0 } = addons.getConfig(); 27158 useEffect(() => { 27159 document.body.setAttribute("data-shortcuts-enabled", enableShortcuts ? "true" : "false"); 27160 }, [enableShortcuts]), useEffect(() => { 27161 let rootElement = document.getElementById("root"); 27162 if (!rootElement) 27163 return; 27164 let observer = new MutationObserver(() => { 27165 let hasInert = rootElement.hasAttribute("inert"); 27166 addons.getChannel().emit(core_events_default.MANAGER_INERT_ATTRIBUTE_CHANGED, hasInert); 27167 }); 27168 return observer.observe(rootElement, { 27169 attributes: !0, 27170 attributeFilter: ["inert"] 27171 }), () => observer.disconnect(); 27172 }, []); 27173 let isReviewEnabled = isReviewFeatureEnabled(scope.FEATURES), layout = react_default.createElement( 27174 Layout, 27175 { 27176 hasTab, 27177 managerLayoutState, 27178 setManagerLayoutState, 27179 slotOverlay: isReviewEnabled ? react_default.createElement(ReviewPersistentLayer, null) : void 0, 27180 slotMain: react_default.createElement(MainPreview, null), 27181 slotSidebar: react_default.createElement(Sidebar_default, { onMenuClick: () => setMobileAboutOpen((state) => !state) }), 27182 slotPanel: react_default.createElement(Panel_default, null), 27183 slotPages: pages.map(({ id, render: Content6 }) => react_default.createElement(Content6, { key: id })) 27184 } 27185 ); 27186 return react_default.createElement(react_default.Fragment, null, react_default.createElement(Global, { styles: createGlobal }), react_default.createElement(ManagerErrorBoundary, null, isReviewEnabled ? react_default.createElement(ReviewProvider, null, layout) : layout)); 27187}; 27188 27189// src/manager/provider.ts 27190var Provider2 = class { 27191 getElements(_type) { 27192 throw new Error("Provider.getElements() is not implemented!"); 27193 } 27194 handleAPI(_api) { 27195 throw new Error("Provider.handleAPI() is not implemented!"); 27196 } 27197 getConfig() { 27198 return console.error("Provider.getConfig() is not implemented!"), {}; 27199 } 27200}; 27201 27202// src/manager/settings/index.tsx 27203init_react(); 27204 27205// src/manager/settings/AboutPage.tsx 27206init_react(); 27207 27208// src/manager/settings/About.tsx 27209init_react(); 27210var Container12 = styled.div({ 27211 display: "flex", 27212 alignItems: "center", 27213 flexDirection: "column", 27214 marginTop: 40 27215}), Header = styled.header({ 27216 marginBottom: 32, 27217 alignItems: "center", 27218 display: "flex", 27219 "> svg": { 27220 height: 48, 27221 width: "auto", 27222 marginRight: 8 27223 } 27224}), Footer2 = styled.div(({ theme }) => ({ 27225 marginBottom: 24, 27226 display: "flex", 27227 flexDirection: "column", 27228 alignItems: "center", 27229 color: theme.base === "light" ? theme.color.dark : theme.color.lightest, 27230 fontWeight: theme.typography.weight.regular, 27231 fontSize: theme.typography.size.s2 27232})), Actions3 = styled.div({ 27233 display: "flex", 27234 flexDirection: "row", 27235 alignItems: "center", 27236 marginBottom: 24, 27237 marginTop: 24, 27238 gap: 16 27239}), StyledLink = styled(Link)(({ theme }) => ({ 27240 "&&": { 27241 fontWeight: theme.typography.weight.bold, 27242 color: theme.base === "light" ? theme.color.dark : theme.color.light 27243 }, 27244 "&:hover": { 27245 color: theme.base === "light" ? theme.color.darkest : theme.color.lightest 27246 } 27247})), AboutScreen = ({ onNavigateToWhatsNew }) => react_default.createElement(Container12, null, react_default.createElement(Header, null, react_default.createElement(StorybookLogo, { alt: "Storybook" })), react_default.createElement(UpgradeBlock, { onNavigateToWhatsNew }), react_default.createElement(Footer2, null, react_default.createElement(Actions3, null, react_default.createElement(Button, { ariaLabel: !1, asChild: !0 }, react_default.createElement("a", { href: "https://github.com/storybookjs/storybook" }, react_default.createElement(GithubIcon, null), "GitHub")), react_default.createElement(Button, { ariaLabel: !1, asChild: !0 }, react_default.createElement("a", { href: "https://storybook.js.org/docs?ref=ui" }, react_default.createElement(DocumentIcon, { style: { display: "inline", marginRight: 5 } }), "Documentation"))), react_default.createElement("div", null, "Open source software maintained by", " ", react_default.createElement(StyledLink, { href: "https://www.chromatic.com/" }, "Chromatic"), " and the", " ", react_default.createElement(StyledLink, { href: "https://github.com/storybookjs/storybook/graphs/contributors" }, "Storybook Community")))); 27248 27249// src/manager/settings/AboutPage.tsx 27250var NotificationClearer = class extends Component { 27251 componentDidMount() { 27252 let { api, notificationId } = this.props; 27253 api.clearNotification(notificationId); 27254 } 27255 render() { 27256 let { children } = this.props; 27257 return children; 27258 } 27259}, AboutPage = () => { 27260 let api = useStorybookApi(), state = useStorybookState(), onNavigateToWhatsNew = useCallback(() => { 27261 api.changeSettingsTab("whats-new"); 27262 }, [api]); 27263 return react_default.createElement(NotificationClearer, { api, notificationId: "update" }, react_default.createElement( 27264 AboutScreen, 27265 { 27266 onNavigateToWhatsNew: state.whatsNewData?.status === "SUCCESS" ? onNavigateToWhatsNew : void 0 27267 } 27268 )); 27269}; 27270 27271// src/manager/settings/GuidePage.tsx 27272init_react(); 27273 27274// src/manager/settings/Checklist/Checklist.tsx 27275init_react(); 27276 27277// src/manager/components/Focus/Focus.tsx 27278init_react(); 27279var FocusOutline = styled.div( 27280 ({ theme, active = !1, outlineOffset = 0 }) => ({ 27281 width: "100%", 27282 borderRadius: "inherit", 27283 transition: "outline-color var(--transition-duration, 0.2s)", 27284 outline: `2px solid ${active ? theme.color.secondary : "transparent"}`, 27285 outlineOffset 27286 }) 27287), FocusProxy = styled(FocusOutline)(({ theme, targetId }) => ({ 27288 [`&:has([data-target-id="${targetId}"]:focus-visible)`]: { 27289 outlineColor: theme.color.secondary 27290 } 27291})), FocusRing = ({ 27292 active = !1, 27293 highlightDuration, 27294 nodeRef, 27295 ...props 27296}) => { 27297 let [visible, setVisible] = useState(active); 27298 return useEffect(() => { 27299 if (highlightDuration) { 27300 setVisible(active); 27301 let timeout = setTimeout(setVisible, highlightDuration, !1); 27302 return () => clearTimeout(timeout); 27303 } 27304 }, [active, highlightDuration]), react_default.createElement(FocusOutline, { ...props, active: highlightDuration ? visible : active, ref: nodeRef }); 27305}, FocusTarget = ({ 27306 targetHash, 27307 highlightDuration, 27308 ...props 27309}) => { 27310 let nodeRef = useRef(null), locationHash = useLocationHash(), [active, setActive] = useState(locationHash === targetHash); 27311 return useEffect(() => { 27312 let timeouts = []; 27313 return setActive(!1), locationHash === targetHash && (timeouts.push( 27314 setTimeout(() => { 27315 setActive(!0), nodeRef.current?.focus({ preventScroll: !0 }), nodeRef.current?.scrollIntoView({ behavior: "smooth", block: "center" }); 27316 }, 0) 27317 ), highlightDuration && timeouts.push(setTimeout(setActive, highlightDuration, !1))), () => timeouts.forEach(clearTimeout); 27318 }, [locationHash, targetHash, highlightDuration]), react_default.createElement(FocusRing, { ...props, active, nodeRef, tabIndex: -1 }); 27319}, Focus = { 27320 Outline: FocusOutline, 27321 Proxy: FocusProxy, 27322 Ring: FocusRing, 27323 Target: FocusTarget 27324}; 27325 27326// src/manager/settings/Checklist/Checklist.tsx 27327var Sections = styled.ol(({ theme }) => ({ 27328 listStyle: "none", 27329 display: "flex", 27330 flexDirection: "column", 27331 gap: 20, 27332 margin: 0, 27333 padding: 0, 27334 "& > li": { 27335 background: theme.background.content, 27336 border: `1px solid ${theme.base === "dark" ? theme.color.darker : theme.color.border}`, 27337 borderRadius: 8 27338 } 27339})), Items = styled.ol(({ theme }) => ({ 27340 listStyle: "none", 27341 display: "flex", 27342 flexDirection: "column", 27343 margin: 0, 27344 padding: 0, 27345 "& > li:not(:last-child)": { 27346 boxShadow: `inset 0 -1px 0 ${theme.base === "dark" ? theme.color.darker : theme.color.border}` 27347 }, 27348 "& > li:last-child": { 27349 borderBottomLeftRadius: 7, 27350 borderBottomRightRadius: 7 27351 } 27352})), SectionSummary = styled.div( 27353 ({ theme, progress, isCollapsed, onClick }) => ({ 27354 position: "relative", 27355 fontWeight: "bold", 27356 display: "flex", 27357 alignItems: "center", 27358 gap: 10, 27359 padding: "10px 10px 10px 15px", 27360 borderBottom: `5px solid ${theme.base === "dark" ? theme.color.darker : theme.color.light}`, 27361 borderBottomLeftRadius: isCollapsed ? 7 : 0, 27362 borderBottomRightRadius: isCollapsed ? 7 : 0, 27363 transition: "border-radius var(--transition-duration, 0.2s)", 27364 cursor: onClick ? "pointer" : "default", 27365 "--toggle-button-rotate": isCollapsed ? "0deg" : "180deg", 27366 "--toggle-button-opacity": 0, 27367 "&:hover, &:focus-visible": { 27368 outline: "none", 27369 "--toggle-button-opacity": 1 27370 }, 27371 "&::after": { 27372 pointerEvents: "none", 27373 position: "absolute", 27374 top: 0, 27375 bottom: -5, 27376 left: 0, 27377 right: 0, 27378 content: '""', 27379 display: "block", 27380 width: `${progress}%`, 27381 borderBottom: `5px solid ${theme.color.positive}`, 27382 borderBottomLeftRadius: "inherit", 27383 borderBottomRightRadius: progress === 100 ? "inherit" : 0, 27384 transition: "width var(--transition-duration, 0.2s)" 27385 } 27386 }) 27387), SectionHeading = styled.h2(({ theme }) => ({ 27388 flex: 1, 27389 margin: 0, 27390 fontSize: theme.typography.size.s3, 27391 fontWeight: theme.typography.weight.bold 27392})), ItemSummary = styled.div( 27393 ({ theme, isCollapsed, onClick }) => ({ 27394 fontWeight: theme.typography.weight.regular, 27395 fontSize: theme.typography.size.s2, 27396 display: "flex", 27397 alignItems: "center", 27398 minHeight: 40, 27399 gap: 10, 27400 padding: isCollapsed ? "6px 10px 6px 15px" : "10px 10px 10px 15px", 27401 transition: "padding var(--transition-duration, 0.2s)", 27402 cursor: onClick ? "pointer" : "default", 27403 "--toggle-button-rotate": isCollapsed ? "0deg" : "180deg", 27404 "&:focus-visible": { 27405 outline: "none" 27406 } 27407 }) 27408), ItemHeading = styled.h3(({ theme, skipped }) => ({ 27409 flex: 1, 27410 margin: 0, 27411 color: skipped ? theme.textMutedColor : theme.color.defaultText, 27412 overflow: "hidden", 27413 textOverflow: "ellipsis", 27414 whiteSpace: "nowrap", 27415 fontSize: theme.typography.size.s2, 27416 fontWeight: theme.typography.weight.bold 27417})), ItemContent2 = styled.div(({ theme }) => ({ 27418 display: "flex", 27419 flexDirection: "column", 27420 alignItems: "flex-start", 27421 gap: 8, 27422 padding: "0 15px 15px 41px", 27423 fontSize: theme.typography.size.s2, 27424 code: { 27425 fontSize: "0.9em", 27426 backgroundColor: theme.background.app, 27427 borderRadius: theme.appBorderRadius, 27428 padding: "1px 3px" 27429 }, 27430 img: { 27431 maxWidth: "100%", 27432 margin: "15px auto" 27433 }, 27434 p: { 27435 margin: 0, 27436 lineHeight: 1.4 27437 }, 27438 "ol, ul": { 27439 paddingLeft: 25, 27440 listStyleType: "disc", 27441 "li::marker": { 27442 color: theme.color.mediumdark 27443 } 27444 } 27445})), StatusIcon3 = styled.div(({ theme }) => ({ 27446 position: "relative", 27447 flex: "0 0 auto", 27448 minHeight: 16, 27449 minWidth: 16, 27450 margin: 0, 27451 background: theme.base === "dark" ? theme.color.darkest : theme.background.app, 27452 borderRadius: 9, 27453 outline: `1px solid ${theme.base === "dark" ? theme.color.darker : theme.color.border}`, 27454 outlineOffset: -1 27455})), Checked2 = styled(StatusPassIcon)( 27456 ({ theme, "data-visible": visible }) => ({ 27457 position: "absolute", 27458 width: "inherit", 27459 height: "inherit", 27460 top: 0, 27461 left: 0, 27462 bottom: 0, 27463 right: 0, 27464 padding: 1, 27465 borderRadius: "50%", 27466 background: theme.color.positive, 27467 color: theme.background.content, 27468 opacity: visible ? 1 : 0, 27469 transform: visible ? "scale(1)" : "scale(0.7)", 27470 transition: "all var(--transition-duration, 0.2s)" 27471 }) 27472), Skipped = styled.span(({ theme, visible }) => ({ 27473 display: "flex", 27474 alignItems: "center", 27475 color: theme.textMutedColor, 27476 fontSize: "12px", 27477 fontWeight: "bold", 27478 overflow: "hidden", 27479 padding: visible ? "0 10px" : 0, 27480 opacity: visible ? 1 : 0, 27481 width: visible ? "auto" : 0, 27482 height: visible ? 18 : 16, 27483 transition: "all var(--transition-duration, 0.2s)" 27484})), Actions4 = styled.div({ 27485 alignSelf: "flex-end", 27486 flexDirection: "row-reverse", 27487 display: "flex", 27488 gap: 4 27489}), ToggleButton2 = styled(Button)({ 27490 opacity: "var(--toggle-button-opacity)", 27491 transition: "opacity var(--transition-duration, 0.2s)", 27492 "&:hover, &:focus": { 27493 opacity: 1 27494 }, 27495 svg: { 27496 transform: "rotate(var(--toggle-button-rotate))", 27497 transition: "transform var(--transition-duration, 0.2s)" 27498 } 27499}), ChecklistCopyButton = ({ 27500 label, 27501 copyContent, 27502 onClick 27503}) => { 27504 let { children: copyChildren, buttonProps: copyButtonProps } = useCopyButton2({ 27505 children: label, 27506 onCopy: onClick, 27507 content: copyContent 27508 }); 27509 return react_default.createElement(Button, { variant: "solid", size: "small", ...copyButtonProps }, copyChildren); 27510}, Checklist = ({ 27511 availableItems, 27512 accept, 27513 skip, 27514 reset, 27515 forceCollapsed = !1 27516}) => { 27517 let api = useStorybookApi(), locationHash = useLocationHash(), { itemsById, sectionsById } = useMemo( 27518 () => availableItems.reduce( 27519 (acc, item) => { 27520 acc.itemsById[item.id] = item; 27521 let { sectionId: id, sectionTitle: title2 } = item; 27522 return acc.sectionsById[id] = acc.sectionsById[id] ?? { id, title: title2, itemIds: [] }, acc.sectionsById[id].itemIds.push(item.id), acc; 27523 }, 27524 { itemsById: {}, sectionsById: {} } 27525 ), 27526 [availableItems] 27527 ), sections = useMemo( 27528 () => Object.values(sectionsById).map(({ id, title: title2, itemIds }) => { 27529 let items = itemIds.map((id2) => itemsById[id2]).filter(({ showOnGuidePage }) => showOnGuidePage !== !1), progress = items.reduce((acc, item) => item.isOpen ? acc : acc + 1, 0) / items.length * 100; 27530 return { id, title: title2, items, progress }; 27531 }), 27532 [itemsById, sectionsById] 27533 ); 27534 return react_default.createElement(Sections, null, sections.map(({ id, title: title2, items, progress }) => { 27535 let collapsed = forceCollapsed || progress === 100 && items.every((item) => item.id !== locationHash); 27536 return react_default.createElement("li", { key: id }, react_default.createElement(Focus.Proxy, { targetId: `toggle-${id}` }, react_default.createElement( 27537 Collapsible, 27538 { 27539 collapsed, 27540 summary: ({ isCollapsed, toggleCollapsed, toggleProps }) => react_default.createElement( 27541 SectionSummary, 27542 { 27543 progress, 27544 isCollapsed, 27545 onClick: toggleCollapsed 27546 }, 27547 react_default.createElement(StatusIcon3, null, react_default.createElement(Checked2, { "data-visible": progress === 100 })), 27548 react_default.createElement(SectionHeading, null, title2), 27549 react_default.createElement(Actions4, null, react_default.createElement( 27550 ToggleButton2, 27551 { 27552 ...toggleProps, 27553 "data-target-id": `toggle-${id}`, 27554 variant: "ghost", 27555 padding: "small", 27556 "aria-label": title2 27557 }, 27558 react_default.createElement(ChevronSmallDownIcon, null) 27559 )) 27560 ) 27561 }, 27562 react_default.createElement(Items, null, items.map( 27563 ({ 27564 content, 27565 isOpen, 27566 isAccepted, 27567 isDone, 27568 isLockedBy, 27569 isImmutable, 27570 isSkipped, 27571 ...item 27572 }) => { 27573 let isChecked = isAccepted || isDone, isCollapsed = item.id !== locationHash, isLocked = !!isLockedBy, itemContent = content?.({ api }); 27574 return react_default.createElement(ActionList.Item, { key: item.id }, react_default.createElement( 27575 Focus.Target, 27576 { 27577 targetHash: item.id, 27578 highlightDuration: 2e3, 27579 outlineOffset: -2 27580 }, 27581 react_default.createElement(Focus.Proxy, { targetId: `toggle-${item.id}`, outlineOffset: -2 }, react_default.createElement( 27582 Collapsible, 27583 { 27584 collapsed: isCollapsed, 27585 summary: ({ isCollapsed: isCollapsed2, toggleCollapsed, toggleProps }) => react_default.createElement( 27586 ItemSummary, 27587 { 27588 isCollapsed: isCollapsed2 || !itemContent, 27589 onClick: itemContent ? toggleCollapsed : void 0 27590 }, 27591 react_default.createElement(StatusIcon3, null, react_default.createElement(Checked2, { "data-visible": isChecked }), react_default.createElement(Skipped, { visible: isSkipped }, "Skipped")), 27592 react_default.createElement(ItemHeading, { skipped: isSkipped }, item.label), 27593 react_default.createElement(Actions4, null, itemContent && react_default.createElement( 27594 ToggleButton2, 27595 { 27596 ...toggleProps, 27597 "data-target-id": `toggle-${item.id}`, 27598 variant: "ghost", 27599 padding: "small", 27600 ariaLabel: `${isCollapsed2 ? "Expand" : "Collapse"} ${item.label}` 27601 }, 27602 react_default.createElement(ChevronSmallDownIcon, null) 27603 ), isLocked && react_default.createElement( 27604 Button, 27605 { 27606 variant: "ghost", 27607 padding: "small", 27608 ariaLabel: "Locked", 27609 tooltip: `Complete \u201C${itemsById[isLockedBy].label}\u201D first`, 27610 disabled: !0, 27611 readOnly: !0 27612 }, 27613 react_default.createElement(LockIcon, null) 27614 ), isOpen && !isLocked && item.action && (item.action.copyContent ? react_default.createElement( 27615 ChecklistCopyButton, 27616 { 27617 label: item.action.label, 27618 copyContent: item.action.copyContent, 27619 onClick: () => item.action.onClick({ 27620 api, 27621 accept: () => accept(item.id) 27622 }) 27623 } 27624 ) : react_default.createElement( 27625 Button, 27626 { 27627 ariaLabel: !1, 27628 variant: "solid", 27629 size: "small", 27630 onClick: (e2) => { 27631 e2.stopPropagation(), item.action?.onClick({ 27632 api, 27633 accept: () => accept(item.id) 27634 }); 27635 } 27636 }, 27637 item.action.label 27638 )), isOpen && !isLocked && !item.action && !item.subscribe && react_default.createElement( 27639 Button, 27640 { 27641 ariaLabel: !1, 27642 variant: "outline", 27643 size: "small", 27644 onClick: (e2) => { 27645 e2.stopPropagation(), accept(item.id); 27646 } 27647 }, 27648 react_default.createElement(CheckIcon, null), 27649 "Mark as complete" 27650 ), isOpen && !isLocked && react_default.createElement( 27651 Button, 27652 { 27653 ariaLabel: !1, 27654 variant: "ghost", 27655 size: "small", 27656 onClick: (e2) => { 27657 e2.stopPropagation(), skip(item.id); 27658 } 27659 }, 27660 "Skip" 27661 ), (isAccepted && !isImmutable || isSkipped) && !isLocked && react_default.createElement( 27662 Button, 27663 { 27664 ariaLabel: "Undo", 27665 variant: "ghost", 27666 padding: "small", 27667 onClick: (e2) => { 27668 e2.stopPropagation(), reset(item.id); 27669 } 27670 }, 27671 react_default.createElement(UndoIcon, null) 27672 )) 27673 ) 27674 }, 27675 itemContent && react_default.createElement(ItemContent2, null, itemContent) 27676 )) 27677 )); 27678 } 27679 )) 27680 ))); 27681 })); 27682}; 27683 27684// src/manager/settings/Checklist/AiSetupBlock.tsx 27685init_react(); 27686var AiCtaCard = styled.div(({ theme }) => ({ 27687 display: "flex", 27688 flexDirection: "column", 27689 padding: "10px 10px 10px 15px", 27690 border: `1px solid ${theme.base === "dark" ? theme.color.darker : theme.color.border}`, 27691 borderRadius: 8, 27692 background: theme.background.content 27693})), AiCtaHeadingRow = styled.div({ 27694 display: "flex", 27695 alignItems: "center", 27696 gap: 10 27697}), AiCtaHeading = styled.h2(({ theme, $skipped }) => ({ 27698 flex: 1, 27699 margin: 0, 27700 color: $skipped ? theme.textMutedColor : theme.color.defaultText, 27701 fontSize: theme.typography.size.s2, 27702 fontWeight: theme.typography.weight.bold, 27703 textWrap: "pretty" 27704})), AiCtaDescription = styled.p(({ theme }) => ({ 27705 margin: 0, 27706 color: theme.color.defaultText, 27707 fontSize: theme.typography.size.s2, 27708 fontWeight: theme.typography.weight.regular, 27709 marginTop: 8 27710})), AiCtaActions = styled.div({ 27711 display: "flex", 27712 gap: 8, 27713 justifyContent: "flex-end", 27714 marginTop: 12 27715}), CopyButton3 = ({ api }) => { 27716 let { children: buttonChildren, buttonProps } = useCopyButton2({ 27717 children: "Copy prompt", 27718 childrenOnCopy: react_default.createElement(react_default.Fragment, null, react_default.createElement(CheckIcon, null), " Copied!"), 27719 content: getAiSetupPrompt(), 27720 onCopy: () => { 27721 api.emit(AI_PROMPT_NUDGE, { id: "setup", origin: "onboarding-guide-page" }); 27722 } 27723 }); 27724 return react_default.createElement(Button, { variant: "solid", size: "medium", ...buttonProps }, buttonChildren); 27725}, AiSetupBlock = ({ 27726 item, 27727 reset, 27728 skip 27729}) => { 27730 let api = useStorybookApi(); 27731 return !item.isDone && !item.isAccepted && !item.isCompleted ? react_default.createElement(AiCtaCard, null, react_default.createElement(AiCtaHeadingRow, null, item.isSkipped && react_default.createElement(StatusIcon3, null, react_default.createElement(Skipped, { visible: !0 }, "Skipped")), react_default.createElement(AiCtaHeading, { $skipped: item.isSkipped }, "Set up Storybook with AI"), item.isSkipped && react_default.createElement(Button, { ariaLabel: "Undo", variant: "ghost", padding: "small", onClick: () => reset(item.id) }, react_default.createElement(UndoIcon, null))), react_default.createElement(Collapsible.Content, { collapsed: item.isSkipped }, react_default.createElement(AiCtaDescription, null, "Run a prompt in your AI agent to analyze your codebase, configure decorators and mocks, write sample stories for your UI components, and verify everything works."), react_default.createElement(AiCtaActions, null, react_default.createElement(Button, { variant: "ghost", size: "medium", ariaLabel: !1, onClick: () => skip(item.id) }, "Skip"), react_default.createElement(CopyButton3, { api })))) : null; 27732}; 27733 27734// src/manager/settings/GuidePage.tsx 27735var Container13 = styled.div(({ theme }) => ({ 27736 display: "flex", 27737 flexDirection: "column", 27738 maxWidth: 600, 27739 margin: "0 auto", 27740 padding: "48px 20px", 27741 gap: 32, 27742 fontSize: theme.typography.size.s2, 27743 "--transition-duration": "0.2s" 27744})), Intro = styled.div(({ theme }) => ({ 27745 display: "flex", 27746 flexDirection: "column", 27747 gap: 8, 27748 "& h1": { 27749 fontSize: theme.typography.size.m3, 27750 fontWeight: theme.typography.weight.bold, 27751 margin: 0 27752 }, 27753 "& > p": { 27754 margin: 0 27755 } 27756})), GuidePage = () => { 27757 let checklist = useChecklist(), aiSetupItem = checklist.availableItems.find((item) => item.id === "aiSetup"); 27758 return react_default.createElement(Container13, null, react_default.createElement(Intro, null, react_default.createElement("h1", null, "Guide"), react_default.createElement("p", null, "Whether you're just getting started or looking for ways to level up, this checklist will help you make the most of your Storybook.")), aiSetupItem && react_default.createElement(AiSetupBlock, { item: aiSetupItem, reset: checklist.reset, skip: checklist.skip }), react_default.createElement(Checklist, { ...checklist, forceCollapsed: aiSetupItem?.isOpen }), scope.FEATURES?.sidebarOnboardingChecklist !== !1 && react_default.createElement(react_default.Fragment, null, checklist.openItems.length === 0 ? react_default.createElement("center", null, "Your work here is done!") : checklist.widget.disable || checklist.openItems.every((item) => item.isMuted) ? react_default.createElement("center", null, "Want to see this in the sidebar?", " ", react_default.createElement(Link, { onClick: () => checklist.disable(!1) }, "Show in sidebar")) : react_default.createElement("center", null, "Don't want to see this in the sidebar?", " ", react_default.createElement(Link, { onClick: () => checklist.mute(checklist.allItems.map(({ id }) => id)) }, "Remove from sidebar")))); 27759}; 27760 27761// src/manager/settings/ShortcutsPage.tsx 27762init_react(); 27763 27764// src/manager/settings/shortcuts.tsx 27765init_react(); 27766 27767// src/manager/settings/SettingsFooter.tsx 27768init_react(); 27769var Footer3 = styled.div(({ theme }) => ({ 27770 display: "flex", 27771 paddingTop: 20, 27772 marginTop: 20, 27773 borderTop: `1px solid ${theme.appBorderColor}`, 27774 fontWeight: theme.typography.weight.bold, 27775 "& > * + *": { 27776 marginLeft: 20 27777 } 27778})), SettingsFooter = (props) => react_default.createElement(Footer3, { ...props }, react_default.createElement(Link, { secondary: !0, href: "https://storybook.js.org?ref=ui", cancel: !1, target: "_blank" }, "Docs"), react_default.createElement(Link, { secondary: !0, href: "https://github.com/storybookjs/storybook", cancel: !1, target: "_blank" }, "GitHub"), react_default.createElement( 27779 Link, 27780 { 27781 secondary: !0, 27782 href: "https://storybook.js.org/community?ref=ui#support", 27783 cancel: !1, 27784 target: "_blank" 27785 }, 27786 "Support" 27787)), SettingsFooter_default = SettingsFooter; 27788 27789// src/manager/settings/shortcuts.tsx 27790var Header2 = styled.header(({ theme }) => ({ 27791 marginBottom: 20, 27792 fontSize: theme.typography.size.m3, 27793 fontWeight: theme.typography.weight.bold, 27794 alignItems: "center", 27795 display: "flex" 27796})), HeaderItem = styled.div(({ theme }) => ({ 27797 fontWeight: theme.typography.weight.bold 27798})), GridHeaderRow = styled.div({ 27799 alignSelf: "flex-end", 27800 display: "grid", 27801 margin: "10px 0", 27802 gridTemplateColumns: "1fr 1fr 12px", 27803 "& > *:last-of-type": { 27804 gridColumn: "2 / 2", 27805 justifySelf: "flex-end", 27806 gridRow: "1" 27807 } 27808}), Row = styled.div(({ theme }) => ({ 27809 padding: "6px 0", 27810 borderTop: `1px solid ${theme.appBorderColor}`, 27811 display: "grid", 27812 gridTemplateColumns: "1fr 1fr 0px" 27813})), GridWrapper = styled.div({ 27814 display: "grid", 27815 gridTemplateColumns: "1fr", 27816 gridAutoRows: "minmax(auto, auto)", 27817 marginBottom: 20 27818}), Description = styled.div({ 27819 alignSelf: "center" 27820}), TextInput = styled(Form.Input)( 27821 ({ valid, theme }) => valid === "error" ? { 27822 animation: `${theme.animation.jiggle} 700ms ease-out` 27823 } : {}, 27824 { 27825 display: "flex", 27826 width: 80, 27827 flexDirection: "column", 27828 justifySelf: "flex-end", 27829 paddingLeft: 4, 27830 paddingRight: 4, 27831 textAlign: "center" 27832 } 27833), Fade = keyframes` 278340%,100% { opacity: 0; } 27835 50% { opacity: 1; } 27836`, SuccessIcon = styled(CheckIcon)( 27837 ({ valid, theme }) => valid === "valid" ? { 27838 color: theme.color.positive, 27839 animation: `${Fade} 2s ease forwards` 27840 } : { 27841 opacity: 0 27842 }, 27843 { 27844 alignSelf: "center", 27845 display: "flex", 27846 marginLeft: 10, 27847 height: 14, 27848 width: 14 27849 } 27850), Container14 = styled.div(({ theme }) => ({ 27851 fontSize: theme.typography.size.s2, 27852 padding: "3rem 20px", 27853 maxWidth: 600, 27854 margin: "0 auto" 27855})), shortcutLabels = { 27856 fullScreen: "Go full screen", 27857 togglePanel: "Toggle addons", 27858 panelPosition: "Toggle addons orientation", 27859 toggleNav: "Toggle sidebar", 27860 toolbar: "Toggle toolbar", 27861 search: "Focus search", 27862 focusNav: "Focus sidebar", 27863 focusIframe: "Focus canvas", 27864 focusPanel: "Focus addons", 27865 prevComponent: "Previous component", 27866 nextComponent: "Next component", 27867 prevStory: "Previous story", 27868 nextStory: "Next story", 27869 shortcutsPage: "Go to shortcuts page", 27870 aboutPage: "Go to about page", 27871 collapseAll: "Collapse all items on sidebar", 27872 expandAll: "Expand all items on sidebar", 27873 remount: "Reload story", 27874 openInEditor: "Open story in editor", 27875 openInIsolation: "Open story in isolation", 27876 copyStoryLink: "Copy story link to clipboard", 27877 goToPreviousLandmark: "Go to previous landmark", 27878 goToNextLandmark: "Go to next landmark" 27879 // TODO: bring this back once we want to add shortcuts for this 27880 // copyStoryName: 'Copy story name to clipboard', 27881}, fixedShortcuts = ["escape"], hardcodedShortcuts = ["goToPreviousLandmark", "goToNextLandmark"]; 27882function toShortcutState(shortcutKeys) { 27883 let state = {}; 27884 for (let key of Object.keys(shortcutKeys).filter((k2) => !fixedShortcuts.includes(k2))) 27885 state[key] = { 27886 shortcut: shortcutKeys[key], 27887 error: !1, 27888 hardcoded: hardcodedShortcuts.includes(key) 27889 }; 27890 return state; 27891} 27892var ShortcutsScreen = class extends Component { 27893 constructor(props) { 27894 super(props); 27895 this.onKeyDown = (e2) => { 27896 let { activeFeature, shortcutKeys } = this.state; 27897 if (e2.key === "Backspace") 27898 return this.restoreDefault(); 27899 let shortcut = eventToShortcut(e2); 27900 if (!shortcut) 27901 return !1; 27902 let normalizedShortcut = shortcut.map( 27903 (key) => Array.isArray(key) ? key.at(-1) : key 27904 ), error = !!Object.entries(shortcutKeys).find( 27905 ([feature, { shortcut: existingShortcut }]) => feature !== activeFeature && existingShortcut && shortcutMatchesShortcut(normalizedShortcut, existingShortcut) 27906 ); 27907 return this.setState({ 27908 shortcutKeys: { ...shortcutKeys, [activeFeature]: { shortcut: normalizedShortcut, error } } 27909 }); 27910 }; 27911 this.onFocus = (focusedInput) => () => { 27912 let { shortcutKeys } = this.state; 27913 this.setState({ 27914 activeFeature: focusedInput, 27915 shortcutKeys: { 27916 ...shortcutKeys, 27917 [focusedInput]: { shortcut: null, error: !1 } 27918 } 27919 }); 27920 }; 27921 this.onBlur = async () => { 27922 let { shortcutKeys, activeFeature } = this.state; 27923 if (shortcutKeys[activeFeature]) { 27924 let { shortcut, error } = shortcutKeys[activeFeature]; 27925 return !shortcut || error ? this.restoreDefault() : this.saveShortcut(); 27926 } 27927 return !1; 27928 }; 27929 this.saveShortcut = async () => { 27930 let { activeFeature, shortcutKeys } = this.state, { setShortcut } = this.props; 27931 await setShortcut(activeFeature, shortcutKeys[activeFeature].shortcut), this.setState({ successField: activeFeature }); 27932 }; 27933 this.restoreDefaults = async () => { 27934 let { restoreAllDefaultShortcuts } = this.props, defaultShortcuts = await restoreAllDefaultShortcuts(); 27935 return this.setState({ shortcutKeys: toShortcutState(defaultShortcuts) }); 27936 }; 27937 this.restoreDefault = async () => { 27938 let { activeFeature, shortcutKeys } = this.state, { restoreDefaultShortcut } = this.props, defaultShortcut = await restoreDefaultShortcut(activeFeature); 27939 return this.setState({ 27940 shortcutKeys: { 27941 ...shortcutKeys, 27942 ...toShortcutState({ [activeFeature]: defaultShortcut }) 27943 } 27944 }); 27945 }; 27946 this.displaySuccessMessage = (activeElement) => { 27947 let { successField, shortcutKeys } = this.state; 27948 return activeElement === successField && shortcutKeys[activeElement].error === !1 ? "valid" : void 0; 27949 }; 27950 this.displayError = (activeElement) => { 27951 let { activeFeature, shortcutKeys } = this.state; 27952 return activeElement === activeFeature && shortcutKeys[activeElement].error === !0 ? "error" : void 0; 27953 }; 27954 this.renderKeyInput = () => { 27955 let { shortcutKeys, addonsShortcutLabels } = this.state; 27956 return Object.entries(shortcutKeys).filter( 27957 ([feature]) => shortcutLabels[feature] !== void 0 || addonsShortcutLabels && addonsShortcutLabels[feature] 27958 ).map( 27959 ([feature, { shortcut, hardcoded }]) => react_default.createElement(Row, { key: feature }, react_default.createElement(Description, null, shortcutLabels[feature] || addonsShortcutLabels[feature]), hardcoded ? react_default.createElement(react_default.Fragment, null, react_default.createElement( 27960 TooltipProvider, 27961 { 27962 tooltip: react_default.createElement(Tooltip, { hasChrome: !0 }, "This shortcut cannot be changed."), 27963 placement: "right" 27964 }, 27965 react_default.createElement( 27966 TextInput, 27967 { 27968 "aria-disabled": !0, 27969 readOnly: !0, 27970 valid: void 0, 27971 value: shortcut ? shortcutToHumanString(shortcut) : "" 27972 } 27973 ) 27974 )) : react_default.createElement( 27975 TextInput, 27976 { 27977 spellCheck: "false", 27978 valid: this.displayError(feature), 27979 className: "modalInput", 27980 onBlur: this.onBlur, 27981 onFocus: this.onFocus(feature), 27982 onKeyDown: this.onKeyDown, 27983 value: shortcut ? shortcutToHumanString(shortcut) : "", 27984 placeholder: "Type keys", 27985 readOnly: !0 27986 } 27987 ), react_default.createElement(SuccessIcon, { valid: this.displaySuccessMessage(feature) })) 27988 ); 27989 }; 27990 this.renderKeyForm = () => react_default.createElement(GridWrapper, null, react_default.createElement(GridHeaderRow, null, react_default.createElement(HeaderItem, null, "Commands"), react_default.createElement(HeaderItem, null, "Shortcut")), this.renderKeyInput()); 27991 this.state = { 27992 // @ts-expect-error (non strict) 27993 activeFeature: void 0, 27994 // @ts-expect-error (non strict) 27995 successField: void 0, 27996 // The initial shortcutKeys that come from props are the defaults/what was saved 27997 // As the user interacts with the page, the state stores the temporary, unsaved shortcuts 27998 // This object also includes the error attached to each shortcut 27999 shortcutKeys: toShortcutState(props.shortcutKeys), 28000 addonsShortcutLabels: props.addonsShortcutLabels 28001 }; 28002 } 28003 render() { 28004 let layout = this.renderKeyForm(); 28005 return react_default.createElement(Container14, null, react_default.createElement(Header2, null, "Keyboard shortcuts"), layout, react_default.createElement( 28006 Button, 28007 { 28008 ariaLabel: !1, 28009 variant: "outline", 28010 size: "small", 28011 id: "restoreDefaultsHotkeys", 28012 onClick: this.restoreDefaults 28013 }, 28014 "Restore defaults" 28015 ), react_default.createElement(SettingsFooter_default, null)); 28016 } 28017}; 28018 28019// src/manager/settings/ShortcutsPage.tsx 28020var ShortcutsPage = () => react_default.createElement(Consumer, null, ({ 28021 api: { 28022 getShortcutKeys, 28023 getAddonsShortcutLabels, 28024 setShortcut, 28025 restoreDefaultShortcut, 28026 restoreAllDefaultShortcuts 28027 } 28028}) => react_default.createElement( 28029 ShortcutsScreen, 28030 { 28031 shortcutKeys: getShortcutKeys(), 28032 addonsShortcutLabels: getAddonsShortcutLabels(), 28033 setShortcut, 28034 restoreDefaultShortcut, 28035 restoreAllDefaultShortcuts 28036 } 28037)); 28038 28039// src/manager/settings/whats_new_page.tsx 28040init_react(); 28041 28042// src/manager/settings/whats_new.tsx 28043init_react(); 28044var Centered = styled.div({ 28045 top: "50%", 28046 position: "absolute", 28047 transform: "translateY(-50%)", 28048 width: "100%", 28049 textAlign: "center" 28050}), LoaderWrapper2 = styled.div({ 28051 position: "relative", 28052 height: "32px" 28053}), Message3 = styled.div(({ theme }) => ({ 28054 paddingTop: "12px", 28055 color: theme.textMutedColor, 28056 maxWidth: "295px", 28057 margin: "0 auto", 28058 fontSize: `${theme.typography.size.s1}px`, 28059 lineHeight: "16px" 28060})), Container15 = styled.div(({ theme }) => ({ 28061 position: "absolute", 28062 width: "100%", 28063 height: 40, 28064 bottom: 0, 28065 background: theme.background.bar, 28066 fontSize: theme.typography.size.s2, 28067 borderTop: `1px solid ${theme.color.border}`, 28068 padding: "0 10px 0 15px", 28069 display: "flex", 28070 alignItems: "center", 28071 justifyContent: "space-between" 28072})), WhatsNewFooter = ({ 28073 isNotificationsEnabled, 28074 onToggleNotifications, 28075 copyContent 28076}) => { 28077 let theme = useTheme(), { children: copyText, buttonProps: copyButtonProps } = useCopyButton2({ 28078 children: "Copy Link", 28079 content: copyContent 28080 }); 28081 return react_default.createElement(Container15, null, react_default.createElement("div", { style: { display: "flex", alignItems: "center", gap: 10 } }, react_default.createElement(HeartIcon, { color: theme.color.mediumdark }), react_default.createElement("div", null, "Share this with your team."), react_default.createElement(Button, { size: "small", variant: "ghost", ...copyButtonProps }, copyText)), isNotificationsEnabled ? react_default.createElement(Button, { ariaLabel: !1, size: "small", variant: "ghost", onClick: onToggleNotifications }, react_default.createElement(EyeCloseIcon, null), "Hide notifications") : react_default.createElement(Button, { ariaLabel: !1, size: "small", variant: "ghost", onClick: onToggleNotifications }, react_default.createElement(EyeIcon, null), "Show notifications")); 28082}, Iframe = styled.iframe( 28083 { 28084 position: "absolute", 28085 top: 0, 28086 left: 0, 28087 right: 0, 28088 bottom: 0, 28089 border: 0, 28090 margin: 0, 28091 padding: 0, 28092 width: "100%", 28093 height: "calc(100% - 40px)", 28094 background: "white" 28095 }, 28096 ({ isLoaded }) => ({ visibility: isLoaded ? "visible" : "hidden" }) 28097), AlertIcon2 = styled(((props) => react_default.createElement(AlertIcon, { ...props })))(({ theme }) => ({ 28098 color: theme.textMutedColor, 28099 width: 32, 28100 height: 32, 28101 margin: "0 auto" 28102})), WhatsNewLoader = () => react_default.createElement(Centered, null, react_default.createElement(LoaderWrapper2, null, react_default.createElement(Loader, null)), react_default.createElement(Message3, null, "Loading...")), MaxWaitTimeMessaging = () => react_default.createElement(Centered, null, react_default.createElement(AlertIcon2, null), react_default.createElement(Message3, null, "The page couldn't be loaded. Check your internet connection and try again.")), PureWhatsNewScreen = ({ 28103 didHitMaxWaitTime, 28104 isLoaded, 28105 onLoad, 28106 url, 28107 copyContent, 28108 onToggleNotifications, 28109 isNotificationsEnabled 28110}) => react_default.createElement(Fragment, null, !isLoaded && !didHitMaxWaitTime && react_default.createElement(WhatsNewLoader, null), didHitMaxWaitTime ? react_default.createElement(MaxWaitTimeMessaging, null) : react_default.createElement(react_default.Fragment, null, react_default.createElement(Iframe, { isLoaded, onLoad, src: url, title: "What's new?" }), react_default.createElement( 28111 WhatsNewFooter, 28112 { 28113 isNotificationsEnabled, 28114 onToggleNotifications, 28115 copyContent 28116 } 28117))), MAX_WAIT_TIME = 1e4, WhatsNewScreen = () => { 28118 let api = useStorybookApi(), state = useStorybookState(), { whatsNewData } = state, [isLoaded, setLoaded] = useState(!1), [didHitMaxWaitTime, setDidHitMaxWaitTime] = useState(!1); 28119 if (useEffect(() => { 28120 let timer = setTimeout(() => !isLoaded && setDidHitMaxWaitTime(!0), MAX_WAIT_TIME); 28121 return () => clearTimeout(timer); 28122 }, [isLoaded]), whatsNewData?.status !== "SUCCESS") 28123 return null; 28124 let isNotificationsEnabled = !whatsNewData.disableWhatsNewNotifications; 28125 return react_default.createElement( 28126 PureWhatsNewScreen, 28127 { 28128 didHitMaxWaitTime, 28129 isLoaded, 28130 onLoad: () => { 28131 api.whatsNewHasBeenRead(), setLoaded(!0); 28132 }, 28133 url: whatsNewData.url, 28134 isNotificationsEnabled, 28135 copyContent: whatsNewData.blogUrl ?? whatsNewData.url, 28136 onToggleNotifications: () => { 28137 isNotificationsEnabled ? scope.confirm("All update notifications will no longer be shown. Are you sure?") && api.toggleWhatsNewNotifications() : api.toggleWhatsNewNotifications(); 28138 } 28139 } 28140 ); 28141}; 28142 28143// src/manager/settings/whats_new_page.tsx 28144var WhatsNewPage = () => react_default.createElement(WhatsNewScreen, null); 28145 28146// src/manager/settings/index.tsx 28147var { document: document9 } = scope, Content5 = styled(ScrollArea)(({ theme }) => ({ 28148 background: theme.background.content 28149})), SidebarToggle = styled.div({ 28150 // Extra specificity is necessary here 28151 "&&:has(*)": { 28152 order: 0, 28153 display: "flex", 28154 alignItems: "center", 28155 marginLeft: 10, 28156 marginRight: 6, 28157 gap: 6 28158 } 28159}), RouteWrapper = ({ children, path }) => react_default.createElement(Content5, { vertical: !0, horizontal: !1 }, react_default.createElement(Route, { path }, children)), Pages = ({ changeTab, onClose, enableShortcuts = !0, enableWhatsNew }) => { 28160 react_default.useEffect(() => { 28161 let handleEscape = (event) => { 28162 !enableShortcuts || event.repeat || matchesModifiers(!1, event) && matchesKeyCode("Escape", event) && (event.preventDefault(), onClose()); 28163 }; 28164 return document9.addEventListener("keydown", handleEscape), () => document9.removeEventListener("keydown", handleEscape); 28165 }, [enableShortcuts, onClose]); 28166 let api = useStorybookApi(), toolsExtra = Object.values(api.getElements(Addon_TypesEnum.TOOLEXTRA)), tabs = useMemo(() => { 28167 let tabsToInclude = [ 28168 { 28169 id: "about", 28170 title: "About", 28171 children: react_default.createElement(RouteWrapper, { path: "about" }, react_default.createElement(AboutPage, { key: "about" })) 28172 } 28173 ]; 28174 return scope.CONFIG_TYPE === "DEVELOPMENT" && scope.FEATURES?.menuOnboardingChecklist !== !1 && tabsToInclude.push({ 28175 id: "guide", 28176 title: "Guide", 28177 children: react_default.createElement(RouteWrapper, { path: "guide" }, react_default.createElement(GuidePage, { key: "guide" })) 28178 }), tabsToInclude.push({ 28179 id: "shortcuts", 28180 title: "Keyboard shortcuts", 28181 children: react_default.createElement(RouteWrapper, { path: "shortcuts" }, react_default.createElement(ShortcutsPage, { key: "shortcuts" })) 28182 }), enableWhatsNew && tabsToInclude.push({ 28183 id: "whats-new", 28184 title: "What's new?", 28185 children: react_default.createElement(RouteWrapper, { path: "whats-new" }, react_default.createElement(WhatsNewPage, { key: "whats-new" })) 28186 }), tabsToInclude; 28187 }, [enableWhatsNew]); 28188 return react_default.createElement(Location, null, ({ path }) => { 28189 let selected = tabs.find((tab) => path.includes(`settings/${tab.id}`))?.id; 28190 return react_default.createElement( 28191 TabsView, 28192 { 28193 tabs, 28194 tools: react_default.createElement(react_default.Fragment, null, react_default.createElement(SidebarToggle, null, menuTool.render({})), toolsExtra.map((item) => react_default.createElement(react_default.Fragment, { key: item.id }, item.render({}))), react_default.createElement( 28195 Button, 28196 { 28197 padding: "small", 28198 variant: "ghost", 28199 onClick: (e2) => (e2.preventDefault(), onClose()), 28200 ariaLabel: "Close settings page" 28201 }, 28202 react_default.createElement(CloseIcon, null) 28203 )), 28204 selected, 28205 onSelectionChange: changeTab 28206 } 28207 ); 28208 }); 28209}, SettingsPages = () => { 28210 let api = useStorybookApi(), state = useStorybookState(), changeTab = (tab) => api.changeSettingsTab(tab); 28211 return react_default.createElement( 28212 Pages, 28213 { 28214 enableWhatsNew: state.whatsNewData?.status === "SUCCESS", 28215 enableShortcuts: state.ui.enableShortcuts, 28216 changeTab, 28217 onClose: api.closeSettings 28218 } 28219 ); 28220}, settingsPageAddon = { 28221 id: "settings", 28222 url: "/settings/", 28223 title: "Settings", 28224 type: types.experimental_PAGE, 28225 render: () => react_default.createElement(Route, { path: "/settings/", startsWith: !0 }, react_default.createElement(SettingsPages, null)) 28226}; 28227 28228// src/manager/index.tsx 28229ThemeProvider.displayName = "ThemeProvider"; 28230q.displayName = "HelmetProvider"; 28231var Root5 = ({ provider }) => react_default.createElement(q, { key: "helmet.Provider" }, react_default.createElement(LocationProvider, { key: "location.provider" }, react_default.createElement(Main3, { provider }))), Main3 = ({ provider }) => { 28232 let navigate = useNavigate(); 28233 return react_default.createElement(Location, { key: "location.consumer" }, (locationData) => react_default.createElement( 28234 Provider, 28235 { 28236 key: "manager", 28237 provider, 28238 ...locationData, 28239 navigate, 28240 docsOptions: scope?.DOCS_OPTIONS || {} 28241 }, 28242 (combo) => { 28243 let { state, api } = combo, setManagerLayoutState = useCallback( 28244 (sizes) => { 28245 api.setSizes(sizes); 28246 }, 28247 [api] 28248 ), pages = useMemo( 28249 () => [settingsPageAddon, ...Object.values(api.getElements(types.experimental_PAGE))], 28250 [Object.keys(api.getElements(types.experimental_PAGE)).join()] 28251 ); 28252 return react_default.createElement(ThemeProvider, { key: "theme.provider", theme: ensure(state.theme) }, react_default.createElement(LayoutProvider, null, react_default.createElement( 28253 App, 28254 { 28255 key: "app", 28256 pages, 28257 managerLayoutState: { 28258 ...state.layout, 28259 viewMode: state.viewMode 28260 }, 28261 hasTab: !!api.getQueryParam("tab"), 28262 setManagerLayoutState 28263 } 28264 ))); 28265 } 28266 )); 28267}; 28268function renderStorybookUI(domNode, provider) { 28269 if (!(provider instanceof Provider2)) 28270 throw new ProviderDoesNotExtendBaseProviderError(); 28271 createRoot(domNode).render(react_default.createElement(Root5, { key: "root", provider })); 28272} 28273 28274// src/manager/runtime.tsx 28275var WS_DISCONNECTED_NOTIFICATION_ID = "CORE/WS_DISCONNECTED"; 28276addons.register( 28277 TOOLBAR_ID, 28278 () => addons.add(TOOLBAR_ID, { 28279 title: TOOLBAR_ID, 28280 type: types.TOOL, 28281 match: ({ tabId }) => !tabId, 28282 render: () => react_default.createElement(ToolbarManager, null) 28283 }) 28284); 28285var channel = createBrowserChannel({ page: "manager" }); 28286addons.setChannel(channel); 28287channel.emit(CHANNEL_CREATED); 28288var ReactProvider = class extends Provider2 { 28289 constructor() { 28290 super(...arguments); 28291 this.addons = addons; 28292 this.channel = channel; 28293 this.wsDisconnected = !1; 28294 } 28295 getElements(type) { 28296 return this.addons.getElements(type); 28297 } 28298 getConfig() { 28299 return this.addons.getConfig(); 28300 } 28301 handleAPI(api) { 28302 this.addons.loadAddons(api), this.channel.on(CHANNEL_WS_DISCONNECT, (ev) => { 28303 this.wsDisconnected = !0, api.addNotification({ 28304 id: WS_DISCONNECTED_NOTIFICATION_ID, 28305 content: { 28306 headline: ev.code === 3008 ? "Server timed out" : "Connection lost", 28307 subHeadline: "Please restart your Storybook server and reload the page" 28308 }, 28309 icon: react_default.createElement(FailedIcon, { color: color.negative }), 28310 link: void 0 28311 }); 28312 }); 28313 } 28314}, { document: document10 } = scope, rootEl = document10.getElementById("root"); 28315setTimeout(() => { 28316 renderStorybookUI(rootEl, new ReactProvider()); 28317}, 0);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.