| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 var __create = Object.create; 2 var __defProp = Object.defineProperty; 3 var __getOwnPropDesc = Object.getOwnPropertyDescriptor; 4 var __getOwnPropNames = Object.getOwnPropertyNames; 5 var __getProtoOf = Object.getPrototypeOf; 6 var __hasOwnProp = Object.prototype.hasOwnProperty; 7 var __require = /* @__PURE__ */ ((x2) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x2, { 8 get: (a2, b2) => (typeof require !== "undefined" ? require : a2)[b2] 9 }) : x2)(function(x2) { 10 if (typeof require !== "undefined") return require.apply(this, arguments); 11 throw Error('Dynamic require of "' + x2 + '" is not supported'); 12 }); 13 var __commonJS = (cb, mod) => function __require4() { 14 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; 15 }; 16 var __export = (target, all) => { 17 for (var name2 in all) 18 __defProp(target, name2, { get: all[name2], enumerable: true }); 19 }; 20 var __copyProps = (to, from, except, desc) => { 21 if (from && typeof from === "object" || typeof from === "function") { 22 for (let key of __getOwnPropNames(from)) 23 if (!__hasOwnProp.call(to, key) && key !== except) 24 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); 25 } 26 return to; 27 }; 28 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( 29 // If the importer is in node compatibility mode or this is not an ESM 30 // file that has been converted to a CommonJS file using a Babel- 31 // compatible transform (i.e. "__esModule" has not been set), then set 32 // "default" to the CommonJS "module.exports" for node compatibility. 33 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, 34 mod 35 )); 36 37 // package-external:@wordpress/i18n 38 var require_i18n = __commonJS({ 39 "package-external:@wordpress/i18n"(exports, module) { 40 module.exports = window.wp.i18n; 41 } 42 }); 43 44 // package-external:@wordpress/element 45 var require_element = __commonJS({ 46 "package-external:@wordpress/element"(exports, module) { 47 module.exports = window.wp.element; 48 } 49 }); 50 51 // vendor-external:react 52 var require_react = __commonJS({ 53 "vendor-external:react"(exports, module) { 54 module.exports = window.React; 55 } 56 }); 57 58 // vendor-external:react/jsx-runtime 59 var require_jsx_runtime = __commonJS({ 60 "vendor-external:react/jsx-runtime"(exports, module) { 61 module.exports = window.ReactJSXRuntime; 62 } 63 }); 64 65 // vendor-external:react-dom 66 var require_react_dom = __commonJS({ 67 "vendor-external:react-dom"(exports, module) { 68 module.exports = window.ReactDOM; 69 } 70 }); 71 72 // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js 73 var require_use_sync_external_store_shim_development = __commonJS({ 74 "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"(exports) { 75 "use strict"; 76 (function() { 77 function is(x2, y2) { 78 return x2 === y2 && (0 !== x2 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2; 79 } 80 function useSyncExternalStore$2(subscribe, getSnapshot) { 81 didWarnOld18Alpha || void 0 === React48.startTransition || (didWarnOld18Alpha = true, console.error( 82 "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release." 83 )); 84 var value = getSnapshot(); 85 if (!didWarnUncachedGetSnapshot) { 86 var cachedValue = getSnapshot(); 87 objectIs(value, cachedValue) || (console.error( 88 "The result of getSnapshot should be cached to avoid an infinite loop" 89 ), didWarnUncachedGetSnapshot = true); 90 } 91 cachedValue = useState29({ 92 inst: { value, getSnapshot } 93 }); 94 var inst = cachedValue[0].inst, forceUpdate = cachedValue[1]; 95 useLayoutEffect4( 96 function() { 97 inst.value = value; 98 inst.getSnapshot = getSnapshot; 99 checkIfSnapshotChanged(inst) && forceUpdate({ inst }); 100 }, 101 [subscribe, value, getSnapshot] 102 ); 103 useEffect20( 104 function() { 105 checkIfSnapshotChanged(inst) && forceUpdate({ inst }); 106 return subscribe(function() { 107 checkIfSnapshotChanged(inst) && forceUpdate({ inst }); 108 }); 109 }, 110 [subscribe] 111 ); 112 useDebugValue2(value); 113 return value; 114 } 115 function checkIfSnapshotChanged(inst) { 116 var latestGetSnapshot = inst.getSnapshot; 117 inst = inst.value; 118 try { 119 var nextValue = latestGetSnapshot(); 120 return !objectIs(inst, nextValue); 121 } catch (error) { 122 return true; 123 } 124 } 125 function useSyncExternalStore$1(subscribe, getSnapshot) { 126 return getSnapshot(); 127 } 128 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); 129 var React48 = require_react(), objectIs = "function" === typeof Object.is ? Object.is : is, useState29 = React48.useState, useEffect20 = React48.useEffect, useLayoutEffect4 = React48.useLayoutEffect, useDebugValue2 = React48.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2; 130 exports.useSyncExternalStore = void 0 !== React48.useSyncExternalStore ? React48.useSyncExternalStore : shim; 131 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); 132 })(); 133 } 134 }); 135 136 // node_modules/use-sync-external-store/shim/index.js 137 var require_shim = __commonJS({ 138 "node_modules/use-sync-external-store/shim/index.js"(exports, module) { 139 "use strict"; 140 if (false) { 141 module.exports = null; 142 } else { 143 module.exports = require_use_sync_external_store_shim_development(); 144 } 145 } 146 }); 147 148 // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js 149 var require_with_selector_development = __commonJS({ 150 "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js"(exports) { 151 "use strict"; 152 (function() { 153 function is(x2, y2) { 154 return x2 === y2 && (0 !== x2 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2; 155 } 156 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); 157 var React48 = require_react(), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore2 = shim.useSyncExternalStore, useRef23 = React48.useRef, useEffect20 = React48.useEffect, useMemo29 = React48.useMemo, useDebugValue2 = React48.useDebugValue; 158 exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) { 159 var instRef = useRef23(null); 160 if (null === instRef.current) { 161 var inst = { hasValue: false, value: null }; 162 instRef.current = inst; 163 } else inst = instRef.current; 164 instRef = useMemo29( 165 function() { 166 function memoizedSelector(nextSnapshot) { 167 if (!hasMemo) { 168 hasMemo = true; 169 memoizedSnapshot = nextSnapshot; 170 nextSnapshot = selector(nextSnapshot); 171 if (void 0 !== isEqual && inst.hasValue) { 172 var currentSelection = inst.value; 173 if (isEqual(currentSelection, nextSnapshot)) 174 return memoizedSelection = currentSelection; 175 } 176 return memoizedSelection = nextSnapshot; 177 } 178 currentSelection = memoizedSelection; 179 if (objectIs(memoizedSnapshot, nextSnapshot)) 180 return currentSelection; 181 var nextSelection = selector(nextSnapshot); 182 if (void 0 !== isEqual && isEqual(currentSelection, nextSelection)) 183 return memoizedSnapshot = nextSnapshot, currentSelection; 184 memoizedSnapshot = nextSnapshot; 185 return memoizedSelection = nextSelection; 186 } 187 var hasMemo = false, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot; 188 return [ 189 function() { 190 return memoizedSelector(getSnapshot()); 191 }, 192 null === maybeGetServerSnapshot ? void 0 : function() { 193 return memoizedSelector(maybeGetServerSnapshot()); 194 } 195 ]; 196 }, 197 [getSnapshot, getServerSnapshot, selector, isEqual] 198 ); 199 var value = useSyncExternalStore2(subscribe, instRef[0], instRef[1]); 200 useEffect20( 201 function() { 202 inst.hasValue = true; 203 inst.value = value; 204 }, 205 [value] 206 ); 207 useDebugValue2(value); 208 return value; 209 }; 210 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); 211 })(); 212 } 213 }); 214 215 // node_modules/use-sync-external-store/shim/with-selector.js 216 var require_with_selector = __commonJS({ 217 "node_modules/use-sync-external-store/shim/with-selector.js"(exports, module) { 218 "use strict"; 219 if (false) { 220 module.exports = null; 221 } else { 222 module.exports = require_with_selector_development(); 223 } 224 } 225 }); 226 227 // package-external:@wordpress/primitives 228 var require_primitives = __commonJS({ 229 "package-external:@wordpress/primitives"(exports, module) { 230 module.exports = window.wp.primitives; 231 } 232 }); 233 234 // package-external:@wordpress/compose 235 var require_compose = __commonJS({ 236 "package-external:@wordpress/compose"(exports, module) { 237 module.exports = window.wp.compose; 238 } 239 }); 240 241 // package-external:@wordpress/theme 242 var require_theme = __commonJS({ 243 "package-external:@wordpress/theme"(exports, module) { 244 module.exports = window.wp.theme; 245 } 246 }); 247 248 // package-external:@wordpress/private-apis 249 var require_private_apis = __commonJS({ 250 "package-external:@wordpress/private-apis"(exports, module) { 251 module.exports = window.wp.privateApis; 252 } 253 }); 254 255 // package-external:@wordpress/components 256 var require_components = __commonJS({ 257 "package-external:@wordpress/components"(exports, module) { 258 module.exports = window.wp.components; 259 } 260 }); 261 262 // package-external:@wordpress/editor 263 var require_editor = __commonJS({ 264 "package-external:@wordpress/editor"(exports, module) { 265 module.exports = window.wp.editor; 266 } 267 }); 268 269 // package-external:@wordpress/core-data 270 var require_core_data = __commonJS({ 271 "package-external:@wordpress/core-data"(exports, module) { 272 module.exports = window.wp.coreData; 273 } 274 }); 275 276 // package-external:@wordpress/data 277 var require_data = __commonJS({ 278 "package-external:@wordpress/data"(exports, module) { 279 module.exports = window.wp.data; 280 } 281 }); 282 283 // package-external:@wordpress/blocks 284 var require_blocks = __commonJS({ 285 "package-external:@wordpress/blocks"(exports, module) { 286 module.exports = window.wp.blocks; 287 } 288 }); 289 290 // package-external:@wordpress/block-editor 291 var require_block_editor = __commonJS({ 292 "package-external:@wordpress/block-editor"(exports, module) { 293 module.exports = window.wp.blockEditor; 294 } 295 }); 296 297 // package-external:@wordpress/style-engine 298 var require_style_engine = __commonJS({ 299 "package-external:@wordpress/style-engine"(exports, module) { 300 module.exports = window.wp.styleEngine; 301 } 302 }); 303 304 // node_modules/fast-deep-equal/es6/index.js 305 var require_es6 = __commonJS({ 306 "node_modules/fast-deep-equal/es6/index.js"(exports, module) { 307 "use strict"; 308 module.exports = function equal(a2, b2) { 309 if (a2 === b2) return true; 310 if (a2 && b2 && typeof a2 == "object" && typeof b2 == "object") { 311 if (a2.constructor !== b2.constructor) return false; 312 var length, i2, keys; 313 if (Array.isArray(a2)) { 314 length = a2.length; 315 if (length != b2.length) return false; 316 for (i2 = length; i2-- !== 0; ) 317 if (!equal(a2[i2], b2[i2])) return false; 318 return true; 319 } 320 if (a2 instanceof Map && b2 instanceof Map) { 321 if (a2.size !== b2.size) return false; 322 for (i2 of a2.entries()) 323 if (!b2.has(i2[0])) return false; 324 for (i2 of a2.entries()) 325 if (!equal(i2[1], b2.get(i2[0]))) return false; 326 return true; 327 } 328 if (a2 instanceof Set && b2 instanceof Set) { 329 if (a2.size !== b2.size) return false; 330 for (i2 of a2.entries()) 331 if (!b2.has(i2[0])) return false; 332 return true; 333 } 334 if (ArrayBuffer.isView(a2) && ArrayBuffer.isView(b2)) { 335 length = a2.length; 336 if (length != b2.length) return false; 337 for (i2 = length; i2-- !== 0; ) 338 if (a2[i2] !== b2[i2]) return false; 339 return true; 340 } 341 if (a2.constructor === RegExp) return a2.source === b2.source && a2.flags === b2.flags; 342 if (a2.valueOf !== Object.prototype.valueOf) return a2.valueOf() === b2.valueOf(); 343 if (a2.toString !== Object.prototype.toString) return a2.toString() === b2.toString(); 344 keys = Object.keys(a2); 345 length = keys.length; 346 if (length !== Object.keys(b2).length) return false; 347 for (i2 = length; i2-- !== 0; ) 348 if (!Object.prototype.hasOwnProperty.call(b2, keys[i2])) return false; 349 for (i2 = length; i2-- !== 0; ) { 350 var key = keys[i2]; 351 if (!equal(a2[key], b2[key])) return false; 352 } 353 return true; 354 } 355 return a2 !== a2 && b2 !== b2; 356 }; 357 } 358 }); 359 360 // node_modules/deepmerge/dist/cjs.js 361 var require_cjs = __commonJS({ 362 "node_modules/deepmerge/dist/cjs.js"(exports, module) { 363 "use strict"; 364 var isMergeableObject = function isMergeableObject2(value) { 365 return isNonNullObject(value) && !isSpecial(value); 366 }; 367 function isNonNullObject(value) { 368 return !!value && typeof value === "object"; 369 } 370 function isSpecial(value) { 371 var stringValue = Object.prototype.toString.call(value); 372 return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value); 373 } 374 var canUseSymbol = typeof Symbol === "function" && Symbol.for; 375 var REACT_ELEMENT_TYPE = canUseSymbol ? /* @__PURE__ */ Symbol.for("react.element") : 60103; 376 function isReactElement(value) { 377 return value.$$typeof === REACT_ELEMENT_TYPE; 378 } 379 function emptyTarget(val) { 380 return Array.isArray(val) ? [] : {}; 381 } 382 function cloneUnlessOtherwiseSpecified(value, options) { 383 return options.clone !== false && options.isMergeableObject(value) ? deepmerge2(emptyTarget(value), value, options) : value; 384 } 385 function defaultArrayMerge(target, source, options) { 386 return target.concat(source).map(function(element) { 387 return cloneUnlessOtherwiseSpecified(element, options); 388 }); 389 } 390 function getMergeFunction(key, options) { 391 if (!options.customMerge) { 392 return deepmerge2; 393 } 394 var customMerge = options.customMerge(key); 395 return typeof customMerge === "function" ? customMerge : deepmerge2; 396 } 397 function getEnumerableOwnPropertySymbols(target) { 398 return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) { 399 return Object.propertyIsEnumerable.call(target, symbol); 400 }) : []; 401 } 402 function getKeys(target) { 403 return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target)); 404 } 405 function propertyIsOnObject(object, property) { 406 try { 407 return property in object; 408 } catch (_) { 409 return false; 410 } 411 } 412 function propertyIsUnsafe(target, key) { 413 return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key)); 414 } 415 function mergeObject(target, source, options) { 416 var destination = {}; 417 if (options.isMergeableObject(target)) { 418 getKeys(target).forEach(function(key) { 419 destination[key] = cloneUnlessOtherwiseSpecified(target[key], options); 420 }); 421 } 422 getKeys(source).forEach(function(key) { 423 if (propertyIsUnsafe(target, key)) { 424 return; 425 } 426 if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) { 427 destination[key] = getMergeFunction(key, options)(target[key], source[key], options); 428 } else { 429 destination[key] = cloneUnlessOtherwiseSpecified(source[key], options); 430 } 431 }); 432 return destination; 433 } 434 function deepmerge2(target, source, options) { 435 options = options || {}; 436 options.arrayMerge = options.arrayMerge || defaultArrayMerge; 437 options.isMergeableObject = options.isMergeableObject || isMergeableObject; 438 options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified; 439 var sourceIsArray = Array.isArray(source); 440 var targetIsArray = Array.isArray(target); 441 var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray; 442 if (!sourceAndTargetTypesMatch) { 443 return cloneUnlessOtherwiseSpecified(source, options); 444 } else if (sourceIsArray) { 445 return options.arrayMerge(target, source, options); 446 } else { 447 return mergeObject(target, source, options); 448 } 449 } 450 deepmerge2.all = function deepmergeAll(array, options) { 451 if (!Array.isArray(array)) { 452 throw new Error("first argument should be an array"); 453 } 454 return array.reduce(function(prev, next) { 455 return deepmerge2(prev, next, options); 456 }, {}); 457 }; 458 var deepmerge_1 = deepmerge2; 459 module.exports = deepmerge_1; 460 } 461 }); 462 463 // package-external:@wordpress/keycodes 464 var require_keycodes = __commonJS({ 465 "package-external:@wordpress/keycodes"(exports, module) { 466 module.exports = window.wp.keycodes; 467 } 468 }); 469 470 // package-external:@wordpress/api-fetch 471 var require_api_fetch = __commonJS({ 472 "package-external:@wordpress/api-fetch"(exports, module) { 473 module.exports = window.wp.apiFetch; 474 } 475 }); 476 477 // package-external:@wordpress/date 478 var require_date = __commonJS({ 479 "package-external:@wordpress/date"(exports, module) { 480 module.exports = window.wp.date; 481 } 482 }); 483 484 // node_modules/clsx/dist/clsx.mjs 485 function r(e2) { 486 var t3, f2, n2 = ""; 487 if ("string" == typeof e2 || "number" == typeof e2) n2 += e2; 488 else if ("object" == typeof e2) if (Array.isArray(e2)) { 489 var o3 = e2.length; 490 for (t3 = 0; t3 < o3; t3++) e2[t3] && (f2 = r(e2[t3])) && (n2 && (n2 += " "), n2 += f2); 491 } else for (f2 in e2) e2[f2] && (n2 && (n2 += " "), n2 += f2); 492 return n2; 493 } 494 function clsx() { 495 for (var e2, t3, f2 = 0, n2 = "", o3 = arguments.length; f2 < o3; f2++) (e2 = arguments[f2]) && (t3 = r(e2)) && (n2 && (n2 += " "), n2 += t3); 496 return n2; 497 } 498 var clsx_default = clsx; 499 500 // node_modules/@base-ui/utils/safeReact.mjs 501 var React2 = __toESM(require_react(), 1); 502 var SafeReact = { 503 ...React2 504 }; 505 506 // node_modules/@base-ui/utils/useRefWithInit.mjs 507 var React3 = __toESM(require_react(), 1); 508 var UNINITIALIZED = {}; 509 function useRefWithInit(init, initArg) { 510 const ref = React3.useRef(UNINITIALIZED); 511 if (ref.current === UNINITIALIZED) { 512 ref.current = init(initArg); 513 } 514 return ref; 515 } 516 517 // node_modules/@base-ui/utils/useStableCallback.mjs 518 var useInsertionEffect = SafeReact.useInsertionEffect; 519 var useSafeInsertionEffect = ( 520 // React 17 doesn't have useInsertionEffect. 521 useInsertionEffect && // Preact replaces useInsertionEffect with useLayoutEffect and fires too late. 522 useInsertionEffect !== SafeReact.useLayoutEffect ? useInsertionEffect : (fn) => fn() 523 ); 524 function useStableCallback(callback) { 525 const stable = useRefWithInit(createStableCallback).current; 526 stable.next = callback; 527 useSafeInsertionEffect(stable.effect); 528 return stable.trampoline; 529 } 530 function createStableCallback() { 531 const stable = { 532 next: void 0, 533 callback: assertNotCalled, 534 trampoline: (...args) => stable.callback?.(...args), 535 effect: () => { 536 stable.callback = stable.next; 537 } 538 }; 539 return stable; 540 } 541 function assertNotCalled() { 542 if (true) { 543 throw ( 544 /* minify-error-disabled */ 545 new Error("Base UI: Cannot call an event handler while rendering.") 546 ); 547 } 548 } 549 550 // node_modules/@base-ui/utils/useIsoLayoutEffect.mjs 551 var React4 = __toESM(require_react(), 1); 552 var noop = () => { 553 }; 554 var useIsoLayoutEffect = typeof document !== "undefined" ? React4.useLayoutEffect : noop; 555 556 // node_modules/@base-ui/utils/warn.mjs 557 var set; 558 if (true) { 559 set = /* @__PURE__ */ new Set(); 560 } 561 function warn(...messages) { 562 if (true) { 563 const messageKey = messages.join(" "); 564 if (!set.has(messageKey)) { 565 set.add(messageKey); 566 console.warn(`Base UI: $messageKey}`); 567 } 568 } 569 } 570 571 // node_modules/@base-ui/react/internals/direction-context/DirectionContext.mjs 572 var React5 = __toESM(require_react(), 1); 573 var DirectionContext = /* @__PURE__ */ React5.createContext(void 0); 574 if (true) DirectionContext.displayName = "DirectionContext"; 575 function useDirection() { 576 const context = React5.useContext(DirectionContext); 577 return context?.direction ?? "ltr"; 578 } 579 580 // node_modules/@base-ui/react/internals/useRenderElement.mjs 581 var React8 = __toESM(require_react(), 1); 582 583 // node_modules/@base-ui/utils/useMergedRefs.mjs 584 function useMergedRefs(a2, b2, c2, d2) { 585 const forkRef = useRefWithInit(createForkRef).current; 586 if (didChange(forkRef, a2, b2, c2, d2)) { 587 update(forkRef, [a2, b2, c2, d2]); 588 } 589 return forkRef.callback; 590 } 591 function useMergedRefsN(refs) { 592 const forkRef = useRefWithInit(createForkRef).current; 593 if (didChangeN(forkRef, refs)) { 594 update(forkRef, refs); 595 } 596 return forkRef.callback; 597 } 598 function createForkRef() { 599 return { 600 callback: null, 601 cleanup: null, 602 refs: [] 603 }; 604 } 605 function didChange(forkRef, a2, b2, c2, d2) { 606 return forkRef.refs[0] !== a2 || forkRef.refs[1] !== b2 || forkRef.refs[2] !== c2 || forkRef.refs[3] !== d2; 607 } 608 function didChangeN(forkRef, newRefs) { 609 return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index2) => ref !== newRefs[index2]); 610 } 611 function update(forkRef, refs) { 612 forkRef.refs = refs; 613 if (refs.every((ref) => ref == null)) { 614 forkRef.callback = null; 615 return; 616 } 617 forkRef.callback = (instance) => { 618 if (forkRef.cleanup) { 619 forkRef.cleanup(); 620 forkRef.cleanup = null; 621 } 622 if (instance != null) { 623 const cleanupCallbacks = Array(refs.length).fill(null); 624 for (let i2 = 0; i2 < refs.length; i2 += 1) { 625 const ref = refs[i2]; 626 if (ref == null) { 627 continue; 628 } 629 switch (typeof ref) { 630 case "function": { 631 const refCleanup = ref(instance); 632 if (typeof refCleanup === "function") { 633 cleanupCallbacks[i2] = refCleanup; 634 } 635 break; 636 } 637 case "object": { 638 ref.current = instance; 639 break; 640 } 641 default: 642 } 643 } 644 forkRef.cleanup = () => { 645 for (let i2 = 0; i2 < refs.length; i2 += 1) { 646 const ref = refs[i2]; 647 if (ref == null) { 648 continue; 649 } 650 switch (typeof ref) { 651 case "function": { 652 const cleanupCallback = cleanupCallbacks[i2]; 653 if (typeof cleanupCallback === "function") { 654 cleanupCallback(); 655 } else { 656 ref(null); 657 } 658 break; 659 } 660 case "object": { 661 ref.current = null; 662 break; 663 } 664 default: 665 } 666 } 667 }; 668 } 669 }; 670 } 671 672 // node_modules/@base-ui/utils/getReactElementRef.mjs 673 var React7 = __toESM(require_react(), 1); 674 675 // node_modules/@base-ui/utils/reactVersion.mjs 676 var React6 = __toESM(require_react(), 1); 677 var majorVersion = parseInt(React6.version, 10); 678 function isReactVersionAtLeast(reactVersionToCheck) { 679 return majorVersion >= reactVersionToCheck; 680 } 681 682 // node_modules/@base-ui/utils/getReactElementRef.mjs 683 function getReactElementRef(element) { 684 if (!/* @__PURE__ */ React7.isValidElement(element)) { 685 return null; 686 } 687 const reactElement = element; 688 const propsWithRef = reactElement.props; 689 return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null; 690 } 691 692 // node_modules/@base-ui/utils/mergeObjects.mjs 693 function mergeObjects(a2, b2) { 694 if (a2 && !b2) { 695 return a2; 696 } 697 if (!a2 && b2) { 698 return b2; 699 } 700 if (a2 || b2) { 701 return { 702 ...a2, 703 ...b2 704 }; 705 } 706 return void 0; 707 } 708 709 // node_modules/@base-ui/utils/empty.mjs 710 function NOOP() { 711 } 712 var EMPTY_ARRAY = Object.freeze([]); 713 var EMPTY_OBJECT = Object.freeze({}); 714 715 // node_modules/@base-ui/react/internals/getStateAttributesProps.mjs 716 function getStateAttributesProps(state, customMapping) { 717 const props = {}; 718 for (const key in state) { 719 const value = state[key]; 720 if (customMapping?.hasOwnProperty(key)) { 721 const customProps = customMapping[key](value); 722 if (customProps != null) { 723 Object.assign(props, customProps); 724 } 725 continue; 726 } 727 if (value === true) { 728 props[`data-$key.toLowerCase()}`] = ""; 729 } else if (value) { 730 props[`data-$key.toLowerCase()}`] = value.toString(); 731 } 732 } 733 return props; 734 } 735 736 // node_modules/@base-ui/react/utils/resolveClassName.mjs 737 function resolveClassName(className, state) { 738 return typeof className === "function" ? className(state) : className; 739 } 740 741 // node_modules/@base-ui/react/utils/resolveStyle.mjs 742 function resolveStyle(style, state) { 743 return typeof style === "function" ? style(state) : style; 744 } 745 746 // node_modules/@base-ui/react/merge-props/mergeProps.mjs 747 var EMPTY_PROPS = {}; 748 function mergeProps(a2, b2, c2, d2, e2) { 749 if (!c2 && !d2 && !e2 && !a2) { 750 return createInitialMergedProps(b2); 751 } 752 let merged = createInitialMergedProps(a2); 753 if (b2) { 754 merged = mergeInto(merged, b2); 755 } 756 if (c2) { 757 merged = mergeInto(merged, c2); 758 } 759 if (d2) { 760 merged = mergeInto(merged, d2); 761 } 762 if (e2) { 763 merged = mergeInto(merged, e2); 764 } 765 return merged; 766 } 767 function mergePropsN(props) { 768 if (props.length === 0) { 769 return EMPTY_PROPS; 770 } 771 if (props.length === 1) { 772 return createInitialMergedProps(props[0]); 773 } 774 let merged = createInitialMergedProps(props[0]); 775 for (let i2 = 1; i2 < props.length; i2 += 1) { 776 merged = mergeInto(merged, props[i2]); 777 } 778 return merged; 779 } 780 function createInitialMergedProps(inputProps) { 781 if (isPropsGetter(inputProps)) { 782 return { 783 ...resolvePropsGetter(inputProps, EMPTY_PROPS) 784 }; 785 } 786 return copyInitialProps(inputProps); 787 } 788 function mergeInto(merged, inputProps) { 789 if (isPropsGetter(inputProps)) { 790 return resolvePropsGetter(inputProps, merged); 791 } 792 return mutablyMergeInto(merged, inputProps); 793 } 794 function copyInitialProps(inputProps) { 795 const copiedProps = { 796 ...inputProps 797 }; 798 for (const propName in copiedProps) { 799 const propValue = copiedProps[propName]; 800 if (isEventHandler(propName, propValue)) { 801 copiedProps[propName] = wrapEventHandler(propValue); 802 } 803 } 804 return copiedProps; 805 } 806 function mutablyMergeInto(mergedProps, externalProps) { 807 if (!externalProps) { 808 return mergedProps; 809 } 810 for (const propName in externalProps) { 811 const externalPropValue = externalProps[propName]; 812 switch (propName) { 813 case "style": { 814 mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue); 815 break; 816 } 817 case "className": { 818 mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue); 819 break; 820 } 821 default: { 822 if (isEventHandler(propName, externalPropValue)) { 823 mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue); 824 } else { 825 mergedProps[propName] = externalPropValue; 826 } 827 } 828 } 829 } 830 return mergedProps; 831 } 832 function isEventHandler(key, value) { 833 const code0 = key.charCodeAt(0); 834 const code1 = key.charCodeAt(1); 835 const code2 = key.charCodeAt(2); 836 return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined"); 837 } 838 function isPropsGetter(inputProps) { 839 return typeof inputProps === "function"; 840 } 841 function resolvePropsGetter(inputProps, previousProps) { 842 if (isPropsGetter(inputProps)) { 843 return inputProps(previousProps); 844 } 845 return inputProps ?? EMPTY_PROPS; 846 } 847 function mergeEventHandlers(ourHandler, theirHandler) { 848 if (!theirHandler) { 849 return ourHandler; 850 } 851 if (!ourHandler) { 852 return wrapEventHandler(theirHandler); 853 } 854 return (...args) => { 855 const event = args[0]; 856 if (isSyntheticEvent(event)) { 857 const baseUIEvent = event; 858 makeEventPreventable(baseUIEvent); 859 const result2 = theirHandler(...args); 860 if (!baseUIEvent.baseUIHandlerPrevented) { 861 ourHandler?.(...args); 862 } 863 return result2; 864 } 865 const result = theirHandler(...args); 866 ourHandler?.(...args); 867 return result; 868 }; 869 } 870 function wrapEventHandler(handler) { 871 if (!handler) { 872 return handler; 873 } 874 return (...args) => { 875 const event = args[0]; 876 if (isSyntheticEvent(event)) { 877 makeEventPreventable(event); 878 } 879 return handler(...args); 880 }; 881 } 882 function makeEventPreventable(event) { 883 event.preventBaseUIHandler = () => { 884 event.baseUIHandlerPrevented = true; 885 }; 886 return event; 887 } 888 function mergeClassNames(ourClassName, theirClassName) { 889 if (theirClassName) { 890 if (ourClassName) { 891 return theirClassName + " " + ourClassName; 892 } 893 return theirClassName; 894 } 895 return ourClassName; 896 } 897 function isSyntheticEvent(event) { 898 return event != null && typeof event === "object" && "nativeEvent" in event; 899 } 900 901 // node_modules/@base-ui/react/internals/useRenderElement.mjs 902 var import_react = __toESM(require_react(), 1); 903 function useRenderElement(element, componentProps, params = {}) { 904 const renderProp = componentProps.render; 905 const outProps = useRenderElementProps(componentProps, params); 906 if (params.enabled === false) { 907 return null; 908 } 909 const state = params.state ?? EMPTY_OBJECT; 910 return evaluateRenderProp(element, renderProp, outProps, state); 911 } 912 function useRenderElementProps(componentProps, params = {}) { 913 const { 914 className: classNameProp, 915 style: styleProp, 916 render: renderProp 917 } = componentProps; 918 const { 919 state = EMPTY_OBJECT, 920 ref, 921 props, 922 stateAttributesMapping: stateAttributesMapping3, 923 enabled = true 924 } = params; 925 const className = enabled ? resolveClassName(classNameProp, state) : void 0; 926 const style = enabled ? resolveStyle(styleProp, state) : void 0; 927 const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping3) : EMPTY_OBJECT; 928 const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : void 0; 929 const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT; 930 if (typeof document !== "undefined") { 931 if (!enabled) { 932 useMergedRefs(null, null); 933 } else if (Array.isArray(ref)) { 934 outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]); 935 } else { 936 outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref); 937 } 938 } 939 if (!enabled) { 940 return EMPTY_OBJECT; 941 } 942 if (className !== void 0) { 943 outProps.className = mergeClassNames(outProps.className, className); 944 } 945 if (style !== void 0) { 946 outProps.style = mergeObjects(outProps.style, style); 947 } 948 return outProps; 949 } 950 function resolveRenderFunctionProps(props) { 951 if (Array.isArray(props)) { 952 return mergePropsN(props); 953 } 954 return mergeProps(void 0, props); 955 } 956 var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"); 957 var COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/; 958 var LOWERCASE_CHARACTER_PATTERN = /[a-z]/; 959 function evaluateRenderProp(element, render, props, state) { 960 if (render) { 961 if (typeof render === "function") { 962 if (true) { 963 warnIfRenderPropLooksLikeComponent(render); 964 } 965 return render(props, state); 966 } 967 const mergedProps = mergeProps(props, render.props); 968 mergedProps.ref = props.ref; 969 let newElement = render; 970 if (newElement?.$$typeof === REACT_LAZY_TYPE) { 971 const children = React8.Children.toArray(render); 972 newElement = children[0]; 973 } 974 if (true) { 975 if (!/* @__PURE__ */ React8.isValidElement(newElement)) { 976 throw new Error(["Base UI: The `render` prop was provided an invalid React element as `React.isValidElement(render)` is `false`.", "A valid React element must be provided to the `render` prop because it is cloned with props to replace the default element.", "https://base-ui.com/r/invalid-render-prop"].join("\n")); 977 } 978 } 979 return /* @__PURE__ */ React8.cloneElement(newElement, mergedProps); 980 } 981 if (element) { 982 if (typeof element === "string") { 983 return renderTag(element, props); 984 } 985 } 986 throw new Error(true ? "Base UI: Render element or function are not defined." : formatErrorMessage_default(8)); 987 } 988 function warnIfRenderPropLooksLikeComponent(renderFn) { 989 const functionName = renderFn.name; 990 if (functionName.length === 0) { 991 return; 992 } 993 if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) { 994 return; 995 } 996 if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) { 997 return; 998 } 999 warn(`The \`render\` prop received a function named \`$functionName}\` that starts with an uppercase letter.`, "This usually means a React component was passed directly as `render={Component}`.", "Base UI calls `render` as a plain function, which can break the Rules of Hooks during reconciliation.", "If this is an intentional render callback, rename it to start with a lowercase letter.", "Use `render={<Component />}` or `render={(props) => <Component {...props} />}` instead.", "https://base-ui.com/r/invalid-render-prop"); 1000 } 1001 function renderTag(Tag, props) { 1002 if (Tag === "button") { 1003 return /* @__PURE__ */ (0, import_react.createElement)("button", { 1004 type: "button", 1005 ...props, 1006 key: props.key 1007 }); 1008 } 1009 if (Tag === "img") { 1010 return /* @__PURE__ */ (0, import_react.createElement)("img", { 1011 alt: "", 1012 ...props, 1013 key: props.key 1014 }); 1015 } 1016 return /* @__PURE__ */ React8.createElement(Tag, props); 1017 } 1018 1019 // node_modules/@base-ui/utils/useId.mjs 1020 var React9 = __toESM(require_react(), 1); 1021 var globalId = 0; 1022 function useGlobalId(idOverride, prefix = "mui") { 1023 const [defaultId, setDefaultId] = React9.useState(idOverride); 1024 const id = idOverride || defaultId; 1025 React9.useEffect(() => { 1026 if (defaultId == null) { 1027 globalId += 1; 1028 setDefaultId(`$prefix}-$globalId}`); 1029 } 1030 }, [defaultId, prefix]); 1031 return id; 1032 } 1033 var maybeReactUseId = SafeReact.useId; 1034 function useId(idOverride, prefix) { 1035 if (maybeReactUseId !== void 0) { 1036 const reactId = maybeReactUseId(); 1037 return idOverride ?? (prefix ? `$prefix}-$reactId}` : reactId); 1038 } 1039 return useGlobalId(idOverride, prefix); 1040 } 1041 1042 // node_modules/@base-ui/react/internals/useBaseUiId.mjs 1043 function useBaseUiId(idOverride) { 1044 return useId(idOverride, "base-ui"); 1045 } 1046 1047 // node_modules/@base-ui/react/internals/reason-parts.mjs 1048 var reason_parts_exports = {}; 1049 __export(reason_parts_exports, { 1050 cancelOpen: () => cancelOpen, 1051 chipRemovePress: () => chipRemovePress, 1052 clearPress: () => clearPress, 1053 closePress: () => closePress, 1054 closeWatcher: () => closeWatcher, 1055 decrementPress: () => decrementPress, 1056 disabled: () => disabled, 1057 drag: () => drag, 1058 escapeKey: () => escapeKey, 1059 focusOut: () => focusOut, 1060 imperativeAction: () => imperativeAction, 1061 incrementPress: () => incrementPress, 1062 initial: () => initial, 1063 inputBlur: () => inputBlur, 1064 inputChange: () => inputChange, 1065 inputClear: () => inputClear, 1066 inputPaste: () => inputPaste, 1067 inputPress: () => inputPress, 1068 itemPress: () => itemPress, 1069 keyboard: () => keyboard, 1070 linkPress: () => linkPress, 1071 listNavigation: () => listNavigation, 1072 missing: () => missing, 1073 none: () => none, 1074 outsidePress: () => outsidePress, 1075 pointer: () => pointer, 1076 scrub: () => scrub, 1077 siblingOpen: () => siblingOpen, 1078 swipe: () => swipe, 1079 trackPress: () => trackPress, 1080 triggerFocus: () => triggerFocus, 1081 triggerHover: () => triggerHover, 1082 triggerPress: () => triggerPress, 1083 wheel: () => wheel, 1084 windowResize: () => windowResize 1085 }); 1086 var none = "none"; 1087 var triggerPress = "trigger-press"; 1088 var triggerHover = "trigger-hover"; 1089 var triggerFocus = "trigger-focus"; 1090 var outsidePress = "outside-press"; 1091 var itemPress = "item-press"; 1092 var closePress = "close-press"; 1093 var linkPress = "link-press"; 1094 var clearPress = "clear-press"; 1095 var chipRemovePress = "chip-remove-press"; 1096 var trackPress = "track-press"; 1097 var incrementPress = "increment-press"; 1098 var decrementPress = "decrement-press"; 1099 var inputChange = "input-change"; 1100 var inputClear = "input-clear"; 1101 var inputBlur = "input-blur"; 1102 var inputPaste = "input-paste"; 1103 var inputPress = "input-press"; 1104 var focusOut = "focus-out"; 1105 var escapeKey = "escape-key"; 1106 var closeWatcher = "close-watcher"; 1107 var listNavigation = "list-navigation"; 1108 var keyboard = "keyboard"; 1109 var pointer = "pointer"; 1110 var drag = "drag"; 1111 var wheel = "wheel"; 1112 var scrub = "scrub"; 1113 var cancelOpen = "cancel-open"; 1114 var siblingOpen = "sibling-open"; 1115 var disabled = "disabled"; 1116 var missing = "missing"; 1117 var initial = "initial"; 1118 var imperativeAction = "imperative-action"; 1119 var swipe = "swipe"; 1120 var windowResize = "window-resize"; 1121 1122 // node_modules/@base-ui/react/internals/createBaseUIEventDetails.mjs 1123 function createChangeEventDetails(reason, event, trigger, customProperties) { 1124 let canceled = false; 1125 let allowPropagation = false; 1126 const custom = customProperties ?? EMPTY_OBJECT; 1127 const details = { 1128 reason, 1129 event: event ?? new Event("base-ui"), 1130 cancel() { 1131 canceled = true; 1132 }, 1133 allowPropagation() { 1134 allowPropagation = true; 1135 }, 1136 get isCanceled() { 1137 return canceled; 1138 }, 1139 get isPropagationAllowed() { 1140 return allowPropagation; 1141 }, 1142 trigger, 1143 ...custom 1144 }; 1145 return details; 1146 } 1147 1148 // node_modules/@base-ui/react/internals/useTransitionStatus.mjs 1149 var React11 = __toESM(require_react(), 1); 1150 1151 // node_modules/@base-ui/utils/useOnMount.mjs 1152 var React10 = __toESM(require_react(), 1); 1153 var EMPTY = []; 1154 function useOnMount(fn) { 1155 React10.useEffect(fn, EMPTY); 1156 } 1157 1158 // node_modules/@base-ui/utils/useAnimationFrame.mjs 1159 var EMPTY2 = null; 1160 var LAST_RAF = globalThis.requestAnimationFrame; 1161 var Scheduler = class { 1162 /* This implementation uses an array as a backing data-structure for frame callbacks. 1163 * It allows `O(1)` callback cancelling by inserting a `null` in the array, though it 1164 * never calls the native `cancelAnimationFrame` if there are no frames left. This can 1165 * be much more efficient if there is a call pattern that alterns as 1166 * "request-cancel-request-cancel-…". 1167 * But in the case of "request-request-…-cancel-cancel-…", it leaves the final animation 1168 * frame to run anyway. We turn that frame into a `O(1)` no-op via `callbacksCount`. */ 1169 callbacks = []; 1170 callbacksCount = 0; 1171 nextId = 1; 1172 startId = 1; 1173 isScheduled = false; 1174 tick = (timestamp) => { 1175 this.isScheduled = false; 1176 const currentCallbacks = this.callbacks; 1177 const currentCallbacksCount = this.callbacksCount; 1178 this.callbacks = []; 1179 this.callbacksCount = 0; 1180 this.startId = this.nextId; 1181 if (currentCallbacksCount > 0) { 1182 for (let i2 = 0; i2 < currentCallbacks.length; i2 += 1) { 1183 currentCallbacks[i2]?.(timestamp); 1184 } 1185 } 1186 }; 1187 request(fn) { 1188 const id = this.nextId; 1189 this.nextId += 1; 1190 this.callbacks.push(fn); 1191 this.callbacksCount += 1; 1192 const didRAFChange = LAST_RAF !== requestAnimationFrame && (LAST_RAF = requestAnimationFrame, true); 1193 if (!this.isScheduled || didRAFChange) { 1194 requestAnimationFrame(this.tick); 1195 this.isScheduled = true; 1196 } 1197 return id; 1198 } 1199 cancel(id) { 1200 const index2 = id - this.startId; 1201 if (index2 < 0 || index2 >= this.callbacks.length) { 1202 return; 1203 } 1204 this.callbacks[index2] = null; 1205 this.callbacksCount -= 1; 1206 } 1207 }; 1208 var scheduler = new Scheduler(); 1209 var AnimationFrame = class _AnimationFrame { 1210 static create() { 1211 return new _AnimationFrame(); 1212 } 1213 static request(fn) { 1214 return scheduler.request(fn); 1215 } 1216 static cancel(id) { 1217 return scheduler.cancel(id); 1218 } 1219 currentId = EMPTY2; 1220 /** 1221 * Executes `fn` after `delay`, clearing any previously scheduled call. 1222 */ 1223 request(fn) { 1224 this.cancel(); 1225 this.currentId = scheduler.request(() => { 1226 this.currentId = EMPTY2; 1227 fn(); 1228 }); 1229 } 1230 cancel = () => { 1231 if (this.currentId !== EMPTY2) { 1232 scheduler.cancel(this.currentId); 1233 this.currentId = EMPTY2; 1234 } 1235 }; 1236 disposeEffect = () => { 1237 return this.cancel; 1238 }; 1239 }; 1240 function useAnimationFrame() { 1241 const timeout = useRefWithInit(AnimationFrame.create).current; 1242 useOnMount(timeout.disposeEffect); 1243 return timeout; 1244 } 1245 1246 // node_modules/@base-ui/react/internals/useTransitionStatus.mjs 1247 function useTransitionStatus(open, enableIdleState = false, deferEndingState = false) { 1248 const [transitionStatus, setTransitionStatus] = React11.useState(open && enableIdleState ? "idle" : void 0); 1249 const [mounted, setMounted] = React11.useState(open); 1250 if (open && !mounted) { 1251 setMounted(true); 1252 setTransitionStatus("starting"); 1253 } 1254 if (!open && mounted && transitionStatus !== "ending" && !deferEndingState) { 1255 setTransitionStatus("ending"); 1256 } 1257 if (!open && !mounted && transitionStatus === "ending") { 1258 setTransitionStatus(void 0); 1259 } 1260 useIsoLayoutEffect(() => { 1261 if (!open && mounted && transitionStatus !== "ending" && deferEndingState) { 1262 const frame = AnimationFrame.request(() => { 1263 setTransitionStatus("ending"); 1264 }); 1265 return () => { 1266 AnimationFrame.cancel(frame); 1267 }; 1268 } 1269 return void 0; 1270 }, [open, mounted, transitionStatus, deferEndingState]); 1271 useIsoLayoutEffect(() => { 1272 if (!open || enableIdleState) { 1273 return void 0; 1274 } 1275 const frame = AnimationFrame.request(() => { 1276 setTransitionStatus(void 0); 1277 }); 1278 return () => { 1279 AnimationFrame.cancel(frame); 1280 }; 1281 }, [enableIdleState, open]); 1282 useIsoLayoutEffect(() => { 1283 if (!open || !enableIdleState) { 1284 return void 0; 1285 } 1286 if (open && mounted && transitionStatus !== "idle") { 1287 setTransitionStatus("starting"); 1288 } 1289 const frame = AnimationFrame.request(() => { 1290 setTransitionStatus("idle"); 1291 }); 1292 return () => { 1293 AnimationFrame.cancel(frame); 1294 }; 1295 }, [enableIdleState, open, mounted, transitionStatus]); 1296 return { 1297 mounted, 1298 setMounted, 1299 transitionStatus 1300 }; 1301 } 1302 1303 // node_modules/@base-ui/react/internals/stateAttributesMapping.mjs 1304 var TransitionStatusDataAttributes = /* @__PURE__ */ (function(TransitionStatusDataAttributes2) { 1305 TransitionStatusDataAttributes2["startingStyle"] = "data-starting-style"; 1306 TransitionStatusDataAttributes2["endingStyle"] = "data-ending-style"; 1307 return TransitionStatusDataAttributes2; 1308 })({}); 1309 var STARTING_HOOK = { 1310 [TransitionStatusDataAttributes.startingStyle]: "" 1311 }; 1312 var ENDING_HOOK = { 1313 [TransitionStatusDataAttributes.endingStyle]: "" 1314 }; 1315 var transitionStatusMapping = { 1316 transitionStatus(value) { 1317 if (value === "starting") { 1318 return STARTING_HOOK; 1319 } 1320 if (value === "ending") { 1321 return ENDING_HOOK; 1322 } 1323 return null; 1324 } 1325 }; 1326 1327 // node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs 1328 function hasWindow() { 1329 return typeof window !== "undefined"; 1330 } 1331 function getNodeName(node) { 1332 if (isNode(node)) { 1333 return (node.nodeName || "").toLowerCase(); 1334 } 1335 return "#document"; 1336 } 1337 function getWindow(node) { 1338 var _node$ownerDocument; 1339 return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window; 1340 } 1341 function getDocumentElement(node) { 1342 var _ref; 1343 return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement; 1344 } 1345 function isNode(value) { 1346 if (!hasWindow()) { 1347 return false; 1348 } 1349 return value instanceof Node || value instanceof getWindow(value).Node; 1350 } 1351 function isElement(value) { 1352 if (!hasWindow()) { 1353 return false; 1354 } 1355 return value instanceof Element || value instanceof getWindow(value).Element; 1356 } 1357 function isHTMLElement(value) { 1358 if (!hasWindow()) { 1359 return false; 1360 } 1361 return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement; 1362 } 1363 function isShadowRoot(value) { 1364 if (!hasWindow() || typeof ShadowRoot === "undefined") { 1365 return false; 1366 } 1367 return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot; 1368 } 1369 function isOverflowElement(element) { 1370 const { 1371 overflow, 1372 overflowX, 1373 overflowY, 1374 display 1375 } = getComputedStyle2(element); 1376 return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents"; 1377 } 1378 function isTableElement(element) { 1379 return /^(table|td|th)$/.test(getNodeName(element)); 1380 } 1381 function isTopLayer(element) { 1382 try { 1383 if (element.matches(":popover-open")) { 1384 return true; 1385 } 1386 } catch (_e) { 1387 } 1388 try { 1389 return element.matches(":modal"); 1390 } catch (_e) { 1391 return false; 1392 } 1393 } 1394 var willChangeRe = /transform|translate|scale|rotate|perspective|filter/; 1395 var containRe = /paint|layout|strict|content/; 1396 var isNotNone = (value) => !!value && value !== "none"; 1397 var isWebKitValue; 1398 function isContainingBlock(elementOrCss) { 1399 const css = isElement(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss; 1400 return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || "") || containRe.test(css.contain || ""); 1401 } 1402 function getContainingBlock(element) { 1403 let currentNode = getParentNode(element); 1404 while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) { 1405 if (isContainingBlock(currentNode)) { 1406 return currentNode; 1407 } else if (isTopLayer(currentNode)) { 1408 return null; 1409 } 1410 currentNode = getParentNode(currentNode); 1411 } 1412 return null; 1413 } 1414 function isWebKit() { 1415 if (isWebKitValue == null) { 1416 isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none"); 1417 } 1418 return isWebKitValue; 1419 } 1420 function isLastTraversableNode(node) { 1421 return /^(html|body|#document)$/.test(getNodeName(node)); 1422 } 1423 function getComputedStyle2(element) { 1424 return getWindow(element).getComputedStyle(element); 1425 } 1426 function getNodeScroll(element) { 1427 if (isElement(element)) { 1428 return { 1429 scrollLeft: element.scrollLeft, 1430 scrollTop: element.scrollTop 1431 }; 1432 } 1433 return { 1434 scrollLeft: element.scrollX, 1435 scrollTop: element.scrollY 1436 }; 1437 } 1438 function getParentNode(node) { 1439 if (getNodeName(node) === "html") { 1440 return node; 1441 } 1442 const result = ( 1443 // Step into the shadow DOM of the parent of a slotted node. 1444 node.assignedSlot || // DOM Element detected. 1445 node.parentNode || // ShadowRoot detected. 1446 isShadowRoot(node) && node.host || // Fallback. 1447 getDocumentElement(node) 1448 ); 1449 return isShadowRoot(result) ? result.host : result; 1450 } 1451 function getNearestOverflowAncestor(node) { 1452 const parentNode = getParentNode(node); 1453 if (isLastTraversableNode(parentNode)) { 1454 return node.ownerDocument ? node.ownerDocument.body : node.body; 1455 } 1456 if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) { 1457 return parentNode; 1458 } 1459 return getNearestOverflowAncestor(parentNode); 1460 } 1461 function getOverflowAncestors(node, list, traverseIframes) { 1462 var _node$ownerDocument2; 1463 if (list === void 0) { 1464 list = []; 1465 } 1466 if (traverseIframes === void 0) { 1467 traverseIframes = true; 1468 } 1469 const scrollableAncestor = getNearestOverflowAncestor(node); 1470 const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body); 1471 const win = getWindow(scrollableAncestor); 1472 if (isBody) { 1473 const frameElement = getFrameElement(win); 1474 return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []); 1475 } else { 1476 return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes)); 1477 } 1478 } 1479 function getFrameElement(win) { 1480 return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null; 1481 } 1482 1483 // node_modules/@base-ui/utils/addEventListener.mjs 1484 function addEventListener(target, type, listener, options) { 1485 target.addEventListener(type, listener, options); 1486 return () => { 1487 target.removeEventListener(type, listener, options); 1488 }; 1489 } 1490 1491 // node_modules/@base-ui/utils/useValueAsRef.mjs 1492 function useValueAsRef(value) { 1493 const latest = useRefWithInit(createLatestRef, value).current; 1494 latest.next = value; 1495 useIsoLayoutEffect(latest.effect); 1496 return latest; 1497 } 1498 function createLatestRef(value) { 1499 const latest = { 1500 current: value, 1501 next: value, 1502 effect: () => { 1503 latest.current = latest.next; 1504 } 1505 }; 1506 return latest; 1507 } 1508 1509 // node_modules/@base-ui/utils/owner.mjs 1510 function ownerDocument(node) { 1511 return node?.ownerDocument || document; 1512 } 1513 1514 // node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs 1515 var React12 = __toESM(require_react(), 1); 1516 1517 // node_modules/@base-ui/react/internals/useAnimationsFinished.mjs 1518 var ReactDOM = __toESM(require_react_dom(), 1); 1519 1520 // node_modules/@base-ui/react/utils/resolveRef.mjs 1521 function resolveRef(maybeRef) { 1522 if (maybeRef == null) { 1523 return maybeRef; 1524 } 1525 return "current" in maybeRef ? maybeRef.current : maybeRef; 1526 } 1527 1528 // node_modules/@base-ui/react/internals/useAnimationsFinished.mjs 1529 function useAnimationsFinished(elementOrRef, waitForStartingStyleRemoved = false, treatAbortedAsFinished = true) { 1530 const frame = useAnimationFrame(); 1531 return useStableCallback((fnToExecute, signal = null) => { 1532 frame.cancel(); 1533 const element = resolveRef(elementOrRef); 1534 if (element == null) { 1535 return; 1536 } 1537 const resolvedElement = element; 1538 const done = () => { 1539 ReactDOM.flushSync(fnToExecute); 1540 }; 1541 if (typeof resolvedElement.getAnimations !== "function" || globalThis.BASE_UI_ANIMATIONS_DISABLED) { 1542 fnToExecute(); 1543 return; 1544 } 1545 function exec() { 1546 Promise.all(resolvedElement.getAnimations().map((animation) => animation.finished)).then(() => { 1547 if (!signal?.aborted) { 1548 done(); 1549 } 1550 }).catch(() => { 1551 if (treatAbortedAsFinished) { 1552 if (!signal?.aborted) { 1553 done(); 1554 } 1555 return; 1556 } 1557 const currentAnimations = resolvedElement.getAnimations(); 1558 if (!signal?.aborted && currentAnimations.length > 0 && currentAnimations.some((animation) => animation.pending || animation.playState !== "finished")) { 1559 exec(); 1560 } 1561 }); 1562 } 1563 if (waitForStartingStyleRemoved) { 1564 const startingStyleAttribute = TransitionStatusDataAttributes.startingStyle; 1565 if (!resolvedElement.hasAttribute(startingStyleAttribute)) { 1566 frame.request(exec); 1567 return; 1568 } 1569 const attributeObserver = new MutationObserver(() => { 1570 if (!resolvedElement.hasAttribute(startingStyleAttribute)) { 1571 attributeObserver.disconnect(); 1572 exec(); 1573 } 1574 }); 1575 attributeObserver.observe(resolvedElement, { 1576 attributes: true, 1577 attributeFilter: [startingStyleAttribute] 1578 }); 1579 signal?.addEventListener("abort", () => attributeObserver.disconnect(), { 1580 once: true 1581 }); 1582 return; 1583 } 1584 frame.request(exec); 1585 }); 1586 } 1587 1588 // node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs 1589 function useOpenChangeComplete(parameters) { 1590 const { 1591 enabled = true, 1592 open, 1593 ref, 1594 onComplete: onCompleteParam 1595 } = parameters; 1596 const onComplete = useStableCallback(onCompleteParam); 1597 const runOnceAnimationsFinish = useAnimationsFinished(ref, open, false); 1598 React12.useEffect(() => { 1599 if (!enabled) { 1600 return void 0; 1601 } 1602 const abortController = new AbortController(); 1603 runOnceAnimationsFinish(onComplete, abortController.signal); 1604 return () => { 1605 abortController.abort(); 1606 }; 1607 }, [enabled, open, onComplete, runOnceAnimationsFinish]); 1608 } 1609 1610 // node_modules/@base-ui/utils/useOnFirstRender.mjs 1611 var React13 = __toESM(require_react(), 1); 1612 function useOnFirstRender(fn) { 1613 const ref = React13.useRef(true); 1614 if (ref.current) { 1615 ref.current = false; 1616 fn(); 1617 } 1618 } 1619 1620 // node_modules/@base-ui/utils/platform/parts.mjs 1621 var parts_exports = {}; 1622 __export(parts_exports, { 1623 engine: () => engine_exports, 1624 env: () => env_exports, 1625 os: () => os_exports, 1626 screenReader: () => screen_reader_exports 1627 }); 1628 1629 // node_modules/@base-ui/utils/platform/os.mjs 1630 var os_exports = {}; 1631 __export(os_exports, { 1632 android: () => android, 1633 apple: () => apple, 1634 ios: () => ios, 1635 linux: () => linux, 1636 mac: () => mac, 1637 windows: () => windows 1638 }); 1639 1640 // node_modules/@base-ui/utils/platform/shared.mjs 1641 function readRawData() { 1642 if (typeof navigator === "undefined") { 1643 return { 1644 userAgent: "", 1645 platform: "", 1646 maxTouchPoints: 0 1647 }; 1648 } 1649 if (true) { 1650 const uaData = navigator.userAgentData; 1651 if (uaData && Array.isArray(uaData.brands)) { 1652 return { 1653 userAgent: uaData.brands.map(({ 1654 brand, 1655 version: version2 1656 }) => `$brand}/$version2}`).join(" "), 1657 platform: uaData.platform ?? navigator.platform ?? "", 1658 maxTouchPoints: navigator.maxTouchPoints ?? 0 1659 }; 1660 } 1661 } 1662 return { 1663 userAgent: navigator.userAgent, 1664 platform: navigator.platform ?? "", 1665 maxTouchPoints: navigator.maxTouchPoints ?? 0 1666 }; 1667 } 1668 var { 1669 userAgent, 1670 platform, 1671 maxTouchPoints 1672 } = readRawData(); 1673 var lowerUserAgent = userAgent.toLowerCase(); 1674 var lowerPlatform = platform.toLowerCase(); 1675 1676 // node_modules/@base-ui/utils/platform/os.mjs 1677 var ios = /^i(os$|p)/.test(lowerPlatform) || lowerPlatform === "macintel" && maxTouchPoints > 1; 1678 var ANDROID_STRING = "android"; 1679 var android = lowerPlatform === ANDROID_STRING || lowerUserAgent.includes(ANDROID_STRING); 1680 var mac = !ios && lowerPlatform.startsWith("mac"); 1681 var windows = lowerPlatform.startsWith("win"); 1682 var linux = !android && /^(linux|chrome os)/.test(lowerPlatform); 1683 var apple = mac || ios; 1684 1685 // node_modules/@base-ui/utils/platform/engine.mjs 1686 var engine_exports = {}; 1687 __export(engine_exports, { 1688 blink: () => blink, 1689 gecko: () => gecko, 1690 webkit: () => webkit 1691 }); 1692 var webkit = typeof CSS !== "undefined" && !!CSS.supports?.("-webkit-backdrop-filter:none"); 1693 var gecko = !webkit && lowerUserAgent.includes("firefox"); 1694 var blink = !webkit && lowerUserAgent.includes("chrom"); 1695 1696 // node_modules/@base-ui/utils/platform/screen-reader.mjs 1697 var screen_reader_exports = {}; 1698 __export(screen_reader_exports, { 1699 voiceOver: () => voiceOver 1700 }); 1701 var voiceOver = apple; 1702 1703 // node_modules/@base-ui/utils/platform/env.mjs 1704 var env_exports = {}; 1705 __export(env_exports, { 1706 jsdom: () => jsdom 1707 }); 1708 var jsdom = /jsdom|happydom/.test(lowerUserAgent); 1709 1710 // node_modules/@base-ui/utils/useTimeout.mjs 1711 var EMPTY3 = 0; 1712 var Timeout = class _Timeout { 1713 static create() { 1714 return new _Timeout(); 1715 } 1716 currentId = EMPTY3; 1717 /** 1718 * Executes `fn` after `delay`, clearing any previously scheduled call. 1719 */ 1720 start(delay, fn) { 1721 this.clear(); 1722 this.currentId = setTimeout(() => { 1723 this.currentId = EMPTY3; 1724 fn(); 1725 }, delay); 1726 } 1727 isStarted() { 1728 return this.currentId !== EMPTY3; 1729 } 1730 clear = () => { 1731 if (this.currentId !== EMPTY3) { 1732 clearTimeout(this.currentId); 1733 this.currentId = EMPTY3; 1734 } 1735 }; 1736 disposeEffect = () => { 1737 return this.clear; 1738 }; 1739 }; 1740 function useTimeout() { 1741 const timeout = useRefWithInit(Timeout.create).current; 1742 useOnMount(timeout.disposeEffect); 1743 return timeout; 1744 } 1745 1746 // node_modules/@base-ui/react/floating-ui-react/components/FloatingDelayGroup.mjs 1747 var React14 = __toESM(require_react(), 1); 1748 1749 // node_modules/@base-ui/react/floating-ui-react/utils/event.mjs 1750 function isReactEvent(event) { 1751 return "nativeEvent" in event; 1752 } 1753 function isMouseLikePointerType(pointerType, strict) { 1754 const values = ["mouse", "pen"]; 1755 if (!strict) { 1756 values.push("", void 0); 1757 } 1758 return values.includes(pointerType); 1759 } 1760 function isClickLikeEvent(event) { 1761 const type = event.type; 1762 return type === "click" || type === "mousedown" || type === "keydown" || type === "keyup"; 1763 } 1764 1765 // node_modules/@base-ui/react/floating-ui-react/utils/constants.mjs 1766 var FOCUSABLE_ATTRIBUTE = "data-base-ui-focusable"; 1767 var TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])"; 1768 1769 // node_modules/@base-ui/react/internals/shadowDom.mjs 1770 function activeElement(doc) { 1771 let element = doc.activeElement; 1772 while (element?.shadowRoot?.activeElement != null) { 1773 element = element.shadowRoot.activeElement; 1774 } 1775 return element; 1776 } 1777 function contains(parent, child) { 1778 if (!parent || !child) { 1779 return false; 1780 } 1781 const rootNode = child.getRootNode?.(); 1782 if (parent.contains(child)) { 1783 return true; 1784 } 1785 if (rootNode && isShadowRoot(rootNode)) { 1786 let next = child; 1787 while (next) { 1788 if (parent === next) { 1789 return true; 1790 } 1791 next = next.parentNode || next.host; 1792 } 1793 } 1794 return false; 1795 } 1796 function getTarget(event) { 1797 if ("composedPath" in event) { 1798 return event.composedPath()[0]; 1799 } 1800 return event.target; 1801 } 1802 1803 // node_modules/@base-ui/react/floating-ui-react/utils/element.mjs 1804 function isTargetInsideEnabledTrigger(target, triggerElements) { 1805 if (!isElement(target)) { 1806 return false; 1807 } 1808 const targetElement = target; 1809 if (triggerElements.hasElement(targetElement)) { 1810 return !targetElement.hasAttribute("data-trigger-disabled"); 1811 } 1812 for (const [, trigger] of triggerElements.entries()) { 1813 if (contains(trigger, targetElement)) { 1814 return !trigger.hasAttribute("data-trigger-disabled"); 1815 } 1816 } 1817 return false; 1818 } 1819 function isEventTargetWithin(event, node) { 1820 if (node == null) { 1821 return false; 1822 } 1823 if ("composedPath" in event) { 1824 return event.composedPath().includes(node); 1825 } 1826 const eventAgain = event; 1827 return eventAgain.target != null && node.contains(eventAgain.target); 1828 } 1829 function isRootElement(element) { 1830 return element.matches("html,body"); 1831 } 1832 function isTypeableElement(element) { 1833 return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR); 1834 } 1835 function isInteractiveElement(element) { 1836 return element?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),$TYPEABLE_SELECTOR}`) != null; 1837 } 1838 function matchesFocusVisible(element) { 1839 if (!element || parts_exports.env.jsdom) { 1840 return true; 1841 } 1842 try { 1843 return element.matches(":focus-visible"); 1844 } catch (_e) { 1845 return true; 1846 } 1847 } 1848 1849 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverShared.mjs 1850 function resolveValue(value, pointerType) { 1851 if (pointerType != null && !isMouseLikePointerType(pointerType)) { 1852 return 0; 1853 } 1854 if (typeof value === "function") { 1855 return value(); 1856 } 1857 return value; 1858 } 1859 function getDelay(value, prop, pointerType) { 1860 const result = resolveValue(value, pointerType); 1861 if (typeof result === "number") { 1862 return result; 1863 } 1864 return result?.[prop]; 1865 } 1866 function getRestMs(value) { 1867 if (typeof value === "function") { 1868 return value(); 1869 } 1870 return value; 1871 } 1872 function isClickLikeOpenEvent(openEventType, interactedInside) { 1873 return interactedInside || openEventType === "click" || openEventType === "mousedown"; 1874 } 1875 function isHoverOpenEvent(openEventType) { 1876 return openEventType?.includes("mouse") && openEventType !== "mousedown"; 1877 } 1878 1879 // node_modules/@base-ui/react/floating-ui-react/components/FloatingDelayGroup.mjs 1880 var import_jsx_runtime = __toESM(require_jsx_runtime(), 1); 1881 var FloatingDelayGroupContext = /* @__PURE__ */ React14.createContext({ 1882 hasProvider: false, 1883 timeoutMs: 0, 1884 delayRef: { 1885 current: 0 1886 }, 1887 initialDelayRef: { 1888 current: 0 1889 }, 1890 timeout: new Timeout(), 1891 currentIdRef: { 1892 current: null 1893 }, 1894 currentContextRef: { 1895 current: null 1896 } 1897 }); 1898 if (true) FloatingDelayGroupContext.displayName = "FloatingDelayGroupContext"; 1899 function resetDelayRef(delayRef, initialDelayRef) { 1900 delayRef.current = initialDelayRef.current; 1901 } 1902 function FloatingDelayGroup(props) { 1903 const { 1904 children, 1905 delay, 1906 timeoutMs = 0 1907 } = props; 1908 const delayRef = React14.useRef(delay); 1909 const initialDelayRef = React14.useRef(delay); 1910 const currentIdRef = React14.useRef(null); 1911 const currentContextRef = React14.useRef(null); 1912 const timeout = useTimeout(); 1913 useIsoLayoutEffect(() => { 1914 initialDelayRef.current = delay; 1915 if (!currentIdRef.current) { 1916 delayRef.current = delay; 1917 return; 1918 } 1919 delayRef.current = { 1920 open: getDelay(delayRef.current, "open"), 1921 close: getDelay(delay, "close") 1922 }; 1923 }, [delay, currentIdRef, delayRef, initialDelayRef]); 1924 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FloatingDelayGroupContext.Provider, { 1925 value: React14.useMemo(() => ({ 1926 hasProvider: true, 1927 delayRef, 1928 initialDelayRef, 1929 currentIdRef, 1930 timeoutMs, 1931 currentContextRef, 1932 timeout 1933 }), [timeoutMs, timeout]), 1934 children 1935 }); 1936 } 1937 function useDelayGroup(context, options = { 1938 open: false 1939 }) { 1940 const { 1941 open 1942 } = options; 1943 const store = "rootStore" in context ? context.rootStore : context; 1944 const floatingId = store.useState("floatingId"); 1945 const groupContext = React14.useContext(FloatingDelayGroupContext); 1946 const { 1947 currentIdRef, 1948 delayRef, 1949 timeoutMs, 1950 initialDelayRef, 1951 currentContextRef, 1952 hasProvider, 1953 timeout 1954 } = groupContext; 1955 const [isInstantPhase, setIsInstantPhase] = React14.useState(false); 1956 const openRef = React14.useRef(open); 1957 const isUnmountedRef = React14.useRef(false); 1958 useIsoLayoutEffect(() => { 1959 openRef.current = open; 1960 }, [open]); 1961 useIsoLayoutEffect(() => { 1962 return () => { 1963 isUnmountedRef.current = true; 1964 }; 1965 }, []); 1966 useIsoLayoutEffect(() => { 1967 function unset() { 1968 if (!isUnmountedRef.current) { 1969 setIsInstantPhase(false); 1970 } 1971 currentContextRef.current?.setIsInstantPhase(false); 1972 currentIdRef.current = null; 1973 currentContextRef.current = null; 1974 delayRef.current = initialDelayRef.current; 1975 timeout.clear(); 1976 } 1977 if (!currentIdRef.current) { 1978 return void 0; 1979 } 1980 if (!open && currentIdRef.current === floatingId) { 1981 setIsInstantPhase(false); 1982 if (timeoutMs) { 1983 const closingId = floatingId; 1984 timeout.start(timeoutMs, () => { 1985 if (store.select("open") || currentIdRef.current && currentIdRef.current !== closingId) { 1986 return; 1987 } 1988 unset(); 1989 }); 1990 return () => { 1991 if (openRef.current || currentIdRef.current !== closingId) { 1992 timeout.clear(); 1993 } 1994 }; 1995 } 1996 unset(); 1997 } 1998 return void 0; 1999 }, [open, floatingId, currentIdRef, delayRef, timeoutMs, initialDelayRef, currentContextRef, timeout, store]); 2000 useIsoLayoutEffect(() => { 2001 if (!open) { 2002 return; 2003 } 2004 const prevContext = currentContextRef.current; 2005 const prevId = currentIdRef.current; 2006 timeout.clear(); 2007 currentContextRef.current = { 2008 onOpenChange: store.setOpen, 2009 setIsInstantPhase 2010 }; 2011 currentIdRef.current = floatingId; 2012 delayRef.current = { 2013 open: 0, 2014 close: getDelay(initialDelayRef.current, "close") 2015 }; 2016 if (prevId !== null && prevId !== floatingId) { 2017 setIsInstantPhase(true); 2018 prevContext?.setIsInstantPhase(true); 2019 prevContext?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.none)); 2020 } else { 2021 setIsInstantPhase(false); 2022 prevContext?.setIsInstantPhase(false); 2023 } 2024 }, [open, floatingId, store, currentIdRef, delayRef, initialDelayRef, currentContextRef, timeout]); 2025 useIsoLayoutEffect(() => { 2026 return () => { 2027 if (currentIdRef.current === floatingId) { 2028 currentContextRef.current = null; 2029 if (!openRef.current) { 2030 return; 2031 } 2032 currentIdRef.current = null; 2033 resetDelayRef(delayRef, initialDelayRef); 2034 timeout.clear(); 2035 } 2036 }; 2037 }, [currentContextRef, currentIdRef, delayRef, floatingId, initialDelayRef, timeout]); 2038 return React14.useMemo(() => ({ 2039 hasProvider, 2040 delayRef, 2041 isInstantPhase 2042 }), [hasProvider, delayRef, isInstantPhase]); 2043 } 2044 2045 // node_modules/@base-ui/utils/mergeCleanups.mjs 2046 function mergeCleanups(...cleanups) { 2047 return () => { 2048 for (let i2 = 0; i2 < cleanups.length; i2 += 1) { 2049 const cleanup = cleanups[i2]; 2050 if (cleanup) { 2051 cleanup(); 2052 } 2053 } 2054 }; 2055 } 2056 2057 // node_modules/@base-ui/react/utils/FocusGuard.mjs 2058 var React15 = __toESM(require_react(), 1); 2059 2060 // node_modules/@base-ui/utils/visuallyHidden.mjs 2061 var visuallyHiddenBase = { 2062 clipPath: "inset(50%)", 2063 overflow: "hidden", 2064 whiteSpace: "nowrap", 2065 border: 0, 2066 padding: 0, 2067 width: 1, 2068 height: 1, 2069 margin: -1 2070 }; 2071 var visuallyHidden = { 2072 ...visuallyHiddenBase, 2073 position: "fixed", 2074 top: 0, 2075 left: 0 2076 }; 2077 var visuallyHiddenInput = { 2078 ...visuallyHiddenBase, 2079 position: "absolute" 2080 }; 2081 2082 // node_modules/@base-ui/react/utils/FocusGuard.mjs 2083 var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1); 2084 var FocusGuard = /* @__PURE__ */ React15.forwardRef(function FocusGuard2(props, ref) { 2085 const [role, setRole] = React15.useState(); 2086 useIsoLayoutEffect(() => { 2087 if (parts_exports.screenReader.voiceOver && parts_exports.engine.webkit) { 2088 setRole("button"); 2089 } 2090 }, []); 2091 const restProps = { 2092 tabIndex: 0, 2093 // Role is only for VoiceOver 2094 role 2095 }; 2096 return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { 2097 ...props, 2098 ref, 2099 style: visuallyHidden, 2100 "aria-hidden": role ? void 0 : true, 2101 ...restProps, 2102 "data-base-ui-focus-guard": "" 2103 }); 2104 }); 2105 if (true) FocusGuard.displayName = "FocusGuard"; 2106 2107 // node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs 2108 var sides = ["top", "right", "bottom", "left"]; 2109 var min = Math.min; 2110 var max = Math.max; 2111 var round = Math.round; 2112 var floor = Math.floor; 2113 var createCoords = (v2) => ({ 2114 x: v2, 2115 y: v2 2116 }); 2117 var oppositeSideMap = { 2118 left: "right", 2119 right: "left", 2120 bottom: "top", 2121 top: "bottom" 2122 }; 2123 function clamp(start, value, end) { 2124 return max(start, min(value, end)); 2125 } 2126 function evaluate(value, param) { 2127 return typeof value === "function" ? value(param) : value; 2128 } 2129 function getSide(placement) { 2130 return placement.split("-")[0]; 2131 } 2132 function getAlignment(placement) { 2133 return placement.split("-")[1]; 2134 } 2135 function getOppositeAxis(axis) { 2136 return axis === "x" ? "y" : "x"; 2137 } 2138 function getAxisLength(axis) { 2139 return axis === "y" ? "height" : "width"; 2140 } 2141 function getSideAxis(placement) { 2142 const firstChar = placement[0]; 2143 return firstChar === "t" || firstChar === "b" ? "y" : "x"; 2144 } 2145 function getAlignmentAxis(placement) { 2146 return getOppositeAxis(getSideAxis(placement)); 2147 } 2148 function getAlignmentSides(placement, rects, rtl) { 2149 if (rtl === void 0) { 2150 rtl = false; 2151 } 2152 const alignment = getAlignment(placement); 2153 const alignmentAxis = getAlignmentAxis(placement); 2154 const length = getAxisLength(alignmentAxis); 2155 let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top"; 2156 if (rects.reference[length] > rects.floating[length]) { 2157 mainAlignmentSide = getOppositePlacement(mainAlignmentSide); 2158 } 2159 return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)]; 2160 } 2161 function getExpandedPlacements(placement) { 2162 const oppositePlacement = getOppositePlacement(placement); 2163 return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)]; 2164 } 2165 function getOppositeAlignmentPlacement(placement) { 2166 return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start"); 2167 } 2168 var lrPlacement = ["left", "right"]; 2169 var rlPlacement = ["right", "left"]; 2170 var tbPlacement = ["top", "bottom"]; 2171 var btPlacement = ["bottom", "top"]; 2172 function getSideList(side, isStart, rtl) { 2173 switch (side) { 2174 case "top": 2175 case "bottom": 2176 if (rtl) return isStart ? rlPlacement : lrPlacement; 2177 return isStart ? lrPlacement : rlPlacement; 2178 case "left": 2179 case "right": 2180 return isStart ? tbPlacement : btPlacement; 2181 default: 2182 return []; 2183 } 2184 } 2185 function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) { 2186 const alignment = getAlignment(placement); 2187 let list = getSideList(getSide(placement), direction === "start", rtl); 2188 if (alignment) { 2189 list = list.map((side) => side + "-" + alignment); 2190 if (flipAlignment) { 2191 list = list.concat(list.map(getOppositeAlignmentPlacement)); 2192 } 2193 } 2194 return list; 2195 } 2196 function getOppositePlacement(placement) { 2197 const side = getSide(placement); 2198 return oppositeSideMap[side] + placement.slice(side.length); 2199 } 2200 function expandPaddingObject(padding) { 2201 return { 2202 top: 0, 2203 right: 0, 2204 bottom: 0, 2205 left: 0, 2206 ...padding 2207 }; 2208 } 2209 function getPaddingObject(padding) { 2210 return typeof padding !== "number" ? expandPaddingObject(padding) : { 2211 top: padding, 2212 right: padding, 2213 bottom: padding, 2214 left: padding 2215 }; 2216 } 2217 function rectToClientRect(rect) { 2218 const { 2219 x: x2, 2220 y: y2, 2221 width, 2222 height 2223 } = rect; 2224 return { 2225 width, 2226 height, 2227 top: y2, 2228 left: x2, 2229 right: x2 + width, 2230 bottom: y2 + height, 2231 x: x2, 2232 y: y2 2233 }; 2234 } 2235 2236 // node_modules/@base-ui/react/floating-ui-react/utils/composite.mjs 2237 function isHiddenByStyles(styles) { 2238 return styles.visibility === "hidden" || styles.visibility === "collapse"; 2239 } 2240 function isElementVisible(element, styles = element ? getComputedStyle2(element) : null) { 2241 if (!element || !element.isConnected || !styles || isHiddenByStyles(styles)) { 2242 return false; 2243 } 2244 if (typeof element.checkVisibility === "function") { 2245 return element.checkVisibility(); 2246 } 2247 return styles.display !== "none" && styles.display !== "contents"; 2248 } 2249 2250 // node_modules/@base-ui/react/floating-ui-react/utils/tabbable.mjs 2251 var CANDIDATE_SELECTOR = 'a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]'; 2252 function getParentElement(element) { 2253 const assignedSlot = element.assignedSlot; 2254 if (assignedSlot) { 2255 return assignedSlot; 2256 } 2257 if (element.parentElement) { 2258 return element.parentElement; 2259 } 2260 const rootNode = element.getRootNode(); 2261 return isShadowRoot(rootNode) ? rootNode.host : null; 2262 } 2263 function getDetailsSummary(details) { 2264 for (const child of Array.from(details.children)) { 2265 if (getNodeName(child) === "summary") { 2266 return child; 2267 } 2268 } 2269 return null; 2270 } 2271 function isWithinOpenDetailsSummary(element, details) { 2272 const summary = getDetailsSummary(details); 2273 return !!summary && (element === summary || contains(summary, element)); 2274 } 2275 function isFocusableCandidate(element) { 2276 const nodeName = element ? getNodeName(element) : ""; 2277 return element != null && element.matches(CANDIDATE_SELECTOR) && (nodeName !== "summary" || element.parentElement != null && getNodeName(element.parentElement) === "details" && getDetailsSummary(element.parentElement) === element) && (nodeName !== "details" || getDetailsSummary(element) == null) && (nodeName !== "input" || element.type !== "hidden"); 2278 } 2279 function isFocusableElement(element) { 2280 if (!isFocusableCandidate(element) || !element.isConnected || element.matches(":disabled")) { 2281 return false; 2282 } 2283 for (let current = element; current; current = getParentElement(current)) { 2284 const isAncestor = current !== element; 2285 const isSlot = getNodeName(current) === "slot"; 2286 if (current.hasAttribute("inert")) { 2287 return false; 2288 } 2289 if (isAncestor && getNodeName(current) === "details" && !current.open && !isWithinOpenDetailsSummary(element, current) || current.hasAttribute("hidden") || !isSlot && !isVisibleInTabbableTree(current, isAncestor)) { 2290 return false; 2291 } 2292 } 2293 return true; 2294 } 2295 function isVisibleInTabbableTree(element, isAncestor) { 2296 const styles = getComputedStyle2(element); 2297 if (!isAncestor) { 2298 return isElementVisible(element, styles); 2299 } 2300 return styles.display !== "none"; 2301 } 2302 function getTabIndex(element) { 2303 const tabIndex = element.tabIndex; 2304 if (tabIndex < 0) { 2305 const nodeName = getNodeName(element); 2306 if (nodeName === "details" || nodeName === "audio" || nodeName === "video" || isHTMLElement(element) && element.isContentEditable) { 2307 return 0; 2308 } 2309 } 2310 return tabIndex; 2311 } 2312 function getNamedRadioInput(element) { 2313 if (getNodeName(element) !== "input") { 2314 return null; 2315 } 2316 const input = element; 2317 return input.type === "radio" && input.name !== "" ? input : null; 2318 } 2319 function isTabbableRadio(element, candidates) { 2320 const input = getNamedRadioInput(element); 2321 if (!input) { 2322 return true; 2323 } 2324 const checkedRadio = candidates.find((candidate) => { 2325 const radio = getNamedRadioInput(candidate); 2326 return radio?.name === input.name && radio.form === input.form && radio.checked; 2327 }); 2328 if (checkedRadio) { 2329 return checkedRadio === input; 2330 } 2331 return candidates.find((candidate) => { 2332 const radio = getNamedRadioInput(candidate); 2333 return radio?.name === input.name && radio.form === input.form; 2334 }) === input; 2335 } 2336 function getComposedChildren(container) { 2337 if (isHTMLElement(container) && getNodeName(container) === "slot") { 2338 const assignedElements = container.assignedElements({ 2339 flatten: true 2340 }); 2341 if (assignedElements.length > 0) { 2342 return assignedElements; 2343 } 2344 } 2345 if (isHTMLElement(container) && container.shadowRoot) { 2346 return Array.from(container.shadowRoot.children); 2347 } 2348 return Array.from(container.children); 2349 } 2350 function appendCandidates(container, list) { 2351 getComposedChildren(container).forEach((child) => { 2352 if (isFocusableCandidate(child)) { 2353 list.push(child); 2354 } 2355 appendCandidates(child, list); 2356 }); 2357 } 2358 function appendMatchingElements(container, selector, list) { 2359 getComposedChildren(container).forEach((child) => { 2360 if (isHTMLElement(child) && child.matches(selector)) { 2361 list.push(child); 2362 } 2363 appendMatchingElements(child, selector, list); 2364 }); 2365 } 2366 function focusable(container) { 2367 const candidates = []; 2368 appendCandidates(container, candidates); 2369 return candidates.filter(isFocusableElement); 2370 } 2371 function tabbable(container) { 2372 const candidates = focusable(container); 2373 return candidates.filter((element) => getTabIndex(element) >= 0 && isTabbableRadio(element, candidates)); 2374 } 2375 function getTabbableIn(container, dir) { 2376 const list = tabbable(container); 2377 const len = list.length; 2378 if (len === 0) { 2379 return void 0; 2380 } 2381 const active = activeElement(ownerDocument(container)); 2382 const index2 = list.indexOf(active); 2383 const nextIndex = index2 === -1 ? dir === 1 ? 0 : len - 1 : index2 + dir; 2384 return list[nextIndex]; 2385 } 2386 function getNextTabbable(referenceElement) { 2387 return getTabbableIn(ownerDocument(referenceElement).body, 1) || referenceElement; 2388 } 2389 function getPreviousTabbable(referenceElement) { 2390 return getTabbableIn(ownerDocument(referenceElement).body, -1) || referenceElement; 2391 } 2392 function isOutsideEvent(event, container) { 2393 const containerElement = container || event.currentTarget; 2394 const relatedTarget = event.relatedTarget; 2395 return !relatedTarget || !contains(containerElement, relatedTarget); 2396 } 2397 function disableFocusInside(container) { 2398 const tabbableElements = tabbable(container); 2399 tabbableElements.forEach((element) => { 2400 element.dataset.tabindex = element.getAttribute("tabindex") || ""; 2401 element.setAttribute("tabindex", "-1"); 2402 }); 2403 } 2404 function enableFocusInside(container) { 2405 const elements2 = []; 2406 appendMatchingElements(container, "[data-tabindex]", elements2); 2407 elements2.forEach((element) => { 2408 const tabindex = element.dataset.tabindex; 2409 delete element.dataset.tabindex; 2410 if (tabindex) { 2411 element.setAttribute("tabindex", tabindex); 2412 } else { 2413 element.removeAttribute("tabindex"); 2414 } 2415 }); 2416 } 2417 2418 // node_modules/@base-ui/react/floating-ui-react/utils/nodes.mjs 2419 function getNodeChildren(nodes, id, onlyOpenChildren = true) { 2420 const directChildren = nodes.filter((node) => node.parentId === id); 2421 return directChildren.flatMap((child) => [...!onlyOpenChildren || child.context?.open ? [child] : [], ...getNodeChildren(nodes, child.id, onlyOpenChildren)]); 2422 } 2423 2424 // node_modules/@base-ui/react/floating-ui-react/utils/createAttribute.mjs 2425 function createAttribute(name2) { 2426 return `data-base-ui-$name2}`; 2427 } 2428 2429 // node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs 2430 var React16 = __toESM(require_react(), 1); 2431 var ReactDOM2 = __toESM(require_react_dom(), 1); 2432 2433 // node_modules/@base-ui/react/internals/constants.mjs 2434 var DISABLED_TRANSITIONS_STYLE = { 2435 style: { 2436 transition: "none" 2437 } 2438 }; 2439 var BASE_UI_SWIPE_IGNORE_ATTRIBUTE = "data-base-ui-swipe-ignore"; 2440 var LEGACY_SWIPE_IGNORE_ATTRIBUTE = "data-swipe-ignore"; 2441 var BASE_UI_SWIPE_IGNORE_SELECTOR = `[$BASE_UI_SWIPE_IGNORE_ATTRIBUTE}]`; 2442 var LEGACY_SWIPE_IGNORE_SELECTOR = `[$LEGACY_SWIPE_IGNORE_ATTRIBUTE}]`; 2443 var POPUP_COLLISION_AVOIDANCE = { 2444 fallbackAxisSide: "end" 2445 }; 2446 var ownerVisuallyHidden = { 2447 clipPath: "inset(50%)", 2448 position: "fixed", 2449 top: 0, 2450 left: 0 2451 }; 2452 2453 // node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs 2454 var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1); 2455 var PortalContext = /* @__PURE__ */ React16.createContext(null); 2456 if (true) PortalContext.displayName = "PortalContext"; 2457 var usePortalContext = () => React16.useContext(PortalContext); 2458 var attr = createAttribute("portal"); 2459 function useFloatingPortalNode(props = {}) { 2460 const { 2461 ref, 2462 container: containerProp, 2463 componentProps = EMPTY_OBJECT, 2464 elementProps 2465 } = props; 2466 const uniqueId = useId(); 2467 const portalContext = usePortalContext(); 2468 const parentPortalNode = portalContext?.portalNode; 2469 const [containerElement, setContainerElement] = React16.useState(null); 2470 const [portalNode, setPortalNode] = React16.useState(null); 2471 const setPortalNodeRef = useStableCallback((node) => { 2472 if (node !== null) { 2473 setPortalNode(node); 2474 } 2475 }); 2476 const containerRef = React16.useRef(null); 2477 useIsoLayoutEffect(() => { 2478 if (containerProp === null) { 2479 if (containerRef.current) { 2480 containerRef.current = null; 2481 setPortalNode(null); 2482 setContainerElement(null); 2483 } 2484 return; 2485 } 2486 if (uniqueId == null) { 2487 return; 2488 } 2489 const resolvedContainer = (containerProp && (isNode(containerProp) ? containerProp : containerProp.current)) ?? parentPortalNode ?? document.body; 2490 if (resolvedContainer == null) { 2491 if (containerRef.current) { 2492 containerRef.current = null; 2493 setPortalNode(null); 2494 setContainerElement(null); 2495 } 2496 return; 2497 } 2498 if (containerRef.current !== resolvedContainer) { 2499 containerRef.current = resolvedContainer; 2500 setPortalNode(null); 2501 setContainerElement(resolvedContainer); 2502 } 2503 }, [containerProp, parentPortalNode, uniqueId]); 2504 const portalElement = useRenderElement("div", componentProps, { 2505 ref: [ref, setPortalNodeRef], 2506 props: [{ 2507 id: uniqueId, 2508 [attr]: "" 2509 }, elementProps] 2510 }); 2511 const portalSubtree = containerElement && portalElement ? /* @__PURE__ */ ReactDOM2.createPortal(portalElement, containerElement) : null; 2512 return { 2513 portalNode, 2514 portalSubtree 2515 }; 2516 } 2517 var FloatingPortal = /* @__PURE__ */ React16.forwardRef(function FloatingPortal2(componentProps, forwardedRef) { 2518 const { 2519 render, 2520 className, 2521 style, 2522 children, 2523 container, 2524 renderGuards, 2525 ...elementProps 2526 } = componentProps; 2527 const { 2528 portalNode, 2529 portalSubtree 2530 } = useFloatingPortalNode({ 2531 container, 2532 ref: forwardedRef, 2533 componentProps, 2534 elementProps 2535 }); 2536 const beforeOutsideRef = React16.useRef(null); 2537 const afterOutsideRef = React16.useRef(null); 2538 const beforeInsideRef = React16.useRef(null); 2539 const afterInsideRef = React16.useRef(null); 2540 const [focusManagerState, setFocusManagerState] = React16.useState(null); 2541 const focusInsideDisabledRef = React16.useRef(false); 2542 const modal = focusManagerState?.modal; 2543 const open = focusManagerState?.open; 2544 const shouldRenderGuards = typeof renderGuards === "boolean" ? renderGuards : !!focusManagerState && !focusManagerState.modal && focusManagerState.open && !!portalNode; 2545 React16.useEffect(() => { 2546 if (!portalNode || modal) { 2547 return void 0; 2548 } 2549 function onFocus(event) { 2550 if (portalNode && event.relatedTarget && isOutsideEvent(event)) { 2551 if (event.type === "focusin") { 2552 if (focusInsideDisabledRef.current) { 2553 enableFocusInside(portalNode); 2554 focusInsideDisabledRef.current = false; 2555 } 2556 } else { 2557 disableFocusInside(portalNode); 2558 focusInsideDisabledRef.current = true; 2559 } 2560 } 2561 } 2562 return mergeCleanups(addEventListener(portalNode, "focusin", onFocus, true), addEventListener(portalNode, "focusout", onFocus, true)); 2563 }, [portalNode, modal]); 2564 useIsoLayoutEffect(() => { 2565 if (!portalNode || open !== true || !focusInsideDisabledRef.current) { 2566 return; 2567 } 2568 enableFocusInside(portalNode); 2569 focusInsideDisabledRef.current = false; 2570 }, [open, portalNode]); 2571 const portalContextValue = React16.useMemo(() => ({ 2572 beforeOutsideRef, 2573 afterOutsideRef, 2574 beforeInsideRef, 2575 afterInsideRef, 2576 portalNode, 2577 setFocusManagerState 2578 }), [portalNode]); 2579 return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(React16.Fragment, { 2580 children: [portalSubtree, /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(PortalContext.Provider, { 2581 value: portalContextValue, 2582 children: [shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FocusGuard, { 2583 "data-type": "outside", 2584 ref: beforeOutsideRef, 2585 onFocus: (event) => { 2586 if (isOutsideEvent(event, portalNode)) { 2587 beforeInsideRef.current?.focus(); 2588 } else { 2589 const domReference = focusManagerState ? focusManagerState.domReference : null; 2590 const prevTabbable = getPreviousTabbable(domReference); 2591 prevTabbable?.focus(); 2592 } 2593 } 2594 }), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { 2595 "aria-owns": portalNode.id, 2596 style: ownerVisuallyHidden 2597 }), portalNode && /* @__PURE__ */ ReactDOM2.createPortal(children, portalNode), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FocusGuard, { 2598 "data-type": "outside", 2599 ref: afterOutsideRef, 2600 onFocus: (event) => { 2601 if (isOutsideEvent(event, portalNode)) { 2602 afterInsideRef.current?.focus(); 2603 } else { 2604 const domReference = focusManagerState ? focusManagerState.domReference : null; 2605 const nextTabbable = getNextTabbable(domReference); 2606 nextTabbable?.focus(); 2607 if (focusManagerState?.closeOnFocusOut) { 2608 focusManagerState?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.focusOut, event.nativeEvent)); 2609 } 2610 } 2611 } 2612 })] 2613 })] 2614 }); 2615 }); 2616 if (true) FloatingPortal.displayName = "FloatingPortal"; 2617 2618 // node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs 2619 var React17 = __toESM(require_react(), 1); 2620 2621 // node_modules/@base-ui/react/floating-ui-react/utils/createEventEmitter.mjs 2622 function createEventEmitter() { 2623 const map = /* @__PURE__ */ new Map(); 2624 return { 2625 emit(event, data) { 2626 map.get(event)?.forEach((listener) => listener(data)); 2627 }, 2628 on(event, listener) { 2629 if (!map.has(event)) { 2630 map.set(event, /* @__PURE__ */ new Set()); 2631 } 2632 map.get(event).add(listener); 2633 }, 2634 off(event, listener) { 2635 map.get(event)?.delete(listener); 2636 } 2637 }; 2638 } 2639 2640 // node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs 2641 var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1); 2642 var FloatingNodeContext = /* @__PURE__ */ React17.createContext(null); 2643 if (true) FloatingNodeContext.displayName = "FloatingNodeContext"; 2644 var FloatingTreeContext = /* @__PURE__ */ React17.createContext(null); 2645 if (true) FloatingTreeContext.displayName = "FloatingTreeContext"; 2646 var useFloatingParentNodeId = () => React17.useContext(FloatingNodeContext)?.id || null; 2647 var useFloatingTree = (externalTree) => { 2648 const contextTree = React17.useContext(FloatingTreeContext); 2649 return externalTree ?? contextTree; 2650 }; 2651 2652 // node_modules/@base-ui/react/floating-ui-react/hooks/useClientPoint.mjs 2653 var React18 = __toESM(require_react(), 1); 2654 function createVirtualElement(domElement, data) { 2655 let offsetX = null; 2656 let offsetY = null; 2657 let isAutoUpdateEvent = false; 2658 return { 2659 contextElement: domElement || void 0, 2660 getBoundingClientRect() { 2661 const domRect = domElement?.getBoundingClientRect() || { 2662 width: 0, 2663 height: 0, 2664 x: 0, 2665 y: 0 2666 }; 2667 const isXAxis = data.axis === "x" || data.axis === "both"; 2668 const isYAxis = data.axis === "y" || data.axis === "both"; 2669 const canTrackCursorOnAutoUpdate = ["mouseenter", "mousemove"].includes(data.dataRef.current.openEvent?.type || "") && data.pointerType !== "touch"; 2670 let width = domRect.width; 2671 let height = domRect.height; 2672 let x2 = domRect.x; 2673 let y2 = domRect.y; 2674 if (offsetX == null && data.x && isXAxis) { 2675 offsetX = domRect.x - data.x; 2676 } 2677 if (offsetY == null && data.y && isYAxis) { 2678 offsetY = domRect.y - data.y; 2679 } 2680 x2 -= offsetX || 0; 2681 y2 -= offsetY || 0; 2682 width = 0; 2683 height = 0; 2684 if (!isAutoUpdateEvent || canTrackCursorOnAutoUpdate) { 2685 width = data.axis === "y" ? domRect.width : 0; 2686 height = data.axis === "x" ? domRect.height : 0; 2687 x2 = isXAxis && data.x != null ? data.x : x2; 2688 y2 = isYAxis && data.y != null ? data.y : y2; 2689 } else if (isAutoUpdateEvent && !canTrackCursorOnAutoUpdate) { 2690 height = data.axis === "x" ? domRect.height : height; 2691 width = data.axis === "y" ? domRect.width : width; 2692 } 2693 isAutoUpdateEvent = true; 2694 return { 2695 width, 2696 height, 2697 x: x2, 2698 y: y2, 2699 top: y2, 2700 right: x2 + width, 2701 bottom: y2 + height, 2702 left: x2 2703 }; 2704 } 2705 }; 2706 } 2707 function isMouseBasedEvent(event) { 2708 return event != null && event.clientX != null; 2709 } 2710 function useClientPoint(context, props = {}) { 2711 const { 2712 enabled = true, 2713 axis = "both" 2714 } = props; 2715 const store = "rootStore" in context ? context.rootStore : context; 2716 const open = store.useState("open"); 2717 const floating = store.useState("floatingElement"); 2718 const domReference = store.useState("domReferenceElement"); 2719 const dataRef = store.context.dataRef; 2720 const initialRef = React18.useRef(false); 2721 const cleanupListenerRef = React18.useRef(null); 2722 const [pointerType, setPointerType] = React18.useState(); 2723 const [reactive, setReactive] = React18.useState([]); 2724 const resetReference = useStableCallback((reference2) => { 2725 store.set("positionReference", reference2); 2726 }); 2727 const setReference = useStableCallback((newX, newY, referenceElement) => { 2728 if (initialRef.current) { 2729 return; 2730 } 2731 if (dataRef.current.openEvent && !isMouseBasedEvent(dataRef.current.openEvent)) { 2732 return; 2733 } 2734 store.set("positionReference", createVirtualElement(referenceElement ?? domReference, { 2735 x: newX, 2736 y: newY, 2737 axis, 2738 dataRef, 2739 pointerType 2740 })); 2741 }); 2742 const handleReferenceEnterOrMove = useStableCallback((event) => { 2743 if (!open) { 2744 setReference(event.clientX, event.clientY, event.currentTarget); 2745 } else if (!cleanupListenerRef.current) { 2746 setReference(event.clientX, event.clientY, event.currentTarget); 2747 setReactive([]); 2748 } 2749 }); 2750 const openCheck = isMouseLikePointerType(pointerType) ? floating : open; 2751 React18.useEffect(() => { 2752 if (!enabled) { 2753 resetReference(domReference); 2754 return void 0; 2755 } 2756 if (!openCheck) { 2757 return void 0; 2758 } 2759 function cleanupListener() { 2760 cleanupListenerRef.current?.(); 2761 cleanupListenerRef.current = null; 2762 } 2763 const win = getWindow(floating); 2764 function handleMouseMove(event) { 2765 const target = getTarget(event); 2766 if (!contains(floating, target)) { 2767 setReference(event.clientX, event.clientY); 2768 } else { 2769 cleanupListener(); 2770 } 2771 } 2772 if (!dataRef.current.openEvent || isMouseBasedEvent(dataRef.current.openEvent)) { 2773 cleanupListenerRef.current = addEventListener(win, "mousemove", handleMouseMove); 2774 } else { 2775 resetReference(domReference); 2776 } 2777 return cleanupListener; 2778 }, [openCheck, enabled, floating, dataRef, domReference, store, setReference, resetReference, reactive]); 2779 React18.useEffect(() => () => { 2780 store.set("positionReference", null); 2781 }, [store]); 2782 React18.useEffect(() => { 2783 if (enabled && !floating) { 2784 initialRef.current = false; 2785 } 2786 }, [enabled, floating]); 2787 React18.useEffect(() => { 2788 if (!enabled && open) { 2789 initialRef.current = true; 2790 } 2791 }, [enabled, open]); 2792 const reference = React18.useMemo(() => { 2793 function setPointerTypeRef(event) { 2794 setPointerType(event.pointerType); 2795 } 2796 return { 2797 onPointerDown: setPointerTypeRef, 2798 onPointerEnter: setPointerTypeRef, 2799 onMouseMove: handleReferenceEnterOrMove, 2800 onMouseEnter: handleReferenceEnterOrMove 2801 }; 2802 }, [handleReferenceEnterOrMove]); 2803 return React18.useMemo(() => enabled ? { 2804 reference, 2805 trigger: reference 2806 } : {}, [enabled, reference]); 2807 } 2808 2809 // node_modules/@base-ui/react/floating-ui-react/hooks/useDismiss.mjs 2810 var React19 = __toESM(require_react(), 1); 2811 function alwaysFalse() { 2812 return false; 2813 } 2814 function normalizeProp(normalizable) { 2815 return { 2816 escapeKey: typeof normalizable === "boolean" ? normalizable : normalizable?.escapeKey ?? false, 2817 outsidePress: typeof normalizable === "boolean" ? normalizable : normalizable?.outsidePress ?? true 2818 }; 2819 } 2820 function useDismiss(context, props = {}) { 2821 const { 2822 enabled = true, 2823 escapeKey: escapeKey2 = true, 2824 outsidePress: outsidePressProp = true, 2825 outsidePressEvent = "sloppy", 2826 referencePress = alwaysFalse, 2827 bubbles, 2828 externalTree 2829 } = props; 2830 const store = "rootStore" in context ? context.rootStore : context; 2831 const open = store.useState("open"); 2832 const floatingElement = store.useState("floatingElement"); 2833 const { 2834 dataRef 2835 } = store.context; 2836 const tree = useFloatingTree(externalTree); 2837 const outsidePressFn = useStableCallback(typeof outsidePressProp === "function" ? outsidePressProp : () => false); 2838 const outsidePress2 = typeof outsidePressProp === "function" ? outsidePressFn : outsidePressProp; 2839 const outsidePressEnabled = outsidePress2 !== false; 2840 const getOutsidePressEventProp = useStableCallback(() => outsidePressEvent); 2841 const { 2842 escapeKey: escapeKeyBubbles, 2843 outsidePress: outsidePressBubbles 2844 } = normalizeProp(bubbles); 2845 const pressStartedInsideRef = React19.useRef(false); 2846 const pressStartPreventedRef = React19.useRef(false); 2847 const suppressNextOutsideClickRef = React19.useRef(false); 2848 const isComposingRef = React19.useRef(false); 2849 const currentPointerTypeRef = React19.useRef(""); 2850 const touchStateRef = React19.useRef(null); 2851 const cancelDismissOnEndTimeout = useTimeout(); 2852 const clearInsideReactTreeTimeout = useTimeout(); 2853 const clearInsideReactTree = useStableCallback(() => { 2854 clearInsideReactTreeTimeout.clear(); 2855 dataRef.current.insideReactTree = false; 2856 }); 2857 const hasBlockingChild = useStableCallback((bubbleKey) => { 2858 const nodeId = dataRef.current.floatingContext?.nodeId; 2859 const children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : []; 2860 return children.some((child) => child.context?.open && !child.context.dataRef.current[bubbleKey]); 2861 }); 2862 const isEventWithinOwnElements = useStableCallback((event) => { 2863 return isEventTargetWithin(event, store.select("floatingElement")) || isEventTargetWithin(event, store.select("domReferenceElement")); 2864 }); 2865 const closeOnReferencePress = useStableCallback((event) => { 2866 if (!referencePress()) { 2867 return; 2868 } 2869 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerPress, event.nativeEvent)); 2870 }); 2871 const closeOnEscapeKeyDown = useStableCallback((event) => { 2872 if (!open || !enabled || !escapeKey2 || event.key !== "Escape") { 2873 return; 2874 } 2875 if (isComposingRef.current) { 2876 return; 2877 } 2878 if (!escapeKeyBubbles && hasBlockingChild("__escapeKeyBubbles")) { 2879 return; 2880 } 2881 const native = isReactEvent(event) ? event.nativeEvent : event; 2882 const eventDetails = createChangeEventDetails(reason_parts_exports.escapeKey, native); 2883 store.setOpen(false, eventDetails); 2884 if (!eventDetails.isCanceled) { 2885 event.preventDefault(); 2886 } 2887 if (!escapeKeyBubbles && !eventDetails.isPropagationAllowed) { 2888 event.stopPropagation(); 2889 } 2890 }); 2891 const markInsideReactTree = useStableCallback(() => { 2892 dataRef.current.insideReactTree = true; 2893 clearInsideReactTreeTimeout.start(0, clearInsideReactTree); 2894 }); 2895 const markPressStartedInsideReactTree = useStableCallback((event) => { 2896 if (!open || !enabled || event.button !== 0) { 2897 return; 2898 } 2899 const target = getTarget(event.nativeEvent); 2900 if (!contains(store.select("floatingElement"), target)) { 2901 return; 2902 } 2903 if (!pressStartedInsideRef.current) { 2904 pressStartedInsideRef.current = true; 2905 pressStartPreventedRef.current = false; 2906 } 2907 }); 2908 const markInsidePressStartPrevented = useStableCallback((event) => { 2909 if (!open || !enabled) { 2910 return; 2911 } 2912 if (!(event.defaultPrevented || event.nativeEvent.defaultPrevented)) { 2913 return; 2914 } 2915 if (pressStartedInsideRef.current) { 2916 pressStartPreventedRef.current = true; 2917 } 2918 }); 2919 React19.useEffect(() => { 2920 if (!open || !enabled) { 2921 return void 0; 2922 } 2923 dataRef.current.__escapeKeyBubbles = escapeKeyBubbles; 2924 dataRef.current.__outsidePressBubbles = outsidePressBubbles; 2925 const compositionTimeout = new Timeout(); 2926 const preventedPressSuppressionTimeout = new Timeout(); 2927 function handleCompositionStart() { 2928 compositionTimeout.clear(); 2929 isComposingRef.current = true; 2930 } 2931 function handleCompositionEnd() { 2932 compositionTimeout.start( 2933 // 0ms or 1ms don't work in Safari. 5ms appears to consistently work. 2934 // Only apply to WebKit for the test to remain 0ms. 2935 parts_exports.engine.webkit ? 5 : 0, 2936 () => { 2937 isComposingRef.current = false; 2938 } 2939 ); 2940 } 2941 function suppressImmediateOutsideClickAfterPreventedStart() { 2942 suppressNextOutsideClickRef.current = true; 2943 preventedPressSuppressionTimeout.start(0, () => { 2944 suppressNextOutsideClickRef.current = false; 2945 }); 2946 } 2947 function resetPressStartState() { 2948 pressStartedInsideRef.current = false; 2949 pressStartPreventedRef.current = false; 2950 } 2951 function getOutsidePressEvent() { 2952 const type = currentPointerTypeRef.current; 2953 const computedType = type === "pen" || !type ? "mouse" : type; 2954 const outsidePressEventValue = getOutsidePressEventProp(); 2955 const resolved = typeof outsidePressEventValue === "function" ? outsidePressEventValue() : outsidePressEventValue; 2956 if (typeof resolved === "string") { 2957 return resolved; 2958 } 2959 return resolved[computedType]; 2960 } 2961 function shouldIgnoreEvent(event) { 2962 const computedOutsidePressEvent = getOutsidePressEvent(); 2963 return computedOutsidePressEvent === "intentional" && event.type !== "click" || computedOutsidePressEvent === "sloppy" && event.type === "click"; 2964 } 2965 function isEventWithinFloatingTree(event) { 2966 const nodeId = dataRef.current.floatingContext?.nodeId; 2967 const targetIsInsideChildren = tree && getNodeChildren(tree.nodesRef.current, nodeId).some((node) => isEventTargetWithin(event, node.context?.elements.floating)); 2968 return isEventWithinOwnElements(event) || targetIsInsideChildren; 2969 } 2970 function closeOnPressOutside(event) { 2971 if (shouldIgnoreEvent(event)) { 2972 if (event.type !== "click" && !isEventWithinOwnElements(event)) { 2973 preventedPressSuppressionTimeout.clear(); 2974 suppressNextOutsideClickRef.current = false; 2975 } 2976 clearInsideReactTree(); 2977 return; 2978 } 2979 if (dataRef.current.insideReactTree) { 2980 clearInsideReactTree(); 2981 return; 2982 } 2983 const target = getTarget(event); 2984 const inertSelector = `[$createAttribute("inert")}]`; 2985 const targetRoot = isElement(target) ? target.getRootNode() : null; 2986 const markers = Array.from((isShadowRoot(targetRoot) ? targetRoot : ownerDocument(store.select("floatingElement"))).querySelectorAll(inertSelector)); 2987 const triggers = store.context.triggerElements; 2988 if (target && (triggers.hasElement(target) || triggers.hasMatchingElement((trigger) => contains(trigger, target)))) { 2989 return; 2990 } 2991 let targetRootAncestor = isElement(target) ? target : null; 2992 while (targetRootAncestor && !isLastTraversableNode(targetRootAncestor)) { 2993 const nextParent = getParentNode(targetRootAncestor); 2994 if (isLastTraversableNode(nextParent) || !isElement(nextParent)) { 2995 break; 2996 } 2997 targetRootAncestor = nextParent; 2998 } 2999 if (markers.length && isElement(target) && !isRootElement(target) && // Clicked on a direct ancestor (e.g. FloatingOverlay). 3000 !contains(target, store.select("floatingElement")) && // If the target root element contains none of the markers, then the 3001 // element was injected after the floating element rendered. 3002 markers.every((marker) => !contains(targetRootAncestor, marker))) { 3003 return; 3004 } 3005 if (isHTMLElement(target) && !("touches" in event)) { 3006 const lastTraversableNode = isLastTraversableNode(target); 3007 const style = getComputedStyle2(target); 3008 const scrollRe = /auto|scroll/; 3009 const isScrollableX = lastTraversableNode || scrollRe.test(style.overflowX); 3010 const isScrollableY = lastTraversableNode || scrollRe.test(style.overflowY); 3011 const canScrollX = isScrollableX && target.clientWidth > 0 && target.scrollWidth > target.clientWidth; 3012 const canScrollY = isScrollableY && target.clientHeight > 0 && target.scrollHeight > target.clientHeight; 3013 const isRTL12 = style.direction === "rtl"; 3014 const pressedVerticalScrollbar = canScrollY && (isRTL12 ? event.offsetX <= target.offsetWidth - target.clientWidth : event.offsetX > target.clientWidth); 3015 const pressedHorizontalScrollbar = canScrollX && event.offsetY > target.clientHeight; 3016 if (pressedVerticalScrollbar || pressedHorizontalScrollbar) { 3017 return; 3018 } 3019 } 3020 if (isEventWithinFloatingTree(event)) { 3021 return; 3022 } 3023 if (getOutsidePressEvent() === "intentional" && suppressNextOutsideClickRef.current) { 3024 preventedPressSuppressionTimeout.clear(); 3025 suppressNextOutsideClickRef.current = false; 3026 return; 3027 } 3028 if (typeof outsidePress2 === "function" && !outsidePress2(event)) { 3029 return; 3030 } 3031 if (hasBlockingChild("__outsidePressBubbles")) { 3032 return; 3033 } 3034 store.setOpen(false, createChangeEventDetails(reason_parts_exports.outsidePress, event)); 3035 clearInsideReactTree(); 3036 } 3037 function handlePointerDown(event) { 3038 if (getOutsidePressEvent() !== "sloppy" || event.pointerType === "touch" || !store.select("open") || !enabled || isEventWithinOwnElements(event)) { 3039 return; 3040 } 3041 closeOnPressOutside(event); 3042 } 3043 function handleTouchStart(event) { 3044 if (getOutsidePressEvent() !== "sloppy" || !store.select("open") || !enabled || isEventWithinOwnElements(event)) { 3045 return; 3046 } 3047 const touch = event.touches[0]; 3048 if (touch) { 3049 touchStateRef.current = { 3050 startTime: Date.now(), 3051 startX: touch.clientX, 3052 startY: touch.clientY, 3053 dismissOnTouchEnd: false, 3054 dismissOnMouseDown: true 3055 }; 3056 cancelDismissOnEndTimeout.start(1e3, () => { 3057 if (touchStateRef.current) { 3058 touchStateRef.current.dismissOnTouchEnd = false; 3059 touchStateRef.current.dismissOnMouseDown = false; 3060 } 3061 }); 3062 } 3063 } 3064 function addTargetEventListenerOnce(event, listener) { 3065 const target = getTarget(event); 3066 if (!target) { 3067 return; 3068 } 3069 const unsubscribe2 = addEventListener(target, event.type, () => { 3070 listener(event); 3071 unsubscribe2(); 3072 }); 3073 } 3074 function handleTouchStartCapture(event) { 3075 currentPointerTypeRef.current = "touch"; 3076 addTargetEventListenerOnce(event, handleTouchStart); 3077 } 3078 function closeOnPressOutsideCapture(event) { 3079 cancelDismissOnEndTimeout.clear(); 3080 if (event.type === "pointerdown") { 3081 currentPointerTypeRef.current = event.pointerType; 3082 } 3083 if (event.type === "mousedown" && touchStateRef.current && !touchStateRef.current.dismissOnMouseDown) { 3084 return; 3085 } 3086 addTargetEventListenerOnce(event, (targetEvent) => { 3087 if (targetEvent.type === "pointerdown") { 3088 handlePointerDown(targetEvent); 3089 } else { 3090 closeOnPressOutside(targetEvent); 3091 } 3092 }); 3093 } 3094 function handlePressEndCapture(event) { 3095 if (!pressStartedInsideRef.current) { 3096 return; 3097 } 3098 const pressStartedInsideDefaultPrevented = pressStartPreventedRef.current; 3099 resetPressStartState(); 3100 if (getOutsidePressEvent() !== "intentional") { 3101 return; 3102 } 3103 if (event.type === "pointercancel") { 3104 if (pressStartedInsideDefaultPrevented) { 3105 suppressImmediateOutsideClickAfterPreventedStart(); 3106 } 3107 return; 3108 } 3109 if (isEventWithinFloatingTree(event)) { 3110 return; 3111 } 3112 if (pressStartedInsideDefaultPrevented) { 3113 suppressImmediateOutsideClickAfterPreventedStart(); 3114 return; 3115 } 3116 if (typeof outsidePress2 === "function" && !outsidePress2(event)) { 3117 return; 3118 } 3119 preventedPressSuppressionTimeout.clear(); 3120 suppressNextOutsideClickRef.current = true; 3121 clearInsideReactTree(); 3122 } 3123 function handleTouchMove(event) { 3124 if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) { 3125 return; 3126 } 3127 const touch = event.touches[0]; 3128 if (!touch) { 3129 return; 3130 } 3131 const deltaX = Math.abs(touch.clientX - touchStateRef.current.startX); 3132 const deltaY = Math.abs(touch.clientY - touchStateRef.current.startY); 3133 const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY); 3134 if (distance > 5) { 3135 touchStateRef.current.dismissOnTouchEnd = true; 3136 } 3137 if (distance > 10) { 3138 closeOnPressOutside(event); 3139 cancelDismissOnEndTimeout.clear(); 3140 touchStateRef.current = null; 3141 } 3142 } 3143 function handleTouchMoveCapture(event) { 3144 addTargetEventListenerOnce(event, handleTouchMove); 3145 } 3146 function handleTouchEnd(event) { 3147 if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) { 3148 return; 3149 } 3150 if (touchStateRef.current.dismissOnTouchEnd) { 3151 closeOnPressOutside(event); 3152 } 3153 cancelDismissOnEndTimeout.clear(); 3154 touchStateRef.current = null; 3155 } 3156 function handleTouchEndCapture(event) { 3157 addTargetEventListenerOnce(event, handleTouchEnd); 3158 } 3159 const doc = ownerDocument(floatingElement); 3160 const unsubscribe = mergeCleanups(escapeKey2 && mergeCleanups(addEventListener(doc, "keydown", closeOnEscapeKeyDown), addEventListener(doc, "compositionstart", handleCompositionStart), addEventListener(doc, "compositionend", handleCompositionEnd)), outsidePressEnabled && mergeCleanups(addEventListener(doc, "click", closeOnPressOutsideCapture, true), addEventListener(doc, "pointerdown", closeOnPressOutsideCapture, true), addEventListener(doc, "pointerup", handlePressEndCapture, true), addEventListener(doc, "pointercancel", handlePressEndCapture, true), addEventListener(doc, "mousedown", closeOnPressOutsideCapture, true), addEventListener(doc, "mouseup", handlePressEndCapture, true), addEventListener(doc, "touchstart", handleTouchStartCapture, true), addEventListener(doc, "touchmove", handleTouchMoveCapture, true), addEventListener(doc, "touchend", handleTouchEndCapture, true))); 3161 return () => { 3162 unsubscribe(); 3163 compositionTimeout.clear(); 3164 preventedPressSuppressionTimeout.clear(); 3165 resetPressStartState(); 3166 suppressNextOutsideClickRef.current = false; 3167 }; 3168 }, [dataRef, floatingElement, escapeKey2, outsidePressEnabled, outsidePress2, open, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, clearInsideReactTree, getOutsidePressEventProp, hasBlockingChild, isEventWithinOwnElements, tree, store, cancelDismissOnEndTimeout]); 3169 React19.useEffect(clearInsideReactTree, [outsidePress2, clearInsideReactTree]); 3170 const reference = React19.useMemo(() => ({ 3171 onKeyDown: closeOnEscapeKeyDown, 3172 onPointerDown: closeOnReferencePress, 3173 onClick: closeOnReferencePress 3174 }), [closeOnEscapeKeyDown, closeOnReferencePress]); 3175 const floating = React19.useMemo(() => ({ 3176 onKeyDown: closeOnEscapeKeyDown, 3177 // `onMouseDown` may be blocked if `event.preventDefault()` is called in 3178 // `onPointerDown`, such as with <NumberField.ScrubArea>. 3179 // See https://github.com/mui/base-ui/pull/3379 3180 onPointerDown: markInsidePressStartPrevented, 3181 onMouseDown: markInsidePressStartPrevented, 3182 onClickCapture: markInsideReactTree, 3183 onMouseDownCapture(event) { 3184 markInsideReactTree(); 3185 markPressStartedInsideReactTree(event); 3186 }, 3187 onPointerDownCapture(event) { 3188 markInsideReactTree(); 3189 markPressStartedInsideReactTree(event); 3190 }, 3191 onMouseUpCapture: markInsideReactTree, 3192 onTouchEndCapture: markInsideReactTree, 3193 onTouchMoveCapture: markInsideReactTree 3194 }), [closeOnEscapeKeyDown, markInsideReactTree, markPressStartedInsideReactTree, markInsidePressStartPrevented]); 3195 return React19.useMemo(() => enabled ? { 3196 reference, 3197 floating, 3198 trigger: reference 3199 } : {}, [enabled, reference, floating]); 3200 } 3201 3202 // node_modules/@base-ui/react/floating-ui-react/hooks/useFloating.mjs 3203 var React26 = __toESM(require_react(), 1); 3204 3205 // node_modules/@floating-ui/core/dist/floating-ui.core.mjs 3206 function computeCoordsFromPlacement(_ref, placement, rtl) { 3207 let { 3208 reference, 3209 floating 3210 } = _ref; 3211 const sideAxis = getSideAxis(placement); 3212 const alignmentAxis = getAlignmentAxis(placement); 3213 const alignLength = getAxisLength(alignmentAxis); 3214 const side = getSide(placement); 3215 const isVertical = sideAxis === "y"; 3216 const commonX = reference.x + reference.width / 2 - floating.width / 2; 3217 const commonY = reference.y + reference.height / 2 - floating.height / 2; 3218 const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2; 3219 let coords; 3220 switch (side) { 3221 case "top": 3222 coords = { 3223 x: commonX, 3224 y: reference.y - floating.height 3225 }; 3226 break; 3227 case "bottom": 3228 coords = { 3229 x: commonX, 3230 y: reference.y + reference.height 3231 }; 3232 break; 3233 case "right": 3234 coords = { 3235 x: reference.x + reference.width, 3236 y: commonY 3237 }; 3238 break; 3239 case "left": 3240 coords = { 3241 x: reference.x - floating.width, 3242 y: commonY 3243 }; 3244 break; 3245 default: 3246 coords = { 3247 x: reference.x, 3248 y: reference.y 3249 }; 3250 } 3251 switch (getAlignment(placement)) { 3252 case "start": 3253 coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1); 3254 break; 3255 case "end": 3256 coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1); 3257 break; 3258 } 3259 return coords; 3260 } 3261 async function detectOverflow(state, options) { 3262 var _await$platform$isEle; 3263 if (options === void 0) { 3264 options = {}; 3265 } 3266 const { 3267 x: x2, 3268 y: y2, 3269 platform: platform3, 3270 rects, 3271 elements: elements2, 3272 strategy 3273 } = state; 3274 const { 3275 boundary = "clippingAncestors", 3276 rootBoundary = "viewport", 3277 elementContext = "floating", 3278 altBoundary = false, 3279 padding = 0 3280 } = evaluate(options, state); 3281 const paddingObject = getPaddingObject(padding); 3282 const altContext = elementContext === "floating" ? "reference" : "floating"; 3283 const element = elements2[altBoundary ? altContext : elementContext]; 3284 const clippingClientRect = rectToClientRect(await platform3.getClippingRect({ 3285 element: ((_await$platform$isEle = await (platform3.isElement == null ? void 0 : platform3.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform3.getDocumentElement == null ? void 0 : platform3.getDocumentElement(elements2.floating)), 3286 boundary, 3287 rootBoundary, 3288 strategy 3289 })); 3290 const rect = elementContext === "floating" ? { 3291 x: x2, 3292 y: y2, 3293 width: rects.floating.width, 3294 height: rects.floating.height 3295 } : rects.reference; 3296 const offsetParent = await (platform3.getOffsetParent == null ? void 0 : platform3.getOffsetParent(elements2.floating)); 3297 const offsetScale = await (platform3.isElement == null ? void 0 : platform3.isElement(offsetParent)) ? await (platform3.getScale == null ? void 0 : platform3.getScale(offsetParent)) || { 3298 x: 1, 3299 y: 1 3300 } : { 3301 x: 1, 3302 y: 1 3303 }; 3304 const elementClientRect = rectToClientRect(platform3.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform3.convertOffsetParentRelativeRectToViewportRelativeRect({ 3305 elements: elements2, 3306 rect, 3307 offsetParent, 3308 strategy 3309 }) : rect); 3310 return { 3311 top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y, 3312 bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y, 3313 left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x, 3314 right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x 3315 }; 3316 } 3317 var MAX_RESET_COUNT = 50; 3318 var computePosition = async (reference, floating, config) => { 3319 const { 3320 placement = "bottom", 3321 strategy = "absolute", 3322 middleware = [], 3323 platform: platform3 3324 } = config; 3325 const platformWithDetectOverflow = platform3.detectOverflow ? platform3 : { 3326 ...platform3, 3327 detectOverflow 3328 }; 3329 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(floating)); 3330 let rects = await platform3.getElementRects({ 3331 reference, 3332 floating, 3333 strategy 3334 }); 3335 let { 3336 x: x2, 3337 y: y2 3338 } = computeCoordsFromPlacement(rects, placement, rtl); 3339 let statefulPlacement = placement; 3340 let resetCount = 0; 3341 const middlewareData = {}; 3342 for (let i2 = 0; i2 < middleware.length; i2++) { 3343 const currentMiddleware = middleware[i2]; 3344 if (!currentMiddleware) { 3345 continue; 3346 } 3347 const { 3348 name: name2, 3349 fn 3350 } = currentMiddleware; 3351 const { 3352 x: nextX, 3353 y: nextY, 3354 data, 3355 reset 3356 } = await fn({ 3357 x: x2, 3358 y: y2, 3359 initialPlacement: placement, 3360 placement: statefulPlacement, 3361 strategy, 3362 middlewareData, 3363 rects, 3364 platform: platformWithDetectOverflow, 3365 elements: { 3366 reference, 3367 floating 3368 } 3369 }); 3370 x2 = nextX != null ? nextX : x2; 3371 y2 = nextY != null ? nextY : y2; 3372 middlewareData[name2] = { 3373 ...middlewareData[name2], 3374 ...data 3375 }; 3376 if (reset && resetCount < MAX_RESET_COUNT) { 3377 resetCount++; 3378 if (typeof reset === "object") { 3379 if (reset.placement) { 3380 statefulPlacement = reset.placement; 3381 } 3382 if (reset.rects) { 3383 rects = reset.rects === true ? await platform3.getElementRects({ 3384 reference, 3385 floating, 3386 strategy 3387 }) : reset.rects; 3388 } 3389 ({ 3390 x: x2, 3391 y: y2 3392 } = computeCoordsFromPlacement(rects, statefulPlacement, rtl)); 3393 } 3394 i2 = -1; 3395 } 3396 } 3397 return { 3398 x: x2, 3399 y: y2, 3400 placement: statefulPlacement, 3401 strategy, 3402 middlewareData 3403 }; 3404 }; 3405 var flip = function(options) { 3406 if (options === void 0) { 3407 options = {}; 3408 } 3409 return { 3410 name: "flip", 3411 options, 3412 async fn(state) { 3413 var _middlewareData$arrow, _middlewareData$flip; 3414 const { 3415 placement, 3416 middlewareData, 3417 rects, 3418 initialPlacement, 3419 platform: platform3, 3420 elements: elements2 3421 } = state; 3422 const { 3423 mainAxis: checkMainAxis = true, 3424 crossAxis: checkCrossAxis = true, 3425 fallbackPlacements: specifiedFallbackPlacements, 3426 fallbackStrategy = "bestFit", 3427 fallbackAxisSideDirection = "none", 3428 flipAlignment = true, 3429 ...detectOverflowOptions 3430 } = evaluate(options, state); 3431 if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { 3432 return {}; 3433 } 3434 const side = getSide(placement); 3435 const initialSideAxis = getSideAxis(initialPlacement); 3436 const isBasePlacement = getSide(initialPlacement) === initialPlacement; 3437 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements2.floating)); 3438 const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement)); 3439 const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none"; 3440 if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) { 3441 fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl)); 3442 } 3443 const placements2 = [initialPlacement, ...fallbackPlacements]; 3444 const overflow = await platform3.detectOverflow(state, detectOverflowOptions); 3445 const overflows = []; 3446 let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || []; 3447 if (checkMainAxis) { 3448 overflows.push(overflow[side]); 3449 } 3450 if (checkCrossAxis) { 3451 const sides2 = getAlignmentSides(placement, rects, rtl); 3452 overflows.push(overflow[sides2[0]], overflow[sides2[1]]); 3453 } 3454 overflowsData = [...overflowsData, { 3455 placement, 3456 overflows 3457 }]; 3458 if (!overflows.every((side2) => side2 <= 0)) { 3459 var _middlewareData$flip2, _overflowsData$filter; 3460 const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1; 3461 const nextPlacement = placements2[nextIndex]; 3462 if (nextPlacement) { 3463 const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false; 3464 if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis 3465 // overflows the main axis. 3466 overflowsData.every((d2) => getSideAxis(d2.placement) === initialSideAxis ? d2.overflows[0] > 0 : true)) { 3467 return { 3468 data: { 3469 index: nextIndex, 3470 overflows: overflowsData 3471 }, 3472 reset: { 3473 placement: nextPlacement 3474 } 3475 }; 3476 } 3477 } 3478 let resetPlacement = (_overflowsData$filter = overflowsData.filter((d2) => d2.overflows[0] <= 0).sort((a2, b2) => a2.overflows[1] - b2.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement; 3479 if (!resetPlacement) { 3480 switch (fallbackStrategy) { 3481 case "bestFit": { 3482 var _overflowsData$filter2; 3483 const placement2 = (_overflowsData$filter2 = overflowsData.filter((d2) => { 3484 if (hasFallbackAxisSideDirection) { 3485 const currentSideAxis = getSideAxis(d2.placement); 3486 return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal 3487 // reading directions favoring greater width. 3488 currentSideAxis === "y"; 3489 } 3490 return true; 3491 }).map((d2) => [d2.placement, d2.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a2, b2) => a2[1] - b2[1])[0]) == null ? void 0 : _overflowsData$filter2[0]; 3492 if (placement2) { 3493 resetPlacement = placement2; 3494 } 3495 break; 3496 } 3497 case "initialPlacement": 3498 resetPlacement = initialPlacement; 3499 break; 3500 } 3501 } 3502 if (placement !== resetPlacement) { 3503 return { 3504 reset: { 3505 placement: resetPlacement 3506 } 3507 }; 3508 } 3509 } 3510 return {}; 3511 } 3512 }; 3513 }; 3514 function getSideOffsets(overflow, rect) { 3515 return { 3516 top: overflow.top - rect.height, 3517 right: overflow.right - rect.width, 3518 bottom: overflow.bottom - rect.height, 3519 left: overflow.left - rect.width 3520 }; 3521 } 3522 function isAnySideFullyClipped(overflow) { 3523 return sides.some((side) => overflow[side] >= 0); 3524 } 3525 var hide = function(options) { 3526 if (options === void 0) { 3527 options = {}; 3528 } 3529 return { 3530 name: "hide", 3531 options, 3532 async fn(state) { 3533 const { 3534 rects, 3535 platform: platform3 3536 } = state; 3537 const { 3538 strategy = "referenceHidden", 3539 ...detectOverflowOptions 3540 } = evaluate(options, state); 3541 switch (strategy) { 3542 case "referenceHidden": { 3543 const overflow = await platform3.detectOverflow(state, { 3544 ...detectOverflowOptions, 3545 elementContext: "reference" 3546 }); 3547 const offsets = getSideOffsets(overflow, rects.reference); 3548 return { 3549 data: { 3550 referenceHiddenOffsets: offsets, 3551 referenceHidden: isAnySideFullyClipped(offsets) 3552 } 3553 }; 3554 } 3555 case "escaped": { 3556 const overflow = await platform3.detectOverflow(state, { 3557 ...detectOverflowOptions, 3558 altBoundary: true 3559 }); 3560 const offsets = getSideOffsets(overflow, rects.floating); 3561 return { 3562 data: { 3563 escapedOffsets: offsets, 3564 escaped: isAnySideFullyClipped(offsets) 3565 } 3566 }; 3567 } 3568 default: { 3569 return {}; 3570 } 3571 } 3572 } 3573 }; 3574 }; 3575 var originSides = /* @__PURE__ */ new Set(["left", "top"]); 3576 async function convertValueToCoords(state, options) { 3577 const { 3578 placement, 3579 platform: platform3, 3580 elements: elements2 3581 } = state; 3582 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements2.floating)); 3583 const side = getSide(placement); 3584 const alignment = getAlignment(placement); 3585 const isVertical = getSideAxis(placement) === "y"; 3586 const mainAxisMulti = originSides.has(side) ? -1 : 1; 3587 const crossAxisMulti = rtl && isVertical ? -1 : 1; 3588 const rawValue = evaluate(options, state); 3589 let { 3590 mainAxis, 3591 crossAxis, 3592 alignmentAxis 3593 } = typeof rawValue === "number" ? { 3594 mainAxis: rawValue, 3595 crossAxis: 0, 3596 alignmentAxis: null 3597 } : { 3598 mainAxis: rawValue.mainAxis || 0, 3599 crossAxis: rawValue.crossAxis || 0, 3600 alignmentAxis: rawValue.alignmentAxis 3601 }; 3602 if (alignment && typeof alignmentAxis === "number") { 3603 crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis; 3604 } 3605 return isVertical ? { 3606 x: crossAxis * crossAxisMulti, 3607 y: mainAxis * mainAxisMulti 3608 } : { 3609 x: mainAxis * mainAxisMulti, 3610 y: crossAxis * crossAxisMulti 3611 }; 3612 } 3613 var offset = function(options) { 3614 if (options === void 0) { 3615 options = 0; 3616 } 3617 return { 3618 name: "offset", 3619 options, 3620 async fn(state) { 3621 var _middlewareData$offse, _middlewareData$arrow; 3622 const { 3623 x: x2, 3624 y: y2, 3625 placement, 3626 middlewareData 3627 } = state; 3628 const diffCoords = await convertValueToCoords(state, options); 3629 if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { 3630 return {}; 3631 } 3632 return { 3633 x: x2 + diffCoords.x, 3634 y: y2 + diffCoords.y, 3635 data: { 3636 ...diffCoords, 3637 placement 3638 } 3639 }; 3640 } 3641 }; 3642 }; 3643 var shift = function(options) { 3644 if (options === void 0) { 3645 options = {}; 3646 } 3647 return { 3648 name: "shift", 3649 options, 3650 async fn(state) { 3651 const { 3652 x: x2, 3653 y: y2, 3654 placement, 3655 platform: platform3 3656 } = state; 3657 const { 3658 mainAxis: checkMainAxis = true, 3659 crossAxis: checkCrossAxis = false, 3660 limiter = { 3661 fn: (_ref) => { 3662 let { 3663 x: x3, 3664 y: y3 3665 } = _ref; 3666 return { 3667 x: x3, 3668 y: y3 3669 }; 3670 } 3671 }, 3672 ...detectOverflowOptions 3673 } = evaluate(options, state); 3674 const coords = { 3675 x: x2, 3676 y: y2 3677 }; 3678 const overflow = await platform3.detectOverflow(state, detectOverflowOptions); 3679 const crossAxis = getSideAxis(getSide(placement)); 3680 const mainAxis = getOppositeAxis(crossAxis); 3681 let mainAxisCoord = coords[mainAxis]; 3682 let crossAxisCoord = coords[crossAxis]; 3683 if (checkMainAxis) { 3684 const minSide = mainAxis === "y" ? "top" : "left"; 3685 const maxSide = mainAxis === "y" ? "bottom" : "right"; 3686 const min2 = mainAxisCoord + overflow[minSide]; 3687 const max2 = mainAxisCoord - overflow[maxSide]; 3688 mainAxisCoord = clamp(min2, mainAxisCoord, max2); 3689 } 3690 if (checkCrossAxis) { 3691 const minSide = crossAxis === "y" ? "top" : "left"; 3692 const maxSide = crossAxis === "y" ? "bottom" : "right"; 3693 const min2 = crossAxisCoord + overflow[minSide]; 3694 const max2 = crossAxisCoord - overflow[maxSide]; 3695 crossAxisCoord = clamp(min2, crossAxisCoord, max2); 3696 } 3697 const limitedCoords = limiter.fn({ 3698 ...state, 3699 [mainAxis]: mainAxisCoord, 3700 [crossAxis]: crossAxisCoord 3701 }); 3702 return { 3703 ...limitedCoords, 3704 data: { 3705 x: limitedCoords.x - x2, 3706 y: limitedCoords.y - y2, 3707 enabled: { 3708 [mainAxis]: checkMainAxis, 3709 [crossAxis]: checkCrossAxis 3710 } 3711 } 3712 }; 3713 } 3714 }; 3715 }; 3716 var limitShift = function(options) { 3717 if (options === void 0) { 3718 options = {}; 3719 } 3720 return { 3721 options, 3722 fn(state) { 3723 const { 3724 x: x2, 3725 y: y2, 3726 placement, 3727 rects, 3728 middlewareData 3729 } = state; 3730 const { 3731 offset: offset4 = 0, 3732 mainAxis: checkMainAxis = true, 3733 crossAxis: checkCrossAxis = true 3734 } = evaluate(options, state); 3735 const coords = { 3736 x: x2, 3737 y: y2 3738 }; 3739 const crossAxis = getSideAxis(placement); 3740 const mainAxis = getOppositeAxis(crossAxis); 3741 let mainAxisCoord = coords[mainAxis]; 3742 let crossAxisCoord = coords[crossAxis]; 3743 const rawOffset = evaluate(offset4, state); 3744 const computedOffset = typeof rawOffset === "number" ? { 3745 mainAxis: rawOffset, 3746 crossAxis: 0 3747 } : { 3748 mainAxis: 0, 3749 crossAxis: 0, 3750 ...rawOffset 3751 }; 3752 if (checkMainAxis) { 3753 const len = mainAxis === "y" ? "height" : "width"; 3754 const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis; 3755 const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis; 3756 if (mainAxisCoord < limitMin) { 3757 mainAxisCoord = limitMin; 3758 } else if (mainAxisCoord > limitMax) { 3759 mainAxisCoord = limitMax; 3760 } 3761 } 3762 if (checkCrossAxis) { 3763 var _middlewareData$offse, _middlewareData$offse2; 3764 const len = mainAxis === "y" ? "width" : "height"; 3765 const isOriginSide = originSides.has(getSide(placement)); 3766 const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis); 3767 const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0); 3768 if (crossAxisCoord < limitMin) { 3769 crossAxisCoord = limitMin; 3770 } else if (crossAxisCoord > limitMax) { 3771 crossAxisCoord = limitMax; 3772 } 3773 } 3774 return { 3775 [mainAxis]: mainAxisCoord, 3776 [crossAxis]: crossAxisCoord 3777 }; 3778 } 3779 }; 3780 }; 3781 var size = function(options) { 3782 if (options === void 0) { 3783 options = {}; 3784 } 3785 return { 3786 name: "size", 3787 options, 3788 async fn(state) { 3789 var _state$middlewareData, _state$middlewareData2; 3790 const { 3791 placement, 3792 rects, 3793 platform: platform3, 3794 elements: elements2 3795 } = state; 3796 const { 3797 apply = () => { 3798 }, 3799 ...detectOverflowOptions 3800 } = evaluate(options, state); 3801 const overflow = await platform3.detectOverflow(state, detectOverflowOptions); 3802 const side = getSide(placement); 3803 const alignment = getAlignment(placement); 3804 const isYAxis = getSideAxis(placement) === "y"; 3805 const { 3806 width, 3807 height 3808 } = rects.floating; 3809 let heightSide; 3810 let widthSide; 3811 if (side === "top" || side === "bottom") { 3812 heightSide = side; 3813 widthSide = alignment === (await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements2.floating)) ? "start" : "end") ? "left" : "right"; 3814 } else { 3815 widthSide = side; 3816 heightSide = alignment === "end" ? "top" : "bottom"; 3817 } 3818 const maximumClippingHeight = height - overflow.top - overflow.bottom; 3819 const maximumClippingWidth = width - overflow.left - overflow.right; 3820 const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight); 3821 const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth); 3822 const noShift = !state.middlewareData.shift; 3823 let availableHeight = overflowAvailableHeight; 3824 let availableWidth = overflowAvailableWidth; 3825 if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) { 3826 availableWidth = maximumClippingWidth; 3827 } 3828 if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) { 3829 availableHeight = maximumClippingHeight; 3830 } 3831 if (noShift && !alignment) { 3832 const xMin = max(overflow.left, 0); 3833 const xMax = max(overflow.right, 0); 3834 const yMin = max(overflow.top, 0); 3835 const yMax = max(overflow.bottom, 0); 3836 if (isYAxis) { 3837 availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right)); 3838 } else { 3839 availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom)); 3840 } 3841 } 3842 await apply({ 3843 ...state, 3844 availableWidth, 3845 availableHeight 3846 }); 3847 const nextDimensions = await platform3.getDimensions(elements2.floating); 3848 if (width !== nextDimensions.width || height !== nextDimensions.height) { 3849 return { 3850 reset: { 3851 rects: true 3852 } 3853 }; 3854 } 3855 return {}; 3856 } 3857 }; 3858 }; 3859 3860 // node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs 3861 function getCssDimensions(element) { 3862 const css = getComputedStyle2(element); 3863 let width = parseFloat(css.width) || 0; 3864 let height = parseFloat(css.height) || 0; 3865 const hasOffset = isHTMLElement(element); 3866 const offsetWidth = hasOffset ? element.offsetWidth : width; 3867 const offsetHeight = hasOffset ? element.offsetHeight : height; 3868 const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; 3869 if (shouldFallback) { 3870 width = offsetWidth; 3871 height = offsetHeight; 3872 } 3873 return { 3874 width, 3875 height, 3876 $: shouldFallback 3877 }; 3878 } 3879 function unwrapElement(element) { 3880 return !isElement(element) ? element.contextElement : element; 3881 } 3882 function getScale(element) { 3883 const domElement = unwrapElement(element); 3884 if (!isHTMLElement(domElement)) { 3885 return createCoords(1); 3886 } 3887 const rect = domElement.getBoundingClientRect(); 3888 const { 3889 width, 3890 height, 3891 $: $2 3892 } = getCssDimensions(domElement); 3893 let x2 = ($2 ? round(rect.width) : rect.width) / width; 3894 let y2 = ($2 ? round(rect.height) : rect.height) / height; 3895 if (!x2 || !Number.isFinite(x2)) { 3896 x2 = 1; 3897 } 3898 if (!y2 || !Number.isFinite(y2)) { 3899 y2 = 1; 3900 } 3901 return { 3902 x: x2, 3903 y: y2 3904 }; 3905 } 3906 var noOffsets = /* @__PURE__ */ createCoords(0); 3907 function getVisualOffsets(element) { 3908 const win = getWindow(element); 3909 if (!isWebKit() || !win.visualViewport) { 3910 return noOffsets; 3911 } 3912 return { 3913 x: win.visualViewport.offsetLeft, 3914 y: win.visualViewport.offsetTop 3915 }; 3916 } 3917 function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) { 3918 if (isFixed === void 0) { 3919 isFixed = false; 3920 } 3921 if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) { 3922 return false; 3923 } 3924 return isFixed; 3925 } 3926 function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) { 3927 if (includeScale === void 0) { 3928 includeScale = false; 3929 } 3930 if (isFixedStrategy === void 0) { 3931 isFixedStrategy = false; 3932 } 3933 const clientRect = element.getBoundingClientRect(); 3934 const domElement = unwrapElement(element); 3935 let scale = createCoords(1); 3936 if (includeScale) { 3937 if (offsetParent) { 3938 if (isElement(offsetParent)) { 3939 scale = getScale(offsetParent); 3940 } 3941 } else { 3942 scale = getScale(element); 3943 } 3944 } 3945 const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0); 3946 let x2 = (clientRect.left + visualOffsets.x) / scale.x; 3947 let y2 = (clientRect.top + visualOffsets.y) / scale.y; 3948 let width = clientRect.width / scale.x; 3949 let height = clientRect.height / scale.y; 3950 if (domElement) { 3951 const win = getWindow(domElement); 3952 const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent; 3953 let currentWin = win; 3954 let currentIFrame = getFrameElement(currentWin); 3955 while (currentIFrame && offsetParent && offsetWin !== currentWin) { 3956 const iframeScale = getScale(currentIFrame); 3957 const iframeRect = currentIFrame.getBoundingClientRect(); 3958 const css = getComputedStyle2(currentIFrame); 3959 const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x; 3960 const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y; 3961 x2 *= iframeScale.x; 3962 y2 *= iframeScale.y; 3963 width *= iframeScale.x; 3964 height *= iframeScale.y; 3965 x2 += left; 3966 y2 += top; 3967 currentWin = getWindow(currentIFrame); 3968 currentIFrame = getFrameElement(currentWin); 3969 } 3970 } 3971 return rectToClientRect({ 3972 width, 3973 height, 3974 x: x2, 3975 y: y2 3976 }); 3977 } 3978 function getWindowScrollBarX(element, rect) { 3979 const leftScroll = getNodeScroll(element).scrollLeft; 3980 if (!rect) { 3981 return getBoundingClientRect(getDocumentElement(element)).left + leftScroll; 3982 } 3983 return rect.left + leftScroll; 3984 } 3985 function getHTMLOffset(documentElement, scroll) { 3986 const htmlRect = documentElement.getBoundingClientRect(); 3987 const x2 = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect); 3988 const y2 = htmlRect.top + scroll.scrollTop; 3989 return { 3990 x: x2, 3991 y: y2 3992 }; 3993 } 3994 function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) { 3995 let { 3996 elements: elements2, 3997 rect, 3998 offsetParent, 3999 strategy 4000 } = _ref; 4001 const isFixed = strategy === "fixed"; 4002 const documentElement = getDocumentElement(offsetParent); 4003 const topLayer = elements2 ? isTopLayer(elements2.floating) : false; 4004 if (offsetParent === documentElement || topLayer && isFixed) { 4005 return rect; 4006 } 4007 let scroll = { 4008 scrollLeft: 0, 4009 scrollTop: 0 4010 }; 4011 let scale = createCoords(1); 4012 const offsets = createCoords(0); 4013 const isOffsetParentAnElement = isHTMLElement(offsetParent); 4014 if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { 4015 if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { 4016 scroll = getNodeScroll(offsetParent); 4017 } 4018 if (isOffsetParentAnElement) { 4019 const offsetRect = getBoundingClientRect(offsetParent); 4020 scale = getScale(offsetParent); 4021 offsets.x = offsetRect.x + offsetParent.clientLeft; 4022 offsets.y = offsetRect.y + offsetParent.clientTop; 4023 } 4024 } 4025 const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0); 4026 return { 4027 width: rect.width * scale.x, 4028 height: rect.height * scale.y, 4029 x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x, 4030 y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y 4031 }; 4032 } 4033 function getClientRects(element) { 4034 return Array.from(element.getClientRects()); 4035 } 4036 function getDocumentRect(element) { 4037 const html = getDocumentElement(element); 4038 const scroll = getNodeScroll(element); 4039 const body = element.ownerDocument.body; 4040 const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth); 4041 const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight); 4042 let x2 = -scroll.scrollLeft + getWindowScrollBarX(element); 4043 const y2 = -scroll.scrollTop; 4044 if (getComputedStyle2(body).direction === "rtl") { 4045 x2 += max(html.clientWidth, body.clientWidth) - width; 4046 } 4047 return { 4048 width, 4049 height, 4050 x: x2, 4051 y: y2 4052 }; 4053 } 4054 var SCROLLBAR_MAX = 25; 4055 function getViewportRect(element, strategy) { 4056 const win = getWindow(element); 4057 const html = getDocumentElement(element); 4058 const visualViewport = win.visualViewport; 4059 let width = html.clientWidth; 4060 let height = html.clientHeight; 4061 let x2 = 0; 4062 let y2 = 0; 4063 if (visualViewport) { 4064 width = visualViewport.width; 4065 height = visualViewport.height; 4066 const visualViewportBased = isWebKit(); 4067 if (!visualViewportBased || visualViewportBased && strategy === "fixed") { 4068 x2 = visualViewport.offsetLeft; 4069 y2 = visualViewport.offsetTop; 4070 } 4071 } 4072 const windowScrollbarX = getWindowScrollBarX(html); 4073 if (windowScrollbarX <= 0) { 4074 const doc = html.ownerDocument; 4075 const body = doc.body; 4076 const bodyStyles = getComputedStyle(body); 4077 const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0; 4078 const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline); 4079 if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) { 4080 width -= clippingStableScrollbarWidth; 4081 } 4082 } else if (windowScrollbarX <= SCROLLBAR_MAX) { 4083 width += windowScrollbarX; 4084 } 4085 return { 4086 width, 4087 height, 4088 x: x2, 4089 y: y2 4090 }; 4091 } 4092 function getInnerBoundingClientRect(element, strategy) { 4093 const clientRect = getBoundingClientRect(element, true, strategy === "fixed"); 4094 const top = clientRect.top + element.clientTop; 4095 const left = clientRect.left + element.clientLeft; 4096 const scale = isHTMLElement(element) ? getScale(element) : createCoords(1); 4097 const width = element.clientWidth * scale.x; 4098 const height = element.clientHeight * scale.y; 4099 const x2 = left * scale.x; 4100 const y2 = top * scale.y; 4101 return { 4102 width, 4103 height, 4104 x: x2, 4105 y: y2 4106 }; 4107 } 4108 function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) { 4109 let rect; 4110 if (clippingAncestor === "viewport") { 4111 rect = getViewportRect(element, strategy); 4112 } else if (clippingAncestor === "document") { 4113 rect = getDocumentRect(getDocumentElement(element)); 4114 } else if (isElement(clippingAncestor)) { 4115 rect = getInnerBoundingClientRect(clippingAncestor, strategy); 4116 } else { 4117 const visualOffsets = getVisualOffsets(element); 4118 rect = { 4119 x: clippingAncestor.x - visualOffsets.x, 4120 y: clippingAncestor.y - visualOffsets.y, 4121 width: clippingAncestor.width, 4122 height: clippingAncestor.height 4123 }; 4124 } 4125 return rectToClientRect(rect); 4126 } 4127 function hasFixedPositionAncestor(element, stopNode) { 4128 const parentNode = getParentNode(element); 4129 if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) { 4130 return false; 4131 } 4132 return getComputedStyle2(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode); 4133 } 4134 function getClippingElementAncestors(element, cache) { 4135 const cachedResult = cache.get(element); 4136 if (cachedResult) { 4137 return cachedResult; 4138 } 4139 let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body"); 4140 let currentContainingBlockComputedStyle = null; 4141 const elementIsFixed = getComputedStyle2(element).position === "fixed"; 4142 let currentNode = elementIsFixed ? getParentNode(element) : element; 4143 while (isElement(currentNode) && !isLastTraversableNode(currentNode)) { 4144 const computedStyle = getComputedStyle2(currentNode); 4145 const currentNodeIsContaining = isContainingBlock(currentNode); 4146 if (!currentNodeIsContaining && computedStyle.position === "fixed") { 4147 currentContainingBlockComputedStyle = null; 4148 } 4149 const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === "absolute" || currentContainingBlockComputedStyle.position === "fixed") || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode); 4150 if (shouldDropCurrentNode) { 4151 result = result.filter((ancestor) => ancestor !== currentNode); 4152 } else { 4153 currentContainingBlockComputedStyle = computedStyle; 4154 } 4155 currentNode = getParentNode(currentNode); 4156 } 4157 cache.set(element, result); 4158 return result; 4159 } 4160 function getClippingRect(_ref) { 4161 let { 4162 element, 4163 boundary, 4164 rootBoundary, 4165 strategy 4166 } = _ref; 4167 const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary); 4168 const clippingAncestors = [...elementClippingAncestors, rootBoundary]; 4169 const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy); 4170 let top = firstRect.top; 4171 let right = firstRect.right; 4172 let bottom = firstRect.bottom; 4173 let left = firstRect.left; 4174 for (let i2 = 1; i2 < clippingAncestors.length; i2++) { 4175 const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i2], strategy); 4176 top = max(rect.top, top); 4177 right = min(rect.right, right); 4178 bottom = min(rect.bottom, bottom); 4179 left = max(rect.left, left); 4180 } 4181 return { 4182 width: right - left, 4183 height: bottom - top, 4184 x: left, 4185 y: top 4186 }; 4187 } 4188 function getDimensions(element) { 4189 const { 4190 width, 4191 height 4192 } = getCssDimensions(element); 4193 return { 4194 width, 4195 height 4196 }; 4197 } 4198 function getRectRelativeToOffsetParent(element, offsetParent, strategy) { 4199 const isOffsetParentAnElement = isHTMLElement(offsetParent); 4200 const documentElement = getDocumentElement(offsetParent); 4201 const isFixed = strategy === "fixed"; 4202 const rect = getBoundingClientRect(element, true, isFixed, offsetParent); 4203 let scroll = { 4204 scrollLeft: 0, 4205 scrollTop: 0 4206 }; 4207 const offsets = createCoords(0); 4208 function setLeftRTLScrollbarOffset() { 4209 offsets.x = getWindowScrollBarX(documentElement); 4210 } 4211 if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { 4212 if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { 4213 scroll = getNodeScroll(offsetParent); 4214 } 4215 if (isOffsetParentAnElement) { 4216 const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent); 4217 offsets.x = offsetRect.x + offsetParent.clientLeft; 4218 offsets.y = offsetRect.y + offsetParent.clientTop; 4219 } else if (documentElement) { 4220 setLeftRTLScrollbarOffset(); 4221 } 4222 } 4223 if (isFixed && !isOffsetParentAnElement && documentElement) { 4224 setLeftRTLScrollbarOffset(); 4225 } 4226 const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0); 4227 const x2 = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x; 4228 const y2 = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y; 4229 return { 4230 x: x2, 4231 y: y2, 4232 width: rect.width, 4233 height: rect.height 4234 }; 4235 } 4236 function isStaticPositioned(element) { 4237 return getComputedStyle2(element).position === "static"; 4238 } 4239 function getTrueOffsetParent(element, polyfill) { 4240 if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") { 4241 return null; 4242 } 4243 if (polyfill) { 4244 return polyfill(element); 4245 } 4246 let rawOffsetParent = element.offsetParent; 4247 if (getDocumentElement(element) === rawOffsetParent) { 4248 rawOffsetParent = rawOffsetParent.ownerDocument.body; 4249 } 4250 return rawOffsetParent; 4251 } 4252 function getOffsetParent(element, polyfill) { 4253 const win = getWindow(element); 4254 if (isTopLayer(element)) { 4255 return win; 4256 } 4257 if (!isHTMLElement(element)) { 4258 let svgOffsetParent = getParentNode(element); 4259 while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) { 4260 if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) { 4261 return svgOffsetParent; 4262 } 4263 svgOffsetParent = getParentNode(svgOffsetParent); 4264 } 4265 return win; 4266 } 4267 let offsetParent = getTrueOffsetParent(element, polyfill); 4268 while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) { 4269 offsetParent = getTrueOffsetParent(offsetParent, polyfill); 4270 } 4271 if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) { 4272 return win; 4273 } 4274 return offsetParent || getContainingBlock(element) || win; 4275 } 4276 var getElementRects = async function(data) { 4277 const getOffsetParentFn = this.getOffsetParent || getOffsetParent; 4278 const getDimensionsFn = this.getDimensions; 4279 const floatingDimensions = await getDimensionsFn(data.floating); 4280 return { 4281 reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy), 4282 floating: { 4283 x: 0, 4284 y: 0, 4285 width: floatingDimensions.width, 4286 height: floatingDimensions.height 4287 } 4288 }; 4289 }; 4290 function isRTL(element) { 4291 return getComputedStyle2(element).direction === "rtl"; 4292 } 4293 var platform2 = { 4294 convertOffsetParentRelativeRectToViewportRelativeRect, 4295 getDocumentElement, 4296 getClippingRect, 4297 getOffsetParent, 4298 getElementRects, 4299 getClientRects, 4300 getDimensions, 4301 getScale, 4302 isElement, 4303 isRTL 4304 }; 4305 function rectsAreEqual(a2, b2) { 4306 return a2.x === b2.x && a2.y === b2.y && a2.width === b2.width && a2.height === b2.height; 4307 } 4308 function observeMove(element, onMove) { 4309 let io = null; 4310 let timeoutId; 4311 const root = getDocumentElement(element); 4312 function cleanup() { 4313 var _io; 4314 clearTimeout(timeoutId); 4315 (_io = io) == null || _io.disconnect(); 4316 io = null; 4317 } 4318 function refresh(skip, threshold) { 4319 if (skip === void 0) { 4320 skip = false; 4321 } 4322 if (threshold === void 0) { 4323 threshold = 1; 4324 } 4325 cleanup(); 4326 const elementRectForRootMargin = element.getBoundingClientRect(); 4327 const { 4328 left, 4329 top, 4330 width, 4331 height 4332 } = elementRectForRootMargin; 4333 if (!skip) { 4334 onMove(); 4335 } 4336 if (!width || !height) { 4337 return; 4338 } 4339 const insetTop = floor(top); 4340 const insetRight = floor(root.clientWidth - (left + width)); 4341 const insetBottom = floor(root.clientHeight - (top + height)); 4342 const insetLeft = floor(left); 4343 const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px"; 4344 const options = { 4345 rootMargin, 4346 threshold: max(0, min(1, threshold)) || 1 4347 }; 4348 let isFirstUpdate = true; 4349 function handleObserve(entries) { 4350 const ratio = entries[0].intersectionRatio; 4351 if (ratio !== threshold) { 4352 if (!isFirstUpdate) { 4353 return refresh(); 4354 } 4355 if (!ratio) { 4356 timeoutId = setTimeout(() => { 4357 refresh(false, 1e-7); 4358 }, 1e3); 4359 } else { 4360 refresh(false, ratio); 4361 } 4362 } 4363 if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) { 4364 refresh(); 4365 } 4366 isFirstUpdate = false; 4367 } 4368 try { 4369 io = new IntersectionObserver(handleObserve, { 4370 ...options, 4371 // Handle <iframe>s 4372 root: root.ownerDocument 4373 }); 4374 } catch (_e) { 4375 io = new IntersectionObserver(handleObserve, options); 4376 } 4377 io.observe(element); 4378 } 4379 refresh(true); 4380 return cleanup; 4381 } 4382 function autoUpdate(reference, floating, update2, options) { 4383 if (options === void 0) { 4384 options = {}; 4385 } 4386 const { 4387 ancestorScroll = true, 4388 ancestorResize = true, 4389 elementResize = typeof ResizeObserver === "function", 4390 layoutShift = typeof IntersectionObserver === "function", 4391 animationFrame = false 4392 } = options; 4393 const referenceEl = unwrapElement(reference); 4394 const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : []; 4395 ancestors.forEach((ancestor) => { 4396 ancestorScroll && ancestor.addEventListener("scroll", update2, { 4397 passive: true 4398 }); 4399 ancestorResize && ancestor.addEventListener("resize", update2); 4400 }); 4401 const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update2) : null; 4402 let reobserveFrame = -1; 4403 let resizeObserver = null; 4404 if (elementResize) { 4405 resizeObserver = new ResizeObserver((_ref) => { 4406 let [firstEntry] = _ref; 4407 if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) { 4408 resizeObserver.unobserve(floating); 4409 cancelAnimationFrame(reobserveFrame); 4410 reobserveFrame = requestAnimationFrame(() => { 4411 var _resizeObserver; 4412 (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating); 4413 }); 4414 } 4415 update2(); 4416 }); 4417 if (referenceEl && !animationFrame) { 4418 resizeObserver.observe(referenceEl); 4419 } 4420 if (floating) { 4421 resizeObserver.observe(floating); 4422 } 4423 } 4424 let frameId; 4425 let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null; 4426 if (animationFrame) { 4427 frameLoop(); 4428 } 4429 function frameLoop() { 4430 const nextRefRect = getBoundingClientRect(reference); 4431 if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) { 4432 update2(); 4433 } 4434 prevRefRect = nextRefRect; 4435 frameId = requestAnimationFrame(frameLoop); 4436 } 4437 update2(); 4438 return () => { 4439 var _resizeObserver2; 4440 ancestors.forEach((ancestor) => { 4441 ancestorScroll && ancestor.removeEventListener("scroll", update2); 4442 ancestorResize && ancestor.removeEventListener("resize", update2); 4443 }); 4444 cleanupIo == null || cleanupIo(); 4445 (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect(); 4446 resizeObserver = null; 4447 if (animationFrame) { 4448 cancelAnimationFrame(frameId); 4449 } 4450 }; 4451 } 4452 var offset2 = offset; 4453 var shift2 = shift; 4454 var flip2 = flip; 4455 var size2 = size; 4456 var hide2 = hide; 4457 var limitShift2 = limitShift; 4458 var computePosition2 = (reference, floating, options) => { 4459 const cache = /* @__PURE__ */ new Map(); 4460 const mergedOptions = { 4461 platform: platform2, 4462 ...options 4463 }; 4464 const platformWithCache = { 4465 ...mergedOptions.platform, 4466 _c: cache 4467 }; 4468 return computePosition(reference, floating, { 4469 ...mergedOptions, 4470 platform: platformWithCache 4471 }); 4472 }; 4473 4474 // node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs 4475 var React20 = __toESM(require_react(), 1); 4476 var import_react2 = __toESM(require_react(), 1); 4477 var ReactDOM3 = __toESM(require_react_dom(), 1); 4478 var isClient = typeof document !== "undefined"; 4479 var noop2 = function noop3() { 4480 }; 4481 var index = isClient ? import_react2.useLayoutEffect : noop2; 4482 function deepEqual(a2, b2) { 4483 if (a2 === b2) { 4484 return true; 4485 } 4486 if (typeof a2 !== typeof b2) { 4487 return false; 4488 } 4489 if (typeof a2 === "function" && a2.toString() === b2.toString()) { 4490 return true; 4491 } 4492 let length; 4493 let i2; 4494 let keys; 4495 if (a2 && b2 && typeof a2 === "object") { 4496 if (Array.isArray(a2)) { 4497 length = a2.length; 4498 if (length !== b2.length) return false; 4499 for (i2 = length; i2-- !== 0; ) { 4500 if (!deepEqual(a2[i2], b2[i2])) { 4501 return false; 4502 } 4503 } 4504 return true; 4505 } 4506 keys = Object.keys(a2); 4507 length = keys.length; 4508 if (length !== Object.keys(b2).length) { 4509 return false; 4510 } 4511 for (i2 = length; i2-- !== 0; ) { 4512 if (!{}.hasOwnProperty.call(b2, keys[i2])) { 4513 return false; 4514 } 4515 } 4516 for (i2 = length; i2-- !== 0; ) { 4517 const key = keys[i2]; 4518 if (key === "_owner" && a2.$$typeof) { 4519 continue; 4520 } 4521 if (!deepEqual(a2[key], b2[key])) { 4522 return false; 4523 } 4524 } 4525 return true; 4526 } 4527 return a2 !== a2 && b2 !== b2; 4528 } 4529 function getDPR(element) { 4530 if (typeof window === "undefined") { 4531 return 1; 4532 } 4533 const win = element.ownerDocument.defaultView || window; 4534 return win.devicePixelRatio || 1; 4535 } 4536 function roundByDPR(element, value) { 4537 const dpr = getDPR(element); 4538 return Math.round(value * dpr) / dpr; 4539 } 4540 function useLatestRef(value) { 4541 const ref = React20.useRef(value); 4542 index(() => { 4543 ref.current = value; 4544 }); 4545 return ref; 4546 } 4547 function useFloating(options) { 4548 if (options === void 0) { 4549 options = {}; 4550 } 4551 const { 4552 placement = "bottom", 4553 strategy = "absolute", 4554 middleware = [], 4555 platform: platform3, 4556 elements: { 4557 reference: externalReference, 4558 floating: externalFloating 4559 } = {}, 4560 transform = true, 4561 whileElementsMounted, 4562 open 4563 } = options; 4564 const [data, setData] = React20.useState({ 4565 x: 0, 4566 y: 0, 4567 strategy, 4568 placement, 4569 middlewareData: {}, 4570 isPositioned: false 4571 }); 4572 const [latestMiddleware, setLatestMiddleware] = React20.useState(middleware); 4573 if (!deepEqual(latestMiddleware, middleware)) { 4574 setLatestMiddleware(middleware); 4575 } 4576 const [_reference, _setReference] = React20.useState(null); 4577 const [_floating, _setFloating] = React20.useState(null); 4578 const setReference = React20.useCallback((node) => { 4579 if (node !== referenceRef.current) { 4580 referenceRef.current = node; 4581 _setReference(node); 4582 } 4583 }, []); 4584 const setFloating = React20.useCallback((node) => { 4585 if (node !== floatingRef.current) { 4586 floatingRef.current = node; 4587 _setFloating(node); 4588 } 4589 }, []); 4590 const referenceEl = externalReference || _reference; 4591 const floatingEl = externalFloating || _floating; 4592 const referenceRef = React20.useRef(null); 4593 const floatingRef = React20.useRef(null); 4594 const dataRef = React20.useRef(data); 4595 const hasWhileElementsMounted = whileElementsMounted != null; 4596 const whileElementsMountedRef = useLatestRef(whileElementsMounted); 4597 const platformRef = useLatestRef(platform3); 4598 const openRef = useLatestRef(open); 4599 const update2 = React20.useCallback(() => { 4600 if (!referenceRef.current || !floatingRef.current) { 4601 return; 4602 } 4603 const config = { 4604 placement, 4605 strategy, 4606 middleware: latestMiddleware 4607 }; 4608 if (platformRef.current) { 4609 config.platform = platformRef.current; 4610 } 4611 computePosition2(referenceRef.current, floatingRef.current, config).then((data2) => { 4612 const fullData = { 4613 ...data2, 4614 // The floating element's position may be recomputed while it's closed 4615 // but still mounted (such as when transitioning out). To ensure 4616 // `isPositioned` will be `false` initially on the next open, avoid 4617 // setting it to `true` when `open === false` (must be specified). 4618 isPositioned: openRef.current !== false 4619 }; 4620 if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) { 4621 dataRef.current = fullData; 4622 ReactDOM3.flushSync(() => { 4623 setData(fullData); 4624 }); 4625 } 4626 }); 4627 }, [latestMiddleware, placement, strategy, platformRef, openRef]); 4628 index(() => { 4629 if (open === false && dataRef.current.isPositioned) { 4630 dataRef.current.isPositioned = false; 4631 setData((data2) => ({ 4632 ...data2, 4633 isPositioned: false 4634 })); 4635 } 4636 }, [open]); 4637 const isMountedRef = React20.useRef(false); 4638 index(() => { 4639 isMountedRef.current = true; 4640 return () => { 4641 isMountedRef.current = false; 4642 }; 4643 }, []); 4644 index(() => { 4645 if (referenceEl) referenceRef.current = referenceEl; 4646 if (floatingEl) floatingRef.current = floatingEl; 4647 if (referenceEl && floatingEl) { 4648 if (whileElementsMountedRef.current) { 4649 return whileElementsMountedRef.current(referenceEl, floatingEl, update2); 4650 } 4651 update2(); 4652 } 4653 }, [referenceEl, floatingEl, update2, whileElementsMountedRef, hasWhileElementsMounted]); 4654 const refs = React20.useMemo(() => ({ 4655 reference: referenceRef, 4656 floating: floatingRef, 4657 setReference, 4658 setFloating 4659 }), [setReference, setFloating]); 4660 const elements2 = React20.useMemo(() => ({ 4661 reference: referenceEl, 4662 floating: floatingEl 4663 }), [referenceEl, floatingEl]); 4664 const floatingStyles = React20.useMemo(() => { 4665 const initialStyles = { 4666 position: strategy, 4667 left: 0, 4668 top: 0 4669 }; 4670 if (!elements2.floating) { 4671 return initialStyles; 4672 } 4673 const x2 = roundByDPR(elements2.floating, data.x); 4674 const y2 = roundByDPR(elements2.floating, data.y); 4675 if (transform) { 4676 return { 4677 ...initialStyles, 4678 transform: "translate(" + x2 + "px, " + y2 + "px)", 4679 ...getDPR(elements2.floating) >= 1.5 && { 4680 willChange: "transform" 4681 } 4682 }; 4683 } 4684 return { 4685 position: strategy, 4686 left: x2, 4687 top: y2 4688 }; 4689 }, [strategy, transform, elements2.floating, data.x, data.y]); 4690 return React20.useMemo(() => ({ 4691 ...data, 4692 update: update2, 4693 refs, 4694 elements: elements2, 4695 floatingStyles 4696 }), [data, update2, refs, elements2, floatingStyles]); 4697 } 4698 var offset3 = (options, deps) => { 4699 const result = offset2(options); 4700 return { 4701 name: result.name, 4702 fn: result.fn, 4703 options: [options, deps] 4704 }; 4705 }; 4706 var shift3 = (options, deps) => { 4707 const result = shift2(options); 4708 return { 4709 name: result.name, 4710 fn: result.fn, 4711 options: [options, deps] 4712 }; 4713 }; 4714 var limitShift3 = (options, deps) => { 4715 const result = limitShift2(options); 4716 return { 4717 fn: result.fn, 4718 options: [options, deps] 4719 }; 4720 }; 4721 var flip3 = (options, deps) => { 4722 const result = flip2(options); 4723 return { 4724 name: result.name, 4725 fn: result.fn, 4726 options: [options, deps] 4727 }; 4728 }; 4729 var size3 = (options, deps) => { 4730 const result = size2(options); 4731 return { 4732 name: result.name, 4733 fn: result.fn, 4734 options: [options, deps] 4735 }; 4736 }; 4737 var hide3 = (options, deps) => { 4738 const result = hide2(options); 4739 return { 4740 name: result.name, 4741 fn: result.fn, 4742 options: [options, deps] 4743 }; 4744 }; 4745 4746 // node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs 4747 var React25 = __toESM(require_react(), 1); 4748 var ReactDOM4 = __toESM(require_react_dom(), 1); 4749 4750 // node_modules/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.mjs 4751 var React24 = __toESM(require_react(), 1); 4752 4753 // node_modules/@base-ui/utils/store/createSelector.mjs 4754 var createSelector = (a2, b2, c2, d2, e2, f2, ...other) => { 4755 if (other.length > 0) { 4756 throw new Error(true ? "Unsupported number of selectors" : formatErrorMessage_default(1)); 4757 } 4758 let selector; 4759 if (a2 && b2 && c2 && d2 && e2 && f2) { 4760 selector = (state, a1, a22, a3) => { 4761 const va = a2(state, a1, a22, a3); 4762 const vb = b2(state, a1, a22, a3); 4763 const vc = c2(state, a1, a22, a3); 4764 const vd = d2(state, a1, a22, a3); 4765 const ve = e2(state, a1, a22, a3); 4766 return f2(va, vb, vc, vd, ve, a1, a22, a3); 4767 }; 4768 } else if (a2 && b2 && c2 && d2 && e2) { 4769 selector = (state, a1, a22, a3) => { 4770 const va = a2(state, a1, a22, a3); 4771 const vb = b2(state, a1, a22, a3); 4772 const vc = c2(state, a1, a22, a3); 4773 const vd = d2(state, a1, a22, a3); 4774 return e2(va, vb, vc, vd, a1, a22, a3); 4775 }; 4776 } else if (a2 && b2 && c2 && d2) { 4777 selector = (state, a1, a22, a3) => { 4778 const va = a2(state, a1, a22, a3); 4779 const vb = b2(state, a1, a22, a3); 4780 const vc = c2(state, a1, a22, a3); 4781 return d2(va, vb, vc, a1, a22, a3); 4782 }; 4783 } else if (a2 && b2 && c2) { 4784 selector = (state, a1, a22, a3) => { 4785 const va = a2(state, a1, a22, a3); 4786 const vb = b2(state, a1, a22, a3); 4787 return c2(va, vb, a1, a22, a3); 4788 }; 4789 } else if (a2 && b2) { 4790 selector = (state, a1, a22, a3) => { 4791 const va = a2(state, a1, a22, a3); 4792 return b2(va, a1, a22, a3); 4793 }; 4794 } else if (a2) { 4795 selector = a2; 4796 } else { 4797 throw ( 4798 /* minify-error-disabled */ 4799 new Error("Missing arguments") 4800 ); 4801 } 4802 return selector; 4803 }; 4804 4805 // node_modules/@base-ui/utils/store/useStore.mjs 4806 var React22 = __toESM(require_react(), 1); 4807 var import_shim = __toESM(require_shim(), 1); 4808 var import_with_selector = __toESM(require_with_selector(), 1); 4809 4810 // node_modules/@base-ui/utils/fastHooks.mjs 4811 var React21 = __toESM(require_react(), 1); 4812 var hooks = []; 4813 var currentInstance = void 0; 4814 function getInstance() { 4815 return currentInstance; 4816 } 4817 function register(hook) { 4818 hooks.push(hook); 4819 } 4820 function fastComponent(fn) { 4821 const FastComponent = (props, forwardedRef) => { 4822 const instance = useRefWithInit(createInstance).current; 4823 let result; 4824 try { 4825 currentInstance = instance; 4826 for (const hook of hooks) { 4827 hook.before(instance); 4828 } 4829 result = fn(props, forwardedRef); 4830 for (const hook of hooks) { 4831 hook.after(instance); 4832 } 4833 instance.didInitialize = true; 4834 } finally { 4835 currentInstance = void 0; 4836 } 4837 return result; 4838 }; 4839 FastComponent.displayName = fn.displayName || fn.name; 4840 return FastComponent; 4841 } 4842 function fastComponentRef(fn) { 4843 return /* @__PURE__ */ React21.forwardRef(fastComponent(fn)); 4844 } 4845 function createInstance() { 4846 return { 4847 didInitialize: false 4848 }; 4849 } 4850 4851 // node_modules/@base-ui/utils/store/useStore.mjs 4852 var canUseRawUseSyncExternalStore = isReactVersionAtLeast(19); 4853 var useStoreImplementation = canUseRawUseSyncExternalStore ? useStoreFast : useStoreLegacy; 4854 function useStore(store, selector, a1, a2, a3) { 4855 return useStoreImplementation(store, selector, a1, a2, a3); 4856 } 4857 function useStoreR19(store, selector, a1, a2, a3) { 4858 const getSelection = React22.useCallback(() => selector(store.getSnapshot(), a1, a2, a3), [store, selector, a1, a2, a3]); 4859 return (0, import_shim.useSyncExternalStore)(store.subscribe, getSelection, getSelection); 4860 } 4861 register({ 4862 before(instance) { 4863 instance.syncIndex = 0; 4864 if (!instance.didInitialize) { 4865 instance.syncTick = 1; 4866 instance.syncHooks = []; 4867 instance.didChangeStore = true; 4868 instance.getSnapshot = () => { 4869 let didChange2 = false; 4870 for (let i2 = 0; i2 < instance.syncHooks.length; i2 += 1) { 4871 const hook = instance.syncHooks[i2]; 4872 const value = hook.selector(hook.store.state, hook.a1, hook.a2, hook.a3); 4873 if (!Object.is(hook.value, value)) { 4874 didChange2 = true; 4875 hook.value = value; 4876 } 4877 } 4878 if (didChange2) { 4879 instance.syncTick += 1; 4880 } 4881 return instance.syncTick; 4882 }; 4883 } 4884 }, 4885 after(instance) { 4886 if (instance.syncHooks.length > 0) { 4887 if (instance.didChangeStore) { 4888 instance.didChangeStore = false; 4889 instance.subscribe = (onStoreChange) => { 4890 const stores = /* @__PURE__ */ new Set(); 4891 for (const hook of instance.syncHooks) { 4892 stores.add(hook.store); 4893 } 4894 const unsubscribes = []; 4895 for (const store of stores) { 4896 unsubscribes.push(store.subscribe(onStoreChange)); 4897 } 4898 return () => { 4899 for (const unsubscribe of unsubscribes) { 4900 unsubscribe(); 4901 } 4902 }; 4903 }; 4904 } 4905 (0, import_shim.useSyncExternalStore)(instance.subscribe, instance.getSnapshot, instance.getSnapshot); 4906 } 4907 } 4908 }); 4909 function useStoreFast(store, selector, a1, a2, a3) { 4910 const instance = getInstance(); 4911 if (!instance) { 4912 return useStoreR19(store, selector, a1, a2, a3); 4913 } 4914 const index2 = instance.syncIndex; 4915 instance.syncIndex += 1; 4916 let hook; 4917 if (!instance.didInitialize) { 4918 hook = { 4919 store, 4920 selector, 4921 a1, 4922 a2, 4923 a3, 4924 value: selector(store.getSnapshot(), a1, a2, a3) 4925 }; 4926 instance.syncHooks.push(hook); 4927 } else { 4928 hook = instance.syncHooks[index2]; 4929 if (hook.store !== store || hook.selector !== selector || !Object.is(hook.a1, a1) || !Object.is(hook.a2, a2) || !Object.is(hook.a3, a3)) { 4930 if (hook.store !== store) { 4931 instance.didChangeStore = true; 4932 } 4933 hook.store = store; 4934 hook.selector = selector; 4935 hook.a1 = a1; 4936 hook.a2 = a2; 4937 hook.a3 = a3; 4938 hook.value = selector(store.getSnapshot(), a1, a2, a3); 4939 } 4940 } 4941 return hook.value; 4942 } 4943 function useStoreLegacy(store, selector, a1, a2, a3) { 4944 return (0, import_with_selector.useSyncExternalStoreWithSelector)(store.subscribe, store.getSnapshot, store.getSnapshot, (state) => selector(state, a1, a2, a3)); 4945 } 4946 4947 // node_modules/@base-ui/utils/store/Store.mjs 4948 var Store = class { 4949 /** 4950 * The current state of the store. 4951 * This property is updated immediately when the state changes as a result of calling {@link setState}, {@link update}, or {@link set}. 4952 * To subscribe to state changes, use the {@link useState} method. The value returned by {@link useState} is updated after the component renders (similarly to React's useState). 4953 * The values can be used directly (to avoid subscribing to the store) in effects or event handlers. 4954 * 4955 * Do not modify properties in state directly. Instead, use the provided methods to ensure proper state management and listener notification. 4956 */ 4957 // Internal state to handle recursive `setState()` calls 4958 constructor(state) { 4959 this.state = state; 4960 this.listeners = /* @__PURE__ */ new Set(); 4961 this.updateTick = 0; 4962 } 4963 /** 4964 * Registers a listener that will be called whenever the store's state changes. 4965 * 4966 * @param fn The listener function to be called on state changes. 4967 * @returns A function to unsubscribe the listener. 4968 */ 4969 subscribe = (fn) => { 4970 this.listeners.add(fn); 4971 return () => { 4972 this.listeners.delete(fn); 4973 }; 4974 }; 4975 /** 4976 * Returns the current state of the store. 4977 */ 4978 getSnapshot = () => { 4979 return this.state; 4980 }; 4981 /** 4982 * Updates the entire store's state and notifies all registered listeners. 4983 * 4984 * @param newState The new state to set for the store. 4985 */ 4986 setState(newState) { 4987 if (this.state === newState) { 4988 return; 4989 } 4990 this.state = newState; 4991 this.updateTick += 1; 4992 const currentTick = this.updateTick; 4993 for (const listener of this.listeners) { 4994 if (currentTick !== this.updateTick) { 4995 return; 4996 } 4997 listener(newState); 4998 } 4999 } 5000 /** 5001 * Merges the provided changes into the current state and notifies listeners if there are changes. 5002 * 5003 * @param changes An object containing the changes to apply to the current state. 5004 */ 5005 update(changes) { 5006 for (const key in changes) { 5007 if (!Object.is(this.state[key], changes[key])) { 5008 this.setState({ 5009 ...this.state, 5010 ...changes 5011 }); 5012 return; 5013 } 5014 } 5015 } 5016 /** 5017 * Sets a specific key in the store's state to a new value and notifies listeners if the value has changed. 5018 * 5019 * @param key The key in the store's state to update. 5020 * @param value The new value to set for the specified key. 5021 */ 5022 set(key, value) { 5023 if (!Object.is(this.state[key], value)) { 5024 this.setState({ 5025 ...this.state, 5026 [key]: value 5027 }); 5028 } 5029 } 5030 /** 5031 * Gives the state a new reference and updates all registered listeners. 5032 */ 5033 notifyAll() { 5034 const newState = { 5035 ...this.state 5036 }; 5037 this.setState(newState); 5038 } 5039 use(selector, a1, a2, a3) { 5040 return useStore(this, selector, a1, a2, a3); 5041 } 5042 }; 5043 5044 // node_modules/@base-ui/utils/store/ReactStore.mjs 5045 var React23 = __toESM(require_react(), 1); 5046 var ReactStore = class extends Store { 5047 /** 5048 * Creates a new ReactStore instance. 5049 * 5050 * @param state Initial state of the store. 5051 * @param context Non-reactive context values. 5052 * @param selectors Optional selectors for use with `useState`. 5053 */ 5054 constructor(state, context = {}, selectors3) { 5055 super(state); 5056 this.context = context; 5057 this.selectors = selectors3; 5058 } 5059 /** 5060 * Non-reactive values such as refs, callbacks, etc. 5061 */ 5062 /** 5063 * Synchronizes a single external value into the store. 5064 * 5065 * Note that the while the value in `state` is updated immediately, the value returned 5066 * by `useState` is updated before the next render (similarly to React's `useState`). 5067 */ 5068 useSyncedValue(key, value) { 5069 React23.useDebugValue(key); 5070 const store = this; 5071 useIsoLayoutEffect(() => { 5072 if (store.state[key] !== value) { 5073 store.set(key, value); 5074 } 5075 }, [store, key, value]); 5076 } 5077 /** 5078 * Synchronizes a single external value into the store and 5079 * cleans it up (sets to `undefined`) on unmount. 5080 * 5081 * Note that the while the value in `state` is updated immediately, the value returned 5082 * by `useState` is updated before the next render (similarly to React's `useState`). 5083 */ 5084 useSyncedValueWithCleanup(key, value) { 5085 const store = this; 5086 useIsoLayoutEffect(() => { 5087 if (store.state[key] !== value) { 5088 store.set(key, value); 5089 } 5090 return () => { 5091 store.set(key, void 0); 5092 }; 5093 }, [store, key, value]); 5094 } 5095 /** 5096 * Synchronizes multiple external values into the store. 5097 * 5098 * Note that the while the values in `state` are updated immediately, the values returned 5099 * by `useState` are updated before the next render (similarly to React's `useState`). 5100 */ 5101 useSyncedValues(statePart) { 5102 const store = this; 5103 if (true) { 5104 React23.useDebugValue(statePart, (p3) => Object.keys(p3)); 5105 const keys = React23.useRef(Object.keys(statePart)).current; 5106 const nextKeys = Object.keys(statePart); 5107 if (keys.length !== nextKeys.length || keys.some((key, index2) => key !== nextKeys[index2])) { 5108 console.error("ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable."); 5109 } 5110 } 5111 const dependencies = Object.values(statePart); 5112 useIsoLayoutEffect(() => { 5113 store.update(statePart); 5114 }, [store, ...dependencies]); 5115 } 5116 /** 5117 * Registers a controllable prop pair (`controlled`, `defaultValue`) for a specific key. If `controlled` 5118 * is non-undefined, the store's state at `key` is updated to match `controlled`. 5119 */ 5120 useControlledProp(key, controlled) { 5121 React23.useDebugValue(key); 5122 const store = this; 5123 const isControlled = controlled !== void 0; 5124 useIsoLayoutEffect(() => { 5125 if (isControlled && !Object.is(store.state[key], controlled)) { 5126 store.setState({ 5127 ...store.state, 5128 [key]: controlled 5129 }); 5130 } 5131 }, [store, key, controlled, isControlled]); 5132 if (true) { 5133 const cache = this.controlledValues ??= /* @__PURE__ */ new Map(); 5134 if (!cache.has(key)) { 5135 cache.set(key, isControlled); 5136 } 5137 const previouslyControlled = cache.get(key); 5138 if (previouslyControlled !== void 0 && previouslyControlled !== isControlled) { 5139 console.error(`A component is changing the $isControlled ? "" : "un"}controlled state of $key.toString()} to be $isControlled ? "un" : ""}controlled. Elements should not switch from uncontrolled to controlled (or vice versa).`); 5140 } 5141 } 5142 } 5143 /** Gets the current value from the store using a selector with the provided key. 5144 * 5145 * @param key Key of the selector to use. 5146 */ 5147 select(key, a1, a2, a3) { 5148 const selector = this.selectors[key]; 5149 return selector(this.state, a1, a2, a3); 5150 } 5151 /** 5152 * Returns a value from the store's state using a selector function. 5153 * Used to subscribe to specific parts of the state. 5154 * This methods causes a rerender whenever the selected state changes. 5155 * 5156 * @param key Key of the selector to use. 5157 */ 5158 useState(key, a1, a2, a3) { 5159 React23.useDebugValue(key); 5160 return useStore(this, this.selectors[key], a1, a2, a3); 5161 } 5162 /** 5163 * Wraps a function with `useStableCallback` to ensure it has a stable reference 5164 * and assigns it to the context. 5165 * 5166 * @param key Key of the event callback. Must be a function in the context. 5167 * @param fn Function to assign. 5168 */ 5169 useContextCallback(key, fn) { 5170 React23.useDebugValue(key); 5171 const stableFunction = useStableCallback(fn ?? NOOP); 5172 this.context[key] = stableFunction; 5173 } 5174 /** 5175 * Returns a stable setter function for a specific key in the store's state. 5176 * It's commonly used to pass as a ref callback to React elements. 5177 * 5178 * @param key Key of the state to set. 5179 */ 5180 useStateSetter(key) { 5181 const ref = React23.useRef(void 0); 5182 if (ref.current === void 0) { 5183 ref.current = (value) => { 5184 this.set(key, value); 5185 }; 5186 } 5187 return ref.current; 5188 } 5189 /** 5190 * Observes changes derived from the store's selectors and calls the listener when the selected value changes. 5191 * 5192 * @param key Key of the selector to observe. 5193 * @param listener Listener function called when the selector result changes. 5194 */ 5195 observe(selector, listener) { 5196 let selectFn; 5197 if (typeof selector === "function") { 5198 selectFn = selector; 5199 } else { 5200 selectFn = this.selectors[selector]; 5201 } 5202 let prevValue = selectFn(this.state); 5203 listener(prevValue, prevValue, this); 5204 return this.subscribe((nextState) => { 5205 const nextValue = selectFn(nextState); 5206 if (!Object.is(prevValue, nextValue)) { 5207 const oldValue = prevValue; 5208 prevValue = nextValue; 5209 listener(nextValue, oldValue, this); 5210 } 5211 }); 5212 } 5213 }; 5214 5215 // node_modules/@base-ui/react/floating-ui-react/components/FloatingRootStore.mjs 5216 var selectors = { 5217 open: createSelector((state) => state.open), 5218 transitionStatus: createSelector((state) => state.transitionStatus), 5219 domReferenceElement: createSelector((state) => state.domReferenceElement), 5220 referenceElement: createSelector((state) => state.positionReference ?? state.referenceElement), 5221 floatingElement: createSelector((state) => state.floatingElement), 5222 floatingId: createSelector((state) => state.floatingId) 5223 }; 5224 var FloatingRootStore = class extends ReactStore { 5225 constructor(options) { 5226 const { 5227 syncOnly, 5228 nested, 5229 onOpenChange, 5230 triggerElements, 5231 ...initialState 5232 } = options; 5233 super({ 5234 ...initialState, 5235 positionReference: initialState.referenceElement, 5236 domReferenceElement: initialState.referenceElement 5237 }, { 5238 onOpenChange, 5239 dataRef: { 5240 current: {} 5241 }, 5242 events: createEventEmitter(), 5243 nested, 5244 triggerElements 5245 }, selectors); 5246 this.syncOnly = syncOnly; 5247 } 5248 /** 5249 * Syncs the event used by hover logic to distinguish hover-open from click-like interaction. 5250 */ 5251 syncOpenEvent = (newOpen, event) => { 5252 if (!newOpen || !this.state.open || // Prevent a pending hover-open from overwriting a click-open event, while allowing 5253 // click events to upgrade a hover-open. 5254 event != null && isClickLikeEvent(event)) { 5255 this.context.dataRef.current.openEvent = newOpen ? event : void 0; 5256 } 5257 }; 5258 /** 5259 * Runs the root-owned side effects for an open state change. 5260 */ 5261 dispatchOpenChange = (newOpen, eventDetails) => { 5262 this.syncOpenEvent(newOpen, eventDetails.event); 5263 const details = { 5264 open: newOpen, 5265 reason: eventDetails.reason, 5266 nativeEvent: eventDetails.event, 5267 nested: this.context.nested, 5268 triggerElement: eventDetails.trigger 5269 }; 5270 this.context.events.emit("openchange", details); 5271 }; 5272 /** 5273 * Emits the `openchange` event through the internal event emitter and calls the `onOpenChange` handler with the provided arguments. 5274 * 5275 * @param newOpen The new open state. 5276 * @param eventDetails Details about the event that triggered the open state change. 5277 */ 5278 setOpen = (newOpen, eventDetails) => { 5279 if (this.syncOnly) { 5280 this.context.onOpenChange?.(newOpen, eventDetails); 5281 return; 5282 } 5283 this.dispatchOpenChange(newOpen, eventDetails); 5284 this.context.onOpenChange?.(newOpen, eventDetails); 5285 }; 5286 }; 5287 5288 // node_modules/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.mjs 5289 function useSyncedFloatingRootContext(options) { 5290 const { 5291 popupStore, 5292 treatPopupAsFloatingElement = false, 5293 floatingRootContext: floatingRootContextProp, 5294 floatingId, 5295 nested, 5296 onOpenChange 5297 } = options; 5298 const open = popupStore.useState("open"); 5299 const referenceElement = popupStore.useState("activeTriggerElement"); 5300 const floatingElement = popupStore.useState(treatPopupAsFloatingElement ? "popupElement" : "positionerElement"); 5301 const triggerElements = popupStore.context.triggerElements; 5302 const handleOpenChange = onOpenChange; 5303 const internalStoreRef = React24.useRef(null); 5304 if (floatingRootContextProp === void 0 && internalStoreRef.current === null) { 5305 internalStoreRef.current = new FloatingRootStore({ 5306 open, 5307 transitionStatus: void 0, 5308 referenceElement, 5309 floatingElement, 5310 triggerElements, 5311 onOpenChange: handleOpenChange, 5312 floatingId, 5313 syncOnly: true, 5314 nested 5315 }); 5316 } 5317 const store = floatingRootContextProp ?? internalStoreRef.current; 5318 popupStore.useSyncedValue("floatingId", floatingId); 5319 useIsoLayoutEffect(() => { 5320 const valuesToSync = { 5321 open, 5322 floatingId, 5323 referenceElement, 5324 floatingElement 5325 }; 5326 if (isElement(referenceElement)) { 5327 valuesToSync.domReferenceElement = referenceElement; 5328 } 5329 if (store.state.positionReference === store.state.referenceElement) { 5330 valuesToSync.positionReference = referenceElement; 5331 } 5332 store.update(valuesToSync); 5333 }, [open, floatingId, referenceElement, floatingElement, store]); 5334 store.context.onOpenChange = handleOpenChange; 5335 store.context.nested = nested; 5336 return store; 5337 } 5338 5339 // node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs 5340 var FOCUSABLE_POPUP_PROPS = { 5341 tabIndex: -1, 5342 [FOCUSABLE_ATTRIBUTE]: "" 5343 }; 5344 function usePopupStore(externalStore, createStore, treatPopupAsFloatingElement = false) { 5345 const floatingId = useId(); 5346 const nested = useFloatingParentNodeId() != null; 5347 const internalStoreRef = React25.useRef(null); 5348 if (externalStore === void 0 && internalStoreRef.current === null) { 5349 internalStoreRef.current = createStore(floatingId, nested); 5350 } 5351 const store = externalStore ?? internalStoreRef.current; 5352 useSyncedFloatingRootContext({ 5353 popupStore: store, 5354 treatPopupAsFloatingElement, 5355 floatingRootContext: store.state.floatingRootContext, 5356 floatingId, 5357 nested, 5358 onOpenChange: store.setOpen 5359 }); 5360 return { 5361 store, 5362 internalStore: internalStoreRef.current 5363 }; 5364 } 5365 function useTriggerRegistration(id, store) { 5366 const registeredElementIdRef = React25.useRef(null); 5367 const registeredElementRef = React25.useRef(null); 5368 return React25.useCallback((element) => { 5369 if (id === void 0) { 5370 return; 5371 } 5372 let shouldSyncTriggerCount = false; 5373 if (registeredElementIdRef.current !== null) { 5374 const registeredId = registeredElementIdRef.current; 5375 const registeredElement = registeredElementRef.current; 5376 const currentElement = store.context.triggerElements.getById(registeredId); 5377 if (registeredElement && currentElement === registeredElement) { 5378 store.context.triggerElements.delete(registeredId); 5379 shouldSyncTriggerCount = true; 5380 } 5381 registeredElementIdRef.current = null; 5382 registeredElementRef.current = null; 5383 } 5384 if (element !== null) { 5385 registeredElementIdRef.current = id; 5386 registeredElementRef.current = element; 5387 store.context.triggerElements.add(id, element); 5388 shouldSyncTriggerCount = true; 5389 } 5390 if (shouldSyncTriggerCount) { 5391 const triggerCount = store.context.triggerElements.size; 5392 if (store.select("open") && store.state.triggerCount !== triggerCount) { 5393 store.set("triggerCount", triggerCount); 5394 } 5395 } 5396 }, [store, id]); 5397 } 5398 function setPopupOpenState(state, open, trigger, preventUnmountOnClose = false) { 5399 if (open) { 5400 state.preventUnmountingOnClose = false; 5401 } else if (preventUnmountOnClose) { 5402 state.preventUnmountingOnClose = true; 5403 } 5404 const triggerId = trigger?.id ?? null; 5405 if (triggerId || open) { 5406 state.activeTriggerId = triggerId; 5407 state.activeTriggerElement = trigger ?? null; 5408 } 5409 } 5410 function attachPreventUnmountOnClose(eventDetails) { 5411 let preventUnmountOnClose = false; 5412 eventDetails.preventUnmountOnClose = () => { 5413 preventUnmountOnClose = true; 5414 }; 5415 return () => preventUnmountOnClose; 5416 } 5417 function applyPopupOpenChange(store, nextOpen, eventDetails, options = {}) { 5418 const reason = eventDetails.reason; 5419 const isHover = reason === reason_parts_exports.triggerHover; 5420 const isFocusOpen = nextOpen && reason === reason_parts_exports.triggerFocus; 5421 const isDismissClose = !nextOpen && (reason === reason_parts_exports.triggerPress || reason === reason_parts_exports.escapeKey); 5422 const shouldPreventUnmountOnClose = attachPreventUnmountOnClose(eventDetails); 5423 store.context.onOpenChange?.(nextOpen, eventDetails); 5424 if (eventDetails.isCanceled) { 5425 return; 5426 } 5427 options.onBeforeDispatch?.(); 5428 store.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails); 5429 const changeState = () => { 5430 const updatedState = { 5431 ...options.extraState, 5432 open: nextOpen 5433 }; 5434 if (isFocusOpen) { 5435 updatedState.instantType = "focus"; 5436 } else if (isDismissClose) { 5437 updatedState.instantType = "dismiss"; 5438 } else if (isHover) { 5439 updatedState.instantType = void 0; 5440 } 5441 setPopupOpenState(updatedState, nextOpen, eventDetails.trigger, shouldPreventUnmountOnClose()); 5442 store.update(updatedState); 5443 }; 5444 if (isHover) { 5445 ReactDOM4.flushSync(changeState); 5446 } else { 5447 changeState(); 5448 } 5449 } 5450 function useInitialOpenSync(store, openProp, defaultOpen, defaultTriggerId) { 5451 useOnFirstRender(() => { 5452 if (openProp === void 0 && store.state.open === false && defaultOpen) { 5453 store.state = { 5454 ...store.state, 5455 open: true, 5456 activeTriggerId: defaultTriggerId, 5457 preventUnmountingOnClose: false 5458 }; 5459 } 5460 }); 5461 } 5462 function useTriggerDataForwarding(triggerId, triggerElementRef, store, stateUpdates) { 5463 const isMountedByThisTrigger = store.useState("isMountedByTrigger", triggerId); 5464 const baseRegisterTrigger = useTriggerRegistration(triggerId, store); 5465 const registerTrigger = useStableCallback((element) => { 5466 baseRegisterTrigger(element); 5467 if (!element) { 5468 return; 5469 } 5470 const open = store.select("open"); 5471 const activeTriggerId = store.select("activeTriggerId"); 5472 if (activeTriggerId === triggerId) { 5473 store.update({ 5474 activeTriggerElement: element, 5475 ...open ? stateUpdates : null 5476 }); 5477 return; 5478 } 5479 if (activeTriggerId == null && open) { 5480 store.update({ 5481 activeTriggerId: triggerId, 5482 activeTriggerElement: element, 5483 ...stateUpdates 5484 }); 5485 } 5486 }); 5487 useIsoLayoutEffect(() => { 5488 if (isMountedByThisTrigger) { 5489 store.update({ 5490 activeTriggerElement: triggerElementRef.current, 5491 ...stateUpdates 5492 }); 5493 } 5494 }, [isMountedByThisTrigger, store, triggerElementRef, ...Object.values(stateUpdates)]); 5495 return { 5496 registerTrigger, 5497 isMountedByThisTrigger 5498 }; 5499 } 5500 function useImplicitActiveTrigger(store, options = {}) { 5501 const { 5502 closeOnActiveTriggerUnmount = false 5503 } = options; 5504 const open = store.useState("open"); 5505 const reactiveTriggerCount = store.useState("triggerCount"); 5506 useIsoLayoutEffect(() => { 5507 if (!open) { 5508 if (store.state.triggerCount !== 0) { 5509 store.set("triggerCount", 0); 5510 } 5511 return; 5512 } 5513 const triggerCount = store.context.triggerElements.size; 5514 const stateUpdates = {}; 5515 if (store.state.triggerCount !== triggerCount) { 5516 stateUpdates.triggerCount = triggerCount; 5517 } 5518 const activeTriggerId = store.select("activeTriggerId"); 5519 let lostActiveTriggerId = null; 5520 if (activeTriggerId) { 5521 const activeTriggerElement = store.context.triggerElements.getById(activeTriggerId); 5522 if (!activeTriggerElement) { 5523 lostActiveTriggerId = activeTriggerId; 5524 } else if (activeTriggerElement !== store.state.activeTriggerElement) { 5525 stateUpdates.activeTriggerElement = activeTriggerElement; 5526 } 5527 } 5528 if (!lostActiveTriggerId && !activeTriggerId && triggerCount === 1) { 5529 const iteratorResult = store.context.triggerElements.entries().next(); 5530 if (!iteratorResult.done) { 5531 const [implicitTriggerId, implicitTriggerElement] = iteratorResult.value; 5532 stateUpdates.activeTriggerId = implicitTriggerId; 5533 stateUpdates.activeTriggerElement = implicitTriggerElement; 5534 } 5535 } 5536 if (stateUpdates.triggerCount !== void 0 || stateUpdates.activeTriggerId !== void 0 || stateUpdates.activeTriggerElement !== void 0) { 5537 store.update(stateUpdates); 5538 } 5539 if (lostActiveTriggerId) { 5540 if (closeOnActiveTriggerUnmount) { 5541 queueMicrotask(() => { 5542 if (store.select("open") && store.select("activeTriggerId") === lostActiveTriggerId && !store.context.triggerElements.getById(lostActiveTriggerId)) { 5543 const eventDetails = createChangeEventDetails(reason_parts_exports.none); 5544 store.setOpen(false, eventDetails); 5545 if (!eventDetails.isCanceled) { 5546 store.update({ 5547 activeTriggerId: null, 5548 activeTriggerElement: null 5549 }); 5550 } 5551 } 5552 }); 5553 } 5554 } 5555 }, [open, store, reactiveTriggerCount, closeOnActiveTriggerUnmount]); 5556 } 5557 function useOpenStateTransitions(open, store, onUnmount) { 5558 const { 5559 mounted, 5560 setMounted, 5561 transitionStatus 5562 } = useTransitionStatus(open); 5563 const preventUnmountingOnClose = store.useState("preventUnmountingOnClose"); 5564 const syncedPreventUnmountingOnClose = open ? false : preventUnmountingOnClose; 5565 store.useSyncedValues({ 5566 mounted, 5567 transitionStatus, 5568 preventUnmountingOnClose: syncedPreventUnmountingOnClose 5569 }); 5570 const forceUnmount = useStableCallback(() => { 5571 setMounted(false); 5572 store.update({ 5573 activeTriggerId: null, 5574 activeTriggerElement: null, 5575 mounted: false, 5576 preventUnmountingOnClose: false 5577 }); 5578 onUnmount?.(); 5579 store.context.onOpenChangeComplete?.(false); 5580 }); 5581 useOpenChangeComplete({ 5582 enabled: mounted && !open && !syncedPreventUnmountingOnClose, 5583 open, 5584 ref: store.context.popupRef, 5585 onComplete() { 5586 if (!open) { 5587 forceUnmount(); 5588 } 5589 } 5590 }); 5591 return { 5592 forceUnmount, 5593 transitionStatus 5594 }; 5595 } 5596 function usePopupInteractionProps(store, statePart) { 5597 store.useSyncedValues(statePart); 5598 useIsoLayoutEffect(() => () => { 5599 store.update({ 5600 activeTriggerProps: EMPTY_OBJECT, 5601 inactiveTriggerProps: EMPTY_OBJECT, 5602 popupProps: EMPTY_OBJECT 5603 }); 5604 }, [store]); 5605 } 5606 5607 // node_modules/@base-ui/react/utils/popups/popupTriggerMap.mjs 5608 var PopupTriggerMap = class { 5609 constructor() { 5610 this.elementsSet = /* @__PURE__ */ new Set(); 5611 this.idMap = /* @__PURE__ */ new Map(); 5612 } 5613 /** 5614 * Adds a trigger element with the given ID. 5615 * 5616 * Note: The provided element is assumed to not be registered under multiple IDs. 5617 */ 5618 add(id, element) { 5619 const existingElement = this.idMap.get(id); 5620 if (existingElement === element) { 5621 return; 5622 } 5623 if (existingElement !== void 0) { 5624 this.elementsSet.delete(existingElement); 5625 } 5626 this.elementsSet.add(element); 5627 this.idMap.set(id, element); 5628 if (true) { 5629 if (this.elementsSet.size !== this.idMap.size) { 5630 throw new Error("Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap."); 5631 } 5632 } 5633 } 5634 /** 5635 * Removes the trigger element with the given ID. 5636 */ 5637 delete(id) { 5638 const element = this.idMap.get(id); 5639 if (element) { 5640 this.elementsSet.delete(element); 5641 this.idMap.delete(id); 5642 } 5643 } 5644 /** 5645 * Whether the given element is registered as a trigger. 5646 */ 5647 hasElement(element) { 5648 return this.elementsSet.has(element); 5649 } 5650 /** 5651 * Whether there is a registered trigger element matching the given predicate. 5652 */ 5653 hasMatchingElement(predicate) { 5654 for (const element of this.elementsSet) { 5655 if (predicate(element)) { 5656 return true; 5657 } 5658 } 5659 return false; 5660 } 5661 /** 5662 * Returns the trigger element associated with the given ID, or undefined if no such element exists. 5663 */ 5664 getById(id) { 5665 return this.idMap.get(id); 5666 } 5667 /** 5668 * Returns an iterable of all registered trigger entries, where each entry is a tuple of [id, element]. 5669 */ 5670 entries() { 5671 return this.idMap.entries(); 5672 } 5673 /** 5674 * Returns an iterable of all registered trigger elements. 5675 */ 5676 elements() { 5677 return this.elementsSet.values(); 5678 } 5679 /** 5680 * Returns the number of registered trigger elements. 5681 */ 5682 get size() { 5683 return this.idMap.size; 5684 } 5685 }; 5686 5687 // node_modules/@base-ui/react/floating-ui-react/utils/getEmptyRootContext.mjs 5688 function getEmptyRootContext() { 5689 return new FloatingRootStore({ 5690 open: false, 5691 transitionStatus: void 0, 5692 floatingElement: null, 5693 referenceElement: null, 5694 triggerElements: new PopupTriggerMap(), 5695 floatingId: void 0, 5696 syncOnly: false, 5697 nested: false, 5698 onOpenChange: void 0 5699 }); 5700 } 5701 5702 // node_modules/@base-ui/react/utils/popups/store.mjs 5703 function createInitialPopupStoreState() { 5704 return { 5705 open: false, 5706 openProp: void 0, 5707 mounted: false, 5708 transitionStatus: void 0, 5709 floatingRootContext: getEmptyRootContext(), 5710 floatingId: void 0, 5711 triggerCount: 0, 5712 preventUnmountingOnClose: false, 5713 payload: void 0, 5714 activeTriggerId: null, 5715 activeTriggerElement: null, 5716 triggerIdProp: void 0, 5717 popupElement: null, 5718 positionerElement: null, 5719 activeTriggerProps: EMPTY_OBJECT, 5720 inactiveTriggerProps: EMPTY_OBJECT, 5721 popupProps: EMPTY_OBJECT 5722 }; 5723 } 5724 function createPopupFloatingRootContext(triggerElements, floatingId, nested = false) { 5725 return new FloatingRootStore({ 5726 open: false, 5727 transitionStatus: void 0, 5728 floatingElement: null, 5729 referenceElement: null, 5730 triggerElements, 5731 floatingId, 5732 syncOnly: true, 5733 nested, 5734 onOpenChange: void 0 5735 }); 5736 } 5737 var activeTriggerIdSelector = createSelector((state) => state.triggerIdProp ?? state.activeTriggerId); 5738 var openSelector = createSelector((state) => state.openProp ?? state.open); 5739 var popupIdSelector = createSelector((state) => { 5740 const popupId = state.popupElement?.id ?? state.floatingId; 5741 return popupId || void 0; 5742 }); 5743 function triggerOwnsOpenPopup(state, triggerId) { 5744 return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) === triggerId; 5745 } 5746 function triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) { 5747 if (triggerOwnsOpenPopup(state, triggerId)) { 5748 return true; 5749 } 5750 return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) == null && state.triggerCount === 1; 5751 } 5752 var popupStoreSelectors = { 5753 open: openSelector, 5754 mounted: createSelector((state) => state.mounted), 5755 transitionStatus: createSelector((state) => state.transitionStatus), 5756 floatingRootContext: createSelector((state) => state.floatingRootContext), 5757 triggerCount: createSelector((state) => state.triggerCount), 5758 preventUnmountingOnClose: createSelector((state) => state.preventUnmountingOnClose), 5759 payload: createSelector((state) => state.payload), 5760 activeTriggerId: activeTriggerIdSelector, 5761 activeTriggerElement: createSelector((state) => state.mounted ? state.activeTriggerElement : null), 5762 popupId: popupIdSelector, 5763 /** 5764 * Whether the trigger with the given ID was used to open the popup. 5765 */ 5766 isTriggerActive: createSelector((state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId), 5767 /** 5768 * Whether the popup is open and was activated by a trigger with the given ID. 5769 */ 5770 isOpenedByTrigger: createSelector((state, triggerId) => triggerOwnsOpenPopup(state, triggerId)), 5771 /** 5772 * Whether the popup is mounted and was activated by a trigger with the given ID. 5773 */ 5774 isMountedByTrigger: createSelector((state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId && state.mounted), 5775 triggerProps: createSelector((state, isActive) => isActive ? state.activeTriggerProps : state.inactiveTriggerProps), 5776 /** 5777 * Popup id for the trigger that currently owns the open popup. 5778 */ 5779 triggerPopupId: createSelector((state, triggerId) => triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) ? popupIdSelector(state) : void 0), 5780 popupProps: createSelector((state) => state.popupProps), 5781 popupElement: createSelector((state) => state.popupElement), 5782 positionerElement: createSelector((state) => state.positionerElement) 5783 }; 5784 5785 // node_modules/@base-ui/react/floating-ui-react/hooks/useFloatingRootContext.mjs 5786 function useFloatingRootContext(options) { 5787 const { 5788 open = false, 5789 onOpenChange, 5790 elements: elements2 = {} 5791 } = options; 5792 const floatingId = useId(); 5793 const nested = useFloatingParentNodeId() != null; 5794 if (true) { 5795 const optionDomReference = elements2.reference; 5796 if (optionDomReference && !isElement(optionDomReference)) { 5797 console.error("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `context.setPositionReference()`", "instead."); 5798 } 5799 } 5800 const store = useRefWithInit(() => new FloatingRootStore({ 5801 open, 5802 transitionStatus: void 0, 5803 onOpenChange, 5804 referenceElement: elements2.reference ?? null, 5805 floatingElement: elements2.floating ?? null, 5806 triggerElements: new PopupTriggerMap(), 5807 floatingId, 5808 syncOnly: false, 5809 nested 5810 })).current; 5811 useIsoLayoutEffect(() => { 5812 const valuesToSync = { 5813 open, 5814 floatingId 5815 }; 5816 if (elements2.reference !== void 0) { 5817 valuesToSync.referenceElement = elements2.reference; 5818 valuesToSync.domReferenceElement = isElement(elements2.reference) ? elements2.reference : null; 5819 } 5820 if (elements2.floating !== void 0) { 5821 valuesToSync.floatingElement = elements2.floating; 5822 } 5823 store.update(valuesToSync); 5824 }, [open, floatingId, elements2.reference, elements2.floating, store]); 5825 store.context.onOpenChange = onOpenChange; 5826 store.context.nested = nested; 5827 return store; 5828 } 5829 5830 // node_modules/@base-ui/react/floating-ui-react/hooks/useFloating.mjs 5831 function useFloating2(options = {}) { 5832 const { 5833 nodeId, 5834 externalTree 5835 } = options; 5836 const internalStore = useFloatingRootContext(options); 5837 const store = options.rootContext || internalStore; 5838 const referenceElement = store.useState("referenceElement"); 5839 const floatingElement = store.useState("floatingElement"); 5840 const domReferenceElement = store.useState("domReferenceElement"); 5841 const open = store.useState("open"); 5842 const floatingId = store.useState("floatingId"); 5843 const [positionReference, setPositionReferenceRaw] = React26.useState(null); 5844 const [localDomReference, setLocalDomReference] = React26.useState(void 0); 5845 const [localFloatingElement, setLocalFloatingElement] = React26.useState(void 0); 5846 const domReferenceRef = React26.useRef(null); 5847 const tree = useFloatingTree(externalTree); 5848 const storeElements = React26.useMemo(() => ({ 5849 reference: referenceElement, 5850 floating: floatingElement, 5851 domReference: domReferenceElement 5852 }), [referenceElement, floatingElement, domReferenceElement]); 5853 const position = useFloating({ 5854 ...options, 5855 elements: { 5856 ...storeElements, 5857 ...positionReference && { 5858 reference: positionReference 5859 } 5860 } 5861 }); 5862 const localDomReferenceElement = isElement(localDomReference) ? localDomReference : null; 5863 const syncedFloatingElement = localFloatingElement === void 0 ? store.state.floatingElement : localFloatingElement; 5864 store.useSyncedValue("referenceElement", localDomReference ?? null); 5865 store.useSyncedValue("domReferenceElement", localDomReference === void 0 ? domReferenceElement : localDomReferenceElement); 5866 store.useSyncedValue("floatingElement", syncedFloatingElement); 5867 const setPositionReference = React26.useCallback((node) => { 5868 const computedPositionReference = isElement(node) ? { 5869 getBoundingClientRect: () => node.getBoundingClientRect(), 5870 getClientRects: () => node.getClientRects(), 5871 contextElement: node 5872 } : node; 5873 setPositionReferenceRaw(computedPositionReference); 5874 position.refs.setReference(computedPositionReference); 5875 }, [position.refs]); 5876 const setReference = React26.useCallback((node) => { 5877 if (isElement(node) || node === null) { 5878 domReferenceRef.current = node; 5879 setLocalDomReference(node); 5880 } 5881 if (isElement(position.refs.reference.current) || position.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to 5882 // `null` to support `positionReference` + an unstable `reference` 5883 // callback ref. 5884 node !== null && !isElement(node)) { 5885 position.refs.setReference(node); 5886 } 5887 }, [position.refs, setLocalDomReference]); 5888 const setFloating = React26.useCallback((node) => { 5889 setLocalFloatingElement(node); 5890 position.refs.setFloating(node); 5891 }, [position.refs]); 5892 const refs = React26.useMemo(() => ({ 5893 ...position.refs, 5894 setReference, 5895 setFloating, 5896 setPositionReference, 5897 domReference: domReferenceRef 5898 }), [position.refs, setReference, setFloating, setPositionReference]); 5899 const elements2 = React26.useMemo(() => ({ 5900 ...position.elements, 5901 domReference: domReferenceElement 5902 }), [position.elements, domReferenceElement]); 5903 const context = React26.useMemo(() => ({ 5904 ...position, 5905 dataRef: store.context.dataRef, 5906 open, 5907 onOpenChange: store.setOpen, 5908 events: store.context.events, 5909 floatingId, 5910 refs, 5911 elements: elements2, 5912 nodeId, 5913 rootStore: store 5914 }), [position, refs, elements2, nodeId, store, open, floatingId]); 5915 useIsoLayoutEffect(() => { 5916 if (domReferenceElement) { 5917 domReferenceRef.current = domReferenceElement; 5918 } 5919 }, [domReferenceElement]); 5920 useIsoLayoutEffect(() => { 5921 store.context.dataRef.current.floatingContext = context; 5922 const node = tree?.nodesRef.current.find((n2) => n2.id === nodeId); 5923 if (node) { 5924 node.context = context; 5925 } 5926 }); 5927 return React26.useMemo(() => ({ 5928 ...position, 5929 context, 5930 refs, 5931 elements: elements2, 5932 rootStore: store 5933 }), [position, refs, elements2, context, store]); 5934 } 5935 5936 // node_modules/@base-ui/react/floating-ui-react/hooks/useFocus.mjs 5937 var React27 = __toESM(require_react(), 1); 5938 var isMacSafari = parts_exports.os.mac && parts_exports.engine.webkit; 5939 function useFocus(context, props = {}) { 5940 const { 5941 enabled = true, 5942 delay 5943 } = props; 5944 const store = "rootStore" in context ? context.rootStore : context; 5945 const { 5946 events, 5947 dataRef 5948 } = store.context; 5949 const blockFocusRef = React27.useRef(false); 5950 const blockedReferenceRef = React27.useRef(null); 5951 const keyboardModalityRef = React27.useRef(true); 5952 const timeout = useTimeout(); 5953 React27.useEffect(() => { 5954 const domReference = store.select("domReferenceElement"); 5955 if (!enabled) { 5956 return void 0; 5957 } 5958 const win = getWindow(domReference); 5959 function onBlur() { 5960 const currentDomReference = store.select("domReferenceElement"); 5961 if (!store.select("open") && isHTMLElement(currentDomReference) && currentDomReference === activeElement(ownerDocument(currentDomReference))) { 5962 blockFocusRef.current = true; 5963 } 5964 } 5965 function onKeyDown() { 5966 keyboardModalityRef.current = true; 5967 } 5968 function onPointerDown() { 5969 keyboardModalityRef.current = false; 5970 } 5971 return mergeCleanups(addEventListener(win, "blur", onBlur), isMacSafari && addEventListener(win, "keydown", onKeyDown, true), isMacSafari && addEventListener(win, "pointerdown", onPointerDown, true)); 5972 }, [store, enabled]); 5973 React27.useEffect(() => { 5974 if (!enabled) { 5975 return void 0; 5976 } 5977 function onOpenChangeLocal(details) { 5978 if (details.reason === reason_parts_exports.triggerPress || details.reason === reason_parts_exports.escapeKey) { 5979 const referenceElement = store.select("domReferenceElement"); 5980 if (isElement(referenceElement)) { 5981 blockedReferenceRef.current = referenceElement; 5982 blockFocusRef.current = true; 5983 } 5984 } 5985 } 5986 events.on("openchange", onOpenChangeLocal); 5987 return () => { 5988 events.off("openchange", onOpenChangeLocal); 5989 }; 5990 }, [events, enabled, store]); 5991 const reference = React27.useMemo(() => { 5992 function resetBlockedFocus() { 5993 blockFocusRef.current = false; 5994 blockedReferenceRef.current = null; 5995 } 5996 return { 5997 onMouseLeave() { 5998 resetBlockedFocus(); 5999 }, 6000 onFocus(event) { 6001 const focusTarget = event.currentTarget; 6002 if (blockFocusRef.current) { 6003 if (blockedReferenceRef.current === focusTarget) { 6004 return; 6005 } 6006 resetBlockedFocus(); 6007 } 6008 const target = getTarget(event.nativeEvent); 6009 if (isElement(target)) { 6010 if (isMacSafari && !event.relatedTarget) { 6011 if (!keyboardModalityRef.current && !isTypeableElement(target)) { 6012 return; 6013 } 6014 } else if (!matchesFocusVisible(target)) { 6015 return; 6016 } 6017 } 6018 const movedFromOtherEnabledTrigger = isTargetInsideEnabledTrigger(event.relatedTarget, store.context.triggerElements); 6019 const { 6020 nativeEvent, 6021 currentTarget 6022 } = event; 6023 const delayValue = typeof delay === "function" ? delay() : delay; 6024 if (store.select("open") && movedFromOtherEnabledTrigger || delayValue === 0 || delayValue === void 0) { 6025 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget)); 6026 return; 6027 } 6028 timeout.start(delayValue, () => { 6029 if (blockFocusRef.current) { 6030 return; 6031 } 6032 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget)); 6033 }); 6034 }, 6035 onBlur(event) { 6036 resetBlockedFocus(); 6037 const relatedTarget = event.relatedTarget; 6038 const nativeEvent = event.nativeEvent; 6039 const movedToFocusGuard = isElement(relatedTarget) && relatedTarget.hasAttribute(createAttribute("focus-guard")) && relatedTarget.getAttribute("data-type") === "outside"; 6040 timeout.start(0, () => { 6041 const domReference = store.select("domReferenceElement"); 6042 const activeEl = activeElement(ownerDocument(domReference)); 6043 if (!relatedTarget && activeEl === domReference) { 6044 return; 6045 } 6046 if (contains(dataRef.current.floatingContext?.refs.floating.current, activeEl) || contains(domReference, activeEl) || movedToFocusGuard) { 6047 return; 6048 } 6049 const nextFocusedElement = relatedTarget ?? activeEl; 6050 if (isTargetInsideEnabledTrigger(nextFocusedElement, store.context.triggerElements)) { 6051 return; 6052 } 6053 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent)); 6054 }); 6055 } 6056 }; 6057 }, [dataRef, delay, store, timeout]); 6058 return React27.useMemo(() => enabled ? { 6059 reference, 6060 trigger: reference 6061 } : {}, [enabled, reference]); 6062 } 6063 6064 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverFloatingInteraction.mjs 6065 var React28 = __toESM(require_react(), 1); 6066 6067 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverInteractionSharedState.mjs 6068 var HoverInteraction = class _HoverInteraction { 6069 constructor() { 6070 this.pointerType = void 0; 6071 this.interactedInside = false; 6072 this.handler = void 0; 6073 this.blockMouseMove = true; 6074 this.performedPointerEventsMutation = false; 6075 this.pointerEventsScopeElement = null; 6076 this.pointerEventsReferenceElement = null; 6077 this.pointerEventsFloatingElement = null; 6078 this.restTimeoutPending = false; 6079 this.openChangeTimeout = new Timeout(); 6080 this.restTimeout = new Timeout(); 6081 this.handleCloseOptions = void 0; 6082 } 6083 static create() { 6084 return new _HoverInteraction(); 6085 } 6086 dispose = () => { 6087 this.openChangeTimeout.clear(); 6088 this.restTimeout.clear(); 6089 }; 6090 disposeEffect = () => { 6091 return this.dispose; 6092 }; 6093 }; 6094 var pointerEventsMutationOwnerByScopeElement = /* @__PURE__ */ new WeakMap(); 6095 function clearSafePolygonPointerEventsMutation(instance) { 6096 if (!instance.performedPointerEventsMutation) { 6097 return; 6098 } 6099 const scopeElement = instance.pointerEventsScopeElement; 6100 if (scopeElement && pointerEventsMutationOwnerByScopeElement.get(scopeElement) === instance) { 6101 instance.pointerEventsScopeElement?.style.removeProperty("pointer-events"); 6102 instance.pointerEventsReferenceElement?.style.removeProperty("pointer-events"); 6103 instance.pointerEventsFloatingElement?.style.removeProperty("pointer-events"); 6104 pointerEventsMutationOwnerByScopeElement.delete(scopeElement); 6105 } 6106 instance.performedPointerEventsMutation = false; 6107 instance.pointerEventsScopeElement = null; 6108 instance.pointerEventsReferenceElement = null; 6109 instance.pointerEventsFloatingElement = null; 6110 } 6111 function applySafePolygonPointerEventsMutation(instance, options) { 6112 const { 6113 scopeElement, 6114 referenceElement, 6115 floatingElement 6116 } = options; 6117 const existingOwner = pointerEventsMutationOwnerByScopeElement.get(scopeElement); 6118 if (existingOwner && existingOwner !== instance) { 6119 clearSafePolygonPointerEventsMutation(existingOwner); 6120 } 6121 clearSafePolygonPointerEventsMutation(instance); 6122 instance.performedPointerEventsMutation = true; 6123 instance.pointerEventsScopeElement = scopeElement; 6124 instance.pointerEventsReferenceElement = referenceElement; 6125 instance.pointerEventsFloatingElement = floatingElement; 6126 pointerEventsMutationOwnerByScopeElement.set(scopeElement, instance); 6127 scopeElement.style.pointerEvents = "none"; 6128 referenceElement.style.pointerEvents = "auto"; 6129 floatingElement.style.pointerEvents = "auto"; 6130 } 6131 function useHoverInteractionSharedState(store) { 6132 const data = store.context.dataRef.current; 6133 const instance = useRefWithInit(() => data.hoverInteractionState ?? HoverInteraction.create()).current; 6134 if (!data.hoverInteractionState) { 6135 data.hoverInteractionState = instance; 6136 } 6137 useOnMount(data.hoverInteractionState.disposeEffect); 6138 return data.hoverInteractionState; 6139 } 6140 6141 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverFloatingInteraction.mjs 6142 function useHoverFloatingInteraction(context, parameters = {}) { 6143 const { 6144 enabled = true, 6145 closeDelay: closeDelayProp = 0, 6146 nodeId: nodeIdProp 6147 } = parameters; 6148 const store = "rootStore" in context ? context.rootStore : context; 6149 const open = store.useState("open"); 6150 const floatingElement = store.useState("floatingElement"); 6151 const domReferenceElement = store.useState("domReferenceElement"); 6152 const { 6153 dataRef 6154 } = store.context; 6155 const tree = useFloatingTree(); 6156 const parentId = useFloatingParentNodeId(); 6157 const instance = useHoverInteractionSharedState(store); 6158 const childClosedTimeout = useTimeout(); 6159 const isClickLikeOpenEvent2 = useStableCallback(() => { 6160 return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside); 6161 }); 6162 const isHoverOpen = useStableCallback(() => { 6163 return isHoverOpenEvent(dataRef.current.openEvent?.type); 6164 }); 6165 const clearPointerEvents = useStableCallback(() => { 6166 clearSafePolygonPointerEventsMutation(instance); 6167 }); 6168 useIsoLayoutEffect(() => { 6169 if (!open) { 6170 instance.pointerType = void 0; 6171 instance.restTimeoutPending = false; 6172 instance.interactedInside = false; 6173 clearPointerEvents(); 6174 } 6175 }, [open, instance, clearPointerEvents]); 6176 React28.useEffect(() => { 6177 return clearPointerEvents; 6178 }, [clearPointerEvents]); 6179 useIsoLayoutEffect(() => { 6180 if (!enabled) { 6181 return void 0; 6182 } 6183 if (open && instance.handleCloseOptions?.blockPointerEvents && isHoverOpen() && isElement(domReferenceElement) && floatingElement) { 6184 const ref = domReferenceElement; 6185 const floatingEl = floatingElement; 6186 const doc = ownerDocument(floatingElement); 6187 const parentFloating = tree?.nodesRef.current.find((node) => node.id === parentId)?.context?.elements.floating; 6188 if (parentFloating) { 6189 parentFloating.style.pointerEvents = ""; 6190 } 6191 const cachedScopeElement = instance.pointerEventsScopeElement !== floatingEl ? instance.pointerEventsScopeElement : null; 6192 const parentScopeElement = parentFloating !== floatingEl ? parentFloating : null; 6193 const scopeElement = instance.handleCloseOptions?.getScope?.() ?? cachedScopeElement ?? parentScopeElement ?? ref.closest("[data-rootownerid]") ?? doc.body; 6194 applySafePolygonPointerEventsMutation(instance, { 6195 scopeElement, 6196 referenceElement: ref, 6197 floatingElement: floatingEl 6198 }); 6199 return () => { 6200 clearPointerEvents(); 6201 }; 6202 } 6203 return void 0; 6204 }, [enabled, open, domReferenceElement, floatingElement, instance, isHoverOpen, tree, parentId, clearPointerEvents]); 6205 React28.useEffect(() => { 6206 if (!enabled) { 6207 return void 0; 6208 } 6209 function hasParentChildren() { 6210 return !!(tree && parentId && getNodeChildren(tree.nodesRef.current, parentId).length > 0); 6211 } 6212 function closeWithDelay(event) { 6213 const closeDelay = getDelay(closeDelayProp, "close", instance.pointerType); 6214 const close = () => { 6215 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 6216 tree?.events.emit("floating.closed", event); 6217 }; 6218 if (closeDelay) { 6219 instance.openChangeTimeout.start(closeDelay, close); 6220 } else { 6221 instance.openChangeTimeout.clear(); 6222 close(); 6223 } 6224 } 6225 function handleInteractInside(event) { 6226 const target = getTarget(event); 6227 if (!isInteractiveElement(target)) { 6228 instance.interactedInside = false; 6229 return; 6230 } 6231 instance.interactedInside = target?.closest("[aria-haspopup]") != null; 6232 } 6233 function onFloatingMouseEnter() { 6234 instance.openChangeTimeout.clear(); 6235 childClosedTimeout.clear(); 6236 tree?.events.off("floating.closed", onNodeClosed); 6237 clearPointerEvents(); 6238 } 6239 function onFloatingMouseLeave(event) { 6240 if (hasParentChildren() && tree) { 6241 tree.events.on("floating.closed", onNodeClosed); 6242 return; 6243 } 6244 if (isTargetInsideEnabledTrigger(event.relatedTarget, store.context.triggerElements)) { 6245 return; 6246 } 6247 const currentNodeId = dataRef.current.floatingContext?.nodeId ?? nodeIdProp; 6248 const relatedTarget = event.relatedTarget; 6249 const isMovingIntoDescendantFloating = tree && currentNodeId && isElement(relatedTarget) && getNodeChildren(tree.nodesRef.current, currentNodeId, false).some((node) => contains(node.context?.elements.floating, relatedTarget)); 6250 if (isMovingIntoDescendantFloating) { 6251 return; 6252 } 6253 if (instance.handler) { 6254 instance.handler(event); 6255 return; 6256 } 6257 clearPointerEvents(); 6258 if (isHoverOpen() && !isClickLikeOpenEvent2()) { 6259 closeWithDelay(event); 6260 } 6261 } 6262 function onNodeClosed(event) { 6263 if (!tree || !parentId || hasParentChildren()) { 6264 return; 6265 } 6266 childClosedTimeout.start(0, () => { 6267 tree.events.off("floating.closed", onNodeClosed); 6268 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 6269 tree.events.emit("floating.closed", event); 6270 }); 6271 } 6272 const floating = floatingElement; 6273 return mergeCleanups(floating && addEventListener(floating, "mouseenter", onFloatingMouseEnter), floating && addEventListener(floating, "mouseleave", onFloatingMouseLeave), floating && addEventListener(floating, "pointerdown", handleInteractInside, true), () => { 6274 tree?.events.off("floating.closed", onNodeClosed); 6275 }); 6276 }, [enabled, floatingElement, store, dataRef, closeDelayProp, nodeIdProp, isHoverOpen, isClickLikeOpenEvent2, clearPointerEvents, instance, tree, parentId, childClosedTimeout]); 6277 } 6278 6279 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverReferenceInteraction.mjs 6280 var React29 = __toESM(require_react(), 1); 6281 var ReactDOM5 = __toESM(require_react_dom(), 1); 6282 var EMPTY_REF = { 6283 current: null 6284 }; 6285 function useHoverReferenceInteraction(context, props = {}) { 6286 const { 6287 enabled = true, 6288 delay = 0, 6289 handleClose = null, 6290 mouseOnly = false, 6291 restMs = 0, 6292 move = true, 6293 triggerElementRef = EMPTY_REF, 6294 externalTree, 6295 isActiveTrigger = true, 6296 getHandleCloseContext, 6297 isClosing, 6298 shouldOpen: shouldOpenProp 6299 } = props; 6300 const store = "rootStore" in context ? context.rootStore : context; 6301 const { 6302 dataRef, 6303 events 6304 } = store.context; 6305 const tree = useFloatingTree(externalTree); 6306 const instance = useHoverInteractionSharedState(store); 6307 const isHoverCloseActiveRef = React29.useRef(false); 6308 const handleCloseRef = useValueAsRef(handleClose); 6309 const delayRef = useValueAsRef(delay); 6310 const restMsRef = useValueAsRef(restMs); 6311 const enabledRef = useValueAsRef(enabled); 6312 const shouldOpenRef = useValueAsRef(shouldOpenProp); 6313 const isClosingRef = useValueAsRef(isClosing); 6314 const isClickLikeOpenEvent2 = useStableCallback(() => { 6315 return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside); 6316 }); 6317 const checkShouldOpen = useStableCallback(() => { 6318 return shouldOpenRef.current?.() !== false; 6319 }); 6320 const isOverInactiveTrigger = useStableCallback((currentDomReference, currentTarget, target) => { 6321 const allTriggers = store.context.triggerElements; 6322 if (allTriggers.hasElement(currentTarget)) { 6323 return !currentDomReference || !contains(currentDomReference, currentTarget); 6324 } 6325 if (!isElement(target)) { 6326 return false; 6327 } 6328 const targetElement = target; 6329 return allTriggers.hasMatchingElement((trigger) => contains(trigger, targetElement)) && (!currentDomReference || !contains(currentDomReference, targetElement)); 6330 }); 6331 const cleanupMouseMoveHandler = useStableCallback(() => { 6332 if (!instance.handler) { 6333 return; 6334 } 6335 const doc = ownerDocument(store.select("domReferenceElement")); 6336 doc.removeEventListener("mousemove", instance.handler); 6337 instance.handler = void 0; 6338 }); 6339 const clearPointerEvents = useStableCallback(() => { 6340 clearSafePolygonPointerEventsMutation(instance); 6341 }); 6342 if (isActiveTrigger) { 6343 instance.handleCloseOptions = handleCloseRef.current?.__options; 6344 } 6345 React29.useEffect(() => cleanupMouseMoveHandler, [cleanupMouseMoveHandler]); 6346 React29.useEffect(() => { 6347 if (!enabled) { 6348 return void 0; 6349 } 6350 function onOpenChangeLocal(details) { 6351 if (!details.open) { 6352 isHoverCloseActiveRef.current = details.reason === reason_parts_exports.triggerHover; 6353 cleanupMouseMoveHandler(); 6354 instance.openChangeTimeout.clear(); 6355 instance.restTimeout.clear(); 6356 instance.blockMouseMove = true; 6357 instance.restTimeoutPending = false; 6358 } else { 6359 isHoverCloseActiveRef.current = false; 6360 } 6361 } 6362 events.on("openchange", onOpenChangeLocal); 6363 return () => { 6364 events.off("openchange", onOpenChangeLocal); 6365 }; 6366 }, [enabled, events, instance, cleanupMouseMoveHandler]); 6367 React29.useEffect(() => { 6368 if (!enabled) { 6369 return void 0; 6370 } 6371 function closeWithDelay(event, runElseBranch = true) { 6372 const closeDelay = getDelay(delayRef.current, "close", instance.pointerType); 6373 if (closeDelay) { 6374 instance.openChangeTimeout.start(closeDelay, () => { 6375 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 6376 tree?.events.emit("floating.closed", event); 6377 }); 6378 } else if (runElseBranch) { 6379 instance.openChangeTimeout.clear(); 6380 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 6381 tree?.events.emit("floating.closed", event); 6382 } 6383 } 6384 const trigger = triggerElementRef.current ?? (isActiveTrigger ? store.select("domReferenceElement") : null); 6385 if (!isElement(trigger)) { 6386 return void 0; 6387 } 6388 function onMouseEnter(event) { 6389 instance.openChangeTimeout.clear(); 6390 instance.blockMouseMove = false; 6391 if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) { 6392 return; 6393 } 6394 const restMsValue = getRestMs(restMsRef.current); 6395 const openDelay = getDelay(delayRef.current, "open", instance.pointerType); 6396 const eventTarget = getTarget(event); 6397 const currentTarget = event.currentTarget ?? null; 6398 const currentDomReference = store.select("domReferenceElement"); 6399 let triggerNode = currentTarget; 6400 if (isElement(eventTarget) && !store.context.triggerElements.hasElement(eventTarget)) { 6401 for (const triggerElement of store.context.triggerElements.elements()) { 6402 if (contains(triggerElement, eventTarget)) { 6403 triggerNode = triggerElement; 6404 break; 6405 } 6406 } 6407 } 6408 if (isElement(currentTarget) && isElement(currentDomReference) && !store.context.triggerElements.hasElement(currentTarget) && contains(currentTarget, currentDomReference)) { 6409 triggerNode = currentDomReference; 6410 } 6411 const isOverInactive = triggerNode == null ? false : isOverInactiveTrigger(currentDomReference, triggerNode, eventTarget); 6412 const isOpen = store.select("open"); 6413 const isInClosingTransition = isClosingRef.current?.() ?? store.select("transitionStatus") === "ending"; 6414 const isHoverCloseTransition = !isOpen && isInClosingTransition && isHoverCloseActiveRef.current; 6415 const isReenteringSameTriggerDuringCloseTransition = !isOverInactive && isElement(triggerNode) && isElement(currentDomReference) && contains(currentDomReference, triggerNode) && isHoverCloseTransition; 6416 const isRestOnlyDelay = restMsValue > 0 && !openDelay; 6417 const shouldOpenImmediately = isOverInactive && (isOpen || isHoverCloseTransition) || isReenteringSameTriggerDuringCloseTransition; 6418 const shouldOpen = !isOpen || isOverInactive; 6419 if (shouldOpenImmediately) { 6420 if (checkShouldOpen()) { 6421 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); 6422 } 6423 return; 6424 } 6425 if (isRestOnlyDelay) { 6426 return; 6427 } 6428 if (openDelay) { 6429 instance.openChangeTimeout.start(openDelay, () => { 6430 if (shouldOpen && checkShouldOpen()) { 6431 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); 6432 } 6433 }); 6434 } else if (shouldOpen) { 6435 if (checkShouldOpen()) { 6436 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); 6437 } 6438 } 6439 } 6440 function onMouseLeave(event) { 6441 if (isClickLikeOpenEvent2()) { 6442 clearPointerEvents(); 6443 return; 6444 } 6445 cleanupMouseMoveHandler(); 6446 const domReferenceElement = store.select("domReferenceElement"); 6447 const doc = ownerDocument(domReferenceElement); 6448 instance.restTimeout.clear(); 6449 instance.restTimeoutPending = false; 6450 const handleCloseContextBase = dataRef.current.floatingContext ?? getHandleCloseContext?.(); 6451 if (isTargetInsideEnabledTrigger(event.relatedTarget, store.context.triggerElements)) { 6452 return; 6453 } 6454 if (handleCloseRef.current && handleCloseContextBase) { 6455 if (!store.select("open")) { 6456 instance.openChangeTimeout.clear(); 6457 } 6458 const currentTrigger = triggerElementRef.current; 6459 instance.handler = handleCloseRef.current({ 6460 ...handleCloseContextBase, 6461 tree, 6462 x: event.clientX, 6463 y: event.clientY, 6464 onClose() { 6465 clearPointerEvents(); 6466 cleanupMouseMoveHandler(); 6467 if (enabledRef.current && !isClickLikeOpenEvent2() && currentTrigger === store.select("domReferenceElement")) { 6468 closeWithDelay(event, true); 6469 } 6470 } 6471 }); 6472 doc.addEventListener("mousemove", instance.handler); 6473 instance.handler(event); 6474 return; 6475 } 6476 const shouldClose = instance.pointerType === "touch" ? !contains(store.select("floatingElement"), event.relatedTarget) : true; 6477 if (shouldClose) { 6478 closeWithDelay(event); 6479 } 6480 } 6481 if (move) { 6482 return mergeCleanups(addEventListener(trigger, "mousemove", onMouseEnter, { 6483 once: true 6484 }), addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave)); 6485 } 6486 return mergeCleanups(addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave)); 6487 }, [cleanupMouseMoveHandler, clearPointerEvents, dataRef, delayRef, store, enabled, handleCloseRef, instance, isActiveTrigger, isOverInactiveTrigger, isClickLikeOpenEvent2, mouseOnly, move, restMsRef, triggerElementRef, tree, enabledRef, getHandleCloseContext, isClosingRef, checkShouldOpen]); 6488 return React29.useMemo(() => { 6489 if (!enabled) { 6490 return void 0; 6491 } 6492 function setPointerRef(event) { 6493 instance.pointerType = event.pointerType; 6494 } 6495 return { 6496 onPointerDown: setPointerRef, 6497 onPointerEnter: setPointerRef, 6498 onMouseMove(event) { 6499 const { 6500 nativeEvent 6501 } = event; 6502 const trigger = event.currentTarget; 6503 const currentDomReference = store.select("domReferenceElement"); 6504 const currentOpen = store.select("open"); 6505 const isOverInactive = isOverInactiveTrigger(currentDomReference, trigger, event.target); 6506 if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) { 6507 return; 6508 } 6509 if (currentOpen && isOverInactive && instance.handleCloseOptions?.blockPointerEvents) { 6510 const floatingElement = store.select("floatingElement"); 6511 if (floatingElement) { 6512 const scopeElement = instance.handleCloseOptions?.getScope?.() ?? trigger.ownerDocument.body; 6513 applySafePolygonPointerEventsMutation(instance, { 6514 scopeElement, 6515 referenceElement: trigger, 6516 floatingElement 6517 }); 6518 } 6519 } 6520 const restMsValue = getRestMs(restMsRef.current); 6521 if (currentOpen && !isOverInactive || restMsValue === 0) { 6522 return; 6523 } 6524 if (!isOverInactive && instance.restTimeoutPending && event.movementX ** 2 + event.movementY ** 2 < 2) { 6525 return; 6526 } 6527 instance.restTimeout.clear(); 6528 function handleMouseMove() { 6529 instance.restTimeoutPending = false; 6530 if (isClickLikeOpenEvent2()) { 6531 return; 6532 } 6533 const latestOpen = store.select("open"); 6534 if (!instance.blockMouseMove && (!latestOpen || isOverInactive) && checkShouldOpen()) { 6535 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, nativeEvent, trigger)); 6536 } 6537 } 6538 if (instance.pointerType === "touch") { 6539 ReactDOM5.flushSync(() => { 6540 handleMouseMove(); 6541 }); 6542 } else if (isOverInactive && currentOpen) { 6543 handleMouseMove(); 6544 } else { 6545 instance.restTimeoutPending = true; 6546 instance.restTimeout.start(restMsValue, handleMouseMove); 6547 } 6548 } 6549 }; 6550 }, [enabled, instance, isClickLikeOpenEvent2, isOverInactiveTrigger, mouseOnly, store, restMsRef, checkShouldOpen]); 6551 } 6552 6553 // node_modules/@base-ui/react/floating-ui-react/safePolygon.mjs 6554 var CURSOR_SPEED_THRESHOLD = 0.1; 6555 var CURSOR_SPEED_THRESHOLD_SQUARED = CURSOR_SPEED_THRESHOLD * CURSOR_SPEED_THRESHOLD; 6556 var POLYGON_BUFFER = 0.5; 6557 function hasIntersectingEdge(pointX, pointY, xi, yi, xj, yj) { 6558 return yi >= pointY !== yj >= pointY && pointX <= (xj - xi) * (pointY - yi) / (yj - yi) + xi; 6559 } 6560 function isPointInQuadrilateral(pointX, pointY, x1, y1, x2, y2, x3, y3, x4, y4) { 6561 let isInsideValue = false; 6562 if (hasIntersectingEdge(pointX, pointY, x1, y1, x2, y2)) { 6563 isInsideValue = !isInsideValue; 6564 } 6565 if (hasIntersectingEdge(pointX, pointY, x2, y2, x3, y3)) { 6566 isInsideValue = !isInsideValue; 6567 } 6568 if (hasIntersectingEdge(pointX, pointY, x3, y3, x4, y4)) { 6569 isInsideValue = !isInsideValue; 6570 } 6571 if (hasIntersectingEdge(pointX, pointY, x4, y4, x1, y1)) { 6572 isInsideValue = !isInsideValue; 6573 } 6574 return isInsideValue; 6575 } 6576 function isInsideRect(pointX, pointY, rect) { 6577 return pointX >= rect.x && pointX <= rect.x + rect.width && pointY >= rect.y && pointY <= rect.y + rect.height; 6578 } 6579 function isInsideAxisAlignedRect(pointX, pointY, x1, y1, x2, y2) { 6580 const minX = Math.min(x1, x2); 6581 const maxX = Math.max(x1, x2); 6582 const minY = Math.min(y1, y2); 6583 const maxY = Math.max(y1, y2); 6584 return pointX >= minX && pointX <= maxX && pointY >= minY && pointY <= maxY; 6585 } 6586 function safePolygon(options = {}) { 6587 const { 6588 blockPointerEvents = false 6589 } = options; 6590 const timeout = new Timeout(); 6591 const fn = ({ 6592 x: x2, 6593 y: y2, 6594 placement, 6595 elements: elements2, 6596 onClose, 6597 nodeId, 6598 tree 6599 }) => { 6600 const side = placement?.split("-")[0]; 6601 let hasLanded = false; 6602 let lastX = null; 6603 let lastY = null; 6604 let lastCursorTime = typeof performance !== "undefined" ? performance.now() : 0; 6605 function isCursorMovingSlowly(nextX, nextY) { 6606 const currentTime = performance.now(); 6607 const elapsedTime = currentTime - lastCursorTime; 6608 if (lastX === null || lastY === null || elapsedTime === 0) { 6609 lastX = nextX; 6610 lastY = nextY; 6611 lastCursorTime = currentTime; 6612 return false; 6613 } 6614 const deltaX = nextX - lastX; 6615 const deltaY = nextY - lastY; 6616 const distanceSquared = deltaX * deltaX + deltaY * deltaY; 6617 const thresholdSquared = elapsedTime * elapsedTime * CURSOR_SPEED_THRESHOLD_SQUARED; 6618 lastX = nextX; 6619 lastY = nextY; 6620 lastCursorTime = currentTime; 6621 return distanceSquared < thresholdSquared; 6622 } 6623 function close() { 6624 timeout.clear(); 6625 onClose(); 6626 } 6627 return function onMouseMove(event) { 6628 timeout.clear(); 6629 const domReference = elements2.domReference; 6630 const floating = elements2.floating; 6631 if (!domReference || !floating || side == null || x2 == null || y2 == null) { 6632 return void 0; 6633 } 6634 const { 6635 clientX, 6636 clientY 6637 } = event; 6638 const target = getTarget(event); 6639 const isLeave = event.type === "mouseleave"; 6640 const isOverFloatingEl = contains(floating, target); 6641 const isOverReferenceEl = contains(domReference, target); 6642 if (isOverFloatingEl) { 6643 hasLanded = true; 6644 if (!isLeave) { 6645 return void 0; 6646 } 6647 } 6648 if (isOverReferenceEl) { 6649 hasLanded = false; 6650 if (!isLeave) { 6651 hasLanded = true; 6652 return void 0; 6653 } 6654 } 6655 if (isLeave && isElement(event.relatedTarget) && contains(floating, event.relatedTarget)) { 6656 return void 0; 6657 } 6658 function hasOpenChildNode() { 6659 return Boolean(tree && getNodeChildren(tree.nodesRef.current, nodeId).length > 0); 6660 } 6661 function closeIfNoOpenChild() { 6662 if (!hasOpenChildNode()) { 6663 close(); 6664 } 6665 } 6666 if (hasOpenChildNode()) { 6667 return void 0; 6668 } 6669 const refRect = domReference.getBoundingClientRect(); 6670 const rect = floating.getBoundingClientRect(); 6671 const cursorLeaveFromRight = x2 > rect.right - rect.width / 2; 6672 const cursorLeaveFromBottom = y2 > rect.bottom - rect.height / 2; 6673 const isFloatingWider = rect.width > refRect.width; 6674 const isFloatingTaller = rect.height > refRect.height; 6675 const left = (isFloatingWider ? refRect : rect).left; 6676 const right = (isFloatingWider ? refRect : rect).right; 6677 const top = (isFloatingTaller ? refRect : rect).top; 6678 const bottom = (isFloatingTaller ? refRect : rect).bottom; 6679 if (side === "top" && y2 >= refRect.bottom - 1 || side === "bottom" && y2 <= refRect.top + 1 || side === "left" && x2 >= refRect.right - 1 || side === "right" && x2 <= refRect.left + 1) { 6680 closeIfNoOpenChild(); 6681 return void 0; 6682 } 6683 let isInsideTroughRect = false; 6684 switch (side) { 6685 case "top": 6686 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, refRect.top + 1, right, rect.bottom - 1); 6687 break; 6688 case "bottom": 6689 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, rect.top + 1, right, refRect.bottom - 1); 6690 break; 6691 case "left": 6692 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, rect.right - 1, bottom, refRect.left + 1, top); 6693 break; 6694 case "right": 6695 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, refRect.right - 1, bottom, rect.left + 1, top); 6696 break; 6697 default: 6698 } 6699 if (isInsideTroughRect) { 6700 return void 0; 6701 } 6702 if (hasLanded && !isInsideRect(clientX, clientY, refRect)) { 6703 closeIfNoOpenChild(); 6704 return void 0; 6705 } 6706 if (!isLeave && isCursorMovingSlowly(clientX, clientY)) { 6707 closeIfNoOpenChild(); 6708 return void 0; 6709 } 6710 let isInsidePolygon = false; 6711 switch (side) { 6712 case "top": { 6713 const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 6714 const cursorPointOneX = isFloatingWider ? x2 + cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset; 6715 const cursorPointTwoX = isFloatingWider ? x2 - cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset; 6716 const cursorPointY = y2 + POLYGON_BUFFER + 1; 6717 const commonYLeft = cursorLeaveFromRight ? rect.bottom - POLYGON_BUFFER : isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top; 6718 const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top : rect.bottom - POLYGON_BUFFER; 6719 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight); 6720 break; 6721 } 6722 case "bottom": { 6723 const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 6724 const cursorPointOneX = isFloatingWider ? x2 + cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset; 6725 const cursorPointTwoX = isFloatingWider ? x2 - cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset; 6726 const cursorPointY = y2 - POLYGON_BUFFER; 6727 const commonYLeft = cursorLeaveFromRight ? rect.top + POLYGON_BUFFER : isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom; 6728 const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom : rect.top + POLYGON_BUFFER; 6729 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight); 6730 break; 6731 } 6732 case "left": { 6733 const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 6734 const cursorPointOneY = isFloatingTaller ? y2 + cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset; 6735 const cursorPointTwoY = isFloatingTaller ? y2 - cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset; 6736 const cursorPointX = x2 + POLYGON_BUFFER + 1; 6737 const commonXTop = cursorLeaveFromBottom ? rect.right - POLYGON_BUFFER : isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left; 6738 const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left : rect.right - POLYGON_BUFFER; 6739 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, commonXTop, rect.top, commonXBottom, rect.bottom, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY); 6740 break; 6741 } 6742 case "right": { 6743 const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 6744 const cursorPointOneY = isFloatingTaller ? y2 + cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset; 6745 const cursorPointTwoY = isFloatingTaller ? y2 - cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset; 6746 const cursorPointX = x2 - POLYGON_BUFFER; 6747 const commonXTop = cursorLeaveFromBottom ? rect.left + POLYGON_BUFFER : isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right; 6748 const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right : rect.left + POLYGON_BUFFER; 6749 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY, commonXTop, rect.top, commonXBottom, rect.bottom); 6750 break; 6751 } 6752 default: 6753 } 6754 if (!isInsidePolygon) { 6755 closeIfNoOpenChild(); 6756 } else if (!hasLanded) { 6757 timeout.start(40, closeIfNoOpenChild); 6758 } 6759 return void 0; 6760 }; 6761 }; 6762 fn.__options = { 6763 ...options, 6764 blockPointerEvents 6765 }; 6766 return fn; 6767 } 6768 6769 // node_modules/@base-ui/react/utils/popupStateMapping.mjs 6770 var CommonPopupDataAttributes = (function(CommonPopupDataAttributes2) { 6771 CommonPopupDataAttributes2["open"] = "data-open"; 6772 CommonPopupDataAttributes2["closed"] = "data-closed"; 6773 CommonPopupDataAttributes2[CommonPopupDataAttributes2["startingStyle"] = TransitionStatusDataAttributes.startingStyle] = "startingStyle"; 6774 CommonPopupDataAttributes2[CommonPopupDataAttributes2["endingStyle"] = TransitionStatusDataAttributes.endingStyle] = "endingStyle"; 6775 CommonPopupDataAttributes2["anchorHidden"] = "data-anchor-hidden"; 6776 CommonPopupDataAttributes2["side"] = "data-side"; 6777 CommonPopupDataAttributes2["align"] = "data-align"; 6778 return CommonPopupDataAttributes2; 6779 })({}); 6780 var CommonTriggerDataAttributes = /* @__PURE__ */ (function(CommonTriggerDataAttributes2) { 6781 CommonTriggerDataAttributes2["popupOpen"] = "data-popup-open"; 6782 CommonTriggerDataAttributes2["pressed"] = "data-pressed"; 6783 return CommonTriggerDataAttributes2; 6784 })({}); 6785 var TRIGGER_HOOK = { 6786 [CommonTriggerDataAttributes.popupOpen]: "" 6787 }; 6788 var PRESSABLE_TRIGGER_HOOK = { 6789 [CommonTriggerDataAttributes.popupOpen]: "", 6790 [CommonTriggerDataAttributes.pressed]: "" 6791 }; 6792 var POPUP_OPEN_HOOK = { 6793 [CommonPopupDataAttributes.open]: "" 6794 }; 6795 var POPUP_CLOSED_HOOK = { 6796 [CommonPopupDataAttributes.closed]: "" 6797 }; 6798 var ANCHOR_HIDDEN_HOOK = { 6799 [CommonPopupDataAttributes.anchorHidden]: "" 6800 }; 6801 var triggerOpenStateMapping = { 6802 open(value) { 6803 if (value) { 6804 return TRIGGER_HOOK; 6805 } 6806 return null; 6807 } 6808 }; 6809 var popupStateMapping = { 6810 open(value) { 6811 if (value) { 6812 return POPUP_OPEN_HOOK; 6813 } 6814 return POPUP_CLOSED_HOOK; 6815 }, 6816 anchorHidden(value) { 6817 if (value) { 6818 return ANCHOR_HIDDEN_HOOK; 6819 } 6820 return null; 6821 } 6822 }; 6823 6824 // node_modules/@base-ui/utils/inertValue.mjs 6825 function inertValue(value) { 6826 if (isReactVersionAtLeast(19)) { 6827 return value; 6828 } 6829 return value ? "true" : void 0; 6830 } 6831 6832 // node_modules/@base-ui/react/utils/useAnchorPositioning.mjs 6833 var React30 = __toESM(require_react(), 1); 6834 6835 // node_modules/@base-ui/react/floating-ui-react/middleware/arrow.mjs 6836 var baseArrow = (options) => ({ 6837 name: "arrow", 6838 options, 6839 async fn(state) { 6840 const { 6841 x: x2, 6842 y: y2, 6843 placement, 6844 rects, 6845 platform: platform3, 6846 elements: elements2, 6847 middlewareData 6848 } = state; 6849 const { 6850 element, 6851 padding = 0, 6852 offsetParent = "real" 6853 } = evaluate(options, state) || {}; 6854 if (element == null) { 6855 return {}; 6856 } 6857 const paddingObject = getPaddingObject(padding); 6858 const coords = { 6859 x: x2, 6860 y: y2 6861 }; 6862 const axis = getAlignmentAxis(placement); 6863 const length = getAxisLength(axis); 6864 const arrowDimensions = await platform3.getDimensions(element); 6865 const isYAxis = axis === "y"; 6866 const minProp = isYAxis ? "top" : "left"; 6867 const maxProp = isYAxis ? "bottom" : "right"; 6868 const clientProp = isYAxis ? "clientHeight" : "clientWidth"; 6869 const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length]; 6870 const startDiff = coords[axis] - rects.reference[axis]; 6871 const arrowOffsetParent = offsetParent === "real" ? await platform3.getOffsetParent?.(element) : elements2.floating; 6872 let clientSize = elements2.floating[clientProp] || rects.floating[length]; 6873 if (!clientSize || !await platform3.isElement?.(arrowOffsetParent)) { 6874 clientSize = elements2.floating[clientProp] || rects.floating[length]; 6875 } 6876 const centerToReference = endDiff / 2 - startDiff / 2; 6877 const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1; 6878 const minPadding = Math.min(paddingObject[minProp], largestPossiblePadding); 6879 const maxPadding = Math.min(paddingObject[maxProp], largestPossiblePadding); 6880 const min2 = minPadding; 6881 const max2 = clientSize - arrowDimensions[length] - maxPadding; 6882 const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference; 6883 const offset4 = clamp(min2, center, max2); 6884 const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset4 && rects.reference[length] / 2 - (center < min2 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0; 6885 const alignmentOffset = shouldAddOffset ? center < min2 ? center - min2 : center - max2 : 0; 6886 return { 6887 [axis]: coords[axis] + alignmentOffset, 6888 data: { 6889 [axis]: offset4, 6890 centerOffset: center - offset4 - alignmentOffset, 6891 ...shouldAddOffset && { 6892 alignmentOffset 6893 } 6894 }, 6895 reset: shouldAddOffset 6896 }; 6897 } 6898 }); 6899 var arrow4 = (options, deps) => ({ 6900 ...baseArrow(options), 6901 options: [options, deps] 6902 }); 6903 6904 // node_modules/@base-ui/react/utils/hideMiddleware.mjs 6905 var nativeHideFn = hide3().fn; 6906 var hide4 = { 6907 name: "hide", 6908 async fn(state) { 6909 const { 6910 width, 6911 height, 6912 x: x2, 6913 y: y2 6914 } = state.rects.reference; 6915 const anchorHidden = width === 0 && height === 0 && x2 === 0 && y2 === 0; 6916 const nativeHideResult = await nativeHideFn(state); 6917 return { 6918 data: { 6919 referenceHidden: nativeHideResult.data?.referenceHidden || anchorHidden 6920 } 6921 }; 6922 } 6923 }; 6924 6925 // node_modules/@base-ui/react/utils/adaptiveOriginMiddleware.mjs 6926 var DEFAULT_SIDES = { 6927 sideX: "left", 6928 sideY: "top" 6929 }; 6930 var adaptiveOrigin = { 6931 name: "adaptiveOrigin", 6932 async fn(state) { 6933 const { 6934 x: rawX, 6935 y: rawY, 6936 rects: { 6937 floating: floatRect 6938 }, 6939 elements: { 6940 floating 6941 }, 6942 platform: platform3, 6943 strategy, 6944 placement 6945 } = state; 6946 const win = getWindow(floating); 6947 const styles = win.getComputedStyle(floating); 6948 const hasTransition = styles.transitionDuration !== "0s" && styles.transitionDuration !== ""; 6949 if (!hasTransition) { 6950 return { 6951 x: rawX, 6952 y: rawY, 6953 data: DEFAULT_SIDES 6954 }; 6955 } 6956 const offsetParent = await platform3.getOffsetParent?.(floating); 6957 let offsetDimensions = { 6958 width: 0, 6959 height: 0 6960 }; 6961 if (strategy === "fixed" && win?.visualViewport) { 6962 offsetDimensions = { 6963 width: win.visualViewport.width, 6964 height: win.visualViewport.height 6965 }; 6966 } else if (offsetParent === win) { 6967 const doc = ownerDocument(floating); 6968 offsetDimensions = { 6969 width: doc.documentElement.clientWidth, 6970 height: doc.documentElement.clientHeight 6971 }; 6972 } else if (await platform3.isElement?.(offsetParent)) { 6973 offsetDimensions = await platform3.getDimensions(offsetParent); 6974 } 6975 const currentSide = getSide(placement); 6976 let x2 = rawX; 6977 let y2 = rawY; 6978 if (currentSide === "left") { 6979 x2 = offsetDimensions.width - (rawX + floatRect.width); 6980 } 6981 if (currentSide === "top") { 6982 y2 = offsetDimensions.height - (rawY + floatRect.height); 6983 } 6984 const sideX = currentSide === "left" ? "right" : DEFAULT_SIDES.sideX; 6985 const sideY = currentSide === "top" ? "bottom" : DEFAULT_SIDES.sideY; 6986 return { 6987 x: x2, 6988 y: y2, 6989 data: { 6990 sideX, 6991 sideY 6992 } 6993 }; 6994 } 6995 }; 6996 6997 // node_modules/@base-ui/react/utils/useAnchorPositioning.mjs 6998 function getLogicalSide(sideParam, renderedSide, isRtl) { 6999 const isLogicalSideParam = sideParam === "inline-start" || sideParam === "inline-end"; 7000 const logicalRight = isRtl ? "inline-start" : "inline-end"; 7001 const logicalLeft = isRtl ? "inline-end" : "inline-start"; 7002 return { 7003 top: "top", 7004 right: isLogicalSideParam ? logicalRight : "right", 7005 bottom: "bottom", 7006 left: isLogicalSideParam ? logicalLeft : "left" 7007 }[renderedSide]; 7008 } 7009 function getOffsetData(state, sideParam, isRtl) { 7010 const { 7011 rects, 7012 placement 7013 } = state; 7014 const data = { 7015 side: getLogicalSide(sideParam, getSide(placement), isRtl), 7016 align: getAlignment(placement) || "center", 7017 anchor: { 7018 width: rects.reference.width, 7019 height: rects.reference.height 7020 }, 7021 positioner: { 7022 width: rects.floating.width, 7023 height: rects.floating.height 7024 } 7025 }; 7026 return data; 7027 } 7028 function useAnchorPositioning(params) { 7029 const { 7030 // Public parameters 7031 anchor, 7032 positionMethod = "absolute", 7033 side: sideParam = "bottom", 7034 sideOffset = 0, 7035 align = "center", 7036 alignOffset = 0, 7037 collisionBoundary, 7038 collisionPadding: collisionPaddingParam = 5, 7039 sticky = false, 7040 arrowPadding = 5, 7041 disableAnchorTracking = false, 7042 inline: inlineMiddleware, 7043 // Private parameters 7044 keepMounted = false, 7045 floatingRootContext, 7046 mounted, 7047 collisionAvoidance, 7048 shiftCrossAxis = false, 7049 nodeId, 7050 adaptiveOrigin: adaptiveOrigin2, 7051 lazyFlip = false, 7052 externalTree 7053 } = params; 7054 const [mountSide, setMountSide] = React30.useState(null); 7055 if (!mounted && mountSide !== null) { 7056 setMountSide(null); 7057 } 7058 const collisionAvoidanceSide = collisionAvoidance.side || "flip"; 7059 const collisionAvoidanceAlign = collisionAvoidance.align || "flip"; 7060 const collisionAvoidanceFallbackAxisSide = collisionAvoidance.fallbackAxisSide || "end"; 7061 const anchorFn = typeof anchor === "function" ? anchor : void 0; 7062 const anchorFnCallback = useStableCallback(anchorFn); 7063 const anchorDep = anchorFn ? anchorFnCallback : anchor; 7064 const anchorValueRef = useValueAsRef(anchor); 7065 const mountedRef = useValueAsRef(mounted); 7066 const direction = useDirection(); 7067 const isRtl = direction === "rtl"; 7068 const side = mountSide || { 7069 top: "top", 7070 right: "right", 7071 bottom: "bottom", 7072 left: "left", 7073 "inline-end": isRtl ? "left" : "right", 7074 "inline-start": isRtl ? "right" : "left" 7075 }[sideParam]; 7076 const placement = align === "center" ? side : `$side}-$align}`; 7077 let collisionPadding = collisionPaddingParam; 7078 const bias = 1; 7079 const biasTop = sideParam === "bottom" ? bias : 0; 7080 const biasBottom = sideParam === "top" ? bias : 0; 7081 const biasLeft = sideParam === "right" ? bias : 0; 7082 const biasRight = sideParam === "left" ? bias : 0; 7083 if (typeof collisionPadding === "number") { 7084 collisionPadding = { 7085 top: collisionPadding + biasTop, 7086 right: collisionPadding + biasRight, 7087 bottom: collisionPadding + biasBottom, 7088 left: collisionPadding + biasLeft 7089 }; 7090 } else if (collisionPadding) { 7091 collisionPadding = { 7092 top: (collisionPadding.top || 0) + biasTop, 7093 right: (collisionPadding.right || 0) + biasRight, 7094 bottom: (collisionPadding.bottom || 0) + biasBottom, 7095 left: (collisionPadding.left || 0) + biasLeft 7096 }; 7097 } 7098 const commonCollisionProps = { 7099 boundary: collisionBoundary === "clipping-ancestors" ? "clippingAncestors" : collisionBoundary, 7100 padding: collisionPadding 7101 }; 7102 const arrowRef = React30.useRef(null); 7103 const sideOffsetRef = useValueAsRef(sideOffset); 7104 const alignOffsetRef = useValueAsRef(alignOffset); 7105 const sideOffsetDep = typeof sideOffset !== "function" ? sideOffset : 0; 7106 const alignOffsetDep = typeof alignOffset !== "function" ? alignOffset : 0; 7107 const middleware = []; 7108 if (inlineMiddleware) { 7109 middleware.push(inlineMiddleware); 7110 } 7111 middleware.push(offset3((state) => { 7112 const data = getOffsetData(state, sideParam, isRtl); 7113 const sideAxis = typeof sideOffsetRef.current === "function" ? sideOffsetRef.current(data) : sideOffsetRef.current; 7114 const alignAxis = typeof alignOffsetRef.current === "function" ? alignOffsetRef.current(data) : alignOffsetRef.current; 7115 return { 7116 mainAxis: sideAxis, 7117 crossAxis: alignAxis, 7118 alignmentAxis: alignAxis 7119 }; 7120 }, [sideOffsetDep, alignOffsetDep, isRtl, sideParam])); 7121 const shiftDisabled = collisionAvoidanceAlign === "none" && collisionAvoidanceSide !== "shift"; 7122 const crossAxisShiftEnabled = !shiftDisabled && (sticky || shiftCrossAxis || collisionAvoidanceSide === "shift"); 7123 const flipMiddleware = collisionAvoidanceSide === "none" ? null : flip3({ 7124 ...commonCollisionProps, 7125 // Ensure the popup flips if it's been limited by its --available-height and it resizes. 7126 // Since the size() padding is smaller than the flip() padding, flip() will take precedence. 7127 padding: { 7128 top: collisionPadding.top + bias, 7129 right: collisionPadding.right + bias, 7130 bottom: collisionPadding.bottom + bias, 7131 left: collisionPadding.left + bias 7132 }, 7133 mainAxis: !shiftCrossAxis && collisionAvoidanceSide === "flip", 7134 crossAxis: collisionAvoidanceAlign === "flip" ? "alignment" : false, 7135 fallbackAxisSideDirection: collisionAvoidanceFallbackAxisSide 7136 }); 7137 const shiftMiddleware = shiftDisabled ? null : shift3((data) => { 7138 const html = ownerDocument(data.elements.floating).documentElement; 7139 return { 7140 ...commonCollisionProps, 7141 // Use the Layout Viewport to avoid shifting around when pinch-zooming 7142 // for context menus. 7143 rootBoundary: shiftCrossAxis ? { 7144 x: 0, 7145 y: 0, 7146 width: html.clientWidth, 7147 height: html.clientHeight 7148 } : void 0, 7149 mainAxis: collisionAvoidanceAlign !== "none", 7150 crossAxis: crossAxisShiftEnabled, 7151 limiter: sticky || shiftCrossAxis ? void 0 : limitShift3((limitData) => { 7152 if (!arrowRef.current) { 7153 return {}; 7154 } 7155 const { 7156 width, 7157 height 7158 } = arrowRef.current.getBoundingClientRect(); 7159 const sideAxis = getSideAxis(getSide(limitData.placement)); 7160 const arrowSize = sideAxis === "y" ? width : height; 7161 const offsetAmount = sideAxis === "y" ? collisionPadding.left + collisionPadding.right : collisionPadding.top + collisionPadding.bottom; 7162 return { 7163 offset: arrowSize / 2 + offsetAmount / 2 7164 }; 7165 }) 7166 }; 7167 }, [commonCollisionProps, sticky, shiftCrossAxis, collisionPadding, collisionAvoidanceAlign]); 7168 if (collisionAvoidanceSide === "shift" || collisionAvoidanceAlign === "shift" || align === "center") { 7169 middleware.push(shiftMiddleware, flipMiddleware); 7170 } else { 7171 middleware.push(flipMiddleware, shiftMiddleware); 7172 } 7173 middleware.push(size3({ 7174 ...commonCollisionProps, 7175 apply({ 7176 elements: { 7177 floating 7178 }, 7179 availableWidth, 7180 availableHeight, 7181 rects 7182 }) { 7183 if (!mountedRef.current) { 7184 return; 7185 } 7186 const floatingStyle = floating.style; 7187 floatingStyle.setProperty("--available-width", `$availableWidth}px`); 7188 floatingStyle.setProperty("--available-height", `$availableHeight}px`); 7189 const dpr = getWindow(floating).devicePixelRatio || 1; 7190 const { 7191 x: x3, 7192 y: y3, 7193 width, 7194 height 7195 } = rects.reference; 7196 const anchorWidth = (Math.round((x3 + width) * dpr) - Math.round(x3 * dpr)) / dpr; 7197 const anchorHeight = (Math.round((y3 + height) * dpr) - Math.round(y3 * dpr)) / dpr; 7198 floatingStyle.setProperty("--anchor-width", `$anchorWidth}px`); 7199 floatingStyle.setProperty("--anchor-height", `$anchorHeight}px`); 7200 } 7201 }), arrow4((state) => ({ 7202 // `transform-origin` calculations rely on an element existing. If the arrow hasn't been set, 7203 // we'll create a fake element. 7204 element: arrowRef.current || ownerDocument(state.elements.floating).createElement("div"), 7205 padding: arrowPadding, 7206 offsetParent: "floating" 7207 }), [arrowPadding]), { 7208 name: "transformOrigin", 7209 fn(state) { 7210 const { 7211 elements: elements3, 7212 middlewareData: middlewareData2, 7213 placement: renderedPlacement2, 7214 rects, 7215 y: y3 7216 } = state; 7217 const currentRenderedSide = getSide(renderedPlacement2); 7218 const currentRenderedAxis = getSideAxis(currentRenderedSide); 7219 const arrowEl = arrowRef.current; 7220 const arrowX = middlewareData2.arrow?.x || 0; 7221 const arrowY = middlewareData2.arrow?.y || 0; 7222 const arrowWidth = arrowEl?.clientWidth || 0; 7223 const arrowHeight = arrowEl?.clientHeight || 0; 7224 const transformX = arrowX + arrowWidth / 2; 7225 const transformY = arrowY + arrowHeight / 2; 7226 const shiftY = Math.abs(middlewareData2.shift?.y || 0); 7227 const halfAnchorHeight = rects.reference.height / 2; 7228 const sideOffsetValue = typeof sideOffset === "function" ? sideOffset(getOffsetData(state, sideParam, isRtl)) : sideOffset; 7229 const isOverlappingAnchor = shiftY > sideOffsetValue; 7230 const adjacentTransformOrigin = { 7231 top: `$transformX}px calc(100% + $sideOffsetValue}px)`, 7232 bottom: `$transformX}px ${-sideOffsetValue}px`, 7233 left: `calc(100% + $sideOffsetValue}px) $transformY}px`, 7234 right: `${-sideOffsetValue}px $transformY}px` 7235 }[currentRenderedSide]; 7236 const overlapTransformOrigin = `$transformX}px $rects.reference.y + halfAnchorHeight - y3}px`; 7237 elements3.floating.style.setProperty("--transform-origin", crossAxisShiftEnabled && currentRenderedAxis === "y" && isOverlappingAnchor ? overlapTransformOrigin : adjacentTransformOrigin); 7238 return {}; 7239 } 7240 }, hide4, adaptiveOrigin2); 7241 useIsoLayoutEffect(() => { 7242 if (!mounted && floatingRootContext) { 7243 floatingRootContext.update({ 7244 referenceElement: null, 7245 floatingElement: null, 7246 domReferenceElement: null, 7247 positionReference: null 7248 }); 7249 } 7250 }, [mounted, floatingRootContext]); 7251 const autoUpdateOptions = React30.useMemo(() => ({ 7252 elementResize: !disableAnchorTracking && typeof ResizeObserver !== "undefined", 7253 layoutShift: !disableAnchorTracking && typeof IntersectionObserver !== "undefined" 7254 }), [disableAnchorTracking]); 7255 const { 7256 refs, 7257 elements: elements2, 7258 x: x2, 7259 y: y2, 7260 middlewareData, 7261 update: update2, 7262 placement: renderedPlacement, 7263 context, 7264 isPositioned, 7265 floatingStyles: originalFloatingStyles 7266 } = useFloating2({ 7267 rootContext: floatingRootContext, 7268 open: keepMounted ? mounted : void 0, 7269 placement, 7270 middleware, 7271 strategy: positionMethod, 7272 whileElementsMounted: keepMounted ? void 0 : (...args) => autoUpdate(...args, autoUpdateOptions), 7273 nodeId, 7274 externalTree 7275 }); 7276 const { 7277 sideX, 7278 sideY 7279 } = middlewareData.adaptiveOrigin || DEFAULT_SIDES; 7280 const resolvedPosition = isPositioned ? positionMethod : "fixed"; 7281 const floatingStyles = React30.useMemo(() => { 7282 const base = adaptiveOrigin2 ? { 7283 position: resolvedPosition, 7284 [sideX]: x2, 7285 [sideY]: y2 7286 } : { 7287 position: resolvedPosition, 7288 ...originalFloatingStyles 7289 }; 7290 if (!isPositioned) { 7291 base.opacity = 0; 7292 } 7293 return base; 7294 }, [adaptiveOrigin2, resolvedPosition, sideX, x2, sideY, y2, originalFloatingStyles, isPositioned]); 7295 const registeredPositionReferenceRef = React30.useRef(null); 7296 useIsoLayoutEffect(() => { 7297 if (!mounted) { 7298 return; 7299 } 7300 const anchorValue = anchorValueRef.current; 7301 const resolvedAnchor = typeof anchorValue === "function" ? anchorValue() : anchorValue; 7302 const unwrappedElement = (isRef(resolvedAnchor) ? resolvedAnchor.current : resolvedAnchor) || null; 7303 const finalAnchor = unwrappedElement || null; 7304 if (finalAnchor !== registeredPositionReferenceRef.current) { 7305 refs.setPositionReference(finalAnchor); 7306 registeredPositionReferenceRef.current = finalAnchor; 7307 } 7308 }, [mounted, refs, anchorDep, anchorValueRef]); 7309 React30.useEffect(() => { 7310 if (!mounted) { 7311 return; 7312 } 7313 const anchorValue = anchorValueRef.current; 7314 if (typeof anchorValue === "function") { 7315 return; 7316 } 7317 if (isRef(anchorValue) && anchorValue.current !== registeredPositionReferenceRef.current) { 7318 refs.setPositionReference(anchorValue.current); 7319 registeredPositionReferenceRef.current = anchorValue.current; 7320 } 7321 }, [mounted, refs, anchorDep, anchorValueRef]); 7322 React30.useEffect(() => { 7323 if (keepMounted && mounted && elements2.reference && elements2.floating) { 7324 return autoUpdate(elements2.reference, elements2.floating, update2, autoUpdateOptions); 7325 } 7326 return void 0; 7327 }, [keepMounted, mounted, elements2, update2, autoUpdateOptions]); 7328 const renderedSide = getSide(renderedPlacement); 7329 const logicalRenderedSide = getLogicalSide(sideParam, renderedSide, isRtl); 7330 const renderedAlign = getAlignment(renderedPlacement) || "center"; 7331 const anchorHidden = Boolean(middlewareData.hide?.referenceHidden); 7332 useIsoLayoutEffect(() => { 7333 if (lazyFlip && mounted && isPositioned) { 7334 setMountSide(renderedSide); 7335 } 7336 }, [lazyFlip, mounted, isPositioned, renderedSide]); 7337 const arrowStyles = React30.useMemo(() => ({ 7338 position: "absolute", 7339 top: middlewareData.arrow?.y, 7340 left: middlewareData.arrow?.x 7341 }), [middlewareData.arrow]); 7342 const arrowUncentered = middlewareData.arrow?.centerOffset !== 0; 7343 return React30.useMemo(() => ({ 7344 positionerStyles: floatingStyles, 7345 arrowStyles, 7346 arrowRef, 7347 arrowUncentered, 7348 side: logicalRenderedSide, 7349 align: renderedAlign, 7350 physicalSide: renderedSide, 7351 anchorHidden, 7352 refs, 7353 context, 7354 isPositioned, 7355 update: update2 7356 }), [floatingStyles, arrowStyles, arrowRef, arrowUncentered, logicalRenderedSide, renderedAlign, renderedSide, anchorHidden, refs, context, isPositioned, update2]); 7357 } 7358 function isRef(param) { 7359 return param != null && "current" in param; 7360 } 7361 7362 // node_modules/@base-ui/react/utils/getDisabledMountTransitionStyles.mjs 7363 function getDisabledMountTransitionStyles(transitionStatus) { 7364 return transitionStatus === "starting" ? DISABLED_TRANSITIONS_STYLE : EMPTY_OBJECT; 7365 } 7366 7367 // node_modules/@base-ui/react/utils/usePositioner.mjs 7368 function usePositioner(componentProps, state, { 7369 styles, 7370 transitionStatus, 7371 props, 7372 refs, 7373 hidden, 7374 inert = false 7375 }) { 7376 const style = { 7377 ...styles 7378 }; 7379 if (inert) { 7380 style.pointerEvents = "none"; 7381 } 7382 return useRenderElement("div", componentProps, { 7383 state, 7384 ref: refs, 7385 props: [{ 7386 role: "presentation", 7387 hidden, 7388 style 7389 }, getDisabledMountTransitionStyles(transitionStatus), props], 7390 stateAttributesMapping: popupStateMapping 7391 }); 7392 } 7393 7394 // node_modules/@base-ui/react/utils/usePopupViewport.mjs 7395 var React33 = __toESM(require_react(), 1); 7396 var ReactDOM6 = __toESM(require_react_dom(), 1); 7397 7398 // node_modules/@base-ui/utils/usePreviousValue.mjs 7399 var React31 = __toESM(require_react(), 1); 7400 function usePreviousValue(value) { 7401 const [state, setState] = React31.useState({ 7402 current: value, 7403 previous: null 7404 }); 7405 if (value !== state.current) { 7406 setState({ 7407 current: value, 7408 previous: state.current 7409 }); 7410 } 7411 return state.previous; 7412 } 7413 7414 // node_modules/@base-ui/react/utils/usePopupAutoResize.mjs 7415 var React32 = __toESM(require_react(), 1); 7416 7417 // node_modules/@base-ui/react/utils/getCssDimensions.mjs 7418 function getCssDimensions2(element) { 7419 const css = getComputedStyle2(element); 7420 let width = parseFloat(css.width) || 0; 7421 let height = parseFloat(css.height) || 0; 7422 const hasOffset = isHTMLElement(element); 7423 const offsetWidth = hasOffset ? element.offsetWidth : width; 7424 const offsetHeight = hasOffset ? element.offsetHeight : height; 7425 const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; 7426 if (shouldFallback) { 7427 width = offsetWidth; 7428 height = offsetHeight; 7429 } 7430 return { 7431 width, 7432 height 7433 }; 7434 } 7435 7436 // node_modules/@base-ui/react/utils/usePopupAutoResize.mjs 7437 function usePopupAutoResize(parameters) { 7438 const { 7439 popupElement, 7440 positionerElement, 7441 content, 7442 mounted, 7443 onMeasureLayout: onMeasureLayoutParam, 7444 onMeasureLayoutComplete: onMeasureLayoutCompleteParam, 7445 side, 7446 direction 7447 } = parameters; 7448 const runOnceAnimationsFinish = useAnimationsFinished(popupElement, true, false); 7449 const animationFrame = useAnimationFrame(); 7450 const committedDimensionsRef = React32.useRef(null); 7451 const isInitialRenderRef = React32.useRef(true); 7452 const restoreAnchoringStylesRef = React32.useRef(NOOP); 7453 const onMeasureLayout = useStableCallback(onMeasureLayoutParam); 7454 const onMeasureLayoutComplete = useStableCallback(onMeasureLayoutCompleteParam); 7455 const anchoringStyles = React32.useMemo(() => { 7456 let isOriginSide = side === "top"; 7457 let isPhysicalLeft = side === "left"; 7458 if (direction === "rtl") { 7459 isOriginSide = isOriginSide || side === "inline-end"; 7460 isPhysicalLeft = isPhysicalLeft || side === "inline-end"; 7461 } else { 7462 isOriginSide = isOriginSide || side === "inline-start"; 7463 isPhysicalLeft = isPhysicalLeft || side === "inline-start"; 7464 } 7465 return isOriginSide ? { 7466 position: "absolute", 7467 [side === "top" ? "bottom" : "top"]: "0", 7468 [isPhysicalLeft ? "right" : "left"]: "0" 7469 } : EMPTY_OBJECT; 7470 }, [side, direction]); 7471 useIsoLayoutEffect(() => { 7472 if (!mounted) { 7473 restoreAnchoringStylesRef.current = NOOP; 7474 isInitialRenderRef.current = true; 7475 committedDimensionsRef.current = null; 7476 return void 0; 7477 } 7478 if (!popupElement || !positionerElement) { 7479 return void 0; 7480 } 7481 restoreAnchoringStylesRef.current = applyElementStyles(popupElement, anchoringStyles); 7482 setPopupCssSize(popupElement, "auto"); 7483 const restorePopupPosition = overrideElementStyle(popupElement, "position", "static"); 7484 const restorePopupTransform = overrideElementStyle(popupElement, "transform", "none"); 7485 const restorePopupScale = overrideElementStyle(popupElement, "scale", "1"); 7486 const restorePositionerAvailableSize = applyElementStyles(positionerElement, { 7487 "--available-width": "max-content", 7488 "--available-height": "max-content" 7489 }); 7490 function restoreMeasurementOverrides() { 7491 restorePopupPosition(); 7492 restorePopupTransform(); 7493 restorePositionerAvailableSize(); 7494 } 7495 function restoreMeasurementOverridesIncludingScale() { 7496 restoreMeasurementOverrides(); 7497 restorePopupScale(); 7498 } 7499 onMeasureLayout?.(); 7500 if (isInitialRenderRef.current || committedDimensionsRef.current === null) { 7501 setPositionerCssSize(positionerElement, "max-content"); 7502 const dimensions = getCssDimensions2(popupElement); 7503 committedDimensionsRef.current = dimensions; 7504 setPositionerCssSize(positionerElement, dimensions); 7505 restoreMeasurementOverridesIncludingScale(); 7506 onMeasureLayoutComplete?.(null, dimensions); 7507 isInitialRenderRef.current = false; 7508 return () => { 7509 restoreAnchoringStylesRef.current(); 7510 restoreAnchoringStylesRef.current = NOOP; 7511 }; 7512 } 7513 setPositionerCssSize(positionerElement, "max-content"); 7514 const previousDimensions = committedDimensionsRef.current; 7515 const newDimensions = getCssDimensions2(popupElement); 7516 committedDimensionsRef.current = newDimensions; 7517 setPopupCssSize(popupElement, previousDimensions); 7518 restoreMeasurementOverridesIncludingScale(); 7519 onMeasureLayoutComplete?.(previousDimensions, newDimensions); 7520 setPositionerCssSize(positionerElement, newDimensions); 7521 const abortController = new AbortController(); 7522 animationFrame.request(() => { 7523 setPopupCssSize(popupElement, newDimensions); 7524 runOnceAnimationsFinish(() => { 7525 popupElement.style.setProperty("--popup-width", "auto"); 7526 popupElement.style.setProperty("--popup-height", "auto"); 7527 }, abortController.signal); 7528 }); 7529 return () => { 7530 abortController.abort(); 7531 animationFrame.cancel(); 7532 restoreAnchoringStylesRef.current(); 7533 restoreAnchoringStylesRef.current = NOOP; 7534 }; 7535 }, [content, popupElement, positionerElement, runOnceAnimationsFinish, animationFrame, mounted, onMeasureLayout, onMeasureLayoutComplete, anchoringStyles]); 7536 } 7537 function overrideElementStyle(element, property, value) { 7538 const originalValue = element.style.getPropertyValue(property); 7539 element.style.setProperty(property, value); 7540 return () => { 7541 element.style.setProperty(property, originalValue); 7542 }; 7543 } 7544 function applyElementStyles(element, styles) { 7545 const restorers = []; 7546 for (const [key, value] of Object.entries(styles)) { 7547 restorers.push(overrideElementStyle(element, key, value)); 7548 } 7549 return restorers.length ? () => { 7550 restorers.forEach((restore) => restore()); 7551 } : NOOP; 7552 } 7553 function setPopupCssSize(popupElement, size4) { 7554 const width = size4 === "auto" ? "auto" : `$size4.width}px`; 7555 const height = size4 === "auto" ? "auto" : `$size4.height}px`; 7556 popupElement.style.setProperty("--popup-width", width); 7557 popupElement.style.setProperty("--popup-height", height); 7558 } 7559 function setPositionerCssSize(positionerElement, size4) { 7560 const width = size4 === "max-content" ? "max-content" : `$size4.width}px`; 7561 const height = size4 === "max-content" ? "max-content" : `$size4.height}px`; 7562 positionerElement.style.setProperty("--positioner-width", width); 7563 positionerElement.style.setProperty("--positioner-height", height); 7564 } 7565 7566 // node_modules/@base-ui/react/utils/usePopupViewport.mjs 7567 var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1); 7568 function usePopupViewport(parameters) { 7569 const { 7570 store, 7571 side, 7572 cssVars, 7573 children 7574 } = parameters; 7575 const direction = useDirection(); 7576 const activeTrigger = store.useState("activeTriggerElement"); 7577 const activeTriggerId = store.useState("activeTriggerId"); 7578 const open = store.useState("open"); 7579 const payload = store.useState("payload"); 7580 const mounted = store.useState("mounted"); 7581 const popupElement = store.useState("popupElement"); 7582 const positionerElement = store.useState("positionerElement"); 7583 const previousActiveTrigger = usePreviousValue(open ? activeTrigger : null); 7584 const currentContentKey = usePopupContentKey(activeTriggerId, payload); 7585 const capturedNodeRef = React33.useRef(null); 7586 const [previousContentNode, setPreviousContentNode] = React33.useState(null); 7587 const [newTriggerOffset, setNewTriggerOffset] = React33.useState(null); 7588 const currentContainerRef = React33.useRef(null); 7589 const previousContainerRef = React33.useRef(null); 7590 const onAnimationsFinished = useAnimationsFinished(currentContainerRef, true, false); 7591 const cleanupFrame = useAnimationFrame(); 7592 const [previousContentDimensions, setPreviousContentDimensions] = React33.useState(null); 7593 const [showStartingStyleAttribute, setShowStartingStyleAttribute] = React33.useState(false); 7594 useIsoLayoutEffect(() => { 7595 store.set("hasViewport", true); 7596 return () => { 7597 store.set("hasViewport", false); 7598 }; 7599 }, [store]); 7600 const handleMeasureLayout = useStableCallback(() => { 7601 currentContainerRef.current?.style.setProperty("animation", "none"); 7602 currentContainerRef.current?.style.setProperty("transition", "none"); 7603 previousContainerRef.current?.style.setProperty("display", "none"); 7604 }); 7605 const handleMeasureLayoutComplete = useStableCallback((previousDimensions) => { 7606 currentContainerRef.current?.style.removeProperty("animation"); 7607 currentContainerRef.current?.style.removeProperty("transition"); 7608 previousContainerRef.current?.style.removeProperty("display"); 7609 if (previousDimensions) { 7610 setPreviousContentDimensions(previousDimensions); 7611 } 7612 }); 7613 const lastHandledTriggerRef = React33.useRef(null); 7614 useIsoLayoutEffect(() => { 7615 if (!open || !mounted) { 7616 lastHandledTriggerRef.current = null; 7617 } 7618 }, [open, mounted]); 7619 useIsoLayoutEffect(() => { 7620 if (activeTrigger && previousActiveTrigger && activeTrigger !== previousActiveTrigger && lastHandledTriggerRef.current !== activeTrigger && capturedNodeRef.current) { 7621 setPreviousContentNode(capturedNodeRef.current); 7622 setShowStartingStyleAttribute(true); 7623 const offset4 = calculateRelativePosition(previousActiveTrigger, activeTrigger); 7624 setNewTriggerOffset(offset4); 7625 cleanupFrame.request(() => { 7626 ReactDOM6.flushSync(() => { 7627 setShowStartingStyleAttribute(false); 7628 }); 7629 onAnimationsFinished(() => { 7630 setPreviousContentNode(null); 7631 setPreviousContentDimensions(null); 7632 capturedNodeRef.current = null; 7633 }); 7634 }); 7635 lastHandledTriggerRef.current = activeTrigger; 7636 } 7637 }, [activeTrigger, previousActiveTrigger, previousContentNode, onAnimationsFinished, cleanupFrame]); 7638 useIsoLayoutEffect(() => { 7639 const source = currentContainerRef.current; 7640 if (!source) { 7641 return; 7642 } 7643 const wrapper = ownerDocument(source).createElement("div"); 7644 for (const child of Array.from(source.childNodes)) { 7645 wrapper.appendChild(child.cloneNode(true)); 7646 } 7647 capturedNodeRef.current = wrapper; 7648 }); 7649 const isTransitioning = previousContentNode != null; 7650 let childrenToRender; 7651 if (!isTransitioning) { 7652 childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { 7653 "data-current": true, 7654 ref: currentContainerRef, 7655 children 7656 }, currentContentKey); 7657 } else { 7658 childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(React33.Fragment, { 7659 children: [/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { 7660 "data-previous": true, 7661 inert: inertValue(true), 7662 ref: previousContainerRef, 7663 style: { 7664 ...previousContentDimensions ? { 7665 [cssVars.popupWidth]: `$previousContentDimensions.width}px`, 7666 [cssVars.popupHeight]: `$previousContentDimensions.height}px` 7667 } : null, 7668 position: "absolute" 7669 }, 7670 "data-ending-style": showStartingStyleAttribute ? void 0 : "" 7671 }, "previous"), /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { 7672 "data-current": true, 7673 ref: currentContainerRef, 7674 "data-starting-style": showStartingStyleAttribute ? "" : void 0, 7675 children 7676 }, currentContentKey)] 7677 }); 7678 } 7679 useIsoLayoutEffect(() => { 7680 const container = previousContainerRef.current; 7681 if (!container || !previousContentNode) { 7682 return; 7683 } 7684 container.replaceChildren(...Array.from(previousContentNode.childNodes)); 7685 }, [previousContentNode]); 7686 usePopupAutoResize({ 7687 popupElement, 7688 positionerElement, 7689 mounted, 7690 content: payload, 7691 onMeasureLayout: handleMeasureLayout, 7692 onMeasureLayoutComplete: handleMeasureLayoutComplete, 7693 side, 7694 direction 7695 }); 7696 const state = { 7697 activationDirection: getActivationDirection(newTriggerOffset), 7698 transitioning: isTransitioning 7699 }; 7700 return { 7701 children: childrenToRender, 7702 state 7703 }; 7704 } 7705 function getActivationDirection(offset4) { 7706 if (!offset4) { 7707 return void 0; 7708 } 7709 return `$getValueWithTolerance(offset4.horizontal, 5, "right", "left")} $getValueWithTolerance(offset4.vertical, 5, "down", "up")}`; 7710 } 7711 function getValueWithTolerance(value, tolerance, positiveLabel, negativeLabel) { 7712 if (value > tolerance) { 7713 return positiveLabel; 7714 } 7715 if (value < -tolerance) { 7716 return negativeLabel; 7717 } 7718 return ""; 7719 } 7720 function calculateRelativePosition(from, to) { 7721 const fromRect = from.getBoundingClientRect(); 7722 const toRect = to.getBoundingClientRect(); 7723 const fromCenter = { 7724 x: fromRect.left + fromRect.width / 2, 7725 y: fromRect.top + fromRect.height / 2 7726 }; 7727 const toCenter = { 7728 x: toRect.left + toRect.width / 2, 7729 y: toRect.top + toRect.height / 2 7730 }; 7731 return { 7732 horizontal: toCenter.x - fromCenter.x, 7733 vertical: toCenter.y - fromCenter.y 7734 }; 7735 } 7736 function usePopupContentKey(activeTriggerId, payload) { 7737 const [contentKey, setContentKey] = React33.useState(0); 7738 const previousActiveTriggerIdRef = React33.useRef(activeTriggerId); 7739 const previousPayloadRef = React33.useRef(payload); 7740 const pendingPayloadUpdateRef = React33.useRef(false); 7741 useIsoLayoutEffect(() => { 7742 const previousActiveTriggerId = previousActiveTriggerIdRef.current; 7743 const previousPayload = previousPayloadRef.current; 7744 const triggerIdChanged = activeTriggerId !== previousActiveTriggerId; 7745 const payloadChanged = payload !== previousPayload; 7746 if (triggerIdChanged) { 7747 setContentKey((value) => value + 1); 7748 pendingPayloadUpdateRef.current = !payloadChanged; 7749 } else if (pendingPayloadUpdateRef.current && payloadChanged) { 7750 setContentKey((value) => value + 1); 7751 pendingPayloadUpdateRef.current = false; 7752 } 7753 previousActiveTriggerIdRef.current = activeTriggerId; 7754 previousPayloadRef.current = payload; 7755 }, [activeTriggerId, payload]); 7756 return `$activeTriggerId ?? "current"}-$contentKey}`; 7757 } 7758 7759 // node_modules/@base-ui/react/utils/FloatingPortalLite.mjs 7760 var React34 = __toESM(require_react(), 1); 7761 var ReactDOM7 = __toESM(require_react_dom(), 1); 7762 var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1); 7763 var FloatingPortalLite = /* @__PURE__ */ React34.forwardRef(function FloatingPortalLite2(componentProps, forwardedRef) { 7764 const { 7765 children, 7766 container, 7767 className, 7768 render, 7769 style, 7770 ...elementProps 7771 } = componentProps; 7772 const { 7773 portalNode, 7774 portalSubtree 7775 } = useFloatingPortalNode({ 7776 container, 7777 ref: forwardedRef, 7778 componentProps, 7779 elementProps 7780 }); 7781 if (!portalSubtree && !portalNode) { 7782 return null; 7783 } 7784 return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(React34.Fragment, { 7785 children: [portalSubtree, portalNode && /* @__PURE__ */ ReactDOM7.createPortal(children, portalNode)] 7786 }); 7787 }); 7788 if (true) FloatingPortalLite.displayName = "FloatingPortalLite"; 7789 7790 // node_modules/@base-ui/react/tooltip/index.parts.mjs 7791 var index_parts_exports = {}; 7792 __export(index_parts_exports, { 7793 Arrow: () => TooltipArrow, 7794 Handle: () => TooltipHandle, 7795 Popup: () => TooltipPopup, 7796 Portal: () => TooltipPortal, 7797 Positioner: () => TooltipPositioner, 7798 Provider: () => TooltipProvider, 7799 Root: () => TooltipRoot, 7800 Trigger: () => TooltipTrigger, 7801 Viewport: () => TooltipViewport, 7802 createHandle: () => createTooltipHandle 7803 }); 7804 7805 // node_modules/@base-ui/react/tooltip/root/TooltipRoot.mjs 7806 var React37 = __toESM(require_react(), 1); 7807 7808 // node_modules/@base-ui/react/tooltip/root/TooltipRootContext.mjs 7809 var React35 = __toESM(require_react(), 1); 7810 var TooltipRootContext = /* @__PURE__ */ React35.createContext(void 0); 7811 if (true) TooltipRootContext.displayName = "TooltipRootContext"; 7812 function useTooltipRootContext(optional) { 7813 const context = React35.useContext(TooltipRootContext); 7814 if (context === void 0 && !optional) { 7815 throw new Error(true ? "Base UI: TooltipRootContext is missing. Tooltip parts must be placed within <Tooltip.Root>." : formatErrorMessage_default(72)); 7816 } 7817 return context; 7818 } 7819 7820 // node_modules/@base-ui/react/tooltip/store/TooltipStore.mjs 7821 var React36 = __toESM(require_react(), 1); 7822 var selectors2 = { 7823 ...popupStoreSelectors, 7824 disabled: createSelector((state) => state.disabled), 7825 instantType: createSelector((state) => state.instantType), 7826 isInstantPhase: createSelector((state) => state.isInstantPhase), 7827 trackCursorAxis: createSelector((state) => state.trackCursorAxis), 7828 disableHoverablePopup: createSelector((state) => state.disableHoverablePopup), 7829 lastOpenChangeReason: createSelector((state) => state.openChangeReason), 7830 closeOnClick: createSelector((state) => state.closeOnClick), 7831 closeDelay: createSelector((state) => state.closeDelay), 7832 hasViewport: createSelector((state) => state.hasViewport) 7833 }; 7834 var TooltipStore = class _TooltipStore extends ReactStore { 7835 constructor(initialState, floatingId, nested = false) { 7836 const triggerElements = new PopupTriggerMap(); 7837 const state = { 7838 ...createInitialState(), 7839 ...initialState 7840 }; 7841 state.floatingRootContext = createPopupFloatingRootContext(triggerElements, floatingId, nested); 7842 super(state, { 7843 popupRef: /* @__PURE__ */ React36.createRef(), 7844 onOpenChange: void 0, 7845 onOpenChangeComplete: void 0, 7846 triggerElements 7847 }, selectors2); 7848 } 7849 setOpen = (nextOpen, eventDetails) => { 7850 applyPopupOpenChange(this, nextOpen, eventDetails, { 7851 extraState: { 7852 openChangeReason: eventDetails.reason 7853 } 7854 }); 7855 }; 7856 // Used by trigger clicks to clear a delayed hover open without reporting a public open-state change. 7857 cancelPendingOpen(event) { 7858 this.state.floatingRootContext.dispatchOpenChange(false, createChangeEventDetails(reason_parts_exports.triggerPress, event)); 7859 } 7860 static useStore(externalStore, initialState) { 7861 const store = usePopupStore(externalStore, (floatingId, nested) => new _TooltipStore(initialState, floatingId, nested)).store; 7862 return store; 7863 } 7864 }; 7865 function createInitialState() { 7866 return { 7867 ...createInitialPopupStoreState(), 7868 disabled: false, 7869 instantType: void 0, 7870 isInstantPhase: false, 7871 trackCursorAxis: "none", 7872 disableHoverablePopup: false, 7873 openChangeReason: null, 7874 closeOnClick: true, 7875 closeDelay: 0, 7876 hasViewport: false 7877 }; 7878 } 7879 7880 // node_modules/@base-ui/react/tooltip/root/TooltipRoot.mjs 7881 var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1); 7882 var TooltipRoot = fastComponent(function TooltipRoot2(props) { 7883 const { 7884 disabled: disabled2 = false, 7885 defaultOpen = false, 7886 open: openProp, 7887 disableHoverablePopup = false, 7888 trackCursorAxis = "none", 7889 actionsRef, 7890 onOpenChange, 7891 onOpenChangeComplete, 7892 handle, 7893 triggerId: triggerIdProp, 7894 defaultTriggerId: defaultTriggerIdProp = null, 7895 children 7896 } = props; 7897 const store = TooltipStore.useStore(handle?.store, { 7898 open: defaultOpen, 7899 openProp, 7900 activeTriggerId: defaultTriggerIdProp, 7901 triggerIdProp 7902 }); 7903 useInitialOpenSync(store, openProp, defaultOpen, defaultTriggerIdProp); 7904 store.useControlledProp("openProp", openProp); 7905 store.useControlledProp("triggerIdProp", triggerIdProp); 7906 store.useContextCallback("onOpenChange", onOpenChange); 7907 store.useContextCallback("onOpenChangeComplete", onOpenChangeComplete); 7908 const openState = store.useState("open"); 7909 const open = !disabled2 && openState; 7910 const activeTriggerId = store.useState("activeTriggerId"); 7911 const mounted = store.useState("mounted"); 7912 const payload = store.useState("payload"); 7913 store.useSyncedValues({ 7914 trackCursorAxis, 7915 disableHoverablePopup 7916 }); 7917 store.useSyncedValue("disabled", disabled2); 7918 useImplicitActiveTrigger(store, { 7919 closeOnActiveTriggerUnmount: true 7920 }); 7921 const { 7922 forceUnmount, 7923 transitionStatus 7924 } = useOpenStateTransitions(open, store); 7925 const isInstantPhase = store.useState("isInstantPhase"); 7926 const instantType = store.useState("instantType"); 7927 const lastOpenChangeReason = store.useState("lastOpenChangeReason"); 7928 const previousInstantTypeRef = React37.useRef(null); 7929 useIsoLayoutEffect(() => { 7930 if (openState && disabled2) { 7931 store.setOpen(false, createChangeEventDetails(reason_parts_exports.disabled)); 7932 } 7933 }, [openState, disabled2, store]); 7934 useIsoLayoutEffect(() => { 7935 if (transitionStatus === "ending" && lastOpenChangeReason === reason_parts_exports.none || transitionStatus !== "ending" && isInstantPhase) { 7936 if (instantType !== "delay") { 7937 previousInstantTypeRef.current = instantType; 7938 } 7939 store.set("instantType", "delay"); 7940 } else if (previousInstantTypeRef.current !== null) { 7941 store.set("instantType", previousInstantTypeRef.current); 7942 previousInstantTypeRef.current = null; 7943 } 7944 }, [transitionStatus, isInstantPhase, lastOpenChangeReason, instantType, store]); 7945 useIsoLayoutEffect(() => { 7946 if (open) { 7947 if (activeTriggerId == null) { 7948 store.set("payload", void 0); 7949 } 7950 } 7951 }, [store, activeTriggerId, open]); 7952 const handleImperativeClose = React37.useCallback(() => { 7953 store.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction)); 7954 }, [store]); 7955 React37.useImperativeHandle(actionsRef, () => ({ 7956 unmount: forceUnmount, 7957 close: handleImperativeClose 7958 }), [forceUnmount, handleImperativeClose]); 7959 const shouldRenderInteractions = open || mounted || !disabled2 && trackCursorAxis !== "none"; 7960 return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(TooltipRootContext.Provider, { 7961 value: store, 7962 children: [shouldRenderInteractions && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TooltipInteractions, { 7963 store, 7964 disabled: disabled2, 7965 trackCursorAxis 7966 }), typeof children === "function" ? children({ 7967 payload 7968 }) : children] 7969 }); 7970 }); 7971 if (true) TooltipRoot.displayName = "TooltipRoot"; 7972 function TooltipInteractions({ 7973 store, 7974 disabled: disabled2, 7975 trackCursorAxis 7976 }) { 7977 const floatingRootContext = store.useState("floatingRootContext"); 7978 const dismiss = useDismiss(floatingRootContext, { 7979 enabled: !disabled2, 7980 referencePress: () => store.select("closeOnClick") 7981 }); 7982 const clientPoint = useClientPoint(floatingRootContext, { 7983 enabled: !disabled2 && trackCursorAxis !== "none", 7984 axis: trackCursorAxis === "none" ? void 0 : trackCursorAxis 7985 }); 7986 const activeTriggerProps = React37.useMemo(() => mergeProps(clientPoint.reference, dismiss.reference), [clientPoint.reference, dismiss.reference]); 7987 const inactiveTriggerProps = React37.useMemo(() => mergeProps(clientPoint.trigger, dismiss.trigger), [clientPoint.trigger, dismiss.trigger]); 7988 const popupProps = React37.useMemo(() => mergeProps(FOCUSABLE_POPUP_PROPS, clientPoint.floating, dismiss.floating), [clientPoint.floating, dismiss.floating]); 7989 usePopupInteractionProps(store, { 7990 activeTriggerProps, 7991 inactiveTriggerProps, 7992 popupProps 7993 }); 7994 return null; 7995 } 7996 7997 // node_modules/@base-ui/react/tooltip/trigger/TooltipTrigger.mjs 7998 var React39 = __toESM(require_react(), 1); 7999 8000 // node_modules/@base-ui/react/tooltip/provider/TooltipProviderContext.mjs 8001 var React38 = __toESM(require_react(), 1); 8002 var TooltipProviderContext = /* @__PURE__ */ React38.createContext(void 0); 8003 if (true) TooltipProviderContext.displayName = "TooltipProviderContext"; 8004 function useTooltipProviderContext() { 8005 return React38.useContext(TooltipProviderContext); 8006 } 8007 8008 // node_modules/@base-ui/react/tooltip/trigger/TooltipTriggerDataAttributes.mjs 8009 var TooltipTriggerDataAttributes = (function(TooltipTriggerDataAttributes2) { 8010 TooltipTriggerDataAttributes2[TooltipTriggerDataAttributes2["popupOpen"] = CommonTriggerDataAttributes.popupOpen] = "popupOpen"; 8011 TooltipTriggerDataAttributes2["triggerDisabled"] = "data-trigger-disabled"; 8012 return TooltipTriggerDataAttributes2; 8013 })({}); 8014 8015 // node_modules/@base-ui/react/tooltip/utils/constants.mjs 8016 var OPEN_DELAY = 600; 8017 8018 // node_modules/@base-ui/react/tooltip/trigger/TooltipTrigger.mjs 8019 var TOOLTIP_TRIGGER_IDENTIFIER = "data-base-ui-tooltip-trigger"; 8020 function getTargetElement(event) { 8021 if ("composedPath" in event) { 8022 const path = event.composedPath(); 8023 for (let i2 = 0; i2 < path.length; i2 += 1) { 8024 const element = path[i2]; 8025 if (isElement(element)) { 8026 return element; 8027 } 8028 } 8029 } 8030 const target = event.target; 8031 if (isElement(target)) { 8032 return target; 8033 } 8034 return null; 8035 } 8036 function closestEnabledTooltipTrigger(element) { 8037 let current = element; 8038 while (current) { 8039 if (current.hasAttribute(TOOLTIP_TRIGGER_IDENTIFIER)) { 8040 return current; 8041 } 8042 const parentElement = current.parentElement; 8043 if (parentElement) { 8044 current = parentElement; 8045 continue; 8046 } 8047 const root = current.getRootNode(); 8048 current = "host" in root && isElement(root.host) ? root.host : null; 8049 } 8050 return null; 8051 } 8052 var TooltipTrigger = fastComponentRef(function TooltipTrigger2(componentProps, forwardedRef) { 8053 const { 8054 render, 8055 className, 8056 style, 8057 handle, 8058 payload, 8059 disabled: disabledProp, 8060 delay, 8061 closeOnClick = true, 8062 closeDelay, 8063 id: idProp, 8064 ...elementProps 8065 } = componentProps; 8066 const rootContext = useTooltipRootContext(true); 8067 const store = handle?.store ?? rootContext; 8068 if (!store) { 8069 throw new Error(true ? "Base UI: <Tooltip.Trigger> must be either used within a <Tooltip.Root> component or provided with a handle." : formatErrorMessage_default(82)); 8070 } 8071 const thisTriggerId = useBaseUiId(idProp); 8072 const isTriggerActive = store.useState("isTriggerActive", thisTriggerId); 8073 const isOpenedByThisTrigger = store.useState("isOpenedByTrigger", thisTriggerId); 8074 const floatingRootContext = store.useState("floatingRootContext"); 8075 const triggerElementRef = React39.useRef(null); 8076 const delayWithDefault = delay ?? OPEN_DELAY; 8077 const closeDelayWithDefault = closeDelay ?? 0; 8078 const { 8079 registerTrigger, 8080 isMountedByThisTrigger 8081 } = useTriggerDataForwarding(thisTriggerId, triggerElementRef, store, { 8082 payload, 8083 closeOnClick, 8084 closeDelay: closeDelayWithDefault 8085 }); 8086 const providerContext = useTooltipProviderContext(); 8087 const { 8088 delayRef, 8089 isInstantPhase, 8090 hasProvider 8091 } = useDelayGroup(floatingRootContext, { 8092 open: isOpenedByThisTrigger 8093 }); 8094 const hoverInteraction = useHoverInteractionSharedState(floatingRootContext); 8095 store.useSyncedValue("isInstantPhase", isInstantPhase); 8096 const rootDisabled = store.useState("disabled"); 8097 const disabled2 = disabledProp ?? rootDisabled; 8098 const disabledRef = useValueAsRef(disabled2); 8099 const trackCursorAxis = store.useState("trackCursorAxis"); 8100 const disableHoverablePopup = store.useState("disableHoverablePopup"); 8101 const isNestedTriggerHoveredRef = React39.useRef(false); 8102 const nestedTriggerOpenTimeout = useTimeout(); 8103 const pointerTypeRef = React39.useRef(void 0); 8104 function getOpenDelay() { 8105 const providerDelay = providerContext?.delay; 8106 const groupOpenValue = typeof delayRef.current === "object" ? delayRef.current.open : void 0; 8107 let computedOpenDelay = delayWithDefault; 8108 if (hasProvider) { 8109 if (groupOpenValue !== 0) { 8110 computedOpenDelay = delay ?? providerDelay ?? delayWithDefault; 8111 } else { 8112 computedOpenDelay = 0; 8113 } 8114 } 8115 return computedOpenDelay; 8116 } 8117 function isEnabledNestedTriggerTarget(target) { 8118 const triggerEl = triggerElementRef.current; 8119 if (!triggerEl || !target) { 8120 return false; 8121 } 8122 const nearestTrigger = closestEnabledTooltipTrigger(target); 8123 return nearestTrigger !== null && nearestTrigger !== triggerEl && contains(triggerEl, nearestTrigger); 8124 } 8125 function detectNestedTriggerHover(target) { 8126 const nestedTriggerHovered = isEnabledNestedTriggerTarget(target); 8127 isNestedTriggerHoveredRef.current = nestedTriggerHovered; 8128 if (nestedTriggerHovered) { 8129 hoverInteraction.openChangeTimeout.clear(); 8130 hoverInteraction.restTimeout.clear(); 8131 hoverInteraction.restTimeoutPending = false; 8132 nestedTriggerOpenTimeout.clear(); 8133 } 8134 return nestedTriggerHovered; 8135 } 8136 const hoverProps = useHoverReferenceInteraction(floatingRootContext, { 8137 enabled: !disabled2, 8138 mouseOnly: true, 8139 move: false, 8140 handleClose: !disableHoverablePopup && trackCursorAxis !== "both" ? safePolygon() : null, 8141 restMs: getOpenDelay, 8142 delay() { 8143 const closeValue = typeof delayRef.current === "object" ? delayRef.current.close : void 0; 8144 let computedCloseDelay = closeDelayWithDefault; 8145 if (closeDelay == null && hasProvider) { 8146 computedCloseDelay = closeValue; 8147 } 8148 return { 8149 close: computedCloseDelay 8150 }; 8151 }, 8152 triggerElementRef, 8153 isActiveTrigger: isTriggerActive, 8154 isClosing: () => store.select("transitionStatus") === "ending", 8155 shouldOpen() { 8156 return !isNestedTriggerHoveredRef.current; 8157 } 8158 }); 8159 const focusProps = useFocus(floatingRootContext, { 8160 enabled: !disabled2 8161 }).reference; 8162 const handleNestedTriggerHover = (event) => { 8163 const wasNestedTriggerHovered = isNestedTriggerHoveredRef.current; 8164 const target = getTargetElement(event); 8165 const nestedTriggerHovered = detectNestedTriggerHover(target); 8166 const triggerEl = triggerElementRef.current; 8167 const targetInsideTrigger = triggerEl && target && contains(triggerEl, target); 8168 if (nestedTriggerHovered && store.select("open") && store.select("lastOpenChangeReason") === reason_parts_exports.triggerHover) { 8169 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 8170 return; 8171 } 8172 if (wasNestedTriggerHovered && !nestedTriggerHovered && targetInsideTrigger && !disabledRef.current && !store.select("open") && triggerEl && // Match the hover hook's non-strict mouse fallback for mouse-only event sequences. 8173 isMouseLikePointerType(pointerTypeRef.current)) { 8174 const open = () => { 8175 if (!isNestedTriggerHoveredRef.current && !disabledRef.current && !store.select("open")) { 8176 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerEl)); 8177 } 8178 }; 8179 const openDelay = getOpenDelay(); 8180 if (openDelay === 0) { 8181 nestedTriggerOpenTimeout.clear(); 8182 open(); 8183 } else { 8184 nestedTriggerOpenTimeout.start(openDelay, open); 8185 } 8186 } 8187 }; 8188 const rootTriggerProps = store.useState("triggerProps", isMountedByThisTrigger); 8189 const shouldApplyRootTriggerProps = isMountedByThisTrigger || trackCursorAxis !== "none"; 8190 const state = { 8191 open: isOpenedByThisTrigger 8192 }; 8193 const element = useRenderElement("button", componentProps, { 8194 state, 8195 ref: [forwardedRef, registerTrigger, triggerElementRef], 8196 props: [hoverProps, focusProps, shouldApplyRootTriggerProps ? rootTriggerProps : void 0, { 8197 onMouseOver(event) { 8198 handleNestedTriggerHover(event.nativeEvent); 8199 }, 8200 onFocus(event) { 8201 if (isEnabledNestedTriggerTarget(getTargetElement(event.nativeEvent))) { 8202 event.preventBaseUIHandler(); 8203 } 8204 }, 8205 onMouseLeave() { 8206 isNestedTriggerHoveredRef.current = false; 8207 nestedTriggerOpenTimeout.clear(); 8208 pointerTypeRef.current = void 0; 8209 }, 8210 onPointerEnter(event) { 8211 pointerTypeRef.current = event.pointerType; 8212 }, 8213 onPointerDown(event) { 8214 pointerTypeRef.current = event.pointerType; 8215 store.set("closeOnClick", closeOnClick); 8216 if (closeOnClick && !store.select("open")) { 8217 store.cancelPendingOpen(event.nativeEvent); 8218 } 8219 }, 8220 onClick(event) { 8221 if (closeOnClick && !store.select("open")) { 8222 store.cancelPendingOpen(event.nativeEvent); 8223 } 8224 }, 8225 id: thisTriggerId, 8226 [TooltipTriggerDataAttributes.triggerDisabled]: disabled2 ? "" : void 0, 8227 [TOOLTIP_TRIGGER_IDENTIFIER]: disabled2 ? void 0 : "" 8228 }, elementProps], 8229 stateAttributesMapping: triggerOpenStateMapping 8230 }); 8231 return element; 8232 }); 8233 if (true) TooltipTrigger.displayName = "TooltipTrigger"; 8234 8235 // node_modules/@base-ui/react/tooltip/portal/TooltipPortal.mjs 8236 var React41 = __toESM(require_react(), 1); 8237 8238 // node_modules/@base-ui/react/tooltip/portal/TooltipPortalContext.mjs 8239 var React40 = __toESM(require_react(), 1); 8240 var TooltipPortalContext = /* @__PURE__ */ React40.createContext(void 0); 8241 if (true) TooltipPortalContext.displayName = "TooltipPortalContext"; 8242 function useTooltipPortalContext() { 8243 const value = React40.useContext(TooltipPortalContext); 8244 if (value === void 0) { 8245 throw new Error(true ? "Base UI: <Tooltip.Portal> is missing." : formatErrorMessage_default(70)); 8246 } 8247 return value; 8248 } 8249 8250 // node_modules/@base-ui/react/tooltip/portal/TooltipPortal.mjs 8251 var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1); 8252 var TooltipPortal = /* @__PURE__ */ React41.forwardRef(function TooltipPortal2(props, forwardedRef) { 8253 const { 8254 keepMounted = false, 8255 ...portalProps 8256 } = props; 8257 const store = useTooltipRootContext(); 8258 const mounted = store.useState("mounted"); 8259 const shouldRender = mounted || keepMounted; 8260 if (!shouldRender) { 8261 return null; 8262 } 8263 return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(TooltipPortalContext.Provider, { 8264 value: keepMounted, 8265 children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(FloatingPortalLite, { 8266 ref: forwardedRef, 8267 ...portalProps 8268 }) 8269 }); 8270 }); 8271 if (true) TooltipPortal.displayName = "TooltipPortal"; 8272 8273 // node_modules/@base-ui/react/tooltip/positioner/TooltipPositioner.mjs 8274 var React43 = __toESM(require_react(), 1); 8275 8276 // node_modules/@base-ui/react/tooltip/positioner/TooltipPositionerContext.mjs 8277 var React42 = __toESM(require_react(), 1); 8278 var TooltipPositionerContext = /* @__PURE__ */ React42.createContext(void 0); 8279 if (true) TooltipPositionerContext.displayName = "TooltipPositionerContext"; 8280 function useTooltipPositionerContext() { 8281 const context = React42.useContext(TooltipPositionerContext); 8282 if (context === void 0) { 8283 throw new Error(true ? "Base UI: TooltipPositionerContext is missing. TooltipPositioner parts must be placed within <Tooltip.Positioner>." : formatErrorMessage_default(71)); 8284 } 8285 return context; 8286 } 8287 8288 // node_modules/@base-ui/react/tooltip/positioner/TooltipPositioner.mjs 8289 var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1); 8290 var TooltipPositioner = /* @__PURE__ */ React43.forwardRef(function TooltipPositioner2(componentProps, forwardedRef) { 8291 const { 8292 render, 8293 className, 8294 anchor, 8295 positionMethod = "absolute", 8296 side = "top", 8297 align = "center", 8298 sideOffset = 0, 8299 alignOffset = 0, 8300 collisionBoundary = "clipping-ancestors", 8301 collisionPadding = 5, 8302 arrowPadding = 5, 8303 sticky = false, 8304 disableAnchorTracking = false, 8305 collisionAvoidance = POPUP_COLLISION_AVOIDANCE, 8306 style, 8307 ...elementProps 8308 } = componentProps; 8309 const store = useTooltipRootContext(); 8310 const keepMounted = useTooltipPortalContext(); 8311 const open = store.useState("open"); 8312 const mounted = store.useState("mounted"); 8313 const trackCursorAxis = store.useState("trackCursorAxis"); 8314 const disableHoverablePopup = store.useState("disableHoverablePopup"); 8315 const floatingRootContext = store.useState("floatingRootContext"); 8316 const instantType = store.useState("instantType"); 8317 const transitionStatus = store.useState("transitionStatus"); 8318 const hasViewport = store.useState("hasViewport"); 8319 const positioning = useAnchorPositioning({ 8320 anchor, 8321 positionMethod, 8322 floatingRootContext, 8323 mounted, 8324 side, 8325 sideOffset, 8326 align, 8327 alignOffset, 8328 collisionBoundary, 8329 collisionPadding, 8330 sticky, 8331 arrowPadding, 8332 disableAnchorTracking, 8333 keepMounted, 8334 collisionAvoidance, 8335 adaptiveOrigin: hasViewport ? adaptiveOrigin : void 0 8336 }); 8337 const state = React43.useMemo(() => ({ 8338 open, 8339 side: positioning.side, 8340 align: positioning.align, 8341 anchorHidden: positioning.anchorHidden, 8342 instant: trackCursorAxis !== "none" ? "tracking-cursor" : instantType 8343 }), [open, positioning.side, positioning.align, positioning.anchorHidden, trackCursorAxis, instantType]); 8344 const element = usePositioner(componentProps, state, { 8345 styles: positioning.positionerStyles, 8346 transitionStatus, 8347 props: elementProps, 8348 refs: [forwardedRef, store.useStateSetter("positionerElement")], 8349 hidden: !mounted, 8350 inert: !open || trackCursorAxis === "both" || disableHoverablePopup 8351 }); 8352 return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TooltipPositionerContext.Provider, { 8353 value: positioning, 8354 children: element 8355 }); 8356 }); 8357 if (true) TooltipPositioner.displayName = "TooltipPositioner"; 8358 8359 // node_modules/@base-ui/react/tooltip/popup/TooltipPopup.mjs 8360 var React44 = __toESM(require_react(), 1); 8361 var stateAttributesMapping = { 8362 ...popupStateMapping, 8363 ...transitionStatusMapping 8364 }; 8365 var TooltipPopup = /* @__PURE__ */ React44.forwardRef(function TooltipPopup2(componentProps, forwardedRef) { 8366 const { 8367 render, 8368 className, 8369 style, 8370 ...elementProps 8371 } = componentProps; 8372 const store = useTooltipRootContext(); 8373 const { 8374 side, 8375 align 8376 } = useTooltipPositionerContext(); 8377 const open = store.useState("open"); 8378 const instantType = store.useState("instantType"); 8379 const transitionStatus = store.useState("transitionStatus"); 8380 const popupProps = store.useState("popupProps"); 8381 const floatingContext = store.useState("floatingRootContext"); 8382 const disabled2 = store.useState("disabled"); 8383 const closeDelay = store.useState("closeDelay"); 8384 useOpenChangeComplete({ 8385 open, 8386 ref: store.context.popupRef, 8387 onComplete() { 8388 if (open) { 8389 store.context.onOpenChangeComplete?.(true); 8390 } 8391 } 8392 }); 8393 useHoverFloatingInteraction(floatingContext, { 8394 enabled: !disabled2, 8395 closeDelay 8396 }); 8397 const setPopupElement = store.useStateSetter("popupElement"); 8398 const state = { 8399 open, 8400 side, 8401 align, 8402 instant: instantType, 8403 transitionStatus 8404 }; 8405 const element = useRenderElement("div", componentProps, { 8406 state, 8407 ref: [forwardedRef, store.context.popupRef, setPopupElement], 8408 props: [popupProps, getDisabledMountTransitionStyles(transitionStatus), elementProps], 8409 stateAttributesMapping 8410 }); 8411 return element; 8412 }); 8413 if (true) TooltipPopup.displayName = "TooltipPopup"; 8414 8415 // node_modules/@base-ui/react/tooltip/arrow/TooltipArrow.mjs 8416 var React45 = __toESM(require_react(), 1); 8417 var TooltipArrow = /* @__PURE__ */ React45.forwardRef(function TooltipArrow2(componentProps, forwardedRef) { 8418 const { 8419 render, 8420 className, 8421 style, 8422 ...elementProps 8423 } = componentProps; 8424 const store = useTooltipRootContext(); 8425 const { 8426 arrowRef, 8427 side, 8428 align, 8429 arrowUncentered, 8430 arrowStyles 8431 } = useTooltipPositionerContext(); 8432 const open = store.useState("open"); 8433 const instantType = store.useState("instantType"); 8434 const state = { 8435 open, 8436 side, 8437 align, 8438 uncentered: arrowUncentered, 8439 instant: instantType 8440 }; 8441 const element = useRenderElement("div", componentProps, { 8442 state, 8443 ref: [forwardedRef, arrowRef], 8444 props: [{ 8445 style: arrowStyles, 8446 "aria-hidden": true 8447 }, elementProps], 8448 stateAttributesMapping: popupStateMapping 8449 }); 8450 return element; 8451 }); 8452 if (true) TooltipArrow.displayName = "TooltipArrow"; 8453 8454 // node_modules/@base-ui/react/tooltip/provider/TooltipProvider.mjs 8455 var React46 = __toESM(require_react(), 1); 8456 var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1); 8457 var TooltipProvider = function TooltipProvider2(props) { 8458 const { 8459 delay, 8460 closeDelay, 8461 timeout = 400 8462 } = props; 8463 const contextValue = React46.useMemo(() => ({ 8464 delay, 8465 closeDelay 8466 }), [delay, closeDelay]); 8467 const delayValue = React46.useMemo(() => ({ 8468 open: delay, 8469 close: closeDelay 8470 }), [delay, closeDelay]); 8471 return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TooltipProviderContext.Provider, { 8472 value: contextValue, 8473 children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FloatingDelayGroup, { 8474 delay: delayValue, 8475 timeoutMs: timeout, 8476 children: props.children 8477 }) 8478 }); 8479 }; 8480 if (true) TooltipProvider.displayName = "TooltipProvider"; 8481 8482 // node_modules/@base-ui/react/tooltip/viewport/TooltipViewport.mjs 8483 var React47 = __toESM(require_react(), 1); 8484 8485 // node_modules/@base-ui/react/tooltip/viewport/TooltipViewportCssVars.mjs 8486 var TooltipViewportCssVars = /* @__PURE__ */ (function(TooltipViewportCssVars2) { 8487 TooltipViewportCssVars2["popupWidth"] = "--popup-width"; 8488 TooltipViewportCssVars2["popupHeight"] = "--popup-height"; 8489 return TooltipViewportCssVars2; 8490 })({}); 8491 8492 // node_modules/@base-ui/react/tooltip/viewport/TooltipViewport.mjs 8493 var stateAttributesMapping2 = { 8494 activationDirection: (value) => value ? { 8495 "data-activation-direction": value 8496 } : null 8497 }; 8498 var TooltipViewport = /* @__PURE__ */ React47.forwardRef(function TooltipViewport2(componentProps, forwardedRef) { 8499 const { 8500 render, 8501 className, 8502 style, 8503 children, 8504 ...elementProps 8505 } = componentProps; 8506 const store = useTooltipRootContext(); 8507 const positioner = useTooltipPositionerContext(); 8508 const instantType = store.useState("instantType"); 8509 const { 8510 children: childrenToRender, 8511 state: viewportState 8512 } = usePopupViewport({ 8513 store, 8514 side: positioner.side, 8515 cssVars: TooltipViewportCssVars, 8516 children 8517 }); 8518 const state = { 8519 activationDirection: viewportState.activationDirection, 8520 transitioning: viewportState.transitioning, 8521 instant: instantType 8522 }; 8523 return useRenderElement("div", componentProps, { 8524 state, 8525 ref: forwardedRef, 8526 props: [elementProps, { 8527 children: childrenToRender 8528 }], 8529 stateAttributesMapping: stateAttributesMapping2 8530 }); 8531 }); 8532 if (true) TooltipViewport.displayName = "TooltipViewport"; 8533 8534 // node_modules/@base-ui/react/tooltip/store/TooltipHandle.mjs 8535 var TooltipHandle = class { 8536 /** 8537 * Internal store holding the tooltip state. 8538 * @internal 8539 */ 8540 constructor() { 8541 this.store = new TooltipStore(); 8542 } 8543 /** 8544 * Opens the tooltip and associates it with the trigger with the given ID. 8545 * The trigger must be a Tooltip.Trigger component with this handle passed as a prop. 8546 * 8547 * This method should only be called in an event handler or an effect (not during rendering). 8548 * 8549 * @param triggerId ID of the trigger to associate with the tooltip. 8550 */ 8551 open(triggerId) { 8552 const triggerElement = triggerId ? this.store.context.triggerElements.getById(triggerId) : void 0; 8553 if (triggerId && !triggerElement) { 8554 throw new Error(true ? `Base UI: TooltipHandle.open: No trigger found with id "$triggerId}".` : formatErrorMessage_default(81, triggerId)); 8555 } 8556 this.store.setOpen(true, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, triggerElement)); 8557 } 8558 /** 8559 * Closes the tooltip. 8560 */ 8561 close() { 8562 this.store.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, void 0)); 8563 } 8564 /** 8565 * Indicates whether the tooltip is currently open. 8566 */ 8567 get isOpen() { 8568 return this.store.select("open"); 8569 } 8570 }; 8571 function createTooltipHandle() { 8572 return new TooltipHandle(); 8573 } 8574 8575 // node_modules/@base-ui/react/use-render/useRender.mjs 8576 function useRender(params) { 8577 return useRenderElement(params.defaultTagName ?? "div", params, params); 8578 } 8579 8580 // packages/ui/build-module/text/text.mjs 8581 var import_element10 = __toESM(require_element(), 1); 8582 var STYLE_HASH_ATTRIBUTE = "data-wp-hash"; 8583 function getRuntime() { 8584 const globalScope = globalThis; 8585 if (globalScope.__wpStyleRuntime) { 8586 return globalScope.__wpStyleRuntime; 8587 } 8588 globalScope.__wpStyleRuntime = { 8589 documents: /* @__PURE__ */ new Map(), 8590 styles: /* @__PURE__ */ new Map(), 8591 injectedStyles: /* @__PURE__ */ new WeakMap() 8592 }; 8593 if (typeof document !== "undefined") { 8594 registerDocument(document); 8595 } 8596 return globalScope.__wpStyleRuntime; 8597 } 8598 function documentContainsStyleHash(targetDocument, hash) { 8599 if (!targetDocument.head) { 8600 return false; 8601 } 8602 for (const style of targetDocument.head.querySelectorAll( 8603 `style[$STYLE_HASH_ATTRIBUTE}]` 8604 )) { 8605 if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) { 8606 return true; 8607 } 8608 } 8609 return false; 8610 } 8611 function injectStyle(targetDocument, hash, css) { 8612 if (!targetDocument.head) { 8613 return; 8614 } 8615 const runtime = getRuntime(); 8616 let injectedStyles = runtime.injectedStyles.get(targetDocument); 8617 if (!injectedStyles) { 8618 injectedStyles = /* @__PURE__ */ new Set(); 8619 runtime.injectedStyles.set(targetDocument, injectedStyles); 8620 } 8621 if (injectedStyles.has(hash)) { 8622 return; 8623 } 8624 if (documentContainsStyleHash(targetDocument, hash)) { 8625 injectedStyles.add(hash); 8626 return; 8627 } 8628 const style = targetDocument.createElement("style"); 8629 style.setAttribute(STYLE_HASH_ATTRIBUTE, hash); 8630 style.appendChild(targetDocument.createTextNode(css)); 8631 targetDocument.head.appendChild(style); 8632 injectedStyles.add(hash); 8633 } 8634 function registerDocument(targetDocument) { 8635 const runtime = getRuntime(); 8636 runtime.documents.set( 8637 targetDocument, 8638 (runtime.documents.get(targetDocument) ?? 0) + 1 8639 ); 8640 for (const [hash, css] of runtime.styles) { 8641 injectStyle(targetDocument, hash, css); 8642 } 8643 return () => { 8644 const count = runtime.documents.get(targetDocument); 8645 if (count === void 0) { 8646 return; 8647 } 8648 if (count <= 1) { 8649 runtime.documents.delete(targetDocument); 8650 return; 8651 } 8652 runtime.documents.set(targetDocument, count - 1); 8653 }; 8654 } 8655 function registerStyle(hash, css) { 8656 const runtime = getRuntime(); 8657 runtime.styles.set(hash, css); 8658 for (const targetDocument of runtime.documents.keys()) { 8659 injectStyle(targetDocument, hash, css); 8660 } 8661 } 8662 if (typeof process === "undefined" || true) { 8663 registerStyle("a495f9d138", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._83ed8a8da5dd50ea__text{margin:0}._14437cfb77831647__heading-2xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-2xl,32px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-2xl,32px);--_gcd-p-line-height:var(--wpds-typography-line-height-2xl,40px);font-size:var(--wpds-typography-font-size-2xl,32px);line-height:var(--wpds-typography-line-height-2xl,40px)}._14437cfb77831647__heading-2xl,._3c78b7fa9b4072dd__heading-xl{font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-emphasis,600)}._3c78b7fa9b4072dd__heading-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-p-line-height:var(--wpds-typography-line-height-md,24px);font-size:var(--wpds-typography-font-size-xl,20px);line-height:var(--wpds-typography-line-height-md,24px)}.aa58f227716bcde2__heading-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-lg,15px)}.aa58f227716bcde2__heading-lg,.fc4da56d8dfe52c4__heading-md{font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wpds-typography-line-height-sm,20px)}.fc4da56d8dfe52c4__heading-md{--_gcd-heading-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-md,13px)}.a9b78c7c82e8dff7__heading-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-xs,11px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-xs,11px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wpds-typography-line-height-xs,16px);text-transform:uppercase}._305ff559e52180d5__body-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-p-line-height:var(--wpds-typography-line-height-xl,32px);font-size:var(--wpds-typography-font-size-xl,20px);line-height:var(--wpds-typography-line-height-xl,32px)}._305ff559e52180d5__body-xl,.ca1aa3fc2029e958__body-lg{font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-default,400)}.ca1aa3fc2029e958__body-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-p-line-height:var(--wpds-typography-line-height-md,24px);font-size:var(--wpds-typography-font-size-lg,15px);line-height:var(--wpds-typography-line-height-md,24px)}._131101940be12424__body-md{--_gcd-heading-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-line-height-sm,20px)}._0e8d87a42c1f75fa__body-sm,._131101940be12424__body-md{font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-default,400)}._0e8d87a42c1f75fa__body-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);font-size:var(--wpds-typography-font-size-sm,12px);line-height:var(--wpds-typography-line-height-xs,16px)}}}'); 8664 } 8665 var style_default = { "text": "_83ed8a8da5dd50ea__text", "heading-2xl": "_14437cfb77831647__heading-2xl", "heading-xl": "_3c78b7fa9b4072dd__heading-xl", "heading-lg": "aa58f227716bcde2__heading-lg", "heading-md": "fc4da56d8dfe52c4__heading-md", "heading-sm": "a9b78c7c82e8dff7__heading-sm", "body-xl": "_305ff559e52180d5__body-xl", "body-lg": "ca1aa3fc2029e958__body-lg", "body-md": "_131101940be12424__body-md", "body-sm": "_0e8d87a42c1f75fa__body-sm" }; 8666 if (typeof process === "undefined" || true) { 8667 registerStyle("af6d9984a6", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}"); 8668 } 8669 var global_css_defense_default = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a" }; 8670 var Text = (0, import_element10.forwardRef)(function Text2({ variant = "body-md", render, className, ...props }, ref) { 8671 const element = useRender({ 8672 render, 8673 defaultTagName: "span", 8674 ref, 8675 props: mergeProps(props, { 8676 className: clsx_default( 8677 style_default.text, 8678 global_css_defense_default.heading, 8679 global_css_defense_default.p, 8680 style_default[variant], 8681 className 8682 ) 8683 }) 8684 }); 8685 return element; 8686 }); 8687 8688 // packages/icons/build-module/icon/index.mjs 8689 var import_element11 = __toESM(require_element(), 1); 8690 var icon_default = (0, import_element11.forwardRef)( 8691 ({ icon, size: size4 = 24, ...props }, ref) => { 8692 return (0, import_element11.cloneElement)(icon, { 8693 width: size4, 8694 height: size4, 8695 ...props, 8696 ref 8697 }); 8698 } 8699 ); 8700 8701 // packages/icons/build-module/library/chevron-left.mjs 8702 var import_primitives = __toESM(require_primitives(), 1); 8703 var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1); 8704 var chevron_left_default = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_primitives.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_primitives.Path, { d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" }) }); 8705 8706 // packages/icons/build-module/library/chevron-right.mjs 8707 var import_primitives2 = __toESM(require_primitives(), 1); 8708 var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1); 8709 var chevron_right_default = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives2.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives2.Path, { d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" }) }); 8710 8711 // packages/icons/build-module/library/more-vertical.mjs 8712 var import_primitives3 = __toESM(require_primitives(), 1); 8713 var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1); 8714 var more_vertical_default = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_primitives3.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_primitives3.Path, { d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" }) }); 8715 8716 // packages/icons/build-module/library/next.mjs 8717 var import_primitives4 = __toESM(require_primitives(), 1); 8718 var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1); 8719 var next_default = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_primitives4.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_primitives4.Path, { d: "M6.6 6L5.4 7l4.5 5-4.5 5 1.1 1 5.5-6-5.4-6zm6 0l-1.1 1 4.5 5-4.5 5 1.1 1 5.5-6-5.5-6z" }) }); 8720 8721 // packages/icons/build-module/library/previous.mjs 8722 var import_primitives5 = __toESM(require_primitives(), 1); 8723 var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1); 8724 var previous_default = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_primitives5.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_primitives5.Path, { d: "M11.6 7l-1.1-1L5 12l5.5 6 1.1-1L7 12l4.6-5zm6 0l-1.1-1-5.5 6 5.5 6 1.1-1-4.6-5 4.6-5z" }) }); 8725 8726 // packages/ui/build-module/utils/render-slot-with-children.mjs 8727 var import_element12 = __toESM(require_element(), 1); 8728 function renderSlotWithChildren(slot, defaultSlot, children) { 8729 return (0, import_element12.cloneElement)(slot ?? defaultSlot, { children }); 8730 } 8731 8732 // packages/ui/build-module/utils/theme-provider.mjs 8733 var theme = __toESM(require_theme(), 1); 8734 8735 // packages/ui/build-module/lock-unlock.mjs 8736 var import_private_apis = __toESM(require_private_apis(), 1); 8737 var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 8738 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 8739 "@wordpress/ui" 8740 ); 8741 8742 // packages/ui/build-module/utils/theme-provider.mjs 8743 function getThemeProvider() { 8744 const themePackage = theme; 8745 if (themePackage.ThemeProvider) { 8746 return themePackage.ThemeProvider; 8747 } 8748 if (!themePackage.privateApis) { 8749 throw new Error( 8750 "@wordpress/ui: @wordpress/theme must expose `ThemeProvider` or `privateApis.ThemeProvider`." 8751 ); 8752 } 8753 return unlock( 8754 themePackage.privateApis 8755 ).ThemeProvider; 8756 } 8757 var ThemeProvider = getThemeProvider(); 8758 8759 // packages/ui/build-module/stack/stack.mjs 8760 var import_element13 = __toESM(require_element(), 1); 8761 var STYLE_HASH_ATTRIBUTE2 = "data-wp-hash"; 8762 function getRuntime2() { 8763 const globalScope = globalThis; 8764 if (globalScope.__wpStyleRuntime) { 8765 return globalScope.__wpStyleRuntime; 8766 } 8767 globalScope.__wpStyleRuntime = { 8768 documents: /* @__PURE__ */ new Map(), 8769 styles: /* @__PURE__ */ new Map(), 8770 injectedStyles: /* @__PURE__ */ new WeakMap() 8771 }; 8772 if (typeof document !== "undefined") { 8773 registerDocument2(document); 8774 } 8775 return globalScope.__wpStyleRuntime; 8776 } 8777 function documentContainsStyleHash2(targetDocument, hash) { 8778 if (!targetDocument.head) { 8779 return false; 8780 } 8781 for (const style of targetDocument.head.querySelectorAll( 8782 `style[$STYLE_HASH_ATTRIBUTE2}]` 8783 )) { 8784 if (style.getAttribute(STYLE_HASH_ATTRIBUTE2) === hash) { 8785 return true; 8786 } 8787 } 8788 return false; 8789 } 8790 function injectStyle2(targetDocument, hash, css) { 8791 if (!targetDocument.head) { 8792 return; 8793 } 8794 const runtime = getRuntime2(); 8795 let injectedStyles = runtime.injectedStyles.get(targetDocument); 8796 if (!injectedStyles) { 8797 injectedStyles = /* @__PURE__ */ new Set(); 8798 runtime.injectedStyles.set(targetDocument, injectedStyles); 8799 } 8800 if (injectedStyles.has(hash)) { 8801 return; 8802 } 8803 if (documentContainsStyleHash2(targetDocument, hash)) { 8804 injectedStyles.add(hash); 8805 return; 8806 } 8807 const style = targetDocument.createElement("style"); 8808 style.setAttribute(STYLE_HASH_ATTRIBUTE2, hash); 8809 style.appendChild(targetDocument.createTextNode(css)); 8810 targetDocument.head.appendChild(style); 8811 injectedStyles.add(hash); 8812 } 8813 function registerDocument2(targetDocument) { 8814 const runtime = getRuntime2(); 8815 runtime.documents.set( 8816 targetDocument, 8817 (runtime.documents.get(targetDocument) ?? 0) + 1 8818 ); 8819 for (const [hash, css] of runtime.styles) { 8820 injectStyle2(targetDocument, hash, css); 8821 } 8822 return () => { 8823 const count = runtime.documents.get(targetDocument); 8824 if (count === void 0) { 8825 return; 8826 } 8827 if (count <= 1) { 8828 runtime.documents.delete(targetDocument); 8829 return; 8830 } 8831 runtime.documents.set(targetDocument, count - 1); 8832 }; 8833 } 8834 function registerStyle2(hash, css) { 8835 const runtime = getRuntime2(); 8836 runtime.styles.set(hash, css); 8837 for (const targetDocument of runtime.documents.keys()) { 8838 injectStyle2(targetDocument, hash, css); 8839 } 8840 } 8841 if (typeof process === "undefined" || true) { 8842 registerStyle2("32aba35fe1", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._19ce0419607e1896__stack{display:flex}}}"); 8843 } 8844 var style_default2 = { "stack": "_19ce0419607e1896__stack" }; 8845 var gapTokens = { 8846 xs: "var(--wpds-dimension-gap-xs, 4px)", 8847 sm: "var(--wpds-dimension-gap-sm, 8px)", 8848 md: "var(--wpds-dimension-gap-md, 12px)", 8849 lg: "var(--wpds-dimension-gap-lg, 16px)", 8850 xl: "var(--wpds-dimension-gap-xl, 24px)", 8851 "2xl": "var(--wpds-dimension-gap-2xl, 32px)", 8852 "3xl": "var(--wpds-dimension-gap-3xl, 40px)" 8853 }; 8854 var Stack = (0, import_element13.forwardRef)(function Stack2({ direction, gap, align, justify, wrap, render, ...props }, ref) { 8855 const style = { 8856 gap: gap && gapTokens[gap], 8857 alignItems: align, 8858 justifyContent: justify, 8859 flexDirection: direction, 8860 flexWrap: wrap 8861 }; 8862 const element = useRender({ 8863 render, 8864 ref, 8865 props: mergeProps(props, { style, className: style_default2.stack }) 8866 }); 8867 return element; 8868 }); 8869 8870 // packages/ui/build-module/tooltip/index.mjs 8871 var tooltip_exports = {}; 8872 __export(tooltip_exports, { 8873 Popup: () => Popup, 8874 Portal: () => Portal, 8875 Positioner: () => Positioner, 8876 Provider: () => Provider, 8877 Root: () => Root, 8878 Trigger: () => Trigger 8879 }); 8880 8881 // packages/ui/build-module/tooltip/popup.mjs 8882 var import_element16 = __toESM(require_element(), 1); 8883 8884 // packages/ui/build-module/tooltip/portal.mjs 8885 var import_element14 = __toESM(require_element(), 1); 8886 8887 // packages/ui/build-module/utils/wp-compat-overlay-slot.mjs 8888 var STYLE_HASH_ATTRIBUTE3 = "data-wp-hash"; 8889 function getRuntime3() { 8890 const globalScope = globalThis; 8891 if (globalScope.__wpStyleRuntime) { 8892 return globalScope.__wpStyleRuntime; 8893 } 8894 globalScope.__wpStyleRuntime = { 8895 documents: /* @__PURE__ */ new Map(), 8896 styles: /* @__PURE__ */ new Map(), 8897 injectedStyles: /* @__PURE__ */ new WeakMap() 8898 }; 8899 if (typeof document !== "undefined") { 8900 registerDocument3(document); 8901 } 8902 return globalScope.__wpStyleRuntime; 8903 } 8904 function documentContainsStyleHash3(targetDocument, hash) { 8905 if (!targetDocument.head) { 8906 return false; 8907 } 8908 for (const style of targetDocument.head.querySelectorAll( 8909 `style[$STYLE_HASH_ATTRIBUTE3}]` 8910 )) { 8911 if (style.getAttribute(STYLE_HASH_ATTRIBUTE3) === hash) { 8912 return true; 8913 } 8914 } 8915 return false; 8916 } 8917 function injectStyle3(targetDocument, hash, css) { 8918 if (!targetDocument.head) { 8919 return; 8920 } 8921 const runtime = getRuntime3(); 8922 let injectedStyles = runtime.injectedStyles.get(targetDocument); 8923 if (!injectedStyles) { 8924 injectedStyles = /* @__PURE__ */ new Set(); 8925 runtime.injectedStyles.set(targetDocument, injectedStyles); 8926 } 8927 if (injectedStyles.has(hash)) { 8928 return; 8929 } 8930 if (documentContainsStyleHash3(targetDocument, hash)) { 8931 injectedStyles.add(hash); 8932 return; 8933 } 8934 const style = targetDocument.createElement("style"); 8935 style.setAttribute(STYLE_HASH_ATTRIBUTE3, hash); 8936 style.appendChild(targetDocument.createTextNode(css)); 8937 targetDocument.head.appendChild(style); 8938 injectedStyles.add(hash); 8939 } 8940 function registerDocument3(targetDocument) { 8941 const runtime = getRuntime3(); 8942 runtime.documents.set( 8943 targetDocument, 8944 (runtime.documents.get(targetDocument) ?? 0) + 1 8945 ); 8946 for (const [hash, css] of runtime.styles) { 8947 injectStyle3(targetDocument, hash, css); 8948 } 8949 return () => { 8950 const count = runtime.documents.get(targetDocument); 8951 if (count === void 0) { 8952 return; 8953 } 8954 if (count <= 1) { 8955 runtime.documents.delete(targetDocument); 8956 return; 8957 } 8958 runtime.documents.set(targetDocument, count - 1); 8959 }; 8960 } 8961 function registerStyle3(hash, css) { 8962 const runtime = getRuntime3(); 8963 runtime.styles.set(hash, css); 8964 for (const targetDocument of runtime.documents.keys()) { 8965 injectStyle3(targetDocument, hash, css); 8966 } 8967 } 8968 if (typeof process === "undefined" || true) { 8969 registerStyle3("be37f31c1e", "._11fc52b637ff8a7e__slot{inset:0;isolation:isolate;pointer-events:none;position:fixed;z-index:1000000003}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._11fc52b637ff8a7e__slot>*{pointer-events:auto}}}"); 8970 } 8971 var wp_compat_overlay_slot_default = { "slot": "_11fc52b637ff8a7e__slot" }; 8972 var WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE = "data-wp-compat-overlay-slot"; 8973 function resolveOwnerDocument() { 8974 return typeof document === "undefined" ? null : document; 8975 } 8976 function isInWordPressEnvironment() { 8977 let topWp; 8978 try { 8979 topWp = window.top?.wp; 8980 } catch { 8981 } 8982 const wp = topWp ?? window.wp; 8983 return typeof wp?.components === "object" && wp.components !== null; 8984 } 8985 var cachedSlot = null; 8986 function ensureSlotIsAccessible(element) { 8987 element.setAttribute("aria-hidden", "false"); 8988 return element; 8989 } 8990 function createSlot(ownerDocument2) { 8991 const element = ownerDocument2.createElement("div"); 8992 element.setAttribute(WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE, ""); 8993 if (wp_compat_overlay_slot_default.slot) { 8994 element.classList.add(wp_compat_overlay_slot_default.slot); 8995 } 8996 ownerDocument2.body.appendChild(element); 8997 return element; 8998 } 8999 function getWpCompatOverlaySlot() { 9000 if (typeof window === "undefined") { 9001 return void 0; 9002 } 9003 if (!isInWordPressEnvironment() && window.__wpUiCompatOverlaySlotEnabled !== true) { 9004 return void 0; 9005 } 9006 const ownerDocument2 = resolveOwnerDocument(); 9007 if (!ownerDocument2 || !ownerDocument2.body) { 9008 return void 0; 9009 } 9010 if (cachedSlot && cachedSlot.ownerDocument === ownerDocument2 && cachedSlot.isConnected) { 9011 return ensureSlotIsAccessible(cachedSlot); 9012 } 9013 const existing = ownerDocument2.querySelector( 9014 `[$WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE}]` 9015 ); 9016 if (existing instanceof HTMLDivElement) { 9017 cachedSlot = ensureSlotIsAccessible(existing); 9018 return cachedSlot; 9019 } 9020 if (cachedSlot?.isConnected) { 9021 cachedSlot.remove(); 9022 } 9023 cachedSlot = ensureSlotIsAccessible(createSlot(ownerDocument2)); 9024 return cachedSlot; 9025 } 9026 9027 // packages/ui/build-module/tooltip/portal.mjs 9028 var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1); 9029 var Portal = (0, import_element14.forwardRef)( 9030 function TooltipPortal3({ container, ...restProps }, ref) { 9031 return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)( 9032 index_parts_exports.Portal, 9033 { 9034 container: container ?? getWpCompatOverlaySlot(), 9035 ...restProps, 9036 ref 9037 } 9038 ); 9039 } 9040 ); 9041 9042 // packages/ui/build-module/tooltip/positioner.mjs 9043 var import_element15 = __toESM(require_element(), 1); 9044 var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1); 9045 var STYLE_HASH_ATTRIBUTE4 = "data-wp-hash"; 9046 function getRuntime4() { 9047 const globalScope = globalThis; 9048 if (globalScope.__wpStyleRuntime) { 9049 return globalScope.__wpStyleRuntime; 9050 } 9051 globalScope.__wpStyleRuntime = { 9052 documents: /* @__PURE__ */ new Map(), 9053 styles: /* @__PURE__ */ new Map(), 9054 injectedStyles: /* @__PURE__ */ new WeakMap() 9055 }; 9056 if (typeof document !== "undefined") { 9057 registerDocument4(document); 9058 } 9059 return globalScope.__wpStyleRuntime; 9060 } 9061 function documentContainsStyleHash4(targetDocument, hash) { 9062 if (!targetDocument.head) { 9063 return false; 9064 } 9065 for (const style of targetDocument.head.querySelectorAll( 9066 `style[$STYLE_HASH_ATTRIBUTE4}]` 9067 )) { 9068 if (style.getAttribute(STYLE_HASH_ATTRIBUTE4) === hash) { 9069 return true; 9070 } 9071 } 9072 return false; 9073 } 9074 function injectStyle4(targetDocument, hash, css) { 9075 if (!targetDocument.head) { 9076 return; 9077 } 9078 const runtime = getRuntime4(); 9079 let injectedStyles = runtime.injectedStyles.get(targetDocument); 9080 if (!injectedStyles) { 9081 injectedStyles = /* @__PURE__ */ new Set(); 9082 runtime.injectedStyles.set(targetDocument, injectedStyles); 9083 } 9084 if (injectedStyles.has(hash)) { 9085 return; 9086 } 9087 if (documentContainsStyleHash4(targetDocument, hash)) { 9088 injectedStyles.add(hash); 9089 return; 9090 } 9091 const style = targetDocument.createElement("style"); 9092 style.setAttribute(STYLE_HASH_ATTRIBUTE4, hash); 9093 style.appendChild(targetDocument.createTextNode(css)); 9094 targetDocument.head.appendChild(style); 9095 injectedStyles.add(hash); 9096 } 9097 function registerDocument4(targetDocument) { 9098 const runtime = getRuntime4(); 9099 runtime.documents.set( 9100 targetDocument, 9101 (runtime.documents.get(targetDocument) ?? 0) + 1 9102 ); 9103 for (const [hash, css] of runtime.styles) { 9104 injectStyle4(targetDocument, hash, css); 9105 } 9106 return () => { 9107 const count = runtime.documents.get(targetDocument); 9108 if (count === void 0) { 9109 return; 9110 } 9111 if (count <= 1) { 9112 runtime.documents.delete(targetDocument); 9113 return; 9114 } 9115 runtime.documents.set(targetDocument, count - 1); 9116 }; 9117 } 9118 function registerStyle4(hash, css) { 9119 const runtime = getRuntime4(); 9120 runtime.styles.set(hash, css); 9121 for (const targetDocument of runtime.documents.keys()) { 9122 injectStyle4(targetDocument, hash, css); 9123 } 9124 } 9125 if (typeof process === "undefined" || true) { 9126 registerStyle4("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); 9127 } 9128 var resets_default = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; 9129 if (typeof process === "undefined" || true) { 9130 registerStyle4("19fcc06039", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._480b748dd3510e64__positioner{z-index:var(--wp-ui-tooltip-z-index,initial)}._50096b232db7709d__popup{--_wp-ui-elevation-sm:0 1px 2px rgba(0,0,0,.05),0 2px 3px rgba(0,0,0,.04),0 6px 6px rgba(0,0,0,.03),0 8px 8px rgba(0,0,0,.02);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-elevation-sm);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-sm,12px);line-height:1.4;padding:var(--wpds-dimension-padding-xs,4px) var(--wpds-dimension-padding-sm,8px);@media (forced-colors:active){border-bottom-color:CanvasText;border-bottom-style:solid;border-bottom-width:1px;border-left-color:CanvasText;border-left-style:solid;border-left-width:1px;border-right-color:CanvasText;border-right-style:solid;border-right-width:1px;border-top-color:CanvasText;border-top-style:solid;border-top-width:1px}}}}'); 9131 } 9132 var style_default3 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" }; 9133 var Positioner = (0, import_element15.forwardRef)( 9134 function TooltipPositioner3({ align = "center", className, side = "top", sideOffset = 4, ...props }, ref) { 9135 return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)( 9136 index_parts_exports.Positioner, 9137 { 9138 ref, 9139 align, 9140 side, 9141 sideOffset, 9142 ...props, 9143 className: clsx_default( 9144 resets_default["box-sizing"], 9145 style_default3.positioner, 9146 className 9147 ) 9148 } 9149 ); 9150 } 9151 ); 9152 9153 // packages/ui/build-module/tooltip/popup.mjs 9154 var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1); 9155 var STYLE_HASH_ATTRIBUTE5 = "data-wp-hash"; 9156 function getRuntime5() { 9157 const globalScope = globalThis; 9158 if (globalScope.__wpStyleRuntime) { 9159 return globalScope.__wpStyleRuntime; 9160 } 9161 globalScope.__wpStyleRuntime = { 9162 documents: /* @__PURE__ */ new Map(), 9163 styles: /* @__PURE__ */ new Map(), 9164 injectedStyles: /* @__PURE__ */ new WeakMap() 9165 }; 9166 if (typeof document !== "undefined") { 9167 registerDocument5(document); 9168 } 9169 return globalScope.__wpStyleRuntime; 9170 } 9171 function documentContainsStyleHash5(targetDocument, hash) { 9172 if (!targetDocument.head) { 9173 return false; 9174 } 9175 for (const style of targetDocument.head.querySelectorAll( 9176 `style[$STYLE_HASH_ATTRIBUTE5}]` 9177 )) { 9178 if (style.getAttribute(STYLE_HASH_ATTRIBUTE5) === hash) { 9179 return true; 9180 } 9181 } 9182 return false; 9183 } 9184 function injectStyle5(targetDocument, hash, css) { 9185 if (!targetDocument.head) { 9186 return; 9187 } 9188 const runtime = getRuntime5(); 9189 let injectedStyles = runtime.injectedStyles.get(targetDocument); 9190 if (!injectedStyles) { 9191 injectedStyles = /* @__PURE__ */ new Set(); 9192 runtime.injectedStyles.set(targetDocument, injectedStyles); 9193 } 9194 if (injectedStyles.has(hash)) { 9195 return; 9196 } 9197 if (documentContainsStyleHash5(targetDocument, hash)) { 9198 injectedStyles.add(hash); 9199 return; 9200 } 9201 const style = targetDocument.createElement("style"); 9202 style.setAttribute(STYLE_HASH_ATTRIBUTE5, hash); 9203 style.appendChild(targetDocument.createTextNode(css)); 9204 targetDocument.head.appendChild(style); 9205 injectedStyles.add(hash); 9206 } 9207 function registerDocument5(targetDocument) { 9208 const runtime = getRuntime5(); 9209 runtime.documents.set( 9210 targetDocument, 9211 (runtime.documents.get(targetDocument) ?? 0) + 1 9212 ); 9213 for (const [hash, css] of runtime.styles) { 9214 injectStyle5(targetDocument, hash, css); 9215 } 9216 return () => { 9217 const count = runtime.documents.get(targetDocument); 9218 if (count === void 0) { 9219 return; 9220 } 9221 if (count <= 1) { 9222 runtime.documents.delete(targetDocument); 9223 return; 9224 } 9225 runtime.documents.set(targetDocument, count - 1); 9226 }; 9227 } 9228 function registerStyle5(hash, css) { 9229 const runtime = getRuntime5(); 9230 runtime.styles.set(hash, css); 9231 for (const targetDocument of runtime.documents.keys()) { 9232 injectStyle5(targetDocument, hash, css); 9233 } 9234 } 9235 if (typeof process === "undefined" || true) { 9236 registerStyle5("19fcc06039", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._480b748dd3510e64__positioner{z-index:var(--wp-ui-tooltip-z-index,initial)}._50096b232db7709d__popup{--_wp-ui-elevation-sm:0 1px 2px rgba(0,0,0,.05),0 2px 3px rgba(0,0,0,.04),0 6px 6px rgba(0,0,0,.03),0 8px 8px rgba(0,0,0,.02);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-elevation-sm);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-sm,12px);line-height:1.4;padding:var(--wpds-dimension-padding-xs,4px) var(--wpds-dimension-padding-sm,8px);@media (forced-colors:active){border-bottom-color:CanvasText;border-bottom-style:solid;border-bottom-width:1px;border-left-color:CanvasText;border-left-style:solid;border-left-width:1px;border-right-color:CanvasText;border-right-style:solid;border-right-width:1px;border-top-color:CanvasText;border-top-style:solid;border-top-width:1px}}}}'); 9237 } 9238 var style_default4 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" }; 9239 var POPUP_COLOR = { background: "#1e1e1e" }; 9240 var Popup = (0, import_element16.forwardRef)(function TooltipPopup3({ portal, positioner, children, className, ...props }, ref) { 9241 const popupContent = /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ThemeProvider, { color: POPUP_COLOR, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)( 9242 index_parts_exports.Popup, 9243 { 9244 ref, 9245 className: clsx_default(style_default4.popup, className), 9246 ...props, 9247 children 9248 } 9249 ) }); 9250 const positionedPopup = renderSlotWithChildren( 9251 positioner, 9252 /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Positioner, {}), 9253 popupContent 9254 ); 9255 return renderSlotWithChildren(portal, /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Portal, {}), positionedPopup); 9256 }); 9257 9258 // packages/ui/build-module/tooltip/trigger.mjs 9259 var import_element17 = __toESM(require_element(), 1); 9260 var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1); 9261 var Trigger = (0, import_element17.forwardRef)( 9262 function TooltipTrigger3(props, ref) { 9263 return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(index_parts_exports.Trigger, { ref, ...props }); 9264 } 9265 ); 9266 9267 // packages/ui/build-module/tooltip/root.mjs 9268 var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1); 9269 function Root(props) { 9270 return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(index_parts_exports.Root, { ...props }); 9271 } 9272 9273 // packages/ui/build-module/tooltip/provider.mjs 9274 var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1); 9275 function Provider({ ...props }) { 9276 return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(index_parts_exports.Provider, { ...props }); 9277 } 9278 9279 // packages/ui/build-module/skeleton/skeleton.mjs 9280 var import_element18 = __toESM(require_element(), 1); 9281 var STYLE_HASH_ATTRIBUTE6 = "data-wp-hash"; 9282 function getRuntime6() { 9283 const globalScope = globalThis; 9284 if (globalScope.__wpStyleRuntime) { 9285 return globalScope.__wpStyleRuntime; 9286 } 9287 globalScope.__wpStyleRuntime = { 9288 documents: /* @__PURE__ */ new Map(), 9289 styles: /* @__PURE__ */ new Map(), 9290 injectedStyles: /* @__PURE__ */ new WeakMap() 9291 }; 9292 if (typeof document !== "undefined") { 9293 registerDocument6(document); 9294 } 9295 return globalScope.__wpStyleRuntime; 9296 } 9297 function documentContainsStyleHash6(targetDocument, hash) { 9298 if (!targetDocument.head) { 9299 return false; 9300 } 9301 for (const style of targetDocument.head.querySelectorAll( 9302 `style[$STYLE_HASH_ATTRIBUTE6}]` 9303 )) { 9304 if (style.getAttribute(STYLE_HASH_ATTRIBUTE6) === hash) { 9305 return true; 9306 } 9307 } 9308 return false; 9309 } 9310 function injectStyle6(targetDocument, hash, css) { 9311 if (!targetDocument.head) { 9312 return; 9313 } 9314 const runtime = getRuntime6(); 9315 let injectedStyles = runtime.injectedStyles.get(targetDocument); 9316 if (!injectedStyles) { 9317 injectedStyles = /* @__PURE__ */ new Set(); 9318 runtime.injectedStyles.set(targetDocument, injectedStyles); 9319 } 9320 if (injectedStyles.has(hash)) { 9321 return; 9322 } 9323 if (documentContainsStyleHash6(targetDocument, hash)) { 9324 injectedStyles.add(hash); 9325 return; 9326 } 9327 const style = targetDocument.createElement("style"); 9328 style.setAttribute(STYLE_HASH_ATTRIBUTE6, hash); 9329 style.appendChild(targetDocument.createTextNode(css)); 9330 targetDocument.head.appendChild(style); 9331 injectedStyles.add(hash); 9332 } 9333 function registerDocument6(targetDocument) { 9334 const runtime = getRuntime6(); 9335 runtime.documents.set( 9336 targetDocument, 9337 (runtime.documents.get(targetDocument) ?? 0) + 1 9338 ); 9339 for (const [hash, css] of runtime.styles) { 9340 injectStyle6(targetDocument, hash, css); 9341 } 9342 return () => { 9343 const count = runtime.documents.get(targetDocument); 9344 if (count === void 0) { 9345 return; 9346 } 9347 if (count <= 1) { 9348 runtime.documents.delete(targetDocument); 9349 return; 9350 } 9351 runtime.documents.set(targetDocument, count - 1); 9352 }; 9353 } 9354 function registerStyle6(hash, css) { 9355 const runtime = getRuntime6(); 9356 runtime.styles.set(hash, css); 9357 for (const targetDocument of runtime.documents.keys()) { 9358 injectStyle6(targetDocument, hash, css); 9359 } 9360 } 9361 if (typeof process === "undefined" || true) { 9362 registerStyle6("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); 9363 } 9364 var resets_default2 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; 9365 if (typeof process === "undefined" || true) { 9366 registerStyle6("ed2c39ec90", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.b20cc1690085c2f0__skeleton{background-color:var(--wpds-color-background-surface-neutral-weak,#f4f4f4);display:block;@media (forced-colors:active){border:var(--wpds-border-width-xs,1px) solid CanvasText}}._9b143194fdb45f93__pulse{@media not (prefers-reduced-motion){animation:e2b9fe0690281bc8__skeleton-pulse 1.5s ease-in-out infinite}}@keyframes e2b9fe0690281bc8__skeleton-pulse{0%,to{opacity:1}50%{opacity:.4}}}}"); 9367 } 9368 var style_default5 = { "skeleton": "b20cc1690085c2f0__skeleton", "pulse": "_9b143194fdb45f93__pulse", "skeleton-pulse": "e2b9fe0690281bc8__skeleton-pulse" }; 9369 var Skeleton = (0, import_element18.forwardRef)( 9370 function Skeleton2({ render, ...props }, ref) { 9371 return useRender({ 9372 render, 9373 ref, 9374 props: mergeProps( 9375 { 9376 className: clsx_default( 9377 style_default5.skeleton, 9378 style_default5.pulse, 9379 resets_default2["box-sizing"] 9380 ), 9381 // Decorative by default; consumers mark the loading 9382 // region with aria-busy / role="status". 9383 "aria-hidden": true 9384 }, 9385 props 9386 ) 9387 }); 9388 } 9389 ); 9390 9391 // packages/admin-ui/build-module/navigable-region/index.mjs 9392 var import_element19 = __toESM(require_element(), 1); 9393 var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1); 9394 var NavigableRegion = (0, import_element19.forwardRef)( 9395 ({ children, className, ariaLabel, as: Tag = "div", ...props }, ref) => { 9396 return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)( 9397 Tag, 9398 { 9399 ref, 9400 className: clsx_default("admin-ui-navigable-region", className), 9401 "aria-label": ariaLabel, 9402 role: "region", 9403 tabIndex: "-1", 9404 ...props, 9405 children 9406 } 9407 ); 9408 } 9409 ); 9410 NavigableRegion.displayName = "NavigableRegion"; 9411 var navigable_region_default = NavigableRegion; 9412 9413 // packages/admin-ui/build-module/page/sidebar-toggle-slot.mjs 9414 var import_components = __toESM(require_components(), 1); 9415 var { Fill: SidebarToggleFill, Slot: SidebarToggleSlot } = (0, import_components.createSlotFill)("SidebarToggle"); 9416 9417 // packages/admin-ui/build-module/page/header.mjs 9418 var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1); 9419 var STYLE_HASH_ATTRIBUTE7 = "data-wp-hash"; 9420 function getRuntime7() { 9421 const globalScope = globalThis; 9422 if (globalScope.__wpStyleRuntime) { 9423 return globalScope.__wpStyleRuntime; 9424 } 9425 globalScope.__wpStyleRuntime = { 9426 documents: /* @__PURE__ */ new Map(), 9427 styles: /* @__PURE__ */ new Map(), 9428 injectedStyles: /* @__PURE__ */ new WeakMap() 9429 }; 9430 if (typeof document !== "undefined") { 9431 registerDocument7(document); 9432 } 9433 return globalScope.__wpStyleRuntime; 9434 } 9435 function documentContainsStyleHash7(targetDocument, hash) { 9436 if (!targetDocument.head) { 9437 return false; 9438 } 9439 for (const style of targetDocument.head.querySelectorAll( 9440 `style[$STYLE_HASH_ATTRIBUTE7}]` 9441 )) { 9442 if (style.getAttribute(STYLE_HASH_ATTRIBUTE7) === hash) { 9443 return true; 9444 } 9445 } 9446 return false; 9447 } 9448 function injectStyle7(targetDocument, hash, css) { 9449 if (!targetDocument.head) { 9450 return; 9451 } 9452 const runtime = getRuntime7(); 9453 let injectedStyles = runtime.injectedStyles.get(targetDocument); 9454 if (!injectedStyles) { 9455 injectedStyles = /* @__PURE__ */ new Set(); 9456 runtime.injectedStyles.set(targetDocument, injectedStyles); 9457 } 9458 if (injectedStyles.has(hash)) { 9459 return; 9460 } 9461 if (documentContainsStyleHash7(targetDocument, hash)) { 9462 injectedStyles.add(hash); 9463 return; 9464 } 9465 const style = targetDocument.createElement("style"); 9466 style.setAttribute(STYLE_HASH_ATTRIBUTE7, hash); 9467 style.appendChild(targetDocument.createTextNode(css)); 9468 targetDocument.head.appendChild(style); 9469 injectedStyles.add(hash); 9470 } 9471 function registerDocument7(targetDocument) { 9472 const runtime = getRuntime7(); 9473 runtime.documents.set( 9474 targetDocument, 9475 (runtime.documents.get(targetDocument) ?? 0) + 1 9476 ); 9477 for (const [hash, css] of runtime.styles) { 9478 injectStyle7(targetDocument, hash, css); 9479 } 9480 return () => { 9481 const count = runtime.documents.get(targetDocument); 9482 if (count === void 0) { 9483 return; 9484 } 9485 if (count <= 1) { 9486 runtime.documents.delete(targetDocument); 9487 return; 9488 } 9489 runtime.documents.set(targetDocument, count - 1); 9490 }; 9491 } 9492 function registerStyle7(hash, css) { 9493 const runtime = getRuntime7(); 9494 runtime.styles.set(hash, css); 9495 for (const targetDocument of runtime.documents.keys()) { 9496 injectStyle7(targetDocument, hash, css); 9497 } 9498 } 9499 if (typeof process === "undefined" || true) { 9500 registerStyle7("ddd9aab364", "._956b6df0898efed0__page{text-wrap:pretty;background-color:var(--wpds-color-background-surface-neutral,#fcfcfc);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);display:flex;flex-flow:column;height:100%;position:relative;z-index:1}._0625b55e82a0d93d__header{background:var(--wpds-color-background-surface-neutral-strong,#fff);border-block-end:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);inset-block-start:0;padding:var(--wpds-dimension-padding-lg,16px) var(--wpds-dimension-padding-2xl,24px);position:sticky;z-index:1}.a43c44d5ae28b2e8__header-content{min-height:var(--wpds-dimension-size-md,32px)}.b7cb5b9daf3a3b25__header-actions{flex-shrink:0}._8113be94e7caf73c__header-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._9a776c7f70996f61__header-visual{display:grid;flex-shrink:0;grid-template-columns:1fr;grid-template-rows:1fr;height:var(--wpds-dimension-size-sm,24px);width:var(--wpds-dimension-size-sm,24px);>*{grid-column:1/-1;grid-row:1/-1;max-height:100%;max-width:100%}}.d5e0920cd15d35bc__sidebar-toggle-slot:empty{display:none}._60fea2f6bf5319cd__header-subtitle{color:var(--wpds-color-foreground-content-neutral-weak,#707070);padding-block-end:var(--wpds-dimension-padding-xs,4px)}.be5e57d029ec4036__content{display:flex;flex-direction:column;flex-grow:1;overflow:auto;&._128806d0b26e3a50__has-padding{padding:var(--wpds-dimension-padding-lg,16px) var(--wpds-dimension-padding-2xl,24px)}}"); 9501 } 9502 var style_default6 = { "page": "_956b6df0898efed0__page", "header": "_0625b55e82a0d93d__header", "header-content": "a43c44d5ae28b2e8__header-content", "header-actions": "b7cb5b9daf3a3b25__header-actions", "header-title": "_8113be94e7caf73c__header-title", "header-visual": "_9a776c7f70996f61__header-visual", "sidebar-toggle-slot": "d5e0920cd15d35bc__sidebar-toggle-slot", "header-subtitle": "_60fea2f6bf5319cd__header-subtitle", "content": "be5e57d029ec4036__content", "has-padding": "_128806d0b26e3a50__has-padding" }; 9503 function Header({ 9504 headingLevel = 1, 9505 breadcrumbs, 9506 badges, 9507 visual, 9508 title, 9509 subTitle, 9510 actions, 9511 showSidebarToggle = true 9512 }) { 9513 const HeadingTag = `h$headingLevel}`; 9514 return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(Stack, { direction: "column", className: style_default6.header, children: [ 9515 /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)( 9516 Stack, 9517 { 9518 className: style_default6["header-content"], 9519 direction: "row", 9520 gap: "sm", 9521 justify: "space-between", 9522 children: [ 9523 /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(Stack, { direction: "row", gap: "sm", align: "center", justify: "start", children: [ 9524 showSidebarToggle && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)( 9525 SidebarToggleSlot, 9526 { 9527 bubblesVirtually: true, 9528 className: style_default6["sidebar-toggle-slot"] 9529 } 9530 ), 9531 visual && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)( 9532 "div", 9533 { 9534 className: style_default6["header-visual"], 9535 "aria-hidden": "true", 9536 children: visual 9537 } 9538 ), 9539 title && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)( 9540 Text, 9541 { 9542 className: style_default6["header-title"], 9543 render: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(HeadingTag, {}), 9544 variant: "heading-lg", 9545 children: title 9546 } 9547 ), 9548 breadcrumbs, 9549 badges 9550 ] }), 9551 actions && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)( 9552 Stack, 9553 { 9554 align: "center", 9555 className: style_default6["header-actions"], 9556 direction: "row", 9557 gap: "sm", 9558 children: actions 9559 } 9560 ) 9561 ] 9562 } 9563 ), 9564 subTitle && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)( 9565 Text, 9566 { 9567 render: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", {}), 9568 variant: "body-md", 9569 className: style_default6["header-subtitle"], 9570 children: subTitle 9571 } 9572 ) 9573 ] }); 9574 } 9575 9576 // packages/admin-ui/build-module/page/index.mjs 9577 var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1); 9578 var STYLE_HASH_ATTRIBUTE8 = "data-wp-hash"; 9579 function getRuntime8() { 9580 const globalScope = globalThis; 9581 if (globalScope.__wpStyleRuntime) { 9582 return globalScope.__wpStyleRuntime; 9583 } 9584 globalScope.__wpStyleRuntime = { 9585 documents: /* @__PURE__ */ new Map(), 9586 styles: /* @__PURE__ */ new Map(), 9587 injectedStyles: /* @__PURE__ */ new WeakMap() 9588 }; 9589 if (typeof document !== "undefined") { 9590 registerDocument8(document); 9591 } 9592 return globalScope.__wpStyleRuntime; 9593 } 9594 function documentContainsStyleHash8(targetDocument, hash) { 9595 if (!targetDocument.head) { 9596 return false; 9597 } 9598 for (const style of targetDocument.head.querySelectorAll( 9599 `style[$STYLE_HASH_ATTRIBUTE8}]` 9600 )) { 9601 if (style.getAttribute(STYLE_HASH_ATTRIBUTE8) === hash) { 9602 return true; 9603 } 9604 } 9605 return false; 9606 } 9607 function injectStyle8(targetDocument, hash, css) { 9608 if (!targetDocument.head) { 9609 return; 9610 } 9611 const runtime = getRuntime8(); 9612 let injectedStyles = runtime.injectedStyles.get(targetDocument); 9613 if (!injectedStyles) { 9614 injectedStyles = /* @__PURE__ */ new Set(); 9615 runtime.injectedStyles.set(targetDocument, injectedStyles); 9616 } 9617 if (injectedStyles.has(hash)) { 9618 return; 9619 } 9620 if (documentContainsStyleHash8(targetDocument, hash)) { 9621 injectedStyles.add(hash); 9622 return; 9623 } 9624 const style = targetDocument.createElement("style"); 9625 style.setAttribute(STYLE_HASH_ATTRIBUTE8, hash); 9626 style.appendChild(targetDocument.createTextNode(css)); 9627 targetDocument.head.appendChild(style); 9628 injectedStyles.add(hash); 9629 } 9630 function registerDocument8(targetDocument) { 9631 const runtime = getRuntime8(); 9632 runtime.documents.set( 9633 targetDocument, 9634 (runtime.documents.get(targetDocument) ?? 0) + 1 9635 ); 9636 for (const [hash, css] of runtime.styles) { 9637 injectStyle8(targetDocument, hash, css); 9638 } 9639 return () => { 9640 const count = runtime.documents.get(targetDocument); 9641 if (count === void 0) { 9642 return; 9643 } 9644 if (count <= 1) { 9645 runtime.documents.delete(targetDocument); 9646 return; 9647 } 9648 runtime.documents.set(targetDocument, count - 1); 9649 }; 9650 } 9651 function registerStyle8(hash, css) { 9652 const runtime = getRuntime8(); 9653 runtime.styles.set(hash, css); 9654 for (const targetDocument of runtime.documents.keys()) { 9655 injectStyle8(targetDocument, hash, css); 9656 } 9657 } 9658 if (typeof process === "undefined" || true) { 9659 registerStyle8("ddd9aab364", "._956b6df0898efed0__page{text-wrap:pretty;background-color:var(--wpds-color-background-surface-neutral,#fcfcfc);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);display:flex;flex-flow:column;height:100%;position:relative;z-index:1}._0625b55e82a0d93d__header{background:var(--wpds-color-background-surface-neutral-strong,#fff);border-block-end:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);inset-block-start:0;padding:var(--wpds-dimension-padding-lg,16px) var(--wpds-dimension-padding-2xl,24px);position:sticky;z-index:1}.a43c44d5ae28b2e8__header-content{min-height:var(--wpds-dimension-size-md,32px)}.b7cb5b9daf3a3b25__header-actions{flex-shrink:0}._8113be94e7caf73c__header-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._9a776c7f70996f61__header-visual{display:grid;flex-shrink:0;grid-template-columns:1fr;grid-template-rows:1fr;height:var(--wpds-dimension-size-sm,24px);width:var(--wpds-dimension-size-sm,24px);>*{grid-column:1/-1;grid-row:1/-1;max-height:100%;max-width:100%}}.d5e0920cd15d35bc__sidebar-toggle-slot:empty{display:none}._60fea2f6bf5319cd__header-subtitle{color:var(--wpds-color-foreground-content-neutral-weak,#707070);padding-block-end:var(--wpds-dimension-padding-xs,4px)}.be5e57d029ec4036__content{display:flex;flex-direction:column;flex-grow:1;overflow:auto;&._128806d0b26e3a50__has-padding{padding:var(--wpds-dimension-padding-lg,16px) var(--wpds-dimension-padding-2xl,24px)}}"); 9660 } 9661 var style_default7 = { "page": "_956b6df0898efed0__page", "header": "_0625b55e82a0d93d__header", "header-content": "a43c44d5ae28b2e8__header-content", "header-actions": "b7cb5b9daf3a3b25__header-actions", "header-title": "_8113be94e7caf73c__header-title", "header-visual": "_9a776c7f70996f61__header-visual", "sidebar-toggle-slot": "d5e0920cd15d35bc__sidebar-toggle-slot", "header-subtitle": "_60fea2f6bf5319cd__header-subtitle", "content": "be5e57d029ec4036__content", "has-padding": "_128806d0b26e3a50__has-padding" }; 9662 function Page({ 9663 headingLevel, 9664 breadcrumbs, 9665 badges, 9666 visual, 9667 title, 9668 subTitle, 9669 children, 9670 className, 9671 actions, 9672 ariaLabel, 9673 hasPadding = false, 9674 showSidebarToggle = true 9675 }) { 9676 const classes = clsx_default(style_default7.page, className); 9677 const effectiveAriaLabel = ariaLabel ?? (typeof title === "string" ? title : ""); 9678 return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(navigable_region_default, { className: classes, ariaLabel: effectiveAriaLabel, children: [ 9679 (title || breadcrumbs || badges || actions || visual) && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)( 9680 Header, 9681 { 9682 headingLevel, 9683 breadcrumbs, 9684 badges, 9685 visual, 9686 title, 9687 subTitle, 9688 actions, 9689 showSidebarToggle 9690 } 9691 ), 9692 hasPadding ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)( 9693 "div", 9694 { 9695 className: clsx_default( 9696 style_default7.content, 9697 style_default7["has-padding"] 9698 ), 9699 children 9700 } 9701 ) : children 9702 ] }); 9703 } 9704 Page.SidebarToggleFill = SidebarToggleFill; 9705 var page_default = Page; 9706 9707 // routes/font-list/stage.tsx 9708 var import_i18n47 = __toESM(require_i18n()); 9709 var import_components60 = __toESM(require_components()); 9710 var import_editor = __toESM(require_editor()); 9711 var import_core_data12 = __toESM(require_core_data()); 9712 var import_data13 = __toESM(require_data()); 9713 var import_element52 = __toESM(require_element()); 9714 9715 // packages/global-styles-ui/build-module/global-styles-ui.mjs 9716 var import_components59 = __toESM(require_components(), 1); 9717 var import_blocks5 = __toESM(require_blocks(), 1); 9718 var import_data12 = __toESM(require_data(), 1); 9719 var import_block_editor14 = __toESM(require_block_editor(), 1); 9720 var import_element51 = __toESM(require_element(), 1); 9721 var import_compose6 = __toESM(require_compose(), 1); 9722 9723 // packages/global-styles-engine/build-module/utils/object.mjs 9724 function setImmutably(object, path, value) { 9725 path = Array.isArray(path) ? [...path] : [path]; 9726 object = Array.isArray(object) ? [...object] : { ...object }; 9727 const leaf = path.pop(); 9728 let prev = object; 9729 for (const key of path) { 9730 const lvl = prev[key]; 9731 prev = prev[key] = Array.isArray(lvl) ? [...lvl] : { ...lvl }; 9732 } 9733 prev[leaf] = value; 9734 return object; 9735 } 9736 var getValueFromObjectPath = (object, path, defaultValue) => { 9737 const arrayPath = Array.isArray(path) ? path : path.split("."); 9738 let value = object; 9739 arrayPath.forEach((fieldName) => { 9740 value = value?.[fieldName]; 9741 }); 9742 return value ?? defaultValue; 9743 }; 9744 9745 // packages/global-styles-engine/build-module/settings/get-setting.mjs 9746 var VALID_SETTINGS = [ 9747 "appearanceTools", 9748 "useRootPaddingAwareAlignments", 9749 "background.backgroundImage", 9750 "background.backgroundRepeat", 9751 "background.backgroundSize", 9752 "background.backgroundPosition", 9753 "background.gradient", 9754 "border.color", 9755 "border.radius", 9756 "border.radiusSizes", 9757 "border.style", 9758 "border.width", 9759 "shadow.presets", 9760 "shadow.defaultPresets", 9761 "color.background", 9762 "color.button", 9763 "color.caption", 9764 "color.custom", 9765 "color.customDuotone", 9766 "color.customGradient", 9767 "color.defaultDuotone", 9768 "color.defaultGradients", 9769 "color.defaultPalette", 9770 "color.duotone", 9771 "color.gradients", 9772 "color.heading", 9773 "color.link", 9774 "color.palette", 9775 "color.text", 9776 "custom", 9777 "dimensions.aspectRatio", 9778 "dimensions.height", 9779 "dimensions.minHeight", 9780 "dimensions.minWidth", 9781 "dimensions.width", 9782 "dimensions.dimensionSizes", 9783 "layout.contentSize", 9784 "layout.definitions", 9785 "layout.wideSize", 9786 "lightbox.enabled", 9787 "lightbox.allowEditing", 9788 "position.fixed", 9789 "position.sticky", 9790 "spacing.customSpacingSize", 9791 "spacing.defaultSpacingSizes", 9792 "spacing.spacingSizes", 9793 "spacing.spacingScale", 9794 "spacing.blockGap", 9795 "spacing.margin", 9796 "spacing.padding", 9797 "spacing.units", 9798 "typography.fluid", 9799 "typography.customFontSize", 9800 "typography.defaultFontSizes", 9801 "typography.dropCap", 9802 "typography.fontFamilies", 9803 "typography.fontSizes", 9804 "typography.fontStyle", 9805 "typography.fontWeight", 9806 "typography.letterSpacing", 9807 "typography.lineHeight", 9808 "typography.textAlign", 9809 "typography.textColumns", 9810 "typography.textDecoration", 9811 "typography.textIndent", 9812 "typography.textTransform", 9813 "typography.writingMode", 9814 "viewport.mobile", 9815 "viewport.tablet" 9816 ]; 9817 function getSetting(globalStyles, path, blockName) { 9818 const appendedBlockPath = blockName ? ".blocks." + blockName : ""; 9819 const appendedPropertyPath = path ? "." + path : ""; 9820 const contextualPath = `settings$appendedBlockPath}$appendedPropertyPath}`; 9821 const globalPath = `settings$appendedPropertyPath}`; 9822 if (path) { 9823 return getValueFromObjectPath(globalStyles, contextualPath) ?? getValueFromObjectPath(globalStyles, globalPath); 9824 } 9825 let result = {}; 9826 VALID_SETTINGS.forEach((setting) => { 9827 const value = getValueFromObjectPath( 9828 globalStyles, 9829 `settings$appendedBlockPath}.$setting}` 9830 ) ?? getValueFromObjectPath(globalStyles, `settings.$setting}`); 9831 if (value !== void 0) { 9832 result = setImmutably(result, setting.split("."), value); 9833 } 9834 }); 9835 return result; 9836 } 9837 9838 // packages/global-styles-engine/build-module/settings/set-setting.mjs 9839 function setSetting(globalStyles, path, newValue, blockName) { 9840 const appendedBlockPath = blockName ? ".blocks." + blockName : ""; 9841 const appendedPropertyPath = path ? "." + path : ""; 9842 const finalPath = `settings$appendedBlockPath}$appendedPropertyPath}`; 9843 return setImmutably( 9844 globalStyles, 9845 finalPath.split("."), 9846 newValue 9847 ); 9848 } 9849 9850 // packages/global-styles-engine/build-module/utils/common.mjs 9851 var import_style_engine = __toESM(require_style_engine(), 1); 9852 9853 // packages/global-styles-engine/build-module/utils/fluid.mjs 9854 var DEFAULT_MAXIMUM_VIEWPORT_WIDTH = "1600px"; 9855 var DEFAULT_MINIMUM_VIEWPORT_WIDTH = "320px"; 9856 var DEFAULT_SCALE_FACTOR = 1; 9857 var DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MIN = 0.25; 9858 var DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MAX = 0.75; 9859 var DEFAULT_MINIMUM_FONT_SIZE_LIMIT = "14px"; 9860 function getComputedFluidTypographyValue({ 9861 minimumFontSize, 9862 maximumFontSize, 9863 fontSize, 9864 minimumViewportWidth = DEFAULT_MINIMUM_VIEWPORT_WIDTH, 9865 maximumViewportWidth = DEFAULT_MAXIMUM_VIEWPORT_WIDTH, 9866 scaleFactor = DEFAULT_SCALE_FACTOR, 9867 minimumFontSizeLimit 9868 }) { 9869 minimumFontSizeLimit = !!getTypographyValueAndUnit(minimumFontSizeLimit) ? minimumFontSizeLimit : DEFAULT_MINIMUM_FONT_SIZE_LIMIT; 9870 if (fontSize) { 9871 const fontSizeParsed = getTypographyValueAndUnit(fontSize); 9872 if (!fontSizeParsed?.unit || !fontSizeParsed?.value) { 9873 return null; 9874 } 9875 const minimumFontSizeLimitParsed = getTypographyValueAndUnit( 9876 minimumFontSizeLimit, 9877 { 9878 coerceTo: fontSizeParsed.unit 9879 } 9880 ); 9881 if (!!minimumFontSizeLimitParsed?.value && !minimumFontSize && !maximumFontSize) { 9882 if (fontSizeParsed?.value <= minimumFontSizeLimitParsed?.value) { 9883 return null; 9884 } 9885 } 9886 if (!maximumFontSize) { 9887 maximumFontSize = `$fontSizeParsed.value}$fontSizeParsed.unit}`; 9888 } 9889 if (!minimumFontSize) { 9890 const fontSizeValueInPx = fontSizeParsed.unit === "px" ? fontSizeParsed.value : fontSizeParsed.value * 16; 9891 const minimumFontSizeFactor = Math.min( 9892 Math.max( 9893 1 - 0.075 * Math.log2(fontSizeValueInPx), 9894 DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MIN 9895 ), 9896 DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MAX 9897 ); 9898 const calculatedMinimumFontSize = roundToPrecision( 9899 fontSizeParsed.value * minimumFontSizeFactor, 9900 3 9901 ); 9902 if (!!minimumFontSizeLimitParsed?.value && calculatedMinimumFontSize < minimumFontSizeLimitParsed?.value) { 9903 minimumFontSize = `$minimumFontSizeLimitParsed.value}$minimumFontSizeLimitParsed.unit}`; 9904 } else { 9905 minimumFontSize = `$calculatedMinimumFontSize}$fontSizeParsed.unit}`; 9906 } 9907 } 9908 } 9909 const minimumFontSizeParsed = getTypographyValueAndUnit(minimumFontSize); 9910 const fontSizeUnit = minimumFontSizeParsed?.unit || "rem"; 9911 const maximumFontSizeParsed = getTypographyValueAndUnit(maximumFontSize, { 9912 coerceTo: fontSizeUnit 9913 }); 9914 if (!minimumFontSizeParsed || !maximumFontSizeParsed) { 9915 return null; 9916 } 9917 const minimumFontSizeRem = getTypographyValueAndUnit(minimumFontSize, { 9918 coerceTo: "rem" 9919 }); 9920 const maximumViewportWidthParsed = getTypographyValueAndUnit( 9921 maximumViewportWidth, 9922 { coerceTo: fontSizeUnit } 9923 ); 9924 const minimumViewportWidthParsed = getTypographyValueAndUnit( 9925 minimumViewportWidth, 9926 { coerceTo: fontSizeUnit } 9927 ); 9928 if (!maximumViewportWidthParsed || !minimumViewportWidthParsed || !minimumFontSizeRem) { 9929 return null; 9930 } 9931 const linearDenominator = maximumViewportWidthParsed.value - minimumViewportWidthParsed.value; 9932 if (!linearDenominator) { 9933 return null; 9934 } 9935 const minViewportWidthOffsetValue = roundToPrecision( 9936 minimumViewportWidthParsed.value / 100, 9937 3 9938 ); 9939 const viewportWidthOffset = roundToPrecision(minViewportWidthOffsetValue, 3) + fontSizeUnit; 9940 const linearFactor = 100 * ((maximumFontSizeParsed.value - minimumFontSizeParsed.value) / linearDenominator); 9941 const linearFactorScaled = roundToPrecision( 9942 (linearFactor || 1) * scaleFactor, 9943 3 9944 ); 9945 const fluidTargetFontSize = `$minimumFontSizeRem.value}$minimumFontSizeRem.unit} + ((1vw - $viewportWidthOffset}) * $linearFactorScaled})`; 9946 return `clamp($minimumFontSize}, $fluidTargetFontSize}, $maximumFontSize})`; 9947 } 9948 function getTypographyValueAndUnit(rawValue, options = {}) { 9949 if (typeof rawValue !== "string" && typeof rawValue !== "number") { 9950 return null; 9951 } 9952 if (isFinite(rawValue)) { 9953 rawValue = `$rawValue}px`; 9954 } 9955 const { coerceTo, rootSizeValue, acceptableUnits } = { 9956 coerceTo: "", 9957 // Default browser font size. Later we could inject some JS to compute this `getComputedStyle( document.querySelector( "html" ) ).fontSize`. 9958 rootSizeValue: 16, 9959 acceptableUnits: ["rem", "px", "em"], 9960 ...options 9961 }; 9962 const acceptableUnitsGroup = acceptableUnits?.join("|"); 9963 const regexUnits = new RegExp( 9964 `^(\\d*\\.?\\d+)($acceptableUnitsGroup}){1,1}$` 9965 ); 9966 const matches = rawValue.toString().match(regexUnits); 9967 if (!matches || matches.length < 3) { 9968 return null; 9969 } 9970 let [, value, unit] = matches; 9971 let returnValue = parseFloat(value); 9972 if ("px" === coerceTo && ("em" === unit || "rem" === unit)) { 9973 returnValue = returnValue * rootSizeValue; 9974 unit = coerceTo; 9975 } 9976 if ("px" === unit && ("em" === coerceTo || "rem" === coerceTo)) { 9977 returnValue = returnValue / rootSizeValue; 9978 unit = coerceTo; 9979 } 9980 if (("em" === coerceTo || "rem" === coerceTo) && ("em" === unit || "rem" === unit)) { 9981 unit = coerceTo; 9982 } 9983 if (!unit) { 9984 return null; 9985 } 9986 return { 9987 value: roundToPrecision(returnValue, 3), 9988 unit 9989 }; 9990 } 9991 function roundToPrecision(value, digits = 3) { 9992 const base = Math.pow(10, digits); 9993 return Math.round(value * base) / base; 9994 } 9995 9996 // packages/global-styles-engine/build-module/utils/typography.mjs 9997 function isFluidTypographyEnabled(typographySettings) { 9998 const fluidSettings = typographySettings?.fluid; 9999 return true === fluidSettings || fluidSettings && typeof fluidSettings === "object" && Object.keys(fluidSettings).length > 0; 10000 } 10001 function getFluidTypographyOptionsFromSettings(settings) { 10002 const typographySettings = settings?.typography ?? {}; 10003 const layoutSettings = settings?.layout; 10004 const defaultMaxViewportWidth = getTypographyValueAndUnit( 10005 layoutSettings?.wideSize 10006 ) ? layoutSettings?.wideSize : null; 10007 return isFluidTypographyEnabled(typographySettings) && defaultMaxViewportWidth ? { 10008 fluid: { 10009 maxViewportWidth: defaultMaxViewportWidth, 10010 ...typeof typographySettings.fluid === "object" ? typographySettings.fluid : {} 10011 } 10012 } : { 10013 fluid: typographySettings?.fluid 10014 }; 10015 } 10016 function getTypographyFontSizeValue(preset, settings) { 10017 const { size: defaultSize } = preset; 10018 if (!defaultSize || "0" === defaultSize || false === preset?.fluid) { 10019 return defaultSize; 10020 } 10021 if (!isFluidTypographyEnabled(settings?.typography) && !isFluidTypographyEnabled(preset)) { 10022 return defaultSize; 10023 } 10024 const fluidTypographySettings = getFluidTypographyOptionsFromSettings(settings)?.fluid ?? {}; 10025 const fluidFontSizeValue = getComputedFluidTypographyValue({ 10026 minimumFontSize: typeof preset?.fluid === "boolean" ? void 0 : preset?.fluid?.min, 10027 maximumFontSize: typeof preset?.fluid === "boolean" ? void 0 : preset?.fluid?.max, 10028 fontSize: defaultSize, 10029 minimumFontSizeLimit: typeof fluidTypographySettings === "object" ? fluidTypographySettings?.minFontSize : void 0, 10030 maximumViewportWidth: typeof fluidTypographySettings === "object" ? fluidTypographySettings?.maxViewportWidth : void 0, 10031 minimumViewportWidth: typeof fluidTypographySettings === "object" ? fluidTypographySettings?.minViewportWidth : void 0 10032 }); 10033 if (!!fluidFontSizeValue) { 10034 return fluidFontSizeValue; 10035 } 10036 return defaultSize; 10037 } 10038 10039 // packages/global-styles-engine/build-module/utils/common.mjs 10040 var PRESET_METADATA = [ 10041 { 10042 path: ["color", "palette"], 10043 valueKey: "color", 10044 cssVarInfix: "color", 10045 classes: [ 10046 { classSuffix: "color", propertyName: "color" }, 10047 { 10048 classSuffix: "background-color", 10049 propertyName: "background-color" 10050 }, 10051 { 10052 classSuffix: "border-color", 10053 propertyName: "border-color" 10054 } 10055 ] 10056 }, 10057 { 10058 path: ["color", "gradients"], 10059 valueKey: "gradient", 10060 cssVarInfix: "gradient", 10061 classes: [ 10062 { 10063 classSuffix: "gradient-background", 10064 propertyName: "background" 10065 } 10066 ] 10067 }, 10068 { 10069 path: ["color", "duotone"], 10070 valueKey: "colors", 10071 cssVarInfix: "duotone", 10072 valueFunc: ({ slug }) => `url( '#wp-duotone-$slug}' )`, 10073 classes: [] 10074 }, 10075 { 10076 path: ["shadow", "presets"], 10077 valueKey: "shadow", 10078 cssVarInfix: "shadow", 10079 classes: [] 10080 }, 10081 { 10082 path: ["typography", "fontSizes"], 10083 valueFunc: (preset, settings) => getTypographyFontSizeValue(preset, settings), 10084 valueKey: "size", 10085 cssVarInfix: "font-size", 10086 classes: [{ classSuffix: "font-size", propertyName: "font-size" }] 10087 }, 10088 { 10089 path: ["typography", "fontFamilies"], 10090 valueKey: "fontFamily", 10091 cssVarInfix: "font-family", 10092 classes: [ 10093 { classSuffix: "font-family", propertyName: "font-family" } 10094 ] 10095 }, 10096 { 10097 path: ["spacing", "spacingSizes"], 10098 valueKey: "size", 10099 cssVarInfix: "spacing", 10100 valueFunc: ({ size: size4 }) => size4, 10101 classes: [] 10102 }, 10103 { 10104 path: ["border", "radiusSizes"], 10105 valueKey: "size", 10106 cssVarInfix: "border-radius", 10107 classes: [] 10108 }, 10109 { 10110 path: ["dimensions", "dimensionSizes"], 10111 valueKey: "size", 10112 cssVarInfix: "dimension", 10113 classes: [] 10114 } 10115 ]; 10116 function getResolvedRefValue(ruleValue, tree) { 10117 if (!ruleValue || !tree) { 10118 return ruleValue; 10119 } 10120 if (typeof ruleValue === "object" && "ref" in ruleValue && ruleValue?.ref) { 10121 const resolvedRuleValue = (0, import_style_engine.getCSSValueFromRawStyle)( 10122 getValueFromObjectPath(tree, ruleValue.ref) 10123 ); 10124 if (typeof resolvedRuleValue === "object" && resolvedRuleValue !== null && "ref" in resolvedRuleValue && resolvedRuleValue?.ref) { 10125 return void 0; 10126 } 10127 if (resolvedRuleValue === void 0) { 10128 return ruleValue; 10129 } 10130 return resolvedRuleValue; 10131 } 10132 return ruleValue; 10133 } 10134 function getResolvedThemeFilePath(file, themeFileURIs) { 10135 if (!file || !themeFileURIs || !Array.isArray(themeFileURIs)) { 10136 return file; 10137 } 10138 const uri = themeFileURIs.find( 10139 (themeFileUri) => themeFileUri?.name === file 10140 ); 10141 if (!uri?.href) { 10142 return file; 10143 } 10144 return uri?.href; 10145 } 10146 function getResolvedValue(ruleValue, tree) { 10147 if (!ruleValue || !tree) { 10148 return ruleValue; 10149 } 10150 const resolvedValue = getResolvedRefValue(ruleValue, tree); 10151 if (typeof resolvedValue === "object" && resolvedValue !== null && "url" in resolvedValue && resolvedValue?.url) { 10152 resolvedValue.url = getResolvedThemeFilePath( 10153 resolvedValue.url, 10154 tree?._links?.["wp:theme-file"] 10155 ); 10156 } 10157 return resolvedValue; 10158 } 10159 function findInPresetsBy(settings, blockName, presetPath = [], presetProperty = "slug", presetValueValue) { 10160 const orderedPresetsByOrigin = [ 10161 blockName ? getValueFromObjectPath(settings, [ 10162 "blocks", 10163 blockName, 10164 ...presetPath 10165 ]) : void 0, 10166 getValueFromObjectPath(settings, presetPath) 10167 ].filter(Boolean); 10168 for (const presetByOrigin of orderedPresetsByOrigin) { 10169 if (presetByOrigin) { 10170 const origins = ["custom", "theme", "default"]; 10171 for (const origin of origins) { 10172 const presets = presetByOrigin[origin]; 10173 if (presets) { 10174 const presetObject = presets.find( 10175 (preset) => preset[presetProperty] === presetValueValue 10176 ); 10177 if (presetObject) { 10178 if (presetProperty === "slug") { 10179 return presetObject; 10180 } 10181 const highestPresetObjectWithSameSlug = findInPresetsBy( 10182 settings, 10183 blockName, 10184 presetPath, 10185 "slug", 10186 presetObject.slug 10187 ); 10188 if (highestPresetObjectWithSameSlug[presetProperty] === presetObject[presetProperty]) { 10189 return presetObject; 10190 } 10191 return void 0; 10192 } 10193 } 10194 } 10195 } 10196 } 10197 } 10198 function getValueFromPresetVariable(features, blockName, variable, [presetType, slug] = []) { 10199 const metadata = PRESET_METADATA.find( 10200 (data) => data.cssVarInfix === presetType 10201 ); 10202 if (!metadata || !features.settings) { 10203 return variable; 10204 } 10205 const presetObject = findInPresetsBy( 10206 features.settings, 10207 blockName, 10208 metadata.path, 10209 "slug", 10210 slug 10211 ); 10212 if (presetObject) { 10213 const { valueKey } = metadata; 10214 const result = presetObject[valueKey]; 10215 return getValueFromVariable(features, blockName, result); 10216 } 10217 return variable; 10218 } 10219 function getValueFromCustomVariable(features, blockName, variable, path = []) { 10220 const result = (blockName ? getValueFromObjectPath(features?.settings ?? {}, [ 10221 "blocks", 10222 blockName, 10223 "custom", 10224 ...path 10225 ]) : void 0) ?? getValueFromObjectPath(features?.settings ?? {}, [ 10226 "custom", 10227 ...path 10228 ]); 10229 if (!result) { 10230 return variable; 10231 } 10232 return getValueFromVariable(features, blockName, result); 10233 } 10234 function getValueFromVariable(features, blockName, variable) { 10235 if (!variable || typeof variable !== "string") { 10236 if (typeof variable === "object" && variable !== null && "ref" in variable && typeof variable.ref === "string") { 10237 const resolvedVariable = getValueFromObjectPath( 10238 features, 10239 variable.ref 10240 ); 10241 if (!resolvedVariable || typeof resolvedVariable === "object" && "ref" in resolvedVariable) { 10242 return resolvedVariable; 10243 } 10244 variable = resolvedVariable; 10245 } else { 10246 return variable; 10247 } 10248 } 10249 const USER_VALUE_PREFIX = "var:"; 10250 const THEME_VALUE_PREFIX = "var(--wp--"; 10251 const THEME_VALUE_SUFFIX = ")"; 10252 let parsedVar; 10253 if (variable.startsWith(USER_VALUE_PREFIX)) { 10254 parsedVar = variable.slice(USER_VALUE_PREFIX.length).split("|"); 10255 } else if (variable.startsWith(THEME_VALUE_PREFIX) && variable.endsWith(THEME_VALUE_SUFFIX)) { 10256 parsedVar = variable.slice(THEME_VALUE_PREFIX.length, -THEME_VALUE_SUFFIX.length).split("--"); 10257 } else { 10258 return variable; 10259 } 10260 const [type, ...path] = parsedVar; 10261 if (type === "preset") { 10262 return getValueFromPresetVariable( 10263 features, 10264 blockName, 10265 variable, 10266 path 10267 ); 10268 } 10269 if (type === "custom") { 10270 return getValueFromCustomVariable( 10271 features, 10272 blockName, 10273 variable, 10274 path 10275 ); 10276 } 10277 return variable; 10278 } 10279 10280 // packages/global-styles-engine/build-module/style-state-back-compat.mjs 10281 var LEGACY_STYLE_STATE_ALIASES = { 10282 "@mobile": "mobile", 10283 "@tablet": "tablet", 10284 "-current": "@current" 10285 }; 10286 function isObjectRecord(value) { 10287 return !!value && typeof value === "object" && !Array.isArray(value); 10288 } 10289 function normalizeStyleStateNode(node) { 10290 if (!isObjectRecord(node)) { 10291 return node; 10292 } 10293 let normalized = node; 10294 Object.entries(LEGACY_STYLE_STATE_ALIASES).forEach( 10295 ([state, legacyState]) => { 10296 if (Object.hasOwn(node, legacyState)) { 10297 if (normalized === node) { 10298 normalized = { ...node }; 10299 } 10300 if (!Object.hasOwn(node, state)) { 10301 normalized[state] = node[legacyState]; 10302 } 10303 delete normalized[legacyState]; 10304 } 10305 } 10306 ); 10307 Object.entries(normalized).forEach(([key, value]) => { 10308 if (!isObjectRecord(value)) { 10309 return; 10310 } 10311 const normalizedValue = normalizeStyleStateNode(value); 10312 if (normalizedValue !== value) { 10313 if (normalized === node) { 10314 normalized = { ...node }; 10315 } 10316 normalized[key] = normalizedValue; 10317 } 10318 }); 10319 return normalized; 10320 } 10321 function normalizeStyleStateAliases(globalStyles) { 10322 if (true) { 10323 return globalStyles; 10324 } 10325 if (!globalStyles?.styles) { 10326 return globalStyles; 10327 } 10328 const styles = normalizeStyleStateNode(globalStyles.styles); 10329 return styles === globalStyles.styles ? globalStyles : { ...globalStyles, styles }; 10330 } 10331 function getLegacyStyleStatePath(path) { 10332 if (true) { 10333 return void 0; 10334 } 10335 const pathParts = path.split("."); 10336 const legacyPathParts = pathParts.map( 10337 (part) => LEGACY_STYLE_STATE_ALIASES[part] ?? part 10338 ); 10339 return legacyPathParts.some( 10340 (part, index2) => part !== pathParts[index2] 10341 ) ? legacyPathParts.join(".") : void 0; 10342 } 10343 10344 // packages/global-styles-engine/build-module/settings/get-style.mjs 10345 function getStyle(globalStyles, path, blockName, shouldDecodeEncode = true) { 10346 const appendedPath = path ? "." + path : ""; 10347 const finalPath = !blockName ? `styles$appendedPath}` : `styles.blocks.$blockName}$appendedPath}`; 10348 if (!globalStyles) { 10349 return void 0; 10350 } 10351 let rawResult = getValueFromObjectPath(globalStyles, finalPath); 10352 const legacyPath = getLegacyStyleStatePath(finalPath); 10353 if (rawResult === void 0 && legacyPath) { 10354 let hasCanonicalPath = true; 10355 let currentValue = globalStyles; 10356 for (const pathPart of finalPath.split(".")) { 10357 if (!currentValue || typeof currentValue !== "object" || !Object.hasOwn(currentValue, pathPart)) { 10358 hasCanonicalPath = false; 10359 break; 10360 } 10361 currentValue = currentValue[pathPart]; 10362 } 10363 if (!hasCanonicalPath) { 10364 rawResult = getValueFromObjectPath(globalStyles, legacyPath); 10365 } 10366 } 10367 const result = shouldDecodeEncode ? getValueFromVariable(globalStyles, blockName, rawResult) : rawResult; 10368 return result; 10369 } 10370 10371 // packages/global-styles-engine/build-module/settings/set-style.mjs 10372 function setStyle(globalStyles, path, newValue, blockName) { 10373 const appendedPath = path ? "." + path : ""; 10374 const finalPath = !blockName ? `styles$appendedPath}` : `styles.blocks.$blockName}$appendedPath}`; 10375 return setImmutably( 10376 normalizeStyleStateAliases(globalStyles), 10377 finalPath.split("."), 10378 newValue 10379 ); 10380 } 10381 10382 // packages/global-styles-engine/build-module/core/equal.mjs 10383 var import_es6 = __toESM(require_es6(), 1); 10384 function areGlobalStylesEqual(original, variation) { 10385 if (typeof original !== "object" || typeof variation !== "object") { 10386 return original === variation; 10387 } 10388 return (0, import_es6.default)(original?.styles, variation?.styles) && (0, import_es6.default)(original?.settings, variation?.settings); 10389 } 10390 10391 // packages/global-styles-engine/build-module/core/merge.mjs 10392 var import_deepmerge = __toESM(require_cjs(), 1); 10393 10394 // node_modules/is-plain-object/dist/is-plain-object.mjs 10395 function isObject(o3) { 10396 return Object.prototype.toString.call(o3) === "[object Object]"; 10397 } 10398 function isPlainObject(o3) { 10399 var ctor, prot; 10400 if (isObject(o3) === false) return false; 10401 ctor = o3.constructor; 10402 if (ctor === void 0) return true; 10403 prot = ctor.prototype; 10404 if (isObject(prot) === false) return false; 10405 if (prot.hasOwnProperty("isPrototypeOf") === false) { 10406 return false; 10407 } 10408 return true; 10409 } 10410 10411 // packages/global-styles-engine/build-module/core/merge.mjs 10412 function mergeGlobalStyles(base, user) { 10413 return (0, import_deepmerge.default)( 10414 normalizeStyleStateAliases(base), 10415 normalizeStyleStateAliases(user), 10416 { 10417 /* 10418 * We only pass as arrays the presets, 10419 * in which case we want the new array of values 10420 * to override the old array (no merging). 10421 */ 10422 isMergeableObject: isPlainObject, 10423 /* 10424 * Exceptions to the above rule. 10425 * Background images should be replaced, not merged, 10426 * as they themselves are specific object definitions for the style. 10427 */ 10428 customMerge: (key) => { 10429 if (key === "backgroundImage") { 10430 return (baseConfig, userConfig) => userConfig ?? baseConfig; 10431 } 10432 return void 0; 10433 } 10434 } 10435 ); 10436 } 10437 10438 // node_modules/colord/index.mjs 10439 var r2 = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }; 10440 var t = function(r3) { 10441 return "string" == typeof r3 ? r3.length > 0 : "number" == typeof r3; 10442 }; 10443 var n = function(r3, t3, n2) { 10444 return void 0 === t3 && (t3 = 0), void 0 === n2 && (n2 = Math.pow(10, t3)), Math.round(n2 * r3) / n2 + 0; 10445 }; 10446 var e = function(r3, t3, n2) { 10447 return void 0 === t3 && (t3 = 0), void 0 === n2 && (n2 = 1), r3 > n2 ? n2 : r3 > t3 ? r3 : t3; 10448 }; 10449 var u = function(r3) { 10450 return (r3 = isFinite(r3) ? r3 % 360 : 0) > 0 ? r3 : r3 + 360; 10451 }; 10452 var a = function(r3) { 10453 return { r: e(r3.r, 0, 255), g: e(r3.g, 0, 255), b: e(r3.b, 0, 255), a: e(r3.a) }; 10454 }; 10455 var o = function(r3) { 10456 return { r: n(r3.r), g: n(r3.g), b: n(r3.b), a: n(r3.a, 3) }; 10457 }; 10458 var i = /^#([0-9a-f]{3,8})$/i; 10459 var s = function(r3) { 10460 var t3 = r3.toString(16); 10461 return t3.length < 2 ? "0" + t3 : t3; 10462 }; 10463 var h = function(r3) { 10464 var t3 = r3.r, n2 = r3.g, e2 = r3.b, u2 = r3.a, a2 = Math.max(t3, n2, e2), o3 = a2 - Math.min(t3, n2, e2), i2 = o3 ? a2 === t3 ? (n2 - e2) / o3 : a2 === n2 ? 2 + (e2 - t3) / o3 : 4 + (t3 - n2) / o3 : 0; 10465 return { h: 60 * (i2 < 0 ? i2 + 6 : i2), s: a2 ? o3 / a2 * 100 : 0, v: a2 / 255 * 100, a: u2 }; 10466 }; 10467 var b = function(r3) { 10468 var t3 = r3.h, n2 = r3.s, e2 = r3.v, u2 = r3.a; 10469 t3 = t3 / 360 * 6, n2 /= 100, e2 /= 100; 10470 var a2 = Math.floor(t3), o3 = e2 * (1 - n2), i2 = e2 * (1 - (t3 - a2) * n2), s2 = e2 * (1 - (1 - t3 + a2) * n2), h2 = a2 % 6; 10471 return { r: 255 * [e2, i2, o3, o3, s2, e2][h2], g: 255 * [s2, e2, e2, i2, o3, o3][h2], b: 255 * [o3, o3, s2, e2, e2, i2][h2], a: u2 }; 10472 }; 10473 var g = function(r3) { 10474 return { h: u(r3.h), s: e(r3.s, 0, 100), l: e(r3.l, 0, 100), a: e(r3.a) }; 10475 }; 10476 var d = function(r3) { 10477 return { h: n(r3.h), s: n(r3.s), l: n(r3.l), a: n(r3.a, 3) }; 10478 }; 10479 var f = function(r3) { 10480 return b((n2 = (t3 = r3).s, { h: t3.h, s: (n2 *= ((e2 = t3.l) < 50 ? e2 : 100 - e2) / 100) > 0 ? 2 * n2 / (e2 + n2) * 100 : 0, v: e2 + n2, a: t3.a })); 10481 var t3, n2, e2; 10482 }; 10483 var c = function(r3) { 10484 return { h: (t3 = h(r3)).h, s: (u2 = (200 - (n2 = t3.s)) * (e2 = t3.v) / 100) > 0 && u2 < 200 ? n2 * e2 / 100 / (u2 <= 100 ? u2 : 200 - u2) * 100 : 0, l: u2 / 2, a: t3.a }; 10485 var t3, n2, e2, u2; 10486 }; 10487 var l = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i; 10488 var p2 = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i; 10489 var v = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i; 10490 var m = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i; 10491 var y = { string: [[function(r3) { 10492 var t3 = i.exec(r3); 10493 return t3 ? (r3 = t3[1]).length <= 4 ? { r: parseInt(r3[0] + r3[0], 16), g: parseInt(r3[1] + r3[1], 16), b: parseInt(r3[2] + r3[2], 16), a: 4 === r3.length ? n(parseInt(r3[3] + r3[3], 16) / 255, 2) : 1 } : 6 === r3.length || 8 === r3.length ? { r: parseInt(r3.substr(0, 2), 16), g: parseInt(r3.substr(2, 2), 16), b: parseInt(r3.substr(4, 2), 16), a: 8 === r3.length ? n(parseInt(r3.substr(6, 2), 16) / 255, 2) : 1 } : null : null; 10494 }, "hex"], [function(r3) { 10495 var t3 = v.exec(r3) || m.exec(r3); 10496 return t3 ? t3[2] !== t3[4] || t3[4] !== t3[6] ? null : a({ r: Number(t3[1]) / (t3[2] ? 100 / 255 : 1), g: Number(t3[3]) / (t3[4] ? 100 / 255 : 1), b: Number(t3[5]) / (t3[6] ? 100 / 255 : 1), a: void 0 === t3[7] ? 1 : Number(t3[7]) / (t3[8] ? 100 : 1) }) : null; 10497 }, "rgb"], [function(t3) { 10498 var n2 = l.exec(t3) || p2.exec(t3); 10499 if (!n2) return null; 10500 var e2, u2, a2 = g({ h: (e2 = n2[1], u2 = n2[2], void 0 === u2 && (u2 = "deg"), Number(e2) * (r2[u2] || 1)), s: Number(n2[3]), l: Number(n2[4]), a: void 0 === n2[5] ? 1 : Number(n2[5]) / (n2[6] ? 100 : 1) }); 10501 return f(a2); 10502 }, "hsl"]], object: [[function(r3) { 10503 var n2 = r3.r, e2 = r3.g, u2 = r3.b, o3 = r3.a, i2 = void 0 === o3 ? 1 : o3; 10504 return t(n2) && t(e2) && t(u2) ? a({ r: Number(n2), g: Number(e2), b: Number(u2), a: Number(i2) }) : null; 10505 }, "rgb"], [function(r3) { 10506 var n2 = r3.h, e2 = r3.s, u2 = r3.l, a2 = r3.a, o3 = void 0 === a2 ? 1 : a2; 10507 if (!t(n2) || !t(e2) || !t(u2)) return null; 10508 var i2 = g({ h: Number(n2), s: Number(e2), l: Number(u2), a: Number(o3) }); 10509 return f(i2); 10510 }, "hsl"], [function(r3) { 10511 var n2 = r3.h, a2 = r3.s, o3 = r3.v, i2 = r3.a, s2 = void 0 === i2 ? 1 : i2; 10512 if (!t(n2) || !t(a2) || !t(o3)) return null; 10513 var h2 = (function(r4) { 10514 return { h: u(r4.h), s: e(r4.s, 0, 100), v: e(r4.v, 0, 100), a: e(r4.a) }; 10515 })({ h: Number(n2), s: Number(a2), v: Number(o3), a: Number(s2) }); 10516 return b(h2); 10517 }, "hsv"]] }; 10518 var N = function(r3, t3) { 10519 for (var n2 = 0; n2 < t3.length; n2++) { 10520 var e2 = t3[n2][0](r3); 10521 if (e2) return [e2, t3[n2][1]]; 10522 } 10523 return [null, void 0]; 10524 }; 10525 var x = function(r3) { 10526 return "string" == typeof r3 ? N(r3.trim(), y.string) : "object" == typeof r3 && null !== r3 ? N(r3, y.object) : [null, void 0]; 10527 }; 10528 var M = function(r3, t3) { 10529 var n2 = c(r3); 10530 return { h: n2.h, s: e(n2.s + 100 * t3, 0, 100), l: n2.l, a: n2.a }; 10531 }; 10532 var H = function(r3) { 10533 return (299 * r3.r + 587 * r3.g + 114 * r3.b) / 1e3 / 255; 10534 }; 10535 var $ = function(r3, t3) { 10536 var n2 = c(r3); 10537 return { h: n2.h, s: n2.s, l: e(n2.l + 100 * t3, 0, 100), a: n2.a }; 10538 }; 10539 var j = (function() { 10540 function r3(r4) { 10541 this.parsed = x(r4)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 }; 10542 } 10543 return r3.prototype.isValid = function() { 10544 return null !== this.parsed; 10545 }, r3.prototype.brightness = function() { 10546 return n(H(this.rgba), 2); 10547 }, r3.prototype.isDark = function() { 10548 return H(this.rgba) < 0.5; 10549 }, r3.prototype.isLight = function() { 10550 return H(this.rgba) >= 0.5; 10551 }, r3.prototype.toHex = function() { 10552 return r4 = o(this.rgba), t3 = r4.r, e2 = r4.g, u2 = r4.b, i2 = (a2 = r4.a) < 1 ? s(n(255 * a2)) : "", "#" + s(t3) + s(e2) + s(u2) + i2; 10553 var r4, t3, e2, u2, a2, i2; 10554 }, r3.prototype.toRgb = function() { 10555 return o(this.rgba); 10556 }, r3.prototype.toRgbString = function() { 10557 return r4 = o(this.rgba), t3 = r4.r, n2 = r4.g, e2 = r4.b, (u2 = r4.a) < 1 ? "rgba(" + t3 + ", " + n2 + ", " + e2 + ", " + u2 + ")" : "rgb(" + t3 + ", " + n2 + ", " + e2 + ")"; 10558 var r4, t3, n2, e2, u2; 10559 }, r3.prototype.toHsl = function() { 10560 return d(c(this.rgba)); 10561 }, r3.prototype.toHslString = function() { 10562 return r4 = d(c(this.rgba)), t3 = r4.h, n2 = r4.s, e2 = r4.l, (u2 = r4.a) < 1 ? "hsla(" + t3 + ", " + n2 + "%, " + e2 + "%, " + u2 + ")" : "hsl(" + t3 + ", " + n2 + "%, " + e2 + "%)"; 10563 var r4, t3, n2, e2, u2; 10564 }, r3.prototype.toHsv = function() { 10565 return r4 = h(this.rgba), { h: n(r4.h), s: n(r4.s), v: n(r4.v), a: n(r4.a, 3) }; 10566 var r4; 10567 }, r3.prototype.invert = function() { 10568 return w({ r: 255 - (r4 = this.rgba).r, g: 255 - r4.g, b: 255 - r4.b, a: r4.a }); 10569 var r4; 10570 }, r3.prototype.saturate = function(r4) { 10571 return void 0 === r4 && (r4 = 0.1), w(M(this.rgba, r4)); 10572 }, r3.prototype.desaturate = function(r4) { 10573 return void 0 === r4 && (r4 = 0.1), w(M(this.rgba, -r4)); 10574 }, r3.prototype.grayscale = function() { 10575 return w(M(this.rgba, -1)); 10576 }, r3.prototype.lighten = function(r4) { 10577 return void 0 === r4 && (r4 = 0.1), w($(this.rgba, r4)); 10578 }, r3.prototype.darken = function(r4) { 10579 return void 0 === r4 && (r4 = 0.1), w($(this.rgba, -r4)); 10580 }, r3.prototype.rotate = function(r4) { 10581 return void 0 === r4 && (r4 = 15), this.hue(this.hue() + r4); 10582 }, r3.prototype.alpha = function(r4) { 10583 return "number" == typeof r4 ? w({ r: (t3 = this.rgba).r, g: t3.g, b: t3.b, a: r4 }) : n(this.rgba.a, 3); 10584 var t3; 10585 }, r3.prototype.hue = function(r4) { 10586 var t3 = c(this.rgba); 10587 return "number" == typeof r4 ? w({ h: r4, s: t3.s, l: t3.l, a: t3.a }) : n(t3.h); 10588 }, r3.prototype.isEqual = function(r4) { 10589 return this.toHex() === w(r4).toHex(); 10590 }, r3; 10591 })(); 10592 var w = function(r3) { 10593 return r3 instanceof j ? r3 : new j(r3); 10594 }; 10595 var S = []; 10596 var k = function(r3) { 10597 r3.forEach(function(r4) { 10598 S.indexOf(r4) < 0 && (r4(j, y), S.push(r4)); 10599 }); 10600 }; 10601 10602 // packages/global-styles-engine/build-module/utils/viewport.mjs 10603 var DEFAULT_VIEWPORT_BREAKPOINTS = { 10604 mobile: "480px", 10605 tablet: "782px" 10606 }; 10607 var VIEWPORT_SIZE_REGEXP = /^(\d+|\d*\.\d+)(px|em|rem)$/; 10608 var DEFAULT_FONT_SIZE = 16; 10609 function isViewportSettings(configOrSettings) { 10610 return "mobile" in configOrSettings || "tablet" in configOrSettings; 10611 } 10612 function getViewportSettings(configOrSettings) { 10613 if (!configOrSettings || typeof configOrSettings !== "object") { 10614 return {}; 10615 } 10616 if (isViewportSettings(configOrSettings)) { 10617 return configOrSettings; 10618 } 10619 return configOrSettings.settings?.viewport ?? {}; 10620 } 10621 function isValidViewportSize(value) { 10622 return typeof value === "string" && VIEWPORT_SIZE_REGEXP.test(value.trim()); 10623 } 10624 function getViewportBreakpointValueInPixels(value) { 10625 if (typeof value === "number") { 10626 return value; 10627 } 10628 if (typeof value !== "string") { 10629 return void 0; 10630 } 10631 const match2 = value.trim().match(VIEWPORT_SIZE_REGEXP); 10632 if (!match2) { 10633 return void 0; 10634 } 10635 const numericValue = Number.parseFloat(match2[1]); 10636 const unit = match2[2]; 10637 return unit === "px" ? numericValue : numericValue * DEFAULT_FONT_SIZE; 10638 } 10639 function getViewportBreakpoints(configOrSettings) { 10640 const viewportSettings = getViewportSettings(configOrSettings); 10641 const breakpoints = {}; 10642 const breakpointValuesInPixels = {}; 10643 Object.keys(DEFAULT_VIEWPORT_BREAKPOINTS).forEach((breakpoint) => { 10644 const key = breakpoint; 10645 const value = viewportSettings[key]; 10646 const px = getViewportBreakpointValueInPixels(value); 10647 if (px !== void 0 && isValidViewportSize(value)) { 10648 breakpoints[key] = value.trim(); 10649 breakpointValuesInPixels[key] = px; 10650 } 10651 }); 10652 const breakpointNames = Object.keys(breakpoints); 10653 if (!breakpointNames.length) { 10654 return { ...DEFAULT_VIEWPORT_BREAKPOINTS }; 10655 } 10656 if (1 === breakpointNames.length) { 10657 return breakpoints; 10658 } 10659 const mobile = breakpoints.mobile; 10660 const tablet = breakpoints.tablet; 10661 if (breakpointValuesInPixels.mobile >= breakpointValuesInPixels.tablet) { 10662 return { mobile }; 10663 } 10664 return { mobile, tablet }; 10665 } 10666 function getResponsiveMediaQueries(configOrSettings) { 10667 const breakpoints = getViewportBreakpoints(configOrSettings); 10668 const mediaQueries = {}; 10669 if (breakpoints.mobile) { 10670 mediaQueries["@mobile"] = `@media (width <= $breakpoints.mobile})`; 10671 } 10672 if (breakpoints.tablet) { 10673 mediaQueries["@tablet"] = breakpoints.mobile ? `@media ($breakpoints.mobile} < width <= $breakpoints.tablet})` : `@media (width <= $breakpoints.tablet})`; 10674 } 10675 return mediaQueries; 10676 } 10677 10678 // packages/global-styles-engine/build-module/variation.mjs 10679 function getVariationStyle(globalStyles, name2, variation, { resolveRefs = true } = {}) { 10680 if (!globalStyles?.styles?.blocks?.[name2]?.variations?.[variation]) { 10681 return void 0; 10682 } 10683 const replaceRefs = (variationStyles) => { 10684 Object.keys(variationStyles).forEach((key) => { 10685 const value = variationStyles[key]; 10686 if (typeof value === "object" && value !== null) { 10687 if (value.ref !== void 0) { 10688 if (typeof value.ref !== "string" || value.ref.trim() === "") { 10689 delete variationStyles[key]; 10690 } else { 10691 const refValue = getValueFromObjectPath( 10692 globalStyles, 10693 value.ref 10694 ); 10695 if (refValue !== void 0 && refValue !== null) { 10696 variationStyles[key] = refValue; 10697 } else { 10698 delete variationStyles[key]; 10699 } 10700 } 10701 } else { 10702 replaceRefs(value); 10703 if (Object.keys(value).length === 0) { 10704 delete variationStyles[key]; 10705 } 10706 } 10707 } 10708 }); 10709 }; 10710 const styles = JSON.parse( 10711 JSON.stringify( 10712 globalStyles.styles.blocks[name2].variations[variation] 10713 ) 10714 ); 10715 if (resolveRefs) { 10716 replaceRefs(styles); 10717 } 10718 return styles; 10719 } 10720 10721 // packages/global-styles-engine/build-module/resolve-style.mjs 10722 var DEFAULT_STATE_VALUE = "default"; 10723 function isDefaultBlockStyleState(selectedState) { 10724 const viewport = selectedState?.viewport; 10725 const pseudoState = selectedState?.pseudoState; 10726 return (!viewport || viewport === DEFAULT_STATE_VALUE) && (!pseudoState || pseudoState === DEFAULT_STATE_VALUE); 10727 } 10728 function getStyleStatePath(selectedState) { 10729 if (isDefaultBlockStyleState(selectedState)) { 10730 return []; 10731 } 10732 return [selectedState.viewport, selectedState.pseudoState].filter( 10733 (state) => !!state && state !== DEFAULT_STATE_VALUE 10734 ); 10735 } 10736 function getStyleForState(style, selectedState) { 10737 const path = getStyleStatePath(selectedState); 10738 if (!path.length) { 10739 return style; 10740 } 10741 return getValueFromObjectPath(style, path); 10742 } 10743 var TREE_STRUCTURAL_KEYS = /* @__PURE__ */ new Set(["blocks", "variations", "css"]); 10744 var EMPTY_INHERITANCE = Object.freeze({ 10745 value: {}, 10746 sources: {} 10747 }); 10748 var SOURCE_DESCRIPTORS = { 10749 root: { layer: "root" }, 10750 element: { layer: "element" }, 10751 block: { layer: "block" }, 10752 blockVariation: { layer: "blockVariation" } 10753 }; 10754 function createSourceDescriptor(type) { 10755 const descriptor = SOURCE_DESCRIPTORS[type]; 10756 if (!descriptor) { 10757 return null; 10758 } 10759 return { ...descriptor }; 10760 } 10761 function createContribution(styles, source) { 10762 if (!styles || !source) { 10763 return null; 10764 } 10765 return { styles, source }; 10766 } 10767 function getPathKey(path) { 10768 return path.join("."); 10769 } 10770 function getSourceForPath(source) { 10771 return { ...source }; 10772 } 10773 function isExplicitEmpty(value) { 10774 if (value === "" || value === null) { 10775 return true; 10776 } 10777 if (typeof value === "object" && !Array.isArray(value) && Object.keys(value).length === 0) { 10778 return true; 10779 } 10780 return false; 10781 } 10782 function isRefObject(value) { 10783 return value !== null && typeof value === "object" && !Array.isArray(value) && typeof value.ref === "string"; 10784 } 10785 function pickLayerRootContribution(layer) { 10786 if (!layer || typeof layer !== "object" || Array.isArray(layer)) { 10787 return null; 10788 } 10789 const contribution = {}; 10790 for (const key of Object.keys(layer)) { 10791 if (TREE_STRUCTURAL_KEYS.has(key)) { 10792 continue; 10793 } 10794 if (key === "elements") { 10795 if (layer.elements && typeof layer.elements === "object") { 10796 contribution.elements = layer.elements; 10797 } 10798 continue; 10799 } 10800 if (isExplicitEmpty(layer[key])) { 10801 continue; 10802 } 10803 contribution[key] = layer[key]; 10804 } 10805 return Object.keys(contribution).length === 0 ? null : contribution; 10806 } 10807 var ATOMIC_OBJECT_KEYS = /* @__PURE__ */ new Set(["backgroundImage"]); 10808 function deepMergeDroppingEmpties(target, source, globalStyles, sourceMetadata, sources, path = []) { 10809 if (!source || typeof source !== "object" || Array.isArray(source)) { 10810 return target; 10811 } 10812 for (const key of Object.keys(source)) { 10813 let sourceValue = source[key]; 10814 if (isExplicitEmpty(sourceValue)) { 10815 continue; 10816 } 10817 if (isRefObject(sourceValue)) { 10818 if (sourceValue.ref.trim() === "") { 10819 continue; 10820 } 10821 const resolved = getValueFromObjectPath( 10822 globalStyles, 10823 sourceValue.ref 10824 ); 10825 if (resolved === void 0 || resolved === null || isRefObject(resolved)) { 10826 continue; 10827 } 10828 sourceValue = resolved; 10829 } 10830 const nextPath = [...path, key]; 10831 if (!ATOMIC_OBJECT_KEYS.has(key) && sourceValue !== null && typeof sourceValue === "object" && !Array.isArray(sourceValue) && !isRefObject(sourceValue)) { 10832 const existing = target[key] && typeof target[key] === "object" && !Array.isArray(target[key]) ? target[key] : {}; 10833 target[key] = deepMergeDroppingEmpties( 10834 { ...existing }, 10835 sourceValue, 10836 globalStyles, 10837 sourceMetadata, 10838 sources, 10839 nextPath 10840 ); 10841 } else { 10842 target[key] = ATOMIC_OBJECT_KEYS.has(key) && sourceValue !== null && typeof sourceValue === "object" && !Array.isArray(sourceValue) ? { ...sourceValue } : sourceValue; 10843 if (sourceMetadata && sources) { 10844 sources[getPathKey(nextPath)] = getSourceForPath(sourceMetadata); 10845 } 10846 } 10847 } 10848 return target; 10849 } 10850 function getStateSlice(layerObject, selectedState) { 10851 if (!layerObject) { 10852 return null; 10853 } 10854 const slice = getStyleForState(layerObject, selectedState); 10855 return slice && typeof slice === "object" && !Array.isArray(slice) ? slice : null; 10856 } 10857 var NON_CASCADING_ROOT_PREFIXES = [ 10858 "color.background", 10859 "color.gradient", 10860 "background", 10861 "spacing", 10862 "dimensions", 10863 "border", 10864 "shadow", 10865 "filter" 10866 ]; 10867 function isNonCascadingRootPath(pathKey) { 10868 if (pathKey.startsWith("elements.")) { 10869 return false; 10870 } 10871 return NON_CASCADING_ROOT_PREFIXES.some( 10872 (prefix) => pathKey === prefix || pathKey.startsWith(`$prefix}.`) 10873 ); 10874 } 10875 function deleteAtPath(target, pathSegments) { 10876 if (!target || typeof target !== "object") { 10877 return; 10878 } 10879 const [head2, ...rest] = pathSegments; 10880 if (rest.length === 0) { 10881 delete target[head2]; 10882 return; 10883 } 10884 const child = target[head2]; 10885 if (child && typeof child === "object") { 10886 deleteAtPath(child, rest); 10887 if (Object.keys(child).length === 0) { 10888 delete target[head2]; 10889 } 10890 } 10891 } 10892 function dropNonCascadingRootLeaves(value, sources) { 10893 for (const pathKey of Object.keys(sources)) { 10894 if (sources[pathKey].layer === "root" && isNonCascadingRootPath(pathKey)) { 10895 deleteAtPath(value, pathKey.split(".")); 10896 delete sources[pathKey]; 10897 } 10898 } 10899 } 10900 function resolveThemeFileBackgroundImage(value, globalStyles, links) { 10901 const image = value?.background?.backgroundImage; 10902 if (!image) { 10903 return; 10904 } 10905 const resolved = getResolvedValue(image, { 10906 ...globalStyles, 10907 _links: links ?? void 0 10908 }); 10909 if (resolved !== void 0) { 10910 value.background.backgroundImage = resolved; 10911 } 10912 } 10913 function computeResolvedStyle(globalStyles, { 10914 blockName, 10915 variationName = null, 10916 elements: elements2 = null, 10917 viewport = null, 10918 pseudoState = null 10919 } = {}) { 10920 if (!globalStyles || !globalStyles.styles) { 10921 return EMPTY_INHERITANCE; 10922 } 10923 if (!blockName) { 10924 return EMPTY_INHERITANCE; 10925 } 10926 const styles = globalStyles.styles; 10927 const selectedState = { viewport, pseudoState }; 10928 const root = styles; 10929 const block = styles.blocks?.[blockName] ?? null; 10930 const elementLayers = (elements2 ?? []).map((elementName) => styles.elements?.[elementName] ?? null).filter((layer) => !!layer); 10931 const variation = variationName ? getVariationStyle(globalStyles, blockName, variationName) ?? null : null; 10932 const contributions = [ 10933 createContribution( 10934 pickLayerRootContribution(root), 10935 createSourceDescriptor("root") 10936 ), 10937 ...elementLayers.map( 10938 (layer) => createContribution( 10939 pickLayerRootContribution(layer), 10940 createSourceDescriptor("element") 10941 ) 10942 ), 10943 block ? createContribution( 10944 pickLayerRootContribution(block), 10945 createSourceDescriptor("block") 10946 ) : null, 10947 variation ? createContribution( 10948 pickLayerRootContribution(variation), 10949 createSourceDescriptor("blockVariation") 10950 ) : null 10951 ]; 10952 if (!isDefaultBlockStyleState(selectedState)) { 10953 contributions.push( 10954 createContribution( 10955 pickLayerRootContribution( 10956 getStateSlice(root, selectedState) 10957 ), 10958 createSourceDescriptor("root") 10959 ), 10960 ...elementLayers.map( 10961 (layer) => createContribution( 10962 pickLayerRootContribution( 10963 getStateSlice(layer, selectedState) 10964 ), 10965 createSourceDescriptor("element") 10966 ) 10967 ), 10968 block ? createContribution( 10969 pickLayerRootContribution( 10970 getStateSlice(block, selectedState) 10971 ), 10972 createSourceDescriptor("block") 10973 ) : null, 10974 variation ? createContribution( 10975 pickLayerRootContribution( 10976 getStateSlice(variation, selectedState) 10977 ), 10978 createSourceDescriptor("blockVariation") 10979 ) : null 10980 ); 10981 } 10982 const filteredContributions = contributions.filter( 10983 Boolean 10984 ); 10985 if (filteredContributions.length === 0) { 10986 return EMPTY_INHERITANCE; 10987 } 10988 const sources = {}; 10989 const value = filteredContributions.reduce( 10990 (mergedValue, contribution) => deepMergeDroppingEmpties( 10991 mergedValue, 10992 contribution.styles, 10993 globalStyles, 10994 contribution.source, 10995 sources 10996 ), 10997 {} 10998 ); 10999 dropNonCascadingRootLeaves(value, sources); 11000 resolveThemeFileBackgroundImage( 11001 value, 11002 globalStyles, 11003 globalStyles._links ?? null 11004 ); 11005 return { value, sources }; 11006 } 11007 var NO_LINKS = {}; 11008 var memo = /* @__PURE__ */ new WeakMap(); 11009 function resolveStyle2(globalStyles, context = {}) { 11010 const styleData = globalStyles?.styles; 11011 if (!styleData || typeof styleData !== "object") { 11012 return computeResolvedStyle(globalStyles, context); 11013 } 11014 let byLinks = memo.get(styleData); 11015 if (!byLinks) { 11016 byLinks = /* @__PURE__ */ new WeakMap(); 11017 memo.set(styleData, byLinks); 11018 } 11019 const linksKey = globalStyles?._links ?? NO_LINKS; 11020 let inner = byLinks.get(linksKey); 11021 if (!inner) { 11022 inner = /* @__PURE__ */ new Map(); 11023 byLinks.set(linksKey, inner); 11024 } 11025 const sliceKey = `$context.elements?.join(",") ?? ""}:$context.viewport ?? ""}:$context.pseudoState ?? ""}`; 11026 const key = (context.blockName || "") + "" + (context.variationName || "") + "" + sliceKey; 11027 if (inner.has(key)) { 11028 return inner.get(key); 11029 } 11030 const result = computeResolvedStyle(globalStyles, context); 11031 inner.set(key, result); 11032 return result; 11033 } 11034 11035 // packages/global-styles-engine/build-module/lock-unlock.mjs 11036 var import_private_apis2 = __toESM(require_private_apis(), 1); 11037 var { lock: lock2, unlock: unlock2 } = (0, import_private_apis2.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 11038 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 11039 "@wordpress/global-styles-engine" 11040 ); 11041 11042 // packages/global-styles-engine/build-module/private-apis.mjs 11043 var privateApis = {}; 11044 lock2(privateApis, { 11045 getResponsiveMediaQueries, 11046 getViewportBreakpoints, 11047 getViewportBreakpointValueInPixels, 11048 resolveStyle: resolveStyle2, 11049 getVariationStyle 11050 }); 11051 11052 // packages/global-styles-ui/build-module/provider.mjs 11053 var import_element21 = __toESM(require_element(), 1); 11054 11055 // packages/global-styles-ui/build-module/context.mjs 11056 var import_element20 = __toESM(require_element(), 1); 11057 var GlobalStylesContext = (0, import_element20.createContext)({ 11058 user: { styles: {}, settings: {} }, 11059 base: { styles: {}, settings: {} }, 11060 merged: { styles: {}, settings: {} }, 11061 onChange: () => { 11062 }, 11063 fontLibraryEnabled: false 11064 }); 11065 11066 // packages/global-styles-ui/build-module/provider.mjs 11067 var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1); 11068 function GlobalStylesProvider({ 11069 children, 11070 value, 11071 baseValue, 11072 onChange, 11073 fontLibraryEnabled 11074 }) { 11075 const merged = (0, import_element21.useMemo)(() => { 11076 return mergeGlobalStyles(baseValue, value); 11077 }, [baseValue, value]); 11078 const contextValue = (0, import_element21.useMemo)( 11079 () => ({ 11080 user: value, 11081 base: baseValue, 11082 merged, 11083 onChange, 11084 fontLibraryEnabled 11085 }), 11086 [value, baseValue, merged, onChange, fontLibraryEnabled] 11087 ); 11088 return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(GlobalStylesContext.Provider, { value: contextValue, children }); 11089 } 11090 11091 // packages/global-styles-ui/build-module/screen-root.mjs 11092 var import_components8 = __toESM(require_components(), 1); 11093 var import_i18n5 = __toESM(require_i18n(), 1); 11094 var import_data2 = __toESM(require_data(), 1); 11095 var import_core_data2 = __toESM(require_core_data(), 1); 11096 11097 // packages/global-styles-ui/build-module/icon-with-current-color.mjs 11098 var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1); 11099 function IconWithCurrentColor({ 11100 className, 11101 ...props 11102 }) { 11103 return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)( 11104 icon_default, 11105 { 11106 className: clsx_default( 11107 className, 11108 "global-styles-ui-icon-with-current-color" 11109 ), 11110 ...props 11111 } 11112 ); 11113 } 11114 11115 // packages/global-styles-ui/build-module/navigation-button.mjs 11116 var import_components2 = __toESM(require_components(), 1); 11117 var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1); 11118 function GenericNavigationButton({ 11119 icon, 11120 children, 11121 ...props 11122 }) { 11123 return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_components2.__experimentalItem, { ...props, children: [ 11124 icon && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_components2.__experimentalHStack, { justify: "flex-start", children: [ 11125 /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(IconWithCurrentColor, { icon, size: 24 }), 11126 /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_components2.FlexItem, { children }) 11127 ] }), 11128 !icon && children 11129 ] }); 11130 } 11131 function NavigationButtonAsItem(props) { 11132 return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_components2.Navigator.Button, { as: GenericNavigationButton, ...props }); 11133 } 11134 11135 // packages/global-styles-ui/build-module/root-menu.mjs 11136 var import_components3 = __toESM(require_components(), 1); 11137 var import_i18n3 = __toESM(require_i18n(), 1); 11138 var import_block_editor = __toESM(require_block_editor(), 1); 11139 11140 // node_modules/colord/plugins/a11y.mjs 11141 var o2 = function(o3) { 11142 var t3 = o3 / 255; 11143 return t3 < 0.04045 ? t3 / 12.92 : Math.pow((t3 + 0.055) / 1.055, 2.4); 11144 }; 11145 var t2 = function(t3) { 11146 return 0.2126 * o2(t3.r) + 0.7152 * o2(t3.g) + 0.0722 * o2(t3.b); 11147 }; 11148 function a11y_default(o3) { 11149 o3.prototype.luminance = function() { 11150 return o4 = t2(this.rgba), void 0 === (r3 = 2) && (r3 = 0), void 0 === n2 && (n2 = Math.pow(10, r3)), Math.round(n2 * o4) / n2 + 0; 11151 var o4, r3, n2; 11152 }, o3.prototype.contrast = function(r3) { 11153 void 0 === r3 && (r3 = "#FFF"); 11154 var n2, a2, i2, e2, v2, u2, d2, c2 = r3 instanceof o3 ? r3 : new o3(r3); 11155 return e2 = this.rgba, v2 = c2.toRgb(), u2 = t2(e2), d2 = t2(v2), n2 = u2 > d2 ? (u2 + 0.05) / (d2 + 0.05) : (d2 + 0.05) / (u2 + 0.05), void 0 === (a2 = 2) && (a2 = 0), void 0 === i2 && (i2 = Math.pow(10, a2)), Math.floor(i2 * n2) / i2 + 0; 11156 }, o3.prototype.isReadable = function(o4, t3) { 11157 return void 0 === o4 && (o4 = "#FFF"), void 0 === t3 && (t3 = {}), this.contrast(o4) >= (e2 = void 0 === (i2 = (r3 = t3).size) ? "normal" : i2, "AAA" === (a2 = void 0 === (n2 = r3.level) ? "AA" : n2) && "normal" === e2 ? 7 : "AA" === a2 && "large" === e2 ? 3 : 4.5); 11158 var r3, n2, a2, i2, e2; 11159 }; 11160 } 11161 11162 // packages/global-styles-ui/build-module/hooks.mjs 11163 var import_element22 = __toESM(require_element(), 1); 11164 var import_data = __toESM(require_data(), 1); 11165 var import_core_data = __toESM(require_core_data(), 1); 11166 var import_i18n2 = __toESM(require_i18n(), 1); 11167 11168 // packages/global-styles-ui/build-module/utils.mjs 11169 var import_i18n = __toESM(require_i18n(), 1); 11170 11171 // packages/global-styles-ui/build-module/lock-unlock.mjs 11172 var import_private_apis4 = __toESM(require_private_apis(), 1); 11173 var { lock: lock3, unlock: unlock3 } = (0, import_private_apis4.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 11174 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 11175 "@wordpress/global-styles-ui" 11176 ); 11177 11178 // packages/global-styles-ui/build-module/utils.mjs 11179 var { getViewportBreakpoints: getViewportBreakpoints2 } = unlock3(privateApis); 11180 var VALID_ELEMENT_STATES = { 11181 link: [ 11182 { value: ":link", label: (0, import_i18n.__)("Link") }, 11183 { value: ":any-link", label: (0, import_i18n.__)("Any Link") }, 11184 { value: ":visited", label: (0, import_i18n.__)("Visited") }, 11185 { value: ":hover", label: (0, import_i18n.__)("Hover") }, 11186 { value: ":focus", label: (0, import_i18n.__)("Focus") }, 11187 { value: ":focus-visible", label: (0, import_i18n.__)("Focus-visible") }, 11188 { value: ":active", label: (0, import_i18n.__)("Active") } 11189 ], 11190 button: [ 11191 { value: ":link", label: (0, import_i18n.__)("Link") }, 11192 { value: ":any-link", label: (0, import_i18n.__)("Any Link") }, 11193 { value: ":visited", label: (0, import_i18n.__)("Visited") }, 11194 { value: ":hover", label: (0, import_i18n.__)("Hover") }, 11195 { value: ":focus", label: (0, import_i18n.__)("Focus") }, 11196 { value: ":focus-visible", label: (0, import_i18n.__)("Focus-visible") }, 11197 { value: ":active", label: (0, import_i18n.__)("Active") } 11198 ] 11199 }; 11200 var VALID_BLOCK_STATES = { 11201 "core/button": [ 11202 { value: ":hover", label: (0, import_i18n.__)("Hover") }, 11203 { value: ":focus", label: (0, import_i18n.__)("Focus") }, 11204 { value: ":focus-visible", label: (0, import_i18n.__)("Focus-visible") }, 11205 { value: ":active", label: (0, import_i18n.__)("Active") } 11206 ] 11207 }; 11208 var RESPONSIVE_STATES = [ 11209 { value: "@tablet", label: (0, import_i18n.__)("Tablet") }, 11210 { value: "@mobile", label: (0, import_i18n.__)("Mobile") } 11211 ]; 11212 function removePropertiesFromObject(object, properties) { 11213 if (!properties?.length) { 11214 return object; 11215 } 11216 if (typeof object !== "object" || !object || !Object.keys(object).length) { 11217 return object; 11218 } 11219 for (const key in object) { 11220 if (properties.includes(key)) { 11221 delete object[key]; 11222 } else if (typeof object[key] === "object") { 11223 removePropertiesFromObject(object[key], properties); 11224 } 11225 } 11226 return object; 11227 } 11228 var filterObjectByProperties = (object, properties) => { 11229 if (!object || !properties?.length) { 11230 return {}; 11231 } 11232 const newObject = {}; 11233 Object.keys(object).forEach((key) => { 11234 if (properties.includes(key)) { 11235 newObject[key] = object[key]; 11236 } else if (typeof object[key] === "object") { 11237 const newFilter = filterObjectByProperties( 11238 object[key], 11239 properties 11240 ); 11241 if (Object.keys(newFilter).length) { 11242 newObject[key] = newFilter; 11243 } 11244 } 11245 }); 11246 return newObject; 11247 }; 11248 function isVariationWithProperties(variation, properties) { 11249 const variationWithProperties = filterObjectByProperties( 11250 structuredClone(variation), 11251 properties 11252 ); 11253 return areGlobalStylesEqual(variationWithProperties, variation); 11254 } 11255 function getFontFamilyFromSetting(fontFamilies, setting) { 11256 if (!Array.isArray(fontFamilies) || !setting) { 11257 return null; 11258 } 11259 const fontFamilyVariable = setting.replace("var(", "").replace(")", ""); 11260 const fontFamilySlug = fontFamilyVariable?.split("--").slice(-1)[0]; 11261 return fontFamilies.find( 11262 (fontFamily) => fontFamily.slug === fontFamilySlug 11263 ); 11264 } 11265 function getFontFamilies(themeJson) { 11266 const themeFontFamilies = themeJson?.settings?.typography?.fontFamilies?.theme; 11267 const customFontFamilies = themeJson?.settings?.typography?.fontFamilies?.custom; 11268 let fontFamilies = []; 11269 if (themeFontFamilies && customFontFamilies) { 11270 fontFamilies = [...themeFontFamilies, ...customFontFamilies]; 11271 } else if (themeFontFamilies) { 11272 fontFamilies = themeFontFamilies; 11273 } else if (customFontFamilies) { 11274 fontFamilies = customFontFamilies; 11275 } 11276 const bodyFontFamilySetting = themeJson?.styles?.typography?.fontFamily; 11277 const bodyFontFamily = getFontFamilyFromSetting( 11278 fontFamilies, 11279 bodyFontFamilySetting 11280 ); 11281 const headingFontFamilySetting = themeJson?.styles?.elements?.heading?.typography?.fontFamily; 11282 let headingFontFamily; 11283 if (!headingFontFamilySetting) { 11284 headingFontFamily = bodyFontFamily; 11285 } else { 11286 headingFontFamily = getFontFamilyFromSetting( 11287 fontFamilies, 11288 themeJson?.styles?.elements?.heading?.typography?.fontFamily 11289 ); 11290 } 11291 return [bodyFontFamily, headingFontFamily]; 11292 } 11293 11294 // packages/global-styles-ui/build-module/hooks.mjs 11295 k([a11y_default]); 11296 function useStyle(path, blockName, readFrom = "merged", shouldDecodeEncode = true, state) { 11297 const { user, base, merged, onChange } = (0, import_element22.useContext)(GlobalStylesContext); 11298 const statePathParts = state?.split(".").filter(Boolean) ?? []; 11299 const pseudoSelectorState = statePathParts.find( 11300 (value) => value.startsWith(":") 11301 ); 11302 const statePathWithoutPseudo = statePathParts.filter((value) => !value.startsWith(":")).join("."); 11303 const stylePath = [path, statePathWithoutPseudo].filter(Boolean).join("."); 11304 let sourceValue = merged; 11305 if (readFrom === "base") { 11306 sourceValue = base; 11307 } else if (readFrom === "user") { 11308 sourceValue = user; 11309 } 11310 const styleValue = (0, import_element22.useMemo)(() => { 11311 const rawValue = getStyle( 11312 sourceValue, 11313 stylePath, 11314 blockName, 11315 shouldDecodeEncode 11316 ); 11317 if (pseudoSelectorState) { 11318 return rawValue?.[pseudoSelectorState] ?? {}; 11319 } 11320 return rawValue; 11321 }, [ 11322 sourceValue, 11323 stylePath, 11324 blockName, 11325 shouldDecodeEncode, 11326 pseudoSelectorState 11327 ]); 11328 const setStyleValue = (0, import_element22.useCallback)( 11329 (newValue) => { 11330 let valueToSet = newValue; 11331 if (pseudoSelectorState) { 11332 const fullCurrentValue = getStyle( 11333 user, 11334 stylePath, 11335 blockName, 11336 false 11337 ); 11338 valueToSet = { 11339 ...fullCurrentValue, 11340 [pseudoSelectorState]: newValue 11341 }; 11342 } 11343 const newGlobalStyles = setStyle( 11344 user, 11345 stylePath, 11346 valueToSet, 11347 blockName 11348 ); 11349 onChange(newGlobalStyles); 11350 }, 11351 [user, onChange, stylePath, blockName, pseudoSelectorState] 11352 ); 11353 return [styleValue, setStyleValue]; 11354 } 11355 function useSetting(path, blockName, readFrom = "merged") { 11356 const { user, base, merged, onChange } = (0, import_element22.useContext)(GlobalStylesContext); 11357 let sourceValue = merged; 11358 if (readFrom === "base") { 11359 sourceValue = base; 11360 } else if (readFrom === "user") { 11361 sourceValue = user; 11362 } 11363 const settingValue = (0, import_element22.useMemo)( 11364 () => getSetting(sourceValue, path, blockName), 11365 [sourceValue, path, blockName] 11366 ); 11367 const setSettingValue = (0, import_element22.useCallback)( 11368 (newValue) => { 11369 const newGlobalStyles = setSetting( 11370 user, 11371 path, 11372 newValue, 11373 blockName 11374 ); 11375 onChange(newGlobalStyles); 11376 }, 11377 [user, onChange, path, blockName] 11378 ); 11379 return [settingValue, setSettingValue]; 11380 } 11381 var EMPTY_ARRAY2 = []; 11382 function hasThemeVariation({ 11383 title, 11384 settings, 11385 styles 11386 }) { 11387 return title === (0, import_i18n2.__)("Default") || Object.keys(settings || {}).length > 0 || Object.keys(styles || {}).length > 0; 11388 } 11389 function useCurrentMergeThemeStyleVariationsWithUserConfig(properties = []) { 11390 const { variationsFromTheme } = (0, import_data.useSelect)((select) => { 11391 const _variationsFromTheme = select( 11392 import_core_data.store 11393 ).__experimentalGetCurrentThemeGlobalStylesVariations?.(); 11394 return { 11395 variationsFromTheme: _variationsFromTheme || EMPTY_ARRAY2 11396 }; 11397 }, []); 11398 const { user: userVariation } = (0, import_element22.useContext)(GlobalStylesContext); 11399 return (0, import_element22.useMemo)(() => { 11400 const clonedUserVariation = structuredClone(userVariation); 11401 const userVariationWithoutProperties = removePropertiesFromObject( 11402 clonedUserVariation, 11403 properties 11404 ); 11405 userVariationWithoutProperties.title = (0, import_i18n2.__)("Default"); 11406 const variationsWithPropertiesAndBase = variationsFromTheme.filter((variation) => { 11407 return isVariationWithProperties(variation, properties); 11408 }).map((variation) => { 11409 return mergeGlobalStyles( 11410 userVariationWithoutProperties, 11411 variation 11412 ); 11413 }); 11414 const variationsByProperties = [ 11415 userVariationWithoutProperties, 11416 ...variationsWithPropertiesAndBase 11417 ]; 11418 return variationsByProperties?.length ? variationsByProperties.filter(hasThemeVariation) : []; 11419 }, [properties, userVariation, variationsFromTheme]); 11420 } 11421 11422 // packages/global-styles-ui/build-module/root-menu.mjs 11423 var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1); 11424 var { 11425 useHasDimensionsPanel, 11426 useHasTypographyPanel, 11427 useHasColorPanel, 11428 useSettingsForBlockElement, 11429 useHasBackgroundPanel 11430 } = unlock3(import_block_editor.privateApis); 11431 11432 // packages/global-styles-ui/build-module/preview-styles.mjs 11433 var import_components7 = __toESM(require_components(), 1); 11434 11435 // packages/global-styles-ui/build-module/preview-hooks.mjs 11436 function useStylesPreviewColors() { 11437 const [textColor = "black"] = useStyle("color.text"); 11438 const [backgroundColor = "white"] = useStyle("color.background"); 11439 const [headingColor = textColor] = useStyle( 11440 "elements.h1.color.text" 11441 ); 11442 const [linkColor = headingColor] = useStyle( 11443 "elements.link.color.text" 11444 ); 11445 const [buttonBackgroundColor = linkColor] = useStyle( 11446 "elements.button.color.background" 11447 ); 11448 const [coreColors] = useSetting("color.palette.core") || []; 11449 const [themeColors] = useSetting("color.palette.theme") || []; 11450 const [customColors] = useSetting("color.palette.custom") || []; 11451 const paletteColors = (themeColors ?? []).concat(customColors ?? []).concat(coreColors ?? []); 11452 const textColorObject = paletteColors.filter( 11453 ({ color }) => color === textColor 11454 ); 11455 const buttonBackgroundColorObject = paletteColors.filter( 11456 ({ color }) => color === buttonBackgroundColor 11457 ); 11458 const highlightedColors = textColorObject.concat(buttonBackgroundColorObject).concat(paletteColors).filter( 11459 // we exclude these background color because it is already visible in the preview. 11460 ({ color }) => color !== backgroundColor 11461 ).slice(0, 2); 11462 return { 11463 paletteColors, 11464 highlightedColors 11465 }; 11466 } 11467 11468 // packages/global-styles-ui/build-module/typography-example.mjs 11469 var import_element23 = __toESM(require_element(), 1); 11470 var import_components4 = __toESM(require_components(), 1); 11471 var import_i18n4 = __toESM(require_i18n(), 1); 11472 11473 // packages/global-styles-ui/build-module/font-library/utils/preview-styles.mjs 11474 function findNearest(input, numbers) { 11475 if (numbers.length === 0) { 11476 return null; 11477 } 11478 numbers.sort((a2, b2) => Math.abs(input - a2) - Math.abs(input - b2)); 11479 return numbers[0]; 11480 } 11481 function extractFontWeights(fontFaces) { 11482 const result = []; 11483 fontFaces.forEach((face) => { 11484 const weights = String(face.fontWeight).split(" "); 11485 if (weights.length === 2) { 11486 const start = parseInt(weights[0]); 11487 const end = parseInt(weights[1]); 11488 for (let i2 = start; i2 <= end; i2 += 100) { 11489 result.push(i2); 11490 } 11491 } else if (weights.length === 1) { 11492 result.push(parseInt(weights[0])); 11493 } 11494 }); 11495 return result; 11496 } 11497 function formatFontFamily(input) { 11498 const regex = /^(?!generic\([ a-zA-Z\-]+\)$)(?!^[a-zA-Z\-]+$).+/; 11499 const output = input.trim(); 11500 const formatItem = (item) => { 11501 item = item.trim(); 11502 if (item.match(regex)) { 11503 item = item.replace(/^["']|["']$/g, ""); 11504 return `"$item}"`; 11505 } 11506 return item; 11507 }; 11508 if (output.includes(",")) { 11509 return output.split(",").map(formatItem).filter((item) => item !== "").join(", "); 11510 } 11511 return formatItem(output); 11512 } 11513 function formatFontFaceName(input) { 11514 if (!input) { 11515 return ""; 11516 } 11517 let output = input.trim(); 11518 if (output.includes(",")) { 11519 output = (output.split(",").find((item) => item.trim() !== "") ?? "").trim(); 11520 } 11521 output = output.replace(/^["']|["']$/g, ""); 11522 if (window.navigator.userAgent.toLowerCase().includes("firefox")) { 11523 output = `"$output}"`; 11524 } 11525 return output; 11526 } 11527 function getFamilyPreviewStyle(family) { 11528 const style = { 11529 fontFamily: formatFontFamily(family.fontFamily) 11530 }; 11531 if (!("fontFace" in family) || !Array.isArray(family.fontFace)) { 11532 style.fontWeight = "400"; 11533 style.fontStyle = "normal"; 11534 return style; 11535 } 11536 if (family.fontFace) { 11537 const normalFaces = family.fontFace.filter( 11538 (face) => face?.fontStyle && face.fontStyle.toLowerCase() === "normal" 11539 ); 11540 if (normalFaces.length > 0) { 11541 style.fontStyle = "normal"; 11542 const normalWeights = extractFontWeights(normalFaces); 11543 const nearestWeight = findNearest(400, normalWeights); 11544 style.fontWeight = String(nearestWeight) || "400"; 11545 } else { 11546 style.fontStyle = family.fontFace.length && family.fontFace[0].fontStyle || "normal"; 11547 style.fontWeight = family.fontFace.length && String(family.fontFace[0].fontWeight) || "400"; 11548 } 11549 } 11550 return style; 11551 } 11552 function getFacePreviewStyle(face) { 11553 return { 11554 fontFamily: formatFontFamily(face.fontFamily), 11555 fontStyle: face.fontStyle || "normal", 11556 fontWeight: face.fontWeight || "400" 11557 }; 11558 } 11559 11560 // packages/global-styles-ui/build-module/typography-example.mjs 11561 var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1); 11562 function PreviewTypography({ 11563 fontSize, 11564 variation 11565 }) { 11566 const { base } = (0, import_element23.useContext)(GlobalStylesContext); 11567 let config = base; 11568 if (variation) { 11569 config = { ...base, ...variation }; 11570 } 11571 const [textColor] = useStyle("color.text"); 11572 const [bodyFontFamilies, headingFontFamilies] = getFontFamilies(config); 11573 const bodyPreviewStyle = bodyFontFamilies ? getFamilyPreviewStyle(bodyFontFamilies) : {}; 11574 const headingPreviewStyle = headingFontFamilies ? getFamilyPreviewStyle(headingFontFamilies) : {}; 11575 if (textColor) { 11576 bodyPreviewStyle.color = textColor; 11577 headingPreviewStyle.color = textColor; 11578 } 11579 if (fontSize) { 11580 bodyPreviewStyle.fontSize = fontSize; 11581 headingPreviewStyle.fontSize = fontSize; 11582 } 11583 return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)( 11584 import_components4.__unstableMotion.div, 11585 { 11586 animate: { 11587 scale: 1, 11588 opacity: 1 11589 }, 11590 initial: { 11591 scale: 0.1, 11592 opacity: 0 11593 }, 11594 transition: { 11595 delay: 0.3, 11596 type: "tween" 11597 }, 11598 style: { 11599 textAlign: "center", 11600 lineHeight: 1 11601 }, 11602 children: [ 11603 /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { style: headingPreviewStyle, children: (0, import_i18n4._x)("A", "Uppercase letter A") }), 11604 /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { style: bodyPreviewStyle, children: (0, import_i18n4._x)("a", "Lowercase letter A") }) 11605 ] 11606 } 11607 ); 11608 } 11609 11610 // packages/global-styles-ui/build-module/highlighted-colors.mjs 11611 var import_components5 = __toESM(require_components(), 1); 11612 var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1); 11613 function HighlightedColors({ 11614 normalizedColorSwatchSize, 11615 ratio 11616 }) { 11617 const { highlightedColors } = useStylesPreviewColors(); 11618 const scaledSwatchSize = normalizedColorSwatchSize * ratio; 11619 return highlightedColors.map(({ slug, color }, index2) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)( 11620 import_components5.__unstableMotion.div, 11621 { 11622 style: { 11623 height: scaledSwatchSize, 11624 width: scaledSwatchSize, 11625 background: color, 11626 borderRadius: scaledSwatchSize / 2 11627 }, 11628 animate: { 11629 scale: 1, 11630 opacity: 1 11631 }, 11632 initial: { 11633 scale: 0.1, 11634 opacity: 0 11635 }, 11636 transition: { 11637 delay: index2 === 1 ? 0.2 : 0.1 11638 } 11639 }, 11640 `$slug}-$index2}` 11641 )); 11642 } 11643 11644 // packages/global-styles-ui/build-module/preview-wrapper.mjs 11645 var import_components6 = __toESM(require_components(), 1); 11646 var import_compose = __toESM(require_compose(), 1); 11647 var import_element24 = __toESM(require_element(), 1); 11648 var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1); 11649 var normalizedWidth = 248; 11650 var normalizedHeight = 152; 11651 var THROTTLE_OPTIONS = { 11652 leading: true, 11653 trailing: true 11654 }; 11655 function PreviewWrapper({ 11656 children, 11657 label, 11658 isFocused, 11659 withHoverView 11660 }) { 11661 const [backgroundColor = "white"] = useStyle("color.background"); 11662 const [gradientValue] = useStyle("color.gradient"); 11663 const disableMotion = (0, import_compose.useReducedMotion)(); 11664 const [isHovered, setIsHovered] = (0, import_element24.useState)(false); 11665 const [containerResizeListener, { width }] = (0, import_compose.useResizeObserver)(); 11666 const [throttledWidth, setThrottledWidthState] = (0, import_element24.useState)(width); 11667 const [ratioState, setRatioState] = (0, import_element24.useState)(); 11668 const setThrottledWidth = (0, import_compose.useThrottle)( 11669 setThrottledWidthState, 11670 250, 11671 THROTTLE_OPTIONS 11672 ); 11673 (0, import_element24.useLayoutEffect)(() => { 11674 if (width) { 11675 setThrottledWidth(width); 11676 } 11677 }, [width, setThrottledWidth]); 11678 (0, import_element24.useLayoutEffect)(() => { 11679 const newRatio = throttledWidth ? throttledWidth / normalizedWidth : 1; 11680 const ratioDiff = newRatio - (ratioState || 0); 11681 const isRatioDiffBigEnough = Math.abs(ratioDiff) > 0.1; 11682 if (isRatioDiffBigEnough || !ratioState) { 11683 setRatioState(newRatio); 11684 } 11685 }, [throttledWidth, ratioState]); 11686 const fallbackRatio = width ? width / normalizedWidth : 1; 11687 const ratio = ratioState ? ratioState : fallbackRatio; 11688 const isReady = !!width; 11689 return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [ 11690 /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { style: { position: "relative" }, children: containerResizeListener }), 11691 !isReady && // Match the preview aspect ratio so layout doesn't jump once width is measured. 11692 /* @__PURE__ */ (0, import_jsx_runtime31.jsx)( 11693 Skeleton, 11694 { 11695 className: "global-styles-ui-preview__wrapper", 11696 style: { 11697 aspectRatio: normalizedWidth / normalizedHeight 11698 } 11699 } 11700 ), 11701 isReady && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)( 11702 "div", 11703 { 11704 className: clsx_default("global-styles-ui-preview__wrapper", { 11705 "is-hoverable": withHoverView 11706 }), 11707 style: { 11708 height: normalizedHeight * ratio 11709 }, 11710 onMouseEnter: () => setIsHovered(true), 11711 onMouseLeave: () => setIsHovered(false), 11712 tabIndex: -1, 11713 children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)( 11714 import_components6.__unstableMotion.div, 11715 { 11716 style: { 11717 height: normalizedHeight * ratio, 11718 width: "100%", 11719 background: gradientValue ?? backgroundColor 11720 }, 11721 initial: "start", 11722 animate: (isHovered || isFocused) && !disableMotion && label ? "hover" : "start", 11723 children: [].concat(children).map( 11724 (child, key) => child({ ratio, key }) 11725 ) 11726 } 11727 ) 11728 } 11729 ) 11730 ] }); 11731 } 11732 var preview_wrapper_default = PreviewWrapper; 11733 11734 // packages/global-styles-ui/build-module/preview-styles.mjs 11735 var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1); 11736 var firstFrameVariants = { 11737 start: { 11738 scale: 1, 11739 opacity: 1 11740 }, 11741 hover: { 11742 scale: 0, 11743 opacity: 0 11744 } 11745 }; 11746 var midFrameVariants = { 11747 hover: { 11748 opacity: 1 11749 }, 11750 start: { 11751 opacity: 0.5 11752 } 11753 }; 11754 var secondFrameVariants = { 11755 hover: { 11756 scale: 1, 11757 opacity: 1 11758 }, 11759 start: { 11760 scale: 0, 11761 opacity: 0 11762 } 11763 }; 11764 function PreviewStyles({ 11765 label, 11766 isFocused, 11767 withHoverView, 11768 variation 11769 }) { 11770 const [fontWeight] = useStyle("typography.fontWeight"); 11771 const [fontFamily = "serif"] = useStyle( 11772 "typography.fontFamily" 11773 ); 11774 const [headingFontFamily = fontFamily] = useStyle( 11775 "elements.h1.typography.fontFamily" 11776 ); 11777 const [headingFontWeight = fontWeight] = useStyle( 11778 "elements.h1.typography.fontWeight" 11779 ); 11780 const [textColor = "black"] = useStyle("color.text"); 11781 const [headingColor = textColor] = useStyle( 11782 "elements.h1.color.text" 11783 ); 11784 const { paletteColors } = useStylesPreviewColors(); 11785 return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)( 11786 preview_wrapper_default, 11787 { 11788 label, 11789 isFocused, 11790 withHoverView, 11791 children: [ 11792 ({ ratio, key }) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)( 11793 import_components7.__unstableMotion.div, 11794 { 11795 variants: firstFrameVariants, 11796 style: { 11797 height: "100%", 11798 overflow: "hidden" 11799 }, 11800 children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)( 11801 import_components7.__experimentalHStack, 11802 { 11803 spacing: 10 * ratio, 11804 justify: "center", 11805 style: { 11806 height: "100%", 11807 overflow: "hidden" 11808 }, 11809 children: [ 11810 /* @__PURE__ */ (0, import_jsx_runtime32.jsx)( 11811 PreviewTypography, 11812 { 11813 fontSize: 65 * ratio, 11814 variation 11815 } 11816 ), 11817 /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_components7.__experimentalVStack, { spacing: 4 * ratio, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)( 11818 HighlightedColors, 11819 { 11820 normalizedColorSwatchSize: 32, 11821 ratio 11822 } 11823 ) }) 11824 ] 11825 } 11826 ) 11827 }, 11828 key 11829 ), 11830 ({ key }) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)( 11831 import_components7.__unstableMotion.div, 11832 { 11833 variants: withHoverView ? midFrameVariants : void 0, 11834 style: { 11835 height: "100%", 11836 width: "100%", 11837 position: "absolute", 11838 top: 0, 11839 overflow: "hidden", 11840 filter: "blur(60px)", 11841 opacity: 0.1 11842 }, 11843 children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)( 11844 import_components7.__experimentalHStack, 11845 { 11846 spacing: 0, 11847 justify: "flex-start", 11848 style: { 11849 height: "100%", 11850 overflow: "hidden" 11851 }, 11852 children: paletteColors.slice(0, 4).map(({ color }, index2) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)( 11853 "div", 11854 { 11855 style: { 11856 height: "100%", 11857 background: color, 11858 flexGrow: 1 11859 } 11860 }, 11861 index2 11862 )) 11863 } 11864 ) 11865 }, 11866 key 11867 ), 11868 ({ ratio, key }) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)( 11869 import_components7.__unstableMotion.div, 11870 { 11871 variants: secondFrameVariants, 11872 style: { 11873 height: "100%", 11874 width: "100%", 11875 overflow: "hidden", 11876 position: "absolute", 11877 top: 0 11878 }, 11879 children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)( 11880 import_components7.__experimentalVStack, 11881 { 11882 spacing: 3 * ratio, 11883 justify: "center", 11884 style: { 11885 height: "100%", 11886 overflow: "hidden", 11887 padding: 10 * ratio, 11888 boxSizing: "border-box" 11889 }, 11890 children: label && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)( 11891 "div", 11892 { 11893 style: { 11894 fontSize: 40 * ratio, 11895 fontFamily: headingFontFamily, 11896 color: headingColor, 11897 fontWeight: headingFontWeight, 11898 lineHeight: "1em", 11899 textAlign: "center" 11900 }, 11901 children: label 11902 } 11903 ) 11904 } 11905 ) 11906 }, 11907 key 11908 ) 11909 ] 11910 } 11911 ); 11912 } 11913 var preview_styles_default = PreviewStyles; 11914 11915 // packages/global-styles-ui/build-module/screen-root.mjs 11916 var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1); 11917 11918 // packages/global-styles-ui/build-module/screen-block-list.mjs 11919 var import_blocks2 = __toESM(require_blocks(), 1); 11920 var import_i18n7 = __toESM(require_i18n(), 1); 11921 var import_components11 = __toESM(require_components(), 1); 11922 var import_data4 = __toESM(require_data(), 1); 11923 var import_element25 = __toESM(require_element(), 1); 11924 var import_block_editor3 = __toESM(require_block_editor(), 1); 11925 var import_compose2 = __toESM(require_compose(), 1); 11926 import { speak } from "@wordpress/a11y"; 11927 11928 // packages/global-styles-ui/build-module/variations/variations-panel.mjs 11929 var import_blocks = __toESM(require_blocks(), 1); 11930 var import_data3 = __toESM(require_data(), 1); 11931 var import_components9 = __toESM(require_components(), 1); 11932 var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1); 11933 function getFilteredBlockStyles(blockStyles, variations) { 11934 return blockStyles?.filter( 11935 (style) => style.source === "block" || variations.includes(style.name) 11936 ) || []; 11937 } 11938 function useBlockVariations(name2) { 11939 const blockStyles = (0, import_data3.useSelect)( 11940 (select) => { 11941 const { getBlockStyles } = select(import_blocks.store); 11942 return getBlockStyles(name2); 11943 }, 11944 [name2] 11945 ); 11946 const [variations] = useStyle("variations", name2); 11947 const variationNames = Object.keys(variations ?? {}); 11948 return getFilteredBlockStyles(blockStyles, variationNames); 11949 } 11950 11951 // packages/global-styles-ui/build-module/screen-header.mjs 11952 var import_components10 = __toESM(require_components(), 1); 11953 var import_i18n6 = __toESM(require_i18n(), 1); 11954 var import_block_editor2 = __toESM(require_block_editor(), 1); 11955 var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1); 11956 var { StateControl, StateControlBadges } = unlock3(import_block_editor2.privateApis); 11957 11958 // packages/global-styles-ui/build-module/screen-block-list.mjs 11959 var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1); 11960 var { 11961 useHasDimensionsPanel: useHasDimensionsPanel2, 11962 useHasTypographyPanel: useHasTypographyPanel2, 11963 useHasBorderPanel, 11964 useSettingsForBlockElement: useSettingsForBlockElement2, 11965 useHasColorPanel: useHasColorPanel2, 11966 useHasBackgroundPanel: useHasBackgroundPanel2 11967 } = unlock3(import_block_editor3.privateApis); 11968 function useSortedBlockTypes() { 11969 const blockItems = (0, import_data4.useSelect)( 11970 (select) => select(import_blocks2.store).getBlockTypes(), 11971 [] 11972 ); 11973 const groupByType = (blocks, block) => { 11974 const { core, noncore } = blocks; 11975 const type = block.name.startsWith("core/") ? core : noncore; 11976 type.push(block); 11977 return blocks; 11978 }; 11979 const { core: coreItems, noncore: nonCoreItems } = blockItems.reduce( 11980 groupByType, 11981 { core: [], noncore: [] } 11982 ); 11983 return [...coreItems, ...nonCoreItems]; 11984 } 11985 function useBlockHasGlobalStyles(blockName) { 11986 const [rawSettings] = useSetting("", blockName); 11987 const settings = useSettingsForBlockElement2(rawSettings, blockName); 11988 const hasTypographyPanel = useHasTypographyPanel2(settings); 11989 const hasColorPanel = useHasColorPanel2(settings); 11990 const hasBackgroundPanel = useHasBackgroundPanel2(settings); 11991 const hasBorderPanel = useHasBorderPanel(settings); 11992 const hasDimensionsPanel = useHasDimensionsPanel2(settings); 11993 const hasLayoutPanel = hasBorderPanel || hasDimensionsPanel; 11994 const hasVariationsPanel = !!useBlockVariations(blockName)?.length; 11995 const hasGlobalStyles = hasTypographyPanel || hasColorPanel || hasBackgroundPanel || hasLayoutPanel || hasVariationsPanel; 11996 return hasGlobalStyles; 11997 } 11998 function BlockMenuItem({ block }) { 11999 const hasBlockMenuItem = useBlockHasGlobalStyles(block.name); 12000 if (!hasBlockMenuItem) { 12001 return null; 12002 } 12003 return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)( 12004 NavigationButtonAsItem, 12005 { 12006 path: "/blocks/" + encodeURIComponent(block.name), 12007 children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_components11.__experimentalHStack, { justify: "flex-start", children: [ 12008 /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_block_editor3.BlockIcon, { icon: block.icon }), 12009 /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_components11.FlexItem, { children: block.title }) 12010 ] }) 12011 } 12012 ); 12013 } 12014 function BlockList({ filterValue }) { 12015 const sortedBlockTypes = useSortedBlockTypes(); 12016 const debouncedSpeak = (0, import_compose2.useDebounce)(speak, 500); 12017 const { isMatchingSearchTerm } = (0, import_data4.useSelect)(import_blocks2.store); 12018 const filteredBlockTypes = !filterValue ? sortedBlockTypes : sortedBlockTypes.filter( 12019 (blockType) => isMatchingSearchTerm(blockType, filterValue) 12020 ); 12021 const blockTypesListRef = (0, import_element25.useRef)(null); 12022 (0, import_element25.useEffect)(() => { 12023 if (!filterValue) { 12024 return; 12025 } 12026 const count = blockTypesListRef.current?.childElementCount || 0; 12027 const resultsFoundMessage = (0, import_i18n7.sprintf)( 12028 /* translators: %d: number of results. */ 12029 (0, import_i18n7._n)("%d result found.", "%d results found.", count), 12030 count 12031 ); 12032 debouncedSpeak(resultsFoundMessage, "polite"); 12033 }, [filterValue, debouncedSpeak]); 12034 return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)( 12035 "div", 12036 { 12037 ref: blockTypesListRef, 12038 className: "global-styles-ui-block-types-item-list", 12039 role: "list", 12040 children: filteredBlockTypes.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_components11.__experimentalText, { align: "center", as: "p", children: (0, import_i18n7.__)("No blocks found.") }) : filteredBlockTypes.map((block) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)( 12041 BlockMenuItem, 12042 { 12043 block 12044 }, 12045 "menu-itemblock-" + block.name 12046 )) 12047 } 12048 ); 12049 } 12050 var MemoizedBlockList = (0, import_element25.memo)(BlockList); 12051 12052 // packages/global-styles-ui/build-module/screen-block.mjs 12053 var import_blocks4 = __toESM(require_blocks(), 1); 12054 var import_block_editor5 = __toESM(require_block_editor(), 1); 12055 var import_element27 = __toESM(require_element(), 1); 12056 var import_data5 = __toESM(require_data(), 1); 12057 var import_core_data3 = __toESM(require_core_data(), 1); 12058 var import_components14 = __toESM(require_components(), 1); 12059 var import_i18n8 = __toESM(require_i18n(), 1); 12060 12061 // packages/global-styles-ui/build-module/block-preview-panel.mjs 12062 var import_block_editor4 = __toESM(require_block_editor(), 1); 12063 var import_blocks3 = __toESM(require_blocks(), 1); 12064 var import_components12 = __toESM(require_components(), 1); 12065 var import_element26 = __toESM(require_element(), 1); 12066 var import_jsx_runtime37 = __toESM(require_jsx_runtime(), 1); 12067 var { getViewportBreakpoints: getViewportBreakpoints3, getViewportBreakpointValueInPixels: getViewportBreakpointValueInPixels2 } = unlock3( 12068 privateApis 12069 ); 12070 12071 // packages/global-styles-ui/build-module/subtitle.mjs 12072 var import_components13 = __toESM(require_components(), 1); 12073 var import_jsx_runtime38 = __toESM(require_jsx_runtime(), 1); 12074 function Subtitle({ children, level = 2 }) { 12075 return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_components13.__experimentalHeading, { className: "global-styles-ui-subtitle", level, children }); 12076 } 12077 12078 // packages/global-styles-ui/build-module/screen-block.mjs 12079 var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1); 12080 var { 12081 useHasDimensionsPanel: useHasDimensionsPanel3, 12082 useHasTypographyPanel: useHasTypographyPanel3, 12083 useHasBorderPanel: useHasBorderPanel2, 12084 useSettingsForBlockElement: useSettingsForBlockElement3, 12085 useHasColorPanel: useHasColorPanel3, 12086 useHasFiltersPanel, 12087 useHasImageSettingsPanel, 12088 useHasBackgroundPanel: useHasBackgroundPanel3, 12089 BackgroundPanel: StylesBackgroundPanel, 12090 BorderPanel: StylesBorderPanel, 12091 ColorPanel: StylesColorPanel, 12092 TypographyPanel: StylesTypographyPanel, 12093 DimensionsPanel: StylesDimensionsPanel, 12094 FiltersPanel: StylesFiltersPanel, 12095 ImageSettingsPanel, 12096 AdvancedPanel: StylesAdvancedPanel 12097 } = unlock3(import_block_editor5.privateApis); 12098 12099 // packages/global-styles-ui/build-module/screen-typography.mjs 12100 var import_i18n22 = __toESM(require_i18n(), 1); 12101 var import_components33 = __toESM(require_components(), 1); 12102 var import_element39 = __toESM(require_element(), 1); 12103 12104 // packages/global-styles-ui/build-module/screen-body.mjs 12105 var import_components15 = __toESM(require_components(), 1); 12106 var import_jsx_runtime40 = __toESM(require_jsx_runtime(), 1); 12107 12108 // packages/global-styles-ui/build-module/typography-elements.mjs 12109 var import_i18n9 = __toESM(require_i18n(), 1); 12110 var import_components16 = __toESM(require_components(), 1); 12111 var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1); 12112 12113 // packages/global-styles-ui/build-module/variations/variations-typography.mjs 12114 var import_components18 = __toESM(require_components(), 1); 12115 12116 // packages/global-styles-ui/build-module/preview-typography.mjs 12117 var import_components17 = __toESM(require_components(), 1); 12118 var import_jsx_runtime42 = __toESM(require_jsx_runtime(), 1); 12119 var StylesPreviewTypography = ({ 12120 variation, 12121 isFocused, 12122 withHoverView 12123 }) => { 12124 return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)( 12125 preview_wrapper_default, 12126 { 12127 label: variation.title, 12128 isFocused, 12129 withHoverView, 12130 children: ({ ratio, key }) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)( 12131 import_components17.__experimentalHStack, 12132 { 12133 spacing: 10 * ratio, 12134 justify: "center", 12135 style: { 12136 height: "100%", 12137 overflow: "hidden" 12138 }, 12139 children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)( 12140 PreviewTypography, 12141 { 12142 variation, 12143 fontSize: 85 * ratio 12144 } 12145 ) 12146 }, 12147 key 12148 ) 12149 } 12150 ); 12151 }; 12152 var preview_typography_default = StylesPreviewTypography; 12153 12154 // packages/global-styles-ui/build-module/variations/variation.mjs 12155 var import_element28 = __toESM(require_element(), 1); 12156 var import_keycodes = __toESM(require_keycodes(), 1); 12157 var import_i18n10 = __toESM(require_i18n(), 1); 12158 var import_jsx_runtime43 = __toESM(require_jsx_runtime(), 1); 12159 function Variation({ 12160 variation, 12161 children, 12162 isPill = false, 12163 properties, 12164 showTooltip = false 12165 }) { 12166 const [isFocused, setIsFocused] = (0, import_element28.useState)(false); 12167 const { 12168 base, 12169 user, 12170 onChange: setUserConfig 12171 } = (0, import_element28.useContext)(GlobalStylesContext); 12172 const context = (0, import_element28.useMemo)(() => { 12173 let merged = mergeGlobalStyles(base, variation); 12174 if (properties) { 12175 merged = filterObjectByProperties(merged, properties); 12176 } 12177 return { 12178 user: variation, 12179 base, 12180 merged, 12181 onChange: () => { 12182 } 12183 }; 12184 }, [variation, base, properties]); 12185 const selectVariation = () => setUserConfig(variation); 12186 const selectOnEnter = (event) => { 12187 if (event.keyCode === import_keycodes.ENTER) { 12188 event.preventDefault(); 12189 selectVariation(); 12190 } 12191 }; 12192 const isActive = (0, import_element28.useMemo)( 12193 () => areGlobalStylesEqual(user, variation), 12194 [user, variation] 12195 ); 12196 let label = variation?.title; 12197 if (variation?.description) { 12198 label = (0, import_i18n10.sprintf)( 12199 /* translators: 1: variation title. 2: variation description. */ 12200 (0, import_i18n10._x)("%1$s (%2$s)", "variation label"), 12201 variation?.title, 12202 variation?.description 12203 ); 12204 } 12205 const content = /* @__PURE__ */ (0, import_jsx_runtime43.jsx)( 12206 "div", 12207 { 12208 className: clsx_default("global-styles-ui-variations_item", { 12209 "is-active": isActive 12210 }), 12211 role: "button", 12212 onClick: selectVariation, 12213 onKeyDown: selectOnEnter, 12214 tabIndex: 0, 12215 "aria-label": label, 12216 "aria-current": isActive, 12217 onFocus: () => setIsFocused(true), 12218 onBlur: () => setIsFocused(false), 12219 children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)( 12220 "div", 12221 { 12222 className: clsx_default("global-styles-ui-variations_item-preview", { 12223 "is-pill": isPill 12224 }), 12225 children: children(isFocused) 12226 } 12227 ) 12228 } 12229 ); 12230 return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(GlobalStylesContext.Provider, { value: context, children: showTooltip ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(tooltip_exports.Root, { children: [ 12231 /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(tooltip_exports.Trigger, { render: content }), 12232 /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(tooltip_exports.Popup, { children: variation?.title }) 12233 ] }) : content }); 12234 } 12235 12236 // packages/global-styles-ui/build-module/variations/variations-typography.mjs 12237 var import_jsx_runtime44 = __toESM(require_jsx_runtime(), 1); 12238 var propertiesToFilter = ["typography"]; 12239 function TypographyVariations({ 12240 title, 12241 gap = 2 12242 }) { 12243 const typographyVariations = useCurrentMergeThemeStyleVariationsWithUserConfig(propertiesToFilter); 12244 if (typographyVariations?.length <= 1) { 12245 return null; 12246 } 12247 return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_components18.__experimentalVStack, { spacing: 3, children: [ 12248 title && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Subtitle, { level: 3, children: title }), 12249 /* @__PURE__ */ (0, import_jsx_runtime44.jsx)( 12250 import_components18.__experimentalGrid, 12251 { 12252 columns: 3, 12253 gap, 12254 className: "global-styles-ui-style-variations-container", 12255 children: typographyVariations.map( 12256 (variation, index2) => { 12257 return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)( 12258 Variation, 12259 { 12260 variation, 12261 properties: propertiesToFilter, 12262 showTooltip: true, 12263 children: () => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)( 12264 preview_typography_default, 12265 { 12266 variation 12267 } 12268 ) 12269 }, 12270 index2 12271 ); 12272 } 12273 ) 12274 } 12275 ) 12276 ] }); 12277 } 12278 12279 // packages/global-styles-ui/build-module/font-families.mjs 12280 var import_i18n20 = __toESM(require_i18n(), 1); 12281 var import_components31 = __toESM(require_components(), 1); 12282 var import_element38 = __toESM(require_element(), 1); 12283 12284 // packages/global-styles-ui/build-module/font-library/context.mjs 12285 var import_element29 = __toESM(require_element(), 1); 12286 var import_data6 = __toESM(require_data(), 1); 12287 var import_core_data5 = __toESM(require_core_data(), 1); 12288 var import_i18n12 = __toESM(require_i18n(), 1); 12289 12290 // packages/global-styles-ui/build-module/font-library/api.mjs 12291 var import_api_fetch = __toESM(require_api_fetch(), 1); 12292 var import_core_data4 = __toESM(require_core_data(), 1); 12293 var FONT_FAMILIES_URL = "/wp/v2/font-families"; 12294 function invalidateFontFamilyCache(registry) { 12295 const { receiveEntityRecords } = registry.dispatch(import_core_data4.store); 12296 receiveEntityRecords( 12297 "postType", 12298 "wp_font_family", 12299 [], 12300 void 0, 12301 true 12302 // invalidateCache 12303 ); 12304 } 12305 async function fetchInstallFontFamily(data, registry) { 12306 const config = { 12307 path: FONT_FAMILIES_URL, 12308 method: "POST", 12309 body: data 12310 }; 12311 const response = await (0, import_api_fetch.default)(config); 12312 invalidateFontFamilyCache(registry); 12313 return { 12314 id: response.id, 12315 ...response.font_family_settings, 12316 fontFace: [] 12317 }; 12318 } 12319 async function fetchInstallFontFace(fontFamilyId, data, registry) { 12320 const config = { 12321 path: `$FONT_FAMILIES_URL}/$fontFamilyId}/font-faces`, 12322 method: "POST", 12323 body: data 12324 }; 12325 const response = await (0, import_api_fetch.default)(config); 12326 invalidateFontFamilyCache(registry); 12327 return { 12328 id: response.id, 12329 ...response.font_face_settings 12330 }; 12331 } 12332 12333 // packages/global-styles-ui/build-module/font-library/utils/index.mjs 12334 var import_components19 = __toESM(require_components(), 1); 12335 12336 // packages/global-styles-ui/build-module/font-library/utils/constants.mjs 12337 var import_i18n11 = __toESM(require_i18n(), 1); 12338 var ALLOWED_FILE_EXTENSIONS = ["otf", "ttf", "woff", "woff2"]; 12339 var FONT_WEIGHTS = { 12340 100: (0, import_i18n11._x)("Thin", "font weight"), 12341 200: (0, import_i18n11._x)("Extra-light", "font weight"), 12342 300: (0, import_i18n11._x)("Light", "font weight"), 12343 400: (0, import_i18n11._x)("Normal", "font weight"), 12344 500: (0, import_i18n11._x)("Medium", "font weight"), 12345 600: (0, import_i18n11._x)("Semi-bold", "font weight"), 12346 700: (0, import_i18n11._x)("Bold", "font weight"), 12347 800: (0, import_i18n11._x)("Extra-bold", "font weight"), 12348 900: (0, import_i18n11._x)("Black", "font weight") 12349 }; 12350 var FONT_STYLES = { 12351 normal: (0, import_i18n11._x)("Normal", "font style"), 12352 italic: (0, import_i18n11._x)("Italic", "font style") 12353 }; 12354 12355 // packages/global-styles-ui/build-module/font-library/utils/index.mjs 12356 var { File } = window; 12357 var { kebabCase } = unlock3(import_components19.privateApis); 12358 function setUIValuesNeeded(font2, extraValues = {}) { 12359 if (!font2.name && (font2.fontFamily || font2.slug)) { 12360 font2.name = font2.fontFamily || font2.slug; 12361 } 12362 return { 12363 ...font2, 12364 ...extraValues 12365 }; 12366 } 12367 function isUrlEncoded(url) { 12368 if (typeof url !== "string") { 12369 return false; 12370 } 12371 return url !== decodeURIComponent(url); 12372 } 12373 function getFontFaceVariantName(face) { 12374 const weightName = FONT_WEIGHTS[face.fontWeight ?? ""] || face.fontWeight; 12375 const styleName = face.fontStyle === "normal" ? "" : FONT_STYLES[face.fontStyle ?? ""] || face.fontStyle; 12376 return `$weightName} $styleName}`; 12377 } 12378 function mergeFontFaces(existing = [], incoming = []) { 12379 const map = /* @__PURE__ */ new Map(); 12380 for (const face of existing) { 12381 map.set(`$face.fontWeight}$face.fontStyle}`, face); 12382 } 12383 for (const face of incoming) { 12384 map.set(`$face.fontWeight}$face.fontStyle}`, face); 12385 } 12386 return Array.from(map.values()); 12387 } 12388 function mergeFontFamilies(existing = [], incoming = []) { 12389 const map = /* @__PURE__ */ new Map(); 12390 for (const font2 of existing) { 12391 map.set(font2.slug, { ...font2 }); 12392 } 12393 for (const font2 of incoming) { 12394 if (map.has(font2.slug)) { 12395 const { fontFace: incomingFontFaces, ...restIncoming } = font2; 12396 const existingFont = map.get(font2.slug); 12397 const mergedFontFaces = mergeFontFaces( 12398 existingFont.fontFace, 12399 incomingFontFaces 12400 ); 12401 map.set(font2.slug, { 12402 ...restIncoming, 12403 fontFace: mergedFontFaces 12404 }); 12405 } else { 12406 map.set(font2.slug, { ...font2 }); 12407 } 12408 } 12409 return Array.from(map.values()); 12410 } 12411 async function loadFontFaceInBrowser(fontFace, source, addTo = "all") { 12412 let dataSource; 12413 if (typeof source === "string") { 12414 dataSource = `url($source})`; 12415 } else if (source instanceof File) { 12416 dataSource = await source.arrayBuffer(); 12417 } else { 12418 return; 12419 } 12420 const newFont = new window.FontFace( 12421 formatFontFaceName(fontFace.fontFamily), 12422 dataSource, 12423 { 12424 style: fontFace.fontStyle, 12425 weight: String(fontFace.fontWeight) 12426 } 12427 ); 12428 const loadedFace = await newFont.load(); 12429 if (addTo === "document" || addTo === "all") { 12430 document.fonts.add(loadedFace); 12431 } 12432 if (addTo === "iframe" || addTo === "all") { 12433 const iframe = document.querySelector( 12434 'iframe[name="editor-canvas"]' 12435 ); 12436 if (iframe?.contentDocument) { 12437 iframe.contentDocument.fonts.add(loadedFace); 12438 } 12439 } 12440 } 12441 function unloadFontFaceInBrowser(fontFace, removeFrom = "all") { 12442 const unloadFontFace = (fonts) => { 12443 fonts.forEach((f2) => { 12444 if (f2.family === formatFontFaceName(fontFace?.fontFamily) && f2.weight === fontFace?.fontWeight && f2.style === fontFace?.fontStyle) { 12445 fonts.delete(f2); 12446 } 12447 }); 12448 }; 12449 if (removeFrom === "document" || removeFrom === "all") { 12450 unloadFontFace(document.fonts); 12451 } 12452 if (removeFrom === "iframe" || removeFrom === "all") { 12453 const iframe = document.querySelector( 12454 'iframe[name="editor-canvas"]' 12455 ); 12456 if (iframe?.contentDocument) { 12457 unloadFontFace(iframe.contentDocument.fonts); 12458 } 12459 } 12460 } 12461 function getDisplaySrcFromFontFace(input) { 12462 if (!input) { 12463 return; 12464 } 12465 let src; 12466 if (Array.isArray(input)) { 12467 src = input[0]; 12468 } else { 12469 src = input; 12470 } 12471 if (src.startsWith("file:.")) { 12472 return; 12473 } 12474 if (!isUrlEncoded(src)) { 12475 src = encodeURI(src); 12476 } 12477 return src; 12478 } 12479 function makeFontFamilyFormData(fontFamily) { 12480 const formData = new FormData(); 12481 const { fontFace, category, ...familyWithValidParameters } = fontFamily; 12482 const fontFamilySettings = { 12483 ...familyWithValidParameters, 12484 slug: kebabCase(fontFamily.slug) 12485 }; 12486 formData.append( 12487 "font_family_settings", 12488 JSON.stringify(fontFamilySettings) 12489 ); 12490 return formData; 12491 } 12492 function makeFontFacesFormData(font2) { 12493 const fontFacesFormData = (font2?.fontFace ?? []).map( 12494 (item, faceIndex) => { 12495 const face = { ...item }; 12496 const formData = new FormData(); 12497 if (face.file) { 12498 const files = Array.isArray(face.file) ? face.file : [face.file]; 12499 const src = []; 12500 files.forEach((file, key) => { 12501 const fileId = `file-$faceIndex}-$key}`; 12502 formData.append(fileId, file, file.name); 12503 src.push(fileId); 12504 }); 12505 face.src = src.length === 1 ? src[0] : src; 12506 delete face.file; 12507 formData.append("font_face_settings", JSON.stringify(face)); 12508 } else { 12509 formData.append("font_face_settings", JSON.stringify(face)); 12510 } 12511 return formData; 12512 } 12513 ); 12514 return fontFacesFormData; 12515 } 12516 async function batchInstallFontFaces(fontFamilyId, fontFacesData, registry) { 12517 const responses = []; 12518 for (const faceData of fontFacesData) { 12519 try { 12520 const response = await fetchInstallFontFace( 12521 fontFamilyId, 12522 faceData, 12523 registry 12524 ); 12525 responses.push({ status: "fulfilled", value: response }); 12526 } catch (error) { 12527 responses.push({ status: "rejected", reason: error }); 12528 } 12529 } 12530 const results = { 12531 errors: [], 12532 successes: [] 12533 }; 12534 responses.forEach((result, index2) => { 12535 if (result.status === "fulfilled" && result.value) { 12536 const response = result.value; 12537 results.successes.push(response); 12538 } else if (result.reason) { 12539 results.errors.push({ 12540 data: fontFacesData[index2], 12541 message: result.reason.message 12542 }); 12543 } 12544 }); 12545 return results; 12546 } 12547 async function downloadFontFaceAssets(src) { 12548 src = Array.isArray(src) ? src : [src]; 12549 const files = await Promise.all( 12550 src.map(async (url) => { 12551 return fetch(new Request(url)).then((response) => { 12552 if (!response.ok) { 12553 throw new Error( 12554 `Error downloading font face asset from $url}. Server responded with status: $response.status}` 12555 ); 12556 } 12557 return response.blob(); 12558 }).then((blob) => { 12559 const filename = url.split("/").pop(); 12560 const file = new File([blob], filename, { 12561 type: blob.type 12562 }); 12563 return file; 12564 }); 12565 }) 12566 ); 12567 return files.length === 1 ? files[0] : files; 12568 } 12569 function checkFontFaceInstalled(fontFace, collection) { 12570 return -1 !== collection.findIndex((collectionFontFace) => { 12571 return collectionFontFace.fontWeight === fontFace.fontWeight && collectionFontFace.fontStyle === fontFace.fontStyle; 12572 }); 12573 } 12574 12575 // packages/global-styles-ui/build-module/font-library/utils/set-immutably.mjs 12576 function setImmutably2(object, path, value) { 12577 path = Array.isArray(path) ? [...path] : [path]; 12578 object = Array.isArray(object) ? [...object] : { ...object }; 12579 const leaf = path.pop(); 12580 let prev = object; 12581 for (const key of path) { 12582 const lvl = prev[key]; 12583 prev = prev[key] = Array.isArray(lvl) ? [...lvl] : { ...lvl }; 12584 } 12585 prev[leaf] = value; 12586 return object; 12587 } 12588 12589 // packages/global-styles-ui/build-module/font-library/utils/toggleFont.mjs 12590 function toggleFont(font2, face, initialfonts = []) { 12591 const isFontActivated = (f2) => f2.slug === font2.slug; 12592 const getActivatedFont = (fonts) => fonts.find(isFontActivated); 12593 const toggleEntireFontFamily = (activatedFont2) => { 12594 if (!activatedFont2) { 12595 return [...initialfonts, font2]; 12596 } 12597 return initialfonts.filter( 12598 (f2) => !isFontActivated(f2) 12599 ); 12600 }; 12601 const toggleFontVariant = (activatedFont2) => { 12602 const isFaceActivated = (f2) => f2.fontWeight === face.fontWeight && f2.fontStyle === face.fontStyle; 12603 if (!activatedFont2) { 12604 return [...initialfonts, { ...font2, fontFace: [face] }]; 12605 } 12606 let newFontFaces = activatedFont2.fontFace || []; 12607 if (newFontFaces.find(isFaceActivated)) { 12608 newFontFaces = newFontFaces.filter( 12609 (f2) => !isFaceActivated(f2) 12610 ); 12611 } else { 12612 newFontFaces = [...newFontFaces, face]; 12613 } 12614 if (newFontFaces.length === 0) { 12615 return initialfonts.filter( 12616 (f2) => !isFontActivated(f2) 12617 ); 12618 } 12619 return initialfonts.map( 12620 (f2) => isFontActivated(f2) ? { ...f2, fontFace: newFontFaces } : f2 12621 ); 12622 }; 12623 const activatedFont = getActivatedFont(initialfonts); 12624 if (!face) { 12625 return toggleEntireFontFamily(activatedFont); 12626 } 12627 return toggleFontVariant(activatedFont); 12628 } 12629 12630 // packages/global-styles-ui/build-module/font-library/context.mjs 12631 var import_jsx_runtime45 = __toESM(require_jsx_runtime(), 1); 12632 var FontLibraryContext = (0, import_element29.createContext)( 12633 {} 12634 ); 12635 FontLibraryContext.displayName = "FontLibraryContext"; 12636 function FontLibraryProvider({ children }) { 12637 const registry = (0, import_data6.useRegistry)(); 12638 const { saveEntityRecord, deleteEntityRecord } = (0, import_data6.useDispatch)(import_core_data5.store); 12639 const { globalStylesId } = (0, import_data6.useSelect)((select) => { 12640 const { __experimentalGetCurrentGlobalStylesId } = select(import_core_data5.store); 12641 return { globalStylesId: __experimentalGetCurrentGlobalStylesId() }; 12642 }, []); 12643 const globalStyles = (0, import_core_data5.useEntityRecord)( 12644 "root", 12645 "globalStyles", 12646 globalStylesId 12647 ); 12648 const [isInstalling, setIsInstalling] = (0, import_element29.useState)(false); 12649 const { records: libraryPosts = [], isResolving: isResolvingLibrary } = (0, import_core_data5.useEntityRecords)( 12650 "postType", 12651 "wp_font_family", 12652 { 12653 _embed: true 12654 } 12655 ); 12656 const libraryFonts = (libraryPosts || []).map((fontFamilyPost) => { 12657 return { 12658 id: fontFamilyPost.id, 12659 ...fontFamilyPost.font_family_settings || {}, 12660 fontFace: fontFamilyPost?._embedded?.font_faces?.map( 12661 (face) => face.font_face_settings 12662 ) || [] 12663 }; 12664 }) || []; 12665 const [fontFamilies, setFontFamilies] = useSetting("typography.fontFamilies"); 12666 const saveFontFamilies = async (fonts) => { 12667 if (!globalStyles.record) { 12668 return; 12669 } 12670 const updatedGlobalStyles = globalStyles.record; 12671 const finalGlobalStyles = setImmutably2( 12672 updatedGlobalStyles ?? {}, 12673 ["settings", "typography", "fontFamilies"], 12674 fonts 12675 ); 12676 await saveEntityRecord("root", "globalStyles", finalGlobalStyles); 12677 }; 12678 const [modalTabOpen, setModalTabOpen] = (0, import_element29.useState)(""); 12679 const [libraryFontSelected, setLibraryFontSelected] = (0, import_element29.useState)(void 0); 12680 const themeFonts = fontFamilies?.theme ? fontFamilies.theme.map((f2) => setUIValuesNeeded(f2, { source: "theme" })).sort((a2, b2) => a2.name.localeCompare(b2.name)) : []; 12681 const customFonts = fontFamilies?.custom ? fontFamilies.custom.map((f2) => setUIValuesNeeded(f2, { source: "custom" })).sort((a2, b2) => a2.name.localeCompare(b2.name)) : []; 12682 const baseCustomFonts = libraryFonts ? libraryFonts.map((f2) => setUIValuesNeeded(f2, { source: "custom" })).sort((a2, b2) => a2.name.localeCompare(b2.name)) : []; 12683 (0, import_element29.useEffect)(() => { 12684 if (!modalTabOpen) { 12685 setLibraryFontSelected(void 0); 12686 } 12687 }, [modalTabOpen]); 12688 const handleSetLibraryFontSelected = (font2) => { 12689 if (!font2) { 12690 setLibraryFontSelected(void 0); 12691 return; 12692 } 12693 const fonts = font2.source === "theme" ? themeFonts : baseCustomFonts; 12694 const fontSelected = fonts.find((f2) => f2.slug === font2.slug); 12695 setLibraryFontSelected({ 12696 ...fontSelected || font2, 12697 source: font2.source 12698 }); 12699 }; 12700 const [loadedFontUrls] = (0, import_element29.useState)(/* @__PURE__ */ new Set()); 12701 const getAvailableFontsOutline = (availableFontFamilies) => { 12702 const outline = availableFontFamilies.reduce( 12703 (acc, font2) => { 12704 const availableFontFaces = font2?.fontFace && font2.fontFace?.length > 0 ? font2?.fontFace.map( 12705 (face) => `$face.fontStyle ?? ""}$face.fontWeight ?? ""}` 12706 ) : ["normal400"]; 12707 acc[font2.slug] = availableFontFaces; 12708 return acc; 12709 }, 12710 {} 12711 ); 12712 return outline; 12713 }; 12714 const getActivatedFontsOutline = (source) => { 12715 switch (source) { 12716 case "theme": 12717 return getAvailableFontsOutline(themeFonts); 12718 case "custom": 12719 default: 12720 return getAvailableFontsOutline(customFonts); 12721 } 12722 }; 12723 const isFontActivated = (slug, style, weight, source) => { 12724 if (!style && !weight) { 12725 return !!getActivatedFontsOutline(source)[slug]; 12726 } 12727 return !!getActivatedFontsOutline(source)[slug]?.includes( 12728 (style ?? "") + (weight ?? "") 12729 ); 12730 }; 12731 const getFontFacesActivated = (slug, source) => { 12732 return getActivatedFontsOutline(source)[slug] || []; 12733 }; 12734 async function installFonts(fontFamiliesToInstall) { 12735 setIsInstalling(true); 12736 try { 12737 const fontFamiliesToActivate = []; 12738 let installationErrors = []; 12739 for (const fontFamilyToInstall of fontFamiliesToInstall) { 12740 let isANewFontFamily = false; 12741 const fontFamilyRecords = await (0, import_data6.resolveSelect)( 12742 import_core_data5.store 12743 ).getEntityRecords( 12744 "postType", 12745 "wp_font_family", 12746 { 12747 slug: fontFamilyToInstall.slug, 12748 per_page: 1, 12749 _embed: true 12750 } 12751 ); 12752 const fontFamilyPost = fontFamilyRecords && fontFamilyRecords.length > 0 ? fontFamilyRecords[0] : null; 12753 let installedFontFamily = fontFamilyPost ? { 12754 id: fontFamilyPost.id, 12755 ...fontFamilyPost.font_family_settings, 12756 fontFace: (fontFamilyPost?._embedded?.font_faces ?? []).map( 12757 (face) => face.font_face_settings 12758 ) || [] 12759 } : null; 12760 if (!installedFontFamily) { 12761 isANewFontFamily = true; 12762 installedFontFamily = await fetchInstallFontFamily( 12763 makeFontFamilyFormData(fontFamilyToInstall), 12764 registry 12765 ); 12766 } 12767 const alreadyInstalledFontFaces = installedFontFamily.fontFace && fontFamilyToInstall.fontFace ? installedFontFamily.fontFace.filter( 12768 (fontFaceToInstall) => fontFaceToInstall && fontFamilyToInstall.fontFace && checkFontFaceInstalled( 12769 fontFaceToInstall, 12770 fontFamilyToInstall.fontFace 12771 ) 12772 ) : []; 12773 if (installedFontFamily.fontFace && fontFamilyToInstall.fontFace) { 12774 fontFamilyToInstall.fontFace = fontFamilyToInstall.fontFace.filter( 12775 (fontFaceToInstall) => !checkFontFaceInstalled( 12776 fontFaceToInstall, 12777 installedFontFamily.fontFace 12778 ) 12779 ); 12780 } 12781 let successfullyInstalledFontFaces = []; 12782 let unsuccessfullyInstalledFontFaces = []; 12783 if (fontFamilyToInstall?.fontFace?.length ?? 0 > 0) { 12784 const response = await batchInstallFontFaces( 12785 // @ts-expect-error - Type mismatch: WpFontFamily.id can be number | string, but batchInstallFontFaces expects only string. 12786 installedFontFamily.id, 12787 makeFontFacesFormData( 12788 fontFamilyToInstall 12789 ), 12790 registry 12791 ); 12792 successfullyInstalledFontFaces = response?.successes; 12793 unsuccessfullyInstalledFontFaces = response?.errors; 12794 } 12795 if (successfullyInstalledFontFaces?.length > 0 || alreadyInstalledFontFaces?.length > 0) { 12796 installedFontFamily.fontFace = [ 12797 ...successfullyInstalledFontFaces 12798 ]; 12799 fontFamiliesToActivate.push(installedFontFamily); 12800 } 12801 if (installedFontFamily && !fontFamilyToInstall?.fontFace?.length) { 12802 fontFamiliesToActivate.push(installedFontFamily); 12803 } 12804 if (isANewFontFamily && (fontFamilyToInstall?.fontFace?.length ?? 0) > 0 && successfullyInstalledFontFaces?.length === 0) { 12805 await deleteEntityRecord( 12806 "postType", 12807 "wp_font_family", 12808 installedFontFamily.id, 12809 { force: true } 12810 ); 12811 } 12812 installationErrors = installationErrors.concat( 12813 unsuccessfullyInstalledFontFaces 12814 ); 12815 } 12816 const installationErrorMessages = installationErrors.reduce( 12817 (unique, item) => unique.includes(item.message) ? unique : [...unique, item.message], 12818 [] 12819 ); 12820 if (fontFamiliesToActivate.length > 0) { 12821 const activeFonts = activateCustomFontFamilies( 12822 // @ts-expect-error - Type mismatch: items may have id as number | string, but FontFamily.id should be string | undefined. 12823 fontFamiliesToActivate 12824 ); 12825 await saveFontFamilies(activeFonts); 12826 } 12827 if (installationErrorMessages.length > 0) { 12828 const installError = new Error((0, import_i18n12.__)("There was an error installing fonts.")); 12829 installError.installationErrors = installationErrorMessages; 12830 throw installError; 12831 } 12832 } finally { 12833 setIsInstalling(false); 12834 } 12835 } 12836 async function uninstallFontFamily(fontFamilyToUninstall) { 12837 if (!fontFamilyToUninstall?.id) { 12838 throw new Error((0, import_i18n12.__)("Font family to uninstall is not defined.")); 12839 } 12840 try { 12841 await deleteEntityRecord( 12842 "postType", 12843 "wp_font_family", 12844 fontFamilyToUninstall.id, 12845 { force: true } 12846 ); 12847 const activeFonts = deactivateFontFamily(fontFamilyToUninstall); 12848 await saveFontFamilies(activeFonts); 12849 return { deleted: true }; 12850 } catch (error) { 12851 console.error( 12852 `There was an error uninstalling the font family:`, 12853 error 12854 ); 12855 throw error; 12856 } 12857 } 12858 const deactivateFontFamily = (font2) => { 12859 const initialCustomFonts = fontFamilies?.[font2.source ?? ""] ?? []; 12860 const newCustomFonts = initialCustomFonts.filter( 12861 (f2) => f2.slug !== font2.slug 12862 ); 12863 const activeFonts = { 12864 ...fontFamilies, 12865 [font2.source ?? ""]: newCustomFonts 12866 }; 12867 setFontFamilies(activeFonts); 12868 if (font2.fontFace) { 12869 font2.fontFace.forEach((face) => { 12870 unloadFontFaceInBrowser(face, "all"); 12871 }); 12872 } 12873 return activeFonts; 12874 }; 12875 const activateCustomFontFamilies = (fontsToAdd) => { 12876 const fontsToActivate = cleanFontsForSave(fontsToAdd); 12877 const activeFonts = { 12878 ...fontFamilies, 12879 // Merge the existing custom fonts with the new fonts. 12880 custom: mergeFontFamilies(fontFamilies?.custom, fontsToActivate) 12881 }; 12882 setFontFamilies(activeFonts); 12883 loadFontsInBrowser(fontsToActivate); 12884 return activeFonts; 12885 }; 12886 const cleanFontsForSave = (fonts) => { 12887 return fonts.map(({ id: _familyDbId, fontFace, ...font2 }) => ({ 12888 ...font2, 12889 ...fontFace && fontFace.length > 0 ? { 12890 fontFace: fontFace.map( 12891 ({ id: _faceDbId, ...face }) => face 12892 ) 12893 } : {} 12894 })); 12895 }; 12896 const loadFontsInBrowser = (fonts) => { 12897 fonts.forEach((font2) => { 12898 if (font2.fontFace) { 12899 font2.fontFace.forEach((face) => { 12900 const displaySrc = getDisplaySrcFromFontFace( 12901 face?.src ?? "" 12902 ); 12903 if (displaySrc) { 12904 loadFontFaceInBrowser(face, displaySrc, "all"); 12905 } 12906 }); 12907 } 12908 }); 12909 }; 12910 const toggleActivateFont = (font2, face) => { 12911 const initialFonts = fontFamilies?.[font2.source ?? ""] ?? []; 12912 const newFonts = toggleFont(font2, face, initialFonts); 12913 setFontFamilies({ 12914 ...fontFamilies, 12915 [font2.source ?? ""]: newFonts 12916 }); 12917 const isFaceActivated = isFontActivated( 12918 font2.slug, 12919 face?.fontStyle ?? "", 12920 face?.fontWeight ?? "", 12921 font2.source ?? "custom" 12922 ); 12923 if (face && isFaceActivated) { 12924 unloadFontFaceInBrowser(face, "all"); 12925 } else { 12926 const displaySrc = getDisplaySrcFromFontFace(face?.src ?? ""); 12927 if (face && displaySrc) { 12928 loadFontFaceInBrowser(face, displaySrc, "all"); 12929 } 12930 } 12931 }; 12932 const loadFontFaceAsset = async (fontFace) => { 12933 if (!fontFace.src) { 12934 return; 12935 } 12936 const src = getDisplaySrcFromFontFace(fontFace.src); 12937 if (!src || loadedFontUrls.has(src)) { 12938 return; 12939 } 12940 loadFontFaceInBrowser(fontFace, src, "document"); 12941 loadedFontUrls.add(src); 12942 }; 12943 return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)( 12944 FontLibraryContext.Provider, 12945 { 12946 value: { 12947 libraryFontSelected, 12948 handleSetLibraryFontSelected, 12949 fontFamilies: fontFamilies ?? {}, 12950 baseCustomFonts, 12951 isFontActivated, 12952 getFontFacesActivated, 12953 loadFontFaceAsset, 12954 installFonts, 12955 uninstallFontFamily, 12956 toggleActivateFont, 12957 getAvailableFontsOutline, 12958 modalTabOpen, 12959 setModalTabOpen, 12960 saveFontFamilies, 12961 isResolvingLibrary, 12962 isInstalling 12963 }, 12964 children 12965 } 12966 ); 12967 } 12968 var context_default = FontLibraryProvider; 12969 12970 // packages/global-styles-ui/build-module/font-library/modal.mjs 12971 var import_i18n18 = __toESM(require_i18n(), 1); 12972 var import_components29 = __toESM(require_components(), 1); 12973 var import_core_data8 = __toESM(require_core_data(), 1); 12974 var import_data8 = __toESM(require_data(), 1); 12975 12976 // packages/global-styles-ui/build-module/font-library/installed-fonts.mjs 12977 var import_components23 = __toESM(require_components(), 1); 12978 var import_core_data6 = __toESM(require_core_data(), 1); 12979 var import_data7 = __toESM(require_data(), 1); 12980 var import_element33 = __toESM(require_element(), 1); 12981 var import_i18n14 = __toESM(require_i18n(), 1); 12982 12983 // packages/global-styles-ui/build-module/font-library/font-card.mjs 12984 var import_i18n13 = __toESM(require_i18n(), 1); 12985 var import_element31 = __toESM(require_element(), 1); 12986 var import_components21 = __toESM(require_components(), 1); 12987 12988 // packages/global-styles-ui/build-module/font-library/font-demo.mjs 12989 var import_components20 = __toESM(require_components(), 1); 12990 var import_element30 = __toESM(require_element(), 1); 12991 var import_jsx_runtime46 = __toESM(require_jsx_runtime(), 1); 12992 function getPreviewUrl(fontFace) { 12993 if (fontFace.preview) { 12994 return fontFace.preview; 12995 } 12996 if (fontFace.src) { 12997 return Array.isArray(fontFace.src) ? fontFace.src[0] : fontFace.src; 12998 } 12999 return void 0; 13000 } 13001 function getDisplayFontFace(font2) { 13002 if ("fontStyle" in font2 && font2.fontStyle || "fontWeight" in font2 && font2.fontWeight) { 13003 return font2; 13004 } 13005 if ("fontFace" in font2 && font2.fontFace && font2.fontFace.length) { 13006 return font2.fontFace.find( 13007 (face) => face.fontStyle === "normal" && face.fontWeight === "400" 13008 ) || font2.fontFace[0]; 13009 } 13010 return { 13011 fontStyle: "normal", 13012 fontWeight: "400", 13013 fontFamily: font2.fontFamily 13014 }; 13015 } 13016 function FontDemo({ font: font2, text }) { 13017 const ref = (0, import_element30.useRef)(null); 13018 const fontFace = getDisplayFontFace(font2); 13019 const style = getFamilyPreviewStyle(font2); 13020 text = text || ("name" in font2 ? font2.name : ""); 13021 const customPreviewUrl = font2.preview; 13022 const [isIntersecting, setIsIntersecting] = (0, import_element30.useState)(false); 13023 const [isAssetLoaded, setIsAssetLoaded] = (0, import_element30.useState)(false); 13024 const { loadFontFaceAsset } = (0, import_element30.useContext)(FontLibraryContext); 13025 const previewUrl = customPreviewUrl ?? getPreviewUrl(fontFace); 13026 const isPreviewImage = previewUrl && previewUrl.match(/\.(png|jpg|jpeg|gif|svg)$/i); 13027 const faceStyles = getFacePreviewStyle(fontFace); 13028 const textDemoStyle = { 13029 fontSize: "18px", 13030 lineHeight: 1, 13031 opacity: isAssetLoaded ? "1" : "0", 13032 ...style, 13033 ...faceStyles 13034 }; 13035 (0, import_element30.useEffect)(() => { 13036 const observer = new window.IntersectionObserver(([entry]) => { 13037 setIsIntersecting(entry.isIntersecting); 13038 }, {}); 13039 if (ref.current) { 13040 observer.observe(ref.current); 13041 } 13042 return () => observer.disconnect(); 13043 }, [ref]); 13044 (0, import_element30.useEffect)(() => { 13045 const loadAsset = async () => { 13046 if (isIntersecting) { 13047 if (!isPreviewImage && fontFace.src) { 13048 await loadFontFaceAsset(fontFace); 13049 } 13050 setIsAssetLoaded(true); 13051 } 13052 }; 13053 loadAsset(); 13054 }, [fontFace, isIntersecting, loadFontFaceAsset, isPreviewImage]); 13055 return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { ref, children: isPreviewImage ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)( 13056 "img", 13057 { 13058 src: previewUrl, 13059 loading: "lazy", 13060 alt: text, 13061 className: "font-library__font-variant_demo-image" 13062 } 13063 ) : /* @__PURE__ */ (0, import_jsx_runtime46.jsx)( 13064 import_components20.__experimentalText, 13065 { 13066 style: textDemoStyle, 13067 className: "font-library__font-variant_demo-text", 13068 children: text 13069 } 13070 ) }); 13071 } 13072 var font_demo_default = FontDemo; 13073 13074 // packages/global-styles-ui/build-module/font-library/font-card.mjs 13075 var import_jsx_runtime47 = __toESM(require_jsx_runtime(), 1); 13076 function FontCard({ 13077 font: font2, 13078 onClick, 13079 variantsText, 13080 navigatorPath, 13081 shouldFocus 13082 }) { 13083 const variantsCount = font2.fontFace?.length || 1; 13084 const style = { 13085 cursor: !!onClick ? "pointer" : "default" 13086 }; 13087 const navigator2 = (0, import_components21.useNavigator)(); 13088 const ref = (0, import_element31.useRef)(null); 13089 (0, import_element31.useEffect)(() => { 13090 if (shouldFocus) { 13091 ref.current?.focus(); 13092 } 13093 }, [shouldFocus]); 13094 return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)( 13095 import_components21.Button, 13096 { 13097 ref, 13098 __next40pxDefaultSize: true, 13099 onClick: () => { 13100 onClick(); 13101 if (navigatorPath) { 13102 navigator2.goTo(navigatorPath); 13103 } 13104 }, 13105 style, 13106 className: "font-library__font-card", 13107 children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_components21.Flex, { justify: "space-between", wrap: false, children: [ 13108 /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(font_demo_default, { font: font2 }), 13109 /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_components21.Flex, { justify: "flex-end", children: [ 13110 /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_components21.FlexItem, { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_components21.__experimentalText, { className: "font-library__font-card__count", children: variantsText || (0, import_i18n13.sprintf)( 13111 /* translators: %d: Number of font variants. */ 13112 (0, import_i18n13._n)( 13113 "%d variant", 13114 "%d variants", 13115 variantsCount 13116 ), 13117 variantsCount 13118 ) }) }), 13119 /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_components21.FlexItem, { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(icon_default, { icon: (0, import_i18n13.isRTL)() ? chevron_left_default : chevron_right_default }) }) 13120 ] }) 13121 ] }) 13122 } 13123 ); 13124 } 13125 var font_card_default = FontCard; 13126 13127 // packages/global-styles-ui/build-module/font-library/library-font-variant.mjs 13128 var import_element32 = __toESM(require_element(), 1); 13129 var import_components22 = __toESM(require_components(), 1); 13130 var import_jsx_runtime48 = __toESM(require_jsx_runtime(), 1); 13131 function LibraryFontVariant({ 13132 face, 13133 font: font2 13134 }) { 13135 const { isFontActivated, toggleActivateFont } = (0, import_element32.useContext)(FontLibraryContext); 13136 const isInstalled = (font2?.fontFace?.length ?? 0) > 0 ? isFontActivated( 13137 font2.slug, 13138 face.fontStyle, 13139 face.fontWeight, 13140 font2.source 13141 ) : isFontActivated(font2.slug, void 0, void 0, font2.source); 13142 const handleToggleActivation = () => { 13143 if ((font2?.fontFace?.length ?? 0) > 0) { 13144 toggleActivateFont(font2, face); 13145 return; 13146 } 13147 toggleActivateFont(font2); 13148 }; 13149 const displayName = font2.name + " " + getFontFaceVariantName(face); 13150 const checkboxId = (0, import_element32.useId)(); 13151 return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "font-library__font-card", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_components22.Flex, { justify: "flex-start", align: "center", gap: "1rem", children: [ 13152 /* @__PURE__ */ (0, import_jsx_runtime48.jsx)( 13153 import_components22.CheckboxControl, 13154 { 13155 checked: isInstalled, 13156 onChange: handleToggleActivation, 13157 id: checkboxId 13158 } 13159 ), 13160 /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("label", { htmlFor: checkboxId, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)( 13161 font_demo_default, 13162 { 13163 font: face, 13164 text: displayName, 13165 onClick: handleToggleActivation 13166 } 13167 ) }) 13168 ] }) }); 13169 } 13170 var library_font_variant_default = LibraryFontVariant; 13171 13172 // packages/global-styles-ui/build-module/font-library/utils/sort-font-faces.mjs 13173 function getNumericFontWeight(value) { 13174 switch (value) { 13175 case "normal": 13176 return 400; 13177 case "bold": 13178 return 700; 13179 case "bolder": 13180 return 500; 13181 case "lighter": 13182 return 300; 13183 default: 13184 return parseInt(value, 10); 13185 } 13186 } 13187 function sortFontFaces(faces) { 13188 return faces.sort((a2, b2) => { 13189 if (a2.fontStyle === "normal" && b2.fontStyle !== "normal") { 13190 return -1; 13191 } 13192 if (b2.fontStyle === "normal" && a2.fontStyle !== "normal") { 13193 return 1; 13194 } 13195 if (a2.fontStyle === b2.fontStyle) { 13196 return getNumericFontWeight(a2.fontWeight?.toString() ?? "normal") - getNumericFontWeight(b2.fontWeight?.toString() ?? "normal"); 13197 } 13198 if (!a2.fontStyle || !b2.fontStyle) { 13199 return !a2.fontStyle ? 1 : -1; 13200 } 13201 return a2.fontStyle.localeCompare(b2.fontStyle); 13202 }); 13203 } 13204 13205 // packages/global-styles-ui/build-module/font-library/installed-fonts.mjs 13206 var import_jsx_runtime49 = __toESM(require_jsx_runtime(), 1); 13207 function getFontFamiliesKey(fontFamilies) { 13208 if (!fontFamilies) { 13209 return ""; 13210 } 13211 const normalized = {}; 13212 for (const source of Object.keys(fontFamilies).sort()) { 13213 normalized[source] = (fontFamilies[source] ?? []).map((family) => ({ 13214 slug: family.slug, 13215 fontFace: (family.fontFace ?? []).map( 13216 (face) => `$face.fontStyle}-$face.fontWeight}` 13217 ).sort() 13218 })).sort((a2, b2) => a2.slug.localeCompare(b2.slug)); 13219 } 13220 return JSON.stringify(normalized); 13221 } 13222 function InstalledFonts() { 13223 const { 13224 baseCustomFonts, 13225 libraryFontSelected, 13226 handleSetLibraryFontSelected, 13227 uninstallFontFamily, 13228 isResolvingLibrary, 13229 isInstalling, 13230 saveFontFamilies, 13231 getFontFacesActivated 13232 } = (0, import_element33.useContext)(FontLibraryContext); 13233 const [fontFamilies, setFontFamilies] = useSetting("typography.fontFamilies"); 13234 const [lastSelectedFontSlug, setLastSelectedFontSlug] = (0, import_element33.useState)(void 0); 13235 const [isConfirmDeleteOpen, setIsConfirmDeleteOpen] = (0, import_element33.useState)(false); 13236 const [notice, setNotice] = (0, import_element33.useState)(null); 13237 const [baseFontFamilies] = useSetting("typography.fontFamilies", void 0, "base"); 13238 const globalStylesId = (0, import_data7.useSelect)((select) => { 13239 const { __experimentalGetCurrentGlobalStylesId } = select(import_core_data6.store); 13240 return __experimentalGetCurrentGlobalStylesId(); 13241 }, []); 13242 const globalStyles = (0, import_core_data6.useEntityRecord)( 13243 "root", 13244 "globalStyles", 13245 globalStylesId 13246 ); 13247 const editedFontFamilies = globalStyles?.edits?.settings?.typography?.fontFamilies; 13248 const savedFontFamilies = globalStyles?.record?.settings?.typography?.fontFamilies; 13249 const fontFamiliesHasChanges = (0, import_element33.useMemo)(() => { 13250 if (editedFontFamilies === void 0) { 13251 return false; 13252 } 13253 return getFontFamiliesKey(editedFontFamilies) !== getFontFamiliesKey(savedFontFamilies); 13254 }, [editedFontFamilies, savedFontFamilies]); 13255 const themeFonts = fontFamilies?.theme ? fontFamilies.theme.map((f2) => setUIValuesNeeded(f2, { source: "theme" })).sort((a2, b2) => a2.name.localeCompare(b2.name)) : []; 13256 const themeFontsSlugs = new Set(themeFonts.map((f2) => f2.slug)); 13257 const baseThemeFonts = baseFontFamilies?.theme ? themeFonts.concat( 13258 baseFontFamilies.theme.filter((f2) => !themeFontsSlugs.has(f2.slug)).map((f2) => setUIValuesNeeded(f2, { source: "theme" })).sort((a2, b2) => a2.name.localeCompare(b2.name)) 13259 ) : []; 13260 const customFontFamilyId = libraryFontSelected?.source === "custom" && libraryFontSelected?.id; 13261 const canUserDelete = (0, import_data7.useSelect)( 13262 (select) => { 13263 const { canUser } = select(import_core_data6.store); 13264 return customFontFamilyId && canUser("delete", { 13265 kind: "postType", 13266 name: "wp_font_family", 13267 id: customFontFamilyId 13268 }); 13269 }, 13270 [customFontFamilyId] 13271 ); 13272 const shouldDisplayDeleteButton = !!libraryFontSelected && libraryFontSelected?.source !== "theme" && canUserDelete; 13273 const handleUninstallClick = () => { 13274 setIsConfirmDeleteOpen(true); 13275 }; 13276 const handleUpdate = async () => { 13277 setNotice(null); 13278 try { 13279 await saveFontFamilies(fontFamilies); 13280 setNotice({ 13281 type: "success", 13282 message: (0, import_i18n14.__)("Font family updated successfully.") 13283 }); 13284 } catch (error) { 13285 setNotice({ 13286 type: "error", 13287 message: (0, import_i18n14.sprintf)( 13288 /* translators: %s: error message */ 13289 (0, import_i18n14.__)("There was an error updating the font family. %s"), 13290 error.message 13291 ) 13292 }); 13293 } 13294 }; 13295 const getFontFacesToDisplay = (font2) => { 13296 if (!font2) { 13297 return []; 13298 } 13299 if (!font2.fontFace || !font2.fontFace.length) { 13300 return [ 13301 { 13302 fontFamily: font2.fontFamily, 13303 fontStyle: "normal", 13304 fontWeight: "400" 13305 } 13306 ]; 13307 } 13308 return sortFontFaces(font2.fontFace); 13309 }; 13310 const getFontCardVariantsText = (font2) => { 13311 const variantsInstalled = font2?.fontFace && (font2?.fontFace?.length ?? 0) > 0 ? font2.fontFace.length : 1; 13312 const variantsActive = getFontFacesActivated( 13313 font2.slug, 13314 font2.source 13315 ).length; 13316 return (0, import_i18n14.sprintf)( 13317 /* translators: 1: Active font variants, 2: Total font variants. */ 13318 (0, import_i18n14.__)("%1$d of %2$d active"), 13319 variantsActive, 13320 variantsInstalled 13321 ); 13322 }; 13323 (0, import_element33.useEffect)(() => { 13324 handleSetLibraryFontSelected(libraryFontSelected); 13325 }, []); 13326 const activeFontsCount = libraryFontSelected ? getFontFacesActivated( 13327 libraryFontSelected.slug, 13328 libraryFontSelected.source 13329 ).length : 0; 13330 const selectedFontsCount = libraryFontSelected?.fontFace?.length ?? (libraryFontSelected?.fontFamily ? 1 : 0); 13331 const isIndeterminate = activeFontsCount > 0 && activeFontsCount !== selectedFontsCount; 13332 const isSelectAllChecked = activeFontsCount === selectedFontsCount; 13333 const toggleSelectAll = () => { 13334 if (!libraryFontSelected || !libraryFontSelected?.source) { 13335 return; 13336 } 13337 const initialFonts = fontFamilies?.[libraryFontSelected.source]?.filter( 13338 (f2) => f2.slug !== libraryFontSelected.slug 13339 ) ?? []; 13340 const newFonts = isSelectAllChecked ? initialFonts : [...initialFonts, libraryFontSelected]; 13341 setFontFamilies({ 13342 ...fontFamilies, 13343 [libraryFontSelected.source]: newFonts 13344 }); 13345 if (libraryFontSelected.fontFace) { 13346 libraryFontSelected.fontFace.forEach((face) => { 13347 if (isSelectAllChecked) { 13348 unloadFontFaceInBrowser(face, "all"); 13349 } else { 13350 const displaySrc = getDisplaySrcFromFontFace( 13351 face?.src ?? "" 13352 ); 13353 if (displaySrc) { 13354 loadFontFaceInBrowser(face, displaySrc, "all"); 13355 } 13356 } 13357 }); 13358 } 13359 }; 13360 const hasFonts = baseThemeFonts.length > 0 || baseCustomFonts.length > 0; 13361 return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "font-library__tabpanel-layout", children: [ 13362 isResolvingLibrary && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "font-library__loading", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_components23.ProgressBar, {}) }), 13363 !isResolvingLibrary && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [ 13364 /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)( 13365 import_components23.Navigator, 13366 { 13367 initialPath: libraryFontSelected ? "/fontFamily" : "/", 13368 children: [ 13369 /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_components23.Navigator.Screen, { path: "/", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_components23.__experimentalVStack, { spacing: "8", children: [ 13370 notice && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)( 13371 import_components23.Notice, 13372 { 13373 status: notice.type, 13374 onRemove: () => setNotice(null), 13375 children: notice.message 13376 } 13377 ), 13378 !hasFonts && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_components23.__experimentalText, { as: "p", children: (0, import_i18n14.__)("No fonts installed.") }), 13379 baseThemeFonts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_components23.__experimentalVStack, { children: [ 13380 /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("h2", { 13381 className: "font-library__fonts-title", 13382 /* translators: Heading for a list of fonts provided by the theme. */ 13383 children: (0, import_i18n14._x)("Theme", "font source") 13384 }), 13385 /* @__PURE__ */ (0, import_jsx_runtime49.jsx)( 13386 "ul", 13387 { 13388 role: "list", 13389 className: "font-library__fonts-list", 13390 children: baseThemeFonts.map((font2) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)( 13391 "li", 13392 { 13393 className: "font-library__fonts-list-item", 13394 children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)( 13395 font_card_default, 13396 { 13397 font: font2, 13398 navigatorPath: "/fontFamily", 13399 variantsText: getFontCardVariantsText( 13400 font2 13401 ), 13402 shouldFocus: font2.slug === lastSelectedFontSlug, 13403 onClick: () => { 13404 setNotice(null); 13405 handleSetLibraryFontSelected( 13406 font2 13407 ); 13408 } 13409 } 13410 ) 13411 }, 13412 font2.slug 13413 )) 13414 } 13415 ) 13416 ] }), 13417 baseCustomFonts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_components23.__experimentalVStack, { children: [ 13418 /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("h2", { 13419 className: "font-library__fonts-title", 13420 /* translators: Heading for a list of fonts installed by the user. */ 13421 children: (0, import_i18n14._x)("Custom", "font source") 13422 }), 13423 /* @__PURE__ */ (0, import_jsx_runtime49.jsx)( 13424 "ul", 13425 { 13426 role: "list", 13427 className: "font-library__fonts-list", 13428 children: baseCustomFonts.map((font2) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)( 13429 "li", 13430 { 13431 className: "font-library__fonts-list-item", 13432 children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)( 13433 font_card_default, 13434 { 13435 font: font2, 13436 navigatorPath: "/fontFamily", 13437 variantsText: getFontCardVariantsText( 13438 font2 13439 ), 13440 shouldFocus: font2.slug === lastSelectedFontSlug, 13441 onClick: () => { 13442 setNotice(null); 13443 handleSetLibraryFontSelected( 13444 font2 13445 ); 13446 } 13447 } 13448 ) 13449 }, 13450 font2.slug 13451 )) 13452 } 13453 ) 13454 ] }) 13455 ] }) }), 13456 /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_components23.Navigator.Screen, { path: "/fontFamily", children: [ 13457 libraryFontSelected && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)( 13458 ConfirmDeleteDialog, 13459 { 13460 font: libraryFontSelected, 13461 isOpen: isConfirmDeleteOpen, 13462 setIsOpen: setIsConfirmDeleteOpen, 13463 setNotice, 13464 uninstallFontFamily, 13465 handleSetLibraryFontSelected 13466 } 13467 ), 13468 /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_components23.Flex, { justify: "flex-start", children: [ 13469 /* @__PURE__ */ (0, import_jsx_runtime49.jsx)( 13470 import_components23.Navigator.BackButton, 13471 { 13472 icon: (0, import_i18n14.isRTL)() ? chevron_right_default : chevron_left_default, 13473 size: "small", 13474 onClick: () => { 13475 setLastSelectedFontSlug( 13476 libraryFontSelected?.slug 13477 ); 13478 handleSetLibraryFontSelected( 13479 void 0 13480 ); 13481 setNotice(null); 13482 }, 13483 label: (0, import_i18n14.__)("Back") 13484 } 13485 ), 13486 /* @__PURE__ */ (0, import_jsx_runtime49.jsx)( 13487 import_components23.__experimentalHeading, 13488 { 13489 level: 2, 13490 size: 13, 13491 className: "global-styles-ui-header", 13492 children: libraryFontSelected?.name 13493 } 13494 ) 13495 ] }), 13496 notice && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [ 13497 /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_components23.__experimentalSpacer, { margin: 1 }), 13498 /* @__PURE__ */ (0, import_jsx_runtime49.jsx)( 13499 import_components23.Notice, 13500 { 13501 status: notice.type, 13502 onRemove: () => setNotice(null), 13503 children: notice.message 13504 } 13505 ), 13506 /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_components23.__experimentalSpacer, { margin: 1 }) 13507 ] }), 13508 /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_components23.__experimentalSpacer, { margin: 4 }), 13509 /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_components23.__experimentalText, { children: (0, import_i18n14.__)( 13510 "Choose font variants. Keep in mind that too many variants could make your site slower." 13511 ) }), 13512 /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_components23.__experimentalSpacer, { margin: 4 }), 13513 /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_components23.__experimentalVStack, { spacing: 0, children: [ 13514 /* @__PURE__ */ (0, import_jsx_runtime49.jsx)( 13515 import_components23.CheckboxControl, 13516 { 13517 className: "font-library__select-all", 13518 label: (0, import_i18n14.__)("Select all"), 13519 checked: isSelectAllChecked, 13520 onChange: toggleSelectAll, 13521 indeterminate: isIndeterminate 13522 } 13523 ), 13524 /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_components23.__experimentalSpacer, { margin: 8 }), 13525 /* @__PURE__ */ (0, import_jsx_runtime49.jsx)( 13526 "ul", 13527 { 13528 role: "list", 13529 className: "font-library__fonts-list", 13530 children: libraryFontSelected && getFontFacesToDisplay( 13531 libraryFontSelected 13532 ).map((face, i2) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)( 13533 "li", 13534 { 13535 className: "font-library__fonts-list-item", 13536 children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)( 13537 library_font_variant_default, 13538 { 13539 font: libraryFontSelected, 13540 face 13541 }, 13542 `face$i2}` 13543 ) 13544 }, 13545 `face$i2}` 13546 )) 13547 } 13548 ) 13549 ] }) 13550 ] }) 13551 ] 13552 } 13553 ), 13554 /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_components23.__experimentalHStack, { justify: "flex-end", className: "font-library__footer", children: [ 13555 isInstalling && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_components23.ProgressBar, {}), 13556 shouldDisplayDeleteButton && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)( 13557 import_components23.Button, 13558 { 13559 __next40pxDefaultSize: true, 13560 isDestructive: true, 13561 variant: "tertiary", 13562 onClick: handleUninstallClick, 13563 children: (0, import_i18n14.__)("Delete") 13564 } 13565 ), 13566 /* @__PURE__ */ (0, import_jsx_runtime49.jsx)( 13567 import_components23.Button, 13568 { 13569 __next40pxDefaultSize: true, 13570 variant: "primary", 13571 onClick: handleUpdate, 13572 disabled: !fontFamiliesHasChanges, 13573 accessibleWhenDisabled: true, 13574 children: (0, import_i18n14.__)("Update") 13575 } 13576 ) 13577 ] }) 13578 ] }) 13579 ] }); 13580 } 13581 function ConfirmDeleteDialog({ 13582 font: font2, 13583 isOpen, 13584 setIsOpen, 13585 setNotice, 13586 uninstallFontFamily, 13587 handleSetLibraryFontSelected 13588 }) { 13589 const navigator2 = (0, import_components23.useNavigator)(); 13590 const handleConfirmUninstall = async () => { 13591 setNotice(null); 13592 setIsOpen(false); 13593 try { 13594 await uninstallFontFamily(font2); 13595 navigator2.goBack(); 13596 handleSetLibraryFontSelected(void 0); 13597 setNotice({ 13598 type: "success", 13599 message: (0, import_i18n14.__)("Font family uninstalled successfully.") 13600 }); 13601 } catch (error) { 13602 setNotice({ 13603 type: "error", 13604 message: (0, import_i18n14.__)("There was an error uninstalling the font family.") + error.message 13605 }); 13606 } 13607 }; 13608 const handleCancelUninstall = () => { 13609 setIsOpen(false); 13610 }; 13611 return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)( 13612 import_components23.__experimentalConfirmDialog, 13613 { 13614 isOpen, 13615 cancelButtonText: (0, import_i18n14.__)("Cancel"), 13616 confirmButtonText: (0, import_i18n14.__)("Delete"), 13617 onCancel: handleCancelUninstall, 13618 onConfirm: handleConfirmUninstall, 13619 size: "medium", 13620 children: font2 && (0, import_i18n14.sprintf)( 13621 /* translators: %s: Name of the font. */ 13622 (0, import_i18n14.__)( 13623 'Are you sure you want to delete "%s" font and all its variants and assets?' 13624 ), 13625 font2.name 13626 ) 13627 } 13628 ); 13629 } 13630 var installed_fonts_default = InstalledFonts; 13631 13632 // packages/global-styles-ui/build-module/font-library/font-collection.mjs 13633 var import_element35 = __toESM(require_element(), 1); 13634 var import_components26 = __toESM(require_components(), 1); 13635 var import_compose3 = __toESM(require_compose(), 1); 13636 var import_i18n16 = __toESM(require_i18n(), 1); 13637 var import_core_data7 = __toESM(require_core_data(), 1); 13638 13639 // packages/global-styles-ui/build-module/font-library/utils/filter-fonts.mjs 13640 function filterFonts(fonts, filters) { 13641 const { category, search } = filters; 13642 let filteredFonts = fonts || []; 13643 if (category && category !== "all") { 13644 filteredFonts = filteredFonts.filter( 13645 (font2) => font2.categories && font2.categories.indexOf(category) !== -1 13646 ); 13647 } 13648 if (search) { 13649 filteredFonts = filteredFonts.filter( 13650 (font2) => font2.font_family_settings && font2.font_family_settings.name.toLowerCase().includes(search.toLowerCase()) 13651 ); 13652 } 13653 return filteredFonts; 13654 } 13655 13656 // packages/global-styles-ui/build-module/font-library/utils/fonts-outline.mjs 13657 function getFontsOutline(fonts) { 13658 return fonts.reduce( 13659 (acc, font2) => ({ 13660 ...acc, 13661 [font2.slug]: (font2?.fontFace || []).reduce( 13662 (faces, face) => ({ 13663 ...faces, 13664 [`$face.fontStyle}-$face.fontWeight}`]: true 13665 }), 13666 {} 13667 ) 13668 }), 13669 {} 13670 ); 13671 } 13672 function isFontFontFaceInOutline(slug, face, outline) { 13673 if (!face) { 13674 return !!outline[slug]; 13675 } 13676 return !!outline[slug]?.[`$face.fontStyle}-$face.fontWeight}`]; 13677 } 13678 13679 // packages/global-styles-ui/build-module/font-library/google-fonts-confirm-dialog.mjs 13680 var import_i18n15 = __toESM(require_i18n(), 1); 13681 var import_components24 = __toESM(require_components(), 1); 13682 var import_jsx_runtime50 = __toESM(require_jsx_runtime(), 1); 13683 function GoogleFontsConfirmDialog() { 13684 const handleConfirm = () => { 13685 window.localStorage.setItem( 13686 "wp-font-library-google-fonts-permission", 13687 "true" 13688 ); 13689 window.dispatchEvent(new Event("storage")); 13690 }; 13691 return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "font-library__google-fonts-confirm", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_components24.Card, { children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_components24.CardBody, { children: [ 13692 /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_components24.__experimentalHeading, { level: 2, children: (0, import_i18n15.__)("Connect to Google Fonts") }), 13693 /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_components24.__experimentalSpacer, { margin: 6 }), 13694 /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_components24.__experimentalText, { as: "p", children: (0, import_i18n15.__)( 13695 "To install fonts from Google you must give permission to connect directly to Google servers. The fonts you install will be downloaded from Google and stored on your site. Your site will then use these locally-hosted fonts." 13696 ) }), 13697 /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_components24.__experimentalSpacer, { margin: 3 }), 13698 /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_components24.__experimentalText, { as: "p", children: (0, import_i18n15.__)( 13699 "You can alternatively upload files directly on the Upload tab." 13700 ) }), 13701 /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_components24.__experimentalSpacer, { margin: 6 }), 13702 /* @__PURE__ */ (0, import_jsx_runtime50.jsx)( 13703 import_components24.Button, 13704 { 13705 __next40pxDefaultSize: true, 13706 variant: "primary", 13707 onClick: handleConfirm, 13708 children: (0, import_i18n15.__)("Allow access to Google Fonts") 13709 } 13710 ) 13711 ] }) }) }); 13712 } 13713 var google_fonts_confirm_dialog_default = GoogleFontsConfirmDialog; 13714 13715 // packages/global-styles-ui/build-module/font-library/collection-font-variant.mjs 13716 var import_element34 = __toESM(require_element(), 1); 13717 var import_components25 = __toESM(require_components(), 1); 13718 var import_jsx_runtime51 = __toESM(require_jsx_runtime(), 1); 13719 function CollectionFontVariant({ 13720 face, 13721 font: font2, 13722 handleToggleVariant, 13723 selected 13724 }) { 13725 const handleToggleActivation = () => { 13726 if (font2?.fontFace) { 13727 handleToggleVariant(font2, face); 13728 return; 13729 } 13730 handleToggleVariant(font2); 13731 }; 13732 const displayName = font2.name + " " + getFontFaceVariantName(face); 13733 const checkboxId = (0, import_element34.useId)(); 13734 return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "font-library__font-card", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_components25.Flex, { justify: "flex-start", align: "center", gap: "1rem", children: [ 13735 /* @__PURE__ */ (0, import_jsx_runtime51.jsx)( 13736 import_components25.CheckboxControl, 13737 { 13738 checked: selected, 13739 onChange: handleToggleActivation, 13740 id: checkboxId 13741 } 13742 ), 13743 /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("label", { htmlFor: checkboxId, children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)( 13744 font_demo_default, 13745 { 13746 font: face, 13747 text: displayName, 13748 onClick: handleToggleActivation 13749 } 13750 ) }) 13751 ] }) }); 13752 } 13753 var collection_font_variant_default = CollectionFontVariant; 13754 13755 // packages/global-styles-ui/build-module/font-library/font-collection.mjs 13756 var import_jsx_runtime52 = __toESM(require_jsx_runtime(), 1); 13757 var DEFAULT_CATEGORY = { 13758 slug: "all", 13759 name: (0, import_i18n16._x)("All", "font categories") 13760 }; 13761 var LOCAL_STORAGE_ITEM = "wp-font-library-google-fonts-permission"; 13762 var MIN_WINDOW_HEIGHT = 500; 13763 function FontCollection({ slug }) { 13764 const requiresPermission = slug === "google-fonts"; 13765 const getGoogleFontsPermissionFromStorage = () => { 13766 return window.localStorage.getItem(LOCAL_STORAGE_ITEM) === "true"; 13767 }; 13768 const [selectedFont, setSelectedFont] = (0, import_element35.useState)( 13769 null 13770 ); 13771 const [lastSelectedFontSlug, setLastSelectedFontSlug] = (0, import_element35.useState)(void 0); 13772 const [notice, setNotice] = (0, import_element35.useState)(null); 13773 const [fontsToInstall, setFontsToInstall] = (0, import_element35.useState)( 13774 [] 13775 ); 13776 const [page, setPage] = (0, import_element35.useState)(1); 13777 const [filters, setFilters] = (0, import_element35.useState)({}); 13778 const [renderConfirmDialog, setRenderConfirmDialog] = (0, import_element35.useState)( 13779 requiresPermission && !getGoogleFontsPermissionFromStorage() 13780 ); 13781 const { installFonts, isInstalling } = (0, import_element35.useContext)(FontLibraryContext); 13782 const { record: selectedCollection, isResolving: isLoading } = (0, import_core_data7.useEntityRecord)("root", "fontCollection", slug); 13783 (0, import_element35.useEffect)(() => { 13784 const handleStorage = () => { 13785 setRenderConfirmDialog( 13786 requiresPermission && !getGoogleFontsPermissionFromStorage() 13787 ); 13788 }; 13789 handleStorage(); 13790 window.addEventListener("storage", handleStorage); 13791 return () => window.removeEventListener("storage", handleStorage); 13792 }, [slug, requiresPermission]); 13793 const revokeAccess = () => { 13794 window.localStorage.setItem(LOCAL_STORAGE_ITEM, "false"); 13795 window.dispatchEvent(new Event("storage")); 13796 }; 13797 (0, import_element35.useEffect)(() => { 13798 setSelectedFont(null); 13799 }, [slug]); 13800 (0, import_element35.useEffect)(() => { 13801 setFontsToInstall([]); 13802 }, [selectedFont]); 13803 const collectionFonts = (0, import_element35.useMemo)( 13804 () => selectedCollection?.font_families ?? [], 13805 [selectedCollection] 13806 ); 13807 const collectionCategories = selectedCollection?.categories ?? []; 13808 const categories = [DEFAULT_CATEGORY, ...collectionCategories]; 13809 const fonts = (0, import_element35.useMemo)( 13810 () => filterFonts(collectionFonts, filters), 13811 [collectionFonts, filters] 13812 ); 13813 const windowHeight = Math.max(window.innerHeight, MIN_WINDOW_HEIGHT); 13814 const pageSize = Math.floor((windowHeight - 417) / 61); 13815 const totalPages = Math.ceil(fonts.length / pageSize); 13816 const itemsStart = (page - 1) * pageSize; 13817 const itemsLimit = page * pageSize; 13818 const items = fonts.slice(itemsStart, itemsLimit); 13819 const handleCategoryFilter = (category) => { 13820 setFilters({ ...filters, category }); 13821 setPage(1); 13822 }; 13823 const handleUpdateSearchInput = (value) => { 13824 setFilters({ ...filters, search: value }); 13825 setPage(1); 13826 }; 13827 const debouncedUpdateSearchInput = (0, import_compose3.debounce)(handleUpdateSearchInput, 300); 13828 const handleToggleVariant = (font2, face) => { 13829 const newFontsToInstall = toggleFont(font2, face, fontsToInstall); 13830 setFontsToInstall(newFontsToInstall); 13831 }; 13832 const fontToInstallOutline = getFontsOutline(fontsToInstall); 13833 const resetFontsToInstall = () => { 13834 setFontsToInstall([]); 13835 }; 13836 const selectFontCount = fontsToInstall.length > 0 ? fontsToInstall[0]?.fontFace?.length ?? 0 : 0; 13837 const isIndeterminate = selectFontCount > 0 && selectFontCount !== selectedFont?.fontFace?.length; 13838 const isSelectAllChecked = selectFontCount === selectedFont?.fontFace?.length; 13839 const toggleSelectAll = () => { 13840 const newFonts = []; 13841 if (!isSelectAllChecked && selectedFont) { 13842 newFonts.push(selectedFont); 13843 } 13844 setFontsToInstall(newFonts); 13845 }; 13846 const handleInstall = async () => { 13847 setNotice(null); 13848 const fontFamily = fontsToInstall[0]; 13849 try { 13850 if (fontFamily?.fontFace) { 13851 await Promise.all( 13852 fontFamily.fontFace.map(async (fontFace) => { 13853 if (fontFace.src) { 13854 fontFace.file = await downloadFontFaceAssets( 13855 fontFace.src 13856 ); 13857 } 13858 }) 13859 ); 13860 } 13861 } catch { 13862 setNotice({ 13863 type: "error", 13864 message: (0, import_i18n16.__)( 13865 "Error installing the fonts, could not be downloaded." 13866 ) 13867 }); 13868 return; 13869 } 13870 try { 13871 await installFonts([fontFamily]); 13872 setNotice({ 13873 type: "success", 13874 message: (0, import_i18n16.__)("Fonts were installed successfully.") 13875 }); 13876 } catch (error) { 13877 setNotice({ 13878 type: "error", 13879 message: error.message 13880 }); 13881 } 13882 resetFontsToInstall(); 13883 }; 13884 const getSortedFontFaces = (fontFamily) => { 13885 if (!fontFamily) { 13886 return []; 13887 } 13888 if (!fontFamily.fontFace || !fontFamily.fontFace.length) { 13889 return [ 13890 { 13891 fontFamily: fontFamily.fontFamily, 13892 fontStyle: "normal", 13893 fontWeight: "400" 13894 } 13895 ]; 13896 } 13897 return sortFontFaces(fontFamily.fontFace); 13898 }; 13899 if (renderConfirmDialog) { 13900 return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(google_fonts_confirm_dialog_default, {}); 13901 } 13902 const showActions = slug === "google-fonts" && !renderConfirmDialog && !selectedFont; 13903 return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "font-library__tabpanel-layout", children: [ 13904 isLoading && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "font-library__loading", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_components26.ProgressBar, {}) }), 13905 !isLoading && selectedCollection && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_jsx_runtime52.Fragment, { children: [ 13906 /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)( 13907 import_components26.Navigator, 13908 { 13909 initialPath: "/", 13910 className: "font-library__tabpanel-layout", 13911 children: [ 13912 /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_components26.Navigator.Screen, { path: "/", children: [ 13913 /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_components26.__experimentalHStack, { justify: "space-between", children: [ 13914 /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_components26.__experimentalVStack, { children: [ 13915 /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_components26.__experimentalHeading, { level: 2, size: 13, children: selectedCollection.name }), 13916 /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_components26.__experimentalText, { children: selectedCollection.description }) 13917 ] }), 13918 showActions && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)( 13919 import_components26.DropdownMenu, 13920 { 13921 icon: more_vertical_default, 13922 label: (0, import_i18n16.__)("Actions"), 13923 popoverProps: { 13924 position: "bottom left" 13925 }, 13926 controls: [ 13927 { 13928 title: (0, import_i18n16.__)( 13929 "Revoke access to Google Fonts" 13930 ), 13931 onClick: revokeAccess 13932 } 13933 ] 13934 } 13935 ) 13936 ] }), 13937 /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_components26.__experimentalSpacer, { margin: 4 }), 13938 /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_components26.__experimentalHStack, { spacing: 4, justify: "space-between", children: [ 13939 /* @__PURE__ */ (0, import_jsx_runtime52.jsx)( 13940 import_components26.SearchControl, 13941 { 13942 value: filters.search, 13943 placeholder: (0, import_i18n16.__)("Font name\u2026"), 13944 label: (0, import_i18n16.__)("Search"), 13945 onChange: debouncedUpdateSearchInput, 13946 hideLabelFromVision: false 13947 } 13948 ), 13949 /* @__PURE__ */ (0, import_jsx_runtime52.jsx)( 13950 import_components26.SelectControl, 13951 { 13952 label: (0, import_i18n16.__)("Category"), 13953 value: filters.category, 13954 onChange: handleCategoryFilter, 13955 children: categories && categories.map((category) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)( 13956 "option", 13957 { 13958 value: category.slug, 13959 children: category.name 13960 }, 13961 category.slug 13962 )) 13963 } 13964 ) 13965 ] }), 13966 /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_components26.__experimentalSpacer, { margin: 4 }), 13967 !!selectedCollection?.font_families?.length && !fonts.length && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_components26.__experimentalText, { children: (0, import_i18n16.__)( 13968 "No fonts found. Try with a different search term." 13969 ) }), 13970 /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "font-library__fonts-grid__main", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)( 13971 "ul", 13972 { 13973 role: "list", 13974 className: "font-library__fonts-list", 13975 children: items.map((font2) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)( 13976 "li", 13977 { 13978 className: "font-library__fonts-list-item", 13979 children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)( 13980 font_card_default, 13981 { 13982 font: font2.font_family_settings, 13983 navigatorPath: "/fontFamily", 13984 shouldFocus: font2.font_family_settings.slug === lastSelectedFontSlug, 13985 onClick: () => { 13986 setSelectedFont( 13987 font2.font_family_settings 13988 ); 13989 } 13990 } 13991 ) 13992 }, 13993 font2.font_family_settings.slug 13994 )) 13995 } 13996 ) }) 13997 ] }), 13998 /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_components26.Navigator.Screen, { path: "/fontFamily", children: [ 13999 /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_components26.Flex, { justify: "flex-start", children: [ 14000 /* @__PURE__ */ (0, import_jsx_runtime52.jsx)( 14001 import_components26.Navigator.BackButton, 14002 { 14003 icon: (0, import_i18n16.isRTL)() ? chevron_right_default : chevron_left_default, 14004 size: "small", 14005 onClick: () => { 14006 setLastSelectedFontSlug( 14007 selectedFont?.slug 14008 ); 14009 setSelectedFont(null); 14010 setNotice(null); 14011 }, 14012 label: (0, import_i18n16.__)("Back") 14013 } 14014 ), 14015 /* @__PURE__ */ (0, import_jsx_runtime52.jsx)( 14016 import_components26.__experimentalHeading, 14017 { 14018 level: 2, 14019 size: 13, 14020 className: "global-styles-ui-header", 14021 children: selectedFont?.name 14022 } 14023 ) 14024 ] }), 14025 notice && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_jsx_runtime52.Fragment, { children: [ 14026 /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_components26.__experimentalSpacer, { margin: 1 }), 14027 /* @__PURE__ */ (0, import_jsx_runtime52.jsx)( 14028 import_components26.Notice, 14029 { 14030 status: notice.type, 14031 onRemove: () => setNotice(null), 14032 children: notice.message 14033 } 14034 ), 14035 /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_components26.__experimentalSpacer, { margin: 1 }) 14036 ] }), 14037 /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_components26.__experimentalSpacer, { margin: 4 }), 14038 /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_components26.__experimentalText, { children: (0, import_i18n16.__)("Select font variants to install.") }), 14039 /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_components26.__experimentalSpacer, { margin: 4 }), 14040 /* @__PURE__ */ (0, import_jsx_runtime52.jsx)( 14041 import_components26.CheckboxControl, 14042 { 14043 className: "font-library__select-all", 14044 label: (0, import_i18n16.__)("Select all"), 14045 checked: isSelectAllChecked, 14046 onChange: toggleSelectAll, 14047 indeterminate: isIndeterminate 14048 } 14049 ), 14050 /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_components26.__experimentalVStack, { spacing: 0, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)( 14051 "ul", 14052 { 14053 role: "list", 14054 className: "font-library__fonts-list", 14055 children: selectedFont && getSortedFontFaces(selectedFont).map( 14056 (face, i2) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)( 14057 "li", 14058 { 14059 className: "font-library__fonts-list-item", 14060 children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)( 14061 collection_font_variant_default, 14062 { 14063 font: selectedFont, 14064 face, 14065 handleToggleVariant, 14066 selected: isFontFontFaceInOutline( 14067 selectedFont.slug, 14068 selectedFont.fontFace ? face : null, 14069 // If the font has no fontFace, we want to check if the font is in the outline 14070 fontToInstallOutline 14071 ) 14072 } 14073 ) 14074 }, 14075 `face$i2}` 14076 ) 14077 ) 14078 } 14079 ) }), 14080 /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_components26.__experimentalSpacer, { margin: 16 }) 14081 ] }) 14082 ] 14083 } 14084 ), 14085 selectedFont && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)( 14086 import_components26.Flex, 14087 { 14088 justify: "flex-end", 14089 className: "font-library__footer", 14090 children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)( 14091 import_components26.Button, 14092 { 14093 __next40pxDefaultSize: true, 14094 variant: "primary", 14095 onClick: handleInstall, 14096 isBusy: isInstalling, 14097 disabled: fontsToInstall.length === 0 || isInstalling, 14098 accessibleWhenDisabled: true, 14099 children: (0, import_i18n16.__)("Install") 14100 } 14101 ) 14102 } 14103 ), 14104 !selectedFont && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)( 14105 import_components26.__experimentalHStack, 14106 { 14107 expanded: false, 14108 className: "font-library__footer", 14109 justify: "end", 14110 spacing: 6, 14111 children: [ 14112 /* @__PURE__ */ (0, import_jsx_runtime52.jsx)( 14113 import_components26.__experimentalHStack, 14114 { 14115 justify: "flex-start", 14116 expanded: false, 14117 spacing: 1, 14118 className: "font-library__page-selection", 14119 children: (0, import_element35.createInterpolateElement)( 14120 (0, import_i18n16.sprintf)( 14121 // translators: 1: Current page number, 2: Total number of pages. 14122 (0, import_i18n16._x)( 14123 "<div>Page</div>%1$s<div>of %2$d</div>", 14124 "paging" 14125 ), 14126 "<CurrentPage />", 14127 totalPages 14128 ), 14129 { 14130 div: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { "aria-hidden": true }), 14131 // @ts-expect-error — Tag injected via sprintf argument, not visible in format string. 14132 CurrentPage: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)( 14133 import_components26.SelectControl, 14134 { 14135 "aria-label": (0, import_i18n16.__)( 14136 "Current page" 14137 ), 14138 value: page.toString(), 14139 options: [ 14140 ...Array(totalPages) 14141 ].map((e2, i2) => { 14142 return { 14143 label: (i2 + 1).toString(), 14144 value: (i2 + 1).toString() 14145 }; 14146 }), 14147 onChange: (newPage) => setPage( 14148 parseInt(newPage) 14149 ), 14150 size: "small", 14151 variant: "minimal" 14152 } 14153 ) 14154 } 14155 ) 14156 } 14157 ), 14158 /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_components26.__experimentalHStack, { expanded: false, spacing: 1, children: [ 14159 /* @__PURE__ */ (0, import_jsx_runtime52.jsx)( 14160 import_components26.Button, 14161 { 14162 onClick: () => setPage(page - 1), 14163 disabled: page === 1, 14164 accessibleWhenDisabled: true, 14165 label: (0, import_i18n16.__)("Previous page"), 14166 icon: (0, import_i18n16.isRTL)() ? next_default : previous_default, 14167 showTooltip: true, 14168 size: "compact", 14169 tooltipPosition: "top" 14170 } 14171 ), 14172 /* @__PURE__ */ (0, import_jsx_runtime52.jsx)( 14173 import_components26.Button, 14174 { 14175 onClick: () => setPage(page + 1), 14176 disabled: page === totalPages, 14177 accessibleWhenDisabled: true, 14178 label: (0, import_i18n16.__)("Next page"), 14179 icon: (0, import_i18n16.isRTL)() ? previous_default : next_default, 14180 showTooltip: true, 14181 size: "compact", 14182 tooltipPosition: "top" 14183 } 14184 ) 14185 ] }) 14186 ] 14187 } 14188 ) 14189 ] }) 14190 ] }); 14191 } 14192 var font_collection_default = FontCollection; 14193 14194 // packages/global-styles-ui/build-module/font-library/upload-fonts.mjs 14195 var import_i18n17 = __toESM(require_i18n(), 1); 14196 var import_components28 = __toESM(require_components(), 1); 14197 var import_element36 = __toESM(require_element(), 1); 14198 14199 // packages/global-styles-ui/build-module/font-library/lib/unbrotli.mjs 14200 var __require2 = /* @__PURE__ */ ((x2) => typeof __require !== "undefined" ? __require : typeof Proxy !== "undefined" ? new Proxy(x2, { 14201 get: (a2, b2) => (typeof __require !== "undefined" ? __require : a2)[b2] 14202 }) : x2)(function(x2) { 14203 if (typeof __require !== "undefined") return __require.apply(this, arguments); 14204 throw Error('Dynamic require of "' + x2 + '" is not supported'); 14205 }); 14206 var unbrotli_default = (function() { 14207 var define, module, exports; 14208 return (/* @__PURE__ */ (function() { 14209 function r3(e2, n2, t3) { 14210 function o3(i22, f2) { 14211 if (!n2[i22]) { 14212 if (!e2[i22]) { 14213 var c2 = "function" == typeof __require2 && __require2; 14214 if (!f2 && c2) return c2(i22, true); 14215 if (u2) return u2(i22, true); 14216 var a2 = new Error("Cannot find module '" + i22 + "'"); 14217 throw a2.code = "MODULE_NOT_FOUND", a2; 14218 } 14219 var p3 = n2[i22] = { exports: {} }; 14220 e2[i22][0].call( 14221 p3.exports, 14222 function(r22) { 14223 var n22 = e2[i22][1][r22]; 14224 return o3(n22 || r22); 14225 }, 14226 p3, 14227 p3.exports, 14228 r3, 14229 e2, 14230 n2, 14231 t3 14232 ); 14233 } 14234 return n2[i22].exports; 14235 } 14236 for (var u2 = "function" == typeof __require2 && __require2, i2 = 0; i2 < t3.length; i2++) 14237 o3(t3[i2]); 14238 return o3; 14239 } 14240 return r3; 14241 })())( 14242 { 14243 1: [ 14244 function(require2, module2, exports2) { 14245 var BROTLI_READ_SIZE = 4096; 14246 var BROTLI_IBUF_SIZE = 2 * BROTLI_READ_SIZE + 32; 14247 var BROTLI_IBUF_MASK = 2 * BROTLI_READ_SIZE - 1; 14248 var kBitMask = new Uint32Array([ 14249 0, 14250 1, 14251 3, 14252 7, 14253 15, 14254 31, 14255 63, 14256 127, 14257 255, 14258 511, 14259 1023, 14260 2047, 14261 4095, 14262 8191, 14263 16383, 14264 32767, 14265 65535, 14266 131071, 14267 262143, 14268 524287, 14269 1048575, 14270 2097151, 14271 4194303, 14272 8388607, 14273 16777215 14274 ]); 14275 function BrotliBitReader(input) { 14276 this.buf_ = new Uint8Array(BROTLI_IBUF_SIZE); 14277 this.input_ = input; 14278 this.reset(); 14279 } 14280 BrotliBitReader.READ_SIZE = BROTLI_READ_SIZE; 14281 BrotliBitReader.IBUF_MASK = BROTLI_IBUF_MASK; 14282 BrotliBitReader.prototype.reset = function() { 14283 this.buf_ptr_ = 0; 14284 this.val_ = 0; 14285 this.pos_ = 0; 14286 this.bit_pos_ = 0; 14287 this.bit_end_pos_ = 0; 14288 this.eos_ = 0; 14289 this.readMoreInput(); 14290 for (var i2 = 0; i2 < 4; i2++) { 14291 this.val_ |= this.buf_[this.pos_] << 8 * i2; 14292 ++this.pos_; 14293 } 14294 return this.bit_end_pos_ > 0; 14295 }; 14296 BrotliBitReader.prototype.readMoreInput = function() { 14297 if (this.bit_end_pos_ > 256) { 14298 return; 14299 } else if (this.eos_) { 14300 if (this.bit_pos_ > this.bit_end_pos_) 14301 throw new Error( 14302 "Unexpected end of input " + this.bit_pos_ + " " + this.bit_end_pos_ 14303 ); 14304 } else { 14305 var dst = this.buf_ptr_; 14306 var bytes_read = this.input_.read( 14307 this.buf_, 14308 dst, 14309 BROTLI_READ_SIZE 14310 ); 14311 if (bytes_read < 0) { 14312 throw new Error("Unexpected end of input"); 14313 } 14314 if (bytes_read < BROTLI_READ_SIZE) { 14315 this.eos_ = 1; 14316 for (var p3 = 0; p3 < 32; p3++) 14317 this.buf_[dst + bytes_read + p3] = 0; 14318 } 14319 if (dst === 0) { 14320 for (var p3 = 0; p3 < 32; p3++) 14321 this.buf_[(BROTLI_READ_SIZE << 1) + p3] = this.buf_[p3]; 14322 this.buf_ptr_ = BROTLI_READ_SIZE; 14323 } else { 14324 this.buf_ptr_ = 0; 14325 } 14326 this.bit_end_pos_ += bytes_read << 3; 14327 } 14328 }; 14329 BrotliBitReader.prototype.fillBitWindow = function() { 14330 while (this.bit_pos_ >= 8) { 14331 this.val_ >>>= 8; 14332 this.val_ |= this.buf_[this.pos_ & BROTLI_IBUF_MASK] << 24; 14333 ++this.pos_; 14334 this.bit_pos_ = this.bit_pos_ - 8 >>> 0; 14335 this.bit_end_pos_ = this.bit_end_pos_ - 8 >>> 0; 14336 } 14337 }; 14338 BrotliBitReader.prototype.readBits = function(n_bits) { 14339 if (32 - this.bit_pos_ < n_bits) { 14340 this.fillBitWindow(); 14341 } 14342 var val = this.val_ >>> this.bit_pos_ & kBitMask[n_bits]; 14343 this.bit_pos_ += n_bits; 14344 return val; 14345 }; 14346 module2.exports = BrotliBitReader; 14347 }, 14348 {} 14349 ], 14350 2: [ 14351 function(require2, module2, exports2) { 14352 var CONTEXT_LSB6 = 0; 14353 var CONTEXT_MSB6 = 1; 14354 var CONTEXT_UTF8 = 2; 14355 var CONTEXT_SIGNED = 3; 14356 exports2.lookup = new Uint8Array([ 14357 /* CONTEXT_UTF8, last byte. */ 14358 /* ASCII range. */ 14359 0, 14360 0, 14361 0, 14362 0, 14363 0, 14364 0, 14365 0, 14366 0, 14367 0, 14368 4, 14369 4, 14370 0, 14371 0, 14372 4, 14373 0, 14374 0, 14375 0, 14376 0, 14377 0, 14378 0, 14379 0, 14380 0, 14381 0, 14382 0, 14383 0, 14384 0, 14385 0, 14386 0, 14387 0, 14388 0, 14389 0, 14390 0, 14391 8, 14392 12, 14393 16, 14394 12, 14395 12, 14396 20, 14397 12, 14398 16, 14399 24, 14400 28, 14401 12, 14402 12, 14403 32, 14404 12, 14405 36, 14406 12, 14407 44, 14408 44, 14409 44, 14410 44, 14411 44, 14412 44, 14413 44, 14414 44, 14415 44, 14416 44, 14417 32, 14418 32, 14419 24, 14420 40, 14421 28, 14422 12, 14423 12, 14424 48, 14425 52, 14426 52, 14427 52, 14428 48, 14429 52, 14430 52, 14431 52, 14432 48, 14433 52, 14434 52, 14435 52, 14436 52, 14437 52, 14438 48, 14439 52, 14440 52, 14441 52, 14442 52, 14443 52, 14444 48, 14445 52, 14446 52, 14447 52, 14448 52, 14449 52, 14450 24, 14451 12, 14452 28, 14453 12, 14454 12, 14455 12, 14456 56, 14457 60, 14458 60, 14459 60, 14460 56, 14461 60, 14462 60, 14463 60, 14464 56, 14465 60, 14466 60, 14467 60, 14468 60, 14469 60, 14470 56, 14471 60, 14472 60, 14473 60, 14474 60, 14475 60, 14476 56, 14477 60, 14478 60, 14479 60, 14480 60, 14481 60, 14482 24, 14483 12, 14484 28, 14485 12, 14486 0, 14487 /* UTF8 continuation byte range. */ 14488 0, 14489 1, 14490 0, 14491 1, 14492 0, 14493 1, 14494 0, 14495 1, 14496 0, 14497 1, 14498 0, 14499 1, 14500 0, 14501 1, 14502 0, 14503 1, 14504 0, 14505 1, 14506 0, 14507 1, 14508 0, 14509 1, 14510 0, 14511 1, 14512 0, 14513 1, 14514 0, 14515 1, 14516 0, 14517 1, 14518 0, 14519 1, 14520 0, 14521 1, 14522 0, 14523 1, 14524 0, 14525 1, 14526 0, 14527 1, 14528 0, 14529 1, 14530 0, 14531 1, 14532 0, 14533 1, 14534 0, 14535 1, 14536 0, 14537 1, 14538 0, 14539 1, 14540 0, 14541 1, 14542 0, 14543 1, 14544 0, 14545 1, 14546 0, 14547 1, 14548 0, 14549 1, 14550 0, 14551 1, 14552 2, 14553 3, 14554 2, 14555 3, 14556 2, 14557 3, 14558 2, 14559 3, 14560 2, 14561 3, 14562 2, 14563 3, 14564 2, 14565 3, 14566 2, 14567 3, 14568 2, 14569 3, 14570 2, 14571 3, 14572 2, 14573 3, 14574 2, 14575 3, 14576 2, 14577 3, 14578 2, 14579 3, 14580 2, 14581 3, 14582 2, 14583 3, 14584 2, 14585 3, 14586 2, 14587 3, 14588 2, 14589 3, 14590 2, 14591 3, 14592 2, 14593 3, 14594 2, 14595 3, 14596 2, 14597 3, 14598 2, 14599 3, 14600 2, 14601 3, 14602 2, 14603 3, 14604 2, 14605 3, 14606 2, 14607 3, 14608 2, 14609 3, 14610 2, 14611 3, 14612 2, 14613 3, 14614 2, 14615 3, 14616 /* ASCII range. */ 14617 0, 14618 0, 14619 0, 14620 0, 14621 0, 14622 0, 14623 0, 14624 0, 14625 0, 14626 0, 14627 0, 14628 0, 14629 0, 14630 0, 14631 0, 14632 0, 14633 0, 14634 0, 14635 0, 14636 0, 14637 0, 14638 0, 14639 0, 14640 0, 14641 0, 14642 0, 14643 0, 14644 0, 14645 0, 14646 0, 14647 0, 14648 0, 14649 0, 14650 1, 14651 1, 14652 1, 14653 1, 14654 1, 14655 1, 14656 1, 14657 1, 14658 1, 14659 1, 14660 1, 14661 1, 14662 1, 14663 1, 14664 1, 14665 2, 14666 2, 14667 2, 14668 2, 14669 2, 14670 2, 14671 2, 14672 2, 14673 2, 14674 2, 14675 1, 14676 1, 14677 1, 14678 1, 14679 1, 14680 1, 14681 1, 14682 2, 14683 2, 14684 2, 14685 2, 14686 2, 14687 2, 14688 2, 14689 2, 14690 2, 14691 2, 14692 2, 14693 2, 14694 2, 14695 2, 14696 2, 14697 2, 14698 2, 14699 2, 14700 2, 14701 2, 14702 2, 14703 2, 14704 2, 14705 2, 14706 2, 14707 2, 14708 1, 14709 1, 14710 1, 14711 1, 14712 1, 14713 1, 14714 3, 14715 3, 14716 3, 14717 3, 14718 3, 14719 3, 14720 3, 14721 3, 14722 3, 14723 3, 14724 3, 14725 3, 14726 3, 14727 3, 14728 3, 14729 3, 14730 3, 14731 3, 14732 3, 14733 3, 14734 3, 14735 3, 14736 3, 14737 3, 14738 3, 14739 3, 14740 1, 14741 1, 14742 1, 14743 1, 14744 0, 14745 /* UTF8 continuation byte range. */ 14746 0, 14747 0, 14748 0, 14749 0, 14750 0, 14751 0, 14752 0, 14753 0, 14754 0, 14755 0, 14756 0, 14757 0, 14758 0, 14759 0, 14760 0, 14761 0, 14762 0, 14763 0, 14764 0, 14765 0, 14766 0, 14767 0, 14768 0, 14769 0, 14770 0, 14771 0, 14772 0, 14773 0, 14774 0, 14775 0, 14776 0, 14777 0, 14778 0, 14779 0, 14780 0, 14781 0, 14782 0, 14783 0, 14784 0, 14785 0, 14786 0, 14787 0, 14788 0, 14789 0, 14790 0, 14791 0, 14792 0, 14793 0, 14794 0, 14795 0, 14796 0, 14797 0, 14798 0, 14799 0, 14800 0, 14801 0, 14802 0, 14803 0, 14804 0, 14805 0, 14806 0, 14807 0, 14808 0, 14809 0, 14810 0, 14811 0, 14812 0, 14813 0, 14814 0, 14815 0, 14816 0, 14817 0, 14818 0, 14819 0, 14820 0, 14821 0, 14822 0, 14823 0, 14824 0, 14825 0, 14826 0, 14827 0, 14828 0, 14829 0, 14830 0, 14831 0, 14832 0, 14833 0, 14834 0, 14835 0, 14836 0, 14837 0, 14838 0, 14839 0, 14840 0, 14841 0, 14842 2, 14843 2, 14844 2, 14845 2, 14846 2, 14847 2, 14848 2, 14849 2, 14850 2, 14851 2, 14852 2, 14853 2, 14854 2, 14855 2, 14856 2, 14857 2, 14858 2, 14859 2, 14860 2, 14861 2, 14862 2, 14863 2, 14864 2, 14865 2, 14866 2, 14867 2, 14868 2, 14869 2, 14870 2, 14871 2, 14872 2, 14873 2, 14874 0, 14875 1, 14876 1, 14877 1, 14878 1, 14879 1, 14880 1, 14881 1, 14882 1, 14883 1, 14884 1, 14885 1, 14886 1, 14887 1, 14888 1, 14889 1, 14890 2, 14891 2, 14892 2, 14893 2, 14894 2, 14895 2, 14896 2, 14897 2, 14898 2, 14899 2, 14900 2, 14901 2, 14902 2, 14903 2, 14904 2, 14905 2, 14906 2, 14907 2, 14908 2, 14909 2, 14910 2, 14911 2, 14912 2, 14913 2, 14914 2, 14915 2, 14916 2, 14917 2, 14918 2, 14919 2, 14920 2, 14921 2, 14922 2, 14923 2, 14924 2, 14925 2, 14926 2, 14927 2, 14928 2, 14929 2, 14930 2, 14931 2, 14932 2, 14933 2, 14934 2, 14935 2, 14936 2, 14937 2, 14938 3, 14939 3, 14940 3, 14941 3, 14942 3, 14943 3, 14944 3, 14945 3, 14946 3, 14947 3, 14948 3, 14949 3, 14950 3, 14951 3, 14952 3, 14953 3, 14954 3, 14955 3, 14956 3, 14957 3, 14958 3, 14959 3, 14960 3, 14961 3, 14962 3, 14963 3, 14964 3, 14965 3, 14966 3, 14967 3, 14968 3, 14969 3, 14970 3, 14971 3, 14972 3, 14973 3, 14974 3, 14975 3, 14976 3, 14977 3, 14978 3, 14979 3, 14980 3, 14981 3, 14982 3, 14983 3, 14984 3, 14985 3, 14986 3, 14987 3, 14988 3, 14989 3, 14990 3, 14991 3, 14992 3, 14993 3, 14994 3, 14995 3, 14996 3, 14997 3, 14998 3, 14999 3, 15000 3, 15001 3, 15002 4, 15003 4, 15004 4, 15005 4, 15006 4, 15007 4, 15008 4, 15009 4, 15010 4, 15011 4, 15012 4, 15013 4, 15014 4, 15015 4, 15016 4, 15017 4, 15018 4, 15019 4, 15020 4, 15021 4, 15022 4, 15023 4, 15024 4, 15025 4, 15026 4, 15027 4, 15028 4, 15029 4, 15030 4, 15031 4, 15032 4, 15033 4, 15034 4, 15035 4, 15036 4, 15037 4, 15038 4, 15039 4, 15040 4, 15041 4, 15042 4, 15043 4, 15044 4, 15045 4, 15046 4, 15047 4, 15048 4, 15049 4, 15050 4, 15051 4, 15052 4, 15053 4, 15054 4, 15055 4, 15056 4, 15057 4, 15058 4, 15059 4, 15060 4, 15061 4, 15062 4, 15063 4, 15064 4, 15065 4, 15066 5, 15067 5, 15068 5, 15069 5, 15070 5, 15071 5, 15072 5, 15073 5, 15074 5, 15075 5, 15076 5, 15077 5, 15078 5, 15079 5, 15080 5, 15081 5, 15082 5, 15083 5, 15084 5, 15085 5, 15086 5, 15087 5, 15088 5, 15089 5, 15090 5, 15091 5, 15092 5, 15093 5, 15094 5, 15095 5, 15096 5, 15097 5, 15098 5, 15099 5, 15100 5, 15101 5, 15102 5, 15103 5, 15104 5, 15105 5, 15106 5, 15107 5, 15108 5, 15109 5, 15110 5, 15111 5, 15112 5, 15113 5, 15114 6, 15115 6, 15116 6, 15117 6, 15118 6, 15119 6, 15120 6, 15121 6, 15122 6, 15123 6, 15124 6, 15125 6, 15126 6, 15127 6, 15128 6, 15129 7, 15130 /* CONTEXT_SIGNED, last byte, same as the above values shifted by 3 bits. */ 15131 0, 15132 8, 15133 8, 15134 8, 15135 8, 15136 8, 15137 8, 15138 8, 15139 8, 15140 8, 15141 8, 15142 8, 15143 8, 15144 8, 15145 8, 15146 8, 15147 16, 15148 16, 15149 16, 15150 16, 15151 16, 15152 16, 15153 16, 15154 16, 15155 16, 15156 16, 15157 16, 15158 16, 15159 16, 15160 16, 15161 16, 15162 16, 15163 16, 15164 16, 15165 16, 15166 16, 15167 16, 15168 16, 15169 16, 15170 16, 15171 16, 15172 16, 15173 16, 15174 16, 15175 16, 15176 16, 15177 16, 15178 16, 15179 16, 15180 16, 15181 16, 15182 16, 15183 16, 15184 16, 15185 16, 15186 16, 15187 16, 15188 16, 15189 16, 15190 16, 15191 16, 15192 16, 15193 16, 15194 16, 15195 24, 15196 24, 15197 24, 15198 24, 15199 24, 15200 24, 15201 24, 15202 24, 15203 24, 15204 24, 15205 24, 15206 24, 15207 24, 15208 24, 15209 24, 15210 24, 15211 24, 15212 24, 15213 24, 15214 24, 15215 24, 15216 24, 15217 24, 15218 24, 15219 24, 15220 24, 15221 24, 15222 24, 15223 24, 15224 24, 15225 24, 15226 24, 15227 24, 15228 24, 15229 24, 15230 24, 15231 24, 15232 24, 15233 24, 15234 24, 15235 24, 15236 24, 15237 24, 15238 24, 15239 24, 15240 24, 15241 24, 15242 24, 15243 24, 15244 24, 15245 24, 15246 24, 15247 24, 15248 24, 15249 24, 15250 24, 15251 24, 15252 24, 15253 24, 15254 24, 15255 24, 15256 24, 15257 24, 15258 24, 15259 32, 15260 32, 15261 32, 15262 32, 15263 32, 15264 32, 15265 32, 15266 32, 15267 32, 15268 32, 15269 32, 15270 32, 15271 32, 15272 32, 15273 32, 15274 32, 15275 32, 15276 32, 15277 32, 15278 32, 15279 32, 15280 32, 15281 32, 15282 32, 15283 32, 15284 32, 15285 32, 15286 32, 15287 32, 15288 32, 15289 32, 15290 32, 15291 32, 15292 32, 15293 32, 15294 32, 15295 32, 15296 32, 15297 32, 15298 32, 15299 32, 15300 32, 15301 32, 15302 32, 15303 32, 15304 32, 15305 32, 15306 32, 15307 32, 15308 32, 15309 32, 15310 32, 15311 32, 15312 32, 15313 32, 15314 32, 15315 32, 15316 32, 15317 32, 15318 32, 15319 32, 15320 32, 15321 32, 15322 32, 15323 40, 15324 40, 15325 40, 15326 40, 15327 40, 15328 40, 15329 40, 15330 40, 15331 40, 15332 40, 15333 40, 15334 40, 15335 40, 15336 40, 15337 40, 15338 40, 15339 40, 15340 40, 15341 40, 15342 40, 15343 40, 15344 40, 15345 40, 15346 40, 15347 40, 15348 40, 15349 40, 15350 40, 15351 40, 15352 40, 15353 40, 15354 40, 15355 40, 15356 40, 15357 40, 15358 40, 15359 40, 15360 40, 15361 40, 15362 40, 15363 40, 15364 40, 15365 40, 15366 40, 15367 40, 15368 40, 15369 40, 15370 40, 15371 48, 15372 48, 15373 48, 15374 48, 15375 48, 15376 48, 15377 48, 15378 48, 15379 48, 15380 48, 15381 48, 15382 48, 15383 48, 15384 48, 15385 48, 15386 56, 15387 /* CONTEXT_LSB6, last byte. */ 15388 0, 15389 1, 15390 2, 15391 3, 15392 4, 15393 5, 15394 6, 15395 7, 15396 8, 15397 9, 15398 10, 15399 11, 15400 12, 15401 13, 15402 14, 15403 15, 15404 16, 15405 17, 15406 18, 15407 19, 15408 20, 15409 21, 15410 22, 15411 23, 15412 24, 15413 25, 15414 26, 15415 27, 15416 28, 15417 29, 15418 30, 15419 31, 15420 32, 15421 33, 15422 34, 15423 35, 15424 36, 15425 37, 15426 38, 15427 39, 15428 40, 15429 41, 15430 42, 15431 43, 15432 44, 15433 45, 15434 46, 15435 47, 15436 48, 15437 49, 15438 50, 15439 51, 15440 52, 15441 53, 15442 54, 15443 55, 15444 56, 15445 57, 15446 58, 15447 59, 15448 60, 15449 61, 15450 62, 15451 63, 15452 0, 15453 1, 15454 2, 15455 3, 15456 4, 15457 5, 15458 6, 15459 7, 15460 8, 15461 9, 15462 10, 15463 11, 15464 12, 15465 13, 15466 14, 15467 15, 15468 16, 15469 17, 15470 18, 15471 19, 15472 20, 15473 21, 15474 22, 15475 23, 15476 24, 15477 25, 15478 26, 15479 27, 15480 28, 15481 29, 15482 30, 15483 31, 15484 32, 15485 33, 15486 34, 15487 35, 15488 36, 15489 37, 15490 38, 15491 39, 15492 40, 15493 41, 15494 42, 15495 43, 15496 44, 15497 45, 15498 46, 15499 47, 15500 48, 15501 49, 15502 50, 15503 51, 15504 52, 15505 53, 15506 54, 15507 55, 15508 56, 15509 57, 15510 58, 15511 59, 15512 60, 15513 61, 15514 62, 15515 63, 15516 0, 15517 1, 15518 2, 15519 3, 15520 4, 15521 5, 15522 6, 15523 7, 15524 8, 15525 9, 15526 10, 15527 11, 15528 12, 15529 13, 15530 14, 15531 15, 15532 16, 15533 17, 15534 18, 15535 19, 15536 20, 15537 21, 15538 22, 15539 23, 15540 24, 15541 25, 15542 26, 15543 27, 15544 28, 15545 29, 15546 30, 15547 31, 15548 32, 15549 33, 15550 34, 15551 35, 15552 36, 15553 37, 15554 38, 15555 39, 15556 40, 15557 41, 15558 42, 15559 43, 15560 44, 15561 45, 15562 46, 15563 47, 15564 48, 15565 49, 15566 50, 15567 51, 15568 52, 15569 53, 15570 54, 15571 55, 15572 56, 15573 57, 15574 58, 15575 59, 15576 60, 15577 61, 15578 62, 15579 63, 15580 0, 15581 1, 15582 2, 15583 3, 15584 4, 15585 5, 15586 6, 15587 7, 15588 8, 15589 9, 15590 10, 15591 11, 15592 12, 15593 13, 15594 14, 15595 15, 15596 16, 15597 17, 15598 18, 15599 19, 15600 20, 15601 21, 15602 22, 15603 23, 15604 24, 15605 25, 15606 26, 15607 27, 15608 28, 15609 29, 15610 30, 15611 31, 15612 32, 15613 33, 15614 34, 15615 35, 15616 36, 15617 37, 15618 38, 15619 39, 15620 40, 15621 41, 15622 42, 15623 43, 15624 44, 15625 45, 15626 46, 15627 47, 15628 48, 15629 49, 15630 50, 15631 51, 15632 52, 15633 53, 15634 54, 15635 55, 15636 56, 15637 57, 15638 58, 15639 59, 15640 60, 15641 61, 15642 62, 15643 63, 15644 /* CONTEXT_MSB6, last byte. */ 15645 0, 15646 0, 15647 0, 15648 0, 15649 1, 15650 1, 15651 1, 15652 1, 15653 2, 15654 2, 15655 2, 15656 2, 15657 3, 15658 3, 15659 3, 15660 3, 15661 4, 15662 4, 15663 4, 15664 4, 15665 5, 15666 5, 15667 5, 15668 5, 15669 6, 15670 6, 15671 6, 15672 6, 15673 7, 15674 7, 15675 7, 15676 7, 15677 8, 15678 8, 15679 8, 15680 8, 15681 9, 15682 9, 15683 9, 15684 9, 15685 10, 15686 10, 15687 10, 15688 10, 15689 11, 15690 11, 15691 11, 15692 11, 15693 12, 15694 12, 15695 12, 15696 12, 15697 13, 15698 13, 15699 13, 15700 13, 15701 14, 15702 14, 15703 14, 15704 14, 15705 15, 15706 15, 15707 15, 15708 15, 15709 16, 15710 16, 15711 16, 15712 16, 15713 17, 15714 17, 15715 17, 15716 17, 15717 18, 15718 18, 15719 18, 15720 18, 15721 19, 15722 19, 15723 19, 15724 19, 15725 20, 15726 20, 15727 20, 15728 20, 15729 21, 15730 21, 15731 21, 15732 21, 15733 22, 15734 22, 15735 22, 15736 22, 15737 23, 15738 23, 15739 23, 15740 23, 15741 24, 15742 24, 15743 24, 15744 24, 15745 25, 15746 25, 15747 25, 15748 25, 15749 26, 15750 26, 15751 26, 15752 26, 15753 27, 15754 27, 15755 27, 15756 27, 15757 28, 15758 28, 15759 28, 15760 28, 15761 29, 15762 29, 15763 29, 15764 29, 15765 30, 15766 30, 15767 30, 15768 30, 15769 31, 15770 31, 15771 31, 15772 31, 15773 32, 15774 32, 15775 32, 15776 32, 15777 33, 15778 33, 15779 33, 15780 33, 15781 34, 15782 34, 15783 34, 15784 34, 15785 35, 15786 35, 15787 35, 15788 35, 15789 36, 15790 36, 15791 36, 15792 36, 15793 37, 15794 37, 15795 37, 15796 37, 15797 38, 15798 38, 15799 38, 15800 38, 15801 39, 15802 39, 15803 39, 15804 39, 15805 40, 15806 40, 15807 40, 15808 40, 15809 41, 15810 41, 15811 41, 15812 41, 15813 42, 15814 42, 15815 42, 15816 42, 15817 43, 15818 43, 15819 43, 15820 43, 15821 44, 15822 44, 15823 44, 15824 44, 15825 45, 15826 45, 15827 45, 15828 45, 15829 46, 15830 46, 15831 46, 15832 46, 15833 47, 15834 47, 15835 47, 15836 47, 15837 48, 15838 48, 15839 48, 15840 48, 15841 49, 15842 49, 15843 49, 15844 49, 15845 50, 15846 50, 15847 50, 15848 50, 15849 51, 15850 51, 15851 51, 15852 51, 15853 52, 15854 52, 15855 52, 15856 52, 15857 53, 15858 53, 15859 53, 15860 53, 15861 54, 15862 54, 15863 54, 15864 54, 15865 55, 15866 55, 15867 55, 15868 55, 15869 56, 15870 56, 15871 56, 15872 56, 15873 57, 15874 57, 15875 57, 15876 57, 15877 58, 15878 58, 15879 58, 15880 58, 15881 59, 15882 59, 15883 59, 15884 59, 15885 60, 15886 60, 15887 60, 15888 60, 15889 61, 15890 61, 15891 61, 15892 61, 15893 62, 15894 62, 15895 62, 15896 62, 15897 63, 15898 63, 15899 63, 15900 63, 15901 /* CONTEXT_{M,L}SB6, second last byte, */ 15902 0, 15903 0, 15904 0, 15905 0, 15906 0, 15907 0, 15908 0, 15909 0, 15910 0, 15911 0, 15912 0, 15913 0, 15914 0, 15915 0, 15916 0, 15917 0, 15918 0, 15919 0, 15920 0, 15921 0, 15922 0, 15923 0, 15924 0, 15925 0, 15926 0, 15927 0, 15928 0, 15929 0, 15930 0, 15931 0, 15932 0, 15933 0, 15934 0, 15935 0, 15936 0, 15937 0, 15938 0, 15939 0, 15940 0, 15941 0, 15942 0, 15943 0, 15944 0, 15945 0, 15946 0, 15947 0, 15948 0, 15949 0, 15950 0, 15951 0, 15952 0, 15953 0, 15954 0, 15955 0, 15956 0, 15957 0, 15958 0, 15959 0, 15960 0, 15961 0, 15962 0, 15963 0, 15964 0, 15965 0, 15966 0, 15967 0, 15968 0, 15969 0, 15970 0, 15971 0, 15972 0, 15973 0, 15974 0, 15975 0, 15976 0, 15977 0, 15978 0, 15979 0, 15980 0, 15981 0, 15982 0, 15983 0, 15984 0, 15985 0, 15986 0, 15987 0, 15988 0, 15989 0, 15990 0, 15991 0, 15992 0, 15993 0, 15994 0, 15995 0, 15996 0, 15997 0, 15998 0, 15999 0, 16000 0, 16001 0, 16002 0, 16003 0, 16004 0, 16005 0, 16006 0, 16007 0, 16008 0, 16009 0, 16010 0, 16011 0, 16012 0, 16013 0, 16014 0, 16015 0, 16016 0, 16017 0, 16018 0, 16019 0, 16020 0, 16021 0, 16022 0, 16023 0, 16024 0, 16025 0, 16026 0, 16027 0, 16028 0, 16029 0, 16030 0, 16031 0, 16032 0, 16033 0, 16034 0, 16035 0, 16036 0, 16037 0, 16038 0, 16039 0, 16040 0, 16041 0, 16042 0, 16043 0, 16044 0, 16045 0, 16046 0, 16047 0, 16048 0, 16049 0, 16050 0, 16051 0, 16052 0, 16053 0, 16054 0, 16055 0, 16056 0, 16057 0, 16058 0, 16059 0, 16060 0, 16061 0, 16062 0, 16063 0, 16064 0, 16065 0, 16066 0, 16067 0, 16068 0, 16069 0, 16070 0, 16071 0, 16072 0, 16073 0, 16074 0, 16075 0, 16076 0, 16077 0, 16078 0, 16079 0, 16080 0, 16081 0, 16082 0, 16083 0, 16084 0, 16085 0, 16086 0, 16087 0, 16088 0, 16089 0, 16090 0, 16091 0, 16092 0, 16093 0, 16094 0, 16095 0, 16096 0, 16097 0, 16098 0, 16099 0, 16100 0, 16101 0, 16102 0, 16103 0, 16104 0, 16105 0, 16106 0, 16107 0, 16108 0, 16109 0, 16110 0, 16111 0, 16112 0, 16113 0, 16114 0, 16115 0, 16116 0, 16117 0, 16118 0, 16119 0, 16120 0, 16121 0, 16122 0, 16123 0, 16124 0, 16125 0, 16126 0, 16127 0, 16128 0, 16129 0, 16130 0, 16131 0, 16132 0, 16133 0, 16134 0, 16135 0, 16136 0, 16137 0, 16138 0, 16139 0, 16140 0, 16141 0, 16142 0, 16143 0, 16144 0, 16145 0, 16146 0, 16147 0, 16148 0, 16149 0, 16150 0, 16151 0, 16152 0, 16153 0, 16154 0, 16155 0, 16156 0, 16157 0 16158 ]); 16159 exports2.lookupOffsets = new Uint16Array([ 16160 /* CONTEXT_LSB6 */ 16161 1024, 16162 1536, 16163 1280, 16164 1536, 16165 0, 16166 256, 16167 768, 16168 512 16169 ]); 16170 }, 16171 {} 16172 ], 16173 3: [ 16174 function(require2, module2, exports2) { 16175 var BrotliInput = require2("./streams").BrotliInput; 16176 var BrotliOutput = require2("./streams").BrotliOutput; 16177 var BrotliBitReader = require2("./bit_reader"); 16178 var BrotliDictionary = require2("./dictionary"); 16179 var HuffmanCode = require2("./huffman").HuffmanCode; 16180 var BrotliBuildHuffmanTable = require2("./huffman").BrotliBuildHuffmanTable; 16181 var Context = require2("./context"); 16182 var Prefix = require2("./prefix"); 16183 var Transform = require2("./transform"); 16184 var kDefaultCodeLength = 8; 16185 var kCodeLengthRepeatCode = 16; 16186 var kNumLiteralCodes = 256; 16187 var kNumInsertAndCopyCodes = 704; 16188 var kNumBlockLengthCodes = 26; 16189 var kLiteralContextBits = 6; 16190 var kDistanceContextBits = 2; 16191 var HUFFMAN_TABLE_BITS = 8; 16192 var HUFFMAN_TABLE_MASK = 255; 16193 var HUFFMAN_MAX_TABLE_SIZE = 1080; 16194 var CODE_LENGTH_CODES = 18; 16195 var kCodeLengthCodeOrder = new Uint8Array([ 16196 1, 16197 2, 16198 3, 16199 4, 16200 0, 16201 5, 16202 17, 16203 6, 16204 16, 16205 7, 16206 8, 16207 9, 16208 10, 16209 11, 16210 12, 16211 13, 16212 14, 16213 15 16214 ]); 16215 var NUM_DISTANCE_SHORT_CODES = 16; 16216 var kDistanceShortCodeIndexOffset = new Uint8Array([ 16217 3, 16218 2, 16219 1, 16220 0, 16221 3, 16222 3, 16223 3, 16224 3, 16225 3, 16226 3, 16227 2, 16228 2, 16229 2, 16230 2, 16231 2, 16232 2 16233 ]); 16234 var kDistanceShortCodeValueOffset = new Int8Array([ 16235 0, 16236 0, 16237 0, 16238 0, 16239 -1, 16240 1, 16241 -2, 16242 2, 16243 -3, 16244 3, 16245 -1, 16246 1, 16247 -2, 16248 2, 16249 -3, 16250 3 16251 ]); 16252 var kMaxHuffmanTableSize = new Uint16Array([ 16253 256, 16254 402, 16255 436, 16256 468, 16257 500, 16258 534, 16259 566, 16260 598, 16261 630, 16262 662, 16263 694, 16264 726, 16265 758, 16266 790, 16267 822, 16268 854, 16269 886, 16270 920, 16271 952, 16272 984, 16273 1016, 16274 1048, 16275 1080 16276 ]); 16277 function DecodeWindowBits(br) { 16278 var n2; 16279 if (br.readBits(1) === 0) { 16280 return 16; 16281 } 16282 n2 = br.readBits(3); 16283 if (n2 > 0) { 16284 return 17 + n2; 16285 } 16286 n2 = br.readBits(3); 16287 if (n2 > 0) { 16288 return 8 + n2; 16289 } 16290 return 17; 16291 } 16292 function DecodeVarLenUint8(br) { 16293 if (br.readBits(1)) { 16294 var nbits = br.readBits(3); 16295 if (nbits === 0) { 16296 return 1; 16297 } else { 16298 return br.readBits(nbits) + (1 << nbits); 16299 } 16300 } 16301 return 0; 16302 } 16303 function MetaBlockLength() { 16304 this.meta_block_length = 0; 16305 this.input_end = 0; 16306 this.is_uncompressed = 0; 16307 this.is_metadata = false; 16308 } 16309 function DecodeMetaBlockLength(br) { 16310 var out = new MetaBlockLength(); 16311 var size_nibbles; 16312 var size_bytes; 16313 var i2; 16314 out.input_end = br.readBits(1); 16315 if (out.input_end && br.readBits(1)) { 16316 return out; 16317 } 16318 size_nibbles = br.readBits(2) + 4; 16319 if (size_nibbles === 7) { 16320 out.is_metadata = true; 16321 if (br.readBits(1) !== 0) 16322 throw new Error("Invalid reserved bit"); 16323 size_bytes = br.readBits(2); 16324 if (size_bytes === 0) return out; 16325 for (i2 = 0; i2 < size_bytes; i2++) { 16326 var next_byte = br.readBits(8); 16327 if (i2 + 1 === size_bytes && size_bytes > 1 && next_byte === 0) 16328 throw new Error("Invalid size byte"); 16329 out.meta_block_length |= next_byte << i2 * 8; 16330 } 16331 } else { 16332 for (i2 = 0; i2 < size_nibbles; ++i2) { 16333 var next_nibble = br.readBits(4); 16334 if (i2 + 1 === size_nibbles && size_nibbles > 4 && next_nibble === 0) 16335 throw new Error("Invalid size nibble"); 16336 out.meta_block_length |= next_nibble << i2 * 4; 16337 } 16338 } 16339 ++out.meta_block_length; 16340 if (!out.input_end && !out.is_metadata) { 16341 out.is_uncompressed = br.readBits(1); 16342 } 16343 return out; 16344 } 16345 function ReadSymbol(table, index2, br) { 16346 var start_index = index2; 16347 var nbits; 16348 br.fillBitWindow(); 16349 index2 += br.val_ >>> br.bit_pos_ & HUFFMAN_TABLE_MASK; 16350 nbits = table[index2].bits - HUFFMAN_TABLE_BITS; 16351 if (nbits > 0) { 16352 br.bit_pos_ += HUFFMAN_TABLE_BITS; 16353 index2 += table[index2].value; 16354 index2 += br.val_ >>> br.bit_pos_ & (1 << nbits) - 1; 16355 } 16356 br.bit_pos_ += table[index2].bits; 16357 return table[index2].value; 16358 } 16359 function ReadHuffmanCodeLengths(code_length_code_lengths, num_symbols, code_lengths, br) { 16360 var symbol = 0; 16361 var prev_code_len = kDefaultCodeLength; 16362 var repeat = 0; 16363 var repeat_code_len = 0; 16364 var space = 32768; 16365 var table = []; 16366 for (var i2 = 0; i2 < 32; i2++) 16367 table.push(new HuffmanCode(0, 0)); 16368 BrotliBuildHuffmanTable( 16369 table, 16370 0, 16371 5, 16372 code_length_code_lengths, 16373 CODE_LENGTH_CODES 16374 ); 16375 while (symbol < num_symbols && space > 0) { 16376 var p3 = 0; 16377 var code_len; 16378 br.readMoreInput(); 16379 br.fillBitWindow(); 16380 p3 += br.val_ >>> br.bit_pos_ & 31; 16381 br.bit_pos_ += table[p3].bits; 16382 code_len = table[p3].value & 255; 16383 if (code_len < kCodeLengthRepeatCode) { 16384 repeat = 0; 16385 code_lengths[symbol++] = code_len; 16386 if (code_len !== 0) { 16387 prev_code_len = code_len; 16388 space -= 32768 >> code_len; 16389 } 16390 } else { 16391 var extra_bits = code_len - 14; 16392 var old_repeat; 16393 var repeat_delta; 16394 var new_len = 0; 16395 if (code_len === kCodeLengthRepeatCode) { 16396 new_len = prev_code_len; 16397 } 16398 if (repeat_code_len !== new_len) { 16399 repeat = 0; 16400 repeat_code_len = new_len; 16401 } 16402 old_repeat = repeat; 16403 if (repeat > 0) { 16404 repeat -= 2; 16405 repeat <<= extra_bits; 16406 } 16407 repeat += br.readBits(extra_bits) + 3; 16408 repeat_delta = repeat - old_repeat; 16409 if (symbol + repeat_delta > num_symbols) { 16410 throw new Error( 16411 "[ReadHuffmanCodeLengths] symbol + repeat_delta > num_symbols" 16412 ); 16413 } 16414 for (var x2 = 0; x2 < repeat_delta; x2++) 16415 code_lengths[symbol + x2] = repeat_code_len; 16416 symbol += repeat_delta; 16417 if (repeat_code_len !== 0) { 16418 space -= repeat_delta << 15 - repeat_code_len; 16419 } 16420 } 16421 } 16422 if (space !== 0) { 16423 throw new Error( 16424 "[ReadHuffmanCodeLengths] space = " + space 16425 ); 16426 } 16427 for (; symbol < num_symbols; symbol++) 16428 code_lengths[symbol] = 0; 16429 } 16430 function ReadHuffmanCode(alphabet_size, tables, table, br) { 16431 var table_size = 0; 16432 var simple_code_or_skip; 16433 var code_lengths = new Uint8Array(alphabet_size); 16434 br.readMoreInput(); 16435 simple_code_or_skip = br.readBits(2); 16436 if (simple_code_or_skip === 1) { 16437 var i2; 16438 var max_bits_counter = alphabet_size - 1; 16439 var max_bits = 0; 16440 var symbols = new Int32Array(4); 16441 var num_symbols = br.readBits(2) + 1; 16442 while (max_bits_counter) { 16443 max_bits_counter >>= 1; 16444 ++max_bits; 16445 } 16446 for (i2 = 0; i2 < num_symbols; ++i2) { 16447 symbols[i2] = br.readBits(max_bits) % alphabet_size; 16448 code_lengths[symbols[i2]] = 2; 16449 } 16450 code_lengths[symbols[0]] = 1; 16451 switch (num_symbols) { 16452 case 1: 16453 break; 16454 case 3: 16455 if (symbols[0] === symbols[1] || symbols[0] === symbols[2] || symbols[1] === symbols[2]) { 16456 throw new Error( 16457 "[ReadHuffmanCode] invalid symbols" 16458 ); 16459 } 16460 break; 16461 case 2: 16462 if (symbols[0] === symbols[1]) { 16463 throw new Error( 16464 "[ReadHuffmanCode] invalid symbols" 16465 ); 16466 } 16467 code_lengths[symbols[1]] = 1; 16468 break; 16469 case 4: 16470 if (symbols[0] === symbols[1] || symbols[0] === symbols[2] || symbols[0] === symbols[3] || symbols[1] === symbols[2] || symbols[1] === symbols[3] || symbols[2] === symbols[3]) { 16471 throw new Error( 16472 "[ReadHuffmanCode] invalid symbols" 16473 ); 16474 } 16475 if (br.readBits(1)) { 16476 code_lengths[symbols[2]] = 3; 16477 code_lengths[symbols[3]] = 3; 16478 } else { 16479 code_lengths[symbols[0]] = 2; 16480 } 16481 break; 16482 } 16483 } else { 16484 var i2; 16485 var code_length_code_lengths = new Uint8Array( 16486 CODE_LENGTH_CODES 16487 ); 16488 var space = 32; 16489 var num_codes = 0; 16490 var huff = [ 16491 new HuffmanCode(2, 0), 16492 new HuffmanCode(2, 4), 16493 new HuffmanCode(2, 3), 16494 new HuffmanCode(3, 2), 16495 new HuffmanCode(2, 0), 16496 new HuffmanCode(2, 4), 16497 new HuffmanCode(2, 3), 16498 new HuffmanCode(4, 1), 16499 new HuffmanCode(2, 0), 16500 new HuffmanCode(2, 4), 16501 new HuffmanCode(2, 3), 16502 new HuffmanCode(3, 2), 16503 new HuffmanCode(2, 0), 16504 new HuffmanCode(2, 4), 16505 new HuffmanCode(2, 3), 16506 new HuffmanCode(4, 5) 16507 ]; 16508 for (i2 = simple_code_or_skip; i2 < CODE_LENGTH_CODES && space > 0; ++i2) { 16509 var code_len_idx = kCodeLengthCodeOrder[i2]; 16510 var p3 = 0; 16511 var v2; 16512 br.fillBitWindow(); 16513 p3 += br.val_ >>> br.bit_pos_ & 15; 16514 br.bit_pos_ += huff[p3].bits; 16515 v2 = huff[p3].value; 16516 code_length_code_lengths[code_len_idx] = v2; 16517 if (v2 !== 0) { 16518 space -= 32 >> v2; 16519 ++num_codes; 16520 } 16521 } 16522 if (!(num_codes === 1 || space === 0)) 16523 throw new Error( 16524 "[ReadHuffmanCode] invalid num_codes or space" 16525 ); 16526 ReadHuffmanCodeLengths( 16527 code_length_code_lengths, 16528 alphabet_size, 16529 code_lengths, 16530 br 16531 ); 16532 } 16533 table_size = BrotliBuildHuffmanTable( 16534 tables, 16535 table, 16536 HUFFMAN_TABLE_BITS, 16537 code_lengths, 16538 alphabet_size 16539 ); 16540 if (table_size === 0) { 16541 throw new Error( 16542 "[ReadHuffmanCode] BuildHuffmanTable failed: " 16543 ); 16544 } 16545 return table_size; 16546 } 16547 function ReadBlockLength(table, index2, br) { 16548 var code; 16549 var nbits; 16550 code = ReadSymbol(table, index2, br); 16551 nbits = Prefix.kBlockLengthPrefixCode[code].nbits; 16552 return Prefix.kBlockLengthPrefixCode[code].offset + br.readBits(nbits); 16553 } 16554 function TranslateShortCodes(code, ringbuffer, index2) { 16555 var val; 16556 if (code < NUM_DISTANCE_SHORT_CODES) { 16557 index2 += kDistanceShortCodeIndexOffset[code]; 16558 index2 &= 3; 16559 val = ringbuffer[index2] + kDistanceShortCodeValueOffset[code]; 16560 } else { 16561 val = code - NUM_DISTANCE_SHORT_CODES + 1; 16562 } 16563 return val; 16564 } 16565 function MoveToFront(v2, index2) { 16566 var value = v2[index2]; 16567 var i2 = index2; 16568 for (; i2; --i2) v2[i2] = v2[i2 - 1]; 16569 v2[0] = value; 16570 } 16571 function InverseMoveToFrontTransform(v2, v_len) { 16572 var mtf = new Uint8Array(256); 16573 var i2; 16574 for (i2 = 0; i2 < 256; ++i2) { 16575 mtf[i2] = i2; 16576 } 16577 for (i2 = 0; i2 < v_len; ++i2) { 16578 var index2 = v2[i2]; 16579 v2[i2] = mtf[index2]; 16580 if (index2) MoveToFront(mtf, index2); 16581 } 16582 } 16583 function HuffmanTreeGroup(alphabet_size, num_htrees) { 16584 this.alphabet_size = alphabet_size; 16585 this.num_htrees = num_htrees; 16586 this.codes = new Array( 16587 num_htrees + num_htrees * kMaxHuffmanTableSize[alphabet_size + 31 >>> 5] 16588 ); 16589 this.htrees = new Uint32Array(num_htrees); 16590 } 16591 HuffmanTreeGroup.prototype.decode = function(br) { 16592 var i2; 16593 var table_size; 16594 var next = 0; 16595 for (i2 = 0; i2 < this.num_htrees; ++i2) { 16596 this.htrees[i2] = next; 16597 table_size = ReadHuffmanCode( 16598 this.alphabet_size, 16599 this.codes, 16600 next, 16601 br 16602 ); 16603 next += table_size; 16604 } 16605 }; 16606 function DecodeContextMap(context_map_size, br) { 16607 var out = { num_htrees: null, context_map: null }; 16608 var use_rle_for_zeros; 16609 var max_run_length_prefix = 0; 16610 var table; 16611 var i2; 16612 br.readMoreInput(); 16613 var num_htrees = out.num_htrees = DecodeVarLenUint8(br) + 1; 16614 var context_map = out.context_map = new Uint8Array( 16615 context_map_size 16616 ); 16617 if (num_htrees <= 1) { 16618 return out; 16619 } 16620 use_rle_for_zeros = br.readBits(1); 16621 if (use_rle_for_zeros) { 16622 max_run_length_prefix = br.readBits(4) + 1; 16623 } 16624 table = []; 16625 for (i2 = 0; i2 < HUFFMAN_MAX_TABLE_SIZE; i2++) { 16626 table[i2] = new HuffmanCode(0, 0); 16627 } 16628 ReadHuffmanCode( 16629 num_htrees + max_run_length_prefix, 16630 table, 16631 0, 16632 br 16633 ); 16634 for (i2 = 0; i2 < context_map_size; ) { 16635 var code; 16636 br.readMoreInput(); 16637 code = ReadSymbol(table, 0, br); 16638 if (code === 0) { 16639 context_map[i2] = 0; 16640 ++i2; 16641 } else if (code <= max_run_length_prefix) { 16642 var reps = 1 + (1 << code) + br.readBits(code); 16643 while (--reps) { 16644 if (i2 >= context_map_size) { 16645 throw new Error( 16646 "[DecodeContextMap] i >= context_map_size" 16647 ); 16648 } 16649 context_map[i2] = 0; 16650 ++i2; 16651 } 16652 } else { 16653 context_map[i2] = code - max_run_length_prefix; 16654 ++i2; 16655 } 16656 } 16657 if (br.readBits(1)) { 16658 InverseMoveToFrontTransform( 16659 context_map, 16660 context_map_size 16661 ); 16662 } 16663 return out; 16664 } 16665 function DecodeBlockType(max_block_type, trees, tree_type, block_types, ringbuffers, indexes, br) { 16666 var ringbuffer = tree_type * 2; 16667 var index2 = tree_type; 16668 var type_code = ReadSymbol( 16669 trees, 16670 tree_type * HUFFMAN_MAX_TABLE_SIZE, 16671 br 16672 ); 16673 var block_type; 16674 if (type_code === 0) { 16675 block_type = ringbuffers[ringbuffer + (indexes[index2] & 1)]; 16676 } else if (type_code === 1) { 16677 block_type = ringbuffers[ringbuffer + (indexes[index2] - 1 & 1)] + 1; 16678 } else { 16679 block_type = type_code - 2; 16680 } 16681 if (block_type >= max_block_type) { 16682 block_type -= max_block_type; 16683 } 16684 block_types[tree_type] = block_type; 16685 ringbuffers[ringbuffer + (indexes[index2] & 1)] = block_type; 16686 ++indexes[index2]; 16687 } 16688 function CopyUncompressedBlockToOutput(output, len, pos, ringbuffer, ringbuffer_mask, br) { 16689 var rb_size = ringbuffer_mask + 1; 16690 var rb_pos = pos & ringbuffer_mask; 16691 var br_pos = br.pos_ & BrotliBitReader.IBUF_MASK; 16692 var nbytes; 16693 if (len < 8 || br.bit_pos_ + (len << 3) < br.bit_end_pos_) { 16694 while (len-- > 0) { 16695 br.readMoreInput(); 16696 ringbuffer[rb_pos++] = br.readBits(8); 16697 if (rb_pos === rb_size) { 16698 output.write(ringbuffer, rb_size); 16699 rb_pos = 0; 16700 } 16701 } 16702 return; 16703 } 16704 if (br.bit_end_pos_ < 32) { 16705 throw new Error( 16706 "[CopyUncompressedBlockToOutput] br.bit_end_pos_ < 32" 16707 ); 16708 } 16709 while (br.bit_pos_ < 32) { 16710 ringbuffer[rb_pos] = br.val_ >>> br.bit_pos_; 16711 br.bit_pos_ += 8; 16712 ++rb_pos; 16713 --len; 16714 } 16715 nbytes = br.bit_end_pos_ - br.bit_pos_ >> 3; 16716 if (br_pos + nbytes > BrotliBitReader.IBUF_MASK) { 16717 var tail = BrotliBitReader.IBUF_MASK + 1 - br_pos; 16718 for (var x2 = 0; x2 < tail; x2++) 16719 ringbuffer[rb_pos + x2] = br.buf_[br_pos + x2]; 16720 nbytes -= tail; 16721 rb_pos += tail; 16722 len -= tail; 16723 br_pos = 0; 16724 } 16725 for (var x2 = 0; x2 < nbytes; x2++) 16726 ringbuffer[rb_pos + x2] = br.buf_[br_pos + x2]; 16727 rb_pos += nbytes; 16728 len -= nbytes; 16729 if (rb_pos >= rb_size) { 16730 output.write(ringbuffer, rb_size); 16731 rb_pos -= rb_size; 16732 for (var x2 = 0; x2 < rb_pos; x2++) 16733 ringbuffer[x2] = ringbuffer[rb_size + x2]; 16734 } 16735 while (rb_pos + len >= rb_size) { 16736 nbytes = rb_size - rb_pos; 16737 if (br.input_.read(ringbuffer, rb_pos, nbytes) < nbytes) { 16738 throw new Error( 16739 "[CopyUncompressedBlockToOutput] not enough bytes" 16740 ); 16741 } 16742 output.write(ringbuffer, rb_size); 16743 len -= nbytes; 16744 rb_pos = 0; 16745 } 16746 if (br.input_.read(ringbuffer, rb_pos, len) < len) { 16747 throw new Error( 16748 "[CopyUncompressedBlockToOutput] not enough bytes" 16749 ); 16750 } 16751 br.reset(); 16752 } 16753 function JumpToByteBoundary(br) { 16754 var new_bit_pos = br.bit_pos_ + 7 & ~7; 16755 var pad_bits = br.readBits(new_bit_pos - br.bit_pos_); 16756 return pad_bits == 0; 16757 } 16758 function BrotliDecompressedSize(buffer) { 16759 var input = new BrotliInput(buffer); 16760 var br = new BrotliBitReader(input); 16761 DecodeWindowBits(br); 16762 var out = DecodeMetaBlockLength(br); 16763 return out.meta_block_length; 16764 } 16765 exports2.BrotliDecompressedSize = BrotliDecompressedSize; 16766 function BrotliDecompressBuffer(buffer, output_size) { 16767 var input = new BrotliInput(buffer); 16768 if (output_size == null) { 16769 output_size = BrotliDecompressedSize(buffer); 16770 } 16771 var output_buffer = new Uint8Array(output_size); 16772 var output = new BrotliOutput(output_buffer); 16773 BrotliDecompress(input, output); 16774 if (output.pos < output.buffer.length) { 16775 output.buffer = output.buffer.subarray( 16776 0, 16777 output.pos 16778 ); 16779 } 16780 return output.buffer; 16781 } 16782 exports2.BrotliDecompressBuffer = BrotliDecompressBuffer; 16783 function BrotliDecompress(input, output) { 16784 var i2; 16785 var pos = 0; 16786 var input_end = 0; 16787 var window_bits = 0; 16788 var max_backward_distance; 16789 var max_distance = 0; 16790 var ringbuffer_size; 16791 var ringbuffer_mask; 16792 var ringbuffer; 16793 var ringbuffer_end; 16794 var dist_rb = [16, 15, 11, 4]; 16795 var dist_rb_idx = 0; 16796 var prev_byte1 = 0; 16797 var prev_byte2 = 0; 16798 var hgroup = [ 16799 new HuffmanTreeGroup(0, 0), 16800 new HuffmanTreeGroup(0, 0), 16801 new HuffmanTreeGroup(0, 0) 16802 ]; 16803 var block_type_trees; 16804 var block_len_trees; 16805 var br; 16806 var kRingBufferWriteAheadSlack = 128 + BrotliBitReader.READ_SIZE; 16807 br = new BrotliBitReader(input); 16808 window_bits = DecodeWindowBits(br); 16809 max_backward_distance = (1 << window_bits) - 16; 16810 ringbuffer_size = 1 << window_bits; 16811 ringbuffer_mask = ringbuffer_size - 1; 16812 ringbuffer = new Uint8Array( 16813 ringbuffer_size + kRingBufferWriteAheadSlack + BrotliDictionary.maxDictionaryWordLength 16814 ); 16815 ringbuffer_end = ringbuffer_size; 16816 block_type_trees = []; 16817 block_len_trees = []; 16818 for (var x2 = 0; x2 < 3 * HUFFMAN_MAX_TABLE_SIZE; x2++) { 16819 block_type_trees[x2] = new HuffmanCode(0, 0); 16820 block_len_trees[x2] = new HuffmanCode(0, 0); 16821 } 16822 while (!input_end) { 16823 var meta_block_remaining_len = 0; 16824 var is_uncompressed; 16825 var block_length = [1 << 28, 1 << 28, 1 << 28]; 16826 var block_type = [0]; 16827 var num_block_types = [1, 1, 1]; 16828 var block_type_rb = [0, 1, 0, 1, 0, 1]; 16829 var block_type_rb_index = [0]; 16830 var distance_postfix_bits; 16831 var num_direct_distance_codes; 16832 var distance_postfix_mask; 16833 var num_distance_codes; 16834 var context_map = null; 16835 var context_modes = null; 16836 var num_literal_htrees; 16837 var dist_context_map = null; 16838 var num_dist_htrees; 16839 var context_offset = 0; 16840 var context_map_slice = null; 16841 var literal_htree_index = 0; 16842 var dist_context_offset = 0; 16843 var dist_context_map_slice = null; 16844 var dist_htree_index = 0; 16845 var context_lookup_offset1 = 0; 16846 var context_lookup_offset2 = 0; 16847 var context_mode; 16848 var htree_command; 16849 for (i2 = 0; i2 < 3; ++i2) { 16850 hgroup[i2].codes = null; 16851 hgroup[i2].htrees = null; 16852 } 16853 br.readMoreInput(); 16854 var _out = DecodeMetaBlockLength(br); 16855 meta_block_remaining_len = _out.meta_block_length; 16856 if (pos + meta_block_remaining_len > output.buffer.length) { 16857 var tmp = new Uint8Array( 16858 pos + meta_block_remaining_len 16859 ); 16860 tmp.set(output.buffer); 16861 output.buffer = tmp; 16862 } 16863 input_end = _out.input_end; 16864 is_uncompressed = _out.is_uncompressed; 16865 if (_out.is_metadata) { 16866 JumpToByteBoundary(br); 16867 for (; meta_block_remaining_len > 0; --meta_block_remaining_len) { 16868 br.readMoreInput(); 16869 br.readBits(8); 16870 } 16871 continue; 16872 } 16873 if (meta_block_remaining_len === 0) { 16874 continue; 16875 } 16876 if (is_uncompressed) { 16877 br.bit_pos_ = br.bit_pos_ + 7 & ~7; 16878 CopyUncompressedBlockToOutput( 16879 output, 16880 meta_block_remaining_len, 16881 pos, 16882 ringbuffer, 16883 ringbuffer_mask, 16884 br 16885 ); 16886 pos += meta_block_remaining_len; 16887 continue; 16888 } 16889 for (i2 = 0; i2 < 3; ++i2) { 16890 num_block_types[i2] = DecodeVarLenUint8(br) + 1; 16891 if (num_block_types[i2] >= 2) { 16892 ReadHuffmanCode( 16893 num_block_types[i2] + 2, 16894 block_type_trees, 16895 i2 * HUFFMAN_MAX_TABLE_SIZE, 16896 br 16897 ); 16898 ReadHuffmanCode( 16899 kNumBlockLengthCodes, 16900 block_len_trees, 16901 i2 * HUFFMAN_MAX_TABLE_SIZE, 16902 br 16903 ); 16904 block_length[i2] = ReadBlockLength( 16905 block_len_trees, 16906 i2 * HUFFMAN_MAX_TABLE_SIZE, 16907 br 16908 ); 16909 block_type_rb_index[i2] = 1; 16910 } 16911 } 16912 br.readMoreInput(); 16913 distance_postfix_bits = br.readBits(2); 16914 num_direct_distance_codes = NUM_DISTANCE_SHORT_CODES + (br.readBits(4) << distance_postfix_bits); 16915 distance_postfix_mask = (1 << distance_postfix_bits) - 1; 16916 num_distance_codes = num_direct_distance_codes + (48 << distance_postfix_bits); 16917 context_modes = new Uint8Array( 16918 num_block_types[0] 16919 ); 16920 for (i2 = 0; i2 < num_block_types[0]; ++i2) { 16921 br.readMoreInput(); 16922 context_modes[i2] = br.readBits(2) << 1; 16923 } 16924 var _o1 = DecodeContextMap( 16925 num_block_types[0] << kLiteralContextBits, 16926 br 16927 ); 16928 num_literal_htrees = _o1.num_htrees; 16929 context_map = _o1.context_map; 16930 var _o2 = DecodeContextMap( 16931 num_block_types[2] << kDistanceContextBits, 16932 br 16933 ); 16934 num_dist_htrees = _o2.num_htrees; 16935 dist_context_map = _o2.context_map; 16936 hgroup[0] = new HuffmanTreeGroup( 16937 kNumLiteralCodes, 16938 num_literal_htrees 16939 ); 16940 hgroup[1] = new HuffmanTreeGroup( 16941 kNumInsertAndCopyCodes, 16942 num_block_types[1] 16943 ); 16944 hgroup[2] = new HuffmanTreeGroup( 16945 num_distance_codes, 16946 num_dist_htrees 16947 ); 16948 for (i2 = 0; i2 < 3; ++i2) { 16949 hgroup[i2].decode(br); 16950 } 16951 context_map_slice = 0; 16952 dist_context_map_slice = 0; 16953 context_mode = context_modes[block_type[0]]; 16954 context_lookup_offset1 = Context.lookupOffsets[context_mode]; 16955 context_lookup_offset2 = Context.lookupOffsets[context_mode + 1]; 16956 htree_command = hgroup[1].htrees[0]; 16957 while (meta_block_remaining_len > 0) { 16958 var cmd_code; 16959 var range_idx; 16960 var insert_code; 16961 var copy_code; 16962 var insert_length; 16963 var copy_length; 16964 var distance_code; 16965 var distance; 16966 var context; 16967 var j2; 16968 var copy_dst; 16969 br.readMoreInput(); 16970 if (block_length[1] === 0) { 16971 DecodeBlockType( 16972 num_block_types[1], 16973 block_type_trees, 16974 1, 16975 block_type, 16976 block_type_rb, 16977 block_type_rb_index, 16978 br 16979 ); 16980 block_length[1] = ReadBlockLength( 16981 block_len_trees, 16982 HUFFMAN_MAX_TABLE_SIZE, 16983 br 16984 ); 16985 htree_command = hgroup[1].htrees[block_type[1]]; 16986 } 16987 --block_length[1]; 16988 cmd_code = ReadSymbol( 16989 hgroup[1].codes, 16990 htree_command, 16991 br 16992 ); 16993 range_idx = cmd_code >> 6; 16994 if (range_idx >= 2) { 16995 range_idx -= 2; 16996 distance_code = -1; 16997 } else { 16998 distance_code = 0; 16999 } 17000 insert_code = Prefix.kInsertRangeLut[range_idx] + (cmd_code >> 3 & 7); 17001 copy_code = Prefix.kCopyRangeLut[range_idx] + (cmd_code & 7); 17002 insert_length = Prefix.kInsertLengthPrefixCode[insert_code].offset + br.readBits( 17003 Prefix.kInsertLengthPrefixCode[insert_code].nbits 17004 ); 17005 copy_length = Prefix.kCopyLengthPrefixCode[copy_code].offset + br.readBits( 17006 Prefix.kCopyLengthPrefixCode[copy_code].nbits 17007 ); 17008 prev_byte1 = ringbuffer[pos - 1 & ringbuffer_mask]; 17009 prev_byte2 = ringbuffer[pos - 2 & ringbuffer_mask]; 17010 for (j2 = 0; j2 < insert_length; ++j2) { 17011 br.readMoreInput(); 17012 if (block_length[0] === 0) { 17013 DecodeBlockType( 17014 num_block_types[0], 17015 block_type_trees, 17016 0, 17017 block_type, 17018 block_type_rb, 17019 block_type_rb_index, 17020 br 17021 ); 17022 block_length[0] = ReadBlockLength( 17023 block_len_trees, 17024 0, 17025 br 17026 ); 17027 context_offset = block_type[0] << kLiteralContextBits; 17028 context_map_slice = context_offset; 17029 context_mode = context_modes[block_type[0]]; 17030 context_lookup_offset1 = Context.lookupOffsets[context_mode]; 17031 context_lookup_offset2 = Context.lookupOffsets[context_mode + 1]; 17032 } 17033 context = Context.lookup[context_lookup_offset1 + prev_byte1] | Context.lookup[context_lookup_offset2 + prev_byte2]; 17034 literal_htree_index = context_map[context_map_slice + context]; 17035 --block_length[0]; 17036 prev_byte2 = prev_byte1; 17037 prev_byte1 = ReadSymbol( 17038 hgroup[0].codes, 17039 hgroup[0].htrees[literal_htree_index], 17040 br 17041 ); 17042 ringbuffer[pos & ringbuffer_mask] = prev_byte1; 17043 if ((pos & ringbuffer_mask) === ringbuffer_mask) { 17044 output.write( 17045 ringbuffer, 17046 ringbuffer_size 17047 ); 17048 } 17049 ++pos; 17050 } 17051 meta_block_remaining_len -= insert_length; 17052 if (meta_block_remaining_len <= 0) break; 17053 if (distance_code < 0) { 17054 var context; 17055 br.readMoreInput(); 17056 if (block_length[2] === 0) { 17057 DecodeBlockType( 17058 num_block_types[2], 17059 block_type_trees, 17060 2, 17061 block_type, 17062 block_type_rb, 17063 block_type_rb_index, 17064 br 17065 ); 17066 block_length[2] = ReadBlockLength( 17067 block_len_trees, 17068 2 * HUFFMAN_MAX_TABLE_SIZE, 17069 br 17070 ); 17071 dist_context_offset = block_type[2] << kDistanceContextBits; 17072 dist_context_map_slice = dist_context_offset; 17073 } 17074 --block_length[2]; 17075 context = (copy_length > 4 ? 3 : copy_length - 2) & 255; 17076 dist_htree_index = dist_context_map[dist_context_map_slice + context]; 17077 distance_code = ReadSymbol( 17078 hgroup[2].codes, 17079 hgroup[2].htrees[dist_htree_index], 17080 br 17081 ); 17082 if (distance_code >= num_direct_distance_codes) { 17083 var nbits; 17084 var postfix; 17085 var offset4; 17086 distance_code -= num_direct_distance_codes; 17087 postfix = distance_code & distance_postfix_mask; 17088 distance_code >>= distance_postfix_bits; 17089 nbits = (distance_code >> 1) + 1; 17090 offset4 = (2 + (distance_code & 1) << nbits) - 4; 17091 distance_code = num_direct_distance_codes + (offset4 + br.readBits(nbits) << distance_postfix_bits) + postfix; 17092 } 17093 } 17094 distance = TranslateShortCodes( 17095 distance_code, 17096 dist_rb, 17097 dist_rb_idx 17098 ); 17099 if (distance < 0) { 17100 throw new Error( 17101 "[BrotliDecompress] invalid distance" 17102 ); 17103 } 17104 if (pos < max_backward_distance && max_distance !== max_backward_distance) { 17105 max_distance = pos; 17106 } else { 17107 max_distance = max_backward_distance; 17108 } 17109 copy_dst = pos & ringbuffer_mask; 17110 if (distance > max_distance) { 17111 if (copy_length >= BrotliDictionary.minDictionaryWordLength && copy_length <= BrotliDictionary.maxDictionaryWordLength) { 17112 var offset4 = BrotliDictionary.offsetsByLength[copy_length]; 17113 var word_id = distance - max_distance - 1; 17114 var shift4 = BrotliDictionary.sizeBitsByLength[copy_length]; 17115 var mask = (1 << shift4) - 1; 17116 var word_idx = word_id & mask; 17117 var transform_idx = word_id >> shift4; 17118 offset4 += word_idx * copy_length; 17119 if (transform_idx < Transform.kNumTransforms) { 17120 var len = Transform.transformDictionaryWord( 17121 ringbuffer, 17122 copy_dst, 17123 offset4, 17124 copy_length, 17125 transform_idx 17126 ); 17127 copy_dst += len; 17128 pos += len; 17129 meta_block_remaining_len -= len; 17130 if (copy_dst >= ringbuffer_end) { 17131 output.write( 17132 ringbuffer, 17133 ringbuffer_size 17134 ); 17135 for (var _x10 = 0; _x10 < copy_dst - ringbuffer_end; _x10++) 17136 ringbuffer[_x10] = ringbuffer[ringbuffer_end + _x10]; 17137 } 17138 } else { 17139 throw new Error( 17140 "Invalid backward reference. pos: " + pos + " distance: " + distance + " len: " + copy_length + " bytes left: " + meta_block_remaining_len 17141 ); 17142 } 17143 } else { 17144 throw new Error( 17145 "Invalid backward reference. pos: " + pos + " distance: " + distance + " len: " + copy_length + " bytes left: " + meta_block_remaining_len 17146 ); 17147 } 17148 } else { 17149 if (distance_code > 0) { 17150 dist_rb[dist_rb_idx & 3] = distance; 17151 ++dist_rb_idx; 17152 } 17153 if (copy_length > meta_block_remaining_len) { 17154 throw new Error( 17155 "Invalid backward reference. pos: " + pos + " distance: " + distance + " len: " + copy_length + " bytes left: " + meta_block_remaining_len 17156 ); 17157 } 17158 for (j2 = 0; j2 < copy_length; ++j2) { 17159 ringbuffer[pos & ringbuffer_mask] = ringbuffer[pos - distance & ringbuffer_mask]; 17160 if ((pos & ringbuffer_mask) === ringbuffer_mask) { 17161 output.write( 17162 ringbuffer, 17163 ringbuffer_size 17164 ); 17165 } 17166 ++pos; 17167 --meta_block_remaining_len; 17168 } 17169 } 17170 prev_byte1 = ringbuffer[pos - 1 & ringbuffer_mask]; 17171 prev_byte2 = ringbuffer[pos - 2 & ringbuffer_mask]; 17172 } 17173 pos &= 1073741823; 17174 } 17175 output.write(ringbuffer, pos & ringbuffer_mask); 17176 } 17177 exports2.BrotliDecompress = BrotliDecompress; 17178 BrotliDictionary.init(); 17179 }, 17180 { 17181 "./bit_reader": 1, 17182 "./context": 2, 17183 "./dictionary": 6, 17184 "./huffman": 7, 17185 "./prefix": 9, 17186 "./streams": 10, 17187 "./transform": 11 17188 } 17189 ], 17190 4: [ 17191 function(require2, module2, exports2) { 17192 var base64 = require2("base64-js"); 17193 exports2.init = function() { 17194 var BrotliDecompressBuffer = require2("./decode").BrotliDecompressBuffer; 17195 var compressed = base64.toByteArray( 17196 require2("./dictionary.bin.js") 17197 ); 17198 return BrotliDecompressBuffer(compressed); 17199 }; 17200 }, 17201 { "./decode": 3, "./dictionary.bin.js": 5, "base64-js": 8 } 17202 ], 17203 5: [ 17204 function(require2, module2, exports2) { 17205 module2.exports = "W5/fcQLn5gKf2XUbAiQ1XULX+TZz6ADToDsgqk6qVfeC0e4m6OO2wcQ1J76ZBVRV1fRkEsdu//62zQsFEZWSTCnMhcsQKlS2qOhuVYYMGCkV0fXWEoMFbESXrKEZ9wdUEsyw9g4bJlEt1Y6oVMxMRTEVbCIwZzJzboK5j8m4YH02qgXYhv1V+PM435sLVxyHJihaJREEhZGqL03txGFQLm76caGO/ovxKvzCby/3vMTtX/459f0igi7WutnKiMQ6wODSoRh/8Lx1V3Q99MvKtwB6bHdERYRY0hStJoMjNeTsNX7bn+Y7e4EQ3bf8xBc7L0BsyfFPK43dGSXpL6clYC/I328h54/VYrQ5i0648FgbGtl837svJ35L3Mot/+nPlNpWgKx1gGXQYqX6n+bbZ7wuyCHKcUok12Xjqub7NXZGzqBx0SD+uziNf87t7ve42jxSKQoW3nyxVrWIGlFShhCKxjpZZ5MeGna0+lBkk+kaN8F9qFBAFgEogyMBdcX/T1W/WnMOi/7ycWUQloEBKGeC48MkiwqJkJO+12eQiOFHMmck6q/IjWW3RZlany23TBm+cNr/84/oi5GGmGBZWrZ6j+zykVozz5fT/QH/Da6WTbZYYPynVNO7kxzuNN2kxKKWche5WveitPKAecB8YcAHz/+zXLjcLzkdDSktNIDwZE9J9X+tto43oJy65wApM3mDzYtCwX9lM+N5VR3kXYo0Z3t0TtXfgBFg7gU8oN0Dgl7fZlUbhNll+0uuohRVKjrEd8egrSndy5/Tgd2gqjA4CAVuC7ESUmL3DZoGnfhQV8uwnpi8EGvAVVsowNRxPudck7+oqAUDkwZopWqFnW1riss0t1z6iCISVKreYGNvQcXv+1L9+jbP8cd/d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P9aiVcIB9k6tY7WdJ1wNV+bHeydNtmC6G5ICtFC1ZwmJU/j8hf0I8TRVKSiz5oYIa93EpUI78X8GYIAZabx47/n8LDAAJ0nNtP1rpROprqKMBRecShca6qXuTSI3jZBLOB3Vp381B5rCGhjSvh/NSVkYp2qIdP/Bg="; 17206 }, 17207 {} 17208 ], 17209 6: [ 17210 function(require2, module2, exports2) { 17211 var data = require2("./dictionary-browser"); 17212 exports2.init = function() { 17213 exports2.dictionary = data.init(); 17214 }; 17215 exports2.offsetsByLength = new Uint32Array([ 17216 0, 17217 0, 17218 0, 17219 0, 17220 0, 17221 4096, 17222 9216, 17223 21504, 17224 35840, 17225 44032, 17226 53248, 17227 63488, 17228 74752, 17229 87040, 17230 93696, 17231 100864, 17232 104704, 17233 106752, 17234 108928, 17235 113536, 17236 115968, 17237 118528, 17238 119872, 17239 121280, 17240 122016 17241 ]); 17242 exports2.sizeBitsByLength = new Uint8Array([ 17243 0, 17244 0, 17245 0, 17246 0, 17247 10, 17248 10, 17249 11, 17250 11, 17251 10, 17252 10, 17253 10, 17254 10, 17255 10, 17256 9, 17257 9, 17258 8, 17259 7, 17260 7, 17261 8, 17262 7, 17263 7, 17264 6, 17265 6, 17266 5, 17267 5 17268 ]); 17269 exports2.minDictionaryWordLength = 4; 17270 exports2.maxDictionaryWordLength = 24; 17271 }, 17272 { "./dictionary-browser": 4 } 17273 ], 17274 7: [ 17275 function(require2, module2, exports2) { 17276 function HuffmanCode(bits, value) { 17277 this.bits = bits; 17278 this.value = value; 17279 } 17280 exports2.HuffmanCode = HuffmanCode; 17281 var MAX_LENGTH = 15; 17282 function GetNextKey(key, len) { 17283 var step = 1 << len - 1; 17284 while (key & step) { 17285 step >>= 1; 17286 } 17287 return (key & step - 1) + step; 17288 } 17289 function ReplicateValue(table, i2, step, end, code) { 17290 do { 17291 end -= step; 17292 table[i2 + end] = new HuffmanCode( 17293 code.bits, 17294 code.value 17295 ); 17296 } while (end > 0); 17297 } 17298 function NextTableBitSize(count, len, root_bits) { 17299 var left = 1 << len - root_bits; 17300 while (len < MAX_LENGTH) { 17301 left -= count[len]; 17302 if (left <= 0) break; 17303 ++len; 17304 left <<= 1; 17305 } 17306 return len - root_bits; 17307 } 17308 exports2.BrotliBuildHuffmanTable = function(root_table, table, root_bits, code_lengths, code_lengths_size) { 17309 var start_table = table; 17310 var code; 17311 var len; 17312 var symbol; 17313 var key; 17314 var step; 17315 var low; 17316 var mask; 17317 var table_bits; 17318 var table_size; 17319 var total_size; 17320 var sorted; 17321 var count = new Int32Array( 17322 MAX_LENGTH + 1 17323 ); 17324 var offset4 = new Int32Array( 17325 MAX_LENGTH + 1 17326 ); 17327 sorted = new Int32Array(code_lengths_size); 17328 for (symbol = 0; symbol < code_lengths_size; symbol++) { 17329 count[code_lengths[symbol]]++; 17330 } 17331 offset4[1] = 0; 17332 for (len = 1; len < MAX_LENGTH; len++) { 17333 offset4[len + 1] = offset4[len] + count[len]; 17334 } 17335 for (symbol = 0; symbol < code_lengths_size; symbol++) { 17336 if (code_lengths[symbol] !== 0) { 17337 sorted[offset4[code_lengths[symbol]]++] = symbol; 17338 } 17339 } 17340 table_bits = root_bits; 17341 table_size = 1 << table_bits; 17342 total_size = table_size; 17343 if (offset4[MAX_LENGTH] === 1) { 17344 for (key = 0; key < total_size; ++key) { 17345 root_table[table + key] = new HuffmanCode( 17346 0, 17347 sorted[0] & 65535 17348 ); 17349 } 17350 return total_size; 17351 } 17352 key = 0; 17353 symbol = 0; 17354 for (len = 1, step = 2; len <= root_bits; ++len, step <<= 1) { 17355 for (; count[len] > 0; --count[len]) { 17356 code = new HuffmanCode( 17357 len & 255, 17358 sorted[symbol++] & 65535 17359 ); 17360 ReplicateValue( 17361 root_table, 17362 table + key, 17363 step, 17364 table_size, 17365 code 17366 ); 17367 key = GetNextKey(key, len); 17368 } 17369 } 17370 mask = total_size - 1; 17371 low = -1; 17372 for (len = root_bits + 1, step = 2; len <= MAX_LENGTH; ++len, step <<= 1) { 17373 for (; count[len] > 0; --count[len]) { 17374 if ((key & mask) !== low) { 17375 table += table_size; 17376 table_bits = NextTableBitSize( 17377 count, 17378 len, 17379 root_bits 17380 ); 17381 table_size = 1 << table_bits; 17382 total_size += table_size; 17383 low = key & mask; 17384 root_table[start_table + low] = new HuffmanCode( 17385 table_bits + root_bits & 255, 17386 table - start_table - low & 65535 17387 ); 17388 } 17389 code = new HuffmanCode( 17390 len - root_bits & 255, 17391 sorted[symbol++] & 65535 17392 ); 17393 ReplicateValue( 17394 root_table, 17395 table + (key >> root_bits), 17396 step, 17397 table_size, 17398 code 17399 ); 17400 key = GetNextKey(key, len); 17401 } 17402 } 17403 return total_size; 17404 }; 17405 }, 17406 {} 17407 ], 17408 8: [ 17409 function(require2, module2, exports2) { 17410 "use strict"; 17411 exports2.byteLength = byteLength; 17412 exports2.toByteArray = toByteArray; 17413 exports2.fromByteArray = fromByteArray; 17414 var lookup = []; 17415 var revLookup = []; 17416 var Arr = typeof Uint8Array !== "undefined" ? Uint8Array : Array; 17417 var code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; 17418 for (var i2 = 0, len = code.length; i2 < len; ++i2) { 17419 lookup[i2] = code[i2]; 17420 revLookup[code.charCodeAt(i2)] = i2; 17421 } 17422 revLookup["-".charCodeAt(0)] = 62; 17423 revLookup["_".charCodeAt(0)] = 63; 17424 function getLens(b64) { 17425 var len2 = b64.length; 17426 if (len2 % 4 > 0) { 17427 throw new Error( 17428 "Invalid string. Length must be a multiple of 4" 17429 ); 17430 } 17431 var validLen = b64.indexOf("="); 17432 if (validLen === -1) validLen = len2; 17433 var placeHoldersLen = validLen === len2 ? 0 : 4 - validLen % 4; 17434 return [validLen, placeHoldersLen]; 17435 } 17436 function byteLength(b64) { 17437 var lens = getLens(b64); 17438 var validLen = lens[0]; 17439 var placeHoldersLen = lens[1]; 17440 return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen; 17441 } 17442 function _byteLength(b64, validLen, placeHoldersLen) { 17443 return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen; 17444 } 17445 function toByteArray(b64) { 17446 var tmp; 17447 var lens = getLens(b64); 17448 var validLen = lens[0]; 17449 var placeHoldersLen = lens[1]; 17450 var arr = new Arr( 17451 _byteLength(b64, validLen, placeHoldersLen) 17452 ); 17453 var curByte = 0; 17454 var len2 = placeHoldersLen > 0 ? validLen - 4 : validLen; 17455 for (var i22 = 0; i22 < len2; i22 += 4) { 17456 tmp = revLookup[b64.charCodeAt(i22)] << 18 | revLookup[b64.charCodeAt(i22 + 1)] << 12 | revLookup[b64.charCodeAt(i22 + 2)] << 6 | revLookup[b64.charCodeAt(i22 + 3)]; 17457 arr[curByte++] = tmp >> 16 & 255; 17458 arr[curByte++] = tmp >> 8 & 255; 17459 arr[curByte++] = tmp & 255; 17460 } 17461 if (placeHoldersLen === 2) { 17462 tmp = revLookup[b64.charCodeAt(i22)] << 2 | revLookup[b64.charCodeAt(i22 + 1)] >> 4; 17463 arr[curByte++] = tmp & 255; 17464 } 17465 if (placeHoldersLen === 1) { 17466 tmp = revLookup[b64.charCodeAt(i22)] << 10 | revLookup[b64.charCodeAt(i22 + 1)] << 4 | revLookup[b64.charCodeAt(i22 + 2)] >> 2; 17467 arr[curByte++] = tmp >> 8 & 255; 17468 arr[curByte++] = tmp & 255; 17469 } 17470 return arr; 17471 } 17472 function tripletToBase64(num) { 17473 return lookup[num >> 18 & 63] + lookup[num >> 12 & 63] + lookup[num >> 6 & 63] + lookup[num & 63]; 17474 } 17475 function encodeChunk(uint8, start, end) { 17476 var tmp; 17477 var output = []; 17478 for (var i22 = start; i22 < end; i22 += 3) { 17479 tmp = (uint8[i22] << 16 & 16711680) + (uint8[i22 + 1] << 8 & 65280) + (uint8[i22 + 2] & 255); 17480 output.push(tripletToBase64(tmp)); 17481 } 17482 return output.join(""); 17483 } 17484 function fromByteArray(uint8) { 17485 var tmp; 17486 var len2 = uint8.length; 17487 var extraBytes = len2 % 3; 17488 var parts = []; 17489 var maxChunkLength = 16383; 17490 for (var i22 = 0, len22 = len2 - extraBytes; i22 < len22; i22 += maxChunkLength) { 17491 parts.push( 17492 encodeChunk( 17493 uint8, 17494 i22, 17495 i22 + maxChunkLength > len22 ? len22 : i22 + maxChunkLength 17496 ) 17497 ); 17498 } 17499 if (extraBytes === 1) { 17500 tmp = uint8[len2 - 1]; 17501 parts.push( 17502 lookup[tmp >> 2] + lookup[tmp << 4 & 63] + "==" 17503 ); 17504 } else if (extraBytes === 2) { 17505 tmp = (uint8[len2 - 2] << 8) + uint8[len2 - 1]; 17506 parts.push( 17507 lookup[tmp >> 10] + lookup[tmp >> 4 & 63] + lookup[tmp << 2 & 63] + "=" 17508 ); 17509 } 17510 return parts.join(""); 17511 } 17512 }, 17513 {} 17514 ], 17515 9: [ 17516 function(require2, module2, exports2) { 17517 function PrefixCodeRange(offset4, nbits) { 17518 this.offset = offset4; 17519 this.nbits = nbits; 17520 } 17521 exports2.kBlockLengthPrefixCode = [ 17522 new PrefixCodeRange(1, 2), 17523 new PrefixCodeRange(5, 2), 17524 new PrefixCodeRange(9, 2), 17525 new PrefixCodeRange(13, 2), 17526 new PrefixCodeRange(17, 3), 17527 new PrefixCodeRange(25, 3), 17528 new PrefixCodeRange(33, 3), 17529 new PrefixCodeRange(41, 3), 17530 new PrefixCodeRange(49, 4), 17531 new PrefixCodeRange(65, 4), 17532 new PrefixCodeRange(81, 4), 17533 new PrefixCodeRange(97, 4), 17534 new PrefixCodeRange(113, 5), 17535 new PrefixCodeRange(145, 5), 17536 new PrefixCodeRange(177, 5), 17537 new PrefixCodeRange(209, 5), 17538 new PrefixCodeRange(241, 6), 17539 new PrefixCodeRange(305, 6), 17540 new PrefixCodeRange(369, 7), 17541 new PrefixCodeRange(497, 8), 17542 new PrefixCodeRange(753, 9), 17543 new PrefixCodeRange(1265, 10), 17544 new PrefixCodeRange(2289, 11), 17545 new PrefixCodeRange(4337, 12), 17546 new PrefixCodeRange(8433, 13), 17547 new PrefixCodeRange(16625, 24) 17548 ]; 17549 exports2.kInsertLengthPrefixCode = [ 17550 new PrefixCodeRange(0, 0), 17551 new PrefixCodeRange(1, 0), 17552 new PrefixCodeRange(2, 0), 17553 new PrefixCodeRange(3, 0), 17554 new PrefixCodeRange(4, 0), 17555 new PrefixCodeRange(5, 0), 17556 new PrefixCodeRange(6, 1), 17557 new PrefixCodeRange(8, 1), 17558 new PrefixCodeRange(10, 2), 17559 new PrefixCodeRange(14, 2), 17560 new PrefixCodeRange(18, 3), 17561 new PrefixCodeRange(26, 3), 17562 new PrefixCodeRange(34, 4), 17563 new PrefixCodeRange(50, 4), 17564 new PrefixCodeRange(66, 5), 17565 new PrefixCodeRange(98, 5), 17566 new PrefixCodeRange(130, 6), 17567 new PrefixCodeRange(194, 7), 17568 new PrefixCodeRange(322, 8), 17569 new PrefixCodeRange(578, 9), 17570 new PrefixCodeRange(1090, 10), 17571 new PrefixCodeRange(2114, 12), 17572 new PrefixCodeRange(6210, 14), 17573 new PrefixCodeRange(22594, 24) 17574 ]; 17575 exports2.kCopyLengthPrefixCode = [ 17576 new PrefixCodeRange(2, 0), 17577 new PrefixCodeRange(3, 0), 17578 new PrefixCodeRange(4, 0), 17579 new PrefixCodeRange(5, 0), 17580 new PrefixCodeRange(6, 0), 17581 new PrefixCodeRange(7, 0), 17582 new PrefixCodeRange(8, 0), 17583 new PrefixCodeRange(9, 0), 17584 new PrefixCodeRange(10, 1), 17585 new PrefixCodeRange(12, 1), 17586 new PrefixCodeRange(14, 2), 17587 new PrefixCodeRange(18, 2), 17588 new PrefixCodeRange(22, 3), 17589 new PrefixCodeRange(30, 3), 17590 new PrefixCodeRange(38, 4), 17591 new PrefixCodeRange(54, 4), 17592 new PrefixCodeRange(70, 5), 17593 new PrefixCodeRange(102, 5), 17594 new PrefixCodeRange(134, 6), 17595 new PrefixCodeRange(198, 7), 17596 new PrefixCodeRange(326, 8), 17597 new PrefixCodeRange(582, 9), 17598 new PrefixCodeRange(1094, 10), 17599 new PrefixCodeRange(2118, 24) 17600 ]; 17601 exports2.kInsertRangeLut = [0, 0, 8, 8, 0, 16, 8, 16, 16]; 17602 exports2.kCopyRangeLut = [0, 8, 0, 8, 16, 0, 16, 8, 16]; 17603 }, 17604 {} 17605 ], 17606 10: [ 17607 function(require2, module2, exports2) { 17608 function BrotliInput(buffer) { 17609 this.buffer = buffer; 17610 this.pos = 0; 17611 } 17612 BrotliInput.prototype.read = function(buf, i2, count) { 17613 if (this.pos + count > this.buffer.length) { 17614 count = this.buffer.length - this.pos; 17615 } 17616 for (var p3 = 0; p3 < count; p3++) 17617 buf[i2 + p3] = this.buffer[this.pos + p3]; 17618 this.pos += count; 17619 return count; 17620 }; 17621 exports2.BrotliInput = BrotliInput; 17622 function BrotliOutput(buf) { 17623 this.buffer = buf; 17624 this.pos = 0; 17625 } 17626 BrotliOutput.prototype.write = function(buf, count) { 17627 if (this.pos + count > this.buffer.length) 17628 throw new Error( 17629 "Output buffer is not large enough" 17630 ); 17631 this.buffer.set(buf.subarray(0, count), this.pos); 17632 this.pos += count; 17633 return count; 17634 }; 17635 exports2.BrotliOutput = BrotliOutput; 17636 }, 17637 {} 17638 ], 17639 11: [ 17640 function(require2, module2, exports2) { 17641 var BrotliDictionary = require2("./dictionary"); 17642 var kIdentity = 0; 17643 var kOmitLast1 = 1; 17644 var kOmitLast2 = 2; 17645 var kOmitLast3 = 3; 17646 var kOmitLast4 = 4; 17647 var kOmitLast5 = 5; 17648 var kOmitLast6 = 6; 17649 var kOmitLast7 = 7; 17650 var kOmitLast8 = 8; 17651 var kOmitLast9 = 9; 17652 var kUppercaseFirst = 10; 17653 var kUppercaseAll = 11; 17654 var kOmitFirst1 = 12; 17655 var kOmitFirst2 = 13; 17656 var kOmitFirst3 = 14; 17657 var kOmitFirst4 = 15; 17658 var kOmitFirst5 = 16; 17659 var kOmitFirst6 = 17; 17660 var kOmitFirst7 = 18; 17661 var kOmitFirst8 = 19; 17662 var kOmitFirst9 = 20; 17663 function Transform(prefix, transform, suffix) { 17664 this.prefix = new Uint8Array(prefix.length); 17665 this.transform = transform; 17666 this.suffix = new Uint8Array(suffix.length); 17667 for (var i2 = 0; i2 < prefix.length; i2++) 17668 this.prefix[i2] = prefix.charCodeAt(i2); 17669 for (var i2 = 0; i2 < suffix.length; i2++) 17670 this.suffix[i2] = suffix.charCodeAt(i2); 17671 } 17672 var kTransforms = [ 17673 new Transform("", kIdentity, ""), 17674 new Transform("", kIdentity, " "), 17675 new Transform(" ", kIdentity, " "), 17676 new Transform("", kOmitFirst1, ""), 17677 new Transform("", kUppercaseFirst, " "), 17678 new Transform("", kIdentity, " the "), 17679 new Transform(" ", kIdentity, ""), 17680 new Transform("s ", kIdentity, " "), 17681 new Transform("", kIdentity, " of "), 17682 new Transform("", kUppercaseFirst, ""), 17683 new Transform("", kIdentity, " and "), 17684 new Transform("", kOmitFirst2, ""), 17685 new Transform("", kOmitLast1, ""), 17686 new Transform(", ", kIdentity, " "), 17687 new Transform("", kIdentity, ", "), 17688 new Transform(" ", kUppercaseFirst, " "), 17689 new Transform("", kIdentity, " in "), 17690 new Transform("", kIdentity, " to "), 17691 new Transform("e ", kIdentity, " "), 17692 new Transform("", kIdentity, '"'), 17693 new Transform("", kIdentity, "."), 17694 new Transform("", kIdentity, '">'), 17695 new Transform("", kIdentity, "\n"), 17696 new Transform("", kOmitLast3, ""), 17697 new Transform("", kIdentity, "]"), 17698 new Transform("", kIdentity, " for "), 17699 new Transform("", kOmitFirst3, ""), 17700 new Transform("", kOmitLast2, ""), 17701 new Transform("", kIdentity, " a "), 17702 new Transform("", kIdentity, " that "), 17703 new Transform(" ", kUppercaseFirst, ""), 17704 new Transform("", kIdentity, ". "), 17705 new Transform(".", kIdentity, ""), 17706 new Transform(" ", kIdentity, ", "), 17707 new Transform("", kOmitFirst4, ""), 17708 new Transform("", kIdentity, " with "), 17709 new Transform("", kIdentity, "'"), 17710 new Transform("", kIdentity, " from "), 17711 new Transform("", kIdentity, " by "), 17712 new Transform("", kOmitFirst5, ""), 17713 new Transform("", kOmitFirst6, ""), 17714 new Transform(" the ", kIdentity, ""), 17715 new Transform("", kOmitLast4, ""), 17716 new Transform("", kIdentity, ". The "), 17717 new Transform("", kUppercaseAll, ""), 17718 new Transform("", kIdentity, " on "), 17719 new Transform("", kIdentity, " as "), 17720 new Transform("", kIdentity, " is "), 17721 new Transform("", kOmitLast7, ""), 17722 new Transform("", kOmitLast1, "ing "), 17723 new Transform("", kIdentity, "\n "), 17724 new Transform("", kIdentity, ":"), 17725 new Transform(" ", kIdentity, ". "), 17726 new Transform("", kIdentity, "ed "), 17727 new Transform("", kOmitFirst9, ""), 17728 new Transform("", kOmitFirst7, ""), 17729 new Transform("", kOmitLast6, ""), 17730 new Transform("", kIdentity, "("), 17731 new Transform("", kUppercaseFirst, ", "), 17732 new Transform("", kOmitLast8, ""), 17733 new Transform("", kIdentity, " at "), 17734 new Transform("", kIdentity, "ly "), 17735 new Transform(" the ", kIdentity, " of "), 17736 new Transform("", kOmitLast5, ""), 17737 new Transform("", kOmitLast9, ""), 17738 new Transform(" ", kUppercaseFirst, ", "), 17739 new Transform("", kUppercaseFirst, '"'), 17740 new Transform(".", kIdentity, "("), 17741 new Transform("", kUppercaseAll, " "), 17742 new Transform("", kUppercaseFirst, '">'), 17743 new Transform("", kIdentity, '="'), 17744 new Transform(" ", kIdentity, "."), 17745 new Transform(".com/", kIdentity, ""), 17746 new Transform(" the ", kIdentity, " of the "), 17747 new Transform("", kUppercaseFirst, "'"), 17748 new Transform("", kIdentity, ". This "), 17749 new Transform("", kIdentity, ","), 17750 new Transform(".", kIdentity, " "), 17751 new Transform("", kUppercaseFirst, "("), 17752 new Transform("", kUppercaseFirst, "."), 17753 new Transform("", kIdentity, " not "), 17754 new Transform(" ", kIdentity, '="'), 17755 new Transform("", kIdentity, "er "), 17756 new Transform(" ", kUppercaseAll, " "), 17757 new Transform("", kIdentity, "al "), 17758 new Transform(" ", kUppercaseAll, ""), 17759 new Transform("", kIdentity, "='"), 17760 new Transform("", kUppercaseAll, '"'), 17761 new Transform("", kUppercaseFirst, ". "), 17762 new Transform(" ", kIdentity, "("), 17763 new Transform("", kIdentity, "ful "), 17764 new Transform(" ", kUppercaseFirst, ". "), 17765 new Transform("", kIdentity, "ive "), 17766 new Transform("", kIdentity, "less "), 17767 new Transform("", kUppercaseAll, "'"), 17768 new Transform("", kIdentity, "est "), 17769 new Transform(" ", kUppercaseFirst, "."), 17770 new Transform("", kUppercaseAll, '">'), 17771 new Transform(" ", kIdentity, "='"), 17772 new Transform("", kUppercaseFirst, ","), 17773 new Transform("", kIdentity, "ize "), 17774 new Transform("", kUppercaseAll, "."), 17775 new Transform("\xC2\xA0", kIdentity, ""), 17776 new Transform(" ", kIdentity, ","), 17777 new Transform("", kUppercaseFirst, '="'), 17778 new Transform("", kUppercaseAll, '="'), 17779 new Transform("", kIdentity, "ous "), 17780 new Transform("", kUppercaseAll, ", "), 17781 new Transform("", kUppercaseFirst, "='"), 17782 new Transform(" ", kUppercaseFirst, ","), 17783 new Transform(" ", kUppercaseAll, '="'), 17784 new Transform(" ", kUppercaseAll, ", "), 17785 new Transform("", kUppercaseAll, ","), 17786 new Transform("", kUppercaseAll, "("), 17787 new Transform("", kUppercaseAll, ". "), 17788 new Transform(" ", kUppercaseAll, "."), 17789 new Transform("", kUppercaseAll, "='"), 17790 new Transform(" ", kUppercaseAll, ". "), 17791 new Transform(" ", kUppercaseFirst, '="'), 17792 new Transform(" ", kUppercaseAll, "='"), 17793 new Transform(" ", kUppercaseFirst, "='") 17794 ]; 17795 exports2.kTransforms = kTransforms; 17796 exports2.kNumTransforms = kTransforms.length; 17797 function ToUpperCase(p3, i2) { 17798 if (p3[i2] < 192) { 17799 if (p3[i2] >= 97 && p3[i2] <= 122) { 17800 p3[i2] ^= 32; 17801 } 17802 return 1; 17803 } 17804 if (p3[i2] < 224) { 17805 p3[i2 + 1] ^= 32; 17806 return 2; 17807 } 17808 p3[i2 + 2] ^= 5; 17809 return 3; 17810 } 17811 exports2.transformDictionaryWord = function(dst, idx, word, len, transform) { 17812 var prefix = kTransforms[transform].prefix; 17813 var suffix = kTransforms[transform].suffix; 17814 var t3 = kTransforms[transform].transform; 17815 var skip = t3 < kOmitFirst1 ? 0 : t3 - (kOmitFirst1 - 1); 17816 var i2 = 0; 17817 var start_idx = idx; 17818 var uppercase; 17819 if (skip > len) { 17820 skip = len; 17821 } 17822 var prefix_pos = 0; 17823 while (prefix_pos < prefix.length) { 17824 dst[idx++] = prefix[prefix_pos++]; 17825 } 17826 word += skip; 17827 len -= skip; 17828 if (t3 <= kOmitLast9) { 17829 len -= t3; 17830 } 17831 for (i2 = 0; i2 < len; i2++) { 17832 dst[idx++] = BrotliDictionary.dictionary[word + i2]; 17833 } 17834 uppercase = idx - len; 17835 if (t3 === kUppercaseFirst) { 17836 ToUpperCase(dst, uppercase); 17837 } else if (t3 === kUppercaseAll) { 17838 while (len > 0) { 17839 var step = ToUpperCase(dst, uppercase); 17840 uppercase += step; 17841 len -= step; 17842 } 17843 } 17844 var suffix_pos = 0; 17845 while (suffix_pos < suffix.length) { 17846 dst[idx++] = suffix[suffix_pos++]; 17847 } 17848 return idx - start_idx; 17849 }; 17850 }, 17851 { "./dictionary": 6 } 17852 ], 17853 12: [ 17854 function(require2, module2, exports2) { 17855 module2.exports = require2("./dec/decode").BrotliDecompressBuffer; 17856 }, 17857 { "./dec/decode": 3 } 17858 ] 17859 }, 17860 {}, 17861 [12] 17862 )(12); 17863 })(); 17864 17865 // packages/global-styles-ui/build-module/font-library/lib/inflate.mjs 17866 var __require3 = /* @__PURE__ */ ((x2) => typeof __require !== "undefined" ? __require : typeof Proxy !== "undefined" ? new Proxy(x2, { 17867 get: (a2, b2) => (typeof __require !== "undefined" ? __require : a2)[b2] 17868 }) : x2)(function(x2) { 17869 if (typeof __require !== "undefined") return __require.apply(this, arguments); 17870 throw Error('Dynamic require of "' + x2 + '" is not supported'); 17871 }); 17872 var inflate_default = (function() { 17873 var define, module, exports; 17874 return (/* @__PURE__ */ (function() { 17875 function r3(e2, n2, t3) { 17876 function o3(i22, f2) { 17877 if (!n2[i22]) { 17878 if (!e2[i22]) { 17879 var c2 = "function" == typeof __require3 && __require3; 17880 if (!f2 && c2) return c2(i22, true); 17881 if (u2) return u2(i22, true); 17882 var a2 = new Error("Cannot find module '" + i22 + "'"); 17883 throw a2.code = "MODULE_NOT_FOUND", a2; 17884 } 17885 var p3 = n2[i22] = { exports: {} }; 17886 e2[i22][0].call( 17887 p3.exports, 17888 function(r22) { 17889 var n22 = e2[i22][1][r22]; 17890 return o3(n22 || r22); 17891 }, 17892 p3, 17893 p3.exports, 17894 r3, 17895 e2, 17896 n2, 17897 t3 17898 ); 17899 } 17900 return n2[i22].exports; 17901 } 17902 for (var u2 = "function" == typeof __require3 && __require3, i2 = 0; i2 < t3.length; i2++) 17903 o3(t3[i2]); 17904 return o3; 17905 } 17906 return r3; 17907 })())( 17908 { 17909 1: [ 17910 function(require2, module2, exports2) { 17911 "use strict"; 17912 var TYPED_OK = typeof Uint8Array !== "undefined" && typeof Uint16Array !== "undefined" && typeof Int32Array !== "undefined"; 17913 function _has(obj, key) { 17914 return Object.prototype.hasOwnProperty.call(obj, key); 17915 } 17916 exports2.assign = function(obj) { 17917 var sources = Array.prototype.slice.call( 17918 arguments, 17919 1 17920 ); 17921 while (sources.length) { 17922 var source = sources.shift(); 17923 if (!source) { 17924 continue; 17925 } 17926 if (typeof source !== "object") { 17927 throw new TypeError( 17928 source + "must be non-object" 17929 ); 17930 } 17931 for (var p3 in source) { 17932 if (_has(source, p3)) { 17933 obj[p3] = source[p3]; 17934 } 17935 } 17936 } 17937 return obj; 17938 }; 17939 exports2.shrinkBuf = function(buf, size4) { 17940 if (buf.length === size4) { 17941 return buf; 17942 } 17943 if (buf.subarray) { 17944 return buf.subarray(0, size4); 17945 } 17946 buf.length = size4; 17947 return buf; 17948 }; 17949 var fnTyped = { 17950 arraySet: function(dest, src, src_offs, len, dest_offs) { 17951 if (src.subarray && dest.subarray) { 17952 dest.set( 17953 src.subarray(src_offs, src_offs + len), 17954 dest_offs 17955 ); 17956 return; 17957 } 17958 for (var i2 = 0; i2 < len; i2++) { 17959 dest[dest_offs + i2] = src[src_offs + i2]; 17960 } 17961 }, 17962 // Join array of chunks to single array. 17963 flattenChunks: function(chunks) { 17964 var i2, l2, len, pos, chunk, result; 17965 len = 0; 17966 for (i2 = 0, l2 = chunks.length; i2 < l2; i2++) { 17967 len += chunks[i2].length; 17968 } 17969 result = new Uint8Array(len); 17970 pos = 0; 17971 for (i2 = 0, l2 = chunks.length; i2 < l2; i2++) { 17972 chunk = chunks[i2]; 17973 result.set(chunk, pos); 17974 pos += chunk.length; 17975 } 17976 return result; 17977 } 17978 }; 17979 var fnUntyped = { 17980 arraySet: function(dest, src, src_offs, len, dest_offs) { 17981 for (var i2 = 0; i2 < len; i2++) { 17982 dest[dest_offs + i2] = src[src_offs + i2]; 17983 } 17984 }, 17985 // Join array of chunks to single array. 17986 flattenChunks: function(chunks) { 17987 return [].concat.apply([], chunks); 17988 } 17989 }; 17990 exports2.setTyped = function(on) { 17991 if (on) { 17992 exports2.Buf8 = Uint8Array; 17993 exports2.Buf16 = Uint16Array; 17994 exports2.Buf32 = Int32Array; 17995 exports2.assign(exports2, fnTyped); 17996 } else { 17997 exports2.Buf8 = Array; 17998 exports2.Buf16 = Array; 17999 exports2.Buf32 = Array; 18000 exports2.assign(exports2, fnUntyped); 18001 } 18002 }; 18003 exports2.setTyped(TYPED_OK); 18004 }, 18005 {} 18006 ], 18007 2: [ 18008 function(require2, module2, exports2) { 18009 "use strict"; 18010 var utils = require2("./common"); 18011 var STR_APPLY_OK = true; 18012 var STR_APPLY_UIA_OK = true; 18013 try { 18014 String.fromCharCode.apply(null, [0]); 18015 } catch (__43) { 18016 STR_APPLY_OK = false; 18017 } 18018 try { 18019 String.fromCharCode.apply(null, new Uint8Array(1)); 18020 } catch (__43) { 18021 STR_APPLY_UIA_OK = false; 18022 } 18023 var _utf8len = new utils.Buf8(256); 18024 for (var q = 0; q < 256; q++) { 18025 _utf8len[q] = q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1; 18026 } 18027 _utf8len[254] = _utf8len[254] = 1; 18028 exports2.string2buf = function(str) { 18029 var buf, c2, c22, m_pos, i2, str_len = str.length, buf_len = 0; 18030 for (m_pos = 0; m_pos < str_len; m_pos++) { 18031 c2 = str.charCodeAt(m_pos); 18032 if ((c2 & 64512) === 55296 && m_pos + 1 < str_len) { 18033 c22 = str.charCodeAt(m_pos + 1); 18034 if ((c22 & 64512) === 56320) { 18035 c2 = 65536 + (c2 - 55296 << 10) + (c22 - 56320); 18036 m_pos++; 18037 } 18038 } 18039 buf_len += c2 < 128 ? 1 : c2 < 2048 ? 2 : c2 < 65536 ? 3 : 4; 18040 } 18041 buf = new utils.Buf8(buf_len); 18042 for (i2 = 0, m_pos = 0; i2 < buf_len; m_pos++) { 18043 c2 = str.charCodeAt(m_pos); 18044 if ((c2 & 64512) === 55296 && m_pos + 1 < str_len) { 18045 c22 = str.charCodeAt(m_pos + 1); 18046 if ((c22 & 64512) === 56320) { 18047 c2 = 65536 + (c2 - 55296 << 10) + (c22 - 56320); 18048 m_pos++; 18049 } 18050 } 18051 if (c2 < 128) { 18052 buf[i2++] = c2; 18053 } else if (c2 < 2048) { 18054 buf[i2++] = 192 | c2 >>> 6; 18055 buf[i2++] = 128 | c2 & 63; 18056 } else if (c2 < 65536) { 18057 buf[i2++] = 224 | c2 >>> 12; 18058 buf[i2++] = 128 | c2 >>> 6 & 63; 18059 buf[i2++] = 128 | c2 & 63; 18060 } else { 18061 buf[i2++] = 240 | c2 >>> 18; 18062 buf[i2++] = 128 | c2 >>> 12 & 63; 18063 buf[i2++] = 128 | c2 >>> 6 & 63; 18064 buf[i2++] = 128 | c2 & 63; 18065 } 18066 } 18067 return buf; 18068 }; 18069 function buf2binstring(buf, len) { 18070 if (len < 65534) { 18071 if (buf.subarray && STR_APPLY_UIA_OK || !buf.subarray && STR_APPLY_OK) { 18072 return String.fromCharCode.apply( 18073 null, 18074 utils.shrinkBuf(buf, len) 18075 ); 18076 } 18077 } 18078 var result = ""; 18079 for (var i2 = 0; i2 < len; i2++) { 18080 result += String.fromCharCode(buf[i2]); 18081 } 18082 return result; 18083 } 18084 exports2.buf2binstring = function(buf) { 18085 return buf2binstring(buf, buf.length); 18086 }; 18087 exports2.binstring2buf = function(str) { 18088 var buf = new utils.Buf8(str.length); 18089 for (var i2 = 0, len = buf.length; i2 < len; i2++) { 18090 buf[i2] = str.charCodeAt(i2); 18091 } 18092 return buf; 18093 }; 18094 exports2.buf2string = function(buf, max2) { 18095 var i2, out, c2, c_len; 18096 var len = max2 || buf.length; 18097 var utf16buf = new Array(len * 2); 18098 for (out = 0, i2 = 0; i2 < len; ) { 18099 c2 = buf[i2++]; 18100 if (c2 < 128) { 18101 utf16buf[out++] = c2; 18102 continue; 18103 } 18104 c_len = _utf8len[c2]; 18105 if (c_len > 4) { 18106 utf16buf[out++] = 65533; 18107 i2 += c_len - 1; 18108 continue; 18109 } 18110 c2 &= c_len === 2 ? 31 : c_len === 3 ? 15 : 7; 18111 while (c_len > 1 && i2 < len) { 18112 c2 = c2 << 6 | buf[i2++] & 63; 18113 c_len--; 18114 } 18115 if (c_len > 1) { 18116 utf16buf[out++] = 65533; 18117 continue; 18118 } 18119 if (c2 < 65536) { 18120 utf16buf[out++] = c2; 18121 } else { 18122 c2 -= 65536; 18123 utf16buf[out++] = 55296 | c2 >> 10 & 1023; 18124 utf16buf[out++] = 56320 | c2 & 1023; 18125 } 18126 } 18127 return buf2binstring(utf16buf, out); 18128 }; 18129 exports2.utf8border = function(buf, max2) { 18130 var pos; 18131 max2 = max2 || buf.length; 18132 if (max2 > buf.length) { 18133 max2 = buf.length; 18134 } 18135 pos = max2 - 1; 18136 while (pos >= 0 && (buf[pos] & 192) === 128) { 18137 pos--; 18138 } 18139 if (pos < 0) { 18140 return max2; 18141 } 18142 if (pos === 0) { 18143 return max2; 18144 } 18145 return pos + _utf8len[buf[pos]] > max2 ? pos : max2; 18146 }; 18147 }, 18148 { "./common": 1 } 18149 ], 18150 3: [ 18151 function(require2, module2, exports2) { 18152 "use strict"; 18153 function adler32(adler, buf, len, pos) { 18154 var s1 = adler & 65535 | 0, s2 = adler >>> 16 & 65535 | 0, n2 = 0; 18155 while (len !== 0) { 18156 n2 = len > 2e3 ? 2e3 : len; 18157 len -= n2; 18158 do { 18159 s1 = s1 + buf[pos++] | 0; 18160 s2 = s2 + s1 | 0; 18161 } while (--n2); 18162 s1 %= 65521; 18163 s2 %= 65521; 18164 } 18165 return s1 | s2 << 16 | 0; 18166 } 18167 module2.exports = adler32; 18168 }, 18169 {} 18170 ], 18171 4: [ 18172 function(require2, module2, exports2) { 18173 "use strict"; 18174 module2.exports = { 18175 /* Allowed flush values; see deflate() and inflate() below for details */ 18176 Z_NO_FLUSH: 0, 18177 Z_PARTIAL_FLUSH: 1, 18178 Z_SYNC_FLUSH: 2, 18179 Z_FULL_FLUSH: 3, 18180 Z_FINISH: 4, 18181 Z_BLOCK: 5, 18182 Z_TREES: 6, 18183 /* Return codes for the compression/decompression functions. Negative values 18184 * are errors, positive values are used for special but normal events. 18185 */ 18186 Z_OK: 0, 18187 Z_STREAM_END: 1, 18188 Z_NEED_DICT: 2, 18189 Z_ERRNO: -1, 18190 Z_STREAM_ERROR: -2, 18191 Z_DATA_ERROR: -3, 18192 //Z_MEM_ERROR: -4, 18193 Z_BUF_ERROR: -5, 18194 //Z_VERSION_ERROR: -6, 18195 /* compression levels */ 18196 Z_NO_COMPRESSION: 0, 18197 Z_BEST_SPEED: 1, 18198 Z_BEST_COMPRESSION: 9, 18199 Z_DEFAULT_COMPRESSION: -1, 18200 Z_FILTERED: 1, 18201 Z_HUFFMAN_ONLY: 2, 18202 Z_RLE: 3, 18203 Z_FIXED: 4, 18204 Z_DEFAULT_STRATEGY: 0, 18205 /* Possible values of the data_type field (though see inflate()) */ 18206 Z_BINARY: 0, 18207 Z_TEXT: 1, 18208 //Z_ASCII: 1, // = Z_TEXT (deprecated) 18209 Z_UNKNOWN: 2, 18210 /* The deflate compression method */ 18211 Z_DEFLATED: 8 18212 //Z_NULL: null // Use -1 or null inline, depending on var type 18213 }; 18214 }, 18215 {} 18216 ], 18217 5: [ 18218 function(require2, module2, exports2) { 18219 "use strict"; 18220 function makeTable() { 18221 var c2, table = []; 18222 for (var n2 = 0; n2 < 256; n2++) { 18223 c2 = n2; 18224 for (var k2 = 0; k2 < 8; k2++) { 18225 c2 = c2 & 1 ? 3988292384 ^ c2 >>> 1 : c2 >>> 1; 18226 } 18227 table[n2] = c2; 18228 } 18229 return table; 18230 } 18231 var crcTable = makeTable(); 18232 function crc32(crc, buf, len, pos) { 18233 var t3 = crcTable, end = pos + len; 18234 crc ^= -1; 18235 for (var i2 = pos; i2 < end; i2++) { 18236 crc = crc >>> 8 ^ t3[(crc ^ buf[i2]) & 255]; 18237 } 18238 return crc ^ -1; 18239 } 18240 module2.exports = crc32; 18241 }, 18242 {} 18243 ], 18244 6: [ 18245 function(require2, module2, exports2) { 18246 "use strict"; 18247 function GZheader() { 18248 this.text = 0; 18249 this.time = 0; 18250 this.xflags = 0; 18251 this.os = 0; 18252 this.extra = null; 18253 this.extra_len = 0; 18254 this.name = ""; 18255 this.comment = ""; 18256 this.hcrc = 0; 18257 this.done = false; 18258 } 18259 module2.exports = GZheader; 18260 }, 18261 {} 18262 ], 18263 7: [ 18264 function(require2, module2, exports2) { 18265 "use strict"; 18266 var BAD = 30; 18267 var TYPE = 12; 18268 module2.exports = function inflate_fast(strm, start) { 18269 var state; 18270 var _in; 18271 var last; 18272 var _out; 18273 var beg; 18274 var end; 18275 var dmax; 18276 var wsize; 18277 var whave; 18278 var wnext; 18279 var s_window; 18280 var hold; 18281 var bits; 18282 var lcode; 18283 var dcode; 18284 var lmask; 18285 var dmask; 18286 var here; 18287 var op; 18288 var len; 18289 var dist; 18290 var from; 18291 var from_source; 18292 var input, output; 18293 state = strm.state; 18294 _in = strm.next_in; 18295 input = strm.input; 18296 last = _in + (strm.avail_in - 5); 18297 _out = strm.next_out; 18298 output = strm.output; 18299 beg = _out - (start - strm.avail_out); 18300 end = _out + (strm.avail_out - 257); 18301 dmax = state.dmax; 18302 wsize = state.wsize; 18303 whave = state.whave; 18304 wnext = state.wnext; 18305 s_window = state.window; 18306 hold = state.hold; 18307 bits = state.bits; 18308 lcode = state.lencode; 18309 dcode = state.distcode; 18310 lmask = (1 << state.lenbits) - 1; 18311 dmask = (1 << state.distbits) - 1; 18312 top: do { 18313 if (bits < 15) { 18314 hold += input[_in++] << bits; 18315 bits += 8; 18316 hold += input[_in++] << bits; 18317 bits += 8; 18318 } 18319 here = lcode[hold & lmask]; 18320 dolen: for (; ; ) { 18321 op = here >>> 24; 18322 hold >>>= op; 18323 bits -= op; 18324 op = here >>> 16 & 255; 18325 if (op === 0) { 18326 output[_out++] = here & 65535; 18327 } else if (op & 16) { 18328 len = here & 65535; 18329 op &= 15; 18330 if (op) { 18331 if (bits < op) { 18332 hold += input[_in++] << bits; 18333 bits += 8; 18334 } 18335 len += hold & (1 << op) - 1; 18336 hold >>>= op; 18337 bits -= op; 18338 } 18339 if (bits < 15) { 18340 hold += input[_in++] << bits; 18341 bits += 8; 18342 hold += input[_in++] << bits; 18343 bits += 8; 18344 } 18345 here = dcode[hold & dmask]; 18346 dodist: for (; ; ) { 18347 op = here >>> 24; 18348 hold >>>= op; 18349 bits -= op; 18350 op = here >>> 16 & 255; 18351 if (op & 16) { 18352 dist = here & 65535; 18353 op &= 15; 18354 if (bits < op) { 18355 hold += input[_in++] << bits; 18356 bits += 8; 18357 if (bits < op) { 18358 hold += input[_in++] << bits; 18359 bits += 8; 18360 } 18361 } 18362 dist += hold & (1 << op) - 1; 18363 if (dist > dmax) { 18364 strm.msg = "invalid distance too far back"; 18365 state.mode = BAD; 18366 break top; 18367 } 18368 hold >>>= op; 18369 bits -= op; 18370 op = _out - beg; 18371 if (dist > op) { 18372 op = dist - op; 18373 if (op > whave) { 18374 if (state.sane) { 18375 strm.msg = "invalid distance too far back"; 18376 state.mode = BAD; 18377 break top; 18378 } 18379 } 18380 from = 0; 18381 from_source = s_window; 18382 if (wnext === 0) { 18383 from += wsize - op; 18384 if (op < len) { 18385 len -= op; 18386 do { 18387 output[_out++] = s_window[from++]; 18388 } while (--op); 18389 from = _out - dist; 18390 from_source = output; 18391 } 18392 } else if (wnext < op) { 18393 from += wsize + wnext - op; 18394 op -= wnext; 18395 if (op < len) { 18396 len -= op; 18397 do { 18398 output[_out++] = s_window[from++]; 18399 } while (--op); 18400 from = 0; 18401 if (wnext < len) { 18402 op = wnext; 18403 len -= op; 18404 do { 18405 output[_out++] = s_window[from++]; 18406 } while (--op); 18407 from = _out - dist; 18408 from_source = output; 18409 } 18410 } 18411 } else { 18412 from += wnext - op; 18413 if (op < len) { 18414 len -= op; 18415 do { 18416 output[_out++] = s_window[from++]; 18417 } while (--op); 18418 from = _out - dist; 18419 from_source = output; 18420 } 18421 } 18422 while (len > 2) { 18423 output[_out++] = from_source[from++]; 18424 output[_out++] = from_source[from++]; 18425 output[_out++] = from_source[from++]; 18426 len -= 3; 18427 } 18428 if (len) { 18429 output[_out++] = from_source[from++]; 18430 if (len > 1) { 18431 output[_out++] = from_source[from++]; 18432 } 18433 } 18434 } else { 18435 from = _out - dist; 18436 do { 18437 output[_out++] = output[from++]; 18438 output[_out++] = output[from++]; 18439 output[_out++] = output[from++]; 18440 len -= 3; 18441 } while (len > 2); 18442 if (len) { 18443 output[_out++] = output[from++]; 18444 if (len > 1) { 18445 output[_out++] = output[from++]; 18446 } 18447 } 18448 } 18449 } else if ((op & 64) === 0) { 18450 here = dcode[(here & 65535) + (hold & (1 << op) - 1)]; 18451 continue dodist; 18452 } else { 18453 strm.msg = "invalid distance code"; 18454 state.mode = BAD; 18455 break top; 18456 } 18457 break; 18458 } 18459 } else if ((op & 64) === 0) { 18460 here = lcode[(here & 65535) + (hold & (1 << op) - 1)]; 18461 continue dolen; 18462 } else if (op & 32) { 18463 state.mode = TYPE; 18464 break top; 18465 } else { 18466 strm.msg = "invalid literal/length code"; 18467 state.mode = BAD; 18468 break top; 18469 } 18470 break; 18471 } 18472 } while (_in < last && _out < end); 18473 len = bits >> 3; 18474 _in -= len; 18475 bits -= len << 3; 18476 hold &= (1 << bits) - 1; 18477 strm.next_in = _in; 18478 strm.next_out = _out; 18479 strm.avail_in = _in < last ? 5 + (last - _in) : 5 - (_in - last); 18480 strm.avail_out = _out < end ? 257 + (end - _out) : 257 - (_out - end); 18481 state.hold = hold; 18482 state.bits = bits; 18483 return; 18484 }; 18485 }, 18486 {} 18487 ], 18488 8: [ 18489 function(require2, module2, exports2) { 18490 "use strict"; 18491 var utils = require2("../utils/common"); 18492 var adler32 = require2("./adler32"); 18493 var crc32 = require2("./crc32"); 18494 var inflate_fast = require2("./inffast"); 18495 var inflate_table = require2("./inftrees"); 18496 var CODES = 0; 18497 var LENS = 1; 18498 var DISTS = 2; 18499 var Z_FINISH = 4; 18500 var Z_BLOCK = 5; 18501 var Z_TREES = 6; 18502 var Z_OK = 0; 18503 var Z_STREAM_END = 1; 18504 var Z_NEED_DICT = 2; 18505 var Z_STREAM_ERROR = -2; 18506 var Z_DATA_ERROR = -3; 18507 var Z_MEM_ERROR = -4; 18508 var Z_BUF_ERROR = -5; 18509 var Z_DEFLATED = 8; 18510 var HEAD = 1; 18511 var FLAGS = 2; 18512 var TIME = 3; 18513 var OS = 4; 18514 var EXLEN = 5; 18515 var EXTRA = 6; 18516 var NAME = 7; 18517 var COMMENT = 8; 18518 var HCRC = 9; 18519 var DICTID = 10; 18520 var DICT = 11; 18521 var TYPE = 12; 18522 var TYPEDO = 13; 18523 var STORED = 14; 18524 var COPY_ = 15; 18525 var COPY = 16; 18526 var TABLE = 17; 18527 var LENLENS = 18; 18528 var CODELENS = 19; 18529 var LEN_ = 20; 18530 var LEN = 21; 18531 var LENEXT = 22; 18532 var DIST = 23; 18533 var DISTEXT = 24; 18534 var MATCH = 25; 18535 var LIT = 26; 18536 var CHECK = 27; 18537 var LENGTH = 28; 18538 var DONE = 29; 18539 var BAD = 30; 18540 var MEM = 31; 18541 var SYNC = 32; 18542 var ENOUGH_LENS = 852; 18543 var ENOUGH_DISTS = 592; 18544 var MAX_WBITS = 15; 18545 var DEF_WBITS = MAX_WBITS; 18546 function zswap32(q) { 18547 return (q >>> 24 & 255) + (q >>> 8 & 65280) + ((q & 65280) << 8) + ((q & 255) << 24); 18548 } 18549 function InflateState() { 18550 this.mode = 0; 18551 this.last = false; 18552 this.wrap = 0; 18553 this.havedict = false; 18554 this.flags = 0; 18555 this.dmax = 0; 18556 this.check = 0; 18557 this.total = 0; 18558 this.head = null; 18559 this.wbits = 0; 18560 this.wsize = 0; 18561 this.whave = 0; 18562 this.wnext = 0; 18563 this.window = null; 18564 this.hold = 0; 18565 this.bits = 0; 18566 this.length = 0; 18567 this.offset = 0; 18568 this.extra = 0; 18569 this.lencode = null; 18570 this.distcode = null; 18571 this.lenbits = 0; 18572 this.distbits = 0; 18573 this.ncode = 0; 18574 this.nlen = 0; 18575 this.ndist = 0; 18576 this.have = 0; 18577 this.next = null; 18578 this.lens = new utils.Buf16( 18579 320 18580 ); 18581 this.work = new utils.Buf16( 18582 288 18583 ); 18584 this.lendyn = null; 18585 this.distdyn = null; 18586 this.sane = 0; 18587 this.back = 0; 18588 this.was = 0; 18589 } 18590 function inflateResetKeep(strm) { 18591 var state; 18592 if (!strm || !strm.state) { 18593 return Z_STREAM_ERROR; 18594 } 18595 state = strm.state; 18596 strm.total_in = strm.total_out = state.total = 0; 18597 strm.msg = ""; 18598 if (state.wrap) { 18599 strm.adler = state.wrap & 1; 18600 } 18601 state.mode = HEAD; 18602 state.last = 0; 18603 state.havedict = 0; 18604 state.dmax = 32768; 18605 state.head = null; 18606 state.hold = 0; 18607 state.bits = 0; 18608 state.lencode = state.lendyn = new utils.Buf32( 18609 ENOUGH_LENS 18610 ); 18611 state.distcode = state.distdyn = new utils.Buf32( 18612 ENOUGH_DISTS 18613 ); 18614 state.sane = 1; 18615 state.back = -1; 18616 return Z_OK; 18617 } 18618 function inflateReset(strm) { 18619 var state; 18620 if (!strm || !strm.state) { 18621 return Z_STREAM_ERROR; 18622 } 18623 state = strm.state; 18624 state.wsize = 0; 18625 state.whave = 0; 18626 state.wnext = 0; 18627 return inflateResetKeep(strm); 18628 } 18629 function inflateReset2(strm, windowBits) { 18630 var wrap; 18631 var state; 18632 if (!strm || !strm.state) { 18633 return Z_STREAM_ERROR; 18634 } 18635 state = strm.state; 18636 if (windowBits < 0) { 18637 wrap = 0; 18638 windowBits = -windowBits; 18639 } else { 18640 wrap = (windowBits >> 4) + 1; 18641 if (windowBits < 48) { 18642 windowBits &= 15; 18643 } 18644 } 18645 if (windowBits && (windowBits < 8 || windowBits > 15)) { 18646 return Z_STREAM_ERROR; 18647 } 18648 if (state.window !== null && state.wbits !== windowBits) { 18649 state.window = null; 18650 } 18651 state.wrap = wrap; 18652 state.wbits = windowBits; 18653 return inflateReset(strm); 18654 } 18655 function inflateInit2(strm, windowBits) { 18656 var ret; 18657 var state; 18658 if (!strm) { 18659 return Z_STREAM_ERROR; 18660 } 18661 state = new InflateState(); 18662 strm.state = state; 18663 state.window = null; 18664 ret = inflateReset2(strm, windowBits); 18665 if (ret !== Z_OK) { 18666 strm.state = null; 18667 } 18668 return ret; 18669 } 18670 function inflateInit(strm) { 18671 return inflateInit2(strm, DEF_WBITS); 18672 } 18673 var virgin = true; 18674 var lenfix, distfix; 18675 function fixedtables(state) { 18676 if (virgin) { 18677 var sym; 18678 lenfix = new utils.Buf32(512); 18679 distfix = new utils.Buf32(32); 18680 sym = 0; 18681 while (sym < 144) { 18682 state.lens[sym++] = 8; 18683 } 18684 while (sym < 256) { 18685 state.lens[sym++] = 9; 18686 } 18687 while (sym < 280) { 18688 state.lens[sym++] = 7; 18689 } 18690 while (sym < 288) { 18691 state.lens[sym++] = 8; 18692 } 18693 inflate_table( 18694 LENS, 18695 state.lens, 18696 0, 18697 288, 18698 lenfix, 18699 0, 18700 state.work, 18701 { bits: 9 } 18702 ); 18703 sym = 0; 18704 while (sym < 32) { 18705 state.lens[sym++] = 5; 18706 } 18707 inflate_table( 18708 DISTS, 18709 state.lens, 18710 0, 18711 32, 18712 distfix, 18713 0, 18714 state.work, 18715 { bits: 5 } 18716 ); 18717 virgin = false; 18718 } 18719 state.lencode = lenfix; 18720 state.lenbits = 9; 18721 state.distcode = distfix; 18722 state.distbits = 5; 18723 } 18724 function updatewindow(strm, src, end, copy) { 18725 var dist; 18726 var state = strm.state; 18727 if (state.window === null) { 18728 state.wsize = 1 << state.wbits; 18729 state.wnext = 0; 18730 state.whave = 0; 18731 state.window = new utils.Buf8(state.wsize); 18732 } 18733 if (copy >= state.wsize) { 18734 utils.arraySet( 18735 state.window, 18736 src, 18737 end - state.wsize, 18738 state.wsize, 18739 0 18740 ); 18741 state.wnext = 0; 18742 state.whave = state.wsize; 18743 } else { 18744 dist = state.wsize - state.wnext; 18745 if (dist > copy) { 18746 dist = copy; 18747 } 18748 utils.arraySet( 18749 state.window, 18750 src, 18751 end - copy, 18752 dist, 18753 state.wnext 18754 ); 18755 copy -= dist; 18756 if (copy) { 18757 utils.arraySet( 18758 state.window, 18759 src, 18760 end - copy, 18761 copy, 18762 0 18763 ); 18764 state.wnext = copy; 18765 state.whave = state.wsize; 18766 } else { 18767 state.wnext += dist; 18768 if (state.wnext === state.wsize) { 18769 state.wnext = 0; 18770 } 18771 if (state.whave < state.wsize) { 18772 state.whave += dist; 18773 } 18774 } 18775 } 18776 return 0; 18777 } 18778 function inflate(strm, flush) { 18779 var state; 18780 var input, output; 18781 var next; 18782 var put; 18783 var have, left; 18784 var hold; 18785 var bits; 18786 var _in, _out; 18787 var copy; 18788 var from; 18789 var from_source; 18790 var here = 0; 18791 var here_bits, here_op, here_val; 18792 var last_bits, last_op, last_val; 18793 var len; 18794 var ret; 18795 var hbuf = new utils.Buf8( 18796 4 18797 ); 18798 var opts; 18799 var n2; 18800 var order = ( 18801 /* permutation of code lengths */ 18802 [ 18803 16, 18804 17, 18805 18, 18806 0, 18807 8, 18808 7, 18809 9, 18810 6, 18811 10, 18812 5, 18813 11, 18814 4, 18815 12, 18816 3, 18817 13, 18818 2, 18819 14, 18820 1, 18821 15 18822 ] 18823 ); 18824 if (!strm || !strm.state || !strm.output || !strm.input && strm.avail_in !== 0) { 18825 return Z_STREAM_ERROR; 18826 } 18827 state = strm.state; 18828 if (state.mode === TYPE) { 18829 state.mode = TYPEDO; 18830 } 18831 put = strm.next_out; 18832 output = strm.output; 18833 left = strm.avail_out; 18834 next = strm.next_in; 18835 input = strm.input; 18836 have = strm.avail_in; 18837 hold = state.hold; 18838 bits = state.bits; 18839 _in = have; 18840 _out = left; 18841 ret = Z_OK; 18842 inf_leave: for (; ; ) { 18843 switch (state.mode) { 18844 case HEAD: 18845 if (state.wrap === 0) { 18846 state.mode = TYPEDO; 18847 break; 18848 } 18849 while (bits < 16) { 18850 if (have === 0) { 18851 break inf_leave; 18852 } 18853 have--; 18854 hold += input[next++] << bits; 18855 bits += 8; 18856 } 18857 if (state.wrap & 2 && hold === 35615) { 18858 state.check = 0; 18859 hbuf[0] = hold & 255; 18860 hbuf[1] = hold >>> 8 & 255; 18861 state.check = crc32( 18862 state.check, 18863 hbuf, 18864 2, 18865 0 18866 ); 18867 hold = 0; 18868 bits = 0; 18869 state.mode = FLAGS; 18870 break; 18871 } 18872 state.flags = 0; 18873 if (state.head) { 18874 state.head.done = false; 18875 } 18876 if (!(state.wrap & 1) || (((hold & 255) << 8) + (hold >> 8)) % 31) { 18877 strm.msg = "incorrect header check"; 18878 state.mode = BAD; 18879 break; 18880 } 18881 if ((hold & 15) !== Z_DEFLATED) { 18882 strm.msg = "unknown compression method"; 18883 state.mode = BAD; 18884 break; 18885 } 18886 hold >>>= 4; 18887 bits -= 4; 18888 len = (hold & 15) + 8; 18889 if (state.wbits === 0) { 18890 state.wbits = len; 18891 } else if (len > state.wbits) { 18892 strm.msg = "invalid window size"; 18893 state.mode = BAD; 18894 break; 18895 } 18896 state.dmax = 1 << len; 18897 strm.adler = state.check = 1; 18898 state.mode = hold & 512 ? DICTID : TYPE; 18899 hold = 0; 18900 bits = 0; 18901 break; 18902 case FLAGS: 18903 while (bits < 16) { 18904 if (have === 0) { 18905 break inf_leave; 18906 } 18907 have--; 18908 hold += input[next++] << bits; 18909 bits += 8; 18910 } 18911 state.flags = hold; 18912 if ((state.flags & 255) !== Z_DEFLATED) { 18913 strm.msg = "unknown compression method"; 18914 state.mode = BAD; 18915 break; 18916 } 18917 if (state.flags & 57344) { 18918 strm.msg = "unknown header flags set"; 18919 state.mode = BAD; 18920 break; 18921 } 18922 if (state.head) { 18923 state.head.text = hold >> 8 & 1; 18924 } 18925 if (state.flags & 512) { 18926 hbuf[0] = hold & 255; 18927 hbuf[1] = hold >>> 8 & 255; 18928 state.check = crc32( 18929 state.check, 18930 hbuf, 18931 2, 18932 0 18933 ); 18934 } 18935 hold = 0; 18936 bits = 0; 18937 state.mode = TIME; 18938 /* falls through */ 18939 case TIME: 18940 while (bits < 32) { 18941 if (have === 0) { 18942 break inf_leave; 18943 } 18944 have--; 18945 hold += input[next++] << bits; 18946 bits += 8; 18947 } 18948 if (state.head) { 18949 state.head.time = hold; 18950 } 18951 if (state.flags & 512) { 18952 hbuf[0] = hold & 255; 18953 hbuf[1] = hold >>> 8 & 255; 18954 hbuf[2] = hold >>> 16 & 255; 18955 hbuf[3] = hold >>> 24 & 255; 18956 state.check = crc32( 18957 state.check, 18958 hbuf, 18959 4, 18960 0 18961 ); 18962 } 18963 hold = 0; 18964 bits = 0; 18965 state.mode = OS; 18966 /* falls through */ 18967 case OS: 18968 while (bits < 16) { 18969 if (have === 0) { 18970 break inf_leave; 18971 } 18972 have--; 18973 hold += input[next++] << bits; 18974 bits += 8; 18975 } 18976 if (state.head) { 18977 state.head.xflags = hold & 255; 18978 state.head.os = hold >> 8; 18979 } 18980 if (state.flags & 512) { 18981 hbuf[0] = hold & 255; 18982 hbuf[1] = hold >>> 8 & 255; 18983 state.check = crc32( 18984 state.check, 18985 hbuf, 18986 2, 18987 0 18988 ); 18989 } 18990 hold = 0; 18991 bits = 0; 18992 state.mode = EXLEN; 18993 /* falls through */ 18994 case EXLEN: 18995 if (state.flags & 1024) { 18996 while (bits < 16) { 18997 if (have === 0) { 18998 break inf_leave; 18999 } 19000 have--; 19001 hold += input[next++] << bits; 19002 bits += 8; 19003 } 19004 state.length = hold; 19005 if (state.head) { 19006 state.head.extra_len = hold; 19007 } 19008 if (state.flags & 512) { 19009 hbuf[0] = hold & 255; 19010 hbuf[1] = hold >>> 8 & 255; 19011 state.check = crc32( 19012 state.check, 19013 hbuf, 19014 2, 19015 0 19016 ); 19017 } 19018 hold = 0; 19019 bits = 0; 19020 } else if (state.head) { 19021 state.head.extra = null; 19022 } 19023 state.mode = EXTRA; 19024 /* falls through */ 19025 case EXTRA: 19026 if (state.flags & 1024) { 19027 copy = state.length; 19028 if (copy > have) { 19029 copy = have; 19030 } 19031 if (copy) { 19032 if (state.head) { 19033 len = state.head.extra_len - state.length; 19034 if (!state.head.extra) { 19035 state.head.extra = new Array( 19036 state.head.extra_len 19037 ); 19038 } 19039 utils.arraySet( 19040 state.head.extra, 19041 input, 19042 next, 19043 // extra field is limited to 65536 bytes 19044 // - no need for additional size check 19045 copy, 19046 /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/ 19047 len 19048 ); 19049 } 19050 if (state.flags & 512) { 19051 state.check = crc32( 19052 state.check, 19053 input, 19054 copy, 19055 next 19056 ); 19057 } 19058 have -= copy; 19059 next += copy; 19060 state.length -= copy; 19061 } 19062 if (state.length) { 19063 break inf_leave; 19064 } 19065 } 19066 state.length = 0; 19067 state.mode = NAME; 19068 /* falls through */ 19069 case NAME: 19070 if (state.flags & 2048) { 19071 if (have === 0) { 19072 break inf_leave; 19073 } 19074 copy = 0; 19075 do { 19076 len = input[next + copy++]; 19077 if (state.head && len && state.length < 65536) { 19078 state.head.name += String.fromCharCode(len); 19079 } 19080 } while (len && copy < have); 19081 if (state.flags & 512) { 19082 state.check = crc32( 19083 state.check, 19084 input, 19085 copy, 19086 next 19087 ); 19088 } 19089 have -= copy; 19090 next += copy; 19091 if (len) { 19092 break inf_leave; 19093 } 19094 } else if (state.head) { 19095 state.head.name = null; 19096 } 19097 state.length = 0; 19098 state.mode = COMMENT; 19099 /* falls through */ 19100 case COMMENT: 19101 if (state.flags & 4096) { 19102 if (have === 0) { 19103 break inf_leave; 19104 } 19105 copy = 0; 19106 do { 19107 len = input[next + copy++]; 19108 if (state.head && len && state.length < 65536) { 19109 state.head.comment += String.fromCharCode(len); 19110 } 19111 } while (len && copy < have); 19112 if (state.flags & 512) { 19113 state.check = crc32( 19114 state.check, 19115 input, 19116 copy, 19117 next 19118 ); 19119 } 19120 have -= copy; 19121 next += copy; 19122 if (len) { 19123 break inf_leave; 19124 } 19125 } else if (state.head) { 19126 state.head.comment = null; 19127 } 19128 state.mode = HCRC; 19129 /* falls through */ 19130 case HCRC: 19131 if (state.flags & 512) { 19132 while (bits < 16) { 19133 if (have === 0) { 19134 break inf_leave; 19135 } 19136 have--; 19137 hold += input[next++] << bits; 19138 bits += 8; 19139 } 19140 if (hold !== (state.check & 65535)) { 19141 strm.msg = "header crc mismatch"; 19142 state.mode = BAD; 19143 break; 19144 } 19145 hold = 0; 19146 bits = 0; 19147 } 19148 if (state.head) { 19149 state.head.hcrc = state.flags >> 9 & 1; 19150 state.head.done = true; 19151 } 19152 strm.adler = state.check = 0; 19153 state.mode = TYPE; 19154 break; 19155 case DICTID: 19156 while (bits < 32) { 19157 if (have === 0) { 19158 break inf_leave; 19159 } 19160 have--; 19161 hold += input[next++] << bits; 19162 bits += 8; 19163 } 19164 strm.adler = state.check = zswap32(hold); 19165 hold = 0; 19166 bits = 0; 19167 state.mode = DICT; 19168 /* falls through */ 19169 case DICT: 19170 if (state.havedict === 0) { 19171 strm.next_out = put; 19172 strm.avail_out = left; 19173 strm.next_in = next; 19174 strm.avail_in = have; 19175 state.hold = hold; 19176 state.bits = bits; 19177 return Z_NEED_DICT; 19178 } 19179 strm.adler = state.check = 1; 19180 state.mode = TYPE; 19181 /* falls through */ 19182 case TYPE: 19183 if (flush === Z_BLOCK || flush === Z_TREES) { 19184 break inf_leave; 19185 } 19186 /* falls through */ 19187 case TYPEDO: 19188 if (state.last) { 19189 hold >>>= bits & 7; 19190 bits -= bits & 7; 19191 state.mode = CHECK; 19192 break; 19193 } 19194 while (bits < 3) { 19195 if (have === 0) { 19196 break inf_leave; 19197 } 19198 have--; 19199 hold += input[next++] << bits; 19200 bits += 8; 19201 } 19202 state.last = hold & 1; 19203 hold >>>= 1; 19204 bits -= 1; 19205 switch (hold & 3) { 19206 case 0: 19207 state.mode = STORED; 19208 break; 19209 case 1: 19210 fixedtables(state); 19211 state.mode = LEN_; 19212 if (flush === Z_TREES) { 19213 hold >>>= 2; 19214 bits -= 2; 19215 break inf_leave; 19216 } 19217 break; 19218 case 2: 19219 state.mode = TABLE; 19220 break; 19221 case 3: 19222 strm.msg = "invalid block type"; 19223 state.mode = BAD; 19224 } 19225 hold >>>= 2; 19226 bits -= 2; 19227 break; 19228 case STORED: 19229 hold >>>= bits & 7; 19230 bits -= bits & 7; 19231 while (bits < 32) { 19232 if (have === 0) { 19233 break inf_leave; 19234 } 19235 have--; 19236 hold += input[next++] << bits; 19237 bits += 8; 19238 } 19239 if ((hold & 65535) !== (hold >>> 16 ^ 65535)) { 19240 strm.msg = "invalid stored block lengths"; 19241 state.mode = BAD; 19242 break; 19243 } 19244 state.length = hold & 65535; 19245 hold = 0; 19246 bits = 0; 19247 state.mode = COPY_; 19248 if (flush === Z_TREES) { 19249 break inf_leave; 19250 } 19251 /* falls through */ 19252 case COPY_: 19253 state.mode = COPY; 19254 /* falls through */ 19255 case COPY: 19256 copy = state.length; 19257 if (copy) { 19258 if (copy > have) { 19259 copy = have; 19260 } 19261 if (copy > left) { 19262 copy = left; 19263 } 19264 if (copy === 0) { 19265 break inf_leave; 19266 } 19267 utils.arraySet( 19268 output, 19269 input, 19270 next, 19271 copy, 19272 put 19273 ); 19274 have -= copy; 19275 next += copy; 19276 left -= copy; 19277 put += copy; 19278 state.length -= copy; 19279 break; 19280 } 19281 state.mode = TYPE; 19282 break; 19283 case TABLE: 19284 while (bits < 14) { 19285 if (have === 0) { 19286 break inf_leave; 19287 } 19288 have--; 19289 hold += input[next++] << bits; 19290 bits += 8; 19291 } 19292 state.nlen = (hold & 31) + 257; 19293 hold >>>= 5; 19294 bits -= 5; 19295 state.ndist = (hold & 31) + 1; 19296 hold >>>= 5; 19297 bits -= 5; 19298 state.ncode = (hold & 15) + 4; 19299 hold >>>= 4; 19300 bits -= 4; 19301 if (state.nlen > 286 || state.ndist > 30) { 19302 strm.msg = "too many length or distance symbols"; 19303 state.mode = BAD; 19304 break; 19305 } 19306 state.have = 0; 19307 state.mode = LENLENS; 19308 /* falls through */ 19309 case LENLENS: 19310 while (state.have < state.ncode) { 19311 while (bits < 3) { 19312 if (have === 0) { 19313 break inf_leave; 19314 } 19315 have--; 19316 hold += input[next++] << bits; 19317 bits += 8; 19318 } 19319 state.lens[order[state.have++]] = hold & 7; 19320 hold >>>= 3; 19321 bits -= 3; 19322 } 19323 while (state.have < 19) { 19324 state.lens[order[state.have++]] = 0; 19325 } 19326 state.lencode = state.lendyn; 19327 state.lenbits = 7; 19328 opts = { bits: state.lenbits }; 19329 ret = inflate_table( 19330 CODES, 19331 state.lens, 19332 0, 19333 19, 19334 state.lencode, 19335 0, 19336 state.work, 19337 opts 19338 ); 19339 state.lenbits = opts.bits; 19340 if (ret) { 19341 strm.msg = "invalid code lengths set"; 19342 state.mode = BAD; 19343 break; 19344 } 19345 state.have = 0; 19346 state.mode = CODELENS; 19347 /* falls through */ 19348 case CODELENS: 19349 while (state.have < state.nlen + state.ndist) { 19350 for (; ; ) { 19351 here = state.lencode[hold & (1 << state.lenbits) - 1]; 19352 here_bits = here >>> 24; 19353 here_op = here >>> 16 & 255; 19354 here_val = here & 65535; 19355 if (here_bits <= bits) { 19356 break; 19357 } 19358 if (have === 0) { 19359 break inf_leave; 19360 } 19361 have--; 19362 hold += input[next++] << bits; 19363 bits += 8; 19364 } 19365 if (here_val < 16) { 19366 hold >>>= here_bits; 19367 bits -= here_bits; 19368 state.lens[state.have++] = here_val; 19369 } else { 19370 if (here_val === 16) { 19371 n2 = here_bits + 2; 19372 while (bits < n2) { 19373 if (have === 0) { 19374 break inf_leave; 19375 } 19376 have--; 19377 hold += input[next++] << bits; 19378 bits += 8; 19379 } 19380 hold >>>= here_bits; 19381 bits -= here_bits; 19382 if (state.have === 0) { 19383 strm.msg = "invalid bit length repeat"; 19384 state.mode = BAD; 19385 break; 19386 } 19387 len = state.lens[state.have - 1]; 19388 copy = 3 + (hold & 3); 19389 hold >>>= 2; 19390 bits -= 2; 19391 } else if (here_val === 17) { 19392 n2 = here_bits + 3; 19393 while (bits < n2) { 19394 if (have === 0) { 19395 break inf_leave; 19396 } 19397 have--; 19398 hold += input[next++] << bits; 19399 bits += 8; 19400 } 19401 hold >>>= here_bits; 19402 bits -= here_bits; 19403 len = 0; 19404 copy = 3 + (hold & 7); 19405 hold >>>= 3; 19406 bits -= 3; 19407 } else { 19408 n2 = here_bits + 7; 19409 while (bits < n2) { 19410 if (have === 0) { 19411 break inf_leave; 19412 } 19413 have--; 19414 hold += input[next++] << bits; 19415 bits += 8; 19416 } 19417 hold >>>= here_bits; 19418 bits -= here_bits; 19419 len = 0; 19420 copy = 11 + (hold & 127); 19421 hold >>>= 7; 19422 bits -= 7; 19423 } 19424 if (state.have + copy > state.nlen + state.ndist) { 19425 strm.msg = "invalid bit length repeat"; 19426 state.mode = BAD; 19427 break; 19428 } 19429 while (copy--) { 19430 state.lens[state.have++] = len; 19431 } 19432 } 19433 } 19434 if (state.mode === BAD) { 19435 break; 19436 } 19437 if (state.lens[256] === 0) { 19438 strm.msg = "invalid code -- missing end-of-block"; 19439 state.mode = BAD; 19440 break; 19441 } 19442 state.lenbits = 9; 19443 opts = { bits: state.lenbits }; 19444 ret = inflate_table( 19445 LENS, 19446 state.lens, 19447 0, 19448 state.nlen, 19449 state.lencode, 19450 0, 19451 state.work, 19452 opts 19453 ); 19454 state.lenbits = opts.bits; 19455 if (ret) { 19456 strm.msg = "invalid literal/lengths set"; 19457 state.mode = BAD; 19458 break; 19459 } 19460 state.distbits = 6; 19461 state.distcode = state.distdyn; 19462 opts = { bits: state.distbits }; 19463 ret = inflate_table( 19464 DISTS, 19465 state.lens, 19466 state.nlen, 19467 state.ndist, 19468 state.distcode, 19469 0, 19470 state.work, 19471 opts 19472 ); 19473 state.distbits = opts.bits; 19474 if (ret) { 19475 strm.msg = "invalid distances set"; 19476 state.mode = BAD; 19477 break; 19478 } 19479 state.mode = LEN_; 19480 if (flush === Z_TREES) { 19481 break inf_leave; 19482 } 19483 /* falls through */ 19484 case LEN_: 19485 state.mode = LEN; 19486 /* falls through */ 19487 case LEN: 19488 if (have >= 6 && left >= 258) { 19489 strm.next_out = put; 19490 strm.avail_out = left; 19491 strm.next_in = next; 19492 strm.avail_in = have; 19493 state.hold = hold; 19494 state.bits = bits; 19495 inflate_fast(strm, _out); 19496 put = strm.next_out; 19497 output = strm.output; 19498 left = strm.avail_out; 19499 next = strm.next_in; 19500 input = strm.input; 19501 have = strm.avail_in; 19502 hold = state.hold; 19503 bits = state.bits; 19504 if (state.mode === TYPE) { 19505 state.back = -1; 19506 } 19507 break; 19508 } 19509 state.back = 0; 19510 for (; ; ) { 19511 here = state.lencode[hold & (1 << state.lenbits) - 1]; 19512 here_bits = here >>> 24; 19513 here_op = here >>> 16 & 255; 19514 here_val = here & 65535; 19515 if (here_bits <= bits) { 19516 break; 19517 } 19518 if (have === 0) { 19519 break inf_leave; 19520 } 19521 have--; 19522 hold += input[next++] << bits; 19523 bits += 8; 19524 } 19525 if (here_op && (here_op & 240) === 0) { 19526 last_bits = here_bits; 19527 last_op = here_op; 19528 last_val = here_val; 19529 for (; ; ) { 19530 here = state.lencode[last_val + ((hold & (1 << last_bits + last_op) - 1) >> last_bits)]; 19531 here_bits = here >>> 24; 19532 here_op = here >>> 16 & 255; 19533 here_val = here & 65535; 19534 if (last_bits + here_bits <= bits) { 19535 break; 19536 } 19537 if (have === 0) { 19538 break inf_leave; 19539 } 19540 have--; 19541 hold += input[next++] << bits; 19542 bits += 8; 19543 } 19544 hold >>>= last_bits; 19545 bits -= last_bits; 19546 state.back += last_bits; 19547 } 19548 hold >>>= here_bits; 19549 bits -= here_bits; 19550 state.back += here_bits; 19551 state.length = here_val; 19552 if (here_op === 0) { 19553 state.mode = LIT; 19554 break; 19555 } 19556 if (here_op & 32) { 19557 state.back = -1; 19558 state.mode = TYPE; 19559 break; 19560 } 19561 if (here_op & 64) { 19562 strm.msg = "invalid literal/length code"; 19563 state.mode = BAD; 19564 break; 19565 } 19566 state.extra = here_op & 15; 19567 state.mode = LENEXT; 19568 /* falls through */ 19569 case LENEXT: 19570 if (state.extra) { 19571 n2 = state.extra; 19572 while (bits < n2) { 19573 if (have === 0) { 19574 break inf_leave; 19575 } 19576 have--; 19577 hold += input[next++] << bits; 19578 bits += 8; 19579 } 19580 state.length += hold & (1 << state.extra) - 1; 19581 hold >>>= state.extra; 19582 bits -= state.extra; 19583 state.back += state.extra; 19584 } 19585 state.was = state.length; 19586 state.mode = DIST; 19587 /* falls through */ 19588 case DIST: 19589 for (; ; ) { 19590 here = state.distcode[hold & (1 << state.distbits) - 1]; 19591 here_bits = here >>> 24; 19592 here_op = here >>> 16 & 255; 19593 here_val = here & 65535; 19594 if (here_bits <= bits) { 19595 break; 19596 } 19597 if (have === 0) { 19598 break inf_leave; 19599 } 19600 have--; 19601 hold += input[next++] << bits; 19602 bits += 8; 19603 } 19604 if ((here_op & 240) === 0) { 19605 last_bits = here_bits; 19606 last_op = here_op; 19607 last_val = here_val; 19608 for (; ; ) { 19609 here = state.distcode[last_val + ((hold & (1 << last_bits + last_op) - 1) >> last_bits)]; 19610 here_bits = here >>> 24; 19611 here_op = here >>> 16 & 255; 19612 here_val = here & 65535; 19613 if (last_bits + here_bits <= bits) { 19614 break; 19615 } 19616 if (have === 0) { 19617 break inf_leave; 19618 } 19619 have--; 19620 hold += input[next++] << bits; 19621 bits += 8; 19622 } 19623 hold >>>= last_bits; 19624 bits -= last_bits; 19625 state.back += last_bits; 19626 } 19627 hold >>>= here_bits; 19628 bits -= here_bits; 19629 state.back += here_bits; 19630 if (here_op & 64) { 19631 strm.msg = "invalid distance code"; 19632 state.mode = BAD; 19633 break; 19634 } 19635 state.offset = here_val; 19636 state.extra = here_op & 15; 19637 state.mode = DISTEXT; 19638 /* falls through */ 19639 case DISTEXT: 19640 if (state.extra) { 19641 n2 = state.extra; 19642 while (bits < n2) { 19643 if (have === 0) { 19644 break inf_leave; 19645 } 19646 have--; 19647 hold += input[next++] << bits; 19648 bits += 8; 19649 } 19650 state.offset += hold & (1 << state.extra) - 1; 19651 hold >>>= state.extra; 19652 bits -= state.extra; 19653 state.back += state.extra; 19654 } 19655 if (state.offset > state.dmax) { 19656 strm.msg = "invalid distance too far back"; 19657 state.mode = BAD; 19658 break; 19659 } 19660 state.mode = MATCH; 19661 /* falls through */ 19662 case MATCH: 19663 if (left === 0) { 19664 break inf_leave; 19665 } 19666 copy = _out - left; 19667 if (state.offset > copy) { 19668 copy = state.offset - copy; 19669 if (copy > state.whave) { 19670 if (state.sane) { 19671 strm.msg = "invalid distance too far back"; 19672 state.mode = BAD; 19673 break; 19674 } 19675 } 19676 if (copy > state.wnext) { 19677 copy -= state.wnext; 19678 from = state.wsize - copy; 19679 } else { 19680 from = state.wnext - copy; 19681 } 19682 if (copy > state.length) { 19683 copy = state.length; 19684 } 19685 from_source = state.window; 19686 } else { 19687 from_source = output; 19688 from = put - state.offset; 19689 copy = state.length; 19690 } 19691 if (copy > left) { 19692 copy = left; 19693 } 19694 left -= copy; 19695 state.length -= copy; 19696 do { 19697 output[put++] = from_source[from++]; 19698 } while (--copy); 19699 if (state.length === 0) { 19700 state.mode = LEN; 19701 } 19702 break; 19703 case LIT: 19704 if (left === 0) { 19705 break inf_leave; 19706 } 19707 output[put++] = state.length; 19708 left--; 19709 state.mode = LEN; 19710 break; 19711 case CHECK: 19712 if (state.wrap) { 19713 while (bits < 32) { 19714 if (have === 0) { 19715 break inf_leave; 19716 } 19717 have--; 19718 hold |= input[next++] << bits; 19719 bits += 8; 19720 } 19721 _out -= left; 19722 strm.total_out += _out; 19723 state.total += _out; 19724 if (_out) { 19725 strm.adler = state.check = /*UPDATE(state.check, put - _out, _out);*/ 19726 state.flags ? crc32( 19727 state.check, 19728 output, 19729 _out, 19730 put - _out 19731 ) : adler32( 19732 state.check, 19733 output, 19734 _out, 19735 put - _out 19736 ); 19737 } 19738 _out = left; 19739 if ((state.flags ? hold : zswap32(hold)) !== state.check) { 19740 strm.msg = "incorrect data check"; 19741 state.mode = BAD; 19742 break; 19743 } 19744 hold = 0; 19745 bits = 0; 19746 } 19747 state.mode = LENGTH; 19748 /* falls through */ 19749 case LENGTH: 19750 if (state.wrap && state.flags) { 19751 while (bits < 32) { 19752 if (have === 0) { 19753 break inf_leave; 19754 } 19755 have--; 19756 hold += input[next++] << bits; 19757 bits += 8; 19758 } 19759 if (hold !== (state.total & 4294967295)) { 19760 strm.msg = "incorrect length check"; 19761 state.mode = BAD; 19762 break; 19763 } 19764 hold = 0; 19765 bits = 0; 19766 } 19767 state.mode = DONE; 19768 /* falls through */ 19769 case DONE: 19770 ret = Z_STREAM_END; 19771 break inf_leave; 19772 case BAD: 19773 ret = Z_DATA_ERROR; 19774 break inf_leave; 19775 case MEM: 19776 return Z_MEM_ERROR; 19777 case SYNC: 19778 /* falls through */ 19779 default: 19780 return Z_STREAM_ERROR; 19781 } 19782 } 19783 strm.next_out = put; 19784 strm.avail_out = left; 19785 strm.next_in = next; 19786 strm.avail_in = have; 19787 state.hold = hold; 19788 state.bits = bits; 19789 if (state.wsize || _out !== strm.avail_out && state.mode < BAD && (state.mode < CHECK || flush !== Z_FINISH)) { 19790 if (updatewindow( 19791 strm, 19792 strm.output, 19793 strm.next_out, 19794 _out - strm.avail_out 19795 )) { 19796 state.mode = MEM; 19797 return Z_MEM_ERROR; 19798 } 19799 } 19800 _in -= strm.avail_in; 19801 _out -= strm.avail_out; 19802 strm.total_in += _in; 19803 strm.total_out += _out; 19804 state.total += _out; 19805 if (state.wrap && _out) { 19806 strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/ 19807 state.flags ? crc32( 19808 state.check, 19809 output, 19810 _out, 19811 strm.next_out - _out 19812 ) : adler32( 19813 state.check, 19814 output, 19815 _out, 19816 strm.next_out - _out 19817 ); 19818 } 19819 strm.data_type = state.bits + (state.last ? 64 : 0) + (state.mode === TYPE ? 128 : 0) + (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0); 19820 if ((_in === 0 && _out === 0 || flush === Z_FINISH) && ret === Z_OK) { 19821 ret = Z_BUF_ERROR; 19822 } 19823 return ret; 19824 } 19825 function inflateEnd(strm) { 19826 if (!strm || !strm.state) { 19827 return Z_STREAM_ERROR; 19828 } 19829 var state = strm.state; 19830 if (state.window) { 19831 state.window = null; 19832 } 19833 strm.state = null; 19834 return Z_OK; 19835 } 19836 function inflateGetHeader(strm, head2) { 19837 var state; 19838 if (!strm || !strm.state) { 19839 return Z_STREAM_ERROR; 19840 } 19841 state = strm.state; 19842 if ((state.wrap & 2) === 0) { 19843 return Z_STREAM_ERROR; 19844 } 19845 state.head = head2; 19846 head2.done = false; 19847 return Z_OK; 19848 } 19849 function inflateSetDictionary(strm, dictionary) { 19850 var dictLength = dictionary.length; 19851 var state; 19852 var dictid; 19853 var ret; 19854 if (!strm || !strm.state) { 19855 return Z_STREAM_ERROR; 19856 } 19857 state = strm.state; 19858 if (state.wrap !== 0 && state.mode !== DICT) { 19859 return Z_STREAM_ERROR; 19860 } 19861 if (state.mode === DICT) { 19862 dictid = 1; 19863 dictid = adler32( 19864 dictid, 19865 dictionary, 19866 dictLength, 19867 0 19868 ); 19869 if (dictid !== state.check) { 19870 return Z_DATA_ERROR; 19871 } 19872 } 19873 ret = updatewindow( 19874 strm, 19875 dictionary, 19876 dictLength, 19877 dictLength 19878 ); 19879 if (ret) { 19880 state.mode = MEM; 19881 return Z_MEM_ERROR; 19882 } 19883 state.havedict = 1; 19884 return Z_OK; 19885 } 19886 exports2.inflateReset = inflateReset; 19887 exports2.inflateReset2 = inflateReset2; 19888 exports2.inflateResetKeep = inflateResetKeep; 19889 exports2.inflateInit = inflateInit; 19890 exports2.inflateInit2 = inflateInit2; 19891 exports2.inflate = inflate; 19892 exports2.inflateEnd = inflateEnd; 19893 exports2.inflateGetHeader = inflateGetHeader; 19894 exports2.inflateSetDictionary = inflateSetDictionary; 19895 exports2.inflateInfo = "pako inflate (from Nodeca project)"; 19896 }, 19897 { 19898 "../utils/common": 1, 19899 "./adler32": 3, 19900 "./crc32": 5, 19901 "./inffast": 7, 19902 "./inftrees": 9 19903 } 19904 ], 19905 9: [ 19906 function(require2, module2, exports2) { 19907 "use strict"; 19908 var utils = require2("../utils/common"); 19909 var MAXBITS = 15; 19910 var ENOUGH_LENS = 852; 19911 var ENOUGH_DISTS = 592; 19912 var CODES = 0; 19913 var LENS = 1; 19914 var DISTS = 2; 19915 var lbase = [ 19916 /* Length codes 257..285 base */ 19917 3, 19918 4, 19919 5, 19920 6, 19921 7, 19922 8, 19923 9, 19924 10, 19925 11, 19926 13, 19927 15, 19928 17, 19929 19, 19930 23, 19931 27, 19932 31, 19933 35, 19934 43, 19935 51, 19936 59, 19937 67, 19938 83, 19939 99, 19940 115, 19941 131, 19942 163, 19943 195, 19944 227, 19945 258, 19946 0, 19947 0 19948 ]; 19949 var lext = [ 19950 /* Length codes 257..285 extra */ 19951 16, 19952 16, 19953 16, 19954 16, 19955 16, 19956 16, 19957 16, 19958 16, 19959 17, 19960 17, 19961 17, 19962 17, 19963 18, 19964 18, 19965 18, 19966 18, 19967 19, 19968 19, 19969 19, 19970 19, 19971 20, 19972 20, 19973 20, 19974 20, 19975 21, 19976 21, 19977 21, 19978 21, 19979 16, 19980 72, 19981 78 19982 ]; 19983 var dbase = [ 19984 /* Distance codes 0..29 base */ 19985 1, 19986 2, 19987 3, 19988 4, 19989 5, 19990 7, 19991 9, 19992 13, 19993 17, 19994 25, 19995 33, 19996 49, 19997 65, 19998 97, 19999 129, 20000 193, 20001 257, 20002 385, 20003 513, 20004 769, 20005 1025, 20006 1537, 20007 2049, 20008 3073, 20009 4097, 20010 6145, 20011 8193, 20012 12289, 20013 16385, 20014 24577, 20015 0, 20016 0 20017 ]; 20018 var dext = [ 20019 /* Distance codes 0..29 extra */ 20020 16, 20021 16, 20022 16, 20023 16, 20024 17, 20025 17, 20026 18, 20027 18, 20028 19, 20029 19, 20030 20, 20031 20, 20032 21, 20033 21, 20034 22, 20035 22, 20036 23, 20037 23, 20038 24, 20039 24, 20040 25, 20041 25, 20042 26, 20043 26, 20044 27, 20045 27, 20046 28, 20047 28, 20048 29, 20049 29, 20050 64, 20051 64 20052 ]; 20053 module2.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts) { 20054 var bits = opts.bits; 20055 var len = 0; 20056 var sym = 0; 20057 var min2 = 0, max2 = 0; 20058 var root = 0; 20059 var curr = 0; 20060 var drop = 0; 20061 var left = 0; 20062 var used = 0; 20063 var huff = 0; 20064 var incr; 20065 var fill; 20066 var low; 20067 var mask; 20068 var next; 20069 var base = null; 20070 var base_index = 0; 20071 var end; 20072 var count = new utils.Buf16(MAXBITS + 1); 20073 var offs = new utils.Buf16(MAXBITS + 1); 20074 var extra = null; 20075 var extra_index = 0; 20076 var here_bits, here_op, here_val; 20077 for (len = 0; len <= MAXBITS; len++) { 20078 count[len] = 0; 20079 } 20080 for (sym = 0; sym < codes; sym++) { 20081 count[lens[lens_index + sym]]++; 20082 } 20083 root = bits; 20084 for (max2 = MAXBITS; max2 >= 1; max2--) { 20085 if (count[max2] !== 0) { 20086 break; 20087 } 20088 } 20089 if (root > max2) { 20090 root = max2; 20091 } 20092 if (max2 === 0) { 20093 table[table_index++] = 1 << 24 | 64 << 16 | 0; 20094 table[table_index++] = 1 << 24 | 64 << 16 | 0; 20095 opts.bits = 1; 20096 return 0; 20097 } 20098 for (min2 = 1; min2 < max2; min2++) { 20099 if (count[min2] !== 0) { 20100 break; 20101 } 20102 } 20103 if (root < min2) { 20104 root = min2; 20105 } 20106 left = 1; 20107 for (len = 1; len <= MAXBITS; len++) { 20108 left <<= 1; 20109 left -= count[len]; 20110 if (left < 0) { 20111 return -1; 20112 } 20113 } 20114 if (left > 0 && (type === CODES || max2 !== 1)) { 20115 return -1; 20116 } 20117 offs[1] = 0; 20118 for (len = 1; len < MAXBITS; len++) { 20119 offs[len + 1] = offs[len] + count[len]; 20120 } 20121 for (sym = 0; sym < codes; sym++) { 20122 if (lens[lens_index + sym] !== 0) { 20123 work[offs[lens[lens_index + sym]]++] = sym; 20124 } 20125 } 20126 if (type === CODES) { 20127 base = extra = work; 20128 end = 19; 20129 } else if (type === LENS) { 20130 base = lbase; 20131 base_index -= 257; 20132 extra = lext; 20133 extra_index -= 257; 20134 end = 256; 20135 } else { 20136 base = dbase; 20137 extra = dext; 20138 end = -1; 20139 } 20140 huff = 0; 20141 sym = 0; 20142 len = min2; 20143 next = table_index; 20144 curr = root; 20145 drop = 0; 20146 low = -1; 20147 used = 1 << root; 20148 mask = used - 1; 20149 if (type === LENS && used > ENOUGH_LENS || type === DISTS && used > ENOUGH_DISTS) { 20150 return 1; 20151 } 20152 for (; ; ) { 20153 here_bits = len - drop; 20154 if (work[sym] < end) { 20155 here_op = 0; 20156 here_val = work[sym]; 20157 } else if (work[sym] > end) { 20158 here_op = extra[extra_index + work[sym]]; 20159 here_val = base[base_index + work[sym]]; 20160 } else { 20161 here_op = 32 + 64; 20162 here_val = 0; 20163 } 20164 incr = 1 << len - drop; 20165 fill = 1 << curr; 20166 min2 = fill; 20167 do { 20168 fill -= incr; 20169 table[next + (huff >> drop) + fill] = here_bits << 24 | here_op << 16 | here_val | 0; 20170 } while (fill !== 0); 20171 incr = 1 << len - 1; 20172 while (huff & incr) { 20173 incr >>= 1; 20174 } 20175 if (incr !== 0) { 20176 huff &= incr - 1; 20177 huff += incr; 20178 } else { 20179 huff = 0; 20180 } 20181 sym++; 20182 if (--count[len] === 0) { 20183 if (len === max2) { 20184 break; 20185 } 20186 len = lens[lens_index + work[sym]]; 20187 } 20188 if (len > root && (huff & mask) !== low) { 20189 if (drop === 0) { 20190 drop = root; 20191 } 20192 next += min2; 20193 curr = len - drop; 20194 left = 1 << curr; 20195 while (curr + drop < max2) { 20196 left -= count[curr + drop]; 20197 if (left <= 0) { 20198 break; 20199 } 20200 curr++; 20201 left <<= 1; 20202 } 20203 used += 1 << curr; 20204 if (type === LENS && used > ENOUGH_LENS || type === DISTS && used > ENOUGH_DISTS) { 20205 return 1; 20206 } 20207 low = huff & mask; 20208 table[low] = root << 24 | curr << 16 | next - table_index | 0; 20209 } 20210 } 20211 if (huff !== 0) { 20212 table[next + huff] = len - drop << 24 | 64 << 16 | 0; 20213 } 20214 opts.bits = root; 20215 return 0; 20216 }; 20217 }, 20218 { "../utils/common": 1 } 20219 ], 20220 10: [ 20221 function(require2, module2, exports2) { 20222 "use strict"; 20223 module2.exports = { 20224 2: "need dictionary", 20225 1: "stream end", 20226 0: "", 20227 "-1": "file error", 20228 "-2": "stream error", 20229 "-3": "data error", 20230 "-4": "insufficient memory", 20231 "-5": "buffer error", 20232 "-6": "incompatible version" 20233 }; 20234 }, 20235 {} 20236 ], 20237 11: [ 20238 function(require2, module2, exports2) { 20239 "use strict"; 20240 function ZStream() { 20241 this.input = null; 20242 this.next_in = 0; 20243 this.avail_in = 0; 20244 this.total_in = 0; 20245 this.output = null; 20246 this.next_out = 0; 20247 this.avail_out = 0; 20248 this.total_out = 0; 20249 this.msg = ""; 20250 this.state = null; 20251 this.data_type = 2; 20252 this.adler = 0; 20253 } 20254 module2.exports = ZStream; 20255 }, 20256 {} 20257 ], 20258 "/lib/inflate.js": [ 20259 function(require2, module2, exports2) { 20260 "use strict"; 20261 var zlib_inflate = require2("./zlib/inflate"); 20262 var utils = require2("./utils/common"); 20263 var strings = require2("./utils/strings"); 20264 var c2 = require2("./zlib/constants"); 20265 var msg = require2("./zlib/messages"); 20266 var ZStream = require2("./zlib/zstream"); 20267 var GZheader = require2("./zlib/gzheader"); 20268 var toString = Object.prototype.toString; 20269 function Inflate(options) { 20270 if (!(this instanceof Inflate)) 20271 return new Inflate(options); 20272 this.options = utils.assign( 20273 { 20274 chunkSize: 16384, 20275 windowBits: 0, 20276 to: "" 20277 }, 20278 options || {} 20279 ); 20280 var opt = this.options; 20281 if (opt.raw && opt.windowBits >= 0 && opt.windowBits < 16) { 20282 opt.windowBits = -opt.windowBits; 20283 if (opt.windowBits === 0) { 20284 opt.windowBits = -15; 20285 } 20286 } 20287 if (opt.windowBits >= 0 && opt.windowBits < 16 && !(options && options.windowBits)) { 20288 opt.windowBits += 32; 20289 } 20290 if (opt.windowBits > 15 && opt.windowBits < 48) { 20291 if ((opt.windowBits & 15) === 0) { 20292 opt.windowBits |= 15; 20293 } 20294 } 20295 this.err = 0; 20296 this.msg = ""; 20297 this.ended = false; 20298 this.chunks = []; 20299 this.strm = new ZStream(); 20300 this.strm.avail_out = 0; 20301 var status = zlib_inflate.inflateInit2( 20302 this.strm, 20303 opt.windowBits 20304 ); 20305 if (status !== c2.Z_OK) { 20306 throw new Error(msg[status]); 20307 } 20308 this.header = new GZheader(); 20309 zlib_inflate.inflateGetHeader(this.strm, this.header); 20310 if (opt.dictionary) { 20311 if (typeof opt.dictionary === "string") { 20312 opt.dictionary = strings.string2buf( 20313 opt.dictionary 20314 ); 20315 } else if (toString.call(opt.dictionary) === "[object ArrayBuffer]") { 20316 opt.dictionary = new Uint8Array( 20317 opt.dictionary 20318 ); 20319 } 20320 if (opt.raw) { 20321 status = zlib_inflate.inflateSetDictionary( 20322 this.strm, 20323 opt.dictionary 20324 ); 20325 if (status !== c2.Z_OK) { 20326 throw new Error(msg[status]); 20327 } 20328 } 20329 } 20330 } 20331 Inflate.prototype.push = function(data, mode) { 20332 var strm = this.strm; 20333 var chunkSize = this.options.chunkSize; 20334 var dictionary = this.options.dictionary; 20335 var status, _mode; 20336 var next_out_utf8, tail, utf8str; 20337 var allowBufError = false; 20338 if (this.ended) { 20339 return false; 20340 } 20341 _mode = mode === ~~mode ? mode : mode === true ? c2.Z_FINISH : c2.Z_NO_FLUSH; 20342 if (typeof data === "string") { 20343 strm.input = strings.binstring2buf(data); 20344 } else if (toString.call(data) === "[object ArrayBuffer]") { 20345 strm.input = new Uint8Array(data); 20346 } else { 20347 strm.input = data; 20348 } 20349 strm.next_in = 0; 20350 strm.avail_in = strm.input.length; 20351 do { 20352 if (strm.avail_out === 0) { 20353 strm.output = new utils.Buf8(chunkSize); 20354 strm.next_out = 0; 20355 strm.avail_out = chunkSize; 20356 } 20357 status = zlib_inflate.inflate( 20358 strm, 20359 c2.Z_NO_FLUSH 20360 ); 20361 if (status === c2.Z_NEED_DICT && dictionary) { 20362 status = zlib_inflate.inflateSetDictionary( 20363 this.strm, 20364 dictionary 20365 ); 20366 } 20367 if (status === c2.Z_BUF_ERROR && allowBufError === true) { 20368 status = c2.Z_OK; 20369 allowBufError = false; 20370 } 20371 if (status !== c2.Z_STREAM_END && status !== c2.Z_OK) { 20372 this.onEnd(status); 20373 this.ended = true; 20374 return false; 20375 } 20376 if (strm.next_out) { 20377 if (strm.avail_out === 0 || status === c2.Z_STREAM_END || strm.avail_in === 0 && (_mode === c2.Z_FINISH || _mode === c2.Z_SYNC_FLUSH)) { 20378 if (this.options.to === "string") { 20379 next_out_utf8 = strings.utf8border( 20380 strm.output, 20381 strm.next_out 20382 ); 20383 tail = strm.next_out - next_out_utf8; 20384 utf8str = strings.buf2string( 20385 strm.output, 20386 next_out_utf8 20387 ); 20388 strm.next_out = tail; 20389 strm.avail_out = chunkSize - tail; 20390 if (tail) { 20391 utils.arraySet( 20392 strm.output, 20393 strm.output, 20394 next_out_utf8, 20395 tail, 20396 0 20397 ); 20398 } 20399 this.onData(utf8str); 20400 } else { 20401 this.onData( 20402 utils.shrinkBuf( 20403 strm.output, 20404 strm.next_out 20405 ) 20406 ); 20407 } 20408 } 20409 } 20410 if (strm.avail_in === 0 && strm.avail_out === 0) { 20411 allowBufError = true; 20412 } 20413 } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c2.Z_STREAM_END); 20414 if (status === c2.Z_STREAM_END) { 20415 _mode = c2.Z_FINISH; 20416 } 20417 if (_mode === c2.Z_FINISH) { 20418 status = zlib_inflate.inflateEnd(this.strm); 20419 this.onEnd(status); 20420 this.ended = true; 20421 return status === c2.Z_OK; 20422 } 20423 if (_mode === c2.Z_SYNC_FLUSH) { 20424 this.onEnd(c2.Z_OK); 20425 strm.avail_out = 0; 20426 return true; 20427 } 20428 return true; 20429 }; 20430 Inflate.prototype.onData = function(chunk) { 20431 this.chunks.push(chunk); 20432 }; 20433 Inflate.prototype.onEnd = function(status) { 20434 if (status === c2.Z_OK) { 20435 if (this.options.to === "string") { 20436 this.result = this.chunks.join(""); 20437 } else { 20438 this.result = utils.flattenChunks( 20439 this.chunks 20440 ); 20441 } 20442 } 20443 this.chunks = []; 20444 this.err = status; 20445 this.msg = this.strm.msg; 20446 }; 20447 function inflate(input, options) { 20448 var inflator = new Inflate(options); 20449 inflator.push(input, true); 20450 if (inflator.err) { 20451 throw inflator.msg || msg[inflator.err]; 20452 } 20453 return inflator.result; 20454 } 20455 function inflateRaw(input, options) { 20456 options = options || {}; 20457 options.raw = true; 20458 return inflate(input, options); 20459 } 20460 exports2.Inflate = Inflate; 20461 exports2.inflate = inflate; 20462 exports2.inflateRaw = inflateRaw; 20463 exports2.ungzip = inflate; 20464 }, 20465 { 20466 "./utils/common": 1, 20467 "./utils/strings": 2, 20468 "./zlib/constants": 4, 20469 "./zlib/gzheader": 6, 20470 "./zlib/inflate": 8, 20471 "./zlib/messages": 10, 20472 "./zlib/zstream": 11 20473 } 20474 ] 20475 }, 20476 {}, 20477 [] 20478 )("/lib/inflate.js"); 20479 })(); 20480 20481 // packages/global-styles-ui/build-module/font-library/lib/lib-font.browser.mjs 20482 var fetchFunction = globalThis.fetch; 20483 var Event2 = class { 20484 constructor(type, detail = {}, msg) { 20485 this.type = type; 20486 this.detail = detail; 20487 this.msg = msg; 20488 Object.defineProperty(this, `__mayPropagate`, { 20489 enumerable: false, 20490 writable: true 20491 }); 20492 this.__mayPropagate = true; 20493 } 20494 preventDefault() { 20495 } 20496 stopPropagation() { 20497 this.__mayPropagate = false; 20498 } 20499 valueOf() { 20500 return this; 20501 } 20502 toString() { 20503 return this.msg ? `[$this.type} event]: $this.msg}` : `[$this.type} event]`; 20504 } 20505 }; 20506 var EventManager = class { 20507 constructor() { 20508 this.listeners = {}; 20509 } 20510 addEventListener(type, listener, useCapture) { 20511 let bin = this.listeners[type] || []; 20512 if (useCapture) bin.unshift(listener); 20513 else bin.push(listener); 20514 this.listeners[type] = bin; 20515 } 20516 removeEventListener(type, listener) { 20517 let bin = this.listeners[type] || []; 20518 let pos = bin.findIndex((e2) => e2 === listener); 20519 if (pos > -1) { 20520 bin.splice(pos, 1); 20521 this.listeners[type] = bin; 20522 } 20523 } 20524 dispatch(event) { 20525 let bin = this.listeners[event.type]; 20526 if (bin) { 20527 for (let l2 = 0, e2 = bin.length; l2 < e2; l2++) { 20528 if (!event.__mayPropagate) break; 20529 bin[l2](event); 20530 } 20531 } 20532 } 20533 }; 20534 var startDate = (/* @__PURE__ */ new Date(`1904-01-01T00:00:00+0000`)).getTime(); 20535 function asText(data) { 20536 return Array.from(data).map((v2) => String.fromCharCode(v2)).join(``); 20537 } 20538 var Parser = class { 20539 constructor(dict, dataview, name2) { 20540 this.name = (name2 || dict.tag || ``).trim(); 20541 this.length = dict.length; 20542 this.start = dict.offset; 20543 this.offset = 0; 20544 this.data = dataview; 20545 [ 20546 `getInt8`, 20547 `getUint8`, 20548 `getInt16`, 20549 `getUint16`, 20550 `getInt32`, 20551 `getUint32`, 20552 `getBigInt64`, 20553 `getBigUint64` 20554 ].forEach((name3) => { 20555 let fn = name3.replace(/get(Big)?/, "").toLowerCase(); 20556 let increment = parseInt(name3.replace(/[^\d]/g, "")) / 8; 20557 Object.defineProperty(this, fn, { 20558 get: () => this.getValue(name3, increment) 20559 }); 20560 }); 20561 } 20562 get currentPosition() { 20563 return this.start + this.offset; 20564 } 20565 set currentPosition(position) { 20566 this.start = position; 20567 this.offset = 0; 20568 } 20569 skip(n2 = 0, bits = 8) { 20570 this.offset += n2 * bits / 8; 20571 } 20572 getValue(type, increment) { 20573 let pos = this.start + this.offset; 20574 this.offset += increment; 20575 try { 20576 return this.data[type](pos); 20577 } catch (e2) { 20578 console.error(`parser`, type, increment, this); 20579 console.error(`parser`, this.start, this.offset); 20580 throw e2; 20581 } 20582 } 20583 flags(n2) { 20584 if (n2 === 8 || n2 === 16 || n2 === 32 || n2 === 64) { 20585 return this[`uint$n2}`].toString(2).padStart(n2, 0).split(``).map((v2) => v2 === "1"); 20586 } 20587 console.error( 20588 `Error parsing flags: flag types can only be 1, 2, 4, or 8 bytes long` 20589 ); 20590 console.trace(); 20591 } 20592 get tag() { 20593 const t3 = this.uint32; 20594 return asText([ 20595 t3 >> 24 & 255, 20596 t3 >> 16 & 255, 20597 t3 >> 8 & 255, 20598 t3 & 255 20599 ]); 20600 } 20601 get fixed() { 20602 let major = this.int16; 20603 let minor = Math.round(1e3 * this.uint16 / 65356); 20604 return major + minor / 1e3; 20605 } 20606 get legacyFixed() { 20607 let major = this.uint16; 20608 let minor = this.uint16.toString(16).padStart(4, 0); 20609 return parseFloat(`$major}.$minor}`); 20610 } 20611 get uint24() { 20612 return (this.uint8 << 16) + (this.uint8 << 8) + this.uint8; 20613 } 20614 get uint128() { 20615 let value = 0; 20616 for (let i2 = 0; i2 < 5; i2++) { 20617 let byte = this.uint8; 20618 value = value * 128 + (byte & 127); 20619 if (byte < 128) break; 20620 } 20621 return value; 20622 } 20623 get longdatetime() { 20624 return new Date(startDate + 1e3 * parseInt(this.int64.toString())); 20625 } 20626 get fword() { 20627 return this.int16; 20628 } 20629 get ufword() { 20630 return this.uint16; 20631 } 20632 get Offset16() { 20633 return this.uint16; 20634 } 20635 get Offset32() { 20636 return this.uint32; 20637 } 20638 get F2DOT14() { 20639 const bits = p.uint16; 20640 const integer = [0, 1, -2, -1][bits >> 14]; 20641 const fraction = bits & 16383; 20642 return integer + fraction / 16384; 20643 } 20644 verifyLength() { 20645 if (this.offset != this.length) { 20646 console.error( 20647 `unexpected parsed table size ($this.offset}) for "$this.name}" (expected $this.length})` 20648 ); 20649 } 20650 } 20651 readBytes(n2 = 0, position = 0, bits = 8, signed = false) { 20652 n2 = n2 || this.length; 20653 if (n2 === 0) return []; 20654 if (position) this.currentPosition = position; 20655 const fn = `$signed ? `` : `u`}int$bits}`, slice = []; 20656 while (n2--) slice.push(this[fn]); 20657 return slice; 20658 } 20659 }; 20660 var ParsedData = class { 20661 constructor(parser) { 20662 const pGetter = { enumerable: false, get: () => parser }; 20663 Object.defineProperty(this, `parser`, pGetter); 20664 const start = parser.currentPosition; 20665 const startGetter = { enumerable: false, get: () => start }; 20666 Object.defineProperty(this, `start`, startGetter); 20667 } 20668 load(struct) { 20669 Object.keys(struct).forEach((p22) => { 20670 let props = Object.getOwnPropertyDescriptor(struct, p22); 20671 if (props.get) { 20672 this[p22] = props.get.bind(this); 20673 } else if (props.value !== void 0) { 20674 this[p22] = props.value; 20675 } 20676 }); 20677 if (this.parser.length) { 20678 this.parser.verifyLength(); 20679 } 20680 } 20681 }; 20682 var SimpleTable = class extends ParsedData { 20683 constructor(dict, dataview, name2) { 20684 const { parser, start } = super( 20685 new Parser(dict, dataview, name2) 20686 ); 20687 const pGetter = { enumerable: false, get: () => parser }; 20688 Object.defineProperty(this, `p`, pGetter); 20689 const startGetter = { enumerable: false, get: () => start }; 20690 Object.defineProperty(this, `tableStart`, startGetter); 20691 } 20692 }; 20693 function lazy$1(object, property, getter) { 20694 let val; 20695 Object.defineProperty(object, property, { 20696 get: () => { 20697 if (val) return val; 20698 val = getter(); 20699 return val; 20700 }, 20701 enumerable: true 20702 }); 20703 } 20704 var SFNT = class extends SimpleTable { 20705 constructor(font2, dataview, createTable2) { 20706 const { p: p22 } = super({ offset: 0, length: 12 }, dataview, `sfnt`); 20707 this.version = p22.uint32; 20708 this.numTables = p22.uint16; 20709 this.searchRange = p22.uint16; 20710 this.entrySelector = p22.uint16; 20711 this.rangeShift = p22.uint16; 20712 p22.verifyLength(); 20713 this.directory = [...new Array(this.numTables)].map( 20714 (_) => new TableRecord(p22) 20715 ); 20716 this.tables = {}; 20717 this.directory.forEach((entry) => { 20718 const getter = () => createTable2( 20719 this.tables, 20720 { 20721 tag: entry.tag, 20722 offset: entry.offset, 20723 length: entry.length 20724 }, 20725 dataview 20726 ); 20727 lazy$1(this.tables, entry.tag.trim(), getter); 20728 }); 20729 } 20730 }; 20731 var TableRecord = class { 20732 constructor(p22) { 20733 this.tag = p22.tag; 20734 this.checksum = p22.uint32; 20735 this.offset = p22.uint32; 20736 this.length = p22.uint32; 20737 } 20738 }; 20739 var gzipDecode = inflate_default.inflate || void 0; 20740 var nativeGzipDecode = void 0; 20741 var WOFF$1 = class extends SimpleTable { 20742 constructor(font2, dataview, createTable2) { 20743 const { p: p22 } = super({ offset: 0, length: 44 }, dataview, `woff`); 20744 this.signature = p22.tag; 20745 this.flavor = p22.uint32; 20746 this.length = p22.uint32; 20747 this.numTables = p22.uint16; 20748 p22.uint16; 20749 this.totalSfntSize = p22.uint32; 20750 this.majorVersion = p22.uint16; 20751 this.minorVersion = p22.uint16; 20752 this.metaOffset = p22.uint32; 20753 this.metaLength = p22.uint32; 20754 this.metaOrigLength = p22.uint32; 20755 this.privOffset = p22.uint32; 20756 this.privLength = p22.uint32; 20757 p22.verifyLength(); 20758 this.directory = [...new Array(this.numTables)].map( 20759 (_) => new WoffTableDirectoryEntry(p22) 20760 ); 20761 buildWoffLazyLookups(this, dataview, createTable2); 20762 } 20763 }; 20764 var WoffTableDirectoryEntry = class { 20765 constructor(p22) { 20766 this.tag = p22.tag; 20767 this.offset = p22.uint32; 20768 this.compLength = p22.uint32; 20769 this.origLength = p22.uint32; 20770 this.origChecksum = p22.uint32; 20771 } 20772 }; 20773 function buildWoffLazyLookups(woff, dataview, createTable2) { 20774 woff.tables = {}; 20775 woff.directory.forEach((entry) => { 20776 lazy$1(woff.tables, entry.tag.trim(), () => { 20777 let offset4 = 0; 20778 let view = dataview; 20779 if (entry.compLength !== entry.origLength) { 20780 const data = dataview.buffer.slice( 20781 entry.offset, 20782 entry.offset + entry.compLength 20783 ); 20784 let unpacked; 20785 if (gzipDecode) { 20786 unpacked = gzipDecode(new Uint8Array(data)); 20787 } else if (nativeGzipDecode) { 20788 unpacked = nativeGzipDecode(new Uint8Array(data)); 20789 } else { 20790 const msg = `no brotli decoder available to decode WOFF2 font`; 20791 if (font.onerror) font.onerror(msg); 20792 throw new Error(msg); 20793 } 20794 view = new DataView(unpacked.buffer); 20795 } else { 20796 offset4 = entry.offset; 20797 } 20798 return createTable2( 20799 woff.tables, 20800 { tag: entry.tag, offset: offset4, length: entry.origLength }, 20801 view 20802 ); 20803 }); 20804 }); 20805 } 20806 var brotliDecode = unbrotli_default; 20807 var nativeBrotliDecode = void 0; 20808 var WOFF2$1 = class extends SimpleTable { 20809 constructor(font2, dataview, createTable2) { 20810 const { p: p22 } = super({ offset: 0, length: 48 }, dataview, `woff2`); 20811 this.signature = p22.tag; 20812 this.flavor = p22.uint32; 20813 this.length = p22.uint32; 20814 this.numTables = p22.uint16; 20815 p22.uint16; 20816 this.totalSfntSize = p22.uint32; 20817 this.totalCompressedSize = p22.uint32; 20818 this.majorVersion = p22.uint16; 20819 this.minorVersion = p22.uint16; 20820 this.metaOffset = p22.uint32; 20821 this.metaLength = p22.uint32; 20822 this.metaOrigLength = p22.uint32; 20823 this.privOffset = p22.uint32; 20824 this.privLength = p22.uint32; 20825 p22.verifyLength(); 20826 this.directory = [...new Array(this.numTables)].map( 20827 (_) => new Woff2TableDirectoryEntry(p22) 20828 ); 20829 let dictOffset = p22.currentPosition; 20830 this.directory[0].offset = 0; 20831 this.directory.forEach((e2, i2) => { 20832 let next = this.directory[i2 + 1]; 20833 if (next) { 20834 next.offset = e2.offset + (e2.transformLength !== void 0 ? e2.transformLength : e2.origLength); 20835 } 20836 }); 20837 let decoded; 20838 let buffer = dataview.buffer.slice(dictOffset); 20839 if (brotliDecode) { 20840 decoded = brotliDecode(new Uint8Array(buffer)); 20841 } else if (nativeBrotliDecode) { 20842 decoded = new Uint8Array(nativeBrotliDecode(buffer)); 20843 } else { 20844 const msg = `no brotli decoder available to decode WOFF2 font`; 20845 if (font2.onerror) font2.onerror(msg); 20846 throw new Error(msg); 20847 } 20848 buildWoff2LazyLookups(this, decoded, createTable2); 20849 } 20850 }; 20851 var Woff2TableDirectoryEntry = class { 20852 constructor(p22) { 20853 this.flags = p22.uint8; 20854 const tagNumber = this.tagNumber = this.flags & 63; 20855 if (tagNumber === 63) { 20856 this.tag = p22.tag; 20857 } else { 20858 this.tag = getWOFF2Tag(tagNumber); 20859 } 20860 const transformVersion = this.transformVersion = (this.flags & 192) >> 6; 20861 let hasTransforms = transformVersion !== 0; 20862 if (this.tag === `glyf` || this.tag === `loca`) { 20863 hasTransforms = this.transformVersion !== 3; 20864 } 20865 this.origLength = p22.uint128; 20866 if (hasTransforms) { 20867 this.transformLength = p22.uint128; 20868 } 20869 } 20870 }; 20871 function buildWoff2LazyLookups(woff2, decoded, createTable2) { 20872 woff2.tables = {}; 20873 woff2.directory.forEach((entry) => { 20874 lazy$1(woff2.tables, entry.tag.trim(), () => { 20875 const start = entry.offset; 20876 const end = start + (entry.transformLength ? entry.transformLength : entry.origLength); 20877 const data = new DataView(decoded.slice(start, end).buffer); 20878 try { 20879 return createTable2( 20880 woff2.tables, 20881 { tag: entry.tag, offset: 0, length: entry.origLength }, 20882 data 20883 ); 20884 } catch (e2) { 20885 console.error(e2); 20886 } 20887 }); 20888 }); 20889 } 20890 function getWOFF2Tag(flag) { 20891 return [ 20892 `cmap`, 20893 `head`, 20894 `hhea`, 20895 `hmtx`, 20896 `maxp`, 20897 `name`, 20898 `OS/2`, 20899 `post`, 20900 `cvt `, 20901 `fpgm`, 20902 `glyf`, 20903 `loca`, 20904 `prep`, 20905 `CFF `, 20906 `VORG`, 20907 `EBDT`, 20908 `EBLC`, 20909 `gasp`, 20910 `hdmx`, 20911 `kern`, 20912 `LTSH`, 20913 `PCLT`, 20914 `VDMX`, 20915 `vhea`, 20916 `vmtx`, 20917 `BASE`, 20918 `GDEF`, 20919 `GPOS`, 20920 `GSUB`, 20921 `EBSC`, 20922 `JSTF`, 20923 `MATH`, 20924 `CBDT`, 20925 `CBLC`, 20926 `COLR`, 20927 `CPAL`, 20928 `SVG `, 20929 `sbix`, 20930 `acnt`, 20931 `avar`, 20932 `bdat`, 20933 `bloc`, 20934 `bsln`, 20935 `cvar`, 20936 `fdsc`, 20937 `feat`, 20938 `fmtx`, 20939 `fvar`, 20940 `gvar`, 20941 `hsty`, 20942 `just`, 20943 `lcar`, 20944 `mort`, 20945 `morx`, 20946 `opbd`, 20947 `prop`, 20948 `trak`, 20949 `Zapf`, 20950 `Silf`, 20951 `Glat`, 20952 `Gloc`, 20953 `Feat`, 20954 `Sill` 20955 ][flag & 63]; 20956 } 20957 var tableClasses = {}; 20958 var tableClassesLoaded = false; 20959 Promise.all([ 20960 Promise.resolve().then(function() { 20961 return cmap$1; 20962 }), 20963 Promise.resolve().then(function() { 20964 return head$1; 20965 }), 20966 Promise.resolve().then(function() { 20967 return hhea$1; 20968 }), 20969 Promise.resolve().then(function() { 20970 return hmtx$1; 20971 }), 20972 Promise.resolve().then(function() { 20973 return maxp$1; 20974 }), 20975 Promise.resolve().then(function() { 20976 return name$1; 20977 }), 20978 Promise.resolve().then(function() { 20979 return OS2$1; 20980 }), 20981 Promise.resolve().then(function() { 20982 return post$1; 20983 }), 20984 Promise.resolve().then(function() { 20985 return BASE$1; 20986 }), 20987 Promise.resolve().then(function() { 20988 return GDEF$1; 20989 }), 20990 Promise.resolve().then(function() { 20991 return GSUB$1; 20992 }), 20993 Promise.resolve().then(function() { 20994 return GPOS$1; 20995 }), 20996 Promise.resolve().then(function() { 20997 return SVG$1; 20998 }), 20999 Promise.resolve().then(function() { 21000 return fvar$1; 21001 }), 21002 Promise.resolve().then(function() { 21003 return cvt$1; 21004 }), 21005 Promise.resolve().then(function() { 21006 return fpgm$1; 21007 }), 21008 Promise.resolve().then(function() { 21009 return gasp$1; 21010 }), 21011 Promise.resolve().then(function() { 21012 return glyf$1; 21013 }), 21014 Promise.resolve().then(function() { 21015 return loca$1; 21016 }), 21017 Promise.resolve().then(function() { 21018 return prep$1; 21019 }), 21020 Promise.resolve().then(function() { 21021 return CFF$1; 21022 }), 21023 Promise.resolve().then(function() { 21024 return CFF2$1; 21025 }), 21026 Promise.resolve().then(function() { 21027 return VORG$1; 21028 }), 21029 Promise.resolve().then(function() { 21030 return EBLC$1; 21031 }), 21032 Promise.resolve().then(function() { 21033 return EBDT$1; 21034 }), 21035 Promise.resolve().then(function() { 21036 return EBSC$1; 21037 }), 21038 Promise.resolve().then(function() { 21039 return CBLC$1; 21040 }), 21041 Promise.resolve().then(function() { 21042 return CBDT$1; 21043 }), 21044 Promise.resolve().then(function() { 21045 return sbix$1; 21046 }), 21047 Promise.resolve().then(function() { 21048 return COLR$1; 21049 }), 21050 Promise.resolve().then(function() { 21051 return CPAL$1; 21052 }), 21053 Promise.resolve().then(function() { 21054 return DSIG$1; 21055 }), 21056 Promise.resolve().then(function() { 21057 return hdmx$1; 21058 }), 21059 Promise.resolve().then(function() { 21060 return kern$1; 21061 }), 21062 Promise.resolve().then(function() { 21063 return LTSH$1; 21064 }), 21065 Promise.resolve().then(function() { 21066 return MERG$1; 21067 }), 21068 Promise.resolve().then(function() { 21069 return meta$1; 21070 }), 21071 Promise.resolve().then(function() { 21072 return PCLT$1; 21073 }), 21074 Promise.resolve().then(function() { 21075 return VDMX$1; 21076 }), 21077 Promise.resolve().then(function() { 21078 return vhea$1; 21079 }), 21080 Promise.resolve().then(function() { 21081 return vmtx$1; 21082 }) 21083 ]).then((data) => { 21084 data.forEach((e2) => { 21085 let name2 = Object.keys(e2)[0]; 21086 tableClasses[name2] = e2[name2]; 21087 }); 21088 tableClassesLoaded = true; 21089 }); 21090 function createTable(tables, dict, dataview) { 21091 let name2 = dict.tag.replace(/[^\w\d]/g, ``); 21092 let Type = tableClasses[name2]; 21093 if (Type) return new Type(dict, dataview, tables); 21094 console.warn( 21095 `lib-font has no definition for $name2}. The table was skipped.` 21096 ); 21097 return {}; 21098 } 21099 function loadTableClasses() { 21100 let count = 0; 21101 function checkLoaded(resolve, reject) { 21102 if (!tableClassesLoaded) { 21103 if (count > 10) { 21104 return reject(new Error(`loading took too long`)); 21105 } 21106 count++; 21107 return setTimeout(() => checkLoaded(resolve), 250); 21108 } 21109 resolve(createTable); 21110 } 21111 return new Promise((resolve, reject) => checkLoaded(resolve)); 21112 } 21113 function getFontCSSFormat(path, errorOnStyle) { 21114 let pos = path.lastIndexOf(`.`); 21115 let ext = (path.substring(pos + 1) || ``).toLowerCase(); 21116 let format = { 21117 ttf: `truetype`, 21118 otf: `opentype`, 21119 woff: `woff`, 21120 woff2: `woff2` 21121 }[ext]; 21122 if (format) return format; 21123 let msg = { 21124 eot: `The .eot format is not supported: it died in January 12, 2016, when Microsoft retired all versions of IE that didn't already support WOFF.`, 21125 svg: `The .svg format is not supported: SVG fonts (not to be confused with OpenType with embedded SVG) were so bad we took the entire fonts chapter out of the SVG specification again.`, 21126 fon: `The .fon format is not supported: this is an ancient Windows bitmap font format.`, 21127 ttc: `Based on the current CSS specification, font collections are not (yet?) supported.` 21128 }[ext]; 21129 if (!msg) msg = `$path} is not a known webfont format.`; 21130 if (errorOnStyle) { 21131 throw new Error(msg); 21132 } else { 21133 console.warn(`Could not load font: $msg}`); 21134 } 21135 } 21136 async function setupFontFace(name2, url, options = {}) { 21137 if (!globalThis.document) return; 21138 let format = getFontCSSFormat(url, options.errorOnStyle); 21139 if (!format) return; 21140 let style = document.createElement(`style`); 21141 style.className = `injected-by-Font-js`; 21142 let rules = []; 21143 if (options.styleRules) { 21144 rules = Object.entries(options.styleRules).map( 21145 ([key, value]) => `$key}: $value};` 21146 ); 21147 } 21148 style.textContent = ` 21149 @font-face { 21150 font-family: "$name2}"; 21151 $rules.join( 21152 ` 21153 ` 21154 )} 21155 src: url("$url}") format("$format}"); 21156 }`; 21157 globalThis.document.head.appendChild(style); 21158 return style; 21159 } 21160 var TTF = [0, 1, 0, 0]; 21161 var OTF = [79, 84, 84, 79]; 21162 var WOFF = [119, 79, 70, 70]; 21163 var WOFF2 = [119, 79, 70, 50]; 21164 function match(ar1, ar2) { 21165 if (ar1.length !== ar2.length) return; 21166 for (let i2 = 0; i2 < ar1.length; i2++) { 21167 if (ar1[i2] !== ar2[i2]) return; 21168 } 21169 return true; 21170 } 21171 function validFontFormat(dataview) { 21172 const LEAD_BYTES = [ 21173 dataview.getUint8(0), 21174 dataview.getUint8(1), 21175 dataview.getUint8(2), 21176 dataview.getUint8(3) 21177 ]; 21178 if (match(LEAD_BYTES, TTF) || match(LEAD_BYTES, OTF)) return `SFNT`; 21179 if (match(LEAD_BYTES, WOFF)) return `WOFF`; 21180 if (match(LEAD_BYTES, WOFF2)) return `WOFF2`; 21181 } 21182 function checkFetchResponseStatus(response) { 21183 if (!response.ok) { 21184 throw new Error( 21185 `HTTP $response.status} - $response.statusText}` 21186 ); 21187 } 21188 return response; 21189 } 21190 var Font = class extends EventManager { 21191 constructor(name2, options = {}) { 21192 super(); 21193 this.name = name2; 21194 this.options = options; 21195 this.metrics = false; 21196 } 21197 get src() { 21198 return this.__src; 21199 } 21200 set src(src) { 21201 this.__src = src; 21202 (async () => { 21203 if (globalThis.document && !this.options.skipStyleSheet) { 21204 await setupFontFace(this.name, src, this.options); 21205 } 21206 this.loadFont(src); 21207 })(); 21208 } 21209 async loadFont(url, filename) { 21210 fetch(url).then( 21211 (response) => checkFetchResponseStatus(response) && response.arrayBuffer() 21212 ).then( 21213 (buffer) => this.fromDataBuffer(buffer, filename || url) 21214 ).catch((err) => { 21215 const evt = new Event2( 21216 `error`, 21217 err, 21218 `Failed to load font at $filename || url}` 21219 ); 21220 this.dispatch(evt); 21221 if (this.onerror) this.onerror(evt); 21222 }); 21223 } 21224 async fromDataBuffer(buffer, filenameOrUrL) { 21225 this.fontData = new DataView(buffer); 21226 let type = validFontFormat(this.fontData); 21227 if (!type) { 21228 throw new Error( 21229 `$filenameOrUrL} is either an unsupported font format, or not a font at all.` 21230 ); 21231 } 21232 await this.parseBasicData(type); 21233 const evt = new Event2("load", { font: this }); 21234 this.dispatch(evt); 21235 if (this.onload) this.onload(evt); 21236 } 21237 async parseBasicData(type) { 21238 return loadTableClasses().then((createTable2) => { 21239 if (type === `SFNT`) { 21240 this.opentype = new SFNT(this, this.fontData, createTable2); 21241 } 21242 if (type === `WOFF`) { 21243 this.opentype = new WOFF$1(this, this.fontData, createTable2); 21244 } 21245 if (type === `WOFF2`) { 21246 this.opentype = new WOFF2$1(this, this.fontData, createTable2); 21247 } 21248 return this.opentype; 21249 }); 21250 } 21251 getGlyphId(char) { 21252 return this.opentype.tables.cmap.getGlyphId(char); 21253 } 21254 reverse(glyphid) { 21255 return this.opentype.tables.cmap.reverse(glyphid); 21256 } 21257 supports(char) { 21258 return this.getGlyphId(char) !== 0; 21259 } 21260 supportsVariation(variation) { 21261 return this.opentype.tables.cmap.supportsVariation(variation) !== false; 21262 } 21263 measureText(text, size4 = 16) { 21264 if (this.__unloaded) 21265 throw new Error( 21266 "Cannot measure text: font was unloaded. Please reload before calling measureText()" 21267 ); 21268 let d2 = document.createElement("div"); 21269 d2.textContent = text; 21270 d2.style.fontFamily = this.name; 21271 d2.style.fontSize = `$size4}px`; 21272 d2.style.color = `transparent`; 21273 d2.style.background = `transparent`; 21274 d2.style.top = `0`; 21275 d2.style.left = `0`; 21276 d2.style.position = `absolute`; 21277 document.body.appendChild(d2); 21278 let bbox = d2.getBoundingClientRect(); 21279 document.body.removeChild(d2); 21280 const OS22 = this.opentype.tables["OS/2"]; 21281 bbox.fontSize = size4; 21282 bbox.ascender = OS22.sTypoAscender; 21283 bbox.descender = OS22.sTypoDescender; 21284 return bbox; 21285 } 21286 unload() { 21287 if (this.styleElement.parentNode) { 21288 this.styleElement.parentNode.removeElement(this.styleElement); 21289 const evt = new Event2("unload", { font: this }); 21290 this.dispatch(evt); 21291 if (this.onunload) this.onunload(evt); 21292 } 21293 this._unloaded = true; 21294 } 21295 load() { 21296 if (this.__unloaded) { 21297 delete this.__unloaded; 21298 document.head.appendChild(this.styleElement); 21299 const evt = new Event2("load", { font: this }); 21300 this.dispatch(evt); 21301 if (this.onload) this.onload(evt); 21302 } 21303 } 21304 }; 21305 globalThis.Font = Font; 21306 var Subtable = class extends ParsedData { 21307 constructor(p22, plaformID, encodingID) { 21308 super(p22); 21309 this.plaformID = plaformID; 21310 this.encodingID = encodingID; 21311 } 21312 }; 21313 var Format0 = class extends Subtable { 21314 constructor(p22, platformID, encodingID) { 21315 super(p22, platformID, encodingID); 21316 this.format = 0; 21317 this.length = p22.uint16; 21318 this.language = p22.uint16; 21319 this.glyphIdArray = [...new Array(256)].map((_) => p22.uint8); 21320 } 21321 supports(charCode) { 21322 if (charCode.charCodeAt) { 21323 charCode = -1; 21324 console.warn( 21325 `supports(character) not implemented for cmap subtable format 0. only supports(id) is implemented.` 21326 ); 21327 } 21328 return 0 <= charCode && charCode <= 255; 21329 } 21330 reverse(glyphID) { 21331 console.warn(`reverse not implemented for cmap subtable format 0`); 21332 return {}; 21333 } 21334 getSupportedCharCodes() { 21335 return [{ start: 1, end: 256 }]; 21336 } 21337 }; 21338 var Format2 = class extends Subtable { 21339 constructor(p22, platformID, encodingID) { 21340 super(p22, platformID, encodingID); 21341 this.format = 2; 21342 this.length = p22.uint16; 21343 this.language = p22.uint16; 21344 this.subHeaderKeys = [...new Array(256)].map((_) => p22.uint16); 21345 const subHeaderCount = Math.max(...this.subHeaderKeys); 21346 const subHeaderOffset = p22.currentPosition; 21347 lazy$1(this, `subHeaders`, () => { 21348 p22.currentPosition = subHeaderOffset; 21349 return [...new Array(subHeaderCount)].map( 21350 (_) => new SubHeader(p22) 21351 ); 21352 }); 21353 const glyphIndexOffset = subHeaderOffset + subHeaderCount * 8; 21354 lazy$1(this, `glyphIndexArray`, () => { 21355 p22.currentPosition = glyphIndexOffset; 21356 return [...new Array(subHeaderCount)].map((_) => p22.uint16); 21357 }); 21358 } 21359 supports(charCode) { 21360 if (charCode.charCodeAt) { 21361 charCode = -1; 21362 console.warn( 21363 `supports(character) not implemented for cmap subtable format 2. only supports(id) is implemented.` 21364 ); 21365 } 21366 const low = charCode && 255; 21367 const high = charCode && 65280; 21368 const subHeaderKey = this.subHeaders[high]; 21369 const subheader = this.subHeaders[subHeaderKey]; 21370 const first = subheader.firstCode; 21371 const last = first + subheader.entryCount; 21372 return first <= low && low <= last; 21373 } 21374 reverse(glyphID) { 21375 console.warn(`reverse not implemented for cmap subtable format 2`); 21376 return {}; 21377 } 21378 getSupportedCharCodes(preservePropNames = false) { 21379 if (preservePropNames) { 21380 return this.subHeaders.map((h2) => ({ 21381 firstCode: h2.firstCode, 21382 lastCode: h2.lastCode 21383 })); 21384 } 21385 return this.subHeaders.map((h2) => ({ 21386 start: h2.firstCode, 21387 end: h2.lastCode 21388 })); 21389 } 21390 }; 21391 var SubHeader = class { 21392 constructor(p22) { 21393 this.firstCode = p22.uint16; 21394 this.entryCount = p22.uint16; 21395 this.lastCode = this.first + this.entryCount; 21396 this.idDelta = p22.int16; 21397 this.idRangeOffset = p22.uint16; 21398 } 21399 }; 21400 var Format4 = class extends Subtable { 21401 constructor(p22, platformID, encodingID) { 21402 super(p22, platformID, encodingID); 21403 this.format = 4; 21404 this.length = p22.uint16; 21405 this.language = p22.uint16; 21406 this.segCountX2 = p22.uint16; 21407 this.segCount = this.segCountX2 / 2; 21408 this.searchRange = p22.uint16; 21409 this.entrySelector = p22.uint16; 21410 this.rangeShift = p22.uint16; 21411 const endCodePosition = p22.currentPosition; 21412 lazy$1( 21413 this, 21414 `endCode`, 21415 () => p22.readBytes(this.segCount, endCodePosition, 16) 21416 ); 21417 const startCodePosition = endCodePosition + 2 + this.segCountX2; 21418 lazy$1( 21419 this, 21420 `startCode`, 21421 () => p22.readBytes(this.segCount, startCodePosition, 16) 21422 ); 21423 const idDeltaPosition = startCodePosition + this.segCountX2; 21424 lazy$1( 21425 this, 21426 `idDelta`, 21427 () => p22.readBytes(this.segCount, idDeltaPosition, 16, true) 21428 ); 21429 const idRangePosition = idDeltaPosition + this.segCountX2; 21430 lazy$1( 21431 this, 21432 `idRangeOffset`, 21433 () => p22.readBytes(this.segCount, idRangePosition, 16) 21434 ); 21435 const glyphIdArrayPosition = idRangePosition + this.segCountX2; 21436 const glyphIdArrayLength = this.length - (glyphIdArrayPosition - this.tableStart); 21437 lazy$1( 21438 this, 21439 `glyphIdArray`, 21440 () => p22.readBytes(glyphIdArrayLength, glyphIdArrayPosition, 16) 21441 ); 21442 lazy$1( 21443 this, 21444 `segments`, 21445 () => this.buildSegments(idRangePosition, glyphIdArrayPosition, p22) 21446 ); 21447 } 21448 buildSegments(idRangePosition, glyphIdArrayPosition, p22) { 21449 const build = (_, i2) => { 21450 let startCode = this.startCode[i2], endCode = this.endCode[i2], idDelta = this.idDelta[i2], idRangeOffset = this.idRangeOffset[i2], idRangeOffsetPointer = idRangePosition + 2 * i2, glyphIDs = []; 21451 if (idRangeOffset === 0) { 21452 for (let i22 = startCode + idDelta, e2 = endCode + idDelta; i22 <= e2; i22++) { 21453 glyphIDs.push(i22); 21454 } 21455 } else { 21456 for (let i22 = 0, e2 = endCode - startCode; i22 <= e2; i22++) { 21457 p22.currentPosition = idRangeOffsetPointer + idRangeOffset + i22 * 2; 21458 glyphIDs.push(p22.uint16); 21459 } 21460 } 21461 return { 21462 startCode, 21463 endCode, 21464 idDelta, 21465 idRangeOffset, 21466 glyphIDs 21467 }; 21468 }; 21469 return [...new Array(this.segCount)].map(build); 21470 } 21471 reverse(glyphID) { 21472 let s2 = this.segments.find((v2) => v2.glyphIDs.includes(glyphID)); 21473 if (!s2) return {}; 21474 const code = s2.startCode + s2.glyphIDs.indexOf(glyphID); 21475 return { code, unicode: String.fromCodePoint(code) }; 21476 } 21477 getGlyphId(charCode) { 21478 if (charCode.charCodeAt) charCode = charCode.charCodeAt(0); 21479 if (55296 <= charCode && charCode <= 57343) return 0; 21480 if ((charCode & 65534) === 65534 || (charCode & 65535) === 65535) 21481 return 0; 21482 let segment = this.segments.find( 21483 (s2) => s2.startCode <= charCode && charCode <= s2.endCode 21484 ); 21485 if (!segment) return 0; 21486 return segment.glyphIDs[charCode - segment.startCode]; 21487 } 21488 supports(charCode) { 21489 return this.getGlyphId(charCode) !== 0; 21490 } 21491 getSupportedCharCodes(preservePropNames = false) { 21492 if (preservePropNames) return this.segments; 21493 return this.segments.map((v2) => ({ 21494 start: v2.startCode, 21495 end: v2.endCode 21496 })); 21497 } 21498 }; 21499 var Format6 = class extends Subtable { 21500 constructor(p22, platformID, encodingID) { 21501 super(p22, platformID, encodingID); 21502 this.format = 6; 21503 this.length = p22.uint16; 21504 this.language = p22.uint16; 21505 this.firstCode = p22.uint16; 21506 this.entryCount = p22.uint16; 21507 this.lastCode = this.firstCode + this.entryCount - 1; 21508 const getter = () => [...new Array(this.entryCount)].map((_) => p22.uint16); 21509 lazy$1(this, `glyphIdArray`, getter); 21510 } 21511 supports(charCode) { 21512 if (charCode.charCodeAt) { 21513 charCode = -1; 21514 console.warn( 21515 `supports(character) not implemented for cmap subtable format 6. only supports(id) is implemented.` 21516 ); 21517 } 21518 if (charCode < this.firstCode) return {}; 21519 if (charCode > this.firstCode + this.entryCount) return {}; 21520 const code = charCode - this.firstCode; 21521 return { code, unicode: String.fromCodePoint(code) }; 21522 } 21523 reverse(glyphID) { 21524 let pos = this.glyphIdArray.indexOf(glyphID); 21525 if (pos > -1) return this.firstCode + pos; 21526 } 21527 getSupportedCharCodes(preservePropNames = false) { 21528 if (preservePropNames) { 21529 return [{ firstCode: this.firstCode, lastCode: this.lastCode }]; 21530 } 21531 return [{ start: this.firstCode, end: this.lastCode }]; 21532 } 21533 }; 21534 var Format8 = class extends Subtable { 21535 constructor(p22, platformID, encodingID) { 21536 super(p22, platformID, encodingID); 21537 this.format = 8; 21538 p22.uint16; 21539 this.length = p22.uint32; 21540 this.language = p22.uint32; 21541 this.is32 = [...new Array(8192)].map((_) => p22.uint8); 21542 this.numGroups = p22.uint32; 21543 const getter = () => [...new Array(this.numGroups)].map( 21544 (_) => new SequentialMapGroup$1(p22) 21545 ); 21546 lazy$1(this, `groups`, getter); 21547 } 21548 supports(charCode) { 21549 if (charCode.charCodeAt) { 21550 charCode = -1; 21551 console.warn( 21552 `supports(character) not implemented for cmap subtable format 8. only supports(id) is implemented.` 21553 ); 21554 } 21555 return this.groups.findIndex( 21556 (s2) => s2.startcharCode <= charCode && charCode <= s2.endcharCode 21557 ) !== -1; 21558 } 21559 reverse(glyphID) { 21560 console.warn(`reverse not implemented for cmap subtable format 8`); 21561 return {}; 21562 } 21563 getSupportedCharCodes(preservePropNames = false) { 21564 if (preservePropNames) return this.groups; 21565 return this.groups.map((v2) => ({ 21566 start: v2.startcharCode, 21567 end: v2.endcharCode 21568 })); 21569 } 21570 }; 21571 var SequentialMapGroup$1 = class { 21572 constructor(p22) { 21573 this.startcharCode = p22.uint32; 21574 this.endcharCode = p22.uint32; 21575 this.startGlyphID = p22.uint32; 21576 } 21577 }; 21578 var Format10 = class extends Subtable { 21579 constructor(p22, platformID, encodingID) { 21580 super(p22, platformID, encodingID); 21581 this.format = 10; 21582 p22.uint16; 21583 this.length = p22.uint32; 21584 this.language = p22.uint32; 21585 this.startCharCode = p22.uint32; 21586 this.numChars = p22.uint32; 21587 this.endCharCode = this.startCharCode + this.numChars; 21588 const getter = () => [...new Array(this.numChars)].map((_) => p22.uint16); 21589 lazy$1(this, `glyphs`, getter); 21590 } 21591 supports(charCode) { 21592 if (charCode.charCodeAt) { 21593 charCode = -1; 21594 console.warn( 21595 `supports(character) not implemented for cmap subtable format 10. only supports(id) is implemented.` 21596 ); 21597 } 21598 if (charCode < this.startCharCode) return false; 21599 if (charCode > this.startCharCode + this.numChars) return false; 21600 return charCode - this.startCharCode; 21601 } 21602 reverse(glyphID) { 21603 console.warn(`reverse not implemented for cmap subtable format 10`); 21604 return {}; 21605 } 21606 getSupportedCharCodes(preservePropNames = false) { 21607 if (preservePropNames) { 21608 return [ 21609 { 21610 startCharCode: this.startCharCode, 21611 endCharCode: this.endCharCode 21612 } 21613 ]; 21614 } 21615 return [{ start: this.startCharCode, end: this.endCharCode }]; 21616 } 21617 }; 21618 var Format12 = class extends Subtable { 21619 constructor(p22, platformID, encodingID) { 21620 super(p22, platformID, encodingID); 21621 this.format = 12; 21622 p22.uint16; 21623 this.length = p22.uint32; 21624 this.language = p22.uint32; 21625 this.numGroups = p22.uint32; 21626 const getter = () => [...new Array(this.numGroups)].map( 21627 (_) => new SequentialMapGroup(p22) 21628 ); 21629 lazy$1(this, `groups`, getter); 21630 } 21631 supports(charCode) { 21632 if (charCode.charCodeAt) charCode = charCode.charCodeAt(0); 21633 if (55296 <= charCode && charCode <= 57343) return 0; 21634 if ((charCode & 65534) === 65534 || (charCode & 65535) === 65535) 21635 return 0; 21636 return this.groups.findIndex( 21637 (s2) => s2.startCharCode <= charCode && charCode <= s2.endCharCode 21638 ) !== -1; 21639 } 21640 reverse(glyphID) { 21641 for (let group of this.groups) { 21642 let start = group.startGlyphID; 21643 if (start > glyphID) continue; 21644 if (start === glyphID) return group.startCharCode; 21645 let end = start + (group.endCharCode - group.startCharCode); 21646 if (end < glyphID) continue; 21647 const code = group.startCharCode + (glyphID - start); 21648 return { code, unicode: String.fromCodePoint(code) }; 21649 } 21650 return {}; 21651 } 21652 getSupportedCharCodes(preservePropNames = false) { 21653 if (preservePropNames) return this.groups; 21654 return this.groups.map((v2) => ({ 21655 start: v2.startCharCode, 21656 end: v2.endCharCode 21657 })); 21658 } 21659 }; 21660 var SequentialMapGroup = class { 21661 constructor(p22) { 21662 this.startCharCode = p22.uint32; 21663 this.endCharCode = p22.uint32; 21664 this.startGlyphID = p22.uint32; 21665 } 21666 }; 21667 var Format13 = class extends Subtable { 21668 constructor(p22, platformID, encodingID) { 21669 super(p22, platformID, encodingID); 21670 this.format = 13; 21671 p22.uint16; 21672 this.length = p22.uint32; 21673 this.language = p22.uint32; 21674 this.numGroups = p22.uint32; 21675 const getter = [...new Array(this.numGroups)].map( 21676 (_) => new ConstantMapGroup(p22) 21677 ); 21678 lazy$1(this, `groups`, getter); 21679 } 21680 supports(charCode) { 21681 if (charCode.charCodeAt) charCode = charCode.charCodeAt(0); 21682 return this.groups.findIndex( 21683 (s2) => s2.startCharCode <= charCode && charCode <= s2.endCharCode 21684 ) !== -1; 21685 } 21686 reverse(glyphID) { 21687 console.warn(`reverse not implemented for cmap subtable format 13`); 21688 return {}; 21689 } 21690 getSupportedCharCodes(preservePropNames = false) { 21691 if (preservePropNames) return this.groups; 21692 return this.groups.map((v2) => ({ 21693 start: v2.startCharCode, 21694 end: v2.endCharCode 21695 })); 21696 } 21697 }; 21698 var ConstantMapGroup = class { 21699 constructor(p22) { 21700 this.startCharCode = p22.uint32; 21701 this.endCharCode = p22.uint32; 21702 this.glyphID = p22.uint32; 21703 } 21704 }; 21705 var Format14 = class extends Subtable { 21706 constructor(p22, platformID, encodingID) { 21707 super(p22, platformID, encodingID); 21708 this.subTableStart = p22.currentPosition; 21709 this.format = 14; 21710 this.length = p22.uint32; 21711 this.numVarSelectorRecords = p22.uint32; 21712 lazy$1( 21713 this, 21714 `varSelectors`, 21715 () => [...new Array(this.numVarSelectorRecords)].map( 21716 (_) => new VariationSelector(p22) 21717 ) 21718 ); 21719 } 21720 supports() { 21721 console.warn(`supports not implemented for cmap subtable format 14`); 21722 return 0; 21723 } 21724 getSupportedCharCodes() { 21725 console.warn( 21726 `getSupportedCharCodes not implemented for cmap subtable format 14` 21727 ); 21728 return []; 21729 } 21730 reverse(glyphID) { 21731 console.warn(`reverse not implemented for cmap subtable format 14`); 21732 return {}; 21733 } 21734 supportsVariation(variation) { 21735 let v2 = this.varSelector.find( 21736 (uvs) => uvs.varSelector === variation 21737 ); 21738 return v2 ? v2 : false; 21739 } 21740 getSupportedVariations() { 21741 return this.varSelectors.map((v2) => v2.varSelector); 21742 } 21743 }; 21744 var VariationSelector = class { 21745 constructor(p22) { 21746 this.varSelector = p22.uint24; 21747 this.defaultUVSOffset = p22.Offset32; 21748 this.nonDefaultUVSOffset = p22.Offset32; 21749 } 21750 }; 21751 function createSubTable(parser, platformID, encodingID) { 21752 const format = parser.uint16; 21753 if (format === 0) return new Format0(parser, platformID, encodingID); 21754 if (format === 2) return new Format2(parser, platformID, encodingID); 21755 if (format === 4) return new Format4(parser, platformID, encodingID); 21756 if (format === 6) return new Format6(parser, platformID, encodingID); 21757 if (format === 8) return new Format8(parser, platformID, encodingID); 21758 if (format === 10) return new Format10(parser, platformID, encodingID); 21759 if (format === 12) return new Format12(parser, platformID, encodingID); 21760 if (format === 13) return new Format13(parser, platformID, encodingID); 21761 if (format === 14) return new Format14(parser, platformID, encodingID); 21762 return {}; 21763 } 21764 var cmap = class extends SimpleTable { 21765 constructor(dict, dataview) { 21766 const { p: p22 } = super(dict, dataview); 21767 this.version = p22.uint16; 21768 this.numTables = p22.uint16; 21769 this.encodingRecords = [...new Array(this.numTables)].map( 21770 (_) => new EncodingRecord(p22, this.tableStart) 21771 ); 21772 } 21773 getSubTable(tableID) { 21774 return this.encodingRecords[tableID].table; 21775 } 21776 getSupportedEncodings() { 21777 return this.encodingRecords.map((r3) => ({ 21778 platformID: r3.platformID, 21779 encodingId: r3.encodingID 21780 })); 21781 } 21782 getSupportedCharCodes(platformID, encodingID) { 21783 const recordID = this.encodingRecords.findIndex( 21784 (r3) => r3.platformID === platformID && r3.encodingID === encodingID 21785 ); 21786 if (recordID === -1) return false; 21787 const subtable = this.getSubTable(recordID); 21788 return subtable.getSupportedCharCodes(); 21789 } 21790 reverse(glyphid) { 21791 for (let i2 = 0; i2 < this.numTables; i2++) { 21792 let code = this.getSubTable(i2).reverse(glyphid); 21793 if (code) return code; 21794 } 21795 } 21796 getGlyphId(char) { 21797 let last = 0; 21798 this.encodingRecords.some((_, tableID) => { 21799 let t3 = this.getSubTable(tableID); 21800 if (!t3.getGlyphId) return false; 21801 last = t3.getGlyphId(char); 21802 return last !== 0; 21803 }); 21804 return last; 21805 } 21806 supports(char) { 21807 return this.encodingRecords.some((_, tableID) => { 21808 const t3 = this.getSubTable(tableID); 21809 return t3.supports && t3.supports(char) !== false; 21810 }); 21811 } 21812 supportsVariation(variation) { 21813 return this.encodingRecords.some((_, tableID) => { 21814 const t3 = this.getSubTable(tableID); 21815 return t3.supportsVariation && t3.supportsVariation(variation) !== false; 21816 }); 21817 } 21818 }; 21819 var EncodingRecord = class { 21820 constructor(p22, tableStart) { 21821 const platformID = this.platformID = p22.uint16; 21822 const encodingID = this.encodingID = p22.uint16; 21823 const offset4 = this.offset = p22.Offset32; 21824 lazy$1(this, `table`, () => { 21825 p22.currentPosition = tableStart + offset4; 21826 return createSubTable(p22, platformID, encodingID); 21827 }); 21828 } 21829 }; 21830 var cmap$1 = Object.freeze({ __proto__: null, cmap }); 21831 var head = class extends SimpleTable { 21832 constructor(dict, dataview) { 21833 const { p: p22 } = super(dict, dataview); 21834 this.load({ 21835 majorVersion: p22.uint16, 21836 minorVersion: p22.uint16, 21837 fontRevision: p22.fixed, 21838 checkSumAdjustment: p22.uint32, 21839 magicNumber: p22.uint32, 21840 flags: p22.flags(16), 21841 unitsPerEm: p22.uint16, 21842 created: p22.longdatetime, 21843 modified: p22.longdatetime, 21844 xMin: p22.int16, 21845 yMin: p22.int16, 21846 xMax: p22.int16, 21847 yMax: p22.int16, 21848 macStyle: p22.flags(16), 21849 lowestRecPPEM: p22.uint16, 21850 fontDirectionHint: p22.uint16, 21851 indexToLocFormat: p22.uint16, 21852 glyphDataFormat: p22.uint16 21853 }); 21854 } 21855 }; 21856 var head$1 = Object.freeze({ __proto__: null, head }); 21857 var hhea = class extends SimpleTable { 21858 constructor(dict, dataview) { 21859 const { p: p22 } = super(dict, dataview); 21860 this.majorVersion = p22.uint16; 21861 this.minorVersion = p22.uint16; 21862 this.ascender = p22.fword; 21863 this.descender = p22.fword; 21864 this.lineGap = p22.fword; 21865 this.advanceWidthMax = p22.ufword; 21866 this.minLeftSideBearing = p22.fword; 21867 this.minRightSideBearing = p22.fword; 21868 this.xMaxExtent = p22.fword; 21869 this.caretSlopeRise = p22.int16; 21870 this.caretSlopeRun = p22.int16; 21871 this.caretOffset = p22.int16; 21872 p22.int16; 21873 p22.int16; 21874 p22.int16; 21875 p22.int16; 21876 this.metricDataFormat = p22.int16; 21877 this.numberOfHMetrics = p22.uint16; 21878 p22.verifyLength(); 21879 } 21880 }; 21881 var hhea$1 = Object.freeze({ __proto__: null, hhea }); 21882 var hmtx = class extends SimpleTable { 21883 constructor(dict, dataview, tables) { 21884 const { p: p22 } = super(dict, dataview); 21885 const numberOfHMetrics = tables.hhea.numberOfHMetrics; 21886 const numGlyphs = tables.maxp.numGlyphs; 21887 const metricsStart = p22.currentPosition; 21888 lazy$1(this, `hMetrics`, () => { 21889 p22.currentPosition = metricsStart; 21890 return [...new Array(numberOfHMetrics)].map( 21891 (_) => new LongHorMetric(p22.uint16, p22.int16) 21892 ); 21893 }); 21894 if (numberOfHMetrics < numGlyphs) { 21895 const lsbStart = metricsStart + numberOfHMetrics * 4; 21896 lazy$1(this, `leftSideBearings`, () => { 21897 p22.currentPosition = lsbStart; 21898 return [...new Array(numGlyphs - numberOfHMetrics)].map( 21899 (_) => p22.int16 21900 ); 21901 }); 21902 } 21903 } 21904 }; 21905 var LongHorMetric = class { 21906 constructor(w2, b2) { 21907 this.advanceWidth = w2; 21908 this.lsb = b2; 21909 } 21910 }; 21911 var hmtx$1 = Object.freeze({ __proto__: null, hmtx }); 21912 var maxp = class extends SimpleTable { 21913 constructor(dict, dataview) { 21914 const { p: p22 } = super(dict, dataview); 21915 this.version = p22.legacyFixed; 21916 this.numGlyphs = p22.uint16; 21917 if (this.version === 1) { 21918 this.maxPoints = p22.uint16; 21919 this.maxContours = p22.uint16; 21920 this.maxCompositePoints = p22.uint16; 21921 this.maxCompositeContours = p22.uint16; 21922 this.maxZones = p22.uint16; 21923 this.maxTwilightPoints = p22.uint16; 21924 this.maxStorage = p22.uint16; 21925 this.maxFunctionDefs = p22.uint16; 21926 this.maxInstructionDefs = p22.uint16; 21927 this.maxStackElements = p22.uint16; 21928 this.maxSizeOfInstructions = p22.uint16; 21929 this.maxComponentElements = p22.uint16; 21930 this.maxComponentDepth = p22.uint16; 21931 } 21932 p22.verifyLength(); 21933 } 21934 }; 21935 var maxp$1 = Object.freeze({ __proto__: null, maxp }); 21936 var name = class extends SimpleTable { 21937 constructor(dict, dataview) { 21938 const { p: p22 } = super(dict, dataview); 21939 this.format = p22.uint16; 21940 this.count = p22.uint16; 21941 this.stringOffset = p22.Offset16; 21942 this.nameRecords = [...new Array(this.count)].map( 21943 (_) => new NameRecord(p22, this) 21944 ); 21945 if (this.format === 1) { 21946 this.langTagCount = p22.uint16; 21947 this.langTagRecords = [...new Array(this.langTagCount)].map( 21948 (_) => new LangTagRecord(p22.uint16, p22.Offset16) 21949 ); 21950 } 21951 this.stringStart = this.tableStart + this.stringOffset; 21952 } 21953 get(nameID) { 21954 let record = this.nameRecords.find( 21955 (record2) => record2.nameID === nameID 21956 ); 21957 if (record) return record.string; 21958 } 21959 }; 21960 var LangTagRecord = class { 21961 constructor(length, offset4) { 21962 this.length = length; 21963 this.offset = offset4; 21964 } 21965 }; 21966 var NameRecord = class { 21967 constructor(p22, nameTable) { 21968 this.platformID = p22.uint16; 21969 this.encodingID = p22.uint16; 21970 this.languageID = p22.uint16; 21971 this.nameID = p22.uint16; 21972 this.length = p22.uint16; 21973 this.offset = p22.Offset16; 21974 lazy$1(this, `string`, () => { 21975 p22.currentPosition = nameTable.stringStart + this.offset; 21976 return decodeString(p22, this); 21977 }); 21978 } 21979 }; 21980 function decodeString(p22, record) { 21981 const { platformID, length } = record; 21982 if (length === 0) return ``; 21983 if (platformID === 0 || platformID === 3) { 21984 const str2 = []; 21985 for (let i2 = 0, e2 = length / 2; i2 < e2; i2++) 21986 str2[i2] = String.fromCharCode(p22.uint16); 21987 return str2.join(``); 21988 } 21989 const bytes = p22.readBytes(length); 21990 const str = []; 21991 bytes.forEach(function(b2, i2) { 21992 str[i2] = String.fromCharCode(b2); 21993 }); 21994 return str.join(``); 21995 } 21996 var name$1 = Object.freeze({ __proto__: null, name }); 21997 var OS2 = class extends SimpleTable { 21998 constructor(dict, dataview) { 21999 const { p: p22 } = super(dict, dataview); 22000 this.version = p22.uint16; 22001 this.xAvgCharWidth = p22.int16; 22002 this.usWeightClass = p22.uint16; 22003 this.usWidthClass = p22.uint16; 22004 this.fsType = p22.uint16; 22005 this.ySubscriptXSize = p22.int16; 22006 this.ySubscriptYSize = p22.int16; 22007 this.ySubscriptXOffset = p22.int16; 22008 this.ySubscriptYOffset = p22.int16; 22009 this.ySuperscriptXSize = p22.int16; 22010 this.ySuperscriptYSize = p22.int16; 22011 this.ySuperscriptXOffset = p22.int16; 22012 this.ySuperscriptYOffset = p22.int16; 22013 this.yStrikeoutSize = p22.int16; 22014 this.yStrikeoutPosition = p22.int16; 22015 this.sFamilyClass = p22.int16; 22016 this.panose = [...new Array(10)].map((_) => p22.uint8); 22017 this.ulUnicodeRange1 = p22.flags(32); 22018 this.ulUnicodeRange2 = p22.flags(32); 22019 this.ulUnicodeRange3 = p22.flags(32); 22020 this.ulUnicodeRange4 = p22.flags(32); 22021 this.achVendID = p22.tag; 22022 this.fsSelection = p22.uint16; 22023 this.usFirstCharIndex = p22.uint16; 22024 this.usLastCharIndex = p22.uint16; 22025 this.sTypoAscender = p22.int16; 22026 this.sTypoDescender = p22.int16; 22027 this.sTypoLineGap = p22.int16; 22028 this.usWinAscent = p22.uint16; 22029 this.usWinDescent = p22.uint16; 22030 if (this.version === 0) return p22.verifyLength(); 22031 this.ulCodePageRange1 = p22.flags(32); 22032 this.ulCodePageRange2 = p22.flags(32); 22033 if (this.version === 1) return p22.verifyLength(); 22034 this.sxHeight = p22.int16; 22035 this.sCapHeight = p22.int16; 22036 this.usDefaultChar = p22.uint16; 22037 this.usBreakChar = p22.uint16; 22038 this.usMaxContext = p22.uint16; 22039 if (this.version <= 4) return p22.verifyLength(); 22040 this.usLowerOpticalPointSize = p22.uint16; 22041 this.usUpperOpticalPointSize = p22.uint16; 22042 if (this.version === 5) return p22.verifyLength(); 22043 } 22044 }; 22045 var OS2$1 = Object.freeze({ __proto__: null, OS2 }); 22046 var post = class extends SimpleTable { 22047 constructor(dict, dataview) { 22048 const { p: p22 } = super(dict, dataview); 22049 this.version = p22.legacyFixed; 22050 this.italicAngle = p22.fixed; 22051 this.underlinePosition = p22.fword; 22052 this.underlineThickness = p22.fword; 22053 this.isFixedPitch = p22.uint32; 22054 this.minMemType42 = p22.uint32; 22055 this.maxMemType42 = p22.uint32; 22056 this.minMemType1 = p22.uint32; 22057 this.maxMemType1 = p22.uint32; 22058 if (this.version === 1 || this.version === 3) return p22.verifyLength(); 22059 this.numGlyphs = p22.uint16; 22060 if (this.version === 2) { 22061 this.glyphNameIndex = [...new Array(this.numGlyphs)].map( 22062 (_) => p22.uint16 22063 ); 22064 this.namesOffset = p22.currentPosition; 22065 this.glyphNameOffsets = [1]; 22066 for (let i2 = 0; i2 < this.numGlyphs; i2++) { 22067 let index2 = this.glyphNameIndex[i2]; 22068 if (index2 < macStrings.length) { 22069 this.glyphNameOffsets.push(this.glyphNameOffsets[i2]); 22070 continue; 22071 } 22072 let bytelength = p22.int8; 22073 p22.skip(bytelength); 22074 this.glyphNameOffsets.push( 22075 this.glyphNameOffsets[i2] + bytelength + 1 22076 ); 22077 } 22078 } 22079 if (this.version === 2.5) { 22080 this.offset = [...new Array(this.numGlyphs)].map( 22081 (_) => p22.int8 22082 ); 22083 } 22084 } 22085 getGlyphName(glyphid) { 22086 if (this.version !== 2) { 22087 console.warn( 22088 `post table version $this.version} does not support glyph name lookups` 22089 ); 22090 return ``; 22091 } 22092 let index2 = this.glyphNameIndex[glyphid]; 22093 if (index2 < 258) return macStrings[index2]; 22094 let offset4 = this.glyphNameOffsets[glyphid]; 22095 let next = this.glyphNameOffsets[glyphid + 1]; 22096 let len = next - offset4 - 1; 22097 if (len === 0) return `.notdef.`; 22098 this.parser.currentPosition = this.namesOffset + offset4; 22099 const data = this.parser.readBytes( 22100 len, 22101 this.namesOffset + offset4, 22102 8, 22103 true 22104 ); 22105 return data.map((b2) => String.fromCharCode(b2)).join(``); 22106 } 22107 }; 22108 var macStrings = [ 22109 `.notdef`, 22110 `.null`, 22111 `nonmarkingreturn`, 22112 `space`, 22113 `exclam`, 22114 `quotedbl`, 22115 `numbersign`, 22116 `dollar`, 22117 `percent`, 22118 `ampersand`, 22119 `quotesingle`, 22120 `parenleft`, 22121 `parenright`, 22122 `asterisk`, 22123 `plus`, 22124 `comma`, 22125 `hyphen`, 22126 `period`, 22127 `slash`, 22128 `zero`, 22129 `one`, 22130 `two`, 22131 `three`, 22132 `four`, 22133 `five`, 22134 `six`, 22135 `seven`, 22136 `eight`, 22137 `nine`, 22138 `colon`, 22139 `semicolon`, 22140 `less`, 22141 `equal`, 22142 `greater`, 22143 `question`, 22144 `at`, 22145 `A`, 22146 `B`, 22147 `C`, 22148 `D`, 22149 `E`, 22150 `F`, 22151 `G`, 22152 `H`, 22153 `I`, 22154 `J`, 22155 `K`, 22156 `L`, 22157 `M`, 22158 `N`, 22159 `O`, 22160 `P`, 22161 `Q`, 22162 `R`, 22163 `S`, 22164 `T`, 22165 `U`, 22166 `V`, 22167 `W`, 22168 `X`, 22169 `Y`, 22170 `Z`, 22171 `bracketleft`, 22172 `backslash`, 22173 `bracketright`, 22174 `asciicircum`, 22175 `underscore`, 22176 `grave`, 22177 `a`, 22178 `b`, 22179 `c`, 22180 `d`, 22181 `e`, 22182 `f`, 22183 `g`, 22184 `h`, 22185 `i`, 22186 `j`, 22187 `k`, 22188 `l`, 22189 `m`, 22190 `n`, 22191 `o`, 22192 `p`, 22193 `q`, 22194 `r`, 22195 `s`, 22196 `t`, 22197 `u`, 22198 `v`, 22199 `w`, 22200 `x`, 22201 `y`, 22202 `z`, 22203 `braceleft`, 22204 `bar`, 22205 `braceright`, 22206 `asciitilde`, 22207 `Adieresis`, 22208 `Aring`, 22209 `Ccedilla`, 22210 `Eacute`, 22211 `Ntilde`, 22212 `Odieresis`, 22213 `Udieresis`, 22214 `aacute`, 22215 `agrave`, 22216 `acircumflex`, 22217 `adieresis`, 22218 `atilde`, 22219 `aring`, 22220 `ccedilla`, 22221 `eacute`, 22222 `egrave`, 22223 `ecircumflex`, 22224 `edieresis`, 22225 `iacute`, 22226 `igrave`, 22227 `icircumflex`, 22228 `idieresis`, 22229 `ntilde`, 22230 `oacute`, 22231 `ograve`, 22232 `ocircumflex`, 22233 `odieresis`, 22234 `otilde`, 22235 `uacute`, 22236 `ugrave`, 22237 `ucircumflex`, 22238 `udieresis`, 22239 `dagger`, 22240 `degree`, 22241 `cent`, 22242 `sterling`, 22243 `section`, 22244 `bullet`, 22245 `paragraph`, 22246 `germandbls`, 22247 `registered`, 22248 `copyright`, 22249 `trademark`, 22250 `acute`, 22251 `dieresis`, 22252 `notequal`, 22253 `AE`, 22254 `Oslash`, 22255 `infinity`, 22256 `plusminus`, 22257 `lessequal`, 22258 `greaterequal`, 22259 `yen`, 22260 `mu`, 22261 `partialdiff`, 22262 `summation`, 22263 `product`, 22264 `pi`, 22265 `integral`, 22266 `ordfeminine`, 22267 `ordmasculine`, 22268 `Omega`, 22269 `ae`, 22270 `oslash`, 22271 `questiondown`, 22272 `exclamdown`, 22273 `logicalnot`, 22274 `radical`, 22275 `florin`, 22276 `approxequal`, 22277 `Delta`, 22278 `guillemotleft`, 22279 `guillemotright`, 22280 `ellipsis`, 22281 `nonbreakingspace`, 22282 `Agrave`, 22283 `Atilde`, 22284 `Otilde`, 22285 `OE`, 22286 `oe`, 22287 `endash`, 22288 `emdash`, 22289 `quotedblleft`, 22290 `quotedblright`, 22291 `quoteleft`, 22292 `quoteright`, 22293 `divide`, 22294 `lozenge`, 22295 `ydieresis`, 22296 `Ydieresis`, 22297 `fraction`, 22298 `currency`, 22299 `guilsinglleft`, 22300 `guilsinglright`, 22301 `fi`, 22302 `fl`, 22303 `daggerdbl`, 22304 `periodcentered`, 22305 `quotesinglbase`, 22306 `quotedblbase`, 22307 `perthousand`, 22308 `Acircumflex`, 22309 `Ecircumflex`, 22310 `Aacute`, 22311 `Edieresis`, 22312 `Egrave`, 22313 `Iacute`, 22314 `Icircumflex`, 22315 `Idieresis`, 22316 `Igrave`, 22317 `Oacute`, 22318 `Ocircumflex`, 22319 `apple`, 22320 `Ograve`, 22321 `Uacute`, 22322 `Ucircumflex`, 22323 `Ugrave`, 22324 `dotlessi`, 22325 `circumflex`, 22326 `tilde`, 22327 `macron`, 22328 `breve`, 22329 `dotaccent`, 22330 `ring`, 22331 `cedilla`, 22332 `hungarumlaut`, 22333 `ogonek`, 22334 `caron`, 22335 `Lslash`, 22336 `lslash`, 22337 `Scaron`, 22338 `scaron`, 22339 `Zcaron`, 22340 `zcaron`, 22341 `brokenbar`, 22342 `Eth`, 22343 `eth`, 22344 `Yacute`, 22345 `yacute`, 22346 `Thorn`, 22347 `thorn`, 22348 `minus`, 22349 `multiply`, 22350 `onesuperior`, 22351 `twosuperior`, 22352 `threesuperior`, 22353 `onehalf`, 22354 `onequarter`, 22355 `threequarters`, 22356 `franc`, 22357 `Gbreve`, 22358 `gbreve`, 22359 `Idotaccent`, 22360 `Scedilla`, 22361 `scedilla`, 22362 `Cacute`, 22363 `cacute`, 22364 `Ccaron`, 22365 `ccaron`, 22366 `dcroat` 22367 ]; 22368 var post$1 = Object.freeze({ __proto__: null, post }); 22369 var BASE = class extends SimpleTable { 22370 constructor(dict, dataview) { 22371 const { p: p22 } = super(dict, dataview); 22372 this.majorVersion = p22.uint16; 22373 this.minorVersion = p22.uint16; 22374 this.horizAxisOffset = p22.Offset16; 22375 this.vertAxisOffset = p22.Offset16; 22376 lazy$1( 22377 this, 22378 `horizAxis`, 22379 () => new AxisTable( 22380 { offset: dict.offset + this.horizAxisOffset }, 22381 dataview 22382 ) 22383 ); 22384 lazy$1( 22385 this, 22386 `vertAxis`, 22387 () => new AxisTable( 22388 { offset: dict.offset + this.vertAxisOffset }, 22389 dataview 22390 ) 22391 ); 22392 if (this.majorVersion === 1 && this.minorVersion === 1) { 22393 this.itemVarStoreOffset = p22.Offset32; 22394 lazy$1( 22395 this, 22396 `itemVarStore`, 22397 () => new AxisTable( 22398 { offset: dict.offset + this.itemVarStoreOffset }, 22399 dataview 22400 ) 22401 ); 22402 } 22403 } 22404 }; 22405 var AxisTable = class extends SimpleTable { 22406 constructor(dict, dataview) { 22407 const { p: p22 } = super(dict, dataview, `AxisTable`); 22408 this.baseTagListOffset = p22.Offset16; 22409 this.baseScriptListOffset = p22.Offset16; 22410 lazy$1( 22411 this, 22412 `baseTagList`, 22413 () => new BaseTagListTable( 22414 { offset: dict.offset + this.baseTagListOffset }, 22415 dataview 22416 ) 22417 ); 22418 lazy$1( 22419 this, 22420 `baseScriptList`, 22421 () => new BaseScriptListTable( 22422 { offset: dict.offset + this.baseScriptListOffset }, 22423 dataview 22424 ) 22425 ); 22426 } 22427 }; 22428 var BaseTagListTable = class extends SimpleTable { 22429 constructor(dict, dataview) { 22430 const { p: p22 } = super(dict, dataview, `BaseTagListTable`); 22431 this.baseTagCount = p22.uint16; 22432 this.baselineTags = [...new Array(this.baseTagCount)].map( 22433 (_) => p22.tag 22434 ); 22435 } 22436 }; 22437 var BaseScriptListTable = class extends SimpleTable { 22438 constructor(dict, dataview) { 22439 const { p: p22 } = super(dict, dataview, `BaseScriptListTable`); 22440 this.baseScriptCount = p22.uint16; 22441 const recordStart = p22.currentPosition; 22442 lazy$1(this, `baseScriptRecords`, () => { 22443 p22.currentPosition = recordStart; 22444 return [...new Array(this.baseScriptCount)].map( 22445 (_) => new BaseScriptRecord(this.start, p22) 22446 ); 22447 }); 22448 } 22449 }; 22450 var BaseScriptRecord = class { 22451 constructor(baseScriptListTableStart, p22) { 22452 this.baseScriptTag = p22.tag; 22453 this.baseScriptOffset = p22.Offset16; 22454 lazy$1(this, `baseScriptTable`, () => { 22455 p22.currentPosition = baseScriptListTableStart + this.baseScriptOffset; 22456 return new BaseScriptTable(p22); 22457 }); 22458 } 22459 }; 22460 var BaseScriptTable = class { 22461 constructor(p22) { 22462 this.start = p22.currentPosition; 22463 this.baseValuesOffset = p22.Offset16; 22464 this.defaultMinMaxOffset = p22.Offset16; 22465 this.baseLangSysCount = p22.uint16; 22466 this.baseLangSysRecords = [...new Array(this.baseLangSysCount)].map( 22467 (_) => new BaseLangSysRecord(this.start, p22) 22468 ); 22469 lazy$1(this, `baseValues`, () => { 22470 p22.currentPosition = this.start + this.baseValuesOffset; 22471 return new BaseValuesTable(p22); 22472 }); 22473 lazy$1(this, `defaultMinMax`, () => { 22474 p22.currentPosition = this.start + this.defaultMinMaxOffset; 22475 return new MinMaxTable(p22); 22476 }); 22477 } 22478 }; 22479 var BaseLangSysRecord = class { 22480 constructor(baseScriptTableStart, p22) { 22481 this.baseLangSysTag = p22.tag; 22482 this.minMaxOffset = p22.Offset16; 22483 lazy$1(this, `minMax`, () => { 22484 p22.currentPosition = baseScriptTableStart + this.minMaxOffset; 22485 return new MinMaxTable(p22); 22486 }); 22487 } 22488 }; 22489 var BaseValuesTable = class { 22490 constructor(p22) { 22491 this.parser = p22; 22492 this.start = p22.currentPosition; 22493 this.defaultBaselineIndex = p22.uint16; 22494 this.baseCoordCount = p22.uint16; 22495 this.baseCoords = [...new Array(this.baseCoordCount)].map( 22496 (_) => p22.Offset16 22497 ); 22498 } 22499 getTable(id) { 22500 this.parser.currentPosition = this.start + this.baseCoords[id]; 22501 return new BaseCoordTable(this.parser); 22502 } 22503 }; 22504 var MinMaxTable = class { 22505 constructor(p22) { 22506 this.minCoord = p22.Offset16; 22507 this.maxCoord = p22.Offset16; 22508 this.featMinMaxCount = p22.uint16; 22509 const recordStart = p22.currentPosition; 22510 lazy$1(this, `featMinMaxRecords`, () => { 22511 p22.currentPosition = recordStart; 22512 return [...new Array(this.featMinMaxCount)].map( 22513 (_) => new FeatMinMaxRecord(p22) 22514 ); 22515 }); 22516 } 22517 }; 22518 var FeatMinMaxRecord = class { 22519 constructor(p22) { 22520 this.featureTableTag = p22.tag; 22521 this.minCoord = p22.Offset16; 22522 this.maxCoord = p22.Offset16; 22523 } 22524 }; 22525 var BaseCoordTable = class { 22526 constructor(p22) { 22527 this.baseCoordFormat = p22.uint16; 22528 this.coordinate = p22.int16; 22529 if (this.baseCoordFormat === 2) { 22530 this.referenceGlyph = p22.uint16; 22531 this.baseCoordPoint = p22.uint16; 22532 } 22533 if (this.baseCoordFormat === 3) { 22534 this.deviceTable = p22.Offset16; 22535 } 22536 } 22537 }; 22538 var BASE$1 = Object.freeze({ __proto__: null, BASE }); 22539 var ClassDefinition = class { 22540 constructor(p22) { 22541 this.classFormat = p22.uint16; 22542 if (this.classFormat === 1) { 22543 this.startGlyphID = p22.uint16; 22544 this.glyphCount = p22.uint16; 22545 this.classValueArray = [...new Array(this.glyphCount)].map( 22546 (_) => p22.uint16 22547 ); 22548 } 22549 if (this.classFormat === 2) { 22550 this.classRangeCount = p22.uint16; 22551 this.classRangeRecords = [ 22552 ...new Array(this.classRangeCount) 22553 ].map((_) => new ClassRangeRecord(p22)); 22554 } 22555 } 22556 }; 22557 var ClassRangeRecord = class { 22558 constructor(p22) { 22559 this.startGlyphID = p22.uint16; 22560 this.endGlyphID = p22.uint16; 22561 this.class = p22.uint16; 22562 } 22563 }; 22564 var CoverageTable = class extends ParsedData { 22565 constructor(p22) { 22566 super(p22); 22567 this.coverageFormat = p22.uint16; 22568 if (this.coverageFormat === 1) { 22569 this.glyphCount = p22.uint16; 22570 this.glyphArray = [...new Array(this.glyphCount)].map( 22571 (_) => p22.uint16 22572 ); 22573 } 22574 if (this.coverageFormat === 2) { 22575 this.rangeCount = p22.uint16; 22576 this.rangeRecords = [...new Array(this.rangeCount)].map( 22577 (_) => new CoverageRangeRecord(p22) 22578 ); 22579 } 22580 } 22581 }; 22582 var CoverageRangeRecord = class { 22583 constructor(p22) { 22584 this.startGlyphID = p22.uint16; 22585 this.endGlyphID = p22.uint16; 22586 this.startCoverageIndex = p22.uint16; 22587 } 22588 }; 22589 var ItemVariationStoreTable = class { 22590 constructor(table, p22) { 22591 this.table = table; 22592 this.parser = p22; 22593 this.start = p22.currentPosition; 22594 this.format = p22.uint16; 22595 this.variationRegionListOffset = p22.Offset32; 22596 this.itemVariationDataCount = p22.uint16; 22597 this.itemVariationDataOffsets = [ 22598 ...new Array(this.itemVariationDataCount) 22599 ].map((_) => p22.Offset32); 22600 } 22601 }; 22602 var GDEF = class extends SimpleTable { 22603 constructor(dict, dataview) { 22604 const { p: p22 } = super(dict, dataview); 22605 this.majorVersion = p22.uint16; 22606 this.minorVersion = p22.uint16; 22607 this.glyphClassDefOffset = p22.Offset16; 22608 lazy$1(this, `glyphClassDefs`, () => { 22609 if (this.glyphClassDefOffset === 0) return void 0; 22610 p22.currentPosition = this.tableStart + this.glyphClassDefOffset; 22611 return new ClassDefinition(p22); 22612 }); 22613 this.attachListOffset = p22.Offset16; 22614 lazy$1(this, `attachList`, () => { 22615 if (this.attachListOffset === 0) return void 0; 22616 p22.currentPosition = this.tableStart + this.attachListOffset; 22617 return new AttachList(p22); 22618 }); 22619 this.ligCaretListOffset = p22.Offset16; 22620 lazy$1(this, `ligCaretList`, () => { 22621 if (this.ligCaretListOffset === 0) return void 0; 22622 p22.currentPosition = this.tableStart + this.ligCaretListOffset; 22623 return new LigCaretList(p22); 22624 }); 22625 this.markAttachClassDefOffset = p22.Offset16; 22626 lazy$1(this, `markAttachClassDef`, () => { 22627 if (this.markAttachClassDefOffset === 0) return void 0; 22628 p22.currentPosition = this.tableStart + this.markAttachClassDefOffset; 22629 return new ClassDefinition(p22); 22630 }); 22631 if (this.minorVersion >= 2) { 22632 this.markGlyphSetsDefOffset = p22.Offset16; 22633 lazy$1(this, `markGlyphSetsDef`, () => { 22634 if (this.markGlyphSetsDefOffset === 0) return void 0; 22635 p22.currentPosition = this.tableStart + this.markGlyphSetsDefOffset; 22636 return new MarkGlyphSetsTable(p22); 22637 }); 22638 } 22639 if (this.minorVersion === 3) { 22640 this.itemVarStoreOffset = p22.Offset32; 22641 lazy$1(this, `itemVarStore`, () => { 22642 if (this.itemVarStoreOffset === 0) return void 0; 22643 p22.currentPosition = this.tableStart + this.itemVarStoreOffset; 22644 return new ItemVariationStoreTable(p22); 22645 }); 22646 } 22647 } 22648 }; 22649 var AttachList = class extends ParsedData { 22650 constructor(p22) { 22651 super(p22); 22652 this.coverageOffset = p22.Offset16; 22653 this.glyphCount = p22.uint16; 22654 this.attachPointOffsets = [...new Array(this.glyphCount)].map( 22655 (_) => p22.Offset16 22656 ); 22657 } 22658 getPoint(pointID) { 22659 this.parser.currentPosition = this.start + this.attachPointOffsets[pointID]; 22660 return new AttachPoint(this.parser); 22661 } 22662 }; 22663 var AttachPoint = class { 22664 constructor(p22) { 22665 this.pointCount = p22.uint16; 22666 this.pointIndices = [...new Array(this.pointCount)].map( 22667 (_) => p22.uint16 22668 ); 22669 } 22670 }; 22671 var LigCaretList = class extends ParsedData { 22672 constructor(p22) { 22673 super(p22); 22674 this.coverageOffset = p22.Offset16; 22675 lazy$1(this, `coverage`, () => { 22676 p22.currentPosition = this.start + this.coverageOffset; 22677 return new CoverageTable(p22); 22678 }); 22679 this.ligGlyphCount = p22.uint16; 22680 this.ligGlyphOffsets = [...new Array(this.ligGlyphCount)].map( 22681 (_) => p22.Offset16 22682 ); 22683 } 22684 getLigGlyph(ligGlyphID) { 22685 this.parser.currentPosition = this.start + this.ligGlyphOffsets[ligGlyphID]; 22686 return new LigGlyph(this.parser); 22687 } 22688 }; 22689 var LigGlyph = class extends ParsedData { 22690 constructor(p22) { 22691 super(p22); 22692 this.caretCount = p22.uint16; 22693 this.caretValueOffsets = [...new Array(this.caretCount)].map( 22694 (_) => p22.Offset16 22695 ); 22696 } 22697 getCaretValue(caretID) { 22698 this.parser.currentPosition = this.start + this.caretValueOffsets[caretID]; 22699 return new CaretValue(this.parser); 22700 } 22701 }; 22702 var CaretValue = class { 22703 constructor(p22) { 22704 this.caretValueFormat = p22.uint16; 22705 if (this.caretValueFormat === 1) { 22706 this.coordinate = p22.int16; 22707 } 22708 if (this.caretValueFormat === 2) { 22709 this.caretValuePointIndex = p22.uint16; 22710 } 22711 if (this.caretValueFormat === 3) { 22712 this.coordinate = p22.int16; 22713 this.deviceOffset = p22.Offset16; 22714 } 22715 } 22716 }; 22717 var MarkGlyphSetsTable = class extends ParsedData { 22718 constructor(p22) { 22719 super(p22); 22720 this.markGlyphSetTableFormat = p22.uint16; 22721 this.markGlyphSetCount = p22.uint16; 22722 this.coverageOffsets = [...new Array(this.markGlyphSetCount)].map( 22723 (_) => p22.Offset32 22724 ); 22725 } 22726 getMarkGlyphSet(markGlyphSetID) { 22727 this.parser.currentPosition = this.start + this.coverageOffsets[markGlyphSetID]; 22728 return new CoverageTable(this.parser); 22729 } 22730 }; 22731 var GDEF$1 = Object.freeze({ __proto__: null, GDEF }); 22732 var ScriptList = class extends ParsedData { 22733 static EMPTY = { scriptCount: 0, scriptRecords: [] }; 22734 constructor(p22) { 22735 super(p22); 22736 this.scriptCount = p22.uint16; 22737 this.scriptRecords = [...new Array(this.scriptCount)].map( 22738 (_) => new ScriptRecord(p22) 22739 ); 22740 } 22741 }; 22742 var ScriptRecord = class { 22743 constructor(p22) { 22744 this.scriptTag = p22.tag; 22745 this.scriptOffset = p22.Offset16; 22746 } 22747 }; 22748 var ScriptTable = class extends ParsedData { 22749 constructor(p22) { 22750 super(p22); 22751 this.defaultLangSys = p22.Offset16; 22752 this.langSysCount = p22.uint16; 22753 this.langSysRecords = [...new Array(this.langSysCount)].map( 22754 (_) => new LangSysRecord(p22) 22755 ); 22756 } 22757 }; 22758 var LangSysRecord = class { 22759 constructor(p22) { 22760 this.langSysTag = p22.tag; 22761 this.langSysOffset = p22.Offset16; 22762 } 22763 }; 22764 var LangSysTable = class { 22765 constructor(p22) { 22766 this.lookupOrder = p22.Offset16; 22767 this.requiredFeatureIndex = p22.uint16; 22768 this.featureIndexCount = p22.uint16; 22769 this.featureIndices = [...new Array(this.featureIndexCount)].map( 22770 (_) => p22.uint16 22771 ); 22772 } 22773 }; 22774 var FeatureList = class extends ParsedData { 22775 static EMPTY = { featureCount: 0, featureRecords: [] }; 22776 constructor(p22) { 22777 super(p22); 22778 this.featureCount = p22.uint16; 22779 this.featureRecords = [...new Array(this.featureCount)].map( 22780 (_) => new FeatureRecord(p22) 22781 ); 22782 } 22783 }; 22784 var FeatureRecord = class { 22785 constructor(p22) { 22786 this.featureTag = p22.tag; 22787 this.featureOffset = p22.Offset16; 22788 } 22789 }; 22790 var FeatureTable = class extends ParsedData { 22791 constructor(p22) { 22792 super(p22); 22793 this.featureParams = p22.Offset16; 22794 this.lookupIndexCount = p22.uint16; 22795 this.lookupListIndices = [...new Array(this.lookupIndexCount)].map( 22796 (_) => p22.uint16 22797 ); 22798 } 22799 getFeatureParams() { 22800 if (this.featureParams > 0) { 22801 const p22 = this.parser; 22802 p22.currentPosition = this.start + this.featureParams; 22803 const tag = this.featureTag; 22804 if (tag === `size`) return new Size(p22); 22805 if (tag.startsWith(`cc`)) return new CharacterVariant(p22); 22806 if (tag.startsWith(`ss`)) return new StylisticSet(p22); 22807 } 22808 } 22809 }; 22810 var CharacterVariant = class { 22811 constructor(p22) { 22812 this.format = p22.uint16; 22813 this.featUiLabelNameId = p22.uint16; 22814 this.featUiTooltipTextNameId = p22.uint16; 22815 this.sampleTextNameId = p22.uint16; 22816 this.numNamedParameters = p22.uint16; 22817 this.firstParamUiLabelNameId = p22.uint16; 22818 this.charCount = p22.uint16; 22819 this.character = [...new Array(this.charCount)].map( 22820 (_) => p22.uint24 22821 ); 22822 } 22823 }; 22824 var Size = class { 22825 constructor(p22) { 22826 this.designSize = p22.uint16; 22827 this.subfamilyIdentifier = p22.uint16; 22828 this.subfamilyNameID = p22.uint16; 22829 this.smallEnd = p22.uint16; 22830 this.largeEnd = p22.uint16; 22831 } 22832 }; 22833 var StylisticSet = class { 22834 constructor(p22) { 22835 this.version = p22.uint16; 22836 this.UINameID = p22.uint16; 22837 } 22838 }; 22839 function undoCoverageOffsetParsing(instance) { 22840 instance.parser.currentPosition -= 2; 22841 delete instance.coverageOffset; 22842 delete instance.getCoverageTable; 22843 } 22844 var LookupType$1 = class extends ParsedData { 22845 constructor(p22) { 22846 super(p22); 22847 this.substFormat = p22.uint16; 22848 this.coverageOffset = p22.Offset16; 22849 } 22850 getCoverageTable() { 22851 let p22 = this.parser; 22852 p22.currentPosition = this.start + this.coverageOffset; 22853 return new CoverageTable(p22); 22854 } 22855 }; 22856 var SubstLookupRecord = class { 22857 constructor(p22) { 22858 this.glyphSequenceIndex = p22.uint16; 22859 this.lookupListIndex = p22.uint16; 22860 } 22861 }; 22862 var LookupType1$1 = class extends LookupType$1 { 22863 constructor(p22) { 22864 super(p22); 22865 this.deltaGlyphID = p22.int16; 22866 } 22867 }; 22868 var LookupType2$1 = class extends LookupType$1 { 22869 constructor(p22) { 22870 super(p22); 22871 this.sequenceCount = p22.uint16; 22872 this.sequenceOffsets = [...new Array(this.sequenceCount)].map( 22873 (_) => p22.Offset16 22874 ); 22875 } 22876 getSequence(index2) { 22877 let p22 = this.parser; 22878 p22.currentPosition = this.start + this.sequenceOffsets[index2]; 22879 return new SequenceTable(p22); 22880 } 22881 }; 22882 var SequenceTable = class { 22883 constructor(p22) { 22884 this.glyphCount = p22.uint16; 22885 this.substituteGlyphIDs = [...new Array(this.glyphCount)].map( 22886 (_) => p22.uint16 22887 ); 22888 } 22889 }; 22890 var LookupType3$1 = class extends LookupType$1 { 22891 constructor(p22) { 22892 super(p22); 22893 this.alternateSetCount = p22.uint16; 22894 this.alternateSetOffsets = [ 22895 ...new Array(this.alternateSetCount) 22896 ].map((_) => p22.Offset16); 22897 } 22898 getAlternateSet(index2) { 22899 let p22 = this.parser; 22900 p22.currentPosition = this.start + this.alternateSetOffsets[index2]; 22901 return new AlternateSetTable(p22); 22902 } 22903 }; 22904 var AlternateSetTable = class { 22905 constructor(p22) { 22906 this.glyphCount = p22.uint16; 22907 this.alternateGlyphIDs = [...new Array(this.glyphCount)].map( 22908 (_) => p22.uint16 22909 ); 22910 } 22911 }; 22912 var LookupType4$1 = class extends LookupType$1 { 22913 constructor(p22) { 22914 super(p22); 22915 this.ligatureSetCount = p22.uint16; 22916 this.ligatureSetOffsets = [...new Array(this.ligatureSetCount)].map( 22917 (_) => p22.Offset16 22918 ); 22919 } 22920 getLigatureSet(index2) { 22921 let p22 = this.parser; 22922 p22.currentPosition = this.start + this.ligatureSetOffsets[index2]; 22923 return new LigatureSetTable(p22); 22924 } 22925 }; 22926 var LigatureSetTable = class extends ParsedData { 22927 constructor(p22) { 22928 super(p22); 22929 this.ligatureCount = p22.uint16; 22930 this.ligatureOffsets = [...new Array(this.ligatureCount)].map( 22931 (_) => p22.Offset16 22932 ); 22933 } 22934 getLigature(index2) { 22935 let p22 = this.parser; 22936 p22.currentPosition = this.start + this.ligatureOffsets[index2]; 22937 return new LigatureTable(p22); 22938 } 22939 }; 22940 var LigatureTable = class { 22941 constructor(p22) { 22942 this.ligatureGlyph = p22.uint16; 22943 this.componentCount = p22.uint16; 22944 this.componentGlyphIDs = [ 22945 ...new Array(this.componentCount - 1) 22946 ].map((_) => p22.uint16); 22947 } 22948 }; 22949 var LookupType5$1 = class extends LookupType$1 { 22950 constructor(p22) { 22951 super(p22); 22952 if (this.substFormat === 1) { 22953 this.subRuleSetCount = p22.uint16; 22954 this.subRuleSetOffsets = [ 22955 ...new Array(this.subRuleSetCount) 22956 ].map((_) => p22.Offset16); 22957 } 22958 if (this.substFormat === 2) { 22959 this.classDefOffset = p22.Offset16; 22960 this.subClassSetCount = p22.uint16; 22961 this.subClassSetOffsets = [ 22962 ...new Array(this.subClassSetCount) 22963 ].map((_) => p22.Offset16); 22964 } 22965 if (this.substFormat === 3) { 22966 undoCoverageOffsetParsing(this); 22967 this.glyphCount = p22.uint16; 22968 this.substitutionCount = p22.uint16; 22969 this.coverageOffsets = [...new Array(this.glyphCount)].map( 22970 (_) => p22.Offset16 22971 ); 22972 this.substLookupRecords = [ 22973 ...new Array(this.substitutionCount) 22974 ].map((_) => new SubstLookupRecord(p22)); 22975 } 22976 } 22977 getSubRuleSet(index2) { 22978 if (this.substFormat !== 1) 22979 throw new Error( 22980 `lookup type 5.$this.substFormat} has no subrule sets.` 22981 ); 22982 let p22 = this.parser; 22983 p22.currentPosition = this.start + this.subRuleSetOffsets[index2]; 22984 return new SubRuleSetTable(p22); 22985 } 22986 getSubClassSet(index2) { 22987 if (this.substFormat !== 2) 22988 throw new Error( 22989 `lookup type 5.$this.substFormat} has no subclass sets.` 22990 ); 22991 let p22 = this.parser; 22992 p22.currentPosition = this.start + this.subClassSetOffsets[index2]; 22993 return new SubClassSetTable(p22); 22994 } 22995 getCoverageTable(index2) { 22996 if (this.substFormat !== 3 && !index2) 22997 return super.getCoverageTable(); 22998 if (!index2) 22999 throw new Error( 23000 `lookup type 5.$this.substFormat} requires an coverage table index.` 23001 ); 23002 let p22 = this.parser; 23003 p22.currentPosition = this.start + this.coverageOffsets[index2]; 23004 return new CoverageTable(p22); 23005 } 23006 }; 23007 var SubRuleSetTable = class extends ParsedData { 23008 constructor(p22) { 23009 super(p22); 23010 this.subRuleCount = p22.uint16; 23011 this.subRuleOffsets = [...new Array(this.subRuleCount)].map( 23012 (_) => p22.Offset16 23013 ); 23014 } 23015 getSubRule(index2) { 23016 let p22 = this.parser; 23017 p22.currentPosition = this.start + this.subRuleOffsets[index2]; 23018 return new SubRuleTable(p22); 23019 } 23020 }; 23021 var SubRuleTable = class { 23022 constructor(p22) { 23023 this.glyphCount = p22.uint16; 23024 this.substitutionCount = p22.uint16; 23025 this.inputSequence = [...new Array(this.glyphCount - 1)].map( 23026 (_) => p22.uint16 23027 ); 23028 this.substLookupRecords = [ 23029 ...new Array(this.substitutionCount) 23030 ].map((_) => new SubstLookupRecord(p22)); 23031 } 23032 }; 23033 var SubClassSetTable = class extends ParsedData { 23034 constructor(p22) { 23035 super(p22); 23036 this.subClassRuleCount = p22.uint16; 23037 this.subClassRuleOffsets = [ 23038 ...new Array(this.subClassRuleCount) 23039 ].map((_) => p22.Offset16); 23040 } 23041 getSubClass(index2) { 23042 let p22 = this.parser; 23043 p22.currentPosition = this.start + this.subClassRuleOffsets[index2]; 23044 return new SubClassRuleTable(p22); 23045 } 23046 }; 23047 var SubClassRuleTable = class extends SubRuleTable { 23048 constructor(p22) { 23049 super(p22); 23050 } 23051 }; 23052 var LookupType6$1 = class extends LookupType$1 { 23053 constructor(p22) { 23054 super(p22); 23055 if (this.substFormat === 1) { 23056 this.chainSubRuleSetCount = p22.uint16; 23057 this.chainSubRuleSetOffsets = [ 23058 ...new Array(this.chainSubRuleSetCount) 23059 ].map((_) => p22.Offset16); 23060 } 23061 if (this.substFormat === 2) { 23062 this.backtrackClassDefOffset = p22.Offset16; 23063 this.inputClassDefOffset = p22.Offset16; 23064 this.lookaheadClassDefOffset = p22.Offset16; 23065 this.chainSubClassSetCount = p22.uint16; 23066 this.chainSubClassSetOffsets = [ 23067 ...new Array(this.chainSubClassSetCount) 23068 ].map((_) => p22.Offset16); 23069 } 23070 if (this.substFormat === 3) { 23071 undoCoverageOffsetParsing(this); 23072 this.backtrackGlyphCount = p22.uint16; 23073 this.backtrackCoverageOffsets = [ 23074 ...new Array(this.backtrackGlyphCount) 23075 ].map((_) => p22.Offset16); 23076 this.inputGlyphCount = p22.uint16; 23077 this.inputCoverageOffsets = [ 23078 ...new Array(this.inputGlyphCount) 23079 ].map((_) => p22.Offset16); 23080 this.lookaheadGlyphCount = p22.uint16; 23081 this.lookaheadCoverageOffsets = [ 23082 ...new Array(this.lookaheadGlyphCount) 23083 ].map((_) => p22.Offset16); 23084 this.seqLookupCount = p22.uint16; 23085 this.seqLookupRecords = [ 23086 ...new Array(this.substitutionCount) 23087 ].map((_) => new SequenceLookupRecord(p22)); 23088 } 23089 } 23090 getChainSubRuleSet(index2) { 23091 if (this.substFormat !== 1) 23092 throw new Error( 23093 `lookup type 6.$this.substFormat} has no chainsubrule sets.` 23094 ); 23095 let p22 = this.parser; 23096 p22.currentPosition = this.start + this.chainSubRuleSetOffsets[index2]; 23097 return new ChainSubRuleSetTable(p22); 23098 } 23099 getChainSubClassSet(index2) { 23100 if (this.substFormat !== 2) 23101 throw new Error( 23102 `lookup type 6.$this.substFormat} has no chainsubclass sets.` 23103 ); 23104 let p22 = this.parser; 23105 p22.currentPosition = this.start + this.chainSubClassSetOffsets[index2]; 23106 return new ChainSubClassSetTable(p22); 23107 } 23108 getCoverageFromOffset(offset4) { 23109 if (this.substFormat !== 3) 23110 throw new Error( 23111 `lookup type 6.$this.substFormat} does not use contextual coverage offsets.` 23112 ); 23113 let p22 = this.parser; 23114 p22.currentPosition = this.start + offset4; 23115 return new CoverageTable(p22); 23116 } 23117 }; 23118 var ChainSubRuleSetTable = class extends ParsedData { 23119 constructor(p22) { 23120 super(p22); 23121 this.chainSubRuleCount = p22.uint16; 23122 this.chainSubRuleOffsets = [ 23123 ...new Array(this.chainSubRuleCount) 23124 ].map((_) => p22.Offset16); 23125 } 23126 getSubRule(index2) { 23127 let p22 = this.parser; 23128 p22.currentPosition = this.start + this.chainSubRuleOffsets[index2]; 23129 return new ChainSubRuleTable(p22); 23130 } 23131 }; 23132 var ChainSubRuleTable = class { 23133 constructor(p22) { 23134 this.backtrackGlyphCount = p22.uint16; 23135 this.backtrackSequence = [ 23136 ...new Array(this.backtrackGlyphCount) 23137 ].map((_) => p22.uint16); 23138 this.inputGlyphCount = p22.uint16; 23139 this.inputSequence = [...new Array(this.inputGlyphCount - 1)].map( 23140 (_) => p22.uint16 23141 ); 23142 this.lookaheadGlyphCount = p22.uint16; 23143 this.lookAheadSequence = [ 23144 ...new Array(this.lookAheadGlyphCount) 23145 ].map((_) => p22.uint16); 23146 this.substitutionCount = p22.uint16; 23147 this.substLookupRecords = [...new Array(this.SubstCount)].map( 23148 (_) => new SubstLookupRecord(p22) 23149 ); 23150 } 23151 }; 23152 var ChainSubClassSetTable = class extends ParsedData { 23153 constructor(p22) { 23154 super(p22); 23155 this.chainSubClassRuleCount = p22.uint16; 23156 this.chainSubClassRuleOffsets = [ 23157 ...new Array(this.chainSubClassRuleCount) 23158 ].map((_) => p22.Offset16); 23159 } 23160 getSubClass(index2) { 23161 let p22 = this.parser; 23162 p22.currentPosition = this.start + this.chainSubRuleOffsets[index2]; 23163 return new ChainSubClassRuleTable(p22); 23164 } 23165 }; 23166 var ChainSubClassRuleTable = class { 23167 constructor(p22) { 23168 this.backtrackGlyphCount = p22.uint16; 23169 this.backtrackSequence = [ 23170 ...new Array(this.backtrackGlyphCount) 23171 ].map((_) => p22.uint16); 23172 this.inputGlyphCount = p22.uint16; 23173 this.inputSequence = [...new Array(this.inputGlyphCount - 1)].map( 23174 (_) => p22.uint16 23175 ); 23176 this.lookaheadGlyphCount = p22.uint16; 23177 this.lookAheadSequence = [ 23178 ...new Array(this.lookAheadGlyphCount) 23179 ].map((_) => p22.uint16); 23180 this.substitutionCount = p22.uint16; 23181 this.substLookupRecords = [ 23182 ...new Array(this.substitutionCount) 23183 ].map((_) => new SequenceLookupRecord(p22)); 23184 } 23185 }; 23186 var SequenceLookupRecord = class extends ParsedData { 23187 constructor(p22) { 23188 super(p22); 23189 this.sequenceIndex = p22.uint16; 23190 this.lookupListIndex = p22.uint16; 23191 } 23192 }; 23193 var LookupType7$1 = class extends ParsedData { 23194 constructor(p22) { 23195 super(p22); 23196 this.substFormat = p22.uint16; 23197 this.extensionLookupType = p22.uint16; 23198 this.extensionOffset = p22.Offset32; 23199 } 23200 }; 23201 var LookupType8$1 = class extends LookupType$1 { 23202 constructor(p22) { 23203 super(p22); 23204 this.backtrackGlyphCount = p22.uint16; 23205 this.backtrackCoverageOffsets = [ 23206 ...new Array(this.backtrackGlyphCount) 23207 ].map((_) => p22.Offset16); 23208 this.lookaheadGlyphCount = p22.uint16; 23209 this.lookaheadCoverageOffsets = [ 23210 new Array(this.lookaheadGlyphCount) 23211 ].map((_) => p22.Offset16); 23212 this.glyphCount = p22.uint16; 23213 this.substituteGlyphIDs = [...new Array(this.glyphCount)].map( 23214 (_) => p22.uint16 23215 ); 23216 } 23217 }; 23218 var GSUBtables = { 23219 buildSubtable: function(type, p22) { 23220 const subtable = new [ 23221 void 0, 23222 LookupType1$1, 23223 LookupType2$1, 23224 LookupType3$1, 23225 LookupType4$1, 23226 LookupType5$1, 23227 LookupType6$1, 23228 LookupType7$1, 23229 LookupType8$1 23230 ][type](p22); 23231 subtable.type = type; 23232 return subtable; 23233 } 23234 }; 23235 var LookupType = class extends ParsedData { 23236 constructor(p22) { 23237 super(p22); 23238 } 23239 }; 23240 var LookupType1 = class extends LookupType { 23241 constructor(p22) { 23242 super(p22); 23243 console.log(`lookup type 1`); 23244 } 23245 }; 23246 var LookupType2 = class extends LookupType { 23247 constructor(p22) { 23248 super(p22); 23249 console.log(`lookup type 2`); 23250 } 23251 }; 23252 var LookupType3 = class extends LookupType { 23253 constructor(p22) { 23254 super(p22); 23255 console.log(`lookup type 3`); 23256 } 23257 }; 23258 var LookupType4 = class extends LookupType { 23259 constructor(p22) { 23260 super(p22); 23261 console.log(`lookup type 4`); 23262 } 23263 }; 23264 var LookupType5 = class extends LookupType { 23265 constructor(p22) { 23266 super(p22); 23267 console.log(`lookup type 5`); 23268 } 23269 }; 23270 var LookupType6 = class extends LookupType { 23271 constructor(p22) { 23272 super(p22); 23273 console.log(`lookup type 6`); 23274 } 23275 }; 23276 var LookupType7 = class extends LookupType { 23277 constructor(p22) { 23278 super(p22); 23279 console.log(`lookup type 7`); 23280 } 23281 }; 23282 var LookupType8 = class extends LookupType { 23283 constructor(p22) { 23284 super(p22); 23285 console.log(`lookup type 8`); 23286 } 23287 }; 23288 var LookupType9 = class extends LookupType { 23289 constructor(p22) { 23290 super(p22); 23291 console.log(`lookup type 9`); 23292 } 23293 }; 23294 var GPOStables = { 23295 buildSubtable: function(type, p22) { 23296 const subtable = new [ 23297 void 0, 23298 LookupType1, 23299 LookupType2, 23300 LookupType3, 23301 LookupType4, 23302 LookupType5, 23303 LookupType6, 23304 LookupType7, 23305 LookupType8, 23306 LookupType9 23307 ][type](p22); 23308 subtable.type = type; 23309 return subtable; 23310 } 23311 }; 23312 var LookupList = class extends ParsedData { 23313 static EMPTY = { lookupCount: 0, lookups: [] }; 23314 constructor(p22) { 23315 super(p22); 23316 this.lookupCount = p22.uint16; 23317 this.lookups = [...new Array(this.lookupCount)].map( 23318 (_) => p22.Offset16 23319 ); 23320 } 23321 }; 23322 var LookupTable = class extends ParsedData { 23323 constructor(p22, type) { 23324 super(p22); 23325 this.ctType = type; 23326 this.lookupType = p22.uint16; 23327 this.lookupFlag = p22.uint16; 23328 this.subTableCount = p22.uint16; 23329 this.subtableOffsets = [...new Array(this.subTableCount)].map( 23330 (_) => p22.Offset16 23331 ); 23332 this.markFilteringSet = p22.uint16; 23333 } 23334 get rightToLeft() { 23335 return this.lookupFlag & true; 23336 } 23337 get ignoreBaseGlyphs() { 23338 return this.lookupFlag & true; 23339 } 23340 get ignoreLigatures() { 23341 return this.lookupFlag & true; 23342 } 23343 get ignoreMarks() { 23344 return this.lookupFlag & true; 23345 } 23346 get useMarkFilteringSet() { 23347 return this.lookupFlag & true; 23348 } 23349 get markAttachmentType() { 23350 return this.lookupFlag & true; 23351 } 23352 getSubTable(index2) { 23353 const builder = this.ctType === `GSUB` ? GSUBtables : GPOStables; 23354 this.parser.currentPosition = this.start + this.subtableOffsets[index2]; 23355 return builder.buildSubtable(this.lookupType, this.parser); 23356 } 23357 }; 23358 var CommonLayoutTable = class extends SimpleTable { 23359 constructor(dict, dataview, name2) { 23360 const { p: p22, tableStart } = super(dict, dataview, name2); 23361 this.majorVersion = p22.uint16; 23362 this.minorVersion = p22.uint16; 23363 this.scriptListOffset = p22.Offset16; 23364 this.featureListOffset = p22.Offset16; 23365 this.lookupListOffset = p22.Offset16; 23366 if (this.majorVersion === 1 && this.minorVersion === 1) { 23367 this.featureVariationsOffset = p22.Offset32; 23368 } 23369 const no_content = !(this.scriptListOffset || this.featureListOffset || this.lookupListOffset); 23370 lazy$1(this, `scriptList`, () => { 23371 if (no_content) return ScriptList.EMPTY; 23372 p22.currentPosition = tableStart + this.scriptListOffset; 23373 return new ScriptList(p22); 23374 }); 23375 lazy$1(this, `featureList`, () => { 23376 if (no_content) return FeatureList.EMPTY; 23377 p22.currentPosition = tableStart + this.featureListOffset; 23378 return new FeatureList(p22); 23379 }); 23380 lazy$1(this, `lookupList`, () => { 23381 if (no_content) return LookupList.EMPTY; 23382 p22.currentPosition = tableStart + this.lookupListOffset; 23383 return new LookupList(p22); 23384 }); 23385 if (this.featureVariationsOffset) { 23386 lazy$1(this, `featureVariations`, () => { 23387 if (no_content) return FeatureVariations.EMPTY; 23388 p22.currentPosition = tableStart + this.featureVariationsOffset; 23389 return new FeatureVariations(p22); 23390 }); 23391 } 23392 } 23393 getSupportedScripts() { 23394 return this.scriptList.scriptRecords.map((r3) => r3.scriptTag); 23395 } 23396 getScriptTable(scriptTag) { 23397 let record = this.scriptList.scriptRecords.find( 23398 (r3) => r3.scriptTag === scriptTag 23399 ); 23400 this.parser.currentPosition = this.scriptList.start + record.scriptOffset; 23401 let table = new ScriptTable(this.parser); 23402 table.scriptTag = scriptTag; 23403 return table; 23404 } 23405 ensureScriptTable(arg) { 23406 if (typeof arg === "string") { 23407 return this.getScriptTable(arg); 23408 } 23409 return arg; 23410 } 23411 getSupportedLangSys(scriptTable) { 23412 scriptTable = this.ensureScriptTable(scriptTable); 23413 const hasDefault = scriptTable.defaultLangSys !== 0; 23414 const supported = scriptTable.langSysRecords.map( 23415 (l2) => l2.langSysTag 23416 ); 23417 if (hasDefault) supported.unshift(`dflt`); 23418 return supported; 23419 } 23420 getDefaultLangSysTable(scriptTable) { 23421 scriptTable = this.ensureScriptTable(scriptTable); 23422 let offset4 = scriptTable.defaultLangSys; 23423 if (offset4 !== 0) { 23424 this.parser.currentPosition = scriptTable.start + offset4; 23425 let table = new LangSysTable(this.parser); 23426 table.langSysTag = ``; 23427 table.defaultForScript = scriptTable.scriptTag; 23428 return table; 23429 } 23430 } 23431 getLangSysTable(scriptTable, langSysTag = `dflt`) { 23432 if (langSysTag === `dflt`) 23433 return this.getDefaultLangSysTable(scriptTable); 23434 scriptTable = this.ensureScriptTable(scriptTable); 23435 let record = scriptTable.langSysRecords.find( 23436 (l2) => l2.langSysTag === langSysTag 23437 ); 23438 this.parser.currentPosition = scriptTable.start + record.langSysOffset; 23439 let table = new LangSysTable(this.parser); 23440 table.langSysTag = langSysTag; 23441 return table; 23442 } 23443 getFeatures(langSysTable) { 23444 return langSysTable.featureIndices.map( 23445 (index2) => this.getFeature(index2) 23446 ); 23447 } 23448 getFeature(indexOrTag) { 23449 let record; 23450 if (parseInt(indexOrTag) == indexOrTag) { 23451 record = this.featureList.featureRecords[indexOrTag]; 23452 } else { 23453 record = this.featureList.featureRecords.find( 23454 (f2) => f2.featureTag === indexOrTag 23455 ); 23456 } 23457 if (!record) return; 23458 this.parser.currentPosition = this.featureList.start + record.featureOffset; 23459 let table = new FeatureTable(this.parser); 23460 table.featureTag = record.featureTag; 23461 return table; 23462 } 23463 getLookups(featureTable) { 23464 return featureTable.lookupListIndices.map( 23465 (index2) => this.getLookup(index2) 23466 ); 23467 } 23468 getLookup(lookupIndex, type) { 23469 let lookupOffset = this.lookupList.lookups[lookupIndex]; 23470 this.parser.currentPosition = this.lookupList.start + lookupOffset; 23471 return new LookupTable(this.parser, type); 23472 } 23473 }; 23474 var GSUB = class extends CommonLayoutTable { 23475 constructor(dict, dataview) { 23476 super(dict, dataview, `GSUB`); 23477 } 23478 getLookup(lookupIndex) { 23479 return super.getLookup(lookupIndex, `GSUB`); 23480 } 23481 }; 23482 var GSUB$1 = Object.freeze({ __proto__: null, GSUB }); 23483 var GPOS = class extends CommonLayoutTable { 23484 constructor(dict, dataview) { 23485 super(dict, dataview, `GPOS`); 23486 } 23487 getLookup(lookupIndex) { 23488 return super.getLookup(lookupIndex, `GPOS`); 23489 } 23490 }; 23491 var GPOS$1 = Object.freeze({ __proto__: null, GPOS }); 23492 var SVG6 = class extends SimpleTable { 23493 constructor(dict, dataview) { 23494 const { p: p22 } = super(dict, dataview); 23495 this.version = p22.uint16; 23496 this.offsetToSVGDocumentList = p22.Offset32; 23497 p22.currentPosition = this.tableStart + this.offsetToSVGDocumentList; 23498 this.documentList = new SVGDocumentList(p22); 23499 } 23500 }; 23501 var SVGDocumentList = class extends ParsedData { 23502 constructor(p22) { 23503 super(p22); 23504 this.numEntries = p22.uint16; 23505 this.documentRecords = [...new Array(this.numEntries)].map( 23506 (_) => new SVGDocumentRecord(p22) 23507 ); 23508 } 23509 getDocument(documentID) { 23510 let record = this.documentRecords[documentID]; 23511 if (!record) return ""; 23512 let offset4 = this.start + record.svgDocOffset; 23513 this.parser.currentPosition = offset4; 23514 return this.parser.readBytes(record.svgDocLength); 23515 } 23516 getDocumentForGlyph(glyphID) { 23517 let id = this.documentRecords.findIndex( 23518 (d2) => d2.startGlyphID <= glyphID && glyphID <= d2.endGlyphID 23519 ); 23520 if (id === -1) return ""; 23521 return this.getDocument(id); 23522 } 23523 }; 23524 var SVGDocumentRecord = class { 23525 constructor(p22) { 23526 this.startGlyphID = p22.uint16; 23527 this.endGlyphID = p22.uint16; 23528 this.svgDocOffset = p22.Offset32; 23529 this.svgDocLength = p22.uint32; 23530 } 23531 }; 23532 var SVG$1 = Object.freeze({ __proto__: null, SVG: SVG6 }); 23533 var fvar = class extends SimpleTable { 23534 constructor(dict, dataview) { 23535 const { p: p22 } = super(dict, dataview); 23536 this.majorVersion = p22.uint16; 23537 this.minorVersion = p22.uint16; 23538 this.axesArrayOffset = p22.Offset16; 23539 p22.uint16; 23540 this.axisCount = p22.uint16; 23541 this.axisSize = p22.uint16; 23542 this.instanceCount = p22.uint16; 23543 this.instanceSize = p22.uint16; 23544 const axisStart = this.tableStart + this.axesArrayOffset; 23545 lazy$1(this, `axes`, () => { 23546 p22.currentPosition = axisStart; 23547 return [...new Array(this.axisCount)].map( 23548 (_) => new VariationAxisRecord(p22) 23549 ); 23550 }); 23551 const instanceStart = axisStart + this.axisCount * this.axisSize; 23552 lazy$1(this, `instances`, () => { 23553 let instances = []; 23554 for (let i2 = 0; i2 < this.instanceCount; i2++) { 23555 p22.currentPosition = instanceStart + i2 * this.instanceSize; 23556 instances.push( 23557 new InstanceRecord(p22, this.axisCount, this.instanceSize) 23558 ); 23559 } 23560 return instances; 23561 }); 23562 } 23563 getSupportedAxes() { 23564 return this.axes.map((a2) => a2.tag); 23565 } 23566 getAxis(name2) { 23567 return this.axes.find((a2) => a2.tag === name2); 23568 } 23569 }; 23570 var VariationAxisRecord = class { 23571 constructor(p22) { 23572 this.tag = p22.tag; 23573 this.minValue = p22.fixed; 23574 this.defaultValue = p22.fixed; 23575 this.maxValue = p22.fixed; 23576 this.flags = p22.flags(16); 23577 this.axisNameID = p22.uint16; 23578 } 23579 }; 23580 var InstanceRecord = class { 23581 constructor(p22, axisCount, size4) { 23582 let start = p22.currentPosition; 23583 this.subfamilyNameID = p22.uint16; 23584 p22.uint16; 23585 this.coordinates = [...new Array(axisCount)].map( 23586 (_) => p22.fixed 23587 ); 23588 if (p22.currentPosition - start < size4) { 23589 this.postScriptNameID = p22.uint16; 23590 } 23591 } 23592 }; 23593 var fvar$1 = Object.freeze({ __proto__: null, fvar }); 23594 var cvt = class extends SimpleTable { 23595 constructor(dict, dataview) { 23596 const { p: p22 } = super(dict, dataview); 23597 const n2 = dict.length / 2; 23598 lazy$1( 23599 this, 23600 `items`, 23601 () => [...new Array(n2)].map((_) => p22.fword) 23602 ); 23603 } 23604 }; 23605 var cvt$1 = Object.freeze({ __proto__: null, cvt }); 23606 var fpgm = class extends SimpleTable { 23607 constructor(dict, dataview) { 23608 const { p: p22 } = super(dict, dataview); 23609 lazy$1( 23610 this, 23611 `instructions`, 23612 () => [...new Array(dict.length)].map((_) => p22.uint8) 23613 ); 23614 } 23615 }; 23616 var fpgm$1 = Object.freeze({ __proto__: null, fpgm }); 23617 var gasp = class extends SimpleTable { 23618 constructor(dict, dataview) { 23619 const { p: p22 } = super(dict, dataview); 23620 this.version = p22.uint16; 23621 this.numRanges = p22.uint16; 23622 const getter = () => [...new Array(this.numRanges)].map( 23623 (_) => new GASPRange(p22) 23624 ); 23625 lazy$1(this, `gaspRanges`, getter); 23626 } 23627 }; 23628 var GASPRange = class { 23629 constructor(p22) { 23630 this.rangeMaxPPEM = p22.uint16; 23631 this.rangeGaspBehavior = p22.uint16; 23632 } 23633 }; 23634 var gasp$1 = Object.freeze({ __proto__: null, gasp }); 23635 var glyf = class extends SimpleTable { 23636 constructor(dict, dataview) { 23637 super(dict, dataview); 23638 } 23639 getGlyphData(offset4, length) { 23640 this.parser.currentPosition = this.tableStart + offset4; 23641 return this.parser.readBytes(length); 23642 } 23643 }; 23644 var glyf$1 = Object.freeze({ __proto__: null, glyf }); 23645 var loca = class extends SimpleTable { 23646 constructor(dict, dataview, tables) { 23647 const { p: p22 } = super(dict, dataview); 23648 const n2 = tables.maxp.numGlyphs + 1; 23649 if (tables.head.indexToLocFormat === 0) { 23650 this.x2 = true; 23651 lazy$1( 23652 this, 23653 `offsets`, 23654 () => [...new Array(n2)].map((_) => p22.Offset16) 23655 ); 23656 } else { 23657 lazy$1( 23658 this, 23659 `offsets`, 23660 () => [...new Array(n2)].map((_) => p22.Offset32) 23661 ); 23662 } 23663 } 23664 getGlyphDataOffsetAndLength(glyphID) { 23665 let offset4 = this.offsets[glyphID] * this.x2 ? 2 : 1; 23666 let nextOffset = this.offsets[glyphID + 1] * this.x2 ? 2 : 1; 23667 return { offset: offset4, length: nextOffset - offset4 }; 23668 } 23669 }; 23670 var loca$1 = Object.freeze({ __proto__: null, loca }); 23671 var prep = class extends SimpleTable { 23672 constructor(dict, dataview) { 23673 const { p: p22 } = super(dict, dataview); 23674 lazy$1( 23675 this, 23676 `instructions`, 23677 () => [...new Array(dict.length)].map((_) => p22.uint8) 23678 ); 23679 } 23680 }; 23681 var prep$1 = Object.freeze({ __proto__: null, prep }); 23682 var CFF = class extends SimpleTable { 23683 constructor(dict, dataview) { 23684 const { p: p22 } = super(dict, dataview); 23685 lazy$1(this, `data`, () => p22.readBytes()); 23686 } 23687 }; 23688 var CFF$1 = Object.freeze({ __proto__: null, CFF }); 23689 var CFF2 = class extends SimpleTable { 23690 constructor(dict, dataview) { 23691 const { p: p22 } = super(dict, dataview); 23692 lazy$1(this, `data`, () => p22.readBytes()); 23693 } 23694 }; 23695 var CFF2$1 = Object.freeze({ __proto__: null, CFF2 }); 23696 var VORG = class extends SimpleTable { 23697 constructor(dict, dataview) { 23698 const { p: p22 } = super(dict, dataview); 23699 this.majorVersion = p22.uint16; 23700 this.minorVersion = p22.uint16; 23701 this.defaultVertOriginY = p22.int16; 23702 this.numVertOriginYMetrics = p22.uint16; 23703 lazy$1( 23704 this, 23705 `vertORiginYMetrics`, 23706 () => [...new Array(this.numVertOriginYMetrics)].map( 23707 (_) => new VertOriginYMetric(p22) 23708 ) 23709 ); 23710 } 23711 }; 23712 var VertOriginYMetric = class { 23713 constructor(p22) { 23714 this.glyphIndex = p22.uint16; 23715 this.vertOriginY = p22.int16; 23716 } 23717 }; 23718 var VORG$1 = Object.freeze({ __proto__: null, VORG }); 23719 var BitmapSize = class { 23720 constructor(p22) { 23721 this.indexSubTableArrayOffset = p22.Offset32; 23722 this.indexTablesSize = p22.uint32; 23723 this.numberofIndexSubTables = p22.uint32; 23724 this.colorRef = p22.uint32; 23725 this.hori = new SbitLineMetrics(p22); 23726 this.vert = new SbitLineMetrics(p22); 23727 this.startGlyphIndex = p22.uint16; 23728 this.endGlyphIndex = p22.uint16; 23729 this.ppemX = p22.uint8; 23730 this.ppemY = p22.uint8; 23731 this.bitDepth = p22.uint8; 23732 this.flags = p22.int8; 23733 } 23734 }; 23735 var BitmapScale = class { 23736 constructor(p22) { 23737 this.hori = new SbitLineMetrics(p22); 23738 this.vert = new SbitLineMetrics(p22); 23739 this.ppemX = p22.uint8; 23740 this.ppemY = p22.uint8; 23741 this.substitutePpemX = p22.uint8; 23742 this.substitutePpemY = p22.uint8; 23743 } 23744 }; 23745 var SbitLineMetrics = class { 23746 constructor(p22) { 23747 this.ascender = p22.int8; 23748 this.descender = p22.int8; 23749 this.widthMax = p22.uint8; 23750 this.caretSlopeNumerator = p22.int8; 23751 this.caretSlopeDenominator = p22.int8; 23752 this.caretOffset = p22.int8; 23753 this.minOriginSB = p22.int8; 23754 this.minAdvanceSB = p22.int8; 23755 this.maxBeforeBL = p22.int8; 23756 this.minAfterBL = p22.int8; 23757 this.pad1 = p22.int8; 23758 this.pad2 = p22.int8; 23759 } 23760 }; 23761 var EBLC = class extends SimpleTable { 23762 constructor(dict, dataview, name2) { 23763 const { p: p22 } = super(dict, dataview, name2); 23764 this.majorVersion = p22.uint16; 23765 this.minorVersion = p22.uint16; 23766 this.numSizes = p22.uint32; 23767 lazy$1( 23768 this, 23769 `bitMapSizes`, 23770 () => [...new Array(this.numSizes)].map( 23771 (_) => new BitmapSize(p22) 23772 ) 23773 ); 23774 } 23775 }; 23776 var EBLC$1 = Object.freeze({ __proto__: null, EBLC }); 23777 var EBDT = class extends SimpleTable { 23778 constructor(dict, dataview, name2) { 23779 const { p: p22 } = super(dict, dataview, name2); 23780 this.majorVersion = p22.uint16; 23781 this.minorVersion = p22.uint16; 23782 } 23783 }; 23784 var EBDT$1 = Object.freeze({ __proto__: null, EBDT }); 23785 var EBSC = class extends SimpleTable { 23786 constructor(dict, dataview) { 23787 const { p: p22 } = super(dict, dataview); 23788 this.majorVersion = p22.uint16; 23789 this.minorVersion = p22.uint16; 23790 this.numSizes = p22.uint32; 23791 lazy$1( 23792 this, 23793 `bitmapScales`, 23794 () => [...new Array(this.numSizes)].map( 23795 (_) => new BitmapScale(p22) 23796 ) 23797 ); 23798 } 23799 }; 23800 var EBSC$1 = Object.freeze({ __proto__: null, EBSC }); 23801 var CBLC = class extends EBLC { 23802 constructor(dict, dataview) { 23803 super(dict, dataview, `CBLC`); 23804 } 23805 }; 23806 var CBLC$1 = Object.freeze({ __proto__: null, CBLC }); 23807 var CBDT = class extends EBDT { 23808 constructor(dict, dataview) { 23809 super(dict, dataview, `CBDT`); 23810 } 23811 }; 23812 var CBDT$1 = Object.freeze({ __proto__: null, CBDT }); 23813 var sbix = class extends SimpleTable { 23814 constructor(dict, dataview) { 23815 const { p: p22 } = super(dict, dataview); 23816 this.version = p22.uint16; 23817 this.flags = p22.flags(16); 23818 this.numStrikes = p22.uint32; 23819 lazy$1( 23820 this, 23821 `strikeOffsets`, 23822 () => [...new Array(this.numStrikes)].map((_) => p22.Offset32) 23823 ); 23824 } 23825 }; 23826 var sbix$1 = Object.freeze({ __proto__: null, sbix }); 23827 var COLR = class extends SimpleTable { 23828 constructor(dict, dataview) { 23829 const { p: p22 } = super(dict, dataview); 23830 this.version = p22.uint16; 23831 this.numBaseGlyphRecords = p22.uint16; 23832 this.baseGlyphRecordsOffset = p22.Offset32; 23833 this.layerRecordsOffset = p22.Offset32; 23834 this.numLayerRecords = p22.uint16; 23835 } 23836 getBaseGlyphRecord(glyphID) { 23837 let start = this.tableStart + this.baseGlyphRecordsOffset; 23838 this.parser.currentPosition = start; 23839 let first = new BaseGlyphRecord(this.parser); 23840 let firstID = first.gID; 23841 let end = this.tableStart + this.layerRecordsOffset - 6; 23842 this.parser.currentPosition = end; 23843 let last = new BaseGlyphRecord(this.parser); 23844 let lastID = last.gID; 23845 if (firstID === glyphID) return first; 23846 if (lastID === glyphID) return last; 23847 while (true) { 23848 if (start === end) break; 23849 let mid = start + (end - start) / 12; 23850 this.parser.currentPosition = mid; 23851 let middle = new BaseGlyphRecord(this.parser); 23852 let midID = middle.gID; 23853 if (midID === glyphID) return middle; 23854 else if (midID > glyphID) { 23855 end = mid; 23856 } else if (midID < glyphID) { 23857 start = mid; 23858 } 23859 } 23860 return false; 23861 } 23862 getLayers(glyphID) { 23863 let record = this.getBaseGlyphRecord(glyphID); 23864 this.parser.currentPosition = this.tableStart + this.layerRecordsOffset + 4 * record.firstLayerIndex; 23865 return [...new Array(record.numLayers)].map( 23866 (_) => new LayerRecord(p) 23867 ); 23868 } 23869 }; 23870 var BaseGlyphRecord = class { 23871 constructor(p22) { 23872 this.gID = p22.uint16; 23873 this.firstLayerIndex = p22.uint16; 23874 this.numLayers = p22.uint16; 23875 } 23876 }; 23877 var LayerRecord = class { 23878 constructor(p22) { 23879 this.gID = p22.uint16; 23880 this.paletteIndex = p22.uint16; 23881 } 23882 }; 23883 var COLR$1 = Object.freeze({ __proto__: null, COLR }); 23884 var CPAL = class extends SimpleTable { 23885 constructor(dict, dataview) { 23886 const { p: p22 } = super(dict, dataview); 23887 this.version = p22.uint16; 23888 this.numPaletteEntries = p22.uint16; 23889 const numPalettes = this.numPalettes = p22.uint16; 23890 this.numColorRecords = p22.uint16; 23891 this.offsetFirstColorRecord = p22.Offset32; 23892 this.colorRecordIndices = [...new Array(this.numPalettes)].map( 23893 (_) => p22.uint16 23894 ); 23895 lazy$1(this, `colorRecords`, () => { 23896 p22.currentPosition = this.tableStart + this.offsetFirstColorRecord; 23897 return [...new Array(this.numColorRecords)].map( 23898 (_) => new ColorRecord(p22) 23899 ); 23900 }); 23901 if (this.version === 1) { 23902 this.offsetPaletteTypeArray = p22.Offset32; 23903 this.offsetPaletteLabelArray = p22.Offset32; 23904 this.offsetPaletteEntryLabelArray = p22.Offset32; 23905 lazy$1(this, `paletteTypeArray`, () => { 23906 p22.currentPosition = this.tableStart + this.offsetPaletteTypeArray; 23907 return new PaletteTypeArray(p22, numPalettes); 23908 }); 23909 lazy$1(this, `paletteLabelArray`, () => { 23910 p22.currentPosition = this.tableStart + this.offsetPaletteLabelArray; 23911 return new PaletteLabelsArray(p22, numPalettes); 23912 }); 23913 lazy$1(this, `paletteEntryLabelArray`, () => { 23914 p22.currentPosition = this.tableStart + this.offsetPaletteEntryLabelArray; 23915 return new PaletteEntryLabelArray(p22, numPalettes); 23916 }); 23917 } 23918 } 23919 }; 23920 var ColorRecord = class { 23921 constructor(p22) { 23922 this.blue = p22.uint8; 23923 this.green = p22.uint8; 23924 this.red = p22.uint8; 23925 this.alpha = p22.uint8; 23926 } 23927 }; 23928 var PaletteTypeArray = class { 23929 constructor(p22, numPalettes) { 23930 this.paletteTypes = [...new Array(numPalettes)].map( 23931 (_) => p22.uint32 23932 ); 23933 } 23934 }; 23935 var PaletteLabelsArray = class { 23936 constructor(p22, numPalettes) { 23937 this.paletteLabels = [...new Array(numPalettes)].map( 23938 (_) => p22.uint16 23939 ); 23940 } 23941 }; 23942 var PaletteEntryLabelArray = class { 23943 constructor(p22, numPalettes) { 23944 this.paletteEntryLabels = [...new Array(numPalettes)].map( 23945 (_) => p22.uint16 23946 ); 23947 } 23948 }; 23949 var CPAL$1 = Object.freeze({ __proto__: null, CPAL }); 23950 var DSIG = class extends SimpleTable { 23951 constructor(dict, dataview) { 23952 const { p: p22 } = super(dict, dataview); 23953 this.version = p22.uint32; 23954 this.numSignatures = p22.uint16; 23955 this.flags = p22.uint16; 23956 this.signatureRecords = [...new Array(this.numSignatures)].map( 23957 (_) => new SignatureRecord(p22) 23958 ); 23959 } 23960 getData(signatureID) { 23961 const record = this.signatureRecords[signatureID]; 23962 this.parser.currentPosition = this.tableStart + record.offset; 23963 return new SignatureBlockFormat1(this.parser); 23964 } 23965 }; 23966 var SignatureRecord = class { 23967 constructor(p22) { 23968 this.format = p22.uint32; 23969 this.length = p22.uint32; 23970 this.offset = p22.Offset32; 23971 } 23972 }; 23973 var SignatureBlockFormat1 = class { 23974 constructor(p22) { 23975 p22.uint16; 23976 p22.uint16; 23977 this.signatureLength = p22.uint32; 23978 this.signature = p22.readBytes(this.signatureLength); 23979 } 23980 }; 23981 var DSIG$1 = Object.freeze({ __proto__: null, DSIG }); 23982 var hdmx = class extends SimpleTable { 23983 constructor(dict, dataview, tables) { 23984 const { p: p22 } = super(dict, dataview); 23985 const numGlyphs = tables.hmtx.numGlyphs; 23986 this.version = p22.uint16; 23987 this.numRecords = p22.int16; 23988 this.sizeDeviceRecord = p22.int32; 23989 this.records = [...new Array(numRecords)].map( 23990 (_) => new DeviceRecord(p22, numGlyphs) 23991 ); 23992 } 23993 }; 23994 var DeviceRecord = class { 23995 constructor(p22, numGlyphs) { 23996 this.pixelSize = p22.uint8; 23997 this.maxWidth = p22.uint8; 23998 this.widths = p22.readBytes(numGlyphs); 23999 } 24000 }; 24001 var hdmx$1 = Object.freeze({ __proto__: null, hdmx }); 24002 var kern = class extends SimpleTable { 24003 constructor(dict, dataview) { 24004 const { p: p22 } = super(dict, dataview); 24005 this.version = p22.uint16; 24006 this.nTables = p22.uint16; 24007 lazy$1(this, `tables`, () => { 24008 let offset4 = this.tableStart + 4; 24009 const tables = []; 24010 for (let i2 = 0; i2 < this.nTables; i2++) { 24011 p22.currentPosition = offset4; 24012 let subtable = new KernSubTable(p22); 24013 tables.push(subtable); 24014 offset4 += subtable; 24015 } 24016 return tables; 24017 }); 24018 } 24019 }; 24020 var KernSubTable = class { 24021 constructor(p22) { 24022 this.version = p22.uint16; 24023 this.length = p22.uint16; 24024 this.coverage = p22.flags(8); 24025 this.format = p22.uint8; 24026 if (this.format === 0) { 24027 this.nPairs = p22.uint16; 24028 this.searchRange = p22.uint16; 24029 this.entrySelector = p22.uint16; 24030 this.rangeShift = p22.uint16; 24031 lazy$1( 24032 this, 24033 `pairs`, 24034 () => [...new Array(this.nPairs)].map((_) => new Pair(p22)) 24035 ); 24036 } 24037 if (this.format === 2) { 24038 console.warn( 24039 `Kern subtable format 2 is not supported: this parser currently only parses universal table data.` 24040 ); 24041 } 24042 } 24043 get horizontal() { 24044 return this.coverage[0]; 24045 } 24046 get minimum() { 24047 return this.coverage[1]; 24048 } 24049 get crossstream() { 24050 return this.coverage[2]; 24051 } 24052 get override() { 24053 return this.coverage[3]; 24054 } 24055 }; 24056 var Pair = class { 24057 constructor(p22) { 24058 this.left = p22.uint16; 24059 this.right = p22.uint16; 24060 this.value = p22.fword; 24061 } 24062 }; 24063 var kern$1 = Object.freeze({ __proto__: null, kern }); 24064 var LTSH = class extends SimpleTable { 24065 constructor(dict, dataview) { 24066 const { p: p22 } = super(dict, dataview); 24067 this.version = p22.uint16; 24068 this.numGlyphs = p22.uint16; 24069 this.yPels = p22.readBytes(this.numGlyphs); 24070 } 24071 }; 24072 var LTSH$1 = Object.freeze({ __proto__: null, LTSH }); 24073 var MERG = class extends SimpleTable { 24074 constructor(dict, dataview) { 24075 const { p: p22 } = super(dict, dataview); 24076 this.version = p22.uint16; 24077 this.mergeClassCount = p22.uint16; 24078 this.mergeDataOffset = p22.Offset16; 24079 this.classDefCount = p22.uint16; 24080 this.offsetToClassDefOffsets = p22.Offset16; 24081 lazy$1( 24082 this, 24083 `mergeEntryMatrix`, 24084 () => [...new Array(this.mergeClassCount)].map( 24085 (_) => p22.readBytes(this.mergeClassCount) 24086 ) 24087 ); 24088 console.warn(`Full MERG parsing is currently not supported.`); 24089 console.warn( 24090 `If you need this table parsed, please file an issue, or better yet, a PR.` 24091 ); 24092 } 24093 }; 24094 var MERG$1 = Object.freeze({ __proto__: null, MERG }); 24095 var meta = class extends SimpleTable { 24096 constructor(dict, dataview) { 24097 const { p: p22 } = super(dict, dataview); 24098 this.version = p22.uint32; 24099 this.flags = p22.uint32; 24100 p22.uint32; 24101 this.dataMapsCount = p22.uint32; 24102 this.dataMaps = [...new Array(this.dataMapsCount)].map( 24103 (_) => new DataMap(this.tableStart, p22) 24104 ); 24105 } 24106 }; 24107 var DataMap = class { 24108 constructor(tableStart, p22) { 24109 this.tableStart = tableStart; 24110 this.parser = p22; 24111 this.tag = p22.tag; 24112 this.dataOffset = p22.Offset32; 24113 this.dataLength = p22.uint32; 24114 } 24115 getData() { 24116 this.parser.currentField = this.tableStart + this.dataOffset; 24117 return this.parser.readBytes(this.dataLength); 24118 } 24119 }; 24120 var meta$1 = Object.freeze({ __proto__: null, meta }); 24121 var PCLT = class extends SimpleTable { 24122 constructor(dict, dataview) { 24123 super(dict, dataview); 24124 console.warn( 24125 `This font uses a PCLT table, which is currently not supported by this parser.` 24126 ); 24127 console.warn( 24128 `If you need this table parsed, please file an issue, or better yet, a PR.` 24129 ); 24130 } 24131 }; 24132 var PCLT$1 = Object.freeze({ __proto__: null, PCLT }); 24133 var VDMX = class extends SimpleTable { 24134 constructor(dict, dataview) { 24135 const { p: p22 } = super(dict, dataview); 24136 this.version = p22.uint16; 24137 this.numRecs = p22.uint16; 24138 this.numRatios = p22.uint16; 24139 this.ratRanges = [...new Array(this.numRatios)].map( 24140 (_) => new RatioRange(p22) 24141 ); 24142 this.offsets = [...new Array(this.numRatios)].map( 24143 (_) => p22.Offset16 24144 ); 24145 this.VDMXGroups = [...new Array(this.numRecs)].map( 24146 (_) => new VDMXGroup(p22) 24147 ); 24148 } 24149 }; 24150 var RatioRange = class { 24151 constructor(p22) { 24152 this.bCharSet = p22.uint8; 24153 this.xRatio = p22.uint8; 24154 this.yStartRatio = p22.uint8; 24155 this.yEndRatio = p22.uint8; 24156 } 24157 }; 24158 var VDMXGroup = class { 24159 constructor(p22) { 24160 this.recs = p22.uint16; 24161 this.startsz = p22.uint8; 24162 this.endsz = p22.uint8; 24163 this.records = [...new Array(this.recs)].map( 24164 (_) => new vTable(p22) 24165 ); 24166 } 24167 }; 24168 var vTable = class { 24169 constructor(p22) { 24170 this.yPelHeight = p22.uint16; 24171 this.yMax = p22.int16; 24172 this.yMin = p22.int16; 24173 } 24174 }; 24175 var VDMX$1 = Object.freeze({ __proto__: null, VDMX }); 24176 var vhea = class extends SimpleTable { 24177 constructor(dict, dataview) { 24178 const { p: p22 } = super(dict, dataview); 24179 this.version = p22.fixed; 24180 this.ascent = this.vertTypoAscender = p22.int16; 24181 this.descent = this.vertTypoDescender = p22.int16; 24182 this.lineGap = this.vertTypoLineGap = p22.int16; 24183 this.advanceHeightMax = p22.int16; 24184 this.minTopSideBearing = p22.int16; 24185 this.minBottomSideBearing = p22.int16; 24186 this.yMaxExtent = p22.int16; 24187 this.caretSlopeRise = p22.int16; 24188 this.caretSlopeRun = p22.int16; 24189 this.caretOffset = p22.int16; 24190 this.reserved = p22.int16; 24191 this.reserved = p22.int16; 24192 this.reserved = p22.int16; 24193 this.reserved = p22.int16; 24194 this.metricDataFormat = p22.int16; 24195 this.numOfLongVerMetrics = p22.uint16; 24196 p22.verifyLength(); 24197 } 24198 }; 24199 var vhea$1 = Object.freeze({ __proto__: null, vhea }); 24200 var vmtx = class extends SimpleTable { 24201 constructor(dict, dataview, tables) { 24202 super(dict, dataview); 24203 const numOfLongVerMetrics = tables.vhea.numOfLongVerMetrics; 24204 const numGlyphs = tables.maxp.numGlyphs; 24205 const metricsStart = p.currentPosition; 24206 lazy(this, `vMetrics`, () => { 24207 p.currentPosition = metricsStart; 24208 return [...new Array(numOfLongVerMetrics)].map( 24209 (_) => new LongVertMetric(p.uint16, p.int16) 24210 ); 24211 }); 24212 if (numOfLongVerMetrics < numGlyphs) { 24213 const tsbStart = metricsStart + numOfLongVerMetrics * 4; 24214 lazy(this, `topSideBearings`, () => { 24215 p.currentPosition = tsbStart; 24216 return [...new Array(numGlyphs - numOfLongVerMetrics)].map( 24217 (_) => p.int16 24218 ); 24219 }); 24220 } 24221 } 24222 }; 24223 var LongVertMetric = class { 24224 constructor(h2, b2) { 24225 this.advanceHeight = h2; 24226 this.topSideBearing = b2; 24227 } 24228 }; 24229 var vmtx$1 = Object.freeze({ __proto__: null, vmtx }); 24230 24231 // packages/global-styles-ui/build-module/font-library/utils/make-families-from-faces.mjs 24232 var import_components27 = __toESM(require_components(), 1); 24233 var { kebabCase: kebabCase2 } = unlock3(import_components27.privateApis); 24234 function makeFamiliesFromFaces(fontFaces) { 24235 const fontFamiliesObject = fontFaces.reduce( 24236 (acc, item) => { 24237 if (!acc[item.fontFamily]) { 24238 acc[item.fontFamily] = { 24239 name: item.fontFamily, 24240 fontFamily: item.fontFamily, 24241 slug: kebabCase2(item.fontFamily.toLowerCase()), 24242 fontFace: [] 24243 }; 24244 } 24245 acc[item.fontFamily].fontFace.push(item); 24246 return acc; 24247 }, 24248 {} 24249 ); 24250 return Object.values(fontFamiliesObject); 24251 } 24252 24253 // packages/global-styles-ui/build-module/font-library/upload-fonts.mjs 24254 var import_jsx_runtime53 = __toESM(require_jsx_runtime(), 1); 24255 function UploadFonts() { 24256 const { installFonts } = (0, import_element36.useContext)(FontLibraryContext); 24257 const [isUploading, setIsUploading] = (0, import_element36.useState)(false); 24258 const [notice, setNotice] = (0, import_element36.useState)(null); 24259 const handleDropZone = (files) => { 24260 handleFilesUpload(files); 24261 }; 24262 const onFilesUpload = (event) => { 24263 handleFilesUpload(event.target.files); 24264 }; 24265 const handleFilesUpload = async (files) => { 24266 if (!files) { 24267 return; 24268 } 24269 setNotice(null); 24270 setIsUploading(true); 24271 const uniqueFilenames = /* @__PURE__ */ new Set(); 24272 const selectedFiles = [...files]; 24273 let hasInvalidFiles = false; 24274 const checkFilesPromises = selectedFiles.map(async (file) => { 24275 const isFont = await isFontFile(file); 24276 if (!isFont) { 24277 hasInvalidFiles = true; 24278 return null; 24279 } 24280 if (uniqueFilenames.has(file.name)) { 24281 return null; 24282 } 24283 const fileExtension = (((file.name ?? "").split(".") ?? []).pop() ?? "").toLowerCase(); 24284 if (ALLOWED_FILE_EXTENSIONS.includes(fileExtension)) { 24285 uniqueFilenames.add(file.name); 24286 return file; 24287 } 24288 return null; 24289 }); 24290 const allowedFiles = (await Promise.all(checkFilesPromises)).filter((file) => null !== file); 24291 if (allowedFiles.length > 0) { 24292 loadFiles(allowedFiles); 24293 } else { 24294 const message = hasInvalidFiles ? (0, import_i18n17.__)("Sorry, you are not allowed to upload this file type.") : (0, import_i18n17.__)("No fonts found to install."); 24295 setNotice({ 24296 type: "error", 24297 message 24298 }); 24299 setIsUploading(false); 24300 } 24301 }; 24302 const loadFiles = async (files) => { 24303 const fontFacesLoaded = await Promise.all( 24304 files.map(async (fontFile) => { 24305 const fontFaceData = await getFontFaceMetadata(fontFile); 24306 await loadFontFaceInBrowser( 24307 fontFaceData, 24308 fontFaceData.file, 24309 "all" 24310 ); 24311 return fontFaceData; 24312 }) 24313 ); 24314 handleInstall(fontFacesLoaded); 24315 }; 24316 async function isFontFile(file) { 24317 const font2 = new Font("Uploaded Font"); 24318 try { 24319 const buffer = await readFileAsArrayBuffer(file); 24320 await font2.fromDataBuffer(buffer, "font"); 24321 return true; 24322 } catch { 24323 return false; 24324 } 24325 } 24326 async function readFileAsArrayBuffer(file) { 24327 return new Promise((resolve, reject) => { 24328 const reader = new window.FileReader(); 24329 reader.readAsArrayBuffer(file); 24330 reader.onload = () => resolve(reader.result); 24331 reader.onerror = reject; 24332 }); 24333 } 24334 const getFontFaceMetadata = async (fontFile) => { 24335 const buffer = await readFileAsArrayBuffer(fontFile); 24336 const fontObj = new Font("Uploaded Font"); 24337 fontObj.fromDataBuffer(buffer, fontFile.name); 24338 const onloadEvent = await new Promise( 24339 (resolve) => fontObj.onload = resolve 24340 ); 24341 const font2 = onloadEvent.detail.font; 24342 const { name: name2 } = font2.opentype.tables; 24343 const fontName = name2.get(16) || name2.get(1); 24344 const isItalic = name2.get(2).toLowerCase().includes("italic"); 24345 const fontWeight = font2.opentype.tables["OS/2"].usWeightClass || "normal"; 24346 const isVariable = !!font2.opentype.tables.fvar; 24347 const weightAxis = isVariable && font2.opentype.tables.fvar.axes.find( 24348 ({ tag }) => tag === "wght" 24349 ); 24350 const weightRange = weightAxis ? `$weightAxis.minValue} $weightAxis.maxValue}` : null; 24351 return { 24352 file: fontFile, 24353 fontFamily: fontName, 24354 fontStyle: isItalic ? "italic" : "normal", 24355 fontWeight: weightRange || fontWeight 24356 }; 24357 }; 24358 const handleInstall = async (fontFaces) => { 24359 const fontFamilies = makeFamiliesFromFaces(fontFaces); 24360 try { 24361 await installFonts(fontFamilies); 24362 setNotice({ 24363 type: "success", 24364 message: (0, import_i18n17.__)("Fonts were installed successfully.") 24365 }); 24366 } catch (error) { 24367 const typedError = error; 24368 setNotice({ 24369 type: "error", 24370 message: typedError.message, 24371 errors: typedError?.installationErrors 24372 }); 24373 } 24374 setIsUploading(false); 24375 }; 24376 return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "font-library__tabpanel-layout", children: [ 24377 /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_components28.DropZone, { onFilesDrop: handleDropZone }), 24378 /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_components28.__experimentalVStack, { className: "font-library__local-fonts", justify: "start", children: [ 24379 notice && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)( 24380 import_components28.Notice, 24381 { 24382 status: notice.type, 24383 __unstableHTML: true, 24384 onRemove: () => setNotice(null), 24385 children: [ 24386 notice.message, 24387 notice.errors && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("ul", { children: notice.errors.map((error, index2) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("li", { children: error }, index2)) }) 24388 ] 24389 } 24390 ), 24391 isUploading && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_components28.FlexItem, { children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "font-library__upload-area", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_components28.ProgressBar, {}) }) }), 24392 !isUploading && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)( 24393 import_components28.FormFileUpload, 24394 { 24395 accept: ALLOWED_FILE_EXTENSIONS.map( 24396 (ext) => `.$ext}` 24397 ).join(","), 24398 multiple: true, 24399 onChange: onFilesUpload, 24400 render: ({ openFileDialog }) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)( 24401 import_components28.Button, 24402 { 24403 __next40pxDefaultSize: true, 24404 className: "font-library__upload-area", 24405 onClick: openFileDialog, 24406 children: (0, import_i18n17.__)("Upload font") 24407 } 24408 ) 24409 } 24410 ), 24411 /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_components28.__experimentalText, { className: "font-library__upload-area__text", children: (0, import_i18n17.__)( 24412 "Uploaded fonts appear in your library and can be used in your theme. Supported formats: .ttf, .otf, .woff, and .woff2." 24413 ) }) 24414 ] }) 24415 ] }); 24416 } 24417 var upload_fonts_default = UploadFonts; 24418 24419 // packages/global-styles-ui/build-module/font-library/modal.mjs 24420 var import_jsx_runtime54 = __toESM(require_jsx_runtime(), 1); 24421 var { Tabs } = unlock3(import_components29.privateApis); 24422 var DEFAULT_TAB = { 24423 id: "installed-fonts", 24424 title: (0, import_i18n18._x)("Library", "Font library") 24425 }; 24426 var UPLOAD_TAB = { 24427 id: "upload-fonts", 24428 title: (0, import_i18n18._x)("Upload", "noun") 24429 }; 24430 24431 // packages/global-styles-ui/build-module/font-family-item.mjs 24432 var import_i18n19 = __toESM(require_i18n(), 1); 24433 var import_components30 = __toESM(require_components(), 1); 24434 var import_element37 = __toESM(require_element(), 1); 24435 var import_jsx_runtime55 = __toESM(require_jsx_runtime(), 1); 24436 24437 // packages/global-styles-ui/build-module/font-families.mjs 24438 var import_jsx_runtime56 = __toESM(require_jsx_runtime(), 1); 24439 24440 // packages/global-styles-ui/build-module/font-sizes/font-sizes-count.mjs 24441 var import_i18n21 = __toESM(require_i18n(), 1); 24442 var import_components32 = __toESM(require_components(), 1); 24443 var import_jsx_runtime57 = __toESM(require_jsx_runtime(), 1); 24444 24445 // packages/global-styles-ui/build-module/screen-typography.mjs 24446 var import_jsx_runtime58 = __toESM(require_jsx_runtime(), 1); 24447 24448 // packages/global-styles-ui/build-module/screen-typography-element.mjs 24449 var import_i18n23 = __toESM(require_i18n(), 1); 24450 var import_components34 = __toESM(require_components(), 1); 24451 var import_element40 = __toESM(require_element(), 1); 24452 24453 // packages/global-styles-ui/build-module/typography-panel.mjs 24454 var import_block_editor6 = __toESM(require_block_editor(), 1); 24455 var import_jsx_runtime59 = __toESM(require_jsx_runtime(), 1); 24456 var { useSettingsForBlockElement: useSettingsForBlockElement4, TypographyPanel: StylesTypographyPanel2 } = unlock3(import_block_editor6.privateApis); 24457 24458 // packages/global-styles-ui/build-module/typography-preview.mjs 24459 var import_jsx_runtime60 = __toESM(require_jsx_runtime(), 1); 24460 24461 // packages/global-styles-ui/build-module/screen-typography-element.mjs 24462 var import_jsx_runtime61 = __toESM(require_jsx_runtime(), 1); 24463 var elements = { 24464 text: { 24465 description: (0, import_i18n23.__)("Manage the fonts used on the site."), 24466 title: (0, import_i18n23.__)("Text") 24467 }, 24468 link: { 24469 description: (0, import_i18n23.__)("Manage the fonts and typography used on the links."), 24470 title: (0, import_i18n23.__)("Links") 24471 }, 24472 heading: { 24473 description: (0, import_i18n23.__)("Manage the fonts and typography used on headings."), 24474 title: (0, import_i18n23.__)("Headings") 24475 }, 24476 caption: { 24477 description: (0, import_i18n23.__)("Manage the fonts and typography used on captions."), 24478 title: (0, import_i18n23.__)("Captions") 24479 }, 24480 button: { 24481 description: (0, import_i18n23.__)("Manage the fonts and typography used on buttons."), 24482 title: (0, import_i18n23.__)("Buttons") 24483 } 24484 }; 24485 24486 // packages/global-styles-ui/build-module/screen-colors.mjs 24487 var import_i18n25 = __toESM(require_i18n(), 1); 24488 var import_components37 = __toESM(require_components(), 1); 24489 var import_block_editor7 = __toESM(require_block_editor(), 1); 24490 24491 // packages/global-styles-ui/build-module/palette.mjs 24492 var import_components36 = __toESM(require_components(), 1); 24493 var import_i18n24 = __toESM(require_i18n(), 1); 24494 var import_element41 = __toESM(require_element(), 1); 24495 24496 // packages/global-styles-ui/build-module/color-indicator-wrapper.mjs 24497 var import_components35 = __toESM(require_components(), 1); 24498 var import_jsx_runtime62 = __toESM(require_jsx_runtime(), 1); 24499 24500 // packages/global-styles-ui/build-module/palette.mjs 24501 var import_jsx_runtime63 = __toESM(require_jsx_runtime(), 1); 24502 24503 // packages/global-styles-ui/build-module/screen-colors.mjs 24504 var import_jsx_runtime64 = __toESM(require_jsx_runtime(), 1); 24505 var { useSettingsForBlockElement: useSettingsForBlockElement5, ColorPanel: StylesColorPanel2 } = unlock3( 24506 import_block_editor7.privateApis 24507 ); 24508 24509 // packages/global-styles-ui/build-module/screen-color-palette.mjs 24510 var import_i18n28 = __toESM(require_i18n(), 1); 24511 24512 // packages/global-styles-ui/build-module/color-palette-panel.mjs 24513 var import_compose4 = __toESM(require_compose(), 1); 24514 var import_components40 = __toESM(require_components(), 1); 24515 var import_i18n26 = __toESM(require_i18n(), 1); 24516 24517 // packages/global-styles-ui/build-module/variations/variations-color.mjs 24518 var import_components39 = __toESM(require_components(), 1); 24519 24520 // packages/global-styles-ui/build-module/preview-colors.mjs 24521 var import_components38 = __toESM(require_components(), 1); 24522 24523 // packages/global-styles-ui/build-module/preset-colors.mjs 24524 var import_jsx_runtime65 = __toESM(require_jsx_runtime(), 1); 24525 function PresetColors() { 24526 const { paletteColors } = useStylesPreviewColors(); 24527 return paletteColors.slice(0, 4).map(({ slug, color }, index2) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)( 24528 "div", 24529 { 24530 style: { 24531 flexGrow: 1, 24532 height: "100%", 24533 background: color 24534 } 24535 }, 24536 `$slug}-$index2}` 24537 )); 24538 } 24539 24540 // packages/global-styles-ui/build-module/preview-colors.mjs 24541 var import_jsx_runtime66 = __toESM(require_jsx_runtime(), 1); 24542 var firstFrameVariants2 = { 24543 start: { 24544 scale: 1, 24545 opacity: 1 24546 }, 24547 hover: { 24548 scale: 0, 24549 opacity: 0 24550 } 24551 }; 24552 var StylesPreviewColors = ({ 24553 label, 24554 isFocused, 24555 withHoverView 24556 }) => { 24557 return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)( 24558 preview_wrapper_default, 24559 { 24560 label, 24561 isFocused, 24562 withHoverView, 24563 children: ({ key }) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)( 24564 import_components38.__unstableMotion.div, 24565 { 24566 variants: firstFrameVariants2, 24567 style: { 24568 height: "100%", 24569 overflow: "hidden" 24570 }, 24571 children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)( 24572 import_components38.__experimentalHStack, 24573 { 24574 spacing: 0, 24575 justify: "center", 24576 style: { 24577 height: "100%", 24578 overflow: "hidden" 24579 }, 24580 children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(PresetColors, {}) 24581 } 24582 ) 24583 }, 24584 key 24585 ) 24586 } 24587 ); 24588 }; 24589 var preview_colors_default = StylesPreviewColors; 24590 24591 // packages/global-styles-ui/build-module/variations/variations-color.mjs 24592 var import_jsx_runtime67 = __toESM(require_jsx_runtime(), 1); 24593 var propertiesToFilter2 = ["color"]; 24594 function ColorVariations({ 24595 title, 24596 gap = 2 24597 }) { 24598 const colorVariations = useCurrentMergeThemeStyleVariationsWithUserConfig(propertiesToFilter2); 24599 if (colorVariations?.length <= 1) { 24600 return null; 24601 } 24602 return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(import_components39.__experimentalVStack, { spacing: 3, children: [ 24603 title && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Subtitle, { level: 3, children: title }), 24604 /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_components39.__experimentalGrid, { gap, children: colorVariations.map((variation, index2) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)( 24605 Variation, 24606 { 24607 variation, 24608 isPill: true, 24609 properties: propertiesToFilter2, 24610 showTooltip: true, 24611 children: () => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(preview_colors_default, {}) 24612 }, 24613 index2 24614 )) }) 24615 ] }); 24616 } 24617 24618 // packages/global-styles-ui/build-module/color-palette-panel.mjs 24619 var import_jsx_runtime68 = __toESM(require_jsx_runtime(), 1); 24620 24621 // packages/global-styles-ui/build-module/gradients-palette-panel.mjs 24622 var import_compose5 = __toESM(require_compose(), 1); 24623 var import_components41 = __toESM(require_components(), 1); 24624 var import_i18n27 = __toESM(require_i18n(), 1); 24625 var import_jsx_runtime69 = __toESM(require_jsx_runtime(), 1); 24626 24627 // packages/global-styles-ui/build-module/screen-color-palette.mjs 24628 var import_jsx_runtime70 = __toESM(require_jsx_runtime(), 1); 24629 24630 // packages/global-styles-ui/build-module/screen-background.mjs 24631 var import_i18n29 = __toESM(require_i18n(), 1); 24632 var import_block_editor9 = __toESM(require_block_editor(), 1); 24633 var import_components42 = __toESM(require_components(), 1); 24634 24635 // packages/global-styles-ui/build-module/background-panel.mjs 24636 var import_block_editor8 = __toESM(require_block_editor(), 1); 24637 var import_jsx_runtime71 = __toESM(require_jsx_runtime(), 1); 24638 var { BackgroundPanel: StylesBackgroundPanel2 } = unlock3( 24639 import_block_editor8.privateApis 24640 ); 24641 24642 // packages/global-styles-ui/build-module/screen-background.mjs 24643 var import_jsx_runtime72 = __toESM(require_jsx_runtime(), 1); 24644 var { useHasBackgroundPanel: useHasBackgroundPanel4 } = unlock3(import_block_editor9.privateApis); 24645 24646 // packages/global-styles-ui/build-module/shadows-panel.mjs 24647 var import_components44 = __toESM(require_components(), 1); 24648 var import_i18n31 = __toESM(require_i18n(), 1); 24649 var import_element42 = __toESM(require_element(), 1); 24650 24651 // packages/global-styles-ui/build-module/confirm-reset-shadow-dialog.mjs 24652 var import_components43 = __toESM(require_components(), 1); 24653 var import_i18n30 = __toESM(require_i18n(), 1); 24654 var import_jsx_runtime73 = __toESM(require_jsx_runtime(), 1); 24655 24656 // packages/global-styles-ui/build-module/shadows-panel.mjs 24657 var import_jsx_runtime74 = __toESM(require_jsx_runtime(), 1); 24658 var { Menu } = unlock3(import_components44.privateApis); 24659 24660 // packages/global-styles-ui/build-module/shadows-edit-panel.mjs 24661 var import_components45 = __toESM(require_components(), 1); 24662 var import_i18n32 = __toESM(require_i18n(), 1); 24663 var import_element43 = __toESM(require_element(), 1); 24664 var import_jsx_runtime75 = __toESM(require_jsx_runtime(), 1); 24665 var { Menu: Menu2 } = unlock3(import_components45.privateApis); 24666 var customShadowMenuItems = [ 24667 { 24668 label: (0, import_i18n32.__)("Rename"), 24669 action: "rename" 24670 }, 24671 { 24672 label: (0, import_i18n32.__)("Delete"), 24673 action: "delete" 24674 } 24675 ]; 24676 var presetShadowMenuItems = [ 24677 { 24678 label: (0, import_i18n32.__)("Reset"), 24679 action: "reset" 24680 } 24681 ]; 24682 24683 // packages/global-styles-ui/build-module/screen-shadows.mjs 24684 var import_jsx_runtime76 = __toESM(require_jsx_runtime(), 1); 24685 24686 // packages/global-styles-ui/build-module/screen-layout.mjs 24687 var import_i18n33 = __toESM(require_i18n(), 1); 24688 var import_block_editor11 = __toESM(require_block_editor(), 1); 24689 24690 // packages/global-styles-ui/build-module/dimensions-panel.mjs 24691 var import_block_editor10 = __toESM(require_block_editor(), 1); 24692 var import_element44 = __toESM(require_element(), 1); 24693 var import_jsx_runtime77 = __toESM(require_jsx_runtime(), 1); 24694 var { useSettingsForBlockElement: useSettingsForBlockElement6, DimensionsPanel: StylesDimensionsPanel2 } = unlock3(import_block_editor10.privateApis); 24695 24696 // packages/global-styles-ui/build-module/screen-layout.mjs 24697 var import_jsx_runtime78 = __toESM(require_jsx_runtime(), 1); 24698 var { useHasDimensionsPanel: useHasDimensionsPanel4, useSettingsForBlockElement: useSettingsForBlockElement7 } = unlock3( 24699 import_block_editor11.privateApis 24700 ); 24701 24702 // packages/global-styles-ui/build-module/screen-style-variations.mjs 24703 var import_components48 = __toESM(require_components(), 1); 24704 var import_i18n36 = __toESM(require_i18n(), 1); 24705 24706 // packages/global-styles-ui/build-module/style-variations-content.mjs 24707 var import_i18n35 = __toESM(require_i18n(), 1); 24708 var import_components47 = __toESM(require_components(), 1); 24709 24710 // packages/global-styles-ui/build-module/style-variations-container.mjs 24711 var import_core_data9 = __toESM(require_core_data(), 1); 24712 var import_data9 = __toESM(require_data(), 1); 24713 var import_element45 = __toESM(require_element(), 1); 24714 var import_components46 = __toESM(require_components(), 1); 24715 var import_i18n34 = __toESM(require_i18n(), 1); 24716 var import_jsx_runtime79 = __toESM(require_jsx_runtime(), 1); 24717 function StyleVariationsContainer({ 24718 gap = 2 24719 }) { 24720 const { user } = (0, import_element45.useContext)(GlobalStylesContext); 24721 const userStyles = user?.styles; 24722 const variations = (0, import_data9.useSelect)((select) => { 24723 const result = select( 24724 import_core_data9.store 24725 ).__experimentalGetCurrentThemeGlobalStylesVariations(); 24726 return Array.isArray(result) ? result : void 0; 24727 }, []); 24728 const fullStyleVariations = variations?.filter( 24729 (variation) => { 24730 return !isVariationWithProperties(variation, ["color"]) && !isVariationWithProperties(variation, [ 24731 "typography", 24732 "spacing" 24733 ]); 24734 } 24735 ); 24736 const themeVariations = (0, import_element45.useMemo)(() => { 24737 const withEmptyVariation = [ 24738 { 24739 title: (0, import_i18n34.__)("Default"), 24740 settings: {}, 24741 styles: {} 24742 }, 24743 ...fullStyleVariations ?? [] 24744 ]; 24745 return [ 24746 ...withEmptyVariation.map((variation) => { 24747 const blockStyles = variation?.styles?.blocks ? { ...variation.styles.blocks } : {}; 24748 if (userStyles?.blocks) { 24749 Object.keys(userStyles.blocks).forEach((blockName) => { 24750 if (userStyles.blocks?.[blockName]?.css) { 24751 const variationBlockStyles = blockStyles[blockName] || {}; 24752 const customCSS = { 24753 css: `$blockStyles[blockName]?.css || ""} $userStyles.blocks?.[blockName]?.css?.trim() || ""}` 24754 }; 24755 blockStyles[blockName] = { 24756 ...variationBlockStyles, 24757 ...customCSS 24758 }; 24759 } 24760 }); 24761 } 24762 const css = userStyles?.css || variation.styles?.css ? { 24763 css: `$variation.styles?.css || ""} $userStyles?.css || ""}` 24764 } : {}; 24765 const blocks = Object.keys(blockStyles).length > 0 ? { blocks: blockStyles } : {}; 24766 const styles = { 24767 ...variation.styles, 24768 ...css, 24769 ...blocks 24770 }; 24771 return { 24772 ...variation, 24773 settings: variation.settings ?? {}, 24774 styles 24775 }; 24776 }) 24777 ]; 24778 }, [fullStyleVariations, userStyles?.blocks, userStyles?.css]); 24779 if (!fullStyleVariations || fullStyleVariations.length < 1) { 24780 return null; 24781 } 24782 return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)( 24783 import_components46.__experimentalGrid, 24784 { 24785 columns: 2, 24786 className: "global-styles-ui-style-variations-container", 24787 gap, 24788 children: themeVariations.map( 24789 (variation, index2) => /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Variation, { variation, children: (isFocused) => /* @__PURE__ */ (0, import_jsx_runtime79.jsx)( 24790 preview_styles_default, 24791 { 24792 label: variation?.title, 24793 withHoverView: true, 24794 isFocused, 24795 variation 24796 } 24797 ) }, index2) 24798 ) 24799 } 24800 ); 24801 } 24802 var style_variations_container_default = StyleVariationsContainer; 24803 24804 // packages/global-styles-ui/build-module/style-variations-content.mjs 24805 var import_jsx_runtime80 = __toESM(require_jsx_runtime(), 1); 24806 24807 // packages/global-styles-ui/build-module/screen-style-variations.mjs 24808 var import_jsx_runtime81 = __toESM(require_jsx_runtime(), 1); 24809 24810 // packages/global-styles-ui/build-module/screen-css.mjs 24811 var import_i18n37 = __toESM(require_i18n(), 1); 24812 var import_components49 = __toESM(require_components(), 1); 24813 var import_block_editor12 = __toESM(require_block_editor(), 1); 24814 var import_jsx_runtime82 = __toESM(require_jsx_runtime(), 1); 24815 var { AdvancedPanel: StylesAdvancedPanel2 } = unlock3(import_block_editor12.privateApis); 24816 24817 // packages/global-styles-ui/build-module/screen-revisions/index.mjs 24818 var import_i18n40 = __toESM(require_i18n(), 1); 24819 var import_components52 = __toESM(require_components(), 1); 24820 var import_element47 = __toESM(require_element(), 1); 24821 24822 // packages/global-styles-ui/build-module/screen-revisions/use-global-styles-revisions.mjs 24823 var import_data10 = __toESM(require_data(), 1); 24824 var import_core_data10 = __toESM(require_core_data(), 1); 24825 var import_element46 = __toESM(require_element(), 1); 24826 24827 // packages/global-styles-ui/build-module/screen-revisions/revisions-buttons.mjs 24828 var import_i18n38 = __toESM(require_i18n(), 1); 24829 var import_components50 = __toESM(require_components(), 1); 24830 var import_date = __toESM(require_date(), 1); 24831 var import_core_data11 = __toESM(require_core_data(), 1); 24832 var import_data11 = __toESM(require_data(), 1); 24833 var import_keycodes2 = __toESM(require_keycodes(), 1); 24834 var import_jsx_runtime83 = __toESM(require_jsx_runtime(), 1); 24835 var { Badge: WCBadge } = unlock3(import_components50.privateApis); 24836 var DAY_IN_MILLISECONDS = 60 * 60 * 1e3 * 24; 24837 24838 // packages/global-styles-ui/build-module/pagination/index.mjs 24839 var import_components51 = __toESM(require_components(), 1); 24840 var import_i18n39 = __toESM(require_i18n(), 1); 24841 var import_jsx_runtime84 = __toESM(require_jsx_runtime(), 1); 24842 24843 // packages/global-styles-ui/build-module/screen-revisions/index.mjs 24844 var import_jsx_runtime85 = __toESM(require_jsx_runtime(), 1); 24845 24846 // packages/global-styles-ui/build-module/font-sizes/font-sizes.mjs 24847 var import_i18n42 = __toESM(require_i18n(), 1); 24848 var import_components54 = __toESM(require_components(), 1); 24849 var import_element48 = __toESM(require_element(), 1); 24850 24851 // packages/global-styles-ui/build-module/font-sizes/confirm-reset-font-sizes-dialog.mjs 24852 var import_components53 = __toESM(require_components(), 1); 24853 var import_i18n41 = __toESM(require_i18n(), 1); 24854 var import_jsx_runtime86 = __toESM(require_jsx_runtime(), 1); 24855 24856 // packages/global-styles-ui/build-module/font-sizes/font-sizes.mjs 24857 var import_jsx_runtime87 = __toESM(require_jsx_runtime(), 1); 24858 var { Menu: Menu3 } = unlock3(import_components54.privateApis); 24859 24860 // packages/global-styles-ui/build-module/font-sizes/font-size.mjs 24861 var import_i18n46 = __toESM(require_i18n(), 1); 24862 var import_components58 = __toESM(require_components(), 1); 24863 var import_element50 = __toESM(require_element(), 1); 24864 24865 // packages/global-styles-ui/build-module/font-sizes/font-size-preview.mjs 24866 var import_block_editor13 = __toESM(require_block_editor(), 1); 24867 var import_i18n43 = __toESM(require_i18n(), 1); 24868 var import_jsx_runtime88 = __toESM(require_jsx_runtime(), 1); 24869 24870 // packages/global-styles-ui/build-module/font-sizes/confirm-delete-font-size-dialog.mjs 24871 var import_components55 = __toESM(require_components(), 1); 24872 var import_i18n44 = __toESM(require_i18n(), 1); 24873 var import_jsx_runtime89 = __toESM(require_jsx_runtime(), 1); 24874 24875 // packages/global-styles-ui/build-module/font-sizes/rename-font-size-dialog.mjs 24876 var import_components56 = __toESM(require_components(), 1); 24877 var import_i18n45 = __toESM(require_i18n(), 1); 24878 var import_element49 = __toESM(require_element(), 1); 24879 var import_jsx_runtime90 = __toESM(require_jsx_runtime(), 1); 24880 24881 // packages/global-styles-ui/build-module/size-control/index.mjs 24882 var import_components57 = __toESM(require_components(), 1); 24883 var import_jsx_runtime91 = __toESM(require_jsx_runtime(), 1); 24884 24885 // packages/global-styles-ui/build-module/font-sizes/font-size.mjs 24886 var import_jsx_runtime92 = __toESM(require_jsx_runtime(), 1); 24887 var { Menu: Menu4 } = unlock3(import_components58.privateApis); 24888 24889 // packages/global-styles-ui/build-module/global-styles-ui.mjs 24890 var import_jsx_runtime93 = __toESM(require_jsx_runtime(), 1); 24891 24892 // packages/global-styles-ui/build-module/with-global-styles-provider.mjs 24893 var import_jsx_runtime94 = __toESM(require_jsx_runtime(), 1); 24894 function withGlobalStylesProvider(Component) { 24895 return function WrappedComponent({ 24896 value, 24897 baseValue, 24898 onChange, 24899 ...props 24900 }) { 24901 return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)( 24902 GlobalStylesProvider, 24903 { 24904 value, 24905 baseValue, 24906 onChange, 24907 children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Component, { ...props }) 24908 } 24909 ); 24910 }; 24911 } 24912 24913 // packages/global-styles-ui/build-module/style-variations.mjs 24914 var StyleVariations = withGlobalStylesProvider(style_variations_container_default); 24915 24916 // packages/global-styles-ui/build-module/color-variations.mjs 24917 var ColorVariations2 = withGlobalStylesProvider(ColorVariations); 24918 24919 // packages/global-styles-ui/build-module/typography-variations.mjs 24920 var TypographyVariations2 = withGlobalStylesProvider(TypographyVariations); 24921 24922 // packages/global-styles-ui/build-module/font-library/font-library.mjs 24923 var import_jsx_runtime95 = __toESM(require_jsx_runtime(), 1); 24924 function FontLibrary({ 24925 value, 24926 baseValue, 24927 onChange, 24928 activeTab = "installed-fonts" 24929 }) { 24930 let content; 24931 switch (activeTab) { 24932 case "upload-fonts": 24933 content = /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(upload_fonts_default, {}); 24934 break; 24935 case "installed-fonts": 24936 content = /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(installed_fonts_default, {}); 24937 break; 24938 default: 24939 content = /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(font_collection_default, { slug: activeTab }); 24940 } 24941 return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)( 24942 GlobalStylesProvider, 24943 { 24944 value, 24945 baseValue, 24946 onChange, 24947 children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(context_default, { children: content }) 24948 } 24949 ); 24950 } 24951 24952 // routes/font-list/lock-unlock.ts 24953 var import_private_apis5 = __toESM(require_private_apis()); 24954 var { unlock: unlock4 } = (0, import_private_apis5.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 24955 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 24956 "@wordpress/font-list-route" 24957 ); 24958 24959 // routes/font-list/style.scss 24960 if (typeof document !== "undefined" && true && !document.head.querySelector("style[data-wp-hash='911f938962']")) { 24961 const style = document.createElement("style"); 24962 style.setAttribute("data-wp-hash", "911f938962"); 24963 style.appendChild(document.createTextNode('@media (min-width:782px){.font-library-modal.font-library-modal{width:65vw}}.font-library-modal .components-modal__header{border-bottom:none}.font-library-modal .components-modal__content{margin-bottom:90px;padding:0}.font-library-modal .font-library__subtitle{font-size:11px;font-weight:var(--wpds-typography-font-weight-emphasis,600);text-transform:uppercase}.font-library-modal__tab-panel{height:calc(100% - 50px)}.font-library__tabpanel-layout{display:flex;flex-direction:column;height:100%}.font-library__tabpanel-layout>div{flex-grow:1}.font-library__tabpanel-layout .font-library__loading{align-items:center;box-sizing:border-box;display:flex;height:100%;justify-content:center;left:0;padding-top:124px;position:absolute;top:0;width:100%}.font-library__footer,.font-library__tabpanel-layout .components-navigator-screen{padding:24px;width:100%}.font-library__footer{background-color:#fff;border-top:1px solid #ddd;bottom:0;box-sizing:border-box;flex-grow:0!important;flex-shrink:0;height:90px;position:absolute}.font-library__page-selection{font-size:11px;font-weight:var(--wpds-typography-font-weight-emphasis,600);text-transform:uppercase}@media (min-width:600px){.font-library__page-selection .font-library__page-selection-trigger{font-size:11px!important;font-weight:var(--wpds-typography-font-weight-emphasis,600)}}.font-library__fonts-title{font-size:11px;font-weight:var(--wpds-typography-font-weight-emphasis,600);margin-bottom:0;margin-top:0;text-transform:uppercase}.font-library__fonts-list{list-style:none;margin-bottom:0;margin-top:0;padding:0}.font-library__fonts-list-item{margin-bottom:0}.font-library__font-card{border:1px solid #ddd;box-sizing:border-box;height:auto!important;margin-top:-1px;padding:16px;width:100%}.font-library__font-card:hover{background-color:#f0f0f0}.font-library__font-card:focus{position:relative}.font-library__font-card .font-library__font-card__name{font-weight:700}.font-library__font-card .font-library__font-card__count{color:#757575}.font-library__font-card .font-library__font-variant_demo-image{display:block;height:24px;width:auto}.font-library__font-card .font-library__font-variant_demo-text{flex-shrink:0;white-space:nowrap}@media not (prefers-reduced-motion){.font-library__font-card .font-library__font-variant_demo-text{transition:opacity .3s ease-in-out}}.font-library-modal__tablist-container{background:#fff;border-bottom:1px solid #ddd;position:sticky;top:0;z-index:1}.font-library__upload-area{align-items:center;display:flex;height:256px!important;justify-content:center;width:100%}button.font-library__upload-area{background-color:#f0f0f0}.font-library__local-fonts{margin:24px auto;width:80%}.font-library__local-fonts .font-library__upload-area__text{color:#757575}.font-library__google-fonts-confirm{align-items:center;display:flex;justify-content:center;margin-top:64px}.font-library__google-fonts-confirm p{line-height:1.4}.font-library__google-fonts-confirm h2{font-size:1.2rem;font-weight:400}.font-library__google-fonts-confirm .components-card{padding:16px;width:400px}.font-library__google-fonts-confirm .components-button{justify-content:center;width:100%}.font-library__select-all{padding:16px 16px 16px 17px}.font-library__select-all .components-checkbox-control__label{padding-left:16px}.global-styles-ui-pagination .components-button.is-tertiary{height:32px;justify-content:center;width:32px}.global-styles-ui-screen-revisions__revisions-list{flex-grow:1;list-style:none;margin:0 16px 16px}.global-styles-ui-screen-revisions__revisions-list li{margin-bottom:0}.global-styles-ui-screen-revisions__revision-item{cursor:var(--wpds-cursor-control,pointer);display:flex;flex-direction:column;position:relative}.global-styles-ui-screen-revisions__revision-item[role=option]:active,.global-styles-ui-screen-revisions__revision-item[role=option]:focus{box-shadow:0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);outline:2px solid transparent}.global-styles-ui-screen-revisions__revision-item:hover{background:rgba(var(--wp-admin-theme-color--rgb),.04)}.global-styles-ui-screen-revisions__revision-item:hover .global-styles-ui-screen-revisions__date{color:var(--wp-admin-theme-color)}.global-styles-ui-screen-revisions__revision-item:after,.global-styles-ui-screen-revisions__revision-item:before{content:"\\a";display:block;position:absolute}.global-styles-ui-screen-revisions__revision-item:before{background:#ddd;border:4px solid transparent;border-radius:50%;height:8px;left:17px;top:18px;transform:translate(-50%,-50%);width:8px;z-index:1}.global-styles-ui-screen-revisions__revision-item[aria-selected=true]{background:rgba(var(--wp-admin-theme-color--rgb),.04);border-radius:2px;color:var(--wp-admin-theme-color);outline:3px solid transparent;outline-offset:-2px}.global-styles-ui-screen-revisions__revision-item[aria-selected=true] .global-styles-ui-screen-revisions__date{color:var(--wp-admin-theme-color)}.global-styles-ui-screen-revisions__revision-item[aria-selected=true]:before{background:var(--wp-admin-theme-color)}.global-styles-ui-screen-revisions__revision-item[aria-selected=true] .global-styles-ui-screen-revisions__changes>li,.global-styles-ui-screen-revisions__revision-item[aria-selected=true] .global-styles-ui-screen-revisions__meta{color:#1e1e1e}.global-styles-ui-screen-revisions__revision-item:after{border:.5px solid #ddd;height:100%;left:16px;top:0;width:0}.global-styles-ui-screen-revisions__revision-item:first-child:after{top:18px}.global-styles-ui-screen-revisions__revision-item:last-child:after{height:18px}.global-styles-ui-screen-revisions__revision-item-wrapper{display:block;padding:12px 12px 4px 40px}.global-styles-ui-screen-revisions__active-badge,.global-styles-ui-screen-revisions__apply-button.is-primary{align-self:flex-start;margin:0 12px 12px 40px}.global-styles-ui-screen-revisions__changes,.global-styles-ui-screen-revisions__meta{color:#757575;font-size:12px}.global-styles-ui-screen-revisions__description{align-items:flex-start;display:flex;flex-direction:column;gap:8px}.global-styles-ui-screen-revisions__description .global-styles-ui-screen-revisions__date{font-size:12px;font-weight:var(--wpds-typography-font-weight-emphasis,600);text-transform:uppercase}.global-styles-ui-screen-revisions__meta{align-items:flex-start;display:flex;justify-content:start;margin-bottom:4px;text-align:left;width:100%}.global-styles-ui-screen-revisions__meta img{border-radius:100%;height:16px;margin-right:8px;width:16px}.global-styles-ui-screen-revisions__loading{margin:24px auto!important}.global-styles-ui-screen-revisions__changes{line-height:1.4;list-style:disc;margin-left:12px;text-align:left}.global-styles-ui-screen-revisions__changes li{margin-bottom:4px}.global-styles-ui-screen-revisions__pagination.global-styles-ui-screen-revisions__pagination{gap:2px;justify-content:space-between}.global-styles-ui-screen-revisions__pagination.global-styles-ui-screen-revisions__pagination .edit-site-pagination__total{height:1px;left:-1000px;margin:-1px;overflow:hidden;position:absolute}.global-styles-ui-screen-revisions__pagination.global-styles-ui-screen-revisions__pagination .components-text{font-size:12px;will-change:opacity}.global-styles-ui-screen-revisions__pagination.global-styles-ui-screen-revisions__pagination .components-button.is-tertiary{color:#1e1e1e}.global-styles-ui-screen-revisions__pagination.global-styles-ui-screen-revisions__pagination .components-button.is-tertiary:disabled,.global-styles-ui-screen-revisions__pagination.global-styles-ui-screen-revisions__pagination .components-button.is-tertiary[aria-disabled=true]{color:#949494}.global-styles-ui-screen-revisions__footer{background:#fff;border-top:1px solid #ddd;bottom:0;box-sizing:border-box;height:56px;min-width:100%;padding:12px;position:sticky;z-index:1}.global-styles-ui-variations_item{box-sizing:border-box;cursor:var(--wpds-cursor-control,pointer)}.global-styles-ui-variations_item .global-styles-ui-variations_item-preview{border-radius:2px;outline:1px solid rgba(0,0,0,.1);outline-offset:-1px;overflow:hidden;position:relative}@media not (prefers-reduced-motion){.global-styles-ui-variations_item .global-styles-ui-variations_item-preview{transition:outline .1s linear}}.global-styles-ui-variations_item .global-styles-ui-variations_item-preview.is-pill{height:32px}.global-styles-ui-variations_item .global-styles-ui-variations_item-preview.is-pill .block-editor-iframe__scale-container{overflow:hidden}.global-styles-ui-variations_item:not(.is-active):hover .global-styles-ui-variations_item-preview{outline-color:rgba(0,0,0,.3)}.global-styles-ui-variations_item.is-active .global-styles-ui-variations_item-preview,.global-styles-ui-variations_item:focus-visible .global-styles-ui-variations_item-preview{outline-color:#1e1e1e;outline-offset:1px;outline-width:var(--wp-admin-border-width-focus)}.global-styles-ui-variations_item:focus-visible .global-styles-ui-variations_item-preview{outline-color:var(--wp-admin-theme-color)}.global-styles-ui-preview__wrapper{display:block;max-width:100%;width:100%}.global-styles-ui-preview__wrapper.is-hoverable{cursor:var(--wpds-cursor-control,pointer)}.global-styles-ui-typography-preview{align-items:center;background:#f0f0f0;border-radius:2px;display:flex;justify-content:center;margin-bottom:20px;min-height:100px;overflow:hidden}.global-styles-ui-font-size__item{line-break:anywhere;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.global-styles-ui-font-size__item-value{color:#757575}.global-styles-ui-screen-typography__indicator{align-items:center;border-radius:2px;display:flex!important;font-size:14px;height:24px;justify-content:center;width:24px}.global-styles-ui-block-types-search{margin-bottom:10px;padding:0 16px}.global-styles-ui-screen-typography__font-variants-count{color:#757575}.global-styles-ui-font-families__manage-fonts{justify-content:center}.global-styles-ui-screen .color-block-support-panel{border-top:none;padding-left:0;padding-right:0;padding-top:0;row-gap:12px}.global-styles-ui-header{line-height:1.9!important;margin-bottom:0!important}.global-styles-ui-subtitle{font-size:11px!important;font-weight:var(--wpds-typography-font-weight-emphasis,600)!important;margin-bottom:0!important;text-transform:uppercase}.global-styles-ui-section-title{color:#2f2f2f;font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:1.2;margin:0;padding:16px 16px 0}.global-styles-ui-icon-with-current-color{fill:currentColor}.global-styles-ui__color-indicator-wrapper{flex-shrink:0;height:24px}.global-styles-ui__shadows-panel__options-container,.global-styles-ui__typography-panel__options-container{height:24px}.global-styles-ui__block-preview-panel{border:1px solid #ddd;border-radius:2px;overflow:hidden;position:relative;width:100%}.global-styles-ui__shadow-preview-panel{background-image:repeating-linear-gradient(45deg,#e0e0e0 25%,transparent 0,transparent 75%,#e0e0e0 0,#e0e0e0),repeating-linear-gradient(45deg,#e0e0e0 25%,transparent 0,transparent 75%,#e0e0e0 0,#e0e0e0);background-position:0 0,8px 8px;background-size:16px 16px;border:1px solid #ddd;border-radius:2px;height:144px;overflow:auto}.global-styles-ui__shadow-preview-panel .global-styles-ui__shadow-preview-block{background-color:#fff;border:1px solid #ddd;border-radius:2px;height:60px;width:60%}.global-styles-ui__shadow-editor__dropdown-content{width:280px}.global-styles-ui__shadow-editor-panel{margin-bottom:4px}.global-styles-ui__shadow-editor__dropdown{position:relative;width:100%}.global-styles-ui__shadow-editor__dropdown-toggle{border-radius:inherit;height:auto;padding-bottom:8px;padding-top:8px;text-align:left;width:100%}.global-styles-ui__shadow-editor__dropdown-toggle.is-open{background:#f0f0f0;color:var(--wp-admin-theme-color)}.global-styles-ui__shadow-editor__remove-button{opacity:0;position:absolute;right:8px;top:8px}.global-styles-ui__shadow-editor__remove-button.global-styles-ui__shadow-editor__remove-button{border:none}.global-styles-ui__shadow-editor__dropdown-toggle:hover+.global-styles-ui__shadow-editor__remove-button,.global-styles-ui__shadow-editor__remove-button:focus,.global-styles-ui__shadow-editor__remove-button:hover{opacity:1}@media (hover:none){.global-styles-ui__shadow-editor__remove-button{opacity:1}}.global-styles-ui-screen-css{display:flex;flex:1 1 auto;flex-direction:column;margin:16px}.global-styles-ui-screen-css .block-editor-global-styles-advanced-panel{flex:1 1 auto}.global-styles-ui-screen-css .block-editor-global-styles-advanced-panel__custom-css-input,.global-styles-ui-screen-css .block-editor-global-styles-advanced-panel__custom-css-input .components-base-control__field{display:flex;flex:1 1 auto;flex-direction:column}.global-styles-ui-screen-css .block-editor-global-styles-advanced-panel__custom-css-input textarea{flex:1 1 auto}.global-styles-ui-screen-css-help-link{display:inline-block;margin-top:8px}.global-styles-ui-screen-variations{border-top:1px solid #ddd;margin-top:16px}.global-styles-ui-screen-variations>*{margin:24px 16px}.global-styles-ui-sidebar__navigator-provider{height:100%}.global-styles-ui-sidebar__navigator-screen{display:flex;flex-direction:column;height:100%}.global-styles-ui-color-palette__tablist-container{border-bottom:1px solid #ddd}.global-styles-ui-color-palette__tablist{margin-bottom:-1px}.global-styles-ui-sidebar__navigator-screen .single-column{grid-column:span 1}.global-styles-ui-screen-root.global-styles-ui-screen-root,.global-styles-ui-screen-style-variations.global-styles-ui-screen-style-variations{background:unset;color:inherit}.global-styles-ui-sidebar__panel .block-editor-block-icon svg{fill:currentColor}.global-styles-ui-screen-root__active-style-tile.global-styles-ui-screen-root__active-style-tile,.global-styles-ui-screen-root__active-style-tile.global-styles-ui-screen-root__active-style-tile .global-styles-ui-screen-root__active-style-tile-preview{border-radius:2px}.global-styles-ui-screen-root__active-style-tile-preview{clip-path:border-box}.global-styles-ui-color-palette-panel,.global-styles-ui-gradient-palette-panel{padding:16px}.font-library-page__tablist{border-bottom:1px solid #f0f0f0;padding:0 24px}.font-library-page__tab-panel{flex-grow:1;max-height:calc(100% - 110px);overflow:auto}.font-library-page:has(.font-library__footer) .font-library-page__tab-panel{max-height:calc(100% - 198px)}')); 24964 document.head.appendChild(style); 24965 } 24966 24967 // routes/font-list/stage.tsx 24968 var { Tabs: Tabs2 } = unlock4(import_components60.privateApis); 24969 var { useGlobalStyles } = unlock4(import_editor.privateApis); 24970 function FontLibraryPage() { 24971 const { records: collections = [] } = (0, import_core_data12.useEntityRecords)("root", "fontCollection", { 24972 _fields: "slug,name,description" 24973 }); 24974 const [activeTab, setActiveTab] = (0, import_element52.useState)("installed-fonts"); 24975 const { base, user, setUser, isReady } = useGlobalStyles(); 24976 const canUserCreate = (0, import_data13.useSelect)((select) => { 24977 return select(import_core_data12.store).canUser("create", { 24978 kind: "postType", 24979 name: "wp_font_family" 24980 }); 24981 }, []); 24982 if (!isReady) { 24983 return null; 24984 } 24985 const tabs = [ 24986 { 24987 id: "installed-fonts", 24988 title: (0, import_i18n47._x)("Library", "Font library") 24989 } 24990 ]; 24991 if (canUserCreate) { 24992 tabs.push({ 24993 id: "upload-fonts", 24994 title: (0, import_i18n47._x)("Upload", "noun") 24995 }); 24996 tabs.push( 24997 ...(collections || []).map(({ slug, name: name2 }) => ({ 24998 id: slug, 24999 title: collections && collections.length === 1 && slug === "google-fonts" ? (0, import_i18n47.__)("Install Fonts") : name2 25000 })) 25001 ); 25002 } 25003 return /* @__PURE__ */ React.createElement(page_default, { title: (0, import_i18n47.__)("Fonts"), className: "font-library-page" }, /* @__PURE__ */ React.createElement( 25004 Tabs2, 25005 { 25006 selectedTabId: activeTab, 25007 onSelect: (tabId) => setActiveTab(tabId) 25008 }, 25009 /* @__PURE__ */ React.createElement("div", { className: "font-library-page__tablist" }, /* @__PURE__ */ React.createElement(Tabs2.TabList, null, tabs.map(({ id, title }) => /* @__PURE__ */ React.createElement(Tabs2.Tab, { key: id, tabId: id }, title)))), 25010 tabs.map(({ id }) => /* @__PURE__ */ React.createElement( 25011 Tabs2.TabPanel, 25012 { 25013 key: id, 25014 tabId: id, 25015 focusable: false, 25016 className: "font-library-page__tab-panel" 25017 }, 25018 /* @__PURE__ */ React.createElement( 25019 FontLibrary, 25020 { 25021 value: user, 25022 baseValue: base, 25023 onChange: setUser, 25024 activeTab: id 25025 } 25026 ) 25027 )) 25028 )); 25029 } 25030 function Stage() { 25031 return /* @__PURE__ */ React.createElement(FontLibraryPage, null); 25032 } 25033 var stage = Stage; 25034 export { 25035 stage 25036 }; 25037 /*! Bundled license information: 25038 25039 use-sync-external-store/cjs/use-sync-external-store-shim.development.js: 25040 (** 25041 * @license React 25042 * use-sync-external-store-shim.development.js 25043 * 25044 * Copyright (c) Meta Platforms, Inc. and affiliates. 25045 * 25046 * This source code is licensed under the MIT license found in the 25047 * LICENSE file in the root directory of this source tree. 25048 *) 25049 25050 use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js: 25051 (** 25052 * @license React 25053 * use-sync-external-store-shim/with-selector.development.js 25054 * 25055 * Copyright (c) Meta Platforms, Inc. and affiliates. 25056 * 25057 * This source code is licensed under the MIT license found in the 25058 * LICENSE file in the root directory of this source tree. 25059 *) 25060 25061 is-plain-object/dist/is-plain-object.mjs: 25062 (*! 25063 * is-plain-object <https://github.com/jonschlinkert/is-plain-object> 25064 * 25065 * Copyright (c) 2014-2017, Jon Schlinkert. 25066 * Released under the MIT License. 25067 *) 25068 */
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Sat Jul 25 08:20:20 2026 | Cross-referenced by PHPXref |