[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 /******/ (() => { // webpackBootstrap 2 /******/ var __webpack_modules__ = ({ 3 4 /***/ 83: 5 /***/ ((__unused_webpack_module, exports, __webpack_require__) => { 6 7 "use strict"; 8 /** 9 * @license React 10 * use-sync-external-store-shim.production.js 11 * 12 * Copyright (c) Meta Platforms, Inc. and affiliates. 13 * 14 * This source code is licensed under the MIT license found in the 15 * LICENSE file in the root directory of this source tree. 16 */ 17 18 19 var React = __webpack_require__(1609); 20 function is(x, y) { 21 return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y); 22 } 23 var objectIs = "function" === typeof Object.is ? Object.is : is, 24 useState = React.useState, 25 useEffect = React.useEffect, 26 useLayoutEffect = React.useLayoutEffect, 27 useDebugValue = React.useDebugValue; 28 function useSyncExternalStore$2(subscribe, getSnapshot) { 29 var value = getSnapshot(), 30 _useState = useState({ inst: { value: value, getSnapshot: getSnapshot } }), 31 inst = _useState[0].inst, 32 forceUpdate = _useState[1]; 33 useLayoutEffect( 34 function () { 35 inst.value = value; 36 inst.getSnapshot = getSnapshot; 37 checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst }); 38 }, 39 [subscribe, value, getSnapshot] 40 ); 41 useEffect( 42 function () { 43 checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst }); 44 return subscribe(function () { 45 checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst }); 46 }); 47 }, 48 [subscribe] 49 ); 50 useDebugValue(value); 51 return value; 52 } 53 function checkIfSnapshotChanged(inst) { 54 var latestGetSnapshot = inst.getSnapshot; 55 inst = inst.value; 56 try { 57 var nextValue = latestGetSnapshot(); 58 return !objectIs(inst, nextValue); 59 } catch (error) { 60 return !0; 61 } 62 } 63 function useSyncExternalStore$1(subscribe, getSnapshot) { 64 return getSnapshot(); 65 } 66 var shim = 67 "undefined" === typeof window || 68 "undefined" === typeof window.document || 69 "undefined" === typeof window.document.createElement 70 ? useSyncExternalStore$1 71 : useSyncExternalStore$2; 72 exports.useSyncExternalStore = 73 void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim; 74 75 76 /***/ }), 77 78 /***/ 422: 79 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 80 81 "use strict"; 82 83 84 if (true) { 85 module.exports = __webpack_require__(83); 86 } else {} 87 88 89 /***/ }), 90 91 /***/ 1609: 92 /***/ ((module) => { 93 94 "use strict"; 95 module.exports = window["React"]; 96 97 /***/ }), 98 99 /***/ 4660: 100 /***/ ((module) => { 101 102 /** 103 * Credits: 104 * 105 * lib-font 106 * https://github.com/Pomax/lib-font 107 * https://github.com/Pomax/lib-font/blob/master/lib/inflate.js 108 * 109 * The MIT License (MIT) 110 * 111 * Copyright (c) 2020 pomax@nihongoresources.com 112 * 113 * Permission is hereby granted, free of charge, to any person obtaining a copy 114 * of this software and associated documentation files (the "Software"), to deal 115 * in the Software without restriction, including without limitation the rights 116 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 117 * copies of the Software, and to permit persons to whom the Software is 118 * furnished to do so, subject to the following conditions: 119 * 120 * The above copyright notice and this permission notice shall be included in all 121 * copies or substantial portions of the Software. 122 * 123 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 124 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 125 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 126 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 127 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 128 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 129 * SOFTWARE. 130 */ 131 132 /* eslint eslint-comments/no-unlimited-disable: 0 */ 133 /* eslint-disable */ 134 /* pako 1.0.10 nodeca/pako */(function(f){if(true){module.exports=f()}else { var g; }})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=undefined;if(!f&&c)return require(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=undefined,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ 135 'use strict'; 136 137 138 var TYPED_OK = (typeof Uint8Array !== 'undefined') && 139 (typeof Uint16Array !== 'undefined') && 140 (typeof Int32Array !== 'undefined'); 141 142 function _has(obj, key) { 143 return Object.prototype.hasOwnProperty.call(obj, key); 144 } 145 146 exports.assign = function (obj /*from1, from2, from3, ...*/) { 147 var sources = Array.prototype.slice.call(arguments, 1); 148 while (sources.length) { 149 var source = sources.shift(); 150 if (!source) { continue; } 151 152 if (typeof source !== 'object') { 153 throw new TypeError(source + 'must be non-object'); 154 } 155 156 for (var p in source) { 157 if (_has(source, p)) { 158 obj[p] = source[p]; 159 } 160 } 161 } 162 163 return obj; 164 }; 165 166 167 // reduce buffer size, avoiding mem copy 168 exports.shrinkBuf = function (buf, size) { 169 if (buf.length === size) { return buf; } 170 if (buf.subarray) { return buf.subarray(0, size); } 171 buf.length = size; 172 return buf; 173 }; 174 175 176 var fnTyped = { 177 arraySet: function (dest, src, src_offs, len, dest_offs) { 178 if (src.subarray && dest.subarray) { 179 dest.set(src.subarray(src_offs, src_offs + len), dest_offs); 180 return; 181 } 182 // Fallback to ordinary array 183 for (var i = 0; i < len; i++) { 184 dest[dest_offs + i] = src[src_offs + i]; 185 } 186 }, 187 // Join array of chunks to single array. 188 flattenChunks: function (chunks) { 189 var i, l, len, pos, chunk, result; 190 191 // calculate data length 192 len = 0; 193 for (i = 0, l = chunks.length; i < l; i++) { 194 len += chunks[i].length; 195 } 196 197 // join chunks 198 result = new Uint8Array(len); 199 pos = 0; 200 for (i = 0, l = chunks.length; i < l; i++) { 201 chunk = chunks[i]; 202 result.set(chunk, pos); 203 pos += chunk.length; 204 } 205 206 return result; 207 } 208 }; 209 210 var fnUntyped = { 211 arraySet: function (dest, src, src_offs, len, dest_offs) { 212 for (var i = 0; i < len; i++) { 213 dest[dest_offs + i] = src[src_offs + i]; 214 } 215 }, 216 // Join array of chunks to single array. 217 flattenChunks: function (chunks) { 218 return [].concat.apply([], chunks); 219 } 220 }; 221 222 223 // Enable/Disable typed arrays use, for testing 224 // 225 exports.setTyped = function (on) { 226 if (on) { 227 exports.Buf8 = Uint8Array; 228 exports.Buf16 = Uint16Array; 229 exports.Buf32 = Int32Array; 230 exports.assign(exports, fnTyped); 231 } else { 232 exports.Buf8 = Array; 233 exports.Buf16 = Array; 234 exports.Buf32 = Array; 235 exports.assign(exports, fnUntyped); 236 } 237 }; 238 239 exports.setTyped(TYPED_OK); 240 241 },{}],2:[function(require,module,exports){ 242 // String encode/decode helpers 243 'use strict'; 244 245 246 var utils = require('./common'); 247 248 249 // Quick check if we can use fast array to bin string conversion 250 // 251 // - apply(Array) can fail on Android 2.2 252 // - apply(Uint8Array) can fail on iOS 5.1 Safari 253 // 254 var STR_APPLY_OK = true; 255 var STR_APPLY_UIA_OK = true; 256 257 try { String.fromCharCode.apply(null, [ 0 ]); } catch (__) { STR_APPLY_OK = false; } 258 try { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; } 259 260 261 // Table with utf8 lengths (calculated by first byte of sequence) 262 // Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS, 263 // because max possible codepoint is 0x10ffff 264 var _utf8len = new utils.Buf8(256); 265 for (var q = 0; q < 256; q++) { 266 _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1); 267 } 268 _utf8len[254] = _utf8len[254] = 1; // Invalid sequence start 269 270 271 // convert string to array (typed, when possible) 272 exports.string2buf = function (str) { 273 var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0; 274 275 // count binary size 276 for (m_pos = 0; m_pos < str_len; m_pos++) { 277 c = str.charCodeAt(m_pos); 278 if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) { 279 c2 = str.charCodeAt(m_pos + 1); 280 if ((c2 & 0xfc00) === 0xdc00) { 281 c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); 282 m_pos++; 283 } 284 } 285 buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4; 286 } 287 288 // allocate buffer 289 buf = new utils.Buf8(buf_len); 290 291 // convert 292 for (i = 0, m_pos = 0; i < buf_len; m_pos++) { 293 c = str.charCodeAt(m_pos); 294 if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) { 295 c2 = str.charCodeAt(m_pos + 1); 296 if ((c2 & 0xfc00) === 0xdc00) { 297 c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); 298 m_pos++; 299 } 300 } 301 if (c < 0x80) { 302 /* one byte */ 303 buf[i++] = c; 304 } else if (c < 0x800) { 305 /* two bytes */ 306 buf[i++] = 0xC0 | (c >>> 6); 307 buf[i++] = 0x80 | (c & 0x3f); 308 } else if (c < 0x10000) { 309 /* three bytes */ 310 buf[i++] = 0xE0 | (c >>> 12); 311 buf[i++] = 0x80 | (c >>> 6 & 0x3f); 312 buf[i++] = 0x80 | (c & 0x3f); 313 } else { 314 /* four bytes */ 315 buf[i++] = 0xf0 | (c >>> 18); 316 buf[i++] = 0x80 | (c >>> 12 & 0x3f); 317 buf[i++] = 0x80 | (c >>> 6 & 0x3f); 318 buf[i++] = 0x80 | (c & 0x3f); 319 } 320 } 321 322 return buf; 323 }; 324 325 // Helper (used in 2 places) 326 function buf2binstring(buf, len) { 327 // On Chrome, the arguments in a function call that are allowed is `65534`. 328 // If the length of the buffer is smaller than that, we can use this optimization, 329 // otherwise we will take a slower path. 330 if (len < 65534) { 331 if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) { 332 return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len)); 333 } 334 } 335 336 var result = ''; 337 for (var i = 0; i < len; i++) { 338 result += String.fromCharCode(buf[i]); 339 } 340 return result; 341 } 342 343 344 // Convert byte array to binary string 345 exports.buf2binstring = function (buf) { 346 return buf2binstring(buf, buf.length); 347 }; 348 349 350 // Convert binary string (typed, when possible) 351 exports.binstring2buf = function (str) { 352 var buf = new utils.Buf8(str.length); 353 for (var i = 0, len = buf.length; i < len; i++) { 354 buf[i] = str.charCodeAt(i); 355 } 356 return buf; 357 }; 358 359 360 // convert array to string 361 exports.buf2string = function (buf, max) { 362 var i, out, c, c_len; 363 var len = max || buf.length; 364 365 // Reserve max possible length (2 words per char) 366 // NB: by unknown reasons, Array is significantly faster for 367 // String.fromCharCode.apply than Uint16Array. 368 var utf16buf = new Array(len * 2); 369 370 for (out = 0, i = 0; i < len;) { 371 c = buf[i++]; 372 // quick process ascii 373 if (c < 0x80) { utf16buf[out++] = c; continue; } 374 375 c_len = _utf8len[c]; 376 // skip 5 & 6 byte codes 377 if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; } 378 379 // apply mask on first byte 380 c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07; 381 // join the rest 382 while (c_len > 1 && i < len) { 383 c = (c << 6) | (buf[i++] & 0x3f); 384 c_len--; 385 } 386 387 // terminated by end of string? 388 if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; } 389 390 if (c < 0x10000) { 391 utf16buf[out++] = c; 392 } else { 393 c -= 0x10000; 394 utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff); 395 utf16buf[out++] = 0xdc00 | (c & 0x3ff); 396 } 397 } 398 399 return buf2binstring(utf16buf, out); 400 }; 401 402 403 // Calculate max possible position in utf8 buffer, 404 // that will not break sequence. If that's not possible 405 // - (very small limits) return max size as is. 406 // 407 // buf[] - utf8 bytes array 408 // max - length limit (mandatory); 409 exports.utf8border = function (buf, max) { 410 var pos; 411 412 max = max || buf.length; 413 if (max > buf.length) { max = buf.length; } 414 415 // go back from last position, until start of sequence found 416 pos = max - 1; 417 while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; } 418 419 // Very small and broken sequence, 420 // return max, because we should return something anyway. 421 if (pos < 0) { return max; } 422 423 // If we came to start of buffer - that means buffer is too small, 424 // return max too. 425 if (pos === 0) { return max; } 426 427 return (pos + _utf8len[buf[pos]] > max) ? pos : max; 428 }; 429 430 },{"./common":1}],3:[function(require,module,exports){ 431 'use strict'; 432 433 // Note: adler32 takes 12% for level 0 and 2% for level 6. 434 // It isn't worth it to make additional optimizations as in original. 435 // Small size is preferable. 436 437 // (C) 1995-2013 Jean-loup Gailly and Mark Adler 438 // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin 439 // 440 // This software is provided 'as-is', without any express or implied 441 // warranty. In no event will the authors be held liable for any damages 442 // arising from the use of this software. 443 // 444 // Permission is granted to anyone to use this software for any purpose, 445 // including commercial applications, and to alter it and redistribute it 446 // freely, subject to the following restrictions: 447 // 448 // 1. The origin of this software must not be misrepresented; you must not 449 // claim that you wrote the original software. If you use this software 450 // in a product, an acknowledgment in the product documentation would be 451 // appreciated but is not required. 452 // 2. Altered source versions must be plainly marked as such, and must not be 453 // misrepresented as being the original software. 454 // 3. This notice may not be removed or altered from any source distribution. 455 456 function adler32(adler, buf, len, pos) { 457 var s1 = (adler & 0xffff) |0, 458 s2 = ((adler >>> 16) & 0xffff) |0, 459 n = 0; 460 461 while (len !== 0) { 462 // Set limit ~ twice less than 5552, to keep 463 // s2 in 31-bits, because we force signed ints. 464 // in other case %= will fail. 465 n = len > 2000 ? 2000 : len; 466 len -= n; 467 468 do { 469 s1 = (s1 + buf[pos++]) |0; 470 s2 = (s2 + s1) |0; 471 } while (--n); 472 473 s1 %= 65521; 474 s2 %= 65521; 475 } 476 477 return (s1 | (s2 << 16)) |0; 478 } 479 480 481 module.exports = adler32; 482 483 },{}],4:[function(require,module,exports){ 484 'use strict'; 485 486 // (C) 1995-2013 Jean-loup Gailly and Mark Adler 487 // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin 488 // 489 // This software is provided 'as-is', without any express or implied 490 // warranty. In no event will the authors be held liable for any damages 491 // arising from the use of this software. 492 // 493 // Permission is granted to anyone to use this software for any purpose, 494 // including commercial applications, and to alter it and redistribute it 495 // freely, subject to the following restrictions: 496 // 497 // 1. The origin of this software must not be misrepresented; you must not 498 // claim that you wrote the original software. If you use this software 499 // in a product, an acknowledgment in the product documentation would be 500 // appreciated but is not required. 501 // 2. Altered source versions must be plainly marked as such, and must not be 502 // misrepresented as being the original software. 503 // 3. This notice may not be removed or altered from any source distribution. 504 505 module.exports = { 506 507 /* Allowed flush values; see deflate() and inflate() below for details */ 508 Z_NO_FLUSH: 0, 509 Z_PARTIAL_FLUSH: 1, 510 Z_SYNC_FLUSH: 2, 511 Z_FULL_FLUSH: 3, 512 Z_FINISH: 4, 513 Z_BLOCK: 5, 514 Z_TREES: 6, 515 516 /* Return codes for the compression/decompression functions. Negative values 517 * are errors, positive values are used for special but normal events. 518 */ 519 Z_OK: 0, 520 Z_STREAM_END: 1, 521 Z_NEED_DICT: 2, 522 Z_ERRNO: -1, 523 Z_STREAM_ERROR: -2, 524 Z_DATA_ERROR: -3, 525 //Z_MEM_ERROR: -4, 526 Z_BUF_ERROR: -5, 527 //Z_VERSION_ERROR: -6, 528 529 /* compression levels */ 530 Z_NO_COMPRESSION: 0, 531 Z_BEST_SPEED: 1, 532 Z_BEST_COMPRESSION: 9, 533 Z_DEFAULT_COMPRESSION: -1, 534 535 536 Z_FILTERED: 1, 537 Z_HUFFMAN_ONLY: 2, 538 Z_RLE: 3, 539 Z_FIXED: 4, 540 Z_DEFAULT_STRATEGY: 0, 541 542 /* Possible values of the data_type field (though see inflate()) */ 543 Z_BINARY: 0, 544 Z_TEXT: 1, 545 //Z_ASCII: 1, // = Z_TEXT (deprecated) 546 Z_UNKNOWN: 2, 547 548 /* The deflate compression method */ 549 Z_DEFLATED: 8 550 //Z_NULL: null // Use -1 or null inline, depending on var type 551 }; 552 553 },{}],5:[function(require,module,exports){ 554 'use strict'; 555 556 // Note: we can't get significant speed boost here. 557 // So write code to minimize size - no pregenerated tables 558 // and array tools dependencies. 559 560 // (C) 1995-2013 Jean-loup Gailly and Mark Adler 561 // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin 562 // 563 // This software is provided 'as-is', without any express or implied 564 // warranty. In no event will the authors be held liable for any damages 565 // arising from the use of this software. 566 // 567 // Permission is granted to anyone to use this software for any purpose, 568 // including commercial applications, and to alter it and redistribute it 569 // freely, subject to the following restrictions: 570 // 571 // 1. The origin of this software must not be misrepresented; you must not 572 // claim that you wrote the original software. If you use this software 573 // in a product, an acknowledgment in the product documentation would be 574 // appreciated but is not required. 575 // 2. Altered source versions must be plainly marked as such, and must not be 576 // misrepresented as being the original software. 577 // 3. This notice may not be removed or altered from any source distribution. 578 579 // Use ordinary array, since untyped makes no boost here 580 function makeTable() { 581 var c, table = []; 582 583 for (var n = 0; n < 256; n++) { 584 c = n; 585 for (var k = 0; k < 8; k++) { 586 c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1)); 587 } 588 table[n] = c; 589 } 590 591 return table; 592 } 593 594 // Create table on load. Just 255 signed longs. Not a problem. 595 var crcTable = makeTable(); 596 597 598 function crc32(crc, buf, len, pos) { 599 var t = crcTable, 600 end = pos + len; 601 602 crc ^= -1; 603 604 for (var i = pos; i < end; i++) { 605 crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF]; 606 } 607 608 return (crc ^ (-1)); // >>> 0; 609 } 610 611 612 module.exports = crc32; 613 614 },{}],6:[function(require,module,exports){ 615 'use strict'; 616 617 // (C) 1995-2013 Jean-loup Gailly and Mark Adler 618 // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin 619 // 620 // This software is provided 'as-is', without any express or implied 621 // warranty. In no event will the authors be held liable for any damages 622 // arising from the use of this software. 623 // 624 // Permission is granted to anyone to use this software for any purpose, 625 // including commercial applications, and to alter it and redistribute it 626 // freely, subject to the following restrictions: 627 // 628 // 1. The origin of this software must not be misrepresented; you must not 629 // claim that you wrote the original software. If you use this software 630 // in a product, an acknowledgment in the product documentation would be 631 // appreciated but is not required. 632 // 2. Altered source versions must be plainly marked as such, and must not be 633 // misrepresented as being the original software. 634 // 3. This notice may not be removed or altered from any source distribution. 635 636 function GZheader() { 637 /* true if compressed data believed to be text */ 638 this.text = 0; 639 /* modification time */ 640 this.time = 0; 641 /* extra flags (not used when writing a gzip file) */ 642 this.xflags = 0; 643 /* operating system */ 644 this.os = 0; 645 /* pointer to extra field or Z_NULL if none */ 646 this.extra = null; 647 /* extra field length (valid if extra != Z_NULL) */ 648 this.extra_len = 0; // Actually, we don't need it in JS, 649 // but leave for few code modifications 650 651 // 652 // Setup limits is not necessary because in js we should not preallocate memory 653 // for inflate use constant limit in 65536 bytes 654 // 655 656 /* space at extra (only when reading header) */ 657 // this.extra_max = 0; 658 /* pointer to zero-terminated file name or Z_NULL */ 659 this.name = ''; 660 /* space at name (only when reading header) */ 661 // this.name_max = 0; 662 /* pointer to zero-terminated comment or Z_NULL */ 663 this.comment = ''; 664 /* space at comment (only when reading header) */ 665 // this.comm_max = 0; 666 /* true if there was or will be a header crc */ 667 this.hcrc = 0; 668 /* true when done reading gzip header (not used when writing a gzip file) */ 669 this.done = false; 670 } 671 672 module.exports = GZheader; 673 674 },{}],7:[function(require,module,exports){ 675 'use strict'; 676 677 // (C) 1995-2013 Jean-loup Gailly and Mark Adler 678 // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin 679 // 680 // This software is provided 'as-is', without any express or implied 681 // warranty. In no event will the authors be held liable for any damages 682 // arising from the use of this software. 683 // 684 // Permission is granted to anyone to use this software for any purpose, 685 // including commercial applications, and to alter it and redistribute it 686 // freely, subject to the following restrictions: 687 // 688 // 1. The origin of this software must not be misrepresented; you must not 689 // claim that you wrote the original software. If you use this software 690 // in a product, an acknowledgment in the product documentation would be 691 // appreciated but is not required. 692 // 2. Altered source versions must be plainly marked as such, and must not be 693 // misrepresented as being the original software. 694 // 3. This notice may not be removed or altered from any source distribution. 695 696 // See state defs from inflate.js 697 var BAD = 30; /* got a data error -- remain here until reset */ 698 var TYPE = 12; /* i: waiting for type bits, including last-flag bit */ 699 700 /* 701 Decode literal, length, and distance codes and write out the resulting 702 literal and match bytes until either not enough input or output is 703 available, an end-of-block is encountered, or a data error is encountered. 704 When large enough input and output buffers are supplied to inflate(), for 705 example, a 16K input buffer and a 64K output buffer, more than 95% of the 706 inflate execution time is spent in this routine. 707 708 Entry assumptions: 709 710 state.mode === LEN 711 strm.avail_in >= 6 712 strm.avail_out >= 258 713 start >= strm.avail_out 714 state.bits < 8 715 716 On return, state.mode is one of: 717 718 LEN -- ran out of enough output space or enough available input 719 TYPE -- reached end of block code, inflate() to interpret next block 720 BAD -- error in block data 721 722 Notes: 723 724 - The maximum input bits used by a length/distance pair is 15 bits for the 725 length code, 5 bits for the length extra, 15 bits for the distance code, 726 and 13 bits for the distance extra. This totals 48 bits, or six bytes. 727 Therefore if strm.avail_in >= 6, then there is enough input to avoid 728 checking for available input while decoding. 729 730 - The maximum bytes that a single length/distance pair can output is 258 731 bytes, which is the maximum length that can be coded. inflate_fast() 732 requires strm.avail_out >= 258 for each loop to avoid checking for 733 output space. 734 */ 735 module.exports = function inflate_fast(strm, start) { 736 var state; 737 var _in; /* local strm.input */ 738 var last; /* have enough input while in < last */ 739 var _out; /* local strm.output */ 740 var beg; /* inflate()'s initial strm.output */ 741 var end; /* while out < end, enough space available */ 742 //#ifdef INFLATE_STRICT 743 var dmax; /* maximum distance from zlib header */ 744 //#endif 745 var wsize; /* window size or zero if not using window */ 746 var whave; /* valid bytes in the window */ 747 var wnext; /* window write index */ 748 // Use `s_window` instead `window`, avoid conflict with instrumentation tools 749 var s_window; /* allocated sliding window, if wsize != 0 */ 750 var hold; /* local strm.hold */ 751 var bits; /* local strm.bits */ 752 var lcode; /* local strm.lencode */ 753 var dcode; /* local strm.distcode */ 754 var lmask; /* mask for first level of length codes */ 755 var dmask; /* mask for first level of distance codes */ 756 var here; /* retrieved table entry */ 757 var op; /* code bits, operation, extra bits, or */ 758 /* window position, window bytes to copy */ 759 var len; /* match length, unused bytes */ 760 var dist; /* match distance */ 761 var from; /* where to copy match from */ 762 var from_source; 763 764 765 var input, output; // JS specific, because we have no pointers 766 767 /* copy state to local variables */ 768 state = strm.state; 769 //here = state.here; 770 _in = strm.next_in; 771 input = strm.input; 772 last = _in + (strm.avail_in - 5); 773 _out = strm.next_out; 774 output = strm.output; 775 beg = _out - (start - strm.avail_out); 776 end = _out + (strm.avail_out - 257); 777 //#ifdef INFLATE_STRICT 778 dmax = state.dmax; 779 //#endif 780 wsize = state.wsize; 781 whave = state.whave; 782 wnext = state.wnext; 783 s_window = state.window; 784 hold = state.hold; 785 bits = state.bits; 786 lcode = state.lencode; 787 dcode = state.distcode; 788 lmask = (1 << state.lenbits) - 1; 789 dmask = (1 << state.distbits) - 1; 790 791 792 /* decode literals and length/distances until end-of-block or not enough 793 input data or output space */ 794 795 top: 796 do { 797 if (bits < 15) { 798 hold += input[_in++] << bits; 799 bits += 8; 800 hold += input[_in++] << bits; 801 bits += 8; 802 } 803 804 here = lcode[hold & lmask]; 805 806 dolen: 807 for (;;) { // Goto emulation 808 op = here >>> 24/*here.bits*/; 809 hold >>>= op; 810 bits -= op; 811 op = (here >>> 16) & 0xff/*here.op*/; 812 if (op === 0) { /* literal */ 813 //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? 814 // "inflate: literal '%c'\n" : 815 // "inflate: literal 0x%02x\n", here.val)); 816 output[_out++] = here & 0xffff/*here.val*/; 817 } 818 else if (op & 16) { /* length base */ 819 len = here & 0xffff/*here.val*/; 820 op &= 15; /* number of extra bits */ 821 if (op) { 822 if (bits < op) { 823 hold += input[_in++] << bits; 824 bits += 8; 825 } 826 len += hold & ((1 << op) - 1); 827 hold >>>= op; 828 bits -= op; 829 } 830 //Tracevv((stderr, "inflate: length %u\n", len)); 831 if (bits < 15) { 832 hold += input[_in++] << bits; 833 bits += 8; 834 hold += input[_in++] << bits; 835 bits += 8; 836 } 837 here = dcode[hold & dmask]; 838 839 dodist: 840 for (;;) { // goto emulation 841 op = here >>> 24/*here.bits*/; 842 hold >>>= op; 843 bits -= op; 844 op = (here >>> 16) & 0xff/*here.op*/; 845 846 if (op & 16) { /* distance base */ 847 dist = here & 0xffff/*here.val*/; 848 op &= 15; /* number of extra bits */ 849 if (bits < op) { 850 hold += input[_in++] << bits; 851 bits += 8; 852 if (bits < op) { 853 hold += input[_in++] << bits; 854 bits += 8; 855 } 856 } 857 dist += hold & ((1 << op) - 1); 858 //#ifdef INFLATE_STRICT 859 if (dist > dmax) { 860 strm.msg = 'invalid distance too far back'; 861 state.mode = BAD; 862 break top; 863 } 864 //#endif 865 hold >>>= op; 866 bits -= op; 867 //Tracevv((stderr, "inflate: distance %u\n", dist)); 868 op = _out - beg; /* max distance in output */ 869 if (dist > op) { /* see if copy from window */ 870 op = dist - op; /* distance back in window */ 871 if (op > whave) { 872 if (state.sane) { 873 strm.msg = 'invalid distance too far back'; 874 state.mode = BAD; 875 break top; 876 } 877 878 // (!) This block is disabled in zlib defaults, 879 // don't enable it for binary compatibility 880 //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR 881 // if (len <= op - whave) { 882 // do { 883 // output[_out++] = 0; 884 // } while (--len); 885 // continue top; 886 // } 887 // len -= op - whave; 888 // do { 889 // output[_out++] = 0; 890 // } while (--op > whave); 891 // if (op === 0) { 892 // from = _out - dist; 893 // do { 894 // output[_out++] = output[from++]; 895 // } while (--len); 896 // continue top; 897 // } 898 //#endif 899 } 900 from = 0; // window index 901 from_source = s_window; 902 if (wnext === 0) { /* very common case */ 903 from += wsize - op; 904 if (op < len) { /* some from window */ 905 len -= op; 906 do { 907 output[_out++] = s_window[from++]; 908 } while (--op); 909 from = _out - dist; /* rest from output */ 910 from_source = output; 911 } 912 } 913 else if (wnext < op) { /* wrap around window */ 914 from += wsize + wnext - op; 915 op -= wnext; 916 if (op < len) { /* some from end of window */ 917 len -= op; 918 do { 919 output[_out++] = s_window[from++]; 920 } while (--op); 921 from = 0; 922 if (wnext < len) { /* some from start of window */ 923 op = wnext; 924 len -= op; 925 do { 926 output[_out++] = s_window[from++]; 927 } while (--op); 928 from = _out - dist; /* rest from output */ 929 from_source = output; 930 } 931 } 932 } 933 else { /* contiguous in window */ 934 from += wnext - op; 935 if (op < len) { /* some from window */ 936 len -= op; 937 do { 938 output[_out++] = s_window[from++]; 939 } while (--op); 940 from = _out - dist; /* rest from output */ 941 from_source = output; 942 } 943 } 944 while (len > 2) { 945 output[_out++] = from_source[from++]; 946 output[_out++] = from_source[from++]; 947 output[_out++] = from_source[from++]; 948 len -= 3; 949 } 950 if (len) { 951 output[_out++] = from_source[from++]; 952 if (len > 1) { 953 output[_out++] = from_source[from++]; 954 } 955 } 956 } 957 else { 958 from = _out - dist; /* copy direct from output */ 959 do { /* minimum length is three */ 960 output[_out++] = output[from++]; 961 output[_out++] = output[from++]; 962 output[_out++] = output[from++]; 963 len -= 3; 964 } while (len > 2); 965 if (len) { 966 output[_out++] = output[from++]; 967 if (len > 1) { 968 output[_out++] = output[from++]; 969 } 970 } 971 } 972 } 973 else if ((op & 64) === 0) { /* 2nd level distance code */ 974 here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))]; 975 continue dodist; 976 } 977 else { 978 strm.msg = 'invalid distance code'; 979 state.mode = BAD; 980 break top; 981 } 982 983 break; // need to emulate goto via "continue" 984 } 985 } 986 else if ((op & 64) === 0) { /* 2nd level length code */ 987 here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))]; 988 continue dolen; 989 } 990 else if (op & 32) { /* end-of-block */ 991 //Tracevv((stderr, "inflate: end of block\n")); 992 state.mode = TYPE; 993 break top; 994 } 995 else { 996 strm.msg = 'invalid literal/length code'; 997 state.mode = BAD; 998 break top; 999 } 1000 1001 break; // need to emulate goto via "continue" 1002 } 1003 } while (_in < last && _out < end); 1004 1005 /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ 1006 len = bits >> 3; 1007 _in -= len; 1008 bits -= len << 3; 1009 hold &= (1 << bits) - 1; 1010 1011 /* update state and return */ 1012 strm.next_in = _in; 1013 strm.next_out = _out; 1014 strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last)); 1015 strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end)); 1016 state.hold = hold; 1017 state.bits = bits; 1018 return; 1019 }; 1020 1021 },{}],8:[function(require,module,exports){ 1022 'use strict'; 1023 1024 // (C) 1995-2013 Jean-loup Gailly and Mark Adler 1025 // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin 1026 // 1027 // This software is provided 'as-is', without any express or implied 1028 // warranty. In no event will the authors be held liable for any damages 1029 // arising from the use of this software. 1030 // 1031 // Permission is granted to anyone to use this software for any purpose, 1032 // including commercial applications, and to alter it and redistribute it 1033 // freely, subject to the following restrictions: 1034 // 1035 // 1. The origin of this software must not be misrepresented; you must not 1036 // claim that you wrote the original software. If you use this software 1037 // in a product, an acknowledgment in the product documentation would be 1038 // appreciated but is not required. 1039 // 2. Altered source versions must be plainly marked as such, and must not be 1040 // misrepresented as being the original software. 1041 // 3. This notice may not be removed or altered from any source distribution. 1042 1043 var utils = require('../utils/common'); 1044 var adler32 = require('./adler32'); 1045 var crc32 = require('./crc32'); 1046 var inflate_fast = require('./inffast'); 1047 var inflate_table = require('./inftrees'); 1048 1049 var CODES = 0; 1050 var LENS = 1; 1051 var DISTS = 2; 1052 1053 /* Public constants ==========================================================*/ 1054 /* ===========================================================================*/ 1055 1056 1057 /* Allowed flush values; see deflate() and inflate() below for details */ 1058 //var Z_NO_FLUSH = 0; 1059 //var Z_PARTIAL_FLUSH = 1; 1060 //var Z_SYNC_FLUSH = 2; 1061 //var Z_FULL_FLUSH = 3; 1062 var Z_FINISH = 4; 1063 var Z_BLOCK = 5; 1064 var Z_TREES = 6; 1065 1066 1067 /* Return codes for the compression/decompression functions. Negative values 1068 * are errors, positive values are used for special but normal events. 1069 */ 1070 var Z_OK = 0; 1071 var Z_STREAM_END = 1; 1072 var Z_NEED_DICT = 2; 1073 //var Z_ERRNO = -1; 1074 var Z_STREAM_ERROR = -2; 1075 var Z_DATA_ERROR = -3; 1076 var Z_MEM_ERROR = -4; 1077 var Z_BUF_ERROR = -5; 1078 //var Z_VERSION_ERROR = -6; 1079 1080 /* The deflate compression method */ 1081 var Z_DEFLATED = 8; 1082 1083 1084 /* STATES ====================================================================*/ 1085 /* ===========================================================================*/ 1086 1087 1088 var HEAD = 1; /* i: waiting for magic header */ 1089 var FLAGS = 2; /* i: waiting for method and flags (gzip) */ 1090 var TIME = 3; /* i: waiting for modification time (gzip) */ 1091 var OS = 4; /* i: waiting for extra flags and operating system (gzip) */ 1092 var EXLEN = 5; /* i: waiting for extra length (gzip) */ 1093 var EXTRA = 6; /* i: waiting for extra bytes (gzip) */ 1094 var NAME = 7; /* i: waiting for end of file name (gzip) */ 1095 var COMMENT = 8; /* i: waiting for end of comment (gzip) */ 1096 var HCRC = 9; /* i: waiting for header crc (gzip) */ 1097 var DICTID = 10; /* i: waiting for dictionary check value */ 1098 var DICT = 11; /* waiting for inflateSetDictionary() call */ 1099 var TYPE = 12; /* i: waiting for type bits, including last-flag bit */ 1100 var TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */ 1101 var STORED = 14; /* i: waiting for stored size (length and complement) */ 1102 var COPY_ = 15; /* i/o: same as COPY below, but only first time in */ 1103 var COPY = 16; /* i/o: waiting for input or output to copy stored block */ 1104 var TABLE = 17; /* i: waiting for dynamic block table lengths */ 1105 var LENLENS = 18; /* i: waiting for code length code lengths */ 1106 var CODELENS = 19; /* i: waiting for length/lit and distance code lengths */ 1107 var LEN_ = 20; /* i: same as LEN below, but only first time in */ 1108 var LEN = 21; /* i: waiting for length/lit/eob code */ 1109 var LENEXT = 22; /* i: waiting for length extra bits */ 1110 var DIST = 23; /* i: waiting for distance code */ 1111 var DISTEXT = 24; /* i: waiting for distance extra bits */ 1112 var MATCH = 25; /* o: waiting for output space to copy string */ 1113 var LIT = 26; /* o: waiting for output space to write literal */ 1114 var CHECK = 27; /* i: waiting for 32-bit check value */ 1115 var LENGTH = 28; /* i: waiting for 32-bit length (gzip) */ 1116 var DONE = 29; /* finished check, done -- remain here until reset */ 1117 var BAD = 30; /* got a data error -- remain here until reset */ 1118 var MEM = 31; /* got an inflate() memory error -- remain here until reset */ 1119 var SYNC = 32; /* looking for synchronization bytes to restart inflate() */ 1120 1121 /* ===========================================================================*/ 1122 1123 1124 1125 var ENOUGH_LENS = 852; 1126 var ENOUGH_DISTS = 592; 1127 //var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS); 1128 1129 var MAX_WBITS = 15; 1130 /* 32K LZ77 window */ 1131 var DEF_WBITS = MAX_WBITS; 1132 1133 1134 function zswap32(q) { 1135 return (((q >>> 24) & 0xff) + 1136 ((q >>> 8) & 0xff00) + 1137 ((q & 0xff00) << 8) + 1138 ((q & 0xff) << 24)); 1139 } 1140 1141 1142 function InflateState() { 1143 this.mode = 0; /* current inflate mode */ 1144 this.last = false; /* true if processing last block */ 1145 this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */ 1146 this.havedict = false; /* true if dictionary provided */ 1147 this.flags = 0; /* gzip header method and flags (0 if zlib) */ 1148 this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */ 1149 this.check = 0; /* protected copy of check value */ 1150 this.total = 0; /* protected copy of output count */ 1151 // TODO: may be {} 1152 this.head = null; /* where to save gzip header information */ 1153 1154 /* sliding window */ 1155 this.wbits = 0; /* log base 2 of requested window size */ 1156 this.wsize = 0; /* window size or zero if not using window */ 1157 this.whave = 0; /* valid bytes in the window */ 1158 this.wnext = 0; /* window write index */ 1159 this.window = null; /* allocated sliding window, if needed */ 1160 1161 /* bit accumulator */ 1162 this.hold = 0; /* input bit accumulator */ 1163 this.bits = 0; /* number of bits in "in" */ 1164 1165 /* for string and stored block copying */ 1166 this.length = 0; /* literal or length of data to copy */ 1167 this.offset = 0; /* distance back to copy string from */ 1168 1169 /* for table and code decoding */ 1170 this.extra = 0; /* extra bits needed */ 1171 1172 /* fixed and dynamic code tables */ 1173 this.lencode = null; /* starting table for length/literal codes */ 1174 this.distcode = null; /* starting table for distance codes */ 1175 this.lenbits = 0; /* index bits for lencode */ 1176 this.distbits = 0; /* index bits for distcode */ 1177 1178 /* dynamic table building */ 1179 this.ncode = 0; /* number of code length code lengths */ 1180 this.nlen = 0; /* number of length code lengths */ 1181 this.ndist = 0; /* number of distance code lengths */ 1182 this.have = 0; /* number of code lengths in lens[] */ 1183 this.next = null; /* next available space in codes[] */ 1184 1185 this.lens = new utils.Buf16(320); /* temporary storage for code lengths */ 1186 this.work = new utils.Buf16(288); /* work area for code table building */ 1187 1188 /* 1189 because we don't have pointers in js, we use lencode and distcode directly 1190 as buffers so we don't need codes 1191 */ 1192 //this.codes = new utils.Buf32(ENOUGH); /* space for code tables */ 1193 this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */ 1194 this.distdyn = null; /* dynamic table for distance codes (JS specific) */ 1195 this.sane = 0; /* if false, allow invalid distance too far */ 1196 this.back = 0; /* bits back of last unprocessed length/lit */ 1197 this.was = 0; /* initial length of match */ 1198 } 1199 1200 function inflateResetKeep(strm) { 1201 var state; 1202 1203 if (!strm || !strm.state) { return Z_STREAM_ERROR; } 1204 state = strm.state; 1205 strm.total_in = strm.total_out = state.total = 0; 1206 strm.msg = ''; /*Z_NULL*/ 1207 if (state.wrap) { /* to support ill-conceived Java test suite */ 1208 strm.adler = state.wrap & 1; 1209 } 1210 state.mode = HEAD; 1211 state.last = 0; 1212 state.havedict = 0; 1213 state.dmax = 32768; 1214 state.head = null/*Z_NULL*/; 1215 state.hold = 0; 1216 state.bits = 0; 1217 //state.lencode = state.distcode = state.next = state.codes; 1218 state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS); 1219 state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS); 1220 1221 state.sane = 1; 1222 state.back = -1; 1223 //Tracev((stderr, "inflate: reset\n")); 1224 return Z_OK; 1225 } 1226 1227 function inflateReset(strm) { 1228 var state; 1229 1230 if (!strm || !strm.state) { return Z_STREAM_ERROR; } 1231 state = strm.state; 1232 state.wsize = 0; 1233 state.whave = 0; 1234 state.wnext = 0; 1235 return inflateResetKeep(strm); 1236 1237 } 1238 1239 function inflateReset2(strm, windowBits) { 1240 var wrap; 1241 var state; 1242 1243 /* get the state */ 1244 if (!strm || !strm.state) { return Z_STREAM_ERROR; } 1245 state = strm.state; 1246 1247 /* extract wrap request from windowBits parameter */ 1248 if (windowBits < 0) { 1249 wrap = 0; 1250 windowBits = -windowBits; 1251 } 1252 else { 1253 wrap = (windowBits >> 4) + 1; 1254 if (windowBits < 48) { 1255 windowBits &= 15; 1256 } 1257 } 1258 1259 /* set number of window bits, free window if different */ 1260 if (windowBits && (windowBits < 8 || windowBits > 15)) { 1261 return Z_STREAM_ERROR; 1262 } 1263 if (state.window !== null && state.wbits !== windowBits) { 1264 state.window = null; 1265 } 1266 1267 /* update state and reset the rest of it */ 1268 state.wrap = wrap; 1269 state.wbits = windowBits; 1270 return inflateReset(strm); 1271 } 1272 1273 function inflateInit2(strm, windowBits) { 1274 var ret; 1275 var state; 1276 1277 if (!strm) { return Z_STREAM_ERROR; } 1278 //strm.msg = Z_NULL; /* in case we return an error */ 1279 1280 state = new InflateState(); 1281 1282 //if (state === Z_NULL) return Z_MEM_ERROR; 1283 //Tracev((stderr, "inflate: allocated\n")); 1284 strm.state = state; 1285 state.window = null/*Z_NULL*/; 1286 ret = inflateReset2(strm, windowBits); 1287 if (ret !== Z_OK) { 1288 strm.state = null/*Z_NULL*/; 1289 } 1290 return ret; 1291 } 1292 1293 function inflateInit(strm) { 1294 return inflateInit2(strm, DEF_WBITS); 1295 } 1296 1297 1298 /* 1299 Return state with length and distance decoding tables and index sizes set to 1300 fixed code decoding. Normally this returns fixed tables from inffixed.h. 1301 If BUILDFIXED is defined, then instead this routine builds the tables the 1302 first time it's called, and returns those tables the first time and 1303 thereafter. This reduces the size of the code by about 2K bytes, in 1304 exchange for a little execution time. However, BUILDFIXED should not be 1305 used for threaded applications, since the rewriting of the tables and virgin 1306 may not be thread-safe. 1307 */ 1308 var virgin = true; 1309 1310 var lenfix, distfix; // We have no pointers in JS, so keep tables separate 1311 1312 function fixedtables(state) { 1313 /* build fixed huffman tables if first call (may not be thread safe) */ 1314 if (virgin) { 1315 var sym; 1316 1317 lenfix = new utils.Buf32(512); 1318 distfix = new utils.Buf32(32); 1319 1320 /* literal/length table */ 1321 sym = 0; 1322 while (sym < 144) { state.lens[sym++] = 8; } 1323 while (sym < 256) { state.lens[sym++] = 9; } 1324 while (sym < 280) { state.lens[sym++] = 7; } 1325 while (sym < 288) { state.lens[sym++] = 8; } 1326 1327 inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 }); 1328 1329 /* distance table */ 1330 sym = 0; 1331 while (sym < 32) { state.lens[sym++] = 5; } 1332 1333 inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 }); 1334 1335 /* do this just once */ 1336 virgin = false; 1337 } 1338 1339 state.lencode = lenfix; 1340 state.lenbits = 9; 1341 state.distcode = distfix; 1342 state.distbits = 5; 1343 } 1344 1345 1346 /* 1347 Update the window with the last wsize (normally 32K) bytes written before 1348 returning. If window does not exist yet, create it. This is only called 1349 when a window is already in use, or when output has been written during this 1350 inflate call, but the end of the deflate stream has not been reached yet. 1351 It is also called to create a window for dictionary data when a dictionary 1352 is loaded. 1353 1354 Providing output buffers larger than 32K to inflate() should provide a speed 1355 advantage, since only the last 32K of output is copied to the sliding window 1356 upon return from inflate(), and since all distances after the first 32K of 1357 output will fall in the output data, making match copies simpler and faster. 1358 The advantage may be dependent on the size of the processor's data caches. 1359 */ 1360 function updatewindow(strm, src, end, copy) { 1361 var dist; 1362 var state = strm.state; 1363 1364 /* if it hasn't been done already, allocate space for the window */ 1365 if (state.window === null) { 1366 state.wsize = 1 << state.wbits; 1367 state.wnext = 0; 1368 state.whave = 0; 1369 1370 state.window = new utils.Buf8(state.wsize); 1371 } 1372 1373 /* copy state->wsize or less output bytes into the circular window */ 1374 if (copy >= state.wsize) { 1375 utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0); 1376 state.wnext = 0; 1377 state.whave = state.wsize; 1378 } 1379 else { 1380 dist = state.wsize - state.wnext; 1381 if (dist > copy) { 1382 dist = copy; 1383 } 1384 //zmemcpy(state->window + state->wnext, end - copy, dist); 1385 utils.arraySet(state.window, src, end - copy, dist, state.wnext); 1386 copy -= dist; 1387 if (copy) { 1388 //zmemcpy(state->window, end - copy, copy); 1389 utils.arraySet(state.window, src, end - copy, copy, 0); 1390 state.wnext = copy; 1391 state.whave = state.wsize; 1392 } 1393 else { 1394 state.wnext += dist; 1395 if (state.wnext === state.wsize) { state.wnext = 0; } 1396 if (state.whave < state.wsize) { state.whave += dist; } 1397 } 1398 } 1399 return 0; 1400 } 1401 1402 function inflate(strm, flush) { 1403 var state; 1404 var input, output; // input/output buffers 1405 var next; /* next input INDEX */ 1406 var put; /* next output INDEX */ 1407 var have, left; /* available input and output */ 1408 var hold; /* bit buffer */ 1409 var bits; /* bits in bit buffer */ 1410 var _in, _out; /* save starting available input and output */ 1411 var copy; /* number of stored or match bytes to copy */ 1412 var from; /* where to copy match bytes from */ 1413 var from_source; 1414 var here = 0; /* current decoding table entry */ 1415 var here_bits, here_op, here_val; // paked "here" denormalized (JS specific) 1416 //var last; /* parent table entry */ 1417 var last_bits, last_op, last_val; // paked "last" denormalized (JS specific) 1418 var len; /* length to copy for repeats, bits to drop */ 1419 var ret; /* return code */ 1420 var hbuf = new utils.Buf8(4); /* buffer for gzip header crc calculation */ 1421 var opts; 1422 1423 var n; // temporary var for NEED_BITS 1424 1425 var order = /* permutation of code lengths */ 1426 [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ]; 1427 1428 1429 if (!strm || !strm.state || !strm.output || 1430 (!strm.input && strm.avail_in !== 0)) { 1431 return Z_STREAM_ERROR; 1432 } 1433 1434 state = strm.state; 1435 if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */ 1436 1437 1438 //--- LOAD() --- 1439 put = strm.next_out; 1440 output = strm.output; 1441 left = strm.avail_out; 1442 next = strm.next_in; 1443 input = strm.input; 1444 have = strm.avail_in; 1445 hold = state.hold; 1446 bits = state.bits; 1447 //--- 1448 1449 _in = have; 1450 _out = left; 1451 ret = Z_OK; 1452 1453 inf_leave: // goto emulation 1454 for (;;) { 1455 switch (state.mode) { 1456 case HEAD: 1457 if (state.wrap === 0) { 1458 state.mode = TYPEDO; 1459 break; 1460 } 1461 //=== NEEDBITS(16); 1462 while (bits < 16) { 1463 if (have === 0) { break inf_leave; } 1464 have--; 1465 hold += input[next++] << bits; 1466 bits += 8; 1467 } 1468 //===// 1469 if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */ 1470 state.check = 0/*crc32(0L, Z_NULL, 0)*/; 1471 //=== CRC2(state.check, hold); 1472 hbuf[0] = hold & 0xff; 1473 hbuf[1] = (hold >>> 8) & 0xff; 1474 state.check = crc32(state.check, hbuf, 2, 0); 1475 //===// 1476 1477 //=== INITBITS(); 1478 hold = 0; 1479 bits = 0; 1480 //===// 1481 state.mode = FLAGS; 1482 break; 1483 } 1484 state.flags = 0; /* expect zlib header */ 1485 if (state.head) { 1486 state.head.done = false; 1487 } 1488 if (!(state.wrap & 1) || /* check if zlib header allowed */ 1489 (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) { 1490 strm.msg = 'incorrect header check'; 1491 state.mode = BAD; 1492 break; 1493 } 1494 if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) { 1495 strm.msg = 'unknown compression method'; 1496 state.mode = BAD; 1497 break; 1498 } 1499 //--- DROPBITS(4) ---// 1500 hold >>>= 4; 1501 bits -= 4; 1502 //---// 1503 len = (hold & 0x0f)/*BITS(4)*/ + 8; 1504 if (state.wbits === 0) { 1505 state.wbits = len; 1506 } 1507 else if (len > state.wbits) { 1508 strm.msg = 'invalid window size'; 1509 state.mode = BAD; 1510 break; 1511 } 1512 state.dmax = 1 << len; 1513 //Tracev((stderr, "inflate: zlib header ok\n")); 1514 strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/; 1515 state.mode = hold & 0x200 ? DICTID : TYPE; 1516 //=== INITBITS(); 1517 hold = 0; 1518 bits = 0; 1519 //===// 1520 break; 1521 case FLAGS: 1522 //=== NEEDBITS(16); */ 1523 while (bits < 16) { 1524 if (have === 0) { break inf_leave; } 1525 have--; 1526 hold += input[next++] << bits; 1527 bits += 8; 1528 } 1529 //===// 1530 state.flags = hold; 1531 if ((state.flags & 0xff) !== Z_DEFLATED) { 1532 strm.msg = 'unknown compression method'; 1533 state.mode = BAD; 1534 break; 1535 } 1536 if (state.flags & 0xe000) { 1537 strm.msg = 'unknown header flags set'; 1538 state.mode = BAD; 1539 break; 1540 } 1541 if (state.head) { 1542 state.head.text = ((hold >> 8) & 1); 1543 } 1544 if (state.flags & 0x0200) { 1545 //=== CRC2(state.check, hold); 1546 hbuf[0] = hold & 0xff; 1547 hbuf[1] = (hold >>> 8) & 0xff; 1548 state.check = crc32(state.check, hbuf, 2, 0); 1549 //===// 1550 } 1551 //=== INITBITS(); 1552 hold = 0; 1553 bits = 0; 1554 //===// 1555 state.mode = TIME; 1556 /* falls through */ 1557 case TIME: 1558 //=== NEEDBITS(32); */ 1559 while (bits < 32) { 1560 if (have === 0) { break inf_leave; } 1561 have--; 1562 hold += input[next++] << bits; 1563 bits += 8; 1564 } 1565 //===// 1566 if (state.head) { 1567 state.head.time = hold; 1568 } 1569 if (state.flags & 0x0200) { 1570 //=== CRC4(state.check, hold) 1571 hbuf[0] = hold & 0xff; 1572 hbuf[1] = (hold >>> 8) & 0xff; 1573 hbuf[2] = (hold >>> 16) & 0xff; 1574 hbuf[3] = (hold >>> 24) & 0xff; 1575 state.check = crc32(state.check, hbuf, 4, 0); 1576 //=== 1577 } 1578 //=== INITBITS(); 1579 hold = 0; 1580 bits = 0; 1581 //===// 1582 state.mode = OS; 1583 /* falls through */ 1584 case OS: 1585 //=== NEEDBITS(16); */ 1586 while (bits < 16) { 1587 if (have === 0) { break inf_leave; } 1588 have--; 1589 hold += input[next++] << bits; 1590 bits += 8; 1591 } 1592 //===// 1593 if (state.head) { 1594 state.head.xflags = (hold & 0xff); 1595 state.head.os = (hold >> 8); 1596 } 1597 if (state.flags & 0x0200) { 1598 //=== CRC2(state.check, hold); 1599 hbuf[0] = hold & 0xff; 1600 hbuf[1] = (hold >>> 8) & 0xff; 1601 state.check = crc32(state.check, hbuf, 2, 0); 1602 //===// 1603 } 1604 //=== INITBITS(); 1605 hold = 0; 1606 bits = 0; 1607 //===// 1608 state.mode = EXLEN; 1609 /* falls through */ 1610 case EXLEN: 1611 if (state.flags & 0x0400) { 1612 //=== NEEDBITS(16); */ 1613 while (bits < 16) { 1614 if (have === 0) { break inf_leave; } 1615 have--; 1616 hold += input[next++] << bits; 1617 bits += 8; 1618 } 1619 //===// 1620 state.length = hold; 1621 if (state.head) { 1622 state.head.extra_len = hold; 1623 } 1624 if (state.flags & 0x0200) { 1625 //=== CRC2(state.check, hold); 1626 hbuf[0] = hold & 0xff; 1627 hbuf[1] = (hold >>> 8) & 0xff; 1628 state.check = crc32(state.check, hbuf, 2, 0); 1629 //===// 1630 } 1631 //=== INITBITS(); 1632 hold = 0; 1633 bits = 0; 1634 //===// 1635 } 1636 else if (state.head) { 1637 state.head.extra = null/*Z_NULL*/; 1638 } 1639 state.mode = EXTRA; 1640 /* falls through */ 1641 case EXTRA: 1642 if (state.flags & 0x0400) { 1643 copy = state.length; 1644 if (copy > have) { copy = have; } 1645 if (copy) { 1646 if (state.head) { 1647 len = state.head.extra_len - state.length; 1648 if (!state.head.extra) { 1649 // Use untyped array for more convenient processing later 1650 state.head.extra = new Array(state.head.extra_len); 1651 } 1652 utils.arraySet( 1653 state.head.extra, 1654 input, 1655 next, 1656 // extra field is limited to 65536 bytes 1657 // - no need for additional size check 1658 copy, 1659 /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/ 1660 len 1661 ); 1662 //zmemcpy(state.head.extra + len, next, 1663 // len + copy > state.head.extra_max ? 1664 // state.head.extra_max - len : copy); 1665 } 1666 if (state.flags & 0x0200) { 1667 state.check = crc32(state.check, input, copy, next); 1668 } 1669 have -= copy; 1670 next += copy; 1671 state.length -= copy; 1672 } 1673 if (state.length) { break inf_leave; } 1674 } 1675 state.length = 0; 1676 state.mode = NAME; 1677 /* falls through */ 1678 case NAME: 1679 if (state.flags & 0x0800) { 1680 if (have === 0) { break inf_leave; } 1681 copy = 0; 1682 do { 1683 // TODO: 2 or 1 bytes? 1684 len = input[next + copy++]; 1685 /* use constant limit because in js we should not preallocate memory */ 1686 if (state.head && len && 1687 (state.length < 65536 /*state.head.name_max*/)) { 1688 state.head.name += String.fromCharCode(len); 1689 } 1690 } while (len && copy < have); 1691 1692 if (state.flags & 0x0200) { 1693 state.check = crc32(state.check, input, copy, next); 1694 } 1695 have -= copy; 1696 next += copy; 1697 if (len) { break inf_leave; } 1698 } 1699 else if (state.head) { 1700 state.head.name = null; 1701 } 1702 state.length = 0; 1703 state.mode = COMMENT; 1704 /* falls through */ 1705 case COMMENT: 1706 if (state.flags & 0x1000) { 1707 if (have === 0) { break inf_leave; } 1708 copy = 0; 1709 do { 1710 len = input[next + copy++]; 1711 /* use constant limit because in js we should not preallocate memory */ 1712 if (state.head && len && 1713 (state.length < 65536 /*state.head.comm_max*/)) { 1714 state.head.comment += String.fromCharCode(len); 1715 } 1716 } while (len && copy < have); 1717 if (state.flags & 0x0200) { 1718 state.check = crc32(state.check, input, copy, next); 1719 } 1720 have -= copy; 1721 next += copy; 1722 if (len) { break inf_leave; } 1723 } 1724 else if (state.head) { 1725 state.head.comment = null; 1726 } 1727 state.mode = HCRC; 1728 /* falls through */ 1729 case HCRC: 1730 if (state.flags & 0x0200) { 1731 //=== NEEDBITS(16); */ 1732 while (bits < 16) { 1733 if (have === 0) { break inf_leave; } 1734 have--; 1735 hold += input[next++] << bits; 1736 bits += 8; 1737 } 1738 //===// 1739 if (hold !== (state.check & 0xffff)) { 1740 strm.msg = 'header crc mismatch'; 1741 state.mode = BAD; 1742 break; 1743 } 1744 //=== INITBITS(); 1745 hold = 0; 1746 bits = 0; 1747 //===// 1748 } 1749 if (state.head) { 1750 state.head.hcrc = ((state.flags >> 9) & 1); 1751 state.head.done = true; 1752 } 1753 strm.adler = state.check = 0; 1754 state.mode = TYPE; 1755 break; 1756 case DICTID: 1757 //=== NEEDBITS(32); */ 1758 while (bits < 32) { 1759 if (have === 0) { break inf_leave; } 1760 have--; 1761 hold += input[next++] << bits; 1762 bits += 8; 1763 } 1764 //===// 1765 strm.adler = state.check = zswap32(hold); 1766 //=== INITBITS(); 1767 hold = 0; 1768 bits = 0; 1769 //===// 1770 state.mode = DICT; 1771 /* falls through */ 1772 case DICT: 1773 if (state.havedict === 0) { 1774 //--- RESTORE() --- 1775 strm.next_out = put; 1776 strm.avail_out = left; 1777 strm.next_in = next; 1778 strm.avail_in = have; 1779 state.hold = hold; 1780 state.bits = bits; 1781 //--- 1782 return Z_NEED_DICT; 1783 } 1784 strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/; 1785 state.mode = TYPE; 1786 /* falls through */ 1787 case TYPE: 1788 if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; } 1789 /* falls through */ 1790 case TYPEDO: 1791 if (state.last) { 1792 //--- BYTEBITS() ---// 1793 hold >>>= bits & 7; 1794 bits -= bits & 7; 1795 //---// 1796 state.mode = CHECK; 1797 break; 1798 } 1799 //=== NEEDBITS(3); */ 1800 while (bits < 3) { 1801 if (have === 0) { break inf_leave; } 1802 have--; 1803 hold += input[next++] << bits; 1804 bits += 8; 1805 } 1806 //===// 1807 state.last = (hold & 0x01)/*BITS(1)*/; 1808 //--- DROPBITS(1) ---// 1809 hold >>>= 1; 1810 bits -= 1; 1811 //---// 1812 1813 switch ((hold & 0x03)/*BITS(2)*/) { 1814 case 0: /* stored block */ 1815 //Tracev((stderr, "inflate: stored block%s\n", 1816 // state.last ? " (last)" : "")); 1817 state.mode = STORED; 1818 break; 1819 case 1: /* fixed block */ 1820 fixedtables(state); 1821 //Tracev((stderr, "inflate: fixed codes block%s\n", 1822 // state.last ? " (last)" : "")); 1823 state.mode = LEN_; /* decode codes */ 1824 if (flush === Z_TREES) { 1825 //--- DROPBITS(2) ---// 1826 hold >>>= 2; 1827 bits -= 2; 1828 //---// 1829 break inf_leave; 1830 } 1831 break; 1832 case 2: /* dynamic block */ 1833 //Tracev((stderr, "inflate: dynamic codes block%s\n", 1834 // state.last ? " (last)" : "")); 1835 state.mode = TABLE; 1836 break; 1837 case 3: 1838 strm.msg = 'invalid block type'; 1839 state.mode = BAD; 1840 } 1841 //--- DROPBITS(2) ---// 1842 hold >>>= 2; 1843 bits -= 2; 1844 //---// 1845 break; 1846 case STORED: 1847 //--- BYTEBITS() ---// /* go to byte boundary */ 1848 hold >>>= bits & 7; 1849 bits -= bits & 7; 1850 //---// 1851 //=== NEEDBITS(32); */ 1852 while (bits < 32) { 1853 if (have === 0) { break inf_leave; } 1854 have--; 1855 hold += input[next++] << bits; 1856 bits += 8; 1857 } 1858 //===// 1859 if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) { 1860 strm.msg = 'invalid stored block lengths'; 1861 state.mode = BAD; 1862 break; 1863 } 1864 state.length = hold & 0xffff; 1865 //Tracev((stderr, "inflate: stored length %u\n", 1866 // state.length)); 1867 //=== INITBITS(); 1868 hold = 0; 1869 bits = 0; 1870 //===// 1871 state.mode = COPY_; 1872 if (flush === Z_TREES) { break inf_leave; } 1873 /* falls through */ 1874 case COPY_: 1875 state.mode = COPY; 1876 /* falls through */ 1877 case COPY: 1878 copy = state.length; 1879 if (copy) { 1880 if (copy > have) { copy = have; } 1881 if (copy > left) { copy = left; } 1882 if (copy === 0) { break inf_leave; } 1883 //--- zmemcpy(put, next, copy); --- 1884 utils.arraySet(output, input, next, copy, put); 1885 //---// 1886 have -= copy; 1887 next += copy; 1888 left -= copy; 1889 put += copy; 1890 state.length -= copy; 1891 break; 1892 } 1893 //Tracev((stderr, "inflate: stored end\n")); 1894 state.mode = TYPE; 1895 break; 1896 case TABLE: 1897 //=== NEEDBITS(14); */ 1898 while (bits < 14) { 1899 if (have === 0) { break inf_leave; } 1900 have--; 1901 hold += input[next++] << bits; 1902 bits += 8; 1903 } 1904 //===// 1905 state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257; 1906 //--- DROPBITS(5) ---// 1907 hold >>>= 5; 1908 bits -= 5; 1909 //---// 1910 state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1; 1911 //--- DROPBITS(5) ---// 1912 hold >>>= 5; 1913 bits -= 5; 1914 //---// 1915 state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4; 1916 //--- DROPBITS(4) ---// 1917 hold >>>= 4; 1918 bits -= 4; 1919 //---// 1920 //#ifndef PKZIP_BUG_WORKAROUND 1921 if (state.nlen > 286 || state.ndist > 30) { 1922 strm.msg = 'too many length or distance symbols'; 1923 state.mode = BAD; 1924 break; 1925 } 1926 //#endif 1927 //Tracev((stderr, "inflate: table sizes ok\n")); 1928 state.have = 0; 1929 state.mode = LENLENS; 1930 /* falls through */ 1931 case LENLENS: 1932 while (state.have < state.ncode) { 1933 //=== NEEDBITS(3); 1934 while (bits < 3) { 1935 if (have === 0) { break inf_leave; } 1936 have--; 1937 hold += input[next++] << bits; 1938 bits += 8; 1939 } 1940 //===// 1941 state.lens[order[state.have++]] = (hold & 0x07);//BITS(3); 1942 //--- DROPBITS(3) ---// 1943 hold >>>= 3; 1944 bits -= 3; 1945 //---// 1946 } 1947 while (state.have < 19) { 1948 state.lens[order[state.have++]] = 0; 1949 } 1950 // We have separate tables & no pointers. 2 commented lines below not needed. 1951 //state.next = state.codes; 1952 //state.lencode = state.next; 1953 // Switch to use dynamic table 1954 state.lencode = state.lendyn; 1955 state.lenbits = 7; 1956 1957 opts = { bits: state.lenbits }; 1958 ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts); 1959 state.lenbits = opts.bits; 1960 1961 if (ret) { 1962 strm.msg = 'invalid code lengths set'; 1963 state.mode = BAD; 1964 break; 1965 } 1966 //Tracev((stderr, "inflate: code lengths ok\n")); 1967 state.have = 0; 1968 state.mode = CODELENS; 1969 /* falls through */ 1970 case CODELENS: 1971 while (state.have < state.nlen + state.ndist) { 1972 for (;;) { 1973 here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/ 1974 here_bits = here >>> 24; 1975 here_op = (here >>> 16) & 0xff; 1976 here_val = here & 0xffff; 1977 1978 if ((here_bits) <= bits) { break; } 1979 //--- PULLBYTE() ---// 1980 if (have === 0) { break inf_leave; } 1981 have--; 1982 hold += input[next++] << bits; 1983 bits += 8; 1984 //---// 1985 } 1986 if (here_val < 16) { 1987 //--- DROPBITS(here.bits) ---// 1988 hold >>>= here_bits; 1989 bits -= here_bits; 1990 //---// 1991 state.lens[state.have++] = here_val; 1992 } 1993 else { 1994 if (here_val === 16) { 1995 //=== NEEDBITS(here.bits + 2); 1996 n = here_bits + 2; 1997 while (bits < n) { 1998 if (have === 0) { break inf_leave; } 1999 have--; 2000 hold += input[next++] << bits; 2001 bits += 8; 2002 } 2003 //===// 2004 //--- DROPBITS(here.bits) ---// 2005 hold >>>= here_bits; 2006 bits -= here_bits; 2007 //---// 2008 if (state.have === 0) { 2009 strm.msg = 'invalid bit length repeat'; 2010 state.mode = BAD; 2011 break; 2012 } 2013 len = state.lens[state.have - 1]; 2014 copy = 3 + (hold & 0x03);//BITS(2); 2015 //--- DROPBITS(2) ---// 2016 hold >>>= 2; 2017 bits -= 2; 2018 //---// 2019 } 2020 else if (here_val === 17) { 2021 //=== NEEDBITS(here.bits + 3); 2022 n = here_bits + 3; 2023 while (bits < n) { 2024 if (have === 0) { break inf_leave; } 2025 have--; 2026 hold += input[next++] << bits; 2027 bits += 8; 2028 } 2029 //===// 2030 //--- DROPBITS(here.bits) ---// 2031 hold >>>= here_bits; 2032 bits -= here_bits; 2033 //---// 2034 len = 0; 2035 copy = 3 + (hold & 0x07);//BITS(3); 2036 //--- DROPBITS(3) ---// 2037 hold >>>= 3; 2038 bits -= 3; 2039 //---// 2040 } 2041 else { 2042 //=== NEEDBITS(here.bits + 7); 2043 n = here_bits + 7; 2044 while (bits < n) { 2045 if (have === 0) { break inf_leave; } 2046 have--; 2047 hold += input[next++] << bits; 2048 bits += 8; 2049 } 2050 //===// 2051 //--- DROPBITS(here.bits) ---// 2052 hold >>>= here_bits; 2053 bits -= here_bits; 2054 //---// 2055 len = 0; 2056 copy = 11 + (hold & 0x7f);//BITS(7); 2057 //--- DROPBITS(7) ---// 2058 hold >>>= 7; 2059 bits -= 7; 2060 //---// 2061 } 2062 if (state.have + copy > state.nlen + state.ndist) { 2063 strm.msg = 'invalid bit length repeat'; 2064 state.mode = BAD; 2065 break; 2066 } 2067 while (copy--) { 2068 state.lens[state.have++] = len; 2069 } 2070 } 2071 } 2072 2073 /* handle error breaks in while */ 2074 if (state.mode === BAD) { break; } 2075 2076 /* check for end-of-block code (better have one) */ 2077 if (state.lens[256] === 0) { 2078 strm.msg = 'invalid code -- missing end-of-block'; 2079 state.mode = BAD; 2080 break; 2081 } 2082 2083 /* build code tables -- note: do not change the lenbits or distbits 2084 values here (9 and 6) without reading the comments in inftrees.h 2085 concerning the ENOUGH constants, which depend on those values */ 2086 state.lenbits = 9; 2087 2088 opts = { bits: state.lenbits }; 2089 ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts); 2090 // We have separate tables & no pointers. 2 commented lines below not needed. 2091 // state.next_index = opts.table_index; 2092 state.lenbits = opts.bits; 2093 // state.lencode = state.next; 2094 2095 if (ret) { 2096 strm.msg = 'invalid literal/lengths set'; 2097 state.mode = BAD; 2098 break; 2099 } 2100 2101 state.distbits = 6; 2102 //state.distcode.copy(state.codes); 2103 // Switch to use dynamic table 2104 state.distcode = state.distdyn; 2105 opts = { bits: state.distbits }; 2106 ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts); 2107 // We have separate tables & no pointers. 2 commented lines below not needed. 2108 // state.next_index = opts.table_index; 2109 state.distbits = opts.bits; 2110 // state.distcode = state.next; 2111 2112 if (ret) { 2113 strm.msg = 'invalid distances set'; 2114 state.mode = BAD; 2115 break; 2116 } 2117 //Tracev((stderr, 'inflate: codes ok\n')); 2118 state.mode = LEN_; 2119 if (flush === Z_TREES) { break inf_leave; } 2120 /* falls through */ 2121 case LEN_: 2122 state.mode = LEN; 2123 /* falls through */ 2124 case LEN: 2125 if (have >= 6 && left >= 258) { 2126 //--- RESTORE() --- 2127 strm.next_out = put; 2128 strm.avail_out = left; 2129 strm.next_in = next; 2130 strm.avail_in = have; 2131 state.hold = hold; 2132 state.bits = bits; 2133 //--- 2134 inflate_fast(strm, _out); 2135 //--- LOAD() --- 2136 put = strm.next_out; 2137 output = strm.output; 2138 left = strm.avail_out; 2139 next = strm.next_in; 2140 input = strm.input; 2141 have = strm.avail_in; 2142 hold = state.hold; 2143 bits = state.bits; 2144 //--- 2145 2146 if (state.mode === TYPE) { 2147 state.back = -1; 2148 } 2149 break; 2150 } 2151 state.back = 0; 2152 for (;;) { 2153 here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/ 2154 here_bits = here >>> 24; 2155 here_op = (here >>> 16) & 0xff; 2156 here_val = here & 0xffff; 2157 2158 if (here_bits <= bits) { break; } 2159 //--- PULLBYTE() ---// 2160 if (have === 0) { break inf_leave; } 2161 have--; 2162 hold += input[next++] << bits; 2163 bits += 8; 2164 //---// 2165 } 2166 if (here_op && (here_op & 0xf0) === 0) { 2167 last_bits = here_bits; 2168 last_op = here_op; 2169 last_val = here_val; 2170 for (;;) { 2171 here = state.lencode[last_val + 2172 ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)]; 2173 here_bits = here >>> 24; 2174 here_op = (here >>> 16) & 0xff; 2175 here_val = here & 0xffff; 2176 2177 if ((last_bits + here_bits) <= bits) { break; } 2178 //--- PULLBYTE() ---// 2179 if (have === 0) { break inf_leave; } 2180 have--; 2181 hold += input[next++] << bits; 2182 bits += 8; 2183 //---// 2184 } 2185 //--- DROPBITS(last.bits) ---// 2186 hold >>>= last_bits; 2187 bits -= last_bits; 2188 //---// 2189 state.back += last_bits; 2190 } 2191 //--- DROPBITS(here.bits) ---// 2192 hold >>>= here_bits; 2193 bits -= here_bits; 2194 //---// 2195 state.back += here_bits; 2196 state.length = here_val; 2197 if (here_op === 0) { 2198 //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? 2199 // "inflate: literal '%c'\n" : 2200 // "inflate: literal 0x%02x\n", here.val)); 2201 state.mode = LIT; 2202 break; 2203 } 2204 if (here_op & 32) { 2205 //Tracevv((stderr, "inflate: end of block\n")); 2206 state.back = -1; 2207 state.mode = TYPE; 2208 break; 2209 } 2210 if (here_op & 64) { 2211 strm.msg = 'invalid literal/length code'; 2212 state.mode = BAD; 2213 break; 2214 } 2215 state.extra = here_op & 15; 2216 state.mode = LENEXT; 2217 /* falls through */ 2218 case LENEXT: 2219 if (state.extra) { 2220 //=== NEEDBITS(state.extra); 2221 n = state.extra; 2222 while (bits < n) { 2223 if (have === 0) { break inf_leave; } 2224 have--; 2225 hold += input[next++] << bits; 2226 bits += 8; 2227 } 2228 //===// 2229 state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/; 2230 //--- DROPBITS(state.extra) ---// 2231 hold >>>= state.extra; 2232 bits -= state.extra; 2233 //---// 2234 state.back += state.extra; 2235 } 2236 //Tracevv((stderr, "inflate: length %u\n", state.length)); 2237 state.was = state.length; 2238 state.mode = DIST; 2239 /* falls through */ 2240 case DIST: 2241 for (;;) { 2242 here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/ 2243 here_bits = here >>> 24; 2244 here_op = (here >>> 16) & 0xff; 2245 here_val = here & 0xffff; 2246 2247 if ((here_bits) <= bits) { break; } 2248 //--- PULLBYTE() ---// 2249 if (have === 0) { break inf_leave; } 2250 have--; 2251 hold += input[next++] << bits; 2252 bits += 8; 2253 //---// 2254 } 2255 if ((here_op & 0xf0) === 0) { 2256 last_bits = here_bits; 2257 last_op = here_op; 2258 last_val = here_val; 2259 for (;;) { 2260 here = state.distcode[last_val + 2261 ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)]; 2262 here_bits = here >>> 24; 2263 here_op = (here >>> 16) & 0xff; 2264 here_val = here & 0xffff; 2265 2266 if ((last_bits + here_bits) <= bits) { break; } 2267 //--- PULLBYTE() ---// 2268 if (have === 0) { break inf_leave; } 2269 have--; 2270 hold += input[next++] << bits; 2271 bits += 8; 2272 //---// 2273 } 2274 //--- DROPBITS(last.bits) ---// 2275 hold >>>= last_bits; 2276 bits -= last_bits; 2277 //---// 2278 state.back += last_bits; 2279 } 2280 //--- DROPBITS(here.bits) ---// 2281 hold >>>= here_bits; 2282 bits -= here_bits; 2283 //---// 2284 state.back += here_bits; 2285 if (here_op & 64) { 2286 strm.msg = 'invalid distance code'; 2287 state.mode = BAD; 2288 break; 2289 } 2290 state.offset = here_val; 2291 state.extra = (here_op) & 15; 2292 state.mode = DISTEXT; 2293 /* falls through */ 2294 case DISTEXT: 2295 if (state.extra) { 2296 //=== NEEDBITS(state.extra); 2297 n = state.extra; 2298 while (bits < n) { 2299 if (have === 0) { break inf_leave; } 2300 have--; 2301 hold += input[next++] << bits; 2302 bits += 8; 2303 } 2304 //===// 2305 state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/; 2306 //--- DROPBITS(state.extra) ---// 2307 hold >>>= state.extra; 2308 bits -= state.extra; 2309 //---// 2310 state.back += state.extra; 2311 } 2312 //#ifdef INFLATE_STRICT 2313 if (state.offset > state.dmax) { 2314 strm.msg = 'invalid distance too far back'; 2315 state.mode = BAD; 2316 break; 2317 } 2318 //#endif 2319 //Tracevv((stderr, "inflate: distance %u\n", state.offset)); 2320 state.mode = MATCH; 2321 /* falls through */ 2322 case MATCH: 2323 if (left === 0) { break inf_leave; } 2324 copy = _out - left; 2325 if (state.offset > copy) { /* copy from window */ 2326 copy = state.offset - copy; 2327 if (copy > state.whave) { 2328 if (state.sane) { 2329 strm.msg = 'invalid distance too far back'; 2330 state.mode = BAD; 2331 break; 2332 } 2333 // (!) This block is disabled in zlib defaults, 2334 // don't enable it for binary compatibility 2335 //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR 2336 // Trace((stderr, "inflate.c too far\n")); 2337 // copy -= state.whave; 2338 // if (copy > state.length) { copy = state.length; } 2339 // if (copy > left) { copy = left; } 2340 // left -= copy; 2341 // state.length -= copy; 2342 // do { 2343 // output[put++] = 0; 2344 // } while (--copy); 2345 // if (state.length === 0) { state.mode = LEN; } 2346 // break; 2347 //#endif 2348 } 2349 if (copy > state.wnext) { 2350 copy -= state.wnext; 2351 from = state.wsize - copy; 2352 } 2353 else { 2354 from = state.wnext - copy; 2355 } 2356 if (copy > state.length) { copy = state.length; } 2357 from_source = state.window; 2358 } 2359 else { /* copy from output */ 2360 from_source = output; 2361 from = put - state.offset; 2362 copy = state.length; 2363 } 2364 if (copy > left) { copy = left; } 2365 left -= copy; 2366 state.length -= copy; 2367 do { 2368 output[put++] = from_source[from++]; 2369 } while (--copy); 2370 if (state.length === 0) { state.mode = LEN; } 2371 break; 2372 case LIT: 2373 if (left === 0) { break inf_leave; } 2374 output[put++] = state.length; 2375 left--; 2376 state.mode = LEN; 2377 break; 2378 case CHECK: 2379 if (state.wrap) { 2380 //=== NEEDBITS(32); 2381 while (bits < 32) { 2382 if (have === 0) { break inf_leave; } 2383 have--; 2384 // Use '|' instead of '+' to make sure that result is signed 2385 hold |= input[next++] << bits; 2386 bits += 8; 2387 } 2388 //===// 2389 _out -= left; 2390 strm.total_out += _out; 2391 state.total += _out; 2392 if (_out) { 2393 strm.adler = state.check = 2394 /*UPDATE(state.check, put - _out, _out);*/ 2395 (state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out)); 2396 2397 } 2398 _out = left; 2399 // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too 2400 if ((state.flags ? hold : zswap32(hold)) !== state.check) { 2401 strm.msg = 'incorrect data check'; 2402 state.mode = BAD; 2403 break; 2404 } 2405 //=== INITBITS(); 2406 hold = 0; 2407 bits = 0; 2408 //===// 2409 //Tracev((stderr, "inflate: check matches trailer\n")); 2410 } 2411 state.mode = LENGTH; 2412 /* falls through */ 2413 case LENGTH: 2414 if (state.wrap && state.flags) { 2415 //=== NEEDBITS(32); 2416 while (bits < 32) { 2417 if (have === 0) { break inf_leave; } 2418 have--; 2419 hold += input[next++] << bits; 2420 bits += 8; 2421 } 2422 //===// 2423 if (hold !== (state.total & 0xffffffff)) { 2424 strm.msg = 'incorrect length check'; 2425 state.mode = BAD; 2426 break; 2427 } 2428 //=== INITBITS(); 2429 hold = 0; 2430 bits = 0; 2431 //===// 2432 //Tracev((stderr, "inflate: length matches trailer\n")); 2433 } 2434 state.mode = DONE; 2435 /* falls through */ 2436 case DONE: 2437 ret = Z_STREAM_END; 2438 break inf_leave; 2439 case BAD: 2440 ret = Z_DATA_ERROR; 2441 break inf_leave; 2442 case MEM: 2443 return Z_MEM_ERROR; 2444 case SYNC: 2445 /* falls through */ 2446 default: 2447 return Z_STREAM_ERROR; 2448 } 2449 } 2450 2451 // inf_leave <- here is real place for "goto inf_leave", emulated via "break inf_leave" 2452 2453 /* 2454 Return from inflate(), updating the total counts and the check value. 2455 If there was no progress during the inflate() call, return a buffer 2456 error. Call updatewindow() to create and/or update the window state. 2457 Note: a memory error from inflate() is non-recoverable. 2458 */ 2459 2460 //--- RESTORE() --- 2461 strm.next_out = put; 2462 strm.avail_out = left; 2463 strm.next_in = next; 2464 strm.avail_in = have; 2465 state.hold = hold; 2466 state.bits = bits; 2467 //--- 2468 2469 if (state.wsize || (_out !== strm.avail_out && state.mode < BAD && 2470 (state.mode < CHECK || flush !== Z_FINISH))) { 2471 if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) { 2472 state.mode = MEM; 2473 return Z_MEM_ERROR; 2474 } 2475 } 2476 _in -= strm.avail_in; 2477 _out -= strm.avail_out; 2478 strm.total_in += _in; 2479 strm.total_out += _out; 2480 state.total += _out; 2481 if (state.wrap && _out) { 2482 strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/ 2483 (state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out)); 2484 } 2485 strm.data_type = state.bits + (state.last ? 64 : 0) + 2486 (state.mode === TYPE ? 128 : 0) + 2487 (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0); 2488 if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) { 2489 ret = Z_BUF_ERROR; 2490 } 2491 return ret; 2492 } 2493 2494 function inflateEnd(strm) { 2495 2496 if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) { 2497 return Z_STREAM_ERROR; 2498 } 2499 2500 var state = strm.state; 2501 if (state.window) { 2502 state.window = null; 2503 } 2504 strm.state = null; 2505 return Z_OK; 2506 } 2507 2508 function inflateGetHeader(strm, head) { 2509 var state; 2510 2511 /* check state */ 2512 if (!strm || !strm.state) { return Z_STREAM_ERROR; } 2513 state = strm.state; 2514 if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR; } 2515 2516 /* save header structure */ 2517 state.head = head; 2518 head.done = false; 2519 return Z_OK; 2520 } 2521 2522 function inflateSetDictionary(strm, dictionary) { 2523 var dictLength = dictionary.length; 2524 2525 var state; 2526 var dictid; 2527 var ret; 2528 2529 /* check state */ 2530 if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR; } 2531 state = strm.state; 2532 2533 if (state.wrap !== 0 && state.mode !== DICT) { 2534 return Z_STREAM_ERROR; 2535 } 2536 2537 /* check for correct dictionary identifier */ 2538 if (state.mode === DICT) { 2539 dictid = 1; /* adler32(0, null, 0)*/ 2540 /* dictid = adler32(dictid, dictionary, dictLength); */ 2541 dictid = adler32(dictid, dictionary, dictLength, 0); 2542 if (dictid !== state.check) { 2543 return Z_DATA_ERROR; 2544 } 2545 } 2546 /* copy dictionary to window using updatewindow(), which will amend the 2547 existing dictionary if appropriate */ 2548 ret = updatewindow(strm, dictionary, dictLength, dictLength); 2549 if (ret) { 2550 state.mode = MEM; 2551 return Z_MEM_ERROR; 2552 } 2553 state.havedict = 1; 2554 // Tracev((stderr, "inflate: dictionary set\n")); 2555 return Z_OK; 2556 } 2557 2558 exports.inflateReset = inflateReset; 2559 exports.inflateReset2 = inflateReset2; 2560 exports.inflateResetKeep = inflateResetKeep; 2561 exports.inflateInit = inflateInit; 2562 exports.inflateInit2 = inflateInit2; 2563 exports.inflate = inflate; 2564 exports.inflateEnd = inflateEnd; 2565 exports.inflateGetHeader = inflateGetHeader; 2566 exports.inflateSetDictionary = inflateSetDictionary; 2567 exports.inflateInfo = 'pako inflate (from Nodeca project)'; 2568 2569 /* Not implemented 2570 exports.inflateCopy = inflateCopy; 2571 exports.inflateGetDictionary = inflateGetDictionary; 2572 exports.inflateMark = inflateMark; 2573 exports.inflatePrime = inflatePrime; 2574 exports.inflateSync = inflateSync; 2575 exports.inflateSyncPoint = inflateSyncPoint; 2576 exports.inflateUndermine = inflateUndermine; 2577 */ 2578 2579 },{"../utils/common":1,"./adler32":3,"./crc32":5,"./inffast":7,"./inftrees":9}],9:[function(require,module,exports){ 2580 'use strict'; 2581 2582 // (C) 1995-2013 Jean-loup Gailly and Mark Adler 2583 // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin 2584 // 2585 // This software is provided 'as-is', without any express or implied 2586 // warranty. In no event will the authors be held liable for any damages 2587 // arising from the use of this software. 2588 // 2589 // Permission is granted to anyone to use this software for any purpose, 2590 // including commercial applications, and to alter it and redistribute it 2591 // freely, subject to the following restrictions: 2592 // 2593 // 1. The origin of this software must not be misrepresented; you must not 2594 // claim that you wrote the original software. If you use this software 2595 // in a product, an acknowledgment in the product documentation would be 2596 // appreciated but is not required. 2597 // 2. Altered source versions must be plainly marked as such, and must not be 2598 // misrepresented as being the original software. 2599 // 3. This notice may not be removed or altered from any source distribution. 2600 2601 var utils = require('../utils/common'); 2602 2603 var MAXBITS = 15; 2604 var ENOUGH_LENS = 852; 2605 var ENOUGH_DISTS = 592; 2606 //var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS); 2607 2608 var CODES = 0; 2609 var LENS = 1; 2610 var DISTS = 2; 2611 2612 var lbase = [ /* Length codes 257..285 base */ 2613 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 2614 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0 2615 ]; 2616 2617 var lext = [ /* Length codes 257..285 extra */ 2618 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 2619 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78 2620 ]; 2621 2622 var dbase = [ /* Distance codes 0..29 base */ 2623 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 2624 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 2625 8193, 12289, 16385, 24577, 0, 0 2626 ]; 2627 2628 var dext = [ /* Distance codes 0..29 extra */ 2629 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 2630 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 2631 28, 28, 29, 29, 64, 64 2632 ]; 2633 2634 module.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts) 2635 { 2636 var bits = opts.bits; 2637 //here = opts.here; /* table entry for duplication */ 2638 2639 var len = 0; /* a code's length in bits */ 2640 var sym = 0; /* index of code symbols */ 2641 var min = 0, max = 0; /* minimum and maximum code lengths */ 2642 var root = 0; /* number of index bits for root table */ 2643 var curr = 0; /* number of index bits for current table */ 2644 var drop = 0; /* code bits to drop for sub-table */ 2645 var left = 0; /* number of prefix codes available */ 2646 var used = 0; /* code entries in table used */ 2647 var huff = 0; /* Huffman code */ 2648 var incr; /* for incrementing code, index */ 2649 var fill; /* index for replicating entries */ 2650 var low; /* low bits for current root entry */ 2651 var mask; /* mask for low root bits */ 2652 var next; /* next available space in table */ 2653 var base = null; /* base value table to use */ 2654 var base_index = 0; 2655 // var shoextra; /* extra bits table to use */ 2656 var end; /* use base and extra for symbol > end */ 2657 var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */ 2658 var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */ 2659 var extra = null; 2660 var extra_index = 0; 2661 2662 var here_bits, here_op, here_val; 2663 2664 /* 2665 Process a set of code lengths to create a canonical Huffman code. The 2666 code lengths are lens[0..codes-1]. Each length corresponds to the 2667 symbols 0..codes-1. The Huffman code is generated by first sorting the 2668 symbols by length from short to long, and retaining the symbol order 2669 for codes with equal lengths. Then the code starts with all zero bits 2670 for the first code of the shortest length, and the codes are integer 2671 increments for the same length, and zeros are appended as the length 2672 increases. For the deflate format, these bits are stored backwards 2673 from their more natural integer increment ordering, and so when the 2674 decoding tables are built in the large loop below, the integer codes 2675 are incremented backwards. 2676 2677 This routine assumes, but does not check, that all of the entries in 2678 lens[] are in the range 0..MAXBITS. The caller must assure this. 2679 1..MAXBITS is interpreted as that code length. zero means that that 2680 symbol does not occur in this code. 2681 2682 The codes are sorted by computing a count of codes for each length, 2683 creating from that a table of starting indices for each length in the 2684 sorted table, and then entering the symbols in order in the sorted 2685 table. The sorted table is work[], with that space being provided by 2686 the caller. 2687 2688 The length counts are used for other purposes as well, i.e. finding 2689 the minimum and maximum length codes, determining if there are any 2690 codes at all, checking for a valid set of lengths, and looking ahead 2691 at length counts to determine sub-table sizes when building the 2692 decoding tables. 2693 */ 2694 2695 /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */ 2696 for (len = 0; len <= MAXBITS; len++) { 2697 count[len] = 0; 2698 } 2699 for (sym = 0; sym < codes; sym++) { 2700 count[lens[lens_index + sym]]++; 2701 } 2702 2703 /* bound code lengths, force root to be within code lengths */ 2704 root = bits; 2705 for (max = MAXBITS; max >= 1; max--) { 2706 if (count[max] !== 0) { break; } 2707 } 2708 if (root > max) { 2709 root = max; 2710 } 2711 if (max === 0) { /* no symbols to code at all */ 2712 //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */ 2713 //table.bits[opts.table_index] = 1; //here.bits = (var char)1; 2714 //table.val[opts.table_index++] = 0; //here.val = (var short)0; 2715 table[table_index++] = (1 << 24) | (64 << 16) | 0; 2716 2717 2718 //table.op[opts.table_index] = 64; 2719 //table.bits[opts.table_index] = 1; 2720 //table.val[opts.table_index++] = 0; 2721 table[table_index++] = (1 << 24) | (64 << 16) | 0; 2722 2723 opts.bits = 1; 2724 return 0; /* no symbols, but wait for decoding to report error */ 2725 } 2726 for (min = 1; min < max; min++) { 2727 if (count[min] !== 0) { break; } 2728 } 2729 if (root < min) { 2730 root = min; 2731 } 2732 2733 /* check for an over-subscribed or incomplete set of lengths */ 2734 left = 1; 2735 for (len = 1; len <= MAXBITS; len++) { 2736 left <<= 1; 2737 left -= count[len]; 2738 if (left < 0) { 2739 return -1; 2740 } /* over-subscribed */ 2741 } 2742 if (left > 0 && (type === CODES || max !== 1)) { 2743 return -1; /* incomplete set */ 2744 } 2745 2746 /* generate offsets into symbol table for each length for sorting */ 2747 offs[1] = 0; 2748 for (len = 1; len < MAXBITS; len++) { 2749 offs[len + 1] = offs[len] + count[len]; 2750 } 2751 2752 /* sort symbols by length, by symbol order within each length */ 2753 for (sym = 0; sym < codes; sym++) { 2754 if (lens[lens_index + sym] !== 0) { 2755 work[offs[lens[lens_index + sym]]++] = sym; 2756 } 2757 } 2758 2759 /* 2760 Create and fill in decoding tables. In this loop, the table being 2761 filled is at next and has curr index bits. The code being used is huff 2762 with length len. That code is converted to an index by dropping drop 2763 bits off of the bottom. For codes where len is less than drop + curr, 2764 those top drop + curr - len bits are incremented through all values to 2765 fill the table with replicated entries. 2766 2767 root is the number of index bits for the root table. When len exceeds 2768 root, sub-tables are created pointed to by the root entry with an index 2769 of the low root bits of huff. This is saved in low to check for when a 2770 new sub-table should be started. drop is zero when the root table is 2771 being filled, and drop is root when sub-tables are being filled. 2772 2773 When a new sub-table is needed, it is necessary to look ahead in the 2774 code lengths to determine what size sub-table is needed. The length 2775 counts are used for this, and so count[] is decremented as codes are 2776 entered in the tables. 2777 2778 used keeps track of how many table entries have been allocated from the 2779 provided *table space. It is checked for LENS and DIST tables against 2780 the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in 2781 the initial root table size constants. See the comments in inftrees.h 2782 for more information. 2783 2784 sym increments through all symbols, and the loop terminates when 2785 all codes of length max, i.e. all codes, have been processed. This 2786 routine permits incomplete codes, so another loop after this one fills 2787 in the rest of the decoding tables with invalid code markers. 2788 */ 2789 2790 /* set up for code type */ 2791 // poor man optimization - use if-else instead of switch, 2792 // to avoid deopts in old v8 2793 if (type === CODES) { 2794 base = extra = work; /* dummy value--not used */ 2795 end = 19; 2796 2797 } else if (type === LENS) { 2798 base = lbase; 2799 base_index -= 257; 2800 extra = lext; 2801 extra_index -= 257; 2802 end = 256; 2803 2804 } else { /* DISTS */ 2805 base = dbase; 2806 extra = dext; 2807 end = -1; 2808 } 2809 2810 /* initialize opts for loop */ 2811 huff = 0; /* starting code */ 2812 sym = 0; /* starting code symbol */ 2813 len = min; /* starting code length */ 2814 next = table_index; /* current table to fill in */ 2815 curr = root; /* current table index bits */ 2816 drop = 0; /* current bits to drop from code for index */ 2817 low = -1; /* trigger new sub-table when len > root */ 2818 used = 1 << root; /* use root table entries */ 2819 mask = used - 1; /* mask for comparing low */ 2820 2821 /* check available table space */ 2822 if ((type === LENS && used > ENOUGH_LENS) || 2823 (type === DISTS && used > ENOUGH_DISTS)) { 2824 return 1; 2825 } 2826 2827 /* process all codes and make table entries */ 2828 for (;;) { 2829 /* create table entry */ 2830 here_bits = len - drop; 2831 if (work[sym] < end) { 2832 here_op = 0; 2833 here_val = work[sym]; 2834 } 2835 else if (work[sym] > end) { 2836 here_op = extra[extra_index + work[sym]]; 2837 here_val = base[base_index + work[sym]]; 2838 } 2839 else { 2840 here_op = 32 + 64; /* end of block */ 2841 here_val = 0; 2842 } 2843 2844 /* replicate for those indices with low len bits equal to huff */ 2845 incr = 1 << (len - drop); 2846 fill = 1 << curr; 2847 min = fill; /* save offset to next table */ 2848 do { 2849 fill -= incr; 2850 table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0; 2851 } while (fill !== 0); 2852 2853 /* backwards increment the len-bit code huff */ 2854 incr = 1 << (len - 1); 2855 while (huff & incr) { 2856 incr >>= 1; 2857 } 2858 if (incr !== 0) { 2859 huff &= incr - 1; 2860 huff += incr; 2861 } else { 2862 huff = 0; 2863 } 2864 2865 /* go to next symbol, update count, len */ 2866 sym++; 2867 if (--count[len] === 0) { 2868 if (len === max) { break; } 2869 len = lens[lens_index + work[sym]]; 2870 } 2871 2872 /* create new sub-table if needed */ 2873 if (len > root && (huff & mask) !== low) { 2874 /* if first time, transition to sub-tables */ 2875 if (drop === 0) { 2876 drop = root; 2877 } 2878 2879 /* increment past last table */ 2880 next += min; /* here min is 1 << curr */ 2881 2882 /* determine length of next table */ 2883 curr = len - drop; 2884 left = 1 << curr; 2885 while (curr + drop < max) { 2886 left -= count[curr + drop]; 2887 if (left <= 0) { break; } 2888 curr++; 2889 left <<= 1; 2890 } 2891 2892 /* check for enough space */ 2893 used += 1 << curr; 2894 if ((type === LENS && used > ENOUGH_LENS) || 2895 (type === DISTS && used > ENOUGH_DISTS)) { 2896 return 1; 2897 } 2898 2899 /* point entry in root table to sub-table */ 2900 low = huff & mask; 2901 /*table.op[low] = curr; 2902 table.bits[low] = root; 2903 table.val[low] = next - opts.table_index;*/ 2904 table[low] = (root << 24) | (curr << 16) | (next - table_index) |0; 2905 } 2906 } 2907 2908 /* fill in remaining table entry if code is incomplete (guaranteed to have 2909 at most one remaining entry, since if the code is incomplete, the 2910 maximum code length that was allowed to get this far is one bit) */ 2911 if (huff !== 0) { 2912 //table.op[next + huff] = 64; /* invalid code marker */ 2913 //table.bits[next + huff] = len - drop; 2914 //table.val[next + huff] = 0; 2915 table[next + huff] = ((len - drop) << 24) | (64 << 16) |0; 2916 } 2917 2918 /* set return parameters */ 2919 //opts.table_index += used; 2920 opts.bits = root; 2921 return 0; 2922 }; 2923 2924 },{"../utils/common":1}],10:[function(require,module,exports){ 2925 'use strict'; 2926 2927 // (C) 1995-2013 Jean-loup Gailly and Mark Adler 2928 // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin 2929 // 2930 // This software is provided 'as-is', without any express or implied 2931 // warranty. In no event will the authors be held liable for any damages 2932 // arising from the use of this software. 2933 // 2934 // Permission is granted to anyone to use this software for any purpose, 2935 // including commercial applications, and to alter it and redistribute it 2936 // freely, subject to the following restrictions: 2937 // 2938 // 1. The origin of this software must not be misrepresented; you must not 2939 // claim that you wrote the original software. If you use this software 2940 // in a product, an acknowledgment in the product documentation would be 2941 // appreciated but is not required. 2942 // 2. Altered source versions must be plainly marked as such, and must not be 2943 // misrepresented as being the original software. 2944 // 3. This notice may not be removed or altered from any source distribution. 2945 2946 module.exports = { 2947 2: 'need dictionary', /* Z_NEED_DICT 2 */ 2948 1: 'stream end', /* Z_STREAM_END 1 */ 2949 0: '', /* Z_OK 0 */ 2950 '-1': 'file error', /* Z_ERRNO (-1) */ 2951 '-2': 'stream error', /* Z_STREAM_ERROR (-2) */ 2952 '-3': 'data error', /* Z_DATA_ERROR (-3) */ 2953 '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */ 2954 '-5': 'buffer error', /* Z_BUF_ERROR (-5) */ 2955 '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */ 2956 }; 2957 2958 },{}],11:[function(require,module,exports){ 2959 'use strict'; 2960 2961 // (C) 1995-2013 Jean-loup Gailly and Mark Adler 2962 // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin 2963 // 2964 // This software is provided 'as-is', without any express or implied 2965 // warranty. In no event will the authors be held liable for any damages 2966 // arising from the use of this software. 2967 // 2968 // Permission is granted to anyone to use this software for any purpose, 2969 // including commercial applications, and to alter it and redistribute it 2970 // freely, subject to the following restrictions: 2971 // 2972 // 1. The origin of this software must not be misrepresented; you must not 2973 // claim that you wrote the original software. If you use this software 2974 // in a product, an acknowledgment in the product documentation would be 2975 // appreciated but is not required. 2976 // 2. Altered source versions must be plainly marked as such, and must not be 2977 // misrepresented as being the original software. 2978 // 3. This notice may not be removed or altered from any source distribution. 2979 2980 function ZStream() { 2981 /* next input byte */ 2982 this.input = null; // JS specific, because we have no pointers 2983 this.next_in = 0; 2984 /* number of bytes available at input */ 2985 this.avail_in = 0; 2986 /* total number of input bytes read so far */ 2987 this.total_in = 0; 2988 /* next output byte should be put there */ 2989 this.output = null; // JS specific, because we have no pointers 2990 this.next_out = 0; 2991 /* remaining free space at output */ 2992 this.avail_out = 0; 2993 /* total number of bytes output so far */ 2994 this.total_out = 0; 2995 /* last error message, NULL if no error */ 2996 this.msg = ''/*Z_NULL*/; 2997 /* not visible by applications */ 2998 this.state = null; 2999 /* best guess about the data type: binary or text */ 3000 this.data_type = 2/*Z_UNKNOWN*/; 3001 /* adler32 value of the uncompressed data */ 3002 this.adler = 0; 3003 } 3004 3005 module.exports = ZStream; 3006 3007 },{}],"/lib/inflate.js":[function(require,module,exports){ 3008 'use strict'; 3009 3010 3011 var zlib_inflate = require('./zlib/inflate'); 3012 var utils = require('./utils/common'); 3013 var strings = require('./utils/strings'); 3014 var c = require('./zlib/constants'); 3015 var msg = require('./zlib/messages'); 3016 var ZStream = require('./zlib/zstream'); 3017 var GZheader = require('./zlib/gzheader'); 3018 3019 var toString = Object.prototype.toString; 3020 3021 /** 3022 * class Inflate 3023 * 3024 * Generic JS-style wrapper for zlib calls. If you don't need 3025 * streaming behaviour - use more simple functions: [[inflate]] 3026 * and [[inflateRaw]]. 3027 **/ 3028 3029 /* internal 3030 * inflate.chunks -> Array 3031 * 3032 * Chunks of output data, if [[Inflate#onData]] not overridden. 3033 **/ 3034 3035 /** 3036 * Inflate.result -> Uint8Array|Array|String 3037 * 3038 * Uncompressed result, generated by default [[Inflate#onData]] 3039 * and [[Inflate#onEnd]] handlers. Filled after you push last chunk 3040 * (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you 3041 * push a chunk with explicit flush (call [[Inflate#push]] with 3042 * `Z_SYNC_FLUSH` param). 3043 **/ 3044 3045 /** 3046 * Inflate.err -> Number 3047 * 3048 * Error code after inflate finished. 0 (Z_OK) on success. 3049 * Should be checked if broken data possible. 3050 **/ 3051 3052 /** 3053 * Inflate.msg -> String 3054 * 3055 * Error message, if [[Inflate.err]] != 0 3056 **/ 3057 3058 3059 /** 3060 * new Inflate(options) 3061 * - options (Object): zlib inflate options. 3062 * 3063 * Creates new inflator instance with specified params. Throws exception 3064 * on bad params. Supported options: 3065 * 3066 * - `windowBits` 3067 * - `dictionary` 3068 * 3069 * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) 3070 * for more information on these. 3071 * 3072 * Additional options, for internal needs: 3073 * 3074 * - `chunkSize` - size of generated data chunks (16K by default) 3075 * - `raw` (Boolean) - do raw inflate 3076 * - `to` (String) - if equal to 'string', then result will be converted 3077 * from utf8 to utf16 (javascript) string. When string output requested, 3078 * chunk length can differ from `chunkSize`, depending on content. 3079 * 3080 * By default, when no options set, autodetect deflate/gzip data format via 3081 * wrapper header. 3082 * 3083 * ##### Example: 3084 * 3085 * ```javascript 3086 * var pako = require('pako') 3087 * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9]) 3088 * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]); 3089 * 3090 * var inflate = new pako.Inflate({ level: 3}); 3091 * 3092 * inflate.push(chunk1, false); 3093 * inflate.push(chunk2, true); // true -> last chunk 3094 * 3095 * if (inflate.err) { throw new Error(inflate.err); } 3096 * 3097 * console.log(inflate.result); 3098 * ``` 3099 **/ 3100 function Inflate(options) { 3101 if (!(this instanceof Inflate)) return new Inflate(options); 3102 3103 this.options = utils.assign({ 3104 chunkSize: 16384, 3105 windowBits: 0, 3106 to: '' 3107 }, options || {}); 3108 3109 var opt = this.options; 3110 3111 // Force window size for `raw` data, if not set directly, 3112 // because we have no header for autodetect. 3113 if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) { 3114 opt.windowBits = -opt.windowBits; 3115 if (opt.windowBits === 0) { opt.windowBits = -15; } 3116 } 3117 3118 // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate 3119 if ((opt.windowBits >= 0) && (opt.windowBits < 16) && 3120 !(options && options.windowBits)) { 3121 opt.windowBits += 32; 3122 } 3123 3124 // Gzip header has no info about windows size, we can do autodetect only 3125 // for deflate. So, if window size not set, force it to max when gzip possible 3126 if ((opt.windowBits > 15) && (opt.windowBits < 48)) { 3127 // bit 3 (16) -> gzipped data 3128 // bit 4 (32) -> autodetect gzip/deflate 3129 if ((opt.windowBits & 15) === 0) { 3130 opt.windowBits |= 15; 3131 } 3132 } 3133 3134 this.err = 0; // error code, if happens (0 = Z_OK) 3135 this.msg = ''; // error message 3136 this.ended = false; // used to avoid multiple onEnd() calls 3137 this.chunks = []; // chunks of compressed data 3138 3139 this.strm = new ZStream(); 3140 this.strm.avail_out = 0; 3141 3142 var status = zlib_inflate.inflateInit2( 3143 this.strm, 3144 opt.windowBits 3145 ); 3146 3147 if (status !== c.Z_OK) { 3148 throw new Error(msg[status]); 3149 } 3150 3151 this.header = new GZheader(); 3152 3153 zlib_inflate.inflateGetHeader(this.strm, this.header); 3154 3155 // Setup dictionary 3156 if (opt.dictionary) { 3157 // Convert data if needed 3158 if (typeof opt.dictionary === 'string') { 3159 opt.dictionary = strings.string2buf(opt.dictionary); 3160 } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') { 3161 opt.dictionary = new Uint8Array(opt.dictionary); 3162 } 3163 if (opt.raw) { //In raw mode we need to set the dictionary early 3164 status = zlib_inflate.inflateSetDictionary(this.strm, opt.dictionary); 3165 if (status !== c.Z_OK) { 3166 throw new Error(msg[status]); 3167 } 3168 } 3169 } 3170 } 3171 3172 /** 3173 * Inflate#push(data[, mode]) -> Boolean 3174 * - data (Uint8Array|Array|ArrayBuffer|String): input data 3175 * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes. 3176 * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH. 3177 * 3178 * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with 3179 * new output chunks. Returns `true` on success. The last data block must have 3180 * mode Z_FINISH (or `true`). That will flush internal pending buffers and call 3181 * [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you 3182 * can use mode Z_SYNC_FLUSH, keeping the decompression context. 3183 * 3184 * On fail call [[Inflate#onEnd]] with error code and return false. 3185 * 3186 * We strongly recommend to use `Uint8Array` on input for best speed (output 3187 * format is detected automatically). Also, don't skip last param and always 3188 * use the same type in your code (boolean or number). That will improve JS speed. 3189 * 3190 * For regular `Array`-s make sure all elements are [0..255]. 3191 * 3192 * ##### Example 3193 * 3194 * ```javascript 3195 * push(chunk, false); // push one of data chunks 3196 * ... 3197 * push(chunk, true); // push last chunk 3198 * ``` 3199 **/ 3200 Inflate.prototype.push = function (data, mode) { 3201 var strm = this.strm; 3202 var chunkSize = this.options.chunkSize; 3203 var dictionary = this.options.dictionary; 3204 var status, _mode; 3205 var next_out_utf8, tail, utf8str; 3206 3207 // Flag to properly process Z_BUF_ERROR on testing inflate call 3208 // when we check that all output data was flushed. 3209 var allowBufError = false; 3210 3211 if (this.ended) { return false; } 3212 _mode = (mode === ~~mode) ? mode : ((mode === true) ? c.Z_FINISH : c.Z_NO_FLUSH); 3213 3214 // Convert data if needed 3215 if (typeof data === 'string') { 3216 // Only binary strings can be decompressed on practice 3217 strm.input = strings.binstring2buf(data); 3218 } else if (toString.call(data) === '[object ArrayBuffer]') { 3219 strm.input = new Uint8Array(data); 3220 } else { 3221 strm.input = data; 3222 } 3223 3224 strm.next_in = 0; 3225 strm.avail_in = strm.input.length; 3226 3227 do { 3228 if (strm.avail_out === 0) { 3229 strm.output = new utils.Buf8(chunkSize); 3230 strm.next_out = 0; 3231 strm.avail_out = chunkSize; 3232 } 3233 3234 status = zlib_inflate.inflate(strm, c.Z_NO_FLUSH); /* no bad return value */ 3235 3236 if (status === c.Z_NEED_DICT && dictionary) { 3237 status = zlib_inflate.inflateSetDictionary(this.strm, dictionary); 3238 } 3239 3240 if (status === c.Z_BUF_ERROR && allowBufError === true) { 3241 status = c.Z_OK; 3242 allowBufError = false; 3243 } 3244 3245 if (status !== c.Z_STREAM_END && status !== c.Z_OK) { 3246 this.onEnd(status); 3247 this.ended = true; 3248 return false; 3249 } 3250 3251 if (strm.next_out) { 3252 if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && (_mode === c.Z_FINISH || _mode === c.Z_SYNC_FLUSH))) { 3253 3254 if (this.options.to === 'string') { 3255 3256 next_out_utf8 = strings.utf8border(strm.output, strm.next_out); 3257 3258 tail = strm.next_out - next_out_utf8; 3259 utf8str = strings.buf2string(strm.output, next_out_utf8); 3260 3261 // move tail 3262 strm.next_out = tail; 3263 strm.avail_out = chunkSize - tail; 3264 if (tail) { utils.arraySet(strm.output, strm.output, next_out_utf8, tail, 0); } 3265 3266 this.onData(utf8str); 3267 3268 } else { 3269 this.onData(utils.shrinkBuf(strm.output, strm.next_out)); 3270 } 3271 } 3272 } 3273 3274 // When no more input data, we should check that internal inflate buffers 3275 // are flushed. The only way to do it when avail_out = 0 - run one more 3276 // inflate pass. But if output data not exists, inflate return Z_BUF_ERROR. 3277 // Here we set flag to process this error properly. 3278 // 3279 // NOTE. Deflate does not return error in this case and does not needs such 3280 // logic. 3281 if (strm.avail_in === 0 && strm.avail_out === 0) { 3282 allowBufError = true; 3283 } 3284 3285 } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c.Z_STREAM_END); 3286 3287 if (status === c.Z_STREAM_END) { 3288 _mode = c.Z_FINISH; 3289 } 3290 3291 // Finalize on the last chunk. 3292 if (_mode === c.Z_FINISH) { 3293 status = zlib_inflate.inflateEnd(this.strm); 3294 this.onEnd(status); 3295 this.ended = true; 3296 return status === c.Z_OK; 3297 } 3298 3299 // callback interim results if Z_SYNC_FLUSH. 3300 if (_mode === c.Z_SYNC_FLUSH) { 3301 this.onEnd(c.Z_OK); 3302 strm.avail_out = 0; 3303 return true; 3304 } 3305 3306 return true; 3307 }; 3308 3309 3310 /** 3311 * Inflate#onData(chunk) -> Void 3312 * - chunk (Uint8Array|Array|String): output data. Type of array depends 3313 * on js engine support. When string output requested, each chunk 3314 * will be string. 3315 * 3316 * By default, stores data blocks in `chunks[]` property and glue 3317 * those in `onEnd`. Override this handler, if you need another behaviour. 3318 **/ 3319 Inflate.prototype.onData = function (chunk) { 3320 this.chunks.push(chunk); 3321 }; 3322 3323 3324 /** 3325 * Inflate#onEnd(status) -> Void 3326 * - status (Number): inflate status. 0 (Z_OK) on success, 3327 * other if not. 3328 * 3329 * Called either after you tell inflate that the input stream is 3330 * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH) 3331 * or if an error happened. By default - join collected chunks, 3332 * free memory and fill `results` / `err` properties. 3333 **/ 3334 Inflate.prototype.onEnd = function (status) { 3335 // On success - join 3336 if (status === c.Z_OK) { 3337 if (this.options.to === 'string') { 3338 // Glue & convert here, until we teach pako to send 3339 // utf8 aligned strings to onData 3340 this.result = this.chunks.join(''); 3341 } else { 3342 this.result = utils.flattenChunks(this.chunks); 3343 } 3344 } 3345 this.chunks = []; 3346 this.err = status; 3347 this.msg = this.strm.msg; 3348 }; 3349 3350 3351 /** 3352 * inflate(data[, options]) -> Uint8Array|Array|String 3353 * - data (Uint8Array|Array|String): input data to decompress. 3354 * - options (Object): zlib inflate options. 3355 * 3356 * Decompress `data` with inflate/ungzip and `options`. Autodetect 3357 * format via wrapper header by default. That's why we don't provide 3358 * separate `ungzip` method. 3359 * 3360 * Supported options are: 3361 * 3362 * - windowBits 3363 * 3364 * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) 3365 * for more information. 3366 * 3367 * Sugar (options): 3368 * 3369 * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify 3370 * negative windowBits implicitly. 3371 * - `to` (String) - if equal to 'string', then result will be converted 3372 * from utf8 to utf16 (javascript) string. When string output requested, 3373 * chunk length can differ from `chunkSize`, depending on content. 3374 * 3375 * 3376 * ##### Example: 3377 * 3378 * ```javascript 3379 * var pako = require('pako') 3380 * , input = pako.deflate([1,2,3,4,5,6,7,8,9]) 3381 * , output; 3382 * 3383 * try { 3384 * output = pako.inflate(input); 3385 * } catch (err) 3386 * console.log(err); 3387 * } 3388 * ``` 3389 **/ 3390 function inflate(input, options) { 3391 var inflator = new Inflate(options); 3392 3393 inflator.push(input, true); 3394 3395 // That will never happens, if you don't cheat with options :) 3396 if (inflator.err) { throw inflator.msg || msg[inflator.err]; } 3397 3398 return inflator.result; 3399 } 3400 3401 3402 /** 3403 * inflateRaw(data[, options]) -> Uint8Array|Array|String 3404 * - data (Uint8Array|Array|String): input data to decompress. 3405 * - options (Object): zlib inflate options. 3406 * 3407 * The same as [[inflate]], but creates raw data, without wrapper 3408 * (header and adler32 crc). 3409 **/ 3410 function inflateRaw(input, options) { 3411 options = options || {}; 3412 options.raw = true; 3413 return inflate(input, options); 3414 } 3415 3416 3417 /** 3418 * ungzip(data[, options]) -> Uint8Array|Array|String 3419 * - data (Uint8Array|Array|String): input data to decompress. 3420 * - options (Object): zlib inflate options. 3421 * 3422 * Just shortcut to [[inflate]], because it autodetects format 3423 * by header.content. Done for convenience. 3424 **/ 3425 3426 3427 exports.Inflate = Inflate; 3428 exports.inflate = inflate; 3429 exports.inflateRaw = inflateRaw; 3430 exports.ungzip = inflate; 3431 3432 },{"./utils/common":1,"./utils/strings":2,"./zlib/constants":4,"./zlib/gzheader":6,"./zlib/inflate":8,"./zlib/messages":10,"./zlib/zstream":11}]},{},[])("/lib/inflate.js") 3433 }); 3434 /* eslint-enable */ 3435 3436 3437 /***/ }), 3438 3439 /***/ 8572: 3440 /***/ ((module) => { 3441 3442 /** 3443 * Credits: 3444 * 3445 * lib-font 3446 * https://github.com/Pomax/lib-font 3447 * https://github.com/Pomax/lib-font/blob/master/lib/unbrotli.js 3448 * 3449 * The MIT License (MIT) 3450 * 3451 * Copyright (c) 2020 pomax@nihongoresources.com 3452 * 3453 * Permission is hereby granted, free of charge, to any person obtaining a copy 3454 * of this software and associated documentation files (the "Software"), to deal 3455 * in the Software without restriction, including without limitation the rights 3456 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 3457 * copies of the Software, and to permit persons to whom the Software is 3458 * furnished to do so, subject to the following conditions: 3459 * 3460 * The above copyright notice and this permission notice shall be included in all 3461 * copies or substantial portions of the Software. 3462 * 3463 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 3464 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 3465 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 3466 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 3467 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 3468 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 3469 * SOFTWARE. 3470 */ 3471 3472 /* eslint eslint-comments/no-unlimited-disable: 0 */ 3473 /* eslint-disable */ 3474 (function(f){if(true){module.exports=f()}else { var g; }})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=undefined;if(!f&&c)return require(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=undefined,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ 3475 /* Copyright 2013 Google Inc. All Rights Reserved. 3476 3477 Licensed under the Apache License, Version 2.0 (the "License"); 3478 you may not use this file except in compliance with the License. 3479 You may obtain a copy of the License at 3480 3481 http://www.apache.org/licenses/LICENSE-2.0 3482 3483 Unless required by applicable law or agreed to in writing, software 3484 distributed under the License is distributed on an "AS IS" BASIS, 3485 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3486 See the License for the specific language governing permissions and 3487 limitations under the License. 3488 3489 Bit reading helpers 3490 */ 3491 3492 var BROTLI_READ_SIZE = 4096; 3493 var BROTLI_IBUF_SIZE = (2 * BROTLI_READ_SIZE + 32); 3494 var BROTLI_IBUF_MASK = (2 * BROTLI_READ_SIZE - 1); 3495 3496 var kBitMask = new Uint32Array([ 3497 0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 3498 65535, 131071, 262143, 524287, 1048575, 2097151, 4194303, 8388607, 16777215 3499 ]); 3500 3501 /* Input byte buffer, consist of a ringbuffer and a "slack" region where */ 3502 /* bytes from the start of the ringbuffer are copied. */ 3503 function BrotliBitReader(input) { 3504 this.buf_ = new Uint8Array(BROTLI_IBUF_SIZE); 3505 this.input_ = input; /* input callback */ 3506 3507 this.reset(); 3508 } 3509 3510 BrotliBitReader.READ_SIZE = BROTLI_READ_SIZE; 3511 BrotliBitReader.IBUF_MASK = BROTLI_IBUF_MASK; 3512 3513 BrotliBitReader.prototype.reset = function() { 3514 this.buf_ptr_ = 0; /* next input will write here */ 3515 this.val_ = 0; /* pre-fetched bits */ 3516 this.pos_ = 0; /* byte position in stream */ 3517 this.bit_pos_ = 0; /* current bit-reading position in val_ */ 3518 this.bit_end_pos_ = 0; /* bit-reading end position from LSB of val_ */ 3519 this.eos_ = 0; /* input stream is finished */ 3520 3521 this.readMoreInput(); 3522 for (var i = 0; i < 4; i++) { 3523 this.val_ |= this.buf_[this.pos_] << (8 * i); 3524 ++this.pos_; 3525 } 3526 3527 return this.bit_end_pos_ > 0; 3528 }; 3529 3530 /* Fills up the input ringbuffer by calling the input callback. 3531 3532 Does nothing if there are at least 32 bytes present after current position. 3533 3534 Returns 0 if either: 3535 - the input callback returned an error, or 3536 - there is no more input and the position is past the end of the stream. 3537 3538 After encountering the end of the input stream, 32 additional zero bytes are 3539 copied to the ringbuffer, therefore it is safe to call this function after 3540 every 32 bytes of input is read. 3541 */ 3542 BrotliBitReader.prototype.readMoreInput = function() { 3543 if (this.bit_end_pos_ > 256) { 3544 return; 3545 } else if (this.eos_) { 3546 if (this.bit_pos_ > this.bit_end_pos_) 3547 throw new Error('Unexpected end of input ' + this.bit_pos_ + ' ' + this.bit_end_pos_); 3548 } else { 3549 var dst = this.buf_ptr_; 3550 var bytes_read = this.input_.read(this.buf_, dst, BROTLI_READ_SIZE); 3551 if (bytes_read < 0) { 3552 throw new Error('Unexpected end of input'); 3553 } 3554 3555 if (bytes_read < BROTLI_READ_SIZE) { 3556 this.eos_ = 1; 3557 /* Store 32 bytes of zero after the stream end. */ 3558 for (var p = 0; p < 32; p++) 3559 this.buf_[dst + bytes_read + p] = 0; 3560 } 3561 3562 if (dst === 0) { 3563 /* Copy the head of the ringbuffer to the slack region. */ 3564 for (var p = 0; p < 32; p++) 3565 this.buf_[(BROTLI_READ_SIZE << 1) + p] = this.buf_[p]; 3566 3567 this.buf_ptr_ = BROTLI_READ_SIZE; 3568 } else { 3569 this.buf_ptr_ = 0; 3570 } 3571 3572 this.bit_end_pos_ += bytes_read << 3; 3573 } 3574 }; 3575 3576 /* Guarantees that there are at least 24 bits in the buffer. */ 3577 BrotliBitReader.prototype.fillBitWindow = function() { 3578 while (this.bit_pos_ >= 8) { 3579 this.val_ >>>= 8; 3580 this.val_ |= this.buf_[this.pos_ & BROTLI_IBUF_MASK] << 24; 3581 ++this.pos_; 3582 this.bit_pos_ = this.bit_pos_ - 8 >>> 0; 3583 this.bit_end_pos_ = this.bit_end_pos_ - 8 >>> 0; 3584 } 3585 }; 3586 3587 /* Reads the specified number of bits from Read Buffer. */ 3588 BrotliBitReader.prototype.readBits = function(n_bits) { 3589 if (32 - this.bit_pos_ < n_bits) { 3590 this.fillBitWindow(); 3591 } 3592 3593 var val = ((this.val_ >>> this.bit_pos_) & kBitMask[n_bits]); 3594 this.bit_pos_ += n_bits; 3595 return val; 3596 }; 3597 3598 module.exports = BrotliBitReader; 3599 3600 },{}],2:[function(require,module,exports){ 3601 /* Copyright 2013 Google Inc. All Rights Reserved. 3602 3603 Licensed under the Apache License, Version 2.0 (the "License"); 3604 you may not use this file except in compliance with the License. 3605 You may obtain a copy of the License at 3606 3607 http://www.apache.org/licenses/LICENSE-2.0 3608 3609 Unless required by applicable law or agreed to in writing, software 3610 distributed under the License is distributed on an "AS IS" BASIS, 3611 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3612 See the License for the specific language governing permissions and 3613 limitations under the License. 3614 3615 Lookup table to map the previous two bytes to a context id. 3616 3617 There are four different context modeling modes defined here: 3618 CONTEXT_LSB6: context id is the least significant 6 bits of the last byte, 3619 CONTEXT_MSB6: context id is the most significant 6 bits of the last byte, 3620 CONTEXT_UTF8: second-order context model tuned for UTF8-encoded text, 3621 CONTEXT_SIGNED: second-order context model tuned for signed integers. 3622 3623 The context id for the UTF8 context model is calculated as follows. If p1 3624 and p2 are the previous two bytes, we calcualte the context as 3625 3626 context = kContextLookup[p1] | kContextLookup[p2 + 256]. 3627 3628 If the previous two bytes are ASCII characters (i.e. < 128), this will be 3629 equivalent to 3630 3631 context = 4 * context1(p1) + context2(p2), 3632 3633 where context1 is based on the previous byte in the following way: 3634 3635 0 : non-ASCII control 3636 1 : \t, \n, \r 3637 2 : space 3638 3 : other punctuation 3639 4 : " ' 3640 5 : % 3641 6 : ( < [ { 3642 7 : ) > ] } 3643 8 : , ; : 3644 9 : . 3645 10 : = 3646 11 : number 3647 12 : upper-case vowel 3648 13 : upper-case consonant 3649 14 : lower-case vowel 3650 15 : lower-case consonant 3651 3652 and context2 is based on the second last byte: 3653 3654 0 : control, space 3655 1 : punctuation 3656 2 : upper-case letter, number 3657 3 : lower-case letter 3658 3659 If the last byte is ASCII, and the second last byte is not (in a valid UTF8 3660 stream it will be a continuation byte, value between 128 and 191), the 3661 context is the same as if the second last byte was an ASCII control or space. 3662 3663 If the last byte is a UTF8 lead byte (value >= 192), then the next byte will 3664 be a continuation byte and the context id is 2 or 3 depending on the LSB of 3665 the last byte and to a lesser extent on the second last byte if it is ASCII. 3666 3667 If the last byte is a UTF8 continuation byte, the second last byte can be: 3668 - continuation byte: the next byte is probably ASCII or lead byte (assuming 3669 4-byte UTF8 characters are rare) and the context id is 0 or 1. 3670 - lead byte (192 - 207): next byte is ASCII or lead byte, context is 0 or 1 3671 - lead byte (208 - 255): next byte is continuation byte, context is 2 or 3 3672 3673 The possible value combinations of the previous two bytes, the range of 3674 context ids and the type of the next byte is summarized in the table below: 3675 3676 |--------\-----------------------------------------------------------------| 3677 | \ Last byte | 3678 | Second \---------------------------------------------------------------| 3679 | last byte \ ASCII | cont. byte | lead byte | 3680 | \ (0-127) | (128-191) | (192-) | 3681 |=============|===================|=====================|==================| 3682 | ASCII | next: ASCII/lead | not valid | next: cont. | 3683 | (0-127) | context: 4 - 63 | | context: 2 - 3 | 3684 |-------------|-------------------|---------------------|------------------| 3685 | cont. byte | next: ASCII/lead | next: ASCII/lead | next: cont. | 3686 | (128-191) | context: 4 - 63 | context: 0 - 1 | context: 2 - 3 | 3687 |-------------|-------------------|---------------------|------------------| 3688 | lead byte | not valid | next: ASCII/lead | not valid | 3689 | (192-207) | | context: 0 - 1 | | 3690 |-------------|-------------------|---------------------|------------------| 3691 | lead byte | not valid | next: cont. | not valid | 3692 | (208-) | | context: 2 - 3 | | 3693 |-------------|-------------------|---------------------|------------------| 3694 3695 The context id for the signed context mode is calculated as: 3696 3697 context = (kContextLookup[512 + p1] << 3) | kContextLookup[512 + p2]. 3698 3699 For any context modeling modes, the context ids can be calculated by |-ing 3700 together two lookups from one table using context model dependent offsets: 3701 3702 context = kContextLookup[offset1 + p1] | kContextLookup[offset2 + p2]. 3703 3704 where offset1 and offset2 are dependent on the context mode. 3705 */ 3706 3707 var CONTEXT_LSB6 = 0; 3708 var CONTEXT_MSB6 = 1; 3709 var CONTEXT_UTF8 = 2; 3710 var CONTEXT_SIGNED = 3; 3711 3712 /* Common context lookup table for all context modes. */ 3713 exports.lookup = new Uint8Array([ 3714 /* CONTEXT_UTF8, last byte. */ 3715 /* ASCII range. */ 3716 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 0, 0, 4, 0, 0, 3717 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3718 8, 12, 16, 12, 12, 20, 12, 16, 24, 28, 12, 12, 32, 12, 36, 12, 3719 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 32, 32, 24, 40, 28, 12, 3720 12, 48, 52, 52, 52, 48, 52, 52, 52, 48, 52, 52, 52, 52, 52, 48, 3721 52, 52, 52, 52, 52, 48, 52, 52, 52, 52, 52, 24, 12, 28, 12, 12, 3722 12, 56, 60, 60, 60, 56, 60, 60, 60, 56, 60, 60, 60, 60, 60, 56, 3723 60, 60, 60, 60, 60, 56, 60, 60, 60, 60, 60, 24, 12, 28, 12, 0, 3724 /* UTF8 continuation byte range. */ 3725 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 3726 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 3727 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 3728 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 3729 /* UTF8 lead byte range. */ 3730 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 3731 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 3732 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 3733 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 3734 /* CONTEXT_UTF8 second last byte. */ 3735 /* ASCII range. */ 3736 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3737 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3738 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3739 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 3740 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3741 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 3742 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3743 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 0, 3744 /* UTF8 continuation byte range. */ 3745 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3746 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3747 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3748 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3749 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3750 /* UTF8 lead byte range. */ 3751 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3752 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3753 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3754 /* CONTEXT_SIGNED, second last byte. */ 3755 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3756 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3757 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3758 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3759 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3760 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3761 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3762 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3763 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3764 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3765 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3766 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3767 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 3768 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 3769 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 3770 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 3771 /* CONTEXT_SIGNED, last byte, same as the above values shifted by 3 bits. */ 3772 0, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 3773 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 3774 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 3775 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 3776 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 3777 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 3778 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 3779 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 3780 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 3781 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 3782 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 3783 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 3784 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 3785 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 3786 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 3787 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 56, 3788 /* CONTEXT_LSB6, last byte. */ 3789 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 3790 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 3791 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 3792 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 3793 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 3794 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 3795 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 3796 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 3797 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 3798 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 3799 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 3800 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 3801 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 3802 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 3803 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 3804 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 3805 /* CONTEXT_MSB6, last byte. */ 3806 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3807 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 3808 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 3809 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 3810 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 3811 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 23, 3812 24, 24, 24, 24, 25, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 27, 3813 28, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31, 3814 32, 32, 32, 32, 33, 33, 33, 33, 34, 34, 34, 34, 35, 35, 35, 35, 3815 36, 36, 36, 36, 37, 37, 37, 37, 38, 38, 38, 38, 39, 39, 39, 39, 3816 40, 40, 40, 40, 41, 41, 41, 41, 42, 42, 42, 42, 43, 43, 43, 43, 3817 44, 44, 44, 44, 45, 45, 45, 45, 46, 46, 46, 46, 47, 47, 47, 47, 3818 48, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 50, 51, 51, 51, 51, 3819 52, 52, 52, 52, 53, 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, 55, 3820 56, 56, 56, 56, 57, 57, 57, 57, 58, 58, 58, 58, 59, 59, 59, 59, 3821 60, 60, 60, 60, 61, 61, 61, 61, 62, 62, 62, 62, 63, 63, 63, 63, 3822 /* CONTEXT_{M,L}SB6, second last byte, */ 3823 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3824 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3825 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3826 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3827 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3828 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3829 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3830 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3831 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3832 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3833 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3834 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3835 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3836 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3837 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3838 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3839 ]); 3840 3841 exports.lookupOffsets = new Uint16Array([ 3842 /* CONTEXT_LSB6 */ 3843 1024, 1536, 3844 /* CONTEXT_MSB6 */ 3845 1280, 1536, 3846 /* CONTEXT_UTF8 */ 3847 0, 256, 3848 /* CONTEXT_SIGNED */ 3849 768, 512, 3850 ]); 3851 3852 },{}],3:[function(require,module,exports){ 3853 /* Copyright 2013 Google Inc. All Rights Reserved. 3854 3855 Licensed under the Apache License, Version 2.0 (the "License"); 3856 you may not use this file except in compliance with the License. 3857 You may obtain a copy of the License at 3858 3859 http://www.apache.org/licenses/LICENSE-2.0 3860 3861 Unless required by applicable law or agreed to in writing, software 3862 distributed under the License is distributed on an "AS IS" BASIS, 3863 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3864 See the License for the specific language governing permissions and 3865 limitations under the License. 3866 */ 3867 3868 var BrotliInput = require('./streams').BrotliInput; 3869 var BrotliOutput = require('./streams').BrotliOutput; 3870 var BrotliBitReader = require('./bit_reader'); 3871 var BrotliDictionary = require('./dictionary'); 3872 var HuffmanCode = require('./huffman').HuffmanCode; 3873 var BrotliBuildHuffmanTable = require('./huffman').BrotliBuildHuffmanTable; 3874 var Context = require('./context'); 3875 var Prefix = require('./prefix'); 3876 var Transform = require('./transform'); 3877 3878 var kDefaultCodeLength = 8; 3879 var kCodeLengthRepeatCode = 16; 3880 var kNumLiteralCodes = 256; 3881 var kNumInsertAndCopyCodes = 704; 3882 var kNumBlockLengthCodes = 26; 3883 var kLiteralContextBits = 6; 3884 var kDistanceContextBits = 2; 3885 3886 var HUFFMAN_TABLE_BITS = 8; 3887 var HUFFMAN_TABLE_MASK = 0xff; 3888 /* Maximum possible Huffman table size for an alphabet size of 704, max code 3889 * length 15 and root table bits 8. */ 3890 var HUFFMAN_MAX_TABLE_SIZE = 1080; 3891 3892 var CODE_LENGTH_CODES = 18; 3893 var kCodeLengthCodeOrder = new Uint8Array([ 3894 1, 2, 3, 4, 0, 5, 17, 6, 16, 7, 8, 9, 10, 11, 12, 13, 14, 15, 3895 ]); 3896 3897 var NUM_DISTANCE_SHORT_CODES = 16; 3898 var kDistanceShortCodeIndexOffset = new Uint8Array([ 3899 3, 2, 1, 0, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2 3900 ]); 3901 3902 var kDistanceShortCodeValueOffset = new Int8Array([ 3903 0, 0, 0, 0, -1, 1, -2, 2, -3, 3, -1, 1, -2, 2, -3, 3 3904 ]); 3905 3906 var kMaxHuffmanTableSize = new Uint16Array([ 3907 256, 402, 436, 468, 500, 534, 566, 598, 630, 662, 694, 726, 758, 790, 822, 3908 854, 886, 920, 952, 984, 1016, 1048, 1080 3909 ]); 3910 3911 function DecodeWindowBits(br) { 3912 var n; 3913 if (br.readBits(1) === 0) { 3914 return 16; 3915 } 3916 3917 n = br.readBits(3); 3918 if (n > 0) { 3919 return 17 + n; 3920 } 3921 3922 n = br.readBits(3); 3923 if (n > 0) { 3924 return 8 + n; 3925 } 3926 3927 return 17; 3928 } 3929 3930 /* Decodes a number in the range [0..255], by reading 1 - 11 bits. */ 3931 function DecodeVarLenUint8(br) { 3932 if (br.readBits(1)) { 3933 var nbits = br.readBits(3); 3934 if (nbits === 0) { 3935 return 1; 3936 } else { 3937 return br.readBits(nbits) + (1 << nbits); 3938 } 3939 } 3940 return 0; 3941 } 3942 3943 function MetaBlockLength() { 3944 this.meta_block_length = 0; 3945 this.input_end = 0; 3946 this.is_uncompressed = 0; 3947 this.is_metadata = false; 3948 } 3949 3950 function DecodeMetaBlockLength(br) { 3951 var out = new MetaBlockLength; 3952 var size_nibbles; 3953 var size_bytes; 3954 var i; 3955 3956 out.input_end = br.readBits(1); 3957 if (out.input_end && br.readBits(1)) { 3958 return out; 3959 } 3960 3961 size_nibbles = br.readBits(2) + 4; 3962 if (size_nibbles === 7) { 3963 out.is_metadata = true; 3964 3965 if (br.readBits(1) !== 0) 3966 throw new Error('Invalid reserved bit'); 3967 3968 size_bytes = br.readBits(2); 3969 if (size_bytes === 0) 3970 return out; 3971 3972 for (i = 0; i < size_bytes; i++) { 3973 var next_byte = br.readBits(8); 3974 if (i + 1 === size_bytes && size_bytes > 1 && next_byte === 0) 3975 throw new Error('Invalid size byte'); 3976 3977 out.meta_block_length |= next_byte << (i * 8); 3978 } 3979 } else { 3980 for (i = 0; i < size_nibbles; ++i) { 3981 var next_nibble = br.readBits(4); 3982 if (i + 1 === size_nibbles && size_nibbles > 4 && next_nibble === 0) 3983 throw new Error('Invalid size nibble'); 3984 3985 out.meta_block_length |= next_nibble << (i * 4); 3986 } 3987 } 3988 3989 ++out.meta_block_length; 3990 3991 if (!out.input_end && !out.is_metadata) { 3992 out.is_uncompressed = br.readBits(1); 3993 } 3994 3995 return out; 3996 } 3997 3998 /* Decodes the next Huffman code from bit-stream. */ 3999 function ReadSymbol(table, index, br) { 4000 var start_index = index; 4001 4002 var nbits; 4003 br.fillBitWindow(); 4004 index += (br.val_ >>> br.bit_pos_) & HUFFMAN_TABLE_MASK; 4005 nbits = table[index].bits - HUFFMAN_TABLE_BITS; 4006 if (nbits > 0) { 4007 br.bit_pos_ += HUFFMAN_TABLE_BITS; 4008 index += table[index].value; 4009 index += (br.val_ >>> br.bit_pos_) & ((1 << nbits) - 1); 4010 } 4011 br.bit_pos_ += table[index].bits; 4012 return table[index].value; 4013 } 4014 4015 function ReadHuffmanCodeLengths(code_length_code_lengths, num_symbols, code_lengths, br) { 4016 var symbol = 0; 4017 var prev_code_len = kDefaultCodeLength; 4018 var repeat = 0; 4019 var repeat_code_len = 0; 4020 var space = 32768; 4021 4022 var table = []; 4023 for (var i = 0; i < 32; i++) 4024 table.push(new HuffmanCode(0, 0)); 4025 4026 BrotliBuildHuffmanTable(table, 0, 5, code_length_code_lengths, CODE_LENGTH_CODES); 4027 4028 while (symbol < num_symbols && space > 0) { 4029 var p = 0; 4030 var code_len; 4031 4032 br.readMoreInput(); 4033 br.fillBitWindow(); 4034 p += (br.val_ >>> br.bit_pos_) & 31; 4035 br.bit_pos_ += table[p].bits; 4036 code_len = table[p].value & 0xff; 4037 if (code_len < kCodeLengthRepeatCode) { 4038 repeat = 0; 4039 code_lengths[symbol++] = code_len; 4040 if (code_len !== 0) { 4041 prev_code_len = code_len; 4042 space -= 32768 >> code_len; 4043 } 4044 } else { 4045 var extra_bits = code_len - 14; 4046 var old_repeat; 4047 var repeat_delta; 4048 var new_len = 0; 4049 if (code_len === kCodeLengthRepeatCode) { 4050 new_len = prev_code_len; 4051 } 4052 if (repeat_code_len !== new_len) { 4053 repeat = 0; 4054 repeat_code_len = new_len; 4055 } 4056 old_repeat = repeat; 4057 if (repeat > 0) { 4058 repeat -= 2; 4059 repeat <<= extra_bits; 4060 } 4061 repeat += br.readBits(extra_bits) + 3; 4062 repeat_delta = repeat - old_repeat; 4063 if (symbol + repeat_delta > num_symbols) { 4064 throw new Error('[ReadHuffmanCodeLengths] symbol + repeat_delta > num_symbols'); 4065 } 4066 4067 for (var x = 0; x < repeat_delta; x++) 4068 code_lengths[symbol + x] = repeat_code_len; 4069 4070 symbol += repeat_delta; 4071 4072 if (repeat_code_len !== 0) { 4073 space -= repeat_delta << (15 - repeat_code_len); 4074 } 4075 } 4076 } 4077 if (space !== 0) { 4078 throw new Error("[ReadHuffmanCodeLengths] space = " + space); 4079 } 4080 4081 for (; symbol < num_symbols; symbol++) 4082 code_lengths[symbol] = 0; 4083 } 4084 4085 function ReadHuffmanCode(alphabet_size, tables, table, br) { 4086 var table_size = 0; 4087 var simple_code_or_skip; 4088 var code_lengths = new Uint8Array(alphabet_size); 4089 4090 br.readMoreInput(); 4091 4092 /* simple_code_or_skip is used as follows: 4093 1 for simple code; 4094 0 for no skipping, 2 skips 2 code lengths, 3 skips 3 code lengths */ 4095 simple_code_or_skip = br.readBits(2); 4096 if (simple_code_or_skip === 1) { 4097 /* Read symbols, codes & code lengths directly. */ 4098 var i; 4099 var max_bits_counter = alphabet_size - 1; 4100 var max_bits = 0; 4101 var symbols = new Int32Array(4); 4102 var num_symbols = br.readBits(2) + 1; 4103 while (max_bits_counter) { 4104 max_bits_counter >>= 1; 4105 ++max_bits; 4106 } 4107 4108 for (i = 0; i < num_symbols; ++i) { 4109 symbols[i] = br.readBits(max_bits) % alphabet_size; 4110 code_lengths[symbols[i]] = 2; 4111 } 4112 code_lengths[symbols[0]] = 1; 4113 switch (num_symbols) { 4114 case 1: 4115 break; 4116 case 3: 4117 if ((symbols[0] === symbols[1]) || 4118 (symbols[0] === symbols[2]) || 4119 (symbols[1] === symbols[2])) { 4120 throw new Error('[ReadHuffmanCode] invalid symbols'); 4121 } 4122 break; 4123 case 2: 4124 if (symbols[0] === symbols[1]) { 4125 throw new Error('[ReadHuffmanCode] invalid symbols'); 4126 } 4127 4128 code_lengths[symbols[1]] = 1; 4129 break; 4130 case 4: 4131 if ((symbols[0] === symbols[1]) || 4132 (symbols[0] === symbols[2]) || 4133 (symbols[0] === symbols[3]) || 4134 (symbols[1] === symbols[2]) || 4135 (symbols[1] === symbols[3]) || 4136 (symbols[2] === symbols[3])) { 4137 throw new Error('[ReadHuffmanCode] invalid symbols'); 4138 } 4139 4140 if (br.readBits(1)) { 4141 code_lengths[symbols[2]] = 3; 4142 code_lengths[symbols[3]] = 3; 4143 } else { 4144 code_lengths[symbols[0]] = 2; 4145 } 4146 break; 4147 } 4148 } else { /* Decode Huffman-coded code lengths. */ 4149 var i; 4150 var code_length_code_lengths = new Uint8Array(CODE_LENGTH_CODES); 4151 var space = 32; 4152 var num_codes = 0; 4153 /* Static Huffman code for the code length code lengths */ 4154 var huff = [ 4155 new HuffmanCode(2, 0), new HuffmanCode(2, 4), new HuffmanCode(2, 3), new HuffmanCode(3, 2), 4156 new HuffmanCode(2, 0), new HuffmanCode(2, 4), new HuffmanCode(2, 3), new HuffmanCode(4, 1), 4157 new HuffmanCode(2, 0), new HuffmanCode(2, 4), new HuffmanCode(2, 3), new HuffmanCode(3, 2), 4158 new HuffmanCode(2, 0), new HuffmanCode(2, 4), new HuffmanCode(2, 3), new HuffmanCode(4, 5) 4159 ]; 4160 for (i = simple_code_or_skip; i < CODE_LENGTH_CODES && space > 0; ++i) { 4161 var code_len_idx = kCodeLengthCodeOrder[i]; 4162 var p = 0; 4163 var v; 4164 br.fillBitWindow(); 4165 p += (br.val_ >>> br.bit_pos_) & 15; 4166 br.bit_pos_ += huff[p].bits; 4167 v = huff[p].value; 4168 code_length_code_lengths[code_len_idx] = v; 4169 if (v !== 0) { 4170 space -= (32 >> v); 4171 ++num_codes; 4172 } 4173 } 4174 4175 if (!(num_codes === 1 || space === 0)) 4176 throw new Error('[ReadHuffmanCode] invalid num_codes or space'); 4177 4178 ReadHuffmanCodeLengths(code_length_code_lengths, alphabet_size, code_lengths, br); 4179 } 4180 4181 table_size = BrotliBuildHuffmanTable(tables, table, HUFFMAN_TABLE_BITS, code_lengths, alphabet_size); 4182 4183 if (table_size === 0) { 4184 throw new Error("[ReadHuffmanCode] BuildHuffmanTable failed: "); 4185 } 4186 4187 return table_size; 4188 } 4189 4190 function ReadBlockLength(table, index, br) { 4191 var code; 4192 var nbits; 4193 code = ReadSymbol(table, index, br); 4194 nbits = Prefix.kBlockLengthPrefixCode[code].nbits; 4195 return Prefix.kBlockLengthPrefixCode[code].offset + br.readBits(nbits); 4196 } 4197 4198 function TranslateShortCodes(code, ringbuffer, index) { 4199 var val; 4200 if (code < NUM_DISTANCE_SHORT_CODES) { 4201 index += kDistanceShortCodeIndexOffset[code]; 4202 index &= 3; 4203 val = ringbuffer[index] + kDistanceShortCodeValueOffset[code]; 4204 } else { 4205 val = code - NUM_DISTANCE_SHORT_CODES + 1; 4206 } 4207 return val; 4208 } 4209 4210 function MoveToFront(v, index) { 4211 var value = v[index]; 4212 var i = index; 4213 for (; i; --i) v[i] = v[i - 1]; 4214 v[0] = value; 4215 } 4216 4217 function InverseMoveToFrontTransform(v, v_len) { 4218 var mtf = new Uint8Array(256); 4219 var i; 4220 for (i = 0; i < 256; ++i) { 4221 mtf[i] = i; 4222 } 4223 for (i = 0; i < v_len; ++i) { 4224 var index = v[i]; 4225 v[i] = mtf[index]; 4226 if (index) MoveToFront(mtf, index); 4227 } 4228 } 4229 4230 /* Contains a collection of huffman trees with the same alphabet size. */ 4231 function HuffmanTreeGroup(alphabet_size, num_htrees) { 4232 this.alphabet_size = alphabet_size; 4233 this.num_htrees = num_htrees; 4234 this.codes = new Array(num_htrees + num_htrees * kMaxHuffmanTableSize[(alphabet_size + 31) >>> 5]); 4235 this.htrees = new Uint32Array(num_htrees); 4236 } 4237 4238 HuffmanTreeGroup.prototype.decode = function(br) { 4239 var i; 4240 var table_size; 4241 var next = 0; 4242 for (i = 0; i < this.num_htrees; ++i) { 4243 this.htrees[i] = next; 4244 table_size = ReadHuffmanCode(this.alphabet_size, this.codes, next, br); 4245 next += table_size; 4246 } 4247 }; 4248 4249 function DecodeContextMap(context_map_size, br) { 4250 var out = { num_htrees: null, context_map: null }; 4251 var use_rle_for_zeros; 4252 var max_run_length_prefix = 0; 4253 var table; 4254 var i; 4255 4256 br.readMoreInput(); 4257 var num_htrees = out.num_htrees = DecodeVarLenUint8(br) + 1; 4258 4259 var context_map = out.context_map = new Uint8Array(context_map_size); 4260 if (num_htrees <= 1) { 4261 return out; 4262 } 4263 4264 use_rle_for_zeros = br.readBits(1); 4265 if (use_rle_for_zeros) { 4266 max_run_length_prefix = br.readBits(4) + 1; 4267 } 4268 4269 table = []; 4270 for (i = 0; i < HUFFMAN_MAX_TABLE_SIZE; i++) { 4271 table[i] = new HuffmanCode(0, 0); 4272 } 4273 4274 ReadHuffmanCode(num_htrees + max_run_length_prefix, table, 0, br); 4275 4276 for (i = 0; i < context_map_size;) { 4277 var code; 4278 4279 br.readMoreInput(); 4280 code = ReadSymbol(table, 0, br); 4281 if (code === 0) { 4282 context_map[i] = 0; 4283 ++i; 4284 } else if (code <= max_run_length_prefix) { 4285 var reps = 1 + (1 << code) + br.readBits(code); 4286 while (--reps) { 4287 if (i >= context_map_size) { 4288 throw new Error("[DecodeContextMap] i >= context_map_size"); 4289 } 4290 context_map[i] = 0; 4291 ++i; 4292 } 4293 } else { 4294 context_map[i] = code - max_run_length_prefix; 4295 ++i; 4296 } 4297 } 4298 if (br.readBits(1)) { 4299 InverseMoveToFrontTransform(context_map, context_map_size); 4300 } 4301 4302 return out; 4303 } 4304 4305 function DecodeBlockType(max_block_type, trees, tree_type, block_types, ringbuffers, indexes, br) { 4306 var ringbuffer = tree_type * 2; 4307 var index = tree_type; 4308 var type_code = ReadSymbol(trees, tree_type * HUFFMAN_MAX_TABLE_SIZE, br); 4309 var block_type; 4310 if (type_code === 0) { 4311 block_type = ringbuffers[ringbuffer + (indexes[index] & 1)]; 4312 } else if (type_code === 1) { 4313 block_type = ringbuffers[ringbuffer + ((indexes[index] - 1) & 1)] + 1; 4314 } else { 4315 block_type = type_code - 2; 4316 } 4317 if (block_type >= max_block_type) { 4318 block_type -= max_block_type; 4319 } 4320 block_types[tree_type] = block_type; 4321 ringbuffers[ringbuffer + (indexes[index] & 1)] = block_type; 4322 ++indexes[index]; 4323 } 4324 4325 function CopyUncompressedBlockToOutput(output, len, pos, ringbuffer, ringbuffer_mask, br) { 4326 var rb_size = ringbuffer_mask + 1; 4327 var rb_pos = pos & ringbuffer_mask; 4328 var br_pos = br.pos_ & BrotliBitReader.IBUF_MASK; 4329 var nbytes; 4330 4331 /* For short lengths copy byte-by-byte */ 4332 if (len < 8 || br.bit_pos_ + (len << 3) < br.bit_end_pos_) { 4333 while (len-- > 0) { 4334 br.readMoreInput(); 4335 ringbuffer[rb_pos++] = br.readBits(8); 4336 if (rb_pos === rb_size) { 4337 output.write(ringbuffer, rb_size); 4338 rb_pos = 0; 4339 } 4340 } 4341 return; 4342 } 4343 4344 if (br.bit_end_pos_ < 32) { 4345 throw new Error('[CopyUncompressedBlockToOutput] br.bit_end_pos_ < 32'); 4346 } 4347 4348 /* Copy remaining 0-4 bytes from br.val_ to ringbuffer. */ 4349 while (br.bit_pos_ < 32) { 4350 ringbuffer[rb_pos] = (br.val_ >>> br.bit_pos_); 4351 br.bit_pos_ += 8; 4352 ++rb_pos; 4353 --len; 4354 } 4355 4356 /* Copy remaining bytes from br.buf_ to ringbuffer. */ 4357 nbytes = (br.bit_end_pos_ - br.bit_pos_) >> 3; 4358 if (br_pos + nbytes > BrotliBitReader.IBUF_MASK) { 4359 var tail = BrotliBitReader.IBUF_MASK + 1 - br_pos; 4360 for (var x = 0; x < tail; x++) 4361 ringbuffer[rb_pos + x] = br.buf_[br_pos + x]; 4362 4363 nbytes -= tail; 4364 rb_pos += tail; 4365 len -= tail; 4366 br_pos = 0; 4367 } 4368 4369 for (var x = 0; x < nbytes; x++) 4370 ringbuffer[rb_pos + x] = br.buf_[br_pos + x]; 4371 4372 rb_pos += nbytes; 4373 len -= nbytes; 4374 4375 /* If we wrote past the logical end of the ringbuffer, copy the tail of the 4376 ringbuffer to its beginning and flush the ringbuffer to the output. */ 4377 if (rb_pos >= rb_size) { 4378 output.write(ringbuffer, rb_size); 4379 rb_pos -= rb_size; 4380 for (var x = 0; x < rb_pos; x++) 4381 ringbuffer[x] = ringbuffer[rb_size + x]; 4382 } 4383 4384 /* If we have more to copy than the remaining size of the ringbuffer, then we 4385 first fill the ringbuffer from the input and then flush the ringbuffer to 4386 the output */ 4387 while (rb_pos + len >= rb_size) { 4388 nbytes = rb_size - rb_pos; 4389 if (br.input_.read(ringbuffer, rb_pos, nbytes) < nbytes) { 4390 throw new Error('[CopyUncompressedBlockToOutput] not enough bytes'); 4391 } 4392 output.write(ringbuffer, rb_size); 4393 len -= nbytes; 4394 rb_pos = 0; 4395 } 4396 4397 /* Copy straight from the input onto the ringbuffer. The ringbuffer will be 4398 flushed to the output at a later time. */ 4399 if (br.input_.read(ringbuffer, rb_pos, len) < len) { 4400 throw new Error('[CopyUncompressedBlockToOutput] not enough bytes'); 4401 } 4402 4403 /* Restore the state of the bit reader. */ 4404 br.reset(); 4405 } 4406 4407 /* Advances the bit reader position to the next byte boundary and verifies 4408 that any skipped bits are set to zero. */ 4409 function JumpToByteBoundary(br) { 4410 var new_bit_pos = (br.bit_pos_ + 7) & ~7; 4411 var pad_bits = br.readBits(new_bit_pos - br.bit_pos_); 4412 return pad_bits == 0; 4413 } 4414 4415 function BrotliDecompressedSize(buffer) { 4416 var input = new BrotliInput(buffer); 4417 var br = new BrotliBitReader(input); 4418 DecodeWindowBits(br); 4419 var out = DecodeMetaBlockLength(br); 4420 return out.meta_block_length; 4421 } 4422 4423 exports.BrotliDecompressedSize = BrotliDecompressedSize; 4424 4425 function BrotliDecompressBuffer(buffer, output_size) { 4426 var input = new BrotliInput(buffer); 4427 4428 if (output_size == null) { 4429 output_size = BrotliDecompressedSize(buffer); 4430 } 4431 4432 var output_buffer = new Uint8Array(output_size); 4433 var output = new BrotliOutput(output_buffer); 4434 4435 BrotliDecompress(input, output); 4436 4437 if (output.pos < output.buffer.length) { 4438 output.buffer = output.buffer.subarray(0, output.pos); 4439 } 4440 4441 return output.buffer; 4442 } 4443 4444 exports.BrotliDecompressBuffer = BrotliDecompressBuffer; 4445 4446 function BrotliDecompress(input, output) { 4447 var i; 4448 var pos = 0; 4449 var input_end = 0; 4450 var window_bits = 0; 4451 var max_backward_distance; 4452 var max_distance = 0; 4453 var ringbuffer_size; 4454 var ringbuffer_mask; 4455 var ringbuffer; 4456 var ringbuffer_end; 4457 /* This ring buffer holds a few past copy distances that will be used by */ 4458 /* some special distance codes. */ 4459 var dist_rb = [ 16, 15, 11, 4 ]; 4460 var dist_rb_idx = 0; 4461 /* The previous 2 bytes used for context. */ 4462 var prev_byte1 = 0; 4463 var prev_byte2 = 0; 4464 var hgroup = [new HuffmanTreeGroup(0, 0), new HuffmanTreeGroup(0, 0), new HuffmanTreeGroup(0, 0)]; 4465 var block_type_trees; 4466 var block_len_trees; 4467 var br; 4468 4469 /* We need the slack region for the following reasons: 4470 - always doing two 8-byte copies for fast backward copying 4471 - transforms 4472 - flushing the input ringbuffer when decoding uncompressed blocks */ 4473 var kRingBufferWriteAheadSlack = 128 + BrotliBitReader.READ_SIZE; 4474 4475 br = new BrotliBitReader(input); 4476 4477 /* Decode window size. */ 4478 window_bits = DecodeWindowBits(br); 4479 max_backward_distance = (1 << window_bits) - 16; 4480 4481 ringbuffer_size = 1 << window_bits; 4482 ringbuffer_mask = ringbuffer_size - 1; 4483 ringbuffer = new Uint8Array(ringbuffer_size + kRingBufferWriteAheadSlack + BrotliDictionary.maxDictionaryWordLength); 4484 ringbuffer_end = ringbuffer_size; 4485 4486 block_type_trees = []; 4487 block_len_trees = []; 4488 for (var x = 0; x < 3 * HUFFMAN_MAX_TABLE_SIZE; x++) { 4489 block_type_trees[x] = new HuffmanCode(0, 0); 4490 block_len_trees[x] = new HuffmanCode(0, 0); 4491 } 4492 4493 while (!input_end) { 4494 var meta_block_remaining_len = 0; 4495 var is_uncompressed; 4496 var block_length = [ 1 << 28, 1 << 28, 1 << 28 ]; 4497 var block_type = [ 0 ]; 4498 var num_block_types = [ 1, 1, 1 ]; 4499 var block_type_rb = [ 0, 1, 0, 1, 0, 1 ]; 4500 var block_type_rb_index = [ 0 ]; 4501 var distance_postfix_bits; 4502 var num_direct_distance_codes; 4503 var distance_postfix_mask; 4504 var num_distance_codes; 4505 var context_map = null; 4506 var context_modes = null; 4507 var num_literal_htrees; 4508 var dist_context_map = null; 4509 var num_dist_htrees; 4510 var context_offset = 0; 4511 var context_map_slice = null; 4512 var literal_htree_index = 0; 4513 var dist_context_offset = 0; 4514 var dist_context_map_slice = null; 4515 var dist_htree_index = 0; 4516 var context_lookup_offset1 = 0; 4517 var context_lookup_offset2 = 0; 4518 var context_mode; 4519 var htree_command; 4520 4521 for (i = 0; i < 3; ++i) { 4522 hgroup[i].codes = null; 4523 hgroup[i].htrees = null; 4524 } 4525 4526 br.readMoreInput(); 4527 4528 var _out = DecodeMetaBlockLength(br); 4529 meta_block_remaining_len = _out.meta_block_length; 4530 if (pos + meta_block_remaining_len > output.buffer.length) { 4531 /* We need to grow the output buffer to fit the additional data. */ 4532 var tmp = new Uint8Array( pos + meta_block_remaining_len ); 4533 tmp.set( output.buffer ); 4534 output.buffer = tmp; 4535 } 4536 input_end = _out.input_end; 4537 is_uncompressed = _out.is_uncompressed; 4538 4539 if (_out.is_metadata) { 4540 JumpToByteBoundary(br); 4541 4542 for (; meta_block_remaining_len > 0; --meta_block_remaining_len) { 4543 br.readMoreInput(); 4544 /* Read one byte and ignore it. */ 4545 br.readBits(8); 4546 } 4547 4548 continue; 4549 } 4550 4551 if (meta_block_remaining_len === 0) { 4552 continue; 4553 } 4554 4555 if (is_uncompressed) { 4556 br.bit_pos_ = (br.bit_pos_ + 7) & ~7; 4557 CopyUncompressedBlockToOutput(output, meta_block_remaining_len, pos, 4558 ringbuffer, ringbuffer_mask, br); 4559 pos += meta_block_remaining_len; 4560 continue; 4561 } 4562 4563 for (i = 0; i < 3; ++i) { 4564 num_block_types[i] = DecodeVarLenUint8(br) + 1; 4565 if (num_block_types[i] >= 2) { 4566 ReadHuffmanCode(num_block_types[i] + 2, block_type_trees, i * HUFFMAN_MAX_TABLE_SIZE, br); 4567 ReadHuffmanCode(kNumBlockLengthCodes, block_len_trees, i * HUFFMAN_MAX_TABLE_SIZE, br); 4568 block_length[i] = ReadBlockLength(block_len_trees, i * HUFFMAN_MAX_TABLE_SIZE, br); 4569 block_type_rb_index[i] = 1; 4570 } 4571 } 4572 4573 br.readMoreInput(); 4574 4575 distance_postfix_bits = br.readBits(2); 4576 num_direct_distance_codes = NUM_DISTANCE_SHORT_CODES + (br.readBits(4) << distance_postfix_bits); 4577 distance_postfix_mask = (1 << distance_postfix_bits) - 1; 4578 num_distance_codes = (num_direct_distance_codes + (48 << distance_postfix_bits)); 4579 context_modes = new Uint8Array(num_block_types[0]); 4580 4581 for (i = 0; i < num_block_types[0]; ++i) { 4582 br.readMoreInput(); 4583 context_modes[i] = (br.readBits(2) << 1); 4584 } 4585 4586 var _o1 = DecodeContextMap(num_block_types[0] << kLiteralContextBits, br); 4587 num_literal_htrees = _o1.num_htrees; 4588 context_map = _o1.context_map; 4589 4590 var _o2 = DecodeContextMap(num_block_types[2] << kDistanceContextBits, br); 4591 num_dist_htrees = _o2.num_htrees; 4592 dist_context_map = _o2.context_map; 4593 4594 hgroup[0] = new HuffmanTreeGroup(kNumLiteralCodes, num_literal_htrees); 4595 hgroup[1] = new HuffmanTreeGroup(kNumInsertAndCopyCodes, num_block_types[1]); 4596 hgroup[2] = new HuffmanTreeGroup(num_distance_codes, num_dist_htrees); 4597 4598 for (i = 0; i < 3; ++i) { 4599 hgroup[i].decode(br); 4600 } 4601 4602 context_map_slice = 0; 4603 dist_context_map_slice = 0; 4604 context_mode = context_modes[block_type[0]]; 4605 context_lookup_offset1 = Context.lookupOffsets[context_mode]; 4606 context_lookup_offset2 = Context.lookupOffsets[context_mode + 1]; 4607 htree_command = hgroup[1].htrees[0]; 4608 4609 while (meta_block_remaining_len > 0) { 4610 var cmd_code; 4611 var range_idx; 4612 var insert_code; 4613 var copy_code; 4614 var insert_length; 4615 var copy_length; 4616 var distance_code; 4617 var distance; 4618 var context; 4619 var j; 4620 var copy_dst; 4621 4622 br.readMoreInput(); 4623 4624 if (block_length[1] === 0) { 4625 DecodeBlockType(num_block_types[1], 4626 block_type_trees, 1, block_type, block_type_rb, 4627 block_type_rb_index, br); 4628 block_length[1] = ReadBlockLength(block_len_trees, HUFFMAN_MAX_TABLE_SIZE, br); 4629 htree_command = hgroup[1].htrees[block_type[1]]; 4630 } 4631 --block_length[1]; 4632 cmd_code = ReadSymbol(hgroup[1].codes, htree_command, br); 4633 range_idx = cmd_code >> 6; 4634 if (range_idx >= 2) { 4635 range_idx -= 2; 4636 distance_code = -1; 4637 } else { 4638 distance_code = 0; 4639 } 4640 insert_code = Prefix.kInsertRangeLut[range_idx] + ((cmd_code >> 3) & 7); 4641 copy_code = Prefix.kCopyRangeLut[range_idx] + (cmd_code & 7); 4642 insert_length = Prefix.kInsertLengthPrefixCode[insert_code].offset + 4643 br.readBits(Prefix.kInsertLengthPrefixCode[insert_code].nbits); 4644 copy_length = Prefix.kCopyLengthPrefixCode[copy_code].offset + 4645 br.readBits(Prefix.kCopyLengthPrefixCode[copy_code].nbits); 4646 prev_byte1 = ringbuffer[pos-1 & ringbuffer_mask]; 4647 prev_byte2 = ringbuffer[pos-2 & ringbuffer_mask]; 4648 for (j = 0; j < insert_length; ++j) { 4649 br.readMoreInput(); 4650 4651 if (block_length[0] === 0) { 4652 DecodeBlockType(num_block_types[0], 4653 block_type_trees, 0, block_type, block_type_rb, 4654 block_type_rb_index, br); 4655 block_length[0] = ReadBlockLength(block_len_trees, 0, br); 4656 context_offset = block_type[0] << kLiteralContextBits; 4657 context_map_slice = context_offset; 4658 context_mode = context_modes[block_type[0]]; 4659 context_lookup_offset1 = Context.lookupOffsets[context_mode]; 4660 context_lookup_offset2 = Context.lookupOffsets[context_mode + 1]; 4661 } 4662 context = (Context.lookup[context_lookup_offset1 + prev_byte1] | 4663 Context.lookup[context_lookup_offset2 + prev_byte2]); 4664 literal_htree_index = context_map[context_map_slice + context]; 4665 --block_length[0]; 4666 prev_byte2 = prev_byte1; 4667 prev_byte1 = ReadSymbol(hgroup[0].codes, hgroup[0].htrees[literal_htree_index], br); 4668 ringbuffer[pos & ringbuffer_mask] = prev_byte1; 4669 if ((pos & ringbuffer_mask) === ringbuffer_mask) { 4670 output.write(ringbuffer, ringbuffer_size); 4671 } 4672 ++pos; 4673 } 4674 meta_block_remaining_len -= insert_length; 4675 if (meta_block_remaining_len <= 0) break; 4676 4677 if (distance_code < 0) { 4678 var context; 4679 4680 br.readMoreInput(); 4681 if (block_length[2] === 0) { 4682 DecodeBlockType(num_block_types[2], 4683 block_type_trees, 2, block_type, block_type_rb, 4684 block_type_rb_index, br); 4685 block_length[2] = ReadBlockLength(block_len_trees, 2 * HUFFMAN_MAX_TABLE_SIZE, br); 4686 dist_context_offset = block_type[2] << kDistanceContextBits; 4687 dist_context_map_slice = dist_context_offset; 4688 } 4689 --block_length[2]; 4690 context = (copy_length > 4 ? 3 : copy_length - 2) & 0xff; 4691 dist_htree_index = dist_context_map[dist_context_map_slice + context]; 4692 distance_code = ReadSymbol(hgroup[2].codes, hgroup[2].htrees[dist_htree_index], br); 4693 if (distance_code >= num_direct_distance_codes) { 4694 var nbits; 4695 var postfix; 4696 var offset; 4697 distance_code -= num_direct_distance_codes; 4698 postfix = distance_code & distance_postfix_mask; 4699 distance_code >>= distance_postfix_bits; 4700 nbits = (distance_code >> 1) + 1; 4701 offset = ((2 + (distance_code & 1)) << nbits) - 4; 4702 distance_code = num_direct_distance_codes + 4703 ((offset + br.readBits(nbits)) << 4704 distance_postfix_bits) + postfix; 4705 } 4706 } 4707 4708 /* Convert the distance code to the actual distance by possibly looking */ 4709 /* up past distnaces from the ringbuffer. */ 4710 distance = TranslateShortCodes(distance_code, dist_rb, dist_rb_idx); 4711 if (distance < 0) { 4712 throw new Error('[BrotliDecompress] invalid distance'); 4713 } 4714 4715 if (pos < max_backward_distance && 4716 max_distance !== max_backward_distance) { 4717 max_distance = pos; 4718 } else { 4719 max_distance = max_backward_distance; 4720 } 4721 4722 copy_dst = pos & ringbuffer_mask; 4723 4724 if (distance > max_distance) { 4725 if (copy_length >= BrotliDictionary.minDictionaryWordLength && 4726 copy_length <= BrotliDictionary.maxDictionaryWordLength) { 4727 var offset = BrotliDictionary.offsetsByLength[copy_length]; 4728 var word_id = distance - max_distance - 1; 4729 var shift = BrotliDictionary.sizeBitsByLength[copy_length]; 4730 var mask = (1 << shift) - 1; 4731 var word_idx = word_id & mask; 4732 var transform_idx = word_id >> shift; 4733 offset += word_idx * copy_length; 4734 if (transform_idx < Transform.kNumTransforms) { 4735 var len = Transform.transformDictionaryWord(ringbuffer, copy_dst, offset, copy_length, transform_idx); 4736 copy_dst += len; 4737 pos += len; 4738 meta_block_remaining_len -= len; 4739 if (copy_dst >= ringbuffer_end) { 4740 output.write(ringbuffer, ringbuffer_size); 4741 4742 for (var _x = 0; _x < (copy_dst - ringbuffer_end); _x++) 4743 ringbuffer[_x] = ringbuffer[ringbuffer_end + _x]; 4744 } 4745 } else { 4746 throw new Error("Invalid backward reference. pos: " + pos + " distance: " + distance + 4747 " len: " + copy_length + " bytes left: " + meta_block_remaining_len); 4748 } 4749 } else { 4750 throw new Error("Invalid backward reference. pos: " + pos + " distance: " + distance + 4751 " len: " + copy_length + " bytes left: " + meta_block_remaining_len); 4752 } 4753 } else { 4754 if (distance_code > 0) { 4755 dist_rb[dist_rb_idx & 3] = distance; 4756 ++dist_rb_idx; 4757 } 4758 4759 if (copy_length > meta_block_remaining_len) { 4760 throw new Error("Invalid backward reference. pos: " + pos + " distance: " + distance + 4761 " len: " + copy_length + " bytes left: " + meta_block_remaining_len); 4762 } 4763 4764 for (j = 0; j < copy_length; ++j) { 4765 ringbuffer[pos & ringbuffer_mask] = ringbuffer[(pos - distance) & ringbuffer_mask]; 4766 if ((pos & ringbuffer_mask) === ringbuffer_mask) { 4767 output.write(ringbuffer, ringbuffer_size); 4768 } 4769 ++pos; 4770 --meta_block_remaining_len; 4771 } 4772 } 4773 4774 /* When we get here, we must have inserted at least one literal and */ 4775 /* made a copy of at least length two, therefore accessing the last 2 */ 4776 /* bytes is valid. */ 4777 prev_byte1 = ringbuffer[(pos - 1) & ringbuffer_mask]; 4778 prev_byte2 = ringbuffer[(pos - 2) & ringbuffer_mask]; 4779 } 4780 4781 /* Protect pos from overflow, wrap it around at every GB of input data */ 4782 pos &= 0x3fffffff; 4783 } 4784 4785 output.write(ringbuffer, pos & ringbuffer_mask); 4786 } 4787 4788 exports.BrotliDecompress = BrotliDecompress; 4789 4790 BrotliDictionary.init(); 4791 4792 },{"./bit_reader":1,"./context":2,"./dictionary":6,"./huffman":7,"./prefix":9,"./streams":10,"./transform":11}],4:[function(require,module,exports){ 4793 var base64 = require('base64-js'); 4794 //var fs = require('fs'); 4795 4796 /** 4797 * The normal dictionary-data.js is quite large, which makes it 4798 * unsuitable for browser usage. In order to make it smaller, 4799 * we read dictionary.bin, which is a compressed version of 4800 * the dictionary, and on initial load, Brotli decompresses 4801 * it's own dictionary. 😜 4802 */ 4803 exports.init = function() { 4804 var BrotliDecompressBuffer = require('./decode').BrotliDecompressBuffer; 4805 var compressed = base64.toByteArray(require('./dictionary.bin.js')); 4806 return BrotliDecompressBuffer(compressed); 4807 }; 4808 4809 },{"./decode":3,"./dictionary.bin.js":5,"base64-js":8}],5:[function(require,module,exports){ 4810 module.exports="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"; 4811 4812 },{}],6:[function(require,module,exports){ 4813 /* Copyright 2013 Google Inc. All Rights Reserved. 4814 4815 Licensed under the Apache License, Version 2.0 (the "License"); 4816 you may not use this file except in compliance with the License. 4817 You may obtain a copy of the License at 4818 4819 http://www.apache.org/licenses/LICENSE-2.0 4820 4821 Unless required by applicable law or agreed to in writing, software 4822 distributed under the License is distributed on an "AS IS" BASIS, 4823 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4824 See the License for the specific language governing permissions and 4825 limitations under the License. 4826 4827 Collection of static dictionary words. 4828 */ 4829 4830 var data = require('./dictionary-browser'); 4831 exports.init = function() { 4832 exports.dictionary = data.init(); 4833 }; 4834 4835 exports.offsetsByLength = new Uint32Array([ 4836 0, 0, 0, 0, 0, 4096, 9216, 21504, 35840, 44032, 4837 53248, 63488, 74752, 87040, 93696, 100864, 104704, 106752, 108928, 113536, 4838 115968, 118528, 119872, 121280, 122016, 4839 ]); 4840 4841 exports.sizeBitsByLength = new Uint8Array([ 4842 0, 0, 0, 0, 10, 10, 11, 11, 10, 10, 4843 10, 10, 10, 9, 9, 8, 7, 7, 8, 7, 4844 7, 6, 6, 5, 5, 4845 ]); 4846 4847 exports.minDictionaryWordLength = 4; 4848 exports.maxDictionaryWordLength = 24; 4849 4850 },{"./dictionary-browser":4}],7:[function(require,module,exports){ 4851 function HuffmanCode(bits, value) { 4852 this.bits = bits; /* number of bits used for this symbol */ 4853 this.value = value; /* symbol value or table offset */ 4854 } 4855 4856 exports.HuffmanCode = HuffmanCode; 4857 4858 var MAX_LENGTH = 15; 4859 4860 /* Returns reverse(reverse(key, len) + 1, len), where reverse(key, len) is the 4861 bit-wise reversal of the len least significant bits of key. */ 4862 function GetNextKey(key, len) { 4863 var step = 1 << (len - 1); 4864 while (key & step) { 4865 step >>= 1; 4866 } 4867 return (key & (step - 1)) + step; 4868 } 4869 4870 /* Stores code in table[0], table[step], table[2*step], ..., table[end] */ 4871 /* Assumes that end is an integer multiple of step */ 4872 function ReplicateValue(table, i, step, end, code) { 4873 do { 4874 end -= step; 4875 table[i + end] = new HuffmanCode(code.bits, code.value); 4876 } while (end > 0); 4877 } 4878 4879 /* Returns the table width of the next 2nd level table. count is the histogram 4880 of bit lengths for the remaining symbols, len is the code length of the next 4881 processed symbol */ 4882 function NextTableBitSize(count, len, root_bits) { 4883 var left = 1 << (len - root_bits); 4884 while (len < MAX_LENGTH) { 4885 left -= count[len]; 4886 if (left <= 0) break; 4887 ++len; 4888 left <<= 1; 4889 } 4890 return len - root_bits; 4891 } 4892 4893 exports.BrotliBuildHuffmanTable = function(root_table, table, root_bits, code_lengths, code_lengths_size) { 4894 var start_table = table; 4895 var code; /* current table entry */ 4896 var len; /* current code length */ 4897 var symbol; /* symbol index in original or sorted table */ 4898 var key; /* reversed prefix code */ 4899 var step; /* step size to replicate values in current table */ 4900 var low; /* low bits for current root entry */ 4901 var mask; /* mask for low bits */ 4902 var table_bits; /* key length of current table */ 4903 var table_size; /* size of current table */ 4904 var total_size; /* sum of root table size and 2nd level table sizes */ 4905 var sorted; /* symbols sorted by code length */ 4906 var count = new Int32Array(MAX_LENGTH + 1); /* number of codes of each length */ 4907 var offset = new Int32Array(MAX_LENGTH + 1); /* offsets in sorted table for each length */ 4908 4909 sorted = new Int32Array(code_lengths_size); 4910 4911 /* build histogram of code lengths */ 4912 for (symbol = 0; symbol < code_lengths_size; symbol++) { 4913 count[code_lengths[symbol]]++; 4914 } 4915 4916 /* generate offsets into sorted symbol table by code length */ 4917 offset[1] = 0; 4918 for (len = 1; len < MAX_LENGTH; len++) { 4919 offset[len + 1] = offset[len] + count[len]; 4920 } 4921 4922 /* sort symbols by length, by symbol order within each length */ 4923 for (symbol = 0; symbol < code_lengths_size; symbol++) { 4924 if (code_lengths[symbol] !== 0) { 4925 sorted[offset[code_lengths[symbol]]++] = symbol; 4926 } 4927 } 4928 4929 table_bits = root_bits; 4930 table_size = 1 << table_bits; 4931 total_size = table_size; 4932 4933 /* special case code with only one value */ 4934 if (offset[MAX_LENGTH] === 1) { 4935 for (key = 0; key < total_size; ++key) { 4936 root_table[table + key] = new HuffmanCode(0, sorted[0] & 0xffff); 4937 } 4938 4939 return total_size; 4940 } 4941 4942 /* fill in root table */ 4943 key = 0; 4944 symbol = 0; 4945 for (len = 1, step = 2; len <= root_bits; ++len, step <<= 1) { 4946 for (; count[len] > 0; --count[len]) { 4947 code = new HuffmanCode(len & 0xff, sorted[symbol++] & 0xffff); 4948 ReplicateValue(root_table, table + key, step, table_size, code); 4949 key = GetNextKey(key, len); 4950 } 4951 } 4952 4953 /* fill in 2nd level tables and add pointers to root table */ 4954 mask = total_size - 1; 4955 low = -1; 4956 for (len = root_bits + 1, step = 2; len <= MAX_LENGTH; ++len, step <<= 1) { 4957 for (; count[len] > 0; --count[len]) { 4958 if ((key & mask) !== low) { 4959 table += table_size; 4960 table_bits = NextTableBitSize(count, len, root_bits); 4961 table_size = 1 << table_bits; 4962 total_size += table_size; 4963 low = key & mask; 4964 root_table[start_table + low] = new HuffmanCode((table_bits + root_bits) & 0xff, ((table - start_table) - low) & 0xffff); 4965 } 4966 code = new HuffmanCode((len - root_bits) & 0xff, sorted[symbol++] & 0xffff); 4967 ReplicateValue(root_table, table + (key >> root_bits), step, table_size, code); 4968 key = GetNextKey(key, len); 4969 } 4970 } 4971 4972 return total_size; 4973 } 4974 4975 },{}],8:[function(require,module,exports){ 4976 'use strict' 4977 4978 exports.byteLength = byteLength 4979 exports.toByteArray = toByteArray 4980 exports.fromByteArray = fromByteArray 4981 4982 var lookup = [] 4983 var revLookup = [] 4984 var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array 4985 4986 var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' 4987 for (var i = 0, len = code.length; i < len; ++i) { 4988 lookup[i] = code[i] 4989 revLookup[code.charCodeAt(i)] = i 4990 } 4991 4992 // Support decoding URL-safe base64 strings, as Node.js does. 4993 // See: https://en.wikipedia.org/wiki/Base64#URL_applications 4994 revLookup['-'.charCodeAt(0)] = 62 4995 revLookup['_'.charCodeAt(0)] = 63 4996 4997 function getLens (b64) { 4998 var len = b64.length 4999 5000 if (len % 4 > 0) { 5001 throw new Error('Invalid string. Length must be a multiple of 4') 5002 } 5003 5004 // Trim off extra bytes after placeholder bytes are found 5005 // See: https://github.com/beatgammit/base64-js/issues/42 5006 var validLen = b64.indexOf('=') 5007 if (validLen === -1) validLen = len 5008 5009 var placeHoldersLen = validLen === len 5010 ? 0 5011 : 4 - (validLen % 4) 5012 5013 return [validLen, placeHoldersLen] 5014 } 5015 5016 // base64 is 4/3 + up to two characters of the original data 5017 function byteLength (b64) { 5018 var lens = getLens(b64) 5019 var validLen = lens[0] 5020 var placeHoldersLen = lens[1] 5021 return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen 5022 } 5023 5024 function _byteLength (b64, validLen, placeHoldersLen) { 5025 return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen 5026 } 5027 5028 function toByteArray (b64) { 5029 var tmp 5030 var lens = getLens(b64) 5031 var validLen = lens[0] 5032 var placeHoldersLen = lens[1] 5033 5034 var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) 5035 5036 var curByte = 0 5037 5038 // if there are placeholders, only get up to the last complete 4 chars 5039 var len = placeHoldersLen > 0 5040 ? validLen - 4 5041 : validLen 5042 5043 for (var i = 0; i < len; i += 4) { 5044 tmp = 5045 (revLookup[b64.charCodeAt(i)] << 18) | 5046 (revLookup[b64.charCodeAt(i + 1)] << 12) | 5047 (revLookup[b64.charCodeAt(i + 2)] << 6) | 5048 revLookup[b64.charCodeAt(i + 3)] 5049 arr[curByte++] = (tmp >> 16) & 0xFF 5050 arr[curByte++] = (tmp >> 8) & 0xFF 5051 arr[curByte++] = tmp & 0xFF 5052 } 5053 5054 if (placeHoldersLen === 2) { 5055 tmp = 5056 (revLookup[b64.charCodeAt(i)] << 2) | 5057 (revLookup[b64.charCodeAt(i + 1)] >> 4) 5058 arr[curByte++] = tmp & 0xFF 5059 } 5060 5061 if (placeHoldersLen === 1) { 5062 tmp = 5063 (revLookup[b64.charCodeAt(i)] << 10) | 5064 (revLookup[b64.charCodeAt(i + 1)] << 4) | 5065 (revLookup[b64.charCodeAt(i + 2)] >> 2) 5066 arr[curByte++] = (tmp >> 8) & 0xFF 5067 arr[curByte++] = tmp & 0xFF 5068 } 5069 5070 return arr 5071 } 5072 5073 function tripletToBase64 (num) { 5074 return lookup[num >> 18 & 0x3F] + 5075 lookup[num >> 12 & 0x3F] + 5076 lookup[num >> 6 & 0x3F] + 5077 lookup[num & 0x3F] 5078 } 5079 5080 function encodeChunk (uint8, start, end) { 5081 var tmp 5082 var output = [] 5083 for (var i = start; i < end; i += 3) { 5084 tmp = 5085 ((uint8[i] << 16) & 0xFF0000) + 5086 ((uint8[i + 1] << 8) & 0xFF00) + 5087 (uint8[i + 2] & 0xFF) 5088 output.push(tripletToBase64(tmp)) 5089 } 5090 return output.join('') 5091 } 5092 5093 function fromByteArray (uint8) { 5094 var tmp 5095 var len = uint8.length 5096 var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes 5097 var parts = [] 5098 var maxChunkLength = 16383 // must be multiple of 3 5099 5100 // go through the array every three bytes, we'll deal with trailing stuff later 5101 for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { 5102 parts.push(encodeChunk( 5103 uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength) 5104 )) 5105 } 5106 5107 // pad the end with zeros, but make sure to not forget the extra bytes 5108 if (extraBytes === 1) { 5109 tmp = uint8[len - 1] 5110 parts.push( 5111 lookup[tmp >> 2] + 5112 lookup[(tmp << 4) & 0x3F] + 5113 '==' 5114 ) 5115 } else if (extraBytes === 2) { 5116 tmp = (uint8[len - 2] << 8) + uint8[len - 1] 5117 parts.push( 5118 lookup[tmp >> 10] + 5119 lookup[(tmp >> 4) & 0x3F] + 5120 lookup[(tmp << 2) & 0x3F] + 5121 '=' 5122 ) 5123 } 5124 5125 return parts.join('') 5126 } 5127 5128 },{}],9:[function(require,module,exports){ 5129 /* Copyright 2013 Google Inc. All Rights Reserved. 5130 5131 Licensed under the Apache License, Version 2.0 (the "License"); 5132 you may not use this file except in compliance with the License. 5133 You may obtain a copy of the License at 5134 5135 http://www.apache.org/licenses/LICENSE-2.0 5136 5137 Unless required by applicable law or agreed to in writing, software 5138 distributed under the License is distributed on an "AS IS" BASIS, 5139 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5140 See the License for the specific language governing permissions and 5141 limitations under the License. 5142 5143 Lookup tables to map prefix codes to value ranges. This is used during 5144 decoding of the block lengths, literal insertion lengths and copy lengths. 5145 */ 5146 5147 /* Represents the range of values belonging to a prefix code: */ 5148 /* [offset, offset + 2^nbits) */ 5149 function PrefixCodeRange(offset, nbits) { 5150 this.offset = offset; 5151 this.nbits = nbits; 5152 } 5153 5154 exports.kBlockLengthPrefixCode = [ 5155 new PrefixCodeRange(1, 2), new PrefixCodeRange(5, 2), new PrefixCodeRange(9, 2), new PrefixCodeRange(13, 2), 5156 new PrefixCodeRange(17, 3), new PrefixCodeRange(25, 3), new PrefixCodeRange(33, 3), new PrefixCodeRange(41, 3), 5157 new PrefixCodeRange(49, 4), new PrefixCodeRange(65, 4), new PrefixCodeRange(81, 4), new PrefixCodeRange(97, 4), 5158 new PrefixCodeRange(113, 5), new PrefixCodeRange(145, 5), new PrefixCodeRange(177, 5), new PrefixCodeRange(209, 5), 5159 new PrefixCodeRange(241, 6), new PrefixCodeRange(305, 6), new PrefixCodeRange(369, 7), new PrefixCodeRange(497, 8), 5160 new PrefixCodeRange(753, 9), new PrefixCodeRange(1265, 10), new PrefixCodeRange(2289, 11), new PrefixCodeRange(4337, 12), 5161 new PrefixCodeRange(8433, 13), new PrefixCodeRange(16625, 24) 5162 ]; 5163 5164 exports.kInsertLengthPrefixCode = [ 5165 new PrefixCodeRange(0, 0), new PrefixCodeRange(1, 0), new PrefixCodeRange(2, 0), new PrefixCodeRange(3, 0), 5166 new PrefixCodeRange(4, 0), new PrefixCodeRange(5, 0), new PrefixCodeRange(6, 1), new PrefixCodeRange(8, 1), 5167 new PrefixCodeRange(10, 2), new PrefixCodeRange(14, 2), new PrefixCodeRange(18, 3), new PrefixCodeRange(26, 3), 5168 new PrefixCodeRange(34, 4), new PrefixCodeRange(50, 4), new PrefixCodeRange(66, 5), new PrefixCodeRange(98, 5), 5169 new PrefixCodeRange(130, 6), new PrefixCodeRange(194, 7), new PrefixCodeRange(322, 8), new PrefixCodeRange(578, 9), 5170 new PrefixCodeRange(1090, 10), new PrefixCodeRange(2114, 12), new PrefixCodeRange(6210, 14), new PrefixCodeRange(22594, 24), 5171 ]; 5172 5173 exports.kCopyLengthPrefixCode = [ 5174 new PrefixCodeRange(2, 0), new PrefixCodeRange(3, 0), new PrefixCodeRange(4, 0), new PrefixCodeRange(5, 0), 5175 new PrefixCodeRange(6, 0), new PrefixCodeRange(7, 0), new PrefixCodeRange(8, 0), new PrefixCodeRange(9, 0), 5176 new PrefixCodeRange(10, 1), new PrefixCodeRange(12, 1), new PrefixCodeRange(14, 2), new PrefixCodeRange(18, 2), 5177 new PrefixCodeRange(22, 3), new PrefixCodeRange(30, 3), new PrefixCodeRange(38, 4), new PrefixCodeRange(54, 4), 5178 new PrefixCodeRange(70, 5), new PrefixCodeRange(102, 5), new PrefixCodeRange(134, 6), new PrefixCodeRange(198, 7), 5179 new PrefixCodeRange(326, 8), new PrefixCodeRange(582, 9), new PrefixCodeRange(1094, 10), new PrefixCodeRange(2118, 24), 5180 ]; 5181 5182 exports.kInsertRangeLut = [ 5183 0, 0, 8, 8, 0, 16, 8, 16, 16, 5184 ]; 5185 5186 exports.kCopyRangeLut = [ 5187 0, 8, 0, 8, 16, 0, 16, 8, 16, 5188 ]; 5189 5190 },{}],10:[function(require,module,exports){ 5191 function BrotliInput(buffer) { 5192 this.buffer = buffer; 5193 this.pos = 0; 5194 } 5195 5196 BrotliInput.prototype.read = function(buf, i, count) { 5197 if (this.pos + count > this.buffer.length) { 5198 count = this.buffer.length - this.pos; 5199 } 5200 5201 for (var p = 0; p < count; p++) 5202 buf[i + p] = this.buffer[this.pos + p]; 5203 5204 this.pos += count; 5205 return count; 5206 } 5207 5208 exports.BrotliInput = BrotliInput; 5209 5210 function BrotliOutput(buf) { 5211 this.buffer = buf; 5212 this.pos = 0; 5213 } 5214 5215 BrotliOutput.prototype.write = function(buf, count) { 5216 if (this.pos + count > this.buffer.length) 5217 throw new Error('Output buffer is not large enough'); 5218 5219 this.buffer.set(buf.subarray(0, count), this.pos); 5220 this.pos += count; 5221 return count; 5222 }; 5223 5224 exports.BrotliOutput = BrotliOutput; 5225 5226 },{}],11:[function(require,module,exports){ 5227 /* Copyright 2013 Google Inc. All Rights Reserved. 5228 5229 Licensed under the Apache License, Version 2.0 (the "License"); 5230 you may not use this file except in compliance with the License. 5231 You may obtain a copy of the License at 5232 5233 http://www.apache.org/licenses/LICENSE-2.0 5234 5235 Unless required by applicable law or agreed to in writing, software 5236 distributed under the License is distributed on an "AS IS" BASIS, 5237 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5238 See the License for the specific language governing permissions and 5239 limitations under the License. 5240 5241 Transformations on dictionary words. 5242 */ 5243 5244 var BrotliDictionary = require('./dictionary'); 5245 5246 var kIdentity = 0; 5247 var kOmitLast1 = 1; 5248 var kOmitLast2 = 2; 5249 var kOmitLast3 = 3; 5250 var kOmitLast4 = 4; 5251 var kOmitLast5 = 5; 5252 var kOmitLast6 = 6; 5253 var kOmitLast7 = 7; 5254 var kOmitLast8 = 8; 5255 var kOmitLast9 = 9; 5256 var kUppercaseFirst = 10; 5257 var kUppercaseAll = 11; 5258 var kOmitFirst1 = 12; 5259 var kOmitFirst2 = 13; 5260 var kOmitFirst3 = 14; 5261 var kOmitFirst4 = 15; 5262 var kOmitFirst5 = 16; 5263 var kOmitFirst6 = 17; 5264 var kOmitFirst7 = 18; 5265 var kOmitFirst8 = 19; 5266 var kOmitFirst9 = 20; 5267 5268 function Transform(prefix, transform, suffix) { 5269 this.prefix = new Uint8Array(prefix.length); 5270 this.transform = transform; 5271 this.suffix = new Uint8Array(suffix.length); 5272 5273 for (var i = 0; i < prefix.length; i++) 5274 this.prefix[i] = prefix.charCodeAt(i); 5275 5276 for (var i = 0; i < suffix.length; i++) 5277 this.suffix[i] = suffix.charCodeAt(i); 5278 } 5279 5280 var kTransforms = [ 5281 new Transform( "", kIdentity, "" ), 5282 new Transform( "", kIdentity, " " ), 5283 new Transform( " ", kIdentity, " " ), 5284 new Transform( "", kOmitFirst1, "" ), 5285 new Transform( "", kUppercaseFirst, " " ), 5286 new Transform( "", kIdentity, " the " ), 5287 new Transform( " ", kIdentity, "" ), 5288 new Transform( "s ", kIdentity, " " ), 5289 new Transform( "", kIdentity, " of " ), 5290 new Transform( "", kUppercaseFirst, "" ), 5291 new Transform( "", kIdentity, " and " ), 5292 new Transform( "", kOmitFirst2, "" ), 5293 new Transform( "", kOmitLast1, "" ), 5294 new Transform( ", ", kIdentity, " " ), 5295 new Transform( "", kIdentity, ", " ), 5296 new Transform( " ", kUppercaseFirst, " " ), 5297 new Transform( "", kIdentity, " in " ), 5298 new Transform( "", kIdentity, " to " ), 5299 new Transform( "e ", kIdentity, " " ), 5300 new Transform( "", kIdentity, "\"" ), 5301 new Transform( "", kIdentity, "." ), 5302 new Transform( "", kIdentity, "\">" ), 5303 new Transform( "", kIdentity, "\n" ), 5304 new Transform( "", kOmitLast3, "" ), 5305 new Transform( "", kIdentity, "]" ), 5306 new Transform( "", kIdentity, " for " ), 5307 new Transform( "", kOmitFirst3, "" ), 5308 new Transform( "", kOmitLast2, "" ), 5309 new Transform( "", kIdentity, " a " ), 5310 new Transform( "", kIdentity, " that " ), 5311 new Transform( " ", kUppercaseFirst, "" ), 5312 new Transform( "", kIdentity, ". " ), 5313 new Transform( ".", kIdentity, "" ), 5314 new Transform( " ", kIdentity, ", " ), 5315 new Transform( "", kOmitFirst4, "" ), 5316 new Transform( "", kIdentity, " with " ), 5317 new Transform( "", kIdentity, "'" ), 5318 new Transform( "", kIdentity, " from " ), 5319 new Transform( "", kIdentity, " by " ), 5320 new Transform( "", kOmitFirst5, "" ), 5321 new Transform( "", kOmitFirst6, "" ), 5322 new Transform( " the ", kIdentity, "" ), 5323 new Transform( "", kOmitLast4, "" ), 5324 new Transform( "", kIdentity, ". The " ), 5325 new Transform( "", kUppercaseAll, "" ), 5326 new Transform( "", kIdentity, " on " ), 5327 new Transform( "", kIdentity, " as " ), 5328 new Transform( "", kIdentity, " is " ), 5329 new Transform( "", kOmitLast7, "" ), 5330 new Transform( "", kOmitLast1, "ing " ), 5331 new Transform( "", kIdentity, "\n\t" ), 5332 new Transform( "", kIdentity, ":" ), 5333 new Transform( " ", kIdentity, ". " ), 5334 new Transform( "", kIdentity, "ed " ), 5335 new Transform( "", kOmitFirst9, "" ), 5336 new Transform( "", kOmitFirst7, "" ), 5337 new Transform( "", kOmitLast6, "" ), 5338 new Transform( "", kIdentity, "(" ), 5339 new Transform( "", kUppercaseFirst, ", " ), 5340 new Transform( "", kOmitLast8, "" ), 5341 new Transform( "", kIdentity, " at " ), 5342 new Transform( "", kIdentity, "ly " ), 5343 new Transform( " the ", kIdentity, " of " ), 5344 new Transform( "", kOmitLast5, "" ), 5345 new Transform( "", kOmitLast9, "" ), 5346 new Transform( " ", kUppercaseFirst, ", " ), 5347 new Transform( "", kUppercaseFirst, "\"" ), 5348 new Transform( ".", kIdentity, "(" ), 5349 new Transform( "", kUppercaseAll, " " ), 5350 new Transform( "", kUppercaseFirst, "\">" ), 5351 new Transform( "", kIdentity, "=\"" ), 5352 new Transform( " ", kIdentity, "." ), 5353 new Transform( ".com/", kIdentity, "" ), 5354 new Transform( " the ", kIdentity, " of the " ), 5355 new Transform( "", kUppercaseFirst, "'" ), 5356 new Transform( "", kIdentity, ". This " ), 5357 new Transform( "", kIdentity, "," ), 5358 new Transform( ".", kIdentity, " " ), 5359 new Transform( "", kUppercaseFirst, "(" ), 5360 new Transform( "", kUppercaseFirst, "." ), 5361 new Transform( "", kIdentity, " not " ), 5362 new Transform( " ", kIdentity, "=\"" ), 5363 new Transform( "", kIdentity, "er " ), 5364 new Transform( " ", kUppercaseAll, " " ), 5365 new Transform( "", kIdentity, "al " ), 5366 new Transform( " ", kUppercaseAll, "" ), 5367 new Transform( "", kIdentity, "='" ), 5368 new Transform( "", kUppercaseAll, "\"" ), 5369 new Transform( "", kUppercaseFirst, ". " ), 5370 new Transform( " ", kIdentity, "(" ), 5371 new Transform( "", kIdentity, "ful " ), 5372 new Transform( " ", kUppercaseFirst, ". " ), 5373 new Transform( "", kIdentity, "ive " ), 5374 new Transform( "", kIdentity, "less " ), 5375 new Transform( "", kUppercaseAll, "'" ), 5376 new Transform( "", kIdentity, "est " ), 5377 new Transform( " ", kUppercaseFirst, "." ), 5378 new Transform( "", kUppercaseAll, "\">" ), 5379 new Transform( " ", kIdentity, "='" ), 5380 new Transform( "", kUppercaseFirst, "," ), 5381 new Transform( "", kIdentity, "ize " ), 5382 new Transform( "", kUppercaseAll, "." ), 5383 new Transform( "\xc2\xa0", kIdentity, "" ), 5384 new Transform( " ", kIdentity, "," ), 5385 new Transform( "", kUppercaseFirst, "=\"" ), 5386 new Transform( "", kUppercaseAll, "=\"" ), 5387 new Transform( "", kIdentity, "ous " ), 5388 new Transform( "", kUppercaseAll, ", " ), 5389 new Transform( "", kUppercaseFirst, "='" ), 5390 new Transform( " ", kUppercaseFirst, "," ), 5391 new Transform( " ", kUppercaseAll, "=\"" ), 5392 new Transform( " ", kUppercaseAll, ", " ), 5393 new Transform( "", kUppercaseAll, "," ), 5394 new Transform( "", kUppercaseAll, "(" ), 5395 new Transform( "", kUppercaseAll, ". " ), 5396 new Transform( " ", kUppercaseAll, "." ), 5397 new Transform( "", kUppercaseAll, "='" ), 5398 new Transform( " ", kUppercaseAll, ". " ), 5399 new Transform( " ", kUppercaseFirst, "=\"" ), 5400 new Transform( " ", kUppercaseAll, "='" ), 5401 new Transform( " ", kUppercaseFirst, "='" ) 5402 ]; 5403 5404 exports.kTransforms = kTransforms; 5405 exports.kNumTransforms = kTransforms.length; 5406 5407 function ToUpperCase(p, i) { 5408 if (p[i] < 0xc0) { 5409 if (p[i] >= 97 && p[i] <= 122) { 5410 p[i] ^= 32; 5411 } 5412 return 1; 5413 } 5414 5415 /* An overly simplified uppercasing model for utf-8. */ 5416 if (p[i] < 0xe0) { 5417 p[i + 1] ^= 32; 5418 return 2; 5419 } 5420 5421 /* An arbitrary transform for three byte characters. */ 5422 p[i + 2] ^= 5; 5423 return 3; 5424 } 5425 5426 exports.transformDictionaryWord = function(dst, idx, word, len, transform) { 5427 var prefix = kTransforms[transform].prefix; 5428 var suffix = kTransforms[transform].suffix; 5429 var t = kTransforms[transform].transform; 5430 var skip = t < kOmitFirst1 ? 0 : t - (kOmitFirst1 - 1); 5431 var i = 0; 5432 var start_idx = idx; 5433 var uppercase; 5434 5435 if (skip > len) { 5436 skip = len; 5437 } 5438 5439 var prefix_pos = 0; 5440 while (prefix_pos < prefix.length) { 5441 dst[idx++] = prefix[prefix_pos++]; 5442 } 5443 5444 word += skip; 5445 len -= skip; 5446 5447 if (t <= kOmitLast9) { 5448 len -= t; 5449 } 5450 5451 for (i = 0; i < len; i++) { 5452 dst[idx++] = BrotliDictionary.dictionary[word + i]; 5453 } 5454 5455 uppercase = idx - len; 5456 5457 if (t === kUppercaseFirst) { 5458 ToUpperCase(dst, uppercase); 5459 } else if (t === kUppercaseAll) { 5460 while (len > 0) { 5461 var step = ToUpperCase(dst, uppercase); 5462 uppercase += step; 5463 len -= step; 5464 } 5465 } 5466 5467 var suffix_pos = 0; 5468 while (suffix_pos < suffix.length) { 5469 dst[idx++] = suffix[suffix_pos++]; 5470 } 5471 5472 return idx - start_idx; 5473 } 5474 5475 },{"./dictionary":6}],12:[function(require,module,exports){ 5476 module.exports = require('./dec/decode').BrotliDecompressBuffer; 5477 5478 },{"./dec/decode":3}]},{},[12])(12) 5479 }); 5480 /* eslint-enable */ 5481 5482 5483 /***/ }), 5484 5485 /***/ 9681: 5486 /***/ ((module) => { 5487 5488 var characterMap = { 5489 "À": "A", 5490 "Á": "A", 5491 "Â": "A", 5492 "Ã": "A", 5493 "Ä": "A", 5494 "Å": "A", 5495 "Ấ": "A", 5496 "Ắ": "A", 5497 "Ẳ": "A", 5498 "Ẵ": "A", 5499 "Ặ": "A", 5500 "Æ": "AE", 5501 "Ầ": "A", 5502 "Ằ": "A", 5503 "Ȃ": "A", 5504 "Ả": "A", 5505 "Ạ": "A", 5506 "Ẩ": "A", 5507 "Ẫ": "A", 5508 "Ậ": "A", 5509 "Ç": "C", 5510 "Ḉ": "C", 5511 "È": "E", 5512 "É": "E", 5513 "Ê": "E", 5514 "Ë": "E", 5515 "Ế": "E", 5516 "Ḗ": "E", 5517 "Ề": "E", 5518 "Ḕ": "E", 5519 "Ḝ": "E", 5520 "Ȇ": "E", 5521 "Ẻ": "E", 5522 "Ẽ": "E", 5523 "Ẹ": "E", 5524 "Ể": "E", 5525 "Ễ": "E", 5526 "Ệ": "E", 5527 "Ì": "I", 5528 "Í": "I", 5529 "Î": "I", 5530 "Ï": "I", 5531 "Ḯ": "I", 5532 "Ȋ": "I", 5533 "Ỉ": "I", 5534 "Ị": "I", 5535 "Ð": "D", 5536 "Ñ": "N", 5537 "Ò": "O", 5538 "Ó": "O", 5539 "Ô": "O", 5540 "Õ": "O", 5541 "Ö": "O", 5542 "Ø": "O", 5543 "Ố": "O", 5544 "Ṍ": "O", 5545 "Ṓ": "O", 5546 "Ȏ": "O", 5547 "Ỏ": "O", 5548 "Ọ": "O", 5549 "Ổ": "O", 5550 "Ỗ": "O", 5551 "Ộ": "O", 5552 "Ờ": "O", 5553 "Ở": "O", 5554 "Ỡ": "O", 5555 "Ớ": "O", 5556 "Ợ": "O", 5557 "Ù": "U", 5558 "Ú": "U", 5559 "Û": "U", 5560 "Ü": "U", 5561 "Ủ": "U", 5562 "Ụ": "U", 5563 "Ử": "U", 5564 "Ữ": "U", 5565 "Ự": "U", 5566 "Ý": "Y", 5567 "à": "a", 5568 "á": "a", 5569 "â": "a", 5570 "ã": "a", 5571 "ä": "a", 5572 "å": "a", 5573 "ấ": "a", 5574 "ắ": "a", 5575 "ẳ": "a", 5576 "ẵ": "a", 5577 "ặ": "a", 5578 "æ": "ae", 5579 "ầ": "a", 5580 "ằ": "a", 5581 "ȃ": "a", 5582 "ả": "a", 5583 "ạ": "a", 5584 "ẩ": "a", 5585 "ẫ": "a", 5586 "ậ": "a", 5587 "ç": "c", 5588 "ḉ": "c", 5589 "è": "e", 5590 "é": "e", 5591 "ê": "e", 5592 "ë": "e", 5593 "ế": "e", 5594 "ḗ": "e", 5595 "ề": "e", 5596 "ḕ": "e", 5597 "ḝ": "e", 5598 "ȇ": "e", 5599 "ẻ": "e", 5600 "ẽ": "e", 5601 "ẹ": "e", 5602 "ể": "e", 5603 "ễ": "e", 5604 "ệ": "e", 5605 "ì": "i", 5606 "í": "i", 5607 "î": "i", 5608 "ï": "i", 5609 "ḯ": "i", 5610 "ȋ": "i", 5611 "ỉ": "i", 5612 "ị": "i", 5613 "ð": "d", 5614 "ñ": "n", 5615 "ò": "o", 5616 "ó": "o", 5617 "ô": "o", 5618 "õ": "o", 5619 "ö": "o", 5620 "ø": "o", 5621 "ố": "o", 5622 "ṍ": "o", 5623 "ṓ": "o", 5624 "ȏ": "o", 5625 "ỏ": "o", 5626 "ọ": "o", 5627 "ổ": "o", 5628 "ỗ": "o", 5629 "ộ": "o", 5630 "ờ": "o", 5631 "ở": "o", 5632 "ỡ": "o", 5633 "ớ": "o", 5634 "ợ": "o", 5635 "ù": "u", 5636 "ú": "u", 5637 "û": "u", 5638 "ü": "u", 5639 "ủ": "u", 5640 "ụ": "u", 5641 "ử": "u", 5642 "ữ": "u", 5643 "ự": "u", 5644 "ý": "y", 5645 "ÿ": "y", 5646 "Ā": "A", 5647 "ā": "a", 5648 "Ă": "A", 5649 "ă": "a", 5650 "Ą": "A", 5651 "ą": "a", 5652 "Ć": "C", 5653 "ć": "c", 5654 "Ĉ": "C", 5655 "ĉ": "c", 5656 "Ċ": "C", 5657 "ċ": "c", 5658 "Č": "C", 5659 "č": "c", 5660 "C̆": "C", 5661 "c̆": "c", 5662 "Ď": "D", 5663 "ď": "d", 5664 "Đ": "D", 5665 "đ": "d", 5666 "Ē": "E", 5667 "ē": "e", 5668 "Ĕ": "E", 5669 "ĕ": "e", 5670 "Ė": "E", 5671 "ė": "e", 5672 "Ę": "E", 5673 "ę": "e", 5674 "Ě": "E", 5675 "ě": "e", 5676 "Ĝ": "G", 5677 "Ǵ": "G", 5678 "ĝ": "g", 5679 "ǵ": "g", 5680 "Ğ": "G", 5681 "ğ": "g", 5682 "Ġ": "G", 5683 "ġ": "g", 5684 "Ģ": "G", 5685 "ģ": "g", 5686 "Ĥ": "H", 5687 "ĥ": "h", 5688 "Ħ": "H", 5689 "ħ": "h", 5690 "Ḫ": "H", 5691 "ḫ": "h", 5692 "Ĩ": "I", 5693 "ĩ": "i", 5694 "Ī": "I", 5695 "ī": "i", 5696 "Ĭ": "I", 5697 "ĭ": "i", 5698 "Į": "I", 5699 "į": "i", 5700 "İ": "I", 5701 "ı": "i", 5702 "IJ": "IJ", 5703 "ij": "ij", 5704 "Ĵ": "J", 5705 "ĵ": "j", 5706 "Ķ": "K", 5707 "ķ": "k", 5708 "Ḱ": "K", 5709 "ḱ": "k", 5710 "K̆": "K", 5711 "k̆": "k", 5712 "Ĺ": "L", 5713 "ĺ": "l", 5714 "Ļ": "L", 5715 "ļ": "l", 5716 "Ľ": "L", 5717 "ľ": "l", 5718 "Ŀ": "L", 5719 "ŀ": "l", 5720 "Ł": "l", 5721 "ł": "l", 5722 "Ḿ": "M", 5723 "ḿ": "m", 5724 "M̆": "M", 5725 "m̆": "m", 5726 "Ń": "N", 5727 "ń": "n", 5728 "Ņ": "N", 5729 "ņ": "n", 5730 "Ň": "N", 5731 "ň": "n", 5732 "ʼn": "n", 5733 "N̆": "N", 5734 "n̆": "n", 5735 "Ō": "O", 5736 "ō": "o", 5737 "Ŏ": "O", 5738 "ŏ": "o", 5739 "Ő": "O", 5740 "ő": "o", 5741 "Œ": "OE", 5742 "œ": "oe", 5743 "P̆": "P", 5744 "p̆": "p", 5745 "Ŕ": "R", 5746 "ŕ": "r", 5747 "Ŗ": "R", 5748 "ŗ": "r", 5749 "Ř": "R", 5750 "ř": "r", 5751 "R̆": "R", 5752 "r̆": "r", 5753 "Ȓ": "R", 5754 "ȓ": "r", 5755 "Ś": "S", 5756 "ś": "s", 5757 "Ŝ": "S", 5758 "ŝ": "s", 5759 "Ş": "S", 5760 "Ș": "S", 5761 "ș": "s", 5762 "ş": "s", 5763 "Š": "S", 5764 "š": "s", 5765 "Ţ": "T", 5766 "ţ": "t", 5767 "ț": "t", 5768 "Ț": "T", 5769 "Ť": "T", 5770 "ť": "t", 5771 "Ŧ": "T", 5772 "ŧ": "t", 5773 "T̆": "T", 5774 "t̆": "t", 5775 "Ũ": "U", 5776 "ũ": "u", 5777 "Ū": "U", 5778 "ū": "u", 5779 "Ŭ": "U", 5780 "ŭ": "u", 5781 "Ů": "U", 5782 "ů": "u", 5783 "Ű": "U", 5784 "ű": "u", 5785 "Ų": "U", 5786 "ų": "u", 5787 "Ȗ": "U", 5788 "ȗ": "u", 5789 "V̆": "V", 5790 "v̆": "v", 5791 "Ŵ": "W", 5792 "ŵ": "w", 5793 "Ẃ": "W", 5794 "ẃ": "w", 5795 "X̆": "X", 5796 "x̆": "x", 5797 "Ŷ": "Y", 5798 "ŷ": "y", 5799 "Ÿ": "Y", 5800 "Y̆": "Y", 5801 "y̆": "y", 5802 "Ź": "Z", 5803 "ź": "z", 5804 "Ż": "Z", 5805 "ż": "z", 5806 "Ž": "Z", 5807 "ž": "z", 5808 "ſ": "s", 5809 "ƒ": "f", 5810 "Ơ": "O", 5811 "ơ": "o", 5812 "Ư": "U", 5813 "ư": "u", 5814 "Ǎ": "A", 5815 "ǎ": "a", 5816 "Ǐ": "I", 5817 "ǐ": "i", 5818 "Ǒ": "O", 5819 "ǒ": "o", 5820 "Ǔ": "U", 5821 "ǔ": "u", 5822 "Ǖ": "U", 5823 "ǖ": "u", 5824 "Ǘ": "U", 5825 "ǘ": "u", 5826 "Ǚ": "U", 5827 "ǚ": "u", 5828 "Ǜ": "U", 5829 "ǜ": "u", 5830 "Ứ": "U", 5831 "ứ": "u", 5832 "Ṹ": "U", 5833 "ṹ": "u", 5834 "Ǻ": "A", 5835 "ǻ": "a", 5836 "Ǽ": "AE", 5837 "ǽ": "ae", 5838 "Ǿ": "O", 5839 "ǿ": "o", 5840 "Þ": "TH", 5841 "þ": "th", 5842 "Ṕ": "P", 5843 "ṕ": "p", 5844 "Ṥ": "S", 5845 "ṥ": "s", 5846 "X́": "X", 5847 "x́": "x", 5848 "Ѓ": "Г", 5849 "ѓ": "г", 5850 "Ќ": "К", 5851 "ќ": "к", 5852 "A̋": "A", 5853 "a̋": "a", 5854 "E̋": "E", 5855 "e̋": "e", 5856 "I̋": "I", 5857 "i̋": "i", 5858 "Ǹ": "N", 5859 "ǹ": "n", 5860 "Ồ": "O", 5861 "ồ": "o", 5862 "Ṑ": "O", 5863 "ṑ": "o", 5864 "Ừ": "U", 5865 "ừ": "u", 5866 "Ẁ": "W", 5867 "ẁ": "w", 5868 "Ỳ": "Y", 5869 "ỳ": "y", 5870 "Ȁ": "A", 5871 "ȁ": "a", 5872 "Ȅ": "E", 5873 "ȅ": "e", 5874 "Ȉ": "I", 5875 "ȉ": "i", 5876 "Ȍ": "O", 5877 "ȍ": "o", 5878 "Ȑ": "R", 5879 "ȑ": "r", 5880 "Ȕ": "U", 5881 "ȕ": "u", 5882 "B̌": "B", 5883 "b̌": "b", 5884 "Č̣": "C", 5885 "č̣": "c", 5886 "Ê̌": "E", 5887 "ê̌": "e", 5888 "F̌": "F", 5889 "f̌": "f", 5890 "Ǧ": "G", 5891 "ǧ": "g", 5892 "Ȟ": "H", 5893 "ȟ": "h", 5894 "J̌": "J", 5895 "ǰ": "j", 5896 "Ǩ": "K", 5897 "ǩ": "k", 5898 "M̌": "M", 5899 "m̌": "m", 5900 "P̌": "P", 5901 "p̌": "p", 5902 "Q̌": "Q", 5903 "q̌": "q", 5904 "Ř̩": "R", 5905 "ř̩": "r", 5906 "Ṧ": "S", 5907 "ṧ": "s", 5908 "V̌": "V", 5909 "v̌": "v", 5910 "W̌": "W", 5911 "w̌": "w", 5912 "X̌": "X", 5913 "x̌": "x", 5914 "Y̌": "Y", 5915 "y̌": "y", 5916 "A̧": "A", 5917 "a̧": "a", 5918 "B̧": "B", 5919 "b̧": "b", 5920 "Ḑ": "D", 5921 "ḑ": "d", 5922 "Ȩ": "E", 5923 "ȩ": "e", 5924 "Ɛ̧": "E", 5925 "ɛ̧": "e", 5926 "Ḩ": "H", 5927 "ḩ": "h", 5928 "I̧": "I", 5929 "i̧": "i", 5930 "Ɨ̧": "I", 5931 "ɨ̧": "i", 5932 "M̧": "M", 5933 "m̧": "m", 5934 "O̧": "O", 5935 "o̧": "o", 5936 "Q̧": "Q", 5937 "q̧": "q", 5938 "U̧": "U", 5939 "u̧": "u", 5940 "X̧": "X", 5941 "x̧": "x", 5942 "Z̧": "Z", 5943 "z̧": "z", 5944 "й":"и", 5945 "Й":"И", 5946 "ё":"е", 5947 "Ё":"Е", 5948 }; 5949 5950 var chars = Object.keys(characterMap).join('|'); 5951 var allAccents = new RegExp(chars, 'g'); 5952 var firstAccent = new RegExp(chars, ''); 5953 5954 function matcher(match) { 5955 return characterMap[match]; 5956 } 5957 5958 var removeAccents = function(string) { 5959 return string.replace(allAccents, matcher); 5960 }; 5961 5962 var hasAccents = function(string) { 5963 return !!string.match(firstAccent); 5964 }; 5965 5966 module.exports = removeAccents; 5967 module.exports.has = hasAccents; 5968 module.exports.remove = removeAccents; 5969 5970 5971 /***/ }) 5972 5973 /******/ }); 5974 /************************************************************************/ 5975 /******/ // The module cache 5976 /******/ var __webpack_module_cache__ = {}; 5977 /******/ 5978 /******/ // The require function 5979 /******/ function __webpack_require__(moduleId) { 5980 /******/ // Check if module is in cache 5981 /******/ var cachedModule = __webpack_module_cache__[moduleId]; 5982 /******/ if (cachedModule !== undefined) { 5983 /******/ return cachedModule.exports; 5984 /******/ } 5985 /******/ // Create a new module (and put it into the cache) 5986 /******/ var module = __webpack_module_cache__[moduleId] = { 5987 /******/ // no module.id needed 5988 /******/ // no module.loaded needed 5989 /******/ exports: {} 5990 /******/ }; 5991 /******/ 5992 /******/ // Execute the module function 5993 /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); 5994 /******/ 5995 /******/ // Return the exports of the module 5996 /******/ return module.exports; 5997 /******/ } 5998 /******/ 5999 /************************************************************************/ 6000 /******/ /* webpack/runtime/compat get default export */ 6001 /******/ (() => { 6002 /******/ // getDefaultExport function for compatibility with non-harmony modules 6003 /******/ __webpack_require__.n = (module) => { 6004 /******/ var getter = module && module.__esModule ? 6005 /******/ () => (module['default']) : 6006 /******/ () => (module); 6007 /******/ __webpack_require__.d(getter, { a: getter }); 6008 /******/ return getter; 6009 /******/ }; 6010 /******/ })(); 6011 /******/ 6012 /******/ /* webpack/runtime/create fake namespace object */ 6013 /******/ (() => { 6014 /******/ var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__); 6015 /******/ var leafPrototypes; 6016 /******/ // create a fake namespace object 6017 /******/ // mode & 1: value is a module id, require it 6018 /******/ // mode & 2: merge all properties of value into the ns 6019 /******/ // mode & 4: return value when already ns object 6020 /******/ // mode & 16: return value when it's Promise-like 6021 /******/ // mode & 8|1: behave like require 6022 /******/ __webpack_require__.t = function(value, mode) { 6023 /******/ if(mode & 1) value = this(value); 6024 /******/ if(mode & 8) return value; 6025 /******/ if(typeof value === 'object' && value) { 6026 /******/ if((mode & 4) && value.__esModule) return value; 6027 /******/ if((mode & 16) && typeof value.then === 'function') return value; 6028 /******/ } 6029 /******/ var ns = Object.create(null); 6030 /******/ __webpack_require__.r(ns); 6031 /******/ var def = {}; 6032 /******/ leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)]; 6033 /******/ for(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) { 6034 /******/ Object.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key]))); 6035 /******/ } 6036 /******/ def['default'] = () => (value); 6037 /******/ __webpack_require__.d(ns, def); 6038 /******/ return ns; 6039 /******/ }; 6040 /******/ })(); 6041 /******/ 6042 /******/ /* webpack/runtime/define property getters */ 6043 /******/ (() => { 6044 /******/ // define getter functions for harmony exports 6045 /******/ __webpack_require__.d = (exports, definition) => { 6046 /******/ for(var key in definition) { 6047 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 6048 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 6049 /******/ } 6050 /******/ } 6051 /******/ }; 6052 /******/ })(); 6053 /******/ 6054 /******/ /* webpack/runtime/hasOwnProperty shorthand */ 6055 /******/ (() => { 6056 /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) 6057 /******/ })(); 6058 /******/ 6059 /******/ /* webpack/runtime/make namespace object */ 6060 /******/ (() => { 6061 /******/ // define __esModule on exports 6062 /******/ __webpack_require__.r = (exports) => { 6063 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 6064 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 6065 /******/ } 6066 /******/ Object.defineProperty(exports, '__esModule', { value: true }); 6067 /******/ }; 6068 /******/ })(); 6069 /******/ 6070 /************************************************************************/ 6071 var __webpack_exports__ = {}; 6072 // This entry needs to be wrapped in an IIFE because it needs to be in strict mode. 6073 (() => { 6074 "use strict"; 6075 // ESM COMPAT FLAG 6076 __webpack_require__.r(__webpack_exports__); 6077 6078 // EXPORTS 6079 __webpack_require__.d(__webpack_exports__, { 6080 PluginMoreMenuItem: () => (/* reexport */ PluginMoreMenuItem), 6081 PluginSidebar: () => (/* reexport */ PluginSidebar), 6082 PluginSidebarMoreMenuItem: () => (/* reexport */ PluginSidebarMoreMenuItem), 6083 PluginTemplateSettingPanel: () => (/* reexport */ plugin_template_setting_panel), 6084 initializeEditor: () => (/* binding */ initializeEditor), 6085 initializePostsDashboard: () => (/* reexport */ initializePostsDashboard), 6086 reinitializeEditor: () => (/* binding */ reinitializeEditor), 6087 store: () => (/* reexport */ store) 6088 }); 6089 6090 // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/actions.js 6091 var actions_namespaceObject = {}; 6092 __webpack_require__.r(actions_namespaceObject); 6093 __webpack_require__.d(actions_namespaceObject, { 6094 __experimentalSetPreviewDeviceType: () => (__experimentalSetPreviewDeviceType), 6095 addTemplate: () => (addTemplate), 6096 closeGeneralSidebar: () => (closeGeneralSidebar), 6097 openGeneralSidebar: () => (openGeneralSidebar), 6098 openNavigationPanelToMenu: () => (openNavigationPanelToMenu), 6099 removeTemplate: () => (removeTemplate), 6100 revertTemplate: () => (revertTemplate), 6101 setEditedEntity: () => (setEditedEntity), 6102 setEditedPostContext: () => (setEditedPostContext), 6103 setHasPageContentFocus: () => (setHasPageContentFocus), 6104 setHomeTemplateId: () => (setHomeTemplateId), 6105 setIsInserterOpened: () => (setIsInserterOpened), 6106 setIsListViewOpened: () => (setIsListViewOpened), 6107 setIsNavigationPanelOpened: () => (setIsNavigationPanelOpened), 6108 setIsSaveViewOpened: () => (setIsSaveViewOpened), 6109 setNavigationMenu: () => (setNavigationMenu), 6110 setNavigationPanelActiveMenu: () => (setNavigationPanelActiveMenu), 6111 setPage: () => (setPage), 6112 setTemplate: () => (setTemplate), 6113 setTemplatePart: () => (setTemplatePart), 6114 switchEditorMode: () => (switchEditorMode), 6115 toggleDistractionFree: () => (toggleDistractionFree), 6116 toggleFeature: () => (toggleFeature), 6117 updateSettings: () => (updateSettings) 6118 }); 6119 6120 // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/private-actions.js 6121 var private_actions_namespaceObject = {}; 6122 __webpack_require__.r(private_actions_namespaceObject); 6123 __webpack_require__.d(private_actions_namespaceObject, { 6124 registerRoute: () => (registerRoute), 6125 setEditorCanvasContainerView: () => (setEditorCanvasContainerView), 6126 unregisterRoute: () => (unregisterRoute) 6127 }); 6128 6129 // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/selectors.js 6130 var selectors_namespaceObject = {}; 6131 __webpack_require__.r(selectors_namespaceObject); 6132 __webpack_require__.d(selectors_namespaceObject, { 6133 __experimentalGetInsertionPoint: () => (__experimentalGetInsertionPoint), 6134 __experimentalGetPreviewDeviceType: () => (__experimentalGetPreviewDeviceType), 6135 getCanUserCreateMedia: () => (getCanUserCreateMedia), 6136 getCurrentTemplateNavigationPanelSubMenu: () => (getCurrentTemplateNavigationPanelSubMenu), 6137 getCurrentTemplateTemplateParts: () => (getCurrentTemplateTemplateParts), 6138 getEditedPostContext: () => (getEditedPostContext), 6139 getEditedPostId: () => (getEditedPostId), 6140 getEditedPostType: () => (getEditedPostType), 6141 getEditorMode: () => (getEditorMode), 6142 getHomeTemplateId: () => (getHomeTemplateId), 6143 getNavigationPanelActiveMenu: () => (getNavigationPanelActiveMenu), 6144 getPage: () => (getPage), 6145 getReusableBlocks: () => (getReusableBlocks), 6146 getSettings: () => (getSettings), 6147 hasPageContentFocus: () => (hasPageContentFocus), 6148 isFeatureActive: () => (isFeatureActive), 6149 isInserterOpened: () => (isInserterOpened), 6150 isListViewOpened: () => (isListViewOpened), 6151 isNavigationOpened: () => (isNavigationOpened), 6152 isPage: () => (isPage), 6153 isSaveViewOpened: () => (isSaveViewOpened) 6154 }); 6155 6156 // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/private-selectors.js 6157 var private_selectors_namespaceObject = {}; 6158 __webpack_require__.r(private_selectors_namespaceObject); 6159 __webpack_require__.d(private_selectors_namespaceObject, { 6160 getEditorCanvasContainerView: () => (getEditorCanvasContainerView), 6161 getRoutes: () => (getRoutes) 6162 }); 6163 6164 ;// external ["wp","blocks"] 6165 const external_wp_blocks_namespaceObject = window["wp"]["blocks"]; 6166 ;// external ["wp","blockLibrary"] 6167 const external_wp_blockLibrary_namespaceObject = window["wp"]["blockLibrary"]; 6168 ;// external ["wp","data"] 6169 const external_wp_data_namespaceObject = window["wp"]["data"]; 6170 ;// external ["wp","deprecated"] 6171 const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; 6172 var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); 6173 ;// external ["wp","element"] 6174 const external_wp_element_namespaceObject = window["wp"]["element"]; 6175 ;// external ["wp","editor"] 6176 const external_wp_editor_namespaceObject = window["wp"]["editor"]; 6177 ;// external ["wp","preferences"] 6178 const external_wp_preferences_namespaceObject = window["wp"]["preferences"]; 6179 ;// external ["wp","widgets"] 6180 const external_wp_widgets_namespaceObject = window["wp"]["widgets"]; 6181 ;// external ["wp","hooks"] 6182 const external_wp_hooks_namespaceObject = window["wp"]["hooks"]; 6183 ;// external ["wp","compose"] 6184 const external_wp_compose_namespaceObject = window["wp"]["compose"]; 6185 ;// external ["wp","blockEditor"] 6186 const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; 6187 ;// external ["wp","components"] 6188 const external_wp_components_namespaceObject = window["wp"]["components"]; 6189 ;// external ["wp","i18n"] 6190 const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; 6191 ;// external ["wp","notices"] 6192 const external_wp_notices_namespaceObject = window["wp"]["notices"]; 6193 ;// external ["wp","coreData"] 6194 const external_wp_coreData_namespaceObject = window["wp"]["coreData"]; 6195 ;// ./node_modules/colord/index.mjs 6196 var r={grad:.9,turn:360,rad:360/(2*Math.PI)},t=function(r){return"string"==typeof r?r.length>0:"number"==typeof r},n=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*r)/n+0},e=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),r>n?n:r>t?r:t},u=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},a=function(r){return{r:e(r.r,0,255),g:e(r.g,0,255),b:e(r.b,0,255),a:e(r.a)}},o=function(r){return{r:n(r.r),g:n(r.g),b:n(r.b),a:n(r.a,3)}},i=/^#([0-9a-f]{3,8})$/i,s=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},h=function(r){var t=r.r,n=r.g,e=r.b,u=r.a,a=Math.max(t,n,e),o=a-Math.min(t,n,e),i=o?a===t?(n-e)/o:a===n?2+(e-t)/o:4+(t-n)/o:0;return{h:60*(i<0?i+6:i),s:a?o/a*100:0,v:a/255*100,a:u}},b=function(r){var t=r.h,n=r.s,e=r.v,u=r.a;t=t/360*6,n/=100,e/=100;var a=Math.floor(t),o=e*(1-n),i=e*(1-(t-a)*n),s=e*(1-(1-t+a)*n),h=a%6;return{r:255*[e,i,o,o,s,e][h],g:255*[s,e,e,i,o,o][h],b:255*[o,o,s,e,e,i][h],a:u}},g=function(r){return{h:u(r.h),s:e(r.s,0,100),l:e(r.l,0,100),a:e(r.a)}},d=function(r){return{h:n(r.h),s:n(r.s),l:n(r.l),a:n(r.a,3)}},f=function(r){return b((n=(t=r).s,{h:t.h,s:(n*=((e=t.l)<50?e:100-e)/100)>0?2*n/(e+n)*100:0,v:e+n,a:t.a}));var t,n,e},c=function(r){return{h:(t=h(r)).h,s:(u=(200-(n=t.s))*(e=t.v)/100)>0&&u<200?n*e/100/(u<=100?u:200-u)*100:0,l:u/2,a:t.a};var t,n,e,u},l=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,colord_p=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,v=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,m=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,y={string:[[function(r){var t=i.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:4===r.length?n(parseInt(r[3]+r[3],16)/255,2):1}:6===r.length||8===r.length?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:8===r.length?n(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=v.exec(r)||m.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:a({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(t){var n=l.exec(t)||colord_p.exec(t);if(!n)return null;var e,u,a=g({h:(e=n[1],u=n[2],void 0===u&&(u="deg"),Number(e)*(r[u]||1)),s:Number(n[3]),l:Number(n[4]),a:void 0===n[5]?1:Number(n[5])/(n[6]?100:1)});return f(a)},"hsl"]],object:[[function(r){var n=r.r,e=r.g,u=r.b,o=r.a,i=void 0===o?1:o;return t(n)&&t(e)&&t(u)?a({r:Number(n),g:Number(e),b:Number(u),a:Number(i)}):null},"rgb"],[function(r){var n=r.h,e=r.s,u=r.l,a=r.a,o=void 0===a?1:a;if(!t(n)||!t(e)||!t(u))return null;var i=g({h:Number(n),s:Number(e),l:Number(u),a:Number(o)});return f(i)},"hsl"],[function(r){var n=r.h,a=r.s,o=r.v,i=r.a,s=void 0===i?1:i;if(!t(n)||!t(a)||!t(o))return null;var h=function(r){return{h:u(r.h),s:e(r.s,0,100),v:e(r.v,0,100),a:e(r.a)}}({h:Number(n),s:Number(a),v:Number(o),a:Number(s)});return b(h)},"hsv"]]},N=function(r,t){for(var n=0;n<t.length;n++){var e=t[n][0](r);if(e)return[e,t[n][1]]}return[null,void 0]},x=function(r){return"string"==typeof r?N(r.trim(),y.string):"object"==typeof r&&null!==r?N(r,y.object):[null,void 0]},I=function(r){return x(r)[1]},M=function(r,t){var n=c(r);return{h:n.h,s:e(n.s+100*t,0,100),l:n.l,a:n.a}},H=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},$=function(r,t){var n=c(r);return{h:n.h,s:n.s,l:e(n.l+100*t,0,100),a:n.a}},colord_j=function(){function r(r){this.parsed=x(r)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return null!==this.parsed},r.prototype.brightness=function(){return n(H(this.rgba),2)},r.prototype.isDark=function(){return H(this.rgba)<.5},r.prototype.isLight=function(){return H(this.rgba)>=.5},r.prototype.toHex=function(){return r=o(this.rgba),t=r.r,e=r.g,u=r.b,i=(a=r.a)<1?s(n(255*a)):"","#"+s(t)+s(e)+s(u)+i;var r,t,e,u,a,i},r.prototype.toRgb=function(){return o(this.rgba)},r.prototype.toRgbString=function(){return r=o(this.rgba),t=r.r,n=r.g,e=r.b,(u=r.a)<1?"rgba("+t+", "+n+", "+e+", "+u+")":"rgb("+t+", "+n+", "+e+")";var r,t,n,e,u},r.prototype.toHsl=function(){return d(c(this.rgba))},r.prototype.toHslString=function(){return r=d(c(this.rgba)),t=r.h,n=r.s,e=r.l,(u=r.a)<1?"hsla("+t+", "+n+"%, "+e+"%, "+u+")":"hsl("+t+", "+n+"%, "+e+"%)";var r,t,n,e,u},r.prototype.toHsv=function(){return r=h(this.rgba),{h:n(r.h),s:n(r.s),v:n(r.v),a:n(r.a,3)};var r},r.prototype.invert=function(){return w({r:255-(r=this.rgba).r,g:255-r.g,b:255-r.b,a:r.a});var r},r.prototype.saturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,r))},r.prototype.desaturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,-r))},r.prototype.grayscale=function(){return w(M(this.rgba,-1))},r.prototype.lighten=function(r){return void 0===r&&(r=.1),w($(this.rgba,r))},r.prototype.darken=function(r){return void 0===r&&(r=.1),w($(this.rgba,-r))},r.prototype.rotate=function(r){return void 0===r&&(r=15),this.hue(this.hue()+r)},r.prototype.alpha=function(r){return"number"==typeof r?w({r:(t=this.rgba).r,g:t.g,b:t.b,a:r}):n(this.rgba.a,3);var t},r.prototype.hue=function(r){var t=c(this.rgba);return"number"==typeof r?w({h:r,s:t.s,l:t.l,a:t.a}):n(t.h)},r.prototype.isEqual=function(r){return this.toHex()===w(r).toHex()},r}(),w=function(r){return r instanceof colord_j?r:new colord_j(r)},S=[],k=function(r){r.forEach(function(r){S.indexOf(r)<0&&(r(colord_j,y),S.push(r))})},E=function(){return new colord_j({r:255*Math.random(),g:255*Math.random(),b:255*Math.random()})}; 6197 6198 ;// ./node_modules/colord/plugins/a11y.mjs 6199 var a11y_o=function(o){var t=o/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},a11y_t=function(t){return.2126*a11y_o(t.r)+.7152*a11y_o(t.g)+.0722*a11y_o(t.b)};/* harmony default export */ function a11y(o){o.prototype.luminance=function(){return o=a11y_t(this.rgba),void 0===(r=2)&&(r=0),void 0===n&&(n=Math.pow(10,r)),Math.round(n*o)/n+0;var o,r,n},o.prototype.contrast=function(r){void 0===r&&(r="#FFF");var n,a,i,e,v,u,d,c=r instanceof o?r:new o(r);return e=this.rgba,v=c.toRgb(),u=a11y_t(e),d=a11y_t(v),n=u>d?(u+.05)/(d+.05):(d+.05)/(u+.05),void 0===(a=2)&&(a=0),void 0===i&&(i=Math.pow(10,a)),Math.floor(i*n)/i+0},o.prototype.isReadable=function(o,t){return void 0===o&&(o="#FFF"),void 0===t&&(t={}),this.contrast(o)>=(e=void 0===(i=(r=t).size)?"normal":i,"AAA"===(a=void 0===(n=r.level)?"AA":n)&&"normal"===e?7:"AA"===a&&"large"===e?3:4.5);var r,n,a,i,e}} 6200 6201 ;// external ["wp","privateApis"] 6202 const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"]; 6203 ;// ./node_modules/@wordpress/edit-site/build-module/lock-unlock.js 6204 /** 6205 * WordPress dependencies 6206 */ 6207 6208 const { 6209 lock, 6210 unlock 6211 } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', '@wordpress/edit-site'); 6212 6213 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/hooks.js 6214 /** 6215 * External dependencies 6216 */ 6217 6218 6219 6220 /** 6221 * WordPress dependencies 6222 */ 6223 6224 6225 6226 /** 6227 * Internal dependencies 6228 */ 6229 6230 6231 const { 6232 useGlobalSetting, 6233 useGlobalStyle 6234 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 6235 6236 // Enable colord's a11y plugin. 6237 k([a11y]); 6238 function useColorRandomizer(name) { 6239 const [themeColors, setThemeColors] = useGlobalSetting('color.palette.theme', name); 6240 function randomizeColors() { 6241 /* eslint-disable no-restricted-syntax */ 6242 const randomRotationValue = Math.floor(Math.random() * 225); 6243 /* eslint-enable no-restricted-syntax */ 6244 6245 const newColors = themeColors.map(colorObject => { 6246 const { 6247 color 6248 } = colorObject; 6249 const newColor = w(color).rotate(randomRotationValue).toHex(); 6250 return { 6251 ...colorObject, 6252 color: newColor 6253 }; 6254 }); 6255 setThemeColors(newColors); 6256 } 6257 return window.__experimentalEnableColorRandomizer ? [randomizeColors] : []; 6258 } 6259 function useStylesPreviewColors() { 6260 const [textColor = 'black'] = useGlobalStyle('color.text'); 6261 const [backgroundColor = 'white'] = useGlobalStyle('color.background'); 6262 const [headingColor = textColor] = useGlobalStyle('elements.h1.color.text'); 6263 const [linkColor = headingColor] = useGlobalStyle('elements.link.color.text'); 6264 const [buttonBackgroundColor = linkColor] = useGlobalStyle('elements.button.color.background'); 6265 const [coreColors] = useGlobalSetting('color.palette.core'); 6266 const [themeColors] = useGlobalSetting('color.palette.theme'); 6267 const [customColors] = useGlobalSetting('color.palette.custom'); 6268 const paletteColors = (themeColors !== null && themeColors !== void 0 ? themeColors : []).concat(customColors !== null && customColors !== void 0 ? customColors : []).concat(coreColors !== null && coreColors !== void 0 ? coreColors : []); 6269 const textColorObject = paletteColors.filter(({ 6270 color 6271 }) => color === textColor); 6272 const buttonBackgroundColorObject = paletteColors.filter(({ 6273 color 6274 }) => color === buttonBackgroundColor); 6275 const highlightedColors = textColorObject.concat(buttonBackgroundColorObject).concat(paletteColors).filter( 6276 // we exclude these background color because it is already visible in the preview. 6277 ({ 6278 color 6279 }) => color !== backgroundColor).slice(0, 2); 6280 return { 6281 paletteColors, 6282 highlightedColors 6283 }; 6284 } 6285 function useSupportedStyles(name, element) { 6286 const { 6287 supportedPanels 6288 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 6289 return { 6290 supportedPanels: unlock(select(external_wp_blocks_namespaceObject.store)).getSupportedStyles(name, element) 6291 }; 6292 }, [name, element]); 6293 return supportedPanels; 6294 } 6295 6296 ;// ./node_modules/@wordpress/edit-site/build-module/utils/set-nested-value.js 6297 /** 6298 * Sets the value at path of object. 6299 * If a portion of path doesn’t exist, it’s created. 6300 * Arrays are created for missing index properties while objects are created 6301 * for all other missing properties. 6302 * 6303 * This function intentionally mutates the input object. 6304 * 6305 * Inspired by _.set(). 6306 * 6307 * @see https://lodash.com/docs/4.17.15#set 6308 * 6309 * @todo Needs to be deduplicated with its copy in `@wordpress/core-data`. 6310 * 6311 * @param {Object} object Object to modify 6312 * @param {Array} path Path of the property to set. 6313 * @param {*} value Value to set. 6314 */ 6315 function setNestedValue(object, path, value) { 6316 if (!object || typeof object !== 'object') { 6317 return object; 6318 } 6319 path.reduce((acc, key, idx) => { 6320 if (acc[key] === undefined) { 6321 if (Number.isInteger(path[idx + 1])) { 6322 acc[key] = []; 6323 } else { 6324 acc[key] = {}; 6325 } 6326 } 6327 if (idx === path.length - 1) { 6328 acc[key] = value; 6329 } 6330 return acc[key]; 6331 }, object); 6332 return object; 6333 } 6334 6335 ;// external "ReactJSXRuntime" 6336 const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; 6337 ;// ./node_modules/@wordpress/edit-site/build-module/hooks/push-changes-to-global-styles/index.js 6338 /* wp:polyfill */ 6339 /** 6340 * WordPress dependencies 6341 */ 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 /** 6354 * Internal dependencies 6355 */ 6356 6357 6358 6359 6360 const { 6361 cleanEmptyObject, 6362 GlobalStylesContext 6363 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 6364 6365 // Block Gap is a special case and isn't defined within the blocks 6366 // style properties config. We'll add it here to allow it to be pushed 6367 // to global styles as well. 6368 const STYLE_PROPERTY = { 6369 ...external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY, 6370 blockGap: { 6371 value: ['spacing', 'blockGap'] 6372 } 6373 }; 6374 6375 // TODO: Temporary duplication of constant in @wordpress/block-editor. Can be 6376 // removed by moving PushChangesToGlobalStylesControl to 6377 // @wordpress/block-editor. 6378 const STYLE_PATH_TO_CSS_VAR_INFIX = { 6379 'border.color': 'color', 6380 'color.background': 'color', 6381 'color.text': 'color', 6382 'elements.link.color.text': 'color', 6383 'elements.link.:hover.color.text': 'color', 6384 'elements.link.typography.fontFamily': 'font-family', 6385 'elements.link.typography.fontSize': 'font-size', 6386 'elements.button.color.text': 'color', 6387 'elements.button.color.background': 'color', 6388 'elements.button.typography.fontFamily': 'font-family', 6389 'elements.button.typography.fontSize': 'font-size', 6390 'elements.caption.color.text': 'color', 6391 'elements.heading.color': 'color', 6392 'elements.heading.color.background': 'color', 6393 'elements.heading.typography.fontFamily': 'font-family', 6394 'elements.heading.gradient': 'gradient', 6395 'elements.heading.color.gradient': 'gradient', 6396 'elements.h1.color': 'color', 6397 'elements.h1.color.background': 'color', 6398 'elements.h1.typography.fontFamily': 'font-family', 6399 'elements.h1.color.gradient': 'gradient', 6400 'elements.h2.color': 'color', 6401 'elements.h2.color.background': 'color', 6402 'elements.h2.typography.fontFamily': 'font-family', 6403 'elements.h2.color.gradient': 'gradient', 6404 'elements.h3.color': 'color', 6405 'elements.h3.color.background': 'color', 6406 'elements.h3.typography.fontFamily': 'font-family', 6407 'elements.h3.color.gradient': 'gradient', 6408 'elements.h4.color': 'color', 6409 'elements.h4.color.background': 'color', 6410 'elements.h4.typography.fontFamily': 'font-family', 6411 'elements.h4.color.gradient': 'gradient', 6412 'elements.h5.color': 'color', 6413 'elements.h5.color.background': 'color', 6414 'elements.h5.typography.fontFamily': 'font-family', 6415 'elements.h5.color.gradient': 'gradient', 6416 'elements.h6.color': 'color', 6417 'elements.h6.color.background': 'color', 6418 'elements.h6.typography.fontFamily': 'font-family', 6419 'elements.h6.color.gradient': 'gradient', 6420 'color.gradient': 'gradient', 6421 blockGap: 'spacing', 6422 'typography.fontSize': 'font-size', 6423 'typography.fontFamily': 'font-family' 6424 }; 6425 6426 // TODO: Temporary duplication of constant in @wordpress/block-editor. Can be 6427 // removed by moving PushChangesToGlobalStylesControl to 6428 // @wordpress/block-editor. 6429 const STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = { 6430 'border.color': 'borderColor', 6431 'color.background': 'backgroundColor', 6432 'color.text': 'textColor', 6433 'color.gradient': 'gradient', 6434 'typography.fontSize': 'fontSize', 6435 'typography.fontFamily': 'fontFamily' 6436 }; 6437 const SUPPORTED_STYLES = ['border', 'color', 'spacing', 'typography']; 6438 const getValueFromObjectPath = (object, path) => { 6439 let value = object; 6440 path.forEach(fieldName => { 6441 value = value?.[fieldName]; 6442 }); 6443 return value; 6444 }; 6445 const flatBorderProperties = ['borderColor', 'borderWidth', 'borderStyle']; 6446 const sides = ['top', 'right', 'bottom', 'left']; 6447 function getBorderStyleChanges(border, presetColor, userStyle) { 6448 if (!border && !presetColor) { 6449 return []; 6450 } 6451 const changes = [...getFallbackBorderStyleChange('top', border, userStyle), ...getFallbackBorderStyleChange('right', border, userStyle), ...getFallbackBorderStyleChange('bottom', border, userStyle), ...getFallbackBorderStyleChange('left', border, userStyle)]; 6452 6453 // Handle a flat border i.e. all sides the same, CSS shorthand. 6454 const { 6455 color: customColor, 6456 style, 6457 width 6458 } = border || {}; 6459 const hasColorOrWidth = presetColor || customColor || width; 6460 if (hasColorOrWidth && !style) { 6461 // Global Styles need individual side configurations to overcome 6462 // theme.json configurations which are per side as well. 6463 sides.forEach(side => { 6464 // Only add fallback border-style if global styles don't already 6465 // have something set. 6466 if (!userStyle?.[side]?.style) { 6467 changes.push({ 6468 path: ['border', side, 'style'], 6469 value: 'solid' 6470 }); 6471 } 6472 }); 6473 } 6474 return changes; 6475 } 6476 function getFallbackBorderStyleChange(side, border, globalBorderStyle) { 6477 if (!border?.[side] || globalBorderStyle?.[side]?.style) { 6478 return []; 6479 } 6480 const { 6481 color, 6482 style, 6483 width 6484 } = border[side]; 6485 const hasColorOrWidth = color || width; 6486 if (!hasColorOrWidth || style) { 6487 return []; 6488 } 6489 return [{ 6490 path: ['border', side, 'style'], 6491 value: 'solid' 6492 }]; 6493 } 6494 function useChangesToPush(name, attributes, userConfig) { 6495 const supports = useSupportedStyles(name); 6496 const blockUserConfig = userConfig?.styles?.blocks?.[name]; 6497 return (0,external_wp_element_namespaceObject.useMemo)(() => { 6498 const changes = supports.flatMap(key => { 6499 if (!STYLE_PROPERTY[key]) { 6500 return []; 6501 } 6502 const { 6503 value: path 6504 } = STYLE_PROPERTY[key]; 6505 const presetAttributeKey = path.join('.'); 6506 const presetAttributeValue = attributes[STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[presetAttributeKey]]; 6507 const value = presetAttributeValue ? `var:preset|$STYLE_PATH_TO_CSS_VAR_INFIX[presetAttributeKey]}|$presetAttributeValue}` : getValueFromObjectPath(attributes.style, path); 6508 6509 // Links only have a single support entry but have two element 6510 // style properties, color and hover color. The following check 6511 // will add the hover color to the changes if required. 6512 if (key === 'linkColor') { 6513 const linkChanges = value ? [{ 6514 path, 6515 value 6516 }] : []; 6517 const hoverPath = ['elements', 'link', ':hover', 'color', 'text']; 6518 const hoverValue = getValueFromObjectPath(attributes.style, hoverPath); 6519 if (hoverValue) { 6520 linkChanges.push({ 6521 path: hoverPath, 6522 value: hoverValue 6523 }); 6524 } 6525 return linkChanges; 6526 } 6527 6528 // The shorthand border styles can't be mapped directly as global 6529 // styles requires longhand config. 6530 if (flatBorderProperties.includes(key) && value) { 6531 // The shorthand config path is included to clear the block attribute. 6532 const borderChanges = [{ 6533 path, 6534 value 6535 }]; 6536 sides.forEach(side => { 6537 const currentPath = [...path]; 6538 currentPath.splice(-1, 0, side); 6539 borderChanges.push({ 6540 path: currentPath, 6541 value 6542 }); 6543 }); 6544 return borderChanges; 6545 } 6546 return value ? [{ 6547 path, 6548 value 6549 }] : []; 6550 }); 6551 6552 // To ensure display of a visible border, global styles require a 6553 // default border style if a border color or width is present. 6554 getBorderStyleChanges(attributes.style?.border, attributes.borderColor, blockUserConfig?.border).forEach(change => changes.push(change)); 6555 return changes; 6556 }, [supports, attributes, blockUserConfig]); 6557 } 6558 function PushChangesToGlobalStylesControl({ 6559 name, 6560 attributes, 6561 setAttributes 6562 }) { 6563 const { 6564 user: userConfig, 6565 setUserConfig 6566 } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); 6567 const changes = useChangesToPush(name, attributes, userConfig); 6568 const { 6569 __unstableMarkNextChangeAsNotPersistent 6570 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 6571 const { 6572 createSuccessNotice 6573 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 6574 const pushChanges = (0,external_wp_element_namespaceObject.useCallback)(() => { 6575 if (changes.length === 0) { 6576 return; 6577 } 6578 if (changes.length > 0) { 6579 const { 6580 style: blockStyles 6581 } = attributes; 6582 const newBlockStyles = structuredClone(blockStyles); 6583 const newUserConfig = structuredClone(userConfig); 6584 for (const { 6585 path, 6586 value 6587 } of changes) { 6588 setNestedValue(newBlockStyles, path, undefined); 6589 setNestedValue(newUserConfig, ['styles', 'blocks', name, ...path], value); 6590 } 6591 const newBlockAttributes = { 6592 borderColor: undefined, 6593 backgroundColor: undefined, 6594 textColor: undefined, 6595 gradient: undefined, 6596 fontSize: undefined, 6597 fontFamily: undefined, 6598 style: cleanEmptyObject(newBlockStyles) 6599 }; 6600 6601 // @wordpress/core-data doesn't support editing multiple entity types in 6602 // a single undo level. So for now, we disable @wordpress/core-data undo 6603 // tracking and implement our own Undo button in the snackbar 6604 // notification. 6605 __unstableMarkNextChangeAsNotPersistent(); 6606 setAttributes(newBlockAttributes); 6607 setUserConfig(newUserConfig, { 6608 undoIgnore: true 6609 }); 6610 createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( 6611 // translators: %s: Title of the block e.g. 'Heading'. 6612 (0,external_wp_i18n_namespaceObject.__)('%s styles applied.'), (0,external_wp_blocks_namespaceObject.getBlockType)(name).title), { 6613 type: 'snackbar', 6614 actions: [{ 6615 label: (0,external_wp_i18n_namespaceObject.__)('Undo'), 6616 onClick() { 6617 __unstableMarkNextChangeAsNotPersistent(); 6618 setAttributes(attributes); 6619 setUserConfig(userConfig, { 6620 undoIgnore: true 6621 }); 6622 } 6623 }] 6624 }); 6625 } 6626 }, [__unstableMarkNextChangeAsNotPersistent, attributes, changes, createSuccessNotice, name, setAttributes, setUserConfig, userConfig]); 6627 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.BaseControl, { 6628 __nextHasNoMarginBottom: true, 6629 className: "edit-site-push-changes-to-global-styles-control", 6630 help: (0,external_wp_i18n_namespaceObject.sprintf)( 6631 // translators: %s: Title of the block e.g. 'Heading'. 6632 (0,external_wp_i18n_namespaceObject.__)('Apply this block’s typography, spacing, dimensions, and color styles to all %s blocks.'), (0,external_wp_blocks_namespaceObject.getBlockType)(name).title), 6633 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { 6634 children: (0,external_wp_i18n_namespaceObject.__)('Styles') 6635 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 6636 __next40pxDefaultSize: true, 6637 variant: "secondary", 6638 accessibleWhenDisabled: true, 6639 disabled: changes.length === 0, 6640 onClick: pushChanges, 6641 children: (0,external_wp_i18n_namespaceObject.__)('Apply globally') 6642 })] 6643 }); 6644 } 6645 function PushChangesToGlobalStyles(props) { 6646 const blockEditingMode = (0,external_wp_blockEditor_namespaceObject.useBlockEditingMode)(); 6647 const isBlockBasedTheme = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme, []); 6648 const supportsStyles = SUPPORTED_STYLES.some(feature => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(props.name, feature)); 6649 const isDisplayed = blockEditingMode === 'default' && supportsStyles && isBlockBasedTheme; 6650 if (!isDisplayed) { 6651 return null; 6652 } 6653 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InspectorAdvancedControls, { 6654 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PushChangesToGlobalStylesControl, { 6655 ...props 6656 }) 6657 }); 6658 } 6659 const withPushChangesToGlobalStyles = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => props => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 6660 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, { 6661 ...props 6662 }, "edit"), props.isSelected && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PushChangesToGlobalStyles, { 6663 ...props 6664 })] 6665 })); 6666 (0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/edit-site/push-changes-to-global-styles', withPushChangesToGlobalStyles); 6667 6668 ;// ./node_modules/@wordpress/edit-site/build-module/hooks/index.js 6669 /** 6670 * Internal dependencies 6671 */ 6672 6673 6674 ;// ./node_modules/@wordpress/edit-site/build-module/store/reducer.js 6675 /** 6676 * WordPress dependencies 6677 */ 6678 6679 6680 /** 6681 * Reducer returning the settings. 6682 * 6683 * @param {Object} state Current state. 6684 * @param {Object} action Dispatched action. 6685 * 6686 * @return {Object} Updated state. 6687 */ 6688 function settings(state = {}, action) { 6689 switch (action.type) { 6690 case 'UPDATE_SETTINGS': 6691 return { 6692 ...state, 6693 ...action.settings 6694 }; 6695 } 6696 return state; 6697 } 6698 6699 /** 6700 * Reducer keeping track of the currently edited Post Type, 6701 * Post Id and the context provided to fill the content of the block editor. 6702 * 6703 * @param {Object} state Current edited post. 6704 * @param {Object} action Dispatched action. 6705 * 6706 * @return {Object} Updated state. 6707 */ 6708 function editedPost(state = {}, action) { 6709 switch (action.type) { 6710 case 'SET_EDITED_POST': 6711 return { 6712 postType: action.postType, 6713 id: action.id, 6714 context: action.context 6715 }; 6716 case 'SET_EDITED_POST_CONTEXT': 6717 return { 6718 ...state, 6719 context: action.context 6720 }; 6721 } 6722 return state; 6723 } 6724 6725 /** 6726 * Reducer to set the save view panel open or closed. 6727 * 6728 * @param {Object} state Current state. 6729 * @param {Object} action Dispatched action. 6730 */ 6731 function saveViewPanel(state = false, action) { 6732 switch (action.type) { 6733 case 'SET_IS_SAVE_VIEW_OPENED': 6734 return action.isOpen; 6735 } 6736 return state; 6737 } 6738 6739 /** 6740 * Reducer used to track the site editor canvas container view. 6741 * Default is `undefined`, denoting the default, visual block editor. 6742 * This could be, for example, `'style-book'` (the style book). 6743 * 6744 * @param {string|undefined} state Current state. 6745 * @param {Object} action Dispatched action. 6746 */ 6747 function editorCanvasContainerView(state = undefined, action) { 6748 switch (action.type) { 6749 case 'SET_EDITOR_CANVAS_CONTAINER_VIEW': 6750 return action.view; 6751 } 6752 return state; 6753 } 6754 function routes(state = [], action) { 6755 switch (action.type) { 6756 case 'REGISTER_ROUTE': 6757 return [...state, action.route]; 6758 case 'UNREGISTER_ROUTE': 6759 return state.filter(route => route.name !== action.name); 6760 } 6761 return state; 6762 } 6763 /* harmony default export */ const reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ 6764 settings, 6765 editedPost, 6766 saveViewPanel, 6767 editorCanvasContainerView, 6768 routes 6769 })); 6770 6771 ;// external ["wp","patterns"] 6772 const external_wp_patterns_namespaceObject = window["wp"]["patterns"]; 6773 ;// ./node_modules/@wordpress/edit-site/build-module/utils/constants.js 6774 /** 6775 * WordPress dependencies 6776 */ 6777 6778 6779 6780 /** 6781 * Internal dependencies 6782 */ 6783 6784 6785 // Navigation 6786 const NAVIGATION_POST_TYPE = 'wp_navigation'; 6787 6788 // Templates. 6789 const TEMPLATE_POST_TYPE = 'wp_template'; 6790 const TEMPLATE_PART_POST_TYPE = 'wp_template_part'; 6791 const TEMPLATE_ORIGINS = { 6792 custom: 'custom', 6793 theme: 'theme', 6794 plugin: 'plugin' 6795 }; 6796 const TEMPLATE_PART_AREA_DEFAULT_CATEGORY = 'uncategorized'; 6797 const TEMPLATE_PART_ALL_AREAS_CATEGORY = 'all-parts'; 6798 6799 // Patterns. 6800 const { 6801 PATTERN_TYPES, 6802 PATTERN_DEFAULT_CATEGORY, 6803 PATTERN_USER_CATEGORY, 6804 EXCLUDED_PATTERN_SOURCES, 6805 PATTERN_SYNC_TYPES 6806 } = unlock(external_wp_patterns_namespaceObject.privateApis); 6807 6808 // Entities that are editable in focus mode. 6809 const FOCUSABLE_ENTITIES = [TEMPLATE_PART_POST_TYPE, NAVIGATION_POST_TYPE, PATTERN_TYPES.user]; 6810 const POST_TYPE_LABELS = { 6811 [TEMPLATE_POST_TYPE]: (0,external_wp_i18n_namespaceObject.__)('Template'), 6812 [TEMPLATE_PART_POST_TYPE]: (0,external_wp_i18n_namespaceObject.__)('Template part'), 6813 [PATTERN_TYPES.user]: (0,external_wp_i18n_namespaceObject.__)('Pattern'), 6814 [NAVIGATION_POST_TYPE]: (0,external_wp_i18n_namespaceObject.__)('Navigation') 6815 }; 6816 6817 // DataViews constants 6818 const LAYOUT_GRID = 'grid'; 6819 const LAYOUT_TABLE = 'table'; 6820 const LAYOUT_LIST = 'list'; 6821 const OPERATOR_IS = 'is'; 6822 const OPERATOR_IS_NOT = 'isNot'; 6823 const OPERATOR_IS_ANY = 'isAny'; 6824 const OPERATOR_IS_NONE = 'isNone'; 6825 6826 ;// ./node_modules/@wordpress/edit-site/build-module/store/actions.js 6827 /** 6828 * WordPress dependencies 6829 */ 6830 6831 6832 6833 6834 6835 6836 6837 /** 6838 * Internal dependencies 6839 */ 6840 6841 6842 const { 6843 interfaceStore 6844 } = unlock(external_wp_editor_namespaceObject.privateApis); 6845 6846 /** 6847 * Dispatches an action that toggles a feature flag. 6848 * 6849 * @param {string} featureName Feature name. 6850 */ 6851 function toggleFeature(featureName) { 6852 return function ({ 6853 registry 6854 }) { 6855 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).toggleFeature( featureName )", { 6856 since: '6.0', 6857 alternative: "dispatch( 'core/preferences').toggle( 'core/edit-site', featureName )" 6858 }); 6859 registry.dispatch(external_wp_preferences_namespaceObject.store).toggle('core/edit-site', featureName); 6860 }; 6861 } 6862 6863 /** 6864 * Action that changes the width of the editing canvas. 6865 * 6866 * @deprecated 6867 * 6868 * @param {string} deviceType 6869 * 6870 * @return {Object} Action object. 6871 */ 6872 const __experimentalSetPreviewDeviceType = deviceType => ({ 6873 registry 6874 }) => { 6875 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).__experimentalSetPreviewDeviceType", { 6876 since: '6.5', 6877 version: '6.7', 6878 hint: 'registry.dispatch( editorStore ).setDeviceType' 6879 }); 6880 registry.dispatch(external_wp_editor_namespaceObject.store).setDeviceType(deviceType); 6881 }; 6882 6883 /** 6884 * Action that sets a template, optionally fetching it from REST API. 6885 * 6886 * @return {Object} Action object. 6887 */ 6888 function setTemplate() { 6889 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setTemplate", { 6890 since: '6.5', 6891 version: '6.8', 6892 hint: 'The setTemplate is not needed anymore, the correct entity is resolved from the URL automatically.' 6893 }); 6894 return { 6895 type: 'NOTHING' 6896 }; 6897 } 6898 6899 /** 6900 * Action that adds a new template and sets it as the current template. 6901 * 6902 * @param {Object} template The template. 6903 * 6904 * @deprecated 6905 * 6906 * @return {Object} Action object used to set the current template. 6907 */ 6908 const addTemplate = template => async ({ 6909 dispatch, 6910 registry 6911 }) => { 6912 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).addTemplate", { 6913 since: '6.5', 6914 version: '6.8', 6915 hint: 'use saveEntityRecord directly' 6916 }); 6917 const newTemplate = await registry.dispatch(external_wp_coreData_namespaceObject.store).saveEntityRecord('postType', TEMPLATE_POST_TYPE, template); 6918 if (template.content) { 6919 registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', TEMPLATE_POST_TYPE, newTemplate.id, { 6920 blocks: (0,external_wp_blocks_namespaceObject.parse)(template.content) 6921 }, { 6922 undoIgnore: true 6923 }); 6924 } 6925 dispatch({ 6926 type: 'SET_EDITED_POST', 6927 postType: TEMPLATE_POST_TYPE, 6928 id: newTemplate.id 6929 }); 6930 }; 6931 6932 /** 6933 * Action that removes a template. 6934 * 6935 * @param {Object} template The template object. 6936 */ 6937 const removeTemplate = template => ({ 6938 registry 6939 }) => { 6940 return unlock(registry.dispatch(external_wp_editor_namespaceObject.store)).removeTemplates([template]); 6941 }; 6942 6943 /** 6944 * Action that sets a template part. 6945 * 6946 * @deprecated 6947 * @param {string} templatePartId The template part ID. 6948 * 6949 * @return {Object} Action object. 6950 */ 6951 function setTemplatePart(templatePartId) { 6952 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setTemplatePart", { 6953 since: '6.8' 6954 }); 6955 return { 6956 type: 'SET_EDITED_POST', 6957 postType: TEMPLATE_PART_POST_TYPE, 6958 id: templatePartId 6959 }; 6960 } 6961 6962 /** 6963 * Action that sets a navigation menu. 6964 * 6965 * @deprecated 6966 * @param {string} navigationMenuId The Navigation Menu Post ID. 6967 * 6968 * @return {Object} Action object. 6969 */ 6970 function setNavigationMenu(navigationMenuId) { 6971 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setNavigationMenu", { 6972 since: '6.8' 6973 }); 6974 return { 6975 type: 'SET_EDITED_POST', 6976 postType: NAVIGATION_POST_TYPE, 6977 id: navigationMenuId 6978 }; 6979 } 6980 6981 /** 6982 * Action that sets an edited entity. 6983 * 6984 * @deprecated 6985 * @param {string} postType The entity's post type. 6986 * @param {string} postId The entity's ID. 6987 * @param {Object} context The entity's context. 6988 * 6989 * @return {Object} Action object. 6990 */ 6991 function setEditedEntity(postType, postId, context) { 6992 return { 6993 type: 'SET_EDITED_POST', 6994 postType, 6995 id: postId, 6996 context 6997 }; 6998 } 6999 7000 /** 7001 * @deprecated 7002 */ 7003 function setHomeTemplateId() { 7004 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setHomeTemplateId", { 7005 since: '6.2', 7006 version: '6.4' 7007 }); 7008 return { 7009 type: 'NOTHING' 7010 }; 7011 } 7012 7013 /** 7014 * Set's the current block editor context. 7015 * 7016 * @deprecated 7017 * @param {Object} context The context object. 7018 * 7019 * @return {Object} Action object. 7020 */ 7021 function setEditedPostContext(context) { 7022 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setEditedPostContext", { 7023 since: '6.8' 7024 }); 7025 return { 7026 type: 'SET_EDITED_POST_CONTEXT', 7027 context 7028 }; 7029 } 7030 7031 /** 7032 * Resolves the template for a page and displays both. If no path is given, attempts 7033 * to use the postId to generate a path like `?p=${ postId }`. 7034 * 7035 * @deprecated 7036 * 7037 * @return {Object} Action object. 7038 */ 7039 function setPage() { 7040 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setPage", { 7041 since: '6.5', 7042 version: '6.8', 7043 hint: 'The setPage is not needed anymore, the correct entity is resolved from the URL automatically.' 7044 }); 7045 return { 7046 type: 'NOTHING' 7047 }; 7048 } 7049 7050 /** 7051 * Action that sets the active navigation panel menu. 7052 * 7053 * @deprecated 7054 * 7055 * @return {Object} Action object. 7056 */ 7057 function setNavigationPanelActiveMenu() { 7058 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setNavigationPanelActiveMenu", { 7059 since: '6.2', 7060 version: '6.4' 7061 }); 7062 return { 7063 type: 'NOTHING' 7064 }; 7065 } 7066 7067 /** 7068 * Opens the navigation panel and sets its active menu at the same time. 7069 * 7070 * @deprecated 7071 */ 7072 function openNavigationPanelToMenu() { 7073 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).openNavigationPanelToMenu", { 7074 since: '6.2', 7075 version: '6.4' 7076 }); 7077 return { 7078 type: 'NOTHING' 7079 }; 7080 } 7081 7082 /** 7083 * Sets whether the navigation panel should be open. 7084 * 7085 * @deprecated 7086 */ 7087 function setIsNavigationPanelOpened() { 7088 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setIsNavigationPanelOpened", { 7089 since: '6.2', 7090 version: '6.4' 7091 }); 7092 return { 7093 type: 'NOTHING' 7094 }; 7095 } 7096 7097 /** 7098 * Returns an action object used to open/close the inserter. 7099 * 7100 * @deprecated 7101 * 7102 * @param {boolean|Object} value Whether the inserter should be opened (true) or closed (false). 7103 */ 7104 const setIsInserterOpened = value => ({ 7105 registry 7106 }) => { 7107 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setIsInserterOpened", { 7108 since: '6.5', 7109 alternative: "dispatch( 'core/editor').setIsInserterOpened" 7110 }); 7111 registry.dispatch(external_wp_editor_namespaceObject.store).setIsInserterOpened(value); 7112 }; 7113 7114 /** 7115 * Returns an action object used to open/close the list view. 7116 * 7117 * @deprecated 7118 * 7119 * @param {boolean} isOpen A boolean representing whether the list view should be opened or closed. 7120 */ 7121 const setIsListViewOpened = isOpen => ({ 7122 registry 7123 }) => { 7124 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setIsListViewOpened", { 7125 since: '6.5', 7126 alternative: "dispatch( 'core/editor').setIsListViewOpened" 7127 }); 7128 registry.dispatch(external_wp_editor_namespaceObject.store).setIsListViewOpened(isOpen); 7129 }; 7130 7131 /** 7132 * Returns an action object used to update the settings. 7133 * 7134 * @param {Object} settings New settings. 7135 * 7136 * @return {Object} Action object. 7137 */ 7138 function updateSettings(settings) { 7139 return { 7140 type: 'UPDATE_SETTINGS', 7141 settings 7142 }; 7143 } 7144 7145 /** 7146 * Sets whether the save view panel should be open. 7147 * 7148 * @param {boolean} isOpen If true, opens the save view. If false, closes it. 7149 * It does not toggle the state, but sets it directly. 7150 */ 7151 function setIsSaveViewOpened(isOpen) { 7152 return { 7153 type: 'SET_IS_SAVE_VIEW_OPENED', 7154 isOpen 7155 }; 7156 } 7157 7158 /** 7159 * Reverts a template to its original theme-provided file. 7160 * 7161 * @param {Object} template The template to revert. 7162 * @param {Object} [options] 7163 * @param {boolean} [options.allowUndo] Whether to allow the user to undo 7164 * reverting the template. Default true. 7165 */ 7166 const revertTemplate = (template, options) => ({ 7167 registry 7168 }) => { 7169 return unlock(registry.dispatch(external_wp_editor_namespaceObject.store)).revertTemplate(template, options); 7170 }; 7171 7172 /** 7173 * Action that opens an editor sidebar. 7174 * 7175 * @param {?string} name Sidebar name to be opened. 7176 */ 7177 const openGeneralSidebar = name => ({ 7178 registry 7179 }) => { 7180 registry.dispatch(interfaceStore).enableComplementaryArea('core', name); 7181 }; 7182 7183 /** 7184 * Action that closes the sidebar. 7185 */ 7186 const closeGeneralSidebar = () => ({ 7187 registry 7188 }) => { 7189 registry.dispatch(interfaceStore).disableComplementaryArea('core'); 7190 }; 7191 7192 /** 7193 * Triggers an action used to switch editor mode. 7194 * 7195 * @deprecated 7196 * 7197 * @param {string} mode The editor mode. 7198 */ 7199 const switchEditorMode = mode => ({ 7200 registry 7201 }) => { 7202 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).switchEditorMode", { 7203 since: '6.6', 7204 alternative: "dispatch( 'core/editor').switchEditorMode" 7205 }); 7206 registry.dispatch(external_wp_editor_namespaceObject.store).switchEditorMode(mode); 7207 }; 7208 7209 /** 7210 * Sets whether or not the editor allows only page content to be edited. 7211 * 7212 * @param {boolean} hasPageContentFocus True to allow only page content to be 7213 * edited, false to allow template to be 7214 * edited. 7215 */ 7216 const setHasPageContentFocus = hasPageContentFocus => ({ 7217 dispatch, 7218 registry 7219 }) => { 7220 external_wp_deprecated_default()(`dispatch( 'core/edit-site' ).setHasPageContentFocus`, { 7221 since: '6.5' 7222 }); 7223 if (hasPageContentFocus) { 7224 registry.dispatch(external_wp_blockEditor_namespaceObject.store).clearSelectedBlock(); 7225 } 7226 dispatch({ 7227 type: 'SET_HAS_PAGE_CONTENT_FOCUS', 7228 hasPageContentFocus 7229 }); 7230 }; 7231 7232 /** 7233 * Action that toggles Distraction free mode. 7234 * Distraction free mode expects there are no sidebars, as due to the 7235 * z-index values set, you can't close sidebars. 7236 * 7237 * @deprecated 7238 */ 7239 const toggleDistractionFree = () => ({ 7240 registry 7241 }) => { 7242 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).toggleDistractionFree", { 7243 since: '6.6', 7244 alternative: "dispatch( 'core/editor').toggleDistractionFree" 7245 }); 7246 registry.dispatch(external_wp_editor_namespaceObject.store).toggleDistractionFree(); 7247 }; 7248 7249 ;// ./node_modules/@wordpress/edit-site/build-module/store/private-actions.js 7250 /** 7251 * Action that switches the editor canvas container view. 7252 * 7253 * @param {?string} view Editor canvas container view. 7254 */ 7255 const setEditorCanvasContainerView = view => ({ 7256 dispatch 7257 }) => { 7258 dispatch({ 7259 type: 'SET_EDITOR_CANVAS_CONTAINER_VIEW', 7260 view 7261 }); 7262 }; 7263 function registerRoute(route) { 7264 return { 7265 type: 'REGISTER_ROUTE', 7266 route 7267 }; 7268 } 7269 function unregisterRoute(name) { 7270 return { 7271 type: 'UNREGISTER_ROUTE', 7272 name 7273 }; 7274 } 7275 7276 ;// ./node_modules/@wordpress/edit-site/build-module/utils/get-filtered-template-parts.js 7277 /** 7278 * WordPress dependencies 7279 */ 7280 7281 const EMPTY_ARRAY = []; 7282 7283 /** 7284 * Get a flattened and filtered list of template parts and the matching block for that template part. 7285 * 7286 * Takes a list of blocks defined within a template, and a list of template parts, and returns a 7287 * flattened list of template parts and the matching block for that template part. 7288 * 7289 * @param {Array} blocks Blocks to flatten. 7290 * @param {?Array} templateParts Available template parts. 7291 * @return {Array} An array of template parts and their blocks. 7292 */ 7293 function getFilteredTemplatePartBlocks(blocks = EMPTY_ARRAY, templateParts) { 7294 const templatePartsById = templateParts ? 7295 // Key template parts by their ID. 7296 templateParts.reduce((newTemplateParts, part) => ({ 7297 ...newTemplateParts, 7298 [part.id]: part 7299 }), {}) : {}; 7300 const result = []; 7301 7302 // Iterate over all blocks, recursing into inner blocks. 7303 // Output will be based on a depth-first traversal. 7304 const stack = [...blocks]; 7305 while (stack.length) { 7306 const { 7307 innerBlocks, 7308 ...block 7309 } = stack.shift(); 7310 // Place inner blocks at the beginning of the stack to preserve order. 7311 stack.unshift(...innerBlocks); 7312 if ((0,external_wp_blocks_namespaceObject.isTemplatePart)(block)) { 7313 const { 7314 attributes: { 7315 theme, 7316 slug 7317 } 7318 } = block; 7319 const templatePartId = `$theme}//${slug}`; 7320 const templatePart = templatePartsById[templatePartId]; 7321 7322 // Only add to output if the found template part block is in the list of available template parts. 7323 if (templatePart) { 7324 result.push({ 7325 templatePart, 7326 block 7327 }); 7328 } 7329 } 7330 } 7331 return result; 7332 } 7333 7334 ;// ./node_modules/@wordpress/edit-site/build-module/store/selectors.js 7335 /** 7336 * WordPress dependencies 7337 */ 7338 7339 7340 7341 7342 7343 7344 7345 7346 /** 7347 * Internal dependencies 7348 */ 7349 7350 7351 7352 7353 /** 7354 * @typedef {'template'|'template_type'} TemplateType Template type. 7355 */ 7356 7357 /** 7358 * Returns whether the given feature is enabled or not. 7359 * 7360 * @deprecated 7361 * @param {Object} state Global application state. 7362 * @param {string} featureName Feature slug. 7363 * 7364 * @return {boolean} Is active. 7365 */ 7366 const isFeatureActive = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (_, featureName) => { 7367 external_wp_deprecated_default()(`select( 'core/edit-site' ).isFeatureActive`, { 7368 since: '6.0', 7369 alternative: `select( 'core/preferences' ).get` 7370 }); 7371 return !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', featureName); 7372 }); 7373 7374 /** 7375 * Returns the current editing canvas device type. 7376 * 7377 * @deprecated 7378 * 7379 * @param {Object} state Global application state. 7380 * 7381 * @return {string} Device type. 7382 */ 7383 const __experimentalGetPreviewDeviceType = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 7384 external_wp_deprecated_default()(`select( 'core/edit-site' ).__experimentalGetPreviewDeviceType`, { 7385 since: '6.5', 7386 version: '6.7', 7387 alternative: `select( 'core/editor' ).getDeviceType` 7388 }); 7389 return select(external_wp_editor_namespaceObject.store).getDeviceType(); 7390 }); 7391 7392 /** 7393 * Returns whether the current user can create media or not. 7394 * 7395 * @param {Object} state Global application state. 7396 * 7397 * @return {Object} Whether the current user can create media or not. 7398 */ 7399 const getCanUserCreateMedia = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 7400 external_wp_deprecated_default()(`wp.data.select( 'core/edit-site' ).getCanUserCreateMedia()`, { 7401 since: '6.7', 7402 alternative: `wp.data.select( 'core' ).canUser( 'create', { kind: 'root', type: 'media' } )` 7403 }); 7404 return select(external_wp_coreData_namespaceObject.store).canUser('create', 'media'); 7405 }); 7406 7407 /** 7408 * Returns any available Reusable blocks. 7409 * 7410 * @param {Object} state Global application state. 7411 * 7412 * @return {Array} The available reusable blocks. 7413 */ 7414 const getReusableBlocks = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 7415 external_wp_deprecated_default()(`select( 'core/edit-site' ).getReusableBlocks()`, { 7416 since: '6.5', 7417 version: '6.8', 7418 alternative: `select( 'core/core' ).getEntityRecords( 'postType', 'wp_block' )` 7419 }); 7420 const isWeb = external_wp_element_namespaceObject.Platform.OS === 'web'; 7421 return isWeb ? select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_block', { 7422 per_page: -1 7423 }) : []; 7424 }); 7425 7426 /** 7427 * Returns the site editor settings. 7428 * 7429 * @param {Object} state Global application state. 7430 * 7431 * @return {Object} Settings. 7432 */ 7433 function getSettings(state) { 7434 // It is important that we don't inject anything into these settings locally. 7435 // The reason for this is that we have an effect in place that calls setSettings based on the previous value of getSettings. 7436 // If we add computed settings here, we'll be adding these computed settings to the state which is very unexpected. 7437 return state.settings; 7438 } 7439 7440 /** 7441 * @deprecated 7442 */ 7443 function getHomeTemplateId() { 7444 external_wp_deprecated_default()("select( 'core/edit-site' ).getHomeTemplateId", { 7445 since: '6.2', 7446 version: '6.4' 7447 }); 7448 } 7449 7450 /** 7451 * Returns the current edited post type (wp_template or wp_template_part). 7452 * 7453 * @deprecated 7454 * @param {Object} state Global application state. 7455 * 7456 * @return {?TemplateType} Template type. 7457 */ 7458 function getEditedPostType(state) { 7459 external_wp_deprecated_default()("select( 'core/edit-site' ).getEditedPostType", { 7460 since: '6.8', 7461 alternative: "select( 'core/editor' ).getCurrentPostType" 7462 }); 7463 return state.editedPost.postType; 7464 } 7465 7466 /** 7467 * Returns the ID of the currently edited template or template part. 7468 * 7469 * @deprecated 7470 * @param {Object} state Global application state. 7471 * 7472 * @return {?string} Post ID. 7473 */ 7474 function getEditedPostId(state) { 7475 external_wp_deprecated_default()("select( 'core/edit-site' ).getEditedPostId", { 7476 since: '6.8', 7477 alternative: "select( 'core/editor' ).getCurrentPostId" 7478 }); 7479 return state.editedPost.id; 7480 } 7481 7482 /** 7483 * Returns the edited post's context object. 7484 * 7485 * @deprecated 7486 * @param {Object} state Global application state. 7487 * 7488 * @return {Object} Page. 7489 */ 7490 function getEditedPostContext(state) { 7491 external_wp_deprecated_default()("select( 'core/edit-site' ).getEditedPostContext", { 7492 since: '6.8' 7493 }); 7494 return state.editedPost.context; 7495 } 7496 7497 /** 7498 * Returns the current page object. 7499 * 7500 * @deprecated 7501 * @param {Object} state Global application state. 7502 * 7503 * @return {Object} Page. 7504 */ 7505 function getPage(state) { 7506 external_wp_deprecated_default()("select( 'core/edit-site' ).getPage", { 7507 since: '6.8' 7508 }); 7509 return { 7510 context: state.editedPost.context 7511 }; 7512 } 7513 7514 /** 7515 * Returns true if the inserter is opened. 7516 * 7517 * @deprecated 7518 * 7519 * @param {Object} state Global application state. 7520 * 7521 * @return {boolean} Whether the inserter is opened. 7522 */ 7523 const isInserterOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 7524 external_wp_deprecated_default()(`select( 'core/edit-site' ).isInserterOpened`, { 7525 since: '6.5', 7526 alternative: `select( 'core/editor' ).isInserterOpened` 7527 }); 7528 return select(external_wp_editor_namespaceObject.store).isInserterOpened(); 7529 }); 7530 7531 /** 7532 * Get the insertion point for the inserter. 7533 * 7534 * @deprecated 7535 * 7536 * @param {Object} state Global application state. 7537 * 7538 * @return {Object} The root client ID, index to insert at and starting filter value. 7539 */ 7540 const __experimentalGetInsertionPoint = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 7541 external_wp_deprecated_default()(`select( 'core/edit-site' ).__experimentalGetInsertionPoint`, { 7542 since: '6.5', 7543 version: '6.7' 7544 }); 7545 return unlock(select(external_wp_editor_namespaceObject.store)).getInserter(); 7546 }); 7547 7548 /** 7549 * Returns true if the list view is opened. 7550 * 7551 * @param {Object} state Global application state. 7552 * 7553 * @return {boolean} Whether the list view is opened. 7554 */ 7555 const isListViewOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 7556 external_wp_deprecated_default()(`select( 'core/edit-site' ).isListViewOpened`, { 7557 since: '6.5', 7558 alternative: `select( 'core/editor' ).isListViewOpened` 7559 }); 7560 return select(external_wp_editor_namespaceObject.store).isListViewOpened(); 7561 }); 7562 7563 /** 7564 * Returns the current opened/closed state of the save panel. 7565 * 7566 * @param {Object} state Global application state. 7567 * 7568 * @return {boolean} True if the save panel should be open; false if closed. 7569 */ 7570 function isSaveViewOpened(state) { 7571 return state.saveViewPanel; 7572 } 7573 function getBlocksAndTemplateParts(select) { 7574 const templateParts = select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', TEMPLATE_PART_POST_TYPE, { 7575 per_page: -1 7576 }); 7577 const { 7578 getBlocksByName, 7579 getBlocksByClientId 7580 } = select(external_wp_blockEditor_namespaceObject.store); 7581 const clientIds = getBlocksByName('core/template-part'); 7582 const blocks = getBlocksByClientId(clientIds); 7583 return [blocks, templateParts]; 7584 } 7585 7586 /** 7587 * Returns the template parts and their blocks for the current edited template. 7588 * 7589 * @deprecated 7590 * @param {Object} state Global application state. 7591 * @return {Array} Template parts and their blocks in an array. 7592 */ 7593 const getCurrentTemplateTemplateParts = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)(() => { 7594 external_wp_deprecated_default()(`select( 'core/edit-site' ).getCurrentTemplateTemplateParts()`, { 7595 since: '6.7', 7596 version: '6.9', 7597 alternative: `select( 'core/block-editor' ).getBlocksByName( 'core/template-part' )` 7598 }); 7599 return getFilteredTemplatePartBlocks(...getBlocksAndTemplateParts(select)); 7600 }, () => getBlocksAndTemplateParts(select))); 7601 7602 /** 7603 * Returns the current editing mode. 7604 * 7605 * @param {Object} state Global application state. 7606 * 7607 * @return {string} Editing mode. 7608 */ 7609 const getEditorMode = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 7610 return select(external_wp_preferences_namespaceObject.store).get('core', 'editorMode'); 7611 }); 7612 7613 /** 7614 * @deprecated 7615 */ 7616 function getCurrentTemplateNavigationPanelSubMenu() { 7617 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu", { 7618 since: '6.2', 7619 version: '6.4' 7620 }); 7621 } 7622 7623 /** 7624 * @deprecated 7625 */ 7626 function getNavigationPanelActiveMenu() { 7627 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu", { 7628 since: '6.2', 7629 version: '6.4' 7630 }); 7631 } 7632 7633 /** 7634 * @deprecated 7635 */ 7636 function isNavigationOpened() { 7637 external_wp_deprecated_default()("dispatch( 'core/edit-site' ).isNavigationOpened", { 7638 since: '6.2', 7639 version: '6.4' 7640 }); 7641 } 7642 7643 /** 7644 * Whether or not the editor has a page loaded into it. 7645 * 7646 * @see setPage 7647 * @deprecated 7648 * @param {Object} state Global application state. 7649 * 7650 * @return {boolean} Whether or not the editor has a page loaded into it. 7651 */ 7652 function isPage(state) { 7653 external_wp_deprecated_default()("select( 'core/edit-site' ).isPage", { 7654 since: '6.8', 7655 alternative: "select( 'core/editor' ).getCurrentPostType" 7656 }); 7657 return !!state.editedPost.context?.postId; 7658 } 7659 7660 /** 7661 * Whether or not the editor allows only page content to be edited. 7662 * 7663 * @deprecated 7664 * 7665 * @return {boolean} Whether or not focus is on editing page content. 7666 */ 7667 function hasPageContentFocus() { 7668 external_wp_deprecated_default()(`select( 'core/edit-site' ).hasPageContentFocus`, { 7669 since: '6.5' 7670 }); 7671 return false; 7672 } 7673 7674 ;// ./node_modules/@wordpress/edit-site/build-module/store/private-selectors.js 7675 /** 7676 * Returns the editor canvas container view. 7677 * 7678 * @param {Object} state Global application state. 7679 * 7680 * @return {string} Editor canvas container view. 7681 */ 7682 function getEditorCanvasContainerView(state) { 7683 return state.editorCanvasContainerView; 7684 } 7685 function getRoutes(state) { 7686 return state.routes; 7687 } 7688 7689 ;// ./node_modules/@wordpress/edit-site/build-module/store/constants.js 7690 /** 7691 * The identifier for the data store. 7692 * 7693 * @type {string} 7694 */ 7695 const STORE_NAME = 'core/edit-site'; 7696 7697 ;// ./node_modules/@wordpress/edit-site/build-module/store/index.js 7698 /** 7699 * WordPress dependencies 7700 */ 7701 7702 7703 /** 7704 * Internal dependencies 7705 */ 7706 7707 7708 7709 7710 7711 7712 7713 const storeConfig = { 7714 reducer: reducer, 7715 actions: actions_namespaceObject, 7716 selectors: selectors_namespaceObject 7717 }; 7718 const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, storeConfig); 7719 (0,external_wp_data_namespaceObject.register)(store); 7720 unlock(store).registerPrivateSelectors(private_selectors_namespaceObject); 7721 unlock(store).registerPrivateActions(private_actions_namespaceObject); 7722 7723 ;// external ["wp","router"] 7724 const external_wp_router_namespaceObject = window["wp"]["router"]; 7725 ;// ./node_modules/clsx/dist/clsx.mjs 7726 function clsx_r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=clsx_r(e[t]))&&(n&&(n+=" "),n+=f)}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=clsx_r(e))&&(n&&(n+=" "),n+=t);return n}/* harmony default export */ const dist_clsx = (clsx); 7727 ;// external ["wp","commands"] 7728 const external_wp_commands_namespaceObject = window["wp"]["commands"]; 7729 ;// external ["wp","coreCommands"] 7730 const external_wp_coreCommands_namespaceObject = window["wp"]["coreCommands"]; 7731 ;// external ["wp","plugins"] 7732 const external_wp_plugins_namespaceObject = window["wp"]["plugins"]; 7733 ;// external ["wp","htmlEntities"] 7734 const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"]; 7735 ;// external ["wp","primitives"] 7736 const external_wp_primitives_namespaceObject = window["wp"]["primitives"]; 7737 ;// ./node_modules/@wordpress/icons/build-module/library/search.js 7738 /** 7739 * WordPress dependencies 7740 */ 7741 7742 7743 const search = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 7744 xmlns: "http://www.w3.org/2000/svg", 7745 viewBox: "0 0 24 24", 7746 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 7747 d: "M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z" 7748 }) 7749 }); 7750 /* harmony default export */ const library_search = (search); 7751 7752 ;// external ["wp","keycodes"] 7753 const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"]; 7754 ;// external ["wp","url"] 7755 const external_wp_url_namespaceObject = window["wp"]["url"]; 7756 ;// ./node_modules/@wordpress/icons/build-module/library/wordpress.js 7757 /** 7758 * WordPress dependencies 7759 */ 7760 7761 7762 const wordpress = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 7763 xmlns: "http://www.w3.org/2000/svg", 7764 viewBox: "-2 -2 24 24", 7765 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 7766 d: "M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z" 7767 }) 7768 }); 7769 /* harmony default export */ const library_wordpress = (wordpress); 7770 7771 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-icon/index.js 7772 /** 7773 * External dependencies 7774 */ 7775 7776 7777 /** 7778 * WordPress dependencies 7779 */ 7780 7781 7782 7783 7784 7785 7786 function SiteIcon({ 7787 className 7788 }) { 7789 const { 7790 isRequestingSite, 7791 siteIconUrl 7792 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 7793 const { 7794 getEntityRecord 7795 } = select(external_wp_coreData_namespaceObject.store); 7796 const siteData = getEntityRecord('root', '__unstableBase', undefined); 7797 return { 7798 isRequestingSite: !siteData, 7799 siteIconUrl: siteData?.site_icon_url 7800 }; 7801 }, []); 7802 if (isRequestingSite && !siteIconUrl) { 7803 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 7804 className: "edit-site-site-icon__image" 7805 }); 7806 } 7807 const icon = siteIconUrl ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 7808 className: "edit-site-site-icon__image", 7809 alt: (0,external_wp_i18n_namespaceObject.__)('Site Icon'), 7810 src: siteIconUrl 7811 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 7812 className: "edit-site-site-icon__icon", 7813 icon: library_wordpress, 7814 size: 48 7815 }); 7816 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 7817 className: dist_clsx(className, 'edit-site-site-icon'), 7818 children: icon 7819 }); 7820 } 7821 /* harmony default export */ const site_icon = (SiteIcon); 7822 7823 ;// external ["wp","dom"] 7824 const external_wp_dom_namespaceObject = window["wp"]["dom"]; 7825 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar/index.js 7826 /** 7827 * External dependencies 7828 */ 7829 7830 7831 /** 7832 * WordPress dependencies 7833 */ 7834 7835 7836 7837 const SidebarNavigationContext = (0,external_wp_element_namespaceObject.createContext)(() => {}); 7838 // Focus a sidebar element after a navigation. The element to focus is either 7839 // specified by `focusSelector` (when navigating back) or it is the first 7840 // tabbable element (usually the "Back" button). 7841 function focusSidebarElement(el, direction, focusSelector) { 7842 let elementToFocus; 7843 if (direction === 'back' && focusSelector) { 7844 elementToFocus = el.querySelector(focusSelector); 7845 } 7846 if (direction !== null && !elementToFocus) { 7847 const [firstTabbable] = external_wp_dom_namespaceObject.focus.tabbable.find(el); 7848 elementToFocus = firstTabbable !== null && firstTabbable !== void 0 ? firstTabbable : el; 7849 } 7850 elementToFocus?.focus(); 7851 } 7852 7853 // Navigation state that is updated when navigating back or forward. Helps us 7854 // manage the animations and also focus. 7855 function createNavState() { 7856 let state = { 7857 direction: null, 7858 focusSelector: null 7859 }; 7860 return { 7861 get() { 7862 return state; 7863 }, 7864 navigate(direction, focusSelector = null) { 7865 state = { 7866 direction, 7867 focusSelector: direction === 'forward' && focusSelector ? focusSelector : state.focusSelector 7868 }; 7869 } 7870 }; 7871 } 7872 function SidebarContentWrapper({ 7873 children, 7874 shouldAnimate 7875 }) { 7876 const navState = (0,external_wp_element_namespaceObject.useContext)(SidebarNavigationContext); 7877 const wrapperRef = (0,external_wp_element_namespaceObject.useRef)(); 7878 const [navAnimation, setNavAnimation] = (0,external_wp_element_namespaceObject.useState)(null); 7879 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { 7880 const { 7881 direction, 7882 focusSelector 7883 } = navState.get(); 7884 focusSidebarElement(wrapperRef.current, direction, focusSelector); 7885 setNavAnimation(direction); 7886 }, [navState]); 7887 const wrapperCls = dist_clsx('edit-site-sidebar__screen-wrapper', 7888 /* 7889 * Some panes do not have sub-panes and therefore 7890 * should not animate when clicked on. 7891 */ 7892 shouldAnimate ? { 7893 'slide-from-left': navAnimation === 'back', 7894 'slide-from-right': navAnimation === 'forward' 7895 } : {}); 7896 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 7897 ref: wrapperRef, 7898 className: wrapperCls, 7899 children: children 7900 }); 7901 } 7902 function SidebarNavigationProvider({ 7903 children 7904 }) { 7905 const [navState] = (0,external_wp_element_namespaceObject.useState)(createNavState); 7906 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationContext.Provider, { 7907 value: navState, 7908 children: children 7909 }); 7910 } 7911 function SidebarContent({ 7912 routeKey, 7913 shouldAnimate, 7914 children 7915 }) { 7916 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 7917 className: "edit-site-sidebar__content", 7918 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarContentWrapper, { 7919 shouldAnimate: shouldAnimate, 7920 children: children 7921 }, routeKey) 7922 }); 7923 } 7924 7925 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-hub/index.js 7926 /** 7927 * External dependencies 7928 */ 7929 7930 7931 /** 7932 * WordPress dependencies 7933 */ 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 /** 7947 * Internal dependencies 7948 */ 7949 7950 7951 7952 7953 7954 const { 7955 useLocation, 7956 useHistory 7957 } = unlock(external_wp_router_namespaceObject.privateApis); 7958 const SiteHub = (0,external_wp_element_namespaceObject.memo)((0,external_wp_element_namespaceObject.forwardRef)(({ 7959 isTransparent 7960 }, ref) => { 7961 const { 7962 dashboardLink, 7963 homeUrl, 7964 siteTitle 7965 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 7966 const { 7967 getSettings 7968 } = unlock(select(store)); 7969 const { 7970 getEntityRecord 7971 } = select(external_wp_coreData_namespaceObject.store); 7972 const _site = getEntityRecord('root', 'site'); 7973 return { 7974 dashboardLink: getSettings().__experimentalDashboardLink, 7975 homeUrl: getEntityRecord('root', '__unstableBase')?.home, 7976 siteTitle: !_site?.title && !!_site?.url ? (0,external_wp_url_namespaceObject.filterURLForDisplay)(_site?.url) : _site?.title 7977 }; 7978 }, []); 7979 const { 7980 open: openCommandCenter 7981 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_commands_namespaceObject.store); 7982 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 7983 className: "edit-site-site-hub", 7984 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 7985 justify: "flex-start", 7986 spacing: "0", 7987 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 7988 className: dist_clsx('edit-site-site-hub__view-mode-toggle-container', { 7989 'has-transparent-background': isTransparent 7990 }), 7991 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 7992 __next40pxDefaultSize: true, 7993 ref: ref, 7994 href: dashboardLink, 7995 label: (0,external_wp_i18n_namespaceObject.__)('Go to the Dashboard'), 7996 className: "edit-site-layout__view-mode-toggle", 7997 style: { 7998 transform: 'scale(0.5333) translateX(-4px)', 7999 // Offset to position the icon 12px from viewport edge 8000 borderRadius: 4 8001 }, 8002 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(site_icon, { 8003 className: "edit-site-layout__view-mode-toggle-icon" 8004 }) 8005 }) 8006 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 8007 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 8008 className: "edit-site-site-hub__title", 8009 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Button, { 8010 __next40pxDefaultSize: true, 8011 variant: "link", 8012 href: homeUrl, 8013 target: "_blank", 8014 children: [(0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { 8015 as: "span", 8016 children: /* translators: accessibility text */ 8017 (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)') 8018 })] 8019 }) 8020 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 8021 spacing: 0, 8022 expanded: false, 8023 className: "edit-site-site-hub__actions", 8024 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 8025 size: "compact", 8026 className: "edit-site-site-hub_toggle-command-center", 8027 icon: library_search, 8028 onClick: () => openCommandCenter(), 8029 label: (0,external_wp_i18n_namespaceObject.__)('Open command palette'), 8030 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('k') 8031 }) 8032 })] 8033 })] 8034 }) 8035 }); 8036 })); 8037 /* harmony default export */ const site_hub = (SiteHub); 8038 const SiteHubMobile = (0,external_wp_element_namespaceObject.memo)((0,external_wp_element_namespaceObject.forwardRef)(({ 8039 isTransparent 8040 }, ref) => { 8041 const { 8042 path 8043 } = useLocation(); 8044 const history = useHistory(); 8045 const { 8046 navigate 8047 } = (0,external_wp_element_namespaceObject.useContext)(SidebarNavigationContext); 8048 const { 8049 dashboardLink, 8050 homeUrl, 8051 siteTitle, 8052 isBlockTheme, 8053 isClassicThemeWithStyleBookSupport 8054 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 8055 const { 8056 getSettings 8057 } = unlock(select(store)); 8058 const { 8059 getEntityRecord, 8060 getCurrentTheme 8061 } = select(external_wp_coreData_namespaceObject.store); 8062 const _site = getEntityRecord('root', 'site'); 8063 const currentTheme = getCurrentTheme(); 8064 const settings = getSettings(); 8065 const supportsEditorStyles = currentTheme.theme_supports['editor-styles']; 8066 // This is a temp solution until the has_theme_json value is available for the current theme. 8067 const hasThemeJson = settings.supportsLayout; 8068 return { 8069 dashboardLink: settings.__experimentalDashboardLink, 8070 homeUrl: getEntityRecord('root', '__unstableBase')?.home, 8071 siteTitle: !_site?.title && !!_site?.url ? (0,external_wp_url_namespaceObject.filterURLForDisplay)(_site?.url) : _site?.title, 8072 isBlockTheme: currentTheme?.is_block_theme, 8073 isClassicThemeWithStyleBookSupport: !currentTheme?.is_block_theme && (supportsEditorStyles || hasThemeJson) 8074 }; 8075 }, []); 8076 const { 8077 open: openCommandCenter 8078 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_commands_namespaceObject.store); 8079 let backPath; 8080 8081 // If the current path is not the root page, find a page to back to. 8082 if (path !== '/') { 8083 if (isBlockTheme || isClassicThemeWithStyleBookSupport) { 8084 // If the current theme is a block theme or a classic theme that supports StyleBook, 8085 // back to the Design screen. 8086 backPath = '/'; 8087 } else if (path !== '/pattern') { 8088 // If the current theme is a classic theme that does not support StyleBook, 8089 // back to the Patterns page. 8090 backPath = '/pattern'; 8091 } 8092 } 8093 const backButtonProps = { 8094 href: !!backPath ? undefined : dashboardLink, 8095 label: !!backPath ? (0,external_wp_i18n_namespaceObject.__)('Go to Site Editor') : (0,external_wp_i18n_namespaceObject.__)('Go to the Dashboard'), 8096 onClick: !!backPath ? () => { 8097 history.navigate(backPath); 8098 navigate('back'); 8099 } : undefined 8100 }; 8101 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 8102 className: "edit-site-site-hub", 8103 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 8104 justify: "flex-start", 8105 spacing: "0", 8106 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 8107 className: dist_clsx('edit-site-site-hub__view-mode-toggle-container', { 8108 'has-transparent-background': isTransparent 8109 }), 8110 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 8111 __next40pxDefaultSize: true, 8112 ref: ref, 8113 className: "edit-site-layout__view-mode-toggle", 8114 style: { 8115 transform: 'scale(0.5)', 8116 borderRadius: 4 8117 }, 8118 ...backButtonProps, 8119 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(site_icon, { 8120 className: "edit-site-layout__view-mode-toggle-icon" 8121 }) 8122 }) 8123 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 8124 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 8125 className: "edit-site-site-hub__title", 8126 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 8127 __next40pxDefaultSize: true, 8128 variant: "link", 8129 href: homeUrl, 8130 target: "_blank", 8131 label: (0,external_wp_i18n_namespaceObject.__)('View site (opens in a new tab)'), 8132 children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle) 8133 }) 8134 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 8135 spacing: 0, 8136 expanded: false, 8137 className: "edit-site-site-hub__actions", 8138 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 8139 __next40pxDefaultSize: true, 8140 className: "edit-site-site-hub_toggle-command-center", 8141 icon: library_search, 8142 onClick: () => openCommandCenter(), 8143 label: (0,external_wp_i18n_namespaceObject.__)('Open command palette'), 8144 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('k') 8145 }) 8146 })] 8147 })] 8148 }) 8149 }); 8150 })); 8151 8152 ;// ./node_modules/@wordpress/edit-site/build-module/components/resizable-frame/index.js 8153 /** 8154 * External dependencies 8155 */ 8156 8157 8158 /** 8159 * WordPress dependencies 8160 */ 8161 8162 8163 8164 8165 8166 8167 8168 8169 /** 8170 * Internal dependencies 8171 */ 8172 8173 8174 8175 const { 8176 useLocation: resizable_frame_useLocation, 8177 useHistory: resizable_frame_useHistory 8178 } = unlock(external_wp_router_namespaceObject.privateApis); 8179 8180 // Removes the inline styles in the drag handles. 8181 const HANDLE_STYLES_OVERRIDE = { 8182 position: undefined, 8183 userSelect: undefined, 8184 cursor: undefined, 8185 width: undefined, 8186 height: undefined, 8187 top: undefined, 8188 right: undefined, 8189 bottom: undefined, 8190 left: undefined 8191 }; 8192 8193 // The minimum width of the frame (in px) while resizing. 8194 const FRAME_MIN_WIDTH = 320; 8195 // The reference width of the frame (in px) used to calculate the aspect ratio. 8196 const FRAME_REFERENCE_WIDTH = 1300; 8197 // 9 : 19.5 is the target aspect ratio enforced (when possible) while resizing. 8198 const FRAME_TARGET_ASPECT_RATIO = 9 / 19.5; 8199 // The minimum distance (in px) between the frame resize handle and the 8200 // viewport's edge. If the frame is resized to be closer to the viewport's edge 8201 // than this distance, then "canvas mode" will be enabled. 8202 const SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD = 200; 8203 // Default size for the `frameSize` state. 8204 const INITIAL_FRAME_SIZE = { 8205 width: '100%', 8206 height: '100%' 8207 }; 8208 function calculateNewHeight(width, initialAspectRatio) { 8209 const lerp = (a, b, amount) => { 8210 return a + (b - a) * amount; 8211 }; 8212 8213 // Calculate the intermediate aspect ratio based on the current width. 8214 const lerpFactor = 1 - Math.max(0, Math.min(1, (width - FRAME_MIN_WIDTH) / (FRAME_REFERENCE_WIDTH - FRAME_MIN_WIDTH))); 8215 8216 // Calculate the height based on the intermediate aspect ratio 8217 // ensuring the frame arrives at the target aspect ratio. 8218 const intermediateAspectRatio = lerp(initialAspectRatio, FRAME_TARGET_ASPECT_RATIO, lerpFactor); 8219 return width / intermediateAspectRatio; 8220 } 8221 function ResizableFrame({ 8222 isFullWidth, 8223 isOversized, 8224 setIsOversized, 8225 isReady, 8226 children, 8227 /** The default (unresized) width/height of the frame, based on the space available in the viewport. */ 8228 defaultSize, 8229 innerContentStyle 8230 }) { 8231 const history = resizable_frame_useHistory(); 8232 const { 8233 path, 8234 query 8235 } = resizable_frame_useLocation(); 8236 const { 8237 canvas = 'view' 8238 } = query; 8239 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); 8240 const [frameSize, setFrameSize] = (0,external_wp_element_namespaceObject.useState)(INITIAL_FRAME_SIZE); 8241 // The width of the resizable frame when a new resize gesture starts. 8242 const [startingWidth, setStartingWidth] = (0,external_wp_element_namespaceObject.useState)(); 8243 const [isResizing, setIsResizing] = (0,external_wp_element_namespaceObject.useState)(false); 8244 const [shouldShowHandle, setShouldShowHandle] = (0,external_wp_element_namespaceObject.useState)(false); 8245 const [resizeRatio, setResizeRatio] = (0,external_wp_element_namespaceObject.useState)(1); 8246 const FRAME_TRANSITION = { 8247 type: 'tween', 8248 duration: isResizing ? 0 : 0.5 8249 }; 8250 const frameRef = (0,external_wp_element_namespaceObject.useRef)(null); 8251 const resizableHandleHelpId = (0,external_wp_compose_namespaceObject.useInstanceId)(ResizableFrame, 'edit-site-resizable-frame-handle-help'); 8252 const defaultAspectRatio = defaultSize.width / defaultSize.height; 8253 const isBlockTheme = (0,external_wp_data_namespaceObject.useSelect)(select => { 8254 const { 8255 getCurrentTheme 8256 } = select(external_wp_coreData_namespaceObject.store); 8257 return getCurrentTheme()?.is_block_theme; 8258 }, []); 8259 const handleResizeStart = (_event, _direction, ref) => { 8260 // Remember the starting width so we don't have to get `ref.offsetWidth` on 8261 // every resize event thereafter, which will cause layout thrashing. 8262 setStartingWidth(ref.offsetWidth); 8263 setIsResizing(true); 8264 }; 8265 8266 // Calculate the frame size based on the window width as its resized. 8267 const handleResize = (_event, _direction, _ref, delta) => { 8268 const normalizedDelta = delta.width / resizeRatio; 8269 const deltaAbs = Math.abs(normalizedDelta); 8270 const maxDoubledDelta = delta.width < 0 // is shrinking 8271 ? deltaAbs : (defaultSize.width - startingWidth) / 2; 8272 const deltaToDouble = Math.min(deltaAbs, maxDoubledDelta); 8273 const doubleSegment = deltaAbs === 0 ? 0 : deltaToDouble / deltaAbs; 8274 const singleSegment = 1 - doubleSegment; 8275 setResizeRatio(singleSegment + doubleSegment * 2); 8276 const updatedWidth = startingWidth + delta.width; 8277 setIsOversized(updatedWidth > defaultSize.width); 8278 8279 // Width will be controlled by the library (via `resizeRatio`), 8280 // so we only need to update the height. 8281 setFrameSize({ 8282 height: isOversized ? '100%' : calculateNewHeight(updatedWidth, defaultAspectRatio) 8283 }); 8284 }; 8285 const handleResizeStop = (_event, _direction, ref) => { 8286 setIsResizing(false); 8287 if (!isOversized) { 8288 return; 8289 } 8290 setIsOversized(false); 8291 const remainingWidth = ref.ownerDocument.documentElement.offsetWidth - ref.offsetWidth; 8292 if (remainingWidth > SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD || !isBlockTheme) { 8293 // Reset the initial aspect ratio if the frame is resized slightly 8294 // above the sidebar but not far enough to trigger full screen. 8295 setFrameSize(INITIAL_FRAME_SIZE); 8296 } else { 8297 // Trigger full screen if the frame is resized far enough to the left. 8298 history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { 8299 canvas: 'edit' 8300 }), { 8301 transition: 'canvas-mode-edit-transition' 8302 }); 8303 } 8304 }; 8305 8306 // Handle resize by arrow keys 8307 const handleResizableHandleKeyDown = event => { 8308 if (!['ArrowLeft', 'ArrowRight'].includes(event.key)) { 8309 return; 8310 } 8311 event.preventDefault(); 8312 const step = 20 * (event.shiftKey ? 5 : 1); 8313 const delta = step * (event.key === 'ArrowLeft' ? 1 : -1) * ((0,external_wp_i18n_namespaceObject.isRTL)() ? -1 : 1); 8314 const newWidth = Math.min(Math.max(FRAME_MIN_WIDTH, frameRef.current.resizable.offsetWidth + delta), defaultSize.width); 8315 setFrameSize({ 8316 width: newWidth, 8317 height: calculateNewHeight(newWidth, defaultAspectRatio) 8318 }); 8319 }; 8320 const frameAnimationVariants = { 8321 default: { 8322 flexGrow: 0, 8323 height: frameSize.height 8324 }, 8325 fullWidth: { 8326 flexGrow: 1, 8327 height: frameSize.height 8328 } 8329 }; 8330 const resizeHandleVariants = { 8331 hidden: { 8332 opacity: 0, 8333 ...((0,external_wp_i18n_namespaceObject.isRTL)() ? { 8334 right: 0 8335 } : { 8336 left: 0 8337 }) 8338 }, 8339 visible: { 8340 opacity: 1, 8341 // Account for the handle's width. 8342 ...((0,external_wp_i18n_namespaceObject.isRTL)() ? { 8343 right: -14 8344 } : { 8345 left: -14 8346 }) 8347 }, 8348 active: { 8349 opacity: 1, 8350 // Account for the handle's width. 8351 ...((0,external_wp_i18n_namespaceObject.isRTL)() ? { 8352 right: -14 8353 } : { 8354 left: -14 8355 }), 8356 scaleY: 1.3 8357 } 8358 }; 8359 const currentResizeHandleVariant = (() => { 8360 if (isResizing) { 8361 return 'active'; 8362 } 8363 return shouldShowHandle ? 'visible' : 'hidden'; 8364 })(); 8365 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ResizableBox, { 8366 as: external_wp_components_namespaceObject.__unstableMotion.div, 8367 ref: frameRef, 8368 initial: false, 8369 variants: frameAnimationVariants, 8370 animate: isFullWidth ? 'fullWidth' : 'default', 8371 onAnimationComplete: definition => { 8372 if (definition === 'fullWidth') { 8373 setFrameSize({ 8374 width: '100%', 8375 height: '100%' 8376 }); 8377 } 8378 }, 8379 whileHover: canvas === 'view' && isBlockTheme ? { 8380 scale: 1.005, 8381 transition: { 8382 duration: disableMotion ? 0 : 0.5, 8383 ease: 'easeOut' 8384 } 8385 } : {}, 8386 transition: FRAME_TRANSITION, 8387 size: frameSize, 8388 enable: { 8389 top: false, 8390 bottom: false, 8391 // Resizing will be disabled until the editor content is loaded. 8392 ...((0,external_wp_i18n_namespaceObject.isRTL)() ? { 8393 right: isReady, 8394 left: false 8395 } : { 8396 left: isReady, 8397 right: false 8398 }), 8399 topRight: false, 8400 bottomRight: false, 8401 bottomLeft: false, 8402 topLeft: false 8403 }, 8404 resizeRatio: resizeRatio, 8405 handleClasses: undefined, 8406 handleStyles: { 8407 left: HANDLE_STYLES_OVERRIDE, 8408 right: HANDLE_STYLES_OVERRIDE 8409 }, 8410 minWidth: FRAME_MIN_WIDTH, 8411 maxWidth: isFullWidth ? '100%' : '150%', 8412 maxHeight: "100%", 8413 onFocus: () => setShouldShowHandle(true), 8414 onBlur: () => setShouldShowHandle(false), 8415 onMouseOver: () => setShouldShowHandle(true), 8416 onMouseOut: () => setShouldShowHandle(false), 8417 handleComponent: { 8418 [(0,external_wp_i18n_namespaceObject.isRTL)() ? 'right' : 'left']: canvas === 'view' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 8419 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { 8420 text: (0,external_wp_i18n_namespaceObject.__)('Drag to resize'), 8421 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.button, { 8422 role: "separator", 8423 "aria-orientation": "vertical", 8424 className: dist_clsx('edit-site-resizable-frame__handle', { 8425 'is-resizing': isResizing 8426 }), 8427 variants: resizeHandleVariants, 8428 animate: currentResizeHandleVariant, 8429 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Drag to resize'), 8430 "aria-describedby": resizableHandleHelpId, 8431 "aria-valuenow": frameRef.current?.resizable?.offsetWidth || undefined, 8432 "aria-valuemin": FRAME_MIN_WIDTH, 8433 "aria-valuemax": defaultSize.width, 8434 onKeyDown: handleResizableHandleKeyDown, 8435 initial: "hidden", 8436 exit: "hidden", 8437 whileFocus: "active", 8438 whileHover: "active" 8439 }, "handle") 8440 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 8441 hidden: true, 8442 id: resizableHandleHelpId, 8443 children: (0,external_wp_i18n_namespaceObject.__)('Use left and right arrow keys to resize the canvas. Hold shift to resize in larger increments.') 8444 })] 8445 }) 8446 }, 8447 onResizeStart: handleResizeStart, 8448 onResize: handleResize, 8449 onResizeStop: handleResizeStop, 8450 className: dist_clsx('edit-site-resizable-frame__inner', { 8451 'is-resizing': isResizing 8452 }), 8453 showHandle: false // Do not show the default handle, as we're using a custom one. 8454 , 8455 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 8456 className: "edit-site-resizable-frame__inner-content", 8457 style: innerContentStyle, 8458 children: children 8459 }) 8460 }); 8461 } 8462 /* harmony default export */ const resizable_frame = (ResizableFrame); 8463 8464 ;// external ["wp","keyboardShortcuts"] 8465 const external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"]; 8466 ;// ./node_modules/@wordpress/edit-site/build-module/components/save-keyboard-shortcut/index.js 8467 /** 8468 * WordPress dependencies 8469 */ 8470 8471 8472 8473 8474 8475 8476 8477 /** 8478 * Internal dependencies 8479 */ 8480 8481 const shortcutName = 'core/edit-site/save'; 8482 8483 /** 8484 * Register the save keyboard shortcut in view mode. 8485 * 8486 * @return {null} Returns null. 8487 */ 8488 function SaveKeyboardShortcut() { 8489 const { 8490 __experimentalGetDirtyEntityRecords, 8491 isSavingEntityRecord 8492 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store); 8493 const { 8494 hasNonPostEntityChanges, 8495 isPostSavingLocked 8496 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_editor_namespaceObject.store); 8497 const { 8498 savePost 8499 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); 8500 const { 8501 setIsSaveViewOpened 8502 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 8503 const { 8504 registerShortcut, 8505 unregisterShortcut 8506 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store); 8507 (0,external_wp_element_namespaceObject.useEffect)(() => { 8508 registerShortcut({ 8509 name: shortcutName, 8510 category: 'global', 8511 description: (0,external_wp_i18n_namespaceObject.__)('Save your changes.'), 8512 keyCombination: { 8513 modifier: 'primary', 8514 character: 's' 8515 } 8516 }); 8517 return () => { 8518 unregisterShortcut(shortcutName); 8519 }; 8520 }, [registerShortcut, unregisterShortcut]); 8521 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/save', event => { 8522 event.preventDefault(); 8523 const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); 8524 const hasDirtyEntities = !!dirtyEntityRecords.length; 8525 const isSaving = dirtyEntityRecords.some(record => isSavingEntityRecord(record.kind, record.name, record.key)); 8526 if (!hasDirtyEntities || isSaving) { 8527 return; 8528 } 8529 if (hasNonPostEntityChanges()) { 8530 setIsSaveViewOpened(true); 8531 } else if (!isPostSavingLocked()) { 8532 savePost(); 8533 } 8534 }); 8535 return null; 8536 } 8537 8538 ;// ./node_modules/@wordpress/edit-site/build-module/components/layout/hooks.js 8539 /** 8540 * WordPress dependencies 8541 */ 8542 8543 8544 8545 const MAX_LOADING_TIME = 10000; // 10 seconds 8546 8547 function useIsSiteEditorLoading() { 8548 const [loaded, setLoaded] = (0,external_wp_element_namespaceObject.useState)(false); 8549 const inLoadingPause = (0,external_wp_data_namespaceObject.useSelect)(select => { 8550 const hasResolvingSelectors = select(external_wp_coreData_namespaceObject.store).hasResolvingSelectors(); 8551 return !loaded && !hasResolvingSelectors; 8552 }, [loaded]); 8553 8554 /* 8555 * If the maximum expected loading time has passed, we're marking the 8556 * editor as loaded, in order to prevent any failed requests from blocking 8557 * the editor canvas from appearing. 8558 */ 8559 (0,external_wp_element_namespaceObject.useEffect)(() => { 8560 let timeout; 8561 if (!loaded) { 8562 timeout = setTimeout(() => { 8563 setLoaded(true); 8564 }, MAX_LOADING_TIME); 8565 } 8566 return () => { 8567 clearTimeout(timeout); 8568 }; 8569 }, [loaded]); 8570 (0,external_wp_element_namespaceObject.useEffect)(() => { 8571 if (inLoadingPause) { 8572 /* 8573 * We're using an arbitrary 100ms timeout here to catch brief 8574 * moments without any resolving selectors that would result in 8575 * displaying brief flickers of loading state and loaded state. 8576 * 8577 * It's worth experimenting with different values, since this also 8578 * adds 100ms of artificial delay after loading has finished. 8579 */ 8580 const ARTIFICIAL_DELAY = 100; 8581 const timeout = setTimeout(() => { 8582 setLoaded(true); 8583 }, ARTIFICIAL_DELAY); 8584 return () => { 8585 clearTimeout(timeout); 8586 }; 8587 } 8588 }, [inLoadingPause]); 8589 return !loaded; 8590 } 8591 8592 ;// ./node_modules/@react-spring/rafz/dist/esm/index.js 8593 var esm_f=esm_l(),esm_n=e=>esm_c(e,esm_f),esm_m=esm_l();esm_n.write=e=>esm_c(e,esm_m);var esm_d=esm_l();esm_n.onStart=e=>esm_c(e,esm_d);var esm_h=esm_l();esm_n.onFrame=e=>esm_c(e,esm_h);var esm_p=esm_l();esm_n.onFinish=e=>esm_c(e,esm_p);var esm_i=[];esm_n.setTimeout=(e,t)=>{let a=esm_n.now()+t,o=()=>{let F=esm_i.findIndex(z=>z.cancel==o);~F&&esm_i.splice(F,1),esm_u-=~F?1:0},s={time:a,handler:e,cancel:o};return esm_i.splice(esm_w(a),0,s),esm_u+=1,esm_v(),s};var esm_w=e=>~(~esm_i.findIndex(t=>t.time>e)||~esm_i.length);esm_n.cancel=e=>{esm_d.delete(e),esm_h.delete(e),esm_p.delete(e),esm_f.delete(e),esm_m.delete(e)};esm_n.sync=e=>{T=!0,esm_n.batchedUpdates(e),T=!1};esm_n.throttle=e=>{let t;function a(){try{e(...t)}finally{t=null}}function o(...s){t=s,esm_n.onStart(a)}return o.handler=e,o.cancel=()=>{esm_d.delete(a),t=null},o};var esm_y=typeof window<"u"?window.requestAnimationFrame:()=>{};esm_n.use=e=>esm_y=e;esm_n.now=typeof performance<"u"?()=>performance.now():Date.now;esm_n.batchedUpdates=e=>e();esm_n.catch=console.error;esm_n.frameLoop="always";esm_n.advance=()=>{esm_n.frameLoop!=="demand"?console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"):esm_x()};var esm_r=-1,esm_u=0,T=!1;function esm_c(e,t){T?(t.delete(e),e(0)):(t.add(e),esm_v())}function esm_v(){esm_r<0&&(esm_r=0,esm_n.frameLoop!=="demand"&&esm_y(esm_b))}function esm_R(){esm_r=-1}function esm_b(){~esm_r&&(esm_y(esm_b),esm_n.batchedUpdates(esm_x))}function esm_x(){let e=esm_r;esm_r=esm_n.now();let t=esm_w(esm_r);if(t&&(Q(esm_i.splice(0,t),a=>a.handler()),esm_u-=t),!esm_u){esm_R();return}esm_d.flush(),esm_f.flush(e?Math.min(64,esm_r-e):16.667),esm_h.flush(),esm_m.flush(),esm_p.flush()}function esm_l(){let e=new Set,t=e;return{add(a){esm_u+=t==e&&!e.has(a)?1:0,e.add(a)},delete(a){return esm_u-=t==e&&e.has(a)?1:0,e.delete(a)},flush(a){t.size&&(e=new Set,esm_u-=t.size,Q(t,o=>o(a)&&e.add(o)),esm_u+=e.size,t=e)}}}function Q(e,t){e.forEach(a=>{try{t(a)}catch(o){esm_n.catch(o)}})}var esm_S={count(){return esm_u},isRunning(){return esm_r>=0},clear(){esm_r=-1,esm_i=[],esm_d=esm_l(),esm_f=esm_l(),esm_h=esm_l(),esm_m=esm_l(),esm_p=esm_l(),esm_u=0}}; 8594 8595 // EXTERNAL MODULE: external "React" 8596 var external_React_ = __webpack_require__(1609); 8597 var external_React_namespaceObject = /*#__PURE__*/__webpack_require__.t(external_React_, 2); 8598 ;// ./node_modules/@react-spring/shared/dist/esm/index.js 8599 var ze=Object.defineProperty;var Le=(e,t)=>{for(var r in t)ze(e,r,{get:t[r],enumerable:!0})};var dist_esm_p={};Le(dist_esm_p,{assign:()=>U,colors:()=>dist_esm_c,createStringInterpolator:()=>esm_k,skipAnimation:()=>ee,to:()=>J,willAdvance:()=>dist_esm_S});function Y(){}var mt=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0}),dist_esm_l={arr:Array.isArray,obj:e=>!!e&&e.constructor.name==="Object",fun:e=>typeof e=="function",str:e=>typeof e=="string",num:e=>typeof e=="number",und:e=>e===void 0};function bt(e,t){if(dist_esm_l.arr(e)){if(!dist_esm_l.arr(t)||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}return e===t}var esm_Ve=(e,t)=>e.forEach(t);function xt(e,t,r){if(dist_esm_l.arr(e)){for(let n=0;n<e.length;n++)t.call(r,e[n],`$n}`);return}for(let n in e)e.hasOwnProperty(n)&&t.call(r,e[n],n)}var ht=e=>dist_esm_l.und(e)?[]:dist_esm_l.arr(e)?e:[e];function Pe(e,t){if(e.size){let r=Array.from(e);e.clear(),esm_Ve(r,t)}}var yt=(e,...t)=>Pe(e,r=>r(...t)),dist_esm_h=()=>typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent);var esm_k,J,dist_esm_c=null,ee=!1,dist_esm_S=Y,U=e=>{e.to&&(J=e.to),e.now&&(esm_n.now=e.now),e.colors!==void 0&&(dist_esm_c=e.colors),e.skipAnimation!=null&&(ee=e.skipAnimation),e.createStringInterpolator&&(esm_k=e.createStringInterpolator),e.requestAnimationFrame&&esm_n.use(e.requestAnimationFrame),e.batchedUpdates&&(esm_n.batchedUpdates=e.batchedUpdates),e.willAdvance&&(dist_esm_S=e.willAdvance),e.frameLoop&&(esm_n.frameLoop=e.frameLoop)};var esm_E=new Set,dist_esm_u=[],esm_H=[],A=0,qe={get idle(){return!esm_E.size&&!dist_esm_u.length},start(e){A>e.priority?(esm_E.add(e),esm_n.onStart($e)):(te(e),esm_n(B))},advance:B,sort(e){if(A)esm_n.onFrame(()=>qe.sort(e));else{let t=dist_esm_u.indexOf(e);~t&&(dist_esm_u.splice(t,1),re(e))}},clear(){dist_esm_u=[],esm_E.clear()}};function $e(){esm_E.forEach(te),esm_E.clear(),esm_n(B)}function te(e){dist_esm_u.includes(e)||re(e)}function re(e){dist_esm_u.splice(Ge(dist_esm_u,t=>t.priority>e.priority),0,e)}function B(e){let t=esm_H;for(let r=0;r<dist_esm_u.length;r++){let n=dist_esm_u[r];A=n.priority,n.idle||(dist_esm_S(n),n.advance(e),n.idle||t.push(n))}return A=0,esm_H=dist_esm_u,esm_H.length=0,dist_esm_u=t,dist_esm_u.length>0}function Ge(e,t){let r=e.findIndex(t);return r<0?e.length:r}var ne=(e,t,r)=>Math.min(Math.max(r,e),t);var It={transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199};var dist_esm_d="[-+]?\\d*\\.?\\d+",esm_M=dist_esm_d+"%";function C(...e){return"\\(\\s*("+e.join(")\\s*,\\s*(")+")\\s*\\)"}var oe=new RegExp("rgb"+C(dist_esm_d,dist_esm_d,dist_esm_d)),fe=new RegExp("rgba"+C(dist_esm_d,dist_esm_d,dist_esm_d,dist_esm_d)),ae=new RegExp("hsl"+C(dist_esm_d,esm_M,esm_M)),ie=new RegExp("hsla"+C(dist_esm_d,esm_M,esm_M,dist_esm_d)),se=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,ue=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,le=/^#([0-9a-fA-F]{6})$/,esm_ce=/^#([0-9a-fA-F]{8})$/;function be(e){let t;return typeof e=="number"?e>>>0===e&&e>=0&&e<=4294967295?e:null:(t=le.exec(e))?parseInt(t[1]+"ff",16)>>>0:dist_esm_c&&dist_esm_c[e]!==void 0?dist_esm_c[e]:(t=oe.exec(e))?(dist_esm_y(t[1])<<24|dist_esm_y(t[2])<<16|dist_esm_y(t[3])<<8|255)>>>0:(t=fe.exec(e))?(dist_esm_y(t[1])<<24|dist_esm_y(t[2])<<16|dist_esm_y(t[3])<<8|me(t[4]))>>>0:(t=se.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+"ff",16)>>>0:(t=esm_ce.exec(e))?parseInt(t[1],16)>>>0:(t=ue.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+t[4]+t[4],16)>>>0:(t=ae.exec(e))?(de(esm_pe(t[1]),esm_z(t[2]),esm_z(t[3]))|255)>>>0:(t=ie.exec(e))?(de(esm_pe(t[1]),esm_z(t[2]),esm_z(t[3]))|me(t[4]))>>>0:null}function esm_j(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function de(e,t,r){let n=r<.5?r*(1+t):r+t-r*t,f=2*r-n,o=esm_j(f,n,e+1/3),i=esm_j(f,n,e),s=esm_j(f,n,e-1/3);return Math.round(o*255)<<24|Math.round(i*255)<<16|Math.round(s*255)<<8}function dist_esm_y(e){let t=parseInt(e,10);return t<0?0:t>255?255:t}function esm_pe(e){return(parseFloat(e)%360+360)%360/360}function me(e){let t=parseFloat(e);return t<0?0:t>1?255:Math.round(t*255)}function esm_z(e){let t=parseFloat(e);return t<0?0:t>100?1:t/100}function D(e){let t=be(e);if(t===null)return e;t=t||0;let r=(t&4278190080)>>>24,n=(t&16711680)>>>16,f=(t&65280)>>>8,o=(t&255)/255;return`rgba($r}, $n}, $f}, $o})`}var W=(e,t,r)=>{if(dist_esm_l.fun(e))return e;if(dist_esm_l.arr(e))return W({range:e,output:t,extrapolate:r});if(dist_esm_l.str(e.output[0]))return esm_k(e);let n=e,f=n.output,o=n.range||[0,1],i=n.extrapolateLeft||n.extrapolate||"extend",s=n.extrapolateRight||n.extrapolate||"extend",x=n.easing||(a=>a);return a=>{let F=He(a,o);return Ue(a,o[F],o[F+1],f[F],f[F+1],x,i,s,n.map)}};function Ue(e,t,r,n,f,o,i,s,x){let a=x?x(e):e;if(a<t){if(i==="identity")return a;i==="clamp"&&(a=t)}if(a>r){if(s==="identity")return a;s==="clamp"&&(a=r)}return n===f?n:t===r?e<=t?n:f:(t===-1/0?a=-a:r===1/0?a=a-t:a=(a-t)/(r-t),a=o(a),n===-1/0?a=-a:f===1/0?a=a+n:a=a*(f-n)+n,a)}function He(e,t){for(var r=1;r<t.length-1&&!(t[r]>=e);++r);return r-1}var Be=(e,t="end")=>r=>{r=t==="end"?Math.min(r,.999):Math.max(r,.001);let n=r*e,f=t==="end"?Math.floor(n):Math.ceil(n);return ne(0,1,f/e)},P=1.70158,L=P*1.525,xe=P+1,he=2*Math.PI/3,ye=2*Math.PI/4.5,V=e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,Lt={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>1-(1-e)*(1-e),easeInOutQuad:e=>e<.5?2*e*e:1-Math.pow(-2*e+2,2)/2,easeInCubic:e=>e*e*e,easeOutCubic:e=>1-Math.pow(1-e,3),easeInOutCubic:e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2,easeInQuart:e=>e*e*e*e,easeOutQuart:e=>1-Math.pow(1-e,4),easeInOutQuart:e=>e<.5?8*e*e*e*e:1-Math.pow(-2*e+2,4)/2,easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>1-Math.pow(1-e,5),easeInOutQuint:e=>e<.5?16*e*e*e*e*e:1-Math.pow(-2*e+2,5)/2,easeInSine:e=>1-Math.cos(e*Math.PI/2),easeOutSine:e=>Math.sin(e*Math.PI/2),easeInOutSine:e=>-(Math.cos(Math.PI*e)-1)/2,easeInExpo:e=>e===0?0:Math.pow(2,10*e-10),easeOutExpo:e=>e===1?1:1-Math.pow(2,-10*e),easeInOutExpo:e=>e===0?0:e===1?1:e<.5?Math.pow(2,20*e-10)/2:(2-Math.pow(2,-20*e+10))/2,easeInCirc:e=>1-Math.sqrt(1-Math.pow(e,2)),easeOutCirc:e=>Math.sqrt(1-Math.pow(e-1,2)),easeInOutCirc:e=>e<.5?(1-Math.sqrt(1-Math.pow(2*e,2)))/2:(Math.sqrt(1-Math.pow(-2*e+2,2))+1)/2,easeInBack:e=>xe*e*e*e-P*e*e,easeOutBack:e=>1+xe*Math.pow(e-1,3)+P*Math.pow(e-1,2),easeInOutBack:e=>e<.5?Math.pow(2*e,2)*((L+1)*2*e-L)/2:(Math.pow(2*e-2,2)*((L+1)*(e*2-2)+L)+2)/2,easeInElastic:e=>e===0?0:e===1?1:-Math.pow(2,10*e-10)*Math.sin((e*10-10.75)*he),easeOutElastic:e=>e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e*10-.75)*he)+1,easeInOutElastic:e=>e===0?0:e===1?1:e<.5?-(Math.pow(2,20*e-10)*Math.sin((20*e-11.125)*ye))/2:Math.pow(2,-20*e+10)*Math.sin((20*e-11.125)*ye)/2+1,easeInBounce:e=>1-V(1-e),easeOutBounce:V,easeInOutBounce:e=>e<.5?(1-V(1-2*e))/2:(1+V(2*e-1))/2,steps:Be};var esm_g=Symbol.for("FluidValue.get"),dist_esm_m=Symbol.for("FluidValue.observers");var Pt=e=>Boolean(e&&e[esm_g]),ve=e=>e&&e[esm_g]?e[esm_g]():e,esm_qt=e=>e[dist_esm_m]||null;function je(e,t){e.eventObserved?e.eventObserved(t):e(t)}function $t(e,t){let r=e[dist_esm_m];r&&r.forEach(n=>{je(n,t)})}var esm_ge=class{[esm_g];[dist_esm_m];constructor(t){if(!t&&!(t=this.get))throw Error("Unknown getter");De(this,t)}},De=(e,t)=>Ee(e,esm_g,t);function Gt(e,t){if(e[esm_g]){let r=e[dist_esm_m];r||Ee(e,dist_esm_m,r=new Set),r.has(t)||(r.add(t),e.observerAdded&&e.observerAdded(r.size,t))}return t}function Qt(e,t){let r=e[dist_esm_m];if(r&&r.has(t)){let n=r.size-1;n?r.delete(t):e[dist_esm_m]=null,e.observerRemoved&&e.observerRemoved(n,t)}}var Ee=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0});var O=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,esm_Oe=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,K=new RegExp(`($O.source})(%|[a-z]+)`,"i"),we=/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,dist_esm_b=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;var esm_N=e=>{let[t,r]=We(e);if(!t||dist_esm_h())return e;let n=window.getComputedStyle(document.documentElement).getPropertyValue(t);if(n)return n.trim();if(r&&r.startsWith("--")){let f=window.getComputedStyle(document.documentElement).getPropertyValue(r);return f||e}else{if(r&&dist_esm_b.test(r))return esm_N(r);if(r)return r}return e},We=e=>{let t=dist_esm_b.exec(e);if(!t)return[,];let[,r,n]=t;return[r,n]};var _,esm_Ke=(e,t,r,n,f)=>`rgba($Math.round(t)}, $Math.round(r)}, $Math.round(n)}, $f})`,Xt=e=>{_||(_=dist_esm_c?new RegExp(`($Object.keys(dist_esm_c).join("|")})(?!\\w)`,"g"):/^\b$/);let t=e.output.map(o=>ve(o).replace(dist_esm_b,esm_N).replace(esm_Oe,D).replace(_,D)),r=t.map(o=>o.match(O).map(Number)),f=r[0].map((o,i)=>r.map(s=>{if(!(i in s))throw Error('The arity of each "output" value must be equal');return s[i]})).map(o=>W({...e,output:o}));return o=>{let i=!K.test(t[0])&&t.find(x=>K.test(x))?.replace(O,""),s=0;return t[0].replace(O,()=>`$f[s++](o)}$i||""}`).replace(we,esm_Ke)}};var Z="react-spring: ",Te=e=>{let t=e,r=!1;if(typeof t!="function")throw new TypeError(`$Z}once requires a function parameter`);return(...n)=>{r||(t(...n),r=!0)}},Ne=Te(console.warn);function Jt(){Ne(`$Z}The "interpolate" function is deprecated in v9 (use "to" instead)`)}var _e=Te(console.warn);function er(){_e(`$Z}Directly calling start instead of using the api object is deprecated in v9 (use ".start" instead), this will be removed in later 0.X.0 versions`)}function esm_or(e){return dist_esm_l.str(e)&&(e[0]=="#"||/\d/.test(e)||!dist_esm_h()&&dist_esm_b.test(e)||e in(dist_esm_c||{}))}var dist_esm_v,q=new WeakMap,Ze=e=>e.forEach(({target:t,contentRect:r})=>q.get(t)?.forEach(n=>n(r)));function Fe(e,t){dist_esm_v||typeof ResizeObserver<"u"&&(dist_esm_v=new ResizeObserver(Ze));let r=q.get(t);return r||(r=new Set,q.set(t,r)),r.add(e),dist_esm_v&&dist_esm_v.observe(t),()=>{let n=q.get(t);!n||(n.delete(e),!n.size&&dist_esm_v&&dist_esm_v.unobserve(t))}}var esm_$=new Set,dist_esm_w,esm_Xe=()=>{let e=()=>{esm_$.forEach(t=>t({width:window.innerWidth,height:window.innerHeight}))};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},Ie=e=>(esm_$.add(e),dist_esm_w||(dist_esm_w=esm_Xe()),()=>{esm_$.delete(e),!esm_$.size&&dist_esm_w&&(dist_esm_w(),dist_esm_w=void 0)});var ke=(e,{container:t=document.documentElement}={})=>t===document.documentElement?Ie(e):Fe(e,t);var Se=(e,t,r)=>t-e===0?1:(r-e)/(t-e);var esm_Ye={x:{length:"Width",position:"Left"},y:{length:"Height",position:"Top"}},esm_G=class{callback;container;info;constructor(t,r){this.callback=t,this.container=r,this.info={time:0,x:this.createAxis(),y:this.createAxis()}}createAxis=()=>({current:0,progress:0,scrollLength:0});updateAxis=t=>{let r=this.info[t],{length:n,position:f}=esm_Ye[t];r.current=this.container[`scroll$f}`],r.scrollLength=this.container["scroll"+n]-this.container["client"+n],r.progress=Se(0,r.scrollLength,r.current)};update=()=>{this.updateAxis("x"),this.updateAxis("y")};sendEvent=()=>{this.callback(this.info)};advance=()=>{this.update(),this.sendEvent()}};var esm_T=new WeakMap,Ae=new WeakMap,X=new WeakMap,Me=e=>e===document.documentElement?window:e,yr=(e,{container:t=document.documentElement}={})=>{let r=X.get(t);r||(r=new Set,X.set(t,r));let n=new esm_G(e,t);if(r.add(n),!esm_T.has(t)){let o=()=>(r?.forEach(s=>s.advance()),!0);esm_T.set(t,o);let i=Me(t);window.addEventListener("resize",o,{passive:!0}),t!==document.documentElement&&Ae.set(t,ke(o,{container:t})),i.addEventListener("scroll",o,{passive:!0})}let f=esm_T.get(t);return Re(f),()=>{Re.cancel(f);let o=X.get(t);if(!o||(o.delete(n),o.size))return;let i=esm_T.get(t);esm_T.delete(t),i&&(Me(t).removeEventListener("scroll",i),window.removeEventListener("resize",i),Ae.get(t)?.())}};function Er(e){let t=Je(null);return t.current===null&&(t.current=e()),t.current}var esm_Q=dist_esm_h()?external_React_.useEffect:external_React_.useLayoutEffect;var Ce=()=>{let e=(0,external_React_.useRef)(!1);return esm_Q(()=>(e.current=!0,()=>{e.current=!1}),[]),e};function Mr(){let e=(0,external_React_.useState)()[1],t=Ce();return()=>{t.current&&e(Math.random())}}function Lr(e,t){let[r]=(0,external_React_.useState)(()=>({inputs:t,result:e()})),n=(0,external_React_.useRef)(),f=n.current,o=f;return o?Boolean(t&&o.inputs&&it(t,o.inputs))||(o={inputs:t,result:e()}):o=r,(0,external_React_.useEffect)(()=>{n.current=o,f==r&&(r.inputs=r.result=void 0)},[o]),o.result}function it(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}var $r=e=>(0,external_React_.useEffect)(e,ut),ut=[];function Ur(e){let t=ct();return lt(()=>{t.current=e}),t.current}var Wr=()=>{let[e,t]=dt(null);return esm_Q(()=>{let r=window.matchMedia("(prefers-reduced-motion)"),n=f=>{t(f.matches),U({skipAnimation:f.matches})};return n(r),r.addEventListener("change",n),()=>{r.removeEventListener("change",n)}},[]),e}; 8600 8601 ;// ./node_modules/@react-spring/animated/dist/esm/index.js 8602 var animated_dist_esm_h=Symbol.for("Animated:node"),animated_dist_esm_v=e=>!!e&&e[animated_dist_esm_h]===e,dist_esm_k=e=>e&&e[animated_dist_esm_h],esm_D=(e,t)=>mt(e,animated_dist_esm_h,t),F=e=>e&&e[animated_dist_esm_h]&&e[animated_dist_esm_h].getPayload(),animated_dist_esm_c=class{payload;constructor(){esm_D(this,this)}getPayload(){return this.payload||[]}};var animated_dist_esm_l=class extends animated_dist_esm_c{constructor(r){super();this._value=r;dist_esm_l.num(this._value)&&(this.lastPosition=this._value)}done=!0;elapsedTime;lastPosition;lastVelocity;v0;durationProgress=0;static create(r){return new animated_dist_esm_l(r)}getPayload(){return[this]}getValue(){return this._value}setValue(r,n){return dist_esm_l.num(r)&&(this.lastPosition=r,n&&(r=Math.round(r/n)*n,this.done&&(this.lastPosition=r))),this._value===r?!1:(this._value=r,!0)}reset(){let{done:r}=this;this.done=!1,dist_esm_l.num(this._value)&&(this.elapsedTime=0,this.durationProgress=0,this.lastPosition=this._value,r&&(this.lastVelocity=null),this.v0=null)}};var animated_dist_esm_d=class extends animated_dist_esm_l{_string=null;_toString;constructor(t){super(0),this._toString=W({output:[t,t]})}static create(t){return new animated_dist_esm_d(t)}getValue(){let t=this._string;return t??(this._string=this._toString(this._value))}setValue(t){if(dist_esm_l.str(t)){if(t==this._string)return!1;this._string=t,this._value=1}else if(super.setValue(t))this._string=null;else return!1;return!0}reset(t){t&&(this._toString=W({output:[this.getValue(),t]})),this._value=0,super.reset()}};var dist_esm_f={dependencies:null};var animated_dist_esm_u=class extends animated_dist_esm_c{constructor(r){super();this.source=r;this.setValue(r)}getValue(r){let n={};return xt(this.source,(a,i)=>{animated_dist_esm_v(a)?n[i]=a.getValue(r):Pt(a)?n[i]=ve(a):r||(n[i]=a)}),n}setValue(r){this.source=r,this.payload=this._makePayload(r)}reset(){this.payload&&esm_Ve(this.payload,r=>r.reset())}_makePayload(r){if(r){let n=new Set;return xt(r,this._addToPayload,n),Array.from(n)}}_addToPayload(r){dist_esm_f.dependencies&&Pt(r)&&dist_esm_f.dependencies.add(r);let n=F(r);n&&esm_Ve(n,a=>this.add(a))}};var animated_dist_esm_y=class extends animated_dist_esm_u{constructor(t){super(t)}static create(t){return new animated_dist_esm_y(t)}getValue(){return this.source.map(t=>t.getValue())}setValue(t){let r=this.getPayload();return t.length==r.length?r.map((n,a)=>n.setValue(t[a])).some(Boolean):(super.setValue(t.map(dist_esm_z)),!0)}};function dist_esm_z(e){return(esm_or(e)?animated_dist_esm_d:animated_dist_esm_l).create(e)}function esm_Le(e){let t=dist_esm_k(e);return t?t.constructor:dist_esm_l.arr(e)?animated_dist_esm_y:esm_or(e)?animated_dist_esm_d:animated_dist_esm_l}var dist_esm_x=(e,t)=>{let r=!dist_esm_l.fun(e)||e.prototype&&e.prototype.isReactComponent;return (0,external_React_.forwardRef)((n,a)=>{let i=(0,external_React_.useRef)(null),o=r&&(0,external_React_.useCallback)(s=>{i.current=esm_ae(a,s)},[a]),[m,T]=esm_ne(n,t),W=Mr(),P=()=>{let s=i.current;if(r&&!s)return;(s?t.applyAnimatedValues(s,m.getValue(!0)):!1)===!1&&W()},_=new animated_dist_esm_b(P,T),p=(0,external_React_.useRef)();esm_Q(()=>(p.current=_,esm_Ve(T,s=>Gt(s,_)),()=>{p.current&&(esm_Ve(p.current.deps,s=>Qt(s,p.current)),esm_n.cancel(p.current.update))})),(0,external_React_.useEffect)(P,[]),$r(()=>()=>{let s=p.current;esm_Ve(s.deps,S=>Qt(S,s))});let $=t.getComponentProps(m.getValue());return external_React_.createElement(e,{...$,ref:o})})},animated_dist_esm_b=class{constructor(t,r){this.update=t;this.deps=r}eventObserved(t){t.type=="change"&&esm_n.write(this.update)}};function esm_ne(e,t){let r=new Set;return dist_esm_f.dependencies=r,e.style&&(e={...e,style:t.createAnimatedStyle(e.style)}),e=new animated_dist_esm_u(e),dist_esm_f.dependencies=null,[e,r]}function esm_ae(e,t){return e&&(dist_esm_l.fun(e)?e(t):e.current=t),t}var dist_esm_j=Symbol.for("AnimatedComponent"),dist_esm_Ke=(e,{applyAnimatedValues:t=()=>!1,createAnimatedStyle:r=a=>new animated_dist_esm_u(a),getComponentProps:n=a=>a}={})=>{let a={applyAnimatedValues:t,createAnimatedStyle:r,getComponentProps:n},i=o=>{let m=esm_I(o)||"Anonymous";return dist_esm_l.str(o)?o=i[o]||(i[o]=dist_esm_x(o,a)):o=o[dist_esm_j]||(o[dist_esm_j]=dist_esm_x(o,a)),o.displayName=`Animated($m})`,o};return xt(e,(o,m)=>{dist_esm_l.arr(e)&&(m=esm_I(o)),i[m]=i(o)}),{animated:i}},esm_I=e=>dist_esm_l.str(e)?e:e&&dist_esm_l.str(e.displayName)?e.displayName:dist_esm_l.fun(e)&&e.name||null; 8603 8604 ;// ./node_modules/@react-spring/core/dist/esm/index.js 8605 function dist_esm_I(t,...e){return dist_esm_l.fun(t)?t(...e):t}var esm_te=(t,e)=>t===!0||!!(e&&t&&(dist_esm_l.fun(t)?t(e):ht(t).includes(e))),et=(t,e)=>dist_esm_l.obj(t)?e&&t[e]:t;var esm_ke=(t,e)=>t.default===!0?t[e]:t.default?t.default[e]:void 0,nn=t=>t,dist_esm_ne=(t,e=nn)=>{let n=rn;t.default&&t.default!==!0&&(t=t.default,n=Object.keys(t));let r={};for(let o of n){let s=e(t[o],o);dist_esm_l.und(s)||(r[o]=s)}return r},rn=["config","onProps","onStart","onChange","onPause","onResume","onRest"],on={config:1,from:1,to:1,ref:1,loop:1,reset:1,pause:1,cancel:1,reverse:1,immediate:1,default:1,delay:1,onProps:1,onStart:1,onChange:1,onPause:1,onResume:1,onRest:1,onResolve:1,items:1,trail:1,sort:1,expires:1,initial:1,enter:1,update:1,leave:1,children:1,onDestroyed:1,keys:1,callId:1,parentId:1};function sn(t){let e={},n=0;if(xt(t,(r,o)=>{on[o]||(e[o]=r,n++)}),n)return e}function esm_de(t){let e=sn(t);if(e){let n={to:e};return xt(t,(r,o)=>o in e||(n[o]=r)),n}return{...t}}function esm_me(t){return t=ve(t),dist_esm_l.arr(t)?t.map(esm_me):esm_or(t)?dist_esm_p.createStringInterpolator({range:[0,1],output:[t,t]})(1):t}function esm_Ue(t){for(let e in t)return!0;return!1}function esm_Ee(t){return dist_esm_l.fun(t)||dist_esm_l.arr(t)&&dist_esm_l.obj(t[0])}function esm_xe(t,e){t.ref?.delete(t),e?.delete(t)}function esm_he(t,e){e&&t.ref!==e&&(t.ref?.delete(t),e.add(t),t.ref=e)}function wr(t,e,n=1e3){an(()=>{if(e){let r=0;ge(t,(o,s)=>{let a=o.current;if(a.length){let i=n*e[s];isNaN(i)?i=r:r=i,ge(a,u=>{ge(u.queue,p=>{let f=p.delay;p.delay=d=>i+dist_esm_I(f||0,d)})}),o.start()}})}else{let r=Promise.resolve();ge(t,o=>{let s=o.current;if(s.length){let a=s.map(i=>{let u=i.queue;return i.queue=[],u});r=r.then(()=>(ge(s,(i,u)=>ge(a[u]||[],p=>i.queue.push(p))),Promise.all(o.start())))}})}})}var esm_mt={default:{tension:170,friction:26},gentle:{tension:120,friction:14},wobbly:{tension:180,friction:12},stiff:{tension:210,friction:20},slow:{tension:280,friction:60},molasses:{tension:280,friction:120}};var tt={...esm_mt.default,mass:1,damping:1,easing:Lt.linear,clamp:!1},esm_we=class{tension;friction;frequency;damping;mass;velocity=0;restVelocity;precision;progress;duration;easing;clamp;bounce;decay;round;constructor(){Object.assign(this,tt)}};function gt(t,e,n){n&&(n={...n},esm_ht(n,e),e={...n,...e}),esm_ht(t,e),Object.assign(t,e);for(let a in tt)t[a]==null&&(t[a]=tt[a]);let{mass:r,frequency:o,damping:s}=t;return dist_esm_l.und(o)||(o<.01&&(o=.01),s<0&&(s=0),t.tension=Math.pow(2*Math.PI/o,2)*r,t.friction=4*Math.PI*s*r/o),t}function esm_ht(t,e){if(!dist_esm_l.und(e.decay))t.duration=void 0;else{let n=!dist_esm_l.und(e.tension)||!dist_esm_l.und(e.friction);(n||!dist_esm_l.und(e.frequency)||!dist_esm_l.und(e.damping)||!dist_esm_l.und(e.mass))&&(t.duration=void 0,t.decay=void 0),n&&(t.frequency=void 0)}}var esm_yt=[],dist_esm_Le=class{changed=!1;values=esm_yt;toValues=null;fromValues=esm_yt;to;from;config=new esm_we;immediate=!1};function esm_Me(t,{key:e,props:n,defaultProps:r,state:o,actions:s}){return new Promise((a,i)=>{let u,p,f=esm_te(n.cancel??r?.cancel,e);if(f)b();else{dist_esm_l.und(n.pause)||(o.paused=esm_te(n.pause,e));let c=r?.pause;c!==!0&&(c=o.paused||esm_te(c,e)),u=dist_esm_I(n.delay||0,e),c?(o.resumeQueue.add(m),s.pause()):(s.resume(),m())}function d(){o.resumeQueue.add(m),o.timeouts.delete(p),p.cancel(),u=p.time-esm_n.now()}function m(){u>0&&!dist_esm_p.skipAnimation?(o.delayed=!0,p=esm_n.setTimeout(b,u),o.pauseQueue.add(d),o.timeouts.add(p)):b()}function b(){o.delayed&&(o.delayed=!1),o.pauseQueue.delete(d),o.timeouts.delete(p),t<=(o.cancelId||0)&&(f=!0);try{s.start({...n,callId:t,cancel:f},a)}catch(c){i(c)}}})}var esm_be=(t,e)=>e.length==1?e[0]:e.some(n=>n.cancelled)?esm_q(t.get()):e.every(n=>n.noop)?nt(t.get()):dist_esm_E(t.get(),e.every(n=>n.finished)),nt=t=>({value:t,noop:!0,finished:!0,cancelled:!1}),dist_esm_E=(t,e,n=!1)=>({value:t,finished:e,cancelled:n}),esm_q=t=>({value:t,cancelled:!0,finished:!1});function esm_De(t,e,n,r){let{callId:o,parentId:s,onRest:a}=e,{asyncTo:i,promise:u}=n;return!s&&t===i&&!e.reset?u:n.promise=(async()=>{n.asyncId=o,n.asyncTo=t;let p=dist_esm_ne(e,(l,h)=>h==="onRest"?void 0:l),f,d,m=new Promise((l,h)=>(f=l,d=h)),b=l=>{let h=o<=(n.cancelId||0)&&esm_q(r)||o!==n.asyncId&&dist_esm_E(r,!1);if(h)throw l.result=h,d(l),l},c=(l,h)=>{let g=new esm_Ae,x=new esm_Ne;return(async()=>{if(dist_esm_p.skipAnimation)throw esm_oe(n),x.result=dist_esm_E(r,!1),d(x),x;b(g);let S=dist_esm_l.obj(l)?{...l}:{...h,to:l};S.parentId=o,xt(p,(V,_)=>{dist_esm_l.und(S[_])&&(S[_]=V)});let A=await r.start(S);return b(g),n.paused&&await new Promise(V=>{n.resumeQueue.add(V)}),A})()},P;if(dist_esm_p.skipAnimation)return esm_oe(n),dist_esm_E(r,!1);try{let l;dist_esm_l.arr(t)?l=(async h=>{for(let g of h)await c(g)})(t):l=Promise.resolve(t(c,r.stop.bind(r))),await Promise.all([l.then(f),m]),P=dist_esm_E(r.get(),!0,!1)}catch(l){if(l instanceof esm_Ae)P=l.result;else if(l instanceof esm_Ne)P=l.result;else throw l}finally{o==n.asyncId&&(n.asyncId=s,n.asyncTo=s?i:void 0,n.promise=s?u:void 0)}return dist_esm_l.fun(a)&&esm_n.batchedUpdates(()=>{a(P,r,r.item)}),P})()}function esm_oe(t,e){Pe(t.timeouts,n=>n.cancel()),t.pauseQueue.clear(),t.resumeQueue.clear(),t.asyncId=t.asyncTo=t.promise=void 0,e&&(t.cancelId=e)}var esm_Ae=class extends Error{result;constructor(){super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise.")}},esm_Ne=class extends Error{result;constructor(){super("SkipAnimationSignal")}};var esm_Re=t=>t instanceof esm_X,Sn=1,esm_X=class extends esm_ge{id=Sn++;_priority=0;get priority(){return this._priority}set priority(e){this._priority!=e&&(this._priority=e,this._onPriorityChange(e))}get(){let e=dist_esm_k(this);return e&&e.getValue()}to(...e){return dist_esm_p.to(this,e)}interpolate(...e){return Jt(),dist_esm_p.to(this,e)}toJSON(){return this.get()}observerAdded(e){e==1&&this._attach()}observerRemoved(e){e==0&&this._detach()}_attach(){}_detach(){}_onChange(e,n=!1){$t(this,{type:"change",parent:this,value:e,idle:n})}_onPriorityChange(e){this.idle||qe.sort(this),$t(this,{type:"priority",parent:this,priority:e})}};var esm_se=Symbol.for("SpringPhase"),esm_bt=1,rt=2,ot=4,esm_qe=t=>(t[esm_se]&esm_bt)>0,dist_esm_Q=t=>(t[esm_se]&rt)>0,esm_ye=t=>(t[esm_se]&ot)>0,st=(t,e)=>e?t[esm_se]|=rt|esm_bt:t[esm_se]&=~rt,esm_it=(t,e)=>e?t[esm_se]|=ot:t[esm_se]&=~ot;var esm_ue=class extends esm_X{key;animation=new dist_esm_Le;queue;defaultProps={};_state={paused:!1,delayed:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set};_pendingCalls=new Set;_lastCallId=0;_lastToId=0;_memoizedDuration=0;constructor(e,n){if(super(),!dist_esm_l.und(e)||!dist_esm_l.und(n)){let r=dist_esm_l.obj(e)?{...e}:{...n,from:e};dist_esm_l.und(r.default)&&(r.default=!0),this.start(r)}}get idle(){return!(dist_esm_Q(this)||this._state.asyncTo)||esm_ye(this)}get goal(){return ve(this.animation.to)}get velocity(){let e=dist_esm_k(this);return e instanceof animated_dist_esm_l?e.lastVelocity||0:e.getPayload().map(n=>n.lastVelocity||0)}get hasAnimated(){return esm_qe(this)}get isAnimating(){return dist_esm_Q(this)}get isPaused(){return esm_ye(this)}get isDelayed(){return this._state.delayed}advance(e){let n=!0,r=!1,o=this.animation,{config:s,toValues:a}=o,i=F(o.to);!i&&Pt(o.to)&&(a=ht(ve(o.to))),o.values.forEach((f,d)=>{if(f.done)return;let m=f.constructor==animated_dist_esm_d?1:i?i[d].lastPosition:a[d],b=o.immediate,c=m;if(!b){if(c=f.lastPosition,s.tension<=0){f.done=!0;return}let P=f.elapsedTime+=e,l=o.fromValues[d],h=f.v0!=null?f.v0:f.v0=dist_esm_l.arr(s.velocity)?s.velocity[d]:s.velocity,g,x=s.precision||(l==m?.005:Math.min(1,Math.abs(m-l)*.001));if(dist_esm_l.und(s.duration))if(s.decay){let S=s.decay===!0?.998:s.decay,A=Math.exp(-(1-S)*P);c=l+h/(1-S)*(1-A),b=Math.abs(f.lastPosition-c)<=x,g=h*A}else{g=f.lastVelocity==null?h:f.lastVelocity;let S=s.restVelocity||x/10,A=s.clamp?0:s.bounce,V=!dist_esm_l.und(A),_=l==m?f.v0>0:l<m,v,w=!1,C=1,$=Math.ceil(e/C);for(let L=0;L<$&&(v=Math.abs(g)>S,!(!v&&(b=Math.abs(m-c)<=x,b)));++L){V&&(w=c==m||c>m==_,w&&(g=-g*A,c=m));let N=-s.tension*1e-6*(c-m),y=-s.friction*.001*g,T=(N+y)/s.mass;g=g+T*C,c=c+g*C}}else{let S=1;s.duration>0&&(this._memoizedDuration!==s.duration&&(this._memoizedDuration=s.duration,f.durationProgress>0&&(f.elapsedTime=s.duration*f.durationProgress,P=f.elapsedTime+=e)),S=(s.progress||0)+P/this._memoizedDuration,S=S>1?1:S<0?0:S,f.durationProgress=S),c=l+s.easing(S)*(m-l),g=(c-f.lastPosition)/e,b=S==1}f.lastVelocity=g,Number.isNaN(c)&&(console.warn("Got NaN while animating:",this),b=!0)}i&&!i[d].done&&(b=!1),b?f.done=!0:n=!1,f.setValue(c,s.round)&&(r=!0)});let u=dist_esm_k(this),p=u.getValue();if(n){let f=ve(o.to);(p!==f||r)&&!s.decay?(u.setValue(f),this._onChange(f)):r&&s.decay&&this._onChange(p),this._stop()}else r&&this._onChange(p)}set(e){return esm_n.batchedUpdates(()=>{this._stop(),this._focus(e),this._set(e)}),this}pause(){this._update({pause:!0})}resume(){this._update({pause:!1})}finish(){if(dist_esm_Q(this)){let{to:e,config:n}=this.animation;esm_n.batchedUpdates(()=>{this._onStart(),n.decay||this._set(e,!1),this._stop()})}return this}update(e){return(this.queue||(this.queue=[])).push(e),this}start(e,n){let r;return dist_esm_l.und(e)?(r=this.queue||[],this.queue=[]):r=[dist_esm_l.obj(e)?e:{...n,to:e}],Promise.all(r.map(o=>this._update(o))).then(o=>esm_be(this,o))}stop(e){let{to:n}=this.animation;return this._focus(this.get()),esm_oe(this._state,e&&this._lastCallId),esm_n.batchedUpdates(()=>this._stop(n,e)),this}reset(){this._update({reset:!0})}eventObserved(e){e.type=="change"?this._start():e.type=="priority"&&(this.priority=e.priority+1)}_prepareNode(e){let n=this.key||"",{to:r,from:o}=e;r=dist_esm_l.obj(r)?r[n]:r,(r==null||esm_Ee(r))&&(r=void 0),o=dist_esm_l.obj(o)?o[n]:o,o==null&&(o=void 0);let s={to:r,from:o};return esm_qe(this)||(e.reverse&&([r,o]=[o,r]),o=ve(o),dist_esm_l.und(o)?dist_esm_k(this)||this._set(r):this._set(o)),s}_update({...e},n){let{key:r,defaultProps:o}=this;e.default&&Object.assign(o,dist_esm_ne(e,(i,u)=>/^on/.test(u)?et(i,r):i)),_t(this,e,"onProps"),esm_Ie(this,"onProps",e,this);let s=this._prepareNode(e);if(Object.isFrozen(this))throw Error("Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?");let a=this._state;return esm_Me(++this._lastCallId,{key:r,props:e,defaultProps:o,state:a,actions:{pause:()=>{esm_ye(this)||(esm_it(this,!0),yt(a.pauseQueue),esm_Ie(this,"onPause",dist_esm_E(this,esm_Ce(this,this.animation.to)),this))},resume:()=>{esm_ye(this)&&(esm_it(this,!1),dist_esm_Q(this)&&this._resume(),yt(a.resumeQueue),esm_Ie(this,"onResume",dist_esm_E(this,esm_Ce(this,this.animation.to)),this))},start:this._merge.bind(this,s)}}).then(i=>{if(e.loop&&i.finished&&!(n&&i.noop)){let u=at(e);if(u)return this._update(u,!0)}return i})}_merge(e,n,r){if(n.cancel)return this.stop(!0),r(esm_q(this));let o=!dist_esm_l.und(e.to),s=!dist_esm_l.und(e.from);if(o||s)if(n.callId>this._lastToId)this._lastToId=n.callId;else return r(esm_q(this));let{key:a,defaultProps:i,animation:u}=this,{to:p,from:f}=u,{to:d=p,from:m=f}=e;s&&!o&&(!n.default||dist_esm_l.und(d))&&(d=m),n.reverse&&([d,m]=[m,d]);let b=!bt(m,f);b&&(u.from=m),m=ve(m);let c=!bt(d,p);c&&this._focus(d);let P=esm_Ee(n.to),{config:l}=u,{decay:h,velocity:g}=l;(o||s)&&(l.velocity=0),n.config&&!P&>(l,dist_esm_I(n.config,a),n.config!==i.config?dist_esm_I(i.config,a):void 0);let x=dist_esm_k(this);if(!x||dist_esm_l.und(d))return r(dist_esm_E(this,!0));let S=dist_esm_l.und(n.reset)?s&&!n.default:!dist_esm_l.und(m)&&esm_te(n.reset,a),A=S?m:this.get(),V=esm_me(d),_=dist_esm_l.num(V)||dist_esm_l.arr(V)||esm_or(V),v=!P&&(!_||esm_te(i.immediate||n.immediate,a));if(c){let L=esm_Le(d);if(L!==x.constructor)if(v)x=this._set(V);else throw Error(`Cannot animate between $x.constructor.name} and $L.name}, as the "to" prop suggests`)}let w=x.constructor,C=Pt(d),$=!1;if(!C){let L=S||!esm_qe(this)&&b;(c||L)&&($=bt(esm_me(A),V),C=!$),(!bt(u.immediate,v)&&!v||!bt(l.decay,h)||!bt(l.velocity,g))&&(C=!0)}if($&&dist_esm_Q(this)&&(u.changed&&!S?C=!0:C||this._stop(p)),!P&&((C||Pt(p))&&(u.values=x.getPayload(),u.toValues=Pt(d)?null:w==animated_dist_esm_d?[1]:ht(V)),u.immediate!=v&&(u.immediate=v,!v&&!S&&this._set(p)),C)){let{onRest:L}=u;esm_Ve(_n,y=>_t(this,n,y));let N=dist_esm_E(this,esm_Ce(this,p));yt(this._pendingCalls,N),this._pendingCalls.add(r),u.changed&&esm_n.batchedUpdates(()=>{u.changed=!S,L?.(N,this),S?dist_esm_I(i.onRest,N):u.onStart?.(N,this)})}S&&this._set(A),P?r(esm_De(n.to,n,this._state,this)):C?this._start():dist_esm_Q(this)&&!c?this._pendingCalls.add(r):r(nt(A))}_focus(e){let n=this.animation;e!==n.to&&(esm_qt(this)&&this._detach(),n.to=e,esm_qt(this)&&this._attach())}_attach(){let e=0,{to:n}=this.animation;Pt(n)&&(Gt(n,this),esm_Re(n)&&(e=n.priority+1)),this.priority=e}_detach(){let{to:e}=this.animation;Pt(e)&&Qt(e,this)}_set(e,n=!0){let r=ve(e);if(!dist_esm_l.und(r)){let o=dist_esm_k(this);if(!o||!bt(r,o.getValue())){let s=esm_Le(r);!o||o.constructor!=s?esm_D(this,s.create(r)):o.setValue(r),o&&esm_n.batchedUpdates(()=>{this._onChange(r,n)})}}return dist_esm_k(this)}_onStart(){let e=this.animation;e.changed||(e.changed=!0,esm_Ie(this,"onStart",dist_esm_E(this,esm_Ce(this,e.to)),this))}_onChange(e,n){n||(this._onStart(),dist_esm_I(this.animation.onChange,e,this)),dist_esm_I(this.defaultProps.onChange,e,this),super._onChange(e,n)}_start(){let e=this.animation;dist_esm_k(this).reset(ve(e.to)),e.immediate||(e.fromValues=e.values.map(n=>n.lastPosition)),dist_esm_Q(this)||(st(this,!0),esm_ye(this)||this._resume())}_resume(){dist_esm_p.skipAnimation?this.finish():qe.start(this)}_stop(e,n){if(dist_esm_Q(this)){st(this,!1);let r=this.animation;esm_Ve(r.values,s=>{s.done=!0}),r.toValues&&(r.onChange=r.onPause=r.onResume=void 0),$t(this,{type:"idle",parent:this});let o=n?esm_q(this.get()):dist_esm_E(this.get(),esm_Ce(this,e??r.to));yt(this._pendingCalls,o),r.changed&&(r.changed=!1,esm_Ie(this,"onRest",o,this))}}};function esm_Ce(t,e){let n=esm_me(e),r=esm_me(t.get());return bt(r,n)}function at(t,e=t.loop,n=t.to){let r=dist_esm_I(e);if(r){let o=r!==!0&&esm_de(r),s=(o||t).reverse,a=!o||o.reset;return esm_Pe({...t,loop:e,default:!1,pause:void 0,to:!s||esm_Ee(n)?n:void 0,from:a?t.from:void 0,reset:a,...o})}}function esm_Pe(t){let{to:e,from:n}=t=esm_de(t),r=new Set;return dist_esm_l.obj(e)&&Vt(e,r),dist_esm_l.obj(n)&&Vt(n,r),t.keys=r.size?Array.from(r):null,t}function Ot(t){let e=esm_Pe(t);return R.und(e.default)&&(e.default=dist_esm_ne(e)),e}function Vt(t,e){xt(t,(n,r)=>n!=null&&e.add(r))}var _n=["onStart","onRest","onChange","onPause","onResume"];function _t(t,e,n){t.animation[n]=e[n]!==esm_ke(e,n)?et(e[n],t.key):void 0}function esm_Ie(t,e,...n){t.animation[e]?.(...n),t.defaultProps[e]?.(...n)}var Fn=["onStart","onChange","onRest"],kn=1,esm_le=class{id=kn++;springs={};queue=[];ref;_flush;_initialProps;_lastAsyncId=0;_active=new Set;_changed=new Set;_started=!1;_item;_state={paused:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set};_events={onStart:new Map,onChange:new Map,onRest:new Map};constructor(e,n){this._onFrame=this._onFrame.bind(this),n&&(this._flush=n),e&&this.start({default:!0,...e})}get idle(){return!this._state.asyncTo&&Object.values(this.springs).every(e=>e.idle&&!e.isDelayed&&!e.isPaused)}get item(){return this._item}set item(e){this._item=e}get(){let e={};return this.each((n,r)=>e[r]=n.get()),e}set(e){for(let n in e){let r=e[n];dist_esm_l.und(r)||this.springs[n].set(r)}}update(e){return e&&this.queue.push(esm_Pe(e)),this}start(e){let{queue:n}=this;return e?n=ht(e).map(esm_Pe):this.queue=[],this._flush?this._flush(this,n):(jt(this,n),esm_ze(this,n))}stop(e,n){if(e!==!!e&&(n=e),n){let r=this.springs;esm_Ve(ht(n),o=>r[o].stop(!!e))}else esm_oe(this._state,this._lastAsyncId),this.each(r=>r.stop(!!e));return this}pause(e){if(dist_esm_l.und(e))this.start({pause:!0});else{let n=this.springs;esm_Ve(ht(e),r=>n[r].pause())}return this}resume(e){if(dist_esm_l.und(e))this.start({pause:!1});else{let n=this.springs;esm_Ve(ht(e),r=>n[r].resume())}return this}each(e){xt(this.springs,e)}_onFrame(){let{onStart:e,onChange:n,onRest:r}=this._events,o=this._active.size>0,s=this._changed.size>0;(o&&!this._started||s&&!this._started)&&(this._started=!0,Pe(e,([u,p])=>{p.value=this.get(),u(p,this,this._item)}));let a=!o&&this._started,i=s||a&&r.size?this.get():null;s&&n.size&&Pe(n,([u,p])=>{p.value=i,u(p,this,this._item)}),a&&(this._started=!1,Pe(r,([u,p])=>{p.value=i,u(p,this,this._item)}))}eventObserved(e){if(e.type=="change")this._changed.add(e.parent),e.idle||this._active.add(e.parent);else if(e.type=="idle")this._active.delete(e.parent);else return;esm_n.onFrame(this._onFrame)}};function esm_ze(t,e){return Promise.all(e.map(n=>wt(t,n))).then(n=>esm_be(t,n))}async function wt(t,e,n){let{keys:r,to:o,from:s,loop:a,onRest:i,onResolve:u}=e,p=dist_esm_l.obj(e.default)&&e.default;a&&(e.loop=!1),o===!1&&(e.to=null),s===!1&&(e.from=null);let f=dist_esm_l.arr(o)||dist_esm_l.fun(o)?o:void 0;f?(e.to=void 0,e.onRest=void 0,p&&(p.onRest=void 0)):esm_Ve(Fn,P=>{let l=e[P];if(dist_esm_l.fun(l)){let h=t._events[P];e[P]=({finished:g,cancelled:x})=>{let S=h.get(l);S?(g||(S.finished=!1),x&&(S.cancelled=!0)):h.set(l,{value:null,finished:g||!1,cancelled:x||!1})},p&&(p[P]=e[P])}});let d=t._state;e.pause===!d.paused?(d.paused=e.pause,yt(e.pause?d.pauseQueue:d.resumeQueue)):d.paused&&(e.pause=!0);let m=(r||Object.keys(t.springs)).map(P=>t.springs[P].start(e)),b=e.cancel===!0||esm_ke(e,"cancel")===!0;(f||b&&d.asyncId)&&m.push(esm_Me(++t._lastAsyncId,{props:e,state:d,actions:{pause:Y,resume:Y,start(P,l){b?(esm_oe(d,t._lastAsyncId),l(esm_q(t))):(P.onRest=i,l(esm_De(f,P,d,t)))}}})),d.paused&&await new Promise(P=>{d.resumeQueue.add(P)});let c=esm_be(t,await Promise.all(m));if(a&&c.finished&&!(n&&c.noop)){let P=at(e,a,o);if(P)return jt(t,[P]),wt(t,P,!0)}return u&&esm_n.batchedUpdates(()=>u(c,t,t.item)),c}function esm_e(t,e){let n={...t.springs};return e&&pe(Ve(e),r=>{z.und(r.keys)&&(r=esm_Pe(r)),z.obj(r.to)||(r={...r,to:void 0}),Mt(n,r,o=>esm_Lt(o))}),pt(t,n),n}function pt(t,e){Ut(e,(n,r)=>{t.springs[r]||(t.springs[r]=n,Et(n,t))})}function esm_Lt(t,e){let n=new esm_ue;return n.key=t,e&&Gt(n,e),n}function Mt(t,e,n){e.keys&&esm_Ve(e.keys,r=>{(t[r]||(t[r]=n(r)))._prepareNode(e)})}function jt(t,e){esm_Ve(e,n=>{Mt(t.springs,n,r=>esm_Lt(r,t))})}var dist_esm_H=({children:t,...e})=>{let n=(0,external_React_.useContext)(esm_Ge),r=e.pause||!!n.pause,o=e.immediate||!!n.immediate;e=Lr(()=>({pause:r,immediate:o}),[r,o]);let{Provider:s}=esm_Ge;return external_React_.createElement(s,{value:e},t)},esm_Ge=wn(dist_esm_H,{});dist_esm_H.Provider=esm_Ge.Provider;dist_esm_H.Consumer=esm_Ge.Consumer;function wn(t,e){return Object.assign(t,external_React_.createContext(e)),t.Provider._context=t,t.Consumer._context=t,t}var esm_fe=()=>{let t=[],e=function(r){Ln();let o=[];return ce(t,(s,a)=>{if(Ke.und(r))o.push(s.start());else{let i=n(r,s,a);i&&o.push(s.start(i))}}),o};e.current=t,e.add=function(r){t.includes(r)||t.push(r)},e.delete=function(r){let o=t.indexOf(r);~o&&t.splice(o,1)},e.pause=function(){return ce(t,r=>r.pause(...arguments)),this},e.resume=function(){return ce(t,r=>r.resume(...arguments)),this},e.set=function(r){ce(t,(o,s)=>{let a=Ke.fun(r)?r(s,o):r;a&&o.set(a)})},e.start=function(r){let o=[];return ce(t,(s,a)=>{if(Ke.und(r))o.push(s.start());else{let i=this._getProps(r,s,a);i&&o.push(s.start(i))}}),o},e.stop=function(){return ce(t,r=>r.stop(...arguments)),this},e.update=function(r){return ce(t,(o,s)=>o.update(this._getProps(r,o,s))),this};let n=function(r,o,s){return Ke.fun(r)?r(s,o):r};return e._getProps=n,e};function esm_He(t,e,n){let r=jn.fun(e)&&e;r&&!n&&(n=[]);let o=Xe(()=>r||arguments.length==3?esm_fe():void 0,[]),s=Nt(0),a=Dn(),i=Xe(()=>({ctrls:[],queue:[],flush(h,g){let x=esm_e(h,g);return s.current>0&&!i.queue.length&&!Object.keys(x).some(A=>!h.springs[A])?esm_ze(h,g):new Promise(A=>{pt(h,x),i.queue.push(()=>{A(esm_ze(h,g))}),a()})}}),[]),u=Nt([...i.ctrls]),p=[],f=Dt(t)||0;Xe(()=>{Ye(u.current.slice(t,f),h=>{esm_xe(h,o),h.stop(!0)}),u.current.length=t,d(f,t)},[t]),Xe(()=>{d(0,Math.min(f,t))},n);function d(h,g){for(let x=h;x<g;x++){let S=u.current[x]||(u.current[x]=new esm_le(null,i.flush)),A=r?r(x,S):e[x];A&&(p[x]=Ot(A))}}let m=u.current.map((h,g)=>esm_e(h,p[g])),b=Mn(dist_esm_H),c=Dt(b),P=b!==c&&esm_Ue(b);qn(()=>{s.current++,i.ctrls=u.current;let{queue:h}=i;h.length&&(i.queue=[],Ye(h,g=>g())),Ye(u.current,(g,x)=>{o?.add(g),P&&g.start({default:b});let S=p[x];S&&(esm_he(g,S.ref),g.ref?g.queue.push(S):g.start(S))})}),Nn(()=>()=>{Ye(i.ctrls,h=>h.stop(!0))});let l=m.map(h=>({...h}));return o?[l,o]:l}function esm_J(t,e){let n=Qn.fun(t),[[r],o]=esm_He(1,n?t:[t],n?e||[]:e);return n||arguments.length==2?[r,o]:r}var Gn=()=>esm_fe(),Xo=()=>zn(Gn)[0];var Wo=(t,e)=>{let n=Bn(()=>new esm_ue(t,e));return Kn(()=>()=>{n.stop()}),n};function esm_Qt(t,e,n){let r=qt.fun(e)&&e;r&&!n&&(n=[]);let o=!0,s,a=esm_He(t,(i,u)=>{let p=r?r(i,u):e;return s=p.ref,o=o&&p.reverse,p},n||[{}]);if(Yn(()=>{Xn(a[1].current,(i,u)=>{let p=a[1].current[u+(o?1:-1)];if(esm_he(i,s),i.ref){p&&i.update({to:p.springs});return}p?i.start({to:p.springs}):i.start()})},n),r||arguments.length==3){let i=s??a[1];return i._getProps=(u,p,f)=>{let d=qt.fun(u)?u(f,p):u;if(d){let m=i.current[f+(d.reverse?1:-1)];return m&&(d.to=m.springs),d}},a}return a[0]}function esm_Gt(t,e,n){let r=G.fun(e)&&e,{reset:o,sort:s,trail:a=0,expires:i=!0,exitBeforeEnter:u=!1,onDestroyed:p,ref:f,config:d}=r?r():e,m=Jn(()=>r||arguments.length==3?esm_fe():void 0,[]),b=zt(t),c=[],P=lt(null),l=o?null:P.current;Je(()=>{P.current=c}),$n(()=>(j(c,y=>{m?.add(y.ctrl),y.ctrl.ref=m}),()=>{j(P.current,y=>{y.expired&&clearTimeout(y.expirationId),esm_xe(y.ctrl,m),y.ctrl.stop(!0)})}));let h=tr(b,r?r():e,l),g=o&&P.current||[];Je(()=>j(g,({ctrl:y,item:T,key:F})=>{esm_xe(y,m),dist_esm_I(p,T,F)}));let x=[];if(l&&j(l,(y,T)=>{y.expired?(clearTimeout(y.expirationId),g.push(y)):(T=x[T]=h.indexOf(y.key),~T&&(c[T]=y))}),j(b,(y,T)=>{c[T]||(c[T]={key:h[T],item:y,phase:"mount",ctrl:new esm_le},c[T].ctrl.item=y)}),x.length){let y=-1,{leave:T}=r?r():e;j(x,(F,k)=>{let O=l[k];~F?(y=c.indexOf(O),c[y]={...O,item:b[F]}):T&&c.splice(++y,0,O)})}G.fun(s)&&c.sort((y,T)=>s(y.item,T.item));let S=-a,A=Wn(),V=dist_esm_ne(e),_=new Map,v=lt(new Map),w=lt(!1);j(c,(y,T)=>{let F=y.key,k=y.phase,O=r?r():e,U,D,Jt=dist_esm_I(O.delay||0,F);if(k=="mount")U=O.enter,D="enter";else{let M=h.indexOf(F)<0;if(k!="leave")if(M)U=O.leave,D="leave";else if(U=O.update)D="update";else return;else if(!M)U=O.enter,D="enter";else return}if(U=dist_esm_I(U,y.item,T),U=G.obj(U)?esm_de(U):{to:U},!U.config){let M=d||V.config;U.config=dist_esm_I(M,y.item,T,D)}S+=a;let Z={...V,delay:Jt+S,ref:f,immediate:O.immediate,reset:!1,...U};if(D=="enter"&&G.und(Z.from)){let M=r?r():e,Te=G.und(M.initial)||l?M.from:M.initial;Z.from=dist_esm_I(Te,y.item,T)}let{onResolve:Wt}=Z;Z.onResolve=M=>{dist_esm_I(Wt,M);let Te=P.current,B=Te.find(Fe=>Fe.key===F);if(!!B&&!(M.cancelled&&B.phase!="update")&&B.ctrl.idle){let Fe=Te.every(ee=>ee.ctrl.idle);if(B.phase=="leave"){let ee=dist_esm_I(i,B.item);if(ee!==!1){let Ze=ee===!0?0:ee;if(B.expired=!0,!Fe&&Ze>0){Ze<=2147483647&&(B.expirationId=setTimeout(A,Ze));return}}}Fe&&Te.some(ee=>ee.expired)&&(v.current.delete(B),u&&(w.current=!0),A())}};let ft=esm_e(y.ctrl,Z);D==="leave"&&u?v.current.set(y,{phase:D,springs:ft,payload:Z}):_.set(y,{phase:D,springs:ft,payload:Z})});let C=Hn(dist_esm_H),$=Zn(C),L=C!==$&&esm_Ue(C);Je(()=>{L&&j(c,y=>{y.ctrl.start({default:C})})},[C]),j(_,(y,T)=>{if(v.current.size){let F=c.findIndex(k=>k.key===T.key);c.splice(F,1)}}),Je(()=>{j(v.current.size?v.current:_,({phase:y,payload:T},F)=>{let{ctrl:k}=F;F.phase=y,m?.add(k),L&&y=="enter"&&k.start({default:C}),T&&(esm_he(k,T.ref),(k.ref||m)&&!w.current?k.update(T):(k.start(T),w.current&&(w.current=!1)))})},o?void 0:n);let N=y=>Oe.createElement(Oe.Fragment,null,c.map((T,F)=>{let{springs:k}=_.get(T)||T.ctrl,O=y({...k},T.item,T,F);return O&&O.type?Oe.createElement(O.type,{...O.props,key:G.str(T.key)||G.num(T.key)?T.key:T.ctrl.id,ref:O.ref}):O}));return m?[N,m]:N}var esm_er=1;function tr(t,{key:e,keys:n=e},r){if(n===null){let o=new Set;return t.map(s=>{let a=r&&r.find(i=>i.item===s&&i.phase!=="leave"&&!o.has(i));return a?(o.add(a),a.key):esm_er++})}return G.und(n)?t:G.fun(n)?t.map(n):zt(n)}var hs=({container:t,...e}={})=>{let[n,r]=esm_J(()=>({scrollX:0,scrollY:0,scrollXProgress:0,scrollYProgress:0,...e}),[]);return or(()=>{let o=rr(({x:s,y:a})=>{r.start({scrollX:s.current,scrollXProgress:s.progress,scrollY:a.current,scrollYProgress:a.progress})},{container:t?.current||void 0});return()=>{nr(Object.values(n),s=>s.stop()),o()}},[]),n};var Ps=({container:t,...e})=>{let[n,r]=esm_J(()=>({width:0,height:0,...e}),[]);return ar(()=>{let o=sr(({width:s,height:a})=>{r.start({width:s,height:a,immediate:n.width.get()===0||n.height.get()===0})},{container:t?.current||void 0});return()=>{ir(Object.values(n),s=>s.stop()),o()}},[]),n};var cr={any:0,all:1};function Cs(t,e){let[n,r]=pr(!1),o=ur(),s=Bt.fun(t)&&t,a=s?s():{},{to:i={},from:u={},...p}=a,f=s?e:t,[d,m]=esm_J(()=>({from:u,...p}),[]);return lr(()=>{let b=o.current,{root:c,once:P,amount:l="any",...h}=f??{};if(!b||P&&n||typeof IntersectionObserver>"u")return;let g=new WeakMap,x=()=>(i&&m.start(i),r(!0),P?void 0:()=>{u&&m.start(u),r(!1)}),S=V=>{V.forEach(_=>{let v=g.get(_.target);if(_.isIntersecting!==Boolean(v))if(_.isIntersecting){let w=x();Bt.fun(w)?g.set(_.target,w):A.unobserve(_.target)}else v&&(v(),g.delete(_.target))})},A=new IntersectionObserver(S,{root:c&&c.current||void 0,threshold:typeof l=="number"||Array.isArray(l)?l:cr[l],...h});return A.observe(b),()=>A.unobserve(b)},[f]),s?[o,d]:[o,n]}function qs({children:t,...e}){return t(esm_J(e))}function Bs({items:t,children:e,...n}){let r=esm_Qt(t.length,n);return t.map((o,s)=>{let a=e(o,s);return fr.fun(a)?a(r[s]):a})}function Ys({items:t,children:e,...n}){return esm_Gt(t,n)(e)}var esm_W=class extends esm_X{constructor(n,r){super();this.source=n;this.calc=W(...r);let o=this._get(),s=esm_Le(o);esm_D(this,s.create(o))}key;idle=!0;calc;_active=new Set;advance(n){let r=this._get(),o=this.get();bt(r,o)||(dist_esm_k(this).setValue(r),this._onChange(r,this.idle)),!this.idle&&Yt(this._active)&&esm_ct(this)}_get(){let n=dist_esm_l.arr(this.source)?this.source.map(ve):ht(ve(this.source));return this.calc(...n)}_start(){this.idle&&!Yt(this._active)&&(this.idle=!1,esm_Ve(F(this),n=>{n.done=!1}),dist_esm_p.skipAnimation?(esm_n.batchedUpdates(()=>this.advance()),esm_ct(this)):qe.start(this))}_attach(){let n=1;esm_Ve(ht(this.source),r=>{Pt(r)&&Gt(r,this),esm_Re(r)&&(r.idle||this._active.add(r),n=Math.max(n,r.priority+1))}),this.priority=n,this._start()}_detach(){esm_Ve(ht(this.source),n=>{Pt(n)&&Qt(n,this)}),this._active.clear(),esm_ct(this)}eventObserved(n){n.type=="change"?n.idle?this.advance():(this._active.add(n.parent),this._start()):n.type=="idle"?this._active.delete(n.parent):n.type=="priority"&&(this.priority=ht(this.source).reduce((r,o)=>Math.max(r,(esm_Re(o)?o.priority:0)+1),0))}};function vr(t){return t.idle!==!1}function Yt(t){return!t.size||Array.from(t).every(vr)}function esm_ct(t){t.idle||(t.idle=!0,esm_Ve(F(t),e=>{e.done=!0}),$t(t,{type:"idle",parent:t}))}var ui=(t,...e)=>new esm_W(t,e),pi=(t,...e)=>(Cr(),new esm_W(t,e));dist_esm_p.assign({createStringInterpolator:Xt,to:(t,e)=>new esm_W(t,e)});var di=qe.advance; 8606 8607 ;// external "ReactDOM" 8608 const external_ReactDOM_namespaceObject = window["ReactDOM"]; 8609 ;// ./node_modules/@react-spring/web/dist/esm/index.js 8610 var web_dist_esm_k=/^--/;function web_dist_esm_I(t,e){return e==null||typeof e=="boolean"||e===""?"":typeof e=="number"&&e!==0&&!web_dist_esm_k.test(t)&&!(web_dist_esm_c.hasOwnProperty(t)&&web_dist_esm_c[t])?e+"px":(""+e).trim()}var web_dist_esm_v={};function esm_V(t,e){if(!t.nodeType||!t.setAttribute)return!1;let r=t.nodeName==="filter"||t.parentNode&&t.parentNode.nodeName==="filter",{style:i,children:s,scrollTop:u,scrollLeft:l,viewBox:a,...n}=e,d=Object.values(n),m=Object.keys(n).map(o=>r||t.hasAttribute(o)?o:web_dist_esm_v[o]||(web_dist_esm_v[o]=o.replace(/([A-Z])/g,p=>"-"+p.toLowerCase())));s!==void 0&&(t.textContent=s);for(let o in i)if(i.hasOwnProperty(o)){let p=web_dist_esm_I(o,i[o]);web_dist_esm_k.test(o)?t.style.setProperty(o,p):t.style[o]=p}m.forEach((o,p)=>{t.setAttribute(o,d[p])}),u!==void 0&&(t.scrollTop=u),l!==void 0&&(t.scrollLeft=l),a!==void 0&&t.setAttribute("viewBox",a)}var web_dist_esm_c={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},esm_F=(t,e)=>t+e.charAt(0).toUpperCase()+e.substring(1),esm_L=["Webkit","Ms","Moz","O"];web_dist_esm_c=Object.keys(web_dist_esm_c).reduce((t,e)=>(esm_L.forEach(r=>t[esm_F(r,e)]=t[e]),t),web_dist_esm_c);var esm_=/^(matrix|translate|scale|rotate|skew)/,dist_esm_$=/^(translate)/,dist_esm_G=/^(rotate|skew)/,web_dist_esm_y=(t,e)=>dist_esm_l.num(t)&&t!==0?t+e:t,web_dist_esm_h=(t,e)=>dist_esm_l.arr(t)?t.every(r=>web_dist_esm_h(r,e)):dist_esm_l.num(t)?t===e:parseFloat(t)===e,dist_esm_g=class extends animated_dist_esm_u{constructor({x:e,y:r,z:i,...s}){let u=[],l=[];(e||r||i)&&(u.push([e||0,r||0,i||0]),l.push(a=>[`translate3d($a.map(n=>web_dist_esm_y(n,"px")).join(",")})`,web_dist_esm_h(a,0)])),xt(s,(a,n)=>{if(n==="transform")u.push([a||""]),l.push(d=>[d,d===""]);else if(esm_.test(n)){if(delete s[n],dist_esm_l.und(a))return;let d=dist_esm_$.test(n)?"px":dist_esm_G.test(n)?"deg":"";u.push(ht(a)),l.push(n==="rotate3d"?([m,o,p,O])=>[`rotate3d($m},$o},$p},$web_dist_esm_y(O,d)})`,web_dist_esm_h(O,0)]:m=>[`$n}($m.map(o=>web_dist_esm_y(o,d)).join(",")})`,web_dist_esm_h(m,n.startsWith("scale")?1:0)])}}),u.length&&(s.transform=new web_dist_esm_x(u,l)),super(s)}},web_dist_esm_x=class extends esm_ge{constructor(r,i){super();this.inputs=r;this.transforms=i}_value=null;get(){return this._value||(this._value=this._get())}_get(){let r="",i=!0;return esm_Ve(this.inputs,(s,u)=>{let l=ve(s[0]),[a,n]=this.transforms[u](dist_esm_l.arr(l)?l:s.map(ve));r+=" "+a,i=i&&n}),i?"none":r}observerAdded(r){r==1&&esm_Ve(this.inputs,i=>esm_Ve(i,s=>Pt(s)&&Gt(s,this)))}observerRemoved(r){r==0&&esm_Ve(this.inputs,i=>esm_Ve(i,s=>Pt(s)&&Qt(s,this)))}eventObserved(r){r.type=="change"&&(this._value=null),$t(this,r)}};var esm_C=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"];dist_esm_p.assign({batchedUpdates:external_ReactDOM_namespaceObject.unstable_batchedUpdates,createStringInterpolator:Xt,colors:It});var dist_esm_q=dist_esm_Ke(esm_C,{applyAnimatedValues:esm_V,createAnimatedStyle:t=>new dist_esm_g(t),getComponentProps:({scrollTop:t,scrollLeft:e,...r})=>r}),dist_esm_it=dist_esm_q.animated; 8611 8612 ;// ./node_modules/@wordpress/edit-site/build-module/components/layout/animation.js 8613 /** 8614 * External dependencies 8615 */ 8616 8617 8618 /** 8619 * WordPress dependencies 8620 */ 8621 8622 function getAbsolutePosition(element) { 8623 return { 8624 top: element.offsetTop, 8625 left: element.offsetLeft 8626 }; 8627 } 8628 const ANIMATION_DURATION = 400; 8629 8630 /** 8631 * Hook used to compute the styles required to move a div into a new position. 8632 * 8633 * The way this animation works is the following: 8634 * - It first renders the element as if there was no animation. 8635 * - It takes a snapshot of the position of the block to use it 8636 * as a destination point for the animation. 8637 * - It restores the element to the previous position using a CSS transform 8638 * - It uses the "resetAnimation" flag to reset the animation 8639 * from the beginning in order to animate to the new destination point. 8640 * 8641 * @param {Object} $1 Options 8642 * @param {*} $1.triggerAnimationOnChange Variable used to trigger the animation if it changes. 8643 */ 8644 function useMovingAnimation({ 8645 triggerAnimationOnChange 8646 }) { 8647 const ref = (0,external_wp_element_namespaceObject.useRef)(); 8648 8649 // Whenever the trigger changes, we need to take a snapshot of the current 8650 // position of the block to use it as a destination point for the animation. 8651 const { 8652 previous, 8653 prevRect 8654 } = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 8655 previous: ref.current && getAbsolutePosition(ref.current), 8656 prevRect: ref.current && ref.current.getBoundingClientRect() 8657 }), [triggerAnimationOnChange]); 8658 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { 8659 if (!previous || !ref.current) { 8660 return; 8661 } 8662 8663 // We disable the animation if the user has a preference for reduced 8664 // motion. 8665 const disableAnimation = window.matchMedia('(prefers-reduced-motion: reduce)').matches; 8666 if (disableAnimation) { 8667 return; 8668 } 8669 const controller = new esm_le({ 8670 x: 0, 8671 y: 0, 8672 width: prevRect.width, 8673 height: prevRect.height, 8674 config: { 8675 duration: ANIMATION_DURATION, 8676 easing: Lt.easeInOutQuint 8677 }, 8678 onChange({ 8679 value 8680 }) { 8681 if (!ref.current) { 8682 return; 8683 } 8684 let { 8685 x, 8686 y, 8687 width, 8688 height 8689 } = value; 8690 x = Math.round(x); 8691 y = Math.round(y); 8692 width = Math.round(width); 8693 height = Math.round(height); 8694 const finishedMoving = x === 0 && y === 0; 8695 ref.current.style.transformOrigin = 'center center'; 8696 ref.current.style.transform = finishedMoving ? null // Set to `null` to explicitly remove the transform. 8697 : `translate3d($x}px,$y}px,0)`; 8698 ref.current.style.width = finishedMoving ? null : `$width}px`; 8699 ref.current.style.height = finishedMoving ? null : `$height}px`; 8700 } 8701 }); 8702 ref.current.style.transform = undefined; 8703 const destination = ref.current.getBoundingClientRect(); 8704 const x = Math.round(prevRect.left - destination.left); 8705 const y = Math.round(prevRect.top - destination.top); 8706 const width = destination.width; 8707 const height = destination.height; 8708 controller.start({ 8709 x: 0, 8710 y: 0, 8711 width, 8712 height, 8713 from: { 8714 x, 8715 y, 8716 width: prevRect.width, 8717 height: prevRect.height 8718 } 8719 }); 8720 return () => { 8721 controller.stop(); 8722 controller.set({ 8723 x: 0, 8724 y: 0, 8725 width: prevRect.width, 8726 height: prevRect.height 8727 }); 8728 }; 8729 }, [previous, prevRect]); 8730 return ref; 8731 } 8732 /* harmony default export */ const animation = (useMovingAnimation); 8733 8734 ;// ./node_modules/@wordpress/icons/build-module/library/check.js 8735 /** 8736 * WordPress dependencies 8737 */ 8738 8739 8740 const check = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 8741 xmlns: "http://www.w3.org/2000/svg", 8742 viewBox: "0 0 24 24", 8743 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 8744 d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z" 8745 }) 8746 }); 8747 /* harmony default export */ const library_check = (check); 8748 8749 ;// ./node_modules/@wordpress/edit-site/build-module/utils/is-previewing-theme.js 8750 /** 8751 * WordPress dependencies 8752 */ 8753 8754 function isPreviewingTheme() { 8755 return !!(0,external_wp_url_namespaceObject.getQueryArg)(window.location.href, 'wp_theme_preview'); 8756 } 8757 function currentlyPreviewingTheme() { 8758 if (isPreviewingTheme()) { 8759 return (0,external_wp_url_namespaceObject.getQueryArg)(window.location.href, 'wp_theme_preview'); 8760 } 8761 return null; 8762 } 8763 8764 ;// ./node_modules/@wordpress/edit-site/build-module/components/save-button/index.js 8765 /** 8766 * WordPress dependencies 8767 */ 8768 8769 8770 8771 8772 8773 8774 8775 8776 /** 8777 * Internal dependencies 8778 */ 8779 8780 8781 8782 8783 const { 8784 useLocation: save_button_useLocation 8785 } = unlock(external_wp_router_namespaceObject.privateApis); 8786 function SaveButton({ 8787 className = 'edit-site-save-button__button', 8788 variant = 'primary', 8789 showTooltip = true, 8790 showReviewMessage, 8791 icon, 8792 size, 8793 __next40pxDefaultSize = false 8794 }) { 8795 const { 8796 params 8797 } = save_button_useLocation(); 8798 const { 8799 setIsSaveViewOpened 8800 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 8801 const { 8802 saveDirtyEntities 8803 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store)); 8804 const { 8805 dirtyEntityRecords 8806 } = (0,external_wp_editor_namespaceObject.useEntitiesSavedStatesIsDirty)(); 8807 const { 8808 isSaving, 8809 isSaveViewOpen, 8810 previewingThemeName 8811 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 8812 const { 8813 isSavingEntityRecord, 8814 isResolving 8815 } = select(external_wp_coreData_namespaceObject.store); 8816 const { 8817 isSaveViewOpened 8818 } = select(store); 8819 const isActivatingTheme = isResolving('activateTheme'); 8820 const currentlyPreviewingThemeId = currentlyPreviewingTheme(); 8821 return { 8822 isSaving: dirtyEntityRecords.some(record => isSavingEntityRecord(record.kind, record.name, record.key)) || isActivatingTheme, 8823 isSaveViewOpen: isSaveViewOpened(), 8824 // Do not call `getTheme` with null, it will cause a request to 8825 // the server. 8826 previewingThemeName: currentlyPreviewingThemeId ? select(external_wp_coreData_namespaceObject.store).getTheme(currentlyPreviewingThemeId)?.name?.rendered : undefined 8827 }; 8828 }, [dirtyEntityRecords]); 8829 const hasDirtyEntities = !!dirtyEntityRecords.length; 8830 let isOnlyCurrentEntityDirty; 8831 // Check if the current entity is the only entity with changes. 8832 // We have some extra logic for `wp_global_styles` for now, that 8833 // is used in navigation sidebar. 8834 if (dirtyEntityRecords.length === 1) { 8835 if (params.postId) { 8836 isOnlyCurrentEntityDirty = `$dirtyEntityRecords[0].key}` === params.postId && dirtyEntityRecords[0].name === params.postType; 8837 } else if (params.path?.includes('wp_global_styles')) { 8838 isOnlyCurrentEntityDirty = dirtyEntityRecords[0].name === 'globalStyles'; 8839 } 8840 } 8841 const disabled = isSaving || !hasDirtyEntities && !isPreviewingTheme(); 8842 const getLabel = () => { 8843 if (isPreviewingTheme()) { 8844 if (isSaving) { 8845 return (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: The name of theme to be activated. */ 8846 (0,external_wp_i18n_namespaceObject.__)('Activating %s'), previewingThemeName); 8847 } else if (disabled) { 8848 return (0,external_wp_i18n_namespaceObject.__)('Saved'); 8849 } else if (hasDirtyEntities) { 8850 return (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: The name of theme to be activated. */ 8851 (0,external_wp_i18n_namespaceObject.__)('Activate %s & Save'), previewingThemeName); 8852 } 8853 return (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: The name of theme to be activated. */ 8854 (0,external_wp_i18n_namespaceObject.__)('Activate %s'), previewingThemeName); 8855 } 8856 if (isSaving) { 8857 return (0,external_wp_i18n_namespaceObject.__)('Saving'); 8858 } 8859 if (disabled) { 8860 return (0,external_wp_i18n_namespaceObject.__)('Saved'); 8861 } 8862 if (!isOnlyCurrentEntityDirty && showReviewMessage) { 8863 return (0,external_wp_i18n_namespaceObject.sprintf)( 8864 // translators: %d: number of unsaved changes (number). 8865 (0,external_wp_i18n_namespaceObject._n)('Review %d change…', 'Review %d changes…', dirtyEntityRecords.length), dirtyEntityRecords.length); 8866 } 8867 return (0,external_wp_i18n_namespaceObject.__)('Save'); 8868 }; 8869 const label = getLabel(); 8870 const onClick = isOnlyCurrentEntityDirty ? () => saveDirtyEntities({ 8871 dirtyEntityRecords 8872 }) : () => setIsSaveViewOpened(true); 8873 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 8874 variant: variant, 8875 className: className, 8876 "aria-disabled": disabled, 8877 "aria-expanded": isSaveViewOpen, 8878 isBusy: isSaving, 8879 onClick: disabled ? undefined : onClick, 8880 label: label 8881 /* 8882 * We want the tooltip to show the keyboard shortcut only when the 8883 * button does something, i.e. when it's not disabled. 8884 */, 8885 shortcut: disabled ? undefined : external_wp_keycodes_namespaceObject.displayShortcut.primary('s') 8886 /* 8887 * Displaying the keyboard shortcut conditionally makes the tooltip 8888 * itself show conditionally. This would trigger a full-rerendering 8889 * of the button that we want to avoid. By setting `showTooltip`, 8890 * the tooltip is always rendered even when there's no keyboard shortcut. 8891 */, 8892 showTooltip: showTooltip, 8893 icon: icon, 8894 __next40pxDefaultSize: __next40pxDefaultSize, 8895 size: size, 8896 children: label 8897 }); 8898 } 8899 8900 ;// ./node_modules/@wordpress/edit-site/build-module/components/save-hub/index.js 8901 /** 8902 * WordPress dependencies 8903 */ 8904 8905 8906 8907 8908 8909 /** 8910 * Internal dependencies 8911 */ 8912 8913 8914 8915 function SaveHub() { 8916 const { 8917 isDisabled, 8918 isSaving 8919 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 8920 const { 8921 __experimentalGetDirtyEntityRecords, 8922 isSavingEntityRecord 8923 } = select(external_wp_coreData_namespaceObject.store); 8924 const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); 8925 const _isSaving = dirtyEntityRecords.some(record => isSavingEntityRecord(record.kind, record.name, record.key)); 8926 return { 8927 isSaving: _isSaving, 8928 isDisabled: _isSaving || !dirtyEntityRecords.length && !isPreviewingTheme() 8929 }; 8930 }, []); 8931 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 8932 className: "edit-site-save-hub", 8933 alignment: "right", 8934 spacing: 4, 8935 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SaveButton, { 8936 className: "edit-site-save-hub__button", 8937 variant: isDisabled ? null : 'primary', 8938 showTooltip: false, 8939 icon: isDisabled && !isSaving ? library_check : null, 8940 showReviewMessage: true, 8941 __next40pxDefaultSize: true 8942 }) 8943 }); 8944 } 8945 8946 ;// ./node_modules/@wordpress/edit-site/build-module/utils/use-activate-theme.js 8947 /** 8948 * WordPress dependencies 8949 */ 8950 8951 8952 8953 8954 8955 /** 8956 * Internal dependencies 8957 */ 8958 8959 8960 const { 8961 useHistory: use_activate_theme_useHistory, 8962 useLocation: use_activate_theme_useLocation 8963 } = unlock(external_wp_router_namespaceObject.privateApis); 8964 8965 /** 8966 * This should be refactored to use the REST API, once the REST API can activate themes. 8967 * 8968 * @return {Function} A function that activates the theme. 8969 */ 8970 function useActivateTheme() { 8971 const history = use_activate_theme_useHistory(); 8972 const { 8973 path 8974 } = use_activate_theme_useLocation(); 8975 const { 8976 startResolution, 8977 finishResolution 8978 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 8979 return async () => { 8980 if (isPreviewingTheme()) { 8981 const activationURL = 'themes.php?action=activate&stylesheet=' + currentlyPreviewingTheme() + '&_wpnonce=' + window.WP_BLOCK_THEME_ACTIVATE_NONCE; 8982 startResolution('activateTheme'); 8983 await window.fetch(activationURL); 8984 finishResolution('activateTheme'); 8985 // Remove the wp_theme_preview query param: we've finished activating 8986 // the queue and are switching to normal Site Editor. 8987 history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { 8988 wp_theme_preview: '' 8989 })); 8990 } 8991 }; 8992 } 8993 8994 ;// external ["wp","apiFetch"] 8995 const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; 8996 var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); 8997 ;// ./node_modules/@wordpress/edit-site/build-module/utils/use-actual-current-theme.js 8998 /** 8999 * WordPress dependencies 9000 */ 9001 9002 9003 9004 const ACTIVE_THEMES_URL = '/wp/v2/themes?status=active'; 9005 function useActualCurrentTheme() { 9006 const [currentTheme, setCurrentTheme] = (0,external_wp_element_namespaceObject.useState)(); 9007 (0,external_wp_element_namespaceObject.useEffect)(() => { 9008 // Set the `wp_theme_preview` to empty string to bypass the createThemePreviewMiddleware. 9009 const path = (0,external_wp_url_namespaceObject.addQueryArgs)(ACTIVE_THEMES_URL, { 9010 context: 'edit', 9011 wp_theme_preview: '' 9012 }); 9013 external_wp_apiFetch_default()({ 9014 path 9015 }).then(activeThemes => setCurrentTheme(activeThemes[0])) 9016 // Do nothing 9017 .catch(() => {}); 9018 }, []); 9019 return currentTheme; 9020 } 9021 9022 ;// ./node_modules/@wordpress/edit-site/build-module/components/save-panel/index.js 9023 /** 9024 * External dependencies 9025 */ 9026 9027 9028 /** 9029 * WordPress dependencies 9030 */ 9031 9032 9033 9034 9035 9036 9037 9038 9039 /** 9040 * Internal dependencies 9041 */ 9042 9043 9044 9045 9046 9047 9048 const { 9049 EntitiesSavedStatesExtensible, 9050 NavigableRegion 9051 } = unlock(external_wp_editor_namespaceObject.privateApis); 9052 const { 9053 useLocation: save_panel_useLocation 9054 } = unlock(external_wp_router_namespaceObject.privateApis); 9055 const EntitiesSavedStatesForPreview = ({ 9056 onClose, 9057 renderDialog, 9058 variant 9059 }) => { 9060 var _currentTheme$name$re, _previewingTheme$name; 9061 const isDirtyProps = (0,external_wp_editor_namespaceObject.useEntitiesSavedStatesIsDirty)(); 9062 let activateSaveLabel; 9063 if (isDirtyProps.isDirty) { 9064 activateSaveLabel = (0,external_wp_i18n_namespaceObject.__)('Activate & Save'); 9065 } else { 9066 activateSaveLabel = (0,external_wp_i18n_namespaceObject.__)('Activate'); 9067 } 9068 const currentTheme = useActualCurrentTheme(); 9069 const previewingTheme = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getCurrentTheme(), []); 9070 const additionalPrompt = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 9071 children: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: The name of active theme, 2: The name of theme to be activated. */ 9072 (0,external_wp_i18n_namespaceObject.__)('Saving your changes will change your active theme from %1$s to %2$s.'), (_currentTheme$name$re = currentTheme?.name?.rendered) !== null && _currentTheme$name$re !== void 0 ? _currentTheme$name$re : '...', (_previewingTheme$name = previewingTheme?.name?.rendered) !== null && _previewingTheme$name !== void 0 ? _previewingTheme$name : '...') 9073 }); 9074 const activateTheme = useActivateTheme(); 9075 const onSave = async values => { 9076 await activateTheme(); 9077 return values; 9078 }; 9079 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EntitiesSavedStatesExtensible, { 9080 ...isDirtyProps, 9081 additionalPrompt, 9082 close: onClose, 9083 onSave, 9084 saveEnabled: true, 9085 saveLabel: activateSaveLabel, 9086 renderDialog, 9087 variant 9088 }); 9089 }; 9090 const _EntitiesSavedStates = ({ 9091 onClose, 9092 renderDialog, 9093 variant 9094 }) => { 9095 if (isPreviewingTheme()) { 9096 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EntitiesSavedStatesForPreview, { 9097 onClose: onClose, 9098 renderDialog: renderDialog, 9099 variant: variant 9100 }); 9101 } 9102 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.EntitiesSavedStates, { 9103 close: onClose, 9104 renderDialog: renderDialog, 9105 variant: variant 9106 }); 9107 }; 9108 function SavePanel() { 9109 const { 9110 query 9111 } = save_panel_useLocation(); 9112 const { 9113 canvas = 'view' 9114 } = query; 9115 const { 9116 isSaveViewOpen, 9117 isDirty, 9118 isSaving 9119 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 9120 const { 9121 __experimentalGetDirtyEntityRecords, 9122 isSavingEntityRecord, 9123 isResolving 9124 } = select(external_wp_coreData_namespaceObject.store); 9125 const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); 9126 const isActivatingTheme = isResolving('activateTheme'); 9127 const { 9128 isSaveViewOpened 9129 } = unlock(select(store)); 9130 9131 // The currently selected entity to display. 9132 // Typically template or template part in the site editor. 9133 return { 9134 isSaveViewOpen: isSaveViewOpened(), 9135 isDirty: dirtyEntityRecords.length > 0, 9136 isSaving: dirtyEntityRecords.some(record => isSavingEntityRecord(record.kind, record.name, record.key)) || isActivatingTheme 9137 }; 9138 }, []); 9139 const { 9140 setIsSaveViewOpened 9141 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 9142 const onClose = () => setIsSaveViewOpened(false); 9143 (0,external_wp_element_namespaceObject.useEffect)(() => { 9144 setIsSaveViewOpened(false); 9145 }, [canvas, setIsSaveViewOpened]); 9146 if (canvas === 'view') { 9147 return isSaveViewOpen ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 9148 className: "edit-site-save-panel__modal", 9149 onRequestClose: onClose, 9150 title: (0,external_wp_i18n_namespaceObject.__)('Review changes'), 9151 size: "small", 9152 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(_EntitiesSavedStates, { 9153 onClose: onClose, 9154 variant: "inline" 9155 }) 9156 }) : null; 9157 } 9158 const activateSaveEnabled = isPreviewingTheme() || isDirty; 9159 const disabled = isSaving || !activateSaveEnabled; 9160 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(NavigableRegion, { 9161 className: dist_clsx('edit-site-layout__actions', { 9162 'is-entity-save-view-open': isSaveViewOpen 9163 }), 9164 ariaLabel: (0,external_wp_i18n_namespaceObject.__)('Save panel'), 9165 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 9166 className: dist_clsx('edit-site-editor__toggle-save-panel', { 9167 'screen-reader-text': isSaveViewOpen 9168 }), 9169 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 9170 __next40pxDefaultSize: true, 9171 variant: "secondary", 9172 className: "edit-site-editor__toggle-save-panel-button", 9173 onClick: () => setIsSaveViewOpened(true), 9174 "aria-haspopup": "dialog", 9175 disabled: disabled, 9176 accessibleWhenDisabled: true, 9177 children: (0,external_wp_i18n_namespaceObject.__)('Open save panel') 9178 }) 9179 }), isSaveViewOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(_EntitiesSavedStates, { 9180 onClose: onClose, 9181 renderDialog: true 9182 })] 9183 }); 9184 } 9185 9186 ;// ./node_modules/@wordpress/edit-site/build-module/components/layout/index.js 9187 /** 9188 * External dependencies 9189 */ 9190 9191 9192 /** 9193 * WordPress dependencies 9194 */ 9195 9196 9197 9198 9199 9200 9201 9202 9203 9204 9205 9206 9207 9208 9209 /** 9210 * Internal dependencies 9211 */ 9212 9213 9214 9215 9216 9217 9218 9219 9220 9221 9222 const { 9223 useCommands 9224 } = unlock(external_wp_coreCommands_namespaceObject.privateApis); 9225 const { 9226 useGlobalStyle: layout_useGlobalStyle 9227 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 9228 const { 9229 NavigableRegion: layout_NavigableRegion, 9230 GlobalStylesProvider 9231 } = unlock(external_wp_editor_namespaceObject.privateApis); 9232 const { 9233 useLocation: layout_useLocation 9234 } = unlock(external_wp_router_namespaceObject.privateApis); 9235 const layout_ANIMATION_DURATION = 0.3; 9236 function Layout() { 9237 const { 9238 query, 9239 name: routeKey, 9240 areas, 9241 widths 9242 } = layout_useLocation(); 9243 const { 9244 canvas = 'view' 9245 } = query; 9246 useCommands(); 9247 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); 9248 const toggleRef = (0,external_wp_element_namespaceObject.useRef)(); 9249 const navigateRegionsProps = (0,external_wp_components_namespaceObject.__unstableUseNavigateRegions)(); 9250 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); 9251 const [canvasResizer, canvasSize] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); 9252 const isEditorLoading = useIsSiteEditorLoading(); 9253 const [isResizableFrameOversized, setIsResizableFrameOversized] = (0,external_wp_element_namespaceObject.useState)(false); 9254 const animationRef = animation({ 9255 triggerAnimationOnChange: routeKey + '-' + canvas 9256 }); 9257 const { 9258 showIconLabels 9259 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 9260 return { 9261 showIconLabels: select(external_wp_preferences_namespaceObject.store).get('core', 'showIconLabels') 9262 }; 9263 }); 9264 const [backgroundColor] = layout_useGlobalStyle('color.background'); 9265 const [gradientValue] = layout_useGlobalStyle('color.gradient'); 9266 const previousCanvaMode = (0,external_wp_compose_namespaceObject.usePrevious)(canvas); 9267 (0,external_wp_element_namespaceObject.useEffect)(() => { 9268 if (previousCanvaMode === 'edit') { 9269 toggleRef.current?.focus(); 9270 } 9271 // Should not depend on the previous canvas mode value but the next. 9272 }, [canvas]); 9273 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 9274 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.UnsavedChangesWarning, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_commands_namespaceObject.CommandMenu, {}), canvas === 'view' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SaveKeyboardShortcut, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 9275 ...navigateRegionsProps, 9276 ref: navigateRegionsProps.ref, 9277 className: dist_clsx('edit-site-layout', navigateRegionsProps.className, { 9278 'is-full-canvas': canvas === 'edit', 9279 'show-icon-labels': showIconLabels 9280 }), 9281 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 9282 className: "edit-site-layout__content", 9283 children: [(!isMobileViewport || !areas.mobile) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(layout_NavigableRegion, { 9284 ariaLabel: (0,external_wp_i18n_namespaceObject.__)('Navigation'), 9285 className: "edit-site-layout__sidebar-region", 9286 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { 9287 children: canvas === 'view' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__unstableMotion.div, { 9288 initial: { 9289 opacity: 0 9290 }, 9291 animate: { 9292 opacity: 1 9293 }, 9294 exit: { 9295 opacity: 0 9296 }, 9297 transition: { 9298 type: 'tween', 9299 duration: 9300 // Disable transition in mobile to emulate a full page transition. 9301 disableMotion || isMobileViewport ? 0 : layout_ANIMATION_DURATION, 9302 ease: 'easeOut' 9303 }, 9304 className: "edit-site-layout__sidebar", 9305 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(site_hub, { 9306 ref: toggleRef, 9307 isTransparent: isResizableFrameOversized 9308 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationProvider, { 9309 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarContent, { 9310 shouldAnimate: routeKey !== 'styles', 9311 routeKey: routeKey, 9312 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.ErrorBoundary, { 9313 children: areas.sidebar 9314 }) 9315 }) 9316 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SaveHub, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SavePanel, {})] 9317 }) 9318 }) 9319 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.EditorSnackbars, {}), isMobileViewport && areas.mobile && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 9320 className: "edit-site-layout__mobile", 9321 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationProvider, { 9322 children: canvas !== 'edit' ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 9323 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SiteHubMobile, { 9324 ref: toggleRef, 9325 isTransparent: isResizableFrameOversized 9326 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarContent, { 9327 routeKey: routeKey, 9328 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.ErrorBoundary, { 9329 children: areas.mobile 9330 }) 9331 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SaveHub, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SavePanel, {})] 9332 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.ErrorBoundary, { 9333 children: areas.mobile 9334 }) 9335 }) 9336 }), !isMobileViewport && areas.content && canvas !== 'edit' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 9337 className: "edit-site-layout__area", 9338 style: { 9339 maxWidth: widths?.content 9340 }, 9341 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.ErrorBoundary, { 9342 children: areas.content 9343 }) 9344 }), !isMobileViewport && areas.edit && canvas !== 'edit' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 9345 className: "edit-site-layout__area", 9346 style: { 9347 maxWidth: widths?.edit 9348 }, 9349 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.ErrorBoundary, { 9350 children: areas.edit 9351 }) 9352 }), !isMobileViewport && areas.preview && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 9353 className: "edit-site-layout__canvas-container", 9354 children: [canvasResizer, !!canvasSize.width && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 9355 className: dist_clsx('edit-site-layout__canvas', { 9356 'is-right-aligned': isResizableFrameOversized 9357 }), 9358 ref: animationRef, 9359 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.ErrorBoundary, { 9360 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(resizable_frame, { 9361 isReady: !isEditorLoading, 9362 isFullWidth: canvas === 'edit', 9363 defaultSize: { 9364 width: canvasSize.width - 24 /* $canvas-padding */, 9365 height: canvasSize.height 9366 }, 9367 isOversized: isResizableFrameOversized, 9368 setIsOversized: setIsResizableFrameOversized, 9369 innerContentStyle: { 9370 background: gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor 9371 }, 9372 children: areas.preview 9373 }) 9374 }) 9375 })] 9376 })] 9377 }) 9378 })] 9379 }); 9380 } 9381 function LayoutWithGlobalStylesProvider(props) { 9382 const { 9383 createErrorNotice 9384 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 9385 function onPluginAreaError(name) { 9386 createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: plugin name */ 9387 (0,external_wp_i18n_namespaceObject.__)('The "%s" plugin has encountered an error and cannot be rendered.'), name)); 9388 } 9389 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SlotFillProvider, { 9390 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(GlobalStylesProvider, { 9391 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_plugins_namespaceObject.PluginArea, { 9392 onError: onPluginAreaError 9393 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Layout, { 9394 ...props 9395 })] 9396 }) 9397 }); 9398 } 9399 9400 ;// ./node_modules/@wordpress/icons/build-module/library/styles.js 9401 /** 9402 * WordPress dependencies 9403 */ 9404 9405 9406 const styles = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 9407 viewBox: "0 0 24 24", 9408 xmlns: "http://www.w3.org/2000/svg", 9409 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 9410 fillRule: "evenodd", 9411 clipRule: "evenodd", 9412 d: "M20 12a8 8 0 1 1-16 0 8 8 0 0 1 16 0Zm-1.5 0a6.5 6.5 0 0 1-6.5 6.5v-13a6.5 6.5 0 0 1 6.5 6.5Z" 9413 }) 9414 }); 9415 /* harmony default export */ const library_styles = (styles); 9416 9417 ;// ./node_modules/@wordpress/icons/build-module/library/help.js 9418 /** 9419 * WordPress dependencies 9420 */ 9421 9422 9423 const help = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 9424 xmlns: "http://www.w3.org/2000/svg", 9425 viewBox: "0 0 24 24", 9426 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 9427 d: "M12 4.75a7.25 7.25 0 100 14.5 7.25 7.25 0 000-14.5zM3.25 12a8.75 8.75 0 1117.5 0 8.75 8.75 0 01-17.5 0zM12 8.75a1.5 1.5 0 01.167 2.99c-.465.052-.917.44-.917 1.01V14h1.5v-.845A3 3 0 109 10.25h1.5a1.5 1.5 0 011.5-1.5zM11.25 15v1.5h1.5V15h-1.5z" 9428 }) 9429 }); 9430 /* harmony default export */ const library_help = (help); 9431 9432 ;// ./node_modules/@wordpress/icons/build-module/library/rotate-right.js 9433 /** 9434 * WordPress dependencies 9435 */ 9436 9437 9438 const rotateRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 9439 xmlns: "http://www.w3.org/2000/svg", 9440 viewBox: "0 0 24 24", 9441 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 9442 d: "M15.1 4.8l-3-2.5V4c-4.4 0-8 3.6-8 8 0 3.7 2.5 6.9 6 7.7.3.1.6.1 1 .2l.2-1.5c-.4 0-.7-.1-1.1-.2l-.1.2v-.2c-2.6-.8-4.5-3.3-4.5-6.2 0-3.6 2.9-6.5 6.5-6.5v1.8l3-2.5zM20 11c-.2-1.4-.7-2.7-1.6-3.8l-1.2.8c.7.9 1.1 2 1.3 3.1L20 11zm-1.5 1.8c-.1.5-.2 1.1-.4 1.6s-.5 1-.8 1.5l1.2.9c.4-.5.8-1.1 1-1.8s.5-1.3.5-2l-1.5-.2zm-5.6 5.6l.2 1.5c1.4-.2 2.7-.7 3.8-1.6l-.9-1.1c-.9.7-2 1.1-3.1 1.2z" 9443 }) 9444 }); 9445 /* harmony default export */ const rotate_right = (rotateRight); 9446 9447 ;// ./node_modules/@wordpress/icons/build-module/library/rotate-left.js 9448 /** 9449 * WordPress dependencies 9450 */ 9451 9452 9453 const rotateLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 9454 xmlns: "http://www.w3.org/2000/svg", 9455 viewBox: "0 0 24 24", 9456 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 9457 d: "M12 4V2.2L9 4.8l3 2.5V5.5c3.6 0 6.5 2.9 6.5 6.5 0 2.9-1.9 5.3-4.5 6.2v.2l-.1-.2c-.4.1-.7.2-1.1.2l.2 1.5c.3 0 .6-.1 1-.2 3.5-.9 6-4 6-7.7 0-4.4-3.6-8-8-8zm-7.9 7l1.5.2c.1-1.2.5-2.3 1.2-3.2l-1.1-.9C4.8 8.2 4.3 9.6 4.1 11zm1.5 1.8l-1.5.2c.1.7.3 1.4.5 2 .3.7.6 1.3 1 1.8l1.2-.8c-.3-.5-.6-1-.8-1.5s-.4-1.1-.4-1.7zm1.5 5.5c1.1.9 2.4 1.4 3.8 1.6l.2-1.5c-1.1-.1-2.2-.5-3.1-1.2l-.9 1.1z" 9458 }) 9459 }); 9460 /* harmony default export */ const rotate_left = (rotateLeft); 9461 9462 ;// ./node_modules/@wordpress/icons/build-module/library/brush.js 9463 /** 9464 * WordPress dependencies 9465 */ 9466 9467 9468 const brush = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 9469 xmlns: "http://www.w3.org/2000/svg", 9470 viewBox: "0 0 24 24", 9471 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 9472 d: "M4 20h8v-1.5H4V20zM18.9 3.5c-.6-.6-1.5-.6-2.1 0l-7.2 7.2c-.4-.1-.7 0-1.1.1-.5.2-1.5.7-1.9 2.2-.4 1.7-.8 2.2-1.1 2.7-.1.1-.2.3-.3.4l-.6 1.1H6c2 0 3.4-.4 4.7-1.4.8-.6 1.2-1.4 1.3-2.3 0-.3 0-.5-.1-.7L19 5.7c.5-.6.5-1.6-.1-2.2zM9.7 14.7c-.7.5-1.5.8-2.4 1 .2-.5.5-1.2.8-2.3.2-.6.4-1 .8-1.1.5-.1 1 .1 1.3.3.2.2.3.5.2.8 0 .3-.1.9-.7 1.3z" 9473 }) 9474 }); 9475 /* harmony default export */ const library_brush = (brush); 9476 9477 ;// ./node_modules/@wordpress/icons/build-module/library/backup.js 9478 /** 9479 * WordPress dependencies 9480 */ 9481 9482 9483 const backup = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 9484 xmlns: "http://www.w3.org/2000/svg", 9485 viewBox: "0 0 24 24", 9486 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 9487 d: "M5.5 12h1.75l-2.5 3-2.5-3H4a8 8 0 113.134 6.35l.907-1.194A6.5 6.5 0 105.5 12zm9.53 1.97l-2.28-2.28V8.5a.75.75 0 00-1.5 0V12a.747.747 0 00.218.529l1.282-.84-1.28.842 2.5 2.5a.75.75 0 101.06-1.061z" 9488 }) 9489 }); 9490 /* harmony default export */ const library_backup = (backup); 9491 9492 ;// ./node_modules/@wordpress/icons/build-module/library/external.js 9493 /** 9494 * WordPress dependencies 9495 */ 9496 9497 9498 const external = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 9499 xmlns: "http://www.w3.org/2000/svg", 9500 viewBox: "0 0 24 24", 9501 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 9502 d: "M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z" 9503 }) 9504 }); 9505 /* harmony default export */ const library_external = (external); 9506 9507 ;// ./node_modules/@wordpress/edit-site/build-module/hooks/commands/use-common-commands.js 9508 /** 9509 * WordPress dependencies 9510 */ 9511 9512 9513 9514 9515 9516 9517 9518 9519 9520 9521 /** 9522 * Internal dependencies 9523 */ 9524 9525 9526 const { 9527 useGlobalStylesReset 9528 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 9529 const { 9530 useHistory: use_common_commands_useHistory, 9531 useLocation: use_common_commands_useLocation 9532 } = unlock(external_wp_router_namespaceObject.privateApis); 9533 const getGlobalStylesOpenStylesCommands = () => function useGlobalStylesOpenStylesCommands() { 9534 const { 9535 openGeneralSidebar 9536 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 9537 const { 9538 params 9539 } = use_common_commands_useLocation(); 9540 const { 9541 canvas = 'view' 9542 } = params; 9543 const history = use_common_commands_useHistory(); 9544 const isBlockBasedTheme = (0,external_wp_data_namespaceObject.useSelect)(select => { 9545 return select(external_wp_coreData_namespaceObject.store).getCurrentTheme().is_block_theme; 9546 }, []); 9547 const commands = (0,external_wp_element_namespaceObject.useMemo)(() => { 9548 if (!isBlockBasedTheme) { 9549 return []; 9550 } 9551 return [{ 9552 name: 'core/edit-site/open-styles', 9553 label: (0,external_wp_i18n_namespaceObject.__)('Open styles'), 9554 callback: ({ 9555 close 9556 }) => { 9557 close(); 9558 if (canvas !== 'edit') { 9559 history.navigate('/styles?canvas=edit', { 9560 transition: 'canvas-mode-edit-transition' 9561 }); 9562 } 9563 openGeneralSidebar('edit-site/global-styles'); 9564 }, 9565 icon: library_styles 9566 }]; 9567 }, [history, openGeneralSidebar, canvas, isBlockBasedTheme]); 9568 return { 9569 isLoading: false, 9570 commands 9571 }; 9572 }; 9573 const getGlobalStylesToggleWelcomeGuideCommands = () => function useGlobalStylesToggleWelcomeGuideCommands() { 9574 const { 9575 openGeneralSidebar 9576 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 9577 const { 9578 params 9579 } = use_common_commands_useLocation(); 9580 const { 9581 canvas = 'view' 9582 } = params; 9583 const { 9584 set 9585 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 9586 const history = use_common_commands_useHistory(); 9587 const isBlockBasedTheme = (0,external_wp_data_namespaceObject.useSelect)(select => { 9588 return select(external_wp_coreData_namespaceObject.store).getCurrentTheme().is_block_theme; 9589 }, []); 9590 const commands = (0,external_wp_element_namespaceObject.useMemo)(() => { 9591 if (!isBlockBasedTheme) { 9592 return []; 9593 } 9594 return [{ 9595 name: 'core/edit-site/toggle-styles-welcome-guide', 9596 label: (0,external_wp_i18n_namespaceObject.__)('Learn about styles'), 9597 callback: ({ 9598 close 9599 }) => { 9600 close(); 9601 if (canvas !== 'edit') { 9602 history.navigate('/styles?canvas=edit', { 9603 transition: 'canvas-mode-edit-transition' 9604 }); 9605 } 9606 openGeneralSidebar('edit-site/global-styles'); 9607 set('core/edit-site', 'welcomeGuideStyles', true); 9608 // sometimes there's a focus loss that happens after some time 9609 // that closes the modal, we need to force reopening it. 9610 setTimeout(() => { 9611 set('core/edit-site', 'welcomeGuideStyles', true); 9612 }, 500); 9613 }, 9614 icon: library_help 9615 }]; 9616 }, [history, openGeneralSidebar, canvas, isBlockBasedTheme, set]); 9617 return { 9618 isLoading: false, 9619 commands 9620 }; 9621 }; 9622 const getGlobalStylesResetCommands = () => function useGlobalStylesResetCommands() { 9623 const [canReset, onReset] = useGlobalStylesReset(); 9624 const commands = (0,external_wp_element_namespaceObject.useMemo)(() => { 9625 if (!canReset) { 9626 return []; 9627 } 9628 return [{ 9629 name: 'core/edit-site/reset-global-styles', 9630 label: (0,external_wp_i18n_namespaceObject.__)('Reset styles'), 9631 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? rotate_right : rotate_left, 9632 callback: ({ 9633 close 9634 }) => { 9635 close(); 9636 onReset(); 9637 } 9638 }]; 9639 }, [canReset, onReset]); 9640 return { 9641 isLoading: false, 9642 commands 9643 }; 9644 }; 9645 const getGlobalStylesOpenCssCommands = () => function useGlobalStylesOpenCssCommands() { 9646 const { 9647 openGeneralSidebar, 9648 setEditorCanvasContainerView 9649 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 9650 const { 9651 params 9652 } = use_common_commands_useLocation(); 9653 const { 9654 canvas = 'view' 9655 } = params; 9656 const history = use_common_commands_useHistory(); 9657 const { 9658 canEditCSS 9659 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 9660 const { 9661 getEntityRecord, 9662 __experimentalGetCurrentGlobalStylesId 9663 } = select(external_wp_coreData_namespaceObject.store); 9664 const globalStylesId = __experimentalGetCurrentGlobalStylesId(); 9665 const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined; 9666 return { 9667 canEditCSS: !!globalStyles?._links?.['wp:action-edit-css'] 9668 }; 9669 }, []); 9670 const commands = (0,external_wp_element_namespaceObject.useMemo)(() => { 9671 if (!canEditCSS) { 9672 return []; 9673 } 9674 return [{ 9675 name: 'core/edit-site/open-styles-css', 9676 label: (0,external_wp_i18n_namespaceObject.__)('Customize CSS'), 9677 icon: library_brush, 9678 callback: ({ 9679 close 9680 }) => { 9681 close(); 9682 if (canvas !== 'edit') { 9683 history.navigate('/styles?canvas=edit', { 9684 transition: 'canvas-mode-edit-transition' 9685 }); 9686 } 9687 openGeneralSidebar('edit-site/global-styles'); 9688 setEditorCanvasContainerView('global-styles-css'); 9689 } 9690 }]; 9691 }, [history, openGeneralSidebar, setEditorCanvasContainerView, canEditCSS, canvas]); 9692 return { 9693 isLoading: false, 9694 commands 9695 }; 9696 }; 9697 const getGlobalStylesOpenRevisionsCommands = () => function useGlobalStylesOpenRevisionsCommands() { 9698 const { 9699 openGeneralSidebar, 9700 setEditorCanvasContainerView 9701 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 9702 const { 9703 params 9704 } = use_common_commands_useLocation(); 9705 const { 9706 canvas = 'view' 9707 } = params; 9708 const history = use_common_commands_useHistory(); 9709 const hasRevisions = (0,external_wp_data_namespaceObject.useSelect)(select => { 9710 const { 9711 getEntityRecord, 9712 __experimentalGetCurrentGlobalStylesId 9713 } = select(external_wp_coreData_namespaceObject.store); 9714 const globalStylesId = __experimentalGetCurrentGlobalStylesId(); 9715 const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined; 9716 return !!globalStyles?._links?.['version-history']?.[0]?.count; 9717 }, []); 9718 const commands = (0,external_wp_element_namespaceObject.useMemo)(() => { 9719 if (!hasRevisions) { 9720 return []; 9721 } 9722 return [{ 9723 name: 'core/edit-site/open-global-styles-revisions', 9724 label: (0,external_wp_i18n_namespaceObject.__)('Style revisions'), 9725 icon: library_backup, 9726 callback: ({ 9727 close 9728 }) => { 9729 close(); 9730 if (canvas !== 'edit') { 9731 history.navigate('/styles?canvas=edit', { 9732 transition: 'canvas-mode-edit-transition' 9733 }); 9734 } 9735 openGeneralSidebar('edit-site/global-styles'); 9736 setEditorCanvasContainerView('global-styles-revisions'); 9737 } 9738 }]; 9739 }, [hasRevisions, history, openGeneralSidebar, setEditorCanvasContainerView, canvas]); 9740 return { 9741 isLoading: false, 9742 commands 9743 }; 9744 }; 9745 function useCommonCommands() { 9746 const homeUrl = (0,external_wp_data_namespaceObject.useSelect)(select => { 9747 // Site index. 9748 return select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', '__unstableBase')?.home; 9749 }, []); 9750 (0,external_wp_commands_namespaceObject.useCommand)({ 9751 name: 'core/edit-site/view-site', 9752 label: (0,external_wp_i18n_namespaceObject.__)('View site'), 9753 callback: ({ 9754 close 9755 }) => { 9756 close(); 9757 window.open(homeUrl, '_blank'); 9758 }, 9759 icon: library_external 9760 }); 9761 (0,external_wp_commands_namespaceObject.useCommandLoader)({ 9762 name: 'core/edit-site/open-styles', 9763 hook: getGlobalStylesOpenStylesCommands() 9764 }); 9765 (0,external_wp_commands_namespaceObject.useCommandLoader)({ 9766 name: 'core/edit-site/toggle-styles-welcome-guide', 9767 hook: getGlobalStylesToggleWelcomeGuideCommands() 9768 }); 9769 (0,external_wp_commands_namespaceObject.useCommandLoader)({ 9770 name: 'core/edit-site/reset-global-styles', 9771 hook: getGlobalStylesResetCommands() 9772 }); 9773 (0,external_wp_commands_namespaceObject.useCommandLoader)({ 9774 name: 'core/edit-site/open-styles-css', 9775 hook: getGlobalStylesOpenCssCommands() 9776 }); 9777 (0,external_wp_commands_namespaceObject.useCommandLoader)({ 9778 name: 'core/edit-site/open-styles-revisions', 9779 hook: getGlobalStylesOpenRevisionsCommands() 9780 }); 9781 } 9782 9783 ;// ./node_modules/@wordpress/icons/build-module/library/close-small.js 9784 /** 9785 * WordPress dependencies 9786 */ 9787 9788 9789 const closeSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 9790 xmlns: "http://www.w3.org/2000/svg", 9791 viewBox: "0 0 24 24", 9792 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 9793 d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z" 9794 }) 9795 }); 9796 /* harmony default export */ const close_small = (closeSmall); 9797 9798 ;// ./node_modules/@wordpress/edit-site/build-module/components/editor-canvas-container/index.js 9799 /** 9800 * WordPress dependencies 9801 */ 9802 9803 9804 9805 9806 9807 9808 9809 9810 9811 9812 /** 9813 * Internal dependencies 9814 */ 9815 9816 9817 9818 const { 9819 EditorContentSlotFill, 9820 ResizableEditor 9821 } = unlock(external_wp_editor_namespaceObject.privateApis); 9822 9823 /** 9824 * Returns a translated string for the title of the editor canvas container. 9825 * 9826 * @param {string} view Editor canvas container view. 9827 * 9828 * @return {Object} Translated string for the view title and associated icon, both defaulting to ''. 9829 */ 9830 function getEditorCanvasContainerTitle(view) { 9831 switch (view) { 9832 case 'style-book': 9833 return (0,external_wp_i18n_namespaceObject.__)('Style Book'); 9834 case 'global-styles-revisions': 9835 case 'global-styles-revisions:style-book': 9836 return (0,external_wp_i18n_namespaceObject.__)('Style Revisions'); 9837 default: 9838 return ''; 9839 } 9840 } 9841 function EditorCanvasContainer({ 9842 children, 9843 closeButtonLabel, 9844 onClose, 9845 enableResizing = false 9846 }) { 9847 const { 9848 editorCanvasContainerView, 9849 showListViewByDefault 9850 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 9851 const _editorCanvasContainerView = unlock(select(store)).getEditorCanvasContainerView(); 9852 const _showListViewByDefault = select(external_wp_preferences_namespaceObject.store).get('core', 'showListViewByDefault'); 9853 return { 9854 editorCanvasContainerView: _editorCanvasContainerView, 9855 showListViewByDefault: _showListViewByDefault 9856 }; 9857 }, []); 9858 const [isClosed, setIsClosed] = (0,external_wp_element_namespaceObject.useState)(false); 9859 const { 9860 setEditorCanvasContainerView 9861 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 9862 const { 9863 setIsListViewOpened 9864 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); 9865 const focusOnMountRef = (0,external_wp_compose_namespaceObject.useFocusOnMount)('firstElement'); 9866 const sectionFocusReturnRef = (0,external_wp_compose_namespaceObject.useFocusReturn)(); 9867 function onCloseContainer() { 9868 setIsListViewOpened(showListViewByDefault); 9869 setEditorCanvasContainerView(undefined); 9870 setIsClosed(true); 9871 if (typeof onClose === 'function') { 9872 onClose(); 9873 } 9874 } 9875 function closeOnEscape(event) { 9876 if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) { 9877 event.preventDefault(); 9878 onCloseContainer(); 9879 } 9880 } 9881 const childrenWithProps = Array.isArray(children) ? external_wp_element_namespaceObject.Children.map(children, (child, index) => index === 0 ? (0,external_wp_element_namespaceObject.cloneElement)(child, { 9882 ref: sectionFocusReturnRef 9883 }) : child) : (0,external_wp_element_namespaceObject.cloneElement)(children, { 9884 ref: sectionFocusReturnRef 9885 }); 9886 if (isClosed) { 9887 return null; 9888 } 9889 const title = getEditorCanvasContainerTitle(editorCanvasContainerView); 9890 const shouldShowCloseButton = onClose || closeButtonLabel; 9891 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditorContentSlotFill.Fill, { 9892 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 9893 className: "edit-site-editor-canvas-container", 9894 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ResizableEditor, { 9895 enableResizing: enableResizing, 9896 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("section", { 9897 className: "edit-site-editor-canvas-container__section", 9898 ref: shouldShowCloseButton ? focusOnMountRef : null, 9899 onKeyDown: closeOnEscape, 9900 "aria-label": title, 9901 children: [shouldShowCloseButton && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 9902 size: "compact", 9903 className: "edit-site-editor-canvas-container__close-button", 9904 icon: close_small, 9905 label: closeButtonLabel || (0,external_wp_i18n_namespaceObject.__)('Close'), 9906 onClick: onCloseContainer 9907 }), childrenWithProps] 9908 }) 9909 }) 9910 }) 9911 }); 9912 } 9913 function useHasEditorCanvasContainer() { 9914 const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(EditorContentSlotFill.name); 9915 return !!fills?.length; 9916 } 9917 /* harmony default export */ const editor_canvas_container = (EditorCanvasContainer); 9918 9919 9920 ;// ./node_modules/@wordpress/edit-site/build-module/hooks/commands/use-set-command-context.js 9921 /** 9922 * WordPress dependencies 9923 */ 9924 9925 9926 9927 9928 9929 /** 9930 * Internal dependencies 9931 */ 9932 9933 9934 const { 9935 useCommandContext 9936 } = unlock(external_wp_commands_namespaceObject.privateApis); 9937 const { 9938 useLocation: use_set_command_context_useLocation 9939 } = unlock(external_wp_router_namespaceObject.privateApis); 9940 9941 /** 9942 * React hook used to set the correct command context based on the current state. 9943 */ 9944 function useSetCommandContext() { 9945 const { 9946 query = {} 9947 } = use_set_command_context_useLocation(); 9948 const { 9949 canvas = 'view' 9950 } = query; 9951 const hasBlockSelected = (0,external_wp_data_namespaceObject.useSelect)(select => { 9952 return select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart(); 9953 }, []); 9954 const hasEditorCanvasContainer = useHasEditorCanvasContainer(); 9955 9956 // Sets the right context for the command palette 9957 let commandContext = 'site-editor'; 9958 if (canvas === 'edit') { 9959 commandContext = 'entity-edit'; 9960 } 9961 if (hasBlockSelected) { 9962 commandContext = 'block-selection-edit'; 9963 } 9964 if (hasEditorCanvasContainer) { 9965 /* 9966 * The editor canvas overlay will likely be deprecated in the future, so for now we clear the command context 9967 * to remove the suggested commands that may not make sense with Style Book or Style Revisions open. 9968 * See https://github.com/WordPress/gutenberg/issues/62216. 9969 */ 9970 commandContext = ''; 9971 } 9972 useCommandContext(commandContext); 9973 } 9974 9975 ;// ./node_modules/@wordpress/icons/build-module/library/navigation.js 9976 /** 9977 * WordPress dependencies 9978 */ 9979 9980 9981 const navigation = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 9982 viewBox: "0 0 24 24", 9983 xmlns: "http://www.w3.org/2000/svg", 9984 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 9985 d: "M12 4c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8zm0 14.5c-3.6 0-6.5-2.9-6.5-6.5S8.4 5.5 12 5.5s6.5 2.9 6.5 6.5-2.9 6.5-6.5 6.5zM9 16l4.5-3L15 8.4l-4.5 3L9 16z" 9986 }) 9987 }); 9988 /* harmony default export */ const library_navigation = (navigation); 9989 9990 ;// ./node_modules/@wordpress/icons/build-module/library/page.js 9991 /** 9992 * WordPress dependencies 9993 */ 9994 9995 9996 const page = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { 9997 xmlns: "http://www.w3.org/2000/svg", 9998 viewBox: "0 0 24 24", 9999 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 10000 d: "M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z" 10001 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 10002 d: "M17 4H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2ZM7 5.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5Z" 10003 })] 10004 }); 10005 /* harmony default export */ const library_page = (page); 10006 10007 ;// ./node_modules/@wordpress/icons/build-module/library/layout.js 10008 /** 10009 * WordPress dependencies 10010 */ 10011 10012 10013 const layout = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 10014 xmlns: "http://www.w3.org/2000/svg", 10015 viewBox: "0 0 24 24", 10016 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 10017 d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" 10018 }) 10019 }); 10020 /* harmony default export */ const library_layout = (layout); 10021 10022 ;// ./node_modules/@wordpress/icons/build-module/library/symbol.js 10023 /** 10024 * WordPress dependencies 10025 */ 10026 10027 10028 const symbol = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 10029 xmlns: "http://www.w3.org/2000/svg", 10030 viewBox: "0 0 24 24", 10031 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 10032 d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-1 1.4l-5.6 5.6c-.1.1-.3.1-.4 0l-5.6-5.6c-.1-.1-.1-.3 0-.4l5.6-5.6s.1-.1.2-.1.1 0 .2.1l5.6 5.6c.1.1.1.3 0 .4zm-16.6-.4L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z" 10033 }) 10034 }); 10035 /* harmony default export */ const library_symbol = (symbol); 10036 10037 ;// ./node_modules/@wordpress/icons/build-module/library/chevron-right.js 10038 /** 10039 * WordPress dependencies 10040 */ 10041 10042 10043 const chevronRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 10044 xmlns: "http://www.w3.org/2000/svg", 10045 viewBox: "0 0 24 24", 10046 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 10047 d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" 10048 }) 10049 }); 10050 /* harmony default export */ const chevron_right = (chevronRight); 10051 10052 ;// ./node_modules/@wordpress/icons/build-module/library/chevron-left.js 10053 /** 10054 * WordPress dependencies 10055 */ 10056 10057 10058 const chevronLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 10059 xmlns: "http://www.w3.org/2000/svg", 10060 viewBox: "0 0 24 24", 10061 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 10062 d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" 10063 }) 10064 }); 10065 /* harmony default export */ const chevron_left = (chevronLeft); 10066 10067 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-button/index.js 10068 /** 10069 * External dependencies 10070 */ 10071 10072 10073 /** 10074 * WordPress dependencies 10075 */ 10076 10077 10078 function SidebarButton(props) { 10079 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 10080 size: "compact", 10081 ...props, 10082 className: dist_clsx('edit-site-sidebar-button', props.className) 10083 }); 10084 } 10085 10086 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen/index.js 10087 /** 10088 * External dependencies 10089 */ 10090 10091 10092 /** 10093 * WordPress dependencies 10094 */ 10095 10096 10097 10098 10099 10100 10101 10102 10103 /** 10104 * Internal dependencies 10105 */ 10106 10107 10108 10109 10110 10111 10112 const { 10113 useHistory: sidebar_navigation_screen_useHistory, 10114 useLocation: sidebar_navigation_screen_useLocation 10115 } = unlock(external_wp_router_namespaceObject.privateApis); 10116 function SidebarNavigationScreen({ 10117 isRoot, 10118 title, 10119 actions, 10120 content, 10121 footer, 10122 description, 10123 backPath: backPathProp 10124 }) { 10125 const { 10126 dashboardLink, 10127 dashboardLinkText, 10128 previewingThemeName 10129 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 10130 const { 10131 getSettings 10132 } = unlock(select(store)); 10133 const currentlyPreviewingThemeId = currentlyPreviewingTheme(); 10134 return { 10135 dashboardLink: getSettings().__experimentalDashboardLink, 10136 dashboardLinkText: getSettings().__experimentalDashboardLinkText, 10137 // Do not call `getTheme` with null, it will cause a request to 10138 // the server. 10139 previewingThemeName: currentlyPreviewingThemeId ? select(external_wp_coreData_namespaceObject.store).getTheme(currentlyPreviewingThemeId)?.name?.rendered : undefined 10140 }; 10141 }, []); 10142 const location = sidebar_navigation_screen_useLocation(); 10143 const history = sidebar_navigation_screen_useHistory(); 10144 const { 10145 navigate 10146 } = (0,external_wp_element_namespaceObject.useContext)(SidebarNavigationContext); 10147 const backPath = backPathProp !== null && backPathProp !== void 0 ? backPathProp : location.state?.backPath; 10148 const icon = (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left; 10149 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 10150 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 10151 className: dist_clsx('edit-site-sidebar-navigation-screen__main', { 10152 'has-footer': !!footer 10153 }), 10154 spacing: 0, 10155 justify: "flex-start", 10156 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 10157 spacing: 3, 10158 alignment: "flex-start", 10159 className: "edit-site-sidebar-navigation-screen__title-icon", 10160 children: [!isRoot && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarButton, { 10161 onClick: () => { 10162 history.navigate(backPath); 10163 navigate('back'); 10164 }, 10165 icon: icon, 10166 label: (0,external_wp_i18n_namespaceObject.__)('Back'), 10167 showTooltip: false 10168 }), isRoot && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarButton, { 10169 icon: icon, 10170 label: dashboardLinkText || (0,external_wp_i18n_namespaceObject.__)('Go to the Dashboard'), 10171 href: dashboardLink 10172 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 10173 className: "edit-site-sidebar-navigation-screen__title", 10174 color: '#e0e0e0' /* $gray-200 */, 10175 level: 1, 10176 size: 20, 10177 children: !isPreviewingTheme() ? title : (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: theme name. 2: title */ 10178 (0,external_wp_i18n_namespaceObject.__)('Previewing %1$s: %2$s'), previewingThemeName, title) 10179 }), actions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 10180 className: "edit-site-sidebar-navigation-screen__actions", 10181 children: actions 10182 })] 10183 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 10184 className: "edit-site-sidebar-navigation-screen__content", 10185 children: [description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 10186 className: "edit-site-sidebar-navigation-screen__description", 10187 children: description 10188 }), content] 10189 })] 10190 }), footer && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("footer", { 10191 className: "edit-site-sidebar-navigation-screen__footer", 10192 children: footer 10193 })] 10194 }); 10195 } 10196 10197 ;// ./node_modules/@wordpress/icons/build-module/icon/index.js 10198 /** 10199 * WordPress dependencies 10200 */ 10201 10202 10203 /** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */ 10204 10205 /** 10206 * Return an SVG icon. 10207 * 10208 * @param {IconProps} props icon is the SVG component to render 10209 * size is a number specifying the icon size in pixels 10210 * Other props will be passed to wrapped SVG component 10211 * @param {import('react').ForwardedRef<HTMLElement>} ref The forwarded ref to the SVG element. 10212 * 10213 * @return {JSX.Element} Icon component 10214 */ 10215 function Icon({ 10216 icon, 10217 size = 24, 10218 ...props 10219 }, ref) { 10220 return (0,external_wp_element_namespaceObject.cloneElement)(icon, { 10221 width: size, 10222 height: size, 10223 ...props, 10224 ref 10225 }); 10226 } 10227 /* harmony default export */ const build_module_icon = ((0,external_wp_element_namespaceObject.forwardRef)(Icon)); 10228 10229 ;// ./node_modules/@wordpress/icons/build-module/library/chevron-left-small.js 10230 /** 10231 * WordPress dependencies 10232 */ 10233 10234 10235 const chevronLeftSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 10236 xmlns: "http://www.w3.org/2000/svg", 10237 viewBox: "0 0 24 24", 10238 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 10239 d: "m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z" 10240 }) 10241 }); 10242 /* harmony default export */ const chevron_left_small = (chevronLeftSmall); 10243 10244 ;// ./node_modules/@wordpress/icons/build-module/library/chevron-right-small.js 10245 /** 10246 * WordPress dependencies 10247 */ 10248 10249 10250 const chevronRightSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 10251 xmlns: "http://www.w3.org/2000/svg", 10252 viewBox: "0 0 24 24", 10253 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 10254 d: "M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z" 10255 }) 10256 }); 10257 /* harmony default export */ const chevron_right_small = (chevronRightSmall); 10258 10259 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-item/index.js 10260 /** 10261 * External dependencies 10262 */ 10263 10264 10265 /** 10266 * WordPress dependencies 10267 */ 10268 10269 10270 10271 10272 10273 10274 /** 10275 * Internal dependencies 10276 */ 10277 10278 10279 10280 const { 10281 useHistory: sidebar_navigation_item_useHistory, 10282 useLink 10283 } = unlock(external_wp_router_namespaceObject.privateApis); 10284 function SidebarNavigationItem({ 10285 className, 10286 icon, 10287 withChevron = false, 10288 suffix, 10289 uid, 10290 to, 10291 onClick, 10292 children, 10293 ...props 10294 }) { 10295 const history = sidebar_navigation_item_useHistory(); 10296 const { 10297 navigate 10298 } = (0,external_wp_element_namespaceObject.useContext)(SidebarNavigationContext); 10299 // If there is no custom click handler, create one that navigates to `params`. 10300 function handleClick(e) { 10301 if (onClick) { 10302 onClick(e); 10303 navigate('forward'); 10304 } else if (to) { 10305 e.preventDefault(); 10306 history.navigate(to); 10307 navigate('forward', `[id="$uid}"]`); 10308 } 10309 } 10310 const linkProps = useLink(to); 10311 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItem, { 10312 className: dist_clsx('edit-site-sidebar-navigation-item', { 10313 'with-suffix': !withChevron && suffix 10314 }, className), 10315 id: uid, 10316 onClick: handleClick, 10317 href: to ? linkProps.href : undefined, 10318 ...props, 10319 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 10320 justify: "flex-start", 10321 children: [icon && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { 10322 style: { 10323 fill: 'currentcolor' 10324 }, 10325 icon: icon, 10326 size: 24 10327 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexBlock, { 10328 children: children 10329 }), withChevron && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { 10330 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_small : chevron_right_small, 10331 className: "edit-site-sidebar-navigation-item__drilldown-indicator", 10332 size: 24 10333 }), !withChevron && suffix] 10334 }) 10335 }); 10336 } 10337 10338 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js 10339 /** 10340 * WordPress dependencies 10341 */ 10342 10343 10344 10345 10346 10347 /** 10348 * Internal dependencies 10349 */ 10350 10351 const SITE_EDITOR_AUTHORS_QUERY = { 10352 per_page: -1, 10353 _fields: 'id,name,avatar_urls', 10354 context: 'view', 10355 capabilities: ['edit_theme_options'] 10356 }; 10357 const DEFAULT_QUERY = { 10358 per_page: 100, 10359 page: 1 10360 }; 10361 const use_global_styles_revisions_EMPTY_ARRAY = []; 10362 const { 10363 GlobalStylesContext: use_global_styles_revisions_GlobalStylesContext 10364 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 10365 function useGlobalStylesRevisions({ 10366 query 10367 } = {}) { 10368 const { 10369 user: userConfig 10370 } = (0,external_wp_element_namespaceObject.useContext)(use_global_styles_revisions_GlobalStylesContext); 10371 const _query = { 10372 ...DEFAULT_QUERY, 10373 ...query 10374 }; 10375 const { 10376 authors, 10377 currentUser, 10378 isDirty, 10379 revisions, 10380 isLoadingGlobalStylesRevisions, 10381 revisionsCount 10382 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 10383 var _globalStyles$_links$; 10384 const { 10385 __experimentalGetDirtyEntityRecords, 10386 getCurrentUser, 10387 getUsers, 10388 getRevisions, 10389 __experimentalGetCurrentGlobalStylesId, 10390 getEntityRecord, 10391 isResolving 10392 } = select(external_wp_coreData_namespaceObject.store); 10393 const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); 10394 const _currentUser = getCurrentUser(); 10395 const _isDirty = dirtyEntityRecords.length > 0; 10396 const globalStylesId = __experimentalGetCurrentGlobalStylesId(); 10397 const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined; 10398 const _revisionsCount = (_globalStyles$_links$ = globalStyles?._links?.['version-history']?.[0]?.count) !== null && _globalStyles$_links$ !== void 0 ? _globalStyles$_links$ : 0; 10399 const globalStylesRevisions = getRevisions('root', 'globalStyles', globalStylesId, _query) || use_global_styles_revisions_EMPTY_ARRAY; 10400 const _authors = getUsers(SITE_EDITOR_AUTHORS_QUERY) || use_global_styles_revisions_EMPTY_ARRAY; 10401 const _isResolving = isResolving('getRevisions', ['root', 'globalStyles', globalStylesId, _query]); 10402 return { 10403 authors: _authors, 10404 currentUser: _currentUser, 10405 isDirty: _isDirty, 10406 revisions: globalStylesRevisions, 10407 isLoadingGlobalStylesRevisions: _isResolving, 10408 revisionsCount: _revisionsCount 10409 }; 10410 }, [query]); 10411 return (0,external_wp_element_namespaceObject.useMemo)(() => { 10412 if (!authors.length || isLoadingGlobalStylesRevisions) { 10413 return { 10414 revisions: use_global_styles_revisions_EMPTY_ARRAY, 10415 hasUnsavedChanges: isDirty, 10416 isLoading: true, 10417 revisionsCount 10418 }; 10419 } 10420 10421 // Adds author details to each revision. 10422 const _modifiedRevisions = revisions.map(revision => { 10423 return { 10424 ...revision, 10425 author: authors.find(author => author.id === revision.author) 10426 }; 10427 }); 10428 const fetchedRevisionsCount = revisions.length; 10429 if (fetchedRevisionsCount) { 10430 // Flags the most current saved revision. 10431 if (_modifiedRevisions[0].id !== 'unsaved' && _query.page === 1) { 10432 _modifiedRevisions[0].isLatest = true; 10433 } 10434 10435 // Adds an item for unsaved changes. 10436 if (isDirty && userConfig && Object.keys(userConfig).length > 0 && currentUser && _query.page === 1) { 10437 const unsavedRevision = { 10438 id: 'unsaved', 10439 styles: userConfig?.styles, 10440 settings: userConfig?.settings, 10441 _links: userConfig?._links, 10442 author: { 10443 name: currentUser?.name, 10444 avatar_urls: currentUser?.avatar_urls 10445 }, 10446 modified: new Date() 10447 }; 10448 _modifiedRevisions.unshift(unsavedRevision); 10449 } 10450 if (_query.page === Math.ceil(revisionsCount / _query.per_page)) { 10451 // Adds an item for the default theme styles. 10452 _modifiedRevisions.push({ 10453 id: 'parent', 10454 styles: {}, 10455 settings: {} 10456 }); 10457 } 10458 } 10459 return { 10460 revisions: _modifiedRevisions, 10461 hasUnsavedChanges: isDirty, 10462 isLoading: false, 10463 revisionsCount 10464 }; 10465 }, [isDirty, revisions, currentUser, authors, userConfig, isLoadingGlobalStylesRevisions]); 10466 } 10467 10468 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-details-footer/index.js 10469 /** 10470 * WordPress dependencies 10471 */ 10472 10473 10474 10475 10476 10477 /** 10478 * Internal dependencies 10479 */ 10480 10481 10482 function SidebarNavigationScreenDetailsFooter({ 10483 record, 10484 revisionsCount, 10485 ...otherProps 10486 }) { 10487 var _record$_links$predec; 10488 /* 10489 * There might be other items in the future, 10490 * but for now it's just modified date. 10491 * Later we might render a list of items and isolate 10492 * the following logic. 10493 */ 10494 const hrefProps = {}; 10495 const lastRevisionId = (_record$_links$predec = record?._links?.['predecessor-version']?.[0]?.id) !== null && _record$_links$predec !== void 0 ? _record$_links$predec : null; 10496 10497 // Use incoming prop first, then the record's version history, if available. 10498 revisionsCount = revisionsCount || record?._links?.['version-history']?.[0]?.count || 0; 10499 10500 /* 10501 * Enable the revisions link if there is a last revision and there is more than one revision. 10502 * This link is used for theme assets, e.g., templates, which have no database record until they're edited. 10503 * For these files there's only a "revision" after they're edited twice, 10504 * which means the revision.php page won't display a proper diff. 10505 * See: https://github.com/WordPress/gutenberg/issues/49164. 10506 */ 10507 if (lastRevisionId && revisionsCount > 1) { 10508 hrefProps.href = (0,external_wp_url_namespaceObject.addQueryArgs)('revision.php', { 10509 revision: record?._links['predecessor-version'][0].id 10510 }); 10511 hrefProps.as = 'a'; 10512 } 10513 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 10514 size: "large", 10515 className: "edit-site-sidebar-navigation-screen-details-footer", 10516 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 10517 icon: library_backup, 10518 ...hrefProps, 10519 ...otherProps, 10520 children: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %d: Number of Styles revisions. */ 10521 (0,external_wp_i18n_namespaceObject._n)('%d Revision', '%d Revisions', revisionsCount), revisionsCount) 10522 }) 10523 }); 10524 } 10525 10526 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-global-styles/index.js 10527 /** 10528 * WordPress dependencies 10529 */ 10530 10531 10532 10533 10534 10535 10536 10537 /** 10538 * Internal dependencies 10539 */ 10540 10541 10542 10543 10544 10545 10546 10547 10548 const { 10549 useLocation: sidebar_navigation_screen_global_styles_useLocation, 10550 useHistory: sidebar_navigation_screen_global_styles_useHistory 10551 } = unlock(external_wp_router_namespaceObject.privateApis); 10552 function SidebarNavigationItemGlobalStyles(props) { 10553 const { 10554 name 10555 } = sidebar_navigation_screen_global_styles_useLocation(); 10556 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 10557 ...props, 10558 "aria-current": name === 'styles' 10559 }); 10560 } 10561 function SidebarNavigationScreenGlobalStyles() { 10562 const history = sidebar_navigation_screen_global_styles_useHistory(); 10563 const { 10564 path 10565 } = sidebar_navigation_screen_global_styles_useLocation(); 10566 const { 10567 revisions, 10568 isLoading: isLoadingRevisions, 10569 revisionsCount 10570 } = useGlobalStylesRevisions(); 10571 const { 10572 openGeneralSidebar 10573 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 10574 const { 10575 setEditorCanvasContainerView 10576 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 10577 const { 10578 set: setPreference 10579 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 10580 const openGlobalStyles = (0,external_wp_element_namespaceObject.useCallback)(async () => { 10581 history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { 10582 canvas: 'edit' 10583 }), { 10584 transition: 'canvas-mode-edit-transition' 10585 }); 10586 return Promise.all([setPreference('core', 'distractionFree', false), openGeneralSidebar('edit-site/global-styles')]); 10587 }, [path, history, openGeneralSidebar, setPreference]); 10588 const openRevisions = (0,external_wp_element_namespaceObject.useCallback)(async () => { 10589 await openGlobalStyles(); 10590 // Open the global styles revisions once the canvas mode is set to edit, 10591 // and the global styles sidebar is open. The global styles UI is responsible 10592 // for redirecting to the revisions screen once the editor canvas container 10593 // has been set to 'global-styles-revisions'. 10594 setEditorCanvasContainerView('global-styles-revisions'); 10595 }, [openGlobalStyles, setEditorCanvasContainerView]); 10596 10597 // If there are no revisions, do not render a footer. 10598 const shouldShowGlobalStylesFooter = !!revisionsCount && !isLoadingRevisions; 10599 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { 10600 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { 10601 title: (0,external_wp_i18n_namespaceObject.__)('Design'), 10602 isRoot: true, 10603 description: (0,external_wp_i18n_namespaceObject.__)('Customize the appearance of your website using the block editor.'), 10604 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MainSidebarNavigationContent, { 10605 activeItem: "styles-navigation-item" 10606 }), 10607 footer: shouldShowGlobalStylesFooter && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenDetailsFooter, { 10608 record: revisions?.[0], 10609 revisionsCount: revisionsCount, 10610 onClick: openRevisions 10611 }) 10612 }) 10613 }); 10614 } 10615 10616 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-main/index.js 10617 /** 10618 * WordPress dependencies 10619 */ 10620 10621 10622 10623 10624 10625 10626 10627 /** 10628 * Internal dependencies 10629 */ 10630 10631 10632 10633 10634 10635 10636 function MainSidebarNavigationContent({ 10637 isBlockBasedTheme = true 10638 }) { 10639 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { 10640 className: "edit-site-sidebar-navigation-screen-main", 10641 children: [isBlockBasedTheme && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 10642 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 10643 uid: "navigation-navigation-item", 10644 to: "/navigation", 10645 withChevron: true, 10646 icon: library_navigation, 10647 children: (0,external_wp_i18n_namespaceObject.__)('Navigation') 10648 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItemGlobalStyles, { 10649 to: "/styles", 10650 uid: "global-styles-navigation-item", 10651 icon: library_styles, 10652 children: (0,external_wp_i18n_namespaceObject.__)('Styles') 10653 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 10654 uid: "page-navigation-item", 10655 to: "/page", 10656 withChevron: true, 10657 icon: library_page, 10658 children: (0,external_wp_i18n_namespaceObject.__)('Pages') 10659 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 10660 uid: "template-navigation-item", 10661 to: "/template", 10662 withChevron: true, 10663 icon: library_layout, 10664 children: (0,external_wp_i18n_namespaceObject.__)('Templates') 10665 })] 10666 }), !isBlockBasedTheme && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 10667 uid: "stylebook-navigation-item", 10668 to: "/stylebook", 10669 withChevron: true, 10670 icon: library_styles, 10671 children: (0,external_wp_i18n_namespaceObject.__)('Styles') 10672 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 10673 uid: "patterns-navigation-item", 10674 to: "/pattern", 10675 withChevron: true, 10676 icon: library_symbol, 10677 children: (0,external_wp_i18n_namespaceObject.__)('Patterns') 10678 })] 10679 }); 10680 } 10681 function SidebarNavigationScreenMain({ 10682 customDescription 10683 }) { 10684 const isBlockBasedTheme = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme, []); 10685 const { 10686 setEditorCanvasContainerView 10687 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 10688 10689 // Clear the editor canvas container view when accessing the main navigation screen. 10690 (0,external_wp_element_namespaceObject.useEffect)(() => { 10691 setEditorCanvasContainerView(undefined); 10692 }, [setEditorCanvasContainerView]); 10693 let description; 10694 if (customDescription) { 10695 description = customDescription; 10696 } else if (isBlockBasedTheme) { 10697 description = (0,external_wp_i18n_namespaceObject.__)('Customize the appearance of your website using the block editor.'); 10698 } else { 10699 description = (0,external_wp_i18n_namespaceObject.__)('Explore block styles and patterns to refine your site.'); 10700 } 10701 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { 10702 isRoot: true, 10703 title: (0,external_wp_i18n_namespaceObject.__)('Design'), 10704 description: description, 10705 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MainSidebarNavigationContent, { 10706 isBlockBasedTheme: isBlockBasedTheme 10707 }) 10708 }); 10709 } 10710 10711 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-unsupported/index.js 10712 /** 10713 * WordPress dependencies 10714 */ 10715 10716 10717 10718 function SidebarNavigationScreenUnsupported() { 10719 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 10720 padding: 3, 10721 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { 10722 status: "warning", 10723 isDismissible: false, 10724 children: (0,external_wp_i18n_namespaceObject.__)('The theme you are currently using does not support this screen.') 10725 }) 10726 }); 10727 } 10728 10729 ;// ./node_modules/@wordpress/icons/build-module/library/arrow-up-left.js 10730 /** 10731 * WordPress dependencies 10732 */ 10733 10734 10735 const arrowUpLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 10736 xmlns: "http://www.w3.org/2000/svg", 10737 viewBox: "0 0 24 24", 10738 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 10739 d: "M14 6H6v8h1.5V8.5L17 18l1-1-9.5-9.5H14V6Z" 10740 }) 10741 }); 10742 /* harmony default export */ const arrow_up_left = (arrowUpLeft); 10743 10744 ;// ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/image.js 10745 10746 function WelcomeGuideImage({ 10747 nonAnimatedSrc, 10748 animatedSrc 10749 }) { 10750 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("picture", { 10751 className: "edit-site-welcome-guide__image", 10752 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("source", { 10753 srcSet: nonAnimatedSrc, 10754 media: "(prefers-reduced-motion: reduce)" 10755 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 10756 src: animatedSrc, 10757 width: "312", 10758 height: "240", 10759 alt: "" 10760 })] 10761 }); 10762 } 10763 10764 ;// ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/editor.js 10765 /** 10766 * WordPress dependencies 10767 */ 10768 10769 10770 10771 10772 10773 10774 10775 /** 10776 * Internal dependencies 10777 */ 10778 10779 10780 function WelcomeGuideEditor() { 10781 const { 10782 toggle 10783 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 10784 const { 10785 isActive, 10786 isBlockBasedTheme 10787 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 10788 return { 10789 isActive: !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', 'welcomeGuide'), 10790 isBlockBasedTheme: select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme 10791 }; 10792 }, []); 10793 if (!isActive || !isBlockBasedTheme) { 10794 return null; 10795 } 10796 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Guide, { 10797 className: "edit-site-welcome-guide guide-editor", 10798 contentLabel: (0,external_wp_i18n_namespaceObject.__)('Welcome to the site editor'), 10799 finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get started'), 10800 onFinish: () => toggle('core/edit-site', 'welcomeGuide'), 10801 pages: [{ 10802 image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideImage, { 10803 nonAnimatedSrc: "https://s.w.org/images/block-editor/edit-your-site.svg?1", 10804 animatedSrc: "https://s.w.org/images/block-editor/edit-your-site.gif?1" 10805 }), 10806 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 10807 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { 10808 className: "edit-site-welcome-guide__heading", 10809 children: (0,external_wp_i18n_namespaceObject.__)('Edit your site') 10810 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 10811 className: "edit-site-welcome-guide__text", 10812 children: (0,external_wp_i18n_namespaceObject.__)('Design everything on your site — from the header right down to the footer — using blocks.') 10813 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 10814 className: "edit-site-welcome-guide__text", 10815 children: (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('Click <StylesIconImage /> to start designing your blocks, and choose your typography, layout, and colors.'), { 10816 StylesIconImage: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 10817 alt: (0,external_wp_i18n_namespaceObject.__)('styles'), 10818 src: "data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 4c-4.4 0-8 3.6-8 8v.1c0 4.1 3.2 7.5 7.2 7.9h.8c4.4 0 8-3.6 8-8s-3.6-8-8-8zm0 15V5c3.9 0 7 3.1 7 7s-3.1 7-7 7z' fill='%231E1E1E'/%3E%3C/svg%3E%0A" 10819 }) 10820 }) 10821 })] 10822 }) 10823 }] 10824 }); 10825 } 10826 10827 ;// ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/styles.js 10828 /** 10829 * WordPress dependencies 10830 */ 10831 10832 10833 10834 10835 10836 10837 /** 10838 * Internal dependencies 10839 */ 10840 10841 10842 10843 const { 10844 interfaceStore: styles_interfaceStore 10845 } = unlock(external_wp_editor_namespaceObject.privateApis); 10846 function WelcomeGuideStyles() { 10847 const { 10848 toggle 10849 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 10850 const { 10851 isActive, 10852 isStylesOpen 10853 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 10854 const sidebar = select(styles_interfaceStore).getActiveComplementaryArea('core'); 10855 return { 10856 isActive: !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', 'welcomeGuideStyles'), 10857 isStylesOpen: sidebar === 'edit-site/global-styles' 10858 }; 10859 }, []); 10860 if (!isActive || !isStylesOpen) { 10861 return null; 10862 } 10863 const welcomeLabel = (0,external_wp_i18n_namespaceObject.__)('Welcome to Styles'); 10864 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Guide, { 10865 className: "edit-site-welcome-guide guide-styles", 10866 contentLabel: welcomeLabel, 10867 finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get started'), 10868 onFinish: () => toggle('core/edit-site', 'welcomeGuideStyles'), 10869 pages: [{ 10870 image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideImage, { 10871 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-to-styles.svg?1", 10872 animatedSrc: "https://s.w.org/images/block-editor/welcome-to-styles.gif?1" 10873 }), 10874 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 10875 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { 10876 className: "edit-site-welcome-guide__heading", 10877 children: welcomeLabel 10878 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 10879 className: "edit-site-welcome-guide__text", 10880 children: (0,external_wp_i18n_namespaceObject.__)('Tweak your site, or give it a whole new look! Get creative — how about a new color palette for your buttons, or choosing a new font? Take a look at what you can do here.') 10881 })] 10882 }) 10883 }, { 10884 image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideImage, { 10885 nonAnimatedSrc: "https://s.w.org/images/block-editor/set-the-design.svg?1", 10886 animatedSrc: "https://s.w.org/images/block-editor/set-the-design.gif?1" 10887 }), 10888 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 10889 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { 10890 className: "edit-site-welcome-guide__heading", 10891 children: (0,external_wp_i18n_namespaceObject.__)('Set the design') 10892 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 10893 className: "edit-site-welcome-guide__text", 10894 children: (0,external_wp_i18n_namespaceObject.__)('You can customize your site as much as you like with different colors, typography, and layouts. Or if you prefer, just leave it up to your theme to handle!') 10895 })] 10896 }) 10897 }, { 10898 image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideImage, { 10899 nonAnimatedSrc: "https://s.w.org/images/block-editor/personalize-blocks.svg?1", 10900 animatedSrc: "https://s.w.org/images/block-editor/personalize-blocks.gif?1" 10901 }), 10902 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 10903 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { 10904 className: "edit-site-welcome-guide__heading", 10905 children: (0,external_wp_i18n_namespaceObject.__)('Personalize blocks') 10906 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 10907 className: "edit-site-welcome-guide__text", 10908 children: (0,external_wp_i18n_namespaceObject.__)('You can adjust your blocks to ensure a cohesive experience across your site — add your unique colors to a branded Button block, or adjust the Heading block to your preferred size.') 10909 })] 10910 }) 10911 }, { 10912 image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideImage, { 10913 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg", 10914 animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif" 10915 }), 10916 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 10917 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { 10918 className: "edit-site-welcome-guide__heading", 10919 children: (0,external_wp_i18n_namespaceObject.__)('Learn more') 10920 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("p", { 10921 className: "edit-site-welcome-guide__text", 10922 children: [(0,external_wp_i18n_namespaceObject.__)('New to block themes and styling your site?'), ' ', /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { 10923 href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/styles-overview/'), 10924 children: (0,external_wp_i18n_namespaceObject.__)('Here’s a detailed guide to learn how to make the most of it.') 10925 })] 10926 })] 10927 }) 10928 }] 10929 }); 10930 } 10931 10932 ;// ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/page.js 10933 /** 10934 * WordPress dependencies 10935 */ 10936 10937 10938 10939 10940 10941 function WelcomeGuidePage() { 10942 const { 10943 toggle 10944 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 10945 const isVisible = (0,external_wp_data_namespaceObject.useSelect)(select => { 10946 const isPageActive = !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', 'welcomeGuidePage'); 10947 const isEditorActive = !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', 'welcomeGuide'); 10948 return isPageActive && !isEditorActive; 10949 }, []); 10950 if (!isVisible) { 10951 return null; 10952 } 10953 const heading = (0,external_wp_i18n_namespaceObject.__)('Editing a page'); 10954 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Guide, { 10955 className: "edit-site-welcome-guide guide-page", 10956 contentLabel: heading, 10957 finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Continue'), 10958 onFinish: () => toggle('core/edit-site', 'welcomeGuidePage'), 10959 pages: [{ 10960 image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("video", { 10961 className: "edit-site-welcome-guide__video", 10962 autoPlay: true, 10963 loop: true, 10964 muted: true, 10965 width: "312", 10966 height: "240", 10967 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("source", { 10968 src: "https://s.w.org/images/block-editor/editing-your-page.mp4", 10969 type: "video/mp4" 10970 }) 10971 }), 10972 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 10973 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { 10974 className: "edit-site-welcome-guide__heading", 10975 children: heading 10976 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 10977 className: "edit-site-welcome-guide__text", 10978 children: (0,external_wp_i18n_namespaceObject.__)( 10979 // eslint-disable-next-line no-restricted-syntax -- 'sidebar' is a common web design term for layouts 10980 'It’s now possible to edit page content in the site editor. To customise other parts of the page like the header and footer switch to editing the template using the settings sidebar.') 10981 })] 10982 }) 10983 }] 10984 }); 10985 } 10986 10987 ;// ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/template.js 10988 /** 10989 * WordPress dependencies 10990 */ 10991 10992 10993 10994 10995 10996 10997 function WelcomeGuideTemplate() { 10998 const { 10999 toggle 11000 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 11001 const { 11002 isActive, 11003 hasPreviousEntity 11004 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 11005 const { 11006 getEditorSettings 11007 } = select(external_wp_editor_namespaceObject.store); 11008 const { 11009 get 11010 } = select(external_wp_preferences_namespaceObject.store); 11011 return { 11012 isActive: get('core/edit-site', 'welcomeGuideTemplate'), 11013 hasPreviousEntity: !!getEditorSettings().onNavigateToPreviousEntityRecord 11014 }; 11015 }, []); 11016 const isVisible = isActive && hasPreviousEntity; 11017 if (!isVisible) { 11018 return null; 11019 } 11020 const heading = (0,external_wp_i18n_namespaceObject.__)('Editing a template'); 11021 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Guide, { 11022 className: "edit-site-welcome-guide guide-template", 11023 contentLabel: heading, 11024 finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Continue'), 11025 onFinish: () => toggle('core/edit-site', 'welcomeGuideTemplate'), 11026 pages: [{ 11027 image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("video", { 11028 className: "edit-site-welcome-guide__video", 11029 autoPlay: true, 11030 loop: true, 11031 muted: true, 11032 width: "312", 11033 height: "240", 11034 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("source", { 11035 src: "https://s.w.org/images/block-editor/editing-your-template.mp4", 11036 type: "video/mp4" 11037 }) 11038 }), 11039 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 11040 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { 11041 className: "edit-site-welcome-guide__heading", 11042 children: heading 11043 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 11044 className: "edit-site-welcome-guide__text", 11045 children: (0,external_wp_i18n_namespaceObject.__)('Note that the same template can be used by multiple pages, so any changes made here may affect other pages on the site. To switch back to editing the page content click the ‘Back’ button in the toolbar.') 11046 })] 11047 }) 11048 }] 11049 }); 11050 } 11051 11052 ;// ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/index.js 11053 /** 11054 * Internal dependencies 11055 */ 11056 11057 11058 11059 11060 11061 function WelcomeGuide({ 11062 postType 11063 }) { 11064 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 11065 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideEditor, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideStyles, {}), postType === 'page' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuidePage, {}), postType === 'wp_template' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideTemplate, {})] 11066 }); 11067 } 11068 11069 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles-renderer/index.js 11070 /** 11071 * WordPress dependencies 11072 */ 11073 11074 11075 11076 11077 /** 11078 * Internal dependencies 11079 */ 11080 11081 11082 const { 11083 useGlobalStylesOutput 11084 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 11085 function useGlobalStylesRenderer(disableRootPadding) { 11086 const [styles, settings] = useGlobalStylesOutput(disableRootPadding); 11087 const { 11088 getSettings 11089 } = (0,external_wp_data_namespaceObject.useSelect)(store); 11090 const { 11091 updateSettings 11092 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 11093 (0,external_wp_element_namespaceObject.useEffect)(() => { 11094 var _currentStoreSettings; 11095 if (!styles || !settings) { 11096 return; 11097 } 11098 const currentStoreSettings = getSettings(); 11099 const nonGlobalStyles = Object.values((_currentStoreSettings = currentStoreSettings.styles) !== null && _currentStoreSettings !== void 0 ? _currentStoreSettings : []).filter(style => !style.isGlobalStyles); 11100 updateSettings({ 11101 ...currentStoreSettings, 11102 styles: [...nonGlobalStyles, ...styles], 11103 __experimentalFeatures: settings 11104 }); 11105 }, [styles, settings, updateSettings, getSettings]); 11106 } 11107 function GlobalStylesRenderer({ 11108 disableRootPadding 11109 }) { 11110 useGlobalStylesRenderer(disableRootPadding); 11111 return null; 11112 } 11113 11114 ;// ./node_modules/@wordpress/edit-site/build-module/components/canvas-loader/index.js 11115 /** 11116 * WordPress dependencies 11117 */ 11118 11119 11120 11121 11122 11123 /** 11124 * Internal dependencies 11125 */ 11126 11127 11128 11129 const { 11130 Theme 11131 } = unlock(external_wp_components_namespaceObject.privateApis); 11132 const { 11133 useGlobalStyle: canvas_loader_useGlobalStyle 11134 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 11135 function CanvasLoader({ 11136 id 11137 }) { 11138 var _highlightedColors$0$; 11139 const [fallbackIndicatorColor] = canvas_loader_useGlobalStyle('color.text'); 11140 const [backgroundColor] = canvas_loader_useGlobalStyle('color.background'); 11141 const { 11142 highlightedColors 11143 } = useStylesPreviewColors(); 11144 const indicatorColor = (_highlightedColors$0$ = highlightedColors[0]?.color) !== null && _highlightedColors$0$ !== void 0 ? _highlightedColors$0$ : fallbackIndicatorColor; 11145 const { 11146 elapsed, 11147 total 11148 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 11149 var _selectorsByStatus$re, _selectorsByStatus$fi; 11150 const selectorsByStatus = select(external_wp_coreData_namespaceObject.store).countSelectorsByStatus(); 11151 const resolving = (_selectorsByStatus$re = selectorsByStatus.resolving) !== null && _selectorsByStatus$re !== void 0 ? _selectorsByStatus$re : 0; 11152 const finished = (_selectorsByStatus$fi = selectorsByStatus.finished) !== null && _selectorsByStatus$fi !== void 0 ? _selectorsByStatus$fi : 0; 11153 return { 11154 elapsed: finished, 11155 total: finished + resolving 11156 }; 11157 }, []); 11158 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 11159 className: "edit-site-canvas-loader", 11160 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Theme, { 11161 accent: indicatorColor, 11162 background: backgroundColor, 11163 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ProgressBar, { 11164 id: id, 11165 max: total, 11166 value: elapsed 11167 }) 11168 }) 11169 }); 11170 } 11171 11172 ;// ./node_modules/@wordpress/edit-site/build-module/components/block-editor/use-navigate-to-entity-record.js 11173 /** 11174 * WordPress dependencies 11175 */ 11176 11177 11178 11179 /** 11180 * Internal dependencies 11181 */ 11182 11183 const { 11184 useHistory: use_navigate_to_entity_record_useHistory 11185 } = unlock(external_wp_router_namespaceObject.privateApis); 11186 function useNavigateToEntityRecord() { 11187 const history = use_navigate_to_entity_record_useHistory(); 11188 const onNavigateToEntityRecord = (0,external_wp_element_namespaceObject.useCallback)(params => { 11189 history.navigate(`/$params.postType}/$params.postId}?canvas=edit&focusMode=true`); 11190 }, [history]); 11191 return onNavigateToEntityRecord; 11192 } 11193 11194 ;// ./node_modules/@wordpress/edit-site/build-module/components/block-editor/use-site-editor-settings.js 11195 /** 11196 * WordPress dependencies 11197 */ 11198 11199 11200 11201 11202 11203 /** 11204 * Internal dependencies 11205 */ 11206 11207 11208 11209 11210 const { 11211 useLocation: use_site_editor_settings_useLocation, 11212 useHistory: use_site_editor_settings_useHistory 11213 } = unlock(external_wp_router_namespaceObject.privateApis); 11214 function useNavigateToPreviousEntityRecord() { 11215 const location = use_site_editor_settings_useLocation(); 11216 const previousLocation = (0,external_wp_compose_namespaceObject.usePrevious)(location); 11217 const history = use_site_editor_settings_useHistory(); 11218 const goBack = (0,external_wp_element_namespaceObject.useMemo)(() => { 11219 const isFocusMode = location.query.focusMode || location?.params?.postId && FOCUSABLE_ENTITIES.includes(location?.params?.postType); 11220 const didComeFromEditorCanvas = previousLocation?.query.canvas === 'edit'; 11221 const showBackButton = isFocusMode && didComeFromEditorCanvas; 11222 return showBackButton ? () => history.back() : undefined; 11223 // `previousLocation` changes when the component updates for any reason, not 11224 // just when location changes. Until this is fixed we can't add it to deps. See 11225 // https://github.com/WordPress/gutenberg/pull/58710#discussion_r1479219465. 11226 }, [location, history]); 11227 return goBack; 11228 } 11229 function useSpecificEditorSettings() { 11230 const { 11231 query 11232 } = use_site_editor_settings_useLocation(); 11233 const { 11234 canvas = 'view' 11235 } = query; 11236 const onNavigateToEntityRecord = useNavigateToEntityRecord(); 11237 const { 11238 settings 11239 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 11240 const { 11241 getSettings 11242 } = select(store); 11243 return { 11244 settings: getSettings() 11245 }; 11246 }, []); 11247 const onNavigateToPreviousEntityRecord = useNavigateToPreviousEntityRecord(); 11248 const defaultEditorSettings = (0,external_wp_element_namespaceObject.useMemo)(() => { 11249 return { 11250 ...settings, 11251 richEditingEnabled: true, 11252 supportsTemplateMode: true, 11253 focusMode: canvas !== 'view', 11254 onNavigateToEntityRecord, 11255 onNavigateToPreviousEntityRecord, 11256 isPreviewMode: canvas === 'view' 11257 }; 11258 }, [settings, canvas, onNavigateToEntityRecord, onNavigateToPreviousEntityRecord]); 11259 return defaultEditorSettings; 11260 } 11261 11262 ;// ./node_modules/@wordpress/edit-site/build-module/components/plugin-template-setting-panel/index.js 11263 /** 11264 * Defines an extensibility slot for the Template sidebar. 11265 */ 11266 11267 /** 11268 * WordPress dependencies 11269 */ 11270 11271 11272 11273 11274 11275 const { 11276 Fill, 11277 Slot 11278 } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginTemplateSettingPanel'); 11279 const PluginTemplateSettingPanel = ({ 11280 children 11281 }) => { 11282 external_wp_deprecated_default()('wp.editSite.PluginTemplateSettingPanel', { 11283 since: '6.6', 11284 version: '6.8', 11285 alternative: 'wp.editor.PluginDocumentSettingPanel' 11286 }); 11287 const isCurrentEntityTemplate = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_editor_namespaceObject.store).getCurrentPostType() === 'wp_template', []); 11288 if (!isCurrentEntityTemplate) { 11289 return null; 11290 } 11291 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Fill, { 11292 children: children 11293 }); 11294 }; 11295 PluginTemplateSettingPanel.Slot = Slot; 11296 11297 /** 11298 * Renders items in the Template Sidebar below the main information 11299 * like the Template Card. 11300 * 11301 * @deprecated since 6.6. Use `wp.editor.PluginDocumentSettingPanel` instead. 11302 * 11303 * @example 11304 * ```jsx 11305 * // Using ESNext syntax 11306 * import { PluginTemplateSettingPanel } from '@wordpress/edit-site'; 11307 * 11308 * const MyTemplateSettingTest = () => ( 11309 * <PluginTemplateSettingPanel> 11310 * <p>Hello, World!</p> 11311 * </PluginTemplateSettingPanel> 11312 * ); 11313 * ``` 11314 * 11315 * @return {Component} The component to be rendered. 11316 */ 11317 /* harmony default export */ const plugin_template_setting_panel = (PluginTemplateSettingPanel); 11318 11319 ;// ./node_modules/@wordpress/icons/build-module/library/seen.js 11320 /** 11321 * WordPress dependencies 11322 */ 11323 11324 11325 const seen = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 11326 viewBox: "0 0 24 24", 11327 xmlns: "http://www.w3.org/2000/svg", 11328 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 11329 d: "M3.99961 13C4.67043 13.3354 4.6703 13.3357 4.67017 13.3359L4.67298 13.3305C4.67621 13.3242 4.68184 13.3135 4.68988 13.2985C4.70595 13.2686 4.7316 13.2218 4.76695 13.1608C4.8377 13.0385 4.94692 12.8592 5.09541 12.6419C5.39312 12.2062 5.84436 11.624 6.45435 11.0431C7.67308 9.88241 9.49719 8.75 11.9996 8.75C14.502 8.75 16.3261 9.88241 17.5449 11.0431C18.1549 11.624 18.6061 12.2062 18.9038 12.6419C19.0523 12.8592 19.1615 13.0385 19.2323 13.1608C19.2676 13.2218 19.2933 13.2686 19.3093 13.2985C19.3174 13.3135 19.323 13.3242 19.3262 13.3305L19.3291 13.3359C19.3289 13.3357 19.3288 13.3354 19.9996 13C20.6704 12.6646 20.6703 12.6643 20.6701 12.664L20.6697 12.6632L20.6688 12.6614L20.6662 12.6563L20.6583 12.6408C20.6517 12.6282 20.6427 12.6108 20.631 12.5892C20.6078 12.5459 20.5744 12.4852 20.5306 12.4096C20.4432 12.2584 20.3141 12.0471 20.1423 11.7956C19.7994 11.2938 19.2819 10.626 18.5794 9.9569C17.1731 8.61759 14.9972 7.25 11.9996 7.25C9.00203 7.25 6.82614 8.61759 5.41987 9.9569C4.71736 10.626 4.19984 11.2938 3.85694 11.7956C3.68511 12.0471 3.55605 12.2584 3.4686 12.4096C3.42484 12.4852 3.39142 12.5459 3.36818 12.5892C3.35656 12.6108 3.34748 12.6282 3.34092 12.6408L3.33297 12.6563L3.33041 12.6614L3.32948 12.6632L3.32911 12.664C3.32894 12.6643 3.32879 12.6646 3.99961 13ZM11.9996 16C13.9326 16 15.4996 14.433 15.4996 12.5C15.4996 10.567 13.9326 9 11.9996 9C10.0666 9 8.49961 10.567 8.49961 12.5C8.49961 14.433 10.0666 16 11.9996 16Z" 11330 }) 11331 }); 11332 /* harmony default export */ const library_seen = (seen); 11333 11334 ;// ./node_modules/@wordpress/icons/build-module/library/more-vertical.js 11335 /** 11336 * WordPress dependencies 11337 */ 11338 11339 11340 const moreVertical = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 11341 xmlns: "http://www.w3.org/2000/svg", 11342 viewBox: "0 0 24 24", 11343 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 11344 d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" 11345 }) 11346 }); 11347 /* harmony default export */ const more_vertical = (moreVertical); 11348 11349 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/icon-with-current-color.js 11350 /** 11351 * External dependencies 11352 */ 11353 11354 11355 /** 11356 * WordPress dependencies 11357 */ 11358 11359 11360 function IconWithCurrentColor({ 11361 className, 11362 ...props 11363 }) { 11364 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 11365 className: dist_clsx(className, 'edit-site-global-styles-icon-with-current-color'), 11366 ...props 11367 }); 11368 } 11369 11370 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/navigation-button.js 11371 /** 11372 * WordPress dependencies 11373 */ 11374 11375 11376 /** 11377 * Internal dependencies 11378 */ 11379 11380 11381 function GenericNavigationButton({ 11382 icon, 11383 children, 11384 ...props 11385 }) { 11386 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItem, { 11387 ...props, 11388 children: [icon && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 11389 justify: "flex-start", 11390 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(IconWithCurrentColor, { 11391 icon: icon, 11392 size: 24 11393 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 11394 children: children 11395 })] 11396 }), !icon && children] 11397 }); 11398 } 11399 function NavigationButtonAsItem(props) { 11400 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Navigator.Button, { 11401 as: GenericNavigationButton, 11402 ...props 11403 }); 11404 } 11405 function NavigationBackButtonAsItem(props) { 11406 return /*#__PURE__*/_jsx(Navigator.BackButton, { 11407 as: GenericNavigationButton, 11408 ...props 11409 }); 11410 } 11411 11412 11413 ;// ./node_modules/@wordpress/icons/build-module/library/typography.js 11414 /** 11415 * WordPress dependencies 11416 */ 11417 11418 11419 const typography = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 11420 xmlns: "http://www.w3.org/2000/svg", 11421 viewBox: "0 0 24 24", 11422 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 11423 d: "M6.9 7L3 17.8h1.7l1-2.8h4.1l1 2.8h1.7L8.6 7H6.9zm-.7 6.6l1.5-4.3 1.5 4.3h-3zM21.6 17c-.1.1-.2.2-.3.2-.1.1-.2.1-.4.1s-.3-.1-.4-.2c-.1-.1-.1-.3-.1-.6V12c0-.5 0-1-.1-1.4-.1-.4-.3-.7-.5-1-.2-.2-.5-.4-.9-.5-.4 0-.8-.1-1.3-.1s-1 .1-1.4.2c-.4.1-.7.3-1 .4-.2.2-.4.3-.6.5-.1.2-.2.4-.2.7 0 .3.1.5.2.8.2.2.4.3.8.3.3 0 .6-.1.8-.3.2-.2.3-.4.3-.7 0-.3-.1-.5-.2-.7-.2-.2-.4-.3-.6-.4.2-.2.4-.3.7-.4.3-.1.6-.1.8-.1.3 0 .6 0 .8.1.2.1.4.3.5.5.1.2.2.5.2.9v1.1c0 .3-.1.5-.3.6-.2.2-.5.3-.9.4-.3.1-.7.3-1.1.4-.4.1-.8.3-1.1.5-.3.2-.6.4-.8.7-.2.3-.3.7-.3 1.2 0 .6.2 1.1.5 1.4.3.4.9.5 1.6.5.5 0 1-.1 1.4-.3.4-.2.8-.6 1.1-1.1 0 .4.1.7.3 1 .2.3.6.4 1.2.4.4 0 .7-.1.9-.2.2-.1.5-.3.7-.4h-.3zm-3-.9c-.2.4-.5.7-.8.8-.3.2-.6.2-.8.2-.4 0-.6-.1-.9-.3-.2-.2-.3-.6-.3-1.1 0-.5.1-.9.3-1.2s.5-.5.8-.7c.3-.2.7-.3 1-.5.3-.1.6-.3.7-.6v3.4z" 11424 }) 11425 }); 11426 /* harmony default export */ const library_typography = (typography); 11427 11428 ;// ./node_modules/@wordpress/icons/build-module/library/color.js 11429 /** 11430 * WordPress dependencies 11431 */ 11432 11433 11434 const color = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 11435 viewBox: "0 0 24 24", 11436 xmlns: "http://www.w3.org/2000/svg", 11437 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 11438 d: "M17.2 10.9c-.5-1-1.2-2.1-2.1-3.2-.6-.9-1.3-1.7-2.1-2.6L12 4l-1 1.1c-.6.9-1.3 1.7-2 2.6-.8 1.2-1.5 2.3-2 3.2-.6 1.2-1 2.2-1 3 0 3.4 2.7 6.1 6.1 6.1s6.1-2.7 6.1-6.1c0-.8-.3-1.8-1-3zm-5.1 7.6c-2.5 0-4.6-2.1-4.6-4.6 0-.3.1-1 .8-2.3.5-.9 1.1-1.9 2-3.1.7-.9 1.3-1.7 1.8-2.3.7.8 1.3 1.6 1.8 2.3.8 1.1 1.5 2.2 2 3.1.7 1.3.8 2 .8 2.3 0 2.5-2.1 4.6-4.6 4.6z" 11439 }) 11440 }); 11441 /* harmony default export */ const library_color = (color); 11442 11443 ;// ./node_modules/@wordpress/icons/build-module/library/background.js 11444 /** 11445 * WordPress dependencies 11446 */ 11447 11448 11449 const background = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 11450 xmlns: "http://www.w3.org/2000/svg", 11451 viewBox: "0 0 24 24", 11452 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 11453 fillRule: "evenodd", 11454 clipRule: "evenodd", 11455 d: "M11.53 4.47a.75.75 0 1 0-1.06 1.06l8 8a.75.75 0 1 0 1.06-1.06l-8-8Zm5 1a.75.75 0 1 0-1.06 1.06l2 2a.75.75 0 1 0 1.06-1.06l-2-2Zm-11.06 10a.75.75 0 0 1 1.06 0l2 2a.75.75 0 1 1-1.06 1.06l-2-2a.75.75 0 0 1 0-1.06Zm.06-5a.75.75 0 0 0-1.06 1.06l8 8a.75.75 0 1 0 1.06-1.06l-8-8Zm-.06-3a.75.75 0 0 1 1.06 0l10 10a.75.75 0 1 1-1.06 1.06l-10-10a.75.75 0 0 1 0-1.06Zm3.06-2a.75.75 0 0 0-1.06 1.06l10 10a.75.75 0 1 0 1.06-1.06l-10-10Z" 11456 }) 11457 }); 11458 /* harmony default export */ const library_background = (background); 11459 11460 ;// ./node_modules/@wordpress/icons/build-module/library/shadow.js 11461 /** 11462 * WordPress dependencies 11463 */ 11464 11465 11466 const shadow = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 11467 viewBox: "0 0 24 24", 11468 xmlns: "http://www.w3.org/2000/svg", 11469 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 11470 d: "M12 8c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4zm0 6.5c-1.4 0-2.5-1.1-2.5-2.5s1.1-2.5 2.5-2.5 2.5 1.1 2.5 2.5-1.1 2.5-2.5 2.5zM12.8 3h-1.5v3h1.5V3zm-1.6 18h1.5v-3h-1.5v3zm6.8-9.8v1.5h3v-1.5h-3zm-12 0H3v1.5h3v-1.5zm9.7 5.6 2.1 2.1 1.1-1.1-2.1-2.1-1.1 1.1zM8.3 7.2 6.2 5.1 5.1 6.2l2.1 2.1 1.1-1.1zM5.1 17.8l1.1 1.1 2.1-2.1-1.1-1.1-2.1 2.1zM18.9 6.2l-1.1-1.1-2.1 2.1 1.1 1.1 2.1-2.1z" 11471 }) 11472 }); 11473 /* harmony default export */ const library_shadow = (shadow); 11474 11475 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/root-menu.js 11476 /** 11477 * WordPress dependencies 11478 */ 11479 11480 11481 11482 11483 11484 /** 11485 * Internal dependencies 11486 */ 11487 11488 11489 11490 const { 11491 useHasDimensionsPanel, 11492 useHasTypographyPanel, 11493 useHasColorPanel, 11494 useGlobalSetting: root_menu_useGlobalSetting, 11495 useSettingsForBlockElement, 11496 useHasBackgroundPanel 11497 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 11498 function RootMenu() { 11499 const [rawSettings] = root_menu_useGlobalSetting(''); 11500 const settings = useSettingsForBlockElement(rawSettings); 11501 /* 11502 * Use the raw settings to determine if the background panel should be displayed, 11503 * as the background panel is not dependent on the block element settings. 11504 */ 11505 const hasBackgroundPanel = useHasBackgroundPanel(rawSettings); 11506 const hasTypographyPanel = useHasTypographyPanel(settings); 11507 const hasColorPanel = useHasColorPanel(settings); 11508 const hasShadowPanel = true; // useHasShadowPanel( settings ); 11509 const hasDimensionsPanel = useHasDimensionsPanel(settings); 11510 const hasLayoutPanel = hasDimensionsPanel; 11511 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { 11512 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { 11513 children: [hasTypographyPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 11514 icon: library_typography, 11515 path: "/typography", 11516 children: (0,external_wp_i18n_namespaceObject.__)('Typography') 11517 }), hasColorPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 11518 icon: library_color, 11519 path: "/colors", 11520 children: (0,external_wp_i18n_namespaceObject.__)('Colors') 11521 }), hasBackgroundPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 11522 icon: library_background, 11523 path: "/background", 11524 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Background styles'), 11525 children: (0,external_wp_i18n_namespaceObject.__)('Background') 11526 }), hasShadowPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 11527 icon: library_shadow, 11528 path: "/shadows", 11529 children: (0,external_wp_i18n_namespaceObject.__)('Shadows') 11530 }), hasLayoutPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 11531 icon: library_layout, 11532 path: "/layout", 11533 children: (0,external_wp_i18n_namespaceObject.__)('Layout') 11534 })] 11535 }) 11536 }); 11537 } 11538 /* harmony default export */ const root_menu = (RootMenu); 11539 11540 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/preview-styles.js 11541 function findNearest(input, numbers) { 11542 // If the numbers array is empty, return null 11543 if (numbers.length === 0) { 11544 return null; 11545 } 11546 // Sort the array based on the absolute difference with the input 11547 numbers.sort((a, b) => Math.abs(input - a) - Math.abs(input - b)); 11548 // Return the first element (which will be the nearest) from the sorted array 11549 return numbers[0]; 11550 } 11551 function extractFontWeights(fontFaces) { 11552 const result = []; 11553 fontFaces.forEach(face => { 11554 const weights = String(face.fontWeight).split(' '); 11555 if (weights.length === 2) { 11556 const start = parseInt(weights[0]); 11557 const end = parseInt(weights[1]); 11558 for (let i = start; i <= end; i += 100) { 11559 result.push(i); 11560 } 11561 } else if (weights.length === 1) { 11562 result.push(parseInt(weights[0])); 11563 } 11564 }); 11565 return result; 11566 } 11567 11568 /* 11569 * Format the font family to use in the CSS font-family property of a CSS rule. 11570 * 11571 * The input can be a string with the font family name or a string with multiple font family names separated by commas. 11572 * It follows the recommendations from the CSS Fonts Module Level 4. 11573 * https://www.w3.org/TR/css-fonts-4/#font-family-prop 11574 * 11575 * @param {string} input - The font family. 11576 * @return {string} The formatted font family. 11577 * 11578 * Example: 11579 * formatFontFamily( "Open Sans, Font+Name, sans-serif" ) => '"Open Sans", "Font+Name", sans-serif' 11580 * formatFontFamily( "'Open Sans', generic(kai), sans-serif" ) => '"Open Sans", sans-serif' 11581 * formatFontFamily( "DotGothic16, Slabo 27px, serif" ) => '"DotGothic16","Slabo 27px",serif' 11582 * formatFontFamily( "Mine's, Moe's Typography" ) => `"mine's","Moe's Typography"` 11583 */ 11584 function formatFontFamily(input) { 11585 // Matches strings that are not exclusively alphabetic characters or hyphens, and do not exactly follow the pattern generic(alphabetic characters or hyphens). 11586 const regex = /^(?!generic\([ a-zA-Z\-]+\)$)(?!^[a-zA-Z\-]+$).+/; 11587 const output = input.trim(); 11588 const formatItem = item => { 11589 item = item.trim(); 11590 if (item.match(regex)) { 11591 // removes leading and trailing quotes. 11592 item = item.replace(/^["']|["']$/g, ''); 11593 return `"$item}"`; 11594 } 11595 return item; 11596 }; 11597 if (output.includes(',')) { 11598 return output.split(',').map(formatItem).filter(item => item !== '').join(', '); 11599 } 11600 return formatItem(output); 11601 } 11602 11603 /* 11604 * Format the font face name to use in the font-family property of a font face. 11605 * 11606 * The input can be a string with the font face name or a string with multiple font face names separated by commas. 11607 * It removes the leading and trailing quotes from the font face name. 11608 * 11609 * @param {string} input - The font face name. 11610 * @return {string} The formatted font face name. 11611 * 11612 * Example: 11613 * formatFontFaceName("Open Sans") => "Open Sans" 11614 * formatFontFaceName("'Open Sans', sans-serif") => "Open Sans" 11615 * formatFontFaceName(", 'Open Sans', 'Helvetica Neue', sans-serif") => "Open Sans" 11616 */ 11617 function formatFontFaceName(input) { 11618 if (!input) { 11619 return ''; 11620 } 11621 let output = input.trim(); 11622 if (output.includes(',')) { 11623 output = output.split(',') 11624 // finds the first item that is not an empty string. 11625 .find(item => item.trim() !== '').trim(); 11626 } 11627 // removes leading and trailing quotes. 11628 output = output.replace(/^["']|["']$/g, ''); 11629 11630 // Firefox needs the font name to be wrapped in double quotes meanwhile other browsers don't. 11631 if (window.navigator.userAgent.toLowerCase().includes('firefox')) { 11632 output = `"$output}"`; 11633 } 11634 return output; 11635 } 11636 function getFamilyPreviewStyle(family) { 11637 const style = { 11638 fontFamily: formatFontFamily(family.fontFamily) 11639 }; 11640 if (!Array.isArray(family.fontFace)) { 11641 style.fontWeight = '400'; 11642 style.fontStyle = 'normal'; 11643 return style; 11644 } 11645 if (family.fontFace) { 11646 //get all the font faces with normal style 11647 const normalFaces = family.fontFace.filter(face => face?.fontStyle && face.fontStyle.toLowerCase() === 'normal'); 11648 if (normalFaces.length > 0) { 11649 style.fontStyle = 'normal'; 11650 const normalWeights = extractFontWeights(normalFaces); 11651 const nearestWeight = findNearest(400, normalWeights); 11652 style.fontWeight = String(nearestWeight) || '400'; 11653 } else { 11654 style.fontStyle = family.fontFace.length && family.fontFace[0].fontStyle || 'normal'; 11655 style.fontWeight = family.fontFace.length && String(family.fontFace[0].fontWeight) || '400'; 11656 } 11657 } 11658 return style; 11659 } 11660 function getFacePreviewStyle(face) { 11661 return { 11662 fontFamily: formatFontFamily(face.fontFamily), 11663 fontStyle: face.fontStyle || 'normal', 11664 fontWeight: face.fontWeight || '400' 11665 }; 11666 } 11667 11668 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/utils.js 11669 /** 11670 * 11671 * @param {string} variation The variation name. 11672 * 11673 * @return {string} The variation class name. 11674 */ 11675 function getVariationClassName(variation) { 11676 if (!variation) { 11677 return ''; 11678 } 11679 return `is-style-$variation}`; 11680 } 11681 11682 /** 11683 * Iterates through the presets array and searches for slugs that start with the specified 11684 * slugPrefix followed by a numerical suffix. It identifies the highest numerical suffix found 11685 * and returns one greater than the highest found suffix, ensuring that the new index is unique. 11686 * 11687 * @param {Array} presets The array of preset objects, each potentially containing a slug property. 11688 * @param {string} slugPrefix The prefix to look for in the preset slugs. 11689 * 11690 * @return {number} The next available index for a preset with the specified slug prefix, or 1 if no matching slugs are found. 11691 */ 11692 function getNewIndexFromPresets(presets, slugPrefix) { 11693 const nameRegex = new RegExp(`^$slugPrefix}([\\d]+)$`); 11694 const highestPresetValue = presets.reduce((currentHighest, preset) => { 11695 if (typeof preset?.slug === 'string') { 11696 const matches = preset?.slug.match(nameRegex); 11697 if (matches) { 11698 const id = parseInt(matches[1], 10); 11699 if (id > currentHighest) { 11700 return id; 11701 } 11702 } 11703 } 11704 return currentHighest; 11705 }, 0); 11706 return highestPresetValue + 1; 11707 } 11708 function getFontFamilyFromSetting(fontFamilies, setting) { 11709 if (!Array.isArray(fontFamilies) || !setting) { 11710 return null; 11711 } 11712 const fontFamilyVariable = setting.replace('var(', '').replace(')', ''); 11713 const fontFamilySlug = fontFamilyVariable?.split('--').slice(-1)[0]; 11714 return fontFamilies.find(fontFamily => fontFamily.slug === fontFamilySlug); 11715 } 11716 function getFontFamilies(themeJson) { 11717 const themeFontFamilies = themeJson?.settings?.typography?.fontFamilies?.theme; 11718 const customFontFamilies = themeJson?.settings?.typography?.fontFamilies?.custom; 11719 let fontFamilies = []; 11720 if (themeFontFamilies && customFontFamilies) { 11721 fontFamilies = [...themeFontFamilies, ...customFontFamilies]; 11722 } else if (themeFontFamilies) { 11723 fontFamilies = themeFontFamilies; 11724 } else if (customFontFamilies) { 11725 fontFamilies = customFontFamilies; 11726 } 11727 const bodyFontFamilySetting = themeJson?.styles?.typography?.fontFamily; 11728 const bodyFontFamily = getFontFamilyFromSetting(fontFamilies, bodyFontFamilySetting); 11729 const headingFontFamilySetting = themeJson?.styles?.elements?.heading?.typography?.fontFamily; 11730 let headingFontFamily; 11731 if (!headingFontFamilySetting) { 11732 headingFontFamily = bodyFontFamily; 11733 } else { 11734 headingFontFamily = getFontFamilyFromSetting(fontFamilies, themeJson?.styles?.elements?.heading?.typography?.fontFamily); 11735 } 11736 return [bodyFontFamily, headingFontFamily]; 11737 } 11738 11739 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/typography-example.js 11740 /** 11741 * WordPress dependencies 11742 */ 11743 11744 11745 11746 11747 11748 11749 /** 11750 * Internal dependencies 11751 */ 11752 11753 11754 11755 11756 const { 11757 useGlobalStyle: typography_example_useGlobalStyle, 11758 GlobalStylesContext: typography_example_GlobalStylesContext 11759 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 11760 const { 11761 mergeBaseAndUserConfigs 11762 } = unlock(external_wp_editor_namespaceObject.privateApis); 11763 function PreviewTypography({ 11764 fontSize, 11765 variation 11766 }) { 11767 const { 11768 base 11769 } = (0,external_wp_element_namespaceObject.useContext)(typography_example_GlobalStylesContext); 11770 let config = base; 11771 if (variation) { 11772 config = mergeBaseAndUserConfigs(base, variation); 11773 } 11774 const [textColor] = typography_example_useGlobalStyle('color.text'); 11775 const [bodyFontFamilies, headingFontFamilies] = getFontFamilies(config); 11776 const bodyPreviewStyle = bodyFontFamilies ? getFamilyPreviewStyle(bodyFontFamilies) : {}; 11777 const headingPreviewStyle = headingFontFamilies ? getFamilyPreviewStyle(headingFontFamilies) : {}; 11778 if (textColor) { 11779 bodyPreviewStyle.color = textColor; 11780 headingPreviewStyle.color = textColor; 11781 } 11782 if (fontSize) { 11783 bodyPreviewStyle.fontSize = fontSize; 11784 headingPreviewStyle.fontSize = fontSize; 11785 } 11786 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__unstableMotion.div, { 11787 animate: { 11788 scale: 1, 11789 opacity: 1 11790 }, 11791 initial: { 11792 scale: 0.1, 11793 opacity: 0 11794 }, 11795 transition: { 11796 delay: 0.3, 11797 type: 'tween' 11798 }, 11799 style: { 11800 textAlign: 'center', 11801 lineHeight: 1 11802 }, 11803 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 11804 style: headingPreviewStyle, 11805 children: (0,external_wp_i18n_namespaceObject._x)('A', 'Uppercase letter A') 11806 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 11807 style: bodyPreviewStyle, 11808 children: (0,external_wp_i18n_namespaceObject._x)('a', 'Lowercase letter A') 11809 })] 11810 }); 11811 } 11812 11813 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/highlighted-colors.js 11814 /** 11815 * WordPress dependencies 11816 */ 11817 11818 11819 /** 11820 * Internal dependencies 11821 */ 11822 11823 11824 function HighlightedColors({ 11825 normalizedColorSwatchSize, 11826 ratio 11827 }) { 11828 const { 11829 highlightedColors 11830 } = useStylesPreviewColors(); 11831 const scaledSwatchSize = normalizedColorSwatchSize * ratio; 11832 return highlightedColors.map(({ 11833 slug, 11834 color 11835 }, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { 11836 style: { 11837 height: scaledSwatchSize, 11838 width: scaledSwatchSize, 11839 background: color, 11840 borderRadius: scaledSwatchSize / 2 11841 }, 11842 animate: { 11843 scale: 1, 11844 opacity: 1 11845 }, 11846 initial: { 11847 scale: 0.1, 11848 opacity: 0 11849 }, 11850 transition: { 11851 delay: index === 1 ? 0.2 : 0.1 11852 } 11853 }, `$slug}-$index}`)); 11854 } 11855 11856 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preview-wrapper.js 11857 /** 11858 * WordPress dependencies 11859 */ 11860 11861 11862 11863 11864 11865 /** 11866 * Internal dependencies 11867 */ 11868 11869 11870 const { 11871 useGlobalStyle: preview_wrapper_useGlobalStyle 11872 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 11873 const normalizedWidth = 248; 11874 const normalizedHeight = 152; 11875 11876 // Throttle options for useThrottle. Must be defined outside of the component, 11877 // so that the object reference is the same on each render. 11878 const THROTTLE_OPTIONS = { 11879 leading: true, 11880 trailing: true 11881 }; 11882 function PreviewWrapper({ 11883 children, 11884 label, 11885 isFocused, 11886 withHoverView 11887 }) { 11888 const [backgroundColor = 'white'] = preview_wrapper_useGlobalStyle('color.background'); 11889 const [gradientValue] = preview_wrapper_useGlobalStyle('color.gradient'); 11890 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); 11891 const [isHovered, setIsHovered] = (0,external_wp_element_namespaceObject.useState)(false); 11892 const [containerResizeListener, { 11893 width 11894 }] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); 11895 const [throttledWidth, setThrottledWidthState] = (0,external_wp_element_namespaceObject.useState)(width); 11896 const [ratioState, setRatioState] = (0,external_wp_element_namespaceObject.useState)(); 11897 const setThrottledWidth = (0,external_wp_compose_namespaceObject.useThrottle)(setThrottledWidthState, 250, THROTTLE_OPTIONS); 11898 11899 // Must use useLayoutEffect to avoid a flash of the container at the wrong 11900 // size before the width is set. 11901 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { 11902 if (width) { 11903 setThrottledWidth(width); 11904 } 11905 }, [width, setThrottledWidth]); 11906 11907 // Must use useLayoutEffect to avoid a flash of the container at the wrong 11908 // size before the width is set. 11909 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { 11910 const newRatio = throttledWidth ? throttledWidth / normalizedWidth : 1; 11911 const ratioDiff = newRatio - (ratioState || 0); 11912 11913 // Only update the ratio state if the difference is big enough 11914 // or if the ratio state is not yet set. This is to avoid an 11915 // endless loop of updates at particular viewport heights when the 11916 // presence of a scrollbar causes the width to change slightly. 11917 const isRatioDiffBigEnough = Math.abs(ratioDiff) > 0.1; 11918 if (isRatioDiffBigEnough || !ratioState) { 11919 setRatioState(newRatio); 11920 } 11921 }, [throttledWidth, ratioState]); 11922 11923 // Set a fallbackRatio to use before the throttled ratio has been set. 11924 const fallbackRatio = width ? width / normalizedWidth : 1; 11925 /* 11926 * Use the throttled ratio if it has been calculated, otherwise 11927 * use the fallback ratio. The throttled ratio is used to avoid 11928 * an endless loop of updates at particular viewport heights. 11929 * See: https://github.com/WordPress/gutenberg/issues/55112 11930 */ 11931 const ratio = ratioState ? ratioState : fallbackRatio; 11932 const isReady = !!width; 11933 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 11934 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 11935 style: { 11936 position: 'relative' 11937 }, 11938 children: containerResizeListener 11939 }), isReady && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 11940 className: "edit-site-global-styles-preview__wrapper", 11941 style: { 11942 height: normalizedHeight * ratio 11943 }, 11944 onMouseEnter: () => setIsHovered(true), 11945 onMouseLeave: () => setIsHovered(false), 11946 tabIndex: -1, 11947 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { 11948 style: { 11949 height: normalizedHeight * ratio, 11950 width: '100%', 11951 background: gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor, 11952 cursor: withHoverView ? 'pointer' : undefined 11953 }, 11954 initial: "start", 11955 animate: (isHovered || isFocused) && !disableMotion && label ? 'hover' : 'start', 11956 children: [].concat(children) // This makes sure children is always an array. 11957 .map((child, key) => child({ 11958 ratio, 11959 key 11960 })) 11961 }) 11962 })] 11963 }); 11964 } 11965 11966 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preview-styles.js 11967 /** 11968 * WordPress dependencies 11969 */ 11970 11971 11972 11973 /** 11974 * Internal dependencies 11975 */ 11976 11977 11978 11979 11980 11981 11982 const { 11983 useGlobalStyle: preview_styles_useGlobalStyle 11984 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 11985 const firstFrameVariants = { 11986 start: { 11987 scale: 1, 11988 opacity: 1 11989 }, 11990 hover: { 11991 scale: 0, 11992 opacity: 0 11993 } 11994 }; 11995 const midFrameVariants = { 11996 hover: { 11997 opacity: 1 11998 }, 11999 start: { 12000 opacity: 0.5 12001 } 12002 }; 12003 const secondFrameVariants = { 12004 hover: { 12005 scale: 1, 12006 opacity: 1 12007 }, 12008 start: { 12009 scale: 0, 12010 opacity: 0 12011 } 12012 }; 12013 const PreviewStyles = ({ 12014 label, 12015 isFocused, 12016 withHoverView, 12017 variation 12018 }) => { 12019 const [fontWeight] = preview_styles_useGlobalStyle('typography.fontWeight'); 12020 const [fontFamily = 'serif'] = preview_styles_useGlobalStyle('typography.fontFamily'); 12021 const [headingFontFamily = fontFamily] = preview_styles_useGlobalStyle('elements.h1.typography.fontFamily'); 12022 const [headingFontWeight = fontWeight] = preview_styles_useGlobalStyle('elements.h1.typography.fontWeight'); 12023 const [textColor = 'black'] = preview_styles_useGlobalStyle('color.text'); 12024 const [headingColor = textColor] = preview_styles_useGlobalStyle('elements.h1.color.text'); 12025 const { 12026 paletteColors 12027 } = useStylesPreviewColors(); 12028 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(PreviewWrapper, { 12029 label: label, 12030 isFocused: isFocused, 12031 withHoverView: withHoverView, 12032 children: [({ 12033 ratio, 12034 key 12035 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { 12036 variants: firstFrameVariants, 12037 style: { 12038 height: '100%', 12039 overflow: 'hidden' 12040 }, 12041 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 12042 spacing: 10 * ratio, 12043 justify: "center", 12044 style: { 12045 height: '100%', 12046 overflow: 'hidden' 12047 }, 12048 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreviewTypography, { 12049 fontSize: 65 * ratio, 12050 variation: variation 12051 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 12052 spacing: 4 * ratio, 12053 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(HighlightedColors, { 12054 normalizedColorSwatchSize: 32, 12055 ratio: ratio 12056 }) 12057 })] 12058 }) 12059 }, key), ({ 12060 key 12061 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { 12062 variants: withHoverView && midFrameVariants, 12063 style: { 12064 height: '100%', 12065 width: '100%', 12066 position: 'absolute', 12067 top: 0, 12068 overflow: 'hidden', 12069 filter: 'blur(60px)', 12070 opacity: 0.1 12071 }, 12072 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 12073 spacing: 0, 12074 justify: "flex-start", 12075 style: { 12076 height: '100%', 12077 overflow: 'hidden' 12078 }, 12079 children: paletteColors.slice(0, 4).map(({ 12080 color 12081 }, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 12082 style: { 12083 height: '100%', 12084 background: color, 12085 flexGrow: 1 12086 } 12087 }, index)) 12088 }) 12089 }, key), ({ 12090 ratio, 12091 key 12092 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { 12093 variants: secondFrameVariants, 12094 style: { 12095 height: '100%', 12096 width: '100%', 12097 overflow: 'hidden', 12098 position: 'absolute', 12099 top: 0 12100 }, 12101 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 12102 spacing: 3 * ratio, 12103 justify: "center", 12104 style: { 12105 height: '100%', 12106 overflow: 'hidden', 12107 padding: 10 * ratio, 12108 boxSizing: 'border-box' 12109 }, 12110 children: label && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 12111 style: { 12112 fontSize: 40 * ratio, 12113 fontFamily: headingFontFamily, 12114 color: headingColor, 12115 fontWeight: headingFontWeight, 12116 lineHeight: '1em', 12117 textAlign: 'center' 12118 }, 12119 children: label 12120 }) 12121 }) 12122 }, key)] 12123 }); 12124 }; 12125 /* harmony default export */ const preview_styles = (PreviewStyles); 12126 12127 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-root.js 12128 /** 12129 * WordPress dependencies 12130 */ 12131 12132 12133 12134 12135 12136 12137 12138 /** 12139 * Internal dependencies 12140 */ 12141 12142 12143 12144 12145 12146 12147 const { 12148 useGlobalStyle: screen_root_useGlobalStyle 12149 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 12150 function ScreenRoot() { 12151 const [customCSS] = screen_root_useGlobalStyle('css'); 12152 const { 12153 hasVariations, 12154 canEditCSS 12155 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 12156 const { 12157 getEntityRecord, 12158 __experimentalGetCurrentGlobalStylesId, 12159 __experimentalGetCurrentThemeGlobalStylesVariations 12160 } = select(external_wp_coreData_namespaceObject.store); 12161 const globalStylesId = __experimentalGetCurrentGlobalStylesId(); 12162 const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined; 12163 return { 12164 hasVariations: !!__experimentalGetCurrentThemeGlobalStylesVariations()?.length, 12165 canEditCSS: !!globalStyles?._links?.['wp:action-edit-css'] 12166 }; 12167 }, []); 12168 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Card, { 12169 size: "small", 12170 isBorderless: true, 12171 className: "edit-site-global-styles-screen-root", 12172 isRounded: false, 12173 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardBody, { 12174 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 12175 spacing: 4, 12176 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Card, { 12177 className: "edit-site-global-styles-screen-root__active-style-tile", 12178 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardMedia, { 12179 className: "edit-site-global-styles-screen-root__active-style-tile-preview", 12180 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(preview_styles, {}) 12181 }) 12182 }), hasVariations && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 12183 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 12184 path: "/variations", 12185 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 12186 justify: "space-between", 12187 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 12188 children: (0,external_wp_i18n_namespaceObject.__)('Browse styles') 12189 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(IconWithCurrentColor, { 12190 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right 12191 })] 12192 }) 12193 }) 12194 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(root_menu, {})] 12195 }) 12196 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardDivider, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.CardBody, { 12197 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 12198 as: "p", 12199 paddingTop: 2 12200 /* 12201 * 13px matches the text inset of the NavigationButton (12px padding, plus the width of the button's border). 12202 * This is an ad hoc override for this instance and the Additional CSS option below. Other options for matching the 12203 * the nav button inset should be looked at before reusing further. 12204 */, 12205 paddingX: "13px", 12206 marginBottom: 4, 12207 children: (0,external_wp_i18n_namespaceObject.__)('Customize the appearance of specific blocks for the whole site.') 12208 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 12209 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 12210 path: "/blocks", 12211 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 12212 justify: "space-between", 12213 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 12214 children: (0,external_wp_i18n_namespaceObject.__)('Blocks') 12215 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(IconWithCurrentColor, { 12216 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right 12217 })] 12218 }) 12219 }) 12220 })] 12221 }), canEditCSS && !!customCSS && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 12222 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardDivider, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.CardBody, { 12223 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 12224 as: "p", 12225 paddingTop: 2, 12226 paddingX: "13px", 12227 marginBottom: 4, 12228 children: (0,external_wp_i18n_namespaceObject.__)('Add your own CSS to customize the appearance and layout of your site.') 12229 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 12230 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 12231 path: "/css", 12232 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 12233 justify: "space-between", 12234 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 12235 children: (0,external_wp_i18n_namespaceObject.__)('Additional CSS') 12236 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(IconWithCurrentColor, { 12237 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right 12238 })] 12239 }) 12240 }) 12241 })] 12242 })] 12243 })] 12244 }); 12245 } 12246 /* harmony default export */ const screen_root = (ScreenRoot); 12247 12248 ;// external ["wp","a11y"] 12249 const external_wp_a11y_namespaceObject = window["wp"]["a11y"]; 12250 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/variations/variations-panel.js 12251 /** 12252 * WordPress dependencies 12253 */ 12254 12255 12256 12257 12258 12259 /** 12260 * Internal dependencies 12261 */ 12262 12263 12264 12265 const { 12266 useGlobalStyle: variations_panel_useGlobalStyle 12267 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 12268 12269 // Only core block styles (source === block) or block styles with a matching 12270 // theme.json style variation will be configurable via Global Styles. 12271 function getFilteredBlockStyles(blockStyles, variations) { 12272 return blockStyles?.filter(style => style.source === 'block' || variations.includes(style.name)); 12273 } 12274 function useBlockVariations(name) { 12275 const blockStyles = (0,external_wp_data_namespaceObject.useSelect)(select => { 12276 const { 12277 getBlockStyles 12278 } = select(external_wp_blocks_namespaceObject.store); 12279 return getBlockStyles(name); 12280 }, [name]); 12281 const [variations] = variations_panel_useGlobalStyle('variations', name); 12282 const variationNames = Object.keys(variations !== null && variations !== void 0 ? variations : {}); 12283 return getFilteredBlockStyles(blockStyles, variationNames); 12284 } 12285 function VariationsPanel({ 12286 name 12287 }) { 12288 const coreBlockStyles = useBlockVariations(name); 12289 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 12290 isBordered: true, 12291 isSeparated: true, 12292 children: coreBlockStyles.map((style, index) => { 12293 if (style?.isDefault) { 12294 return null; 12295 } 12296 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 12297 path: '/blocks/' + encodeURIComponent(name) + '/variations/' + encodeURIComponent(style.name), 12298 children: style.label 12299 }, index); 12300 }) 12301 }); 12302 } 12303 12304 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/header.js 12305 /** 12306 * WordPress dependencies 12307 */ 12308 12309 12310 12311 12312 function ScreenHeader({ 12313 title, 12314 description, 12315 onBack 12316 }) { 12317 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 12318 spacing: 0, 12319 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalView, { 12320 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 12321 marginBottom: 0, 12322 paddingX: 4, 12323 paddingY: 3, 12324 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 12325 spacing: 2, 12326 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Navigator.BackButton, { 12327 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left, 12328 size: "small", 12329 label: (0,external_wp_i18n_namespaceObject.__)('Back'), 12330 onClick: onBack 12331 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 12332 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 12333 className: "edit-site-global-styles-header", 12334 level: 2, 12335 size: 13, 12336 children: title 12337 }) 12338 })] 12339 }) 12340 }) 12341 }), description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 12342 className: "edit-site-global-styles-header__description", 12343 children: description 12344 })] 12345 }); 12346 } 12347 /* harmony default export */ const header = (ScreenHeader); 12348 12349 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-block-list.js 12350 /** 12351 * WordPress dependencies 12352 */ 12353 12354 12355 12356 12357 12358 12359 12360 12361 12362 /** 12363 * Internal dependencies 12364 */ 12365 12366 12367 12368 12369 12370 const { 12371 useHasDimensionsPanel: screen_block_list_useHasDimensionsPanel, 12372 useHasTypographyPanel: screen_block_list_useHasTypographyPanel, 12373 useHasBorderPanel, 12374 useGlobalSetting: screen_block_list_useGlobalSetting, 12375 useSettingsForBlockElement: screen_block_list_useSettingsForBlockElement, 12376 useHasColorPanel: screen_block_list_useHasColorPanel 12377 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 12378 function useSortedBlockTypes() { 12379 const blockItems = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blocks_namespaceObject.store).getBlockTypes(), []); 12380 // Ensure core blocks are prioritized in the returned results, 12381 // because third party blocks can be registered earlier than 12382 // the core blocks (usually by using the `init` action), 12383 // thus affecting the display order. 12384 // We don't sort reusable blocks as they are handled differently. 12385 const groupByType = (blocks, block) => { 12386 const { 12387 core, 12388 noncore 12389 } = blocks; 12390 const type = block.name.startsWith('core/') ? core : noncore; 12391 type.push(block); 12392 return blocks; 12393 }; 12394 const { 12395 core: coreItems, 12396 noncore: nonCoreItems 12397 } = blockItems.reduce(groupByType, { 12398 core: [], 12399 noncore: [] 12400 }); 12401 return [...coreItems, ...nonCoreItems]; 12402 } 12403 function useBlockHasGlobalStyles(blockName) { 12404 const [rawSettings] = screen_block_list_useGlobalSetting('', blockName); 12405 const settings = screen_block_list_useSettingsForBlockElement(rawSettings, blockName); 12406 const hasTypographyPanel = screen_block_list_useHasTypographyPanel(settings); 12407 const hasColorPanel = screen_block_list_useHasColorPanel(settings); 12408 const hasBorderPanel = useHasBorderPanel(settings); 12409 const hasDimensionsPanel = screen_block_list_useHasDimensionsPanel(settings); 12410 const hasLayoutPanel = hasBorderPanel || hasDimensionsPanel; 12411 const hasVariationsPanel = !!useBlockVariations(blockName)?.length; 12412 const hasGlobalStyles = hasTypographyPanel || hasColorPanel || hasLayoutPanel || hasVariationsPanel; 12413 return hasGlobalStyles; 12414 } 12415 function BlockMenuItem({ 12416 block 12417 }) { 12418 const hasBlockMenuItem = useBlockHasGlobalStyles(block.name); 12419 if (!hasBlockMenuItem) { 12420 return null; 12421 } 12422 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 12423 path: '/blocks/' + encodeURIComponent(block.name), 12424 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 12425 justify: "flex-start", 12426 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockIcon, { 12427 icon: block.icon 12428 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 12429 children: block.title 12430 })] 12431 }) 12432 }); 12433 } 12434 function BlockList({ 12435 filterValue 12436 }) { 12437 const sortedBlockTypes = useSortedBlockTypes(); 12438 const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500); 12439 const { 12440 isMatchingSearchTerm 12441 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); 12442 const filteredBlockTypes = !filterValue ? sortedBlockTypes : sortedBlockTypes.filter(blockType => isMatchingSearchTerm(blockType, filterValue)); 12443 const blockTypesListRef = (0,external_wp_element_namespaceObject.useRef)(); 12444 12445 // Announce search results on change 12446 (0,external_wp_element_namespaceObject.useEffect)(() => { 12447 if (!filterValue) { 12448 return; 12449 } 12450 // We extract the results from the wrapper div's `ref` because 12451 // filtered items can contain items that will eventually not 12452 // render and there is no reliable way to detect when a child 12453 // will return `null`. 12454 // TODO: We should find a better way of handling this as it's 12455 // fragile and depends on the number of rendered elements of `BlockMenuItem`, 12456 // which is now one. 12457 // @see https://github.com/WordPress/gutenberg/pull/39117#discussion_r816022116 12458 const count = blockTypesListRef.current.childElementCount; 12459 const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %d: number of results. */ 12460 (0,external_wp_i18n_namespaceObject._n)('%d result found.', '%d results found.', count), count); 12461 debouncedSpeak(resultsFoundMessage, count); 12462 }, [filterValue, debouncedSpeak]); 12463 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 12464 ref: blockTypesListRef, 12465 className: "edit-site-block-types-item-list" 12466 // By default, BlockMenuItem has a role=listitem so this div must have a list role. 12467 , 12468 role: "list", 12469 children: filteredBlockTypes.length === 0 ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 12470 align: "center", 12471 as: "p", 12472 children: (0,external_wp_i18n_namespaceObject.__)('No blocks found.') 12473 }) : filteredBlockTypes.map(block => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockMenuItem, { 12474 block: block 12475 }, 'menu-itemblock-' + block.name)) 12476 }); 12477 } 12478 const MemoizedBlockList = (0,external_wp_element_namespaceObject.memo)(BlockList); 12479 function ScreenBlockList() { 12480 const [filterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)(''); 12481 const deferredFilterValue = (0,external_wp_element_namespaceObject.useDeferredValue)(filterValue); 12482 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 12483 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 12484 title: (0,external_wp_i18n_namespaceObject.__)('Blocks'), 12485 description: (0,external_wp_i18n_namespaceObject.__)('Customize the appearance of specific blocks and for the whole site.') 12486 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SearchControl, { 12487 __nextHasNoMarginBottom: true, 12488 className: "edit-site-block-types-search", 12489 onChange: setFilterValue, 12490 value: filterValue, 12491 label: (0,external_wp_i18n_namespaceObject.__)('Search'), 12492 placeholder: (0,external_wp_i18n_namespaceObject.__)('Search') 12493 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MemoizedBlockList, { 12494 filterValue: deferredFilterValue 12495 })] 12496 }); 12497 } 12498 /* harmony default export */ const screen_block_list = (ScreenBlockList); 12499 12500 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/block-preview-panel.js 12501 /** 12502 * WordPress dependencies 12503 */ 12504 12505 12506 12507 12508 12509 /** 12510 * Internal dependencies 12511 */ 12512 12513 12514 const BlockPreviewPanel = ({ 12515 name, 12516 variation = '' 12517 }) => { 12518 var _blockExample$viewpor; 12519 const blockExample = (0,external_wp_blocks_namespaceObject.getBlockType)(name)?.example; 12520 const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => { 12521 if (!blockExample) { 12522 return null; 12523 } 12524 const example = { 12525 ...blockExample, 12526 attributes: { 12527 ...blockExample.attributes, 12528 style: undefined, 12529 className: variation ? getVariationClassName(variation) : blockExample.attributes?.className 12530 } 12531 }; 12532 return (0,external_wp_blocks_namespaceObject.getBlockFromExample)(name, example); 12533 }, [name, blockExample, variation]); 12534 const viewportWidth = (_blockExample$viewpor = blockExample?.viewportWidth) !== null && _blockExample$viewpor !== void 0 ? _blockExample$viewpor : 500; 12535 // Same as height of InserterPreviewPanel. 12536 const previewHeight = 144; 12537 const sidebarWidth = 235; 12538 const scale = sidebarWidth / viewportWidth; 12539 const minHeight = scale !== 0 && scale < 1 && previewHeight ? previewHeight / scale : previewHeight; 12540 if (!blockExample) { 12541 return null; 12542 } 12543 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 12544 marginX: 4, 12545 marginBottom: 4, 12546 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 12547 className: "edit-site-global-styles__block-preview-panel", 12548 style: { 12549 maxHeight: previewHeight, 12550 boxSizing: 'initial' 12551 }, 12552 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockPreview, { 12553 blocks: blocks, 12554 viewportWidth: viewportWidth, 12555 minHeight: previewHeight, 12556 additionalStyles: 12557 //We want this CSS to be in sync with the one in InserterPreviewPanel. 12558 [{ 12559 css: ` 12560 body{ 12561 padding: 24px; 12562 min-height:$Math.round(minHeight)}px; 12563 display:flex; 12564 align-items:center; 12565 } 12566 .is-root-container { width: 100%; } 12567 ` 12568 }] 12569 }) 12570 }) 12571 }); 12572 }; 12573 /* harmony default export */ const block_preview_panel = (BlockPreviewPanel); 12574 12575 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/subtitle.js 12576 /** 12577 * WordPress dependencies 12578 */ 12579 12580 12581 function Subtitle({ 12582 children, 12583 level 12584 }) { 12585 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 12586 className: "edit-site-global-styles-subtitle", 12587 level: level !== null && level !== void 0 ? level : 2, 12588 children: children 12589 }); 12590 } 12591 /* harmony default export */ const subtitle = (Subtitle); 12592 12593 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-block.js 12594 /* wp:polyfill */ 12595 /** 12596 * WordPress dependencies 12597 */ 12598 12599 12600 12601 12602 12603 12604 12605 12606 /** 12607 * Internal dependencies 12608 */ 12609 12610 12611 12612 12613 12614 12615 // Initial control values. 12616 12617 const BACKGROUND_BLOCK_DEFAULT_VALUES = { 12618 backgroundSize: 'cover', 12619 backgroundPosition: '50% 50%' // used only when backgroundSize is 'contain'. 12620 }; 12621 function applyFallbackStyle(border) { 12622 if (!border) { 12623 return border; 12624 } 12625 const hasColorOrWidth = border.color || border.width; 12626 if (!border.style && hasColorOrWidth) { 12627 return { 12628 ...border, 12629 style: 'solid' 12630 }; 12631 } 12632 if (border.style && !hasColorOrWidth) { 12633 return undefined; 12634 } 12635 return border; 12636 } 12637 function applyAllFallbackStyles(border) { 12638 if (!border) { 12639 return border; 12640 } 12641 if ((0,external_wp_components_namespaceObject.__experimentalHasSplitBorders)(border)) { 12642 return { 12643 top: applyFallbackStyle(border.top), 12644 right: applyFallbackStyle(border.right), 12645 bottom: applyFallbackStyle(border.bottom), 12646 left: applyFallbackStyle(border.left) 12647 }; 12648 } 12649 return applyFallbackStyle(border); 12650 } 12651 const { 12652 useHasDimensionsPanel: screen_block_useHasDimensionsPanel, 12653 useHasTypographyPanel: screen_block_useHasTypographyPanel, 12654 useHasBorderPanel: screen_block_useHasBorderPanel, 12655 useGlobalSetting: screen_block_useGlobalSetting, 12656 useSettingsForBlockElement: screen_block_useSettingsForBlockElement, 12657 useHasColorPanel: screen_block_useHasColorPanel, 12658 useHasFiltersPanel, 12659 useHasImageSettingsPanel, 12660 useGlobalStyle: screen_block_useGlobalStyle, 12661 useHasBackgroundPanel: screen_block_useHasBackgroundPanel, 12662 BackgroundPanel: StylesBackgroundPanel, 12663 BorderPanel: StylesBorderPanel, 12664 ColorPanel: StylesColorPanel, 12665 TypographyPanel: StylesTypographyPanel, 12666 DimensionsPanel: StylesDimensionsPanel, 12667 FiltersPanel: StylesFiltersPanel, 12668 ImageSettingsPanel, 12669 AdvancedPanel: StylesAdvancedPanel 12670 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 12671 function ScreenBlock({ 12672 name, 12673 variation 12674 }) { 12675 let prefixParts = []; 12676 if (variation) { 12677 prefixParts = ['variations', variation].concat(prefixParts); 12678 } 12679 const prefix = prefixParts.join('.'); 12680 const [style] = screen_block_useGlobalStyle(prefix, name, 'user', { 12681 shouldDecodeEncode: false 12682 }); 12683 const [inheritedStyle, setStyle] = screen_block_useGlobalStyle(prefix, name, 'all', { 12684 shouldDecodeEncode: false 12685 }); 12686 const [userSettings] = screen_block_useGlobalSetting('', name, 'user'); 12687 const [rawSettings, setSettings] = screen_block_useGlobalSetting('', name); 12688 const settingsForBlockElement = screen_block_useSettingsForBlockElement(rawSettings, name); 12689 const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name); 12690 12691 // Only allow `blockGap` support if serialization has not been skipped, to be sure global spacing can be applied. 12692 let disableBlockGap = false; 12693 if (settingsForBlockElement?.spacing?.blockGap && blockType?.supports?.spacing?.blockGap && (blockType?.supports?.spacing?.__experimentalSkipSerialization === true || blockType?.supports?.spacing?.__experimentalSkipSerialization?.some?.(spacingType => spacingType === 'blockGap'))) { 12694 disableBlockGap = true; 12695 } 12696 12697 // Only allow `aspectRatio` support if the block is not the grouping block. 12698 // The grouping block allows the user to use Group, Row and Stack variations, 12699 // and it is highly likely that the user will not want to set an aspect ratio 12700 // for all three at once. Until there is the ability to set a different aspect 12701 // ratio for each variation, we disable the aspect ratio controls for the 12702 // grouping block in global styles. 12703 let disableAspectRatio = false; 12704 if (settingsForBlockElement?.dimensions?.aspectRatio && name === 'core/group') { 12705 disableAspectRatio = true; 12706 } 12707 const settings = (0,external_wp_element_namespaceObject.useMemo)(() => { 12708 const updatedSettings = structuredClone(settingsForBlockElement); 12709 if (disableBlockGap) { 12710 updatedSettings.spacing.blockGap = false; 12711 } 12712 if (disableAspectRatio) { 12713 updatedSettings.dimensions.aspectRatio = false; 12714 } 12715 return updatedSettings; 12716 }, [settingsForBlockElement, disableBlockGap, disableAspectRatio]); 12717 const blockVariations = useBlockVariations(name); 12718 const hasBackgroundPanel = screen_block_useHasBackgroundPanel(settings); 12719 const hasTypographyPanel = screen_block_useHasTypographyPanel(settings); 12720 const hasColorPanel = screen_block_useHasColorPanel(settings); 12721 const hasBorderPanel = screen_block_useHasBorderPanel(settings); 12722 const hasDimensionsPanel = screen_block_useHasDimensionsPanel(settings); 12723 const hasFiltersPanel = useHasFiltersPanel(settings); 12724 const hasImageSettingsPanel = useHasImageSettingsPanel(name, userSettings, settings); 12725 const hasVariationsPanel = !!blockVariations?.length && !variation; 12726 const { 12727 canEditCSS 12728 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 12729 const { 12730 getEntityRecord, 12731 __experimentalGetCurrentGlobalStylesId 12732 } = select(external_wp_coreData_namespaceObject.store); 12733 const globalStylesId = __experimentalGetCurrentGlobalStylesId(); 12734 const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined; 12735 return { 12736 canEditCSS: !!globalStyles?._links?.['wp:action-edit-css'] 12737 }; 12738 }, []); 12739 const currentBlockStyle = variation ? blockVariations.find(s => s.name === variation) : null; 12740 12741 // These intermediary objects are needed because the "layout" property is stored 12742 // in settings rather than styles. 12743 const inheritedStyleWithLayout = (0,external_wp_element_namespaceObject.useMemo)(() => { 12744 return { 12745 ...inheritedStyle, 12746 layout: settings.layout 12747 }; 12748 }, [inheritedStyle, settings.layout]); 12749 const styleWithLayout = (0,external_wp_element_namespaceObject.useMemo)(() => { 12750 return { 12751 ...style, 12752 layout: userSettings.layout 12753 }; 12754 }, [style, userSettings.layout]); 12755 const onChangeDimensions = newStyle => { 12756 const updatedStyle = { 12757 ...newStyle 12758 }; 12759 delete updatedStyle.layout; 12760 setStyle(updatedStyle); 12761 if (newStyle.layout !== userSettings.layout) { 12762 setSettings({ 12763 ...userSettings, 12764 layout: newStyle.layout 12765 }); 12766 } 12767 }; 12768 const onChangeLightbox = newSetting => { 12769 // If the newSetting is undefined, this means that the user has deselected 12770 // (reset) the lightbox setting. 12771 if (newSetting === undefined) { 12772 setSettings({ 12773 ...rawSettings, 12774 lightbox: undefined 12775 }); 12776 12777 // Otherwise, we simply set the lightbox setting to the new value but 12778 // taking care of not overriding the other lightbox settings. 12779 } else { 12780 setSettings({ 12781 ...rawSettings, 12782 lightbox: { 12783 ...rawSettings.lightbox, 12784 ...newSetting 12785 } 12786 }); 12787 } 12788 }; 12789 const onChangeBorders = newStyle => { 12790 if (!newStyle?.border) { 12791 setStyle(newStyle); 12792 return; 12793 } 12794 12795 // As Global Styles can't conditionally generate styles based on if 12796 // other style properties have been set, we need to force split 12797 // border definitions for user set global border styles. Border 12798 // radius is derived from the same property i.e. `border.radius` if 12799 // it is a string that is used. The longhand border radii styles are 12800 // only generated if that property is an object. 12801 // 12802 // For borders (color, style, and width) those are all properties on 12803 // the `border` style property. This means if the theme.json defined 12804 // split borders and the user condenses them into a flat border or 12805 // vice-versa we'd get both sets of styles which would conflict. 12806 const { 12807 radius, 12808 ...newBorder 12809 } = newStyle.border; 12810 const border = applyAllFallbackStyles(newBorder); 12811 const updatedBorder = !(0,external_wp_components_namespaceObject.__experimentalHasSplitBorders)(border) ? { 12812 top: border, 12813 right: border, 12814 bottom: border, 12815 left: border 12816 } : { 12817 color: null, 12818 style: null, 12819 width: null, 12820 ...border 12821 }; 12822 setStyle({ 12823 ...newStyle, 12824 border: { 12825 ...updatedBorder, 12826 radius 12827 } 12828 }); 12829 }; 12830 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 12831 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 12832 title: variation ? currentBlockStyle?.label : blockType.title 12833 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_preview_panel, { 12834 name: name, 12835 variation: variation 12836 }), hasVariationsPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 12837 className: "edit-site-global-styles-screen-variations", 12838 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 12839 spacing: 3, 12840 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { 12841 children: (0,external_wp_i18n_namespaceObject.__)('Style Variations') 12842 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(VariationsPanel, { 12843 name: name 12844 })] 12845 }) 12846 }), hasColorPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StylesColorPanel, { 12847 inheritedValue: inheritedStyle, 12848 value: style, 12849 onChange: setStyle, 12850 settings: settings 12851 }), hasBackgroundPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StylesBackgroundPanel, { 12852 inheritedValue: inheritedStyle, 12853 value: style, 12854 onChange: setStyle, 12855 settings: settings, 12856 defaultValues: BACKGROUND_BLOCK_DEFAULT_VALUES 12857 }), hasTypographyPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StylesTypographyPanel, { 12858 inheritedValue: inheritedStyle, 12859 value: style, 12860 onChange: setStyle, 12861 settings: settings 12862 }), hasDimensionsPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StylesDimensionsPanel, { 12863 inheritedValue: inheritedStyleWithLayout, 12864 value: styleWithLayout, 12865 onChange: onChangeDimensions, 12866 settings: settings, 12867 includeLayoutControls: true 12868 }), hasBorderPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StylesBorderPanel, { 12869 inheritedValue: inheritedStyle, 12870 value: style, 12871 onChange: onChangeBorders, 12872 settings: settings 12873 }), hasFiltersPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StylesFiltersPanel, { 12874 inheritedValue: inheritedStyleWithLayout, 12875 value: styleWithLayout, 12876 onChange: setStyle, 12877 settings: settings, 12878 includeLayoutControls: true 12879 }), hasImageSettingsPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ImageSettingsPanel, { 12880 onChange: onChangeLightbox, 12881 value: userSettings, 12882 inheritedValue: settings 12883 }), canEditCSS && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { 12884 title: (0,external_wp_i18n_namespaceObject.__)('Advanced'), 12885 initialOpen: false, 12886 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 12887 children: (0,external_wp_i18n_namespaceObject.sprintf)( 12888 // translators: %s: is the name of a block e.g., 'Image' or 'Table'. 12889 (0,external_wp_i18n_namespaceObject.__)('Add your own CSS to customize the appearance of the %s block. You do not need to include a CSS selector, just add the property and value.'), blockType?.title) 12890 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StylesAdvancedPanel, { 12891 value: style, 12892 onChange: setStyle, 12893 inheritedValue: inheritedStyle 12894 })] 12895 })] 12896 }); 12897 } 12898 /* harmony default export */ const screen_block = (ScreenBlock); 12899 12900 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/typography-elements.js 12901 /** 12902 * WordPress dependencies 12903 */ 12904 12905 12906 12907 12908 /** 12909 * Internal dependencies 12910 */ 12911 12912 12913 12914 12915 const { 12916 useGlobalStyle: typography_elements_useGlobalStyle 12917 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 12918 function ElementItem({ 12919 parentMenu, 12920 element, 12921 label 12922 }) { 12923 var _ref; 12924 const prefix = element === 'text' || !element ? '' : `elements.$element}.`; 12925 const extraStyles = element === 'link' ? { 12926 textDecoration: 'underline' 12927 } : {}; 12928 const [fontFamily] = typography_elements_useGlobalStyle(prefix + 'typography.fontFamily'); 12929 const [fontStyle] = typography_elements_useGlobalStyle(prefix + 'typography.fontStyle'); 12930 const [fontWeight] = typography_elements_useGlobalStyle(prefix + 'typography.fontWeight'); 12931 const [backgroundColor] = typography_elements_useGlobalStyle(prefix + 'color.background'); 12932 const [fallbackBackgroundColor] = typography_elements_useGlobalStyle('color.background'); 12933 const [gradientValue] = typography_elements_useGlobalStyle(prefix + 'color.gradient'); 12934 const [color] = typography_elements_useGlobalStyle(prefix + 'color.text'); 12935 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 12936 path: parentMenu + '/typography/' + element, 12937 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 12938 justify: "flex-start", 12939 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 12940 className: "edit-site-global-styles-screen-typography__indicator", 12941 style: { 12942 fontFamily: fontFamily !== null && fontFamily !== void 0 ? fontFamily : 'serif', 12943 background: (_ref = gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor) !== null && _ref !== void 0 ? _ref : fallbackBackgroundColor, 12944 color, 12945 fontStyle, 12946 fontWeight, 12947 ...extraStyles 12948 }, 12949 "aria-hidden": "true", 12950 children: (0,external_wp_i18n_namespaceObject.__)('Aa') 12951 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 12952 children: label 12953 })] 12954 }) 12955 }); 12956 } 12957 function TypographyElements() { 12958 const parentMenu = ''; 12959 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 12960 spacing: 3, 12961 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { 12962 level: 3, 12963 children: (0,external_wp_i18n_namespaceObject.__)('Elements') 12964 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { 12965 isBordered: true, 12966 isSeparated: true, 12967 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ElementItem, { 12968 parentMenu: parentMenu, 12969 element: "text", 12970 label: (0,external_wp_i18n_namespaceObject.__)('Text') 12971 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ElementItem, { 12972 parentMenu: parentMenu, 12973 element: "link", 12974 label: (0,external_wp_i18n_namespaceObject.__)('Links') 12975 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ElementItem, { 12976 parentMenu: parentMenu, 12977 element: "heading", 12978 label: (0,external_wp_i18n_namespaceObject.__)('Headings') 12979 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ElementItem, { 12980 parentMenu: parentMenu, 12981 element: "caption", 12982 label: (0,external_wp_i18n_namespaceObject.__)('Captions') 12983 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ElementItem, { 12984 parentMenu: parentMenu, 12985 element: "button", 12986 label: (0,external_wp_i18n_namespaceObject.__)('Buttons') 12987 })] 12988 })] 12989 }); 12990 } 12991 /* harmony default export */ const typography_elements = (TypographyElements); 12992 12993 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preview-typography.js 12994 /** 12995 * WordPress dependencies 12996 */ 12997 12998 12999 /** 13000 * Internal dependencies 13001 */ 13002 13003 13004 13005 const StylesPreviewTypography = ({ 13006 variation, 13007 isFocused, 13008 withHoverView 13009 }) => { 13010 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreviewWrapper, { 13011 label: variation.title, 13012 isFocused: isFocused, 13013 withHoverView: withHoverView, 13014 children: ({ 13015 ratio, 13016 key 13017 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 13018 spacing: 10 * ratio, 13019 justify: "center", 13020 style: { 13021 height: '100%', 13022 overflow: 'hidden' 13023 }, 13024 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreviewTypography, { 13025 variation: variation, 13026 fontSize: 85 * ratio 13027 }) 13028 }, key) 13029 }); 13030 }; 13031 /* harmony default export */ const preview_typography = (StylesPreviewTypography); 13032 13033 ;// ./node_modules/@wordpress/edit-site/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js 13034 /* wp:polyfill */ 13035 /** 13036 * WordPress dependencies 13037 */ 13038 13039 13040 13041 13042 13043 13044 13045 /** 13046 * Internal dependencies 13047 */ 13048 13049 const use_theme_style_variations_by_property_EMPTY_ARRAY = []; 13050 const { 13051 GlobalStylesContext: use_theme_style_variations_by_property_GlobalStylesContext, 13052 areGlobalStyleConfigsEqual 13053 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 13054 const { 13055 mergeBaseAndUserConfigs: use_theme_style_variations_by_property_mergeBaseAndUserConfigs 13056 } = unlock(external_wp_editor_namespaceObject.privateApis); 13057 13058 /** 13059 * Removes all instances of properties from an object. 13060 * 13061 * @param {Object} object The object to remove the properties from. 13062 * @param {string[]} properties The properties to remove. 13063 * @return {Object} The modified object. 13064 */ 13065 function removePropertiesFromObject(object, properties) { 13066 if (!properties?.length) { 13067 return object; 13068 } 13069 if (typeof object !== 'object' || !object || !Object.keys(object).length) { 13070 return object; 13071 } 13072 for (const key in object) { 13073 if (properties.includes(key)) { 13074 delete object[key]; 13075 } else if (typeof object[key] === 'object') { 13076 removePropertiesFromObject(object[key], properties); 13077 } 13078 } 13079 return object; 13080 } 13081 13082 /** 13083 * Checks whether a style variation is empty. 13084 * 13085 * @param {Object} variation A style variation object. 13086 * @param {string} variation.title The title of the variation. 13087 * @param {Object} variation.settings The settings of the variation. 13088 * @param {Object} variation.styles The styles of the variation. 13089 * @return {boolean} Whether the variation is empty. 13090 */ 13091 function hasThemeVariation({ 13092 title, 13093 settings, 13094 styles 13095 }) { 13096 return title === (0,external_wp_i18n_namespaceObject.__)('Default') || 13097 // Always preserve the default variation. 13098 Object.keys(settings).length > 0 || Object.keys(styles).length > 0; 13099 } 13100 13101 /** 13102 * Fetches the current theme style variations that contain only the specified properties 13103 * and merges them with the user config. 13104 * 13105 * @param {string[]} properties The properties to filter by. 13106 * @return {Object[]|*} The merged object. 13107 */ 13108 function useCurrentMergeThemeStyleVariationsWithUserConfig(properties = []) { 13109 const { 13110 variationsFromTheme 13111 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 13112 const _variationsFromTheme = select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentThemeGlobalStylesVariations(); 13113 return { 13114 variationsFromTheme: _variationsFromTheme || use_theme_style_variations_by_property_EMPTY_ARRAY 13115 }; 13116 }, []); 13117 const { 13118 user: userVariation 13119 } = (0,external_wp_element_namespaceObject.useContext)(use_theme_style_variations_by_property_GlobalStylesContext); 13120 const propertiesAsString = properties.toString(); 13121 return (0,external_wp_element_namespaceObject.useMemo)(() => { 13122 const clonedUserVariation = structuredClone(userVariation); 13123 13124 // Get user variation and remove the settings for the given property. 13125 const userVariationWithoutProperties = removePropertiesFromObject(clonedUserVariation, properties); 13126 userVariationWithoutProperties.title = (0,external_wp_i18n_namespaceObject.__)('Default'); 13127 const variationsWithPropertiesAndBase = variationsFromTheme.filter(variation => { 13128 return isVariationWithProperties(variation, properties); 13129 }).map(variation => { 13130 return use_theme_style_variations_by_property_mergeBaseAndUserConfigs(userVariationWithoutProperties, variation); 13131 }); 13132 const variationsByProperties = [userVariationWithoutProperties, ...variationsWithPropertiesAndBase]; 13133 13134 /* 13135 * Filter out variations with no settings or styles. 13136 */ 13137 return variationsByProperties?.length ? variationsByProperties.filter(hasThemeVariation) : []; 13138 }, [propertiesAsString, userVariation, variationsFromTheme]); 13139 } 13140 13141 /** 13142 * Returns a new object, with properties specified in `properties` array., 13143 * maintain the original object tree structure. 13144 * The function is recursive, so it will perform a deep search for the given properties. 13145 * E.g., the function will return `{ a: { b: { c: { test: 1 } } } }` if the properties are `[ 'test' ]`. 13146 * 13147 * @param {Object} object The object to filter 13148 * @param {string[]} properties The properties to filter by 13149 * @return {Object} The merged object. 13150 */ 13151 const filterObjectByProperties = (object, properties) => { 13152 if (!object || !properties?.length) { 13153 return {}; 13154 } 13155 const newObject = {}; 13156 Object.keys(object).forEach(key => { 13157 if (properties.includes(key)) { 13158 newObject[key] = object[key]; 13159 } else if (typeof object[key] === 'object') { 13160 const newFilter = filterObjectByProperties(object[key], properties); 13161 if (Object.keys(newFilter).length) { 13162 newObject[key] = newFilter; 13163 } 13164 } 13165 }); 13166 return newObject; 13167 }; 13168 13169 /** 13170 * Compares a style variation to the same variation filtered by the specified properties. 13171 * Returns true if the variation contains only the properties specified. 13172 * 13173 * @param {Object} variation The variation to compare. 13174 * @param {string[]} properties The properties to compare. 13175 * @return {boolean} Whether the variation contains only the specified properties. 13176 */ 13177 function isVariationWithProperties(variation, properties) { 13178 const variationWithProperties = filterObjectByProperties(structuredClone(variation), properties); 13179 return areGlobalStyleConfigsEqual(variationWithProperties, variation); 13180 } 13181 13182 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/variations/variation.js 13183 /** 13184 * External dependencies 13185 */ 13186 13187 13188 /** 13189 * WordPress dependencies 13190 */ 13191 13192 13193 13194 13195 13196 13197 13198 /** 13199 * Internal dependencies 13200 */ 13201 13202 13203 13204 const { 13205 mergeBaseAndUserConfigs: variation_mergeBaseAndUserConfigs 13206 } = unlock(external_wp_editor_namespaceObject.privateApis); 13207 const { 13208 GlobalStylesContext: variation_GlobalStylesContext, 13209 areGlobalStyleConfigsEqual: variation_areGlobalStyleConfigsEqual 13210 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 13211 function Variation({ 13212 variation, 13213 children, 13214 isPill, 13215 properties, 13216 showTooltip 13217 }) { 13218 const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false); 13219 const { 13220 base, 13221 user, 13222 setUserConfig 13223 } = (0,external_wp_element_namespaceObject.useContext)(variation_GlobalStylesContext); 13224 const context = (0,external_wp_element_namespaceObject.useMemo)(() => { 13225 let merged = variation_mergeBaseAndUserConfigs(base, variation); 13226 if (properties) { 13227 merged = filterObjectByProperties(merged, properties); 13228 } 13229 return { 13230 user: variation, 13231 base, 13232 merged, 13233 setUserConfig: () => {} 13234 }; 13235 }, [variation, base, properties]); 13236 const selectVariation = () => setUserConfig(variation); 13237 const selectOnEnter = event => { 13238 if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER) { 13239 event.preventDefault(); 13240 selectVariation(); 13241 } 13242 }; 13243 const isActive = (0,external_wp_element_namespaceObject.useMemo)(() => variation_areGlobalStyleConfigsEqual(user, variation), [user, variation]); 13244 let label = variation?.title; 13245 if (variation?.description) { 13246 label = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: variation title. 2: variation description. */ 13247 (0,external_wp_i18n_namespaceObject._x)('%1$s (%2$s)', 'variation label'), variation?.title, variation?.description); 13248 } 13249 const content = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 13250 className: dist_clsx('edit-site-global-styles-variations_item', { 13251 'is-active': isActive 13252 }), 13253 role: "button", 13254 onClick: selectVariation, 13255 onKeyDown: selectOnEnter, 13256 tabIndex: "0", 13257 "aria-label": label, 13258 "aria-current": isActive, 13259 onFocus: () => setIsFocused(true), 13260 onBlur: () => setIsFocused(false), 13261 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 13262 className: dist_clsx('edit-site-global-styles-variations_item-preview', { 13263 'is-pill': isPill 13264 }), 13265 children: children(isFocused) 13266 }) 13267 }); 13268 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(variation_GlobalStylesContext.Provider, { 13269 value: context, 13270 children: showTooltip ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { 13271 text: variation?.title, 13272 children: content 13273 }) : content 13274 }); 13275 } 13276 13277 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/variations/variations-typography.js 13278 /** 13279 * WordPress dependencies 13280 */ 13281 13282 13283 /** 13284 * Internal dependencies 13285 */ 13286 13287 13288 13289 13290 13291 function TypographyVariations({ 13292 title, 13293 gap = 2 13294 }) { 13295 const propertiesToFilter = ['typography']; 13296 const typographyVariations = useCurrentMergeThemeStyleVariationsWithUserConfig(propertiesToFilter); 13297 13298 // Return null if there is only one variation (the default). 13299 if (typographyVariations?.length <= 1) { 13300 return null; 13301 } 13302 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 13303 spacing: 3, 13304 children: [title && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { 13305 level: 3, 13306 children: title 13307 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, { 13308 columns: 3, 13309 gap: gap, 13310 className: "edit-site-global-styles-style-variations-container", 13311 children: typographyVariations.map((variation, index) => { 13312 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Variation, { 13313 variation: variation, 13314 properties: propertiesToFilter, 13315 showTooltip: true, 13316 children: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(preview_typography, { 13317 variation: variation 13318 }) 13319 }, index); 13320 }) 13321 })] 13322 }); 13323 } 13324 13325 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/font-sizes-count.js 13326 /** 13327 * WordPress dependencies 13328 */ 13329 13330 13331 13332 13333 /** 13334 * Internal dependencies 13335 */ 13336 13337 13338 13339 function FontSizes() { 13340 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 13341 spacing: 2, 13342 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 13343 justify: "space-between", 13344 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { 13345 level: 3, 13346 children: (0,external_wp_i18n_namespaceObject.__)('Font Sizes') 13347 }) 13348 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 13349 isBordered: true, 13350 isSeparated: true, 13351 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 13352 path: "/typography/font-sizes", 13353 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 13354 direction: "row", 13355 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 13356 children: (0,external_wp_i18n_namespaceObject.__)('Font size presets') 13357 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { 13358 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right 13359 })] 13360 }) 13361 }) 13362 })] 13363 }); 13364 } 13365 /* harmony default export */ const font_sizes_count = (FontSizes); 13366 13367 ;// ./node_modules/@wordpress/icons/build-module/library/settings.js 13368 /** 13369 * WordPress dependencies 13370 */ 13371 13372 13373 const settings_settings = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { 13374 xmlns: "http://www.w3.org/2000/svg", 13375 viewBox: "0 0 24 24", 13376 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 13377 d: "m19 7.5h-7.628c-.3089-.87389-1.1423-1.5-2.122-1.5-.97966 0-1.81309.62611-2.12197 1.5h-2.12803v1.5h2.12803c.30888.87389 1.14231 1.5 2.12197 1.5.9797 0 1.8131-.62611 2.122-1.5h7.628z" 13378 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 13379 d: "m19 15h-2.128c-.3089-.8739-1.1423-1.5-2.122-1.5s-1.8131.6261-2.122 1.5h-7.628v1.5h7.628c.3089.8739 1.1423 1.5 2.122 1.5s1.8131-.6261 2.122-1.5h2.128z" 13380 })] 13381 }); 13382 /* harmony default export */ const library_settings = (settings_settings); 13383 13384 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/resolvers.js 13385 /** 13386 * WordPress dependencies 13387 */ 13388 13389 const FONT_FAMILIES_URL = '/wp/v2/font-families'; 13390 const FONT_COLLECTIONS_URL = '/wp/v2/font-collections'; 13391 async function fetchInstallFontFamily(data) { 13392 const config = { 13393 path: FONT_FAMILIES_URL, 13394 method: 'POST', 13395 body: data 13396 }; 13397 const response = await external_wp_apiFetch_default()(config); 13398 return { 13399 id: response.id, 13400 ...response.font_family_settings, 13401 fontFace: [] 13402 }; 13403 } 13404 async function fetchInstallFontFace(fontFamilyId, data) { 13405 const config = { 13406 path: `$FONT_FAMILIES_URL}/$fontFamilyId}/font-faces`, 13407 method: 'POST', 13408 body: data 13409 }; 13410 const response = await external_wp_apiFetch_default()(config); 13411 return { 13412 id: response.id, 13413 ...response.font_face_settings 13414 }; 13415 } 13416 async function fetchGetFontFamilyBySlug(slug) { 13417 const config = { 13418 path: `$FONT_FAMILIES_URL}?slug=$slug}&_embed=true`, 13419 method: 'GET' 13420 }; 13421 const response = await external_wp_apiFetch_default()(config); 13422 if (!response || response.length === 0) { 13423 return null; 13424 } 13425 const fontFamilyPost = response[0]; 13426 return { 13427 id: fontFamilyPost.id, 13428 ...fontFamilyPost.font_family_settings, 13429 fontFace: fontFamilyPost?._embedded?.font_faces.map(face => face.font_face_settings) || [] 13430 }; 13431 } 13432 async function fetchUninstallFontFamily(fontFamilyId) { 13433 const config = { 13434 path: `$FONT_FAMILIES_URL}/$fontFamilyId}?force=true`, 13435 method: 'DELETE' 13436 }; 13437 return await external_wp_apiFetch_default()(config); 13438 } 13439 async function fetchFontCollections() { 13440 const config = { 13441 path: `$FONT_COLLECTIONS_URL}?_fields=slug,name,description`, 13442 method: 'GET' 13443 }; 13444 return await external_wp_apiFetch_default()(config); 13445 } 13446 async function fetchFontCollection(id) { 13447 const config = { 13448 path: `$FONT_COLLECTIONS_URL}/$id}`, 13449 method: 'GET' 13450 }; 13451 return await external_wp_apiFetch_default()(config); 13452 } 13453 13454 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/constants.js 13455 /** 13456 * WordPress dependencies 13457 */ 13458 13459 const ALLOWED_FILE_EXTENSIONS = ['otf', 'ttf', 'woff', 'woff2']; 13460 const FONT_WEIGHTS = { 13461 100: (0,external_wp_i18n_namespaceObject._x)('Thin', 'font weight'), 13462 200: (0,external_wp_i18n_namespaceObject._x)('Extra-light', 'font weight'), 13463 300: (0,external_wp_i18n_namespaceObject._x)('Light', 'font weight'), 13464 400: (0,external_wp_i18n_namespaceObject._x)('Normal', 'font weight'), 13465 500: (0,external_wp_i18n_namespaceObject._x)('Medium', 'font weight'), 13466 600: (0,external_wp_i18n_namespaceObject._x)('Semi-bold', 'font weight'), 13467 700: (0,external_wp_i18n_namespaceObject._x)('Bold', 'font weight'), 13468 800: (0,external_wp_i18n_namespaceObject._x)('Extra-bold', 'font weight'), 13469 900: (0,external_wp_i18n_namespaceObject._x)('Black', 'font weight') 13470 }; 13471 const FONT_STYLES = { 13472 normal: (0,external_wp_i18n_namespaceObject._x)('Normal', 'font style'), 13473 italic: (0,external_wp_i18n_namespaceObject._x)('Italic', 'font style') 13474 }; 13475 13476 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/index.js 13477 /** 13478 * WordPress dependencies 13479 */ 13480 13481 13482 /** 13483 * Internal dependencies 13484 */ 13485 13486 13487 13488 13489 13490 /** 13491 * Browser dependencies 13492 */ 13493 const { 13494 File 13495 } = window; 13496 const { 13497 kebabCase 13498 } = unlock(external_wp_components_namespaceObject.privateApis); 13499 function setUIValuesNeeded(font, extraValues = {}) { 13500 if (!font.name && (font.fontFamily || font.slug)) { 13501 font.name = font.fontFamily || font.slug; 13502 } 13503 return { 13504 ...font, 13505 ...extraValues 13506 }; 13507 } 13508 function isUrlEncoded(url) { 13509 if (typeof url !== 'string') { 13510 return false; 13511 } 13512 return url !== decodeURIComponent(url); 13513 } 13514 function getFontFaceVariantName(face) { 13515 const weightName = FONT_WEIGHTS[face.fontWeight] || face.fontWeight; 13516 const styleName = face.fontStyle === 'normal' ? '' : FONT_STYLES[face.fontStyle] || face.fontStyle; 13517 return `$weightName} $styleName}`; 13518 } 13519 function mergeFontFaces(existing = [], incoming = []) { 13520 const map = new Map(); 13521 for (const face of existing) { 13522 map.set(`$face.fontWeight}$face.fontStyle}`, face); 13523 } 13524 for (const face of incoming) { 13525 // This will overwrite if the src already exists, keeping it unique. 13526 map.set(`$face.fontWeight}$face.fontStyle}`, face); 13527 } 13528 return Array.from(map.values()); 13529 } 13530 function mergeFontFamilies(existing = [], incoming = []) { 13531 const map = new Map(); 13532 // Add the existing array to the map. 13533 for (const font of existing) { 13534 map.set(font.slug, { 13535 ...font 13536 }); 13537 } 13538 // Add the incoming array to the map, overwriting existing values excepting fontFace that need to be merged. 13539 for (const font of incoming) { 13540 if (map.has(font.slug)) { 13541 const { 13542 fontFace: incomingFontFaces, 13543 ...restIncoming 13544 } = font; 13545 const existingFont = map.get(font.slug); 13546 // Merge the fontFaces existing with the incoming fontFaces. 13547 const mergedFontFaces = mergeFontFaces(existingFont.fontFace, incomingFontFaces); 13548 // Except for the fontFace key all the other keys are overwritten with the incoming values. 13549 map.set(font.slug, { 13550 ...restIncoming, 13551 fontFace: mergedFontFaces 13552 }); 13553 } else { 13554 map.set(font.slug, { 13555 ...font 13556 }); 13557 } 13558 } 13559 return Array.from(map.values()); 13560 } 13561 13562 /* 13563 * Loads the font face from a URL and adds it to the browser. 13564 * It also adds it to the iframe document. 13565 */ 13566 async function loadFontFaceInBrowser(fontFace, source, addTo = 'all') { 13567 let dataSource; 13568 if (typeof source === 'string') { 13569 dataSource = `url($source})`; 13570 // eslint-disable-next-line no-undef 13571 } else if (source instanceof File) { 13572 dataSource = await source.arrayBuffer(); 13573 } else { 13574 return; 13575 } 13576 const newFont = new window.FontFace(formatFontFaceName(fontFace.fontFamily), dataSource, { 13577 style: fontFace.fontStyle, 13578 weight: fontFace.fontWeight 13579 }); 13580 const loadedFace = await newFont.load(); 13581 if (addTo === 'document' || addTo === 'all') { 13582 document.fonts.add(loadedFace); 13583 } 13584 if (addTo === 'iframe' || addTo === 'all') { 13585 const iframeDocument = document.querySelector('iframe[name="editor-canvas"]').contentDocument; 13586 iframeDocument.fonts.add(loadedFace); 13587 } 13588 } 13589 13590 /* 13591 * Unloads the font face and remove it from the browser. 13592 * It also removes it from the iframe document. 13593 * 13594 * Note that Font faces that were added to the set using the CSS @font-face rule 13595 * remain connected to the corresponding CSS, and cannot be deleted. 13596 * 13597 * @see https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet/delete. 13598 */ 13599 function unloadFontFaceInBrowser(fontFace, removeFrom = 'all') { 13600 const unloadFontFace = fonts => { 13601 fonts.forEach(f => { 13602 if (f.family === formatFontFaceName(fontFace?.fontFamily) && f.weight === fontFace?.fontWeight && f.style === fontFace?.fontStyle) { 13603 fonts.delete(f); 13604 } 13605 }); 13606 }; 13607 if (removeFrom === 'document' || removeFrom === 'all') { 13608 unloadFontFace(document.fonts); 13609 } 13610 if (removeFrom === 'iframe' || removeFrom === 'all') { 13611 const iframeDocument = document.querySelector('iframe[name="editor-canvas"]').contentDocument; 13612 unloadFontFace(iframeDocument.fonts); 13613 } 13614 } 13615 13616 /** 13617 * Retrieves the display source from a font face src. 13618 * 13619 * @param {string|string[]} input - The font face src. 13620 * @return {string|undefined} The display source or undefined if the input is invalid. 13621 */ 13622 function getDisplaySrcFromFontFace(input) { 13623 if (!input) { 13624 return; 13625 } 13626 let src; 13627 if (Array.isArray(input)) { 13628 src = input[0]; 13629 } else { 13630 src = input; 13631 } 13632 // It's expected theme fonts will already be loaded in the browser. 13633 if (src.startsWith('file:.')) { 13634 return; 13635 } 13636 if (!isUrlEncoded(src)) { 13637 src = encodeURI(src); 13638 } 13639 return src; 13640 } 13641 function makeFontFamilyFormData(fontFamily) { 13642 const formData = new FormData(); 13643 const { 13644 fontFace, 13645 category, 13646 ...familyWithValidParameters 13647 } = fontFamily; 13648 const fontFamilySettings = { 13649 ...familyWithValidParameters, 13650 slug: kebabCase(fontFamily.slug) 13651 }; 13652 formData.append('font_family_settings', JSON.stringify(fontFamilySettings)); 13653 return formData; 13654 } 13655 function makeFontFacesFormData(font) { 13656 if (font?.fontFace) { 13657 const fontFacesFormData = font.fontFace.map((item, faceIndex) => { 13658 const face = { 13659 ...item 13660 }; 13661 const formData = new FormData(); 13662 if (face.file) { 13663 // Normalize to an array, since face.file may be a single file or an array of files. 13664 const files = Array.isArray(face.file) ? face.file : [face.file]; 13665 const src = []; 13666 files.forEach((file, key) => { 13667 // Slugified file name because the it might contain spaces or characters treated differently on the server. 13668 const fileId = `file-$faceIndex}-$key}`; 13669 // Add the files to the formData 13670 formData.append(fileId, file, file.name); 13671 src.push(fileId); 13672 }); 13673 face.src = src.length === 1 ? src[0] : src; 13674 delete face.file; 13675 formData.append('font_face_settings', JSON.stringify(face)); 13676 } else { 13677 formData.append('font_face_settings', JSON.stringify(face)); 13678 } 13679 return formData; 13680 }); 13681 return fontFacesFormData; 13682 } 13683 } 13684 async function batchInstallFontFaces(fontFamilyId, fontFacesData) { 13685 const responses = []; 13686 13687 /* 13688 * Uses the same response format as Promise.allSettled, but executes requests in sequence to work 13689 * around a race condition that can cause an error when the fonts directory doesn't exist yet. 13690 */ 13691 for (const faceData of fontFacesData) { 13692 try { 13693 const response = await fetchInstallFontFace(fontFamilyId, faceData); 13694 responses.push({ 13695 status: 'fulfilled', 13696 value: response 13697 }); 13698 } catch (error) { 13699 responses.push({ 13700 status: 'rejected', 13701 reason: error 13702 }); 13703 } 13704 } 13705 const results = { 13706 errors: [], 13707 successes: [] 13708 }; 13709 responses.forEach((result, index) => { 13710 if (result.status === 'fulfilled') { 13711 const response = result.value; 13712 if (response.id) { 13713 results.successes.push(response); 13714 } else { 13715 results.errors.push({ 13716 data: fontFacesData[index], 13717 message: `Error: $response.message}` 13718 }); 13719 } 13720 } else { 13721 // Handle network errors or other fetch-related errors 13722 results.errors.push({ 13723 data: fontFacesData[index], 13724 message: result.reason.message 13725 }); 13726 } 13727 }); 13728 return results; 13729 } 13730 13731 /* 13732 * Downloads a font face asset from a URL to the client and returns a File object. 13733 */ 13734 async function downloadFontFaceAssets(src) { 13735 // Normalize to an array, since `src` could be a string or array. 13736 src = Array.isArray(src) ? src : [src]; 13737 const files = await Promise.all(src.map(async url => { 13738 return fetch(new Request(url)).then(response => { 13739 if (!response.ok) { 13740 throw new Error(`Error downloading font face asset from $url}. Server responded with status: $response.status}`); 13741 } 13742 return response.blob(); 13743 }).then(blob => { 13744 const filename = url.split('/').pop(); 13745 const file = new File([blob], filename, { 13746 type: blob.type 13747 }); 13748 return file; 13749 }); 13750 })); 13751 13752 // If we only have one file return it (not the array). Otherwise return all of them in the array. 13753 return files.length === 1 ? files[0] : files; 13754 } 13755 13756 /* 13757 * Determine if a given Font Face is present in a given collection. 13758 * We determine that a font face has been installed by comparing the fontWeight and fontStyle 13759 * 13760 * @param {Object} fontFace The Font Face to seek 13761 * @param {Array} collection The Collection to seek in 13762 * @returns True if the font face is found in the collection. Otherwise False. 13763 */ 13764 function checkFontFaceInstalled(fontFace, collection) { 13765 return -1 !== collection.findIndex(collectionFontFace => { 13766 return collectionFontFace.fontWeight === fontFace.fontWeight && collectionFontFace.fontStyle === fontFace.fontStyle; 13767 }); 13768 } 13769 13770 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/toggleFont.js 13771 /** 13772 * Toggles the activation of a given font or font variant within a list of custom fonts. 13773 * 13774 * - If only the font is provided (without face), the entire font family's activation is toggled. 13775 * - If both font and face are provided, the activation of the specific font variant is toggled. 13776 * 13777 * @param {Object} font - The font to be toggled. 13778 * @param {string} font.slug - The unique identifier for the font. 13779 * @param {Array} [font.fontFace] - The list of font variants (faces) associated with the font. 13780 * 13781 * @param {Object} [face] - The specific font variant to be toggled. 13782 * @param {string} face.fontWeight - The weight of the font variant. 13783 * @param {string} face.fontStyle - The style of the font variant. 13784 * 13785 * @param {Array} initialfonts - The initial list of custom fonts. 13786 * 13787 * @return {Array} - The updated list of custom fonts with the font/font variant toggled. 13788 * 13789 * @example 13790 * const customFonts = [ 13791 * { slug: 'roboto', fontFace: [{ fontWeight: '400', fontStyle: 'normal' }] } 13792 * ]; 13793 * 13794 * toggleFont({ slug: 'roboto' }, null, customFonts); 13795 * // This will remove 'roboto' from customFonts 13796 * 13797 * toggleFont({ slug: 'roboto' }, { fontWeight: '400', fontStyle: 'normal' }, customFonts); 13798 * // This will remove the specified face from 'roboto' in customFonts 13799 * 13800 * toggleFont({ slug: 'roboto' }, { fontWeight: '500', fontStyle: 'normal' }, customFonts); 13801 * // This will add the specified face to 'roboto' in customFonts 13802 */ 13803 function toggleFont(font, face, initialfonts) { 13804 // Helper to check if a font is activated based on its slug 13805 const isFontActivated = f => f.slug === font.slug; 13806 13807 // Helper to get the activated font from a list of fonts 13808 const getActivatedFont = fonts => fonts.find(isFontActivated); 13809 13810 // Toggle the activation status of an entire font family 13811 const toggleEntireFontFamily = activatedFont => { 13812 if (!activatedFont) { 13813 // If the font is not active, activate the entire font family 13814 return [...initialfonts, font]; 13815 } 13816 // If the font is already active, deactivate the entire font family 13817 return initialfonts.filter(f => !isFontActivated(f)); 13818 }; 13819 13820 // Toggle the activation status of a specific font variant 13821 const toggleFontVariant = activatedFont => { 13822 const isFaceActivated = f => f.fontWeight === face.fontWeight && f.fontStyle === face.fontStyle; 13823 if (!activatedFont) { 13824 // If the font family is not active, activate the font family with the font variant 13825 return [...initialfonts, { 13826 ...font, 13827 fontFace: [face] 13828 }]; 13829 } 13830 let newFontFaces = activatedFont.fontFace || []; 13831 if (newFontFaces.find(isFaceActivated)) { 13832 // If the font variant is active, deactivate it 13833 newFontFaces = newFontFaces.filter(f => !isFaceActivated(f)); 13834 } else { 13835 // If the font variant is not active, activate it 13836 newFontFaces = [...newFontFaces, face]; 13837 } 13838 13839 // If there are no more font faces, deactivate the font family 13840 if (newFontFaces.length === 0) { 13841 return initialfonts.filter(f => !isFontActivated(f)); 13842 } 13843 13844 // Return updated fonts list with toggled font variant 13845 return initialfonts.map(f => isFontActivated(f) ? { 13846 ...f, 13847 fontFace: newFontFaces 13848 } : f); 13849 }; 13850 const activatedFont = getActivatedFont(initialfonts); 13851 if (!face) { 13852 return toggleEntireFontFamily(activatedFont); 13853 } 13854 return toggleFontVariant(activatedFont); 13855 } 13856 13857 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/context.js 13858 /** 13859 * WordPress dependencies 13860 */ 13861 13862 13863 13864 13865 13866 13867 /** 13868 * Internal dependencies 13869 */ 13870 13871 13872 const { 13873 useGlobalSetting: context_useGlobalSetting 13874 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 13875 13876 13877 13878 13879 const FontLibraryContext = (0,external_wp_element_namespaceObject.createContext)({}); 13880 function FontLibraryProvider({ 13881 children 13882 }) { 13883 const { 13884 saveEntityRecord 13885 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 13886 const { 13887 globalStylesId 13888 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 13889 const { 13890 __experimentalGetCurrentGlobalStylesId 13891 } = select(external_wp_coreData_namespaceObject.store); 13892 return { 13893 globalStylesId: __experimentalGetCurrentGlobalStylesId() 13894 }; 13895 }); 13896 const globalStyles = (0,external_wp_coreData_namespaceObject.useEntityRecord)('root', 'globalStyles', globalStylesId); 13897 const [isInstalling, setIsInstalling] = (0,external_wp_element_namespaceObject.useState)(false); 13898 const [refreshKey, setRefreshKey] = (0,external_wp_element_namespaceObject.useState)(0); 13899 const refreshLibrary = () => { 13900 setRefreshKey(Date.now()); 13901 }; 13902 const { 13903 records: libraryPosts = [], 13904 isResolving: isResolvingLibrary 13905 } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', 'wp_font_family', { 13906 refreshKey, 13907 _embed: true 13908 }); 13909 const libraryFonts = (libraryPosts || []).map(fontFamilyPost => { 13910 return { 13911 id: fontFamilyPost.id, 13912 ...fontFamilyPost.font_family_settings, 13913 fontFace: fontFamilyPost?._embedded?.font_faces.map(face => face.font_face_settings) || [] 13914 }; 13915 }) || []; 13916 13917 // Global Styles (settings) font families 13918 const [fontFamilies, setFontFamilies] = context_useGlobalSetting('typography.fontFamilies'); 13919 13920 /* 13921 * Save the font families to the database. 13922 * This function is called when the user activates or deactivates a font family. 13923 * It only updates the global styles post content in the database for new font families. 13924 * This avoids saving other styles/settings changed by the user using other parts of the editor. 13925 * 13926 * It uses the font families from the param to avoid using the font families from an outdated state. 13927 * 13928 * @param {Array} fonts - The font families that will be saved to the database. 13929 */ 13930 const saveFontFamilies = async fonts => { 13931 // Gets the global styles database post content. 13932 const updatedGlobalStyles = globalStyles.record; 13933 13934 // Updates the database version of global styles with the edited font families in the client. 13935 setNestedValue(updatedGlobalStyles, ['settings', 'typography', 'fontFamilies'], fonts); 13936 13937 // Saves a new version of the global styles in the database. 13938 await saveEntityRecord('root', 'globalStyles', updatedGlobalStyles); 13939 }; 13940 13941 // Library Fonts 13942 const [modalTabOpen, setModalTabOpen] = (0,external_wp_element_namespaceObject.useState)(false); 13943 const [libraryFontSelected, setLibraryFontSelected] = (0,external_wp_element_namespaceObject.useState)(null); 13944 13945 // Themes Fonts are the fonts defined in the global styles (database persisted theme.json data). 13946 const themeFonts = fontFamilies?.theme ? fontFamilies.theme.map(f => setUIValuesNeeded(f, { 13947 source: 'theme' 13948 })).sort((a, b) => a.name.localeCompare(b.name)) : []; 13949 const customFonts = fontFamilies?.custom ? fontFamilies.custom.map(f => setUIValuesNeeded(f, { 13950 source: 'custom' 13951 })).sort((a, b) => a.name.localeCompare(b.name)) : []; 13952 const baseCustomFonts = libraryFonts ? libraryFonts.map(f => setUIValuesNeeded(f, { 13953 source: 'custom' 13954 })).sort((a, b) => a.name.localeCompare(b.name)) : []; 13955 (0,external_wp_element_namespaceObject.useEffect)(() => { 13956 if (!modalTabOpen) { 13957 setLibraryFontSelected(null); 13958 } 13959 }, [modalTabOpen]); 13960 const handleSetLibraryFontSelected = font => { 13961 // If font is null, reset the selected font 13962 if (!font) { 13963 setLibraryFontSelected(null); 13964 return; 13965 } 13966 const fonts = font.source === 'theme' ? themeFonts : baseCustomFonts; 13967 13968 // Tries to find the font in the installed fonts 13969 const fontSelected = fonts.find(f => f.slug === font.slug); 13970 // If the font is not found (it is only defined in custom styles), use the font from custom styles 13971 setLibraryFontSelected({ 13972 ...(fontSelected || font), 13973 source: font.source 13974 }); 13975 }; 13976 13977 // Demo 13978 const [loadedFontUrls] = (0,external_wp_element_namespaceObject.useState)(new Set()); 13979 const getAvailableFontsOutline = availableFontFamilies => { 13980 const outline = availableFontFamilies.reduce((acc, font) => { 13981 const availableFontFaces = font?.fontFace && font.fontFace?.length > 0 ? font?.fontFace.map(face => `$face.fontStyle + face.fontWeight}`) : ['normal400']; // If the font doesn't have fontFace, we assume it is a system font and we add the defaults: normal 400 13982 13983 acc[font.slug] = availableFontFaces; 13984 return acc; 13985 }, {}); 13986 return outline; 13987 }; 13988 const getActivatedFontsOutline = source => { 13989 switch (source) { 13990 case 'theme': 13991 return getAvailableFontsOutline(themeFonts); 13992 case 'custom': 13993 default: 13994 return getAvailableFontsOutline(customFonts); 13995 } 13996 }; 13997 const isFontActivated = (slug, style, weight, source) => { 13998 if (!style && !weight) { 13999 return !!getActivatedFontsOutline(source)[slug]; 14000 } 14001 return !!getActivatedFontsOutline(source)[slug]?.includes(style + weight); 14002 }; 14003 const getFontFacesActivated = (slug, source) => { 14004 return getActivatedFontsOutline(source)[slug] || []; 14005 }; 14006 async function installFonts(fontFamiliesToInstall) { 14007 setIsInstalling(true); 14008 try { 14009 const fontFamiliesToActivate = []; 14010 let installationErrors = []; 14011 for (const fontFamilyToInstall of fontFamiliesToInstall) { 14012 let isANewFontFamily = false; 14013 14014 // Get the font family if it already exists. 14015 let installedFontFamily = await fetchGetFontFamilyBySlug(fontFamilyToInstall.slug); 14016 14017 // Otherwise create it. 14018 if (!installedFontFamily) { 14019 isANewFontFamily = true; 14020 // Prepare font family form data to install. 14021 installedFontFamily = await fetchInstallFontFamily(makeFontFamilyFormData(fontFamilyToInstall)); 14022 } 14023 14024 // Collect font faces that have already been installed (to be activated later) 14025 const alreadyInstalledFontFaces = installedFontFamily.fontFace && fontFamilyToInstall.fontFace ? installedFontFamily.fontFace.filter(fontFaceToInstall => checkFontFaceInstalled(fontFaceToInstall, fontFamilyToInstall.fontFace)) : []; 14026 14027 // Filter out Font Faces that have already been installed (so that they are not re-installed) 14028 if (installedFontFamily.fontFace && fontFamilyToInstall.fontFace) { 14029 fontFamilyToInstall.fontFace = fontFamilyToInstall.fontFace.filter(fontFaceToInstall => !checkFontFaceInstalled(fontFaceToInstall, installedFontFamily.fontFace)); 14030 } 14031 14032 // Install the fonts (upload the font files to the server and create the post in the database). 14033 let successfullyInstalledFontFaces = []; 14034 let unsuccessfullyInstalledFontFaces = []; 14035 if (fontFamilyToInstall?.fontFace?.length > 0) { 14036 const response = await batchInstallFontFaces(installedFontFamily.id, makeFontFacesFormData(fontFamilyToInstall)); 14037 successfullyInstalledFontFaces = response?.successes; 14038 unsuccessfullyInstalledFontFaces = response?.errors; 14039 } 14040 14041 // Use the successfully installed font faces 14042 // As well as any font faces that were already installed (those will be activated) 14043 if (successfullyInstalledFontFaces?.length > 0 || alreadyInstalledFontFaces?.length > 0) { 14044 // Use font data from REST API not from client to ensure 14045 // correct font information is used. 14046 installedFontFamily.fontFace = [...successfullyInstalledFontFaces]; 14047 fontFamiliesToActivate.push(installedFontFamily); 14048 } 14049 14050 // If it's a system font but was installed successfully, activate it. 14051 if (installedFontFamily && !fontFamilyToInstall?.fontFace?.length) { 14052 fontFamiliesToActivate.push(installedFontFamily); 14053 } 14054 14055 // If the font family is new and is not a system font, delete it to avoid having font families without font faces. 14056 if (isANewFontFamily && fontFamilyToInstall?.fontFace?.length > 0 && successfullyInstalledFontFaces?.length === 0) { 14057 await fetchUninstallFontFamily(installedFontFamily.id); 14058 } 14059 installationErrors = installationErrors.concat(unsuccessfullyInstalledFontFaces); 14060 } 14061 installationErrors = installationErrors.reduce((unique, item) => unique.includes(item.message) ? unique : [...unique, item.message], []); 14062 if (fontFamiliesToActivate.length > 0) { 14063 // Activate the font family (add the font family to the global styles). 14064 const activeFonts = activateCustomFontFamilies(fontFamiliesToActivate); 14065 // Save the global styles to the database. 14066 await saveFontFamilies(activeFonts); 14067 refreshLibrary(); 14068 } 14069 if (installationErrors.length > 0) { 14070 const installError = new Error((0,external_wp_i18n_namespaceObject.__)('There was an error installing fonts.')); 14071 installError.installationErrors = installationErrors; 14072 throw installError; 14073 } 14074 } finally { 14075 setIsInstalling(false); 14076 } 14077 } 14078 async function uninstallFontFamily(fontFamilyToUninstall) { 14079 try { 14080 // Uninstall the font family. 14081 // (Removes the font files from the server and the posts from the database). 14082 const uninstalledFontFamily = await fetchUninstallFontFamily(fontFamilyToUninstall.id); 14083 14084 // Deactivate the font family if delete request is successful 14085 // (Removes the font family from the global styles). 14086 if (uninstalledFontFamily.deleted) { 14087 const activeFonts = deactivateFontFamily(fontFamilyToUninstall); 14088 // Save the global styles to the database. 14089 await saveFontFamilies(activeFonts); 14090 } 14091 14092 // Refresh the library (the library font families from database). 14093 refreshLibrary(); 14094 return uninstalledFontFamily; 14095 } catch (error) { 14096 // eslint-disable-next-line no-console 14097 console.error(`There was an error uninstalling the font family:`, error); 14098 throw error; 14099 } 14100 } 14101 const deactivateFontFamily = font => { 14102 var _fontFamilies$font$so; 14103 // If the user doesn't have custom fonts defined, include as custom fonts all the theme fonts 14104 // We want to save as active all the theme fonts at the beginning 14105 const initialCustomFonts = (_fontFamilies$font$so = fontFamilies?.[font.source]) !== null && _fontFamilies$font$so !== void 0 ? _fontFamilies$font$so : []; 14106 const newCustomFonts = initialCustomFonts.filter(f => f.slug !== font.slug); 14107 const activeFonts = { 14108 ...fontFamilies, 14109 [font.source]: newCustomFonts 14110 }; 14111 setFontFamilies(activeFonts); 14112 if (font.fontFace) { 14113 font.fontFace.forEach(face => { 14114 unloadFontFaceInBrowser(face, 'all'); 14115 }); 14116 } 14117 return activeFonts; 14118 }; 14119 const activateCustomFontFamilies = fontsToAdd => { 14120 const fontsToActivate = cleanFontsForSave(fontsToAdd); 14121 const activeFonts = { 14122 ...fontFamilies, 14123 // Merge the existing custom fonts with the new fonts. 14124 custom: mergeFontFamilies(fontFamilies?.custom, fontsToActivate) 14125 }; 14126 14127 // Activate the fonts by set the new custom fonts array. 14128 setFontFamilies(activeFonts); 14129 loadFontsInBrowser(fontsToActivate); 14130 return activeFonts; 14131 }; 14132 14133 // Removes the id from the families and faces to avoid saving that to global styles post content. 14134 const cleanFontsForSave = fonts => { 14135 return fonts.map(({ 14136 id: _familyDbId, 14137 fontFace, 14138 ...font 14139 }) => ({ 14140 ...font, 14141 ...(fontFace && fontFace.length > 0 ? { 14142 fontFace: fontFace.map(({ 14143 id: _faceDbId, 14144 ...face 14145 }) => face) 14146 } : {}) 14147 })); 14148 }; 14149 const loadFontsInBrowser = fonts => { 14150 // Add custom fonts to the browser. 14151 fonts.forEach(font => { 14152 if (font.fontFace) { 14153 font.fontFace.forEach(face => { 14154 // Load font faces just in the iframe because they already are in the document. 14155 loadFontFaceInBrowser(face, getDisplaySrcFromFontFace(face.src), 'all'); 14156 }); 14157 } 14158 }); 14159 }; 14160 const toggleActivateFont = (font, face) => { 14161 var _fontFamilies$font$so2; 14162 // If the user doesn't have custom fonts defined, include as custom fonts all the theme fonts 14163 // We want to save as active all the theme fonts at the beginning 14164 const initialFonts = (_fontFamilies$font$so2 = fontFamilies?.[font.source]) !== null && _fontFamilies$font$so2 !== void 0 ? _fontFamilies$font$so2 : []; 14165 // Toggles the received font family or font face 14166 const newFonts = toggleFont(font, face, initialFonts); 14167 // Updates the font families activated in global settings: 14168 setFontFamilies({ 14169 ...fontFamilies, 14170 [font.source]: newFonts 14171 }); 14172 const isFaceActivated = isFontActivated(font.slug, face?.fontStyle, face?.fontWeight, font.source); 14173 if (isFaceActivated) { 14174 unloadFontFaceInBrowser(face, 'all'); 14175 } else { 14176 loadFontFaceInBrowser(face, getDisplaySrcFromFontFace(face?.src), 'all'); 14177 } 14178 }; 14179 const loadFontFaceAsset = async fontFace => { 14180 // If the font doesn't have a src, don't load it. 14181 if (!fontFace.src) { 14182 return; 14183 } 14184 // Get the src of the font. 14185 const src = getDisplaySrcFromFontFace(fontFace.src); 14186 // If the font is already loaded, don't load it again. 14187 if (!src || loadedFontUrls.has(src)) { 14188 return; 14189 } 14190 // Load the font in the browser. 14191 loadFontFaceInBrowser(fontFace, src, 'document'); 14192 // Add the font to the loaded fonts list. 14193 loadedFontUrls.add(src); 14194 }; 14195 14196 // Font Collections 14197 const [collections, setFontCollections] = (0,external_wp_element_namespaceObject.useState)([]); 14198 const getFontCollections = async () => { 14199 const response = await fetchFontCollections(); 14200 setFontCollections(response); 14201 }; 14202 const getFontCollection = async slug => { 14203 try { 14204 const hasData = !!collections.find(collection => collection.slug === slug)?.font_families; 14205 if (hasData) { 14206 return; 14207 } 14208 const response = await fetchFontCollection(slug); 14209 const updatedCollections = collections.map(collection => collection.slug === slug ? { 14210 ...collection, 14211 ...response 14212 } : collection); 14213 setFontCollections(updatedCollections); 14214 } catch (e) { 14215 // eslint-disable-next-line no-console 14216 console.error(e); 14217 throw e; 14218 } 14219 }; 14220 (0,external_wp_element_namespaceObject.useEffect)(() => { 14221 getFontCollections(); 14222 }, []); 14223 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FontLibraryContext.Provider, { 14224 value: { 14225 libraryFontSelected, 14226 handleSetLibraryFontSelected, 14227 fontFamilies, 14228 baseCustomFonts, 14229 isFontActivated, 14230 getFontFacesActivated, 14231 loadFontFaceAsset, 14232 installFonts, 14233 uninstallFontFamily, 14234 toggleActivateFont, 14235 getAvailableFontsOutline, 14236 modalTabOpen, 14237 setModalTabOpen, 14238 refreshLibrary, 14239 saveFontFamilies, 14240 isResolvingLibrary, 14241 isInstalling, 14242 collections, 14243 getFontCollection 14244 }, 14245 children: children 14246 }); 14247 } 14248 /* harmony default export */ const context = (FontLibraryProvider); 14249 14250 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/font-demo.js 14251 /** 14252 * WordPress dependencies 14253 */ 14254 14255 14256 14257 /** 14258 * Internal dependencies 14259 */ 14260 14261 14262 14263 function getPreviewUrl(fontFace) { 14264 if (fontFace.preview) { 14265 return fontFace.preview; 14266 } 14267 if (fontFace.src) { 14268 return Array.isArray(fontFace.src) ? fontFace.src[0] : fontFace.src; 14269 } 14270 } 14271 function getDisplayFontFace(font) { 14272 // if this IS a font face return it 14273 if (font.fontStyle || font.fontWeight) { 14274 return font; 14275 } 14276 // if this is a font family with a collection of font faces 14277 // return the first one that is normal and 400 OR just the first one 14278 if (font.fontFace && font.fontFace.length) { 14279 return font.fontFace.find(face => face.fontStyle === 'normal' && face.fontWeight === '400') || font.fontFace[0]; 14280 } 14281 // This must be a font family with no font faces 14282 // return a fake font face 14283 return { 14284 fontStyle: 'normal', 14285 fontWeight: '400', 14286 fontFamily: font.fontFamily, 14287 fake: true 14288 }; 14289 } 14290 function FontDemo({ 14291 font, 14292 text 14293 }) { 14294 const ref = (0,external_wp_element_namespaceObject.useRef)(null); 14295 const fontFace = getDisplayFontFace(font); 14296 const style = getFamilyPreviewStyle(font); 14297 text = text || font.name; 14298 const customPreviewUrl = font.preview; 14299 const [isIntersecting, setIsIntersecting] = (0,external_wp_element_namespaceObject.useState)(false); 14300 const [isAssetLoaded, setIsAssetLoaded] = (0,external_wp_element_namespaceObject.useState)(false); 14301 const { 14302 loadFontFaceAsset 14303 } = (0,external_wp_element_namespaceObject.useContext)(FontLibraryContext); 14304 const previewUrl = customPreviewUrl !== null && customPreviewUrl !== void 0 ? customPreviewUrl : getPreviewUrl(fontFace); 14305 const isPreviewImage = previewUrl && previewUrl.match(/\.(png|jpg|jpeg|gif|svg)$/i); 14306 const faceStyles = getFacePreviewStyle(fontFace); 14307 const textDemoStyle = { 14308 fontSize: '18px', 14309 lineHeight: 1, 14310 opacity: isAssetLoaded ? '1' : '0', 14311 ...style, 14312 ...faceStyles 14313 }; 14314 (0,external_wp_element_namespaceObject.useEffect)(() => { 14315 const observer = new window.IntersectionObserver(([entry]) => { 14316 setIsIntersecting(entry.isIntersecting); 14317 }, {}); 14318 observer.observe(ref.current); 14319 return () => observer.disconnect(); 14320 }, [ref]); 14321 (0,external_wp_element_namespaceObject.useEffect)(() => { 14322 const loadAsset = async () => { 14323 if (isIntersecting) { 14324 if (!isPreviewImage && fontFace.src) { 14325 await loadFontFaceAsset(fontFace); 14326 } 14327 setIsAssetLoaded(true); 14328 } 14329 }; 14330 loadAsset(); 14331 }, [fontFace, isIntersecting, loadFontFaceAsset, isPreviewImage]); 14332 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 14333 ref: ref, 14334 children: isPreviewImage ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 14335 src: previewUrl, 14336 loading: "lazy", 14337 alt: text, 14338 className: "font-library-modal__font-variant_demo-image" 14339 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 14340 style: textDemoStyle, 14341 className: "font-library-modal__font-variant_demo-text", 14342 children: text 14343 }) 14344 }); 14345 } 14346 /* harmony default export */ const font_demo = (FontDemo); 14347 14348 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/font-card.js 14349 /** 14350 * WordPress dependencies 14351 */ 14352 14353 14354 14355 /** 14356 * Internal dependencies 14357 */ 14358 14359 14360 14361 function FontCard({ 14362 font, 14363 onClick, 14364 variantsText, 14365 navigatorPath 14366 }) { 14367 const variantsCount = font.fontFace?.length || 1; 14368 const style = { 14369 cursor: !!onClick ? 'pointer' : 'default' 14370 }; 14371 const navigator = (0,external_wp_components_namespaceObject.useNavigator)(); 14372 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 14373 __next40pxDefaultSize: true, 14374 onClick: () => { 14375 onClick(); 14376 if (navigatorPath) { 14377 navigator.goTo(navigatorPath); 14378 } 14379 }, 14380 style: style, 14381 className: "font-library-modal__font-card", 14382 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 14383 justify: "space-between", 14384 wrap: false, 14385 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_demo, { 14386 font: font 14387 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 14388 justify: "flex-end", 14389 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 14390 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 14391 className: "font-library-modal__font-card__count", 14392 children: variantsText || (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %d: Number of font variants. */ 14393 (0,external_wp_i18n_namespaceObject._n)('%d variant', '%d variants', variantsCount), variantsCount) 14394 }) 14395 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 14396 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 14397 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right 14398 }) 14399 })] 14400 })] 14401 }) 14402 }); 14403 } 14404 /* harmony default export */ const font_card = (FontCard); 14405 14406 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/library-font-variant.js 14407 /** 14408 * WordPress dependencies 14409 */ 14410 14411 14412 14413 /** 14414 * Internal dependencies 14415 */ 14416 14417 14418 14419 14420 function LibraryFontVariant({ 14421 face, 14422 font 14423 }) { 14424 const { 14425 isFontActivated, 14426 toggleActivateFont 14427 } = (0,external_wp_element_namespaceObject.useContext)(FontLibraryContext); 14428 const isInstalled = font?.fontFace?.length > 0 ? isFontActivated(font.slug, face.fontStyle, face.fontWeight, font.source) : isFontActivated(font.slug, null, null, font.source); 14429 const handleToggleActivation = () => { 14430 if (font?.fontFace?.length > 0) { 14431 toggleActivateFont(font, face); 14432 return; 14433 } 14434 toggleActivateFont(font); 14435 }; 14436 const displayName = font.name + ' ' + getFontFaceVariantName(face); 14437 const checkboxId = (0,external_wp_element_namespaceObject.useId)(); 14438 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 14439 className: "font-library-modal__font-card", 14440 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 14441 justify: "flex-start", 14442 align: "center", 14443 gap: "1rem", 14444 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { 14445 checked: isInstalled, 14446 onChange: handleToggleActivation, 14447 __nextHasNoMarginBottom: true, 14448 id: checkboxId 14449 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("label", { 14450 htmlFor: checkboxId, 14451 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_demo, { 14452 font: face, 14453 text: displayName, 14454 onClick: handleToggleActivation 14455 }) 14456 })] 14457 }) 14458 }); 14459 } 14460 /* harmony default export */ const library_font_variant = (LibraryFontVariant); 14461 14462 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/sort-font-faces.js 14463 function getNumericFontWeight(value) { 14464 switch (value) { 14465 case 'normal': 14466 return 400; 14467 case 'bold': 14468 return 700; 14469 case 'bolder': 14470 return 500; 14471 case 'lighter': 14472 return 300; 14473 default: 14474 return parseInt(value, 10); 14475 } 14476 } 14477 function sortFontFaces(faces) { 14478 return faces.sort((a, b) => { 14479 // Ensure 'normal' fontStyle is always first 14480 if (a.fontStyle === 'normal' && b.fontStyle !== 'normal') { 14481 return -1; 14482 } 14483 if (b.fontStyle === 'normal' && a.fontStyle !== 'normal') { 14484 return 1; 14485 } 14486 14487 // If both fontStyles are the same, sort by fontWeight 14488 if (a.fontStyle === b.fontStyle) { 14489 return getNumericFontWeight(a.fontWeight) - getNumericFontWeight(b.fontWeight); 14490 } 14491 14492 // Sort other fontStyles alphabetically 14493 return a.fontStyle.localeCompare(b.fontStyle); 14494 }); 14495 } 14496 14497 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/installed-fonts.js 14498 /** 14499 * WordPress dependencies 14500 */ 14501 14502 14503 14504 14505 14506 14507 14508 14509 /** 14510 * Internal dependencies 14511 */ 14512 14513 14514 14515 14516 14517 14518 14519 const { 14520 useGlobalSetting: installed_fonts_useGlobalSetting 14521 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 14522 function InstalledFonts() { 14523 var _libraryFontSelected$; 14524 const { 14525 baseCustomFonts, 14526 libraryFontSelected, 14527 handleSetLibraryFontSelected, 14528 refreshLibrary, 14529 uninstallFontFamily, 14530 isResolvingLibrary, 14531 isInstalling, 14532 saveFontFamilies, 14533 getFontFacesActivated 14534 } = (0,external_wp_element_namespaceObject.useContext)(FontLibraryContext); 14535 const [fontFamilies, setFontFamilies] = installed_fonts_useGlobalSetting('typography.fontFamilies'); 14536 const [isConfirmDeleteOpen, setIsConfirmDeleteOpen] = (0,external_wp_element_namespaceObject.useState)(false); 14537 const [notice, setNotice] = (0,external_wp_element_namespaceObject.useState)(false); 14538 const [baseFontFamilies] = installed_fonts_useGlobalSetting('typography.fontFamilies', undefined, 'base'); 14539 const globalStylesId = (0,external_wp_data_namespaceObject.useSelect)(select => { 14540 const { 14541 __experimentalGetCurrentGlobalStylesId 14542 } = select(external_wp_coreData_namespaceObject.store); 14543 return __experimentalGetCurrentGlobalStylesId(); 14544 }); 14545 const globalStyles = (0,external_wp_coreData_namespaceObject.useEntityRecord)('root', 'globalStyles', globalStylesId); 14546 const fontFamiliesHasChanges = !!globalStyles?.edits?.settings?.typography?.fontFamilies; 14547 const themeFonts = fontFamilies?.theme ? fontFamilies.theme.map(f => setUIValuesNeeded(f, { 14548 source: 'theme' 14549 })).sort((a, b) => a.name.localeCompare(b.name)) : []; 14550 const themeFontsSlugs = new Set(themeFonts.map(f => f.slug)); 14551 const baseThemeFonts = baseFontFamilies?.theme ? themeFonts.concat(baseFontFamilies.theme.filter(f => !themeFontsSlugs.has(f.slug)).map(f => setUIValuesNeeded(f, { 14552 source: 'theme' 14553 })).sort((a, b) => a.name.localeCompare(b.name))) : []; 14554 const customFontFamilyId = libraryFontSelected?.source === 'custom' && libraryFontSelected?.id; 14555 const canUserDelete = (0,external_wp_data_namespaceObject.useSelect)(select => { 14556 const { 14557 canUser 14558 } = select(external_wp_coreData_namespaceObject.store); 14559 return customFontFamilyId && canUser('delete', { 14560 kind: 'postType', 14561 name: 'wp_font_family', 14562 id: customFontFamilyId 14563 }); 14564 }, [customFontFamilyId]); 14565 const shouldDisplayDeleteButton = !!libraryFontSelected && libraryFontSelected?.source !== 'theme' && canUserDelete; 14566 const handleUninstallClick = () => { 14567 setIsConfirmDeleteOpen(true); 14568 }; 14569 const handleUpdate = async () => { 14570 setNotice(null); 14571 try { 14572 await saveFontFamilies(fontFamilies); 14573 setNotice({ 14574 type: 'success', 14575 message: (0,external_wp_i18n_namespaceObject.__)('Font family updated successfully.') 14576 }); 14577 } catch (error) { 14578 setNotice({ 14579 type: 'error', 14580 message: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: error message */ 14581 (0,external_wp_i18n_namespaceObject.__)('There was an error updating the font family. %s'), error.message) 14582 }); 14583 } 14584 }; 14585 const getFontFacesToDisplay = font => { 14586 if (!font) { 14587 return []; 14588 } 14589 if (!font.fontFace || !font.fontFace.length) { 14590 return [{ 14591 fontFamily: font.fontFamily, 14592 fontStyle: 'normal', 14593 fontWeight: '400' 14594 }]; 14595 } 14596 return sortFontFaces(font.fontFace); 14597 }; 14598 const getFontCardVariantsText = font => { 14599 const variantsInstalled = font?.fontFace?.length > 0 ? font.fontFace.length : 1; 14600 const variantsActive = getFontFacesActivated(font.slug, font.source).length; 14601 return (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: Active font variants, 2: Total font variants. */ 14602 (0,external_wp_i18n_namespaceObject.__)('%1$s/%2$s variants active'), variantsActive, variantsInstalled); 14603 }; 14604 (0,external_wp_element_namespaceObject.useEffect)(() => { 14605 handleSetLibraryFontSelected(libraryFontSelected); 14606 refreshLibrary(); 14607 }, []); 14608 14609 // Get activated fonts count. 14610 const activeFontsCount = libraryFontSelected ? getFontFacesActivated(libraryFontSelected.slug, libraryFontSelected.source).length : 0; 14611 const selectedFontsCount = (_libraryFontSelected$ = libraryFontSelected?.fontFace?.length) !== null && _libraryFontSelected$ !== void 0 ? _libraryFontSelected$ : libraryFontSelected?.fontFamily ? 1 : 0; 14612 14613 // Check if any fonts are selected. 14614 const isIndeterminate = activeFontsCount > 0 && activeFontsCount !== selectedFontsCount; 14615 14616 // Check if all fonts are selected. 14617 const isSelectAllChecked = activeFontsCount === selectedFontsCount; 14618 14619 // Toggle select all fonts. 14620 const toggleSelectAll = () => { 14621 var _fontFamilies$library; 14622 const initialFonts = (_fontFamilies$library = fontFamilies?.[libraryFontSelected.source]?.filter(f => f.slug !== libraryFontSelected.slug)) !== null && _fontFamilies$library !== void 0 ? _fontFamilies$library : []; 14623 const newFonts = isSelectAllChecked ? initialFonts : [...initialFonts, libraryFontSelected]; 14624 setFontFamilies({ 14625 ...fontFamilies, 14626 [libraryFontSelected.source]: newFonts 14627 }); 14628 if (libraryFontSelected.fontFace) { 14629 libraryFontSelected.fontFace.forEach(face => { 14630 if (isSelectAllChecked) { 14631 unloadFontFaceInBrowser(face, 'all'); 14632 } else { 14633 loadFontFaceInBrowser(face, getDisplaySrcFromFontFace(face?.src), 'all'); 14634 } 14635 }); 14636 } 14637 }; 14638 const hasFonts = baseThemeFonts.length > 0 || baseCustomFonts.length > 0; 14639 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 14640 className: "font-library-modal__tabpanel-layout", 14641 children: [isResolvingLibrary && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 14642 className: "font-library-modal__loading", 14643 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ProgressBar, {}) 14644 }), !isResolvingLibrary && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 14645 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Navigator, { 14646 initialPath: libraryFontSelected ? '/fontFamily' : '/', 14647 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Navigator.Screen, { 14648 path: "/", 14649 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 14650 spacing: "8", 14651 children: [notice && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { 14652 status: notice.type, 14653 onRemove: () => setNotice(null), 14654 children: notice.message 14655 }), !hasFonts && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 14656 as: "p", 14657 children: (0,external_wp_i18n_namespaceObject.__)('No fonts installed.') 14658 }), baseThemeFonts.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 14659 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { 14660 className: "font-library-modal__fonts-title", 14661 children: /* translators: Heading for a list of fonts provided by the theme. */ 14662 (0,external_wp_i18n_namespaceObject._x)('Theme', 'font source') 14663 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { 14664 role: "list", 14665 className: "font-library-modal__fonts-list", 14666 children: baseThemeFonts.map(font => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { 14667 className: "font-library-modal__fonts-list-item", 14668 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_card, { 14669 font: font, 14670 navigatorPath: "/fontFamily", 14671 variantsText: getFontCardVariantsText(font), 14672 onClick: () => { 14673 setNotice(null); 14674 handleSetLibraryFontSelected(font); 14675 } 14676 }) 14677 }, font.slug)) 14678 })] 14679 }), baseCustomFonts.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 14680 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { 14681 className: "font-library-modal__fonts-title", 14682 children: /* translators: Heading for a list of fonts installed by the user. */ 14683 (0,external_wp_i18n_namespaceObject._x)('Custom', 'font source') 14684 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { 14685 role: "list", 14686 className: "font-library-modal__fonts-list", 14687 children: baseCustomFonts.map(font => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { 14688 className: "font-library-modal__fonts-list-item", 14689 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_card, { 14690 font: font, 14691 navigatorPath: "/fontFamily", 14692 variantsText: getFontCardVariantsText(font), 14693 onClick: () => { 14694 setNotice(null); 14695 handleSetLibraryFontSelected(font); 14696 } 14697 }) 14698 }, font.slug)) 14699 })] 14700 })] 14701 }) 14702 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Navigator.Screen, { 14703 path: "/fontFamily", 14704 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ConfirmDeleteDialog, { 14705 font: libraryFontSelected, 14706 isOpen: isConfirmDeleteOpen, 14707 setIsOpen: setIsConfirmDeleteOpen, 14708 setNotice: setNotice, 14709 uninstallFontFamily: uninstallFontFamily, 14710 handleSetLibraryFontSelected: handleSetLibraryFontSelected 14711 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 14712 justify: "flex-start", 14713 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Navigator.BackButton, { 14714 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left, 14715 size: "small", 14716 onClick: () => { 14717 handleSetLibraryFontSelected(null); 14718 setNotice(null); 14719 }, 14720 label: (0,external_wp_i18n_namespaceObject.__)('Back') 14721 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 14722 level: 2, 14723 size: 13, 14724 className: "edit-site-global-styles-header", 14725 children: libraryFontSelected?.name 14726 })] 14727 }), notice && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 14728 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 14729 margin: 1 14730 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { 14731 status: notice.type, 14732 onRemove: () => setNotice(null), 14733 children: notice.message 14734 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 14735 margin: 1 14736 })] 14737 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 14738 margin: 4 14739 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 14740 children: (0,external_wp_i18n_namespaceObject.__)('Choose font variants. Keep in mind that too many variants could make your site slower.') 14741 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 14742 margin: 4 14743 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 14744 spacing: 0, 14745 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { 14746 className: "font-library-modal__select-all", 14747 label: (0,external_wp_i18n_namespaceObject.__)('Select all'), 14748 checked: isSelectAllChecked, 14749 onChange: toggleSelectAll, 14750 indeterminate: isIndeterminate, 14751 __nextHasNoMarginBottom: true 14752 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 14753 margin: 8 14754 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { 14755 role: "list", 14756 className: "font-library-modal__fonts-list", 14757 children: getFontFacesToDisplay(libraryFontSelected).map((face, i) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { 14758 className: "font-library-modal__fonts-list-item", 14759 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(library_font_variant, { 14760 font: libraryFontSelected, 14761 face: face 14762 }, `face$i}`) 14763 }, `face$i}`)) 14764 })] 14765 })] 14766 })] 14767 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 14768 justify: "flex-end", 14769 className: "font-library-modal__footer", 14770 children: [isInstalling && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ProgressBar, {}), shouldDisplayDeleteButton && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 14771 __next40pxDefaultSize: true, 14772 isDestructive: true, 14773 variant: "tertiary", 14774 onClick: handleUninstallClick, 14775 children: (0,external_wp_i18n_namespaceObject.__)('Delete') 14776 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 14777 __next40pxDefaultSize: true, 14778 variant: "primary", 14779 onClick: handleUpdate, 14780 disabled: !fontFamiliesHasChanges, 14781 accessibleWhenDisabled: true, 14782 children: (0,external_wp_i18n_namespaceObject.__)('Update') 14783 })] 14784 })] 14785 })] 14786 }); 14787 } 14788 function ConfirmDeleteDialog({ 14789 font, 14790 isOpen, 14791 setIsOpen, 14792 setNotice, 14793 uninstallFontFamily, 14794 handleSetLibraryFontSelected 14795 }) { 14796 const navigator = (0,external_wp_components_namespaceObject.useNavigator)(); 14797 const handleConfirmUninstall = async () => { 14798 setNotice(null); 14799 setIsOpen(false); 14800 try { 14801 await uninstallFontFamily(font); 14802 navigator.goBack(); 14803 handleSetLibraryFontSelected(null); 14804 setNotice({ 14805 type: 'success', 14806 message: (0,external_wp_i18n_namespaceObject.__)('Font family uninstalled successfully.') 14807 }); 14808 } catch (error) { 14809 setNotice({ 14810 type: 'error', 14811 message: (0,external_wp_i18n_namespaceObject.__)('There was an error uninstalling the font family.') + error.message 14812 }); 14813 } 14814 }; 14815 const handleCancelUninstall = () => { 14816 setIsOpen(false); 14817 }; 14818 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { 14819 isOpen: isOpen, 14820 cancelButtonText: (0,external_wp_i18n_namespaceObject.__)('Cancel'), 14821 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Delete'), 14822 onCancel: handleCancelUninstall, 14823 onConfirm: handleConfirmUninstall, 14824 size: "medium", 14825 children: font && (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: Name of the font. */ 14826 (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to delete "%s" font and all its variants and assets?'), font.name) 14827 }); 14828 } 14829 /* harmony default export */ const installed_fonts = (InstalledFonts); 14830 14831 ;// ./node_modules/@wordpress/icons/build-module/library/next.js 14832 /** 14833 * WordPress dependencies 14834 */ 14835 14836 14837 const next = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 14838 xmlns: "http://www.w3.org/2000/svg", 14839 viewBox: "0 0 24 24", 14840 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 14841 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" 14842 }) 14843 }); 14844 /* harmony default export */ const library_next = (next); 14845 14846 ;// ./node_modules/@wordpress/icons/build-module/library/previous.js 14847 /** 14848 * WordPress dependencies 14849 */ 14850 14851 14852 const previous = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 14853 xmlns: "http://www.w3.org/2000/svg", 14854 viewBox: "0 0 24 24", 14855 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 14856 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" 14857 }) 14858 }); 14859 /* harmony default export */ const library_previous = (previous); 14860 14861 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/filter-fonts.js 14862 /** 14863 * Filters a list of fonts based on the specified filters. 14864 * 14865 * This function filters a given array of fonts based on the criteria provided in the filters object. 14866 * It supports filtering by category and a search term. If the category is provided and not equal to 'all', 14867 * the function filters the fonts array to include only those fonts that belong to the specified category. 14868 * Additionally, if a search term is provided, it filters the fonts array to include only those fonts 14869 * whose name includes the search term, case-insensitively. 14870 * 14871 * @param {Array} fonts Array of font objects in font-collection schema fashion to be filtered. Each font object should have a 'categories' property and a 'font_family_settings' property with a 'name' key. 14872 * @param {Object} filters Object containing the filter criteria. It should have a 'category' key and/or a 'search' key. 14873 * The 'category' key is a string representing the category to filter by. 14874 * The 'search' key is a string representing the search term to filter by. 14875 * @return {Array} Array of filtered font objects based on the provided criteria. 14876 */ 14877 function filterFonts(fonts, filters) { 14878 const { 14879 category, 14880 search 14881 } = filters; 14882 let filteredFonts = fonts || []; 14883 if (category && category !== 'all') { 14884 filteredFonts = filteredFonts.filter(font => font.categories.indexOf(category) !== -1); 14885 } 14886 if (search) { 14887 filteredFonts = filteredFonts.filter(font => font.font_family_settings.name.toLowerCase().includes(search.toLowerCase())); 14888 } 14889 return filteredFonts; 14890 } 14891 14892 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/fonts-outline.js 14893 function getFontsOutline(fonts) { 14894 return fonts.reduce((acc, font) => ({ 14895 ...acc, 14896 [font.slug]: (font?.fontFace || []).reduce((faces, face) => ({ 14897 ...faces, 14898 [`$face.fontStyle}-$face.fontWeight}`]: true 14899 }), {}) 14900 }), {}); 14901 } 14902 function isFontFontFaceInOutline(slug, face, outline) { 14903 if (!face) { 14904 return !!outline[slug]; 14905 } 14906 return !!outline[slug]?.[`$face.fontStyle}-$face.fontWeight}`]; 14907 } 14908 14909 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js 14910 /** 14911 * WordPress dependencies 14912 */ 14913 14914 14915 14916 function GoogleFontsConfirmDialog() { 14917 const handleConfirm = () => { 14918 // eslint-disable-next-line no-undef 14919 window.localStorage.setItem('wp-font-library-google-fonts-permission', 'true'); 14920 window.dispatchEvent(new Event('storage')); 14921 }; 14922 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 14923 className: "font-library__google-fonts-confirm", 14924 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Card, { 14925 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.CardBody, { 14926 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 14927 level: 2, 14928 children: (0,external_wp_i18n_namespaceObject.__)('Connect to Google Fonts') 14929 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 14930 margin: 6 14931 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 14932 as: "p", 14933 children: (0,external_wp_i18n_namespaceObject.__)('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.') 14934 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 14935 margin: 3 14936 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 14937 as: "p", 14938 children: (0,external_wp_i18n_namespaceObject.__)('You can alternatively upload files directly on the Upload tab.') 14939 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 14940 margin: 6 14941 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 14942 __next40pxDefaultSize: true, 14943 variant: "primary", 14944 onClick: handleConfirm, 14945 children: (0,external_wp_i18n_namespaceObject.__)('Allow access to Google Fonts') 14946 })] 14947 }) 14948 }) 14949 }); 14950 } 14951 /* harmony default export */ const google_fonts_confirm_dialog = (GoogleFontsConfirmDialog); 14952 14953 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/collection-font-variant.js 14954 /** 14955 * WordPress dependencies 14956 */ 14957 14958 14959 14960 /** 14961 * Internal dependencies 14962 */ 14963 14964 14965 14966 function CollectionFontVariant({ 14967 face, 14968 font, 14969 handleToggleVariant, 14970 selected 14971 }) { 14972 const handleToggleActivation = () => { 14973 if (font?.fontFace) { 14974 handleToggleVariant(font, face); 14975 return; 14976 } 14977 handleToggleVariant(font); 14978 }; 14979 const displayName = font.name + ' ' + getFontFaceVariantName(face); 14980 const checkboxId = (0,external_wp_element_namespaceObject.useId)(); 14981 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 14982 className: "font-library-modal__font-card", 14983 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 14984 justify: "flex-start", 14985 align: "center", 14986 gap: "1rem", 14987 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { 14988 checked: selected, 14989 onChange: handleToggleActivation, 14990 __nextHasNoMarginBottom: true, 14991 id: checkboxId 14992 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("label", { 14993 htmlFor: checkboxId, 14994 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_demo, { 14995 font: face, 14996 text: displayName, 14997 onClick: handleToggleActivation 14998 }) 14999 })] 15000 }) 15001 }); 15002 } 15003 /* harmony default export */ const collection_font_variant = (CollectionFontVariant); 15004 15005 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/font-collection.js 15006 /** 15007 * WordPress dependencies 15008 */ 15009 15010 15011 15012 15013 15014 15015 /** 15016 * Internal dependencies 15017 */ 15018 15019 15020 15021 15022 15023 15024 15025 15026 15027 15028 const DEFAULT_CATEGORY = { 15029 slug: 'all', 15030 name: (0,external_wp_i18n_namespaceObject._x)('All', 'font categories') 15031 }; 15032 const LOCAL_STORAGE_ITEM = 'wp-font-library-google-fonts-permission'; 15033 const MIN_WINDOW_HEIGHT = 500; 15034 function FontCollection({ 15035 slug 15036 }) { 15037 var _selectedCollection$c; 15038 const requiresPermission = slug === 'google-fonts'; 15039 const getGoogleFontsPermissionFromStorage = () => { 15040 return window.localStorage.getItem(LOCAL_STORAGE_ITEM) === 'true'; 15041 }; 15042 const [selectedFont, setSelectedFont] = (0,external_wp_element_namespaceObject.useState)(null); 15043 const [notice, setNotice] = (0,external_wp_element_namespaceObject.useState)(false); 15044 const [fontsToInstall, setFontsToInstall] = (0,external_wp_element_namespaceObject.useState)([]); 15045 const [page, setPage] = (0,external_wp_element_namespaceObject.useState)(1); 15046 const [filters, setFilters] = (0,external_wp_element_namespaceObject.useState)({}); 15047 const [renderConfirmDialog, setRenderConfirmDialog] = (0,external_wp_element_namespaceObject.useState)(requiresPermission && !getGoogleFontsPermissionFromStorage()); 15048 const { 15049 collections, 15050 getFontCollection, 15051 installFonts, 15052 isInstalling 15053 } = (0,external_wp_element_namespaceObject.useContext)(FontLibraryContext); 15054 const selectedCollection = collections.find(collection => collection.slug === slug); 15055 (0,external_wp_element_namespaceObject.useEffect)(() => { 15056 const handleStorage = () => { 15057 setRenderConfirmDialog(requiresPermission && !getGoogleFontsPermissionFromStorage()); 15058 }; 15059 handleStorage(); 15060 window.addEventListener('storage', handleStorage); 15061 return () => window.removeEventListener('storage', handleStorage); 15062 }, [slug, requiresPermission]); 15063 const revokeAccess = () => { 15064 window.localStorage.setItem(LOCAL_STORAGE_ITEM, 'false'); 15065 window.dispatchEvent(new Event('storage')); 15066 }; 15067 (0,external_wp_element_namespaceObject.useEffect)(() => { 15068 const fetchFontCollection = async () => { 15069 try { 15070 await getFontCollection(slug); 15071 resetFilters(); 15072 } catch (e) { 15073 if (!notice) { 15074 setNotice({ 15075 type: 'error', 15076 message: e?.message 15077 }); 15078 } 15079 } 15080 }; 15081 fetchFontCollection(); 15082 }, [slug, getFontCollection, setNotice, notice]); 15083 (0,external_wp_element_namespaceObject.useEffect)(() => { 15084 setSelectedFont(null); 15085 }, [slug]); 15086 (0,external_wp_element_namespaceObject.useEffect)(() => { 15087 // If the selected fonts change, reset the selected fonts to install 15088 setFontsToInstall([]); 15089 }, [selectedFont]); 15090 const collectionFonts = (0,external_wp_element_namespaceObject.useMemo)(() => { 15091 var _selectedCollection$f; 15092 return (_selectedCollection$f = selectedCollection?.font_families) !== null && _selectedCollection$f !== void 0 ? _selectedCollection$f : []; 15093 }, [selectedCollection]); 15094 const collectionCategories = (_selectedCollection$c = selectedCollection?.categories) !== null && _selectedCollection$c !== void 0 ? _selectedCollection$c : []; 15095 const categories = [DEFAULT_CATEGORY, ...collectionCategories]; 15096 const fonts = (0,external_wp_element_namespaceObject.useMemo)(() => filterFonts(collectionFonts, filters), [collectionFonts, filters]); 15097 const isLoading = !selectedCollection?.font_families && !notice; 15098 15099 // NOTE: The height of the font library modal unavailable to use for rendering font family items is roughly 417px 15100 // The height of each font family item is 61px. 15101 const windowHeight = Math.max(window.innerHeight, MIN_WINDOW_HEIGHT); 15102 const pageSize = Math.floor((windowHeight - 417) / 61); 15103 const totalPages = Math.ceil(fonts.length / pageSize); 15104 const itemsStart = (page - 1) * pageSize; 15105 const itemsLimit = page * pageSize; 15106 const items = fonts.slice(itemsStart, itemsLimit); 15107 const handleCategoryFilter = category => { 15108 setFilters({ 15109 ...filters, 15110 category 15111 }); 15112 setPage(1); 15113 }; 15114 const handleUpdateSearchInput = value => { 15115 setFilters({ 15116 ...filters, 15117 search: value 15118 }); 15119 setPage(1); 15120 }; 15121 const debouncedUpdateSearchInput = (0,external_wp_compose_namespaceObject.debounce)(handleUpdateSearchInput, 300); 15122 const resetFilters = () => { 15123 setFilters({}); 15124 setPage(1); 15125 }; 15126 const handleToggleVariant = (font, face) => { 15127 const newFontsToInstall = toggleFont(font, face, fontsToInstall); 15128 setFontsToInstall(newFontsToInstall); 15129 }; 15130 const fontToInstallOutline = getFontsOutline(fontsToInstall); 15131 const resetFontsToInstall = () => { 15132 setFontsToInstall([]); 15133 }; 15134 const selectFontCount = fontsToInstall.length > 0 ? fontsToInstall[0]?.fontFace?.length : 0; 15135 15136 // Check if any fonts are selected. 15137 const isIndeterminate = selectFontCount > 0 && selectFontCount !== selectedFont?.fontFace?.length; 15138 15139 // Check if all fonts are selected. 15140 const isSelectAllChecked = selectFontCount === selectedFont?.fontFace?.length; 15141 15142 // Toggle select all fonts. 15143 const toggleSelectAll = () => { 15144 const newFonts = isSelectAllChecked ? [] : [selectedFont]; 15145 setFontsToInstall(newFonts); 15146 }; 15147 const handleInstall = async () => { 15148 setNotice(null); 15149 const fontFamily = fontsToInstall[0]; 15150 try { 15151 if (fontFamily?.fontFace) { 15152 await Promise.all(fontFamily.fontFace.map(async fontFace => { 15153 if (fontFace.src) { 15154 fontFace.file = await downloadFontFaceAssets(fontFace.src); 15155 } 15156 })); 15157 } 15158 } catch (error) { 15159 // If any of the fonts fail to download, 15160 // show an error notice and stop the request from being sent. 15161 setNotice({ 15162 type: 'error', 15163 message: (0,external_wp_i18n_namespaceObject.__)('Error installing the fonts, could not be downloaded.') 15164 }); 15165 return; 15166 } 15167 try { 15168 await installFonts([fontFamily]); 15169 setNotice({ 15170 type: 'success', 15171 message: (0,external_wp_i18n_namespaceObject.__)('Fonts were installed successfully.') 15172 }); 15173 } catch (error) { 15174 setNotice({ 15175 type: 'error', 15176 message: error.message 15177 }); 15178 } 15179 resetFontsToInstall(); 15180 }; 15181 const getSortedFontFaces = fontFamily => { 15182 if (!fontFamily) { 15183 return []; 15184 } 15185 if (!fontFamily.fontFace || !fontFamily.fontFace.length) { 15186 return [{ 15187 fontFamily: fontFamily.fontFamily, 15188 fontStyle: 'normal', 15189 fontWeight: '400' 15190 }]; 15191 } 15192 return sortFontFaces(fontFamily.fontFace); 15193 }; 15194 if (renderConfirmDialog) { 15195 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(google_fonts_confirm_dialog, {}); 15196 } 15197 const ActionsComponent = () => { 15198 if (slug !== 'google-fonts' || renderConfirmDialog || selectedFont) { 15199 return null; 15200 } 15201 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { 15202 icon: more_vertical, 15203 label: (0,external_wp_i18n_namespaceObject.__)('Actions'), 15204 popoverProps: { 15205 position: 'bottom left' 15206 }, 15207 controls: [{ 15208 title: (0,external_wp_i18n_namespaceObject.__)('Revoke access to Google Fonts'), 15209 onClick: revokeAccess 15210 }] 15211 }); 15212 }; 15213 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 15214 className: "font-library-modal__tabpanel-layout", 15215 children: [isLoading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 15216 className: "font-library-modal__loading", 15217 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ProgressBar, {}) 15218 }), !isLoading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 15219 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Navigator, { 15220 initialPath: "/", 15221 className: "font-library-modal__tabpanel-layout", 15222 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Navigator.Screen, { 15223 path: "/", 15224 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 15225 justify: "space-between", 15226 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 15227 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 15228 level: 2, 15229 size: 13, 15230 children: selectedCollection.name 15231 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 15232 children: selectedCollection.description 15233 })] 15234 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionsComponent, {})] 15235 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 15236 margin: 4 15237 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 15238 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 15239 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SearchControl, { 15240 className: "font-library-modal__search", 15241 value: filters.search, 15242 placeholder: (0,external_wp_i18n_namespaceObject.__)('Font name…'), 15243 label: (0,external_wp_i18n_namespaceObject.__)('Search'), 15244 onChange: debouncedUpdateSearchInput, 15245 __nextHasNoMarginBottom: true, 15246 hideLabelFromVision: false 15247 }) 15248 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 15249 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { 15250 __nextHasNoMarginBottom: true, 15251 __next40pxDefaultSize: true, 15252 label: (0,external_wp_i18n_namespaceObject.__)('Category'), 15253 value: filters.category, 15254 onChange: handleCategoryFilter, 15255 children: categories && categories.map(category => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("option", { 15256 value: category.slug, 15257 children: category.name 15258 }, category.slug)) 15259 }) 15260 })] 15261 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 15262 margin: 4 15263 }), !!selectedCollection?.font_families?.length && !fonts.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 15264 children: (0,external_wp_i18n_namespaceObject.__)('No fonts found. Try with a different search term') 15265 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 15266 className: "font-library-modal__fonts-grid__main", 15267 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { 15268 role: "list", 15269 className: "font-library-modal__fonts-list", 15270 children: items.map(font => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { 15271 className: "font-library-modal__fonts-list-item", 15272 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_card, { 15273 font: font.font_family_settings, 15274 navigatorPath: "/fontFamily", 15275 onClick: () => { 15276 setSelectedFont(font.font_family_settings); 15277 } 15278 }) 15279 }, font.font_family_settings.slug)) 15280 }) 15281 })] 15282 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Navigator.Screen, { 15283 path: "/fontFamily", 15284 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 15285 justify: "flex-start", 15286 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Navigator.BackButton, { 15287 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left, 15288 size: "small", 15289 onClick: () => { 15290 setSelectedFont(null); 15291 setNotice(null); 15292 }, 15293 label: (0,external_wp_i18n_namespaceObject.__)('Back') 15294 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 15295 level: 2, 15296 size: 13, 15297 className: "edit-site-global-styles-header", 15298 children: selectedFont?.name 15299 })] 15300 }), notice && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 15301 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 15302 margin: 1 15303 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { 15304 status: notice.type, 15305 onRemove: () => setNotice(null), 15306 children: notice.message 15307 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 15308 margin: 1 15309 })] 15310 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 15311 margin: 4 15312 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 15313 children: (0,external_wp_i18n_namespaceObject.__)('Select font variants to install.') 15314 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 15315 margin: 4 15316 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { 15317 className: "font-library-modal__select-all", 15318 label: (0,external_wp_i18n_namespaceObject.__)('Select all'), 15319 checked: isSelectAllChecked, 15320 onChange: toggleSelectAll, 15321 indeterminate: isIndeterminate, 15322 __nextHasNoMarginBottom: true 15323 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 15324 spacing: 0, 15325 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { 15326 role: "list", 15327 className: "font-library-modal__fonts-list", 15328 children: getSortedFontFaces(selectedFont).map((face, i) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { 15329 className: "font-library-modal__fonts-list-item", 15330 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(collection_font_variant, { 15331 font: selectedFont, 15332 face: face, 15333 handleToggleVariant: handleToggleVariant, 15334 selected: isFontFontFaceInOutline(selectedFont.slug, selectedFont.fontFace ? face : null, 15335 // If the font has no fontFace, we want to check if the font is in the outline 15336 fontToInstallOutline) 15337 }) 15338 }, `face$i}`)) 15339 }) 15340 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 15341 margin: 16 15342 })] 15343 })] 15344 }), selectedFont && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { 15345 justify: "flex-end", 15346 className: "font-library-modal__footer", 15347 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 15348 __next40pxDefaultSize: true, 15349 variant: "primary", 15350 onClick: handleInstall, 15351 isBusy: isInstalling, 15352 disabled: fontsToInstall.length === 0 || isInstalling, 15353 accessibleWhenDisabled: true, 15354 children: (0,external_wp_i18n_namespaceObject.__)('Install') 15355 }) 15356 }), !selectedFont && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 15357 expanded: false, 15358 className: "font-library-modal__footer", 15359 justify: "end", 15360 spacing: 6, 15361 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 15362 justify: "flex-start", 15363 expanded: false, 15364 spacing: 1, 15365 className: "font-library-modal__page-selection", 15366 children: (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( 15367 // translators: 1: Current page number, 2: Total number of pages. 15368 (0,external_wp_i18n_namespaceObject._x)('<div>Page</div>%1$s<div>of %2$s</div>', 'paging'), '<CurrentPage />', totalPages), { 15369 div: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 15370 "aria-hidden": true 15371 }), 15372 CurrentPage: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { 15373 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Current page'), 15374 value: page, 15375 options: [...Array(totalPages)].map((e, i) => { 15376 return { 15377 label: i + 1, 15378 value: i + 1 15379 }; 15380 }), 15381 onChange: newPage => setPage(parseInt(newPage)), 15382 size: "small", 15383 __nextHasNoMarginBottom: true, 15384 variant: "minimal" 15385 }) 15386 }) 15387 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 15388 expanded: false, 15389 spacing: 1, 15390 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 15391 onClick: () => setPage(page - 1), 15392 disabled: page === 1, 15393 accessibleWhenDisabled: true, 15394 label: (0,external_wp_i18n_namespaceObject.__)('Previous page'), 15395 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? library_next : library_previous, 15396 showTooltip: true, 15397 size: "compact", 15398 tooltipPosition: "top" 15399 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 15400 onClick: () => setPage(page + 1), 15401 disabled: page === totalPages, 15402 accessibleWhenDisabled: true, 15403 label: (0,external_wp_i18n_namespaceObject.__)('Next page'), 15404 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? library_previous : library_next, 15405 showTooltip: true, 15406 size: "compact", 15407 tooltipPosition: "top" 15408 })] 15409 })] 15410 })] 15411 })] 15412 }); 15413 } 15414 /* harmony default export */ const font_collection = (FontCollection); 15415 15416 // EXTERNAL MODULE: ./node_modules/@wordpress/edit-site/lib/unbrotli.js 15417 var unbrotli = __webpack_require__(8572); 15418 var unbrotli_default = /*#__PURE__*/__webpack_require__.n(unbrotli); 15419 // EXTERNAL MODULE: ./node_modules/@wordpress/edit-site/lib/inflate.js 15420 var inflate = __webpack_require__(4660); 15421 var inflate_default = /*#__PURE__*/__webpack_require__.n(inflate); 15422 ;// ./node_modules/@wordpress/edit-site/lib/lib-font.browser.js 15423 /** 15424 * Credits: 15425 * 15426 * lib-font 15427 * https://github.com/Pomax/lib-font 15428 * https://github.com/Pomax/lib-font/blob/master/lib-font.browser.js 15429 * 15430 * The MIT License (MIT) 15431 * 15432 * Copyright (c) 2020 pomax@nihongoresources.com 15433 * 15434 * Permission is hereby granted, free of charge, to any person obtaining a copy 15435 * of this software and associated documentation files (the "Software"), to deal 15436 * in the Software without restriction, including without limitation the rights 15437 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15438 * copies of the Software, and to permit persons to whom the Software is 15439 * furnished to do so, subject to the following conditions: 15440 * 15441 * The above copyright notice and this permission notice shall be included in all 15442 * copies or substantial portions of the Software. 15443 * 15444 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15445 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15446 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 15447 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 15448 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 15449 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 15450 * SOFTWARE. 15451 */ 15452 15453 /* eslint eslint-comments/no-unlimited-disable: 0 */ 15454 /* eslint-disable */ 15455 // import pako from 'pako'; 15456 15457 15458 15459 let fetchFunction = globalThis.fetch; 15460 // if ( ! fetchFunction ) { 15461 // let backlog = []; 15462 // fetchFunction = globalThis.fetch = ( ...args ) => 15463 // new Promise( ( resolve, reject ) => { 15464 // backlog.push( { args: args, resolve: resolve, reject: reject } ); 15465 // } ); 15466 // import( 'fs' ) 15467 // .then( ( fs ) => { 15468 // fetchFunction = globalThis.fetch = async function ( path ) { 15469 // return new Promise( ( resolve, reject ) => { 15470 // fs.readFile( path, ( err, data ) => { 15471 // if ( err ) return reject( err ); 15472 // resolve( { ok: true, arrayBuffer: () => data.buffer } ); 15473 // } ); 15474 // } ); 15475 // }; 15476 // while ( backlog.length ) { 15477 // let instruction = backlog.shift(); 15478 // fetchFunction( ...instruction.args ) 15479 // .then( ( data ) => instruction.resolve( data ) ) 15480 // .catch( ( err ) => instruction.reject( err ) ); 15481 // } 15482 // } ) 15483 // .catch( ( err ) => { 15484 // console.error( err ); 15485 // throw new Error( 15486 // `lib-font cannot run unless either the Fetch API or Node's filesystem module is available.` 15487 // ); 15488 // } ); 15489 // } 15490 class lib_font_browser_Event { 15491 constructor( type, detail = {}, msg ) { 15492 this.type = type; 15493 this.detail = detail; 15494 this.msg = msg; 15495 Object.defineProperty( this, `__mayPropagate`, { 15496 enumerable: false, 15497 writable: true, 15498 } ); 15499 this.__mayPropagate = true; 15500 } 15501 preventDefault() {} 15502 stopPropagation() { 15503 this.__mayPropagate = false; 15504 } 15505 valueOf() { 15506 return this; 15507 } 15508 toString() { 15509 return this.msg 15510 ? `[${ this.type } event]: ${ this.msg }` 15511 : `[${ this.type } event]`; 15512 } 15513 } 15514 class EventManager { 15515 constructor() { 15516 this.listeners = {}; 15517 } 15518 addEventListener( type, listener, useCapture ) { 15519 let bin = this.listeners[ type ] || []; 15520 if ( useCapture ) bin.unshift( listener ); 15521 else bin.push( listener ); 15522 this.listeners[ type ] = bin; 15523 } 15524 removeEventListener( type, listener ) { 15525 let bin = this.listeners[ type ] || []; 15526 let pos = bin.findIndex( ( e ) => e === listener ); 15527 if ( pos > -1 ) { 15528 bin.splice( pos, 1 ); 15529 this.listeners[ type ] = bin; 15530 } 15531 } 15532 dispatch( event ) { 15533 let bin = this.listeners[ event.type ]; 15534 if ( bin ) { 15535 for ( let l = 0, e = bin.length; l < e; l++ ) { 15536 if ( ! event.__mayPropagate ) break; 15537 bin[ l ]( event ); 15538 } 15539 } 15540 } 15541 } 15542 const startDate = new Date( `1904-01-01T00:00:00+0000` ).getTime(); 15543 function asText( data ) { 15544 return Array.from( data ) 15545 .map( ( v ) => String.fromCharCode( v ) ) 15546 .join( `` ); 15547 } 15548 class Parser { 15549 constructor( dict, dataview, name ) { 15550 this.name = ( name || dict.tag || `` ).trim(); 15551 this.length = dict.length; 15552 this.start = dict.offset; 15553 this.offset = 0; 15554 this.data = dataview; 15555 [ 15556 `getInt8`, 15557 `getUint8`, 15558 `getInt16`, 15559 `getUint16`, 15560 `getInt32`, 15561 `getUint32`, 15562 `getBigInt64`, 15563 `getBigUint64`, 15564 ].forEach( ( name ) => { 15565 let fn = name.replace( /get(Big)?/, '' ).toLowerCase(); 15566 let increment = parseInt( name.replace( /[^\d]/g, '' ) ) / 8; 15567 Object.defineProperty( this, fn, { 15568 get: () => this.getValue( name, increment ), 15569 } ); 15570 } ); 15571 } 15572 get currentPosition() { 15573 return this.start + this.offset; 15574 } 15575 set currentPosition( position ) { 15576 this.start = position; 15577 this.offset = 0; 15578 } 15579 skip( n = 0, bits = 8 ) { 15580 this.offset += ( n * bits ) / 8; 15581 } 15582 getValue( type, increment ) { 15583 let pos = this.start + this.offset; 15584 this.offset += increment; 15585 try { 15586 return this.data[ type ]( pos ); 15587 } catch ( e ) { 15588 console.error( `parser`, type, increment, this ); 15589 console.error( `parser`, this.start, this.offset ); 15590 throw e; 15591 } 15592 } 15593 flags( n ) { 15594 if ( n === 8 || n === 16 || n === 32 || n === 64 ) { 15595 return this[ `uint${ n }` ] 15596 .toString( 2 ) 15597 .padStart( n, 0 ) 15598 .split( `` ) 15599 .map( ( v ) => v === '1' ); 15600 } 15601 console.error( 15602 `Error parsing flags: flag types can only be 1, 2, 4, or 8 bytes long` 15603 ); 15604 console.trace(); 15605 } 15606 get tag() { 15607 const t = this.uint32; 15608 return asText( [ 15609 ( t >> 24 ) & 255, 15610 ( t >> 16 ) & 255, 15611 ( t >> 8 ) & 255, 15612 t & 255, 15613 ] ); 15614 } 15615 get fixed() { 15616 let major = this.int16; 15617 let minor = Math.round( ( 1e3 * this.uint16 ) / 65356 ); 15618 return major + minor / 1e3; 15619 } 15620 get legacyFixed() { 15621 let major = this.uint16; 15622 let minor = this.uint16.toString( 16 ).padStart( 4, 0 ); 15623 return parseFloat( `${ major }.${ minor }` ); 15624 } 15625 get uint24() { 15626 return ( this.uint8 << 16 ) + ( this.uint8 << 8 ) + this.uint8; 15627 } 15628 get uint128() { 15629 let value = 0; 15630 for ( let i = 0; i < 5; i++ ) { 15631 let byte = this.uint8; 15632 value = value * 128 + ( byte & 127 ); 15633 if ( byte < 128 ) break; 15634 } 15635 return value; 15636 } 15637 get longdatetime() { 15638 return new Date( startDate + 1e3 * parseInt( this.int64.toString() ) ); 15639 } 15640 get fword() { 15641 return this.int16; 15642 } 15643 get ufword() { 15644 return this.uint16; 15645 } 15646 get Offset16() { 15647 return this.uint16; 15648 } 15649 get Offset32() { 15650 return this.uint32; 15651 } 15652 get F2DOT14() { 15653 const bits = p.uint16; 15654 const integer = [ 0, 1, -2, -1 ][ bits >> 14 ]; 15655 const fraction = bits & 16383; 15656 return integer + fraction / 16384; 15657 } 15658 verifyLength() { 15659 if ( this.offset != this.length ) { 15660 console.error( 15661 `unexpected parsed table size (${ this.offset }) for "${ this.name }" (expected ${ this.length })` 15662 ); 15663 } 15664 } 15665 readBytes( n = 0, position = 0, bits = 8, signed = false ) { 15666 n = n || this.length; 15667 if ( n === 0 ) return []; 15668 if ( position ) this.currentPosition = position; 15669 const fn = `${ signed ? `` : `u` }int${ bits }`, 15670 slice = []; 15671 while ( n-- ) slice.push( this[ fn ] ); 15672 return slice; 15673 } 15674 } 15675 class ParsedData { 15676 constructor( parser ) { 15677 const pGetter = { enumerable: false, get: () => parser }; 15678 Object.defineProperty( this, `parser`, pGetter ); 15679 const start = parser.currentPosition; 15680 const startGetter = { enumerable: false, get: () => start }; 15681 Object.defineProperty( this, `start`, startGetter ); 15682 } 15683 load( struct ) { 15684 Object.keys( struct ).forEach( ( p ) => { 15685 let props = Object.getOwnPropertyDescriptor( struct, p ); 15686 if ( props.get ) { 15687 this[ p ] = props.get.bind( this ); 15688 } else if ( props.value !== undefined ) { 15689 this[ p ] = props.value; 15690 } 15691 } ); 15692 if ( this.parser.length ) { 15693 this.parser.verifyLength(); 15694 } 15695 } 15696 } 15697 class SimpleTable extends ParsedData { 15698 constructor( dict, dataview, name ) { 15699 const { parser: parser, start: start } = super( 15700 new Parser( dict, dataview, name ) 15701 ); 15702 const pGetter = { enumerable: false, get: () => parser }; 15703 Object.defineProperty( this, `p`, pGetter ); 15704 const startGetter = { enumerable: false, get: () => start }; 15705 Object.defineProperty( this, `tableStart`, startGetter ); 15706 } 15707 } 15708 function lazy$1( object, property, getter ) { 15709 let val; 15710 Object.defineProperty( object, property, { 15711 get: () => { 15712 if ( val ) return val; 15713 val = getter(); 15714 return val; 15715 }, 15716 enumerable: true, 15717 } ); 15718 } 15719 class SFNT extends SimpleTable { 15720 constructor( font, dataview, createTable ) { 15721 const { p: p } = super( { offset: 0, length: 12 }, dataview, `sfnt` ); 15722 this.version = p.uint32; 15723 this.numTables = p.uint16; 15724 this.searchRange = p.uint16; 15725 this.entrySelector = p.uint16; 15726 this.rangeShift = p.uint16; 15727 p.verifyLength(); 15728 this.directory = [ ...new Array( this.numTables ) ].map( 15729 ( _ ) => new TableRecord( p ) 15730 ); 15731 this.tables = {}; 15732 this.directory.forEach( ( entry ) => { 15733 const getter = () => 15734 createTable( 15735 this.tables, 15736 { 15737 tag: entry.tag, 15738 offset: entry.offset, 15739 length: entry.length, 15740 }, 15741 dataview 15742 ); 15743 lazy$1( this.tables, entry.tag.trim(), getter ); 15744 } ); 15745 } 15746 } 15747 class TableRecord { 15748 constructor( p ) { 15749 this.tag = p.tag; 15750 this.checksum = p.uint32; 15751 this.offset = p.uint32; 15752 this.length = p.uint32; 15753 } 15754 } 15755 const gzipDecode = (inflate_default()).inflate || undefined; 15756 let nativeGzipDecode = undefined; 15757 // if ( ! gzipDecode ) { 15758 // import( 'zlib' ).then( ( zlib ) => { 15759 // nativeGzipDecode = ( buffer ) => zlib.unzipSync( buffer ); 15760 // } ); 15761 // } 15762 class WOFF$1 extends SimpleTable { 15763 constructor( font, dataview, createTable ) { 15764 const { p: p } = super( { offset: 0, length: 44 }, dataview, `woff` ); 15765 this.signature = p.tag; 15766 this.flavor = p.uint32; 15767 this.length = p.uint32; 15768 this.numTables = p.uint16; 15769 p.uint16; 15770 this.totalSfntSize = p.uint32; 15771 this.majorVersion = p.uint16; 15772 this.minorVersion = p.uint16; 15773 this.metaOffset = p.uint32; 15774 this.metaLength = p.uint32; 15775 this.metaOrigLength = p.uint32; 15776 this.privOffset = p.uint32; 15777 this.privLength = p.uint32; 15778 p.verifyLength(); 15779 this.directory = [ ...new Array( this.numTables ) ].map( 15780 ( _ ) => new WoffTableDirectoryEntry( p ) 15781 ); 15782 buildWoffLazyLookups( this, dataview, createTable ); 15783 } 15784 } 15785 class WoffTableDirectoryEntry { 15786 constructor( p ) { 15787 this.tag = p.tag; 15788 this.offset = p.uint32; 15789 this.compLength = p.uint32; 15790 this.origLength = p.uint32; 15791 this.origChecksum = p.uint32; 15792 } 15793 } 15794 function buildWoffLazyLookups( woff, dataview, createTable ) { 15795 woff.tables = {}; 15796 woff.directory.forEach( ( entry ) => { 15797 lazy$1( woff.tables, entry.tag.trim(), () => { 15798 let offset = 0; 15799 let view = dataview; 15800 if ( entry.compLength !== entry.origLength ) { 15801 const data = dataview.buffer.slice( 15802 entry.offset, 15803 entry.offset + entry.compLength 15804 ); 15805 let unpacked; 15806 if ( gzipDecode ) { 15807 unpacked = gzipDecode( new Uint8Array( data ) ); 15808 } else if ( nativeGzipDecode ) { 15809 unpacked = nativeGzipDecode( new Uint8Array( data ) ); 15810 } else { 15811 const msg = `no brotli decoder available to decode WOFF2 font`; 15812 if ( font.onerror ) font.onerror( msg ); 15813 throw new Error( msg ); 15814 } 15815 view = new DataView( unpacked.buffer ); 15816 } else { 15817 offset = entry.offset; 15818 } 15819 return createTable( 15820 woff.tables, 15821 { tag: entry.tag, offset: offset, length: entry.origLength }, 15822 view 15823 ); 15824 } ); 15825 } ); 15826 } 15827 const brotliDecode = (unbrotli_default()); 15828 let nativeBrotliDecode = undefined; 15829 // if ( ! brotliDecode ) { 15830 // import( 'zlib' ).then( ( zlib ) => { 15831 // nativeBrotliDecode = ( buffer ) => zlib.brotliDecompressSync( buffer ); 15832 // } ); 15833 // } 15834 class WOFF2$1 extends SimpleTable { 15835 constructor( font, dataview, createTable ) { 15836 const { p: p } = super( { offset: 0, length: 48 }, dataview, `woff2` ); 15837 this.signature = p.tag; 15838 this.flavor = p.uint32; 15839 this.length = p.uint32; 15840 this.numTables = p.uint16; 15841 p.uint16; 15842 this.totalSfntSize = p.uint32; 15843 this.totalCompressedSize = p.uint32; 15844 this.majorVersion = p.uint16; 15845 this.minorVersion = p.uint16; 15846 this.metaOffset = p.uint32; 15847 this.metaLength = p.uint32; 15848 this.metaOrigLength = p.uint32; 15849 this.privOffset = p.uint32; 15850 this.privLength = p.uint32; 15851 p.verifyLength(); 15852 this.directory = [ ...new Array( this.numTables ) ].map( 15853 ( _ ) => new Woff2TableDirectoryEntry( p ) 15854 ); 15855 let dictOffset = p.currentPosition; 15856 this.directory[ 0 ].offset = 0; 15857 this.directory.forEach( ( e, i ) => { 15858 let next = this.directory[ i + 1 ]; 15859 if ( next ) { 15860 next.offset = 15861 e.offset + 15862 ( e.transformLength !== undefined 15863 ? e.transformLength 15864 : e.origLength ); 15865 } 15866 } ); 15867 let decoded; 15868 let buffer = dataview.buffer.slice( dictOffset ); 15869 if ( brotliDecode ) { 15870 decoded = brotliDecode( new Uint8Array( buffer ) ); 15871 } else if ( nativeBrotliDecode ) { 15872 decoded = new Uint8Array( nativeBrotliDecode( buffer ) ); 15873 } else { 15874 const msg = `no brotli decoder available to decode WOFF2 font`; 15875 if ( font.onerror ) font.onerror( msg ); 15876 throw new Error( msg ); 15877 } 15878 buildWoff2LazyLookups( this, decoded, createTable ); 15879 } 15880 } 15881 class Woff2TableDirectoryEntry { 15882 constructor( p ) { 15883 this.flags = p.uint8; 15884 const tagNumber = ( this.tagNumber = this.flags & 63 ); 15885 if ( tagNumber === 63 ) { 15886 this.tag = p.tag; 15887 } else { 15888 this.tag = getWOFF2Tag( tagNumber ); 15889 } 15890 const transformVersion = ( this.transformVersion = 15891 ( this.flags & 192 ) >> 6 ); 15892 let hasTransforms = transformVersion !== 0; 15893 if ( this.tag === `glyf` || this.tag === `loca` ) { 15894 hasTransforms = this.transformVersion !== 3; 15895 } 15896 this.origLength = p.uint128; 15897 if ( hasTransforms ) { 15898 this.transformLength = p.uint128; 15899 } 15900 } 15901 } 15902 function buildWoff2LazyLookups( woff2, decoded, createTable ) { 15903 woff2.tables = {}; 15904 woff2.directory.forEach( ( entry ) => { 15905 lazy$1( woff2.tables, entry.tag.trim(), () => { 15906 const start = entry.offset; 15907 const end = 15908 start + 15909 ( entry.transformLength 15910 ? entry.transformLength 15911 : entry.origLength ); 15912 const data = new DataView( decoded.slice( start, end ).buffer ); 15913 try { 15914 return createTable( 15915 woff2.tables, 15916 { tag: entry.tag, offset: 0, length: entry.origLength }, 15917 data 15918 ); 15919 } catch ( e ) { 15920 console.error( e ); 15921 } 15922 } ); 15923 } ); 15924 } 15925 function getWOFF2Tag( flag ) { 15926 return [ 15927 `cmap`, 15928 `head`, 15929 `hhea`, 15930 `hmtx`, 15931 `maxp`, 15932 `name`, 15933 `OS/2`, 15934 `post`, 15935 `cvt `, 15936 `fpgm`, 15937 `glyf`, 15938 `loca`, 15939 `prep`, 15940 `CFF `, 15941 `VORG`, 15942 `EBDT`, 15943 `EBLC`, 15944 `gasp`, 15945 `hdmx`, 15946 `kern`, 15947 `LTSH`, 15948 `PCLT`, 15949 `VDMX`, 15950 `vhea`, 15951 `vmtx`, 15952 `BASE`, 15953 `GDEF`, 15954 `GPOS`, 15955 `GSUB`, 15956 `EBSC`, 15957 `JSTF`, 15958 `MATH`, 15959 `CBDT`, 15960 `CBLC`, 15961 `COLR`, 15962 `CPAL`, 15963 `SVG `, 15964 `sbix`, 15965 `acnt`, 15966 `avar`, 15967 `bdat`, 15968 `bloc`, 15969 `bsln`, 15970 `cvar`, 15971 `fdsc`, 15972 `feat`, 15973 `fmtx`, 15974 `fvar`, 15975 `gvar`, 15976 `hsty`, 15977 `just`, 15978 `lcar`, 15979 `mort`, 15980 `morx`, 15981 `opbd`, 15982 `prop`, 15983 `trak`, 15984 `Zapf`, 15985 `Silf`, 15986 `Glat`, 15987 `Gloc`, 15988 `Feat`, 15989 `Sill`, 15990 ][ flag & 63 ]; 15991 } 15992 const tableClasses = {}; 15993 let tableClassesLoaded = false; 15994 Promise.all( [ 15995 Promise.resolve().then( function () { 15996 return cmap$1; 15997 } ), 15998 Promise.resolve().then( function () { 15999 return head$1; 16000 } ), 16001 Promise.resolve().then( function () { 16002 return hhea$1; 16003 } ), 16004 Promise.resolve().then( function () { 16005 return hmtx$1; 16006 } ), 16007 Promise.resolve().then( function () { 16008 return maxp$1; 16009 } ), 16010 Promise.resolve().then( function () { 16011 return name$1; 16012 } ), 16013 Promise.resolve().then( function () { 16014 return OS2$1; 16015 } ), 16016 Promise.resolve().then( function () { 16017 return post$1; 16018 } ), 16019 Promise.resolve().then( function () { 16020 return BASE$1; 16021 } ), 16022 Promise.resolve().then( function () { 16023 return GDEF$1; 16024 } ), 16025 Promise.resolve().then( function () { 16026 return GSUB$1; 16027 } ), 16028 Promise.resolve().then( function () { 16029 return GPOS$1; 16030 } ), 16031 Promise.resolve().then( function () { 16032 return SVG$1; 16033 } ), 16034 Promise.resolve().then( function () { 16035 return fvar$1; 16036 } ), 16037 Promise.resolve().then( function () { 16038 return cvt$1; 16039 } ), 16040 Promise.resolve().then( function () { 16041 return fpgm$1; 16042 } ), 16043 Promise.resolve().then( function () { 16044 return gasp$1; 16045 } ), 16046 Promise.resolve().then( function () { 16047 return glyf$1; 16048 } ), 16049 Promise.resolve().then( function () { 16050 return loca$1; 16051 } ), 16052 Promise.resolve().then( function () { 16053 return prep$1; 16054 } ), 16055 Promise.resolve().then( function () { 16056 return CFF$1; 16057 } ), 16058 Promise.resolve().then( function () { 16059 return CFF2$1; 16060 } ), 16061 Promise.resolve().then( function () { 16062 return VORG$1; 16063 } ), 16064 Promise.resolve().then( function () { 16065 return EBLC$1; 16066 } ), 16067 Promise.resolve().then( function () { 16068 return EBDT$1; 16069 } ), 16070 Promise.resolve().then( function () { 16071 return EBSC$1; 16072 } ), 16073 Promise.resolve().then( function () { 16074 return CBLC$1; 16075 } ), 16076 Promise.resolve().then( function () { 16077 return CBDT$1; 16078 } ), 16079 Promise.resolve().then( function () { 16080 return sbix$1; 16081 } ), 16082 Promise.resolve().then( function () { 16083 return COLR$1; 16084 } ), 16085 Promise.resolve().then( function () { 16086 return CPAL$1; 16087 } ), 16088 Promise.resolve().then( function () { 16089 return DSIG$1; 16090 } ), 16091 Promise.resolve().then( function () { 16092 return hdmx$1; 16093 } ), 16094 Promise.resolve().then( function () { 16095 return kern$1; 16096 } ), 16097 Promise.resolve().then( function () { 16098 return LTSH$1; 16099 } ), 16100 Promise.resolve().then( function () { 16101 return MERG$1; 16102 } ), 16103 Promise.resolve().then( function () { 16104 return meta$1; 16105 } ), 16106 Promise.resolve().then( function () { 16107 return PCLT$1; 16108 } ), 16109 Promise.resolve().then( function () { 16110 return VDMX$1; 16111 } ), 16112 Promise.resolve().then( function () { 16113 return vhea$1; 16114 } ), 16115 Promise.resolve().then( function () { 16116 return vmtx$1; 16117 } ), 16118 ] ).then( ( data ) => { 16119 data.forEach( ( e ) => { 16120 let name = Object.keys( e )[ 0 ]; 16121 tableClasses[ name ] = e[ name ]; 16122 } ); 16123 tableClassesLoaded = true; 16124 } ); 16125 function createTable( tables, dict, dataview ) { 16126 let name = dict.tag.replace( /[^\w\d]/g, `` ); 16127 let Type = tableClasses[ name ]; 16128 if ( Type ) return new Type( dict, dataview, tables ); 16129 console.warn( 16130 `lib-font has no definition for ${ name }. The table was skipped.` 16131 ); 16132 return {}; 16133 } 16134 function loadTableClasses() { 16135 let count = 0; 16136 function checkLoaded( resolve, reject ) { 16137 if ( ! tableClassesLoaded ) { 16138 if ( count > 10 ) { 16139 return reject( new Error( `loading took too long` ) ); 16140 } 16141 count++; 16142 return setTimeout( () => checkLoaded( resolve ), 250 ); 16143 } 16144 resolve( createTable ); 16145 } 16146 return new Promise( ( resolve, reject ) => checkLoaded( resolve ) ); 16147 } 16148 function getFontCSSFormat( path, errorOnStyle ) { 16149 let pos = path.lastIndexOf( `.` ); 16150 let ext = ( path.substring( pos + 1 ) || `` ).toLowerCase(); 16151 let format = { 16152 ttf: `truetype`, 16153 otf: `opentype`, 16154 woff: `woff`, 16155 woff2: `woff2`, 16156 }[ ext ]; 16157 if ( format ) return format; 16158 let msg = { 16159 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.`, 16160 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.`, 16161 fon: `The .fon format is not supported: this is an ancient Windows bitmap font format.`, 16162 ttc: `Based on the current CSS specification, font collections are not (yet?) supported.`, 16163 }[ ext ]; 16164 if ( ! msg ) msg = `${ path } is not a known webfont format.`; 16165 if ( errorOnStyle ) { 16166 throw new Error( msg ); 16167 } else { 16168 console.warn( `Could not load font: ${ msg }` ); 16169 } 16170 } 16171 async function setupFontFace( name, url, options = {} ) { 16172 if ( ! globalThis.document ) return; 16173 let format = getFontCSSFormat( url, options.errorOnStyle ); 16174 if ( ! format ) return; 16175 let style = document.createElement( `style` ); 16176 style.className = `injected-by-Font-js`; 16177 let rules = []; 16178 if ( options.styleRules ) { 16179 rules = Object.entries( options.styleRules ).map( 16180 ( [ key, value ] ) => `${ key }: ${ value };` 16181 ); 16182 } 16183 style.textContent = `\n@font-face {\n font-family: "${ name }";\n ${ rules.join( 16184 `\n\t` 16185 ) }\n src: url("${ url }") format("${ format }");\n}`; 16186 globalThis.document.head.appendChild( style ); 16187 return style; 16188 } 16189 const TTF = [ 0, 1, 0, 0 ]; 16190 const OTF = [ 79, 84, 84, 79 ]; 16191 const WOFF = [ 119, 79, 70, 70 ]; 16192 const WOFF2 = [ 119, 79, 70, 50 ]; 16193 function match( ar1, ar2 ) { 16194 if ( ar1.length !== ar2.length ) return; 16195 for ( let i = 0; i < ar1.length; i++ ) { 16196 if ( ar1[ i ] !== ar2[ i ] ) return; 16197 } 16198 return true; 16199 } 16200 function validFontFormat( dataview ) { 16201 const LEAD_BYTES = [ 16202 dataview.getUint8( 0 ), 16203 dataview.getUint8( 1 ), 16204 dataview.getUint8( 2 ), 16205 dataview.getUint8( 3 ), 16206 ]; 16207 if ( match( LEAD_BYTES, TTF ) || match( LEAD_BYTES, OTF ) ) return `SFNT`; 16208 if ( match( LEAD_BYTES, WOFF ) ) return `WOFF`; 16209 if ( match( LEAD_BYTES, WOFF2 ) ) return `WOFF2`; 16210 } 16211 function checkFetchResponseStatus( response ) { 16212 if ( ! response.ok ) { 16213 throw new Error( 16214 `HTTP ${ response.status } - ${ response.statusText }` 16215 ); 16216 } 16217 return response; 16218 } 16219 class Font extends EventManager { 16220 constructor( name, options = {} ) { 16221 super(); 16222 this.name = name; 16223 this.options = options; 16224 this.metrics = false; 16225 } 16226 get src() { 16227 return this.__src; 16228 } 16229 set src( src ) { 16230 this.__src = src; 16231 ( async () => { 16232 if ( globalThis.document && ! this.options.skipStyleSheet ) { 16233 await setupFontFace( this.name, src, this.options ); 16234 } 16235 this.loadFont( src ); 16236 } )(); 16237 } 16238 async loadFont( url, filename ) { 16239 fetch( url ) 16240 .then( 16241 ( response ) => 16242 checkFetchResponseStatus( response ) && 16243 response.arrayBuffer() 16244 ) 16245 .then( ( buffer ) => 16246 this.fromDataBuffer( buffer, filename || url ) 16247 ) 16248 .catch( ( err ) => { 16249 const evt = new lib_font_browser_Event( 16250 `error`, 16251 err, 16252 `Failed to load font at ${ filename || url }` 16253 ); 16254 this.dispatch( evt ); 16255 if ( this.onerror ) this.onerror( evt ); 16256 } ); 16257 } 16258 async fromDataBuffer( buffer, filenameOrUrL ) { 16259 this.fontData = new DataView( buffer ); 16260 let type = validFontFormat( this.fontData ); 16261 if ( ! type ) { 16262 throw new Error( 16263 `${ filenameOrUrL } is either an unsupported font format, or not a font at all.` 16264 ); 16265 } 16266 await this.parseBasicData( type ); 16267 const evt = new lib_font_browser_Event( 'load', { font: this } ); 16268 this.dispatch( evt ); 16269 if ( this.onload ) this.onload( evt ); 16270 } 16271 async parseBasicData( type ) { 16272 return loadTableClasses().then( ( createTable ) => { 16273 if ( type === `SFNT` ) { 16274 this.opentype = new SFNT( this, this.fontData, createTable ); 16275 } 16276 if ( type === `WOFF` ) { 16277 this.opentype = new WOFF$1( this, this.fontData, createTable ); 16278 } 16279 if ( type === `WOFF2` ) { 16280 this.opentype = new WOFF2$1( this, this.fontData, createTable ); 16281 } 16282 return this.opentype; 16283 } ); 16284 } 16285 getGlyphId( char ) { 16286 return this.opentype.tables.cmap.getGlyphId( char ); 16287 } 16288 reverse( glyphid ) { 16289 return this.opentype.tables.cmap.reverse( glyphid ); 16290 } 16291 supports( char ) { 16292 return this.getGlyphId( char ) !== 0; 16293 } 16294 supportsVariation( variation ) { 16295 return ( 16296 this.opentype.tables.cmap.supportsVariation( variation ) !== false 16297 ); 16298 } 16299 measureText( text, size = 16 ) { 16300 if ( this.__unloaded ) 16301 throw new Error( 16302 'Cannot measure text: font was unloaded. Please reload before calling measureText()' 16303 ); 16304 let d = document.createElement( 'div' ); 16305 d.textContent = text; 16306 d.style.fontFamily = this.name; 16307 d.style.fontSize = `${ size }px`; 16308 d.style.color = `transparent`; 16309 d.style.background = `transparent`; 16310 d.style.top = `0`; 16311 d.style.left = `0`; 16312 d.style.position = `absolute`; 16313 document.body.appendChild( d ); 16314 let bbox = d.getBoundingClientRect(); 16315 document.body.removeChild( d ); 16316 const OS2 = this.opentype.tables[ 'OS/2' ]; 16317 bbox.fontSize = size; 16318 bbox.ascender = OS2.sTypoAscender; 16319 bbox.descender = OS2.sTypoDescender; 16320 return bbox; 16321 } 16322 unload() { 16323 if ( this.styleElement.parentNode ) { 16324 this.styleElement.parentNode.removeElement( this.styleElement ); 16325 const evt = new lib_font_browser_Event( 'unload', { font: this } ); 16326 this.dispatch( evt ); 16327 if ( this.onunload ) this.onunload( evt ); 16328 } 16329 this._unloaded = true; 16330 } 16331 load() { 16332 if ( this.__unloaded ) { 16333 delete this.__unloaded; 16334 document.head.appendChild( this.styleElement ); 16335 const evt = new lib_font_browser_Event( 'load', { font: this } ); 16336 this.dispatch( evt ); 16337 if ( this.onload ) this.onload( evt ); 16338 } 16339 } 16340 } 16341 globalThis.Font = Font; 16342 class Subtable extends ParsedData { 16343 constructor( p, plaformID, encodingID ) { 16344 super( p ); 16345 this.plaformID = plaformID; 16346 this.encodingID = encodingID; 16347 } 16348 } 16349 class Format0 extends Subtable { 16350 constructor( p, platformID, encodingID ) { 16351 super( p, platformID, encodingID ); 16352 this.format = 0; 16353 this.length = p.uint16; 16354 this.language = p.uint16; 16355 this.glyphIdArray = [ ...new Array( 256 ) ].map( ( _ ) => p.uint8 ); 16356 } 16357 supports( charCode ) { 16358 if ( charCode.charCodeAt ) { 16359 charCode = -1; 16360 console.warn( 16361 `supports(character) not implemented for cmap subtable format 0. only supports(id) is implemented.` 16362 ); 16363 } 16364 return 0 <= charCode && charCode <= 255; 16365 } 16366 reverse( glyphID ) { 16367 console.warn( `reverse not implemented for cmap subtable format 0` ); 16368 return {}; 16369 } 16370 getSupportedCharCodes() { 16371 return [ { start: 1, end: 256 } ]; 16372 } 16373 } 16374 class Format2 extends Subtable { 16375 constructor( p, platformID, encodingID ) { 16376 super( p, platformID, encodingID ); 16377 this.format = 2; 16378 this.length = p.uint16; 16379 this.language = p.uint16; 16380 this.subHeaderKeys = [ ...new Array( 256 ) ].map( ( _ ) => p.uint16 ); 16381 const subHeaderCount = Math.max( ...this.subHeaderKeys ); 16382 const subHeaderOffset = p.currentPosition; 16383 lazy$1( this, `subHeaders`, () => { 16384 p.currentPosition = subHeaderOffset; 16385 return [ ...new Array( subHeaderCount ) ].map( 16386 ( _ ) => new SubHeader( p ) 16387 ); 16388 } ); 16389 const glyphIndexOffset = subHeaderOffset + subHeaderCount * 8; 16390 lazy$1( this, `glyphIndexArray`, () => { 16391 p.currentPosition = glyphIndexOffset; 16392 return [ ...new Array( subHeaderCount ) ].map( ( _ ) => p.uint16 ); 16393 } ); 16394 } 16395 supports( charCode ) { 16396 if ( charCode.charCodeAt ) { 16397 charCode = -1; 16398 console.warn( 16399 `supports(character) not implemented for cmap subtable format 2. only supports(id) is implemented.` 16400 ); 16401 } 16402 const low = charCode && 255; 16403 const high = charCode && 65280; 16404 const subHeaderKey = this.subHeaders[ high ]; 16405 const subheader = this.subHeaders[ subHeaderKey ]; 16406 const first = subheader.firstCode; 16407 const last = first + subheader.entryCount; 16408 return first <= low && low <= last; 16409 } 16410 reverse( glyphID ) { 16411 console.warn( `reverse not implemented for cmap subtable format 2` ); 16412 return {}; 16413 } 16414 getSupportedCharCodes( preservePropNames = false ) { 16415 if ( preservePropNames ) { 16416 return this.subHeaders.map( ( h ) => ( { 16417 firstCode: h.firstCode, 16418 lastCode: h.lastCode, 16419 } ) ); 16420 } 16421 return this.subHeaders.map( ( h ) => ( { 16422 start: h.firstCode, 16423 end: h.lastCode, 16424 } ) ); 16425 } 16426 } 16427 class SubHeader { 16428 constructor( p ) { 16429 this.firstCode = p.uint16; 16430 this.entryCount = p.uint16; 16431 this.lastCode = this.first + this.entryCount; 16432 this.idDelta = p.int16; 16433 this.idRangeOffset = p.uint16; 16434 } 16435 } 16436 class Format4 extends Subtable { 16437 constructor( p, platformID, encodingID ) { 16438 super( p, platformID, encodingID ); 16439 this.format = 4; 16440 this.length = p.uint16; 16441 this.language = p.uint16; 16442 this.segCountX2 = p.uint16; 16443 this.segCount = this.segCountX2 / 2; 16444 this.searchRange = p.uint16; 16445 this.entrySelector = p.uint16; 16446 this.rangeShift = p.uint16; 16447 const endCodePosition = p.currentPosition; 16448 lazy$1( this, `endCode`, () => 16449 p.readBytes( this.segCount, endCodePosition, 16 ) 16450 ); 16451 const startCodePosition = endCodePosition + 2 + this.segCountX2; 16452 lazy$1( this, `startCode`, () => 16453 p.readBytes( this.segCount, startCodePosition, 16 ) 16454 ); 16455 const idDeltaPosition = startCodePosition + this.segCountX2; 16456 lazy$1( this, `idDelta`, () => 16457 p.readBytes( this.segCount, idDeltaPosition, 16, true ) 16458 ); 16459 const idRangePosition = idDeltaPosition + this.segCountX2; 16460 lazy$1( this, `idRangeOffset`, () => 16461 p.readBytes( this.segCount, idRangePosition, 16 ) 16462 ); 16463 const glyphIdArrayPosition = idRangePosition + this.segCountX2; 16464 const glyphIdArrayLength = 16465 this.length - ( glyphIdArrayPosition - this.tableStart ); 16466 lazy$1( this, `glyphIdArray`, () => 16467 p.readBytes( glyphIdArrayLength, glyphIdArrayPosition, 16 ) 16468 ); 16469 lazy$1( this, `segments`, () => 16470 this.buildSegments( idRangePosition, glyphIdArrayPosition, p ) 16471 ); 16472 } 16473 buildSegments( idRangePosition, glyphIdArrayPosition, p ) { 16474 const build = ( _, i ) => { 16475 let startCode = this.startCode[ i ], 16476 endCode = this.endCode[ i ], 16477 idDelta = this.idDelta[ i ], 16478 idRangeOffset = this.idRangeOffset[ i ], 16479 idRangeOffsetPointer = idRangePosition + 2 * i, 16480 glyphIDs = []; 16481 if ( idRangeOffset === 0 ) { 16482 for ( 16483 let i = startCode + idDelta, e = endCode + idDelta; 16484 i <= e; 16485 i++ 16486 ) { 16487 glyphIDs.push( i ); 16488 } 16489 } else { 16490 for ( let i = 0, e = endCode - startCode; i <= e; i++ ) { 16491 p.currentPosition = 16492 idRangeOffsetPointer + idRangeOffset + i * 2; 16493 glyphIDs.push( p.uint16 ); 16494 } 16495 } 16496 return { 16497 startCode: startCode, 16498 endCode: endCode, 16499 idDelta: idDelta, 16500 idRangeOffset: idRangeOffset, 16501 glyphIDs: glyphIDs, 16502 }; 16503 }; 16504 return [ ...new Array( this.segCount ) ].map( build ); 16505 } 16506 reverse( glyphID ) { 16507 let s = this.segments.find( ( v ) => v.glyphIDs.includes( glyphID ) ); 16508 if ( ! s ) return {}; 16509 const code = s.startCode + s.glyphIDs.indexOf( glyphID ); 16510 return { code: code, unicode: String.fromCodePoint( code ) }; 16511 } 16512 getGlyphId( charCode ) { 16513 if ( charCode.charCodeAt ) charCode = charCode.charCodeAt( 0 ); 16514 if ( 55296 <= charCode && charCode <= 57343 ) return 0; 16515 if ( ( charCode & 65534 ) === 65534 || ( charCode & 65535 ) === 65535 ) 16516 return 0; 16517 let segment = this.segments.find( 16518 ( s ) => s.startCode <= charCode && charCode <= s.endCode 16519 ); 16520 if ( ! segment ) return 0; 16521 return segment.glyphIDs[ charCode - segment.startCode ]; 16522 } 16523 supports( charCode ) { 16524 return this.getGlyphId( charCode ) !== 0; 16525 } 16526 getSupportedCharCodes( preservePropNames = false ) { 16527 if ( preservePropNames ) return this.segments; 16528 return this.segments.map( ( v ) => ( { 16529 start: v.startCode, 16530 end: v.endCode, 16531 } ) ); 16532 } 16533 } 16534 class Format6 extends Subtable { 16535 constructor( p, platformID, encodingID ) { 16536 super( p, platformID, encodingID ); 16537 this.format = 6; 16538 this.length = p.uint16; 16539 this.language = p.uint16; 16540 this.firstCode = p.uint16; 16541 this.entryCount = p.uint16; 16542 this.lastCode = this.firstCode + this.entryCount - 1; 16543 const getter = () => 16544 [ ...new Array( this.entryCount ) ].map( ( _ ) => p.uint16 ); 16545 lazy$1( this, `glyphIdArray`, getter ); 16546 } 16547 supports( charCode ) { 16548 if ( charCode.charCodeAt ) { 16549 charCode = -1; 16550 console.warn( 16551 `supports(character) not implemented for cmap subtable format 6. only supports(id) is implemented.` 16552 ); 16553 } 16554 if ( charCode < this.firstCode ) return {}; 16555 if ( charCode > this.firstCode + this.entryCount ) return {}; 16556 const code = charCode - this.firstCode; 16557 return { code: code, unicode: String.fromCodePoint( code ) }; 16558 } 16559 reverse( glyphID ) { 16560 let pos = this.glyphIdArray.indexOf( glyphID ); 16561 if ( pos > -1 ) return this.firstCode + pos; 16562 } 16563 getSupportedCharCodes( preservePropNames = false ) { 16564 if ( preservePropNames ) { 16565 return [ { firstCode: this.firstCode, lastCode: this.lastCode } ]; 16566 } 16567 return [ { start: this.firstCode, end: this.lastCode } ]; 16568 } 16569 } 16570 class Format8 extends Subtable { 16571 constructor( p, platformID, encodingID ) { 16572 super( p, platformID, encodingID ); 16573 this.format = 8; 16574 p.uint16; 16575 this.length = p.uint32; 16576 this.language = p.uint32; 16577 this.is32 = [ ...new Array( 8192 ) ].map( ( _ ) => p.uint8 ); 16578 this.numGroups = p.uint32; 16579 const getter = () => 16580 [ ...new Array( this.numGroups ) ].map( 16581 ( _ ) => new SequentialMapGroup$1( p ) 16582 ); 16583 lazy$1( this, `groups`, getter ); 16584 } 16585 supports( charCode ) { 16586 if ( charCode.charCodeAt ) { 16587 charCode = -1; 16588 console.warn( 16589 `supports(character) not implemented for cmap subtable format 8. only supports(id) is implemented.` 16590 ); 16591 } 16592 return ( 16593 this.groups.findIndex( 16594 ( s ) => 16595 s.startcharCode <= charCode && charCode <= s.endcharCode 16596 ) !== -1 16597 ); 16598 } 16599 reverse( glyphID ) { 16600 console.warn( `reverse not implemented for cmap subtable format 8` ); 16601 return {}; 16602 } 16603 getSupportedCharCodes( preservePropNames = false ) { 16604 if ( preservePropNames ) return this.groups; 16605 return this.groups.map( ( v ) => ( { 16606 start: v.startcharCode, 16607 end: v.endcharCode, 16608 } ) ); 16609 } 16610 } 16611 class SequentialMapGroup$1 { 16612 constructor( p ) { 16613 this.startcharCode = p.uint32; 16614 this.endcharCode = p.uint32; 16615 this.startGlyphID = p.uint32; 16616 } 16617 } 16618 class Format10 extends Subtable { 16619 constructor( p, platformID, encodingID ) { 16620 super( p, platformID, encodingID ); 16621 this.format = 10; 16622 p.uint16; 16623 this.length = p.uint32; 16624 this.language = p.uint32; 16625 this.startCharCode = p.uint32; 16626 this.numChars = p.uint32; 16627 this.endCharCode = this.startCharCode + this.numChars; 16628 const getter = () => 16629 [ ...new Array( this.numChars ) ].map( ( _ ) => p.uint16 ); 16630 lazy$1( this, `glyphs`, getter ); 16631 } 16632 supports( charCode ) { 16633 if ( charCode.charCodeAt ) { 16634 charCode = -1; 16635 console.warn( 16636 `supports(character) not implemented for cmap subtable format 10. only supports(id) is implemented.` 16637 ); 16638 } 16639 if ( charCode < this.startCharCode ) return false; 16640 if ( charCode > this.startCharCode + this.numChars ) return false; 16641 return charCode - this.startCharCode; 16642 } 16643 reverse( glyphID ) { 16644 console.warn( `reverse not implemented for cmap subtable format 10` ); 16645 return {}; 16646 } 16647 getSupportedCharCodes( preservePropNames = false ) { 16648 if ( preservePropNames ) { 16649 return [ 16650 { 16651 startCharCode: this.startCharCode, 16652 endCharCode: this.endCharCode, 16653 }, 16654 ]; 16655 } 16656 return [ { start: this.startCharCode, end: this.endCharCode } ]; 16657 } 16658 } 16659 class Format12 extends Subtable { 16660 constructor( p, platformID, encodingID ) { 16661 super( p, platformID, encodingID ); 16662 this.format = 12; 16663 p.uint16; 16664 this.length = p.uint32; 16665 this.language = p.uint32; 16666 this.numGroups = p.uint32; 16667 const getter = () => 16668 [ ...new Array( this.numGroups ) ].map( 16669 ( _ ) => new SequentialMapGroup( p ) 16670 ); 16671 lazy$1( this, `groups`, getter ); 16672 } 16673 supports( charCode ) { 16674 if ( charCode.charCodeAt ) charCode = charCode.charCodeAt( 0 ); 16675 if ( 55296 <= charCode && charCode <= 57343 ) return 0; 16676 if ( ( charCode & 65534 ) === 65534 || ( charCode & 65535 ) === 65535 ) 16677 return 0; 16678 return ( 16679 this.groups.findIndex( 16680 ( s ) => 16681 s.startCharCode <= charCode && charCode <= s.endCharCode 16682 ) !== -1 16683 ); 16684 } 16685 reverse( glyphID ) { 16686 for ( let group of this.groups ) { 16687 let start = group.startGlyphID; 16688 if ( start > glyphID ) continue; 16689 if ( start === glyphID ) return group.startCharCode; 16690 let end = start + ( group.endCharCode - group.startCharCode ); 16691 if ( end < glyphID ) continue; 16692 const code = group.startCharCode + ( glyphID - start ); 16693 return { code: code, unicode: String.fromCodePoint( code ) }; 16694 } 16695 return {}; 16696 } 16697 getSupportedCharCodes( preservePropNames = false ) { 16698 if ( preservePropNames ) return this.groups; 16699 return this.groups.map( ( v ) => ( { 16700 start: v.startCharCode, 16701 end: v.endCharCode, 16702 } ) ); 16703 } 16704 } 16705 class SequentialMapGroup { 16706 constructor( p ) { 16707 this.startCharCode = p.uint32; 16708 this.endCharCode = p.uint32; 16709 this.startGlyphID = p.uint32; 16710 } 16711 } 16712 class Format13 extends Subtable { 16713 constructor( p, platformID, encodingID ) { 16714 super( p, platformID, encodingID ); 16715 this.format = 13; 16716 p.uint16; 16717 this.length = p.uint32; 16718 this.language = p.uint32; 16719 this.numGroups = p.uint32; 16720 const getter = [ ...new Array( this.numGroups ) ].map( 16721 ( _ ) => new ConstantMapGroup( p ) 16722 ); 16723 lazy$1( this, `groups`, getter ); 16724 } 16725 supports( charCode ) { 16726 if ( charCode.charCodeAt ) charCode = charCode.charCodeAt( 0 ); 16727 return ( 16728 this.groups.findIndex( 16729 ( s ) => 16730 s.startCharCode <= charCode && charCode <= s.endCharCode 16731 ) !== -1 16732 ); 16733 } 16734 reverse( glyphID ) { 16735 console.warn( `reverse not implemented for cmap subtable format 13` ); 16736 return {}; 16737 } 16738 getSupportedCharCodes( preservePropNames = false ) { 16739 if ( preservePropNames ) return this.groups; 16740 return this.groups.map( ( v ) => ( { 16741 start: v.startCharCode, 16742 end: v.endCharCode, 16743 } ) ); 16744 } 16745 } 16746 class ConstantMapGroup { 16747 constructor( p ) { 16748 this.startCharCode = p.uint32; 16749 this.endCharCode = p.uint32; 16750 this.glyphID = p.uint32; 16751 } 16752 } 16753 class Format14 extends Subtable { 16754 constructor( p, platformID, encodingID ) { 16755 super( p, platformID, encodingID ); 16756 this.subTableStart = p.currentPosition; 16757 this.format = 14; 16758 this.length = p.uint32; 16759 this.numVarSelectorRecords = p.uint32; 16760 lazy$1( this, `varSelectors`, () => 16761 [ ...new Array( this.numVarSelectorRecords ) ].map( 16762 ( _ ) => new VariationSelector( p ) 16763 ) 16764 ); 16765 } 16766 supports() { 16767 console.warn( `supports not implemented for cmap subtable format 14` ); 16768 return 0; 16769 } 16770 getSupportedCharCodes() { 16771 console.warn( 16772 `getSupportedCharCodes not implemented for cmap subtable format 14` 16773 ); 16774 return []; 16775 } 16776 reverse( glyphID ) { 16777 console.warn( `reverse not implemented for cmap subtable format 14` ); 16778 return {}; 16779 } 16780 supportsVariation( variation ) { 16781 let v = this.varSelector.find( 16782 ( uvs ) => uvs.varSelector === variation 16783 ); 16784 return v ? v : false; 16785 } 16786 getSupportedVariations() { 16787 return this.varSelectors.map( ( v ) => v.varSelector ); 16788 } 16789 } 16790 class VariationSelector { 16791 constructor( p ) { 16792 this.varSelector = p.uint24; 16793 this.defaultUVSOffset = p.Offset32; 16794 this.nonDefaultUVSOffset = p.Offset32; 16795 } 16796 } 16797 function createSubTable( parser, platformID, encodingID ) { 16798 const format = parser.uint16; 16799 if ( format === 0 ) return new Format0( parser, platformID, encodingID ); 16800 if ( format === 2 ) return new Format2( parser, platformID, encodingID ); 16801 if ( format === 4 ) return new Format4( parser, platformID, encodingID ); 16802 if ( format === 6 ) return new Format6( parser, platformID, encodingID ); 16803 if ( format === 8 ) return new Format8( parser, platformID, encodingID ); 16804 if ( format === 10 ) return new Format10( parser, platformID, encodingID ); 16805 if ( format === 12 ) return new Format12( parser, platformID, encodingID ); 16806 if ( format === 13 ) return new Format13( parser, platformID, encodingID ); 16807 if ( format === 14 ) return new Format14( parser, platformID, encodingID ); 16808 return {}; 16809 } 16810 class cmap extends SimpleTable { 16811 constructor( dict, dataview ) { 16812 const { p: p } = super( dict, dataview ); 16813 this.version = p.uint16; 16814 this.numTables = p.uint16; 16815 this.encodingRecords = [ ...new Array( this.numTables ) ].map( 16816 ( _ ) => new EncodingRecord( p, this.tableStart ) 16817 ); 16818 } 16819 getSubTable( tableID ) { 16820 return this.encodingRecords[ tableID ].table; 16821 } 16822 getSupportedEncodings() { 16823 return this.encodingRecords.map( ( r ) => ( { 16824 platformID: r.platformID, 16825 encodingId: r.encodingID, 16826 } ) ); 16827 } 16828 getSupportedCharCodes( platformID, encodingID ) { 16829 const recordID = this.encodingRecords.findIndex( 16830 ( r ) => r.platformID === platformID && r.encodingID === encodingID 16831 ); 16832 if ( recordID === -1 ) return false; 16833 const subtable = this.getSubTable( recordID ); 16834 return subtable.getSupportedCharCodes(); 16835 } 16836 reverse( glyphid ) { 16837 for ( let i = 0; i < this.numTables; i++ ) { 16838 let code = this.getSubTable( i ).reverse( glyphid ); 16839 if ( code ) return code; 16840 } 16841 } 16842 getGlyphId( char ) { 16843 let last = 0; 16844 this.encodingRecords.some( ( _, tableID ) => { 16845 let t = this.getSubTable( tableID ); 16846 if ( ! t.getGlyphId ) return false; 16847 last = t.getGlyphId( char ); 16848 return last !== 0; 16849 } ); 16850 return last; 16851 } 16852 supports( char ) { 16853 return this.encodingRecords.some( ( _, tableID ) => { 16854 const t = this.getSubTable( tableID ); 16855 return t.supports && t.supports( char ) !== false; 16856 } ); 16857 } 16858 supportsVariation( variation ) { 16859 return this.encodingRecords.some( ( _, tableID ) => { 16860 const t = this.getSubTable( tableID ); 16861 return ( 16862 t.supportsVariation && 16863 t.supportsVariation( variation ) !== false 16864 ); 16865 } ); 16866 } 16867 } 16868 class EncodingRecord { 16869 constructor( p, tableStart ) { 16870 const platformID = ( this.platformID = p.uint16 ); 16871 const encodingID = ( this.encodingID = p.uint16 ); 16872 const offset = ( this.offset = p.Offset32 ); 16873 lazy$1( this, `table`, () => { 16874 p.currentPosition = tableStart + offset; 16875 return createSubTable( p, platformID, encodingID ); 16876 } ); 16877 } 16878 } 16879 var cmap$1 = Object.freeze( { __proto__: null, cmap: cmap } ); 16880 class head extends SimpleTable { 16881 constructor( dict, dataview ) { 16882 const { p: p } = super( dict, dataview ); 16883 this.load( { 16884 majorVersion: p.uint16, 16885 minorVersion: p.uint16, 16886 fontRevision: p.fixed, 16887 checkSumAdjustment: p.uint32, 16888 magicNumber: p.uint32, 16889 flags: p.flags( 16 ), 16890 unitsPerEm: p.uint16, 16891 created: p.longdatetime, 16892 modified: p.longdatetime, 16893 xMin: p.int16, 16894 yMin: p.int16, 16895 xMax: p.int16, 16896 yMax: p.int16, 16897 macStyle: p.flags( 16 ), 16898 lowestRecPPEM: p.uint16, 16899 fontDirectionHint: p.uint16, 16900 indexToLocFormat: p.uint16, 16901 glyphDataFormat: p.uint16, 16902 } ); 16903 } 16904 } 16905 var head$1 = Object.freeze( { __proto__: null, head: head } ); 16906 class hhea extends SimpleTable { 16907 constructor( dict, dataview ) { 16908 const { p: p } = super( dict, dataview ); 16909 this.majorVersion = p.uint16; 16910 this.minorVersion = p.uint16; 16911 this.ascender = p.fword; 16912 this.descender = p.fword; 16913 this.lineGap = p.fword; 16914 this.advanceWidthMax = p.ufword; 16915 this.minLeftSideBearing = p.fword; 16916 this.minRightSideBearing = p.fword; 16917 this.xMaxExtent = p.fword; 16918 this.caretSlopeRise = p.int16; 16919 this.caretSlopeRun = p.int16; 16920 this.caretOffset = p.int16; 16921 p.int16; 16922 p.int16; 16923 p.int16; 16924 p.int16; 16925 this.metricDataFormat = p.int16; 16926 this.numberOfHMetrics = p.uint16; 16927 p.verifyLength(); 16928 } 16929 } 16930 var hhea$1 = Object.freeze( { __proto__: null, hhea: hhea } ); 16931 class hmtx extends SimpleTable { 16932 constructor( dict, dataview, tables ) { 16933 const { p: p } = super( dict, dataview ); 16934 const numberOfHMetrics = tables.hhea.numberOfHMetrics; 16935 const numGlyphs = tables.maxp.numGlyphs; 16936 const metricsStart = p.currentPosition; 16937 lazy$1( this, `hMetrics`, () => { 16938 p.currentPosition = metricsStart; 16939 return [ ...new Array( numberOfHMetrics ) ].map( 16940 ( _ ) => new LongHorMetric( p.uint16, p.int16 ) 16941 ); 16942 } ); 16943 if ( numberOfHMetrics < numGlyphs ) { 16944 const lsbStart = metricsStart + numberOfHMetrics * 4; 16945 lazy$1( this, `leftSideBearings`, () => { 16946 p.currentPosition = lsbStart; 16947 return [ ...new Array( numGlyphs - numberOfHMetrics ) ].map( 16948 ( _ ) => p.int16 16949 ); 16950 } ); 16951 } 16952 } 16953 } 16954 class LongHorMetric { 16955 constructor( w, b ) { 16956 this.advanceWidth = w; 16957 this.lsb = b; 16958 } 16959 } 16960 var hmtx$1 = Object.freeze( { __proto__: null, hmtx: hmtx } ); 16961 class maxp extends SimpleTable { 16962 constructor( dict, dataview ) { 16963 const { p: p } = super( dict, dataview ); 16964 this.version = p.legacyFixed; 16965 this.numGlyphs = p.uint16; 16966 if ( this.version === 1 ) { 16967 this.maxPoints = p.uint16; 16968 this.maxContours = p.uint16; 16969 this.maxCompositePoints = p.uint16; 16970 this.maxCompositeContours = p.uint16; 16971 this.maxZones = p.uint16; 16972 this.maxTwilightPoints = p.uint16; 16973 this.maxStorage = p.uint16; 16974 this.maxFunctionDefs = p.uint16; 16975 this.maxInstructionDefs = p.uint16; 16976 this.maxStackElements = p.uint16; 16977 this.maxSizeOfInstructions = p.uint16; 16978 this.maxComponentElements = p.uint16; 16979 this.maxComponentDepth = p.uint16; 16980 } 16981 p.verifyLength(); 16982 } 16983 } 16984 var maxp$1 = Object.freeze( { __proto__: null, maxp: maxp } ); 16985 class lib_font_browser_name extends SimpleTable { 16986 constructor( dict, dataview ) { 16987 const { p: p } = super( dict, dataview ); 16988 this.format = p.uint16; 16989 this.count = p.uint16; 16990 this.stringOffset = p.Offset16; 16991 this.nameRecords = [ ...new Array( this.count ) ].map( 16992 ( _ ) => new NameRecord( p, this ) 16993 ); 16994 if ( this.format === 1 ) { 16995 this.langTagCount = p.uint16; 16996 this.langTagRecords = [ ...new Array( this.langTagCount ) ].map( 16997 ( _ ) => new LangTagRecord( p.uint16, p.Offset16 ) 16998 ); 16999 } 17000 this.stringStart = this.tableStart + this.stringOffset; 17001 } 17002 get( nameID ) { 17003 let record = this.nameRecords.find( 17004 ( record ) => record.nameID === nameID 17005 ); 17006 if ( record ) return record.string; 17007 } 17008 } 17009 class LangTagRecord { 17010 constructor( length, offset ) { 17011 this.length = length; 17012 this.offset = offset; 17013 } 17014 } 17015 class NameRecord { 17016 constructor( p, nameTable ) { 17017 this.platformID = p.uint16; 17018 this.encodingID = p.uint16; 17019 this.languageID = p.uint16; 17020 this.nameID = p.uint16; 17021 this.length = p.uint16; 17022 this.offset = p.Offset16; 17023 lazy$1( this, `string`, () => { 17024 p.currentPosition = nameTable.stringStart + this.offset; 17025 return decodeString( p, this ); 17026 } ); 17027 } 17028 } 17029 function decodeString( p, record ) { 17030 const { platformID: platformID, length: length } = record; 17031 if ( length === 0 ) return ``; 17032 if ( platformID === 0 || platformID === 3 ) { 17033 const str = []; 17034 for ( let i = 0, e = length / 2; i < e; i++ ) 17035 str[ i ] = String.fromCharCode( p.uint16 ); 17036 return str.join( `` ); 17037 } 17038 const bytes = p.readBytes( length ); 17039 const str = []; 17040 bytes.forEach( function ( b, i ) { 17041 str[ i ] = String.fromCharCode( b ); 17042 } ); 17043 return str.join( `` ); 17044 } 17045 var name$1 = Object.freeze( { __proto__: null, name: lib_font_browser_name } ); 17046 class OS2 extends SimpleTable { 17047 constructor( dict, dataview ) { 17048 const { p: p } = super( dict, dataview ); 17049 this.version = p.uint16; 17050 this.xAvgCharWidth = p.int16; 17051 this.usWeightClass = p.uint16; 17052 this.usWidthClass = p.uint16; 17053 this.fsType = p.uint16; 17054 this.ySubscriptXSize = p.int16; 17055 this.ySubscriptYSize = p.int16; 17056 this.ySubscriptXOffset = p.int16; 17057 this.ySubscriptYOffset = p.int16; 17058 this.ySuperscriptXSize = p.int16; 17059 this.ySuperscriptYSize = p.int16; 17060 this.ySuperscriptXOffset = p.int16; 17061 this.ySuperscriptYOffset = p.int16; 17062 this.yStrikeoutSize = p.int16; 17063 this.yStrikeoutPosition = p.int16; 17064 this.sFamilyClass = p.int16; 17065 this.panose = [ ...new Array( 10 ) ].map( ( _ ) => p.uint8 ); 17066 this.ulUnicodeRange1 = p.flags( 32 ); 17067 this.ulUnicodeRange2 = p.flags( 32 ); 17068 this.ulUnicodeRange3 = p.flags( 32 ); 17069 this.ulUnicodeRange4 = p.flags( 32 ); 17070 this.achVendID = p.tag; 17071 this.fsSelection = p.uint16; 17072 this.usFirstCharIndex = p.uint16; 17073 this.usLastCharIndex = p.uint16; 17074 this.sTypoAscender = p.int16; 17075 this.sTypoDescender = p.int16; 17076 this.sTypoLineGap = p.int16; 17077 this.usWinAscent = p.uint16; 17078 this.usWinDescent = p.uint16; 17079 if ( this.version === 0 ) return p.verifyLength(); 17080 this.ulCodePageRange1 = p.flags( 32 ); 17081 this.ulCodePageRange2 = p.flags( 32 ); 17082 if ( this.version === 1 ) return p.verifyLength(); 17083 this.sxHeight = p.int16; 17084 this.sCapHeight = p.int16; 17085 this.usDefaultChar = p.uint16; 17086 this.usBreakChar = p.uint16; 17087 this.usMaxContext = p.uint16; 17088 if ( this.version <= 4 ) return p.verifyLength(); 17089 this.usLowerOpticalPointSize = p.uint16; 17090 this.usUpperOpticalPointSize = p.uint16; 17091 if ( this.version === 5 ) return p.verifyLength(); 17092 } 17093 } 17094 var OS2$1 = Object.freeze( { __proto__: null, OS2: OS2 } ); 17095 class post extends SimpleTable { 17096 constructor( dict, dataview ) { 17097 const { p: p } = super( dict, dataview ); 17098 this.version = p.legacyFixed; 17099 this.italicAngle = p.fixed; 17100 this.underlinePosition = p.fword; 17101 this.underlineThickness = p.fword; 17102 this.isFixedPitch = p.uint32; 17103 this.minMemType42 = p.uint32; 17104 this.maxMemType42 = p.uint32; 17105 this.minMemType1 = p.uint32; 17106 this.maxMemType1 = p.uint32; 17107 if ( this.version === 1 || this.version === 3 ) return p.verifyLength(); 17108 this.numGlyphs = p.uint16; 17109 if ( this.version === 2 ) { 17110 this.glyphNameIndex = [ ...new Array( this.numGlyphs ) ].map( 17111 ( _ ) => p.uint16 17112 ); 17113 this.namesOffset = p.currentPosition; 17114 this.glyphNameOffsets = [ 1 ]; 17115 for ( let i = 0; i < this.numGlyphs; i++ ) { 17116 let index = this.glyphNameIndex[ i ]; 17117 if ( index < macStrings.length ) { 17118 this.glyphNameOffsets.push( this.glyphNameOffsets[ i ] ); 17119 continue; 17120 } 17121 let bytelength = p.int8; 17122 p.skip( bytelength ); 17123 this.glyphNameOffsets.push( 17124 this.glyphNameOffsets[ i ] + bytelength + 1 17125 ); 17126 } 17127 } 17128 if ( this.version === 2.5 ) { 17129 this.offset = [ ...new Array( this.numGlyphs ) ].map( 17130 ( _ ) => p.int8 17131 ); 17132 } 17133 } 17134 getGlyphName( glyphid ) { 17135 if ( this.version !== 2 ) { 17136 console.warn( 17137 `post table version ${ this.version } does not support glyph name lookups` 17138 ); 17139 return ``; 17140 } 17141 let index = this.glyphNameIndex[ glyphid ]; 17142 if ( index < 258 ) return macStrings[ index ]; 17143 let offset = this.glyphNameOffsets[ glyphid ]; 17144 let next = this.glyphNameOffsets[ glyphid + 1 ]; 17145 let len = next - offset - 1; 17146 if ( len === 0 ) return `.notdef.`; 17147 this.parser.currentPosition = this.namesOffset + offset; 17148 const data = this.parser.readBytes( 17149 len, 17150 this.namesOffset + offset, 17151 8, 17152 true 17153 ); 17154 return data.map( ( b ) => String.fromCharCode( b ) ).join( `` ); 17155 } 17156 } 17157 const macStrings = [ 17158 `.notdef`, 17159 `.null`, 17160 `nonmarkingreturn`, 17161 `space`, 17162 `exclam`, 17163 `quotedbl`, 17164 `numbersign`, 17165 `dollar`, 17166 `percent`, 17167 `ampersand`, 17168 `quotesingle`, 17169 `parenleft`, 17170 `parenright`, 17171 `asterisk`, 17172 `plus`, 17173 `comma`, 17174 `hyphen`, 17175 `period`, 17176 `slash`, 17177 `zero`, 17178 `one`, 17179 `two`, 17180 `three`, 17181 `four`, 17182 `five`, 17183 `six`, 17184 `seven`, 17185 `eight`, 17186 `nine`, 17187 `colon`, 17188 `semicolon`, 17189 `less`, 17190 `equal`, 17191 `greater`, 17192 `question`, 17193 `at`, 17194 `A`, 17195 `B`, 17196 `C`, 17197 `D`, 17198 `E`, 17199 `F`, 17200 `G`, 17201 `H`, 17202 `I`, 17203 `J`, 17204 `K`, 17205 `L`, 17206 `M`, 17207 `N`, 17208 `O`, 17209 `P`, 17210 `Q`, 17211 `R`, 17212 `S`, 17213 `T`, 17214 `U`, 17215 `V`, 17216 `W`, 17217 `X`, 17218 `Y`, 17219 `Z`, 17220 `bracketleft`, 17221 `backslash`, 17222 `bracketright`, 17223 `asciicircum`, 17224 `underscore`, 17225 `grave`, 17226 `a`, 17227 `b`, 17228 `c`, 17229 `d`, 17230 `e`, 17231 `f`, 17232 `g`, 17233 `h`, 17234 `i`, 17235 `j`, 17236 `k`, 17237 `l`, 17238 `m`, 17239 `n`, 17240 `o`, 17241 `p`, 17242 `q`, 17243 `r`, 17244 `s`, 17245 `t`, 17246 `u`, 17247 `v`, 17248 `w`, 17249 `x`, 17250 `y`, 17251 `z`, 17252 `braceleft`, 17253 `bar`, 17254 `braceright`, 17255 `asciitilde`, 17256 `Adieresis`, 17257 `Aring`, 17258 `Ccedilla`, 17259 `Eacute`, 17260 `Ntilde`, 17261 `Odieresis`, 17262 `Udieresis`, 17263 `aacute`, 17264 `agrave`, 17265 `acircumflex`, 17266 `adieresis`, 17267 `atilde`, 17268 `aring`, 17269 `ccedilla`, 17270 `eacute`, 17271 `egrave`, 17272 `ecircumflex`, 17273 `edieresis`, 17274 `iacute`, 17275 `igrave`, 17276 `icircumflex`, 17277 `idieresis`, 17278 `ntilde`, 17279 `oacute`, 17280 `ograve`, 17281 `ocircumflex`, 17282 `odieresis`, 17283 `otilde`, 17284 `uacute`, 17285 `ugrave`, 17286 `ucircumflex`, 17287 `udieresis`, 17288 `dagger`, 17289 `degree`, 17290 `cent`, 17291 `sterling`, 17292 `section`, 17293 `bullet`, 17294 `paragraph`, 17295 `germandbls`, 17296 `registered`, 17297 `copyright`, 17298 `trademark`, 17299 `acute`, 17300 `dieresis`, 17301 `notequal`, 17302 `AE`, 17303 `Oslash`, 17304 `infinity`, 17305 `plusminus`, 17306 `lessequal`, 17307 `greaterequal`, 17308 `yen`, 17309 `mu`, 17310 `partialdiff`, 17311 `summation`, 17312 `product`, 17313 `pi`, 17314 `integral`, 17315 `ordfeminine`, 17316 `ordmasculine`, 17317 `Omega`, 17318 `ae`, 17319 `oslash`, 17320 `questiondown`, 17321 `exclamdown`, 17322 `logicalnot`, 17323 `radical`, 17324 `florin`, 17325 `approxequal`, 17326 `Delta`, 17327 `guillemotleft`, 17328 `guillemotright`, 17329 `ellipsis`, 17330 `nonbreakingspace`, 17331 `Agrave`, 17332 `Atilde`, 17333 `Otilde`, 17334 `OE`, 17335 `oe`, 17336 `endash`, 17337 `emdash`, 17338 `quotedblleft`, 17339 `quotedblright`, 17340 `quoteleft`, 17341 `quoteright`, 17342 `divide`, 17343 `lozenge`, 17344 `ydieresis`, 17345 `Ydieresis`, 17346 `fraction`, 17347 `currency`, 17348 `guilsinglleft`, 17349 `guilsinglright`, 17350 `fi`, 17351 `fl`, 17352 `daggerdbl`, 17353 `periodcentered`, 17354 `quotesinglbase`, 17355 `quotedblbase`, 17356 `perthousand`, 17357 `Acircumflex`, 17358 `Ecircumflex`, 17359 `Aacute`, 17360 `Edieresis`, 17361 `Egrave`, 17362 `Iacute`, 17363 `Icircumflex`, 17364 `Idieresis`, 17365 `Igrave`, 17366 `Oacute`, 17367 `Ocircumflex`, 17368 `apple`, 17369 `Ograve`, 17370 `Uacute`, 17371 `Ucircumflex`, 17372 `Ugrave`, 17373 `dotlessi`, 17374 `circumflex`, 17375 `tilde`, 17376 `macron`, 17377 `breve`, 17378 `dotaccent`, 17379 `ring`, 17380 `cedilla`, 17381 `hungarumlaut`, 17382 `ogonek`, 17383 `caron`, 17384 `Lslash`, 17385 `lslash`, 17386 `Scaron`, 17387 `scaron`, 17388 `Zcaron`, 17389 `zcaron`, 17390 `brokenbar`, 17391 `Eth`, 17392 `eth`, 17393 `Yacute`, 17394 `yacute`, 17395 `Thorn`, 17396 `thorn`, 17397 `minus`, 17398 `multiply`, 17399 `onesuperior`, 17400 `twosuperior`, 17401 `threesuperior`, 17402 `onehalf`, 17403 `onequarter`, 17404 `threequarters`, 17405 `franc`, 17406 `Gbreve`, 17407 `gbreve`, 17408 `Idotaccent`, 17409 `Scedilla`, 17410 `scedilla`, 17411 `Cacute`, 17412 `cacute`, 17413 `Ccaron`, 17414 `ccaron`, 17415 `dcroat`, 17416 ]; 17417 var post$1 = Object.freeze( { __proto__: null, post: post } ); 17418 class BASE extends SimpleTable { 17419 constructor( dict, dataview ) { 17420 const { p: p } = super( dict, dataview ); 17421 this.majorVersion = p.uint16; 17422 this.minorVersion = p.uint16; 17423 this.horizAxisOffset = p.Offset16; 17424 this.vertAxisOffset = p.Offset16; 17425 lazy$1( 17426 this, 17427 `horizAxis`, 17428 () => 17429 new AxisTable( 17430 { offset: dict.offset + this.horizAxisOffset }, 17431 dataview 17432 ) 17433 ); 17434 lazy$1( 17435 this, 17436 `vertAxis`, 17437 () => 17438 new AxisTable( 17439 { offset: dict.offset + this.vertAxisOffset }, 17440 dataview 17441 ) 17442 ); 17443 if ( this.majorVersion === 1 && this.minorVersion === 1 ) { 17444 this.itemVarStoreOffset = p.Offset32; 17445 lazy$1( 17446 this, 17447 `itemVarStore`, 17448 () => 17449 new AxisTable( 17450 { offset: dict.offset + this.itemVarStoreOffset }, 17451 dataview 17452 ) 17453 ); 17454 } 17455 } 17456 } 17457 class AxisTable extends SimpleTable { 17458 constructor( dict, dataview ) { 17459 const { p: p } = super( dict, dataview, `AxisTable` ); 17460 this.baseTagListOffset = p.Offset16; 17461 this.baseScriptListOffset = p.Offset16; 17462 lazy$1( 17463 this, 17464 `baseTagList`, 17465 () => 17466 new BaseTagListTable( 17467 { offset: dict.offset + this.baseTagListOffset }, 17468 dataview 17469 ) 17470 ); 17471 lazy$1( 17472 this, 17473 `baseScriptList`, 17474 () => 17475 new BaseScriptListTable( 17476 { offset: dict.offset + this.baseScriptListOffset }, 17477 dataview 17478 ) 17479 ); 17480 } 17481 } 17482 class BaseTagListTable extends SimpleTable { 17483 constructor( dict, dataview ) { 17484 const { p: p } = super( dict, dataview, `BaseTagListTable` ); 17485 this.baseTagCount = p.uint16; 17486 this.baselineTags = [ ...new Array( this.baseTagCount ) ].map( 17487 ( _ ) => p.tag 17488 ); 17489 } 17490 } 17491 class BaseScriptListTable extends SimpleTable { 17492 constructor( dict, dataview ) { 17493 const { p: p } = super( dict, dataview, `BaseScriptListTable` ); 17494 this.baseScriptCount = p.uint16; 17495 const recordStart = p.currentPosition; 17496 lazy$1( this, `baseScriptRecords`, () => { 17497 p.currentPosition = recordStart; 17498 return [ ...new Array( this.baseScriptCount ) ].map( 17499 ( _ ) => new BaseScriptRecord( this.start, p ) 17500 ); 17501 } ); 17502 } 17503 } 17504 class BaseScriptRecord { 17505 constructor( baseScriptListTableStart, p ) { 17506 this.baseScriptTag = p.tag; 17507 this.baseScriptOffset = p.Offset16; 17508 lazy$1( this, `baseScriptTable`, () => { 17509 p.currentPosition = 17510 baseScriptListTableStart + this.baseScriptOffset; 17511 return new BaseScriptTable( p ); 17512 } ); 17513 } 17514 } 17515 class BaseScriptTable { 17516 constructor( p ) { 17517 this.start = p.currentPosition; 17518 this.baseValuesOffset = p.Offset16; 17519 this.defaultMinMaxOffset = p.Offset16; 17520 this.baseLangSysCount = p.uint16; 17521 this.baseLangSysRecords = [ ...new Array( this.baseLangSysCount ) ].map( 17522 ( _ ) => new BaseLangSysRecord( this.start, p ) 17523 ); 17524 lazy$1( this, `baseValues`, () => { 17525 p.currentPosition = this.start + this.baseValuesOffset; 17526 return new BaseValuesTable( p ); 17527 } ); 17528 lazy$1( this, `defaultMinMax`, () => { 17529 p.currentPosition = this.start + this.defaultMinMaxOffset; 17530 return new MinMaxTable( p ); 17531 } ); 17532 } 17533 } 17534 class BaseLangSysRecord { 17535 constructor( baseScriptTableStart, p ) { 17536 this.baseLangSysTag = p.tag; 17537 this.minMaxOffset = p.Offset16; 17538 lazy$1( this, `minMax`, () => { 17539 p.currentPosition = baseScriptTableStart + this.minMaxOffset; 17540 return new MinMaxTable( p ); 17541 } ); 17542 } 17543 } 17544 class BaseValuesTable { 17545 constructor( p ) { 17546 this.parser = p; 17547 this.start = p.currentPosition; 17548 this.defaultBaselineIndex = p.uint16; 17549 this.baseCoordCount = p.uint16; 17550 this.baseCoords = [ ...new Array( this.baseCoordCount ) ].map( 17551 ( _ ) => p.Offset16 17552 ); 17553 } 17554 getTable( id ) { 17555 this.parser.currentPosition = this.start + this.baseCoords[ id ]; 17556 return new BaseCoordTable( this.parser ); 17557 } 17558 } 17559 class MinMaxTable { 17560 constructor( p ) { 17561 this.minCoord = p.Offset16; 17562 this.maxCoord = p.Offset16; 17563 this.featMinMaxCount = p.uint16; 17564 const recordStart = p.currentPosition; 17565 lazy$1( this, `featMinMaxRecords`, () => { 17566 p.currentPosition = recordStart; 17567 return [ ...new Array( this.featMinMaxCount ) ].map( 17568 ( _ ) => new FeatMinMaxRecord( p ) 17569 ); 17570 } ); 17571 } 17572 } 17573 class FeatMinMaxRecord { 17574 constructor( p ) { 17575 this.featureTableTag = p.tag; 17576 this.minCoord = p.Offset16; 17577 this.maxCoord = p.Offset16; 17578 } 17579 } 17580 class BaseCoordTable { 17581 constructor( p ) { 17582 this.baseCoordFormat = p.uint16; 17583 this.coordinate = p.int16; 17584 if ( this.baseCoordFormat === 2 ) { 17585 this.referenceGlyph = p.uint16; 17586 this.baseCoordPoint = p.uint16; 17587 } 17588 if ( this.baseCoordFormat === 3 ) { 17589 this.deviceTable = p.Offset16; 17590 } 17591 } 17592 } 17593 var BASE$1 = Object.freeze( { __proto__: null, BASE: BASE } ); 17594 class ClassDefinition { 17595 constructor( p ) { 17596 this.classFormat = p.uint16; 17597 if ( this.classFormat === 1 ) { 17598 this.startGlyphID = p.uint16; 17599 this.glyphCount = p.uint16; 17600 this.classValueArray = [ ...new Array( this.glyphCount ) ].map( 17601 ( _ ) => p.uint16 17602 ); 17603 } 17604 if ( this.classFormat === 2 ) { 17605 this.classRangeCount = p.uint16; 17606 this.classRangeRecords = [ 17607 ...new Array( this.classRangeCount ), 17608 ].map( ( _ ) => new ClassRangeRecord( p ) ); 17609 } 17610 } 17611 } 17612 class ClassRangeRecord { 17613 constructor( p ) { 17614 this.startGlyphID = p.uint16; 17615 this.endGlyphID = p.uint16; 17616 this.class = p.uint16; 17617 } 17618 } 17619 class CoverageTable extends ParsedData { 17620 constructor( p ) { 17621 super( p ); 17622 this.coverageFormat = p.uint16; 17623 if ( this.coverageFormat === 1 ) { 17624 this.glyphCount = p.uint16; 17625 this.glyphArray = [ ...new Array( this.glyphCount ) ].map( 17626 ( _ ) => p.uint16 17627 ); 17628 } 17629 if ( this.coverageFormat === 2 ) { 17630 this.rangeCount = p.uint16; 17631 this.rangeRecords = [ ...new Array( this.rangeCount ) ].map( 17632 ( _ ) => new CoverageRangeRecord( p ) 17633 ); 17634 } 17635 } 17636 } 17637 class CoverageRangeRecord { 17638 constructor( p ) { 17639 this.startGlyphID = p.uint16; 17640 this.endGlyphID = p.uint16; 17641 this.startCoverageIndex = p.uint16; 17642 } 17643 } 17644 class ItemVariationStoreTable { 17645 constructor( table, p ) { 17646 this.table = table; 17647 this.parser = p; 17648 this.start = p.currentPosition; 17649 this.format = p.uint16; 17650 this.variationRegionListOffset = p.Offset32; 17651 this.itemVariationDataCount = p.uint16; 17652 this.itemVariationDataOffsets = [ 17653 ...new Array( this.itemVariationDataCount ), 17654 ].map( ( _ ) => p.Offset32 ); 17655 } 17656 } 17657 class GDEF extends SimpleTable { 17658 constructor( dict, dataview ) { 17659 const { p: p } = super( dict, dataview ); 17660 this.majorVersion = p.uint16; 17661 this.minorVersion = p.uint16; 17662 this.glyphClassDefOffset = p.Offset16; 17663 lazy$1( this, `glyphClassDefs`, () => { 17664 if ( this.glyphClassDefOffset === 0 ) return undefined; 17665 p.currentPosition = this.tableStart + this.glyphClassDefOffset; 17666 return new ClassDefinition( p ); 17667 } ); 17668 this.attachListOffset = p.Offset16; 17669 lazy$1( this, `attachList`, () => { 17670 if ( this.attachListOffset === 0 ) return undefined; 17671 p.currentPosition = this.tableStart + this.attachListOffset; 17672 return new AttachList( p ); 17673 } ); 17674 this.ligCaretListOffset = p.Offset16; 17675 lazy$1( this, `ligCaretList`, () => { 17676 if ( this.ligCaretListOffset === 0 ) return undefined; 17677 p.currentPosition = this.tableStart + this.ligCaretListOffset; 17678 return new LigCaretList( p ); 17679 } ); 17680 this.markAttachClassDefOffset = p.Offset16; 17681 lazy$1( this, `markAttachClassDef`, () => { 17682 if ( this.markAttachClassDefOffset === 0 ) return undefined; 17683 p.currentPosition = this.tableStart + this.markAttachClassDefOffset; 17684 return new ClassDefinition( p ); 17685 } ); 17686 if ( this.minorVersion >= 2 ) { 17687 this.markGlyphSetsDefOffset = p.Offset16; 17688 lazy$1( this, `markGlyphSetsDef`, () => { 17689 if ( this.markGlyphSetsDefOffset === 0 ) return undefined; 17690 p.currentPosition = 17691 this.tableStart + this.markGlyphSetsDefOffset; 17692 return new MarkGlyphSetsTable( p ); 17693 } ); 17694 } 17695 if ( this.minorVersion === 3 ) { 17696 this.itemVarStoreOffset = p.Offset32; 17697 lazy$1( this, `itemVarStore`, () => { 17698 if ( this.itemVarStoreOffset === 0 ) return undefined; 17699 p.currentPosition = this.tableStart + this.itemVarStoreOffset; 17700 return new ItemVariationStoreTable( p ); 17701 } ); 17702 } 17703 } 17704 } 17705 class AttachList extends ParsedData { 17706 constructor( p ) { 17707 super( p ); 17708 this.coverageOffset = p.Offset16; 17709 this.glyphCount = p.uint16; 17710 this.attachPointOffsets = [ ...new Array( this.glyphCount ) ].map( 17711 ( _ ) => p.Offset16 17712 ); 17713 } 17714 getPoint( pointID ) { 17715 this.parser.currentPosition = 17716 this.start + this.attachPointOffsets[ pointID ]; 17717 return new AttachPoint( this.parser ); 17718 } 17719 } 17720 class AttachPoint { 17721 constructor( p ) { 17722 this.pointCount = p.uint16; 17723 this.pointIndices = [ ...new Array( this.pointCount ) ].map( 17724 ( _ ) => p.uint16 17725 ); 17726 } 17727 } 17728 class LigCaretList extends ParsedData { 17729 constructor( p ) { 17730 super( p ); 17731 this.coverageOffset = p.Offset16; 17732 lazy$1( this, `coverage`, () => { 17733 p.currentPosition = this.start + this.coverageOffset; 17734 return new CoverageTable( p ); 17735 } ); 17736 this.ligGlyphCount = p.uint16; 17737 this.ligGlyphOffsets = [ ...new Array( this.ligGlyphCount ) ].map( 17738 ( _ ) => p.Offset16 17739 ); 17740 } 17741 getLigGlyph( ligGlyphID ) { 17742 this.parser.currentPosition = 17743 this.start + this.ligGlyphOffsets[ ligGlyphID ]; 17744 return new LigGlyph( this.parser ); 17745 } 17746 } 17747 class LigGlyph extends ParsedData { 17748 constructor( p ) { 17749 super( p ); 17750 this.caretCount = p.uint16; 17751 this.caretValueOffsets = [ ...new Array( this.caretCount ) ].map( 17752 ( _ ) => p.Offset16 17753 ); 17754 } 17755 getCaretValue( caretID ) { 17756 this.parser.currentPosition = 17757 this.start + this.caretValueOffsets[ caretID ]; 17758 return new CaretValue( this.parser ); 17759 } 17760 } 17761 class CaretValue { 17762 constructor( p ) { 17763 this.caretValueFormat = p.uint16; 17764 if ( this.caretValueFormat === 1 ) { 17765 this.coordinate = p.int16; 17766 } 17767 if ( this.caretValueFormat === 2 ) { 17768 this.caretValuePointIndex = p.uint16; 17769 } 17770 if ( this.caretValueFormat === 3 ) { 17771 this.coordinate = p.int16; 17772 this.deviceOffset = p.Offset16; 17773 } 17774 } 17775 } 17776 class MarkGlyphSetsTable extends ParsedData { 17777 constructor( p ) { 17778 super( p ); 17779 this.markGlyphSetTableFormat = p.uint16; 17780 this.markGlyphSetCount = p.uint16; 17781 this.coverageOffsets = [ ...new Array( this.markGlyphSetCount ) ].map( 17782 ( _ ) => p.Offset32 17783 ); 17784 } 17785 getMarkGlyphSet( markGlyphSetID ) { 17786 this.parser.currentPosition = 17787 this.start + this.coverageOffsets[ markGlyphSetID ]; 17788 return new CoverageTable( this.parser ); 17789 } 17790 } 17791 var GDEF$1 = Object.freeze( { __proto__: null, GDEF: GDEF } ); 17792 class ScriptList extends ParsedData { 17793 static EMPTY = { scriptCount: 0, scriptRecords: [] }; 17794 constructor( p ) { 17795 super( p ); 17796 this.scriptCount = p.uint16; 17797 this.scriptRecords = [ ...new Array( this.scriptCount ) ].map( 17798 ( _ ) => new ScriptRecord( p ) 17799 ); 17800 } 17801 } 17802 class ScriptRecord { 17803 constructor( p ) { 17804 this.scriptTag = p.tag; 17805 this.scriptOffset = p.Offset16; 17806 } 17807 } 17808 class ScriptTable extends ParsedData { 17809 constructor( p ) { 17810 super( p ); 17811 this.defaultLangSys = p.Offset16; 17812 this.langSysCount = p.uint16; 17813 this.langSysRecords = [ ...new Array( this.langSysCount ) ].map( 17814 ( _ ) => new LangSysRecord( p ) 17815 ); 17816 } 17817 } 17818 class LangSysRecord { 17819 constructor( p ) { 17820 this.langSysTag = p.tag; 17821 this.langSysOffset = p.Offset16; 17822 } 17823 } 17824 class LangSysTable { 17825 constructor( p ) { 17826 this.lookupOrder = p.Offset16; 17827 this.requiredFeatureIndex = p.uint16; 17828 this.featureIndexCount = p.uint16; 17829 this.featureIndices = [ ...new Array( this.featureIndexCount ) ].map( 17830 ( _ ) => p.uint16 17831 ); 17832 } 17833 } 17834 class FeatureList extends ParsedData { 17835 static EMPTY = { featureCount: 0, featureRecords: [] }; 17836 constructor( p ) { 17837 super( p ); 17838 this.featureCount = p.uint16; 17839 this.featureRecords = [ ...new Array( this.featureCount ) ].map( 17840 ( _ ) => new FeatureRecord( p ) 17841 ); 17842 } 17843 } 17844 class FeatureRecord { 17845 constructor( p ) { 17846 this.featureTag = p.tag; 17847 this.featureOffset = p.Offset16; 17848 } 17849 } 17850 class FeatureTable extends ParsedData { 17851 constructor( p ) { 17852 super( p ); 17853 this.featureParams = p.Offset16; 17854 this.lookupIndexCount = p.uint16; 17855 this.lookupListIndices = [ ...new Array( this.lookupIndexCount ) ].map( 17856 ( _ ) => p.uint16 17857 ); 17858 } 17859 getFeatureParams() { 17860 if ( this.featureParams > 0 ) { 17861 const p = this.parser; 17862 p.currentPosition = this.start + this.featureParams; 17863 const tag = this.featureTag; 17864 if ( tag === `size` ) return new Size( p ); 17865 if ( tag.startsWith( `cc` ) ) return new CharacterVariant( p ); 17866 if ( tag.startsWith( `ss` ) ) return new StylisticSet( p ); 17867 } 17868 } 17869 } 17870 class CharacterVariant { 17871 constructor( p ) { 17872 this.format = p.uint16; 17873 this.featUiLabelNameId = p.uint16; 17874 this.featUiTooltipTextNameId = p.uint16; 17875 this.sampleTextNameId = p.uint16; 17876 this.numNamedParameters = p.uint16; 17877 this.firstParamUiLabelNameId = p.uint16; 17878 this.charCount = p.uint16; 17879 this.character = [ ...new Array( this.charCount ) ].map( 17880 ( _ ) => p.uint24 17881 ); 17882 } 17883 } 17884 class Size { 17885 constructor( p ) { 17886 this.designSize = p.uint16; 17887 this.subfamilyIdentifier = p.uint16; 17888 this.subfamilyNameID = p.uint16; 17889 this.smallEnd = p.uint16; 17890 this.largeEnd = p.uint16; 17891 } 17892 } 17893 class StylisticSet { 17894 constructor( p ) { 17895 this.version = p.uint16; 17896 this.UINameID = p.uint16; 17897 } 17898 } 17899 function undoCoverageOffsetParsing( instance ) { 17900 instance.parser.currentPosition -= 2; 17901 delete instance.coverageOffset; 17902 delete instance.getCoverageTable; 17903 } 17904 class LookupType$1 extends ParsedData { 17905 constructor( p ) { 17906 super( p ); 17907 this.substFormat = p.uint16; 17908 this.coverageOffset = p.Offset16; 17909 } 17910 getCoverageTable() { 17911 let p = this.parser; 17912 p.currentPosition = this.start + this.coverageOffset; 17913 return new CoverageTable( p ); 17914 } 17915 } 17916 class SubstLookupRecord { 17917 constructor( p ) { 17918 this.glyphSequenceIndex = p.uint16; 17919 this.lookupListIndex = p.uint16; 17920 } 17921 } 17922 class LookupType1$1 extends LookupType$1 { 17923 constructor( p ) { 17924 super( p ); 17925 this.deltaGlyphID = p.int16; 17926 } 17927 } 17928 class LookupType2$1 extends LookupType$1 { 17929 constructor( p ) { 17930 super( p ); 17931 this.sequenceCount = p.uint16; 17932 this.sequenceOffsets = [ ...new Array( this.sequenceCount ) ].map( 17933 ( _ ) => p.Offset16 17934 ); 17935 } 17936 getSequence( index ) { 17937 let p = this.parser; 17938 p.currentPosition = this.start + this.sequenceOffsets[ index ]; 17939 return new SequenceTable( p ); 17940 } 17941 } 17942 class SequenceTable { 17943 constructor( p ) { 17944 this.glyphCount = p.uint16; 17945 this.substituteGlyphIDs = [ ...new Array( this.glyphCount ) ].map( 17946 ( _ ) => p.uint16 17947 ); 17948 } 17949 } 17950 class LookupType3$1 extends LookupType$1 { 17951 constructor( p ) { 17952 super( p ); 17953 this.alternateSetCount = p.uint16; 17954 this.alternateSetOffsets = [ 17955 ...new Array( this.alternateSetCount ), 17956 ].map( ( _ ) => p.Offset16 ); 17957 } 17958 getAlternateSet( index ) { 17959 let p = this.parser; 17960 p.currentPosition = this.start + this.alternateSetOffsets[ index ]; 17961 return new AlternateSetTable( p ); 17962 } 17963 } 17964 class AlternateSetTable { 17965 constructor( p ) { 17966 this.glyphCount = p.uint16; 17967 this.alternateGlyphIDs = [ ...new Array( this.glyphCount ) ].map( 17968 ( _ ) => p.uint16 17969 ); 17970 } 17971 } 17972 class LookupType4$1 extends LookupType$1 { 17973 constructor( p ) { 17974 super( p ); 17975 this.ligatureSetCount = p.uint16; 17976 this.ligatureSetOffsets = [ ...new Array( this.ligatureSetCount ) ].map( 17977 ( _ ) => p.Offset16 17978 ); 17979 } 17980 getLigatureSet( index ) { 17981 let p = this.parser; 17982 p.currentPosition = this.start + this.ligatureSetOffsets[ index ]; 17983 return new LigatureSetTable( p ); 17984 } 17985 } 17986 class LigatureSetTable extends ParsedData { 17987 constructor( p ) { 17988 super( p ); 17989 this.ligatureCount = p.uint16; 17990 this.ligatureOffsets = [ ...new Array( this.ligatureCount ) ].map( 17991 ( _ ) => p.Offset16 17992 ); 17993 } 17994 getLigature( index ) { 17995 let p = this.parser; 17996 p.currentPosition = this.start + this.ligatureOffsets[ index ]; 17997 return new LigatureTable( p ); 17998 } 17999 } 18000 class LigatureTable { 18001 constructor( p ) { 18002 this.ligatureGlyph = p.uint16; 18003 this.componentCount = p.uint16; 18004 this.componentGlyphIDs = [ 18005 ...new Array( this.componentCount - 1 ), 18006 ].map( ( _ ) => p.uint16 ); 18007 } 18008 } 18009 class LookupType5$1 extends LookupType$1 { 18010 constructor( p ) { 18011 super( p ); 18012 if ( this.substFormat === 1 ) { 18013 this.subRuleSetCount = p.uint16; 18014 this.subRuleSetOffsets = [ 18015 ...new Array( this.subRuleSetCount ), 18016 ].map( ( _ ) => p.Offset16 ); 18017 } 18018 if ( this.substFormat === 2 ) { 18019 this.classDefOffset = p.Offset16; 18020 this.subClassSetCount = p.uint16; 18021 this.subClassSetOffsets = [ 18022 ...new Array( this.subClassSetCount ), 18023 ].map( ( _ ) => p.Offset16 ); 18024 } 18025 if ( this.substFormat === 3 ) { 18026 undoCoverageOffsetParsing( this ); 18027 this.glyphCount = p.uint16; 18028 this.substitutionCount = p.uint16; 18029 this.coverageOffsets = [ ...new Array( this.glyphCount ) ].map( 18030 ( _ ) => p.Offset16 18031 ); 18032 this.substLookupRecords = [ 18033 ...new Array( this.substitutionCount ), 18034 ].map( ( _ ) => new SubstLookupRecord( p ) ); 18035 } 18036 } 18037 getSubRuleSet( index ) { 18038 if ( this.substFormat !== 1 ) 18039 throw new Error( 18040 `lookup type 5.${ this.substFormat } has no subrule sets.` 18041 ); 18042 let p = this.parser; 18043 p.currentPosition = this.start + this.subRuleSetOffsets[ index ]; 18044 return new SubRuleSetTable( p ); 18045 } 18046 getSubClassSet( index ) { 18047 if ( this.substFormat !== 2 ) 18048 throw new Error( 18049 `lookup type 5.${ this.substFormat } has no subclass sets.` 18050 ); 18051 let p = this.parser; 18052 p.currentPosition = this.start + this.subClassSetOffsets[ index ]; 18053 return new SubClassSetTable( p ); 18054 } 18055 getCoverageTable( index ) { 18056 if ( this.substFormat !== 3 && ! index ) 18057 return super.getCoverageTable(); 18058 if ( ! index ) 18059 throw new Error( 18060 `lookup type 5.${ this.substFormat } requires an coverage table index.` 18061 ); 18062 let p = this.parser; 18063 p.currentPosition = this.start + this.coverageOffsets[ index ]; 18064 return new CoverageTable( p ); 18065 } 18066 } 18067 class SubRuleSetTable extends ParsedData { 18068 constructor( p ) { 18069 super( p ); 18070 this.subRuleCount = p.uint16; 18071 this.subRuleOffsets = [ ...new Array( this.subRuleCount ) ].map( 18072 ( _ ) => p.Offset16 18073 ); 18074 } 18075 getSubRule( index ) { 18076 let p = this.parser; 18077 p.currentPosition = this.start + this.subRuleOffsets[ index ]; 18078 return new SubRuleTable( p ); 18079 } 18080 } 18081 class SubRuleTable { 18082 constructor( p ) { 18083 this.glyphCount = p.uint16; 18084 this.substitutionCount = p.uint16; 18085 this.inputSequence = [ ...new Array( this.glyphCount - 1 ) ].map( 18086 ( _ ) => p.uint16 18087 ); 18088 this.substLookupRecords = [ 18089 ...new Array( this.substitutionCount ), 18090 ].map( ( _ ) => new SubstLookupRecord( p ) ); 18091 } 18092 } 18093 class SubClassSetTable extends ParsedData { 18094 constructor( p ) { 18095 super( p ); 18096 this.subClassRuleCount = p.uint16; 18097 this.subClassRuleOffsets = [ 18098 ...new Array( this.subClassRuleCount ), 18099 ].map( ( _ ) => p.Offset16 ); 18100 } 18101 getSubClass( index ) { 18102 let p = this.parser; 18103 p.currentPosition = this.start + this.subClassRuleOffsets[ index ]; 18104 return new SubClassRuleTable( p ); 18105 } 18106 } 18107 class SubClassRuleTable extends SubRuleTable { 18108 constructor( p ) { 18109 super( p ); 18110 } 18111 } 18112 class LookupType6$1 extends LookupType$1 { 18113 constructor( p ) { 18114 super( p ); 18115 if ( this.substFormat === 1 ) { 18116 this.chainSubRuleSetCount = p.uint16; 18117 this.chainSubRuleSetOffsets = [ 18118 ...new Array( this.chainSubRuleSetCount ), 18119 ].map( ( _ ) => p.Offset16 ); 18120 } 18121 if ( this.substFormat === 2 ) { 18122 this.backtrackClassDefOffset = p.Offset16; 18123 this.inputClassDefOffset = p.Offset16; 18124 this.lookaheadClassDefOffset = p.Offset16; 18125 this.chainSubClassSetCount = p.uint16; 18126 this.chainSubClassSetOffsets = [ 18127 ...new Array( this.chainSubClassSetCount ), 18128 ].map( ( _ ) => p.Offset16 ); 18129 } 18130 if ( this.substFormat === 3 ) { 18131 undoCoverageOffsetParsing( this ); 18132 this.backtrackGlyphCount = p.uint16; 18133 this.backtrackCoverageOffsets = [ 18134 ...new Array( this.backtrackGlyphCount ), 18135 ].map( ( _ ) => p.Offset16 ); 18136 this.inputGlyphCount = p.uint16; 18137 this.inputCoverageOffsets = [ 18138 ...new Array( this.inputGlyphCount ), 18139 ].map( ( _ ) => p.Offset16 ); 18140 this.lookaheadGlyphCount = p.uint16; 18141 this.lookaheadCoverageOffsets = [ 18142 ...new Array( this.lookaheadGlyphCount ), 18143 ].map( ( _ ) => p.Offset16 ); 18144 this.seqLookupCount = p.uint16; 18145 this.seqLookupRecords = [ 18146 ...new Array( this.substitutionCount ), 18147 ].map( ( _ ) => new SequenceLookupRecord( p ) ); 18148 } 18149 } 18150 getChainSubRuleSet( index ) { 18151 if ( this.substFormat !== 1 ) 18152 throw new Error( 18153 `lookup type 6.${ this.substFormat } has no chainsubrule sets.` 18154 ); 18155 let p = this.parser; 18156 p.currentPosition = this.start + this.chainSubRuleSetOffsets[ index ]; 18157 return new ChainSubRuleSetTable( p ); 18158 } 18159 getChainSubClassSet( index ) { 18160 if ( this.substFormat !== 2 ) 18161 throw new Error( 18162 `lookup type 6.${ this.substFormat } has no chainsubclass sets.` 18163 ); 18164 let p = this.parser; 18165 p.currentPosition = this.start + this.chainSubClassSetOffsets[ index ]; 18166 return new ChainSubClassSetTable( p ); 18167 } 18168 getCoverageFromOffset( offset ) { 18169 if ( this.substFormat !== 3 ) 18170 throw new Error( 18171 `lookup type 6.${ this.substFormat } does not use contextual coverage offsets.` 18172 ); 18173 let p = this.parser; 18174 p.currentPosition = this.start + offset; 18175 return new CoverageTable( p ); 18176 } 18177 } 18178 class ChainSubRuleSetTable extends ParsedData { 18179 constructor( p ) { 18180 super( p ); 18181 this.chainSubRuleCount = p.uint16; 18182 this.chainSubRuleOffsets = [ 18183 ...new Array( this.chainSubRuleCount ), 18184 ].map( ( _ ) => p.Offset16 ); 18185 } 18186 getSubRule( index ) { 18187 let p = this.parser; 18188 p.currentPosition = this.start + this.chainSubRuleOffsets[ index ]; 18189 return new ChainSubRuleTable( p ); 18190 } 18191 } 18192 class ChainSubRuleTable { 18193 constructor( p ) { 18194 this.backtrackGlyphCount = p.uint16; 18195 this.backtrackSequence = [ 18196 ...new Array( this.backtrackGlyphCount ), 18197 ].map( ( _ ) => p.uint16 ); 18198 this.inputGlyphCount = p.uint16; 18199 this.inputSequence = [ ...new Array( this.inputGlyphCount - 1 ) ].map( 18200 ( _ ) => p.uint16 18201 ); 18202 this.lookaheadGlyphCount = p.uint16; 18203 this.lookAheadSequence = [ 18204 ...new Array( this.lookAheadGlyphCount ), 18205 ].map( ( _ ) => p.uint16 ); 18206 this.substitutionCount = p.uint16; 18207 this.substLookupRecords = [ ...new Array( this.SubstCount ) ].map( 18208 ( _ ) => new SubstLookupRecord( p ) 18209 ); 18210 } 18211 } 18212 class ChainSubClassSetTable extends ParsedData { 18213 constructor( p ) { 18214 super( p ); 18215 this.chainSubClassRuleCount = p.uint16; 18216 this.chainSubClassRuleOffsets = [ 18217 ...new Array( this.chainSubClassRuleCount ), 18218 ].map( ( _ ) => p.Offset16 ); 18219 } 18220 getSubClass( index ) { 18221 let p = this.parser; 18222 p.currentPosition = this.start + this.chainSubRuleOffsets[ index ]; 18223 return new ChainSubClassRuleTable( p ); 18224 } 18225 } 18226 class ChainSubClassRuleTable { 18227 constructor( p ) { 18228 this.backtrackGlyphCount = p.uint16; 18229 this.backtrackSequence = [ 18230 ...new Array( this.backtrackGlyphCount ), 18231 ].map( ( _ ) => p.uint16 ); 18232 this.inputGlyphCount = p.uint16; 18233 this.inputSequence = [ ...new Array( this.inputGlyphCount - 1 ) ].map( 18234 ( _ ) => p.uint16 18235 ); 18236 this.lookaheadGlyphCount = p.uint16; 18237 this.lookAheadSequence = [ 18238 ...new Array( this.lookAheadGlyphCount ), 18239 ].map( ( _ ) => p.uint16 ); 18240 this.substitutionCount = p.uint16; 18241 this.substLookupRecords = [ 18242 ...new Array( this.substitutionCount ), 18243 ].map( ( _ ) => new SequenceLookupRecord( p ) ); 18244 } 18245 } 18246 class SequenceLookupRecord extends ParsedData { 18247 constructor( p ) { 18248 super( p ); 18249 this.sequenceIndex = p.uint16; 18250 this.lookupListIndex = p.uint16; 18251 } 18252 } 18253 class LookupType7$1 extends ParsedData { 18254 constructor( p ) { 18255 super( p ); 18256 this.substFormat = p.uint16; 18257 this.extensionLookupType = p.uint16; 18258 this.extensionOffset = p.Offset32; 18259 } 18260 } 18261 class LookupType8$1 extends LookupType$1 { 18262 constructor( p ) { 18263 super( p ); 18264 this.backtrackGlyphCount = p.uint16; 18265 this.backtrackCoverageOffsets = [ 18266 ...new Array( this.backtrackGlyphCount ), 18267 ].map( ( _ ) => p.Offset16 ); 18268 this.lookaheadGlyphCount = p.uint16; 18269 this.lookaheadCoverageOffsets = [ 18270 new Array( this.lookaheadGlyphCount ), 18271 ].map( ( _ ) => p.Offset16 ); 18272 this.glyphCount = p.uint16; 18273 this.substituteGlyphIDs = [ ...new Array( this.glyphCount ) ].map( 18274 ( _ ) => p.uint16 18275 ); 18276 } 18277 } 18278 var GSUBtables = { 18279 buildSubtable: function ( type, p ) { 18280 const subtable = new [ 18281 undefined, 18282 LookupType1$1, 18283 LookupType2$1, 18284 LookupType3$1, 18285 LookupType4$1, 18286 LookupType5$1, 18287 LookupType6$1, 18288 LookupType7$1, 18289 LookupType8$1, 18290 ][ type ]( p ); 18291 subtable.type = type; 18292 return subtable; 18293 }, 18294 }; 18295 class LookupType extends ParsedData { 18296 constructor( p ) { 18297 super( p ); 18298 } 18299 } 18300 class LookupType1 extends LookupType { 18301 constructor( p ) { 18302 super( p ); 18303 console.log( `lookup type 1` ); 18304 } 18305 } 18306 class LookupType2 extends LookupType { 18307 constructor( p ) { 18308 super( p ); 18309 console.log( `lookup type 2` ); 18310 } 18311 } 18312 class LookupType3 extends LookupType { 18313 constructor( p ) { 18314 super( p ); 18315 console.log( `lookup type 3` ); 18316 } 18317 } 18318 class LookupType4 extends LookupType { 18319 constructor( p ) { 18320 super( p ); 18321 console.log( `lookup type 4` ); 18322 } 18323 } 18324 class LookupType5 extends LookupType { 18325 constructor( p ) { 18326 super( p ); 18327 console.log( `lookup type 5` ); 18328 } 18329 } 18330 class LookupType6 extends LookupType { 18331 constructor( p ) { 18332 super( p ); 18333 console.log( `lookup type 6` ); 18334 } 18335 } 18336 class LookupType7 extends LookupType { 18337 constructor( p ) { 18338 super( p ); 18339 console.log( `lookup type 7` ); 18340 } 18341 } 18342 class LookupType8 extends LookupType { 18343 constructor( p ) { 18344 super( p ); 18345 console.log( `lookup type 8` ); 18346 } 18347 } 18348 class LookupType9 extends LookupType { 18349 constructor( p ) { 18350 super( p ); 18351 console.log( `lookup type 9` ); 18352 } 18353 } 18354 var GPOStables = { 18355 buildSubtable: function ( type, p ) { 18356 const subtable = new [ 18357 undefined, 18358 LookupType1, 18359 LookupType2, 18360 LookupType3, 18361 LookupType4, 18362 LookupType5, 18363 LookupType6, 18364 LookupType7, 18365 LookupType8, 18366 LookupType9, 18367 ][ type ]( p ); 18368 subtable.type = type; 18369 return subtable; 18370 }, 18371 }; 18372 class LookupList extends ParsedData { 18373 static EMPTY = { lookupCount: 0, lookups: [] }; 18374 constructor( p ) { 18375 super( p ); 18376 this.lookupCount = p.uint16; 18377 this.lookups = [ ...new Array( this.lookupCount ) ].map( 18378 ( _ ) => p.Offset16 18379 ); 18380 } 18381 } 18382 class LookupTable extends ParsedData { 18383 constructor( p, type ) { 18384 super( p ); 18385 this.ctType = type; 18386 this.lookupType = p.uint16; 18387 this.lookupFlag = p.uint16; 18388 this.subTableCount = p.uint16; 18389 this.subtableOffsets = [ ...new Array( this.subTableCount ) ].map( 18390 ( _ ) => p.Offset16 18391 ); 18392 this.markFilteringSet = p.uint16; 18393 } 18394 get rightToLeft() { 18395 return this.lookupFlag & ( 1 === 1 ); 18396 } 18397 get ignoreBaseGlyphs() { 18398 return this.lookupFlag & ( 2 === 2 ); 18399 } 18400 get ignoreLigatures() { 18401 return this.lookupFlag & ( 4 === 4 ); 18402 } 18403 get ignoreMarks() { 18404 return this.lookupFlag & ( 8 === 8 ); 18405 } 18406 get useMarkFilteringSet() { 18407 return this.lookupFlag & ( 16 === 16 ); 18408 } 18409 get markAttachmentType() { 18410 return this.lookupFlag & ( 65280 === 65280 ); 18411 } 18412 getSubTable( index ) { 18413 const builder = this.ctType === `GSUB` ? GSUBtables : GPOStables; 18414 this.parser.currentPosition = 18415 this.start + this.subtableOffsets[ index ]; 18416 return builder.buildSubtable( this.lookupType, this.parser ); 18417 } 18418 } 18419 class CommonLayoutTable extends SimpleTable { 18420 constructor( dict, dataview, name ) { 18421 const { p: p, tableStart: tableStart } = super( dict, dataview, name ); 18422 this.majorVersion = p.uint16; 18423 this.minorVersion = p.uint16; 18424 this.scriptListOffset = p.Offset16; 18425 this.featureListOffset = p.Offset16; 18426 this.lookupListOffset = p.Offset16; 18427 if ( this.majorVersion === 1 && this.minorVersion === 1 ) { 18428 this.featureVariationsOffset = p.Offset32; 18429 } 18430 const no_content = ! ( 18431 this.scriptListOffset || 18432 this.featureListOffset || 18433 this.lookupListOffset 18434 ); 18435 lazy$1( this, `scriptList`, () => { 18436 if ( no_content ) return ScriptList.EMPTY; 18437 p.currentPosition = tableStart + this.scriptListOffset; 18438 return new ScriptList( p ); 18439 } ); 18440 lazy$1( this, `featureList`, () => { 18441 if ( no_content ) return FeatureList.EMPTY; 18442 p.currentPosition = tableStart + this.featureListOffset; 18443 return new FeatureList( p ); 18444 } ); 18445 lazy$1( this, `lookupList`, () => { 18446 if ( no_content ) return LookupList.EMPTY; 18447 p.currentPosition = tableStart + this.lookupListOffset; 18448 return new LookupList( p ); 18449 } ); 18450 if ( this.featureVariationsOffset ) { 18451 lazy$1( this, `featureVariations`, () => { 18452 if ( no_content ) return FeatureVariations.EMPTY; 18453 p.currentPosition = tableStart + this.featureVariationsOffset; 18454 return new FeatureVariations( p ); 18455 } ); 18456 } 18457 } 18458 getSupportedScripts() { 18459 return this.scriptList.scriptRecords.map( ( r ) => r.scriptTag ); 18460 } 18461 getScriptTable( scriptTag ) { 18462 let record = this.scriptList.scriptRecords.find( 18463 ( r ) => r.scriptTag === scriptTag 18464 ); 18465 this.parser.currentPosition = 18466 this.scriptList.start + record.scriptOffset; 18467 let table = new ScriptTable( this.parser ); 18468 table.scriptTag = scriptTag; 18469 return table; 18470 } 18471 ensureScriptTable( arg ) { 18472 if ( typeof arg === 'string' ) { 18473 return this.getScriptTable( arg ); 18474 } 18475 return arg; 18476 } 18477 getSupportedLangSys( scriptTable ) { 18478 scriptTable = this.ensureScriptTable( scriptTable ); 18479 const hasDefault = scriptTable.defaultLangSys !== 0; 18480 const supported = scriptTable.langSysRecords.map( 18481 ( l ) => l.langSysTag 18482 ); 18483 if ( hasDefault ) supported.unshift( `dflt` ); 18484 return supported; 18485 } 18486 getDefaultLangSysTable( scriptTable ) { 18487 scriptTable = this.ensureScriptTable( scriptTable ); 18488 let offset = scriptTable.defaultLangSys; 18489 if ( offset !== 0 ) { 18490 this.parser.currentPosition = scriptTable.start + offset; 18491 let table = new LangSysTable( this.parser ); 18492 table.langSysTag = ``; 18493 table.defaultForScript = scriptTable.scriptTag; 18494 return table; 18495 } 18496 } 18497 getLangSysTable( scriptTable, langSysTag = `dflt` ) { 18498 if ( langSysTag === `dflt` ) 18499 return this.getDefaultLangSysTable( scriptTable ); 18500 scriptTable = this.ensureScriptTable( scriptTable ); 18501 let record = scriptTable.langSysRecords.find( 18502 ( l ) => l.langSysTag === langSysTag 18503 ); 18504 this.parser.currentPosition = scriptTable.start + record.langSysOffset; 18505 let table = new LangSysTable( this.parser ); 18506 table.langSysTag = langSysTag; 18507 return table; 18508 } 18509 getFeatures( langSysTable ) { 18510 return langSysTable.featureIndices.map( ( index ) => 18511 this.getFeature( index ) 18512 ); 18513 } 18514 getFeature( indexOrTag ) { 18515 let record; 18516 if ( parseInt( indexOrTag ) == indexOrTag ) { 18517 record = this.featureList.featureRecords[ indexOrTag ]; 18518 } else { 18519 record = this.featureList.featureRecords.find( 18520 ( f ) => f.featureTag === indexOrTag 18521 ); 18522 } 18523 if ( ! record ) return; 18524 this.parser.currentPosition = 18525 this.featureList.start + record.featureOffset; 18526 let table = new FeatureTable( this.parser ); 18527 table.featureTag = record.featureTag; 18528 return table; 18529 } 18530 getLookups( featureTable ) { 18531 return featureTable.lookupListIndices.map( ( index ) => 18532 this.getLookup( index ) 18533 ); 18534 } 18535 getLookup( lookupIndex, type ) { 18536 let lookupOffset = this.lookupList.lookups[ lookupIndex ]; 18537 this.parser.currentPosition = this.lookupList.start + lookupOffset; 18538 return new LookupTable( this.parser, type ); 18539 } 18540 } 18541 class GSUB extends CommonLayoutTable { 18542 constructor( dict, dataview ) { 18543 super( dict, dataview, `GSUB` ); 18544 } 18545 getLookup( lookupIndex ) { 18546 return super.getLookup( lookupIndex, `GSUB` ); 18547 } 18548 } 18549 var GSUB$1 = Object.freeze( { __proto__: null, GSUB: GSUB } ); 18550 class GPOS extends CommonLayoutTable { 18551 constructor( dict, dataview ) { 18552 super( dict, dataview, `GPOS` ); 18553 } 18554 getLookup( lookupIndex ) { 18555 return super.getLookup( lookupIndex, `GPOS` ); 18556 } 18557 } 18558 var GPOS$1 = Object.freeze( { __proto__: null, GPOS: GPOS } ); 18559 class SVG extends SimpleTable { 18560 constructor( dict, dataview ) { 18561 const { p: p } = super( dict, dataview ); 18562 this.version = p.uint16; 18563 this.offsetToSVGDocumentList = p.Offset32; 18564 p.currentPosition = this.tableStart + this.offsetToSVGDocumentList; 18565 this.documentList = new SVGDocumentList( p ); 18566 } 18567 } 18568 class SVGDocumentList extends ParsedData { 18569 constructor( p ) { 18570 super( p ); 18571 this.numEntries = p.uint16; 18572 this.documentRecords = [ ...new Array( this.numEntries ) ].map( 18573 ( _ ) => new SVGDocumentRecord( p ) 18574 ); 18575 } 18576 getDocument( documentID ) { 18577 let record = this.documentRecords[ documentID ]; 18578 if ( ! record ) return ''; 18579 let offset = this.start + record.svgDocOffset; 18580 this.parser.currentPosition = offset; 18581 return this.parser.readBytes( record.svgDocLength ); 18582 } 18583 getDocumentForGlyph( glyphID ) { 18584 let id = this.documentRecords.findIndex( 18585 ( d ) => d.startGlyphID <= glyphID && glyphID <= d.endGlyphID 18586 ); 18587 if ( id === -1 ) return ''; 18588 return this.getDocument( id ); 18589 } 18590 } 18591 class SVGDocumentRecord { 18592 constructor( p ) { 18593 this.startGlyphID = p.uint16; 18594 this.endGlyphID = p.uint16; 18595 this.svgDocOffset = p.Offset32; 18596 this.svgDocLength = p.uint32; 18597 } 18598 } 18599 var SVG$1 = Object.freeze( { __proto__: null, SVG: SVG } ); 18600 class fvar extends SimpleTable { 18601 constructor( dict, dataview ) { 18602 const { p: p } = super( dict, dataview ); 18603 this.majorVersion = p.uint16; 18604 this.minorVersion = p.uint16; 18605 this.axesArrayOffset = p.Offset16; 18606 p.uint16; 18607 this.axisCount = p.uint16; 18608 this.axisSize = p.uint16; 18609 this.instanceCount = p.uint16; 18610 this.instanceSize = p.uint16; 18611 const axisStart = this.tableStart + this.axesArrayOffset; 18612 lazy$1( this, `axes`, () => { 18613 p.currentPosition = axisStart; 18614 return [ ...new Array( this.axisCount ) ].map( 18615 ( _ ) => new VariationAxisRecord( p ) 18616 ); 18617 } ); 18618 const instanceStart = axisStart + this.axisCount * this.axisSize; 18619 lazy$1( this, `instances`, () => { 18620 let instances = []; 18621 for ( let i = 0; i < this.instanceCount; i++ ) { 18622 p.currentPosition = instanceStart + i * this.instanceSize; 18623 instances.push( 18624 new InstanceRecord( p, this.axisCount, this.instanceSize ) 18625 ); 18626 } 18627 return instances; 18628 } ); 18629 } 18630 getSupportedAxes() { 18631 return this.axes.map( ( a ) => a.tag ); 18632 } 18633 getAxis( name ) { 18634 return this.axes.find( ( a ) => a.tag === name ); 18635 } 18636 } 18637 class VariationAxisRecord { 18638 constructor( p ) { 18639 this.tag = p.tag; 18640 this.minValue = p.fixed; 18641 this.defaultValue = p.fixed; 18642 this.maxValue = p.fixed; 18643 this.flags = p.flags( 16 ); 18644 this.axisNameID = p.uint16; 18645 } 18646 } 18647 class InstanceRecord { 18648 constructor( p, axisCount, size ) { 18649 let start = p.currentPosition; 18650 this.subfamilyNameID = p.uint16; 18651 p.uint16; 18652 this.coordinates = [ ...new Array( axisCount ) ].map( 18653 ( _ ) => p.fixed 18654 ); 18655 if ( p.currentPosition - start < size ) { 18656 this.postScriptNameID = p.uint16; 18657 } 18658 } 18659 } 18660 var fvar$1 = Object.freeze( { __proto__: null, fvar: fvar } ); 18661 class cvt extends SimpleTable { 18662 constructor( dict, dataview ) { 18663 const { p: p } = super( dict, dataview ); 18664 const n = dict.length / 2; 18665 lazy$1( this, `items`, () => 18666 [ ...new Array( n ) ].map( ( _ ) => p.fword ) 18667 ); 18668 } 18669 } 18670 var cvt$1 = Object.freeze( { __proto__: null, cvt: cvt } ); 18671 class fpgm extends SimpleTable { 18672 constructor( dict, dataview ) { 18673 const { p: p } = super( dict, dataview ); 18674 lazy$1( this, `instructions`, () => 18675 [ ...new Array( dict.length ) ].map( ( _ ) => p.uint8 ) 18676 ); 18677 } 18678 } 18679 var fpgm$1 = Object.freeze( { __proto__: null, fpgm: fpgm } ); 18680 class gasp extends SimpleTable { 18681 constructor( dict, dataview ) { 18682 const { p: p } = super( dict, dataview ); 18683 this.version = p.uint16; 18684 this.numRanges = p.uint16; 18685 const getter = () => 18686 [ ...new Array( this.numRanges ) ].map( 18687 ( _ ) => new GASPRange( p ) 18688 ); 18689 lazy$1( this, `gaspRanges`, getter ); 18690 } 18691 } 18692 class GASPRange { 18693 constructor( p ) { 18694 this.rangeMaxPPEM = p.uint16; 18695 this.rangeGaspBehavior = p.uint16; 18696 } 18697 } 18698 var gasp$1 = Object.freeze( { __proto__: null, gasp: gasp } ); 18699 class glyf extends SimpleTable { 18700 constructor( dict, dataview ) { 18701 super( dict, dataview ); 18702 } 18703 getGlyphData( offset, length ) { 18704 this.parser.currentPosition = this.tableStart + offset; 18705 return this.parser.readBytes( length ); 18706 } 18707 } 18708 var glyf$1 = Object.freeze( { __proto__: null, glyf: glyf } ); 18709 class loca extends SimpleTable { 18710 constructor( dict, dataview, tables ) { 18711 const { p: p } = super( dict, dataview ); 18712 const n = tables.maxp.numGlyphs + 1; 18713 if ( tables.head.indexToLocFormat === 0 ) { 18714 this.x2 = true; 18715 lazy$1( this, `offsets`, () => 18716 [ ...new Array( n ) ].map( ( _ ) => p.Offset16 ) 18717 ); 18718 } else { 18719 lazy$1( this, `offsets`, () => 18720 [ ...new Array( n ) ].map( ( _ ) => p.Offset32 ) 18721 ); 18722 } 18723 } 18724 getGlyphDataOffsetAndLength( glyphID ) { 18725 let offset = this.offsets[ glyphID ] * this.x2 ? 2 : 1; 18726 let nextOffset = this.offsets[ glyphID + 1 ] * this.x2 ? 2 : 1; 18727 return { offset: offset, length: nextOffset - offset }; 18728 } 18729 } 18730 var loca$1 = Object.freeze( { __proto__: null, loca: loca } ); 18731 class prep extends SimpleTable { 18732 constructor( dict, dataview ) { 18733 const { p: p } = super( dict, dataview ); 18734 lazy$1( this, `instructions`, () => 18735 [ ...new Array( dict.length ) ].map( ( _ ) => p.uint8 ) 18736 ); 18737 } 18738 } 18739 var prep$1 = Object.freeze( { __proto__: null, prep: prep } ); 18740 class CFF extends SimpleTable { 18741 constructor( dict, dataview ) { 18742 const { p: p } = super( dict, dataview ); 18743 lazy$1( this, `data`, () => p.readBytes() ); 18744 } 18745 } 18746 var CFF$1 = Object.freeze( { __proto__: null, CFF: CFF } ); 18747 class CFF2 extends SimpleTable { 18748 constructor( dict, dataview ) { 18749 const { p: p } = super( dict, dataview ); 18750 lazy$1( this, `data`, () => p.readBytes() ); 18751 } 18752 } 18753 var CFF2$1 = Object.freeze( { __proto__: null, CFF2: CFF2 } ); 18754 class VORG extends SimpleTable { 18755 constructor( dict, dataview ) { 18756 const { p: p } = super( dict, dataview ); 18757 this.majorVersion = p.uint16; 18758 this.minorVersion = p.uint16; 18759 this.defaultVertOriginY = p.int16; 18760 this.numVertOriginYMetrics = p.uint16; 18761 lazy$1( this, `vertORiginYMetrics`, () => 18762 [ ...new Array( this.numVertOriginYMetrics ) ].map( 18763 ( _ ) => new VertOriginYMetric( p ) 18764 ) 18765 ); 18766 } 18767 } 18768 class VertOriginYMetric { 18769 constructor( p ) { 18770 this.glyphIndex = p.uint16; 18771 this.vertOriginY = p.int16; 18772 } 18773 } 18774 var VORG$1 = Object.freeze( { __proto__: null, VORG: VORG } ); 18775 class BitmapSize { 18776 constructor( p ) { 18777 this.indexSubTableArrayOffset = p.Offset32; 18778 this.indexTablesSize = p.uint32; 18779 this.numberofIndexSubTables = p.uint32; 18780 this.colorRef = p.uint32; 18781 this.hori = new SbitLineMetrics( p ); 18782 this.vert = new SbitLineMetrics( p ); 18783 this.startGlyphIndex = p.uint16; 18784 this.endGlyphIndex = p.uint16; 18785 this.ppemX = p.uint8; 18786 this.ppemY = p.uint8; 18787 this.bitDepth = p.uint8; 18788 this.flags = p.int8; 18789 } 18790 } 18791 class BitmapScale { 18792 constructor( p ) { 18793 this.hori = new SbitLineMetrics( p ); 18794 this.vert = new SbitLineMetrics( p ); 18795 this.ppemX = p.uint8; 18796 this.ppemY = p.uint8; 18797 this.substitutePpemX = p.uint8; 18798 this.substitutePpemY = p.uint8; 18799 } 18800 } 18801 class SbitLineMetrics { 18802 constructor( p ) { 18803 this.ascender = p.int8; 18804 this.descender = p.int8; 18805 this.widthMax = p.uint8; 18806 this.caretSlopeNumerator = p.int8; 18807 this.caretSlopeDenominator = p.int8; 18808 this.caretOffset = p.int8; 18809 this.minOriginSB = p.int8; 18810 this.minAdvanceSB = p.int8; 18811 this.maxBeforeBL = p.int8; 18812 this.minAfterBL = p.int8; 18813 this.pad1 = p.int8; 18814 this.pad2 = p.int8; 18815 } 18816 } 18817 class EBLC extends SimpleTable { 18818 constructor( dict, dataview, name ) { 18819 const { p: p } = super( dict, dataview, name ); 18820 this.majorVersion = p.uint16; 18821 this.minorVersion = p.uint16; 18822 this.numSizes = p.uint32; 18823 lazy$1( this, `bitMapSizes`, () => 18824 [ ...new Array( this.numSizes ) ].map( 18825 ( _ ) => new BitmapSize( p ) 18826 ) 18827 ); 18828 } 18829 } 18830 var EBLC$1 = Object.freeze( { __proto__: null, EBLC: EBLC } ); 18831 class EBDT extends SimpleTable { 18832 constructor( dict, dataview, name ) { 18833 const { p: p } = super( dict, dataview, name ); 18834 this.majorVersion = p.uint16; 18835 this.minorVersion = p.uint16; 18836 } 18837 } 18838 var EBDT$1 = Object.freeze( { __proto__: null, EBDT: EBDT } ); 18839 class EBSC extends SimpleTable { 18840 constructor( dict, dataview ) { 18841 const { p: p } = super( dict, dataview ); 18842 this.majorVersion = p.uint16; 18843 this.minorVersion = p.uint16; 18844 this.numSizes = p.uint32; 18845 lazy$1( this, `bitmapScales`, () => 18846 [ ...new Array( this.numSizes ) ].map( 18847 ( _ ) => new BitmapScale( p ) 18848 ) 18849 ); 18850 } 18851 } 18852 var EBSC$1 = Object.freeze( { __proto__: null, EBSC: EBSC } ); 18853 class CBLC extends EBLC { 18854 constructor( dict, dataview ) { 18855 super( dict, dataview, `CBLC` ); 18856 } 18857 } 18858 var CBLC$1 = Object.freeze( { __proto__: null, CBLC: CBLC } ); 18859 class CBDT extends EBDT { 18860 constructor( dict, dataview ) { 18861 super( dict, dataview, `CBDT` ); 18862 } 18863 } 18864 var CBDT$1 = Object.freeze( { __proto__: null, CBDT: CBDT } ); 18865 class sbix extends SimpleTable { 18866 constructor( dict, dataview ) { 18867 const { p: p } = super( dict, dataview ); 18868 this.version = p.uint16; 18869 this.flags = p.flags( 16 ); 18870 this.numStrikes = p.uint32; 18871 lazy$1( this, `strikeOffsets`, () => 18872 [ ...new Array( this.numStrikes ) ].map( ( _ ) => p.Offset32 ) 18873 ); 18874 } 18875 } 18876 var sbix$1 = Object.freeze( { __proto__: null, sbix: sbix } ); 18877 class COLR extends SimpleTable { 18878 constructor( dict, dataview ) { 18879 const { p: p } = super( dict, dataview ); 18880 this.version = p.uint16; 18881 this.numBaseGlyphRecords = p.uint16; 18882 this.baseGlyphRecordsOffset = p.Offset32; 18883 this.layerRecordsOffset = p.Offset32; 18884 this.numLayerRecords = p.uint16; 18885 } 18886 getBaseGlyphRecord( glyphID ) { 18887 let start = this.tableStart + this.baseGlyphRecordsOffset; 18888 this.parser.currentPosition = start; 18889 let first = new BaseGlyphRecord( this.parser ); 18890 let firstID = first.gID; 18891 let end = this.tableStart + this.layerRecordsOffset - 6; 18892 this.parser.currentPosition = end; 18893 let last = new BaseGlyphRecord( this.parser ); 18894 let lastID = last.gID; 18895 if ( firstID === glyphID ) return first; 18896 if ( lastID === glyphID ) return last; 18897 while ( true ) { 18898 if ( start === end ) break; 18899 let mid = start + ( end - start ) / 12; 18900 this.parser.currentPosition = mid; 18901 let middle = new BaseGlyphRecord( this.parser ); 18902 let midID = middle.gID; 18903 if ( midID === glyphID ) return middle; 18904 else if ( midID > glyphID ) { 18905 end = mid; 18906 } else if ( midID < glyphID ) { 18907 start = mid; 18908 } 18909 } 18910 return false; 18911 } 18912 getLayers( glyphID ) { 18913 let record = this.getBaseGlyphRecord( glyphID ); 18914 this.parser.currentPosition = 18915 this.tableStart + 18916 this.layerRecordsOffset + 18917 4 * record.firstLayerIndex; 18918 return [ ...new Array( record.numLayers ) ].map( 18919 ( _ ) => new LayerRecord( p ) 18920 ); 18921 } 18922 } 18923 class BaseGlyphRecord { 18924 constructor( p ) { 18925 this.gID = p.uint16; 18926 this.firstLayerIndex = p.uint16; 18927 this.numLayers = p.uint16; 18928 } 18929 } 18930 class LayerRecord { 18931 constructor( p ) { 18932 this.gID = p.uint16; 18933 this.paletteIndex = p.uint16; 18934 } 18935 } 18936 var COLR$1 = Object.freeze( { __proto__: null, COLR: COLR } ); 18937 class CPAL extends SimpleTable { 18938 constructor( dict, dataview ) { 18939 const { p: p } = super( dict, dataview ); 18940 this.version = p.uint16; 18941 this.numPaletteEntries = p.uint16; 18942 const numPalettes = ( this.numPalettes = p.uint16 ); 18943 this.numColorRecords = p.uint16; 18944 this.offsetFirstColorRecord = p.Offset32; 18945 this.colorRecordIndices = [ ...new Array( this.numPalettes ) ].map( 18946 ( _ ) => p.uint16 18947 ); 18948 lazy$1( this, `colorRecords`, () => { 18949 p.currentPosition = this.tableStart + this.offsetFirstColorRecord; 18950 return [ ...new Array( this.numColorRecords ) ].map( 18951 ( _ ) => new ColorRecord( p ) 18952 ); 18953 } ); 18954 if ( this.version === 1 ) { 18955 this.offsetPaletteTypeArray = p.Offset32; 18956 this.offsetPaletteLabelArray = p.Offset32; 18957 this.offsetPaletteEntryLabelArray = p.Offset32; 18958 lazy$1( this, `paletteTypeArray`, () => { 18959 p.currentPosition = 18960 this.tableStart + this.offsetPaletteTypeArray; 18961 return new PaletteTypeArray( p, numPalettes ); 18962 } ); 18963 lazy$1( this, `paletteLabelArray`, () => { 18964 p.currentPosition = 18965 this.tableStart + this.offsetPaletteLabelArray; 18966 return new PaletteLabelsArray( p, numPalettes ); 18967 } ); 18968 lazy$1( this, `paletteEntryLabelArray`, () => { 18969 p.currentPosition = 18970 this.tableStart + this.offsetPaletteEntryLabelArray; 18971 return new PaletteEntryLabelArray( p, numPalettes ); 18972 } ); 18973 } 18974 } 18975 } 18976 class ColorRecord { 18977 constructor( p ) { 18978 this.blue = p.uint8; 18979 this.green = p.uint8; 18980 this.red = p.uint8; 18981 this.alpha = p.uint8; 18982 } 18983 } 18984 class PaletteTypeArray { 18985 constructor( p, numPalettes ) { 18986 this.paletteTypes = [ ...new Array( numPalettes ) ].map( 18987 ( _ ) => p.uint32 18988 ); 18989 } 18990 } 18991 class PaletteLabelsArray { 18992 constructor( p, numPalettes ) { 18993 this.paletteLabels = [ ...new Array( numPalettes ) ].map( 18994 ( _ ) => p.uint16 18995 ); 18996 } 18997 } 18998 class PaletteEntryLabelArray { 18999 constructor( p, numPalettes ) { 19000 this.paletteEntryLabels = [ ...new Array( numPalettes ) ].map( 19001 ( _ ) => p.uint16 19002 ); 19003 } 19004 } 19005 var CPAL$1 = Object.freeze( { __proto__: null, CPAL: CPAL } ); 19006 class DSIG extends SimpleTable { 19007 constructor( dict, dataview ) { 19008 const { p: p } = super( dict, dataview ); 19009 this.version = p.uint32; 19010 this.numSignatures = p.uint16; 19011 this.flags = p.uint16; 19012 this.signatureRecords = [ ...new Array( this.numSignatures ) ].map( 19013 ( _ ) => new SignatureRecord( p ) 19014 ); 19015 } 19016 getData( signatureID ) { 19017 const record = this.signatureRecords[ signatureID ]; 19018 this.parser.currentPosition = this.tableStart + record.offset; 19019 return new SignatureBlockFormat1( this.parser ); 19020 } 19021 } 19022 class SignatureRecord { 19023 constructor( p ) { 19024 this.format = p.uint32; 19025 this.length = p.uint32; 19026 this.offset = p.Offset32; 19027 } 19028 } 19029 class SignatureBlockFormat1 { 19030 constructor( p ) { 19031 p.uint16; 19032 p.uint16; 19033 this.signatureLength = p.uint32; 19034 this.signature = p.readBytes( this.signatureLength ); 19035 } 19036 } 19037 var DSIG$1 = Object.freeze( { __proto__: null, DSIG: DSIG } ); 19038 class hdmx extends SimpleTable { 19039 constructor( dict, dataview, tables ) { 19040 const { p: p } = super( dict, dataview ); 19041 const numGlyphs = tables.hmtx.numGlyphs; 19042 this.version = p.uint16; 19043 this.numRecords = p.int16; 19044 this.sizeDeviceRecord = p.int32; 19045 this.records = [ ...new Array( numRecords ) ].map( 19046 ( _ ) => new DeviceRecord( p, numGlyphs ) 19047 ); 19048 } 19049 } 19050 class DeviceRecord { 19051 constructor( p, numGlyphs ) { 19052 this.pixelSize = p.uint8; 19053 this.maxWidth = p.uint8; 19054 this.widths = p.readBytes( numGlyphs ); 19055 } 19056 } 19057 var hdmx$1 = Object.freeze( { __proto__: null, hdmx: hdmx } ); 19058 class kern extends SimpleTable { 19059 constructor( dict, dataview ) { 19060 const { p: p } = super( dict, dataview ); 19061 this.version = p.uint16; 19062 this.nTables = p.uint16; 19063 lazy$1( this, `tables`, () => { 19064 let offset = this.tableStart + 4; 19065 const tables = []; 19066 for ( let i = 0; i < this.nTables; i++ ) { 19067 p.currentPosition = offset; 19068 let subtable = new KernSubTable( p ); 19069 tables.push( subtable ); 19070 offset += subtable; 19071 } 19072 return tables; 19073 } ); 19074 } 19075 } 19076 class KernSubTable { 19077 constructor( p ) { 19078 this.version = p.uint16; 19079 this.length = p.uint16; 19080 this.coverage = p.flags( 8 ); 19081 this.format = p.uint8; 19082 if ( this.format === 0 ) { 19083 this.nPairs = p.uint16; 19084 this.searchRange = p.uint16; 19085 this.entrySelector = p.uint16; 19086 this.rangeShift = p.uint16; 19087 lazy$1( this, `pairs`, () => 19088 [ ...new Array( this.nPairs ) ].map( ( _ ) => new Pair( p ) ) 19089 ); 19090 } 19091 if ( this.format === 2 ) { 19092 console.warn( 19093 `Kern subtable format 2 is not supported: this parser currently only parses universal table data.` 19094 ); 19095 } 19096 } 19097 get horizontal() { 19098 return this.coverage[ 0 ]; 19099 } 19100 get minimum() { 19101 return this.coverage[ 1 ]; 19102 } 19103 get crossstream() { 19104 return this.coverage[ 2 ]; 19105 } 19106 get override() { 19107 return this.coverage[ 3 ]; 19108 } 19109 } 19110 class Pair { 19111 constructor( p ) { 19112 this.left = p.uint16; 19113 this.right = p.uint16; 19114 this.value = p.fword; 19115 } 19116 } 19117 var kern$1 = Object.freeze( { __proto__: null, kern: kern } ); 19118 class LTSH extends SimpleTable { 19119 constructor( dict, dataview ) { 19120 const { p: p } = super( dict, dataview ); 19121 this.version = p.uint16; 19122 this.numGlyphs = p.uint16; 19123 this.yPels = p.readBytes( this.numGlyphs ); 19124 } 19125 } 19126 var LTSH$1 = Object.freeze( { __proto__: null, LTSH: LTSH } ); 19127 class MERG extends SimpleTable { 19128 constructor( dict, dataview ) { 19129 const { p: p } = super( dict, dataview ); 19130 this.version = p.uint16; 19131 this.mergeClassCount = p.uint16; 19132 this.mergeDataOffset = p.Offset16; 19133 this.classDefCount = p.uint16; 19134 this.offsetToClassDefOffsets = p.Offset16; 19135 lazy$1( this, `mergeEntryMatrix`, () => 19136 [ ...new Array( this.mergeClassCount ) ].map( ( _ ) => 19137 p.readBytes( this.mergeClassCount ) 19138 ) 19139 ); 19140 console.warn( `Full MERG parsing is currently not supported.` ); 19141 console.warn( 19142 `If you need this table parsed, please file an issue, or better yet, a PR.` 19143 ); 19144 } 19145 } 19146 var MERG$1 = Object.freeze( { __proto__: null, MERG: MERG } ); 19147 class meta extends SimpleTable { 19148 constructor( dict, dataview ) { 19149 const { p: p } = super( dict, dataview ); 19150 this.version = p.uint32; 19151 this.flags = p.uint32; 19152 p.uint32; 19153 this.dataMapsCount = p.uint32; 19154 this.dataMaps = [ ...new Array( this.dataMapsCount ) ].map( 19155 ( _ ) => new DataMap( this.tableStart, p ) 19156 ); 19157 } 19158 } 19159 class DataMap { 19160 constructor( tableStart, p ) { 19161 this.tableStart = tableStart; 19162 this.parser = p; 19163 this.tag = p.tag; 19164 this.dataOffset = p.Offset32; 19165 this.dataLength = p.uint32; 19166 } 19167 getData() { 19168 this.parser.currentField = this.tableStart + this.dataOffset; 19169 return this.parser.readBytes( this.dataLength ); 19170 } 19171 } 19172 var meta$1 = Object.freeze( { __proto__: null, meta: meta } ); 19173 class PCLT extends SimpleTable { 19174 constructor( dict, dataview ) { 19175 super( dict, dataview ); 19176 console.warn( 19177 `This font uses a PCLT table, which is currently not supported by this parser.` 19178 ); 19179 console.warn( 19180 `If you need this table parsed, please file an issue, or better yet, a PR.` 19181 ); 19182 } 19183 } 19184 var PCLT$1 = Object.freeze( { __proto__: null, PCLT: PCLT } ); 19185 class VDMX extends SimpleTable { 19186 constructor( dict, dataview ) { 19187 const { p: p } = super( dict, dataview ); 19188 this.version = p.uint16; 19189 this.numRecs = p.uint16; 19190 this.numRatios = p.uint16; 19191 this.ratRanges = [ ...new Array( this.numRatios ) ].map( 19192 ( _ ) => new RatioRange( p ) 19193 ); 19194 this.offsets = [ ...new Array( this.numRatios ) ].map( 19195 ( _ ) => p.Offset16 19196 ); 19197 this.VDMXGroups = [ ...new Array( this.numRecs ) ].map( 19198 ( _ ) => new VDMXGroup( p ) 19199 ); 19200 } 19201 } 19202 class RatioRange { 19203 constructor( p ) { 19204 this.bCharSet = p.uint8; 19205 this.xRatio = p.uint8; 19206 this.yStartRatio = p.uint8; 19207 this.yEndRatio = p.uint8; 19208 } 19209 } 19210 class VDMXGroup { 19211 constructor( p ) { 19212 this.recs = p.uint16; 19213 this.startsz = p.uint8; 19214 this.endsz = p.uint8; 19215 this.records = [ ...new Array( this.recs ) ].map( 19216 ( _ ) => new vTable( p ) 19217 ); 19218 } 19219 } 19220 class vTable { 19221 constructor( p ) { 19222 this.yPelHeight = p.uint16; 19223 this.yMax = p.int16; 19224 this.yMin = p.int16; 19225 } 19226 } 19227 var VDMX$1 = Object.freeze( { __proto__: null, VDMX: VDMX } ); 19228 class vhea extends SimpleTable { 19229 constructor( dict, dataview ) { 19230 const { p: p } = super( dict, dataview ); 19231 this.version = p.fixed; 19232 this.ascent = this.vertTypoAscender = p.int16; 19233 this.descent = this.vertTypoDescender = p.int16; 19234 this.lineGap = this.vertTypoLineGap = p.int16; 19235 this.advanceHeightMax = p.int16; 19236 this.minTopSideBearing = p.int16; 19237 this.minBottomSideBearing = p.int16; 19238 this.yMaxExtent = p.int16; 19239 this.caretSlopeRise = p.int16; 19240 this.caretSlopeRun = p.int16; 19241 this.caretOffset = p.int16; 19242 this.reserved = p.int16; 19243 this.reserved = p.int16; 19244 this.reserved = p.int16; 19245 this.reserved = p.int16; 19246 this.metricDataFormat = p.int16; 19247 this.numOfLongVerMetrics = p.uint16; 19248 p.verifyLength(); 19249 } 19250 } 19251 var vhea$1 = Object.freeze( { __proto__: null, vhea: vhea } ); 19252 class vmtx extends SimpleTable { 19253 constructor( dict, dataview, tables ) { 19254 super( dict, dataview ); 19255 const numOfLongVerMetrics = tables.vhea.numOfLongVerMetrics; 19256 const numGlyphs = tables.maxp.numGlyphs; 19257 const metricsStart = p.currentPosition; 19258 lazy( this, `vMetrics`, () => { 19259 p.currentPosition = metricsStart; 19260 return [ ...new Array( numOfLongVerMetrics ) ].map( 19261 ( _ ) => new LongVertMetric( p.uint16, p.int16 ) 19262 ); 19263 } ); 19264 if ( numOfLongVerMetrics < numGlyphs ) { 19265 const tsbStart = metricsStart + numOfLongVerMetrics * 4; 19266 lazy( this, `topSideBearings`, () => { 19267 p.currentPosition = tsbStart; 19268 return [ ...new Array( numGlyphs - numOfLongVerMetrics ) ].map( 19269 ( _ ) => p.int16 19270 ); 19271 } ); 19272 } 19273 } 19274 } 19275 class LongVertMetric { 19276 constructor( h, b ) { 19277 this.advanceHeight = h; 19278 this.topSideBearing = b; 19279 } 19280 } 19281 var vmtx$1 = Object.freeze( { __proto__: null, vmtx: vmtx } ); 19282 19283 /* eslint-enable */ 19284 19285 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/make-families-from-faces.js 19286 /** 19287 * WordPress dependencies 19288 */ 19289 19290 19291 /** 19292 * Internal dependencies 19293 */ 19294 19295 const { 19296 kebabCase: make_families_from_faces_kebabCase 19297 } = unlock(external_wp_components_namespaceObject.privateApis); 19298 function makeFamiliesFromFaces(fontFaces) { 19299 const fontFamiliesObject = fontFaces.reduce((acc, item) => { 19300 if (!acc[item.fontFamily]) { 19301 acc[item.fontFamily] = { 19302 name: item.fontFamily, 19303 fontFamily: item.fontFamily, 19304 slug: make_families_from_faces_kebabCase(item.fontFamily.toLowerCase()), 19305 fontFace: [] 19306 }; 19307 } 19308 acc[item.fontFamily].fontFace.push(item); 19309 return acc; 19310 }, {}); 19311 return Object.values(fontFamiliesObject); 19312 } 19313 19314 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/upload-fonts.js 19315 /** 19316 * WordPress dependencies 19317 */ 19318 19319 19320 19321 19322 /** 19323 * Internal dependencies 19324 */ 19325 19326 19327 19328 19329 19330 19331 function UploadFonts() { 19332 const { 19333 installFonts 19334 } = (0,external_wp_element_namespaceObject.useContext)(FontLibraryContext); 19335 const [isUploading, setIsUploading] = (0,external_wp_element_namespaceObject.useState)(false); 19336 const [notice, setNotice] = (0,external_wp_element_namespaceObject.useState)(false); 19337 const handleDropZone = files => { 19338 handleFilesUpload(files); 19339 }; 19340 const onFilesUpload = event => { 19341 handleFilesUpload(event.target.files); 19342 }; 19343 19344 /** 19345 * Filters the selected files to only allow the ones with the allowed extensions 19346 * 19347 * @param {Array} files The files to be filtered 19348 * @return {void} 19349 */ 19350 const handleFilesUpload = async files => { 19351 setNotice(null); 19352 setIsUploading(true); 19353 const uniqueFilenames = new Set(); 19354 const selectedFiles = [...files]; 19355 let hasInvalidFiles = false; 19356 19357 // Use map to create a promise for each file check, then filter with Promise.all. 19358 const checkFilesPromises = selectedFiles.map(async file => { 19359 const isFont = await isFontFile(file); 19360 if (!isFont) { 19361 hasInvalidFiles = true; 19362 return null; // Return null for invalid files. 19363 } 19364 // Check for duplicates 19365 if (uniqueFilenames.has(file.name)) { 19366 return null; // Return null for duplicates. 19367 } 19368 // Check if the file extension is allowed. 19369 const fileExtension = file.name.split('.').pop().toLowerCase(); 19370 if (ALLOWED_FILE_EXTENSIONS.includes(fileExtension)) { 19371 uniqueFilenames.add(file.name); 19372 return file; // Return the file if it passes all checks. 19373 } 19374 return null; // Return null for disallowed file extensions. 19375 }); 19376 19377 // Filter out the nulls after all promises have resolved. 19378 const allowedFiles = (await Promise.all(checkFilesPromises)).filter(file => null !== file); 19379 if (allowedFiles.length > 0) { 19380 loadFiles(allowedFiles); 19381 } else { 19382 const message = hasInvalidFiles ? (0,external_wp_i18n_namespaceObject.__)('Sorry, you are not allowed to upload this file type.') : (0,external_wp_i18n_namespaceObject.__)('No fonts found to install.'); 19383 setNotice({ 19384 type: 'error', 19385 message 19386 }); 19387 setIsUploading(false); 19388 } 19389 }; 19390 19391 /** 19392 * Loads the selected files and reads the font metadata 19393 * 19394 * @param {Array} files The files to be loaded 19395 * @return {void} 19396 */ 19397 const loadFiles = async files => { 19398 const fontFacesLoaded = await Promise.all(files.map(async fontFile => { 19399 const fontFaceData = await getFontFaceMetadata(fontFile); 19400 await loadFontFaceInBrowser(fontFaceData, fontFaceData.file, 'all'); 19401 return fontFaceData; 19402 })); 19403 handleInstall(fontFacesLoaded); 19404 }; 19405 19406 /** 19407 * Checks if a file is a valid Font file. 19408 * 19409 * @param {File} file The file to be checked. 19410 * @return {boolean} Whether the file is a valid font file. 19411 */ 19412 async function isFontFile(file) { 19413 const font = new Font('Uploaded Font'); 19414 try { 19415 const buffer = await readFileAsArrayBuffer(file); 19416 await font.fromDataBuffer(buffer, 'font'); 19417 return true; 19418 } catch (error) { 19419 return false; 19420 } 19421 } 19422 19423 // Create a function to read the file as array buffer 19424 async function readFileAsArrayBuffer(file) { 19425 return new Promise((resolve, reject) => { 19426 const reader = new window.FileReader(); 19427 reader.readAsArrayBuffer(file); 19428 reader.onload = () => resolve(reader.result); 19429 reader.onerror = reject; 19430 }); 19431 } 19432 const getFontFaceMetadata = async fontFile => { 19433 const buffer = await readFileAsArrayBuffer(fontFile); 19434 const fontObj = new Font('Uploaded Font'); 19435 fontObj.fromDataBuffer(buffer, fontFile.name); 19436 // Assuming that fromDataBuffer triggers onload event and returning a Promise 19437 const onloadEvent = await new Promise(resolve => fontObj.onload = resolve); 19438 const font = onloadEvent.detail.font; 19439 const { 19440 name 19441 } = font.opentype.tables; 19442 const fontName = name.get(16) || name.get(1); 19443 const isItalic = name.get(2).toLowerCase().includes('italic'); 19444 const fontWeight = font.opentype.tables['OS/2'].usWeightClass || 'normal'; 19445 const isVariable = !!font.opentype.tables.fvar; 19446 const weightAxis = isVariable && font.opentype.tables.fvar.axes.find(({ 19447 tag 19448 }) => tag === 'wght'); 19449 const weightRange = weightAxis ? `$weightAxis.minValue} $weightAxis.maxValue}` : null; 19450 return { 19451 file: fontFile, 19452 fontFamily: fontName, 19453 fontStyle: isItalic ? 'italic' : 'normal', 19454 fontWeight: weightRange || fontWeight 19455 }; 19456 }; 19457 19458 /** 19459 * Creates the font family definition and sends it to the server 19460 * 19461 * @param {Array} fontFaces The font faces to be installed 19462 * @return {void} 19463 */ 19464 const handleInstall = async fontFaces => { 19465 const fontFamilies = makeFamiliesFromFaces(fontFaces); 19466 try { 19467 await installFonts(fontFamilies); 19468 setNotice({ 19469 type: 'success', 19470 message: (0,external_wp_i18n_namespaceObject.__)('Fonts were installed successfully.') 19471 }); 19472 } catch (error) { 19473 setNotice({ 19474 type: 'error', 19475 message: error.message, 19476 errors: error?.installationErrors 19477 }); 19478 } 19479 setIsUploading(false); 19480 }; 19481 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 19482 className: "font-library-modal__tabpanel-layout", 19483 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropZone, { 19484 onFilesDrop: handleDropZone 19485 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 19486 className: "font-library-modal__local-fonts", 19487 children: [notice && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Notice, { 19488 status: notice.type, 19489 __unstableHTML: true, 19490 onRemove: () => setNotice(null), 19491 children: [notice.message, notice.errors && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { 19492 children: notice.errors.map((error, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { 19493 children: error 19494 }, index)) 19495 })] 19496 }), isUploading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 19497 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 19498 className: "font-library-modal__upload-area", 19499 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ProgressBar, {}) 19500 }) 19501 }), !isUploading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FormFileUpload, { 19502 accept: ALLOWED_FILE_EXTENSIONS.map(ext => `.$ext}`).join(','), 19503 multiple: true, 19504 onChange: onFilesUpload, 19505 render: ({ 19506 openFileDialog 19507 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 19508 __next40pxDefaultSize: true, 19509 className: "font-library-modal__upload-area", 19510 onClick: openFileDialog, 19511 children: (0,external_wp_i18n_namespaceObject.__)('Upload font') 19512 }) 19513 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 19514 margin: 2 19515 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 19516 className: "font-library-modal__upload-area__text", 19517 children: (0,external_wp_i18n_namespaceObject.__)('Uploaded fonts appear in your library and can be used in your theme. Supported formats: .ttf, .otf, .woff, and .woff2.') 19518 })] 19519 })] 19520 }); 19521 } 19522 /* harmony default export */ const upload_fonts = (UploadFonts); 19523 19524 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/index.js 19525 /** 19526 * WordPress dependencies 19527 */ 19528 19529 19530 19531 19532 19533 19534 /** 19535 * Internal dependencies 19536 */ 19537 19538 19539 19540 19541 19542 19543 const { 19544 Tabs 19545 } = unlock(external_wp_components_namespaceObject.privateApis); 19546 const DEFAULT_TAB = { 19547 id: 'installed-fonts', 19548 title: (0,external_wp_i18n_namespaceObject._x)('Library', 'Font library') 19549 }; 19550 const UPLOAD_TAB = { 19551 id: 'upload-fonts', 19552 title: (0,external_wp_i18n_namespaceObject._x)('Upload', 'noun') 19553 }; 19554 const tabsFromCollections = collections => collections.map(({ 19555 slug, 19556 name 19557 }) => ({ 19558 id: slug, 19559 title: collections.length === 1 && slug === 'google-fonts' ? (0,external_wp_i18n_namespaceObject.__)('Install Fonts') : name 19560 })); 19561 function FontLibraryModal({ 19562 onRequestClose, 19563 defaultTabId = 'installed-fonts' 19564 }) { 19565 const { 19566 collections 19567 } = (0,external_wp_element_namespaceObject.useContext)(FontLibraryContext); 19568 const canUserCreate = (0,external_wp_data_namespaceObject.useSelect)(select => { 19569 return select(external_wp_coreData_namespaceObject.store).canUser('create', { 19570 kind: 'postType', 19571 name: 'wp_font_family' 19572 }); 19573 }, []); 19574 const tabs = [DEFAULT_TAB]; 19575 if (canUserCreate) { 19576 tabs.push(UPLOAD_TAB); 19577 tabs.push(...tabsFromCollections(collections || [])); 19578 } 19579 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 19580 title: (0,external_wp_i18n_namespaceObject.__)('Fonts'), 19581 onRequestClose: onRequestClose, 19582 isFullScreen: true, 19583 className: "font-library-modal", 19584 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Tabs, { 19585 defaultTabId: defaultTabId, 19586 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 19587 className: "font-library-modal__tablist-container", 19588 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.TabList, { 19589 children: tabs.map(({ 19590 id, 19591 title 19592 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.Tab, { 19593 tabId: id, 19594 children: title 19595 }, id)) 19596 }) 19597 }), tabs.map(({ 19598 id 19599 }) => { 19600 let contents; 19601 switch (id) { 19602 case 'upload-fonts': 19603 contents = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(upload_fonts, {}); 19604 break; 19605 case 'installed-fonts': 19606 contents = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(installed_fonts, {}); 19607 break; 19608 default: 19609 contents = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_collection, { 19610 slug: id 19611 }); 19612 } 19613 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.TabPanel, { 19614 tabId: id, 19615 focusable: false, 19616 children: contents 19617 }, id); 19618 })] 19619 }) 19620 }); 19621 } 19622 /* harmony default export */ const font_library_modal = (FontLibraryModal); 19623 19624 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-family-item.js 19625 /** 19626 * WordPress dependencies 19627 */ 19628 19629 19630 19631 19632 /** 19633 * Internal dependencies 19634 */ 19635 19636 19637 19638 function FontFamilyItem({ 19639 font 19640 }) { 19641 const { 19642 handleSetLibraryFontSelected, 19643 setModalTabOpen 19644 } = (0,external_wp_element_namespaceObject.useContext)(FontLibraryContext); 19645 const variantsCount = font?.fontFace?.length || 1; 19646 const handleClick = () => { 19647 handleSetLibraryFontSelected(font); 19648 setModalTabOpen('installed-fonts'); 19649 }; 19650 const previewStyle = getFamilyPreviewStyle(font); 19651 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItem, { 19652 onClick: handleClick, 19653 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 19654 justify: "space-between", 19655 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 19656 style: previewStyle, 19657 children: font.name 19658 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 19659 className: "edit-site-global-styles-screen-typography__font-variants-count", 19660 children: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %d: Number of font variants. */ 19661 (0,external_wp_i18n_namespaceObject._n)('%d variant', '%d variants', variantsCount), variantsCount) 19662 })] 19663 }) 19664 }); 19665 } 19666 /* harmony default export */ const font_family_item = (FontFamilyItem); 19667 19668 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-families.js 19669 /** 19670 * WordPress dependencies 19671 */ 19672 19673 19674 19675 19676 19677 19678 /** 19679 * Internal dependencies 19680 */ 19681 19682 19683 19684 19685 19686 19687 19688 const { 19689 useGlobalSetting: font_families_useGlobalSetting 19690 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 19691 19692 /** 19693 * Maps the fonts with the source, if available. 19694 * 19695 * @param {Array} fonts The fonts to map. 19696 * @param {string} source The source of the fonts. 19697 * @return {Array} The mapped fonts. 19698 */ 19699 function mapFontsWithSource(fonts, source) { 19700 return fonts ? fonts.map(f => setUIValuesNeeded(f, { 19701 source 19702 })) : []; 19703 } 19704 function FontFamilies() { 19705 const { 19706 baseCustomFonts, 19707 modalTabOpen, 19708 setModalTabOpen 19709 } = (0,external_wp_element_namespaceObject.useContext)(FontLibraryContext); 19710 const [fontFamilies] = font_families_useGlobalSetting('typography.fontFamilies'); 19711 const [baseFontFamilies] = font_families_useGlobalSetting('typography.fontFamilies', undefined, 'base'); 19712 const themeFonts = mapFontsWithSource(fontFamilies?.theme, 'theme'); 19713 const customFonts = mapFontsWithSource(fontFamilies?.custom, 'custom'); 19714 const activeFonts = [...themeFonts, ...customFonts].sort((a, b) => a.name.localeCompare(b.name)); 19715 const hasFonts = 0 < activeFonts.length; 19716 const hasInstalledFonts = hasFonts || baseFontFamilies?.theme?.length > 0 || baseCustomFonts?.length > 0; 19717 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 19718 children: [!!modalTabOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_library_modal, { 19719 onRequestClose: () => setModalTabOpen(null), 19720 defaultTabId: modalTabOpen 19721 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 19722 spacing: 2, 19723 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 19724 justify: "space-between", 19725 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { 19726 level: 3, 19727 children: (0,external_wp_i18n_namespaceObject.__)('Fonts') 19728 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 19729 onClick: () => setModalTabOpen('installed-fonts'), 19730 label: (0,external_wp_i18n_namespaceObject.__)('Manage fonts'), 19731 icon: library_settings, 19732 size: "small" 19733 })] 19734 }), activeFonts.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { 19735 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 19736 size: "large", 19737 isBordered: true, 19738 isSeparated: true, 19739 children: activeFonts.map(font => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_family_item, { 19740 font: font 19741 }, font.slug)) 19742 }) 19743 }), !hasFonts && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 19744 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 19745 as: "p", 19746 children: hasInstalledFonts ? (0,external_wp_i18n_namespaceObject.__)('No fonts activated.') : (0,external_wp_i18n_namespaceObject.__)('No fonts installed.') 19747 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 19748 className: "edit-site-global-styles-font-families__manage-fonts", 19749 variant: "secondary", 19750 __next40pxDefaultSize: true, 19751 onClick: () => { 19752 setModalTabOpen(hasInstalledFonts ? 'installed-fonts' : 'upload-fonts'); 19753 }, 19754 children: hasInstalledFonts ? (0,external_wp_i18n_namespaceObject.__)('Manage fonts') : (0,external_wp_i18n_namespaceObject.__)('Add fonts') 19755 })] 19756 })] 19757 })] 19758 }); 19759 } 19760 /* harmony default export */ const font_families = (({ 19761 ...props 19762 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(context, { 19763 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FontFamilies, { 19764 ...props 19765 }) 19766 })); 19767 19768 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-typography.js 19769 /** 19770 * WordPress dependencies 19771 */ 19772 19773 19774 19775 19776 19777 /** 19778 * Internal dependencies 19779 */ 19780 19781 19782 19783 19784 19785 19786 function ScreenTypography() { 19787 const fontLibraryEnabled = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_editor_namespaceObject.store).getEditorSettings().fontLibraryEnabled, []); 19788 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 19789 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 19790 title: (0,external_wp_i18n_namespaceObject.__)('Typography'), 19791 description: (0,external_wp_i18n_namespaceObject.__)('Available fonts, typographic styles, and the application of those styles.') 19792 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 19793 className: "edit-site-global-styles-screen", 19794 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 19795 spacing: 7, 19796 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TypographyVariations, { 19797 title: (0,external_wp_i18n_namespaceObject.__)('Typesets') 19798 }), fontLibraryEnabled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_families, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(typography_elements, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_sizes_count, {})] 19799 }) 19800 })] 19801 }); 19802 } 19803 /* harmony default export */ const screen_typography = (ScreenTypography); 19804 19805 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/typography-panel.js 19806 /** 19807 * WordPress dependencies 19808 */ 19809 19810 19811 /** 19812 * Internal dependencies 19813 */ 19814 19815 19816 const { 19817 useGlobalStyle: typography_panel_useGlobalStyle, 19818 useGlobalSetting: typography_panel_useGlobalSetting, 19819 useSettingsForBlockElement: typography_panel_useSettingsForBlockElement, 19820 TypographyPanel: typography_panel_StylesTypographyPanel 19821 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 19822 function TypographyPanel({ 19823 element, 19824 headingLevel 19825 }) { 19826 let prefixParts = []; 19827 if (element === 'heading') { 19828 prefixParts = prefixParts.concat(['elements', headingLevel]); 19829 } else if (element && element !== 'text') { 19830 prefixParts = prefixParts.concat(['elements', element]); 19831 } 19832 const prefix = prefixParts.join('.'); 19833 const [style] = typography_panel_useGlobalStyle(prefix, undefined, 'user', { 19834 shouldDecodeEncode: false 19835 }); 19836 const [inheritedStyle, setStyle] = typography_panel_useGlobalStyle(prefix, undefined, 'all', { 19837 shouldDecodeEncode: false 19838 }); 19839 const [rawSettings] = typography_panel_useGlobalSetting(''); 19840 const usedElement = element === 'heading' ? headingLevel : element; 19841 const settings = typography_panel_useSettingsForBlockElement(rawSettings, undefined, usedElement); 19842 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(typography_panel_StylesTypographyPanel, { 19843 inheritedValue: inheritedStyle, 19844 value: style, 19845 onChange: setStyle, 19846 settings: settings 19847 }); 19848 } 19849 19850 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/typography-preview.js 19851 /** 19852 * WordPress dependencies 19853 */ 19854 19855 19856 /** 19857 * Internal dependencies 19858 */ 19859 19860 19861 const { 19862 useGlobalStyle: typography_preview_useGlobalStyle 19863 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 19864 function TypographyPreview({ 19865 name, 19866 element, 19867 headingLevel 19868 }) { 19869 var _ref; 19870 let prefix = ''; 19871 if (element === 'heading') { 19872 prefix = `elements.$headingLevel}.`; 19873 } else if (element && element !== 'text') { 19874 prefix = `elements.$element}.`; 19875 } 19876 const [fontFamily] = typography_preview_useGlobalStyle(prefix + 'typography.fontFamily', name); 19877 const [gradientValue] = typography_preview_useGlobalStyle(prefix + 'color.gradient', name); 19878 const [backgroundColor] = typography_preview_useGlobalStyle(prefix + 'color.background', name); 19879 const [fallbackBackgroundColor] = typography_preview_useGlobalStyle('color.background'); 19880 const [color] = typography_preview_useGlobalStyle(prefix + 'color.text', name); 19881 const [fontSize] = typography_preview_useGlobalStyle(prefix + 'typography.fontSize', name); 19882 const [fontStyle] = typography_preview_useGlobalStyle(prefix + 'typography.fontStyle', name); 19883 const [fontWeight] = typography_preview_useGlobalStyle(prefix + 'typography.fontWeight', name); 19884 const [letterSpacing] = typography_preview_useGlobalStyle(prefix + 'typography.letterSpacing', name); 19885 const extraStyles = element === 'link' ? { 19886 textDecoration: 'underline' 19887 } : {}; 19888 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 19889 className: "edit-site-typography-preview", 19890 style: { 19891 fontFamily: fontFamily !== null && fontFamily !== void 0 ? fontFamily : 'serif', 19892 background: (_ref = gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor) !== null && _ref !== void 0 ? _ref : fallbackBackgroundColor, 19893 color, 19894 fontSize, 19895 fontStyle, 19896 fontWeight, 19897 letterSpacing, 19898 ...extraStyles 19899 }, 19900 children: "Aa" 19901 }); 19902 } 19903 19904 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-typography-element.js 19905 /** 19906 * WordPress dependencies 19907 */ 19908 19909 19910 19911 19912 /** 19913 * Internal dependencies 19914 */ 19915 19916 19917 19918 19919 const screen_typography_element_elements = { 19920 text: { 19921 description: (0,external_wp_i18n_namespaceObject.__)('Manage the fonts used on the site.'), 19922 title: (0,external_wp_i18n_namespaceObject.__)('Text') 19923 }, 19924 link: { 19925 description: (0,external_wp_i18n_namespaceObject.__)('Manage the fonts and typography used on the links.'), 19926 title: (0,external_wp_i18n_namespaceObject.__)('Links') 19927 }, 19928 heading: { 19929 description: (0,external_wp_i18n_namespaceObject.__)('Manage the fonts and typography used on headings.'), 19930 title: (0,external_wp_i18n_namespaceObject.__)('Headings') 19931 }, 19932 caption: { 19933 description: (0,external_wp_i18n_namespaceObject.__)('Manage the fonts and typography used on captions.'), 19934 title: (0,external_wp_i18n_namespaceObject.__)('Captions') 19935 }, 19936 button: { 19937 description: (0,external_wp_i18n_namespaceObject.__)('Manage the fonts and typography used on buttons.'), 19938 title: (0,external_wp_i18n_namespaceObject.__)('Buttons') 19939 } 19940 }; 19941 function ScreenTypographyElement({ 19942 element 19943 }) { 19944 const [headingLevel, setHeadingLevel] = (0,external_wp_element_namespaceObject.useState)('heading'); 19945 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 19946 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 19947 title: screen_typography_element_elements[element].title, 19948 description: screen_typography_element_elements[element].description 19949 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 19950 marginX: 4, 19951 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TypographyPreview, { 19952 element: element, 19953 headingLevel: headingLevel 19954 }) 19955 }), element === 'heading' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 19956 marginX: 4, 19957 marginBottom: "1em", 19958 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { 19959 label: (0,external_wp_i18n_namespaceObject.__)('Select heading level'), 19960 hideLabelFromVision: true, 19961 value: headingLevel, 19962 onChange: setHeadingLevel, 19963 isBlock: true, 19964 size: "__unstable-large", 19965 __nextHasNoMarginBottom: true, 19966 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { 19967 value: "heading", 19968 showTooltip: true, 19969 "aria-label": (0,external_wp_i18n_namespaceObject.__)('All headings'), 19970 label: (0,external_wp_i18n_namespaceObject._x)('All', 'heading levels') 19971 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { 19972 value: "h1", 19973 showTooltip: true, 19974 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Heading 1'), 19975 label: (0,external_wp_i18n_namespaceObject.__)('H1') 19976 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { 19977 value: "h2", 19978 showTooltip: true, 19979 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Heading 2'), 19980 label: (0,external_wp_i18n_namespaceObject.__)('H2') 19981 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { 19982 value: "h3", 19983 showTooltip: true, 19984 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Heading 3'), 19985 label: (0,external_wp_i18n_namespaceObject.__)('H3') 19986 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { 19987 value: "h4", 19988 showTooltip: true, 19989 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Heading 4'), 19990 label: (0,external_wp_i18n_namespaceObject.__)('H4') 19991 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { 19992 value: "h5", 19993 showTooltip: true, 19994 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Heading 5'), 19995 label: (0,external_wp_i18n_namespaceObject.__)('H5') 19996 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { 19997 value: "h6", 19998 showTooltip: true, 19999 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Heading 6'), 20000 label: (0,external_wp_i18n_namespaceObject.__)('H6') 20001 })] 20002 }) 20003 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TypographyPanel, { 20004 element: element, 20005 headingLevel: headingLevel 20006 })] 20007 }); 20008 } 20009 /* harmony default export */ const screen_typography_element = (ScreenTypographyElement); 20010 20011 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/font-size-preview.js 20012 /** 20013 * WordPress dependencies 20014 */ 20015 20016 20017 20018 /** 20019 * Internal dependencies 20020 */ 20021 20022 20023 const { 20024 useGlobalStyle: font_size_preview_useGlobalStyle 20025 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 20026 function FontSizePreview({ 20027 fontSize 20028 }) { 20029 var _font$fontFamily; 20030 const [font] = font_size_preview_useGlobalStyle('typography'); 20031 const input = fontSize?.fluid?.min && fontSize?.fluid?.max ? { 20032 minimumFontSize: fontSize.fluid.min, 20033 maximumFontSize: fontSize.fluid.max 20034 } : { 20035 fontSize: fontSize.size 20036 }; 20037 const computedFontSize = (0,external_wp_blockEditor_namespaceObject.getComputedFluidTypographyValue)(input); 20038 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 20039 className: "edit-site-typography-preview", 20040 style: { 20041 fontSize: computedFontSize, 20042 fontFamily: (_font$fontFamily = font?.fontFamily) !== null && _font$fontFamily !== void 0 ? _font$fontFamily : 'serif' 20043 }, 20044 children: (0,external_wp_i18n_namespaceObject.__)('Aa') 20045 }); 20046 } 20047 /* harmony default export */ const font_size_preview = (FontSizePreview); 20048 20049 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/confirm-delete-font-size-dialog.js 20050 /** 20051 * WordPress dependencies 20052 */ 20053 20054 20055 20056 function ConfirmDeleteFontSizeDialog({ 20057 fontSize, 20058 isOpen, 20059 toggleOpen, 20060 handleRemoveFontSize 20061 }) { 20062 const handleConfirm = async () => { 20063 toggleOpen(); 20064 handleRemoveFontSize(fontSize); 20065 }; 20066 const handleCancel = () => { 20067 toggleOpen(); 20068 }; 20069 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { 20070 isOpen: isOpen, 20071 cancelButtonText: (0,external_wp_i18n_namespaceObject.__)('Cancel'), 20072 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Delete'), 20073 onCancel: handleCancel, 20074 onConfirm: handleConfirm, 20075 size: "medium", 20076 children: fontSize && (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: Name of the font size preset. */ 20077 (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to delete "%s" font size preset?'), fontSize.name) 20078 }); 20079 } 20080 /* harmony default export */ const confirm_delete_font_size_dialog = (ConfirmDeleteFontSizeDialog); 20081 20082 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/rename-font-size-dialog.js 20083 /** 20084 * WordPress dependencies 20085 */ 20086 20087 20088 20089 20090 function RenameFontSizeDialog({ 20091 fontSize, 20092 toggleOpen, 20093 handleRename 20094 }) { 20095 const [newName, setNewName] = (0,external_wp_element_namespaceObject.useState)(fontSize.name); 20096 const handleConfirm = () => { 20097 // If the new name is not empty, call the handleRename function 20098 if (newName.trim()) { 20099 handleRename(newName); 20100 } 20101 toggleOpen(); 20102 }; 20103 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 20104 onRequestClose: toggleOpen, 20105 focusOnMount: "firstContentElement", 20106 title: (0,external_wp_i18n_namespaceObject.__)('Rename'), 20107 size: "small", 20108 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { 20109 onSubmit: event => { 20110 event.preventDefault(); 20111 handleConfirm(); 20112 toggleOpen(); 20113 }, 20114 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 20115 spacing: "3", 20116 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControl, { 20117 __next40pxDefaultSize: true, 20118 autoComplete: "off", 20119 value: newName, 20120 onChange: setNewName, 20121 label: (0,external_wp_i18n_namespaceObject.__)('Name'), 20122 placeholder: (0,external_wp_i18n_namespaceObject.__)('Font size preset name') 20123 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 20124 justify: "right", 20125 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 20126 __next40pxDefaultSize: true, 20127 variant: "tertiary", 20128 onClick: toggleOpen, 20129 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 20130 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 20131 __next40pxDefaultSize: true, 20132 variant: "primary", 20133 type: "submit", 20134 children: (0,external_wp_i18n_namespaceObject.__)('Save') 20135 })] 20136 })] 20137 }) 20138 }) 20139 }); 20140 } 20141 /* harmony default export */ const rename_font_size_dialog = (RenameFontSizeDialog); 20142 20143 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/size-control/index.js 20144 /** 20145 * WordPress dependencies 20146 */ 20147 20148 /** 20149 * Internal dependencies 20150 */ 20151 20152 20153 const DEFAULT_UNITS = ['px', 'em', 'rem', 'vw', 'vh']; 20154 function SizeControl({ 20155 // Do not allow manipulation of margin bottom 20156 __nextHasNoMarginBottom, 20157 ...props 20158 }) { 20159 const { 20160 baseControlProps 20161 } = (0,external_wp_components_namespaceObject.useBaseControlProps)(props); 20162 const { 20163 value, 20164 onChange, 20165 fallbackValue, 20166 disabled, 20167 label 20168 } = props; 20169 const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ 20170 availableUnits: DEFAULT_UNITS 20171 }); 20172 const [valueQuantity, valueUnit = 'px'] = (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(value, units); 20173 const isValueUnitRelative = !!valueUnit && ['em', 'rem', 'vw', 'vh'].includes(valueUnit); 20174 20175 // Receives the new value from the UnitControl component as a string containing the value and unit. 20176 const handleUnitControlChange = newValue => { 20177 onChange(newValue); 20178 }; 20179 20180 // Receives the new value from the RangeControl component as a number. 20181 const handleRangeControlChange = newValue => { 20182 onChange?.(newValue + valueUnit); 20183 }; 20184 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl, { 20185 ...baseControlProps, 20186 __nextHasNoMarginBottom: true, 20187 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 20188 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 20189 isBlock: true, 20190 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { 20191 __next40pxDefaultSize: true, 20192 __nextHasNoMarginBottom: true, 20193 label: label, 20194 hideLabelFromVision: true, 20195 value: value, 20196 onChange: handleUnitControlChange, 20197 units: units, 20198 min: 0, 20199 disabled: disabled 20200 }) 20201 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 20202 isBlock: true, 20203 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 20204 marginX: 2, 20205 marginBottom: 0, 20206 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RangeControl, { 20207 __next40pxDefaultSize: true, 20208 __nextHasNoMarginBottom: true, 20209 label: label, 20210 hideLabelFromVision: true, 20211 value: valueQuantity, 20212 initialPosition: fallbackValue, 20213 withInputField: false, 20214 onChange: handleRangeControlChange, 20215 min: 0, 20216 max: isValueUnitRelative ? 10 : 100, 20217 step: isValueUnitRelative ? 0.1 : 1, 20218 disabled: disabled 20219 }) 20220 }) 20221 })] 20222 }) 20223 }); 20224 } 20225 /* harmony default export */ const size_control = (SizeControl); 20226 20227 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/font-size.js 20228 /** 20229 * WordPress dependencies 20230 */ 20231 20232 20233 20234 20235 20236 20237 /** 20238 * Internal dependencies 20239 */ 20240 20241 20242 20243 20244 20245 20246 20247 const { 20248 Menu 20249 } = unlock(external_wp_components_namespaceObject.privateApis); 20250 const { 20251 useGlobalSetting: font_size_useGlobalSetting 20252 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 20253 function FontSize() { 20254 var _fontSizes$origin; 20255 const [isDeleteConfirmOpen, setIsDeleteConfirmOpen] = (0,external_wp_element_namespaceObject.useState)(false); 20256 const [isRenameDialogOpen, setIsRenameDialogOpen] = (0,external_wp_element_namespaceObject.useState)(false); 20257 const { 20258 params: { 20259 origin, 20260 slug 20261 }, 20262 goBack 20263 } = (0,external_wp_components_namespaceObject.useNavigator)(); 20264 const [fontSizes, setFontSizes] = font_size_useGlobalSetting('typography.fontSizes'); 20265 const [globalFluid] = font_size_useGlobalSetting('typography.fluid'); 20266 20267 // Get the font sizes from the origin, default to empty array. 20268 const sizes = (_fontSizes$origin = fontSizes[origin]) !== null && _fontSizes$origin !== void 0 ? _fontSizes$origin : []; 20269 20270 // Get the font size by slug. 20271 const fontSize = sizes.find(size => size.slug === slug); 20272 20273 // Navigate to the font sizes list if the font size is not available. 20274 (0,external_wp_element_namespaceObject.useEffect)(() => { 20275 if (!!slug && !fontSize) { 20276 goBack(); 20277 } 20278 }, [slug, fontSize, goBack]); 20279 if (!origin || !slug || !fontSize) { 20280 return null; 20281 } 20282 20283 // Whether the font size is fluid. If not defined, use the global fluid value of the theme. 20284 const isFluid = fontSize?.fluid !== undefined ? !!fontSize.fluid : !!globalFluid; 20285 20286 // Whether custom fluid values are used. 20287 const isCustomFluid = typeof fontSize?.fluid === 'object'; 20288 const handleNameChange = value => { 20289 updateFontSize('name', value); 20290 }; 20291 const handleFontSizeChange = value => { 20292 updateFontSize('size', value); 20293 }; 20294 const handleFluidChange = value => { 20295 updateFontSize('fluid', value); 20296 }; 20297 const handleCustomFluidValues = value => { 20298 if (value) { 20299 // If custom values are used, init the values with the current ones. 20300 updateFontSize('fluid', { 20301 min: fontSize.size, 20302 max: fontSize.size 20303 }); 20304 } else { 20305 // If custom fluid values are disabled, set fluid to true. 20306 updateFontSize('fluid', true); 20307 } 20308 }; 20309 const handleMinChange = value => { 20310 updateFontSize('fluid', { 20311 ...fontSize.fluid, 20312 min: value 20313 }); 20314 }; 20315 const handleMaxChange = value => { 20316 updateFontSize('fluid', { 20317 ...fontSize.fluid, 20318 max: value 20319 }); 20320 }; 20321 const updateFontSize = (key, value) => { 20322 const newFontSizes = sizes.map(size => { 20323 if (size.slug === slug) { 20324 return { 20325 ...size, 20326 [key]: value 20327 }; // Create a new object with updated key 20328 } 20329 return size; 20330 }); 20331 setFontSizes({ 20332 ...fontSizes, 20333 [origin]: newFontSizes 20334 }); 20335 }; 20336 const handleRemoveFontSize = () => { 20337 const newFontSizes = sizes.filter(size => size.slug !== slug); 20338 setFontSizes({ 20339 ...fontSizes, 20340 [origin]: newFontSizes 20341 }); 20342 }; 20343 const toggleDeleteConfirm = () => { 20344 setIsDeleteConfirmOpen(!isDeleteConfirmOpen); 20345 }; 20346 const toggleRenameDialog = () => { 20347 setIsRenameDialogOpen(!isRenameDialogOpen); 20348 }; 20349 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 20350 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(confirm_delete_font_size_dialog, { 20351 fontSize: fontSize, 20352 isOpen: isDeleteConfirmOpen, 20353 toggleOpen: toggleDeleteConfirm, 20354 handleRemoveFontSize: handleRemoveFontSize 20355 }), isRenameDialogOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(rename_font_size_dialog, { 20356 fontSize: fontSize, 20357 toggleOpen: toggleRenameDialog, 20358 handleRename: handleNameChange 20359 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 20360 spacing: 4, 20361 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 20362 justify: "space-between", 20363 align: "flex-start", 20364 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 20365 title: fontSize.name, 20366 description: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: font size preset name. */ 20367 (0,external_wp_i18n_namespaceObject.__)('Manage the font size %s.'), fontSize.name) 20368 }), origin === 'custom' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 20369 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 20370 marginTop: 3, 20371 marginBottom: 0, 20372 paddingX: 4, 20373 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Menu, { 20374 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.TriggerButton, { 20375 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 20376 size: "small", 20377 icon: more_vertical, 20378 label: (0,external_wp_i18n_namespaceObject.__)('Font size options') 20379 }) 20380 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Menu.Popover, { 20381 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.Item, { 20382 onClick: toggleRenameDialog, 20383 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.ItemLabel, { 20384 children: (0,external_wp_i18n_namespaceObject.__)('Rename') 20385 }) 20386 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.Item, { 20387 onClick: toggleDeleteConfirm, 20388 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.ItemLabel, { 20389 children: (0,external_wp_i18n_namespaceObject.__)('Delete') 20390 }) 20391 })] 20392 })] 20393 }) 20394 }) 20395 })] 20396 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalView, { 20397 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 20398 paddingX: 4, 20399 marginBottom: 0, 20400 paddingBottom: 6, 20401 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 20402 spacing: 4, 20403 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 20404 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_size_preview, { 20405 fontSize: fontSize 20406 }) 20407 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(size_control, { 20408 label: (0,external_wp_i18n_namespaceObject.__)('Size'), 20409 value: !isCustomFluid ? fontSize.size : '', 20410 onChange: handleFontSizeChange, 20411 disabled: isCustomFluid 20412 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { 20413 label: (0,external_wp_i18n_namespaceObject.__)('Fluid typography'), 20414 help: (0,external_wp_i18n_namespaceObject.__)('Scale the font size dynamically to fit the screen or viewport.'), 20415 checked: isFluid, 20416 onChange: handleFluidChange, 20417 __nextHasNoMarginBottom: true 20418 }), isFluid && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { 20419 label: (0,external_wp_i18n_namespaceObject.__)('Custom fluid values'), 20420 help: (0,external_wp_i18n_namespaceObject.__)('Set custom min and max values for the fluid font size.'), 20421 checked: isCustomFluid, 20422 onChange: handleCustomFluidValues, 20423 __nextHasNoMarginBottom: true 20424 }), isCustomFluid && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 20425 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(size_control, { 20426 label: (0,external_wp_i18n_namespaceObject.__)('Minimum'), 20427 value: fontSize.fluid?.min, 20428 onChange: handleMinChange 20429 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(size_control, { 20430 label: (0,external_wp_i18n_namespaceObject.__)('Maximum'), 20431 value: fontSize.fluid?.max, 20432 onChange: handleMaxChange 20433 })] 20434 })] 20435 }) 20436 }) 20437 })] 20438 })] 20439 }); 20440 } 20441 /* harmony default export */ const font_size = (FontSize); 20442 20443 ;// ./node_modules/@wordpress/icons/build-module/library/plus.js 20444 /** 20445 * WordPress dependencies 20446 */ 20447 20448 20449 const plus = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 20450 xmlns: "http://www.w3.org/2000/svg", 20451 viewBox: "0 0 24 24", 20452 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 20453 d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z" 20454 }) 20455 }); 20456 /* harmony default export */ const library_plus = (plus); 20457 20458 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/confirm-reset-font-sizes-dialog.js 20459 /** 20460 * WordPress dependencies 20461 */ 20462 20463 20464 20465 function ConfirmResetFontSizesDialog({ 20466 text, 20467 confirmButtonText, 20468 isOpen, 20469 toggleOpen, 20470 onConfirm 20471 }) { 20472 const handleConfirm = async () => { 20473 toggleOpen(); 20474 onConfirm(); 20475 }; 20476 const handleCancel = () => { 20477 toggleOpen(); 20478 }; 20479 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { 20480 isOpen: isOpen, 20481 cancelButtonText: (0,external_wp_i18n_namespaceObject.__)('Cancel'), 20482 confirmButtonText: confirmButtonText, 20483 onCancel: handleCancel, 20484 onConfirm: handleConfirm, 20485 size: "medium", 20486 children: text 20487 }); 20488 } 20489 /* harmony default export */ const confirm_reset_font_sizes_dialog = (ConfirmResetFontSizesDialog); 20490 20491 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/font-sizes.js 20492 /** 20493 * WordPress dependencies 20494 */ 20495 20496 20497 20498 20499 20500 20501 /** 20502 * Internal dependencies 20503 */ 20504 20505 20506 20507 20508 20509 20510 20511 const { 20512 Menu: font_sizes_Menu 20513 } = unlock(external_wp_components_namespaceObject.privateApis); 20514 const { 20515 useGlobalSetting: font_sizes_useGlobalSetting 20516 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 20517 function FontSizeGroup({ 20518 label, 20519 origin, 20520 sizes, 20521 handleAddFontSize, 20522 handleResetFontSizes 20523 }) { 20524 const [isResetDialogOpen, setIsResetDialogOpen] = (0,external_wp_element_namespaceObject.useState)(false); 20525 const toggleResetDialog = () => setIsResetDialogOpen(!isResetDialogOpen); 20526 const resetDialogText = origin === 'custom' ? (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to remove all custom font size presets?') : (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to reset all font size presets to their default values?'); 20527 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 20528 children: [isResetDialogOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(confirm_reset_font_sizes_dialog, { 20529 text: resetDialogText, 20530 confirmButtonText: origin === 'custom' ? (0,external_wp_i18n_namespaceObject.__)('Remove') : (0,external_wp_i18n_namespaceObject.__)('Reset'), 20531 isOpen: isResetDialogOpen, 20532 toggleOpen: toggleResetDialog, 20533 onConfirm: handleResetFontSizes 20534 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 20535 spacing: 4, 20536 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 20537 justify: "space-between", 20538 align: "center", 20539 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { 20540 level: 3, 20541 children: label 20542 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.FlexItem, { 20543 children: [origin === 'custom' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 20544 label: (0,external_wp_i18n_namespaceObject.__)('Add font size'), 20545 icon: library_plus, 20546 size: "small", 20547 onClick: handleAddFontSize 20548 }), !!handleResetFontSizes && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(font_sizes_Menu, { 20549 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_sizes_Menu.TriggerButton, { 20550 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 20551 size: "small", 20552 icon: more_vertical, 20553 label: (0,external_wp_i18n_namespaceObject.__)('Font size presets options') 20554 }) 20555 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_sizes_Menu.Popover, { 20556 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_sizes_Menu.Item, { 20557 onClick: toggleResetDialog, 20558 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_sizes_Menu.ItemLabel, { 20559 children: origin === 'custom' ? (0,external_wp_i18n_namespaceObject.__)('Remove font size presets') : (0,external_wp_i18n_namespaceObject.__)('Reset font size presets') 20560 }) 20561 }) 20562 })] 20563 })] 20564 })] 20565 }), !!sizes.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 20566 isBordered: true, 20567 isSeparated: true, 20568 children: sizes.map(size => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 20569 path: `/typography/font-sizes/$origin}/$size.slug}`, 20570 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 20571 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 20572 className: "edit-site-font-size__item", 20573 children: size.name 20574 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 20575 display: "flex", 20576 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { 20577 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right 20578 }) 20579 })] 20580 }) 20581 }, size.slug)) 20582 })] 20583 })] 20584 }); 20585 } 20586 function font_sizes_FontSizes() { 20587 const [themeFontSizes, setThemeFontSizes] = font_sizes_useGlobalSetting('typography.fontSizes.theme'); 20588 const [baseThemeFontSizes] = font_sizes_useGlobalSetting('typography.fontSizes.theme', null, 'base'); 20589 const [defaultFontSizes, setDefaultFontSizes] = font_sizes_useGlobalSetting('typography.fontSizes.default'); 20590 const [baseDefaultFontSizes] = font_sizes_useGlobalSetting('typography.fontSizes.default', null, 'base'); 20591 const [customFontSizes = [], setCustomFontSizes] = font_sizes_useGlobalSetting('typography.fontSizes.custom'); 20592 const [defaultFontSizesEnabled] = font_sizes_useGlobalSetting('typography.defaultFontSizes'); 20593 const handleAddFontSize = () => { 20594 const index = getNewIndexFromPresets(customFontSizes, 'custom-'); 20595 const newFontSize = { 20596 /* translators: %d: font size index */ 20597 name: (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('New Font Size %d'), index), 20598 size: '16px', 20599 slug: `custom-$index}` 20600 }; 20601 setCustomFontSizes([...customFontSizes, newFontSize]); 20602 }; 20603 const hasSameSizeValues = (arr1, arr2) => arr1.map(item => item.size).join('') === arr2.map(item => item.size).join(''); 20604 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 20605 spacing: 2, 20606 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 20607 title: (0,external_wp_i18n_namespaceObject.__)('Font size presets'), 20608 description: (0,external_wp_i18n_namespaceObject.__)('Create and edit the presets used for font sizes across the site.') 20609 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalView, { 20610 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 20611 paddingX: 4, 20612 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 20613 spacing: 8, 20614 children: [!!themeFontSizes?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FontSizeGroup, { 20615 label: (0,external_wp_i18n_namespaceObject.__)('Theme'), 20616 origin: "theme", 20617 sizes: themeFontSizes, 20618 baseSizes: baseThemeFontSizes, 20619 handleAddFontSize: handleAddFontSize, 20620 handleResetFontSizes: hasSameSizeValues(themeFontSizes, baseThemeFontSizes) ? null : () => setThemeFontSizes(baseThemeFontSizes) 20621 }), defaultFontSizesEnabled && !!defaultFontSizes?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FontSizeGroup, { 20622 label: (0,external_wp_i18n_namespaceObject.__)('Default'), 20623 origin: "default", 20624 sizes: defaultFontSizes, 20625 baseSizes: baseDefaultFontSizes, 20626 handleAddFontSize: handleAddFontSize, 20627 handleResetFontSizes: hasSameSizeValues(defaultFontSizes, baseDefaultFontSizes) ? null : () => setDefaultFontSizes(baseDefaultFontSizes) 20628 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FontSizeGroup, { 20629 label: (0,external_wp_i18n_namespaceObject.__)('Custom'), 20630 origin: "custom", 20631 sizes: customFontSizes, 20632 handleAddFontSize: handleAddFontSize, 20633 handleResetFontSizes: customFontSizes.length > 0 ? () => setCustomFontSizes([]) : null 20634 })] 20635 }) 20636 }) 20637 })] 20638 }); 20639 } 20640 /* harmony default export */ const font_sizes = (font_sizes_FontSizes); 20641 20642 ;// ./node_modules/@wordpress/icons/build-module/library/shuffle.js 20643 /** 20644 * WordPress dependencies 20645 */ 20646 20647 20648 const shuffle = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 20649 viewBox: "0 0 24 24", 20650 xmlns: "http://www.w3.org/2000/SVG", 20651 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 20652 d: "M17.192 6.75L15.47 5.03l1.06-1.06 3.537 3.53-3.537 3.53-1.06-1.06 1.723-1.72h-3.19c-.602 0-.993.202-1.28.498-.309.319-.538.792-.695 1.383-.13.488-.222 1.023-.296 1.508-.034.664-.116 1.413-.303 2.117-.193.721-.513 1.467-1.068 2.04-.575.594-1.359.954-2.357.954H4v-1.5h4.003c.601 0 .993-.202 1.28-.498.308-.319.538-.792.695-1.383.149-.557.216-1.093.288-1.662l.039-.31a9.653 9.653 0 0 1 .272-1.653c.193-.722.513-1.467 1.067-2.04.576-.594 1.36-.954 2.358-.954h3.19zM8.004 6.75c.8 0 1.46.23 1.988.628a6.24 6.24 0 0 0-.684 1.396 1.725 1.725 0 0 0-.024-.026c-.287-.296-.679-.498-1.28-.498H4v-1.5h4.003zM12.699 14.726c-.161.459-.38.94-.684 1.396.527.397 1.188.628 1.988.628h3.19l-1.722 1.72 1.06 1.06L20.067 16l-3.537-3.53-1.06 1.06 1.723 1.72h-3.19c-.602 0-.993-.202-1.28-.498a1.96 1.96 0 0 1-.024-.026z" 20653 }) 20654 }); 20655 /* harmony default export */ const library_shuffle = (shuffle); 20656 20657 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/color-indicator-wrapper.js 20658 /** 20659 * External dependencies 20660 */ 20661 20662 20663 /** 20664 * WordPress dependencies 20665 */ 20666 20667 20668 function ColorIndicatorWrapper({ 20669 className, 20670 ...props 20671 }) { 20672 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { 20673 className: dist_clsx('edit-site-global-styles__color-indicator-wrapper', className), 20674 ...props 20675 }); 20676 } 20677 /* harmony default export */ const color_indicator_wrapper = (ColorIndicatorWrapper); 20678 20679 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/palette.js 20680 /** 20681 * WordPress dependencies 20682 */ 20683 20684 20685 20686 20687 20688 20689 /** 20690 * Internal dependencies 20691 */ 20692 20693 20694 20695 20696 20697 20698 const { 20699 useGlobalSetting: palette_useGlobalSetting 20700 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 20701 const EMPTY_COLORS = []; 20702 function Palette({ 20703 name 20704 }) { 20705 const [customColors] = palette_useGlobalSetting('color.palette.custom'); 20706 const [themeColors] = palette_useGlobalSetting('color.palette.theme'); 20707 const [defaultColors] = palette_useGlobalSetting('color.palette.default'); 20708 const [defaultPaletteEnabled] = palette_useGlobalSetting('color.defaultPalette', name); 20709 const [randomizeThemeColors] = useColorRandomizer(); 20710 const colors = (0,external_wp_element_namespaceObject.useMemo)(() => [...(customColors || EMPTY_COLORS), ...(themeColors || EMPTY_COLORS), ...(defaultColors && defaultPaletteEnabled ? defaultColors : EMPTY_COLORS)], [customColors, themeColors, defaultColors, defaultPaletteEnabled]); 20711 const screenPath = !name ? '/colors/palette' : '/blocks/' + encodeURIComponent(name) + '/colors/palette'; 20712 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 20713 spacing: 3, 20714 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { 20715 level: 3, 20716 children: (0,external_wp_i18n_namespaceObject.__)('Palette') 20717 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 20718 isBordered: true, 20719 isSeparated: true, 20720 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 20721 path: screenPath, 20722 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 20723 direction: "row", 20724 children: [colors.length > 0 ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 20725 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalZStack, { 20726 isLayered: false, 20727 offset: -8, 20728 children: colors.slice(0, 5).map(({ 20729 color 20730 }, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(color_indicator_wrapper, { 20731 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ColorIndicator, { 20732 colorValue: color 20733 }) 20734 }, `$color}-$index}`)) 20735 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 20736 isBlock: true, 20737 children: (0,external_wp_i18n_namespaceObject.__)('Edit palette') 20738 })] 20739 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 20740 children: (0,external_wp_i18n_namespaceObject.__)('Add colors') 20741 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { 20742 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right 20743 })] 20744 }) 20745 }) 20746 }), window.__experimentalEnableColorRandomizer && themeColors?.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 20747 __next40pxDefaultSize: true, 20748 variant: "secondary", 20749 icon: library_shuffle, 20750 onClick: randomizeThemeColors, 20751 children: (0,external_wp_i18n_namespaceObject.__)('Randomize colors') 20752 })] 20753 }); 20754 } 20755 /* harmony default export */ const palette = (Palette); 20756 20757 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-colors.js 20758 /** 20759 * WordPress dependencies 20760 */ 20761 20762 20763 20764 20765 /** 20766 * Internal dependencies 20767 */ 20768 20769 20770 20771 20772 const { 20773 useGlobalStyle: screen_colors_useGlobalStyle, 20774 useGlobalSetting: screen_colors_useGlobalSetting, 20775 useSettingsForBlockElement: screen_colors_useSettingsForBlockElement, 20776 ColorPanel: screen_colors_StylesColorPanel 20777 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 20778 function ScreenColors() { 20779 const [style] = screen_colors_useGlobalStyle('', undefined, 'user', { 20780 shouldDecodeEncode: false 20781 }); 20782 const [inheritedStyle, setStyle] = screen_colors_useGlobalStyle('', undefined, 'all', { 20783 shouldDecodeEncode: false 20784 }); 20785 const [rawSettings] = screen_colors_useGlobalSetting(''); 20786 const settings = screen_colors_useSettingsForBlockElement(rawSettings); 20787 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 20788 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 20789 title: (0,external_wp_i18n_namespaceObject.__)('Colors'), 20790 description: (0,external_wp_i18n_namespaceObject.__)('Palette colors and the application of those colors on site elements.') 20791 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 20792 className: "edit-site-global-styles-screen", 20793 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 20794 spacing: 7, 20795 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(palette, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_colors_StylesColorPanel, { 20796 inheritedValue: inheritedStyle, 20797 value: style, 20798 onChange: setStyle, 20799 settings: settings 20800 })] 20801 }) 20802 })] 20803 }); 20804 } 20805 /* harmony default export */ const screen_colors = (ScreenColors); 20806 20807 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preset-colors.js 20808 /** 20809 * Internal dependencies 20810 */ 20811 20812 20813 function PresetColors() { 20814 const { 20815 paletteColors 20816 } = useStylesPreviewColors(); 20817 return paletteColors.slice(0, 4).map(({ 20818 slug, 20819 color 20820 }, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 20821 style: { 20822 flexGrow: 1, 20823 height: '100%', 20824 background: color 20825 } 20826 }, `$slug}-$index}`)); 20827 } 20828 20829 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preview-colors.js 20830 /** 20831 * WordPress dependencies 20832 */ 20833 20834 20835 /** 20836 * Internal dependencies 20837 */ 20838 20839 20840 20841 const preview_colors_firstFrameVariants = { 20842 start: { 20843 scale: 1, 20844 opacity: 1 20845 }, 20846 hover: { 20847 scale: 0, 20848 opacity: 0 20849 } 20850 }; 20851 const StylesPreviewColors = ({ 20852 label, 20853 isFocused, 20854 withHoverView 20855 }) => { 20856 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreviewWrapper, { 20857 label: label, 20858 isFocused: isFocused, 20859 withHoverView: withHoverView, 20860 children: ({ 20861 key 20862 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { 20863 variants: preview_colors_firstFrameVariants, 20864 style: { 20865 height: '100%', 20866 overflow: 'hidden' 20867 }, 20868 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 20869 spacing: 0, 20870 justify: "center", 20871 style: { 20872 height: '100%', 20873 overflow: 'hidden' 20874 }, 20875 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PresetColors, {}) 20876 }) 20877 }, key) 20878 }); 20879 }; 20880 /* harmony default export */ const preview_colors = (StylesPreviewColors); 20881 20882 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/variations/variations-color.js 20883 /** 20884 * WordPress dependencies 20885 */ 20886 20887 20888 /** 20889 * Internal dependencies 20890 */ 20891 20892 20893 20894 20895 20896 function ColorVariations({ 20897 title, 20898 gap = 2 20899 }) { 20900 const propertiesToFilter = ['color']; 20901 const colorVariations = useCurrentMergeThemeStyleVariationsWithUserConfig(propertiesToFilter); 20902 20903 // Return null if there is only one variation (the default). 20904 if (colorVariations?.length <= 1) { 20905 return null; 20906 } 20907 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 20908 spacing: 3, 20909 children: [title && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { 20910 level: 3, 20911 children: title 20912 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, { 20913 spacing: gap, 20914 children: colorVariations.map((variation, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Variation, { 20915 variation: variation, 20916 isPill: true, 20917 properties: propertiesToFilter, 20918 showTooltip: true, 20919 children: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(preview_colors, {}) 20920 }, index)) 20921 })] 20922 }); 20923 } 20924 20925 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/color-palette-panel.js 20926 /** 20927 * WordPress dependencies 20928 */ 20929 20930 20931 20932 20933 20934 /** 20935 * Internal dependencies 20936 */ 20937 20938 20939 20940 const { 20941 useGlobalSetting: color_palette_panel_useGlobalSetting 20942 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 20943 const mobilePopoverProps = { 20944 placement: 'bottom-start', 20945 offset: 8 20946 }; 20947 function ColorPalettePanel({ 20948 name 20949 }) { 20950 const [themeColors, setThemeColors] = color_palette_panel_useGlobalSetting('color.palette.theme', name); 20951 const [baseThemeColors] = color_palette_panel_useGlobalSetting('color.palette.theme', name, 'base'); 20952 const [defaultColors, setDefaultColors] = color_palette_panel_useGlobalSetting('color.palette.default', name); 20953 const [baseDefaultColors] = color_palette_panel_useGlobalSetting('color.palette.default', name, 'base'); 20954 const [customColors, setCustomColors] = color_palette_panel_useGlobalSetting('color.palette.custom', name); 20955 const [defaultPaletteEnabled] = color_palette_panel_useGlobalSetting('color.defaultPalette', name); 20956 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('small', '<'); 20957 const popoverProps = isMobileViewport ? mobilePopoverProps : undefined; 20958 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 20959 className: "edit-site-global-styles-color-palette-panel", 20960 spacing: 8, 20961 children: [!!themeColors && !!themeColors.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalPaletteEdit, { 20962 canReset: themeColors !== baseThemeColors, 20963 canOnlyChangeValues: true, 20964 colors: themeColors, 20965 onChange: setThemeColors, 20966 paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Theme'), 20967 paletteLabelHeadingLevel: 3, 20968 popoverProps: popoverProps 20969 }), !!defaultColors && !!defaultColors.length && !!defaultPaletteEnabled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalPaletteEdit, { 20970 canReset: defaultColors !== baseDefaultColors, 20971 canOnlyChangeValues: true, 20972 colors: defaultColors, 20973 onChange: setDefaultColors, 20974 paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Default'), 20975 paletteLabelHeadingLevel: 3, 20976 popoverProps: popoverProps 20977 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalPaletteEdit, { 20978 colors: customColors, 20979 onChange: setCustomColors, 20980 paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Custom'), 20981 paletteLabelHeadingLevel: 3, 20982 slugPrefix: "custom-", 20983 popoverProps: popoverProps 20984 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorVariations, { 20985 title: (0,external_wp_i18n_namespaceObject.__)('Palettes') 20986 })] 20987 }); 20988 } 20989 20990 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/gradients-palette-panel.js 20991 /** 20992 * WordPress dependencies 20993 */ 20994 20995 20996 20997 20998 20999 /** 21000 * Internal dependencies 21001 */ 21002 21003 21004 21005 const { 21006 useGlobalSetting: gradients_palette_panel_useGlobalSetting 21007 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 21008 const gradients_palette_panel_mobilePopoverProps = { 21009 placement: 'bottom-start', 21010 offset: 8 21011 }; 21012 const noop = () => {}; 21013 function GradientPalettePanel({ 21014 name 21015 }) { 21016 const [themeGradients, setThemeGradients] = gradients_palette_panel_useGlobalSetting('color.gradients.theme', name); 21017 const [baseThemeGradients] = gradients_palette_panel_useGlobalSetting('color.gradients.theme', name, 'base'); 21018 const [defaultGradients, setDefaultGradients] = gradients_palette_panel_useGlobalSetting('color.gradients.default', name); 21019 const [baseDefaultGradients] = gradients_palette_panel_useGlobalSetting('color.gradients.default', name, 'base'); 21020 const [customGradients, setCustomGradients] = gradients_palette_panel_useGlobalSetting('color.gradients.custom', name); 21021 const [defaultPaletteEnabled] = gradients_palette_panel_useGlobalSetting('color.defaultGradients', name); 21022 const [customDuotone] = gradients_palette_panel_useGlobalSetting('color.duotone.custom') || []; 21023 const [defaultDuotone] = gradients_palette_panel_useGlobalSetting('color.duotone.default') || []; 21024 const [themeDuotone] = gradients_palette_panel_useGlobalSetting('color.duotone.theme') || []; 21025 const [defaultDuotoneEnabled] = gradients_palette_panel_useGlobalSetting('color.defaultDuotone'); 21026 const duotonePalette = [...(customDuotone || []), ...(themeDuotone || []), ...(defaultDuotone && defaultDuotoneEnabled ? defaultDuotone : [])]; 21027 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('small', '<'); 21028 const popoverProps = isMobileViewport ? gradients_palette_panel_mobilePopoverProps : undefined; 21029 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 21030 className: "edit-site-global-styles-gradient-palette-panel", 21031 spacing: 8, 21032 children: [!!themeGradients && !!themeGradients.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalPaletteEdit, { 21033 canReset: themeGradients !== baseThemeGradients, 21034 canOnlyChangeValues: true, 21035 gradients: themeGradients, 21036 onChange: setThemeGradients, 21037 paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Theme'), 21038 paletteLabelHeadingLevel: 3, 21039 popoverProps: popoverProps 21040 }), !!defaultGradients && !!defaultGradients.length && !!defaultPaletteEnabled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalPaletteEdit, { 21041 canReset: defaultGradients !== baseDefaultGradients, 21042 canOnlyChangeValues: true, 21043 gradients: defaultGradients, 21044 onChange: setDefaultGradients, 21045 paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Default'), 21046 paletteLabelLevel: 3, 21047 popoverProps: popoverProps 21048 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalPaletteEdit, { 21049 gradients: customGradients, 21050 onChange: setCustomGradients, 21051 paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Custom'), 21052 paletteLabelLevel: 3, 21053 slugPrefix: "custom-", 21054 popoverProps: popoverProps 21055 }), !!duotonePalette && !!duotonePalette.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 21056 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { 21057 level: 3, 21058 children: (0,external_wp_i18n_namespaceObject.__)('Duotone') 21059 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 21060 margin: 3 21061 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DuotonePicker, { 21062 duotonePalette: duotonePalette, 21063 disableCustomDuotone: true, 21064 disableCustomColors: true, 21065 clearable: false, 21066 onChange: noop 21067 })] 21068 })] 21069 }); 21070 } 21071 21072 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-color-palette.js 21073 /** 21074 * WordPress dependencies 21075 */ 21076 21077 21078 21079 /** 21080 * Internal dependencies 21081 */ 21082 21083 21084 21085 21086 21087 const { 21088 Tabs: screen_color_palette_Tabs 21089 } = unlock(external_wp_components_namespaceObject.privateApis); 21090 function ScreenColorPalette({ 21091 name 21092 }) { 21093 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 21094 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 21095 title: (0,external_wp_i18n_namespaceObject.__)('Edit palette'), 21096 description: (0,external_wp_i18n_namespaceObject.__)('The combination of colors used across the site and in color pickers.') 21097 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(screen_color_palette_Tabs, { 21098 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(screen_color_palette_Tabs.TabList, { 21099 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette_Tabs.Tab, { 21100 tabId: "color", 21101 children: (0,external_wp_i18n_namespaceObject.__)('Color') 21102 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette_Tabs.Tab, { 21103 tabId: "gradient", 21104 children: (0,external_wp_i18n_namespaceObject.__)('Gradient') 21105 })] 21106 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette_Tabs.TabPanel, { 21107 tabId: "color", 21108 focusable: false, 21109 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorPalettePanel, { 21110 name: name 21111 }) 21112 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette_Tabs.TabPanel, { 21113 tabId: "gradient", 21114 focusable: false, 21115 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GradientPalettePanel, { 21116 name: name 21117 }) 21118 })] 21119 })] 21120 }); 21121 } 21122 /* harmony default export */ const screen_color_palette = (ScreenColorPalette); 21123 21124 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/background-panel.js 21125 /** 21126 * WordPress dependencies 21127 */ 21128 21129 21130 /** 21131 * Internal dependencies 21132 */ 21133 21134 21135 // Initial control values where no block style is set. 21136 21137 const BACKGROUND_DEFAULT_VALUES = { 21138 backgroundSize: 'auto' 21139 }; 21140 const { 21141 useGlobalStyle: background_panel_useGlobalStyle, 21142 useGlobalSetting: background_panel_useGlobalSetting, 21143 BackgroundPanel: background_panel_StylesBackgroundPanel 21144 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 21145 21146 /** 21147 * Checks if there is a current value in the background image block support 21148 * attributes. 21149 * 21150 * @param {Object} style Style attribute. 21151 * @return {boolean} Whether the block has a background image value set. 21152 */ 21153 function hasBackgroundImageValue(style) { 21154 return !!style?.background?.backgroundImage?.id || !!style?.background?.backgroundImage?.url || typeof style?.background?.backgroundImage === 'string'; 21155 } 21156 function BackgroundPanel() { 21157 const [style] = background_panel_useGlobalStyle('', undefined, 'user', { 21158 shouldDecodeEncode: false 21159 }); 21160 const [inheritedStyle, setStyle] = background_panel_useGlobalStyle('', undefined, 'all', { 21161 shouldDecodeEncode: false 21162 }); 21163 const [settings] = background_panel_useGlobalSetting(''); 21164 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(background_panel_StylesBackgroundPanel, { 21165 inheritedValue: inheritedStyle, 21166 value: style, 21167 onChange: setStyle, 21168 settings: settings, 21169 defaultValues: BACKGROUND_DEFAULT_VALUES 21170 }); 21171 } 21172 21173 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-background.js 21174 /** 21175 * WordPress dependencies 21176 */ 21177 21178 21179 21180 21181 /** 21182 * Internal dependencies 21183 */ 21184 21185 21186 21187 21188 const { 21189 useHasBackgroundPanel: screen_background_useHasBackgroundPanel, 21190 useGlobalSetting: screen_background_useGlobalSetting 21191 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 21192 function ScreenBackground() { 21193 const [settings] = screen_background_useGlobalSetting(''); 21194 const hasBackgroundPanel = screen_background_useHasBackgroundPanel(settings); 21195 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 21196 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 21197 title: (0,external_wp_i18n_namespaceObject.__)('Background'), 21198 description: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 21199 children: (0,external_wp_i18n_namespaceObject.__)('Set styles for the site’s background.') 21200 }) 21201 }), hasBackgroundPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BackgroundPanel, {})] 21202 }); 21203 } 21204 /* harmony default export */ const screen_background = (ScreenBackground); 21205 21206 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/confirm-reset-shadow-dialog.js 21207 /** 21208 * WordPress dependencies 21209 */ 21210 21211 21212 21213 function ConfirmResetShadowDialog({ 21214 text, 21215 confirmButtonText, 21216 isOpen, 21217 toggleOpen, 21218 onConfirm 21219 }) { 21220 const handleConfirm = async () => { 21221 toggleOpen(); 21222 onConfirm(); 21223 }; 21224 const handleCancel = () => { 21225 toggleOpen(); 21226 }; 21227 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { 21228 isOpen: isOpen, 21229 cancelButtonText: (0,external_wp_i18n_namespaceObject.__)('Cancel'), 21230 confirmButtonText: confirmButtonText, 21231 onCancel: handleCancel, 21232 onConfirm: handleConfirm, 21233 size: "medium", 21234 children: text 21235 }); 21236 } 21237 /* harmony default export */ const confirm_reset_shadow_dialog = (ConfirmResetShadowDialog); 21238 21239 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/shadows-panel.js 21240 /** 21241 * WordPress dependencies 21242 */ 21243 21244 21245 21246 21247 21248 /** 21249 * Internal dependencies 21250 */ 21251 21252 21253 21254 21255 21256 21257 21258 21259 const { 21260 useGlobalSetting: shadows_panel_useGlobalSetting 21261 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 21262 const { 21263 Menu: shadows_panel_Menu 21264 } = unlock(external_wp_components_namespaceObject.privateApis); 21265 const defaultShadow = '6px 6px 9px rgba(0, 0, 0, 0.2)'; 21266 function ShadowsPanel() { 21267 const [defaultShadows] = shadows_panel_useGlobalSetting('shadow.presets.default'); 21268 const [defaultShadowsEnabled] = shadows_panel_useGlobalSetting('shadow.defaultPresets'); 21269 const [themeShadows] = shadows_panel_useGlobalSetting('shadow.presets.theme'); 21270 const [customShadows, setCustomShadows] = shadows_panel_useGlobalSetting('shadow.presets.custom'); 21271 const onCreateShadow = shadow => { 21272 setCustomShadows([...(customShadows || []), shadow]); 21273 }; 21274 const handleResetShadows = () => { 21275 setCustomShadows([]); 21276 }; 21277 const [isResetDialogOpen, setIsResetDialogOpen] = (0,external_wp_element_namespaceObject.useState)(false); 21278 const toggleResetDialog = () => setIsResetDialogOpen(!isResetDialogOpen); 21279 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 21280 children: [isResetDialogOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(confirm_reset_shadow_dialog, { 21281 text: (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to remove all custom shadows?'), 21282 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Remove'), 21283 isOpen: isResetDialogOpen, 21284 toggleOpen: toggleResetDialog, 21285 onConfirm: handleResetShadows 21286 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 21287 title: (0,external_wp_i18n_namespaceObject.__)('Shadows'), 21288 description: (0,external_wp_i18n_namespaceObject.__)('Manage and create shadow styles for use across the site.') 21289 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 21290 className: "edit-site-global-styles-screen", 21291 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 21292 className: "edit-site-global-styles__shadows-panel", 21293 spacing: 7, 21294 children: [defaultShadowsEnabled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowList, { 21295 label: (0,external_wp_i18n_namespaceObject.__)('Default'), 21296 shadows: defaultShadows || [], 21297 category: "default" 21298 }), themeShadows && themeShadows.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowList, { 21299 label: (0,external_wp_i18n_namespaceObject.__)('Theme'), 21300 shadows: themeShadows || [], 21301 category: "theme" 21302 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowList, { 21303 label: (0,external_wp_i18n_namespaceObject.__)('Custom'), 21304 shadows: customShadows || [], 21305 category: "custom", 21306 canCreate: true, 21307 onCreate: onCreateShadow, 21308 onReset: toggleResetDialog 21309 })] 21310 }) 21311 })] 21312 }); 21313 } 21314 function ShadowList({ 21315 label, 21316 shadows, 21317 category, 21318 canCreate, 21319 onCreate, 21320 onReset 21321 }) { 21322 const handleAddShadow = () => { 21323 const newIndex = getNewIndexFromPresets(shadows, 'shadow-'); 21324 onCreate({ 21325 name: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: is an index for a preset */ 21326 (0,external_wp_i18n_namespaceObject.__)('Shadow %s'), newIndex), 21327 shadow: defaultShadow, 21328 slug: `shadow-$newIndex}` 21329 }); 21330 }; 21331 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 21332 spacing: 2, 21333 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 21334 justify: "space-between", 21335 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { 21336 align: "center", 21337 className: "edit-site-global-styles__shadows-panel__title", 21338 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { 21339 level: 3, 21340 children: label 21341 }) 21342 }), canCreate && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 21343 className: "edit-site-global-styles__shadows-panel__options-container", 21344 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 21345 size: "small", 21346 icon: library_plus, 21347 label: (0,external_wp_i18n_namespaceObject.__)('Add shadow'), 21348 onClick: () => { 21349 handleAddShadow(); 21350 } 21351 }) 21352 }), !!shadows?.length && category === 'custom' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(shadows_panel_Menu, { 21353 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_panel_Menu.TriggerButton, { 21354 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 21355 size: "small", 21356 icon: more_vertical, 21357 label: (0,external_wp_i18n_namespaceObject.__)('Shadow options') 21358 }) 21359 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_panel_Menu.Popover, { 21360 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_panel_Menu.Item, { 21361 onClick: onReset, 21362 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_panel_Menu.ItemLabel, { 21363 children: (0,external_wp_i18n_namespaceObject.__)('Remove all custom shadows') 21364 }) 21365 }) 21366 })] 21367 })] 21368 }), shadows.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 21369 isBordered: true, 21370 isSeparated: true, 21371 children: shadows.map(shadow => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowItem, { 21372 shadow: shadow, 21373 category: category 21374 }, shadow.slug)) 21375 })] 21376 }); 21377 } 21378 function ShadowItem({ 21379 shadow, 21380 category 21381 }) { 21382 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { 21383 path: `/shadows/edit/$category}/$shadow.slug}`, 21384 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 21385 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 21386 children: shadow.name 21387 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { 21388 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right 21389 })] 21390 }) 21391 }); 21392 } 21393 21394 ;// ./node_modules/@wordpress/icons/build-module/library/reset.js 21395 /** 21396 * WordPress dependencies 21397 */ 21398 21399 21400 const reset_reset = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 21401 xmlns: "http://www.w3.org/2000/svg", 21402 viewBox: "0 0 24 24", 21403 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 21404 d: "M7 11.5h10V13H7z" 21405 }) 21406 }); 21407 /* harmony default export */ const library_reset = (reset_reset); 21408 21409 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/shadow-utils.js 21410 const CUSTOM_VALUE_SETTINGS = { 21411 px: { 21412 max: 20, 21413 step: 1 21414 }, 21415 '%': { 21416 max: 100, 21417 step: 1 21418 }, 21419 vw: { 21420 max: 100, 21421 step: 1 21422 }, 21423 vh: { 21424 max: 100, 21425 step: 1 21426 }, 21427 em: { 21428 max: 10, 21429 step: 0.1 21430 }, 21431 rm: { 21432 max: 10, 21433 step: 0.1 21434 }, 21435 svw: { 21436 max: 100, 21437 step: 1 21438 }, 21439 lvw: { 21440 max: 100, 21441 step: 1 21442 }, 21443 dvw: { 21444 max: 100, 21445 step: 1 21446 }, 21447 svh: { 21448 max: 100, 21449 step: 1 21450 }, 21451 lvh: { 21452 max: 100, 21453 step: 1 21454 }, 21455 dvh: { 21456 max: 100, 21457 step: 1 21458 }, 21459 vi: { 21460 max: 100, 21461 step: 1 21462 }, 21463 svi: { 21464 max: 100, 21465 step: 1 21466 }, 21467 lvi: { 21468 max: 100, 21469 step: 1 21470 }, 21471 dvi: { 21472 max: 100, 21473 step: 1 21474 }, 21475 vb: { 21476 max: 100, 21477 step: 1 21478 }, 21479 svb: { 21480 max: 100, 21481 step: 1 21482 }, 21483 lvb: { 21484 max: 100, 21485 step: 1 21486 }, 21487 dvb: { 21488 max: 100, 21489 step: 1 21490 }, 21491 vmin: { 21492 max: 100, 21493 step: 1 21494 }, 21495 svmin: { 21496 max: 100, 21497 step: 1 21498 }, 21499 lvmin: { 21500 max: 100, 21501 step: 1 21502 }, 21503 dvmin: { 21504 max: 100, 21505 step: 1 21506 }, 21507 vmax: { 21508 max: 100, 21509 step: 1 21510 }, 21511 svmax: { 21512 max: 100, 21513 step: 1 21514 }, 21515 lvmax: { 21516 max: 100, 21517 step: 1 21518 }, 21519 dvmax: { 21520 max: 100, 21521 step: 1 21522 } 21523 }; 21524 function getShadowParts(shadow) { 21525 const shadowValues = shadow.match(/(?:[^,(]|\([^)]*\))+/g) || []; 21526 return shadowValues.map(value => value.trim()); 21527 } 21528 function shadowStringToObject(shadowValue) { 21529 /* 21530 * Shadow spec: https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow 21531 * Shadow string format: <offset-x> <offset-y> <blur-radius> <spread-radius> <color> [inset] 21532 * 21533 * A shadow to be valid it must satisfy the following. 21534 * 21535 * 1. Should not contain "none" keyword. 21536 * 2. Values x, y, blur, spread should be in the order. Color and inset can be anywhere in the string except in between x, y, blur, spread values. 21537 * 3. Should not contain more than one set of x, y, blur, spread values. 21538 * 4. Should contain at least x and y values. Others are optional. 21539 * 5. Should not contain more than one "inset" (case insensitive) keyword. 21540 * 6. Should not contain more than one color value. 21541 */ 21542 21543 const defaultShadow = { 21544 x: '0', 21545 y: '0', 21546 blur: '0', 21547 spread: '0', 21548 color: '#000', 21549 inset: false 21550 }; 21551 if (!shadowValue) { 21552 return defaultShadow; 21553 } 21554 21555 // Rule 1: Should not contain "none" keyword. 21556 // if the shadow has "none" keyword, it is not a valid shadow string 21557 if (shadowValue.includes('none')) { 21558 return defaultShadow; 21559 } 21560 21561 // Rule 2: Values x, y, blur, spread should be in the order. 21562 // Color and inset can be anywhere in the string except in between x, y, blur, spread values. 21563 // Extract length values (x, y, blur, spread) from shadow string 21564 // Regex match groups of 1 to 4 length values. 21565 const lengthsRegex = /((?:^|\s+)(-?\d*\.?\d+(?:px|%|in|cm|mm|em|rem|ex|pt|pc|vh|vw|vmin|vmax|ch|lh)?)(?=\s|$)(?![^(]*\))){1,4}/g; 21566 const matches = shadowValue.match(lengthsRegex) || []; 21567 21568 // Rule 3: Should not contain more than one set of x, y, blur, spread values. 21569 // if the string doesn't contain exactly 1 set of x, y, blur, spread values, 21570 // it is not a valid shadow string 21571 if (matches.length !== 1) { 21572 return defaultShadow; 21573 } 21574 21575 // Extract length values (x, y, blur, spread) from shadow string 21576 const lengths = matches[0].split(' ').map(value => value.trim()).filter(value => value); 21577 21578 // Rule 4: Should contain at least x and y values. Others are optional. 21579 if (lengths.length < 2) { 21580 return defaultShadow; 21581 } 21582 21583 // Rule 5: Should not contain more than one "inset" (case insensitive) keyword. 21584 // check if the shadow string contains "inset" keyword 21585 const insets = shadowValue.match(/inset/gi) || []; 21586 if (insets.length > 1) { 21587 return defaultShadow; 21588 } 21589 21590 // Strip lengths and inset from shadow string, leaving just color. 21591 const hasInset = insets.length === 1; 21592 let colorString = shadowValue.replace(lengthsRegex, '').trim(); 21593 if (hasInset) { 21594 colorString = colorString.replace('inset', '').replace('INSET', '').trim(); 21595 } 21596 21597 // Rule 6: Should not contain more than one color value. 21598 // validate color string with regular expression 21599 // check if color has matching hex, rgb or hsl values 21600 const colorRegex = /^#([0-9a-f]{3}){1,2}$|^#([0-9a-f]{4}){1,2}$|^(?:rgb|hsl)a?\(?[\d*\.?\d+%?,?\/?\s]*\)$/gi; 21601 let colorMatches = (colorString.match(colorRegex) || []).map(value => value?.trim()).filter(value => value); 21602 21603 // If color string has more than one color values, it is not a valid 21604 if (colorMatches.length > 1) { 21605 return defaultShadow; 21606 } else if (colorMatches.length === 0) { 21607 // check if color string has multiple named color values separated by space 21608 colorMatches = colorString.trim().split(' ').filter(value => value); 21609 // If color string has more than one color values, it is not a valid 21610 if (colorMatches.length > 1) { 21611 return defaultShadow; 21612 } 21613 } 21614 21615 // Return parsed shadow object. 21616 const [x, y, blur, spread] = lengths; 21617 return { 21618 x, 21619 y, 21620 blur: blur || defaultShadow.blur, 21621 spread: spread || defaultShadow.spread, 21622 inset: hasInset, 21623 color: colorString || defaultShadow.color 21624 }; 21625 } 21626 function shadowObjectToString(shadowObj) { 21627 const shadowString = `$shadowObj.x || '0px'} $shadowObj.y || '0px'} $shadowObj.blur || '0px'} $shadowObj.spread || '0px'}`; 21628 return `$shadowObj.inset ? 'inset' : ''} $shadowString} $shadowObj.color || ''}`.trim(); 21629 } 21630 21631 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/shadows-edit-panel.js 21632 /** 21633 * External dependencies 21634 */ 21635 21636 21637 /** 21638 * WordPress dependencies 21639 */ 21640 21641 21642 21643 21644 21645 21646 /** 21647 * Internal dependencies 21648 */ 21649 21650 21651 21652 21653 21654 21655 const { 21656 useGlobalSetting: shadows_edit_panel_useGlobalSetting 21657 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 21658 const { 21659 Menu: shadows_edit_panel_Menu 21660 } = unlock(external_wp_components_namespaceObject.privateApis); 21661 const customShadowMenuItems = [{ 21662 label: (0,external_wp_i18n_namespaceObject.__)('Rename'), 21663 action: 'rename' 21664 }, { 21665 label: (0,external_wp_i18n_namespaceObject.__)('Delete'), 21666 action: 'delete' 21667 }]; 21668 const presetShadowMenuItems = [{ 21669 label: (0,external_wp_i18n_namespaceObject.__)('Reset'), 21670 action: 'reset' 21671 }]; 21672 function ShadowsEditPanel() { 21673 const { 21674 goBack, 21675 params: { 21676 category, 21677 slug 21678 } 21679 } = (0,external_wp_components_namespaceObject.useNavigator)(); 21680 const [shadows, setShadows] = shadows_edit_panel_useGlobalSetting(`shadow.presets.$category}`); 21681 (0,external_wp_element_namespaceObject.useEffect)(() => { 21682 const hasCurrentShadow = shadows?.some(shadow => shadow.slug === slug); 21683 // If the shadow being edited doesn't exist anymore in the global styles setting, navigate back 21684 // to prevent the user from editing a non-existent shadow entry. 21685 // This can happen, for example: 21686 // - when the user deletes the shadow 21687 // - when the user resets the styles while editing a custom shadow 21688 // 21689 // The check on the slug is necessary to prevent a double back navigation when the user triggers 21690 // a backward navigation by interacting with the screen's UI. 21691 if (!!slug && !hasCurrentShadow) { 21692 goBack(); 21693 } 21694 }, [shadows, slug, goBack]); 21695 const [baseShadows] = shadows_edit_panel_useGlobalSetting(`shadow.presets.$category}`, undefined, 'base'); 21696 const [selectedShadow, setSelectedShadow] = (0,external_wp_element_namespaceObject.useState)(() => (shadows || []).find(shadow => shadow.slug === slug)); 21697 const baseSelectedShadow = (0,external_wp_element_namespaceObject.useMemo)(() => (baseShadows || []).find(b => b.slug === slug), [baseShadows, slug]); 21698 const [isConfirmDialogVisible, setIsConfirmDialogVisible] = (0,external_wp_element_namespaceObject.useState)(false); 21699 const [isRenameModalVisible, setIsRenameModalVisible] = (0,external_wp_element_namespaceObject.useState)(false); 21700 const [shadowName, setShadowName] = (0,external_wp_element_namespaceObject.useState)(selectedShadow.name); 21701 if (!category || !slug) { 21702 return null; 21703 } 21704 const onShadowChange = shadow => { 21705 setSelectedShadow({ 21706 ...selectedShadow, 21707 shadow 21708 }); 21709 const updatedShadows = shadows.map(s => s.slug === slug ? { 21710 ...selectedShadow, 21711 shadow 21712 } : s); 21713 setShadows(updatedShadows); 21714 }; 21715 const onMenuClick = action => { 21716 if (action === 'reset') { 21717 const updatedShadows = shadows.map(s => s.slug === slug ? baseSelectedShadow : s); 21718 setSelectedShadow(baseSelectedShadow); 21719 setShadows(updatedShadows); 21720 } else if (action === 'delete') { 21721 setIsConfirmDialogVisible(true); 21722 } else if (action === 'rename') { 21723 setIsRenameModalVisible(true); 21724 } 21725 }; 21726 const handleShadowDelete = () => { 21727 setShadows(shadows.filter(s => s.slug !== slug)); 21728 }; 21729 const handleShadowRename = newName => { 21730 if (!newName) { 21731 return; 21732 } 21733 const updatedShadows = shadows.map(s => s.slug === slug ? { 21734 ...selectedShadow, 21735 name: newName 21736 } : s); 21737 setSelectedShadow({ 21738 ...selectedShadow, 21739 name: newName 21740 }); 21741 setShadows(updatedShadows); 21742 }; 21743 return !selectedShadow ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 21744 title: "" 21745 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 21746 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 21747 justify: "space-between", 21748 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 21749 title: selectedShadow.name 21750 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 21751 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 21752 marginTop: 2, 21753 marginBottom: 0, 21754 paddingX: 4, 21755 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(shadows_edit_panel_Menu, { 21756 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_edit_panel_Menu.TriggerButton, { 21757 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 21758 size: "small", 21759 icon: more_vertical, 21760 label: (0,external_wp_i18n_namespaceObject.__)('Menu') 21761 }) 21762 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_edit_panel_Menu.Popover, { 21763 children: (category === 'custom' ? customShadowMenuItems : presetShadowMenuItems).map(item => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_edit_panel_Menu.Item, { 21764 onClick: () => onMenuClick(item.action), 21765 disabled: item.action === 'reset' && selectedShadow.shadow === baseSelectedShadow.shadow, 21766 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_edit_panel_Menu.ItemLabel, { 21767 children: item.label 21768 }) 21769 }, item.action)) 21770 })] 21771 }) 21772 }) 21773 })] 21774 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 21775 className: "edit-site-global-styles-screen", 21776 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowsPreview, { 21777 shadow: selectedShadow.shadow 21778 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowEditor, { 21779 shadow: selectedShadow.shadow, 21780 onChange: onShadowChange 21781 })] 21782 }), isConfirmDialogVisible && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { 21783 isOpen: true, 21784 onConfirm: () => { 21785 handleShadowDelete(); 21786 setIsConfirmDialogVisible(false); 21787 }, 21788 onCancel: () => { 21789 setIsConfirmDialogVisible(false); 21790 }, 21791 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Delete'), 21792 size: "medium", 21793 children: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: Name of the shadow preset. */ 21794 (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to delete "%s" shadow preset?'), selectedShadow.name) 21795 }), isRenameModalVisible && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 21796 title: (0,external_wp_i18n_namespaceObject.__)('Rename'), 21797 onRequestClose: () => setIsRenameModalVisible(false), 21798 size: "small", 21799 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("form", { 21800 onSubmit: event => { 21801 event.preventDefault(); 21802 handleShadowRename(shadowName); 21803 setIsRenameModalVisible(false); 21804 }, 21805 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControl, { 21806 __next40pxDefaultSize: true, 21807 autoComplete: "off", 21808 label: (0,external_wp_i18n_namespaceObject.__)('Name'), 21809 placeholder: (0,external_wp_i18n_namespaceObject.__)('Shadow name'), 21810 value: shadowName, 21811 onChange: value => setShadowName(value) 21812 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 21813 marginBottom: 6 21814 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 21815 className: "block-editor-shadow-edit-modal__actions", 21816 justify: "flex-end", 21817 expanded: false, 21818 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 21819 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 21820 __next40pxDefaultSize: true, 21821 variant: "tertiary", 21822 onClick: () => setIsRenameModalVisible(false), 21823 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 21824 }) 21825 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 21826 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 21827 __next40pxDefaultSize: true, 21828 variant: "primary", 21829 type: "submit", 21830 children: (0,external_wp_i18n_namespaceObject.__)('Save') 21831 }) 21832 })] 21833 })] 21834 }) 21835 })] 21836 }); 21837 } 21838 function ShadowsPreview({ 21839 shadow 21840 }) { 21841 const shadowStyle = { 21842 boxShadow: shadow 21843 }; 21844 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 21845 marginBottom: 4, 21846 marginTop: -2, 21847 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 21848 align: "center", 21849 justify: "center", 21850 className: "edit-site-global-styles__shadow-preview-panel", 21851 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 21852 className: "edit-site-global-styles__shadow-preview-block", 21853 style: shadowStyle 21854 }) 21855 }) 21856 }); 21857 } 21858 function ShadowEditor({ 21859 shadow, 21860 onChange 21861 }) { 21862 const addShadowButtonRef = (0,external_wp_element_namespaceObject.useRef)(); 21863 const shadowParts = (0,external_wp_element_namespaceObject.useMemo)(() => getShadowParts(shadow), [shadow]); 21864 const onChangeShadowPart = (index, part) => { 21865 const newShadowParts = [...shadowParts]; 21866 newShadowParts[index] = part; 21867 onChange(newShadowParts.join(', ')); 21868 }; 21869 const onAddShadowPart = () => { 21870 onChange([...shadowParts, defaultShadow].join(', ')); 21871 }; 21872 const onRemoveShadowPart = index => { 21873 onChange(shadowParts.filter((p, i) => i !== index).join(', ')); 21874 addShadowButtonRef.current.focus(); 21875 }; 21876 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 21877 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 21878 spacing: 2, 21879 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 21880 justify: "space-between", 21881 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { 21882 align: "center", 21883 className: "edit-site-global-styles__shadows-panel__title", 21884 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle, { 21885 level: 3, 21886 children: (0,external_wp_i18n_namespaceObject.__)('Shadows') 21887 }) 21888 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 21889 className: "edit-site-global-styles__shadows-panel__options-container", 21890 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 21891 size: "small", 21892 icon: library_plus, 21893 label: (0,external_wp_i18n_namespaceObject.__)('Add shadow'), 21894 onClick: () => { 21895 onAddShadowPart(); 21896 }, 21897 ref: addShadowButtonRef 21898 }) 21899 })] 21900 }) 21901 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 21902 isBordered: true, 21903 isSeparated: true, 21904 children: shadowParts.map((part, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_edit_panel_ShadowItem, { 21905 shadow: part, 21906 onChange: value => onChangeShadowPart(index, value), 21907 canRemove: shadowParts.length > 1, 21908 onRemove: () => onRemoveShadowPart(index) 21909 }, index)) 21910 })] 21911 }); 21912 } 21913 function shadows_edit_panel_ShadowItem({ 21914 shadow, 21915 onChange, 21916 canRemove, 21917 onRemove 21918 }) { 21919 const popoverProps = { 21920 placement: 'left-start', 21921 offset: 36, 21922 shift: true 21923 }; 21924 const shadowObj = (0,external_wp_element_namespaceObject.useMemo)(() => shadowStringToObject(shadow), [shadow]); 21925 const onShadowChange = newShadow => { 21926 onChange(shadowObjectToString(newShadow)); 21927 }; 21928 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 21929 popoverProps: popoverProps, 21930 className: "edit-site-global-styles__shadow-editor__dropdown", 21931 renderToggle: ({ 21932 onToggle, 21933 isOpen 21934 }) => { 21935 const toggleProps = { 21936 onClick: onToggle, 21937 className: dist_clsx('edit-site-global-styles__shadow-editor__dropdown-toggle', { 21938 'is-open': isOpen 21939 }), 21940 'aria-expanded': isOpen 21941 }; 21942 const removeButtonProps = { 21943 onClick: () => { 21944 if (isOpen) { 21945 onToggle(); 21946 } 21947 onRemove(); 21948 }, 21949 className: dist_clsx('edit-site-global-styles__shadow-editor__remove-button', { 21950 'is-open': isOpen 21951 }), 21952 label: (0,external_wp_i18n_namespaceObject.__)('Remove shadow') 21953 }; 21954 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 21955 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 21956 __next40pxDefaultSize: true, 21957 icon: library_shadow, 21958 ...toggleProps, 21959 children: shadowObj.inset ? (0,external_wp_i18n_namespaceObject.__)('Inner shadow') : (0,external_wp_i18n_namespaceObject.__)('Drop shadow') 21960 }), canRemove && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 21961 size: "small", 21962 icon: library_reset, 21963 ...removeButtonProps 21964 })] 21965 }); 21966 }, 21967 renderContent: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, { 21968 paddingSize: "medium", 21969 className: "edit-site-global-styles__shadow-editor__dropdown-content", 21970 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowPopover, { 21971 shadowObj: shadowObj, 21972 onChange: onShadowChange 21973 }) 21974 }) 21975 }); 21976 } 21977 function ShadowPopover({ 21978 shadowObj, 21979 onChange 21980 }) { 21981 const __experimentalIsRenderedInSidebar = true; 21982 const enableAlpha = true; 21983 const onShadowChange = (key, value) => { 21984 const newShadow = { 21985 ...shadowObj, 21986 [key]: value 21987 }; 21988 onChange(newShadow); 21989 }; 21990 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 21991 spacing: 4, 21992 className: "edit-site-global-styles__shadow-editor-panel", 21993 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ColorPalette, { 21994 clearable: false, 21995 enableAlpha: enableAlpha, 21996 __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar, 21997 value: shadowObj.color, 21998 onChange: value => onShadowChange('color', value) 21999 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { 22000 __nextHasNoMarginBottom: true, 22001 value: shadowObj.inset ? 'inset' : 'outset', 22002 isBlock: true, 22003 onChange: value => onShadowChange('inset', value === 'inset'), 22004 hideLabelFromVision: true, 22005 __next40pxDefaultSize: true, 22006 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { 22007 value: "outset", 22008 label: (0,external_wp_i18n_namespaceObject.__)('Outset') 22009 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { 22010 value: "inset", 22011 label: (0,external_wp_i18n_namespaceObject.__)('Inset') 22012 })] 22013 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalGrid, { 22014 columns: 2, 22015 gap: 4, 22016 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowInputControl, { 22017 label: (0,external_wp_i18n_namespaceObject.__)('X Position'), 22018 value: shadowObj.x, 22019 onChange: value => onShadowChange('x', value) 22020 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowInputControl, { 22021 label: (0,external_wp_i18n_namespaceObject.__)('Y Position'), 22022 value: shadowObj.y, 22023 onChange: value => onShadowChange('y', value) 22024 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowInputControl, { 22025 label: (0,external_wp_i18n_namespaceObject.__)('Blur'), 22026 value: shadowObj.blur, 22027 onChange: value => onShadowChange('blur', value) 22028 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowInputControl, { 22029 label: (0,external_wp_i18n_namespaceObject.__)('Spread'), 22030 value: shadowObj.spread, 22031 onChange: value => onShadowChange('spread', value) 22032 })] 22033 })] 22034 }); 22035 } 22036 function ShadowInputControl({ 22037 label, 22038 value, 22039 onChange 22040 }) { 22041 const onValueChange = next => { 22042 const isNumeric = next !== undefined && !isNaN(parseFloat(next)); 22043 const nextValue = isNumeric ? next : '0px'; 22044 onChange(nextValue); 22045 }; 22046 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { 22047 label: label, 22048 __next40pxDefaultSize: true, 22049 value: value, 22050 onChange: onValueChange 22051 }); 22052 } 22053 22054 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-shadows.js 22055 /** 22056 * Internal dependencies 22057 */ 22058 22059 22060 22061 function ScreenShadows() { 22062 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowsPanel, {}); 22063 } 22064 function ScreenShadowsEdit() { 22065 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowsEditPanel, {}); 22066 } 22067 22068 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/dimensions-panel.js 22069 /** 22070 * WordPress dependencies 22071 */ 22072 22073 22074 22075 /** 22076 * Internal dependencies 22077 */ 22078 22079 22080 const { 22081 useGlobalStyle: dimensions_panel_useGlobalStyle, 22082 useGlobalSetting: dimensions_panel_useGlobalSetting, 22083 useSettingsForBlockElement: dimensions_panel_useSettingsForBlockElement, 22084 DimensionsPanel: dimensions_panel_StylesDimensionsPanel 22085 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 22086 const DEFAULT_CONTROLS = { 22087 contentSize: true, 22088 wideSize: true, 22089 padding: true, 22090 margin: true, 22091 blockGap: true, 22092 minHeight: true, 22093 childLayout: false 22094 }; 22095 function DimensionsPanel() { 22096 const [style] = dimensions_panel_useGlobalStyle('', undefined, 'user', { 22097 shouldDecodeEncode: false 22098 }); 22099 const [inheritedStyle, setStyle] = dimensions_panel_useGlobalStyle('', undefined, 'all', { 22100 shouldDecodeEncode: false 22101 }); 22102 const [userSettings] = dimensions_panel_useGlobalSetting('', undefined, 'user'); 22103 const [rawSettings, setSettings] = dimensions_panel_useGlobalSetting(''); 22104 const settings = dimensions_panel_useSettingsForBlockElement(rawSettings); 22105 22106 // These intermediary objects are needed because the "layout" property is stored 22107 // in settings rather than styles. 22108 const inheritedStyleWithLayout = (0,external_wp_element_namespaceObject.useMemo)(() => { 22109 return { 22110 ...inheritedStyle, 22111 layout: settings.layout 22112 }; 22113 }, [inheritedStyle, settings.layout]); 22114 const styleWithLayout = (0,external_wp_element_namespaceObject.useMemo)(() => { 22115 return { 22116 ...style, 22117 layout: userSettings.layout 22118 }; 22119 }, [style, userSettings.layout]); 22120 const onChange = newStyle => { 22121 const updatedStyle = { 22122 ...newStyle 22123 }; 22124 delete updatedStyle.layout; 22125 setStyle(updatedStyle); 22126 if (newStyle.layout !== userSettings.layout) { 22127 const updatedSettings = { 22128 ...userSettings, 22129 layout: newStyle.layout 22130 }; 22131 22132 // Ensure any changes to layout definitions are not persisted. 22133 if (updatedSettings.layout?.definitions) { 22134 delete updatedSettings.layout.definitions; 22135 } 22136 setSettings(updatedSettings); 22137 } 22138 }; 22139 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dimensions_panel_StylesDimensionsPanel, { 22140 inheritedValue: inheritedStyleWithLayout, 22141 value: styleWithLayout, 22142 onChange: onChange, 22143 settings: settings, 22144 includeLayoutControls: true, 22145 defaultControls: DEFAULT_CONTROLS 22146 }); 22147 } 22148 22149 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-layout.js 22150 /** 22151 * WordPress dependencies 22152 */ 22153 22154 22155 22156 /** 22157 * Internal dependencies 22158 */ 22159 22160 22161 22162 22163 const { 22164 useHasDimensionsPanel: screen_layout_useHasDimensionsPanel, 22165 useGlobalSetting: screen_layout_useGlobalSetting, 22166 useSettingsForBlockElement: screen_layout_useSettingsForBlockElement 22167 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 22168 function ScreenLayout() { 22169 const [rawSettings] = screen_layout_useGlobalSetting(''); 22170 const settings = screen_layout_useSettingsForBlockElement(rawSettings); 22171 const hasDimensionsPanel = screen_layout_useHasDimensionsPanel(settings); 22172 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 22173 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 22174 title: (0,external_wp_i18n_namespaceObject.__)('Layout') 22175 }), hasDimensionsPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DimensionsPanel, {})] 22176 }); 22177 } 22178 /* harmony default export */ const screen_layout = (ScreenLayout); 22179 22180 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/style-variations-container.js 22181 /** 22182 * WordPress dependencies 22183 */ 22184 22185 22186 22187 22188 22189 22190 22191 /** 22192 * Internal dependencies 22193 */ 22194 22195 22196 22197 22198 22199 const { 22200 GlobalStylesContext: style_variations_container_GlobalStylesContext 22201 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 22202 function StyleVariationsContainer({ 22203 gap = 2 22204 }) { 22205 const { 22206 user 22207 } = (0,external_wp_element_namespaceObject.useContext)(style_variations_container_GlobalStylesContext); 22208 const userStyles = user?.styles; 22209 const variations = (0,external_wp_data_namespaceObject.useSelect)(select => { 22210 return select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentThemeGlobalStylesVariations(); 22211 }, []); 22212 22213 // Filter out variations that are color or typography variations. 22214 const fullStyleVariations = variations?.filter(variation => { 22215 return !isVariationWithProperties(variation, ['color']) && !isVariationWithProperties(variation, ['typography', 'spacing']); 22216 }); 22217 const themeVariations = (0,external_wp_element_namespaceObject.useMemo)(() => { 22218 const withEmptyVariation = [{ 22219 title: (0,external_wp_i18n_namespaceObject.__)('Default'), 22220 settings: {}, 22221 styles: {} 22222 }, ...(fullStyleVariations !== null && fullStyleVariations !== void 0 ? fullStyleVariations : [])]; 22223 return [...withEmptyVariation.map(variation => { 22224 var _variation$settings; 22225 const blockStyles = { 22226 ...variation?.styles?.blocks 22227 } || {}; 22228 22229 // We need to copy any user custom CSS to the variation to prevent it being lost 22230 // when switching variations. 22231 if (userStyles?.blocks) { 22232 Object.keys(userStyles.blocks).forEach(blockName => { 22233 // First get any block specific custom CSS from the current user styles and merge with any custom CSS for 22234 // that block in the variation. 22235 if (userStyles.blocks[blockName].css) { 22236 const variationBlockStyles = blockStyles[blockName] || {}; 22237 const customCSS = { 22238 css: `$blockStyles[blockName]?.css || ''} $userStyles.blocks[blockName].css.trim() || ''}` 22239 }; 22240 blockStyles[blockName] = { 22241 ...variationBlockStyles, 22242 ...customCSS 22243 }; 22244 } 22245 }); 22246 } 22247 // Now merge any global custom CSS from current user styles with global custom CSS in the variation. 22248 const css = userStyles?.css || variation.styles?.css ? { 22249 css: `$variation.styles?.css || ''} $userStyles?.css || ''}` 22250 } : {}; 22251 const blocks = Object.keys(blockStyles).length > 0 ? { 22252 blocks: blockStyles 22253 } : {}; 22254 const styles = { 22255 ...variation.styles, 22256 ...css, 22257 ...blocks 22258 }; 22259 return { 22260 ...variation, 22261 settings: (_variation$settings = variation.settings) !== null && _variation$settings !== void 0 ? _variation$settings : {}, 22262 styles 22263 }; 22264 })]; 22265 }, [fullStyleVariations, userStyles?.blocks, userStyles?.css]); 22266 if (!fullStyleVariations || fullStyleVariations?.length < 1) { 22267 return null; 22268 } 22269 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, { 22270 columns: 2, 22271 className: "edit-site-global-styles-style-variations-container", 22272 gap: gap, 22273 children: themeVariations.map((variation, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Variation, { 22274 variation: variation, 22275 children: isFocused => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(preview_styles, { 22276 label: variation?.title, 22277 withHoverView: true, 22278 isFocused: isFocused, 22279 variation: variation 22280 }) 22281 }, index)) 22282 }); 22283 } 22284 22285 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-global-styles/content.js 22286 /** 22287 * WordPress dependencies 22288 */ 22289 22290 22291 22292 /** 22293 * Internal dependencies 22294 */ 22295 22296 22297 22298 22299 function SidebarNavigationScreenGlobalStylesContent() { 22300 const gap = 3; 22301 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 22302 spacing: 10, 22303 className: "edit-site-global-styles-variation-container", 22304 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleVariationsContainer, { 22305 gap: gap 22306 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorVariations, { 22307 title: (0,external_wp_i18n_namespaceObject.__)('Palettes'), 22308 gap: gap 22309 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TypographyVariations, { 22310 title: (0,external_wp_i18n_namespaceObject.__)('Typography'), 22311 gap: gap 22312 })] 22313 }); 22314 } 22315 22316 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-style-variations.js 22317 /** 22318 * WordPress dependencies 22319 */ 22320 22321 22322 22323 22324 22325 22326 22327 /** 22328 * Internal dependencies 22329 */ 22330 22331 22332 22333 22334 const { 22335 useZoomOut 22336 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 22337 function ScreenStyleVariations() { 22338 // Style Variations should only be previewed in with 22339 // - a "zoomed out" editor (but not when in preview mode) 22340 // - "Desktop" device preview 22341 const isPreviewMode = (0,external_wp_data_namespaceObject.useSelect)(select => { 22342 return select(external_wp_blockEditor_namespaceObject.store).getSettings().isPreviewMode; 22343 }, []); 22344 const { 22345 setDeviceType 22346 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); 22347 useZoomOut(!isPreviewMode); 22348 (0,external_wp_element_namespaceObject.useEffect)(() => { 22349 setDeviceType('desktop'); 22350 }, [setDeviceType]); 22351 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 22352 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 22353 title: (0,external_wp_i18n_namespaceObject.__)('Browse styles'), 22354 description: (0,external_wp_i18n_namespaceObject.__)('Choose a variation to change the look of the site.') 22355 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Card, { 22356 size: "small", 22357 isBorderless: true, 22358 className: "edit-site-global-styles-screen-style-variations", 22359 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardBody, { 22360 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenGlobalStylesContent, {}) 22361 }) 22362 })] 22363 }); 22364 } 22365 /* harmony default export */ const screen_style_variations = (ScreenStyleVariations); 22366 22367 ;// external ["wp","mediaUtils"] 22368 const external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"]; 22369 ;// ./node_modules/@wordpress/edit-site/build-module/components/style-book/constants.js 22370 /** 22371 * WordPress dependencies 22372 */ 22373 22374 22375 /** 22376 * Internal dependencies 22377 */ 22378 22379 const STYLE_BOOK_COLOR_GROUPS = [{ 22380 slug: 'theme-colors', 22381 title: (0,external_wp_i18n_namespaceObject.__)('Theme Colors'), 22382 origin: 'theme', 22383 type: 'colors' 22384 }, { 22385 slug: 'theme-gradients', 22386 title: (0,external_wp_i18n_namespaceObject.__)('Theme Gradients'), 22387 origin: 'theme', 22388 type: 'gradients' 22389 }, { 22390 slug: 'custom-colors', 22391 title: (0,external_wp_i18n_namespaceObject.__)('Custom Colors'), 22392 origin: 'custom', 22393 type: 'colors' 22394 }, { 22395 slug: 'custom-gradients', 22396 title: (0,external_wp_i18n_namespaceObject.__)('Custom Gradients'), 22397 origin: 'custom', 22398 // User. 22399 type: 'gradients' 22400 }, { 22401 slug: 'duotones', 22402 title: (0,external_wp_i18n_namespaceObject.__)('Duotones'), 22403 origin: 'theme', 22404 type: 'duotones' 22405 }, { 22406 slug: 'default-colors', 22407 title: (0,external_wp_i18n_namespaceObject.__)('Default Colors'), 22408 origin: 'default', 22409 type: 'colors' 22410 }, { 22411 slug: 'default-gradients', 22412 title: (0,external_wp_i18n_namespaceObject.__)('Default Gradients'), 22413 origin: 'default', 22414 type: 'gradients' 22415 }]; 22416 const STYLE_BOOK_THEME_SUBCATEGORIES = [{ 22417 slug: 'site-identity', 22418 title: (0,external_wp_i18n_namespaceObject.__)('Site Identity'), 22419 blocks: ['core/site-logo', 'core/site-title', 'core/site-tagline'] 22420 }, { 22421 slug: 'design', 22422 title: (0,external_wp_i18n_namespaceObject.__)('Design'), 22423 blocks: ['core/navigation', 'core/avatar', 'core/post-time-to-read'], 22424 exclude: ['core/home-link', 'core/navigation-link'] 22425 }, { 22426 slug: 'posts', 22427 title: (0,external_wp_i18n_namespaceObject.__)('Posts'), 22428 blocks: ['core/post-title', 'core/post-excerpt', 'core/post-author', 'core/post-author-name', 'core/post-author-biography', 'core/post-date', 'core/post-terms', 'core/term-description', 'core/query-title', 'core/query-no-results', 'core/query-pagination', 'core/query-numbers'] 22429 }, { 22430 slug: 'comments', 22431 title: (0,external_wp_i18n_namespaceObject.__)('Comments'), 22432 blocks: ['core/comments-title', 'core/comments-pagination', 'core/comments-pagination-numbers', 'core/comments', 'core/comments-author-name', 'core/comment-content', 'core/comment-date', 'core/comment-edit-link', 'core/comment-reply-link', 'core/comment-template', 'core/post-comments-count', 'core/post-comments-link'] 22433 }]; 22434 const STYLE_BOOK_CATEGORIES = [{ 22435 slug: 'overview', 22436 title: (0,external_wp_i18n_namespaceObject.__)('Overview'), 22437 blocks: [] 22438 }, { 22439 slug: 'text', 22440 title: (0,external_wp_i18n_namespaceObject.__)('Text'), 22441 blocks: ['core/post-content', 'core/home-link', 'core/navigation-link'] 22442 }, { 22443 slug: 'colors', 22444 title: (0,external_wp_i18n_namespaceObject.__)('Colors'), 22445 blocks: [] 22446 }, { 22447 slug: 'theme', 22448 title: (0,external_wp_i18n_namespaceObject.__)('Theme'), 22449 subcategories: STYLE_BOOK_THEME_SUBCATEGORIES 22450 }, { 22451 slug: 'media', 22452 title: (0,external_wp_i18n_namespaceObject.__)('Media'), 22453 blocks: ['core/post-featured-image'] 22454 }, { 22455 slug: 'widgets', 22456 title: (0,external_wp_i18n_namespaceObject.__)('Widgets'), 22457 blocks: [] 22458 }, { 22459 slug: 'embed', 22460 title: (0,external_wp_i18n_namespaceObject.__)('Embeds'), 22461 include: [] 22462 }]; 22463 22464 // Style book preview subcategories for all blocks section. 22465 const STYLE_BOOK_ALL_BLOCKS_SUBCATEGORIES = [...STYLE_BOOK_THEME_SUBCATEGORIES, { 22466 slug: 'media', 22467 title: (0,external_wp_i18n_namespaceObject.__)('Media'), 22468 blocks: ['core/post-featured-image'] 22469 }, { 22470 slug: 'widgets', 22471 title: (0,external_wp_i18n_namespaceObject.__)('Widgets'), 22472 blocks: [] 22473 }, { 22474 slug: 'embed', 22475 title: (0,external_wp_i18n_namespaceObject.__)('Embeds'), 22476 include: [] 22477 }]; 22478 22479 // Style book preview categories are organized slightly differently to the editor ones. 22480 const STYLE_BOOK_PREVIEW_CATEGORIES = [{ 22481 slug: 'overview', 22482 title: (0,external_wp_i18n_namespaceObject.__)('Overview'), 22483 blocks: [] 22484 }, { 22485 slug: 'text', 22486 title: (0,external_wp_i18n_namespaceObject.__)('Text'), 22487 blocks: ['core/post-content', 'core/home-link', 'core/navigation-link'] 22488 }, { 22489 slug: 'colors', 22490 title: (0,external_wp_i18n_namespaceObject.__)('Colors'), 22491 blocks: [] 22492 }, { 22493 slug: 'blocks', 22494 title: (0,external_wp_i18n_namespaceObject.__)('All Blocks'), 22495 blocks: [], 22496 subcategories: STYLE_BOOK_ALL_BLOCKS_SUBCATEGORIES 22497 }]; 22498 22499 // Forming a "block formatting context" to prevent margin collapsing. 22500 // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context 22501 const ROOT_CONTAINER = ` 22502 .is-root-container { 22503 display: flow-root; 22504 } 22505 `; 22506 // The content area of the Style Book is rendered within an iframe so that global styles 22507 // are applied to elements within the entire content area. To support elements that are 22508 // not part of the block previews, such as headings and layout for the block previews, 22509 // additional CSS rules need to be passed into the iframe. These are hard-coded below. 22510 // Note that button styles are unset, and then focus rules from the `Button` component are 22511 // applied to the `button` element, targeted via `.edit-site-style-book__example`. 22512 // This is to ensure that browser default styles for buttons are not applied to the previews. 22513 const STYLE_BOOK_IFRAME_STYLES = ` 22514 body { 22515 position: relative; 22516 padding: 32px !important; 22517 } 22518 22519 $ROOT_CONTAINER} 22520 22521 .edit-site-style-book__examples { 22522 max-width: 1200px; 22523 margin: 0 auto; 22524 } 22525 22526 .edit-site-style-book__example { 22527 max-width: 900px; 22528 border-radius: 2px; 22529 cursor: pointer; 22530 display: flex; 22531 flex-direction: column; 22532 gap: 40px; 22533 padding: 16px; 22534 width: 100%; 22535 box-sizing: border-box; 22536 scroll-margin-top: 32px; 22537 scroll-margin-bottom: 32px; 22538 margin: 0 auto 40px auto; 22539 } 22540 22541 .edit-site-style-book__example.is-selected { 22542 box-shadow: 0 0 0 1px var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba)); 22543 } 22544 22545 .edit-site-style-book__example.is-disabled-example { 22546 pointer-events: none; 22547 } 22548 22549 .edit-site-style-book__example:focus:not(:disabled) { 22550 box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba)); 22551 outline: 3px solid transparent; 22552 } 22553 22554 .edit-site-style-book__duotone-example > div:first-child { 22555 display: flex; 22556 aspect-ratio: 16 / 9; 22557 grid-row: span 1; 22558 grid-column: span 2; 22559 } 22560 .edit-site-style-book__duotone-example img { 22561 width: 100%; 22562 height: 100%; 22563 object-fit: cover; 22564 } 22565 .edit-site-style-book__duotone-example > div:not(:first-child) { 22566 height: 20px; 22567 border: 1px solid color-mix( in srgb, currentColor 10%, transparent ); 22568 } 22569 22570 .edit-site-style-book__color-example { 22571 border: 1px solid color-mix( in srgb, currentColor 10%, transparent ); 22572 } 22573 22574 .edit-site-style-book__subcategory-title, 22575 .edit-site-style-book__example-title { 22576 font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; 22577 font-size: 13px; 22578 font-weight: normal; 22579 line-height: normal; 22580 margin: 0; 22581 text-align: left; 22582 padding-top: 8px; 22583 border-top: 1px solid color-mix( in srgb, currentColor 10%, transparent ); 22584 color: color-mix( in srgb, currentColor 60%, transparent ); 22585 } 22586 22587 .edit-site-style-book__subcategory-title { 22588 font-size: 16px; 22589 margin-bottom: 40px; 22590 padding-bottom: 8px; 22591 } 22592 22593 .edit-site-style-book__example-preview { 22594 width: 100%; 22595 } 22596 22597 .edit-site-style-book__example-preview .block-editor-block-list__insertion-point, 22598 .edit-site-style-book__example-preview .block-list-appender { 22599 display: none; 22600 } 22601 :where(.is-root-container > .wp-block:first-child) { 22602 margin-top: 0; 22603 } 22604 :where(.is-root-container > .wp-block:last-child) { 22605 margin-bottom: 0; 22606 } 22607 `; 22608 22609 ;// ./node_modules/@wordpress/edit-site/build-module/components/style-book/categories.js 22610 /** 22611 * WordPress dependencies 22612 */ 22613 // @wordpress/blocks imports are not typed. 22614 // @ts-expect-error 22615 22616 22617 /** 22618 * Internal dependencies 22619 */ 22620 22621 22622 22623 /** 22624 * Returns category examples for a given category definition and list of examples. 22625 * @param {StyleBookCategory} categoryDefinition The category definition. 22626 * @param {BlockExample[]} examples An array of block examples. 22627 * @return {CategoryExamples|undefined} An object containing the category examples. 22628 */ 22629 function getExamplesByCategory(categoryDefinition, examples) { 22630 var _categoryDefinition$s; 22631 if (!categoryDefinition?.slug || !examples?.length) { 22632 return; 22633 } 22634 const categories = (_categoryDefinition$s = categoryDefinition?.subcategories) !== null && _categoryDefinition$s !== void 0 ? _categoryDefinition$s : []; 22635 if (categories.length) { 22636 return categories.reduce((acc, subcategoryDefinition) => { 22637 const subcategoryExamples = getExamplesByCategory(subcategoryDefinition, examples); 22638 if (subcategoryExamples) { 22639 if (!acc.subcategories) { 22640 acc.subcategories = []; 22641 } 22642 acc.subcategories = [...acc.subcategories, subcategoryExamples]; 22643 } 22644 return acc; 22645 }, { 22646 title: categoryDefinition.title, 22647 slug: categoryDefinition.slug 22648 }); 22649 } 22650 const blocksToInclude = categoryDefinition?.blocks || []; 22651 const blocksToExclude = categoryDefinition?.exclude || []; 22652 const categoryExamples = examples.filter(example => { 22653 return !blocksToExclude.includes(example.name) && (example.category === categoryDefinition.slug || blocksToInclude.includes(example.name)); 22654 }); 22655 if (!categoryExamples.length) { 22656 return; 22657 } 22658 return { 22659 title: categoryDefinition.title, 22660 slug: categoryDefinition.slug, 22661 examples: categoryExamples 22662 }; 22663 } 22664 22665 /** 22666 * Returns category examples for a given category definition and list of examples. 22667 * 22668 * @return {StyleBookCategory[]} An array of top-level category definitions. 22669 */ 22670 function getTopLevelStyleBookCategories() { 22671 const reservedCategories = [...STYLE_BOOK_THEME_SUBCATEGORIES, ...STYLE_BOOK_CATEGORIES].map(({ 22672 slug 22673 }) => slug); 22674 const extraCategories = (0,external_wp_blocks_namespaceObject.getCategories)(); 22675 const extraCategoriesFiltered = extraCategories.filter(({ 22676 slug 22677 }) => !reservedCategories.includes(slug)); 22678 return [...STYLE_BOOK_CATEGORIES, ...extraCategoriesFiltered]; 22679 } 22680 22681 ;// ./node_modules/@wordpress/edit-site/build-module/components/style-book/color-examples.js 22682 /** 22683 * External dependencies 22684 */ 22685 22686 22687 /** 22688 * WordPress dependencies 22689 */ 22690 22691 22692 22693 22694 /** 22695 * Internal dependencies 22696 */ 22697 22698 const ColorExamples = ({ 22699 colors, 22700 type, 22701 templateColumns = '1fr 1fr', 22702 itemHeight = '52px' 22703 }) => { 22704 if (!colors) { 22705 return null; 22706 } 22707 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, { 22708 templateColumns: templateColumns, 22709 rowGap: 8, 22710 columnGap: 16, 22711 children: colors.map(color => { 22712 const className = type === 'gradients' ? (0,external_wp_blockEditor_namespaceObject.__experimentalGetGradientClass)(color.slug) : (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', color.slug); 22713 const classes = dist_clsx('edit-site-style-book__color-example', className); 22714 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.View, { 22715 className: classes, 22716 style: { 22717 height: itemHeight 22718 } 22719 }, color.slug); 22720 }) 22721 }); 22722 }; 22723 /* harmony default export */ const color_examples = (ColorExamples); 22724 22725 ;// ./node_modules/@wordpress/edit-site/build-module/components/style-book/duotone-examples.js 22726 /** 22727 * WordPress dependencies 22728 */ 22729 22730 22731 22732 /** 22733 * Internal dependencies 22734 */ 22735 22736 const DuotoneExamples = ({ 22737 duotones 22738 }) => { 22739 if (!duotones) { 22740 return null; 22741 } 22742 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, { 22743 columns: 2, 22744 rowGap: 16, 22745 columnGap: 16, 22746 children: duotones.map(duotone => { 22747 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalGrid, { 22748 className: "edit-site-style-book__duotone-example", 22749 columns: 2, 22750 rowGap: 8, 22751 columnGap: 8, 22752 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.View, { 22753 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 22754 alt: `Duotone example: $duotone.slug}`, 22755 src: "https://s.w.org/images/core/5.3/MtBlanc1.jpg", 22756 style: { 22757 filter: `url(#wp-duotone-$duotone.slug})` 22758 } 22759 }) 22760 }), duotone.colors.map(color => { 22761 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.View, { 22762 className: "edit-site-style-book__color-example", 22763 style: { 22764 backgroundColor: color 22765 } 22766 }, color); 22767 })] 22768 }, duotone.slug); 22769 }) 22770 }); 22771 }; 22772 /* harmony default export */ const duotone_examples = (DuotoneExamples); 22773 22774 ;// ./node_modules/@wordpress/edit-site/build-module/components/style-book/examples.js 22775 /** 22776 * WordPress dependencies 22777 */ 22778 22779 22780 22781 /** 22782 * Internal dependencies 22783 */ 22784 22785 22786 22787 22788 22789 /** 22790 * Returns examples color examples for each origin 22791 * e.g. Core (Default), Theme, and User. 22792 * 22793 * @param {MultiOriginPalettes} colors Global Styles color palettes per origin. 22794 * @return {BlockExample[]} An array of color block examples. 22795 */ 22796 22797 function getColorExamples(colors) { 22798 if (!colors) { 22799 return []; 22800 } 22801 const examples = []; 22802 STYLE_BOOK_COLOR_GROUPS.forEach(group => { 22803 const palette = colors[group.type]; 22804 const paletteFiltered = Array.isArray(palette) ? palette.find(origin => origin.slug === group.origin) : undefined; 22805 if (paletteFiltered?.[group.type]) { 22806 const example = { 22807 name: group.slug, 22808 title: group.title, 22809 category: 'colors' 22810 }; 22811 if (group.type === 'duotones') { 22812 example.content = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(duotone_examples, { 22813 duotones: paletteFiltered[group.type] 22814 }); 22815 examples.push(example); 22816 } else { 22817 example.content = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(color_examples, { 22818 colors: paletteFiltered[group.type], 22819 type: group.type 22820 }); 22821 examples.push(example); 22822 } 22823 } 22824 }); 22825 return examples; 22826 } 22827 22828 /** 22829 * Returns examples for the overview page. 22830 * 22831 * @param {MultiOriginPalettes} colors Global Styles color palettes per origin. 22832 * @return {BlockExample[]} An array of block examples. 22833 */ 22834 function getOverviewBlockExamples(colors) { 22835 const examples = []; 22836 22837 // Get theme palette from colors if they exist. 22838 const themePalette = Array.isArray(colors?.colors) ? colors.colors.find(origin => origin.slug === 'theme') : undefined; 22839 if (themePalette) { 22840 const themeColorexample = { 22841 name: 'theme-colors', 22842 title: (0,external_wp_i18n_namespaceObject.__)('Colors'), 22843 category: 'overview', 22844 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(color_examples, { 22845 colors: themePalette.colors, 22846 type: "colors", 22847 templateColumns: "repeat(auto-fill, minmax( 200px, 1fr ))", 22848 itemHeight: "32px" 22849 }) 22850 }; 22851 examples.push(themeColorexample); 22852 } 22853 22854 // Get examples for typography blocks. 22855 const typographyBlockExamples = []; 22856 if ((0,external_wp_blocks_namespaceObject.getBlockType)('core/heading')) { 22857 const headingBlock = (0,external_wp_blocks_namespaceObject.createBlock)('core/heading', { 22858 content: (0,external_wp_i18n_namespaceObject.__)(`AaBbCcDdEeFfGgHhiiJjKkLIMmNnOoPpQakRrssTtUuVVWwXxxYyZzOl23356789X{(…)},2!*&:/A@HELFO™`), 22859 level: 1 22860 }); 22861 typographyBlockExamples.push(headingBlock); 22862 } 22863 if ((0,external_wp_blocks_namespaceObject.getBlockType)('core/paragraph')) { 22864 const firstParagraphBlock = (0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', { 22865 content: (0,external_wp_i18n_namespaceObject.__)(`A paragraph in a website refers to a distinct block of text that is used to present and organize information. It is a fundamental unit of content in web design and is typically composed of a group of related sentences or thoughts focused on a particular topic or idea. Paragraphs play a crucial role in improving the readability and user experience of a website. They break down the text into smaller, manageable chunks, allowing readers to scan the content more easily.`) 22866 }); 22867 const secondParagraphBlock = (0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', { 22868 content: (0,external_wp_i18n_namespaceObject.__)(`Additionally, paragraphs help structure the flow of information and provide logical breaks between different concepts or pieces of information. In terms of formatting, paragraphs in websites are commonly denoted by a vertical gap or indentation between each block of text. This visual separation helps visually distinguish one paragraph from another, creating a clear and organized layout that guides the reader through the content smoothly.`) 22869 }); 22870 if ((0,external_wp_blocks_namespaceObject.getBlockType)('core/group')) { 22871 const groupBlock = (0,external_wp_blocks_namespaceObject.createBlock)('core/group', { 22872 layout: { 22873 type: 'grid', 22874 columnCount: 2, 22875 minimumColumnWidth: '12rem' 22876 }, 22877 style: { 22878 spacing: { 22879 blockGap: '1.5rem' 22880 } 22881 } 22882 }, [firstParagraphBlock, secondParagraphBlock]); 22883 typographyBlockExamples.push(groupBlock); 22884 } else { 22885 typographyBlockExamples.push(firstParagraphBlock); 22886 } 22887 } 22888 if (!!typographyBlockExamples.length) { 22889 examples.push({ 22890 name: 'typography', 22891 title: (0,external_wp_i18n_namespaceObject.__)('Typography'), 22892 category: 'overview', 22893 blocks: typographyBlockExamples 22894 }); 22895 } 22896 const otherBlockExamples = ['core/image', 'core/separator', 'core/buttons', 'core/pullquote', 'core/search']; 22897 22898 // Get examples for other blocks and put them in order of above array. 22899 otherBlockExamples.forEach(blockName => { 22900 const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName); 22901 if (blockType && blockType.example) { 22902 const blockExample = { 22903 name: blockName, 22904 title: blockType.title, 22905 category: 'overview', 22906 /* 22907 * CSS generated from style attributes will take precedence over global styles CSS, 22908 * so remove the style attribute from the example to ensure the example 22909 * demonstrates changes to global styles. 22910 */ 22911 blocks: (0,external_wp_blocks_namespaceObject.getBlockFromExample)(blockName, { 22912 ...blockType.example, 22913 attributes: { 22914 ...blockType.example.attributes, 22915 style: undefined 22916 } 22917 }) 22918 }; 22919 examples.push(blockExample); 22920 } 22921 }); 22922 return examples; 22923 } 22924 22925 /** 22926 * Returns a list of examples for registered block types. 22927 * 22928 * @param {MultiOriginPalettes} colors Global styles colors grouped by origin e.g. Core, Theme, and User. 22929 * @return {BlockExample[]} An array of block examples. 22930 */ 22931 function getExamples(colors) { 22932 const nonHeadingBlockExamples = (0,external_wp_blocks_namespaceObject.getBlockTypes)().filter(blockType => { 22933 const { 22934 name, 22935 example, 22936 supports 22937 } = blockType; 22938 return name !== 'core/heading' && !!example && supports?.inserter !== false; 22939 }).map(blockType => ({ 22940 name: blockType.name, 22941 title: blockType.title, 22942 category: blockType.category, 22943 /* 22944 * CSS generated from style attributes will take precedence over global styles CSS, 22945 * so remove the style attribute from the example to ensure the example 22946 * demonstrates changes to global styles. 22947 */ 22948 blocks: (0,external_wp_blocks_namespaceObject.getBlockFromExample)(blockType.name, { 22949 ...blockType.example, 22950 attributes: { 22951 ...blockType.example.attributes, 22952 style: undefined 22953 } 22954 }) 22955 })); 22956 const isHeadingBlockRegistered = !!(0,external_wp_blocks_namespaceObject.getBlockType)('core/heading'); 22957 if (!isHeadingBlockRegistered) { 22958 return nonHeadingBlockExamples; 22959 } 22960 22961 // Use our own example for the Heading block so that we can show multiple 22962 // heading levels. 22963 const headingsExample = { 22964 name: 'core/heading', 22965 title: (0,external_wp_i18n_namespaceObject.__)('Headings'), 22966 category: 'text', 22967 blocks: [1, 2, 3, 4, 5, 6].map(level => { 22968 return (0,external_wp_blocks_namespaceObject.createBlock)('core/heading', { 22969 content: (0,external_wp_i18n_namespaceObject.sprintf)( 22970 // translators: %d: heading level e.g: "1", "2", "3" 22971 (0,external_wp_i18n_namespaceObject.__)('Heading %d'), level), 22972 level 22973 }); 22974 }) 22975 }; 22976 const colorExamples = getColorExamples(colors); 22977 const overviewBlockExamples = getOverviewBlockExamples(colors); 22978 return [headingsExample, ...colorExamples, ...nonHeadingBlockExamples, ...overviewBlockExamples]; 22979 } 22980 22981 ;// ./node_modules/@wordpress/edit-site/build-module/components/page/header.js 22982 /** 22983 * WordPress dependencies 22984 */ 22985 22986 22987 /** 22988 * Internal dependencies 22989 */ 22990 22991 function Header({ 22992 title, 22993 subTitle, 22994 actions 22995 }) { 22996 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 22997 className: "edit-site-page-header", 22998 as: "header", 22999 spacing: 0, 23000 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 23001 className: "edit-site-page-header__page-title", 23002 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 23003 as: "h2", 23004 level: 3, 23005 weight: 500, 23006 className: "edit-site-page-header__title", 23007 truncate: true, 23008 children: title 23009 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 23010 className: "edit-site-page-header__actions", 23011 children: actions 23012 })] 23013 }), subTitle && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 23014 variant: "muted", 23015 as: "p", 23016 className: "edit-site-page-header__sub-title", 23017 children: subTitle 23018 })] 23019 }); 23020 } 23021 23022 ;// ./node_modules/@wordpress/edit-site/build-module/components/page/index.js 23023 /** 23024 * External dependencies 23025 */ 23026 23027 23028 /** 23029 * WordPress dependencies 23030 */ 23031 23032 23033 /** 23034 * Internal dependencies 23035 */ 23036 23037 23038 23039 const { 23040 NavigableRegion: page_NavigableRegion 23041 } = unlock(external_wp_editor_namespaceObject.privateApis); 23042 function Page({ 23043 title, 23044 subTitle, 23045 actions, 23046 children, 23047 className, 23048 hideTitleFromUI = false 23049 }) { 23050 const classes = dist_clsx('edit-site-page', className); 23051 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(page_NavigableRegion, { 23052 className: classes, 23053 ariaLabel: title, 23054 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 23055 className: "edit-site-page-content", 23056 children: [!hideTitleFromUI && title && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Header, { 23057 title: title, 23058 subTitle: subTitle, 23059 actions: actions 23060 }), children] 23061 }) 23062 }); 23063 } 23064 23065 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-global-styles-wrapper/index.js 23066 /** 23067 * WordPress dependencies 23068 */ 23069 23070 23071 23072 23073 23074 23075 23076 23077 /** 23078 * Internal dependencies 23079 */ 23080 23081 23082 23083 23084 const { 23085 useLocation: sidebar_global_styles_wrapper_useLocation, 23086 useHistory: sidebar_global_styles_wrapper_useHistory 23087 } = unlock(external_wp_router_namespaceObject.privateApis); 23088 const GlobalStylesPageActions = ({ 23089 isStyleBookOpened, 23090 setIsStyleBookOpened, 23091 path 23092 }) => { 23093 const history = sidebar_global_styles_wrapper_useHistory(); 23094 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 23095 isPressed: isStyleBookOpened, 23096 icon: library_seen, 23097 label: (0,external_wp_i18n_namespaceObject.__)('Style Book'), 23098 onClick: () => { 23099 setIsStyleBookOpened(!isStyleBookOpened); 23100 const updatedPath = !isStyleBookOpened ? (0,external_wp_url_namespaceObject.addQueryArgs)(path, { 23101 preview: 'stylebook' 23102 }) : (0,external_wp_url_namespaceObject.removeQueryArgs)(path, 'preview'); 23103 // Navigate to the updated path. 23104 history.navigate(updatedPath); 23105 }, 23106 size: "compact" 23107 }); 23108 }; 23109 23110 /** 23111 * Hook to deal with navigation and location state. 23112 * 23113 * @return {Array} The current section and a function to update it. 23114 */ 23115 const useSection = () => { 23116 const { 23117 path, 23118 query 23119 } = sidebar_global_styles_wrapper_useLocation(); 23120 const history = sidebar_global_styles_wrapper_useHistory(); 23121 return (0,external_wp_element_namespaceObject.useMemo)(() => { 23122 var _query$section; 23123 return [(_query$section = query.section) !== null && _query$section !== void 0 ? _query$section : '/', updatedSection => { 23124 history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { 23125 section: updatedSection 23126 })); 23127 }]; 23128 }, [path, query.section, history]); 23129 }; 23130 function GlobalStylesUIWrapper() { 23131 const { 23132 path 23133 } = sidebar_global_styles_wrapper_useLocation(); 23134 const [isStyleBookOpened, setIsStyleBookOpened] = (0,external_wp_element_namespaceObject.useState)(path.includes('preview=stylebook')); 23135 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); 23136 const [section, onChangeSection] = useSection(); 23137 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { 23138 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Page, { 23139 actions: !isMobileViewport ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesPageActions, { 23140 isStyleBookOpened: isStyleBookOpened, 23141 setIsStyleBookOpened: setIsStyleBookOpened, 23142 path: path 23143 }) : null, 23144 className: "edit-site-styles", 23145 title: (0,external_wp_i18n_namespaceObject.__)('Styles'), 23146 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(global_styles_ui, { 23147 path: section, 23148 onPathChange: onChangeSection 23149 }) 23150 }) 23151 }); 23152 } 23153 23154 ;// ./node_modules/@wordpress/edit-site/build-module/components/style-book/index.js 23155 /** 23156 * External dependencies 23157 */ 23158 23159 23160 /** 23161 * WordPress dependencies 23162 */ 23163 23164 23165 23166 23167 23168 23169 23170 23171 23172 23173 /** 23174 * Internal dependencies 23175 */ 23176 23177 23178 23179 23180 23181 23182 23183 23184 23185 23186 const { 23187 ExperimentalBlockEditorProvider, 23188 useGlobalStyle: style_book_useGlobalStyle, 23189 GlobalStylesContext: style_book_GlobalStylesContext, 23190 useGlobalStylesOutputWithConfig 23191 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 23192 const { 23193 mergeBaseAndUserConfigs: style_book_mergeBaseAndUserConfigs 23194 } = unlock(external_wp_editor_namespaceObject.privateApis); 23195 const { 23196 Tabs: style_book_Tabs 23197 } = unlock(external_wp_components_namespaceObject.privateApis); 23198 function isObjectEmpty(object) { 23199 return !object || Object.keys(object).length === 0; 23200 } 23201 23202 /** 23203 * Scrolls to a section within an iframe. 23204 * 23205 * @param {string} anchorId The id of the element to scroll to. 23206 * @param {HTMLIFrameElement} iframe The target iframe. 23207 */ 23208 const scrollToSection = (anchorId, iframe) => { 23209 if (!anchorId || !iframe || !iframe?.contentDocument) { 23210 return; 23211 } 23212 const element = anchorId === 'top' ? iframe.contentDocument.body : iframe.contentDocument.getElementById(anchorId); 23213 if (element) { 23214 element.scrollIntoView({ 23215 behavior: 'smooth' 23216 }); 23217 } 23218 }; 23219 23220 /** 23221 * Parses a Block Editor navigation path to build a style book navigation path. 23222 * The object can be extended to include a category, representing a style book tab/section. 23223 * 23224 * @param {string} path An internal Block Editor navigation path. 23225 * @return {null|{block: string}} An object containing the example to navigate to. 23226 */ 23227 const getStyleBookNavigationFromPath = path => { 23228 if (path && typeof path === 'string') { 23229 if (path === '/' || path.startsWith('/typography') || path.startsWith('/colors') || path.startsWith('/blocks')) { 23230 return { 23231 top: true 23232 }; 23233 } 23234 } 23235 return null; 23236 }; 23237 23238 /** 23239 * Retrieves colors, gradients, and duotone filters from Global Styles. 23240 * The inclusion of default (Core) palettes is controlled by the relevant 23241 * theme.json property e.g. defaultPalette, defaultGradients, defaultDuotone. 23242 * 23243 * @return {Object} Object containing properties for each type of palette. 23244 */ 23245 function useMultiOriginPalettes() { 23246 const { 23247 colors, 23248 gradients 23249 } = (0,external_wp_blockEditor_namespaceObject.__experimentalUseMultipleOriginColorsAndGradients)(); 23250 23251 // Add duotone filters to the palettes data. 23252 const [shouldDisplayDefaultDuotones, customDuotones, themeDuotones, defaultDuotones] = (0,external_wp_blockEditor_namespaceObject.useSettings)('color.defaultDuotone', 'color.duotone.custom', 'color.duotone.theme', 'color.duotone.default'); 23253 const palettes = (0,external_wp_element_namespaceObject.useMemo)(() => { 23254 const result = { 23255 colors, 23256 gradients, 23257 duotones: [] 23258 }; 23259 if (themeDuotones && themeDuotones.length) { 23260 result.duotones.push({ 23261 name: (0,external_wp_i18n_namespaceObject._x)('Theme', 'Indicates these duotone filters come from the theme.'), 23262 slug: 'theme', 23263 duotones: themeDuotones 23264 }); 23265 } 23266 if (shouldDisplayDefaultDuotones && defaultDuotones && defaultDuotones.length) { 23267 result.duotones.push({ 23268 name: (0,external_wp_i18n_namespaceObject._x)('Default', 'Indicates these duotone filters come from WordPress.'), 23269 slug: 'default', 23270 duotones: defaultDuotones 23271 }); 23272 } 23273 if (customDuotones && customDuotones.length) { 23274 result.duotones.push({ 23275 name: (0,external_wp_i18n_namespaceObject._x)('Custom', 'Indicates these doutone filters are created by the user.'), 23276 slug: 'custom', 23277 duotones: customDuotones 23278 }); 23279 } 23280 return result; 23281 }, [colors, gradients, customDuotones, themeDuotones, defaultDuotones, shouldDisplayDefaultDuotones]); 23282 return palettes; 23283 } 23284 23285 /** 23286 * Get deduped examples for single page stylebook. 23287 * @param {Array} examples Array of examples. 23288 * @return {Array} Deduped examples. 23289 */ 23290 function getExamplesForSinglePageUse(examples) { 23291 const examplesForSinglePageUse = []; 23292 const overviewCategoryExamples = getExamplesByCategory({ 23293 slug: 'overview' 23294 }, examples); 23295 examplesForSinglePageUse.push(...overviewCategoryExamples.examples); 23296 const otherExamples = examples.filter(example => { 23297 return example.category !== 'overview' && !overviewCategoryExamples.examples.find(overviewExample => overviewExample.name === example.name); 23298 }); 23299 examplesForSinglePageUse.push(...otherExamples); 23300 return examplesForSinglePageUse; 23301 } 23302 function StyleBook({ 23303 enableResizing = true, 23304 isSelected, 23305 onClick, 23306 onSelect, 23307 showCloseButton = true, 23308 onClose, 23309 showTabs = true, 23310 userConfig = {}, 23311 path = '' 23312 }) { 23313 const [textColor] = style_book_useGlobalStyle('color.text'); 23314 const [backgroundColor] = style_book_useGlobalStyle('color.background'); 23315 const colors = useMultiOriginPalettes(); 23316 const examples = (0,external_wp_element_namespaceObject.useMemo)(() => getExamples(colors), [colors]); 23317 const tabs = (0,external_wp_element_namespaceObject.useMemo)(() => getTopLevelStyleBookCategories().filter(category => examples.some(example => example.category === category.slug)), [examples]); 23318 const examplesForSinglePageUse = getExamplesForSinglePageUse(examples); 23319 const { 23320 base: baseConfig 23321 } = (0,external_wp_element_namespaceObject.useContext)(style_book_GlobalStylesContext); 23322 const goTo = getStyleBookNavigationFromPath(path); 23323 const mergedConfig = (0,external_wp_element_namespaceObject.useMemo)(() => { 23324 if (!isObjectEmpty(userConfig) && !isObjectEmpty(baseConfig)) { 23325 return style_book_mergeBaseAndUserConfigs(baseConfig, userConfig); 23326 } 23327 return {}; 23328 }, [baseConfig, userConfig]); 23329 23330 // Copied from packages/edit-site/src/components/revisions/index.js 23331 // could we create a shared hook? 23332 const originalSettings = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getSettings(), []); 23333 const [globalStyles] = useGlobalStylesOutputWithConfig(mergedConfig); 23334 const settings = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 23335 ...originalSettings, 23336 styles: !isObjectEmpty(globalStyles) && !isObjectEmpty(userConfig) ? globalStyles : originalSettings.styles, 23337 isPreviewMode: true 23338 }), [globalStyles, originalSettings, userConfig]); 23339 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_canvas_container, { 23340 onClose: onClose, 23341 enableResizing: enableResizing, 23342 closeButtonLabel: showCloseButton ? (0,external_wp_i18n_namespaceObject.__)('Close') : null, 23343 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 23344 className: dist_clsx('edit-site-style-book', { 23345 'is-button': !!onClick 23346 }), 23347 style: { 23348 color: textColor, 23349 background: backgroundColor 23350 }, 23351 children: showTabs ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(style_book_Tabs, { 23352 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 23353 className: "edit-site-style-book__tablist-container", 23354 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(style_book_Tabs.TabList, { 23355 children: tabs.map(tab => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(style_book_Tabs.Tab, { 23356 tabId: tab.slug, 23357 children: tab.title 23358 }, tab.slug)) 23359 }) 23360 }), tabs.map(tab => { 23361 const categoryDefinition = tab.slug ? getTopLevelStyleBookCategories().find(_category => _category.slug === tab.slug) : null; 23362 const filteredExamples = categoryDefinition ? getExamplesByCategory(categoryDefinition, examples) : { 23363 examples 23364 }; 23365 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(style_book_Tabs.TabPanel, { 23366 tabId: tab.slug, 23367 focusable: false, 23368 className: "edit-site-style-book__tabpanel", 23369 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleBookBody, { 23370 category: tab.slug, 23371 examples: filteredExamples, 23372 isSelected: isSelected, 23373 onSelect: onSelect, 23374 settings: settings, 23375 title: tab.title, 23376 goTo: goTo 23377 }) 23378 }, tab.slug); 23379 })] 23380 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleBookBody, { 23381 examples: { 23382 examples: examplesForSinglePageUse 23383 }, 23384 isSelected: isSelected, 23385 onClick: onClick, 23386 onSelect: onSelect, 23387 settings: settings, 23388 goTo: goTo 23389 }) 23390 }) 23391 }); 23392 } 23393 23394 /** 23395 * Style Book Preview component renders the stylebook without the Editor dependency. 23396 * 23397 * @param {Object} props Component props. 23398 * @param {Object} props.userConfig User configuration. 23399 * @param {boolean} props.isStatic Whether the stylebook is static or clickable. 23400 * @return {Object} Style Book Preview component. 23401 */ 23402 const StyleBookPreview = ({ 23403 userConfig = {}, 23404 isStatic = false 23405 }) => { 23406 const siteEditorSettings = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getSettings(), []); 23407 const canUserUploadMedia = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).canUser('create', { 23408 kind: 'root', 23409 name: 'media' 23410 }), []); 23411 23412 // Update block editor settings because useMultipleOriginColorsAndGradients fetch colours from there. 23413 (0,external_wp_element_namespaceObject.useEffect)(() => { 23414 (0,external_wp_data_namespaceObject.dispatch)(external_wp_blockEditor_namespaceObject.store).updateSettings({ 23415 ...siteEditorSettings, 23416 mediaUpload: canUserUploadMedia ? external_wp_mediaUtils_namespaceObject.uploadMedia : undefined 23417 }); 23418 }, [siteEditorSettings, canUserUploadMedia]); 23419 const [section, onChangeSection] = useSection(); 23420 const isSelected = blockName => { 23421 // Match '/blocks/core%2Fbutton' and 23422 // '/blocks/core%2Fbutton/typography', but not 23423 // '/blocks/core%2Fbuttons'. 23424 return section === `/blocks/$encodeURIComponent(blockName)}` || section.startsWith(`/blocks/$encodeURIComponent(blockName)}/`); 23425 }; 23426 const onSelect = blockName => { 23427 if (STYLE_BOOK_COLOR_GROUPS.find(group => group.slug === blockName)) { 23428 // Go to color palettes Global Styles. 23429 onChangeSection('/colors/palette'); 23430 return; 23431 } 23432 if (blockName === 'typography') { 23433 // Go to typography Global Styles. 23434 onChangeSection('/typography'); 23435 return; 23436 } 23437 23438 // Now go to the selected block. 23439 onChangeSection(`/blocks/$encodeURIComponent(blockName)}`); 23440 }; 23441 const colors = useMultiOriginPalettes(); 23442 const examples = getExamples(colors); 23443 const examplesForSinglePageUse = getExamplesForSinglePageUse(examples); 23444 let previewCategory = null; 23445 if (section.includes('/colors')) { 23446 previewCategory = 'colors'; 23447 } else if (section.includes('/typography')) { 23448 previewCategory = 'text'; 23449 } else if (section.includes('/blocks')) { 23450 previewCategory = 'blocks'; 23451 const blockName = decodeURIComponent(section).split('/blocks/')[1]; 23452 if (blockName && examples.find(example => example.name === blockName)) { 23453 previewCategory = blockName; 23454 } 23455 } else if (!isStatic) { 23456 previewCategory = 'overview'; 23457 } 23458 const categoryDefinition = STYLE_BOOK_PREVIEW_CATEGORIES.find(category => category.slug === previewCategory); 23459 23460 // If there's no category definition there may be a single block. 23461 const filteredExamples = categoryDefinition ? getExamplesByCategory(categoryDefinition, examples) : { 23462 examples: [examples.find(example => example.name === previewCategory)] 23463 }; 23464 23465 // If there's no preview category, show all examples. 23466 const displayedExamples = previewCategory ? filteredExamples : { 23467 examples: examplesForSinglePageUse 23468 }; 23469 const { 23470 base: baseConfig 23471 } = (0,external_wp_element_namespaceObject.useContext)(style_book_GlobalStylesContext); 23472 const goTo = getStyleBookNavigationFromPath(section); 23473 const mergedConfig = (0,external_wp_element_namespaceObject.useMemo)(() => { 23474 if (!isObjectEmpty(userConfig) && !isObjectEmpty(baseConfig)) { 23475 return style_book_mergeBaseAndUserConfigs(baseConfig, userConfig); 23476 } 23477 return {}; 23478 }, [baseConfig, userConfig]); 23479 const [globalStyles] = useGlobalStylesOutputWithConfig(mergedConfig); 23480 const settings = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 23481 ...siteEditorSettings, 23482 styles: !isObjectEmpty(globalStyles) && !isObjectEmpty(userConfig) ? globalStyles : siteEditorSettings.styles, 23483 isPreviewMode: true 23484 }), [globalStyles, siteEditorSettings, userConfig]); 23485 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 23486 className: "edit-site-style-book", 23487 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.BlockEditorProvider, { 23488 settings: settings, 23489 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesRenderer, { 23490 disableRootPadding: true 23491 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleBookBody, { 23492 examples: displayedExamples, 23493 settings: settings, 23494 goTo: goTo, 23495 isSelected: !isStatic ? isSelected : null, 23496 onSelect: !isStatic ? onSelect : null 23497 })] 23498 }) 23499 }); 23500 }; 23501 const StyleBookBody = ({ 23502 examples, 23503 isSelected, 23504 onClick, 23505 onSelect, 23506 settings, 23507 title, 23508 goTo 23509 }) => { 23510 const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false); 23511 const [hasIframeLoaded, setHasIframeLoaded] = (0,external_wp_element_namespaceObject.useState)(false); 23512 const iframeRef = (0,external_wp_element_namespaceObject.useRef)(null); 23513 // The presence of an `onClick` prop indicates that the Style Book is being used as a button. 23514 // In this case, add additional props to the iframe to make it behave like a button. 23515 const buttonModeProps = { 23516 role: 'button', 23517 onFocus: () => setIsFocused(true), 23518 onBlur: () => setIsFocused(false), 23519 onKeyDown: event => { 23520 if (event.defaultPrevented) { 23521 return; 23522 } 23523 const { 23524 keyCode 23525 } = event; 23526 if (onClick && (keyCode === external_wp_keycodes_namespaceObject.ENTER || keyCode === external_wp_keycodes_namespaceObject.SPACE)) { 23527 event.preventDefault(); 23528 onClick(event); 23529 } 23530 }, 23531 onClick: event => { 23532 if (event.defaultPrevented) { 23533 return; 23534 } 23535 if (onClick) { 23536 event.preventDefault(); 23537 onClick(event); 23538 } 23539 }, 23540 readonly: true 23541 }; 23542 const handleLoad = () => setHasIframeLoaded(true); 23543 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { 23544 if (hasIframeLoaded && iframeRef?.current) { 23545 if (goTo?.top) { 23546 scrollToSection('top', iframeRef?.current); 23547 } 23548 } 23549 }, [iframeRef?.current, goTo, scrollToSection, hasIframeLoaded]); 23550 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.__unstableIframe, { 23551 onLoad: handleLoad, 23552 ref: iframeRef, 23553 className: dist_clsx('edit-site-style-book__iframe', { 23554 'is-focused': isFocused && !!onClick, 23555 'is-button': !!onClick 23556 }), 23557 name: "style-book-canvas", 23558 tabIndex: 0, 23559 ...(onClick ? buttonModeProps : {}), 23560 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, { 23561 styles: settings.styles 23562 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("style", { 23563 children: [STYLE_BOOK_IFRAME_STYLES, !!onClick && 'body { cursor: pointer; } body * { pointer-events: none; }'] 23564 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Examples, { 23565 className: "edit-site-style-book__examples", 23566 filteredExamples: examples, 23567 label: title ? (0,external_wp_i18n_namespaceObject.sprintf)( 23568 // translators: %s: Category of blocks, e.g. Text. 23569 (0,external_wp_i18n_namespaceObject.__)('Examples of blocks in the %s category'), title) : (0,external_wp_i18n_namespaceObject.__)('Examples of blocks'), 23570 isSelected: isSelected, 23571 onSelect: onSelect 23572 }, title)] 23573 }); 23574 }; 23575 const Examples = (0,external_wp_element_namespaceObject.memo)(({ 23576 className, 23577 filteredExamples, 23578 label, 23579 isSelected, 23580 onSelect 23581 }) => { 23582 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Composite, { 23583 orientation: "vertical", 23584 className: className, 23585 "aria-label": label, 23586 role: "grid", 23587 children: [!!filteredExamples?.examples?.length && filteredExamples.examples.map(example => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Example, { 23588 id: `example-$example.name}`, 23589 title: example.title, 23590 content: example.content, 23591 blocks: example.blocks, 23592 isSelected: isSelected?.(example.name), 23593 onClick: !!onSelect ? () => onSelect(example.name) : null 23594 }, example.name)), !!filteredExamples?.subcategories?.length && filteredExamples.subcategories.map(subcategory => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Composite.Group, { 23595 className: "edit-site-style-book__subcategory", 23596 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.GroupLabel, { 23597 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { 23598 className: "edit-site-style-book__subcategory-title", 23599 children: subcategory.title 23600 }) 23601 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Subcategory, { 23602 examples: subcategory.examples, 23603 isSelected: isSelected, 23604 onSelect: onSelect 23605 })] 23606 }, `subcategory-$subcategory.slug}`))] 23607 }); 23608 }); 23609 const Subcategory = ({ 23610 examples, 23611 isSelected, 23612 onSelect 23613 }) => { 23614 return !!examples?.length && examples.map(example => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Example, { 23615 id: `example-$example.name}`, 23616 title: example.title, 23617 content: example.content, 23618 blocks: example.blocks, 23619 isSelected: isSelected?.(example.name), 23620 onClick: !!onSelect ? () => onSelect(example.name) : null 23621 }, example.name)); 23622 }; 23623 const disabledExamples = ['example-duotones']; 23624 const Example = ({ 23625 id, 23626 title, 23627 blocks, 23628 isSelected, 23629 onClick, 23630 content 23631 }) => { 23632 const originalSettings = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getSettings(), []); 23633 const settings = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 23634 ...originalSettings, 23635 focusMode: false, 23636 // Disable "Spotlight mode". 23637 isPreviewMode: true 23638 }), [originalSettings]); 23639 23640 // Cache the list of blocks to avoid additional processing when the component is re-rendered. 23641 const renderedBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => Array.isArray(blocks) ? blocks : [blocks], [blocks]); 23642 const disabledProps = disabledExamples.includes(id) || !onClick ? { 23643 disabled: true, 23644 accessibleWhenDisabled: !!onClick 23645 } : {}; 23646 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 23647 role: "row", 23648 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 23649 role: "gridcell", 23650 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Composite.Item, { 23651 className: dist_clsx('edit-site-style-book__example', { 23652 'is-selected': isSelected, 23653 'is-disabled-example': !!disabledProps?.disabled 23654 }), 23655 id: id, 23656 "aria-label": !!onClick ? (0,external_wp_i18n_namespaceObject.sprintf)( 23657 // translators: %s: Title of a block, e.g. Heading. 23658 (0,external_wp_i18n_namespaceObject.__)('Open %s styles in Styles panel'), title) : undefined, 23659 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {}), 23660 role: !!onClick ? 'button' : null, 23661 onClick: onClick, 23662 ...disabledProps, 23663 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 23664 className: "edit-site-style-book__example-title", 23665 children: title 23666 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 23667 className: "edit-site-style-book__example-preview", 23668 "aria-hidden": true, 23669 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Disabled, { 23670 className: "edit-site-style-book__example-preview__content", 23671 children: content ? content : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ExperimentalBlockEditorProvider, { 23672 value: renderedBlocks, 23673 settings: settings, 23674 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockList, { 23675 renderAppender: false 23676 })] 23677 }) 23678 }) 23679 })] 23680 }) 23681 }) 23682 }); 23683 }; 23684 /* harmony default export */ const style_book = (StyleBook); 23685 23686 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-css.js 23687 /** 23688 * WordPress dependencies 23689 */ 23690 23691 23692 23693 23694 23695 /** 23696 * Internal dependencies 23697 */ 23698 23699 23700 23701 23702 const { 23703 useGlobalStyle: screen_css_useGlobalStyle, 23704 AdvancedPanel: screen_css_StylesAdvancedPanel 23705 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 23706 function ScreenCSS() { 23707 const description = (0,external_wp_i18n_namespaceObject.__)('Add your own CSS to customize the appearance and layout of your site.'); 23708 const [style] = screen_css_useGlobalStyle('', undefined, 'user', { 23709 shouldDecodeEncode: false 23710 }); 23711 const [inheritedStyle, setStyle] = screen_css_useGlobalStyle('', undefined, 'all', { 23712 shouldDecodeEncode: false 23713 }); 23714 const { 23715 setEditorCanvasContainerView 23716 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 23717 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 23718 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 23719 title: (0,external_wp_i18n_namespaceObject.__)('CSS'), 23720 description: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 23721 children: [description, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("br", {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { 23722 href: (0,external_wp_i18n_namespaceObject.__)('https://developer.wordpress.org/advanced-administration/wordpress/css/'), 23723 className: "edit-site-global-styles-screen-css-help-link", 23724 children: (0,external_wp_i18n_namespaceObject.__)('Learn more about CSS') 23725 })] 23726 }), 23727 onBack: () => { 23728 setEditorCanvasContainerView(undefined); 23729 } 23730 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 23731 className: "edit-site-global-styles-screen-css", 23732 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_css_StylesAdvancedPanel, { 23733 value: style, 23734 onChange: setStyle, 23735 inheritedValue: inheritedStyle 23736 }) 23737 })] 23738 }); 23739 } 23740 /* harmony default export */ const screen_css = (ScreenCSS); 23741 23742 ;// ./node_modules/@wordpress/edit-site/build-module/components/revisions/index.js 23743 /** 23744 * WordPress dependencies 23745 */ 23746 23747 23748 23749 23750 23751 23752 23753 /** 23754 * Internal dependencies 23755 */ 23756 23757 23758 23759 23760 const { 23761 ExperimentalBlockEditorProvider: revisions_ExperimentalBlockEditorProvider, 23762 GlobalStylesContext: revisions_GlobalStylesContext, 23763 useGlobalStylesOutputWithConfig: revisions_useGlobalStylesOutputWithConfig, 23764 __unstableBlockStyleVariationOverridesWithConfig 23765 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 23766 const { 23767 mergeBaseAndUserConfigs: revisions_mergeBaseAndUserConfigs 23768 } = unlock(external_wp_editor_namespaceObject.privateApis); 23769 function revisions_isObjectEmpty(object) { 23770 return !object || Object.keys(object).length === 0; 23771 } 23772 function Revisions({ 23773 userConfig, 23774 blocks 23775 }) { 23776 const { 23777 base: baseConfig 23778 } = (0,external_wp_element_namespaceObject.useContext)(revisions_GlobalStylesContext); 23779 const mergedConfig = (0,external_wp_element_namespaceObject.useMemo)(() => { 23780 if (!revisions_isObjectEmpty(userConfig) && !revisions_isObjectEmpty(baseConfig)) { 23781 return revisions_mergeBaseAndUserConfigs(baseConfig, userConfig); 23782 } 23783 return {}; 23784 }, [baseConfig, userConfig]); 23785 const renderedBlocksArray = (0,external_wp_element_namespaceObject.useMemo)(() => Array.isArray(blocks) ? blocks : [blocks], [blocks]); 23786 const originalSettings = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getSettings(), []); 23787 const settings = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 23788 ...originalSettings, 23789 isPreviewMode: true 23790 }), [originalSettings]); 23791 const [globalStyles] = revisions_useGlobalStylesOutputWithConfig(mergedConfig); 23792 const editorStyles = !revisions_isObjectEmpty(globalStyles) && !revisions_isObjectEmpty(userConfig) ? globalStyles : settings.styles; 23793 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_canvas_container, { 23794 title: (0,external_wp_i18n_namespaceObject.__)('Revisions'), 23795 closeButtonLabel: (0,external_wp_i18n_namespaceObject.__)('Close revisions'), 23796 enableResizing: true, 23797 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.__unstableIframe, { 23798 className: "edit-site-revisions__iframe", 23799 name: "revisions", 23800 tabIndex: 0, 23801 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("style", { 23802 children: 23803 // Forming a "block formatting context" to prevent margin collapsing. 23804 // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context 23805 `.is-root-container { display: flow-root; }` 23806 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Disabled, { 23807 className: "edit-site-revisions__example-preview__content", 23808 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(revisions_ExperimentalBlockEditorProvider, { 23809 value: renderedBlocksArray, 23810 settings: settings, 23811 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockList, { 23812 renderAppender: false 23813 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, { 23814 styles: editorStyles 23815 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(__unstableBlockStyleVariationOverridesWithConfig, { 23816 config: mergedConfig 23817 })] 23818 }) 23819 })] 23820 }) 23821 }); 23822 } 23823 /* harmony default export */ const components_revisions = (Revisions); 23824 23825 ;// external ["wp","date"] 23826 const external_wp_date_namespaceObject = window["wp"]["date"]; 23827 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-revisions/revisions-buttons.js 23828 /** 23829 * WordPress dependencies 23830 */ 23831 23832 23833 23834 23835 23836 23837 23838 /** 23839 * Internal dependencies 23840 */ 23841 23842 23843 const DAY_IN_MILLISECONDS = 60 * 60 * 1000 * 24; 23844 const { 23845 getGlobalStylesChanges 23846 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 23847 function ChangesSummary({ 23848 revision, 23849 previousRevision 23850 }) { 23851 const changes = getGlobalStylesChanges(revision, previousRevision, { 23852 maxResults: 7 23853 }); 23854 if (!changes.length) { 23855 return null; 23856 } 23857 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { 23858 "data-testid": "global-styles-revision-changes", 23859 className: "edit-site-global-styles-screen-revisions__changes", 23860 children: changes.map(change => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { 23861 children: change 23862 }, change)) 23863 }); 23864 } 23865 23866 /** 23867 * Returns a button label for the revision. 23868 * 23869 * @param {string|number} id A revision object. 23870 * @param {string} authorDisplayName Author name. 23871 * @param {string} formattedModifiedDate Revision modified date formatted. 23872 * @param {boolean} areStylesEqual Whether the revision matches the current editor styles. 23873 * @return {string} Translated label. 23874 */ 23875 function getRevisionLabel(id, authorDisplayName, formattedModifiedDate, areStylesEqual) { 23876 if ('parent' === id) { 23877 return (0,external_wp_i18n_namespaceObject.__)('Reset the styles to the theme defaults'); 23878 } 23879 if ('unsaved' === id) { 23880 return (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: author display name */ 23881 (0,external_wp_i18n_namespaceObject.__)('Unsaved changes by %s'), authorDisplayName); 23882 } 23883 return areStylesEqual ? (0,external_wp_i18n_namespaceObject.sprintf)( 23884 // translators: 1: author display name. 2: revision creation date. 23885 (0,external_wp_i18n_namespaceObject.__)('Changes saved by %1$s on %2$s. This revision matches current editor styles.'), authorDisplayName, formattedModifiedDate) : (0,external_wp_i18n_namespaceObject.sprintf)( 23886 // translators: 1: author display name. 2: revision creation date. 23887 (0,external_wp_i18n_namespaceObject.__)('Changes saved by %1$s on %2$s'), authorDisplayName, formattedModifiedDate); 23888 } 23889 23890 /** 23891 * Returns a rendered list of revisions buttons. 23892 * 23893 * @typedef {Object} props 23894 * @property {Array<Object>} userRevisions A collection of user revisions. 23895 * @property {number} selectedRevisionId The id of the currently-selected revision. 23896 * @property {Function} onChange Callback fired when a revision is selected. 23897 * 23898 * @param {props} Component props. 23899 * @return {JSX.Element} The modal component. 23900 */ 23901 function RevisionsButtons({ 23902 userRevisions, 23903 selectedRevisionId, 23904 onChange, 23905 canApplyRevision, 23906 onApplyRevision 23907 }) { 23908 const { 23909 currentThemeName, 23910 currentUser 23911 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 23912 const { 23913 getCurrentTheme, 23914 getCurrentUser 23915 } = select(external_wp_coreData_namespaceObject.store); 23916 const currentTheme = getCurrentTheme(); 23917 return { 23918 currentThemeName: currentTheme?.name?.rendered || currentTheme?.stylesheet, 23919 currentUser: getCurrentUser() 23920 }; 23921 }, []); 23922 const dateNowInMs = (0,external_wp_date_namespaceObject.getDate)().getTime(); 23923 const { 23924 datetimeAbbreviated 23925 } = (0,external_wp_date_namespaceObject.getSettings)().formats; 23926 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite, { 23927 orientation: "vertical", 23928 className: "edit-site-global-styles-screen-revisions__revisions-list", 23929 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Global styles revisions list'), 23930 role: "listbox", 23931 children: userRevisions.map((revision, index) => { 23932 const { 23933 id, 23934 author, 23935 modified 23936 } = revision; 23937 const isUnsaved = 'unsaved' === id; 23938 // Unsaved changes are created by the current user. 23939 const revisionAuthor = isUnsaved ? currentUser : author; 23940 const authorDisplayName = revisionAuthor?.name || (0,external_wp_i18n_namespaceObject.__)('User'); 23941 const authorAvatar = revisionAuthor?.avatar_urls?.['48']; 23942 const isFirstItem = index === 0; 23943 const isSelected = selectedRevisionId ? selectedRevisionId === id : isFirstItem; 23944 const areStylesEqual = !canApplyRevision && isSelected; 23945 const isReset = 'parent' === id; 23946 const modifiedDate = (0,external_wp_date_namespaceObject.getDate)(modified); 23947 const displayDate = modified && dateNowInMs - modifiedDate.getTime() > DAY_IN_MILLISECONDS ? (0,external_wp_date_namespaceObject.dateI18n)(datetimeAbbreviated, modifiedDate) : (0,external_wp_date_namespaceObject.humanTimeDiff)(modified); 23948 const revisionLabel = getRevisionLabel(id, authorDisplayName, (0,external_wp_date_namespaceObject.dateI18n)(datetimeAbbreviated, modifiedDate), areStylesEqual); 23949 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Composite.Item, { 23950 className: "edit-site-global-styles-screen-revisions__revision-item", 23951 "aria-current": isSelected, 23952 role: "option", 23953 onKeyDown: event => { 23954 const { 23955 keyCode 23956 } = event; 23957 if (keyCode === external_wp_keycodes_namespaceObject.ENTER || keyCode === external_wp_keycodes_namespaceObject.SPACE) { 23958 onChange(revision); 23959 } 23960 }, 23961 onClick: event => { 23962 event.preventDefault(); 23963 onChange(revision); 23964 }, 23965 "aria-selected": isSelected, 23966 "aria-label": revisionLabel, 23967 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {}), 23968 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 23969 className: "edit-site-global-styles-screen-revisions__revision-item-wrapper", 23970 children: isReset ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { 23971 className: "edit-site-global-styles-screen-revisions__description", 23972 children: [(0,external_wp_i18n_namespaceObject.__)('Default styles'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 23973 className: "edit-site-global-styles-screen-revisions__meta", 23974 children: currentThemeName 23975 })] 23976 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { 23977 className: "edit-site-global-styles-screen-revisions__description", 23978 children: [isUnsaved ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 23979 className: "edit-site-global-styles-screen-revisions__date", 23980 children: (0,external_wp_i18n_namespaceObject.__)('(Unsaved)') 23981 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("time", { 23982 className: "edit-site-global-styles-screen-revisions__date", 23983 dateTime: modified, 23984 children: displayDate 23985 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { 23986 className: "edit-site-global-styles-screen-revisions__meta", 23987 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 23988 alt: authorDisplayName, 23989 src: authorAvatar 23990 }), authorDisplayName] 23991 }), isSelected && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ChangesSummary, { 23992 revision: revision, 23993 previousRevision: index < userRevisions.length ? userRevisions[index + 1] : {} 23994 })] 23995 }) 23996 }), isSelected && (areStylesEqual ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 23997 className: "edit-site-global-styles-screen-revisions__applied-text", 23998 children: (0,external_wp_i18n_namespaceObject.__)('These styles are already applied to your site.') 23999 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 24000 size: "compact", 24001 variant: "primary", 24002 className: "edit-site-global-styles-screen-revisions__apply-button", 24003 onClick: onApplyRevision, 24004 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Apply the selected revision to your site.'), 24005 children: isReset ? (0,external_wp_i18n_namespaceObject.__)('Reset to defaults') : (0,external_wp_i18n_namespaceObject.__)('Apply') 24006 }))] 24007 }, id); 24008 }) 24009 }); 24010 } 24011 /* harmony default export */ const revisions_buttons = (RevisionsButtons); 24012 24013 ;// ./node_modules/@wordpress/edit-site/build-module/components/pagination/index.js 24014 /** 24015 * External dependencies 24016 */ 24017 24018 24019 /** 24020 * WordPress dependencies 24021 */ 24022 24023 24024 24025 24026 function Pagination({ 24027 currentPage, 24028 numPages, 24029 changePage, 24030 totalItems, 24031 className, 24032 disabled = false, 24033 buttonVariant = 'tertiary', 24034 label = (0,external_wp_i18n_namespaceObject.__)('Pagination') 24035 }) { 24036 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 24037 expanded: false, 24038 as: "nav", 24039 "aria-label": label, 24040 spacing: 3, 24041 justify: "flex-start", 24042 className: dist_clsx('edit-site-pagination', className), 24043 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 24044 variant: "muted", 24045 className: "edit-site-pagination__total", 24046 children: 24047 // translators: %s: Total number of patterns. 24048 (0,external_wp_i18n_namespaceObject.sprintf)( 24049 // translators: %s: Total number of patterns. 24050 (0,external_wp_i18n_namespaceObject._n)('%s item', '%s items', totalItems), totalItems) 24051 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 24052 expanded: false, 24053 spacing: 1, 24054 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 24055 variant: buttonVariant, 24056 onClick: () => changePage(1), 24057 accessibleWhenDisabled: true, 24058 disabled: disabled || currentPage === 1, 24059 label: (0,external_wp_i18n_namespaceObject.__)('First page'), 24060 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? library_next : library_previous, 24061 size: "compact" 24062 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 24063 variant: buttonVariant, 24064 onClick: () => changePage(currentPage - 1), 24065 accessibleWhenDisabled: true, 24066 disabled: disabled || currentPage === 1, 24067 label: (0,external_wp_i18n_namespaceObject.__)('Previous page'), 24068 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left, 24069 size: "compact" 24070 })] 24071 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 24072 variant: "muted", 24073 children: (0,external_wp_i18n_namespaceObject.sprintf)( 24074 // translators: 1: Current page number. 2: Total number of pages. 24075 (0,external_wp_i18n_namespaceObject._x)('%1$s of %2$s', 'paging'), currentPage, numPages) 24076 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 24077 expanded: false, 24078 spacing: 1, 24079 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 24080 variant: buttonVariant, 24081 onClick: () => changePage(currentPage + 1), 24082 accessibleWhenDisabled: true, 24083 disabled: disabled || currentPage === numPages, 24084 label: (0,external_wp_i18n_namespaceObject.__)('Next page'), 24085 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right, 24086 size: "compact" 24087 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 24088 variant: buttonVariant, 24089 onClick: () => changePage(numPages), 24090 accessibleWhenDisabled: true, 24091 disabled: disabled || currentPage === numPages, 24092 label: (0,external_wp_i18n_namespaceObject.__)('Last page'), 24093 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? library_previous : library_next, 24094 size: "compact" 24095 })] 24096 })] 24097 }); 24098 } 24099 24100 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-revisions/index.js 24101 /** 24102 * WordPress dependencies 24103 */ 24104 24105 24106 24107 24108 24109 24110 /** 24111 * Internal dependencies 24112 */ 24113 24114 24115 24116 24117 24118 24119 24120 24121 24122 const { 24123 GlobalStylesContext: screen_revisions_GlobalStylesContext, 24124 areGlobalStyleConfigsEqual: screen_revisions_areGlobalStyleConfigsEqual 24125 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 24126 const PAGE_SIZE = 10; 24127 function ScreenRevisions() { 24128 const { 24129 user: currentEditorGlobalStyles, 24130 setUserConfig 24131 } = (0,external_wp_element_namespaceObject.useContext)(screen_revisions_GlobalStylesContext); 24132 const { 24133 blocks, 24134 editorCanvasContainerView 24135 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ 24136 editorCanvasContainerView: unlock(select(store)).getEditorCanvasContainerView(), 24137 blocks: select(external_wp_blockEditor_namespaceObject.store).getBlocks() 24138 }), []); 24139 const [currentPage, setCurrentPage] = (0,external_wp_element_namespaceObject.useState)(1); 24140 const [currentRevisions, setCurrentRevisions] = (0,external_wp_element_namespaceObject.useState)([]); 24141 const { 24142 revisions, 24143 isLoading, 24144 hasUnsavedChanges, 24145 revisionsCount 24146 } = useGlobalStylesRevisions({ 24147 query: { 24148 per_page: PAGE_SIZE, 24149 page: currentPage 24150 } 24151 }); 24152 const numPages = Math.ceil(revisionsCount / PAGE_SIZE); 24153 const [currentlySelectedRevision, setCurrentlySelectedRevision] = (0,external_wp_element_namespaceObject.useState)(currentEditorGlobalStyles); 24154 const [isLoadingRevisionWithUnsavedChanges, setIsLoadingRevisionWithUnsavedChanges] = (0,external_wp_element_namespaceObject.useState)(false); 24155 const { 24156 setEditorCanvasContainerView 24157 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 24158 const selectedRevisionMatchesEditorStyles = screen_revisions_areGlobalStyleConfigsEqual(currentlySelectedRevision, currentEditorGlobalStyles); 24159 24160 // The actual code that triggers the revisions screen to navigate back 24161 // to the home screen in in `packages/edit-site/src/components/global-styles/ui.js`. 24162 const onCloseRevisions = () => { 24163 const canvasContainerView = editorCanvasContainerView === 'global-styles-revisions:style-book' ? 'style-book' : undefined; 24164 setEditorCanvasContainerView(canvasContainerView); 24165 }; 24166 const restoreRevision = revision => { 24167 setUserConfig(() => revision); 24168 setIsLoadingRevisionWithUnsavedChanges(false); 24169 onCloseRevisions(); 24170 }; 24171 (0,external_wp_element_namespaceObject.useEffect)(() => { 24172 if (!isLoading && revisions.length) { 24173 setCurrentRevisions(revisions); 24174 } 24175 }, [revisions, isLoading]); 24176 const firstRevision = revisions[0]; 24177 const currentlySelectedRevisionId = currentlySelectedRevision?.id; 24178 const shouldSelectFirstItem = !!firstRevision?.id && !selectedRevisionMatchesEditorStyles && !currentlySelectedRevisionId; 24179 (0,external_wp_element_namespaceObject.useEffect)(() => { 24180 /* 24181 * Ensure that the first item is selected and loaded into the preview pane 24182 * when no revision is selected and the selected styles don't match the current editor styles. 24183 * This is required in case editor styles are changed outside the revisions panel, 24184 * e.g., via the reset styles function of useGlobalStylesReset(). 24185 * See: https://github.com/WordPress/gutenberg/issues/55866 24186 */ 24187 if (shouldSelectFirstItem) { 24188 setCurrentlySelectedRevision(firstRevision); 24189 } 24190 }, [shouldSelectFirstItem, firstRevision]); 24191 24192 // Only display load button if there is a revision to load, 24193 // and it is different from the current editor styles. 24194 const isLoadButtonEnabled = !!currentlySelectedRevisionId && currentlySelectedRevisionId !== 'unsaved' && !selectedRevisionMatchesEditorStyles; 24195 const hasRevisions = !!currentRevisions.length; 24196 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 24197 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, { 24198 title: revisionsCount && 24199 // translators: %s: number of revisions. 24200 (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Revisions (%s)'), revisionsCount), 24201 description: (0,external_wp_i18n_namespaceObject.__)('Click on previously saved styles to preview them. To restore a selected version to the editor, hit "Apply." When you\'re ready, use the Save button to save your changes.'), 24202 onBack: onCloseRevisions 24203 }), !hasRevisions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, { 24204 className: "edit-site-global-styles-screen-revisions__loading" 24205 }), hasRevisions && (editorCanvasContainerView === 'global-styles-revisions:style-book' ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(style_book, { 24206 userConfig: currentlySelectedRevision, 24207 isSelected: () => {}, 24208 onClose: () => { 24209 setEditorCanvasContainerView('global-styles-revisions'); 24210 } 24211 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(components_revisions, { 24212 blocks: blocks, 24213 userConfig: currentlySelectedRevision, 24214 closeButtonLabel: (0,external_wp_i18n_namespaceObject.__)('Close revisions') 24215 })), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(revisions_buttons, { 24216 onChange: setCurrentlySelectedRevision, 24217 selectedRevisionId: currentlySelectedRevisionId, 24218 userRevisions: currentRevisions, 24219 canApplyRevision: isLoadButtonEnabled, 24220 onApplyRevision: () => hasUnsavedChanges ? setIsLoadingRevisionWithUnsavedChanges(true) : restoreRevision(currentlySelectedRevision) 24221 }), numPages > 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 24222 className: "edit-site-global-styles-screen-revisions__footer", 24223 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Pagination, { 24224 className: "edit-site-global-styles-screen-revisions__pagination", 24225 currentPage: currentPage, 24226 numPages: numPages, 24227 changePage: setCurrentPage, 24228 totalItems: revisionsCount, 24229 disabled: isLoading, 24230 label: (0,external_wp_i18n_namespaceObject.__)('Global Styles pagination') 24231 }) 24232 }), isLoadingRevisionWithUnsavedChanges && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { 24233 isOpen: isLoadingRevisionWithUnsavedChanges, 24234 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Apply'), 24235 onConfirm: () => restoreRevision(currentlySelectedRevision), 24236 onCancel: () => setIsLoadingRevisionWithUnsavedChanges(false), 24237 size: "medium", 24238 children: (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to apply this revision? Any unsaved changes will be lost.') 24239 })] 24240 }); 24241 } 24242 /* harmony default export */ const screen_revisions = (ScreenRevisions); 24243 24244 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/ui.js 24245 /** 24246 * WordPress dependencies 24247 */ 24248 24249 24250 24251 24252 24253 24254 24255 24256 24257 24258 24259 /** 24260 * Internal dependencies 24261 */ 24262 24263 24264 24265 24266 24267 24268 24269 24270 24271 24272 24273 24274 24275 24276 24277 24278 24279 24280 24281 24282 const SLOT_FILL_NAME = 'GlobalStylesMenu'; 24283 const { 24284 useGlobalStylesReset: ui_useGlobalStylesReset 24285 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 24286 const { 24287 Slot: GlobalStylesMenuSlot, 24288 Fill: GlobalStylesMenuFill 24289 } = (0,external_wp_components_namespaceObject.createSlotFill)(SLOT_FILL_NAME); 24290 function GlobalStylesActionMenu() { 24291 const [canReset, onReset] = ui_useGlobalStylesReset(); 24292 const { 24293 toggle 24294 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 24295 const { 24296 canEditCSS 24297 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 24298 const { 24299 getEntityRecord, 24300 __experimentalGetCurrentGlobalStylesId 24301 } = select(external_wp_coreData_namespaceObject.store); 24302 const globalStylesId = __experimentalGetCurrentGlobalStylesId(); 24303 const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined; 24304 return { 24305 canEditCSS: !!globalStyles?._links?.['wp:action-edit-css'] 24306 }; 24307 }, []); 24308 const { 24309 setEditorCanvasContainerView 24310 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 24311 const loadCustomCSS = () => { 24312 setEditorCanvasContainerView('global-styles-css'); 24313 }; 24314 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesMenuFill, { 24315 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { 24316 icon: more_vertical, 24317 label: (0,external_wp_i18n_namespaceObject.__)('More'), 24318 toggleProps: { 24319 size: 'compact' 24320 }, 24321 children: ({ 24322 onClose 24323 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 24324 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { 24325 children: [canEditCSS && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 24326 onClick: loadCustomCSS, 24327 children: (0,external_wp_i18n_namespaceObject.__)('Additional CSS') 24328 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 24329 onClick: () => { 24330 toggle('core/edit-site', 'welcomeGuideStyles'); 24331 onClose(); 24332 }, 24333 children: (0,external_wp_i18n_namespaceObject.__)('Welcome Guide') 24334 })] 24335 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { 24336 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 24337 onClick: () => { 24338 onReset(); 24339 onClose(); 24340 }, 24341 disabled: !canReset, 24342 children: (0,external_wp_i18n_namespaceObject.__)('Reset styles') 24343 }) 24344 })] 24345 }) 24346 }) 24347 }); 24348 } 24349 function GlobalStylesNavigationScreen({ 24350 className, 24351 ...props 24352 }) { 24353 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Navigator.Screen, { 24354 className: ['edit-site-global-styles-sidebar__navigator-screen', className].filter(Boolean).join(' '), 24355 ...props 24356 }); 24357 } 24358 function BlockStylesNavigationScreens({ 24359 parentMenu, 24360 blockStyles, 24361 blockName 24362 }) { 24363 return blockStyles.map((style, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 24364 path: parentMenu + '/variations/' + style.name, 24365 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_block, { 24366 name: blockName, 24367 variation: style.name 24368 }) 24369 }, index)); 24370 } 24371 function ContextScreens({ 24372 name, 24373 parentMenu = '' 24374 }) { 24375 const blockStyleVariations = (0,external_wp_data_namespaceObject.useSelect)(select => { 24376 const { 24377 getBlockStyles 24378 } = select(external_wp_blocks_namespaceObject.store); 24379 return getBlockStyles(name); 24380 }, [name]); 24381 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 24382 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 24383 path: parentMenu + '/colors/palette', 24384 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette, { 24385 name: name 24386 }) 24387 }), !!blockStyleVariations?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockStylesNavigationScreens, { 24388 parentMenu: parentMenu, 24389 blockStyles: blockStyleVariations, 24390 blockName: name 24391 })] 24392 }); 24393 } 24394 function GlobalStylesStyleBook() { 24395 const navigator = (0,external_wp_components_namespaceObject.useNavigator)(); 24396 const { 24397 path 24398 } = navigator.location; 24399 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(style_book, { 24400 isSelected: blockName => 24401 // Match '/blocks/core%2Fbutton' and 24402 // '/blocks/core%2Fbutton/typography', but not 24403 // '/blocks/core%2Fbuttons'. 24404 path === `/blocks/$encodeURIComponent(blockName)}` || path.startsWith(`/blocks/$encodeURIComponent(blockName)}/`), 24405 onSelect: blockName => { 24406 if (STYLE_BOOK_COLOR_GROUPS.find(group => group.slug === blockName)) { 24407 // Go to color palettes Global Styles. 24408 navigator.goTo('/colors/palette'); 24409 return; 24410 } 24411 if (blockName === 'typography') { 24412 // Go to typography Global Styles. 24413 navigator.goTo('/typography'); 24414 return; 24415 } 24416 24417 // Now go to the selected block. 24418 navigator.goTo('/blocks/' + encodeURIComponent(blockName)); 24419 } 24420 }); 24421 } 24422 function GlobalStylesBlockLink() { 24423 const navigator = (0,external_wp_components_namespaceObject.useNavigator)(); 24424 const { 24425 selectedBlockName, 24426 selectedBlockClientId 24427 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 24428 const { 24429 getSelectedBlockClientId, 24430 getBlockName 24431 } = select(external_wp_blockEditor_namespaceObject.store); 24432 const clientId = getSelectedBlockClientId(); 24433 return { 24434 selectedBlockName: getBlockName(clientId), 24435 selectedBlockClientId: clientId 24436 }; 24437 }, []); 24438 const blockHasGlobalStyles = useBlockHasGlobalStyles(selectedBlockName); 24439 // When we're in the `Blocks` screen enable deep linking to the selected block. 24440 (0,external_wp_element_namespaceObject.useEffect)(() => { 24441 if (!selectedBlockClientId || !blockHasGlobalStyles) { 24442 return; 24443 } 24444 const currentPath = navigator.location.path; 24445 if (currentPath !== '/blocks' && !currentPath.startsWith('/blocks/')) { 24446 return; 24447 } 24448 const newPath = '/blocks/' + encodeURIComponent(selectedBlockName); 24449 // Avoid navigating to the same path. This can happen when selecting 24450 // a new block of the same type. 24451 if (newPath !== currentPath) { 24452 navigator.goTo(newPath, { 24453 skipFocus: true 24454 }); 24455 } 24456 }, [selectedBlockClientId, selectedBlockName, blockHasGlobalStyles]); 24457 } 24458 function GlobalStylesEditorCanvasContainerLink() { 24459 const { 24460 goTo, 24461 location 24462 } = (0,external_wp_components_namespaceObject.useNavigator)(); 24463 const editorCanvasContainerView = (0,external_wp_data_namespaceObject.useSelect)(select => unlock(select(store)).getEditorCanvasContainerView(), []); 24464 const path = location?.path; 24465 const isRevisionsOpen = path === '/revisions'; 24466 24467 // If the user switches the editor canvas container view, redirect 24468 // to the appropriate screen. This effectively allows deep linking to the 24469 // desired screens from outside the global styles navigation provider. 24470 (0,external_wp_element_namespaceObject.useEffect)(() => { 24471 switch (editorCanvasContainerView) { 24472 case 'global-styles-revisions': 24473 case 'global-styles-revisions:style-book': 24474 if (!isRevisionsOpen) { 24475 goTo('/revisions'); 24476 } 24477 break; 24478 case 'global-styles-css': 24479 goTo('/css'); 24480 break; 24481 // The stand-alone style book is open 24482 // and the revisions panel is open, 24483 // close the revisions panel. 24484 // Otherwise keep the style book open while 24485 // browsing global styles panel. 24486 // 24487 // Falling through as it matches the default scenario. 24488 case 'style-book': 24489 default: 24490 // In general, if the revision screen is in view but the 24491 // `editorCanvasContainerView` is not a revision view, close it. 24492 // This also includes the scenario when the stand-alone style 24493 // book is open, in which case we want the user to close the 24494 // revisions screen and browse global styles. 24495 if (isRevisionsOpen) { 24496 goTo('/', { 24497 isBack: true 24498 }); 24499 } 24500 break; 24501 } 24502 }, [editorCanvasContainerView, isRevisionsOpen, goTo]); 24503 } 24504 function useNavigatorSync(parentPath, onPathChange) { 24505 const navigator = (0,external_wp_components_namespaceObject.useNavigator)(); 24506 const { 24507 path: childPath 24508 } = navigator.location; 24509 const previousParentPath = (0,external_wp_compose_namespaceObject.usePrevious)(parentPath); 24510 const previousChildPath = (0,external_wp_compose_namespaceObject.usePrevious)(childPath); 24511 (0,external_wp_element_namespaceObject.useEffect)(() => { 24512 if (parentPath !== childPath) { 24513 if (parentPath !== previousParentPath) { 24514 navigator.goTo(parentPath); 24515 } else if (childPath !== previousChildPath) { 24516 onPathChange(childPath); 24517 } 24518 } 24519 }, [onPathChange, parentPath, previousChildPath, previousParentPath, childPath, navigator]); 24520 } 24521 24522 // This component is used to wrap the hook in order to conditionally execute it 24523 // when the parent component is used on controlled mode. 24524 function NavigationSync({ 24525 path: parentPath, 24526 onPathChange, 24527 children 24528 }) { 24529 useNavigatorSync(parentPath, onPathChange); 24530 return children; 24531 } 24532 function GlobalStylesUI({ 24533 path, 24534 onPathChange 24535 }) { 24536 const blocks = (0,external_wp_blocks_namespaceObject.getBlockTypes)(); 24537 const editorCanvasContainerView = (0,external_wp_data_namespaceObject.useSelect)(select => unlock(select(store)).getEditorCanvasContainerView(), []); 24538 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Navigator, { 24539 className: "edit-site-global-styles-sidebar__navigator-provider", 24540 initialPath: "/", 24541 children: [path && onPathChange && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationSync, { 24542 path: path, 24543 onPathChange: onPathChange 24544 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 24545 path: "/", 24546 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_root, {}) 24547 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 24548 path: "/variations", 24549 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_style_variations, {}) 24550 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 24551 path: "/blocks", 24552 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_block_list, {}) 24553 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 24554 path: "/typography", 24555 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography, {}) 24556 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 24557 path: "/typography/font-sizes", 24558 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_sizes, {}) 24559 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 24560 path: "/typography/font-sizes/:origin/:slug", 24561 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(font_size, {}) 24562 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 24563 path: "/typography/text", 24564 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element, { 24565 element: "text" 24566 }) 24567 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 24568 path: "/typography/link", 24569 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element, { 24570 element: "link" 24571 }) 24572 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 24573 path: "/typography/heading", 24574 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element, { 24575 element: "heading" 24576 }) 24577 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 24578 path: "/typography/caption", 24579 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element, { 24580 element: "caption" 24581 }) 24582 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 24583 path: "/typography/button", 24584 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element, { 24585 element: "button" 24586 }) 24587 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 24588 path: "/colors", 24589 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_colors, {}) 24590 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 24591 path: "/shadows", 24592 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ScreenShadows, {}) 24593 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 24594 path: "/shadows/edit/:category/:slug", 24595 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ScreenShadowsEdit, {}) 24596 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 24597 path: "/layout", 24598 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_layout, {}) 24599 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 24600 path: "/css", 24601 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_css, {}) 24602 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 24603 path: "/revisions", 24604 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_revisions, {}) 24605 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 24606 path: "/background", 24607 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_background, {}) 24608 }), blocks.map(block => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { 24609 path: '/blocks/' + encodeURIComponent(block.name), 24610 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_block, { 24611 name: block.name 24612 }) 24613 }, 'menu-block-' + block.name)), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ContextScreens, {}), blocks.map(block => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ContextScreens, { 24614 name: block.name, 24615 parentMenu: '/blocks/' + encodeURIComponent(block.name) 24616 }, 'screens-block-' + block.name)), 'style-book' === editorCanvasContainerView && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesStyleBook, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesActionMenu, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesBlockLink, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesEditorCanvasContainerLink, {})] 24617 }); 24618 } 24619 24620 /* harmony default export */ const global_styles_ui = (GlobalStylesUI); 24621 24622 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/index.js 24623 24624 24625 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles-sidebar/default-sidebar.js 24626 /** 24627 * WordPress dependencies 24628 */ 24629 24630 24631 /** 24632 * Internal dependencies 24633 */ 24634 24635 24636 const { 24637 ComplementaryArea, 24638 ComplementaryAreaMoreMenuItem 24639 } = unlock(external_wp_editor_namespaceObject.privateApis); 24640 function DefaultSidebar({ 24641 className, 24642 identifier, 24643 title, 24644 icon, 24645 children, 24646 closeLabel, 24647 header, 24648 headerClassName, 24649 panelClassName, 24650 isActiveByDefault 24651 }) { 24652 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 24653 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComplementaryArea, { 24654 className: className, 24655 scope: "core", 24656 identifier: identifier, 24657 title: title, 24658 icon: icon, 24659 closeLabel: closeLabel, 24660 header: header, 24661 headerClassName: headerClassName, 24662 panelClassName: panelClassName, 24663 isActiveByDefault: isActiveByDefault, 24664 children: children 24665 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComplementaryAreaMoreMenuItem, { 24666 scope: "core", 24667 identifier: identifier, 24668 icon: icon, 24669 children: title 24670 })] 24671 }); 24672 } 24673 24674 ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles-sidebar/index.js 24675 /** 24676 * WordPress dependencies 24677 */ 24678 24679 24680 24681 24682 24683 24684 24685 24686 24687 24688 /** 24689 * Internal dependencies 24690 */ 24691 24692 24693 24694 24695 24696 24697 24698 const { 24699 interfaceStore: global_styles_sidebar_interfaceStore 24700 } = unlock(external_wp_editor_namespaceObject.privateApis); 24701 const { 24702 useLocation: global_styles_sidebar_useLocation 24703 } = unlock(external_wp_router_namespaceObject.privateApis); 24704 function GlobalStylesSidebar() { 24705 const { 24706 query 24707 } = global_styles_sidebar_useLocation(); 24708 const { 24709 canvas = 'view', 24710 name 24711 } = query; 24712 const { 24713 shouldClearCanvasContainerView, 24714 isStyleBookOpened, 24715 showListViewByDefault, 24716 hasRevisions, 24717 isRevisionsOpened, 24718 isRevisionsStyleBookOpened 24719 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 24720 const { 24721 getActiveComplementaryArea 24722 } = select(global_styles_sidebar_interfaceStore); 24723 const { 24724 getEditorCanvasContainerView 24725 } = unlock(select(store)); 24726 const canvasContainerView = getEditorCanvasContainerView(); 24727 const _isVisualEditorMode = 'visual' === select(external_wp_editor_namespaceObject.store).getEditorMode(); 24728 const _isEditCanvasMode = 'edit' === canvas; 24729 const _showListViewByDefault = select(external_wp_preferences_namespaceObject.store).get('core', 'showListViewByDefault'); 24730 const { 24731 getEntityRecord, 24732 __experimentalGetCurrentGlobalStylesId 24733 } = select(external_wp_coreData_namespaceObject.store); 24734 const globalStylesId = __experimentalGetCurrentGlobalStylesId(); 24735 const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined; 24736 return { 24737 isStyleBookOpened: 'style-book' === canvasContainerView, 24738 shouldClearCanvasContainerView: 'edit-site/global-styles' !== getActiveComplementaryArea('core') || !_isVisualEditorMode || !_isEditCanvasMode, 24739 showListViewByDefault: _showListViewByDefault, 24740 hasRevisions: !!globalStyles?._links?.['version-history']?.[0]?.count, 24741 isRevisionsStyleBookOpened: 'global-styles-revisions:style-book' === canvasContainerView, 24742 isRevisionsOpened: 'global-styles-revisions' === canvasContainerView 24743 }; 24744 }, [canvas]); 24745 const { 24746 setEditorCanvasContainerView 24747 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 24748 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); 24749 (0,external_wp_element_namespaceObject.useEffect)(() => { 24750 if (shouldClearCanvasContainerView) { 24751 setEditorCanvasContainerView(undefined); 24752 } 24753 }, [shouldClearCanvasContainerView, setEditorCanvasContainerView]); 24754 const { 24755 setIsListViewOpened 24756 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); 24757 const toggleRevisions = () => { 24758 setIsListViewOpened(false); 24759 if (isRevisionsStyleBookOpened) { 24760 setEditorCanvasContainerView('style-book'); 24761 return; 24762 } 24763 if (isRevisionsOpened) { 24764 setEditorCanvasContainerView(undefined); 24765 return; 24766 } 24767 if (isStyleBookOpened) { 24768 setEditorCanvasContainerView('global-styles-revisions:style-book'); 24769 } else { 24770 setEditorCanvasContainerView('global-styles-revisions'); 24771 } 24772 }; 24773 const toggleStyleBook = () => { 24774 if (isRevisionsOpened) { 24775 setEditorCanvasContainerView('global-styles-revisions:style-book'); 24776 return; 24777 } 24778 if (isRevisionsStyleBookOpened) { 24779 setEditorCanvasContainerView('global-styles-revisions'); 24780 return; 24781 } 24782 setIsListViewOpened(isStyleBookOpened && showListViewByDefault); 24783 setEditorCanvasContainerView(isStyleBookOpened ? undefined : 'style-book'); 24784 }; 24785 const { 24786 getActiveComplementaryArea 24787 } = (0,external_wp_data_namespaceObject.useSelect)(global_styles_sidebar_interfaceStore); 24788 const { 24789 enableComplementaryArea 24790 } = (0,external_wp_data_namespaceObject.useDispatch)(global_styles_sidebar_interfaceStore); 24791 const previousActiveAreaRef = (0,external_wp_element_namespaceObject.useRef)(null); 24792 (0,external_wp_element_namespaceObject.useEffect)(() => { 24793 if (name === 'styles' && canvas === 'edit') { 24794 previousActiveAreaRef.current = getActiveComplementaryArea('core'); 24795 enableComplementaryArea('core', 'edit-site/global-styles'); 24796 } else if (previousActiveAreaRef.current) { 24797 enableComplementaryArea('core', previousActiveAreaRef.current); 24798 } 24799 }, [name, enableComplementaryArea, canvas, getActiveComplementaryArea]); 24800 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DefaultSidebar, { 24801 className: "edit-site-global-styles-sidebar", 24802 identifier: "edit-site/global-styles", 24803 title: (0,external_wp_i18n_namespaceObject.__)('Styles'), 24804 icon: library_styles, 24805 closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close Styles'), 24806 panelClassName: "edit-site-global-styles-sidebar__panel", 24807 header: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 24808 className: "edit-site-global-styles-sidebar__header", 24809 gap: 1, 24810 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 24811 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { 24812 className: "edit-site-global-styles-sidebar__header-title", 24813 children: (0,external_wp_i18n_namespaceObject.__)('Styles') 24814 }) 24815 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 24816 justify: "flex-end", 24817 gap: 1, 24818 className: "edit-site-global-styles-sidebar__header-actions", 24819 children: [!isMobileViewport && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 24820 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 24821 icon: library_seen, 24822 label: (0,external_wp_i18n_namespaceObject.__)('Style Book'), 24823 isPressed: isStyleBookOpened || isRevisionsStyleBookOpened, 24824 accessibleWhenDisabled: true, 24825 disabled: shouldClearCanvasContainerView, 24826 onClick: toggleStyleBook, 24827 size: "compact" 24828 }) 24829 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 24830 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 24831 label: (0,external_wp_i18n_namespaceObject.__)('Revisions'), 24832 icon: library_backup, 24833 onClick: toggleRevisions, 24834 accessibleWhenDisabled: true, 24835 disabled: !hasRevisions, 24836 isPressed: isRevisionsOpened || isRevisionsStyleBookOpened, 24837 size: "compact" 24838 }) 24839 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesMenuSlot, {})] 24840 })] 24841 }), 24842 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(global_styles_ui, {}) 24843 }); 24844 } 24845 24846 ;// ./node_modules/@wordpress/icons/build-module/library/download.js 24847 /** 24848 * WordPress dependencies 24849 */ 24850 24851 24852 const download = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 24853 xmlns: "http://www.w3.org/2000/svg", 24854 viewBox: "0 0 24 24", 24855 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 24856 d: "M18 11.3l-1-1.1-4 4V3h-1.5v11.3L7 10.2l-1 1.1 6.2 5.8 5.8-5.8zm.5 3.7v3.5h-13V15H4v5h16v-5h-1.5z" 24857 }) 24858 }); 24859 /* harmony default export */ const library_download = (download); 24860 24861 ;// external ["wp","blob"] 24862 const external_wp_blob_namespaceObject = window["wp"]["blob"]; 24863 ;// ./node_modules/@wordpress/edit-site/build-module/components/more-menu/site-export.js 24864 /** 24865 * WordPress dependencies 24866 */ 24867 24868 24869 24870 24871 24872 24873 24874 24875 function SiteExport() { 24876 const { 24877 createErrorNotice 24878 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 24879 async function handleExport() { 24880 try { 24881 const response = await external_wp_apiFetch_default()({ 24882 path: '/wp-block-editor/v1/export', 24883 parse: false, 24884 headers: { 24885 Accept: 'application/zip' 24886 } 24887 }); 24888 const blob = await response.blob(); 24889 const contentDisposition = response.headers.get('content-disposition'); 24890 const contentDispositionMatches = contentDisposition.match(/=(.+)\.zip/); 24891 const fileName = contentDispositionMatches[1] ? contentDispositionMatches[1] : 'edit-site-export'; 24892 (0,external_wp_blob_namespaceObject.downloadBlob)(fileName + '.zip', blob, 'application/zip'); 24893 } catch (errorResponse) { 24894 let error = {}; 24895 try { 24896 error = await errorResponse.json(); 24897 } catch (e) {} 24898 const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the site export.'); 24899 createErrorNotice(errorMessage, { 24900 type: 'snackbar' 24901 }); 24902 } 24903 } 24904 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 24905 role: "menuitem", 24906 icon: library_download, 24907 onClick: handleExport, 24908 info: (0,external_wp_i18n_namespaceObject.__)('Download your theme with updated templates and styles.'), 24909 children: (0,external_wp_i18n_namespaceObject._x)('Export', 'site exporter menu item') 24910 }); 24911 } 24912 24913 ;// ./node_modules/@wordpress/edit-site/build-module/components/more-menu/welcome-guide-menu-item.js 24914 /** 24915 * WordPress dependencies 24916 */ 24917 24918 24919 24920 24921 24922 function WelcomeGuideMenuItem() { 24923 const { 24924 toggle 24925 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 24926 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 24927 onClick: () => toggle('core/edit-site', 'welcomeGuide'), 24928 children: (0,external_wp_i18n_namespaceObject.__)('Welcome Guide') 24929 }); 24930 } 24931 24932 ;// ./node_modules/@wordpress/edit-site/build-module/components/more-menu/index.js 24933 /** 24934 * WordPress dependencies 24935 */ 24936 24937 24938 24939 24940 /** 24941 * Internal dependencies 24942 */ 24943 24944 24945 24946 24947 const { 24948 ToolsMoreMenuGroup, 24949 PreferencesModal 24950 } = unlock(external_wp_editor_namespaceObject.privateApis); 24951 function MoreMenu() { 24952 const isBlockBasedTheme = (0,external_wp_data_namespaceObject.useSelect)(select => { 24953 return select(external_wp_coreData_namespaceObject.store).getCurrentTheme().is_block_theme; 24954 }, []); 24955 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 24956 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ToolsMoreMenuGroup, { 24957 children: [isBlockBasedTheme && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SiteExport, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideMenuItem, {})] 24958 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModal, {})] 24959 }); 24960 } 24961 24962 ;// ./node_modules/@wordpress/edit-site/build-module/components/block-editor/use-editor-iframe-props.js 24963 /** 24964 * External dependencies 24965 */ 24966 24967 24968 /** 24969 * WordPress dependencies 24970 */ 24971 24972 24973 24974 24975 24976 24977 24978 24979 /** 24980 * Internal dependencies 24981 */ 24982 24983 const { 24984 useLocation: use_editor_iframe_props_useLocation, 24985 useHistory: use_editor_iframe_props_useHistory 24986 } = unlock(external_wp_router_namespaceObject.privateApis); 24987 function useEditorIframeProps() { 24988 const { 24989 query, 24990 path 24991 } = use_editor_iframe_props_useLocation(); 24992 const history = use_editor_iframe_props_useHistory(); 24993 const { 24994 canvas = 'view' 24995 } = query; 24996 const currentPostIsTrashed = (0,external_wp_data_namespaceObject.useSelect)(select => { 24997 return select(external_wp_editor_namespaceObject.store).getCurrentPostAttribute('status') === 'trash'; 24998 }, []); 24999 const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false); 25000 (0,external_wp_element_namespaceObject.useEffect)(() => { 25001 if (canvas === 'edit') { 25002 setIsFocused(false); 25003 } 25004 }, [canvas]); 25005 25006 // In view mode, make the canvas iframe be perceived and behave as a button 25007 // to switch to edit mode, with a meaningful label and no title attribute. 25008 const viewModeIframeProps = { 25009 'aria-label': (0,external_wp_i18n_namespaceObject.__)('Edit'), 25010 'aria-disabled': currentPostIsTrashed, 25011 title: null, 25012 role: 'button', 25013 tabIndex: 0, 25014 onFocus: () => setIsFocused(true), 25015 onBlur: () => setIsFocused(false), 25016 onKeyDown: event => { 25017 const { 25018 keyCode 25019 } = event; 25020 if ((keyCode === external_wp_keycodes_namespaceObject.ENTER || keyCode === external_wp_keycodes_namespaceObject.SPACE) && !currentPostIsTrashed) { 25021 event.preventDefault(); 25022 history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { 25023 canvas: 'edit' 25024 }), { 25025 transition: 'canvas-mode-edit-transition' 25026 }); 25027 } 25028 }, 25029 onClick: () => history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { 25030 canvas: 'edit' 25031 }), { 25032 transition: 'canvas-mode-edit-transition' 25033 }), 25034 onClickCapture: event => { 25035 if (currentPostIsTrashed) { 25036 event.preventDefault(); 25037 event.stopPropagation(); 25038 } 25039 }, 25040 readonly: true 25041 }; 25042 return { 25043 className: dist_clsx('edit-site-visual-editor__editor-canvas', { 25044 'is-focused': isFocused && canvas === 'view' 25045 }), 25046 ...(canvas === 'view' ? viewModeIframeProps : {}) 25047 }; 25048 } 25049 25050 ;// ./node_modules/@wordpress/edit-site/build-module/components/routes/use-title.js 25051 /** 25052 * WordPress dependencies 25053 */ 25054 25055 25056 25057 25058 25059 25060 25061 25062 /** 25063 * Internal dependencies 25064 */ 25065 25066 const { 25067 useLocation: use_title_useLocation 25068 } = unlock(external_wp_router_namespaceObject.privateApis); 25069 function useTitle(title) { 25070 const location = use_title_useLocation(); 25071 const siteTitle = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', 'site')?.title, []); 25072 const isInitialLocationRef = (0,external_wp_element_namespaceObject.useRef)(true); 25073 (0,external_wp_element_namespaceObject.useEffect)(() => { 25074 isInitialLocationRef.current = false; 25075 }, [location]); 25076 (0,external_wp_element_namespaceObject.useEffect)(() => { 25077 // Don't update or announce the title for initial page load. 25078 if (isInitialLocationRef.current) { 25079 return; 25080 } 25081 if (title && siteTitle) { 25082 // @see https://github.com/WordPress/wordpress-develop/blob/94849898192d271d533e09756007e176feb80697/src/wp-admin/admin-header.php#L67-L68 25083 const formattedTitle = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: Admin document title. 1: Admin screen name, 2: Network or site name. */ 25084 (0,external_wp_i18n_namespaceObject.__)('%1$s ‹ %2$s ‹ Editor — WordPress'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle)); 25085 document.title = formattedTitle; 25086 25087 // Announce title on route change for screen readers. 25088 (0,external_wp_a11y_namespaceObject.speak)(title, 'assertive'); 25089 } 25090 }, [title, siteTitle, location]); 25091 } 25092 25093 ;// ./node_modules/@wordpress/edit-site/build-module/components/editor/use-editor-title.js 25094 /** 25095 * WordPress dependencies 25096 */ 25097 25098 25099 25100 25101 25102 25103 /** 25104 * Internal dependencies 25105 */ 25106 25107 25108 25109 const { 25110 getTemplateInfo 25111 } = unlock(external_wp_editor_namespaceObject.privateApis); 25112 function useEditorTitle(postType, postId) { 25113 const { 25114 title, 25115 isLoaded 25116 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 25117 var _getCurrentTheme; 25118 const { 25119 getEditedEntityRecord, 25120 getCurrentTheme, 25121 hasFinishedResolution 25122 } = select(external_wp_coreData_namespaceObject.store); 25123 if (!postId) { 25124 return { 25125 isLoaded: false 25126 }; 25127 } 25128 const _record = getEditedEntityRecord('postType', postType, postId); 25129 const { 25130 default_template_types: templateTypes = [] 25131 } = (_getCurrentTheme = getCurrentTheme()) !== null && _getCurrentTheme !== void 0 ? _getCurrentTheme : {}; 25132 const templateInfo = getTemplateInfo({ 25133 template: _record, 25134 templateTypes 25135 }); 25136 const _isLoaded = hasFinishedResolution('getEditedEntityRecord', ['postType', postType, postId]); 25137 return { 25138 title: templateInfo.title, 25139 isLoaded: _isLoaded 25140 }; 25141 }, [postType, postId]); 25142 let editorTitle; 25143 if (isLoaded) { 25144 var _POST_TYPE_LABELS$pos; 25145 editorTitle = (0,external_wp_i18n_namespaceObject.sprintf)( 25146 // translators: A breadcrumb trail for the Admin document title. 1: title of template being edited, 2: type of template (Template or Template Part). 25147 (0,external_wp_i18n_namespaceObject._x)('%1$s ‹ %2$s', 'breadcrumb trail'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title), (_POST_TYPE_LABELS$pos = POST_TYPE_LABELS[postType]) !== null && _POST_TYPE_LABELS$pos !== void 0 ? _POST_TYPE_LABELS$pos : POST_TYPE_LABELS[TEMPLATE_POST_TYPE]); 25148 } 25149 25150 // Only announce the title once the editor is ready to prevent "Replace" 25151 // action in <URLQueryController> from double-announcing. 25152 useTitle(isLoaded && editorTitle); 25153 } 25154 /* harmony default export */ const use_editor_title = (useEditorTitle); 25155 25156 ;// ./node_modules/@wordpress/edit-site/build-module/components/editor/use-adapt-editor-to-canvas.js 25157 /** 25158 * WordPress dependencies 25159 */ 25160 25161 25162 25163 25164 25165 function useAdaptEditorToCanvas(canvas) { 25166 const { 25167 clearSelectedBlock 25168 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 25169 const { 25170 setDeviceType, 25171 closePublishSidebar, 25172 setIsListViewOpened, 25173 setIsInserterOpened 25174 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); 25175 const { 25176 get: getPreference 25177 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_preferences_namespaceObject.store); 25178 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 25179 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { 25180 const isMediumOrBigger = window.matchMedia('(min-width: 782px)').matches; 25181 registry.batch(() => { 25182 clearSelectedBlock(); 25183 setDeviceType('Desktop'); 25184 closePublishSidebar(); 25185 setIsInserterOpened(false); 25186 25187 // Check if the block list view should be open by default. 25188 // If `distractionFree` mode is enabled, the block list view should not be open. 25189 // This behavior is disabled for small viewports. 25190 if (isMediumOrBigger && canvas === 'edit' && getPreference('core', 'showListViewByDefault') && !getPreference('core', 'distractionFree')) { 25191 setIsListViewOpened(true); 25192 } else { 25193 setIsListViewOpened(false); 25194 } 25195 }); 25196 }, [canvas, registry, clearSelectedBlock, setDeviceType, closePublishSidebar, setIsInserterOpened, setIsListViewOpened, getPreference]); 25197 } 25198 25199 ;// ./node_modules/@wordpress/edit-site/build-module/components/editor/use-resolve-edited-entity.js 25200 /** 25201 * WordPress dependencies 25202 */ 25203 25204 25205 25206 25207 25208 /** 25209 * Internal dependencies 25210 */ 25211 25212 25213 25214 const { 25215 useLocation: use_resolve_edited_entity_useLocation 25216 } = unlock(external_wp_router_namespaceObject.privateApis); 25217 const postTypesWithoutParentTemplate = [TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE, NAVIGATION_POST_TYPE, PATTERN_TYPES.user]; 25218 const authorizedPostTypes = ['page', 'post']; 25219 function useResolveEditedEntity() { 25220 const { 25221 name, 25222 params = {}, 25223 query 25224 } = use_resolve_edited_entity_useLocation(); 25225 const { 25226 postId = query?.postId 25227 } = params; // Fallback to query param for postId for list view routes. 25228 let postType; 25229 if (name === 'navigation-item') { 25230 postType = NAVIGATION_POST_TYPE; 25231 } else if (name === 'pattern-item') { 25232 postType = PATTERN_TYPES.user; 25233 } else if (name === 'template-part-item') { 25234 postType = TEMPLATE_PART_POST_TYPE; 25235 } else if (name === 'template-item' || name === 'templates') { 25236 postType = TEMPLATE_POST_TYPE; 25237 } else if (name === 'page-item' || name === 'pages') { 25238 postType = 'page'; 25239 } else if (name === 'post-item' || name === 'posts') { 25240 postType = 'post'; 25241 } 25242 const homePage = (0,external_wp_data_namespaceObject.useSelect)(select => { 25243 const { 25244 getHomePage 25245 } = unlock(select(external_wp_coreData_namespaceObject.store)); 25246 return getHomePage(); 25247 }, []); 25248 25249 /** 25250 * This is a hook that recreates the logic to resolve a template for a given WordPress postID postTypeId 25251 * in order to match the frontend as closely as possible in the site editor. 25252 * 25253 * It is not possible to rely on the server logic because there maybe unsaved changes that impact the template resolution. 25254 */ 25255 const resolvedTemplateId = (0,external_wp_data_namespaceObject.useSelect)(select => { 25256 // If we're rendering a post type that doesn't have a template 25257 // no need to resolve its template. 25258 if (postTypesWithoutParentTemplate.includes(postType) && postId) { 25259 return; 25260 } 25261 25262 // Don't trigger resolution for multi-selected posts. 25263 if (postId && postId.includes(',')) { 25264 return; 25265 } 25266 const { 25267 getTemplateId 25268 } = unlock(select(external_wp_coreData_namespaceObject.store)); 25269 25270 // If we're rendering a specific page, we need to resolve its template. 25271 // The site editor only supports pages for now, not other CPTs. 25272 if (postType && postId && authorizedPostTypes.includes(postType)) { 25273 return getTemplateId(postType, postId); 25274 } 25275 25276 // If we're rendering the home page, and we have a static home page, resolve its template. 25277 if (homePage?.postType === 'page') { 25278 return getTemplateId('page', homePage?.postId); 25279 } 25280 if (homePage?.postType === 'wp_template') { 25281 return homePage?.postId; 25282 } 25283 }, [homePage, postId, postType]); 25284 const context = (0,external_wp_element_namespaceObject.useMemo)(() => { 25285 if (postTypesWithoutParentTemplate.includes(postType) && postId) { 25286 return {}; 25287 } 25288 if (postType && postId && authorizedPostTypes.includes(postType)) { 25289 return { 25290 postType, 25291 postId 25292 }; 25293 } 25294 // TODO: for post types lists we should probably not render the front page, but maybe a placeholder 25295 // with a message like "Select a page" or something similar. 25296 if (homePage?.postType === 'page') { 25297 return { 25298 postType: 'page', 25299 postId: homePage?.postId 25300 }; 25301 } 25302 return {}; 25303 }, [homePage, postType, postId]); 25304 if (postTypesWithoutParentTemplate.includes(postType) && postId) { 25305 return { 25306 isReady: true, 25307 postType, 25308 postId, 25309 context 25310 }; 25311 } 25312 if (!!homePage) { 25313 return { 25314 isReady: resolvedTemplateId !== undefined, 25315 postType: TEMPLATE_POST_TYPE, 25316 postId: resolvedTemplateId, 25317 context 25318 }; 25319 } 25320 return { 25321 isReady: false 25322 }; 25323 } 25324 function useSyncDeprecatedEntityIntoState({ 25325 postType, 25326 postId, 25327 context, 25328 isReady 25329 }) { 25330 const { 25331 setEditedEntity 25332 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 25333 (0,external_wp_element_namespaceObject.useEffect)(() => { 25334 if (isReady) { 25335 setEditedEntity(postType, postId, context); 25336 } 25337 }, [isReady, postType, postId, context, setEditedEntity]); 25338 } 25339 25340 ;// ./node_modules/@wordpress/edit-site/build-module/components/editor/site-preview.js 25341 /** 25342 * WordPress dependencies 25343 */ 25344 25345 25346 25347 25348 25349 25350 function SitePreview() { 25351 const siteUrl = (0,external_wp_data_namespaceObject.useSelect)(select => { 25352 const { 25353 getEntityRecord 25354 } = select(external_wp_coreData_namespaceObject.store); 25355 const siteData = getEntityRecord('root', '__unstableBase'); 25356 return siteData?.home; 25357 }, []); 25358 25359 // If theme is block based, return the Editor, otherwise return the site preview. 25360 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("iframe", { 25361 src: (0,external_wp_url_namespaceObject.addQueryArgs)(siteUrl, { 25362 // Parameter for hiding the admin bar. 25363 wp_site_preview: 1 25364 }), 25365 title: (0,external_wp_i18n_namespaceObject.__)('Site Preview'), 25366 style: { 25367 display: 'block', 25368 width: '100%', 25369 height: '100%', 25370 backgroundColor: '#fff' 25371 }, 25372 onLoad: event => { 25373 // Make interactive elements unclickable. 25374 const document = event.target.contentDocument; 25375 const focusableElements = external_wp_dom_namespaceObject.focus.focusable.find(document); 25376 focusableElements.forEach(element => { 25377 element.style.pointerEvents = 'none'; 25378 element.tabIndex = -1; 25379 element.setAttribute('aria-hidden', 'true'); 25380 }); 25381 } 25382 }); 25383 } 25384 25385 ;// ./node_modules/@wordpress/edit-site/build-module/components/editor/index.js 25386 /** 25387 * External dependencies 25388 */ 25389 25390 25391 /** 25392 * WordPress dependencies 25393 */ 25394 25395 25396 25397 25398 25399 25400 25401 25402 25403 25404 25405 25406 25407 25408 25409 /** 25410 * Internal dependencies 25411 */ 25412 25413 25414 25415 25416 25417 25418 25419 25420 25421 25422 25423 25424 25425 25426 25427 25428 25429 25430 25431 25432 25433 25434 const { 25435 Editor, 25436 BackButton 25437 } = unlock(external_wp_editor_namespaceObject.privateApis); 25438 const { 25439 useHistory: editor_useHistory, 25440 useLocation: editor_useLocation 25441 } = unlock(external_wp_router_namespaceObject.privateApis); 25442 const { 25443 BlockKeyboardShortcuts 25444 } = unlock(external_wp_blockLibrary_namespaceObject.privateApis); 25445 const toggleHomeIconVariants = { 25446 edit: { 25447 opacity: 0, 25448 scale: 0.2 25449 }, 25450 hover: { 25451 opacity: 1, 25452 scale: 1, 25453 clipPath: 'inset( 22% round 2px )' 25454 } 25455 }; 25456 const siteIconVariants = { 25457 edit: { 25458 clipPath: 'inset(0% round 0px)' 25459 }, 25460 hover: { 25461 clipPath: 'inset( 22% round 2px )' 25462 }, 25463 tap: { 25464 clipPath: 'inset(0% round 0px)' 25465 } 25466 }; 25467 function getListPathForPostType(postType) { 25468 switch (postType) { 25469 case 'navigation': 25470 return '/navigation'; 25471 case 'wp_block': 25472 return '/pattern?postType=wp_block'; 25473 case 'wp_template_part': 25474 return '/pattern?postType=wp_template_part'; 25475 case 'wp_template': 25476 return '/template'; 25477 case 'page': 25478 return '/page'; 25479 case 'post': 25480 return '/'; 25481 } 25482 throw 'Unknown post type'; 25483 } 25484 function getNavigationPath(location, postType) { 25485 const { 25486 path, 25487 name 25488 } = location; 25489 if (['pattern-item', 'template-part-item', 'page-item', 'template-item', 'post-item'].includes(name)) { 25490 return getListPathForPostType(postType); 25491 } 25492 return (0,external_wp_url_namespaceObject.addQueryArgs)(path, { 25493 canvas: undefined 25494 }); 25495 } 25496 function EditSiteEditor({ 25497 isHomeRoute = false, 25498 isPostsList = false 25499 }) { 25500 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); 25501 const location = editor_useLocation(); 25502 const { 25503 canvas = 'view' 25504 } = location.query; 25505 const isLoading = useIsSiteEditorLoading(); 25506 useAdaptEditorToCanvas(canvas); 25507 const entity = useResolveEditedEntity(); 25508 // deprecated sync state with url 25509 useSyncDeprecatedEntityIntoState(entity); 25510 const { 25511 postType, 25512 postId, 25513 context 25514 } = entity; 25515 const { 25516 isBlockBasedTheme, 25517 editorCanvasView, 25518 currentPostIsTrashed, 25519 hasSiteIcon 25520 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 25521 const { 25522 getEditorCanvasContainerView 25523 } = unlock(select(store)); 25524 const { 25525 getCurrentTheme, 25526 getEntityRecord 25527 } = select(external_wp_coreData_namespaceObject.store); 25528 const siteData = getEntityRecord('root', '__unstableBase', undefined); 25529 return { 25530 isBlockBasedTheme: getCurrentTheme()?.is_block_theme, 25531 editorCanvasView: getEditorCanvasContainerView(), 25532 currentPostIsTrashed: select(external_wp_editor_namespaceObject.store).getCurrentPostAttribute('status') === 'trash', 25533 hasSiteIcon: !!siteData?.site_icon_url 25534 }; 25535 }, []); 25536 const postWithTemplate = !!context?.postId; 25537 use_editor_title(postWithTemplate ? context.postType : postType, postWithTemplate ? context.postId : postId); 25538 const _isPreviewingTheme = isPreviewingTheme(); 25539 const hasDefaultEditorCanvasView = !useHasEditorCanvasContainer(); 25540 const iframeProps = useEditorIframeProps(); 25541 const isEditMode = canvas === 'edit'; 25542 const loadingProgressId = (0,external_wp_compose_namespaceObject.useInstanceId)(CanvasLoader, 'edit-site-editor__loading-progress'); 25543 const settings = useSpecificEditorSettings(); 25544 const styles = (0,external_wp_element_namespaceObject.useMemo)(() => [...settings.styles, { 25545 // Forming a "block formatting context" to prevent margin collapsing. 25546 // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context 25547 css: canvas === 'view' ? `body{min-height: 100vh; $currentPostIsTrashed ? '' : 'cursor: pointer;'}}` : undefined 25548 }], [settings.styles, canvas, currentPostIsTrashed]); 25549 const { 25550 resetZoomLevel 25551 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store)); 25552 const { 25553 createSuccessNotice 25554 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 25555 const history = editor_useHistory(); 25556 const onActionPerformed = (0,external_wp_element_namespaceObject.useCallback)((actionId, items) => { 25557 switch (actionId) { 25558 case 'move-to-trash': 25559 case 'delete-post': 25560 { 25561 history.navigate(getListPathForPostType(postWithTemplate ? context.postType : postType)); 25562 } 25563 break; 25564 case 'duplicate-post': 25565 { 25566 const newItem = items[0]; 25567 const _title = typeof newItem.title === 'string' ? newItem.title : newItem.title?.rendered; 25568 createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( 25569 // translators: %s: Title of the created post or template, e.g: "Hello world". 25570 (0,external_wp_i18n_namespaceObject.__)('"%s" successfully created.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(_title)), { 25571 type: 'snackbar', 25572 id: 'duplicate-post-action', 25573 actions: [{ 25574 label: (0,external_wp_i18n_namespaceObject.__)('Edit'), 25575 onClick: () => { 25576 history.navigate(`/$newItem.type}/$newItem.id}?canvas=edit`); 25577 } 25578 }] 25579 }); 25580 } 25581 break; 25582 } 25583 }, [postType, context?.postType, postWithTemplate, history, createSuccessNotice]); 25584 25585 // Replace the title and icon displayed in the DocumentBar when there's an overlay visible. 25586 const title = getEditorCanvasContainerTitle(editorCanvasView); 25587 const isReady = !isLoading; 25588 const transition = { 25589 duration: disableMotion ? 0 : 0.2 25590 }; 25591 return !isBlockBasedTheme && isHomeRoute ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SitePreview, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 25592 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesRenderer, { 25593 disableRootPadding: postType !== TEMPLATE_POST_TYPE 25594 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.EditorKeyboardShortcutsRegister, {}), isEditMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockKeyboardShortcuts, {}), !isReady ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CanvasLoader, { 25595 id: loadingProgressId 25596 }) : null, isEditMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuide, { 25597 postType: postWithTemplate ? context.postType : postType 25598 }), isReady && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Editor, { 25599 postType: postWithTemplate ? context.postType : postType, 25600 postId: postWithTemplate ? context.postId : postId, 25601 templateId: postWithTemplate ? postId : undefined, 25602 settings: settings, 25603 className: "edit-site-editor__editor-interface", 25604 styles: styles, 25605 customSaveButton: _isPreviewingTheme && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SaveButton, { 25606 size: "compact" 25607 }), 25608 customSavePanel: _isPreviewingTheme && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SavePanel, {}), 25609 forceDisableBlockTools: !hasDefaultEditorCanvasView, 25610 title: title, 25611 iframeProps: iframeProps, 25612 onActionPerformed: onActionPerformed, 25613 extraSidebarPanels: !postWithTemplate && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_template_setting_panel.Slot, {}), 25614 children: [isEditMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BackButton, { 25615 children: ({ 25616 length 25617 }) => length <= 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__unstableMotion.div, { 25618 className: "edit-site-editor__view-mode-toggle", 25619 transition: transition, 25620 animate: "edit", 25621 initial: "edit", 25622 whileHover: "hover", 25623 whileTap: "tap", 25624 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 25625 __next40pxDefaultSize: true, 25626 label: (0,external_wp_i18n_namespaceObject.__)('Open Navigation'), 25627 showTooltip: true, 25628 tooltipPosition: "middle right", 25629 onClick: () => { 25630 resetZoomLevel(); 25631 25632 // TODO: this is a temporary solution to navigate to the posts list if we are 25633 // come here through `posts list` and are in focus mode editing a template, template part etc.. 25634 if (isPostsList && location.query?.focusMode) { 25635 history.navigate('/', { 25636 transition: 'canvas-mode-view-transition' 25637 }); 25638 } else { 25639 history.navigate(getNavigationPath(location, postWithTemplate ? context.postType : postType), { 25640 transition: 'canvas-mode-view-transition' 25641 }); 25642 } 25643 }, 25644 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { 25645 variants: siteIconVariants, 25646 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(site_icon, { 25647 className: "edit-site-editor__view-mode-toggle-icon" 25648 }) 25649 }) 25650 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { 25651 className: dist_clsx('edit-site-editor__back-icon', { 25652 'has-site-icon': hasSiteIcon 25653 }), 25654 variants: toggleHomeIconVariants, 25655 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { 25656 icon: arrow_up_left 25657 }) 25658 })] 25659 }) 25660 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MoreMenu, {}), isBlockBasedTheme && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesSidebar, {})] 25661 })] 25662 }); 25663 } 25664 25665 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/utils.js 25666 /** 25667 * Check if the classic theme supports the stylebook. 25668 * 25669 * @param {Object} siteData - The site data provided by the site editor route area resolvers. 25670 * @return {boolean} True if the stylebook is supported, false otherwise. 25671 */ 25672 function isClassicThemeWithStyleBookSupport(siteData) { 25673 const isBlockTheme = siteData.currentTheme?.is_block_theme; 25674 const supportsEditorStyles = siteData.currentTheme?.theme_supports['editor-styles']; 25675 // This is a temp solution until the has_theme_json value is available for the current theme. 25676 const hasThemeJson = siteData.editorSettings?.supportsLayout; 25677 return !isBlockTheme && (supportsEditorStyles || hasThemeJson); 25678 } 25679 25680 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/home.js 25681 /** 25682 * Internal dependencies 25683 */ 25684 25685 25686 25687 25688 25689 const homeRoute = { 25690 name: 'home', 25691 path: '/', 25692 areas: { 25693 sidebar({ 25694 siteData 25695 }) { 25696 const isBlockTheme = siteData.currentTheme?.is_block_theme; 25697 return isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenMain, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); 25698 }, 25699 preview({ 25700 siteData 25701 }) { 25702 const isBlockTheme = siteData.currentTheme?.is_block_theme; 25703 return isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, { 25704 isHomeRoute: true 25705 }) : undefined; 25706 }, 25707 mobile({ 25708 siteData 25709 }) { 25710 const isBlockTheme = siteData.currentTheme?.is_block_theme; 25711 return isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenMain, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); 25712 } 25713 } 25714 }; 25715 25716 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/styles.js 25717 /** 25718 * WordPress dependencies 25719 */ 25720 25721 25722 /** 25723 * Internal dependencies 25724 */ 25725 25726 25727 25728 25729 25730 25731 const { 25732 useLocation: styles_useLocation 25733 } = unlock(external_wp_router_namespaceObject.privateApis); 25734 function MobileGlobalStylesUI() { 25735 const { 25736 query = {} 25737 } = styles_useLocation(); 25738 const { 25739 canvas 25740 } = query; 25741 if (canvas === 'edit') { 25742 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}); 25743 } 25744 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesUIWrapper, {}); 25745 } 25746 const stylesRoute = { 25747 name: 'styles', 25748 path: '/styles', 25749 areas: { 25750 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesUIWrapper, {}), 25751 sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenGlobalStyles, { 25752 backPath: "/" 25753 }), 25754 preview({ 25755 query 25756 }) { 25757 const isStylebook = query.preview === 'stylebook'; 25758 return isStylebook ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleBookPreview, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}); 25759 }, 25760 mobile: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MobileGlobalStylesUI, {}) 25761 }, 25762 widths: { 25763 content: 380 25764 } 25765 }; 25766 25767 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js 25768 // This requested is preloaded in `gutenberg_preload_navigation_posts`. 25769 // As unbounded queries are limited to 100 by `fetchAllMiddleware` 25770 // on apiFetch this query is limited to 100. 25771 // These parameters must be kept aligned with those in 25772 // lib/compat/wordpress-6.3/navigation-block-preloading.php 25773 // and 25774 // block-library/src/navigation/constants.js 25775 const PRELOADED_NAVIGATION_MENUS_QUERY = { 25776 per_page: 100, 25777 status: ['publish', 'draft'], 25778 order: 'desc', 25779 orderby: 'date' 25780 }; 25781 25782 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js 25783 /** 25784 * WordPress dependencies 25785 */ 25786 25787 25788 25789 25790 const notEmptyString = testString => testString?.trim()?.length > 0; 25791 function RenameModal({ 25792 menuTitle, 25793 onClose, 25794 onSave 25795 }) { 25796 const [editedMenuTitle, setEditedMenuTitle] = (0,external_wp_element_namespaceObject.useState)(menuTitle); 25797 const titleHasChanged = editedMenuTitle !== menuTitle; 25798 const isEditedMenuTitleValid = titleHasChanged && notEmptyString(editedMenuTitle); 25799 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 25800 title: (0,external_wp_i18n_namespaceObject.__)('Rename'), 25801 onRequestClose: onClose, 25802 focusOnMount: "firstContentElement", 25803 size: "small", 25804 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { 25805 className: "sidebar-navigation__rename-modal-form", 25806 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 25807 spacing: "3", 25808 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { 25809 __nextHasNoMarginBottom: true, 25810 __next40pxDefaultSize: true, 25811 value: editedMenuTitle, 25812 placeholder: (0,external_wp_i18n_namespaceObject.__)('Navigation title'), 25813 onChange: setEditedMenuTitle, 25814 label: (0,external_wp_i18n_namespaceObject.__)('Name') 25815 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 25816 justify: "right", 25817 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 25818 __next40pxDefaultSize: true, 25819 variant: "tertiary", 25820 onClick: onClose, 25821 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 25822 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 25823 __next40pxDefaultSize: true, 25824 accessibleWhenDisabled: true, 25825 disabled: !isEditedMenuTitleValid, 25826 variant: "primary", 25827 type: "submit", 25828 onClick: e => { 25829 e.preventDefault(); 25830 if (!isEditedMenuTitleValid) { 25831 return; 25832 } 25833 onSave({ 25834 title: editedMenuTitle 25835 }); 25836 25837 // Immediate close avoids ability to hit save multiple times. 25838 onClose(); 25839 }, 25840 children: (0,external_wp_i18n_namespaceObject.__)('Save') 25841 })] 25842 })] 25843 }) 25844 }) 25845 }); 25846 } 25847 25848 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js 25849 /** 25850 * WordPress dependencies 25851 */ 25852 25853 25854 25855 function DeleteConfirmDialog({ 25856 onClose, 25857 onConfirm 25858 }) { 25859 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { 25860 isOpen: true, 25861 onConfirm: () => { 25862 onConfirm(); 25863 25864 // Immediate close avoids ability to hit delete multiple times. 25865 onClose(); 25866 }, 25867 onCancel: onClose, 25868 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Delete'), 25869 size: "medium", 25870 children: (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to delete this Navigation Menu?') 25871 }); 25872 } 25873 25874 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js 25875 /** 25876 * WordPress dependencies 25877 */ 25878 25879 25880 25881 25882 25883 25884 /** 25885 * Internal dependencies 25886 */ 25887 25888 25889 25890 25891 const { 25892 useHistory: more_menu_useHistory 25893 } = unlock(external_wp_router_namespaceObject.privateApis); 25894 const POPOVER_PROPS = { 25895 position: 'bottom right' 25896 }; 25897 function ScreenNavigationMoreMenu(props) { 25898 const { 25899 onDelete, 25900 onSave, 25901 onDuplicate, 25902 menuTitle, 25903 menuId 25904 } = props; 25905 const [renameModalOpen, setRenameModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); 25906 const [deleteConfirmDialogOpen, setDeleteConfirmDialogOpen] = (0,external_wp_element_namespaceObject.useState)(false); 25907 const history = more_menu_useHistory(); 25908 const closeModals = () => { 25909 setRenameModalOpen(false); 25910 setDeleteConfirmDialogOpen(false); 25911 }; 25912 const openRenameModal = () => setRenameModalOpen(true); 25913 const openDeleteConfirmDialog = () => setDeleteConfirmDialogOpen(true); 25914 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 25915 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { 25916 className: "sidebar-navigation__more-menu", 25917 label: (0,external_wp_i18n_namespaceObject.__)('Actions'), 25918 icon: more_vertical, 25919 popoverProps: POPOVER_PROPS, 25920 children: ({ 25921 onClose 25922 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 25923 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { 25924 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 25925 onClick: () => { 25926 openRenameModal(); 25927 // Close the dropdown after opening the modal. 25928 onClose(); 25929 }, 25930 children: (0,external_wp_i18n_namespaceObject.__)('Rename') 25931 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 25932 onClick: () => { 25933 history.navigate(`/wp_navigation/$menuId}?canvas=edit`); 25934 }, 25935 children: (0,external_wp_i18n_namespaceObject.__)('Edit') 25936 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 25937 onClick: () => { 25938 onDuplicate(); 25939 onClose(); 25940 }, 25941 children: (0,external_wp_i18n_namespaceObject.__)('Duplicate') 25942 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 25943 isDestructive: true, 25944 onClick: () => { 25945 openDeleteConfirmDialog(); 25946 25947 // Close the dropdown after opening the modal. 25948 onClose(); 25949 }, 25950 children: (0,external_wp_i18n_namespaceObject.__)('Delete') 25951 })] 25952 }) 25953 }) 25954 }), deleteConfirmDialogOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DeleteConfirmDialog, { 25955 onClose: closeModals, 25956 onConfirm: onDelete 25957 }), renameModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RenameModal, { 25958 onClose: closeModals, 25959 menuTitle: menuTitle, 25960 onSave: onSave 25961 })] 25962 }); 25963 } 25964 25965 ;// ./node_modules/@wordpress/icons/build-module/library/chevron-up.js 25966 /** 25967 * WordPress dependencies 25968 */ 25969 25970 25971 const chevronUp = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 25972 viewBox: "0 0 24 24", 25973 xmlns: "http://www.w3.org/2000/svg", 25974 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 25975 d: "M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z" 25976 }) 25977 }); 25978 /* harmony default export */ const chevron_up = (chevronUp); 25979 25980 ;// ./node_modules/@wordpress/icons/build-module/library/chevron-down.js 25981 /** 25982 * WordPress dependencies 25983 */ 25984 25985 25986 const chevronDown = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 25987 viewBox: "0 0 24 24", 25988 xmlns: "http://www.w3.org/2000/svg", 25989 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 25990 d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z" 25991 }) 25992 }); 25993 /* harmony default export */ const chevron_down = (chevronDown); 25994 25995 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js 25996 /** 25997 * WordPress dependencies 25998 */ 25999 26000 26001 26002 26003 26004 26005 26006 26007 const leaf_more_menu_POPOVER_PROPS = { 26008 className: 'block-editor-block-settings-menu__popover', 26009 placement: 'bottom-start' 26010 }; 26011 26012 /** 26013 * Internal dependencies 26014 */ 26015 26016 26017 const { 26018 useHistory: leaf_more_menu_useHistory, 26019 useLocation: leaf_more_menu_useLocation 26020 } = unlock(external_wp_router_namespaceObject.privateApis); 26021 function LeafMoreMenu(props) { 26022 const history = leaf_more_menu_useHistory(); 26023 const { 26024 path 26025 } = leaf_more_menu_useLocation(); 26026 const { 26027 block 26028 } = props; 26029 const { 26030 clientId 26031 } = block; 26032 const { 26033 moveBlocksDown, 26034 moveBlocksUp, 26035 removeBlocks 26036 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 26037 const removeLabel = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: block name */ 26038 (0,external_wp_i18n_namespaceObject.__)('Remove %s'), (0,external_wp_blockEditor_namespaceObject.BlockTitle)({ 26039 clientId, 26040 maximumLength: 25 26041 })); 26042 const goToLabel = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: block name */ 26043 (0,external_wp_i18n_namespaceObject.__)('Go to %s'), (0,external_wp_blockEditor_namespaceObject.BlockTitle)({ 26044 clientId, 26045 maximumLength: 25 26046 })); 26047 const rootClientId = (0,external_wp_data_namespaceObject.useSelect)(select => { 26048 const { 26049 getBlockRootClientId 26050 } = select(external_wp_blockEditor_namespaceObject.store); 26051 return getBlockRootClientId(clientId); 26052 }, [clientId]); 26053 const onGoToPage = (0,external_wp_element_namespaceObject.useCallback)(selectedBlock => { 26054 const { 26055 attributes, 26056 name 26057 } = selectedBlock; 26058 if (attributes.kind === 'post-type' && attributes.id && attributes.type && history) { 26059 history.navigate(`/$attributes.type}/$attributes.id}?canvas=edit`, { 26060 state: { 26061 backPath: path 26062 } 26063 }); 26064 } 26065 if (name === 'core/page-list-item' && attributes.id && history) { 26066 history.navigate(`/page/$attributes.id}?canvas=edit`, { 26067 state: { 26068 backPath: path 26069 } 26070 }); 26071 } 26072 }, [path, history]); 26073 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { 26074 icon: more_vertical, 26075 label: (0,external_wp_i18n_namespaceObject.__)('Options'), 26076 className: "block-editor-block-settings-menu", 26077 popoverProps: leaf_more_menu_POPOVER_PROPS, 26078 noIcons: true, 26079 ...props, 26080 children: ({ 26081 onClose 26082 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 26083 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { 26084 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 26085 icon: chevron_up, 26086 onClick: () => { 26087 moveBlocksUp([clientId], rootClientId); 26088 onClose(); 26089 }, 26090 children: (0,external_wp_i18n_namespaceObject.__)('Move up') 26091 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 26092 icon: chevron_down, 26093 onClick: () => { 26094 moveBlocksDown([clientId], rootClientId); 26095 onClose(); 26096 }, 26097 children: (0,external_wp_i18n_namespaceObject.__)('Move down') 26098 }), block.attributes?.type === 'page' && block.attributes?.id && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 26099 onClick: () => { 26100 onGoToPage(block); 26101 onClose(); 26102 }, 26103 children: goToLabel 26104 })] 26105 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { 26106 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 26107 onClick: () => { 26108 removeBlocks([clientId], false); 26109 onClose(); 26110 }, 26111 children: removeLabel 26112 }) 26113 })] 26114 }) 26115 }); 26116 } 26117 26118 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js 26119 /** 26120 * WordPress dependencies 26121 */ 26122 26123 26124 26125 26126 26127 26128 /** 26129 * Internal dependencies 26130 */ 26131 26132 26133 26134 const { 26135 PrivateListView 26136 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 26137 26138 // Needs to be kept in sync with the query used at packages/block-library/src/page-list/edit.js. 26139 const MAX_PAGE_COUNT = 100; 26140 const PAGES_QUERY = ['postType', 'page', { 26141 per_page: MAX_PAGE_COUNT, 26142 _fields: ['id', 'link', 'menu_order', 'parent', 'title', 'type'], 26143 // TODO: When https://core.trac.wordpress.org/ticket/39037 REST API support for multiple orderby 26144 // values is resolved, update 'orderby' to [ 'menu_order', 'post_title' ] to provide a consistent 26145 // sort. 26146 orderby: 'menu_order', 26147 order: 'asc' 26148 }]; 26149 function NavigationMenuContent({ 26150 rootClientId 26151 }) { 26152 const { 26153 listViewRootClientId, 26154 isLoading 26155 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 26156 const { 26157 areInnerBlocksControlled, 26158 getBlockName, 26159 getBlockCount, 26160 getBlockOrder 26161 } = select(external_wp_blockEditor_namespaceObject.store); 26162 const { 26163 isResolving 26164 } = select(external_wp_coreData_namespaceObject.store); 26165 const blockClientIds = getBlockOrder(rootClientId); 26166 const hasOnlyPageListBlock = blockClientIds.length === 1 && getBlockName(blockClientIds[0]) === 'core/page-list'; 26167 const pageListHasBlocks = hasOnlyPageListBlock && getBlockCount(blockClientIds[0]) > 0; 26168 const isLoadingPages = isResolving('getEntityRecords', PAGES_QUERY); 26169 return { 26170 listViewRootClientId: pageListHasBlocks ? blockClientIds[0] : rootClientId, 26171 // This is a small hack to wait for the navigation block 26172 // to actually load its inner blocks. 26173 isLoading: !areInnerBlocksControlled(rootClientId) || isLoadingPages 26174 }; 26175 }, [rootClientId]); 26176 const { 26177 replaceBlock, 26178 __unstableMarkNextChangeAsNotPersistent 26179 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 26180 const offCanvasOnselect = (0,external_wp_element_namespaceObject.useCallback)(block => { 26181 if (block.name === 'core/navigation-link' && !block.attributes.url) { 26182 __unstableMarkNextChangeAsNotPersistent(); 26183 replaceBlock(block.clientId, (0,external_wp_blocks_namespaceObject.createBlock)('core/navigation-link', block.attributes)); 26184 } 26185 }, [__unstableMarkNextChangeAsNotPersistent, replaceBlock]); 26186 26187 // The hidden block is needed because it makes block edit side effects trigger. 26188 // For example a navigation page list load its items has an effect on edit to load its items. 26189 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 26190 children: [!isLoading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateListView, { 26191 rootClientId: listViewRootClientId, 26192 onSelect: offCanvasOnselect, 26193 blockSettingsMenu: LeafMoreMenu, 26194 showAppender: false 26195 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 26196 className: "edit-site-sidebar-navigation-screen-navigation-menus__helper-block-editor", 26197 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockList, {}) 26198 })] 26199 }); 26200 } 26201 26202 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js 26203 /** 26204 * WordPress dependencies 26205 */ 26206 26207 26208 26209 26210 26211 /** 26212 * Internal dependencies 26213 */ 26214 26215 26216 26217 26218 const navigation_menu_editor_noop = () => {}; 26219 function NavigationMenuEditor({ 26220 navigationMenuId 26221 }) { 26222 const { 26223 storedSettings 26224 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 26225 const { 26226 getSettings 26227 } = unlock(select(store)); 26228 return { 26229 storedSettings: getSettings() 26230 }; 26231 }, []); 26232 const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => { 26233 if (!navigationMenuId) { 26234 return []; 26235 } 26236 return [(0,external_wp_blocks_namespaceObject.createBlock)('core/navigation', { 26237 ref: navigationMenuId 26238 })]; 26239 }, [navigationMenuId]); 26240 if (!navigationMenuId || !blocks?.length) { 26241 return null; 26242 } 26243 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockEditorProvider, { 26244 settings: storedSettings, 26245 value: blocks, 26246 onChange: navigation_menu_editor_noop, 26247 onInput: navigation_menu_editor_noop, 26248 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 26249 className: "edit-site-sidebar-navigation-screen-navigation-menus__content", 26250 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationMenuContent, { 26251 rootClientId: blocks[0].clientId 26252 }) 26253 }) 26254 }); 26255 } 26256 26257 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js 26258 /** 26259 * WordPress dependencies 26260 */ 26261 26262 26263 26264 // Copied from packages/block-library/src/navigation/edit/navigation-menu-selector.js. 26265 function buildNavigationLabel(title, id, status) { 26266 if (!title?.rendered) { 26267 /* translators: %s: the index of the menu in the list of menus. */ 26268 return (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('(no title %s)'), id); 26269 } 26270 if (status === 'publish') { 26271 return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title?.rendered); 26272 } 26273 return (0,external_wp_i18n_namespaceObject.sprintf)( 26274 // translators: 1: title of the menu. 2: status of the menu (draft, pending, etc.). 26275 (0,external_wp_i18n_namespaceObject._x)('%1$s (%2$s)', 'menu label'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title?.rendered), status); 26276 } 26277 26278 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js 26279 /** 26280 * WordPress dependencies 26281 */ 26282 26283 26284 /** 26285 * Internal dependencies 26286 */ 26287 26288 26289 26290 26291 26292 function SingleNavigationMenu({ 26293 navigationMenu, 26294 backPath, 26295 handleDelete, 26296 handleDuplicate, 26297 handleSave 26298 }) { 26299 const menuTitle = navigationMenu?.title?.rendered; 26300 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, { 26301 actions: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { 26302 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ScreenNavigationMoreMenu, { 26303 menuId: navigationMenu?.id, 26304 menuTitle: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(menuTitle), 26305 onDelete: handleDelete, 26306 onSave: handleSave, 26307 onDuplicate: handleDuplicate 26308 }) 26309 }), 26310 backPath: backPath, 26311 title: buildNavigationLabel(navigationMenu?.title, navigationMenu?.id, navigationMenu?.status), 26312 description: (0,external_wp_i18n_namespaceObject.__)('Navigation Menus are a curated collection of blocks that allow visitors to get around your site.'), 26313 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationMenuEditor, { 26314 navigationMenuId: navigationMenu?.id 26315 }) 26316 }); 26317 } 26318 26319 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/index.js 26320 /** 26321 * WordPress dependencies 26322 */ 26323 26324 26325 26326 26327 26328 26329 26330 /** 26331 * Internal dependencies 26332 */ 26333 26334 26335 26336 26337 26338 26339 26340 const { 26341 useLocation: sidebar_navigation_screen_navigation_menu_useLocation 26342 } = unlock(external_wp_router_namespaceObject.privateApis); 26343 const postType = `wp_navigation`; 26344 function SidebarNavigationScreenNavigationMenu({ 26345 backPath 26346 }) { 26347 const { 26348 params: { 26349 postId 26350 } 26351 } = sidebar_navigation_screen_navigation_menu_useLocation(); 26352 const { 26353 record: navigationMenu, 26354 isResolving 26355 } = (0,external_wp_coreData_namespaceObject.useEntityRecord)('postType', postType, postId); 26356 const { 26357 isSaving, 26358 isDeleting 26359 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 26360 const { 26361 isSavingEntityRecord, 26362 isDeletingEntityRecord 26363 } = select(external_wp_coreData_namespaceObject.store); 26364 return { 26365 isSaving: isSavingEntityRecord('postType', postType, postId), 26366 isDeleting: isDeletingEntityRecord('postType', postType, postId) 26367 }; 26368 }, [postId]); 26369 const isLoading = isResolving || isSaving || isDeleting; 26370 const menuTitle = navigationMenu?.title?.rendered || navigationMenu?.slug; 26371 const { 26372 handleSave, 26373 handleDelete, 26374 handleDuplicate 26375 } = useNavigationMenuHandlers(); 26376 const _handleDelete = () => handleDelete(navigationMenu); 26377 const _handleSave = edits => handleSave(navigationMenu, edits); 26378 const _handleDuplicate = () => handleDuplicate(navigationMenu); 26379 if (isLoading) { 26380 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, { 26381 description: (0,external_wp_i18n_namespaceObject.__)('Navigation Menus are a curated collection of blocks that allow visitors to get around your site.'), 26382 backPath: backPath, 26383 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, { 26384 className: "edit-site-sidebar-navigation-screen-navigation-menus__loading" 26385 }) 26386 }); 26387 } 26388 if (!isLoading && !navigationMenu) { 26389 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, { 26390 description: (0,external_wp_i18n_namespaceObject.__)('Navigation Menu missing.'), 26391 backPath: backPath 26392 }); 26393 } 26394 if (!navigationMenu?.content?.raw) { 26395 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, { 26396 actions: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ScreenNavigationMoreMenu, { 26397 menuId: navigationMenu?.id, 26398 menuTitle: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(menuTitle), 26399 onDelete: _handleDelete, 26400 onSave: _handleSave, 26401 onDuplicate: _handleDuplicate 26402 }), 26403 backPath: backPath, 26404 title: buildNavigationLabel(navigationMenu?.title, navigationMenu?.id, navigationMenu?.status), 26405 description: (0,external_wp_i18n_namespaceObject.__)('This Navigation Menu is empty.') 26406 }); 26407 } 26408 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SingleNavigationMenu, { 26409 navigationMenu: navigationMenu, 26410 backPath: backPath, 26411 handleDelete: _handleDelete, 26412 handleSave: _handleSave, 26413 handleDuplicate: _handleDuplicate 26414 }); 26415 } 26416 26417 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js 26418 /** 26419 * WordPress dependencies 26420 */ 26421 26422 26423 26424 26425 26426 26427 /** 26428 * Internal dependencies 26429 */ 26430 26431 26432 26433 const { 26434 useHistory: use_navigation_menu_handlers_useHistory 26435 } = unlock(external_wp_router_namespaceObject.privateApis); 26436 function useDeleteNavigationMenu() { 26437 const { 26438 deleteEntityRecord 26439 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 26440 const { 26441 createSuccessNotice, 26442 createErrorNotice 26443 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 26444 const history = use_navigation_menu_handlers_useHistory(); 26445 const handleDelete = async navigationMenu => { 26446 const postId = navigationMenu?.id; 26447 try { 26448 await deleteEntityRecord('postType', postType, postId, { 26449 force: true 26450 }, { 26451 throwOnError: true 26452 }); 26453 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Navigation Menu successfully deleted.'), { 26454 type: 'snackbar' 26455 }); 26456 history.navigate('/navigation'); 26457 } catch (error) { 26458 createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: error message describing why the navigation menu could not be deleted. */ 26459 (0,external_wp_i18n_namespaceObject.__)(`Unable to delete Navigation Menu (%s).`), error?.message), { 26460 type: 'snackbar' 26461 }); 26462 } 26463 }; 26464 return handleDelete; 26465 } 26466 function useSaveNavigationMenu() { 26467 const { 26468 getEditedEntityRecord 26469 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 26470 const { 26471 getEditedEntityRecord: getEditedEntityRecordSelector 26472 } = select(external_wp_coreData_namespaceObject.store); 26473 return { 26474 getEditedEntityRecord: getEditedEntityRecordSelector 26475 }; 26476 }, []); 26477 const { 26478 editEntityRecord, 26479 __experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits 26480 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 26481 const { 26482 createSuccessNotice, 26483 createErrorNotice 26484 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 26485 const handleSave = async (navigationMenu, edits) => { 26486 if (!edits) { 26487 return; 26488 } 26489 const postId = navigationMenu?.id; 26490 // Prepare for revert in case of error. 26491 const originalRecord = getEditedEntityRecord('postType', NAVIGATION_POST_TYPE, postId); 26492 26493 // Apply the edits. 26494 editEntityRecord('postType', postType, postId, edits); 26495 const recordPropertiesToSave = Object.keys(edits); 26496 26497 // Attempt to persist. 26498 try { 26499 await saveSpecifiedEntityEdits('postType', postType, postId, recordPropertiesToSave, { 26500 throwOnError: true 26501 }); 26502 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Renamed Navigation Menu'), { 26503 type: 'snackbar' 26504 }); 26505 } catch (error) { 26506 // Revert to original in case of error. 26507 editEntityRecord('postType', postType, postId, originalRecord); 26508 createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: error message describing why the navigation menu could not be renamed. */ 26509 (0,external_wp_i18n_namespaceObject.__)(`Unable to rename Navigation Menu (%s).`), error?.message), { 26510 type: 'snackbar' 26511 }); 26512 } 26513 }; 26514 return handleSave; 26515 } 26516 function useDuplicateNavigationMenu() { 26517 const history = use_navigation_menu_handlers_useHistory(); 26518 const { 26519 saveEntityRecord 26520 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 26521 const { 26522 createSuccessNotice, 26523 createErrorNotice 26524 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 26525 const handleDuplicate = async navigationMenu => { 26526 const menuTitle = navigationMenu?.title?.rendered || navigationMenu?.slug; 26527 try { 26528 const savedRecord = await saveEntityRecord('postType', postType, { 26529 title: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: Navigation menu title */ 26530 (0,external_wp_i18n_namespaceObject._x)('%s (Copy)', 'navigation menu'), menuTitle), 26531 content: navigationMenu?.content?.raw, 26532 status: 'publish' 26533 }, { 26534 throwOnError: true 26535 }); 26536 if (savedRecord) { 26537 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Duplicated Navigation Menu'), { 26538 type: 'snackbar' 26539 }); 26540 history.navigate(`/wp_navigation/$savedRecord.id}`); 26541 } 26542 } catch (error) { 26543 createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: error message describing why the navigation menu could not be deleted. */ 26544 (0,external_wp_i18n_namespaceObject.__)(`Unable to duplicate Navigation Menu (%s).`), error?.message), { 26545 type: 'snackbar' 26546 }); 26547 } 26548 }; 26549 return handleDuplicate; 26550 } 26551 function useNavigationMenuHandlers() { 26552 return { 26553 handleDelete: useDeleteNavigationMenu(), 26554 handleSave: useSaveNavigationMenu(), 26555 handleDuplicate: useDuplicateNavigationMenu() 26556 }; 26557 } 26558 26559 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/index.js 26560 /** 26561 * WordPress dependencies 26562 */ 26563 26564 26565 26566 26567 26568 26569 26570 /** 26571 * Internal dependencies 26572 */ 26573 26574 26575 26576 26577 26578 26579 26580 26581 // Copied from packages/block-library/src/navigation/edit/navigation-menu-selector.js. 26582 26583 function buildMenuLabel(title, id, status) { 26584 if (!title) { 26585 /* translators: %s: the index of the menu in the list of menus. */ 26586 return (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('(no title %s)'), id); 26587 } 26588 if (status === 'publish') { 26589 return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title); 26590 } 26591 return (0,external_wp_i18n_namespaceObject.sprintf)( 26592 // translators: 1: title of the menu. 2: status of the menu (draft, pending, etc.). 26593 (0,external_wp_i18n_namespaceObject._x)('%1$s (%2$s)', 'menu label'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title), status); 26594 } 26595 function SidebarNavigationScreenNavigationMenus({ 26596 backPath 26597 }) { 26598 const { 26599 records: navigationMenus, 26600 isResolving: isResolvingNavigationMenus, 26601 hasResolved: hasResolvedNavigationMenus 26602 } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', NAVIGATION_POST_TYPE, PRELOADED_NAVIGATION_MENUS_QUERY); 26603 const isLoading = isResolvingNavigationMenus && !hasResolvedNavigationMenus; 26604 const { 26605 getNavigationFallbackId 26606 } = unlock((0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store)); 26607 const isCreatingNavigationFallback = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).isResolving('getNavigationFallbackId'), []); 26608 const firstNavigationMenu = navigationMenus?.[0]; 26609 26610 // If there is no navigation menu found 26611 // then trigger fallback algorithm to create one. 26612 if (!firstNavigationMenu && !isResolvingNavigationMenus && hasResolvedNavigationMenus && 26613 // Ensure a fallback navigation is created only once 26614 !isCreatingNavigationFallback) { 26615 getNavigationFallbackId(); 26616 } 26617 const { 26618 handleSave, 26619 handleDelete, 26620 handleDuplicate 26621 } = useNavigationMenuHandlers(); 26622 const hasNavigationMenus = !!navigationMenus?.length; 26623 if (isLoading) { 26624 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, { 26625 backPath: backPath, 26626 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, { 26627 className: "edit-site-sidebar-navigation-screen-navigation-menus__loading" 26628 }) 26629 }); 26630 } 26631 if (!isLoading && !hasNavigationMenus) { 26632 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, { 26633 description: (0,external_wp_i18n_namespaceObject.__)('No Navigation Menus found.'), 26634 backPath: backPath 26635 }); 26636 } 26637 26638 // if single menu then render it 26639 if (navigationMenus?.length === 1) { 26640 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SingleNavigationMenu, { 26641 navigationMenu: firstNavigationMenu, 26642 backPath: backPath, 26643 handleDelete: () => handleDelete(firstNavigationMenu), 26644 handleDuplicate: () => handleDuplicate(firstNavigationMenu), 26645 handleSave: edits => handleSave(firstNavigationMenu, edits) 26646 }); 26647 } 26648 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, { 26649 backPath: backPath, 26650 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 26651 className: "edit-site-sidebar-navigation-screen-navigation-menus", 26652 children: navigationMenus?.map(({ 26653 id, 26654 title, 26655 status 26656 }, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavMenuItem, { 26657 postId: id, 26658 withChevron: true, 26659 icon: library_navigation, 26660 children: buildMenuLabel(title?.rendered, index + 1, status) 26661 }, id)) 26662 }) 26663 }); 26664 } 26665 function SidebarNavigationScreenWrapper({ 26666 children, 26667 actions, 26668 title, 26669 description, 26670 backPath 26671 }) { 26672 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { 26673 title: title || (0,external_wp_i18n_namespaceObject.__)('Navigation'), 26674 actions: actions, 26675 description: description || (0,external_wp_i18n_namespaceObject.__)('Manage your Navigation Menus.'), 26676 backPath: backPath, 26677 content: children 26678 }); 26679 } 26680 const NavMenuItem = ({ 26681 postId, 26682 ...props 26683 }) => { 26684 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 26685 to: `/wp_navigation/$postId}`, 26686 ...props 26687 }); 26688 }; 26689 26690 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/navigation.js 26691 /** 26692 * WordPress dependencies 26693 */ 26694 26695 26696 /** 26697 * Internal dependencies 26698 */ 26699 26700 26701 26702 26703 26704 const { 26705 useLocation: navigation_useLocation 26706 } = unlock(external_wp_router_namespaceObject.privateApis); 26707 function MobileNavigationView() { 26708 const { 26709 query = {} 26710 } = navigation_useLocation(); 26711 const { 26712 canvas = 'view' 26713 } = query; 26714 return canvas === 'edit' ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenNavigationMenus, { 26715 backPath: "/" 26716 }); 26717 } 26718 const navigationRoute = { 26719 name: 'navigation', 26720 path: '/navigation', 26721 areas: { 26722 sidebar({ 26723 siteData 26724 }) { 26725 const isBlockTheme = siteData.currentTheme?.is_block_theme; 26726 return isBlockTheme ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenNavigationMenus, { 26727 backPath: "/" 26728 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); 26729 }, 26730 preview({ 26731 siteData 26732 }) { 26733 const isBlockTheme = siteData.currentTheme?.is_block_theme; 26734 return isBlockTheme ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : undefined; 26735 }, 26736 mobile({ 26737 siteData 26738 }) { 26739 const isBlockTheme = siteData.currentTheme?.is_block_theme; 26740 return isBlockTheme ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MobileNavigationView, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); 26741 } 26742 } 26743 }; 26744 26745 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/navigation-item.js 26746 /** 26747 * WordPress dependencies 26748 */ 26749 26750 26751 /** 26752 * Internal dependencies 26753 */ 26754 26755 26756 26757 26758 26759 const { 26760 useLocation: navigation_item_useLocation 26761 } = unlock(external_wp_router_namespaceObject.privateApis); 26762 function MobileNavigationItemView() { 26763 const { 26764 query = {} 26765 } = navigation_item_useLocation(); 26766 const { 26767 canvas = 'view' 26768 } = query; 26769 return canvas === 'edit' ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenNavigationMenu, { 26770 backPath: "/navigation" 26771 }); 26772 } 26773 const navigationItemRoute = { 26774 name: 'navigation-item', 26775 path: '/wp_navigation/:postId', 26776 areas: { 26777 sidebar({ 26778 siteData 26779 }) { 26780 const isBlockTheme = siteData.currentTheme?.is_block_theme; 26781 return isBlockTheme ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenNavigationMenu, { 26782 backPath: "/navigation" 26783 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); 26784 }, 26785 preview({ 26786 siteData 26787 }) { 26788 const isBlockTheme = siteData.currentTheme?.is_block_theme; 26789 return isBlockTheme ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); 26790 }, 26791 mobile({ 26792 siteData 26793 }) { 26794 const isBlockTheme = siteData.currentTheme?.is_block_theme; 26795 return isBlockTheme ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MobileNavigationItemView, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); 26796 } 26797 } 26798 }; 26799 26800 ;// ./node_modules/@wordpress/icons/build-module/library/file.js 26801 /** 26802 * WordPress dependencies 26803 */ 26804 26805 26806 const file = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 26807 viewBox: "0 0 24 24", 26808 xmlns: "http://www.w3.org/2000/svg", 26809 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 26810 fillRule: "evenodd", 26811 clipRule: "evenodd", 26812 d: "M12.848 8a1 1 0 0 1-.914-.594l-.723-1.63a.5.5 0 0 0-.447-.276H5a.5.5 0 0 0-.5.5v11.5a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5v-9A.5.5 0 0 0 19 8h-6.152Zm.612-1.5a.5.5 0 0 1-.462-.31l-.445-1.084A2 2 0 0 0 10.763 4H5a2 2 0 0 0-2 2v11.5a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-9a2 2 0 0 0-2-2h-5.54Z" 26813 }) 26814 }); 26815 /* harmony default export */ const library_file = (file); 26816 26817 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/category-item.js 26818 /** 26819 * Internal dependencies 26820 */ 26821 26822 26823 function CategoryItem({ 26824 count, 26825 icon, 26826 id, 26827 isActive, 26828 label, 26829 type 26830 }) { 26831 if (!count) { 26832 return; 26833 } 26834 const queryArgs = [`postType=$type}`]; 26835 if (id) { 26836 queryArgs.push(`categoryId=$id}`); 26837 } 26838 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 26839 icon: icon, 26840 suffix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 26841 children: count 26842 }), 26843 "aria-current": isActive ? 'true' : undefined, 26844 to: `/pattern?$queryArgs.join('&')}`, 26845 children: label 26846 }); 26847 } 26848 26849 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js 26850 /** 26851 * WordPress dependencies 26852 */ 26853 26854 26855 26856 /** 26857 * Internal dependencies 26858 */ 26859 26860 26861 function useDefaultPatternCategories() { 26862 const blockPatternCategories = (0,external_wp_data_namespaceObject.useSelect)(select => { 26863 var _settings$__experimen; 26864 const { 26865 getSettings 26866 } = unlock(select(store)); 26867 const settings = getSettings(); 26868 return (_settings$__experimen = settings.__experimentalAdditionalBlockPatternCategories) !== null && _settings$__experimen !== void 0 ? _settings$__experimen : settings.__experimentalBlockPatternCategories; 26869 }); 26870 const restBlockPatternCategories = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getBlockPatternCategories()); 26871 return [...(blockPatternCategories || []), ...(restBlockPatternCategories || [])]; 26872 } 26873 26874 ;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/utils.js 26875 const filterOutDuplicatesByName = (currentItem, index, items) => index === items.findIndex(item => currentItem.name === item.name); 26876 26877 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js 26878 /** 26879 * WordPress dependencies 26880 */ 26881 26882 26883 26884 26885 /** 26886 * Internal dependencies 26887 */ 26888 26889 26890 26891 26892 function useThemePatterns() { 26893 const blockPatterns = (0,external_wp_data_namespaceObject.useSelect)(select => { 26894 var _getSettings$__experi; 26895 const { 26896 getSettings 26897 } = unlock(select(store)); 26898 return (_getSettings$__experi = getSettings().__experimentalAdditionalBlockPatterns) !== null && _getSettings$__experi !== void 0 ? _getSettings$__experi : getSettings().__experimentalBlockPatterns; 26899 }); 26900 const restBlockPatterns = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getBlockPatterns()); 26901 const patterns = (0,external_wp_element_namespaceObject.useMemo)(() => [...(blockPatterns || []), ...(restBlockPatterns || [])].filter(pattern => !EXCLUDED_PATTERN_SOURCES.includes(pattern.source)).filter(filterOutDuplicatesByName).filter(pattern => pattern.inserter !== false), [blockPatterns, restBlockPatterns]); 26902 return patterns; 26903 } 26904 26905 ;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/search-items.js 26906 /** 26907 * WordPress dependencies 26908 */ 26909 26910 26911 /** 26912 * Internal dependencies 26913 */ 26914 26915 const { 26916 extractWords, 26917 getNormalizedSearchTerms, 26918 normalizeString 26919 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 26920 26921 /** 26922 * Internal dependencies 26923 */ 26924 26925 26926 // Default search helpers. 26927 const defaultGetName = item => { 26928 if (item.type === PATTERN_TYPES.user) { 26929 return item.slug; 26930 } 26931 if (item.type === TEMPLATE_PART_POST_TYPE) { 26932 return ''; 26933 } 26934 return item.name || ''; 26935 }; 26936 const defaultGetTitle = item => { 26937 if (typeof item.title === 'string') { 26938 return item.title; 26939 } 26940 if (item.title && item.title.rendered) { 26941 return item.title.rendered; 26942 } 26943 if (item.title && item.title.raw) { 26944 return item.title.raw; 26945 } 26946 return ''; 26947 }; 26948 const defaultGetDescription = item => { 26949 if (item.type === PATTERN_TYPES.user) { 26950 return item.excerpt.raw; 26951 } 26952 return item.description || ''; 26953 }; 26954 const defaultGetKeywords = item => item.keywords || []; 26955 const defaultHasCategory = () => false; 26956 const removeMatchingTerms = (unmatchedTerms, unprocessedTerms) => { 26957 return unmatchedTerms.filter(term => !getNormalizedSearchTerms(unprocessedTerms).some(unprocessedTerm => unprocessedTerm.includes(term))); 26958 }; 26959 26960 /** 26961 * Filters an item list given a search term. 26962 * 26963 * @param {Array} items Item list 26964 * @param {string} searchInput Search input. 26965 * @param {Object} config Search Config. 26966 * 26967 * @return {Array} Filtered item list. 26968 */ 26969 const searchItems = (items = [], searchInput = '', config = {}) => { 26970 const normalizedSearchTerms = getNormalizedSearchTerms(searchInput); 26971 26972 // Filter patterns by category: the default category indicates that all patterns will be shown. 26973 const onlyFilterByCategory = config.categoryId !== PATTERN_DEFAULT_CATEGORY && !normalizedSearchTerms.length; 26974 const searchRankConfig = { 26975 ...config, 26976 onlyFilterByCategory 26977 }; 26978 26979 // If we aren't filtering on search terms, matching on category is satisfactory. 26980 // If we are, then we need more than a category match. 26981 const threshold = onlyFilterByCategory ? 0 : 1; 26982 const rankedItems = items.map(item => { 26983 return [item, getItemSearchRank(item, searchInput, searchRankConfig)]; 26984 }).filter(([, rank]) => rank > threshold); 26985 26986 // If we didn't have terms to search on, there's no point sorting. 26987 if (normalizedSearchTerms.length === 0) { 26988 return rankedItems.map(([item]) => item); 26989 } 26990 rankedItems.sort(([, rank1], [, rank2]) => rank2 - rank1); 26991 return rankedItems.map(([item]) => item); 26992 }; 26993 26994 /** 26995 * Get the search rank for a given item and a specific search term. 26996 * The better the match, the higher the rank. 26997 * If the rank equals 0, it should be excluded from the results. 26998 * 26999 * @param {Object} item Item to filter. 27000 * @param {string} searchTerm Search term. 27001 * @param {Object} config Search Config. 27002 * 27003 * @return {number} Search Rank. 27004 */ 27005 function getItemSearchRank(item, searchTerm, config) { 27006 const { 27007 categoryId, 27008 getName = defaultGetName, 27009 getTitle = defaultGetTitle, 27010 getDescription = defaultGetDescription, 27011 getKeywords = defaultGetKeywords, 27012 hasCategory = defaultHasCategory, 27013 onlyFilterByCategory 27014 } = config; 27015 let rank = categoryId === PATTERN_DEFAULT_CATEGORY || categoryId === TEMPLATE_PART_ALL_AREAS_CATEGORY || categoryId === PATTERN_USER_CATEGORY && item.type === PATTERN_TYPES.user || hasCategory(item, categoryId) ? 1 : 0; 27016 27017 // If an item doesn't belong to the current category or we don't have 27018 // search terms to filter by, return the initial rank value. 27019 if (!rank || onlyFilterByCategory) { 27020 return rank; 27021 } 27022 const name = getName(item); 27023 const title = getTitle(item); 27024 const description = getDescription(item); 27025 const keywords = getKeywords(item); 27026 const normalizedSearchInput = normalizeString(searchTerm); 27027 const normalizedTitle = normalizeString(title); 27028 27029 // Prefers exact matches 27030 // Then prefers if the beginning of the title matches the search term 27031 // name, keywords, description matches come later. 27032 if (normalizedSearchInput === normalizedTitle) { 27033 rank += 30; 27034 } else if (normalizedTitle.startsWith(normalizedSearchInput)) { 27035 rank += 20; 27036 } else { 27037 const terms = [name, title, description, ...keywords].join(' '); 27038 const normalizedSearchTerms = extractWords(normalizedSearchInput); 27039 const unmatchedTerms = removeMatchingTerms(normalizedSearchTerms, terms); 27040 if (unmatchedTerms.length === 0) { 27041 rank += 10; 27042 } 27043 } 27044 return rank; 27045 } 27046 27047 ;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/use-patterns.js 27048 /** 27049 * WordPress dependencies 27050 */ 27051 27052 27053 27054 27055 27056 /** 27057 * Internal dependencies 27058 */ 27059 27060 27061 27062 27063 27064 const EMPTY_PATTERN_LIST = []; 27065 const selectTemplateParts = (0,external_wp_data_namespaceObject.createSelector)((select, categoryId, search = '') => { 27066 var _getEntityRecords; 27067 const { 27068 getEntityRecords, 27069 getCurrentTheme, 27070 isResolving: isResolvingSelector 27071 } = select(external_wp_coreData_namespaceObject.store); 27072 const query = { 27073 per_page: -1 27074 }; 27075 const templateParts = (_getEntityRecords = getEntityRecords('postType', TEMPLATE_PART_POST_TYPE, query)) !== null && _getEntityRecords !== void 0 ? _getEntityRecords : EMPTY_PATTERN_LIST; 27076 27077 // In the case where a custom template part area has been removed we need 27078 // the current list of areas to cross check against so orphaned template 27079 // parts can be treated as uncategorized. 27080 const knownAreas = getCurrentTheme()?.default_template_part_areas || []; 27081 const templatePartAreas = knownAreas.map(area => area.area); 27082 const templatePartHasCategory = (item, category) => { 27083 if (category !== TEMPLATE_PART_AREA_DEFAULT_CATEGORY) { 27084 return item.area === category; 27085 } 27086 return item.area === category || !templatePartAreas.includes(item.area); 27087 }; 27088 const isResolving = isResolvingSelector('getEntityRecords', ['postType', TEMPLATE_PART_POST_TYPE, query]); 27089 const patterns = searchItems(templateParts, search, { 27090 categoryId, 27091 hasCategory: templatePartHasCategory 27092 }); 27093 return { 27094 patterns, 27095 isResolving 27096 }; 27097 }, select => [select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', TEMPLATE_PART_POST_TYPE, { 27098 per_page: -1 27099 }), select(external_wp_coreData_namespaceObject.store).isResolving('getEntityRecords', ['postType', TEMPLATE_PART_POST_TYPE, { 27100 per_page: -1 27101 }]), select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.default_template_part_areas]); 27102 const selectThemePatterns = (0,external_wp_data_namespaceObject.createSelector)(select => { 27103 var _settings$__experimen; 27104 const { 27105 getSettings 27106 } = unlock(select(store)); 27107 const { 27108 isResolving: isResolvingSelector 27109 } = select(external_wp_coreData_namespaceObject.store); 27110 const settings = getSettings(); 27111 const blockPatterns = (_settings$__experimen = settings.__experimentalAdditionalBlockPatterns) !== null && _settings$__experimen !== void 0 ? _settings$__experimen : settings.__experimentalBlockPatterns; 27112 const restBlockPatterns = select(external_wp_coreData_namespaceObject.store).getBlockPatterns(); 27113 const patterns = [...(blockPatterns || []), ...(restBlockPatterns || [])].filter(pattern => !EXCLUDED_PATTERN_SOURCES.includes(pattern.source)).filter(filterOutDuplicatesByName).filter(pattern => pattern.inserter !== false).map(pattern => ({ 27114 ...pattern, 27115 keywords: pattern.keywords || [], 27116 type: PATTERN_TYPES.theme, 27117 blocks: (0,external_wp_blocks_namespaceObject.parse)(pattern.content, { 27118 __unstableSkipMigrationLogs: true 27119 }) 27120 })); 27121 return { 27122 patterns, 27123 isResolving: isResolvingSelector('getBlockPatterns') 27124 }; 27125 }, select => [select(external_wp_coreData_namespaceObject.store).getBlockPatterns(), select(external_wp_coreData_namespaceObject.store).isResolving('getBlockPatterns'), unlock(select(store)).getSettings()]); 27126 const selectPatterns = (0,external_wp_data_namespaceObject.createSelector)((select, categoryId, syncStatus, search = '') => { 27127 const { 27128 patterns: themePatterns, 27129 isResolving: isResolvingThemePatterns 27130 } = selectThemePatterns(select); 27131 const { 27132 patterns: userPatterns, 27133 isResolving: isResolvingUserPatterns, 27134 categories: userPatternCategories 27135 } = selectUserPatterns(select); 27136 let patterns = [...(themePatterns || []), ...(userPatterns || [])]; 27137 if (syncStatus) { 27138 // User patterns can have their sync statuses checked directly 27139 // Non-user patterns are all unsynced for the time being. 27140 patterns = patterns.filter(pattern => { 27141 return pattern.type === PATTERN_TYPES.user ? (pattern.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full) === syncStatus : syncStatus === PATTERN_SYNC_TYPES.unsynced; 27142 }); 27143 } 27144 if (categoryId) { 27145 patterns = searchItems(patterns, search, { 27146 categoryId, 27147 hasCategory: (item, currentCategory) => { 27148 if (item.type === PATTERN_TYPES.user) { 27149 return item.wp_pattern_category?.some(catId => userPatternCategories.find(cat => cat.id === catId)?.slug === currentCategory); 27150 } 27151 return item.categories?.includes(currentCategory); 27152 } 27153 }); 27154 } else { 27155 patterns = searchItems(patterns, search, { 27156 hasCategory: item => { 27157 if (item.type === PATTERN_TYPES.user) { 27158 return userPatternCategories?.length && (!item.wp_pattern_category?.length || !item.wp_pattern_category?.some(catId => userPatternCategories.find(cat => cat.id === catId))); 27159 } 27160 return !item.hasOwnProperty('categories'); 27161 } 27162 }); 27163 } 27164 return { 27165 patterns, 27166 isResolving: isResolvingThemePatterns || isResolvingUserPatterns 27167 }; 27168 }, select => [selectThemePatterns(select), selectUserPatterns(select)]); 27169 const selectUserPatterns = (0,external_wp_data_namespaceObject.createSelector)((select, syncStatus, search = '') => { 27170 const { 27171 getEntityRecords, 27172 isResolving: isResolvingSelector, 27173 getUserPatternCategories 27174 } = select(external_wp_coreData_namespaceObject.store); 27175 const query = { 27176 per_page: -1 27177 }; 27178 const patternPosts = getEntityRecords('postType', PATTERN_TYPES.user, query); 27179 const userPatternCategories = getUserPatternCategories(); 27180 const categories = new Map(); 27181 userPatternCategories.forEach(userCategory => categories.set(userCategory.id, userCategory)); 27182 let patterns = patternPosts !== null && patternPosts !== void 0 ? patternPosts : EMPTY_PATTERN_LIST; 27183 const isResolving = isResolvingSelector('getEntityRecords', ['postType', PATTERN_TYPES.user, query]); 27184 if (syncStatus) { 27185 patterns = patterns.filter(pattern => pattern.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full === syncStatus); 27186 } 27187 patterns = searchItems(patterns, search, { 27188 // We exit user pattern retrieval early if we aren't in the 27189 // catch-all category for user created patterns, so it has 27190 // to be in the category. 27191 hasCategory: () => true 27192 }); 27193 return { 27194 patterns, 27195 isResolving, 27196 categories: userPatternCategories 27197 }; 27198 }, select => [select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', PATTERN_TYPES.user, { 27199 per_page: -1 27200 }), select(external_wp_coreData_namespaceObject.store).isResolving('getEntityRecords', ['postType', PATTERN_TYPES.user, { 27201 per_page: -1 27202 }]), select(external_wp_coreData_namespaceObject.store).getUserPatternCategories()]); 27203 function useAugmentPatternsWithPermissions(patterns) { 27204 const idsAndTypes = (0,external_wp_element_namespaceObject.useMemo)(() => { 27205 var _patterns$filter$map; 27206 return (_patterns$filter$map = patterns?.filter(record => record.type !== PATTERN_TYPES.theme).map(record => [record.type, record.id])) !== null && _patterns$filter$map !== void 0 ? _patterns$filter$map : []; 27207 }, [patterns]); 27208 const permissions = (0,external_wp_data_namespaceObject.useSelect)(select => { 27209 const { 27210 getEntityRecordPermissions 27211 } = unlock(select(external_wp_coreData_namespaceObject.store)); 27212 return idsAndTypes.reduce((acc, [type, id]) => { 27213 acc[id] = getEntityRecordPermissions('postType', type, id); 27214 return acc; 27215 }, {}); 27216 }, [idsAndTypes]); 27217 return (0,external_wp_element_namespaceObject.useMemo)(() => { 27218 var _patterns$map; 27219 return (_patterns$map = patterns?.map(record => { 27220 var _permissions$record$i; 27221 return { 27222 ...record, 27223 permissions: (_permissions$record$i = permissions?.[record.id]) !== null && _permissions$record$i !== void 0 ? _permissions$record$i : {} 27224 }; 27225 })) !== null && _patterns$map !== void 0 ? _patterns$map : []; 27226 }, [patterns, permissions]); 27227 } 27228 const usePatterns = (postType, categoryId, { 27229 search = '', 27230 syncStatus 27231 } = {}) => { 27232 return (0,external_wp_data_namespaceObject.useSelect)(select => { 27233 if (postType === TEMPLATE_PART_POST_TYPE) { 27234 return selectTemplateParts(select, categoryId, search); 27235 } else if (postType === PATTERN_TYPES.user && !!categoryId) { 27236 const appliedCategory = categoryId === 'uncategorized' ? '' : categoryId; 27237 return selectPatterns(select, appliedCategory, syncStatus, search); 27238 } else if (postType === PATTERN_TYPES.user) { 27239 return selectUserPatterns(select, syncStatus, search); 27240 } 27241 return { 27242 patterns: EMPTY_PATTERN_LIST, 27243 isResolving: false 27244 }; 27245 }, [categoryId, postType, search, syncStatus]); 27246 }; 27247 /* harmony default export */ const use_patterns = (usePatterns); 27248 27249 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js 27250 /** 27251 * WordPress dependencies 27252 */ 27253 27254 27255 27256 /** 27257 * Internal dependencies 27258 */ 27259 27260 27261 27262 27263 function usePatternCategories() { 27264 const defaultCategories = useDefaultPatternCategories(); 27265 defaultCategories.push({ 27266 name: TEMPLATE_PART_AREA_DEFAULT_CATEGORY, 27267 label: (0,external_wp_i18n_namespaceObject.__)('Uncategorized') 27268 }); 27269 const themePatterns = useThemePatterns(); 27270 const { 27271 patterns: userPatterns, 27272 categories: userPatternCategories 27273 } = use_patterns(PATTERN_TYPES.user); 27274 const patternCategories = (0,external_wp_element_namespaceObject.useMemo)(() => { 27275 const categoryMap = {}; 27276 const categoriesWithCounts = []; 27277 27278 // Create a map for easier counting of patterns in categories. 27279 defaultCategories.forEach(category => { 27280 if (!categoryMap[category.name]) { 27281 categoryMap[category.name] = { 27282 ...category, 27283 count: 0 27284 }; 27285 } 27286 }); 27287 userPatternCategories.forEach(category => { 27288 if (!categoryMap[category.name]) { 27289 categoryMap[category.name] = { 27290 ...category, 27291 count: 0 27292 }; 27293 } 27294 }); 27295 27296 // Update the category counts to reflect theme registered patterns. 27297 themePatterns.forEach(pattern => { 27298 pattern.categories?.forEach(category => { 27299 if (categoryMap[category]) { 27300 categoryMap[category].count += 1; 27301 } 27302 }); 27303 // If the pattern has no categories, add it to uncategorized. 27304 if (!pattern.categories?.length) { 27305 categoryMap.uncategorized.count += 1; 27306 } 27307 }); 27308 27309 // Update the category counts to reflect user registered patterns. 27310 userPatterns.forEach(pattern => { 27311 pattern.wp_pattern_category?.forEach(catId => { 27312 const category = userPatternCategories.find(cat => cat.id === catId)?.name; 27313 if (categoryMap[category]) { 27314 categoryMap[category].count += 1; 27315 } 27316 }); 27317 // If the pattern has no categories, add it to uncategorized. 27318 if (!pattern.wp_pattern_category?.length || !pattern.wp_pattern_category?.some(catId => userPatternCategories.find(cat => cat.id === catId))) { 27319 categoryMap.uncategorized.count += 1; 27320 } 27321 }); 27322 27323 // Filter categories so we only have those containing patterns. 27324 [...defaultCategories, ...userPatternCategories].forEach(category => { 27325 if (categoryMap[category.name].count && !categoriesWithCounts.find(cat => cat.name === category.name)) { 27326 categoriesWithCounts.push(categoryMap[category.name]); 27327 } 27328 }); 27329 const sortedCategories = categoriesWithCounts.sort((a, b) => a.label.localeCompare(b.label)); 27330 sortedCategories.unshift({ 27331 name: PATTERN_USER_CATEGORY, 27332 label: (0,external_wp_i18n_namespaceObject.__)('My patterns'), 27333 count: userPatterns.length 27334 }); 27335 sortedCategories.unshift({ 27336 name: PATTERN_DEFAULT_CATEGORY, 27337 label: (0,external_wp_i18n_namespaceObject.__)('All patterns'), 27338 description: (0,external_wp_i18n_namespaceObject.__)('A list of all patterns from all sources.'), 27339 count: themePatterns.length + userPatterns.length 27340 }); 27341 return sortedCategories; 27342 }, [defaultCategories, themePatterns, userPatternCategories, userPatterns]); 27343 return { 27344 patternCategories, 27345 hasPatterns: !!patternCategories.length 27346 }; 27347 } 27348 27349 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js 27350 /** 27351 * WordPress dependencies 27352 */ 27353 27354 27355 27356 /** 27357 * Internal dependencies 27358 */ 27359 27360 const useTemplatePartsGroupedByArea = items => { 27361 const allItems = items || []; 27362 const templatePartAreas = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.default_template_part_areas || [], []); 27363 27364 // Create map of template areas ensuring that default areas are displayed before 27365 // any custom registered template part areas. 27366 const knownAreas = { 27367 header: {}, 27368 footer: {}, 27369 sidebar: {}, 27370 uncategorized: {} 27371 }; 27372 templatePartAreas.forEach(templatePartArea => knownAreas[templatePartArea.area] = { 27373 ...templatePartArea, 27374 templateParts: [] 27375 }); 27376 const groupedByArea = allItems.reduce((accumulator, item) => { 27377 const key = accumulator[item.area] ? item.area : TEMPLATE_PART_AREA_DEFAULT_CATEGORY; 27378 accumulator[key]?.templateParts?.push(item); 27379 return accumulator; 27380 }, knownAreas); 27381 return groupedByArea; 27382 }; 27383 function useTemplatePartAreas() { 27384 const { 27385 records: templateParts, 27386 isResolving: isLoading 27387 } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', TEMPLATE_PART_POST_TYPE, { 27388 per_page: -1 27389 }); 27390 return { 27391 hasTemplateParts: templateParts ? !!templateParts.length : false, 27392 isLoading, 27393 templatePartAreas: useTemplatePartsGroupedByArea(templateParts) 27394 }; 27395 } 27396 27397 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/index.js 27398 /** 27399 * WordPress dependencies 27400 */ 27401 27402 27403 27404 27405 27406 27407 /** 27408 * Internal dependencies 27409 */ 27410 27411 27412 27413 27414 27415 27416 27417 const { 27418 useLocation: sidebar_navigation_screen_patterns_useLocation 27419 } = unlock(external_wp_router_namespaceObject.privateApis); 27420 function CategoriesGroup({ 27421 templatePartAreas, 27422 patternCategories, 27423 currentCategory, 27424 currentType 27425 }) { 27426 const [allPatterns, ...otherPatterns] = patternCategories; 27427 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { 27428 className: "edit-site-sidebar-navigation-screen-patterns__group", 27429 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CategoryItem, { 27430 count: Object.values(templatePartAreas).map(({ 27431 templateParts 27432 }) => templateParts?.length || 0).reduce((acc, val) => acc + val, 0), 27433 icon: (0,external_wp_editor_namespaceObject.getTemplatePartIcon)() /* no name, so it provides the fallback icon */, 27434 label: (0,external_wp_i18n_namespaceObject.__)('All template parts'), 27435 id: TEMPLATE_PART_ALL_AREAS_CATEGORY, 27436 type: TEMPLATE_PART_POST_TYPE, 27437 isActive: currentCategory === TEMPLATE_PART_ALL_AREAS_CATEGORY && currentType === TEMPLATE_PART_POST_TYPE 27438 }, "all"), Object.entries(templatePartAreas).map(([area, { 27439 label, 27440 templateParts 27441 }]) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CategoryItem, { 27442 count: templateParts?.length, 27443 icon: (0,external_wp_editor_namespaceObject.getTemplatePartIcon)(area), 27444 label: label, 27445 id: area, 27446 type: TEMPLATE_PART_POST_TYPE, 27447 isActive: currentCategory === area && currentType === TEMPLATE_PART_POST_TYPE 27448 }, area)), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 27449 className: "edit-site-sidebar-navigation-screen-patterns__divider" 27450 }), allPatterns && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CategoryItem, { 27451 count: allPatterns.count, 27452 label: allPatterns.label, 27453 icon: library_file, 27454 id: allPatterns.name, 27455 type: PATTERN_TYPES.user, 27456 isActive: currentCategory === `$allPatterns.name}` && currentType === PATTERN_TYPES.user 27457 }, allPatterns.name), otherPatterns.map(category => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CategoryItem, { 27458 count: category.count, 27459 label: category.label, 27460 icon: library_file, 27461 id: category.name, 27462 type: PATTERN_TYPES.user, 27463 isActive: currentCategory === `$category.name}` && currentType === PATTERN_TYPES.user 27464 }, category.name))] 27465 }); 27466 } 27467 function SidebarNavigationScreenPatterns({ 27468 backPath 27469 }) { 27470 const { 27471 query: { 27472 postType = 'wp_block', 27473 categoryId 27474 } 27475 } = sidebar_navigation_screen_patterns_useLocation(); 27476 const currentCategory = categoryId || (postType === PATTERN_TYPES.user ? PATTERN_DEFAULT_CATEGORY : TEMPLATE_PART_ALL_AREAS_CATEGORY); 27477 const { 27478 templatePartAreas, 27479 hasTemplateParts, 27480 isLoading 27481 } = useTemplatePartAreas(); 27482 const { 27483 patternCategories, 27484 hasPatterns 27485 } = usePatternCategories(); 27486 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { 27487 title: (0,external_wp_i18n_namespaceObject.__)('Patterns'), 27488 description: (0,external_wp_i18n_namespaceObject.__)('Manage what patterns are available when editing the site.'), 27489 isRoot: !backPath, 27490 backPath: backPath, 27491 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 27492 children: [isLoading && (0,external_wp_i18n_namespaceObject.__)('Loading items…'), !isLoading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 27493 children: [!hasTemplateParts && !hasPatterns && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 27494 className: "edit-site-sidebar-navigation-screen-patterns__group", 27495 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItem, { 27496 children: (0,external_wp_i18n_namespaceObject.__)('No items found') 27497 }) 27498 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CategoriesGroup, { 27499 templatePartAreas: templatePartAreas, 27500 patternCategories: patternCategories, 27501 currentCategory: currentCategory, 27502 currentType: postType 27503 })] 27504 })] 27505 }) 27506 }); 27507 } 27508 27509 // EXTERNAL MODULE: ./node_modules/remove-accents/index.js 27510 var remove_accents = __webpack_require__(9681); 27511 var remove_accents_default = /*#__PURE__*/__webpack_require__.n(remove_accents); 27512 ;// ./node_modules/@wordpress/icons/build-module/library/arrow-up.js 27513 /** 27514 * WordPress dependencies 27515 */ 27516 27517 27518 const arrowUp = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 27519 xmlns: "http://www.w3.org/2000/svg", 27520 viewBox: "0 0 24 24", 27521 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 27522 d: "M12 3.9 6.5 9.5l1 1 3.8-3.7V20h1.5V6.8l3.7 3.7 1-1z" 27523 }) 27524 }); 27525 /* harmony default export */ const arrow_up = (arrowUp); 27526 27527 ;// ./node_modules/@wordpress/icons/build-module/library/arrow-down.js 27528 /** 27529 * WordPress dependencies 27530 */ 27531 27532 27533 const arrowDown = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 27534 xmlns: "http://www.w3.org/2000/svg", 27535 viewBox: "0 0 24 24", 27536 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 27537 d: "m16.5 13.5-3.7 3.7V4h-1.5v13.2l-3.8-3.7-1 1 5.5 5.6 5.5-5.6z" 27538 }) 27539 }); 27540 /* harmony default export */ const arrow_down = (arrowDown); 27541 27542 ;// ./node_modules/@wordpress/dataviews/build-module/constants.js 27543 /** 27544 * WordPress dependencies 27545 */ 27546 27547 27548 27549 /** 27550 * Internal dependencies 27551 */ 27552 27553 // Filter operators. 27554 const constants_OPERATOR_IS = 'is'; 27555 const constants_OPERATOR_IS_NOT = 'isNot'; 27556 const constants_OPERATOR_IS_ANY = 'isAny'; 27557 const constants_OPERATOR_IS_NONE = 'isNone'; 27558 const OPERATOR_IS_ALL = 'isAll'; 27559 const OPERATOR_IS_NOT_ALL = 'isNotAll'; 27560 const ALL_OPERATORS = [constants_OPERATOR_IS, constants_OPERATOR_IS_NOT, constants_OPERATOR_IS_ANY, constants_OPERATOR_IS_NONE, OPERATOR_IS_ALL, OPERATOR_IS_NOT_ALL]; 27561 const OPERATORS = { 27562 [constants_OPERATOR_IS]: { 27563 key: 'is-filter', 27564 label: (0,external_wp_i18n_namespaceObject.__)('Is') 27565 }, 27566 [constants_OPERATOR_IS_NOT]: { 27567 key: 'is-not-filter', 27568 label: (0,external_wp_i18n_namespaceObject.__)('Is not') 27569 }, 27570 [constants_OPERATOR_IS_ANY]: { 27571 key: 'is-any-filter', 27572 label: (0,external_wp_i18n_namespaceObject.__)('Is any') 27573 }, 27574 [constants_OPERATOR_IS_NONE]: { 27575 key: 'is-none-filter', 27576 label: (0,external_wp_i18n_namespaceObject.__)('Is none') 27577 }, 27578 [OPERATOR_IS_ALL]: { 27579 key: 'is-all-filter', 27580 label: (0,external_wp_i18n_namespaceObject.__)('Is all') 27581 }, 27582 [OPERATOR_IS_NOT_ALL]: { 27583 key: 'is-not-all-filter', 27584 label: (0,external_wp_i18n_namespaceObject.__)('Is not all') 27585 } 27586 }; 27587 const SORTING_DIRECTIONS = ['asc', 'desc']; 27588 const sortArrows = { 27589 asc: '↑', 27590 desc: '↓' 27591 }; 27592 const sortValues = { 27593 asc: 'ascending', 27594 desc: 'descending' 27595 }; 27596 const sortLabels = { 27597 asc: (0,external_wp_i18n_namespaceObject.__)('Sort ascending'), 27598 desc: (0,external_wp_i18n_namespaceObject.__)('Sort descending') 27599 }; 27600 const sortIcons = { 27601 asc: arrow_up, 27602 desc: arrow_down 27603 }; 27604 27605 // View layouts. 27606 const constants_LAYOUT_TABLE = 'table'; 27607 const constants_LAYOUT_GRID = 'grid'; 27608 const constants_LAYOUT_LIST = 'list'; 27609 27610 ;// ./node_modules/@wordpress/dataviews/build-module/field-types/integer.js 27611 /** 27612 * Internal dependencies 27613 */ 27614 27615 function sort(a, b, direction) { 27616 return direction === 'asc' ? a - b : b - a; 27617 } 27618 function isValid(value, context) { 27619 // TODO: this implicitly means the value is required. 27620 if (value === '') { 27621 return false; 27622 } 27623 if (!Number.isInteger(Number(value))) { 27624 return false; 27625 } 27626 if (context?.elements) { 27627 const validValues = context?.elements.map(f => f.value); 27628 if (!validValues.includes(Number(value))) { 27629 return false; 27630 } 27631 } 27632 return true; 27633 } 27634 /* harmony default export */ const integer = ({ 27635 sort, 27636 isValid, 27637 Edit: 'integer' 27638 }); 27639 27640 ;// ./node_modules/@wordpress/dataviews/build-module/field-types/text.js 27641 /** 27642 * Internal dependencies 27643 */ 27644 27645 function text_sort(valueA, valueB, direction) { 27646 return direction === 'asc' ? valueA.localeCompare(valueB) : valueB.localeCompare(valueA); 27647 } 27648 function text_isValid(value, context) { 27649 if (context?.elements) { 27650 const validValues = context?.elements?.map(f => f.value); 27651 if (!validValues.includes(value)) { 27652 return false; 27653 } 27654 } 27655 return true; 27656 } 27657 /* harmony default export */ const field_types_text = ({ 27658 sort: text_sort, 27659 isValid: text_isValid, 27660 Edit: 'text' 27661 }); 27662 27663 ;// ./node_modules/@wordpress/dataviews/build-module/field-types/datetime.js 27664 /** 27665 * Internal dependencies 27666 */ 27667 27668 function datetime_sort(a, b, direction) { 27669 const timeA = new Date(a).getTime(); 27670 const timeB = new Date(b).getTime(); 27671 return direction === 'asc' ? timeA - timeB : timeB - timeA; 27672 } 27673 function datetime_isValid(value, context) { 27674 if (context?.elements) { 27675 const validValues = context?.elements.map(f => f.value); 27676 if (!validValues.includes(value)) { 27677 return false; 27678 } 27679 } 27680 return true; 27681 } 27682 /* harmony default export */ const datetime = ({ 27683 sort: datetime_sort, 27684 isValid: datetime_isValid, 27685 Edit: 'datetime' 27686 }); 27687 27688 ;// ./node_modules/@wordpress/dataviews/build-module/field-types/index.js 27689 /** 27690 * Internal dependencies 27691 */ 27692 27693 27694 27695 27696 27697 /** 27698 * 27699 * @param {FieldType} type The field type definition to get. 27700 * 27701 * @return A field type definition. 27702 */ 27703 function getFieldTypeDefinition(type) { 27704 if ('integer' === type) { 27705 return integer; 27706 } 27707 if ('text' === type) { 27708 return field_types_text; 27709 } 27710 if ('datetime' === type) { 27711 return datetime; 27712 } 27713 return { 27714 sort: (a, b, direction) => { 27715 if (typeof a === 'number' && typeof b === 'number') { 27716 return direction === 'asc' ? a - b : b - a; 27717 } 27718 return direction === 'asc' ? a.localeCompare(b) : b.localeCompare(a); 27719 }, 27720 isValid: (value, context) => { 27721 if (context?.elements) { 27722 const validValues = context?.elements?.map(f => f.value); 27723 if (!validValues.includes(value)) { 27724 return false; 27725 } 27726 } 27727 return true; 27728 }, 27729 Edit: () => null 27730 }; 27731 } 27732 27733 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/datetime.js 27734 /** 27735 * WordPress dependencies 27736 */ 27737 27738 27739 27740 /** 27741 * Internal dependencies 27742 */ 27743 27744 function DateTime({ 27745 data, 27746 field, 27747 onChange, 27748 hideLabelFromVision 27749 }) { 27750 const { 27751 id, 27752 label 27753 } = field; 27754 const value = field.getValue({ 27755 item: data 27756 }); 27757 const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ 27758 [id]: newValue 27759 }), [id, onChange]); 27760 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { 27761 className: "dataviews-controls__datetime", 27762 children: [!hideLabelFromVision && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { 27763 as: "legend", 27764 children: label 27765 }), hideLabelFromVision && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { 27766 as: "legend", 27767 children: label 27768 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TimePicker, { 27769 currentTime: value, 27770 onChange: onChangeControl, 27771 hideLabelFromVision: true 27772 })] 27773 }); 27774 } 27775 27776 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/integer.js 27777 /** 27778 * WordPress dependencies 27779 */ 27780 27781 27782 27783 /** 27784 * Internal dependencies 27785 */ 27786 27787 function Integer({ 27788 data, 27789 field, 27790 onChange, 27791 hideLabelFromVision 27792 }) { 27793 var _field$getValue; 27794 const { 27795 id, 27796 label, 27797 description 27798 } = field; 27799 const value = (_field$getValue = field.getValue({ 27800 item: data 27801 })) !== null && _field$getValue !== void 0 ? _field$getValue : ''; 27802 const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ 27803 [id]: Number(newValue) 27804 }), [id, onChange]); 27805 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNumberControl, { 27806 label: label, 27807 help: description, 27808 value: value, 27809 onChange: onChangeControl, 27810 __next40pxDefaultSize: true, 27811 hideLabelFromVision: hideLabelFromVision 27812 }); 27813 } 27814 27815 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/radio.js 27816 /** 27817 * WordPress dependencies 27818 */ 27819 27820 27821 27822 /** 27823 * Internal dependencies 27824 */ 27825 27826 function Radio({ 27827 data, 27828 field, 27829 onChange, 27830 hideLabelFromVision 27831 }) { 27832 const { 27833 id, 27834 label 27835 } = field; 27836 const value = field.getValue({ 27837 item: data 27838 }); 27839 const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ 27840 [id]: newValue 27841 }), [id, onChange]); 27842 if (field.elements) { 27843 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RadioControl, { 27844 label: label, 27845 onChange: onChangeControl, 27846 options: field.elements, 27847 selected: value, 27848 hideLabelFromVision: hideLabelFromVision 27849 }); 27850 } 27851 return null; 27852 } 27853 27854 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/select.js 27855 /** 27856 * WordPress dependencies 27857 */ 27858 27859 27860 27861 27862 /** 27863 * Internal dependencies 27864 */ 27865 27866 function Select({ 27867 data, 27868 field, 27869 onChange, 27870 hideLabelFromVision 27871 }) { 27872 var _field$getValue, _field$elements; 27873 const { 27874 id, 27875 label 27876 } = field; 27877 const value = (_field$getValue = field.getValue({ 27878 item: data 27879 })) !== null && _field$getValue !== void 0 ? _field$getValue : ''; 27880 const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ 27881 [id]: newValue 27882 }), [id, onChange]); 27883 const elements = [ 27884 /* 27885 * Value can be undefined when: 27886 * 27887 * - the field is not required 27888 * - in bulk editing 27889 * 27890 */ 27891 { 27892 label: (0,external_wp_i18n_namespaceObject.__)('Select item'), 27893 value: '' 27894 }, ...((_field$elements = field?.elements) !== null && _field$elements !== void 0 ? _field$elements : [])]; 27895 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { 27896 label: label, 27897 value: value, 27898 options: elements, 27899 onChange: onChangeControl, 27900 __next40pxDefaultSize: true, 27901 __nextHasNoMarginBottom: true, 27902 hideLabelFromVision: hideLabelFromVision 27903 }); 27904 } 27905 27906 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/text.js 27907 /** 27908 * WordPress dependencies 27909 */ 27910 27911 27912 27913 /** 27914 * Internal dependencies 27915 */ 27916 27917 function Text({ 27918 data, 27919 field, 27920 onChange, 27921 hideLabelFromVision 27922 }) { 27923 const { 27924 id, 27925 label, 27926 placeholder 27927 } = field; 27928 const value = field.getValue({ 27929 item: data 27930 }); 27931 const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ 27932 [id]: newValue 27933 }), [id, onChange]); 27934 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { 27935 label: label, 27936 placeholder: placeholder, 27937 value: value !== null && value !== void 0 ? value : '', 27938 onChange: onChangeControl, 27939 __next40pxDefaultSize: true, 27940 __nextHasNoMarginBottom: true, 27941 hideLabelFromVision: hideLabelFromVision 27942 }); 27943 } 27944 27945 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/index.js 27946 /** 27947 * External dependencies 27948 */ 27949 27950 /** 27951 * Internal dependencies 27952 */ 27953 27954 27955 27956 27957 27958 27959 const FORM_CONTROLS = { 27960 datetime: DateTime, 27961 integer: Integer, 27962 radio: Radio, 27963 select: Select, 27964 text: Text 27965 }; 27966 function getControl(field, fieldTypeDefinition) { 27967 if (typeof field.Edit === 'function') { 27968 return field.Edit; 27969 } 27970 if (typeof field.Edit === 'string') { 27971 return getControlByType(field.Edit); 27972 } 27973 if (field.elements) { 27974 return getControlByType('select'); 27975 } 27976 if (typeof fieldTypeDefinition.Edit === 'string') { 27977 return getControlByType(fieldTypeDefinition.Edit); 27978 } 27979 return fieldTypeDefinition.Edit; 27980 } 27981 function getControlByType(type) { 27982 if (Object.keys(FORM_CONTROLS).includes(type)) { 27983 return FORM_CONTROLS[type]; 27984 } 27985 throw 'Control ' + type + ' not found'; 27986 } 27987 27988 ;// ./node_modules/@wordpress/dataviews/build-module/normalize-fields.js 27989 /** 27990 * Internal dependencies 27991 */ 27992 27993 27994 const getValueFromId = id => ({ 27995 item 27996 }) => { 27997 const path = id.split('.'); 27998 let value = item; 27999 for (const segment of path) { 28000 if (value.hasOwnProperty(segment)) { 28001 value = value[segment]; 28002 } else { 28003 value = undefined; 28004 } 28005 } 28006 return value; 28007 }; 28008 28009 /** 28010 * Apply default values and normalize the fields config. 28011 * 28012 * @param fields Fields config. 28013 * @return Normalized fields config. 28014 */ 28015 function normalizeFields(fields) { 28016 return fields.map(field => { 28017 var _field$sort, _field$isValid, _field$enableHiding, _field$enableSorting; 28018 const fieldTypeDefinition = getFieldTypeDefinition(field.type); 28019 const getValue = field.getValue || getValueFromId(field.id); 28020 const sort = (_field$sort = field.sort) !== null && _field$sort !== void 0 ? _field$sort : function sort(a, b, direction) { 28021 return fieldTypeDefinition.sort(getValue({ 28022 item: a 28023 }), getValue({ 28024 item: b 28025 }), direction); 28026 }; 28027 const isValid = (_field$isValid = field.isValid) !== null && _field$isValid !== void 0 ? _field$isValid : function isValid(item, context) { 28028 return fieldTypeDefinition.isValid(getValue({ 28029 item 28030 }), context); 28031 }; 28032 const Edit = getControl(field, fieldTypeDefinition); 28033 const renderFromElements = ({ 28034 item 28035 }) => { 28036 const value = getValue({ 28037 item 28038 }); 28039 return field?.elements?.find(element => element.value === value)?.label || getValue({ 28040 item 28041 }); 28042 }; 28043 const render = field.render || (field.elements ? renderFromElements : getValue); 28044 return { 28045 ...field, 28046 label: field.label || field.id, 28047 header: field.header || field.label || field.id, 28048 getValue, 28049 render, 28050 sort, 28051 isValid, 28052 Edit, 28053 enableHiding: (_field$enableHiding = field.enableHiding) !== null && _field$enableHiding !== void 0 ? _field$enableHiding : true, 28054 enableSorting: (_field$enableSorting = field.enableSorting) !== null && _field$enableSorting !== void 0 ? _field$enableSorting : true 28055 }; 28056 }); 28057 } 28058 28059 ;// ./node_modules/@wordpress/dataviews/build-module/filter-and-sort-data-view.js 28060 /** 28061 * External dependencies 28062 */ 28063 28064 28065 /** 28066 * Internal dependencies 28067 */ 28068 28069 28070 function normalizeSearchInput(input = '') { 28071 return remove_accents_default()(input.trim().toLowerCase()); 28072 } 28073 const filter_and_sort_data_view_EMPTY_ARRAY = []; 28074 28075 /** 28076 * Applies the filtering, sorting and pagination to the raw data based on the view configuration. 28077 * 28078 * @param data Raw data. 28079 * @param view View config. 28080 * @param fields Fields config. 28081 * 28082 * @return Filtered, sorted and paginated data. 28083 */ 28084 function filterSortAndPaginate(data, view, fields) { 28085 if (!data) { 28086 return { 28087 data: filter_and_sort_data_view_EMPTY_ARRAY, 28088 paginationInfo: { 28089 totalItems: 0, 28090 totalPages: 0 28091 } 28092 }; 28093 } 28094 const _fields = normalizeFields(fields); 28095 let filteredData = [...data]; 28096 // Handle global search. 28097 if (view.search) { 28098 const normalizedSearch = normalizeSearchInput(view.search); 28099 filteredData = filteredData.filter(item => { 28100 return _fields.filter(field => field.enableGlobalSearch).map(field => { 28101 return normalizeSearchInput(field.getValue({ 28102 item 28103 })); 28104 }).some(field => field.includes(normalizedSearch)); 28105 }); 28106 } 28107 if (view.filters && view.filters?.length > 0) { 28108 view.filters.forEach(filter => { 28109 const field = _fields.find(_field => _field.id === filter.field); 28110 if (field) { 28111 if (filter.operator === constants_OPERATOR_IS_ANY && filter?.value?.length > 0) { 28112 filteredData = filteredData.filter(item => { 28113 const fieldValue = field.getValue({ 28114 item 28115 }); 28116 if (Array.isArray(fieldValue)) { 28117 return filter.value.some(filterValue => fieldValue.includes(filterValue)); 28118 } else if (typeof fieldValue === 'string') { 28119 return filter.value.includes(fieldValue); 28120 } 28121 return false; 28122 }); 28123 } else if (filter.operator === constants_OPERATOR_IS_NONE && filter?.value?.length > 0) { 28124 filteredData = filteredData.filter(item => { 28125 const fieldValue = field.getValue({ 28126 item 28127 }); 28128 if (Array.isArray(fieldValue)) { 28129 return !filter.value.some(filterValue => fieldValue.includes(filterValue)); 28130 } else if (typeof fieldValue === 'string') { 28131 return !filter.value.includes(fieldValue); 28132 } 28133 return false; 28134 }); 28135 } else if (filter.operator === OPERATOR_IS_ALL && filter?.value?.length > 0) { 28136 filteredData = filteredData.filter(item => { 28137 return filter.value.every(value => { 28138 return field.getValue({ 28139 item 28140 })?.includes(value); 28141 }); 28142 }); 28143 } else if (filter.operator === OPERATOR_IS_NOT_ALL && filter?.value?.length > 0) { 28144 filteredData = filteredData.filter(item => { 28145 return filter.value.every(value => { 28146 return !field.getValue({ 28147 item 28148 })?.includes(value); 28149 }); 28150 }); 28151 } else if (filter.operator === constants_OPERATOR_IS) { 28152 filteredData = filteredData.filter(item => { 28153 return filter.value === field.getValue({ 28154 item 28155 }); 28156 }); 28157 } else if (filter.operator === constants_OPERATOR_IS_NOT) { 28158 filteredData = filteredData.filter(item => { 28159 return filter.value !== field.getValue({ 28160 item 28161 }); 28162 }); 28163 } 28164 } 28165 }); 28166 } 28167 28168 // Handle sorting. 28169 if (view.sort) { 28170 const fieldId = view.sort.field; 28171 const fieldToSort = _fields.find(field => { 28172 return field.id === fieldId; 28173 }); 28174 if (fieldToSort) { 28175 filteredData.sort((a, b) => { 28176 var _view$sort$direction; 28177 return fieldToSort.sort(a, b, (_view$sort$direction = view.sort?.direction) !== null && _view$sort$direction !== void 0 ? _view$sort$direction : 'desc'); 28178 }); 28179 } 28180 } 28181 28182 // Handle pagination. 28183 let totalItems = filteredData.length; 28184 let totalPages = 1; 28185 if (view.page !== undefined && view.perPage !== undefined) { 28186 const start = (view.page - 1) * view.perPage; 28187 totalItems = filteredData?.length || 0; 28188 totalPages = Math.ceil(totalItems / view.perPage); 28189 filteredData = filteredData?.slice(start, start + view.perPage); 28190 } 28191 return { 28192 data: filteredData, 28193 paginationInfo: { 28194 totalItems, 28195 totalPages 28196 } 28197 }; 28198 } 28199 28200 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-context/index.js 28201 /** 28202 * WordPress dependencies 28203 */ 28204 28205 28206 /** 28207 * Internal dependencies 28208 */ 28209 28210 28211 const DataViewsContext = (0,external_wp_element_namespaceObject.createContext)({ 28212 view: { 28213 type: constants_LAYOUT_TABLE 28214 }, 28215 onChangeView: () => {}, 28216 fields: [], 28217 data: [], 28218 paginationInfo: { 28219 totalItems: 0, 28220 totalPages: 0 28221 }, 28222 selection: [], 28223 onChangeSelection: () => {}, 28224 setOpenedFilter: () => {}, 28225 openedFilter: null, 28226 getItemId: item => item.id, 28227 isItemClickable: () => true, 28228 containerWidth: 0 28229 }); 28230 /* harmony default export */ const dataviews_context = (DataViewsContext); 28231 28232 ;// ./node_modules/@wordpress/icons/build-module/library/funnel.js 28233 /** 28234 * WordPress dependencies 28235 */ 28236 28237 28238 const funnel = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 28239 viewBox: "0 0 24 24", 28240 xmlns: "http://www.w3.org/2000/svg", 28241 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 28242 d: "M10 17.5H14V16H10V17.5ZM6 6V7.5H18V6H6ZM8 12.5H16V11H8V12.5Z" 28243 }) 28244 }); 28245 /* harmony default export */ const library_funnel = (funnel); 28246 28247 ;// ./node_modules/@ariakit/react-core/esm/__chunks/3YLGPPWQ.js 28248 "use client"; 28249 var __defProp = Object.defineProperty; 28250 var __defProps = Object.defineProperties; 28251 var __getOwnPropDescs = Object.getOwnPropertyDescriptors; 28252 var __getOwnPropSymbols = Object.getOwnPropertySymbols; 28253 var __hasOwnProp = Object.prototype.hasOwnProperty; 28254 var __propIsEnum = Object.prototype.propertyIsEnumerable; 28255 var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; 28256 var _3YLGPPWQ_spreadValues = (a, b) => { 28257 for (var prop in b || (b = {})) 28258 if (__hasOwnProp.call(b, prop)) 28259 __defNormalProp(a, prop, b[prop]); 28260 if (__getOwnPropSymbols) 28261 for (var prop of __getOwnPropSymbols(b)) { 28262 if (__propIsEnum.call(b, prop)) 28263 __defNormalProp(a, prop, b[prop]); 28264 } 28265 return a; 28266 }; 28267 var _3YLGPPWQ_spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); 28268 var __objRest = (source, exclude) => { 28269 var target = {}; 28270 for (var prop in source) 28271 if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0) 28272 target[prop] = source[prop]; 28273 if (source != null && __getOwnPropSymbols) 28274 for (var prop of __getOwnPropSymbols(source)) { 28275 if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop)) 28276 target[prop] = source[prop]; 28277 } 28278 return target; 28279 }; 28280 28281 28282 28283 ;// ./node_modules/@ariakit/core/esm/__chunks/3YLGPPWQ.js 28284 "use client"; 28285 var _3YLGPPWQ_defProp = Object.defineProperty; 28286 var _3YLGPPWQ_defProps = Object.defineProperties; 28287 var _3YLGPPWQ_getOwnPropDescs = Object.getOwnPropertyDescriptors; 28288 var _3YLGPPWQ_getOwnPropSymbols = Object.getOwnPropertySymbols; 28289 var _3YLGPPWQ_hasOwnProp = Object.prototype.hasOwnProperty; 28290 var _3YLGPPWQ_propIsEnum = Object.prototype.propertyIsEnumerable; 28291 var _3YLGPPWQ_defNormalProp = (obj, key, value) => key in obj ? _3YLGPPWQ_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; 28292 var _chunks_3YLGPPWQ_spreadValues = (a, b) => { 28293 for (var prop in b || (b = {})) 28294 if (_3YLGPPWQ_hasOwnProp.call(b, prop)) 28295 _3YLGPPWQ_defNormalProp(a, prop, b[prop]); 28296 if (_3YLGPPWQ_getOwnPropSymbols) 28297 for (var prop of _3YLGPPWQ_getOwnPropSymbols(b)) { 28298 if (_3YLGPPWQ_propIsEnum.call(b, prop)) 28299 _3YLGPPWQ_defNormalProp(a, prop, b[prop]); 28300 } 28301 return a; 28302 }; 28303 var _chunks_3YLGPPWQ_spreadProps = (a, b) => _3YLGPPWQ_defProps(a, _3YLGPPWQ_getOwnPropDescs(b)); 28304 var _3YLGPPWQ_objRest = (source, exclude) => { 28305 var target = {}; 28306 for (var prop in source) 28307 if (_3YLGPPWQ_hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0) 28308 target[prop] = source[prop]; 28309 if (source != null && _3YLGPPWQ_getOwnPropSymbols) 28310 for (var prop of _3YLGPPWQ_getOwnPropSymbols(source)) { 28311 if (exclude.indexOf(prop) < 0 && _3YLGPPWQ_propIsEnum.call(source, prop)) 28312 target[prop] = source[prop]; 28313 } 28314 return target; 28315 }; 28316 28317 28318 28319 ;// ./node_modules/@ariakit/core/esm/__chunks/PBFD2E7P.js 28320 "use client"; 28321 28322 28323 // src/utils/misc.ts 28324 function PBFD2E7P_noop(..._) { 28325 } 28326 function shallowEqual(a, b) { 28327 if (a === b) return true; 28328 if (!a) return false; 28329 if (!b) return false; 28330 if (typeof a !== "object") return false; 28331 if (typeof b !== "object") return false; 28332 const aKeys = Object.keys(a); 28333 const bKeys = Object.keys(b); 28334 const { length } = aKeys; 28335 if (bKeys.length !== length) return false; 28336 for (const key of aKeys) { 28337 if (a[key] !== b[key]) { 28338 return false; 28339 } 28340 } 28341 return true; 28342 } 28343 function applyState(argument, currentValue) { 28344 if (isUpdater(argument)) { 28345 const value = isLazyValue(currentValue) ? currentValue() : currentValue; 28346 return argument(value); 28347 } 28348 return argument; 28349 } 28350 function isUpdater(argument) { 28351 return typeof argument === "function"; 28352 } 28353 function isLazyValue(value) { 28354 return typeof value === "function"; 28355 } 28356 function isObject(arg) { 28357 return typeof arg === "object" && arg != null; 28358 } 28359 function isEmpty(arg) { 28360 if (Array.isArray(arg)) return !arg.length; 28361 if (isObject(arg)) return !Object.keys(arg).length; 28362 if (arg == null) return true; 28363 if (arg === "") return true; 28364 return false; 28365 } 28366 function isInteger(arg) { 28367 if (typeof arg === "number") { 28368 return Math.floor(arg) === arg; 28369 } 28370 return String(Math.floor(Number(arg))) === arg; 28371 } 28372 function PBFD2E7P_hasOwnProperty(object, prop) { 28373 if (typeof Object.hasOwn === "function") { 28374 return Object.hasOwn(object, prop); 28375 } 28376 return Object.prototype.hasOwnProperty.call(object, prop); 28377 } 28378 function chain(...fns) { 28379 return (...args) => { 28380 for (const fn of fns) { 28381 if (typeof fn === "function") { 28382 fn(...args); 28383 } 28384 } 28385 }; 28386 } 28387 function cx(...args) { 28388 return args.filter(Boolean).join(" ") || void 0; 28389 } 28390 function PBFD2E7P_normalizeString(str) { 28391 return str.normalize("NFD").replace(/[\u0300-\u036f]/g, ""); 28392 } 28393 function omit(object, keys) { 28394 const result = _chunks_3YLGPPWQ_spreadValues({}, object); 28395 for (const key of keys) { 28396 if (PBFD2E7P_hasOwnProperty(result, key)) { 28397 delete result[key]; 28398 } 28399 } 28400 return result; 28401 } 28402 function pick(object, paths) { 28403 const result = {}; 28404 for (const key of paths) { 28405 if (PBFD2E7P_hasOwnProperty(object, key)) { 28406 result[key] = object[key]; 28407 } 28408 } 28409 return result; 28410 } 28411 function identity(value) { 28412 return value; 28413 } 28414 function beforePaint(cb = PBFD2E7P_noop) { 28415 const raf = requestAnimationFrame(cb); 28416 return () => cancelAnimationFrame(raf); 28417 } 28418 function afterPaint(cb = PBFD2E7P_noop) { 28419 let raf = requestAnimationFrame(() => { 28420 raf = requestAnimationFrame(cb); 28421 }); 28422 return () => cancelAnimationFrame(raf); 28423 } 28424 function invariant(condition, message) { 28425 if (condition) return; 28426 if (typeof message !== "string") throw new Error("Invariant failed"); 28427 throw new Error(message); 28428 } 28429 function getKeys(obj) { 28430 return Object.keys(obj); 28431 } 28432 function isFalsyBooleanCallback(booleanOrCallback, ...args) { 28433 const result = typeof booleanOrCallback === "function" ? booleanOrCallback(...args) : booleanOrCallback; 28434 if (result == null) return false; 28435 return !result; 28436 } 28437 function disabledFromProps(props) { 28438 return props.disabled || props["aria-disabled"] === true || props["aria-disabled"] === "true"; 28439 } 28440 function removeUndefinedValues(obj) { 28441 const result = {}; 28442 for (const key in obj) { 28443 if (obj[key] !== void 0) { 28444 result[key] = obj[key]; 28445 } 28446 } 28447 return result; 28448 } 28449 function defaultValue(...values) { 28450 for (const value of values) { 28451 if (value !== void 0) return value; 28452 } 28453 return void 0; 28454 } 28455 28456 28457 28458 ;// ./node_modules/@ariakit/react-core/esm/__chunks/SK3NAZA3.js 28459 "use client"; 28460 28461 28462 // src/utils/misc.ts 28463 28464 28465 function setRef(ref, value) { 28466 if (typeof ref === "function") { 28467 ref(value); 28468 } else if (ref) { 28469 ref.current = value; 28470 } 28471 } 28472 function isValidElementWithRef(element) { 28473 if (!element) return false; 28474 if (!(0,external_React_.isValidElement)(element)) return false; 28475 if ("ref" in element.props) return true; 28476 if ("ref" in element) return true; 28477 return false; 28478 } 28479 function getRefProperty(element) { 28480 if (!isValidElementWithRef(element)) return null; 28481 const props = _3YLGPPWQ_spreadValues({}, element.props); 28482 return props.ref || element.ref; 28483 } 28484 function mergeProps(base, overrides) { 28485 const props = _3YLGPPWQ_spreadValues({}, base); 28486 for (const key in overrides) { 28487 if (!PBFD2E7P_hasOwnProperty(overrides, key)) continue; 28488 if (key === "className") { 28489 const prop = "className"; 28490 props[prop] = base[prop] ? `$base[prop]} $overrides[prop]}` : overrides[prop]; 28491 continue; 28492 } 28493 if (key === "style") { 28494 const prop = "style"; 28495 props[prop] = base[prop] ? _3YLGPPWQ_spreadValues(_3YLGPPWQ_spreadValues({}, base[prop]), overrides[prop]) : overrides[prop]; 28496 continue; 28497 } 28498 const overrideValue = overrides[key]; 28499 if (typeof overrideValue === "function" && key.startsWith("on")) { 28500 const baseValue = base[key]; 28501 if (typeof baseValue === "function") { 28502 props[key] = (...args) => { 28503 overrideValue(...args); 28504 baseValue(...args); 28505 }; 28506 continue; 28507 } 28508 } 28509 props[key] = overrideValue; 28510 } 28511 return props; 28512 } 28513 28514 28515 28516 ;// ./node_modules/@ariakit/core/esm/__chunks/DTR5TSDJ.js 28517 "use client"; 28518 28519 // src/utils/dom.ts 28520 var DTR5TSDJ_canUseDOM = checkIsBrowser(); 28521 function checkIsBrowser() { 28522 var _a; 28523 return typeof window !== "undefined" && !!((_a = window.document) == null ? void 0 : _a.createElement); 28524 } 28525 function getDocument(node) { 28526 if (!node) return document; 28527 if ("self" in node) return node.document; 28528 return node.ownerDocument || document; 28529 } 28530 function getWindow(node) { 28531 if (!node) return self; 28532 if ("self" in node) return node.self; 28533 return getDocument(node).defaultView || window; 28534 } 28535 function DTR5TSDJ_getActiveElement(node, activeDescendant = false) { 28536 const { activeElement } = getDocument(node); 28537 if (!(activeElement == null ? void 0 : activeElement.nodeName)) { 28538 return null; 28539 } 28540 if (DTR5TSDJ_isFrame(activeElement) && activeElement.contentDocument) { 28541 return DTR5TSDJ_getActiveElement( 28542 activeElement.contentDocument.body, 28543 activeDescendant 28544 ); 28545 } 28546 if (activeDescendant) { 28547 const id = activeElement.getAttribute("aria-activedescendant"); 28548 if (id) { 28549 const element = getDocument(activeElement).getElementById(id); 28550 if (element) { 28551 return element; 28552 } 28553 } 28554 } 28555 return activeElement; 28556 } 28557 function contains(parent, child) { 28558 return parent === child || parent.contains(child); 28559 } 28560 function DTR5TSDJ_isFrame(element) { 28561 return element.tagName === "IFRAME"; 28562 } 28563 function isButton(element) { 28564 const tagName = element.tagName.toLowerCase(); 28565 if (tagName === "button") return true; 28566 if (tagName === "input" && element.type) { 28567 return buttonInputTypes.indexOf(element.type) !== -1; 28568 } 28569 return false; 28570 } 28571 var buttonInputTypes = [ 28572 "button", 28573 "color", 28574 "file", 28575 "image", 28576 "reset", 28577 "submit" 28578 ]; 28579 function isVisible(element) { 28580 if (typeof element.checkVisibility === "function") { 28581 return element.checkVisibility(); 28582 } 28583 const htmlElement = element; 28584 return htmlElement.offsetWidth > 0 || htmlElement.offsetHeight > 0 || element.getClientRects().length > 0; 28585 } 28586 function isTextField(element) { 28587 try { 28588 const isTextInput = element instanceof HTMLInputElement && element.selectionStart !== null; 28589 const isTextArea = element.tagName === "TEXTAREA"; 28590 return isTextInput || isTextArea || false; 28591 } catch (error) { 28592 return false; 28593 } 28594 } 28595 function isTextbox(element) { 28596 return element.isContentEditable || isTextField(element); 28597 } 28598 function getTextboxValue(element) { 28599 if (isTextField(element)) { 28600 return element.value; 28601 } 28602 if (element.isContentEditable) { 28603 const range = getDocument(element).createRange(); 28604 range.selectNodeContents(element); 28605 return range.toString(); 28606 } 28607 return ""; 28608 } 28609 function getTextboxSelection(element) { 28610 let start = 0; 28611 let end = 0; 28612 if (isTextField(element)) { 28613 start = element.selectionStart || 0; 28614 end = element.selectionEnd || 0; 28615 } else if (element.isContentEditable) { 28616 const selection = getDocument(element).getSelection(); 28617 if ((selection == null ? void 0 : selection.rangeCount) && selection.anchorNode && contains(element, selection.anchorNode) && selection.focusNode && contains(element, selection.focusNode)) { 28618 const range = selection.getRangeAt(0); 28619 const nextRange = range.cloneRange(); 28620 nextRange.selectNodeContents(element); 28621 nextRange.setEnd(range.startContainer, range.startOffset); 28622 start = nextRange.toString().length; 28623 nextRange.setEnd(range.endContainer, range.endOffset); 28624 end = nextRange.toString().length; 28625 } 28626 } 28627 return { start, end }; 28628 } 28629 function getPopupRole(element, fallback) { 28630 const allowedPopupRoles = ["dialog", "menu", "listbox", "tree", "grid"]; 28631 const role = element == null ? void 0 : element.getAttribute("role"); 28632 if (role && allowedPopupRoles.indexOf(role) !== -1) { 28633 return role; 28634 } 28635 return fallback; 28636 } 28637 function getPopupItemRole(element, fallback) { 28638 var _a; 28639 const itemRoleByPopupRole = { 28640 menu: "menuitem", 28641 listbox: "option", 28642 tree: "treeitem" 28643 }; 28644 const popupRole = getPopupRole(element); 28645 if (!popupRole) return fallback; 28646 const key = popupRole; 28647 return (_a = itemRoleByPopupRole[key]) != null ? _a : fallback; 28648 } 28649 function scrollIntoViewIfNeeded(element, arg) { 28650 if (isPartiallyHidden(element) && "scrollIntoView" in element) { 28651 element.scrollIntoView(arg); 28652 } 28653 } 28654 function getScrollingElement(element) { 28655 if (!element) return null; 28656 const isScrollableOverflow = (overflow) => { 28657 if (overflow === "auto") return true; 28658 if (overflow === "scroll") return true; 28659 return false; 28660 }; 28661 if (element.clientHeight && element.scrollHeight > element.clientHeight) { 28662 const { overflowY } = getComputedStyle(element); 28663 if (isScrollableOverflow(overflowY)) return element; 28664 } else if (element.clientWidth && element.scrollWidth > element.clientWidth) { 28665 const { overflowX } = getComputedStyle(element); 28666 if (isScrollableOverflow(overflowX)) return element; 28667 } 28668 return getScrollingElement(element.parentElement) || document.scrollingElement || document.body; 28669 } 28670 function isPartiallyHidden(element) { 28671 const elementRect = element.getBoundingClientRect(); 28672 const scroller = getScrollingElement(element); 28673 if (!scroller) return false; 28674 const scrollerRect = scroller.getBoundingClientRect(); 28675 const isHTML = scroller.tagName === "HTML"; 28676 const scrollerTop = isHTML ? scrollerRect.top + scroller.scrollTop : scrollerRect.top; 28677 const scrollerBottom = isHTML ? scroller.clientHeight : scrollerRect.bottom; 28678 const scrollerLeft = isHTML ? scrollerRect.left + scroller.scrollLeft : scrollerRect.left; 28679 const scrollerRight = isHTML ? scroller.clientWidth : scrollerRect.right; 28680 const top = elementRect.top < scrollerTop; 28681 const left = elementRect.left < scrollerLeft; 28682 const bottom = elementRect.bottom > scrollerBottom; 28683 const right = elementRect.right > scrollerRight; 28684 return top || left || bottom || right; 28685 } 28686 function setSelectionRange(element, ...args) { 28687 if (/text|search|password|tel|url/i.test(element.type)) { 28688 element.setSelectionRange(...args); 28689 } 28690 } 28691 function sortBasedOnDOMPosition(items, getElement) { 28692 const pairs = items.map((item, index) => [index, item]); 28693 let isOrderDifferent = false; 28694 pairs.sort(([indexA, a], [indexB, b]) => { 28695 const elementA = getElement(a); 28696 const elementB = getElement(b); 28697 if (elementA === elementB) return 0; 28698 if (!elementA || !elementB) return 0; 28699 if (isElementPreceding(elementA, elementB)) { 28700 if (indexA > indexB) { 28701 isOrderDifferent = true; 28702 } 28703 return -1; 28704 } 28705 if (indexA < indexB) { 28706 isOrderDifferent = true; 28707 } 28708 return 1; 28709 }); 28710 if (isOrderDifferent) { 28711 return pairs.map(([_, item]) => item); 28712 } 28713 return items; 28714 } 28715 function isElementPreceding(a, b) { 28716 return Boolean( 28717 b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING 28718 ); 28719 } 28720 28721 28722 28723 ;// ./node_modules/@ariakit/core/esm/__chunks/QAGXQEUG.js 28724 "use client"; 28725 28726 28727 // src/utils/platform.ts 28728 function isTouchDevice() { 28729 return DTR5TSDJ_canUseDOM && !!navigator.maxTouchPoints; 28730 } 28731 function isApple() { 28732 if (!DTR5TSDJ_canUseDOM) return false; 28733 return /mac|iphone|ipad|ipod/i.test(navigator.platform); 28734 } 28735 function isSafari() { 28736 return DTR5TSDJ_canUseDOM && isApple() && /apple/i.test(navigator.vendor); 28737 } 28738 function isFirefox() { 28739 return DTR5TSDJ_canUseDOM && /firefox\//i.test(navigator.userAgent); 28740 } 28741 function isMac() { 28742 return canUseDOM && navigator.platform.startsWith("Mac") && !isTouchDevice(); 28743 } 28744 28745 28746 28747 ;// ./node_modules/@ariakit/core/esm/utils/events.js 28748 "use client"; 28749 28750 28751 28752 28753 // src/utils/events.ts 28754 function isPortalEvent(event) { 28755 return Boolean( 28756 event.currentTarget && !contains(event.currentTarget, event.target) 28757 ); 28758 } 28759 function isSelfTarget(event) { 28760 return event.target === event.currentTarget; 28761 } 28762 function isOpeningInNewTab(event) { 28763 const element = event.currentTarget; 28764 if (!element) return false; 28765 const isAppleDevice = isApple(); 28766 if (isAppleDevice && !event.metaKey) return false; 28767 if (!isAppleDevice && !event.ctrlKey) return false; 28768 const tagName = element.tagName.toLowerCase(); 28769 if (tagName === "a") return true; 28770 if (tagName === "button" && element.type === "submit") return true; 28771 if (tagName === "input" && element.type === "submit") return true; 28772 return false; 28773 } 28774 function isDownloading(event) { 28775 const element = event.currentTarget; 28776 if (!element) return false; 28777 const tagName = element.tagName.toLowerCase(); 28778 if (!event.altKey) return false; 28779 if (tagName === "a") return true; 28780 if (tagName === "button" && element.type === "submit") return true; 28781 if (tagName === "input" && element.type === "submit") return true; 28782 return false; 28783 } 28784 function fireEvent(element, type, eventInit) { 28785 const event = new Event(type, eventInit); 28786 return element.dispatchEvent(event); 28787 } 28788 function fireBlurEvent(element, eventInit) { 28789 const event = new FocusEvent("blur", eventInit); 28790 const defaultAllowed = element.dispatchEvent(event); 28791 const bubbleInit = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, eventInit), { bubbles: true }); 28792 element.dispatchEvent(new FocusEvent("focusout", bubbleInit)); 28793 return defaultAllowed; 28794 } 28795 function fireFocusEvent(element, eventInit) { 28796 const event = new FocusEvent("focus", eventInit); 28797 const defaultAllowed = element.dispatchEvent(event); 28798 const bubbleInit = __spreadProps(__spreadValues({}, eventInit), { bubbles: true }); 28799 element.dispatchEvent(new FocusEvent("focusin", bubbleInit)); 28800 return defaultAllowed; 28801 } 28802 function fireKeyboardEvent(element, type, eventInit) { 28803 const event = new KeyboardEvent(type, eventInit); 28804 return element.dispatchEvent(event); 28805 } 28806 function fireClickEvent(element, eventInit) { 28807 const event = new MouseEvent("click", eventInit); 28808 return element.dispatchEvent(event); 28809 } 28810 function isFocusEventOutside(event, container) { 28811 const containerElement = container || event.currentTarget; 28812 const relatedTarget = event.relatedTarget; 28813 return !relatedTarget || !contains(containerElement, relatedTarget); 28814 } 28815 function getInputType(event) { 28816 const nativeEvent = "nativeEvent" in event ? event.nativeEvent : event; 28817 if (!nativeEvent) return; 28818 if (!("inputType" in nativeEvent)) return; 28819 if (typeof nativeEvent.inputType !== "string") return; 28820 return nativeEvent.inputType; 28821 } 28822 function queueBeforeEvent(element, type, callback, timeout) { 28823 const createTimer = (callback2) => { 28824 if (timeout) { 28825 const timerId2 = setTimeout(callback2, timeout); 28826 return () => clearTimeout(timerId2); 28827 } 28828 const timerId = requestAnimationFrame(callback2); 28829 return () => cancelAnimationFrame(timerId); 28830 }; 28831 const cancelTimer = createTimer(() => { 28832 element.removeEventListener(type, callSync, true); 28833 callback(); 28834 }); 28835 const callSync = () => { 28836 cancelTimer(); 28837 callback(); 28838 }; 28839 element.addEventListener(type, callSync, { once: true, capture: true }); 28840 return cancelTimer; 28841 } 28842 function addGlobalEventListener(type, listener, options, scope = window) { 28843 const children = []; 28844 try { 28845 scope.document.addEventListener(type, listener, options); 28846 for (const frame of Array.from(scope.frames)) { 28847 children.push(addGlobalEventListener(type, listener, options, frame)); 28848 } 28849 } catch (e) { 28850 } 28851 const removeEventListener = () => { 28852 try { 28853 scope.document.removeEventListener(type, listener, options); 28854 } catch (e) { 28855 } 28856 for (const remove of children) { 28857 remove(); 28858 } 28859 }; 28860 return removeEventListener; 28861 } 28862 28863 28864 ;// ./node_modules/@ariakit/react-core/esm/__chunks/ABQUS43J.js 28865 "use client"; 28866 28867 28868 28869 // src/utils/hooks.ts 28870 28871 28872 28873 28874 var _React = _3YLGPPWQ_spreadValues({}, external_React_namespaceObject); 28875 var useReactId = _React.useId; 28876 var useReactDeferredValue = _React.useDeferredValue; 28877 var useReactInsertionEffect = _React.useInsertionEffect; 28878 var useSafeLayoutEffect = DTR5TSDJ_canUseDOM ? external_React_.useLayoutEffect : external_React_.useEffect; 28879 function useInitialValue(value) { 28880 const [initialValue] = (0,external_React_.useState)(value); 28881 return initialValue; 28882 } 28883 function useLazyValue(init) { 28884 const ref = useRef(); 28885 if (ref.current === void 0) { 28886 ref.current = init(); 28887 } 28888 return ref.current; 28889 } 28890 function useLiveRef(value) { 28891 const ref = (0,external_React_.useRef)(value); 28892 useSafeLayoutEffect(() => { 28893 ref.current = value; 28894 }); 28895 return ref; 28896 } 28897 function usePreviousValue(value) { 28898 const [previousValue, setPreviousValue] = useState(value); 28899 if (value !== previousValue) { 28900 setPreviousValue(value); 28901 } 28902 return previousValue; 28903 } 28904 function useEvent(callback) { 28905 const ref = (0,external_React_.useRef)(() => { 28906 throw new Error("Cannot call an event handler while rendering."); 28907 }); 28908 if (useReactInsertionEffect) { 28909 useReactInsertionEffect(() => { 28910 ref.current = callback; 28911 }); 28912 } else { 28913 ref.current = callback; 28914 } 28915 return (0,external_React_.useCallback)((...args) => { 28916 var _a; 28917 return (_a = ref.current) == null ? void 0 : _a.call(ref, ...args); 28918 }, []); 28919 } 28920 function useTransactionState(callback) { 28921 const [state, setState] = (0,external_React_.useState)(null); 28922 useSafeLayoutEffect(() => { 28923 if (state == null) return; 28924 if (!callback) return; 28925 let prevState = null; 28926 callback((prev) => { 28927 prevState = prev; 28928 return state; 28929 }); 28930 return () => { 28931 callback(prevState); 28932 }; 28933 }, [state, callback]); 28934 return [state, setState]; 28935 } 28936 function useMergeRefs(...refs) { 28937 return (0,external_React_.useMemo)(() => { 28938 if (!refs.some(Boolean)) return; 28939 return (value) => { 28940 for (const ref of refs) { 28941 setRef(ref, value); 28942 } 28943 }; 28944 }, refs); 28945 } 28946 function useId(defaultId) { 28947 if (useReactId) { 28948 const reactId = useReactId(); 28949 if (defaultId) return defaultId; 28950 return reactId; 28951 } 28952 const [id, setId] = (0,external_React_.useState)(defaultId); 28953 useSafeLayoutEffect(() => { 28954 if (defaultId || id) return; 28955 const random = Math.random().toString(36).slice(2, 8); 28956 setId(`id-$random}`); 28957 }, [defaultId, id]); 28958 return defaultId || id; 28959 } 28960 function useDeferredValue(value) { 28961 if (useReactDeferredValue) { 28962 return useReactDeferredValue(value); 28963 } 28964 const [deferredValue, setDeferredValue] = useState(value); 28965 useEffect(() => { 28966 const raf = requestAnimationFrame(() => setDeferredValue(value)); 28967 return () => cancelAnimationFrame(raf); 28968 }, [value]); 28969 return deferredValue; 28970 } 28971 function useTagName(refOrElement, type) { 28972 const stringOrUndefined = (type2) => { 28973 if (typeof type2 !== "string") return; 28974 return type2; 28975 }; 28976 const [tagName, setTagName] = (0,external_React_.useState)(() => stringOrUndefined(type)); 28977 useSafeLayoutEffect(() => { 28978 const element = refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement; 28979 setTagName((element == null ? void 0 : element.tagName.toLowerCase()) || stringOrUndefined(type)); 28980 }, [refOrElement, type]); 28981 return tagName; 28982 } 28983 function useAttribute(refOrElement, attributeName, defaultValue) { 28984 const initialValue = useInitialValue(defaultValue); 28985 const [attribute, setAttribute] = (0,external_React_.useState)(initialValue); 28986 (0,external_React_.useEffect)(() => { 28987 const element = refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement; 28988 if (!element) return; 28989 const callback = () => { 28990 const value = element.getAttribute(attributeName); 28991 setAttribute(value == null ? initialValue : value); 28992 }; 28993 const observer = new MutationObserver(callback); 28994 observer.observe(element, { attributeFilter: [attributeName] }); 28995 callback(); 28996 return () => observer.disconnect(); 28997 }, [refOrElement, attributeName, initialValue]); 28998 return attribute; 28999 } 29000 function useUpdateEffect(effect, deps) { 29001 const mounted = (0,external_React_.useRef)(false); 29002 (0,external_React_.useEffect)(() => { 29003 if (mounted.current) { 29004 return effect(); 29005 } 29006 mounted.current = true; 29007 }, deps); 29008 (0,external_React_.useEffect)( 29009 () => () => { 29010 mounted.current = false; 29011 }, 29012 [] 29013 ); 29014 } 29015 function useUpdateLayoutEffect(effect, deps) { 29016 const mounted = (0,external_React_.useRef)(false); 29017 useSafeLayoutEffect(() => { 29018 if (mounted.current) { 29019 return effect(); 29020 } 29021 mounted.current = true; 29022 }, deps); 29023 useSafeLayoutEffect( 29024 () => () => { 29025 mounted.current = false; 29026 }, 29027 [] 29028 ); 29029 } 29030 function useForceUpdate() { 29031 return (0,external_React_.useReducer)(() => [], []); 29032 } 29033 function useBooleanEvent(booleanOrCallback) { 29034 return useEvent( 29035 typeof booleanOrCallback === "function" ? booleanOrCallback : () => booleanOrCallback 29036 ); 29037 } 29038 function useWrapElement(props, callback, deps = []) { 29039 const wrapElement = (0,external_React_.useCallback)( 29040 (element) => { 29041 if (props.wrapElement) { 29042 element = props.wrapElement(element); 29043 } 29044 return callback(element); 29045 }, 29046 [...deps, props.wrapElement] 29047 ); 29048 return _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { wrapElement }); 29049 } 29050 function usePortalRef(portalProp = false, portalRefProp) { 29051 const [portalNode, setPortalNode] = useState(null); 29052 const portalRef = useMergeRefs(setPortalNode, portalRefProp); 29053 const domReady = !portalProp || portalNode; 29054 return { portalRef, portalNode, domReady }; 29055 } 29056 function useMetadataProps(props, key, value) { 29057 const parent = props.onLoadedMetadataCapture; 29058 const onLoadedMetadataCapture = (0,external_React_.useMemo)(() => { 29059 return Object.assign(() => { 29060 }, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, parent), { [key]: value })); 29061 }, [parent, key, value]); 29062 return [parent == null ? void 0 : parent[key], { onLoadedMetadataCapture }]; 29063 } 29064 function useIsMouseMoving() { 29065 (0,external_React_.useEffect)(() => { 29066 addGlobalEventListener("mousemove", setMouseMoving, true); 29067 addGlobalEventListener("mousedown", resetMouseMoving, true); 29068 addGlobalEventListener("mouseup", resetMouseMoving, true); 29069 addGlobalEventListener("keydown", resetMouseMoving, true); 29070 addGlobalEventListener("scroll", resetMouseMoving, true); 29071 }, []); 29072 const isMouseMoving = useEvent(() => mouseMoving); 29073 return isMouseMoving; 29074 } 29075 var mouseMoving = false; 29076 var previousScreenX = 0; 29077 var previousScreenY = 0; 29078 function hasMouseMovement(event) { 29079 const movementX = event.movementX || event.screenX - previousScreenX; 29080 const movementY = event.movementY || event.screenY - previousScreenY; 29081 previousScreenX = event.screenX; 29082 previousScreenY = event.screenY; 29083 return movementX || movementY || "production" === "test"; 29084 } 29085 function setMouseMoving(event) { 29086 if (!hasMouseMovement(event)) return; 29087 mouseMoving = true; 29088 } 29089 function resetMouseMoving() { 29090 mouseMoving = false; 29091 } 29092 29093 29094 29095 ;// ./node_modules/@ariakit/react-core/esm/__chunks/LMDWO4NN.js 29096 "use client"; 29097 29098 29099 29100 29101 // src/utils/system.tsx 29102 29103 29104 function forwardRef2(render) { 29105 const Role = external_React_.forwardRef((props, ref) => render(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { ref }))); 29106 Role.displayName = render.displayName || render.name; 29107 return Role; 29108 } 29109 function memo2(Component, propsAreEqual) { 29110 return external_React_.memo(Component, propsAreEqual); 29111 } 29112 function createElement(Type, props) { 29113 const _a = props, { wrapElement, render } = _a, rest = __objRest(_a, ["wrapElement", "render"]); 29114 const mergedRef = useMergeRefs(props.ref, getRefProperty(render)); 29115 let element; 29116 if (external_React_.isValidElement(render)) { 29117 const renderProps = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, render.props), { ref: mergedRef }); 29118 element = external_React_.cloneElement(render, mergeProps(rest, renderProps)); 29119 } else if (render) { 29120 element = render(rest); 29121 } else { 29122 element = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Type, _3YLGPPWQ_spreadValues({}, rest)); 29123 } 29124 if (wrapElement) { 29125 return wrapElement(element); 29126 } 29127 return element; 29128 } 29129 function createHook(useProps) { 29130 const useRole = (props = {}) => { 29131 return useProps(props); 29132 }; 29133 useRole.displayName = useProps.name; 29134 return useRole; 29135 } 29136 function createStoreContext(providers = [], scopedProviders = []) { 29137 const context = external_React_.createContext(void 0); 29138 const scopedContext = external_React_.createContext(void 0); 29139 const useContext2 = () => external_React_.useContext(context); 29140 const useScopedContext = (onlyScoped = false) => { 29141 const scoped = external_React_.useContext(scopedContext); 29142 const store = useContext2(); 29143 if (onlyScoped) return scoped; 29144 return scoped || store; 29145 }; 29146 const useProviderContext = () => { 29147 const scoped = external_React_.useContext(scopedContext); 29148 const store = useContext2(); 29149 if (scoped && scoped === store) return; 29150 return store; 29151 }; 29152 const ContextProvider = (props) => { 29153 return providers.reduceRight( 29154 (children, Provider) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Provider, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { children })), 29155 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(context.Provider, _3YLGPPWQ_spreadValues({}, props)) 29156 ); 29157 }; 29158 const ScopedContextProvider = (props) => { 29159 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ContextProvider, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { children: scopedProviders.reduceRight( 29160 (children, Provider) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Provider, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { children })), 29161 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(scopedContext.Provider, _3YLGPPWQ_spreadValues({}, props)) 29162 ) })); 29163 }; 29164 return { 29165 context, 29166 scopedContext, 29167 useContext: useContext2, 29168 useScopedContext, 29169 useProviderContext, 29170 ContextProvider, 29171 ScopedContextProvider 29172 }; 29173 } 29174 29175 29176 29177 ;// ./node_modules/@ariakit/react-core/esm/__chunks/VDHZ5F7K.js 29178 "use client"; 29179 29180 29181 // src/collection/collection-context.tsx 29182 var ctx = createStoreContext(); 29183 var useCollectionContext = ctx.useContext; 29184 var useCollectionScopedContext = ctx.useScopedContext; 29185 var useCollectionProviderContext = ctx.useProviderContext; 29186 var CollectionContextProvider = ctx.ContextProvider; 29187 var CollectionScopedContextProvider = ctx.ScopedContextProvider; 29188 29189 29190 29191 ;// ./node_modules/@ariakit/react-core/esm/__chunks/P7GR5CS5.js 29192 "use client"; 29193 29194 29195 29196 // src/composite/composite-context.tsx 29197 29198 var P7GR5CS5_ctx = createStoreContext( 29199 [CollectionContextProvider], 29200 [CollectionScopedContextProvider] 29201 ); 29202 var useCompositeContext = P7GR5CS5_ctx.useContext; 29203 var useCompositeScopedContext = P7GR5CS5_ctx.useScopedContext; 29204 var useCompositeProviderContext = P7GR5CS5_ctx.useProviderContext; 29205 var CompositeContextProvider = P7GR5CS5_ctx.ContextProvider; 29206 var CompositeScopedContextProvider = P7GR5CS5_ctx.ScopedContextProvider; 29207 var CompositeItemContext = (0,external_React_.createContext)( 29208 void 0 29209 ); 29210 var CompositeRowContext = (0,external_React_.createContext)( 29211 void 0 29212 ); 29213 29214 29215 29216 ;// ./node_modules/@ariakit/react-core/esm/__chunks/3XAVFTCA.js 29217 "use client"; 29218 29219 29220 29221 // src/tag/tag-context.tsx 29222 29223 var TagValueContext = (0,external_React_.createContext)(null); 29224 var TagRemoveIdContext = (0,external_React_.createContext)( 29225 null 29226 ); 29227 var _3XAVFTCA_ctx = createStoreContext( 29228 [CompositeContextProvider], 29229 [CompositeScopedContextProvider] 29230 ); 29231 var useTagContext = _3XAVFTCA_ctx.useContext; 29232 var useTagScopedContext = _3XAVFTCA_ctx.useScopedContext; 29233 var useTagProviderContext = _3XAVFTCA_ctx.useProviderContext; 29234 var TagContextProvider = _3XAVFTCA_ctx.ContextProvider; 29235 var TagScopedContextProvider = _3XAVFTCA_ctx.ScopedContextProvider; 29236 29237 29238 29239 ;// ./node_modules/@ariakit/core/esm/__chunks/BCALMBPZ.js 29240 "use client"; 29241 29242 29243 29244 // src/utils/store.ts 29245 function getInternal(store, key) { 29246 const internals = store.__unstableInternals; 29247 invariant(internals, "Invalid store"); 29248 return internals[key]; 29249 } 29250 function createStore(initialState, ...stores) { 29251 let state = initialState; 29252 let prevStateBatch = state; 29253 let lastUpdate = Symbol(); 29254 let destroy = PBFD2E7P_noop; 29255 const instances = /* @__PURE__ */ new Set(); 29256 const updatedKeys = /* @__PURE__ */ new Set(); 29257 const setups = /* @__PURE__ */ new Set(); 29258 const listeners = /* @__PURE__ */ new Set(); 29259 const batchListeners = /* @__PURE__ */ new Set(); 29260 const disposables = /* @__PURE__ */ new WeakMap(); 29261 const listenerKeys = /* @__PURE__ */ new WeakMap(); 29262 const storeSetup = (callback) => { 29263 setups.add(callback); 29264 return () => setups.delete(callback); 29265 }; 29266 const storeInit = () => { 29267 const initialized = instances.size; 29268 const instance = Symbol(); 29269 instances.add(instance); 29270 const maybeDestroy = () => { 29271 instances.delete(instance); 29272 if (instances.size) return; 29273 destroy(); 29274 }; 29275 if (initialized) return maybeDestroy; 29276 const desyncs = getKeys(state).map( 29277 (key) => chain( 29278 ...stores.map((store) => { 29279 var _a; 29280 const storeState = (_a = store == null ? void 0 : store.getState) == null ? void 0 : _a.call(store); 29281 if (!storeState) return; 29282 if (!PBFD2E7P_hasOwnProperty(storeState, key)) return; 29283 return sync(store, [key], (state2) => { 29284 setState( 29285 key, 29286 state2[key], 29287 // @ts-expect-error - Not public API. This is just to prevent 29288 // infinite loops. 29289 true 29290 ); 29291 }); 29292 }) 29293 ) 29294 ); 29295 const teardowns = []; 29296 for (const setup2 of setups) { 29297 teardowns.push(setup2()); 29298 } 29299 const cleanups = stores.map(init); 29300 destroy = chain(...desyncs, ...teardowns, ...cleanups); 29301 return maybeDestroy; 29302 }; 29303 const sub = (keys, listener, set = listeners) => { 29304 set.add(listener); 29305 listenerKeys.set(listener, keys); 29306 return () => { 29307 var _a; 29308 (_a = disposables.get(listener)) == null ? void 0 : _a(); 29309 disposables.delete(listener); 29310 listenerKeys.delete(listener); 29311 set.delete(listener); 29312 }; 29313 }; 29314 const storeSubscribe = (keys, listener) => sub(keys, listener); 29315 const storeSync = (keys, listener) => { 29316 disposables.set(listener, listener(state, state)); 29317 return sub(keys, listener); 29318 }; 29319 const storeBatch = (keys, listener) => { 29320 disposables.set(listener, listener(state, prevStateBatch)); 29321 return sub(keys, listener, batchListeners); 29322 }; 29323 const storePick = (keys) => createStore(pick(state, keys), finalStore); 29324 const storeOmit = (keys) => createStore(omit(state, keys), finalStore); 29325 const getState = () => state; 29326 const setState = (key, value, fromStores = false) => { 29327 var _a; 29328 if (!PBFD2E7P_hasOwnProperty(state, key)) return; 29329 const nextValue = applyState(value, state[key]); 29330 if (nextValue === state[key]) return; 29331 if (!fromStores) { 29332 for (const store of stores) { 29333 (_a = store == null ? void 0 : store.setState) == null ? void 0 : _a.call(store, key, nextValue); 29334 } 29335 } 29336 const prevState = state; 29337 state = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, state), { [key]: nextValue }); 29338 const thisUpdate = Symbol(); 29339 lastUpdate = thisUpdate; 29340 updatedKeys.add(key); 29341 const run = (listener, prev, uKeys) => { 29342 var _a2; 29343 const keys = listenerKeys.get(listener); 29344 const updated = (k) => uKeys ? uKeys.has(k) : k === key; 29345 if (!keys || keys.some(updated)) { 29346 (_a2 = disposables.get(listener)) == null ? void 0 : _a2(); 29347 disposables.set(listener, listener(state, prev)); 29348 } 29349 }; 29350 for (const listener of listeners) { 29351 run(listener, prevState); 29352 } 29353 queueMicrotask(() => { 29354 if (lastUpdate !== thisUpdate) return; 29355 const snapshot = state; 29356 for (const listener of batchListeners) { 29357 run(listener, prevStateBatch, updatedKeys); 29358 } 29359 prevStateBatch = snapshot; 29360 updatedKeys.clear(); 29361 }); 29362 }; 29363 const finalStore = { 29364 getState, 29365 setState, 29366 __unstableInternals: { 29367 setup: storeSetup, 29368 init: storeInit, 29369 subscribe: storeSubscribe, 29370 sync: storeSync, 29371 batch: storeBatch, 29372 pick: storePick, 29373 omit: storeOmit 29374 } 29375 }; 29376 return finalStore; 29377 } 29378 function setup(store, ...args) { 29379 if (!store) return; 29380 return getInternal(store, "setup")(...args); 29381 } 29382 function init(store, ...args) { 29383 if (!store) return; 29384 return getInternal(store, "init")(...args); 29385 } 29386 function subscribe(store, ...args) { 29387 if (!store) return; 29388 return getInternal(store, "subscribe")(...args); 29389 } 29390 function sync(store, ...args) { 29391 if (!store) return; 29392 return getInternal(store, "sync")(...args); 29393 } 29394 function batch(store, ...args) { 29395 if (!store) return; 29396 return getInternal(store, "batch")(...args); 29397 } 29398 function omit2(store, ...args) { 29399 if (!store) return; 29400 return getInternal(store, "omit")(...args); 29401 } 29402 function pick2(store, ...args) { 29403 if (!store) return; 29404 return getInternal(store, "pick")(...args); 29405 } 29406 function mergeStore(...stores) { 29407 const initialState = stores.reduce((state, store2) => { 29408 var _a; 29409 const nextState = (_a = store2 == null ? void 0 : store2.getState) == null ? void 0 : _a.call(store2); 29410 if (!nextState) return state; 29411 return Object.assign(state, nextState); 29412 }, {}); 29413 const store = createStore(initialState, ...stores); 29414 return Object.assign({}, ...stores, store); 29415 } 29416 function throwOnConflictingProps(props, store) { 29417 if (true) return; 29418 if (!store) return; 29419 const defaultKeys = Object.entries(props).filter(([key, value]) => key.startsWith("default") && value !== void 0).map(([key]) => { 29420 var _a; 29421 const stateKey = key.replace("default", ""); 29422 return `${((_a = stateKey[0]) == null ? void 0 : _a.toLowerCase()) || ""}$stateKey.slice(1)}`; 29423 }); 29424 if (!defaultKeys.length) return; 29425 const storeState = store.getState(); 29426 const conflictingProps = defaultKeys.filter( 29427 (key) => PBFD2E7P_hasOwnProperty(storeState, key) 29428 ); 29429 if (!conflictingProps.length) return; 29430 throw new Error( 29431 `Passing a store prop in conjunction with a default state is not supported. 29432 29433 const store = useSelectStore(); 29434 <SelectProvider store={store} defaultValue="Apple" /> 29435 ^ ^ 29436 29437 Instead, pass the default state to the topmost store: 29438 29439 const store = useSelectStore({ defaultValue: "Apple" }); 29440 <SelectProvider store={store} /> 29441 29442 See https://github.com/ariakit/ariakit/pull/2745 for more details. 29443 29444 If there's a particular need for this, please submit a feature request at https://github.com/ariakit/ariakit 29445 ` 29446 ); 29447 } 29448 29449 29450 29451 // EXTERNAL MODULE: ./node_modules/use-sync-external-store/shim/index.js 29452 var shim = __webpack_require__(422); 29453 ;// ./node_modules/@ariakit/react-core/esm/__chunks/YV4JVR4I.js 29454 "use client"; 29455 29456 29457 29458 // src/utils/store.tsx 29459 29460 29461 29462 29463 var { useSyncExternalStore } = shim; 29464 var noopSubscribe = () => () => { 29465 }; 29466 function useStoreState(store, keyOrSelector = identity) { 29467 const storeSubscribe = external_React_.useCallback( 29468 (callback) => { 29469 if (!store) return noopSubscribe(); 29470 return subscribe(store, null, callback); 29471 }, 29472 [store] 29473 ); 29474 const getSnapshot = () => { 29475 const key = typeof keyOrSelector === "string" ? keyOrSelector : null; 29476 const selector = typeof keyOrSelector === "function" ? keyOrSelector : null; 29477 const state = store == null ? void 0 : store.getState(); 29478 if (selector) return selector(state); 29479 if (!state) return; 29480 if (!key) return; 29481 if (!PBFD2E7P_hasOwnProperty(state, key)) return; 29482 return state[key]; 29483 }; 29484 return useSyncExternalStore(storeSubscribe, getSnapshot, getSnapshot); 29485 } 29486 function useStoreStateObject(store, object) { 29487 const objRef = external_React_.useRef( 29488 {} 29489 ); 29490 const storeSubscribe = external_React_.useCallback( 29491 (callback) => { 29492 if (!store) return noopSubscribe(); 29493 return subscribe(store, null, callback); 29494 }, 29495 [store] 29496 ); 29497 const getSnapshot = () => { 29498 const state = store == null ? void 0 : store.getState(); 29499 let updated = false; 29500 const obj = objRef.current; 29501 for (const prop in object) { 29502 const keyOrSelector = object[prop]; 29503 if (typeof keyOrSelector === "function") { 29504 const value = keyOrSelector(state); 29505 if (value !== obj[prop]) { 29506 obj[prop] = value; 29507 updated = true; 29508 } 29509 } 29510 if (typeof keyOrSelector === "string") { 29511 if (!state) continue; 29512 if (!PBFD2E7P_hasOwnProperty(state, keyOrSelector)) continue; 29513 const value = state[keyOrSelector]; 29514 if (value !== obj[prop]) { 29515 obj[prop] = value; 29516 updated = true; 29517 } 29518 } 29519 } 29520 if (updated) { 29521 objRef.current = _3YLGPPWQ_spreadValues({}, obj); 29522 } 29523 return objRef.current; 29524 }; 29525 return useSyncExternalStore(storeSubscribe, getSnapshot, getSnapshot); 29526 } 29527 function useStoreProps(store, props, key, setKey) { 29528 const value = PBFD2E7P_hasOwnProperty(props, key) ? props[key] : void 0; 29529 const setValue = setKey ? props[setKey] : void 0; 29530 const propsRef = useLiveRef({ value, setValue }); 29531 useSafeLayoutEffect(() => { 29532 return sync(store, [key], (state, prev) => { 29533 const { value: value2, setValue: setValue2 } = propsRef.current; 29534 if (!setValue2) return; 29535 if (state[key] === prev[key]) return; 29536 if (state[key] === value2) return; 29537 setValue2(state[key]); 29538 }); 29539 }, [store, key]); 29540 useSafeLayoutEffect(() => { 29541 if (value === void 0) return; 29542 store.setState(key, value); 29543 return batch(store, [key], () => { 29544 if (value === void 0) return; 29545 store.setState(key, value); 29546 }); 29547 }); 29548 } 29549 function YV4JVR4I_useStore(createStore, props) { 29550 const [store, setStore] = external_React_.useState(() => createStore(props)); 29551 useSafeLayoutEffect(() => init(store), [store]); 29552 const useState2 = external_React_.useCallback( 29553 (keyOrSelector) => useStoreState(store, keyOrSelector), 29554 [store] 29555 ); 29556 const memoizedStore = external_React_.useMemo( 29557 () => _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, store), { useState: useState2 }), 29558 [store, useState2] 29559 ); 29560 const updateStore = useEvent(() => { 29561 setStore((store2) => createStore(_3YLGPPWQ_spreadValues(_3YLGPPWQ_spreadValues({}, props), store2.getState()))); 29562 }); 29563 return [memoizedStore, updateStore]; 29564 } 29565 29566 29567 29568 ;// ./node_modules/@ariakit/react-core/esm/__chunks/C3IKGW5T.js 29569 "use client"; 29570 29571 29572 29573 // src/collection/collection-store.ts 29574 29575 function useCollectionStoreProps(store, update, props) { 29576 useUpdateEffect(update, [props.store]); 29577 useStoreProps(store, props, "items", "setItems"); 29578 return store; 29579 } 29580 function useCollectionStore(props = {}) { 29581 const [store, update] = useStore(Core.createCollectionStore, props); 29582 return useCollectionStoreProps(store, update, props); 29583 } 29584 29585 29586 29587 ;// ./node_modules/@ariakit/react-core/esm/__chunks/4CMBR7SL.js 29588 "use client"; 29589 29590 29591 29592 29593 29594 // src/composite/composite-store.ts 29595 29596 function useCompositeStoreOptions(props) { 29597 const id = useId(props.id); 29598 return _3YLGPPWQ_spreadValues({ id }, props); 29599 } 29600 function useCompositeStoreProps(store, update, props) { 29601 store = useCollectionStoreProps(store, update, props); 29602 useStoreProps(store, props, "activeId", "setActiveId"); 29603 useStoreProps(store, props, "includesBaseElement"); 29604 useStoreProps(store, props, "virtualFocus"); 29605 useStoreProps(store, props, "orientation"); 29606 useStoreProps(store, props, "rtl"); 29607 useStoreProps(store, props, "focusLoop"); 29608 useStoreProps(store, props, "focusWrap"); 29609 useStoreProps(store, props, "focusShift"); 29610 return store; 29611 } 29612 function useCompositeStore(props = {}) { 29613 props = useCompositeStoreOptions(props); 29614 const [store, update] = useStore(Core.createCompositeStore, props); 29615 return useCompositeStoreProps(store, update, props); 29616 } 29617 29618 29619 29620 ;// ./node_modules/@ariakit/react-core/esm/__chunks/WYCIER3C.js 29621 "use client"; 29622 29623 29624 29625 // src/disclosure/disclosure-store.ts 29626 29627 function useDisclosureStoreProps(store, update, props) { 29628 useUpdateEffect(update, [props.store, props.disclosure]); 29629 useStoreProps(store, props, "open", "setOpen"); 29630 useStoreProps(store, props, "mounted", "setMounted"); 29631 useStoreProps(store, props, "animated"); 29632 return Object.assign(store, { disclosure: props.disclosure }); 29633 } 29634 function useDisclosureStore(props = {}) { 29635 const [store, update] = useStore(Core.createDisclosureStore, props); 29636 return useDisclosureStoreProps(store, update, props); 29637 } 29638 29639 29640 29641 ;// ./node_modules/@ariakit/react-core/esm/__chunks/BM6PGYQY.js 29642 "use client"; 29643 29644 29645 29646 // src/dialog/dialog-store.ts 29647 29648 function useDialogStoreProps(store, update, props) { 29649 return useDisclosureStoreProps(store, update, props); 29650 } 29651 function useDialogStore(props = {}) { 29652 const [store, update] = useStore(Core.createDialogStore, props); 29653 return useDialogStoreProps(store, update, props); 29654 } 29655 29656 29657 29658 ;// ./node_modules/@ariakit/react-core/esm/__chunks/O2PQ2652.js 29659 "use client"; 29660 29661 29662 29663 29664 // src/popover/popover-store.ts 29665 29666 function usePopoverStoreProps(store, update, props) { 29667 useUpdateEffect(update, [props.popover]); 29668 useStoreProps(store, props, "placement"); 29669 return useDialogStoreProps(store, update, props); 29670 } 29671 function usePopoverStore(props = {}) { 29672 const [store, update] = useStore(Core.createPopoverStore, props); 29673 return usePopoverStoreProps(store, update, props); 29674 } 29675 29676 29677 29678 ;// ./node_modules/@ariakit/core/esm/__chunks/CYQWQL4J.js 29679 "use client"; 29680 29681 29682 29683 29684 29685 // src/collection/collection-store.ts 29686 function getCommonParent(items) { 29687 var _a; 29688 const firstItem = items.find((item) => !!item.element); 29689 const lastItem = [...items].reverse().find((item) => !!item.element); 29690 let parentElement = (_a = firstItem == null ? void 0 : firstItem.element) == null ? void 0 : _a.parentElement; 29691 while (parentElement && (lastItem == null ? void 0 : lastItem.element)) { 29692 const parent = parentElement; 29693 if (lastItem && parent.contains(lastItem.element)) { 29694 return parentElement; 29695 } 29696 parentElement = parentElement.parentElement; 29697 } 29698 return getDocument(parentElement).body; 29699 } 29700 function getPrivateStore(store) { 29701 return store == null ? void 0 : store.__unstablePrivateStore; 29702 } 29703 function createCollectionStore(props = {}) { 29704 var _a; 29705 throwOnConflictingProps(props, props.store); 29706 const syncState = (_a = props.store) == null ? void 0 : _a.getState(); 29707 const items = defaultValue( 29708 props.items, 29709 syncState == null ? void 0 : syncState.items, 29710 props.defaultItems, 29711 [] 29712 ); 29713 const itemsMap = new Map(items.map((item) => [item.id, item])); 29714 const initialState = { 29715 items, 29716 renderedItems: defaultValue(syncState == null ? void 0 : syncState.renderedItems, []) 29717 }; 29718 const syncPrivateStore = getPrivateStore(props.store); 29719 const privateStore = createStore( 29720 { items, renderedItems: initialState.renderedItems }, 29721 syncPrivateStore 29722 ); 29723 const collection = createStore(initialState, props.store); 29724 const sortItems = (renderedItems) => { 29725 const sortedItems = sortBasedOnDOMPosition(renderedItems, (i) => i.element); 29726 privateStore.setState("renderedItems", sortedItems); 29727 collection.setState("renderedItems", sortedItems); 29728 }; 29729 setup(collection, () => init(privateStore)); 29730 setup(privateStore, () => { 29731 return batch(privateStore, ["items"], (state) => { 29732 collection.setState("items", state.items); 29733 }); 29734 }); 29735 setup(privateStore, () => { 29736 return batch(privateStore, ["renderedItems"], (state) => { 29737 let firstRun = true; 29738 let raf = requestAnimationFrame(() => { 29739 const { renderedItems } = collection.getState(); 29740 if (state.renderedItems === renderedItems) return; 29741 sortItems(state.renderedItems); 29742 }); 29743 if (typeof IntersectionObserver !== "function") { 29744 return () => cancelAnimationFrame(raf); 29745 } 29746 const ioCallback = () => { 29747 if (firstRun) { 29748 firstRun = false; 29749 return; 29750 } 29751 cancelAnimationFrame(raf); 29752 raf = requestAnimationFrame(() => sortItems(state.renderedItems)); 29753 }; 29754 const root = getCommonParent(state.renderedItems); 29755 const observer = new IntersectionObserver(ioCallback, { root }); 29756 for (const item of state.renderedItems) { 29757 if (!item.element) continue; 29758 observer.observe(item.element); 29759 } 29760 return () => { 29761 cancelAnimationFrame(raf); 29762 observer.disconnect(); 29763 }; 29764 }); 29765 }); 29766 const mergeItem = (item, setItems, canDeleteFromMap = false) => { 29767 let prevItem; 29768 setItems((items2) => { 29769 const index = items2.findIndex(({ id }) => id === item.id); 29770 const nextItems = items2.slice(); 29771 if (index !== -1) { 29772 prevItem = items2[index]; 29773 const nextItem = _chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, prevItem), item); 29774 nextItems[index] = nextItem; 29775 itemsMap.set(item.id, nextItem); 29776 } else { 29777 nextItems.push(item); 29778 itemsMap.set(item.id, item); 29779 } 29780 return nextItems; 29781 }); 29782 const unmergeItem = () => { 29783 setItems((items2) => { 29784 if (!prevItem) { 29785 if (canDeleteFromMap) { 29786 itemsMap.delete(item.id); 29787 } 29788 return items2.filter(({ id }) => id !== item.id); 29789 } 29790 const index = items2.findIndex(({ id }) => id === item.id); 29791 if (index === -1) return items2; 29792 const nextItems = items2.slice(); 29793 nextItems[index] = prevItem; 29794 itemsMap.set(item.id, prevItem); 29795 return nextItems; 29796 }); 29797 }; 29798 return unmergeItem; 29799 }; 29800 const registerItem = (item) => mergeItem( 29801 item, 29802 (getItems) => privateStore.setState("items", getItems), 29803 true 29804 ); 29805 return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, collection), { 29806 registerItem, 29807 renderItem: (item) => chain( 29808 registerItem(item), 29809 mergeItem( 29810 item, 29811 (getItems) => privateStore.setState("renderedItems", getItems) 29812 ) 29813 ), 29814 item: (id) => { 29815 if (!id) return null; 29816 let item = itemsMap.get(id); 29817 if (!item) { 29818 const { items: items2 } = privateStore.getState(); 29819 item = items2.find((item2) => item2.id === id); 29820 if (item) { 29821 itemsMap.set(id, item); 29822 } 29823 } 29824 return item || null; 29825 }, 29826 // @ts-expect-error Internal 29827 __unstablePrivateStore: privateStore 29828 }); 29829 } 29830 29831 29832 29833 ;// ./node_modules/@ariakit/core/esm/__chunks/7PRQYBBV.js 29834 "use client"; 29835 29836 // src/utils/array.ts 29837 function toArray(arg) { 29838 if (Array.isArray(arg)) { 29839 return arg; 29840 } 29841 return typeof arg !== "undefined" ? [arg] : []; 29842 } 29843 function addItemToArray(array, item, index = -1) { 29844 if (!(index in array)) { 29845 return [...array, item]; 29846 } 29847 return [...array.slice(0, index), item, ...array.slice(index)]; 29848 } 29849 function flatten2DArray(array) { 29850 const flattened = []; 29851 for (const row of array) { 29852 flattened.push(...row); 29853 } 29854 return flattened; 29855 } 29856 function reverseArray(array) { 29857 return array.slice().reverse(); 29858 } 29859 29860 29861 29862 ;// ./node_modules/@ariakit/core/esm/__chunks/AJZ4BYF3.js 29863 "use client"; 29864 29865 29866 29867 29868 29869 29870 // src/composite/composite-store.ts 29871 var NULL_ITEM = { id: null }; 29872 function findFirstEnabledItem(items, excludeId) { 29873 return items.find((item) => { 29874 if (excludeId) { 29875 return !item.disabled && item.id !== excludeId; 29876 } 29877 return !item.disabled; 29878 }); 29879 } 29880 function getEnabledItems(items, excludeId) { 29881 return items.filter((item) => { 29882 if (excludeId) { 29883 return !item.disabled && item.id !== excludeId; 29884 } 29885 return !item.disabled; 29886 }); 29887 } 29888 function getItemsInRow(items, rowId) { 29889 return items.filter((item) => item.rowId === rowId); 29890 } 29891 function flipItems(items, activeId, shouldInsertNullItem = false) { 29892 const index = items.findIndex((item) => item.id === activeId); 29893 return [ 29894 ...items.slice(index + 1), 29895 ...shouldInsertNullItem ? [NULL_ITEM] : [], 29896 ...items.slice(0, index) 29897 ]; 29898 } 29899 function groupItemsByRows(items) { 29900 const rows = []; 29901 for (const item of items) { 29902 const row = rows.find((currentRow) => { 29903 var _a; 29904 return ((_a = currentRow[0]) == null ? void 0 : _a.rowId) === item.rowId; 29905 }); 29906 if (row) { 29907 row.push(item); 29908 } else { 29909 rows.push([item]); 29910 } 29911 } 29912 return rows; 29913 } 29914 function getMaxRowLength(array) { 29915 let maxLength = 0; 29916 for (const { length } of array) { 29917 if (length > maxLength) { 29918 maxLength = length; 29919 } 29920 } 29921 return maxLength; 29922 } 29923 function createEmptyItem(rowId) { 29924 return { 29925 id: "__EMPTY_ITEM__", 29926 disabled: true, 29927 rowId 29928 }; 29929 } 29930 function normalizeRows(rows, activeId, focusShift) { 29931 const maxLength = getMaxRowLength(rows); 29932 for (const row of rows) { 29933 for (let i = 0; i < maxLength; i += 1) { 29934 const item = row[i]; 29935 if (!item || focusShift && item.disabled) { 29936 const isFirst = i === 0; 29937 const previousItem = isFirst && focusShift ? findFirstEnabledItem(row) : row[i - 1]; 29938 row[i] = previousItem && activeId !== previousItem.id && focusShift ? previousItem : createEmptyItem(previousItem == null ? void 0 : previousItem.rowId); 29939 } 29940 } 29941 } 29942 return rows; 29943 } 29944 function verticalizeItems(items) { 29945 const rows = groupItemsByRows(items); 29946 const maxLength = getMaxRowLength(rows); 29947 const verticalized = []; 29948 for (let i = 0; i < maxLength; i += 1) { 29949 for (const row of rows) { 29950 const item = row[i]; 29951 if (item) { 29952 verticalized.push(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, item), { 29953 // If there's no rowId, it means that it's not a grid composite, but 29954 // a single row instead. So, instead of verticalizing it, that is, 29955 // assigning a different rowId based on the column index, we keep it 29956 // undefined so they will be part of the same row. This is useful 29957 // when using up/down on one-dimensional composites. 29958 rowId: item.rowId ? `$i}` : void 0 29959 })); 29960 } 29961 } 29962 } 29963 return verticalized; 29964 } 29965 function createCompositeStore(props = {}) { 29966 var _a; 29967 const syncState = (_a = props.store) == null ? void 0 : _a.getState(); 29968 const collection = createCollectionStore(props); 29969 const activeId = defaultValue( 29970 props.activeId, 29971 syncState == null ? void 0 : syncState.activeId, 29972 props.defaultActiveId 29973 ); 29974 const initialState = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, collection.getState()), { 29975 id: defaultValue( 29976 props.id, 29977 syncState == null ? void 0 : syncState.id, 29978 `id-$Math.random().toString(36).slice(2, 8)}` 29979 ), 29980 activeId, 29981 baseElement: defaultValue(syncState == null ? void 0 : syncState.baseElement, null), 29982 includesBaseElement: defaultValue( 29983 props.includesBaseElement, 29984 syncState == null ? void 0 : syncState.includesBaseElement, 29985 activeId === null 29986 ), 29987 moves: defaultValue(syncState == null ? void 0 : syncState.moves, 0), 29988 orientation: defaultValue( 29989 props.orientation, 29990 syncState == null ? void 0 : syncState.orientation, 29991 "both" 29992 ), 29993 rtl: defaultValue(props.rtl, syncState == null ? void 0 : syncState.rtl, false), 29994 virtualFocus: defaultValue( 29995 props.virtualFocus, 29996 syncState == null ? void 0 : syncState.virtualFocus, 29997 false 29998 ), 29999 focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, false), 30000 focusWrap: defaultValue(props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, false), 30001 focusShift: defaultValue(props.focusShift, syncState == null ? void 0 : syncState.focusShift, false) 30002 }); 30003 const composite = createStore(initialState, collection, props.store); 30004 setup( 30005 composite, 30006 () => sync(composite, ["renderedItems", "activeId"], (state) => { 30007 composite.setState("activeId", (activeId2) => { 30008 var _a2; 30009 if (activeId2 !== void 0) return activeId2; 30010 return (_a2 = findFirstEnabledItem(state.renderedItems)) == null ? void 0 : _a2.id; 30011 }); 30012 }) 30013 ); 30014 const getNextId = (direction = "next", options = {}) => { 30015 var _a2, _b; 30016 const defaultState = composite.getState(); 30017 const { 30018 skip = 0, 30019 activeId: activeId2 = defaultState.activeId, 30020 focusShift = defaultState.focusShift, 30021 focusLoop = defaultState.focusLoop, 30022 focusWrap = defaultState.focusWrap, 30023 includesBaseElement = defaultState.includesBaseElement, 30024 renderedItems = defaultState.renderedItems, 30025 rtl = defaultState.rtl 30026 } = options; 30027 const isVerticalDirection = direction === "up" || direction === "down"; 30028 const isNextDirection = direction === "next" || direction === "down"; 30029 const canReverse = isNextDirection ? rtl && !isVerticalDirection : !rtl || isVerticalDirection; 30030 const canShift = focusShift && !skip; 30031 let items = !isVerticalDirection ? renderedItems : flatten2DArray( 30032 normalizeRows(groupItemsByRows(renderedItems), activeId2, canShift) 30033 ); 30034 items = canReverse ? reverseArray(items) : items; 30035 items = isVerticalDirection ? verticalizeItems(items) : items; 30036 if (activeId2 == null) { 30037 return (_a2 = findFirstEnabledItem(items)) == null ? void 0 : _a2.id; 30038 } 30039 const activeItem = items.find((item) => item.id === activeId2); 30040 if (!activeItem) { 30041 return (_b = findFirstEnabledItem(items)) == null ? void 0 : _b.id; 30042 } 30043 const isGrid = items.some((item) => item.rowId); 30044 const activeIndex = items.indexOf(activeItem); 30045 const nextItems = items.slice(activeIndex + 1); 30046 const nextItemsInRow = getItemsInRow(nextItems, activeItem.rowId); 30047 if (skip) { 30048 const nextEnabledItemsInRow = getEnabledItems(nextItemsInRow, activeId2); 30049 const nextItem2 = nextEnabledItemsInRow.slice(skip)[0] || // If we can't find an item, just return the last one. 30050 nextEnabledItemsInRow[nextEnabledItemsInRow.length - 1]; 30051 return nextItem2 == null ? void 0 : nextItem2.id; 30052 } 30053 const canLoop = focusLoop && (isVerticalDirection ? focusLoop !== "horizontal" : focusLoop !== "vertical"); 30054 const canWrap = isGrid && focusWrap && (isVerticalDirection ? focusWrap !== "horizontal" : focusWrap !== "vertical"); 30055 const hasNullItem = isNextDirection ? (!isGrid || isVerticalDirection) && canLoop && includesBaseElement : isVerticalDirection ? includesBaseElement : false; 30056 if (canLoop) { 30057 const loopItems = canWrap && !hasNullItem ? items : getItemsInRow(items, activeItem.rowId); 30058 const sortedItems = flipItems(loopItems, activeId2, hasNullItem); 30059 const nextItem2 = findFirstEnabledItem(sortedItems, activeId2); 30060 return nextItem2 == null ? void 0 : nextItem2.id; 30061 } 30062 if (canWrap) { 30063 const nextItem2 = findFirstEnabledItem( 30064 // We can use nextItems, which contains all the next items, including 30065 // items from other rows, to wrap between rows. However, if there is a 30066 // null item (the composite container), we'll only use the next items in 30067 // the row. So moving next from the last item will focus on the 30068 // composite container. On grid composites, horizontal navigation never 30069 // focuses on the composite container, only vertical. 30070 hasNullItem ? nextItemsInRow : nextItems, 30071 activeId2 30072 ); 30073 const nextId = hasNullItem ? (nextItem2 == null ? void 0 : nextItem2.id) || null : nextItem2 == null ? void 0 : nextItem2.id; 30074 return nextId; 30075 } 30076 const nextItem = findFirstEnabledItem(nextItemsInRow, activeId2); 30077 if (!nextItem && hasNullItem) { 30078 return null; 30079 } 30080 return nextItem == null ? void 0 : nextItem.id; 30081 }; 30082 return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, collection), composite), { 30083 setBaseElement: (element) => composite.setState("baseElement", element), 30084 setActiveId: (id) => composite.setState("activeId", id), 30085 move: (id) => { 30086 if (id === void 0) return; 30087 composite.setState("activeId", id); 30088 composite.setState("moves", (moves) => moves + 1); 30089 }, 30090 first: () => { 30091 var _a2; 30092 return (_a2 = findFirstEnabledItem(composite.getState().renderedItems)) == null ? void 0 : _a2.id; 30093 }, 30094 last: () => { 30095 var _a2; 30096 return (_a2 = findFirstEnabledItem(reverseArray(composite.getState().renderedItems))) == null ? void 0 : _a2.id; 30097 }, 30098 next: (options) => { 30099 if (options !== void 0 && typeof options === "number") { 30100 options = { skip: options }; 30101 } 30102 return getNextId("next", options); 30103 }, 30104 previous: (options) => { 30105 if (options !== void 0 && typeof options === "number") { 30106 options = { skip: options }; 30107 } 30108 return getNextId("previous", options); 30109 }, 30110 down: (options) => { 30111 if (options !== void 0 && typeof options === "number") { 30112 options = { skip: options }; 30113 } 30114 return getNextId("down", options); 30115 }, 30116 up: (options) => { 30117 if (options !== void 0 && typeof options === "number") { 30118 options = { skip: options }; 30119 } 30120 return getNextId("up", options); 30121 } 30122 }); 30123 } 30124 30125 30126 30127 ;// ./node_modules/@ariakit/core/esm/__chunks/RCQ5P4YE.js 30128 "use client"; 30129 30130 30131 30132 30133 // src/disclosure/disclosure-store.ts 30134 function createDisclosureStore(props = {}) { 30135 const store = mergeStore( 30136 props.store, 30137 omit2(props.disclosure, ["contentElement", "disclosureElement"]) 30138 ); 30139 throwOnConflictingProps(props, store); 30140 const syncState = store == null ? void 0 : store.getState(); 30141 const open = defaultValue( 30142 props.open, 30143 syncState == null ? void 0 : syncState.open, 30144 props.defaultOpen, 30145 false 30146 ); 30147 const animated = defaultValue(props.animated, syncState == null ? void 0 : syncState.animated, false); 30148 const initialState = { 30149 open, 30150 animated, 30151 animating: !!animated && open, 30152 mounted: open, 30153 contentElement: defaultValue(syncState == null ? void 0 : syncState.contentElement, null), 30154 disclosureElement: defaultValue(syncState == null ? void 0 : syncState.disclosureElement, null) 30155 }; 30156 const disclosure = createStore(initialState, store); 30157 setup( 30158 disclosure, 30159 () => sync(disclosure, ["animated", "animating"], (state) => { 30160 if (state.animated) return; 30161 disclosure.setState("animating", false); 30162 }) 30163 ); 30164 setup( 30165 disclosure, 30166 () => subscribe(disclosure, ["open"], () => { 30167 if (!disclosure.getState().animated) return; 30168 disclosure.setState("animating", true); 30169 }) 30170 ); 30171 setup( 30172 disclosure, 30173 () => sync(disclosure, ["open", "animating"], (state) => { 30174 disclosure.setState("mounted", state.open || state.animating); 30175 }) 30176 ); 30177 return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, disclosure), { 30178 disclosure: props.disclosure, 30179 setOpen: (value) => disclosure.setState("open", value), 30180 show: () => disclosure.setState("open", true), 30181 hide: () => disclosure.setState("open", false), 30182 toggle: () => disclosure.setState("open", (open2) => !open2), 30183 stopAnimation: () => disclosure.setState("animating", false), 30184 setContentElement: (value) => disclosure.setState("contentElement", value), 30185 setDisclosureElement: (value) => disclosure.setState("disclosureElement", value) 30186 }); 30187 } 30188 30189 30190 30191 ;// ./node_modules/@ariakit/core/esm/__chunks/FZZ2AVHF.js 30192 "use client"; 30193 30194 30195 // src/dialog/dialog-store.ts 30196 function createDialogStore(props = {}) { 30197 return createDisclosureStore(props); 30198 } 30199 30200 30201 30202 ;// ./node_modules/@ariakit/core/esm/__chunks/ME2CUF3F.js 30203 "use client"; 30204 30205 30206 30207 30208 30209 // src/popover/popover-store.ts 30210 function createPopoverStore(_a = {}) { 30211 var _b = _a, { 30212 popover: otherPopover 30213 } = _b, props = _3YLGPPWQ_objRest(_b, [ 30214 "popover" 30215 ]); 30216 const store = mergeStore( 30217 props.store, 30218 omit2(otherPopover, [ 30219 "arrowElement", 30220 "anchorElement", 30221 "contentElement", 30222 "popoverElement", 30223 "disclosureElement" 30224 ]) 30225 ); 30226 throwOnConflictingProps(props, store); 30227 const syncState = store == null ? void 0 : store.getState(); 30228 const dialog = createDialogStore(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, props), { store })); 30229 const placement = defaultValue( 30230 props.placement, 30231 syncState == null ? void 0 : syncState.placement, 30232 "bottom" 30233 ); 30234 const initialState = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, dialog.getState()), { 30235 placement, 30236 currentPlacement: placement, 30237 anchorElement: defaultValue(syncState == null ? void 0 : syncState.anchorElement, null), 30238 popoverElement: defaultValue(syncState == null ? void 0 : syncState.popoverElement, null), 30239 arrowElement: defaultValue(syncState == null ? void 0 : syncState.arrowElement, null), 30240 rendered: Symbol("rendered") 30241 }); 30242 const popover = createStore(initialState, dialog, store); 30243 return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, dialog), popover), { 30244 setAnchorElement: (element) => popover.setState("anchorElement", element), 30245 setPopoverElement: (element) => popover.setState("popoverElement", element), 30246 setArrowElement: (element) => popover.setState("arrowElement", element), 30247 render: () => popover.setState("rendered", Symbol("rendered")) 30248 }); 30249 } 30250 30251 30252 30253 ;// ./node_modules/@ariakit/core/esm/combobox/combobox-store.js 30254 "use client"; 30255 30256 30257 30258 30259 30260 30261 30262 30263 30264 30265 30266 30267 // src/combobox/combobox-store.ts 30268 var isTouchSafari = isSafari() && isTouchDevice(); 30269 function createComboboxStore(_a = {}) { 30270 var _b = _a, { 30271 tag 30272 } = _b, props = _3YLGPPWQ_objRest(_b, [ 30273 "tag" 30274 ]); 30275 const store = mergeStore(props.store, pick2(tag, ["value", "rtl"])); 30276 throwOnConflictingProps(props, store); 30277 const tagState = tag == null ? void 0 : tag.getState(); 30278 const syncState = store == null ? void 0 : store.getState(); 30279 const activeId = defaultValue( 30280 props.activeId, 30281 syncState == null ? void 0 : syncState.activeId, 30282 props.defaultActiveId, 30283 null 30284 ); 30285 const composite = createCompositeStore(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, props), { 30286 activeId, 30287 includesBaseElement: defaultValue( 30288 props.includesBaseElement, 30289 syncState == null ? void 0 : syncState.includesBaseElement, 30290 true 30291 ), 30292 orientation: defaultValue( 30293 props.orientation, 30294 syncState == null ? void 0 : syncState.orientation, 30295 "vertical" 30296 ), 30297 focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true), 30298 focusWrap: defaultValue(props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, true), 30299 virtualFocus: defaultValue( 30300 props.virtualFocus, 30301 syncState == null ? void 0 : syncState.virtualFocus, 30302 true 30303 ) 30304 })); 30305 const popover = createPopoverStore(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, props), { 30306 placement: defaultValue( 30307 props.placement, 30308 syncState == null ? void 0 : syncState.placement, 30309 "bottom-start" 30310 ) 30311 })); 30312 const value = defaultValue( 30313 props.value, 30314 syncState == null ? void 0 : syncState.value, 30315 props.defaultValue, 30316 "" 30317 ); 30318 const selectedValue = defaultValue( 30319 props.selectedValue, 30320 syncState == null ? void 0 : syncState.selectedValue, 30321 tagState == null ? void 0 : tagState.values, 30322 props.defaultSelectedValue, 30323 "" 30324 ); 30325 const multiSelectable = Array.isArray(selectedValue); 30326 const initialState = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, composite.getState()), popover.getState()), { 30327 value, 30328 selectedValue, 30329 resetValueOnSelect: defaultValue( 30330 props.resetValueOnSelect, 30331 syncState == null ? void 0 : syncState.resetValueOnSelect, 30332 multiSelectable 30333 ), 30334 resetValueOnHide: defaultValue( 30335 props.resetValueOnHide, 30336 syncState == null ? void 0 : syncState.resetValueOnHide, 30337 multiSelectable && !tag 30338 ), 30339 activeValue: syncState == null ? void 0 : syncState.activeValue 30340 }); 30341 const combobox = createStore(initialState, composite, popover, store); 30342 if (isTouchSafari) { 30343 setup( 30344 combobox, 30345 () => sync(combobox, ["virtualFocus"], () => { 30346 combobox.setState("virtualFocus", false); 30347 }) 30348 ); 30349 } 30350 setup(combobox, () => { 30351 if (!tag) return; 30352 return chain( 30353 sync(combobox, ["selectedValue"], (state) => { 30354 if (!Array.isArray(state.selectedValue)) return; 30355 tag.setValues(state.selectedValue); 30356 }), 30357 sync(tag, ["values"], (state) => { 30358 combobox.setState("selectedValue", state.values); 30359 }) 30360 ); 30361 }); 30362 setup( 30363 combobox, 30364 () => sync(combobox, ["resetValueOnHide", "mounted"], (state) => { 30365 if (!state.resetValueOnHide) return; 30366 if (state.mounted) return; 30367 combobox.setState("value", value); 30368 }) 30369 ); 30370 setup( 30371 combobox, 30372 () => sync(combobox, ["open"], (state) => { 30373 if (state.open) return; 30374 combobox.setState("activeId", activeId); 30375 combobox.setState("moves", 0); 30376 }) 30377 ); 30378 setup( 30379 combobox, 30380 () => sync(combobox, ["moves", "activeId"], (state, prevState) => { 30381 if (state.moves === prevState.moves) { 30382 combobox.setState("activeValue", void 0); 30383 } 30384 }) 30385 ); 30386 setup( 30387 combobox, 30388 () => batch(combobox, ["moves", "renderedItems"], (state, prev) => { 30389 if (state.moves === prev.moves) return; 30390 const { activeId: activeId2 } = combobox.getState(); 30391 const activeItem = composite.item(activeId2); 30392 combobox.setState("activeValue", activeItem == null ? void 0 : activeItem.value); 30393 }) 30394 ); 30395 return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, popover), composite), combobox), { 30396 tag, 30397 setValue: (value2) => combobox.setState("value", value2), 30398 resetValue: () => combobox.setState("value", initialState.value), 30399 setSelectedValue: (selectedValue2) => combobox.setState("selectedValue", selectedValue2) 30400 }); 30401 } 30402 30403 30404 ;// ./node_modules/@ariakit/react-core/esm/__chunks/FEOFMWBY.js 30405 "use client"; 30406 30407 30408 30409 30410 30411 30412 30413 // src/combobox/combobox-store.ts 30414 30415 function useComboboxStoreOptions(props) { 30416 const tag = useTagContext(); 30417 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { 30418 tag: props.tag !== void 0 ? props.tag : tag 30419 }); 30420 return useCompositeStoreOptions(props); 30421 } 30422 function useComboboxStoreProps(store, update, props) { 30423 useUpdateEffect(update, [props.tag]); 30424 useStoreProps(store, props, "value", "setValue"); 30425 useStoreProps(store, props, "selectedValue", "setSelectedValue"); 30426 useStoreProps(store, props, "resetValueOnHide"); 30427 useStoreProps(store, props, "resetValueOnSelect"); 30428 return Object.assign( 30429 useCompositeStoreProps( 30430 usePopoverStoreProps(store, update, props), 30431 update, 30432 props 30433 ), 30434 { tag: props.tag } 30435 ); 30436 } 30437 function useComboboxStore(props = {}) { 30438 props = useComboboxStoreOptions(props); 30439 const [store, update] = YV4JVR4I_useStore(createComboboxStore, props); 30440 return useComboboxStoreProps(store, update, props); 30441 } 30442 30443 30444 30445 ;// ./node_modules/@ariakit/react-core/esm/__chunks/S6EF7IVO.js 30446 "use client"; 30447 30448 30449 // src/disclosure/disclosure-context.tsx 30450 var S6EF7IVO_ctx = createStoreContext(); 30451 var useDisclosureContext = S6EF7IVO_ctx.useContext; 30452 var useDisclosureScopedContext = S6EF7IVO_ctx.useScopedContext; 30453 var useDisclosureProviderContext = S6EF7IVO_ctx.useProviderContext; 30454 var DisclosureContextProvider = S6EF7IVO_ctx.ContextProvider; 30455 var DisclosureScopedContextProvider = S6EF7IVO_ctx.ScopedContextProvider; 30456 30457 30458 30459 ;// ./node_modules/@ariakit/react-core/esm/__chunks/RS7LB2H4.js 30460 "use client"; 30461 30462 30463 30464 // src/dialog/dialog-context.tsx 30465 30466 var RS7LB2H4_ctx = createStoreContext( 30467 [DisclosureContextProvider], 30468 [DisclosureScopedContextProvider] 30469 ); 30470 var useDialogContext = RS7LB2H4_ctx.useContext; 30471 var useDialogScopedContext = RS7LB2H4_ctx.useScopedContext; 30472 var useDialogProviderContext = RS7LB2H4_ctx.useProviderContext; 30473 var DialogContextProvider = RS7LB2H4_ctx.ContextProvider; 30474 var DialogScopedContextProvider = RS7LB2H4_ctx.ScopedContextProvider; 30475 var DialogHeadingContext = (0,external_React_.createContext)(void 0); 30476 var DialogDescriptionContext = (0,external_React_.createContext)(void 0); 30477 30478 30479 30480 ;// ./node_modules/@ariakit/react-core/esm/__chunks/MTZPJQMC.js 30481 "use client"; 30482 30483 30484 30485 // src/popover/popover-context.tsx 30486 var MTZPJQMC_ctx = createStoreContext( 30487 [DialogContextProvider], 30488 [DialogScopedContextProvider] 30489 ); 30490 var usePopoverContext = MTZPJQMC_ctx.useContext; 30491 var usePopoverScopedContext = MTZPJQMC_ctx.useScopedContext; 30492 var usePopoverProviderContext = MTZPJQMC_ctx.useProviderContext; 30493 var PopoverContextProvider = MTZPJQMC_ctx.ContextProvider; 30494 var PopoverScopedContextProvider = MTZPJQMC_ctx.ScopedContextProvider; 30495 30496 30497 30498 ;// ./node_modules/@ariakit/react-core/esm/__chunks/VEVQD5MH.js 30499 "use client"; 30500 30501 30502 30503 30504 // src/combobox/combobox-context.tsx 30505 30506 var ComboboxListRoleContext = (0,external_React_.createContext)( 30507 void 0 30508 ); 30509 var VEVQD5MH_ctx = createStoreContext( 30510 [PopoverContextProvider, CompositeContextProvider], 30511 [PopoverScopedContextProvider, CompositeScopedContextProvider] 30512 ); 30513 var useComboboxContext = VEVQD5MH_ctx.useContext; 30514 var useComboboxScopedContext = VEVQD5MH_ctx.useScopedContext; 30515 var useComboboxProviderContext = VEVQD5MH_ctx.useProviderContext; 30516 var ComboboxContextProvider = VEVQD5MH_ctx.ContextProvider; 30517 var ComboboxScopedContextProvider = VEVQD5MH_ctx.ScopedContextProvider; 30518 var ComboboxItemValueContext = (0,external_React_.createContext)( 30519 void 0 30520 ); 30521 var ComboboxItemCheckedContext = (0,external_React_.createContext)(false); 30522 30523 30524 30525 ;// ./node_modules/@ariakit/react-core/esm/combobox/combobox-provider.js 30526 "use client"; 30527 30528 30529 30530 30531 30532 30533 30534 30535 30536 30537 30538 30539 30540 30541 30542 30543 30544 30545 30546 // src/combobox/combobox-provider.tsx 30547 30548 function ComboboxProvider(props = {}) { 30549 const store = useComboboxStore(props); 30550 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxContextProvider, { value: store, children: props.children }); 30551 } 30552 30553 30554 ;// ./node_modules/@ariakit/react-core/esm/combobox/combobox-label.js 30555 "use client"; 30556 30557 30558 30559 30560 30561 30562 30563 30564 30565 30566 30567 // src/combobox/combobox-label.tsx 30568 30569 var TagName = "label"; 30570 var useComboboxLabel = createHook( 30571 function useComboboxLabel2(_a) { 30572 var _b = _a, { store } = _b, props = __objRest(_b, ["store"]); 30573 const context = useComboboxProviderContext(); 30574 store = store || context; 30575 invariant( 30576 store, 30577 false && 0 30578 ); 30579 const comboboxId = store.useState((state) => { 30580 var _a2; 30581 return (_a2 = state.baseElement) == null ? void 0 : _a2.id; 30582 }); 30583 props = _3YLGPPWQ_spreadValues({ 30584 htmlFor: comboboxId 30585 }, props); 30586 return removeUndefinedValues(props); 30587 } 30588 ); 30589 var ComboboxLabel = memo2( 30590 forwardRef2(function ComboboxLabel2(props) { 30591 const htmlProps = useComboboxLabel(props); 30592 return createElement(TagName, htmlProps); 30593 }) 30594 ); 30595 30596 30597 ;// ./node_modules/@ariakit/react-core/esm/__chunks/OMU7RWRV.js 30598 "use client"; 30599 30600 30601 30602 30603 30604 // src/popover/popover-anchor.tsx 30605 var OMU7RWRV_TagName = "div"; 30606 var usePopoverAnchor = createHook( 30607 function usePopoverAnchor2(_a) { 30608 var _b = _a, { store } = _b, props = __objRest(_b, ["store"]); 30609 const context = usePopoverProviderContext(); 30610 store = store || context; 30611 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { 30612 ref: useMergeRefs(store == null ? void 0 : store.setAnchorElement, props.ref) 30613 }); 30614 return props; 30615 } 30616 ); 30617 var PopoverAnchor = forwardRef2(function PopoverAnchor2(props) { 30618 const htmlProps = usePopoverAnchor(props); 30619 return createElement(OMU7RWRV_TagName, htmlProps); 30620 }); 30621 30622 30623 30624 ;// ./node_modules/@ariakit/react-core/esm/__chunks/5VQZOHHZ.js 30625 "use client"; 30626 30627 // src/composite/utils.ts 30628 30629 var _5VQZOHHZ_NULL_ITEM = { id: null }; 30630 function _5VQZOHHZ_flipItems(items, activeId, shouldInsertNullItem = false) { 30631 const index = items.findIndex((item) => item.id === activeId); 30632 return [ 30633 ...items.slice(index + 1), 30634 ...shouldInsertNullItem ? [_5VQZOHHZ_NULL_ITEM] : [], 30635 ...items.slice(0, index) 30636 ]; 30637 } 30638 function _5VQZOHHZ_findFirstEnabledItem(items, excludeId) { 30639 return items.find((item) => { 30640 if (excludeId) { 30641 return !item.disabled && item.id !== excludeId; 30642 } 30643 return !item.disabled; 30644 }); 30645 } 30646 function getEnabledItem(store, id) { 30647 if (!id) return null; 30648 return store.item(id) || null; 30649 } 30650 function _5VQZOHHZ_groupItemsByRows(items) { 30651 const rows = []; 30652 for (const item of items) { 30653 const row = rows.find((currentRow) => { 30654 var _a; 30655 return ((_a = currentRow[0]) == null ? void 0 : _a.rowId) === item.rowId; 30656 }); 30657 if (row) { 30658 row.push(item); 30659 } else { 30660 rows.push([item]); 30661 } 30662 } 30663 return rows; 30664 } 30665 function selectTextField(element, collapseToEnd = false) { 30666 if (isTextField(element)) { 30667 element.setSelectionRange( 30668 collapseToEnd ? element.value.length : 0, 30669 element.value.length 30670 ); 30671 } else if (element.isContentEditable) { 30672 const selection = getDocument(element).getSelection(); 30673 selection == null ? void 0 : selection.selectAllChildren(element); 30674 if (collapseToEnd) { 30675 selection == null ? void 0 : selection.collapseToEnd(); 30676 } 30677 } 30678 } 30679 var FOCUS_SILENTLY = Symbol("FOCUS_SILENTLY"); 30680 function focusSilently(element) { 30681 element[FOCUS_SILENTLY] = true; 30682 element.focus({ preventScroll: true }); 30683 } 30684 function silentlyFocused(element) { 30685 const isSilentlyFocused = element[FOCUS_SILENTLY]; 30686 delete element[FOCUS_SILENTLY]; 30687 return isSilentlyFocused; 30688 } 30689 function isItem(store, element, exclude) { 30690 if (!element) return false; 30691 if (element === exclude) return false; 30692 const item = store.item(element.id); 30693 if (!item) return false; 30694 if (exclude && item.element === exclude) return false; 30695 return true; 30696 } 30697 30698 30699 30700 ;// ./node_modules/@ariakit/react-core/esm/__chunks/SWN3JYXT.js 30701 "use client"; 30702 30703 // src/focusable/focusable-context.tsx 30704 30705 var FocusableContext = (0,external_React_.createContext)(true); 30706 30707 30708 30709 ;// ./node_modules/@ariakit/core/esm/utils/focus.js 30710 "use client"; 30711 30712 30713 30714 // src/utils/focus.ts 30715 var selector = "input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], summary, iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])"; 30716 function hasNegativeTabIndex(element) { 30717 const tabIndex = Number.parseInt(element.getAttribute("tabindex") || "0", 10); 30718 return tabIndex < 0; 30719 } 30720 function isFocusable(element) { 30721 if (!element.matches(selector)) return false; 30722 if (!isVisible(element)) return false; 30723 if (element.closest("[inert]")) return false; 30724 return true; 30725 } 30726 function isTabbable(element) { 30727 if (!isFocusable(element)) return false; 30728 if (hasNegativeTabIndex(element)) return false; 30729 if (!("form" in element)) return true; 30730 if (!element.form) return true; 30731 if (element.checked) return true; 30732 if (element.type !== "radio") return true; 30733 const radioGroup = element.form.elements.namedItem(element.name); 30734 if (!radioGroup) return true; 30735 if (!("length" in radioGroup)) return true; 30736 const activeElement = getActiveElement(element); 30737 if (!activeElement) return true; 30738 if (activeElement === element) return true; 30739 if (!("form" in activeElement)) return true; 30740 if (activeElement.form !== element.form) return true; 30741 if (activeElement.name !== element.name) return true; 30742 return false; 30743 } 30744 function getAllFocusableIn(container, includeContainer) { 30745 const elements = Array.from( 30746 container.querySelectorAll(selector) 30747 ); 30748 if (includeContainer) { 30749 elements.unshift(container); 30750 } 30751 const focusableElements = elements.filter(isFocusable); 30752 focusableElements.forEach((element, i) => { 30753 if (isFrame(element) && element.contentDocument) { 30754 const frameBody = element.contentDocument.body; 30755 focusableElements.splice(i, 1, ...getAllFocusableIn(frameBody)); 30756 } 30757 }); 30758 return focusableElements; 30759 } 30760 function getAllFocusable(includeBody) { 30761 return getAllFocusableIn(document.body, includeBody); 30762 } 30763 function getFirstFocusableIn(container, includeContainer) { 30764 const [first] = getAllFocusableIn(container, includeContainer); 30765 return first || null; 30766 } 30767 function getFirstFocusable(includeBody) { 30768 return getFirstFocusableIn(document.body, includeBody); 30769 } 30770 function getAllTabbableIn(container, includeContainer, fallbackToFocusable) { 30771 const elements = Array.from( 30772 container.querySelectorAll(selector) 30773 ); 30774 const tabbableElements = elements.filter(isTabbable); 30775 if (includeContainer && isTabbable(container)) { 30776 tabbableElements.unshift(container); 30777 } 30778 tabbableElements.forEach((element, i) => { 30779 if (isFrame(element) && element.contentDocument) { 30780 const frameBody = element.contentDocument.body; 30781 const allFrameTabbable = getAllTabbableIn( 30782 frameBody, 30783 false, 30784 fallbackToFocusable 30785 ); 30786 tabbableElements.splice(i, 1, ...allFrameTabbable); 30787 } 30788 }); 30789 if (!tabbableElements.length && fallbackToFocusable) { 30790 return elements; 30791 } 30792 return tabbableElements; 30793 } 30794 function getAllTabbable(fallbackToFocusable) { 30795 return getAllTabbableIn(document.body, false, fallbackToFocusable); 30796 } 30797 function getFirstTabbableIn(container, includeContainer, fallbackToFocusable) { 30798 const [first] = getAllTabbableIn( 30799 container, 30800 includeContainer, 30801 fallbackToFocusable 30802 ); 30803 return first || null; 30804 } 30805 function getFirstTabbable(fallbackToFocusable) { 30806 return getFirstTabbableIn(document.body, false, fallbackToFocusable); 30807 } 30808 function getLastTabbableIn(container, includeContainer, fallbackToFocusable) { 30809 const allTabbable = getAllTabbableIn( 30810 container, 30811 includeContainer, 30812 fallbackToFocusable 30813 ); 30814 return allTabbable[allTabbable.length - 1] || null; 30815 } 30816 function getLastTabbable(fallbackToFocusable) { 30817 return getLastTabbableIn(document.body, false, fallbackToFocusable); 30818 } 30819 function getNextTabbableIn(container, includeContainer, fallbackToFirst, fallbackToFocusable) { 30820 const activeElement = getActiveElement(container); 30821 const allFocusable = getAllFocusableIn(container, includeContainer); 30822 const activeIndex = allFocusable.indexOf(activeElement); 30823 const nextFocusableElements = allFocusable.slice(activeIndex + 1); 30824 return nextFocusableElements.find(isTabbable) || (fallbackToFirst ? allFocusable.find(isTabbable) : null) || (fallbackToFocusable ? nextFocusableElements[0] : null) || null; 30825 } 30826 function getNextTabbable(fallbackToFirst, fallbackToFocusable) { 30827 return getNextTabbableIn( 30828 document.body, 30829 false, 30830 fallbackToFirst, 30831 fallbackToFocusable 30832 ); 30833 } 30834 function getPreviousTabbableIn(container, includeContainer, fallbackToLast, fallbackToFocusable) { 30835 const activeElement = getActiveElement(container); 30836 const allFocusable = getAllFocusableIn(container, includeContainer).reverse(); 30837 const activeIndex = allFocusable.indexOf(activeElement); 30838 const previousFocusableElements = allFocusable.slice(activeIndex + 1); 30839 return previousFocusableElements.find(isTabbable) || (fallbackToLast ? allFocusable.find(isTabbable) : null) || (fallbackToFocusable ? previousFocusableElements[0] : null) || null; 30840 } 30841 function getPreviousTabbable(fallbackToFirst, fallbackToFocusable) { 30842 return getPreviousTabbableIn( 30843 document.body, 30844 false, 30845 fallbackToFirst, 30846 fallbackToFocusable 30847 ); 30848 } 30849 function getClosestFocusable(element) { 30850 while (element && !isFocusable(element)) { 30851 element = element.closest(selector); 30852 } 30853 return element || null; 30854 } 30855 function hasFocus(element) { 30856 const activeElement = DTR5TSDJ_getActiveElement(element); 30857 if (!activeElement) return false; 30858 if (activeElement === element) return true; 30859 const activeDescendant = activeElement.getAttribute("aria-activedescendant"); 30860 if (!activeDescendant) return false; 30861 return activeDescendant === element.id; 30862 } 30863 function hasFocusWithin(element) { 30864 const activeElement = DTR5TSDJ_getActiveElement(element); 30865 if (!activeElement) return false; 30866 if (contains(element, activeElement)) return true; 30867 const activeDescendant = activeElement.getAttribute("aria-activedescendant"); 30868 if (!activeDescendant) return false; 30869 if (!("id" in element)) return false; 30870 if (activeDescendant === element.id) return true; 30871 return !!element.querySelector(`#$CSS.escape(activeDescendant)}`); 30872 } 30873 function focusIfNeeded(element) { 30874 if (!hasFocusWithin(element) && isFocusable(element)) { 30875 element.focus(); 30876 } 30877 } 30878 function disableFocus(element) { 30879 var _a; 30880 const currentTabindex = (_a = element.getAttribute("tabindex")) != null ? _a : ""; 30881 element.setAttribute("data-tabindex", currentTabindex); 30882 element.setAttribute("tabindex", "-1"); 30883 } 30884 function disableFocusIn(container, includeContainer) { 30885 const tabbableElements = getAllTabbableIn(container, includeContainer); 30886 for (const element of tabbableElements) { 30887 disableFocus(element); 30888 } 30889 } 30890 function restoreFocusIn(container) { 30891 const elements = container.querySelectorAll("[data-tabindex]"); 30892 const restoreTabIndex = (element) => { 30893 const tabindex = element.getAttribute("data-tabindex"); 30894 element.removeAttribute("data-tabindex"); 30895 if (tabindex) { 30896 element.setAttribute("tabindex", tabindex); 30897 } else { 30898 element.removeAttribute("tabindex"); 30899 } 30900 }; 30901 if (container.hasAttribute("data-tabindex")) { 30902 restoreTabIndex(container); 30903 } 30904 for (const element of elements) { 30905 restoreTabIndex(element); 30906 } 30907 } 30908 function focusIntoView(element, options) { 30909 if (!("scrollIntoView" in element)) { 30910 element.focus(); 30911 } else { 30912 element.focus({ preventScroll: true }); 30913 element.scrollIntoView(_chunks_3YLGPPWQ_spreadValues({ block: "nearest", inline: "nearest" }, options)); 30914 } 30915 } 30916 30917 30918 ;// ./node_modules/@ariakit/react-core/esm/__chunks/LVA2YJMS.js 30919 "use client"; 30920 30921 30922 30923 30924 30925 // src/focusable/focusable.tsx 30926 30927 30928 30929 30930 30931 30932 var LVA2YJMS_TagName = "div"; 30933 var isSafariBrowser = isSafari(); 30934 var alwaysFocusVisibleInputTypes = [ 30935 "text", 30936 "search", 30937 "url", 30938 "tel", 30939 "email", 30940 "password", 30941 "number", 30942 "date", 30943 "month", 30944 "week", 30945 "time", 30946 "datetime", 30947 "datetime-local" 30948 ]; 30949 var safariFocusAncestorSymbol = Symbol("safariFocusAncestor"); 30950 function isSafariFocusAncestor(element) { 30951 if (!element) return false; 30952 return !!element[safariFocusAncestorSymbol]; 30953 } 30954 function markSafariFocusAncestor(element, value) { 30955 if (!element) return; 30956 element[safariFocusAncestorSymbol] = value; 30957 } 30958 function isAlwaysFocusVisible(element) { 30959 const { tagName, readOnly, type } = element; 30960 if (tagName === "TEXTAREA" && !readOnly) return true; 30961 if (tagName === "SELECT" && !readOnly) return true; 30962 if (tagName === "INPUT" && !readOnly) { 30963 return alwaysFocusVisibleInputTypes.includes(type); 30964 } 30965 if (element.isContentEditable) return true; 30966 const role = element.getAttribute("role"); 30967 if (role === "combobox" && element.dataset.name) { 30968 return true; 30969 } 30970 return false; 30971 } 30972 function getLabels(element) { 30973 if ("labels" in element) { 30974 return element.labels; 30975 } 30976 return null; 30977 } 30978 function isNativeCheckboxOrRadio(element) { 30979 const tagName = element.tagName.toLowerCase(); 30980 if (tagName === "input" && element.type) { 30981 return element.type === "radio" || element.type === "checkbox"; 30982 } 30983 return false; 30984 } 30985 function isNativeTabbable(tagName) { 30986 if (!tagName) return true; 30987 return tagName === "button" || tagName === "summary" || tagName === "input" || tagName === "select" || tagName === "textarea" || tagName === "a"; 30988 } 30989 function supportsDisabledAttribute(tagName) { 30990 if (!tagName) return true; 30991 return tagName === "button" || tagName === "input" || tagName === "select" || tagName === "textarea"; 30992 } 30993 function getTabIndex(focusable, trulyDisabled, nativeTabbable, supportsDisabled, tabIndexProp) { 30994 if (!focusable) { 30995 return tabIndexProp; 30996 } 30997 if (trulyDisabled) { 30998 if (nativeTabbable && !supportsDisabled) { 30999 return -1; 31000 } 31001 return; 31002 } 31003 if (nativeTabbable) { 31004 return tabIndexProp; 31005 } 31006 return tabIndexProp || 0; 31007 } 31008 function useDisableEvent(onEvent, disabled) { 31009 return useEvent((event) => { 31010 onEvent == null ? void 0 : onEvent(event); 31011 if (event.defaultPrevented) return; 31012 if (disabled) { 31013 event.stopPropagation(); 31014 event.preventDefault(); 31015 } 31016 }); 31017 } 31018 var isKeyboardModality = true; 31019 function onGlobalMouseDown(event) { 31020 const target = event.target; 31021 if (target && "hasAttribute" in target) { 31022 if (!target.hasAttribute("data-focus-visible")) { 31023 isKeyboardModality = false; 31024 } 31025 } 31026 } 31027 function onGlobalKeyDown(event) { 31028 if (event.metaKey) return; 31029 if (event.ctrlKey) return; 31030 if (event.altKey) return; 31031 isKeyboardModality = true; 31032 } 31033 var useFocusable = createHook( 31034 function useFocusable2(_a) { 31035 var _b = _a, { 31036 focusable = true, 31037 accessibleWhenDisabled, 31038 autoFocus, 31039 onFocusVisible 31040 } = _b, props = __objRest(_b, [ 31041 "focusable", 31042 "accessibleWhenDisabled", 31043 "autoFocus", 31044 "onFocusVisible" 31045 ]); 31046 const ref = (0,external_React_.useRef)(null); 31047 (0,external_React_.useEffect)(() => { 31048 if (!focusable) return; 31049 addGlobalEventListener("mousedown", onGlobalMouseDown, true); 31050 addGlobalEventListener("keydown", onGlobalKeyDown, true); 31051 }, [focusable]); 31052 if (isSafariBrowser) { 31053 (0,external_React_.useEffect)(() => { 31054 if (!focusable) return; 31055 const element = ref.current; 31056 if (!element) return; 31057 if (!isNativeCheckboxOrRadio(element)) return; 31058 const labels = getLabels(element); 31059 if (!labels) return; 31060 const onMouseUp = () => queueMicrotask(() => element.focus()); 31061 for (const label of labels) { 31062 label.addEventListener("mouseup", onMouseUp); 31063 } 31064 return () => { 31065 for (const label of labels) { 31066 label.removeEventListener("mouseup", onMouseUp); 31067 } 31068 }; 31069 }, [focusable]); 31070 } 31071 const disabled = focusable && disabledFromProps(props); 31072 const trulyDisabled = !!disabled && !accessibleWhenDisabled; 31073 const [focusVisible, setFocusVisible] = (0,external_React_.useState)(false); 31074 (0,external_React_.useEffect)(() => { 31075 if (!focusable) return; 31076 if (trulyDisabled && focusVisible) { 31077 setFocusVisible(false); 31078 } 31079 }, [focusable, trulyDisabled, focusVisible]); 31080 (0,external_React_.useEffect)(() => { 31081 if (!focusable) return; 31082 if (!focusVisible) return; 31083 const element = ref.current; 31084 if (!element) return; 31085 if (typeof IntersectionObserver === "undefined") return; 31086 const observer = new IntersectionObserver(() => { 31087 if (!isFocusable(element)) { 31088 setFocusVisible(false); 31089 } 31090 }); 31091 observer.observe(element); 31092 return () => observer.disconnect(); 31093 }, [focusable, focusVisible]); 31094 const onKeyPressCapture = useDisableEvent( 31095 props.onKeyPressCapture, 31096 disabled 31097 ); 31098 const onMouseDownCapture = useDisableEvent( 31099 props.onMouseDownCapture, 31100 disabled 31101 ); 31102 const onClickCapture = useDisableEvent(props.onClickCapture, disabled); 31103 const onMouseDownProp = props.onMouseDown; 31104 const onMouseDown = useEvent((event) => { 31105 onMouseDownProp == null ? void 0 : onMouseDownProp(event); 31106 if (event.defaultPrevented) return; 31107 if (!focusable) return; 31108 const element = event.currentTarget; 31109 if (!isSafariBrowser) return; 31110 if (isPortalEvent(event)) return; 31111 if (!isButton(element) && !isNativeCheckboxOrRadio(element)) return; 31112 let receivedFocus = false; 31113 const onFocus = () => { 31114 receivedFocus = true; 31115 }; 31116 const options = { capture: true, once: true }; 31117 element.addEventListener("focusin", onFocus, options); 31118 const focusableContainer = getClosestFocusable(element.parentElement); 31119 markSafariFocusAncestor(focusableContainer, true); 31120 queueBeforeEvent(element, "mouseup", () => { 31121 element.removeEventListener("focusin", onFocus, true); 31122 markSafariFocusAncestor(focusableContainer, false); 31123 if (receivedFocus) return; 31124 focusIfNeeded(element); 31125 }); 31126 }); 31127 const handleFocusVisible = (event, currentTarget) => { 31128 if (currentTarget) { 31129 event.currentTarget = currentTarget; 31130 } 31131 if (!focusable) return; 31132 const element = event.currentTarget; 31133 if (!element) return; 31134 if (!hasFocus(element)) return; 31135 onFocusVisible == null ? void 0 : onFocusVisible(event); 31136 if (event.defaultPrevented) return; 31137 element.dataset.focusVisible = "true"; 31138 setFocusVisible(true); 31139 }; 31140 const onKeyDownCaptureProp = props.onKeyDownCapture; 31141 const onKeyDownCapture = useEvent((event) => { 31142 onKeyDownCaptureProp == null ? void 0 : onKeyDownCaptureProp(event); 31143 if (event.defaultPrevented) return; 31144 if (!focusable) return; 31145 if (focusVisible) return; 31146 if (event.metaKey) return; 31147 if (event.altKey) return; 31148 if (event.ctrlKey) return; 31149 if (!isSelfTarget(event)) return; 31150 const element = event.currentTarget; 31151 const applyFocusVisible = () => handleFocusVisible(event, element); 31152 queueBeforeEvent(element, "focusout", applyFocusVisible); 31153 }); 31154 const onFocusCaptureProp = props.onFocusCapture; 31155 const onFocusCapture = useEvent((event) => { 31156 onFocusCaptureProp == null ? void 0 : onFocusCaptureProp(event); 31157 if (event.defaultPrevented) return; 31158 if (!focusable) return; 31159 if (!isSelfTarget(event)) { 31160 setFocusVisible(false); 31161 return; 31162 } 31163 const element = event.currentTarget; 31164 const applyFocusVisible = () => handleFocusVisible(event, element); 31165 if (isKeyboardModality || isAlwaysFocusVisible(event.target)) { 31166 queueBeforeEvent(event.target, "focusout", applyFocusVisible); 31167 } else { 31168 setFocusVisible(false); 31169 } 31170 }); 31171 const onBlurProp = props.onBlur; 31172 const onBlur = useEvent((event) => { 31173 onBlurProp == null ? void 0 : onBlurProp(event); 31174 if (!focusable) return; 31175 if (!isFocusEventOutside(event)) return; 31176 setFocusVisible(false); 31177 }); 31178 const autoFocusOnShow = (0,external_React_.useContext)(FocusableContext); 31179 const autoFocusRef = useEvent((element) => { 31180 if (!focusable) return; 31181 if (!autoFocus) return; 31182 if (!element) return; 31183 if (!autoFocusOnShow) return; 31184 queueMicrotask(() => { 31185 if (hasFocus(element)) return; 31186 if (!isFocusable(element)) return; 31187 element.focus(); 31188 }); 31189 }); 31190 const tagName = useTagName(ref); 31191 const nativeTabbable = focusable && isNativeTabbable(tagName); 31192 const supportsDisabled = focusable && supportsDisabledAttribute(tagName); 31193 const styleProp = props.style; 31194 const style = (0,external_React_.useMemo)(() => { 31195 if (trulyDisabled) { 31196 return _3YLGPPWQ_spreadValues({ pointerEvents: "none" }, styleProp); 31197 } 31198 return styleProp; 31199 }, [trulyDisabled, styleProp]); 31200 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 31201 "data-focus-visible": focusable && focusVisible || void 0, 31202 "data-autofocus": autoFocus || void 0, 31203 "aria-disabled": disabled || void 0 31204 }, props), { 31205 ref: useMergeRefs(ref, autoFocusRef, props.ref), 31206 style, 31207 tabIndex: getTabIndex( 31208 focusable, 31209 trulyDisabled, 31210 nativeTabbable, 31211 supportsDisabled, 31212 props.tabIndex 31213 ), 31214 disabled: supportsDisabled && trulyDisabled ? true : void 0, 31215 // TODO: Test Focusable contentEditable. 31216 contentEditable: disabled ? void 0 : props.contentEditable, 31217 onKeyPressCapture, 31218 onClickCapture, 31219 onMouseDownCapture, 31220 onMouseDown, 31221 onKeyDownCapture, 31222 onFocusCapture, 31223 onBlur 31224 }); 31225 return removeUndefinedValues(props); 31226 } 31227 ); 31228 var Focusable = forwardRef2(function Focusable2(props) { 31229 const htmlProps = useFocusable(props); 31230 return createElement(LVA2YJMS_TagName, htmlProps); 31231 }); 31232 31233 31234 31235 ;// ./node_modules/@ariakit/react-core/esm/__chunks/ITI7HKP4.js 31236 "use client"; 31237 31238 31239 31240 31241 31242 31243 31244 // src/composite/composite.tsx 31245 31246 31247 31248 31249 31250 31251 31252 var ITI7HKP4_TagName = "div"; 31253 function isGrid(items) { 31254 return items.some((item) => !!item.rowId); 31255 } 31256 function isPrintableKey(event) { 31257 const target = event.target; 31258 if (target && !isTextField(target)) return false; 31259 return event.key.length === 1 && !event.ctrlKey && !event.metaKey; 31260 } 31261 function isModifierKey(event) { 31262 return event.key === "Shift" || event.key === "Control" || event.key === "Alt" || event.key === "Meta"; 31263 } 31264 function useKeyboardEventProxy(store, onKeyboardEvent, previousElementRef) { 31265 return useEvent((event) => { 31266 var _a; 31267 onKeyboardEvent == null ? void 0 : onKeyboardEvent(event); 31268 if (event.defaultPrevented) return; 31269 if (event.isPropagationStopped()) return; 31270 if (!isSelfTarget(event)) return; 31271 if (isModifierKey(event)) return; 31272 if (isPrintableKey(event)) return; 31273 const state = store.getState(); 31274 const activeElement = (_a = getEnabledItem(store, state.activeId)) == null ? void 0 : _a.element; 31275 if (!activeElement) return; 31276 const _b = event, { view } = _b, eventInit = __objRest(_b, ["view"]); 31277 const previousElement = previousElementRef == null ? void 0 : previousElementRef.current; 31278 if (activeElement !== previousElement) { 31279 activeElement.focus(); 31280 } 31281 if (!fireKeyboardEvent(activeElement, event.type, eventInit)) { 31282 event.preventDefault(); 31283 } 31284 if (event.currentTarget.contains(activeElement)) { 31285 event.stopPropagation(); 31286 } 31287 }); 31288 } 31289 function findFirstEnabledItemInTheLastRow(items) { 31290 return _5VQZOHHZ_findFirstEnabledItem( 31291 flatten2DArray(reverseArray(_5VQZOHHZ_groupItemsByRows(items))) 31292 ); 31293 } 31294 function useScheduleFocus(store) { 31295 const [scheduled, setScheduled] = (0,external_React_.useState)(false); 31296 const schedule = (0,external_React_.useCallback)(() => setScheduled(true), []); 31297 const activeItem = store.useState( 31298 (state) => getEnabledItem(store, state.activeId) 31299 ); 31300 (0,external_React_.useEffect)(() => { 31301 const activeElement = activeItem == null ? void 0 : activeItem.element; 31302 if (!scheduled) return; 31303 if (!activeElement) return; 31304 setScheduled(false); 31305 activeElement.focus({ preventScroll: true }); 31306 }, [activeItem, scheduled]); 31307 return schedule; 31308 } 31309 var useComposite = createHook( 31310 function useComposite2(_a) { 31311 var _b = _a, { 31312 store, 31313 composite = true, 31314 focusOnMove = composite, 31315 moveOnKeyPress = true 31316 } = _b, props = __objRest(_b, [ 31317 "store", 31318 "composite", 31319 "focusOnMove", 31320 "moveOnKeyPress" 31321 ]); 31322 const context = useCompositeProviderContext(); 31323 store = store || context; 31324 invariant( 31325 store, 31326 false && 0 31327 ); 31328 const ref = (0,external_React_.useRef)(null); 31329 const previousElementRef = (0,external_React_.useRef)(null); 31330 const scheduleFocus = useScheduleFocus(store); 31331 const moves = store.useState("moves"); 31332 const [, setBaseElement] = useTransactionState( 31333 composite ? store.setBaseElement : null 31334 ); 31335 (0,external_React_.useEffect)(() => { 31336 var _a2; 31337 if (!store) return; 31338 if (!moves) return; 31339 if (!composite) return; 31340 if (!focusOnMove) return; 31341 const { activeId: activeId2 } = store.getState(); 31342 const itemElement = (_a2 = getEnabledItem(store, activeId2)) == null ? void 0 : _a2.element; 31343 if (!itemElement) return; 31344 focusIntoView(itemElement); 31345 }, [store, moves, composite, focusOnMove]); 31346 useSafeLayoutEffect(() => { 31347 if (!store) return; 31348 if (!moves) return; 31349 if (!composite) return; 31350 const { baseElement, activeId: activeId2 } = store.getState(); 31351 const isSelfAcive = activeId2 === null; 31352 if (!isSelfAcive) return; 31353 if (!baseElement) return; 31354 const previousElement = previousElementRef.current; 31355 previousElementRef.current = null; 31356 if (previousElement) { 31357 fireBlurEvent(previousElement, { relatedTarget: baseElement }); 31358 } 31359 if (!hasFocus(baseElement)) { 31360 baseElement.focus(); 31361 } 31362 }, [store, moves, composite]); 31363 const activeId = store.useState("activeId"); 31364 const virtualFocus = store.useState("virtualFocus"); 31365 useSafeLayoutEffect(() => { 31366 var _a2; 31367 if (!store) return; 31368 if (!composite) return; 31369 if (!virtualFocus) return; 31370 const previousElement = previousElementRef.current; 31371 previousElementRef.current = null; 31372 if (!previousElement) return; 31373 const activeElement = (_a2 = getEnabledItem(store, activeId)) == null ? void 0 : _a2.element; 31374 const relatedTarget = activeElement || DTR5TSDJ_getActiveElement(previousElement); 31375 if (relatedTarget === previousElement) return; 31376 fireBlurEvent(previousElement, { relatedTarget }); 31377 }, [store, activeId, virtualFocus, composite]); 31378 const onKeyDownCapture = useKeyboardEventProxy( 31379 store, 31380 props.onKeyDownCapture, 31381 previousElementRef 31382 ); 31383 const onKeyUpCapture = useKeyboardEventProxy( 31384 store, 31385 props.onKeyUpCapture, 31386 previousElementRef 31387 ); 31388 const onFocusCaptureProp = props.onFocusCapture; 31389 const onFocusCapture = useEvent((event) => { 31390 onFocusCaptureProp == null ? void 0 : onFocusCaptureProp(event); 31391 if (event.defaultPrevented) return; 31392 if (!store) return; 31393 const { virtualFocus: virtualFocus2 } = store.getState(); 31394 if (!virtualFocus2) return; 31395 const previousActiveElement = event.relatedTarget; 31396 const isSilentlyFocused = silentlyFocused(event.currentTarget); 31397 if (isSelfTarget(event) && isSilentlyFocused) { 31398 event.stopPropagation(); 31399 previousElementRef.current = previousActiveElement; 31400 } 31401 }); 31402 const onFocusProp = props.onFocus; 31403 const onFocus = useEvent((event) => { 31404 onFocusProp == null ? void 0 : onFocusProp(event); 31405 if (event.defaultPrevented) return; 31406 if (!composite) return; 31407 if (!store) return; 31408 const { relatedTarget } = event; 31409 const { virtualFocus: virtualFocus2 } = store.getState(); 31410 if (virtualFocus2) { 31411 if (isSelfTarget(event) && !isItem(store, relatedTarget)) { 31412 queueMicrotask(scheduleFocus); 31413 } 31414 } else if (isSelfTarget(event)) { 31415 store.setActiveId(null); 31416 } 31417 }); 31418 const onBlurCaptureProp = props.onBlurCapture; 31419 const onBlurCapture = useEvent((event) => { 31420 var _a2; 31421 onBlurCaptureProp == null ? void 0 : onBlurCaptureProp(event); 31422 if (event.defaultPrevented) return; 31423 if (!store) return; 31424 const { virtualFocus: virtualFocus2, activeId: activeId2 } = store.getState(); 31425 if (!virtualFocus2) return; 31426 const activeElement = (_a2 = getEnabledItem(store, activeId2)) == null ? void 0 : _a2.element; 31427 const nextActiveElement = event.relatedTarget; 31428 const nextActiveElementIsItem = isItem(store, nextActiveElement); 31429 const previousElement = previousElementRef.current; 31430 previousElementRef.current = null; 31431 if (isSelfTarget(event) && nextActiveElementIsItem) { 31432 if (nextActiveElement === activeElement) { 31433 if (previousElement && previousElement !== nextActiveElement) { 31434 fireBlurEvent(previousElement, event); 31435 } 31436 } else if (activeElement) { 31437 fireBlurEvent(activeElement, event); 31438 } else if (previousElement) { 31439 fireBlurEvent(previousElement, event); 31440 } 31441 event.stopPropagation(); 31442 } else { 31443 const targetIsItem = isItem(store, event.target); 31444 if (!targetIsItem && activeElement) { 31445 fireBlurEvent(activeElement, event); 31446 } 31447 } 31448 }); 31449 const onKeyDownProp = props.onKeyDown; 31450 const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress); 31451 const onKeyDown = useEvent((event) => { 31452 var _a2; 31453 onKeyDownProp == null ? void 0 : onKeyDownProp(event); 31454 if (event.defaultPrevented) return; 31455 if (!store) return; 31456 if (!isSelfTarget(event)) return; 31457 const { orientation, renderedItems, activeId: activeId2 } = store.getState(); 31458 const activeItem = getEnabledItem(store, activeId2); 31459 if ((_a2 = activeItem == null ? void 0 : activeItem.element) == null ? void 0 : _a2.isConnected) return; 31460 const isVertical = orientation !== "horizontal"; 31461 const isHorizontal = orientation !== "vertical"; 31462 const grid = isGrid(renderedItems); 31463 const isHorizontalKey = event.key === "ArrowLeft" || event.key === "ArrowRight" || event.key === "Home" || event.key === "End"; 31464 if (isHorizontalKey && isTextField(event.currentTarget)) return; 31465 const up = () => { 31466 if (grid) { 31467 const item = findFirstEnabledItemInTheLastRow(renderedItems); 31468 return item == null ? void 0 : item.id; 31469 } 31470 return store == null ? void 0 : store.last(); 31471 }; 31472 const keyMap = { 31473 ArrowUp: (grid || isVertical) && up, 31474 ArrowRight: (grid || isHorizontal) && store.first, 31475 ArrowDown: (grid || isVertical) && store.first, 31476 ArrowLeft: (grid || isHorizontal) && store.last, 31477 Home: store.first, 31478 End: store.last, 31479 PageUp: store.first, 31480 PageDown: store.last 31481 }; 31482 const action = keyMap[event.key]; 31483 if (action) { 31484 const id = action(); 31485 if (id !== void 0) { 31486 if (!moveOnKeyPressProp(event)) return; 31487 event.preventDefault(); 31488 store.move(id); 31489 } 31490 } 31491 }); 31492 props = useWrapElement( 31493 props, 31494 (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CompositeContextProvider, { value: store, children: element }), 31495 [store] 31496 ); 31497 const activeDescendant = store.useState((state) => { 31498 var _a2; 31499 if (!store) return; 31500 if (!composite) return; 31501 if (!state.virtualFocus) return; 31502 return (_a2 = getEnabledItem(store, state.activeId)) == null ? void 0 : _a2.id; 31503 }); 31504 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 31505 "aria-activedescendant": activeDescendant 31506 }, props), { 31507 ref: useMergeRefs(ref, setBaseElement, props.ref), 31508 onKeyDownCapture, 31509 onKeyUpCapture, 31510 onFocusCapture, 31511 onFocus, 31512 onBlurCapture, 31513 onKeyDown 31514 }); 31515 const focusable = store.useState( 31516 (state) => composite && (state.virtualFocus || state.activeId === null) 31517 ); 31518 props = useFocusable(_3YLGPPWQ_spreadValues({ focusable }, props)); 31519 return props; 31520 } 31521 ); 31522 var Composite = forwardRef2(function Composite2(props) { 31523 const htmlProps = useComposite(props); 31524 return createElement(ITI7HKP4_TagName, htmlProps); 31525 }); 31526 31527 31528 31529 ;// ./node_modules/@ariakit/react-core/esm/combobox/combobox.js 31530 "use client"; 31531 31532 31533 31534 31535 31536 31537 31538 31539 31540 31541 31542 31543 31544 31545 31546 31547 // src/combobox/combobox.tsx 31548 31549 31550 31551 31552 31553 31554 var combobox_TagName = "input"; 31555 function isFirstItemAutoSelected(items, activeValue, autoSelect) { 31556 if (!autoSelect) return false; 31557 const firstItem = items.find((item) => !item.disabled && item.value); 31558 return (firstItem == null ? void 0 : firstItem.value) === activeValue; 31559 } 31560 function hasCompletionString(value, activeValue) { 31561 if (!activeValue) return false; 31562 if (value == null) return false; 31563 value = PBFD2E7P_normalizeString(value); 31564 return activeValue.length > value.length && activeValue.toLowerCase().indexOf(value.toLowerCase()) === 0; 31565 } 31566 function isInputEvent(event) { 31567 return event.type === "input"; 31568 } 31569 function isAriaAutoCompleteValue(value) { 31570 return value === "inline" || value === "list" || value === "both" || value === "none"; 31571 } 31572 function getDefaultAutoSelectId(items) { 31573 const item = items.find((item2) => { 31574 var _a; 31575 if (item2.disabled) return false; 31576 return ((_a = item2.element) == null ? void 0 : _a.getAttribute("role")) !== "tab"; 31577 }); 31578 return item == null ? void 0 : item.id; 31579 } 31580 var useCombobox = createHook( 31581 function useCombobox2(_a) { 31582 var _b = _a, { 31583 store, 31584 focusable = true, 31585 autoSelect: autoSelectProp = false, 31586 getAutoSelectId, 31587 setValueOnChange, 31588 showMinLength = 0, 31589 showOnChange, 31590 showOnMouseDown, 31591 showOnClick = showOnMouseDown, 31592 showOnKeyDown, 31593 showOnKeyPress = showOnKeyDown, 31594 blurActiveItemOnClick, 31595 setValueOnClick = true, 31596 moveOnKeyPress = true, 31597 autoComplete = "list" 31598 } = _b, props = __objRest(_b, [ 31599 "store", 31600 "focusable", 31601 "autoSelect", 31602 "getAutoSelectId", 31603 "setValueOnChange", 31604 "showMinLength", 31605 "showOnChange", 31606 "showOnMouseDown", 31607 "showOnClick", 31608 "showOnKeyDown", 31609 "showOnKeyPress", 31610 "blurActiveItemOnClick", 31611 "setValueOnClick", 31612 "moveOnKeyPress", 31613 "autoComplete" 31614 ]); 31615 const context = useComboboxProviderContext(); 31616 store = store || context; 31617 invariant( 31618 store, 31619 false && 0 31620 ); 31621 const ref = (0,external_React_.useRef)(null); 31622 const [valueUpdated, forceValueUpdate] = useForceUpdate(); 31623 const canAutoSelectRef = (0,external_React_.useRef)(false); 31624 const composingRef = (0,external_React_.useRef)(false); 31625 const autoSelect = store.useState( 31626 (state) => state.virtualFocus && autoSelectProp 31627 ); 31628 const inline = autoComplete === "inline" || autoComplete === "both"; 31629 const [canInline, setCanInline] = (0,external_React_.useState)(inline); 31630 useUpdateLayoutEffect(() => { 31631 if (!inline) return; 31632 setCanInline(true); 31633 }, [inline]); 31634 const storeValue = store.useState("value"); 31635 const prevSelectedValueRef = (0,external_React_.useRef)(); 31636 (0,external_React_.useEffect)(() => { 31637 return sync(store, ["selectedValue", "activeId"], (_, prev) => { 31638 prevSelectedValueRef.current = prev.selectedValue; 31639 }); 31640 }, []); 31641 const inlineActiveValue = store.useState((state) => { 31642 var _a2; 31643 if (!inline) return; 31644 if (!canInline) return; 31645 if (state.activeValue && Array.isArray(state.selectedValue)) { 31646 if (state.selectedValue.includes(state.activeValue)) return; 31647 if ((_a2 = prevSelectedValueRef.current) == null ? void 0 : _a2.includes(state.activeValue)) return; 31648 } 31649 return state.activeValue; 31650 }); 31651 const items = store.useState("renderedItems"); 31652 const open = store.useState("open"); 31653 const contentElement = store.useState("contentElement"); 31654 const value = (0,external_React_.useMemo)(() => { 31655 if (!inline) return storeValue; 31656 if (!canInline) return storeValue; 31657 const firstItemAutoSelected = isFirstItemAutoSelected( 31658 items, 31659 inlineActiveValue, 31660 autoSelect 31661 ); 31662 if (firstItemAutoSelected) { 31663 if (hasCompletionString(storeValue, inlineActiveValue)) { 31664 const slice = (inlineActiveValue == null ? void 0 : inlineActiveValue.slice(storeValue.length)) || ""; 31665 return storeValue + slice; 31666 } 31667 return storeValue; 31668 } 31669 return inlineActiveValue || storeValue; 31670 }, [inline, canInline, items, inlineActiveValue, autoSelect, storeValue]); 31671 (0,external_React_.useEffect)(() => { 31672 const element = ref.current; 31673 if (!element) return; 31674 const onCompositeItemMove = () => setCanInline(true); 31675 element.addEventListener("combobox-item-move", onCompositeItemMove); 31676 return () => { 31677 element.removeEventListener("combobox-item-move", onCompositeItemMove); 31678 }; 31679 }, []); 31680 (0,external_React_.useEffect)(() => { 31681 if (!inline) return; 31682 if (!canInline) return; 31683 if (!inlineActiveValue) return; 31684 const firstItemAutoSelected = isFirstItemAutoSelected( 31685 items, 31686 inlineActiveValue, 31687 autoSelect 31688 ); 31689 if (!firstItemAutoSelected) return; 31690 if (!hasCompletionString(storeValue, inlineActiveValue)) return; 31691 let cleanup = PBFD2E7P_noop; 31692 queueMicrotask(() => { 31693 const element = ref.current; 31694 if (!element) return; 31695 const { start: prevStart, end: prevEnd } = getTextboxSelection(element); 31696 const nextStart = storeValue.length; 31697 const nextEnd = inlineActiveValue.length; 31698 setSelectionRange(element, nextStart, nextEnd); 31699 cleanup = () => { 31700 if (!hasFocus(element)) return; 31701 const { start, end } = getTextboxSelection(element); 31702 if (start !== nextStart) return; 31703 if (end !== nextEnd) return; 31704 setSelectionRange(element, prevStart, prevEnd); 31705 }; 31706 }); 31707 return () => cleanup(); 31708 }, [ 31709 valueUpdated, 31710 inline, 31711 canInline, 31712 inlineActiveValue, 31713 items, 31714 autoSelect, 31715 storeValue 31716 ]); 31717 const scrollingElementRef = (0,external_React_.useRef)(null); 31718 const getAutoSelectIdProp = useEvent(getAutoSelectId); 31719 const autoSelectIdRef = (0,external_React_.useRef)(null); 31720 (0,external_React_.useEffect)(() => { 31721 if (!open) return; 31722 if (!contentElement) return; 31723 const scrollingElement = getScrollingElement(contentElement); 31724 if (!scrollingElement) return; 31725 scrollingElementRef.current = scrollingElement; 31726 const onUserScroll = () => { 31727 canAutoSelectRef.current = false; 31728 }; 31729 const onScroll = () => { 31730 if (!store) return; 31731 if (!canAutoSelectRef.current) return; 31732 const { activeId } = store.getState(); 31733 if (activeId === null) return; 31734 if (activeId === autoSelectIdRef.current) return; 31735 canAutoSelectRef.current = false; 31736 }; 31737 const options = { passive: true, capture: true }; 31738 scrollingElement.addEventListener("wheel", onUserScroll, options); 31739 scrollingElement.addEventListener("touchmove", onUserScroll, options); 31740 scrollingElement.addEventListener("scroll", onScroll, options); 31741 return () => { 31742 scrollingElement.removeEventListener("wheel", onUserScroll, true); 31743 scrollingElement.removeEventListener("touchmove", onUserScroll, true); 31744 scrollingElement.removeEventListener("scroll", onScroll, true); 31745 }; 31746 }, [open, contentElement, store]); 31747 useSafeLayoutEffect(() => { 31748 if (!storeValue) return; 31749 if (composingRef.current) return; 31750 canAutoSelectRef.current = true; 31751 }, [storeValue]); 31752 useSafeLayoutEffect(() => { 31753 if (autoSelect !== "always" && open) return; 31754 canAutoSelectRef.current = open; 31755 }, [autoSelect, open]); 31756 const resetValueOnSelect = store.useState("resetValueOnSelect"); 31757 useUpdateEffect(() => { 31758 var _a2, _b2; 31759 const canAutoSelect = canAutoSelectRef.current; 31760 if (!store) return; 31761 if (!open) return; 31762 if (!canAutoSelect && !resetValueOnSelect) return; 31763 const { baseElement, contentElement: contentElement2, activeId } = store.getState(); 31764 if (baseElement && !hasFocus(baseElement)) return; 31765 if (contentElement2 == null ? void 0 : contentElement2.hasAttribute("data-placing")) { 31766 const observer = new MutationObserver(forceValueUpdate); 31767 observer.observe(contentElement2, { attributeFilter: ["data-placing"] }); 31768 return () => observer.disconnect(); 31769 } 31770 if (autoSelect && canAutoSelect) { 31771 const userAutoSelectId = getAutoSelectIdProp(items); 31772 const autoSelectId = userAutoSelectId !== void 0 ? userAutoSelectId : (_a2 = getDefaultAutoSelectId(items)) != null ? _a2 : store.first(); 31773 autoSelectIdRef.current = autoSelectId; 31774 store.move(autoSelectId != null ? autoSelectId : null); 31775 } else { 31776 const element = (_b2 = store.item(activeId || store.first())) == null ? void 0 : _b2.element; 31777 if (element && "scrollIntoView" in element) { 31778 element.scrollIntoView({ block: "nearest", inline: "nearest" }); 31779 } 31780 } 31781 return; 31782 }, [ 31783 store, 31784 open, 31785 valueUpdated, 31786 storeValue, 31787 autoSelect, 31788 resetValueOnSelect, 31789 getAutoSelectIdProp, 31790 items 31791 ]); 31792 (0,external_React_.useEffect)(() => { 31793 if (!inline) return; 31794 const combobox = ref.current; 31795 if (!combobox) return; 31796 const elements = [combobox, contentElement].filter( 31797 (value2) => !!value2 31798 ); 31799 const onBlur2 = (event) => { 31800 if (elements.every((el) => isFocusEventOutside(event, el))) { 31801 store == null ? void 0 : store.setValue(value); 31802 } 31803 }; 31804 for (const element of elements) { 31805 element.addEventListener("focusout", onBlur2); 31806 } 31807 return () => { 31808 for (const element of elements) { 31809 element.removeEventListener("focusout", onBlur2); 31810 } 31811 }; 31812 }, [inline, contentElement, store, value]); 31813 const canShow = (event) => { 31814 const currentTarget = event.currentTarget; 31815 return currentTarget.value.length >= showMinLength; 31816 }; 31817 const onChangeProp = props.onChange; 31818 const showOnChangeProp = useBooleanEvent(showOnChange != null ? showOnChange : canShow); 31819 const setValueOnChangeProp = useBooleanEvent( 31820 // If the combobox is combined with tags, the value will be set by the tag 31821 // input component. 31822 setValueOnChange != null ? setValueOnChange : !store.tag 31823 ); 31824 const onChange = useEvent((event) => { 31825 onChangeProp == null ? void 0 : onChangeProp(event); 31826 if (event.defaultPrevented) return; 31827 if (!store) return; 31828 const currentTarget = event.currentTarget; 31829 const { value: value2, selectionStart, selectionEnd } = currentTarget; 31830 const nativeEvent = event.nativeEvent; 31831 canAutoSelectRef.current = true; 31832 if (isInputEvent(nativeEvent)) { 31833 if (nativeEvent.isComposing) { 31834 canAutoSelectRef.current = false; 31835 composingRef.current = true; 31836 } 31837 if (inline) { 31838 const textInserted = nativeEvent.inputType === "insertText" || nativeEvent.inputType === "insertCompositionText"; 31839 const caretAtEnd = selectionStart === value2.length; 31840 setCanInline(textInserted && caretAtEnd); 31841 } 31842 } 31843 if (setValueOnChangeProp(event)) { 31844 const isSameValue = value2 === store.getState().value; 31845 store.setValue(value2); 31846 queueMicrotask(() => { 31847 setSelectionRange(currentTarget, selectionStart, selectionEnd); 31848 }); 31849 if (inline && autoSelect && isSameValue) { 31850 forceValueUpdate(); 31851 } 31852 } 31853 if (showOnChangeProp(event)) { 31854 store.show(); 31855 } 31856 if (!autoSelect || !canAutoSelectRef.current) { 31857 store.setActiveId(null); 31858 } 31859 }); 31860 const onCompositionEndProp = props.onCompositionEnd; 31861 const onCompositionEnd = useEvent((event) => { 31862 canAutoSelectRef.current = true; 31863 composingRef.current = false; 31864 onCompositionEndProp == null ? void 0 : onCompositionEndProp(event); 31865 if (event.defaultPrevented) return; 31866 if (!autoSelect) return; 31867 forceValueUpdate(); 31868 }); 31869 const onMouseDownProp = props.onMouseDown; 31870 const blurActiveItemOnClickProp = useBooleanEvent( 31871 blurActiveItemOnClick != null ? blurActiveItemOnClick : () => !!(store == null ? void 0 : store.getState().includesBaseElement) 31872 ); 31873 const setValueOnClickProp = useBooleanEvent(setValueOnClick); 31874 const showOnClickProp = useBooleanEvent(showOnClick != null ? showOnClick : canShow); 31875 const onMouseDown = useEvent((event) => { 31876 onMouseDownProp == null ? void 0 : onMouseDownProp(event); 31877 if (event.defaultPrevented) return; 31878 if (event.button) return; 31879 if (event.ctrlKey) return; 31880 if (!store) return; 31881 if (blurActiveItemOnClickProp(event)) { 31882 store.setActiveId(null); 31883 } 31884 if (setValueOnClickProp(event)) { 31885 store.setValue(value); 31886 } 31887 if (showOnClickProp(event)) { 31888 queueBeforeEvent(event.currentTarget, "mouseup", store.show); 31889 } 31890 }); 31891 const onKeyDownProp = props.onKeyDown; 31892 const showOnKeyPressProp = useBooleanEvent(showOnKeyPress != null ? showOnKeyPress : canShow); 31893 const onKeyDown = useEvent((event) => { 31894 onKeyDownProp == null ? void 0 : onKeyDownProp(event); 31895 if (!event.repeat) { 31896 canAutoSelectRef.current = false; 31897 } 31898 if (event.defaultPrevented) return; 31899 if (event.ctrlKey) return; 31900 if (event.altKey) return; 31901 if (event.shiftKey) return; 31902 if (event.metaKey) return; 31903 if (!store) return; 31904 const { open: open2 } = store.getState(); 31905 if (open2) return; 31906 if (event.key === "ArrowUp" || event.key === "ArrowDown") { 31907 if (showOnKeyPressProp(event)) { 31908 event.preventDefault(); 31909 store.show(); 31910 } 31911 } 31912 }); 31913 const onBlurProp = props.onBlur; 31914 const onBlur = useEvent((event) => { 31915 canAutoSelectRef.current = false; 31916 onBlurProp == null ? void 0 : onBlurProp(event); 31917 if (event.defaultPrevented) return; 31918 }); 31919 const id = useId(props.id); 31920 const ariaAutoComplete = isAriaAutoCompleteValue(autoComplete) ? autoComplete : void 0; 31921 const isActiveItem = store.useState((state) => state.activeId === null); 31922 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 31923 id, 31924 role: "combobox", 31925 "aria-autocomplete": ariaAutoComplete, 31926 "aria-haspopup": getPopupRole(contentElement, "listbox"), 31927 "aria-expanded": open, 31928 "aria-controls": contentElement == null ? void 0 : contentElement.id, 31929 "data-active-item": isActiveItem || void 0, 31930 value 31931 }, props), { 31932 ref: useMergeRefs(ref, props.ref), 31933 onChange, 31934 onCompositionEnd, 31935 onMouseDown, 31936 onKeyDown, 31937 onBlur 31938 }); 31939 props = useComposite(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 31940 store, 31941 focusable 31942 }, props), { 31943 // Enable inline autocomplete when the user moves from the combobox input 31944 // to an item. 31945 moveOnKeyPress: (event) => { 31946 if (isFalsyBooleanCallback(moveOnKeyPress, event)) return false; 31947 if (inline) setCanInline(true); 31948 return true; 31949 } 31950 })); 31951 props = usePopoverAnchor(_3YLGPPWQ_spreadValues({ store }, props)); 31952 return _3YLGPPWQ_spreadValues({ autoComplete: "off" }, props); 31953 } 31954 ); 31955 var Combobox = forwardRef2(function Combobox2(props) { 31956 const htmlProps = useCombobox(props); 31957 return createElement(combobox_TagName, htmlProps); 31958 }); 31959 31960 31961 ;// ./node_modules/@ariakit/react-core/esm/__chunks/VGCJ63VH.js 31962 "use client"; 31963 31964 31965 31966 31967 31968 31969 31970 // src/disclosure/disclosure-content.tsx 31971 31972 31973 31974 31975 var VGCJ63VH_TagName = "div"; 31976 function afterTimeout(timeoutMs, cb) { 31977 const timeoutId = setTimeout(cb, timeoutMs); 31978 return () => clearTimeout(timeoutId); 31979 } 31980 function VGCJ63VH_afterPaint(cb) { 31981 let raf = requestAnimationFrame(() => { 31982 raf = requestAnimationFrame(cb); 31983 }); 31984 return () => cancelAnimationFrame(raf); 31985 } 31986 function parseCSSTime(...times) { 31987 return times.join(", ").split(", ").reduce((longestTime, currentTimeString) => { 31988 const multiplier = currentTimeString.endsWith("ms") ? 1 : 1e3; 31989 const currentTime = Number.parseFloat(currentTimeString || "0s") * multiplier; 31990 if (currentTime > longestTime) return currentTime; 31991 return longestTime; 31992 }, 0); 31993 } 31994 function isHidden(mounted, hidden, alwaysVisible) { 31995 return !alwaysVisible && hidden !== false && (!mounted || !!hidden); 31996 } 31997 var useDisclosureContent = createHook(function useDisclosureContent2(_a) { 31998 var _b = _a, { store, alwaysVisible } = _b, props = __objRest(_b, ["store", "alwaysVisible"]); 31999 const context = useDisclosureProviderContext(); 32000 store = store || context; 32001 invariant( 32002 store, 32003 false && 0 32004 ); 32005 const ref = (0,external_React_.useRef)(null); 32006 const id = useId(props.id); 32007 const [transition, setTransition] = (0,external_React_.useState)(null); 32008 const open = store.useState("open"); 32009 const mounted = store.useState("mounted"); 32010 const animated = store.useState("animated"); 32011 const contentElement = store.useState("contentElement"); 32012 const otherElement = useStoreState(store.disclosure, "contentElement"); 32013 useSafeLayoutEffect(() => { 32014 if (!ref.current) return; 32015 store == null ? void 0 : store.setContentElement(ref.current); 32016 }, [store]); 32017 useSafeLayoutEffect(() => { 32018 let previousAnimated; 32019 store == null ? void 0 : store.setState("animated", (animated2) => { 32020 previousAnimated = animated2; 32021 return true; 32022 }); 32023 return () => { 32024 if (previousAnimated === void 0) return; 32025 store == null ? void 0 : store.setState("animated", previousAnimated); 32026 }; 32027 }, [store]); 32028 useSafeLayoutEffect(() => { 32029 if (!animated) return; 32030 if (!(contentElement == null ? void 0 : contentElement.isConnected)) { 32031 setTransition(null); 32032 return; 32033 } 32034 return VGCJ63VH_afterPaint(() => { 32035 setTransition(open ? "enter" : mounted ? "leave" : null); 32036 }); 32037 }, [animated, contentElement, open, mounted]); 32038 useSafeLayoutEffect(() => { 32039 if (!store) return; 32040 if (!animated) return; 32041 if (!transition) return; 32042 if (!contentElement) return; 32043 const stopAnimation = () => store == null ? void 0 : store.setState("animating", false); 32044 const stopAnimationSync = () => (0,external_ReactDOM_namespaceObject.flushSync)(stopAnimation); 32045 if (transition === "leave" && open) return; 32046 if (transition === "enter" && !open) return; 32047 if (typeof animated === "number") { 32048 const timeout2 = animated; 32049 return afterTimeout(timeout2, stopAnimationSync); 32050 } 32051 const { 32052 transitionDuration, 32053 animationDuration, 32054 transitionDelay, 32055 animationDelay 32056 } = getComputedStyle(contentElement); 32057 const { 32058 transitionDuration: transitionDuration2 = "0", 32059 animationDuration: animationDuration2 = "0", 32060 transitionDelay: transitionDelay2 = "0", 32061 animationDelay: animationDelay2 = "0" 32062 } = otherElement ? getComputedStyle(otherElement) : {}; 32063 const delay = parseCSSTime( 32064 transitionDelay, 32065 animationDelay, 32066 transitionDelay2, 32067 animationDelay2 32068 ); 32069 const duration = parseCSSTime( 32070 transitionDuration, 32071 animationDuration, 32072 transitionDuration2, 32073 animationDuration2 32074 ); 32075 const timeout = delay + duration; 32076 if (!timeout) { 32077 if (transition === "enter") { 32078 store.setState("animated", false); 32079 } 32080 stopAnimation(); 32081 return; 32082 } 32083 const frameRate = 1e3 / 60; 32084 const maxTimeout = Math.max(timeout - frameRate, 0); 32085 return afterTimeout(maxTimeout, stopAnimationSync); 32086 }, [store, animated, contentElement, otherElement, open, transition]); 32087 props = useWrapElement( 32088 props, 32089 (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DialogScopedContextProvider, { value: store, children: element }), 32090 [store] 32091 ); 32092 const hidden = isHidden(mounted, props.hidden, alwaysVisible); 32093 const styleProp = props.style; 32094 const style = (0,external_React_.useMemo)(() => { 32095 if (hidden) { 32096 return _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, styleProp), { display: "none" }); 32097 } 32098 return styleProp; 32099 }, [hidden, styleProp]); 32100 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 32101 id, 32102 "data-open": open || void 0, 32103 "data-enter": transition === "enter" || void 0, 32104 "data-leave": transition === "leave" || void 0, 32105 hidden 32106 }, props), { 32107 ref: useMergeRefs(id ? store.setContentElement : null, ref, props.ref), 32108 style 32109 }); 32110 return removeUndefinedValues(props); 32111 }); 32112 var DisclosureContentImpl = forwardRef2(function DisclosureContentImpl2(props) { 32113 const htmlProps = useDisclosureContent(props); 32114 return createElement(VGCJ63VH_TagName, htmlProps); 32115 }); 32116 var DisclosureContent = forwardRef2(function DisclosureContent2(_a) { 32117 var _b = _a, { 32118 unmountOnHide 32119 } = _b, props = __objRest(_b, [ 32120 "unmountOnHide" 32121 ]); 32122 const context = useDisclosureProviderContext(); 32123 const store = props.store || context; 32124 const mounted = useStoreState( 32125 store, 32126 (state) => !unmountOnHide || (state == null ? void 0 : state.mounted) 32127 ); 32128 if (mounted === false) return null; 32129 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DisclosureContentImpl, _3YLGPPWQ_spreadValues({}, props)); 32130 }); 32131 32132 32133 32134 ;// ./node_modules/@ariakit/react-core/esm/__chunks/HUWAI7RB.js 32135 "use client"; 32136 32137 32138 32139 32140 32141 32142 // src/combobox/combobox-list.tsx 32143 32144 32145 32146 var HUWAI7RB_TagName = "div"; 32147 var useComboboxList = createHook( 32148 function useComboboxList2(_a) { 32149 var _b = _a, { store, alwaysVisible } = _b, props = __objRest(_b, ["store", "alwaysVisible"]); 32150 const scopedContext = useComboboxScopedContext(true); 32151 const context = useComboboxContext(); 32152 store = store || context; 32153 const scopedContextSameStore = !!store && store === scopedContext; 32154 invariant( 32155 store, 32156 false && 0 32157 ); 32158 const ref = (0,external_React_.useRef)(null); 32159 const id = useId(props.id); 32160 const mounted = store.useState("mounted"); 32161 const hidden = isHidden(mounted, props.hidden, alwaysVisible); 32162 const style = hidden ? _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props.style), { display: "none" }) : props.style; 32163 const multiSelectable = store.useState( 32164 (state) => Array.isArray(state.selectedValue) 32165 ); 32166 const role = useAttribute(ref, "role", props.role); 32167 const isCompositeRole = role === "listbox" || role === "tree" || role === "grid"; 32168 const ariaMultiSelectable = isCompositeRole ? multiSelectable || void 0 : void 0; 32169 const [hasListboxInside, setHasListboxInside] = (0,external_React_.useState)(false); 32170 const contentElement = store.useState("contentElement"); 32171 useSafeLayoutEffect(() => { 32172 if (!mounted) return; 32173 const element = ref.current; 32174 if (!element) return; 32175 if (contentElement !== element) return; 32176 const callback = () => { 32177 setHasListboxInside(!!element.querySelector("[role='listbox']")); 32178 }; 32179 const observer = new MutationObserver(callback); 32180 observer.observe(element, { 32181 subtree: true, 32182 childList: true, 32183 attributeFilter: ["role"] 32184 }); 32185 callback(); 32186 return () => observer.disconnect(); 32187 }, [mounted, contentElement]); 32188 if (!hasListboxInside) { 32189 props = _3YLGPPWQ_spreadValues({ 32190 role: "listbox", 32191 "aria-multiselectable": ariaMultiSelectable 32192 }, props); 32193 } 32194 props = useWrapElement( 32195 props, 32196 (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxScopedContextProvider, { value: store, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxListRoleContext.Provider, { value: role, children: element }) }), 32197 [store, role] 32198 ); 32199 const setContentElement = id && (!scopedContext || !scopedContextSameStore) ? store.setContentElement : null; 32200 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 32201 id, 32202 hidden 32203 }, props), { 32204 ref: useMergeRefs(setContentElement, ref, props.ref), 32205 style 32206 }); 32207 return removeUndefinedValues(props); 32208 } 32209 ); 32210 var ComboboxList = forwardRef2(function ComboboxList2(props) { 32211 const htmlProps = useComboboxList(props); 32212 return createElement(HUWAI7RB_TagName, htmlProps); 32213 }); 32214 32215 32216 32217 ;// ./node_modules/@ariakit/react-core/esm/__chunks/UQQRIHDV.js 32218 "use client"; 32219 32220 32221 32222 32223 32224 // src/composite/composite-hover.tsx 32225 32226 32227 32228 32229 var UQQRIHDV_TagName = "div"; 32230 function getMouseDestination(event) { 32231 const relatedTarget = event.relatedTarget; 32232 if ((relatedTarget == null ? void 0 : relatedTarget.nodeType) === Node.ELEMENT_NODE) { 32233 return relatedTarget; 32234 } 32235 return null; 32236 } 32237 function hoveringInside(event) { 32238 const nextElement = getMouseDestination(event); 32239 if (!nextElement) return false; 32240 return contains(event.currentTarget, nextElement); 32241 } 32242 var UQQRIHDV_symbol = Symbol("composite-hover"); 32243 function movingToAnotherItem(event) { 32244 let dest = getMouseDestination(event); 32245 if (!dest) return false; 32246 do { 32247 if (PBFD2E7P_hasOwnProperty(dest, UQQRIHDV_symbol) && dest[UQQRIHDV_symbol]) return true; 32248 dest = dest.parentElement; 32249 } while (dest); 32250 return false; 32251 } 32252 var useCompositeHover = createHook( 32253 function useCompositeHover2(_a) { 32254 var _b = _a, { 32255 store, 32256 focusOnHover = true, 32257 blurOnHoverEnd = !!focusOnHover 32258 } = _b, props = __objRest(_b, [ 32259 "store", 32260 "focusOnHover", 32261 "blurOnHoverEnd" 32262 ]); 32263 const context = useCompositeContext(); 32264 store = store || context; 32265 invariant( 32266 store, 32267 false && 0 32268 ); 32269 const isMouseMoving = useIsMouseMoving(); 32270 const onMouseMoveProp = props.onMouseMove; 32271 const focusOnHoverProp = useBooleanEvent(focusOnHover); 32272 const onMouseMove = useEvent((event) => { 32273 onMouseMoveProp == null ? void 0 : onMouseMoveProp(event); 32274 if (event.defaultPrevented) return; 32275 if (!isMouseMoving()) return; 32276 if (!focusOnHoverProp(event)) return; 32277 if (!hasFocusWithin(event.currentTarget)) { 32278 const baseElement = store == null ? void 0 : store.getState().baseElement; 32279 if (baseElement && !hasFocus(baseElement)) { 32280 baseElement.focus(); 32281 } 32282 } 32283 store == null ? void 0 : store.setActiveId(event.currentTarget.id); 32284 }); 32285 const onMouseLeaveProp = props.onMouseLeave; 32286 const blurOnHoverEndProp = useBooleanEvent(blurOnHoverEnd); 32287 const onMouseLeave = useEvent((event) => { 32288 var _a2; 32289 onMouseLeaveProp == null ? void 0 : onMouseLeaveProp(event); 32290 if (event.defaultPrevented) return; 32291 if (!isMouseMoving()) return; 32292 if (hoveringInside(event)) return; 32293 if (movingToAnotherItem(event)) return; 32294 if (!focusOnHoverProp(event)) return; 32295 if (!blurOnHoverEndProp(event)) return; 32296 store == null ? void 0 : store.setActiveId(null); 32297 (_a2 = store == null ? void 0 : store.getState().baseElement) == null ? void 0 : _a2.focus(); 32298 }); 32299 const ref = (0,external_React_.useCallback)((element) => { 32300 if (!element) return; 32301 element[UQQRIHDV_symbol] = true; 32302 }, []); 32303 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { 32304 ref: useMergeRefs(ref, props.ref), 32305 onMouseMove, 32306 onMouseLeave 32307 }); 32308 return removeUndefinedValues(props); 32309 } 32310 ); 32311 var CompositeHover = memo2( 32312 forwardRef2(function CompositeHover2(props) { 32313 const htmlProps = useCompositeHover(props); 32314 return createElement(UQQRIHDV_TagName, htmlProps); 32315 }) 32316 ); 32317 32318 32319 32320 ;// ./node_modules/@ariakit/react-core/esm/__chunks/RZ4GPYOB.js 32321 "use client"; 32322 32323 32324 32325 32326 32327 // src/collection/collection-item.tsx 32328 32329 32330 var RZ4GPYOB_TagName = "div"; 32331 var useCollectionItem = createHook( 32332 function useCollectionItem2(_a) { 32333 var _b = _a, { 32334 store, 32335 shouldRegisterItem = true, 32336 getItem = identity, 32337 element: element 32338 } = _b, props = __objRest(_b, [ 32339 "store", 32340 "shouldRegisterItem", 32341 "getItem", 32342 // @ts-expect-error This prop may come from a collection renderer. 32343 "element" 32344 ]); 32345 const context = useCollectionContext(); 32346 store = store || context; 32347 const id = useId(props.id); 32348 const ref = (0,external_React_.useRef)(element); 32349 (0,external_React_.useEffect)(() => { 32350 const element2 = ref.current; 32351 if (!id) return; 32352 if (!element2) return; 32353 if (!shouldRegisterItem) return; 32354 const item = getItem({ id, element: element2 }); 32355 return store == null ? void 0 : store.renderItem(item); 32356 }, [id, shouldRegisterItem, getItem, store]); 32357 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { 32358 ref: useMergeRefs(ref, props.ref) 32359 }); 32360 return removeUndefinedValues(props); 32361 } 32362 ); 32363 var CollectionItem = forwardRef2(function CollectionItem2(props) { 32364 const htmlProps = useCollectionItem(props); 32365 return createElement(RZ4GPYOB_TagName, htmlProps); 32366 }); 32367 32368 32369 32370 ;// ./node_modules/@ariakit/react-core/esm/__chunks/KUU7WJ55.js 32371 "use client"; 32372 32373 32374 32375 32376 32377 // src/command/command.tsx 32378 32379 32380 32381 32382 32383 var KUU7WJ55_TagName = "button"; 32384 function isNativeClick(event) { 32385 if (!event.isTrusted) return false; 32386 const element = event.currentTarget; 32387 if (event.key === "Enter") { 32388 return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "A"; 32389 } 32390 if (event.key === " ") { 32391 return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "INPUT" || element.tagName === "SELECT"; 32392 } 32393 return false; 32394 } 32395 var KUU7WJ55_symbol = Symbol("command"); 32396 var useCommand = createHook( 32397 function useCommand2(_a) { 32398 var _b = _a, { clickOnEnter = true, clickOnSpace = true } = _b, props = __objRest(_b, ["clickOnEnter", "clickOnSpace"]); 32399 const ref = (0,external_React_.useRef)(null); 32400 const [isNativeButton, setIsNativeButton] = (0,external_React_.useState)(false); 32401 (0,external_React_.useEffect)(() => { 32402 if (!ref.current) return; 32403 setIsNativeButton(isButton(ref.current)); 32404 }, []); 32405 const [active, setActive] = (0,external_React_.useState)(false); 32406 const activeRef = (0,external_React_.useRef)(false); 32407 const disabled = disabledFromProps(props); 32408 const [isDuplicate, metadataProps] = useMetadataProps(props, KUU7WJ55_symbol, true); 32409 const onKeyDownProp = props.onKeyDown; 32410 const onKeyDown = useEvent((event) => { 32411 onKeyDownProp == null ? void 0 : onKeyDownProp(event); 32412 const element = event.currentTarget; 32413 if (event.defaultPrevented) return; 32414 if (isDuplicate) return; 32415 if (disabled) return; 32416 if (!isSelfTarget(event)) return; 32417 if (isTextField(element)) return; 32418 if (element.isContentEditable) return; 32419 const isEnter = clickOnEnter && event.key === "Enter"; 32420 const isSpace = clickOnSpace && event.key === " "; 32421 const shouldPreventEnter = event.key === "Enter" && !clickOnEnter; 32422 const shouldPreventSpace = event.key === " " && !clickOnSpace; 32423 if (shouldPreventEnter || shouldPreventSpace) { 32424 event.preventDefault(); 32425 return; 32426 } 32427 if (isEnter || isSpace) { 32428 const nativeClick = isNativeClick(event); 32429 if (isEnter) { 32430 if (!nativeClick) { 32431 event.preventDefault(); 32432 const _a2 = event, { view } = _a2, eventInit = __objRest(_a2, ["view"]); 32433 const click = () => fireClickEvent(element, eventInit); 32434 if (isFirefox()) { 32435 queueBeforeEvent(element, "keyup", click); 32436 } else { 32437 queueMicrotask(click); 32438 } 32439 } 32440 } else if (isSpace) { 32441 activeRef.current = true; 32442 if (!nativeClick) { 32443 event.preventDefault(); 32444 setActive(true); 32445 } 32446 } 32447 } 32448 }); 32449 const onKeyUpProp = props.onKeyUp; 32450 const onKeyUp = useEvent((event) => { 32451 onKeyUpProp == null ? void 0 : onKeyUpProp(event); 32452 if (event.defaultPrevented) return; 32453 if (isDuplicate) return; 32454 if (disabled) return; 32455 if (event.metaKey) return; 32456 const isSpace = clickOnSpace && event.key === " "; 32457 if (activeRef.current && isSpace) { 32458 activeRef.current = false; 32459 if (!isNativeClick(event)) { 32460 event.preventDefault(); 32461 setActive(false); 32462 const element = event.currentTarget; 32463 const _a2 = event, { view } = _a2, eventInit = __objRest(_a2, ["view"]); 32464 queueMicrotask(() => fireClickEvent(element, eventInit)); 32465 } 32466 } 32467 }); 32468 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues(_3YLGPPWQ_spreadValues({ 32469 "data-active": active || void 0, 32470 type: isNativeButton ? "button" : void 0 32471 }, metadataProps), props), { 32472 ref: useMergeRefs(ref, props.ref), 32473 onKeyDown, 32474 onKeyUp 32475 }); 32476 props = useFocusable(props); 32477 return props; 32478 } 32479 ); 32480 var Command = forwardRef2(function Command2(props) { 32481 const htmlProps = useCommand(props); 32482 return createElement(KUU7WJ55_TagName, htmlProps); 32483 }); 32484 32485 32486 32487 ;// ./node_modules/@ariakit/react-core/esm/__chunks/P2CTZE2T.js 32488 "use client"; 32489 32490 32491 32492 32493 32494 32495 32496 32497 32498 // src/composite/composite-item.tsx 32499 32500 32501 32502 32503 32504 32505 var P2CTZE2T_TagName = "button"; 32506 function isEditableElement(element) { 32507 if (isTextbox(element)) return true; 32508 return element.tagName === "INPUT" && !isButton(element); 32509 } 32510 function getNextPageOffset(scrollingElement, pageUp = false) { 32511 const height = scrollingElement.clientHeight; 32512 const { top } = scrollingElement.getBoundingClientRect(); 32513 const pageSize = Math.max(height * 0.875, height - 40) * 1.5; 32514 const pageOffset = pageUp ? height - pageSize + top : pageSize + top; 32515 if (scrollingElement.tagName === "HTML") { 32516 return pageOffset + scrollingElement.scrollTop; 32517 } 32518 return pageOffset; 32519 } 32520 function getItemOffset(itemElement, pageUp = false) { 32521 const { top } = itemElement.getBoundingClientRect(); 32522 if (pageUp) { 32523 return top + itemElement.clientHeight; 32524 } 32525 return top; 32526 } 32527 function findNextPageItemId(element, store, next, pageUp = false) { 32528 var _a; 32529 if (!store) return; 32530 if (!next) return; 32531 const { renderedItems } = store.getState(); 32532 const scrollingElement = getScrollingElement(element); 32533 if (!scrollingElement) return; 32534 const nextPageOffset = getNextPageOffset(scrollingElement, pageUp); 32535 let id; 32536 let prevDifference; 32537 for (let i = 0; i < renderedItems.length; i += 1) { 32538 const previousId = id; 32539 id = next(i); 32540 if (!id) break; 32541 if (id === previousId) continue; 32542 const itemElement = (_a = getEnabledItem(store, id)) == null ? void 0 : _a.element; 32543 if (!itemElement) continue; 32544 const itemOffset = getItemOffset(itemElement, pageUp); 32545 const difference = itemOffset - nextPageOffset; 32546 const absDifference = Math.abs(difference); 32547 if (pageUp && difference <= 0 || !pageUp && difference >= 0) { 32548 if (prevDifference !== void 0 && prevDifference < absDifference) { 32549 id = previousId; 32550 } 32551 break; 32552 } 32553 prevDifference = absDifference; 32554 } 32555 return id; 32556 } 32557 function targetIsAnotherItem(event, store) { 32558 if (isSelfTarget(event)) return false; 32559 return isItem(store, event.target); 32560 } 32561 var useCompositeItem = createHook( 32562 function useCompositeItem2(_a) { 32563 var _b = _a, { 32564 store, 32565 rowId: rowIdProp, 32566 preventScrollOnKeyDown = false, 32567 moveOnKeyPress = true, 32568 tabbable = false, 32569 getItem: getItemProp, 32570 "aria-setsize": ariaSetSizeProp, 32571 "aria-posinset": ariaPosInSetProp 32572 } = _b, props = __objRest(_b, [ 32573 "store", 32574 "rowId", 32575 "preventScrollOnKeyDown", 32576 "moveOnKeyPress", 32577 "tabbable", 32578 "getItem", 32579 "aria-setsize", 32580 "aria-posinset" 32581 ]); 32582 const context = useCompositeContext(); 32583 store = store || context; 32584 const id = useId(props.id); 32585 const ref = (0,external_React_.useRef)(null); 32586 const row = (0,external_React_.useContext)(CompositeRowContext); 32587 const disabled = disabledFromProps(props); 32588 const trulyDisabled = disabled && !props.accessibleWhenDisabled; 32589 const { 32590 rowId, 32591 baseElement, 32592 isActiveItem, 32593 ariaSetSize, 32594 ariaPosInSet, 32595 isTabbable 32596 } = useStoreStateObject(store, { 32597 rowId(state) { 32598 if (rowIdProp) return rowIdProp; 32599 if (!state) return; 32600 if (!(row == null ? void 0 : row.baseElement)) return; 32601 if (row.baseElement !== state.baseElement) return; 32602 return row.id; 32603 }, 32604 baseElement(state) { 32605 return (state == null ? void 0 : state.baseElement) || void 0; 32606 }, 32607 isActiveItem(state) { 32608 return !!state && state.activeId === id; 32609 }, 32610 ariaSetSize(state) { 32611 if (ariaSetSizeProp != null) return ariaSetSizeProp; 32612 if (!state) return; 32613 if (!(row == null ? void 0 : row.ariaSetSize)) return; 32614 if (row.baseElement !== state.baseElement) return; 32615 return row.ariaSetSize; 32616 }, 32617 ariaPosInSet(state) { 32618 if (ariaPosInSetProp != null) return ariaPosInSetProp; 32619 if (!state) return; 32620 if (!(row == null ? void 0 : row.ariaPosInSet)) return; 32621 if (row.baseElement !== state.baseElement) return; 32622 const itemsInRow = state.renderedItems.filter( 32623 (item) => item.rowId === rowId 32624 ); 32625 return row.ariaPosInSet + itemsInRow.findIndex((item) => item.id === id); 32626 }, 32627 isTabbable(state) { 32628 if (!(state == null ? void 0 : state.renderedItems.length)) return true; 32629 if (state.virtualFocus) return false; 32630 if (tabbable) return true; 32631 if (state.activeId === null) return false; 32632 const item = store == null ? void 0 : store.item(state.activeId); 32633 if (item == null ? void 0 : item.disabled) return true; 32634 if (!(item == null ? void 0 : item.element)) return true; 32635 return state.activeId === id; 32636 } 32637 }); 32638 const getItem = (0,external_React_.useCallback)( 32639 (item) => { 32640 var _a2; 32641 const nextItem = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, item), { 32642 id: id || item.id, 32643 rowId, 32644 disabled: !!trulyDisabled, 32645 children: (_a2 = item.element) == null ? void 0 : _a2.textContent 32646 }); 32647 if (getItemProp) { 32648 return getItemProp(nextItem); 32649 } 32650 return nextItem; 32651 }, 32652 [id, rowId, trulyDisabled, getItemProp] 32653 ); 32654 const onFocusProp = props.onFocus; 32655 const hasFocusedComposite = (0,external_React_.useRef)(false); 32656 const onFocus = useEvent((event) => { 32657 onFocusProp == null ? void 0 : onFocusProp(event); 32658 if (event.defaultPrevented) return; 32659 if (isPortalEvent(event)) return; 32660 if (!id) return; 32661 if (!store) return; 32662 if (targetIsAnotherItem(event, store)) return; 32663 const { virtualFocus, baseElement: baseElement2 } = store.getState(); 32664 store.setActiveId(id); 32665 if (isTextbox(event.currentTarget)) { 32666 selectTextField(event.currentTarget); 32667 } 32668 if (!virtualFocus) return; 32669 if (!isSelfTarget(event)) return; 32670 if (isEditableElement(event.currentTarget)) return; 32671 if (!(baseElement2 == null ? void 0 : baseElement2.isConnected)) return; 32672 if (isSafari() && event.currentTarget.hasAttribute("data-autofocus")) { 32673 event.currentTarget.scrollIntoView({ 32674 block: "nearest", 32675 inline: "nearest" 32676 }); 32677 } 32678 hasFocusedComposite.current = true; 32679 const fromComposite = event.relatedTarget === baseElement2 || isItem(store, event.relatedTarget); 32680 if (fromComposite) { 32681 focusSilently(baseElement2); 32682 } else { 32683 baseElement2.focus(); 32684 } 32685 }); 32686 const onBlurCaptureProp = props.onBlurCapture; 32687 const onBlurCapture = useEvent((event) => { 32688 onBlurCaptureProp == null ? void 0 : onBlurCaptureProp(event); 32689 if (event.defaultPrevented) return; 32690 const state = store == null ? void 0 : store.getState(); 32691 if ((state == null ? void 0 : state.virtualFocus) && hasFocusedComposite.current) { 32692 hasFocusedComposite.current = false; 32693 event.preventDefault(); 32694 event.stopPropagation(); 32695 } 32696 }); 32697 const onKeyDownProp = props.onKeyDown; 32698 const preventScrollOnKeyDownProp = useBooleanEvent(preventScrollOnKeyDown); 32699 const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress); 32700 const onKeyDown = useEvent((event) => { 32701 onKeyDownProp == null ? void 0 : onKeyDownProp(event); 32702 if (event.defaultPrevented) return; 32703 if (!isSelfTarget(event)) return; 32704 if (!store) return; 32705 const { currentTarget } = event; 32706 const state = store.getState(); 32707 const item = store.item(id); 32708 const isGrid = !!(item == null ? void 0 : item.rowId); 32709 const isVertical = state.orientation !== "horizontal"; 32710 const isHorizontal = state.orientation !== "vertical"; 32711 const canHomeEnd = () => { 32712 if (isGrid) return true; 32713 if (isHorizontal) return true; 32714 if (!state.baseElement) return true; 32715 if (!isTextField(state.baseElement)) return true; 32716 return false; 32717 }; 32718 const keyMap = { 32719 ArrowUp: (isGrid || isVertical) && store.up, 32720 ArrowRight: (isGrid || isHorizontal) && store.next, 32721 ArrowDown: (isGrid || isVertical) && store.down, 32722 ArrowLeft: (isGrid || isHorizontal) && store.previous, 32723 Home: () => { 32724 if (!canHomeEnd()) return; 32725 if (!isGrid || event.ctrlKey) { 32726 return store == null ? void 0 : store.first(); 32727 } 32728 return store == null ? void 0 : store.previous(-1); 32729 }, 32730 End: () => { 32731 if (!canHomeEnd()) return; 32732 if (!isGrid || event.ctrlKey) { 32733 return store == null ? void 0 : store.last(); 32734 } 32735 return store == null ? void 0 : store.next(-1); 32736 }, 32737 PageUp: () => { 32738 return findNextPageItemId(currentTarget, store, store == null ? void 0 : store.up, true); 32739 }, 32740 PageDown: () => { 32741 return findNextPageItemId(currentTarget, store, store == null ? void 0 : store.down); 32742 } 32743 }; 32744 const action = keyMap[event.key]; 32745 if (action) { 32746 if (isTextbox(currentTarget)) { 32747 const selection = getTextboxSelection(currentTarget); 32748 const isLeft = isHorizontal && event.key === "ArrowLeft"; 32749 const isRight = isHorizontal && event.key === "ArrowRight"; 32750 const isUp = isVertical && event.key === "ArrowUp"; 32751 const isDown = isVertical && event.key === "ArrowDown"; 32752 if (isRight || isDown) { 32753 const { length: valueLength } = getTextboxValue(currentTarget); 32754 if (selection.end !== valueLength) return; 32755 } else if ((isLeft || isUp) && selection.start !== 0) return; 32756 } 32757 const nextId = action(); 32758 if (preventScrollOnKeyDownProp(event) || nextId !== void 0) { 32759 if (!moveOnKeyPressProp(event)) return; 32760 event.preventDefault(); 32761 store.move(nextId); 32762 } 32763 } 32764 }); 32765 const providerValue = (0,external_React_.useMemo)( 32766 () => ({ id, baseElement }), 32767 [id, baseElement] 32768 ); 32769 props = useWrapElement( 32770 props, 32771 (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CompositeItemContext.Provider, { value: providerValue, children: element }), 32772 [providerValue] 32773 ); 32774 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 32775 id, 32776 "data-active-item": isActiveItem || void 0 32777 }, props), { 32778 ref: useMergeRefs(ref, props.ref), 32779 tabIndex: isTabbable ? props.tabIndex : -1, 32780 onFocus, 32781 onBlurCapture, 32782 onKeyDown 32783 }); 32784 props = useCommand(props); 32785 props = useCollectionItem(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 32786 store 32787 }, props), { 32788 getItem, 32789 shouldRegisterItem: id ? props.shouldRegisterItem : false 32790 })); 32791 return removeUndefinedValues(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { 32792 "aria-setsize": ariaSetSize, 32793 "aria-posinset": ariaPosInSet 32794 })); 32795 } 32796 ); 32797 var CompositeItem = memo2( 32798 forwardRef2(function CompositeItem2(props) { 32799 const htmlProps = useCompositeItem(props); 32800 return createElement(P2CTZE2T_TagName, htmlProps); 32801 }) 32802 ); 32803 32804 32805 32806 ;// ./node_modules/@ariakit/react-core/esm/__chunks/ZTDSJLD6.js 32807 "use client"; 32808 32809 32810 32811 32812 32813 32814 32815 32816 // src/combobox/combobox-item.tsx 32817 32818 32819 32820 32821 32822 32823 var ZTDSJLD6_TagName = "div"; 32824 function isSelected(storeValue, itemValue) { 32825 if (itemValue == null) return; 32826 if (storeValue == null) return false; 32827 if (Array.isArray(storeValue)) { 32828 return storeValue.includes(itemValue); 32829 } 32830 return storeValue === itemValue; 32831 } 32832 function getItemRole(popupRole) { 32833 var _a; 32834 const itemRoleByPopupRole = { 32835 menu: "menuitem", 32836 listbox: "option", 32837 tree: "treeitem" 32838 }; 32839 const key = popupRole; 32840 return (_a = itemRoleByPopupRole[key]) != null ? _a : "option"; 32841 } 32842 var useComboboxItem = createHook( 32843 function useComboboxItem2(_a) { 32844 var _b = _a, { 32845 store, 32846 value, 32847 hideOnClick, 32848 setValueOnClick, 32849 selectValueOnClick = true, 32850 resetValueOnSelect, 32851 focusOnHover = false, 32852 moveOnKeyPress = true, 32853 getItem: getItemProp 32854 } = _b, props = __objRest(_b, [ 32855 "store", 32856 "value", 32857 "hideOnClick", 32858 "setValueOnClick", 32859 "selectValueOnClick", 32860 "resetValueOnSelect", 32861 "focusOnHover", 32862 "moveOnKeyPress", 32863 "getItem" 32864 ]); 32865 var _a2; 32866 const context = useComboboxScopedContext(); 32867 store = store || context; 32868 invariant( 32869 store, 32870 false && 0 32871 ); 32872 const { resetValueOnSelectState, multiSelectable, selected } = useStoreStateObject(store, { 32873 resetValueOnSelectState: "resetValueOnSelect", 32874 multiSelectable(state) { 32875 return Array.isArray(state.selectedValue); 32876 }, 32877 selected(state) { 32878 return isSelected(state.selectedValue, value); 32879 } 32880 }); 32881 const getItem = (0,external_React_.useCallback)( 32882 (item) => { 32883 const nextItem = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, item), { value }); 32884 if (getItemProp) { 32885 return getItemProp(nextItem); 32886 } 32887 return nextItem; 32888 }, 32889 [value, getItemProp] 32890 ); 32891 setValueOnClick = setValueOnClick != null ? setValueOnClick : !multiSelectable; 32892 hideOnClick = hideOnClick != null ? hideOnClick : value != null && !multiSelectable; 32893 const onClickProp = props.onClick; 32894 const setValueOnClickProp = useBooleanEvent(setValueOnClick); 32895 const selectValueOnClickProp = useBooleanEvent(selectValueOnClick); 32896 const resetValueOnSelectProp = useBooleanEvent( 32897 (_a2 = resetValueOnSelect != null ? resetValueOnSelect : resetValueOnSelectState) != null ? _a2 : multiSelectable 32898 ); 32899 const hideOnClickProp = useBooleanEvent(hideOnClick); 32900 const onClick = useEvent((event) => { 32901 onClickProp == null ? void 0 : onClickProp(event); 32902 if (event.defaultPrevented) return; 32903 if (isDownloading(event)) return; 32904 if (isOpeningInNewTab(event)) return; 32905 if (value != null) { 32906 if (selectValueOnClickProp(event)) { 32907 if (resetValueOnSelectProp(event)) { 32908 store == null ? void 0 : store.resetValue(); 32909 } 32910 store == null ? void 0 : store.setSelectedValue((prevValue) => { 32911 if (!Array.isArray(prevValue)) return value; 32912 if (prevValue.includes(value)) { 32913 return prevValue.filter((v) => v !== value); 32914 } 32915 return [...prevValue, value]; 32916 }); 32917 } 32918 if (setValueOnClickProp(event)) { 32919 store == null ? void 0 : store.setValue(value); 32920 } 32921 } 32922 if (hideOnClickProp(event)) { 32923 store == null ? void 0 : store.hide(); 32924 } 32925 }); 32926 const onKeyDownProp = props.onKeyDown; 32927 const onKeyDown = useEvent((event) => { 32928 onKeyDownProp == null ? void 0 : onKeyDownProp(event); 32929 if (event.defaultPrevented) return; 32930 const baseElement = store == null ? void 0 : store.getState().baseElement; 32931 if (!baseElement) return; 32932 if (hasFocus(baseElement)) return; 32933 const printable = event.key.length === 1; 32934 if (printable || event.key === "Backspace" || event.key === "Delete") { 32935 queueMicrotask(() => baseElement.focus()); 32936 if (isTextField(baseElement)) { 32937 store == null ? void 0 : store.setValue(baseElement.value); 32938 } 32939 } 32940 }); 32941 if (multiSelectable && selected != null) { 32942 props = _3YLGPPWQ_spreadValues({ 32943 "aria-selected": selected 32944 }, props); 32945 } 32946 props = useWrapElement( 32947 props, 32948 (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxItemValueContext.Provider, { value, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxItemCheckedContext.Provider, { value: selected != null ? selected : false, children: element }) }), 32949 [value, selected] 32950 ); 32951 const popupRole = (0,external_React_.useContext)(ComboboxListRoleContext); 32952 props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 32953 role: getItemRole(popupRole), 32954 children: value 32955 }, props), { 32956 onClick, 32957 onKeyDown 32958 }); 32959 const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress); 32960 props = useCompositeItem(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ 32961 store 32962 }, props), { 32963 getItem, 32964 // Dispatch a custom event on the combobox input when moving to an item 32965 // with the keyboard so the Combobox component can enable inline 32966 // autocompletion. 32967 moveOnKeyPress: (event) => { 32968 if (!moveOnKeyPressProp(event)) return false; 32969 const moveEvent = new Event("combobox-item-move"); 32970 const baseElement = store == null ? void 0 : store.getState().baseElement; 32971 baseElement == null ? void 0 : baseElement.dispatchEvent(moveEvent); 32972 return true; 32973 } 32974 })); 32975 props = useCompositeHover(_3YLGPPWQ_spreadValues({ store, focusOnHover }, props)); 32976 return props; 32977 } 32978 ); 32979 var ComboboxItem = memo2( 32980 forwardRef2(function ComboboxItem2(props) { 32981 const htmlProps = useComboboxItem(props); 32982 return createElement(ZTDSJLD6_TagName, htmlProps); 32983 }) 32984 ); 32985 32986 32987 32988 ;// ./node_modules/@ariakit/react-core/esm/combobox/combobox-item-value.js 32989 "use client"; 32990 32991 32992 32993 32994 32995 32996 32997 32998 32999 33000 33001 33002 // src/combobox/combobox-item-value.tsx 33003 33004 33005 33006 33007 var combobox_item_value_TagName = "span"; 33008 function normalizeValue(value) { 33009 return PBFD2E7P_normalizeString(value).toLowerCase(); 33010 } 33011 function getOffsets(string, values) { 33012 const offsets = []; 33013 for (const value of values) { 33014 let pos = 0; 33015 const length = value.length; 33016 while (string.indexOf(value, pos) !== -1) { 33017 const index = string.indexOf(value, pos); 33018 if (index !== -1) { 33019 offsets.push([index, length]); 33020 } 33021 pos = index + 1; 33022 } 33023 } 33024 return offsets; 33025 } 33026 function filterOverlappingOffsets(offsets) { 33027 return offsets.filter(([offset, length], i, arr) => { 33028 return !arr.some( 33029 ([o, l], j) => j !== i && o <= offset && o + l >= offset + length 33030 ); 33031 }); 33032 } 33033 function sortOffsets(offsets) { 33034 return offsets.sort(([a], [b]) => a - b); 33035 } 33036 function splitValue(itemValue, userValue) { 33037 if (!itemValue) return itemValue; 33038 if (!userValue) return itemValue; 33039 const userValues = toArray(userValue).filter(Boolean).map(normalizeValue); 33040 const parts = []; 33041 const span = (value, autocomplete = false) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 33042 "span", 33043 { 33044 "data-autocomplete-value": autocomplete ? "" : void 0, 33045 "data-user-value": autocomplete ? void 0 : "", 33046 children: value 33047 }, 33048 parts.length 33049 ); 33050 const offsets = sortOffsets( 33051 filterOverlappingOffsets( 33052 // Convert userValues into a set to avoid duplicates 33053 getOffsets(normalizeValue(itemValue), new Set(userValues)) 33054 ) 33055 ); 33056 if (!offsets.length) { 33057 parts.push(span(itemValue, true)); 33058 return parts; 33059 } 33060 const [firstOffset] = offsets[0]; 33061 const values = [ 33062 itemValue.slice(0, firstOffset), 33063 ...offsets.flatMap(([offset, length], i) => { 33064 var _a; 33065 const value = itemValue.slice(offset, offset + length); 33066 const nextOffset = (_a = offsets[i + 1]) == null ? void 0 : _a[0]; 33067 const nextValue = itemValue.slice(offset + length, nextOffset); 33068 return [value, nextValue]; 33069 }) 33070 ]; 33071 values.forEach((value, i) => { 33072 if (!value) return; 33073 parts.push(span(value, i % 2 === 0)); 33074 }); 33075 return parts; 33076 } 33077 var useComboboxItemValue = createHook(function useComboboxItemValue2(_a) { 33078 var _b = _a, { store, value, userValue } = _b, props = __objRest(_b, ["store", "value", "userValue"]); 33079 const context = useComboboxScopedContext(); 33080 store = store || context; 33081 const itemContext = (0,external_React_.useContext)(ComboboxItemValueContext); 33082 const itemValue = value != null ? value : itemContext; 33083 const inputValue = useStoreState(store, (state) => userValue != null ? userValue : state == null ? void 0 : state.value); 33084 const children = (0,external_React_.useMemo)(() => { 33085 if (!itemValue) return; 33086 if (!inputValue) return itemValue; 33087 return splitValue(itemValue, inputValue); 33088 }, [itemValue, inputValue]); 33089 props = _3YLGPPWQ_spreadValues({ 33090 children 33091 }, props); 33092 return removeUndefinedValues(props); 33093 }); 33094 var ComboboxItemValue = forwardRef2(function ComboboxItemValue2(props) { 33095 const htmlProps = useComboboxItemValue(props); 33096 return createElement(combobox_item_value_TagName, htmlProps); 33097 }); 33098 33099 33100 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/search-widget.js 33101 /** 33102 * External dependencies 33103 */ 33104 // eslint-disable-next-line no-restricted-imports 33105 33106 33107 33108 /** 33109 * WordPress dependencies 33110 */ 33111 33112 33113 33114 33115 33116 33117 33118 /** 33119 * Internal dependencies 33120 */ 33121 33122 const radioCheck = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 33123 xmlns: "http://www.w3.org/2000/svg", 33124 viewBox: "0 0 24 24", 33125 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Circle, { 33126 cx: 12, 33127 cy: 12, 33128 r: 3 33129 }) 33130 }); 33131 function search_widget_normalizeSearchInput(input = '') { 33132 return remove_accents_default()(input.trim().toLowerCase()); 33133 } 33134 const search_widget_EMPTY_ARRAY = []; 33135 const getCurrentValue = (filterDefinition, currentFilter) => { 33136 if (filterDefinition.singleSelection) { 33137 return currentFilter?.value; 33138 } 33139 if (Array.isArray(currentFilter?.value)) { 33140 return currentFilter.value; 33141 } 33142 if (!Array.isArray(currentFilter?.value) && !!currentFilter?.value) { 33143 return [currentFilter.value]; 33144 } 33145 return search_widget_EMPTY_ARRAY; 33146 }; 33147 const getNewValue = (filterDefinition, currentFilter, value) => { 33148 if (filterDefinition.singleSelection) { 33149 return value; 33150 } 33151 if (Array.isArray(currentFilter?.value)) { 33152 return currentFilter.value.includes(value) ? currentFilter.value.filter(v => v !== value) : [...currentFilter.value, value]; 33153 } 33154 return [value]; 33155 }; 33156 function generateFilterElementCompositeItemId(prefix, filterElementValue) { 33157 return `$prefix}-$filterElementValue}`; 33158 } 33159 function ListBox({ 33160 view, 33161 filter, 33162 onChangeView 33163 }) { 33164 const baseId = (0,external_wp_compose_namespaceObject.useInstanceId)(ListBox, 'dataviews-filter-list-box'); 33165 const [activeCompositeId, setActiveCompositeId] = (0,external_wp_element_namespaceObject.useState)( 33166 // When there are one or less operators, the first item is set as active 33167 // (by setting the initial `activeId` to `undefined`). 33168 // With 2 or more operators, the focus is moved on the operators control 33169 // (by setting the initial `activeId` to `null`), meaning that there won't 33170 // be an active item initially. Focus is then managed via the 33171 // `onFocusVisible` callback. 33172 filter.operators?.length === 1 ? undefined : null); 33173 const currentFilter = view.filters?.find(f => f.field === filter.field); 33174 const currentValue = getCurrentValue(filter, currentFilter); 33175 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite, { 33176 virtualFocus: true, 33177 focusLoop: true, 33178 activeId: activeCompositeId, 33179 setActiveId: setActiveCompositeId, 33180 role: "listbox", 33181 className: "dataviews-filters__search-widget-listbox", 33182 "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: List of items for a filter. 1: Filter name. e.g.: "List of: Author". */ 33183 (0,external_wp_i18n_namespaceObject.__)('List of: %1$s'), filter.name), 33184 onFocusVisible: () => { 33185 // `onFocusVisible` needs the `Composite` component to be focusable, 33186 // which is implicitly achieved via the `virtualFocus` prop. 33187 if (!activeCompositeId && filter.elements.length) { 33188 setActiveCompositeId(generateFilterElementCompositeItemId(baseId, filter.elements[0].value)); 33189 } 33190 }, 33191 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Typeahead, {}), 33192 children: filter.elements.map(element => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Composite.Hover, { 33193 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Item, { 33194 id: generateFilterElementCompositeItemId(baseId, element.value), 33195 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 33196 "aria-label": element.label, 33197 role: "option", 33198 className: "dataviews-filters__search-widget-listitem" 33199 }), 33200 onClick: () => { 33201 var _view$filters, _view$filters2; 33202 const newFilters = currentFilter ? [...((_view$filters = view.filters) !== null && _view$filters !== void 0 ? _view$filters : []).map(_filter => { 33203 if (_filter.field === filter.field) { 33204 return { 33205 ..._filter, 33206 operator: currentFilter.operator || filter.operators[0], 33207 value: getNewValue(filter, currentFilter, element.value) 33208 }; 33209 } 33210 return _filter; 33211 })] : [...((_view$filters2 = view.filters) !== null && _view$filters2 !== void 0 ? _view$filters2 : []), { 33212 field: filter.field, 33213 operator: filter.operators[0], 33214 value: getNewValue(filter, currentFilter, element.value) 33215 }]; 33216 onChangeView({ 33217 ...view, 33218 page: 1, 33219 filters: newFilters 33220 }); 33221 } 33222 }), 33223 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { 33224 className: "dataviews-filters__search-widget-listitem-check", 33225 children: [filter.singleSelection && currentValue === element.value && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 33226 icon: radioCheck 33227 }), !filter.singleSelection && currentValue.includes(element.value) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 33228 icon: library_check 33229 })] 33230 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 33231 children: element.label 33232 })] 33233 }, element.value)) 33234 }); 33235 } 33236 function search_widget_ComboboxList({ 33237 view, 33238 filter, 33239 onChangeView 33240 }) { 33241 const [searchValue, setSearchValue] = (0,external_wp_element_namespaceObject.useState)(''); 33242 const deferredSearchValue = (0,external_wp_element_namespaceObject.useDeferredValue)(searchValue); 33243 const currentFilter = view.filters?.find(_filter => _filter.field === filter.field); 33244 const currentValue = getCurrentValue(filter, currentFilter); 33245 const matches = (0,external_wp_element_namespaceObject.useMemo)(() => { 33246 const normalizedSearch = search_widget_normalizeSearchInput(deferredSearchValue); 33247 return filter.elements.filter(item => search_widget_normalizeSearchInput(item.label).includes(normalizedSearch)); 33248 }, [filter.elements, deferredSearchValue]); 33249 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ComboboxProvider, { 33250 selectedValue: currentValue, 33251 setSelectedValue: value => { 33252 var _view$filters3, _view$filters4; 33253 const newFilters = currentFilter ? [...((_view$filters3 = view.filters) !== null && _view$filters3 !== void 0 ? _view$filters3 : []).map(_filter => { 33254 if (_filter.field === filter.field) { 33255 return { 33256 ..._filter, 33257 operator: currentFilter.operator || filter.operators[0], 33258 value 33259 }; 33260 } 33261 return _filter; 33262 })] : [...((_view$filters4 = view.filters) !== null && _view$filters4 !== void 0 ? _view$filters4 : []), { 33263 field: filter.field, 33264 operator: filter.operators[0], 33265 value 33266 }]; 33267 onChangeView({ 33268 ...view, 33269 page: 1, 33270 filters: newFilters 33271 }); 33272 }, 33273 setValue: setSearchValue, 33274 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 33275 className: "dataviews-filters__search-widget-filter-combobox__wrapper", 33276 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxLabel, { 33277 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { 33278 children: (0,external_wp_i18n_namespaceObject.__)('Search items') 33279 }), 33280 children: (0,external_wp_i18n_namespaceObject.__)('Search items') 33281 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Combobox, { 33282 autoSelect: "always", 33283 placeholder: (0,external_wp_i18n_namespaceObject.__)('Search'), 33284 className: "dataviews-filters__search-widget-filter-combobox__input" 33285 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 33286 className: "dataviews-filters__search-widget-filter-combobox__icon", 33287 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 33288 icon: library_search 33289 }) 33290 })] 33291 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ComboboxList, { 33292 className: "dataviews-filters__search-widget-filter-combobox-list", 33293 alwaysVisible: true, 33294 children: [matches.map(element => { 33295 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ComboboxItem, { 33296 resetValueOnSelect: false, 33297 value: element.value, 33298 className: "dataviews-filters__search-widget-listitem", 33299 hideOnClick: false, 33300 setValueOnClick: false, 33301 focusOnHover: true, 33302 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { 33303 className: "dataviews-filters__search-widget-listitem-check", 33304 children: [filter.singleSelection && currentValue === element.value && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 33305 icon: radioCheck 33306 }), !filter.singleSelection && currentValue.includes(element.value) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 33307 icon: library_check 33308 })] 33309 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { 33310 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxItemValue, { 33311 className: "dataviews-filters__search-widget-filter-combobox-item-value", 33312 value: element.label 33313 }), !!element.description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 33314 className: "dataviews-filters__search-widget-listitem-description", 33315 children: element.description 33316 })] 33317 })] 33318 }, element.value); 33319 }), !matches.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 33320 children: (0,external_wp_i18n_namespaceObject.__)('No results found') 33321 })] 33322 })] 33323 }); 33324 } 33325 function SearchWidget(props) { 33326 const Widget = props.filter.elements.length > 10 ? search_widget_ComboboxList : ListBox; 33327 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Widget, { 33328 ...props 33329 }); 33330 } 33331 33332 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/filter-summary.js 33333 /** 33334 * External dependencies 33335 */ 33336 33337 /** 33338 * WordPress dependencies 33339 */ 33340 33341 33342 33343 33344 const ENTER = 'Enter'; 33345 const SPACE = ' '; 33346 33347 /** 33348 * Internal dependencies 33349 */ 33350 33351 33352 33353 const FilterText = ({ 33354 activeElements, 33355 filterInView, 33356 filter 33357 }) => { 33358 if (activeElements === undefined || activeElements.length === 0) { 33359 return filter.name; 33360 } 33361 const filterTextWrappers = { 33362 Name: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 33363 className: "dataviews-filters__summary-filter-text-name" 33364 }), 33365 Value: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 33366 className: "dataviews-filters__summary-filter-text-value" 33367 }) 33368 }; 33369 if (filterInView?.operator === constants_OPERATOR_IS_ANY) { 33370 return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: Filter name. 3: Filter value. e.g.: "Author is any: Admin, Editor". */ 33371 (0,external_wp_i18n_namespaceObject.__)('<Name>%1$s is any: </Name><Value>%2$s</Value>'), filter.name, activeElements.map(element => element.label).join(', ')), filterTextWrappers); 33372 } 33373 if (filterInView?.operator === constants_OPERATOR_IS_NONE) { 33374 return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: Filter name. 3: Filter value. e.g.: "Author is none: Admin, Editor". */ 33375 (0,external_wp_i18n_namespaceObject.__)('<Name>%1$s is none: </Name><Value>%2$s</Value>'), filter.name, activeElements.map(element => element.label).join(', ')), filterTextWrappers); 33376 } 33377 if (filterInView?.operator === OPERATOR_IS_ALL) { 33378 return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: Filter name. 3: Filter value. e.g.: "Author is all: Admin, Editor". */ 33379 (0,external_wp_i18n_namespaceObject.__)('<Name>%1$s is all: </Name><Value>%2$s</Value>'), filter.name, activeElements.map(element => element.label).join(', ')), filterTextWrappers); 33380 } 33381 if (filterInView?.operator === OPERATOR_IS_NOT_ALL) { 33382 return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: Filter name. 3: Filter value. e.g.: "Author is not all: Admin, Editor". */ 33383 (0,external_wp_i18n_namespaceObject.__)('<Name>%1$s is not all: </Name><Value>%2$s</Value>'), filter.name, activeElements.map(element => element.label).join(', ')), filterTextWrappers); 33384 } 33385 if (filterInView?.operator === constants_OPERATOR_IS) { 33386 return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: Filter name. 3: Filter value. e.g.: "Author is: Admin". */ 33387 (0,external_wp_i18n_namespaceObject.__)('<Name>%1$s is: </Name><Value>%2$s</Value>'), filter.name, activeElements[0].label), filterTextWrappers); 33388 } 33389 if (filterInView?.operator === constants_OPERATOR_IS_NOT) { 33390 return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: Filter name. 3: Filter value. e.g.: "Author is not: Admin". */ 33391 (0,external_wp_i18n_namespaceObject.__)('<Name>%1$s is not: </Name><Value>%2$s</Value>'), filter.name, activeElements[0].label), filterTextWrappers); 33392 } 33393 return (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: Filter name e.g.: "Unknown status for Author". */ 33394 (0,external_wp_i18n_namespaceObject.__)('Unknown status for %1$s'), filter.name); 33395 }; 33396 function OperatorSelector({ 33397 filter, 33398 view, 33399 onChangeView 33400 }) { 33401 const operatorOptions = filter.operators?.map(operator => ({ 33402 value: operator, 33403 label: OPERATORS[operator]?.label 33404 })); 33405 const currentFilter = view.filters?.find(_filter => _filter.field === filter.field); 33406 const value = currentFilter?.operator || filter.operators[0]; 33407 return operatorOptions.length > 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 33408 spacing: 2, 33409 justify: "flex-start", 33410 className: "dataviews-filters__summary-operators-container", 33411 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 33412 className: "dataviews-filters__summary-operators-filter-name", 33413 children: filter.name 33414 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { 33415 label: (0,external_wp_i18n_namespaceObject.__)('Conditions'), 33416 value: value, 33417 options: operatorOptions, 33418 onChange: newValue => { 33419 var _view$filters, _view$filters2; 33420 const operator = newValue; 33421 const newFilters = currentFilter ? [...((_view$filters = view.filters) !== null && _view$filters !== void 0 ? _view$filters : []).map(_filter => { 33422 if (_filter.field === filter.field) { 33423 return { 33424 ..._filter, 33425 operator 33426 }; 33427 } 33428 return _filter; 33429 })] : [...((_view$filters2 = view.filters) !== null && _view$filters2 !== void 0 ? _view$filters2 : []), { 33430 field: filter.field, 33431 operator, 33432 value: undefined 33433 }]; 33434 onChangeView({ 33435 ...view, 33436 page: 1, 33437 filters: newFilters 33438 }); 33439 }, 33440 size: "small", 33441 __nextHasNoMarginBottom: true, 33442 hideLabelFromVision: true 33443 })] 33444 }); 33445 } 33446 function FilterSummary({ 33447 addFilterRef, 33448 openedFilter, 33449 ...commonProps 33450 }) { 33451 const toggleRef = (0,external_wp_element_namespaceObject.useRef)(null); 33452 const { 33453 filter, 33454 view, 33455 onChangeView 33456 } = commonProps; 33457 const filterInView = view.filters?.find(f => f.field === filter.field); 33458 const activeElements = filter.elements.filter(element => { 33459 if (filter.singleSelection) { 33460 return element.value === filterInView?.value; 33461 } 33462 return filterInView?.value?.includes(element.value); 33463 }); 33464 const isPrimary = filter.isPrimary; 33465 const hasValues = filterInView?.value !== undefined; 33466 const canResetOrRemove = !isPrimary || hasValues; 33467 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 33468 defaultOpen: openedFilter === filter.field, 33469 contentClassName: "dataviews-filters__summary-popover", 33470 popoverProps: { 33471 placement: 'bottom-start', 33472 role: 'dialog' 33473 }, 33474 onClose: () => { 33475 toggleRef.current?.focus(); 33476 }, 33477 renderToggle: ({ 33478 isOpen, 33479 onToggle 33480 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 33481 className: "dataviews-filters__summary-chip-container", 33482 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { 33483 text: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: Filter name. */ 33484 (0,external_wp_i18n_namespaceObject.__)('Filter by: %1$s'), filter.name.toLowerCase()), 33485 placement: "top", 33486 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 33487 className: dist_clsx('dataviews-filters__summary-chip', { 33488 'has-reset': canResetOrRemove, 33489 'has-values': hasValues 33490 }), 33491 role: "button", 33492 tabIndex: 0, 33493 onClick: onToggle, 33494 onKeyDown: event => { 33495 if ([ENTER, SPACE].includes(event.key)) { 33496 onToggle(); 33497 event.preventDefault(); 33498 } 33499 }, 33500 "aria-pressed": isOpen, 33501 "aria-expanded": isOpen, 33502 ref: toggleRef, 33503 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FilterText, { 33504 activeElements: activeElements, 33505 filterInView: filterInView, 33506 filter: filter 33507 }) 33508 }) 33509 }), canResetOrRemove && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { 33510 text: isPrimary ? (0,external_wp_i18n_namespaceObject.__)('Reset') : (0,external_wp_i18n_namespaceObject.__)('Remove'), 33511 placement: "top", 33512 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("button", { 33513 className: dist_clsx('dataviews-filters__summary-chip-remove', { 33514 'has-values': hasValues 33515 }), 33516 onClick: () => { 33517 onChangeView({ 33518 ...view, 33519 page: 1, 33520 filters: view.filters?.filter(_filter => _filter.field !== filter.field) 33521 }); 33522 // If the filter is not primary and can be removed, it will be added 33523 // back to the available filters from `Add filter` component. 33524 if (!isPrimary) { 33525 addFilterRef.current?.focus(); 33526 } else { 33527 // If is primary, focus the toggle button. 33528 toggleRef.current?.focus(); 33529 } 33530 }, 33531 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 33532 icon: close_small 33533 }) 33534 }) 33535 })] 33536 }), 33537 renderContent: () => { 33538 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 33539 spacing: 0, 33540 justify: "flex-start", 33541 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(OperatorSelector, { 33542 ...commonProps 33543 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SearchWidget, { 33544 ...commonProps 33545 })] 33546 }); 33547 } 33548 }); 33549 } 33550 33551 ;// ./node_modules/@wordpress/dataviews/build-module/lock-unlock.js 33552 /** 33553 * WordPress dependencies 33554 */ 33555 33556 const { 33557 lock: lock_unlock_lock, 33558 unlock: lock_unlock_unlock 33559 } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', '@wordpress/dataviews'); 33560 33561 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/add-filter.js 33562 /** 33563 * External dependencies 33564 */ 33565 33566 /** 33567 * WordPress dependencies 33568 */ 33569 33570 33571 33572 33573 /** 33574 * Internal dependencies 33575 */ 33576 33577 33578 const { 33579 Menu: add_filter_Menu 33580 } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 33581 function AddFilterMenu({ 33582 filters, 33583 view, 33584 onChangeView, 33585 setOpenedFilter, 33586 triggerProps 33587 }) { 33588 const inactiveFilters = filters.filter(filter => !filter.isVisible); 33589 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(add_filter_Menu, { 33590 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_filter_Menu.TriggerButton, { 33591 ...triggerProps 33592 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_filter_Menu.Popover, { 33593 children: inactiveFilters.map(filter => { 33594 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_filter_Menu.Item, { 33595 onClick: () => { 33596 setOpenedFilter(filter.field); 33597 onChangeView({ 33598 ...view, 33599 page: 1, 33600 filters: [...(view.filters || []), { 33601 field: filter.field, 33602 value: undefined, 33603 operator: filter.operators[0] 33604 }] 33605 }); 33606 }, 33607 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_filter_Menu.ItemLabel, { 33608 children: filter.name 33609 }) 33610 }, filter.field); 33611 }) 33612 })] 33613 }); 33614 } 33615 function AddFilter({ 33616 filters, 33617 view, 33618 onChangeView, 33619 setOpenedFilter 33620 }, ref) { 33621 if (!filters.length || filters.every(({ 33622 isPrimary 33623 }) => isPrimary)) { 33624 return null; 33625 } 33626 const inactiveFilters = filters.filter(filter => !filter.isVisible); 33627 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AddFilterMenu, { 33628 triggerProps: { 33629 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 33630 accessibleWhenDisabled: true, 33631 size: "compact", 33632 className: "dataviews-filters-button", 33633 variant: "tertiary", 33634 disabled: !inactiveFilters.length, 33635 ref: ref 33636 }), 33637 children: (0,external_wp_i18n_namespaceObject.__)('Add filter') 33638 }, 33639 filters, 33640 view, 33641 onChangeView, 33642 setOpenedFilter 33643 }); 33644 } 33645 /* harmony default export */ const add_filter = ((0,external_wp_element_namespaceObject.forwardRef)(AddFilter)); 33646 33647 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/reset-filters.js 33648 /** 33649 * WordPress dependencies 33650 */ 33651 33652 33653 33654 /** 33655 * Internal dependencies 33656 */ 33657 33658 function ResetFilter({ 33659 filters, 33660 view, 33661 onChangeView 33662 }) { 33663 const isPrimary = field => filters.some(_filter => _filter.field === field && _filter.isPrimary); 33664 const isDisabled = !view.search && !view.filters?.some(_filter => _filter.value !== undefined || !isPrimary(_filter.field)); 33665 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 33666 disabled: isDisabled, 33667 accessibleWhenDisabled: true, 33668 size: "compact", 33669 variant: "tertiary", 33670 className: "dataviews-filters__reset-button", 33671 onClick: () => { 33672 onChangeView({ 33673 ...view, 33674 page: 1, 33675 search: '', 33676 filters: [] 33677 }); 33678 }, 33679 children: (0,external_wp_i18n_namespaceObject.__)('Reset') 33680 }); 33681 } 33682 33683 ;// ./node_modules/@wordpress/dataviews/build-module/utils.js 33684 /** 33685 * Internal dependencies 33686 */ 33687 33688 function sanitizeOperators(field) { 33689 let operators = field.filterBy?.operators; 33690 33691 // Assign default values. 33692 if (!operators || !Array.isArray(operators)) { 33693 operators = [constants_OPERATOR_IS_ANY, constants_OPERATOR_IS_NONE]; 33694 } 33695 33696 // Make sure only valid operators are used. 33697 operators = operators.filter(operator => ALL_OPERATORS.includes(operator)); 33698 33699 // Do not allow mixing single & multiselection operators. 33700 // Remove multiselection operators if any of the single selection ones is present. 33701 if (operators.includes(constants_OPERATOR_IS) || operators.includes(constants_OPERATOR_IS_NOT)) { 33702 operators = operators.filter(operator => [constants_OPERATOR_IS, constants_OPERATOR_IS_NOT].includes(operator)); 33703 } 33704 return operators; 33705 } 33706 33707 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/index.js 33708 /** 33709 * WordPress dependencies 33710 */ 33711 33712 33713 33714 33715 33716 /** 33717 * Internal dependencies 33718 */ 33719 33720 33721 33722 33723 33724 33725 33726 function useFilters(fields, view) { 33727 return (0,external_wp_element_namespaceObject.useMemo)(() => { 33728 const filters = []; 33729 fields.forEach(field => { 33730 if (!field.elements?.length) { 33731 return; 33732 } 33733 const operators = sanitizeOperators(field); 33734 if (operators.length === 0) { 33735 return; 33736 } 33737 const isPrimary = !!field.filterBy?.isPrimary; 33738 filters.push({ 33739 field: field.id, 33740 name: field.label, 33741 elements: field.elements, 33742 singleSelection: operators.some(op => [constants_OPERATOR_IS, constants_OPERATOR_IS_NOT].includes(op)), 33743 operators, 33744 isVisible: isPrimary || !!view.filters?.some(f => f.field === field.id && ALL_OPERATORS.includes(f.operator)), 33745 isPrimary 33746 }); 33747 }); 33748 // Sort filters by primary property. We need the primary filters to be first. 33749 // Then we sort by name. 33750 filters.sort((a, b) => { 33751 if (a.isPrimary && !b.isPrimary) { 33752 return -1; 33753 } 33754 if (!a.isPrimary && b.isPrimary) { 33755 return 1; 33756 } 33757 return a.name.localeCompare(b.name); 33758 }); 33759 return filters; 33760 }, [fields, view]); 33761 } 33762 function FiltersToggle({ 33763 filters, 33764 view, 33765 onChangeView, 33766 setOpenedFilter, 33767 isShowingFilter, 33768 setIsShowingFilter 33769 }) { 33770 const buttonRef = (0,external_wp_element_namespaceObject.useRef)(null); 33771 const onChangeViewWithFilterVisibility = (0,external_wp_element_namespaceObject.useCallback)(_view => { 33772 onChangeView(_view); 33773 setIsShowingFilter(true); 33774 }, [onChangeView, setIsShowingFilter]); 33775 const visibleFilters = filters.filter(filter => filter.isVisible); 33776 const hasVisibleFilters = !!visibleFilters.length; 33777 if (filters.length === 0) { 33778 return null; 33779 } 33780 const addFilterButtonProps = { 33781 label: (0,external_wp_i18n_namespaceObject.__)('Add filter'), 33782 'aria-expanded': false, 33783 isPressed: false 33784 }; 33785 const toggleFiltersButtonProps = { 33786 label: (0,external_wp_i18n_namespaceObject._x)('Filter', 'verb'), 33787 'aria-expanded': isShowingFilter, 33788 isPressed: isShowingFilter, 33789 onClick: () => { 33790 if (!isShowingFilter) { 33791 setOpenedFilter(null); 33792 } 33793 setIsShowingFilter(!isShowingFilter); 33794 } 33795 }; 33796 const buttonComponent = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 33797 ref: buttonRef, 33798 className: "dataviews-filters__visibility-toggle", 33799 size: "compact", 33800 icon: library_funnel, 33801 ...(hasVisibleFilters ? toggleFiltersButtonProps : addFilterButtonProps) 33802 }); 33803 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 33804 className: "dataviews-filters__container-visibility-toggle", 33805 children: !hasVisibleFilters ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AddFilterMenu, { 33806 filters: filters, 33807 view: view, 33808 onChangeView: onChangeViewWithFilterVisibility, 33809 setOpenedFilter: setOpenedFilter, 33810 triggerProps: { 33811 render: buttonComponent 33812 } 33813 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FilterVisibilityToggle, { 33814 buttonRef: buttonRef, 33815 filtersCount: view.filters?.length, 33816 children: buttonComponent 33817 }) 33818 }); 33819 } 33820 function FilterVisibilityToggle({ 33821 buttonRef, 33822 filtersCount, 33823 children 33824 }) { 33825 // Focus the `add filter` button when unmounts. 33826 (0,external_wp_element_namespaceObject.useEffect)(() => () => { 33827 buttonRef.current?.focus(); 33828 }, [buttonRef]); 33829 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 33830 children: [children, !!filtersCount && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 33831 className: "dataviews-filters-toggle__count", 33832 children: filtersCount 33833 })] 33834 }); 33835 } 33836 function Filters() { 33837 const { 33838 fields, 33839 view, 33840 onChangeView, 33841 openedFilter, 33842 setOpenedFilter 33843 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 33844 const addFilterRef = (0,external_wp_element_namespaceObject.useRef)(null); 33845 const filters = useFilters(fields, view); 33846 const addFilter = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_filter, { 33847 filters: filters, 33848 view: view, 33849 onChangeView: onChangeView, 33850 ref: addFilterRef, 33851 setOpenedFilter: setOpenedFilter 33852 }, "add-filter"); 33853 const visibleFilters = filters.filter(filter => filter.isVisible); 33854 if (visibleFilters.length === 0) { 33855 return null; 33856 } 33857 const filterComponents = [...visibleFilters.map(filter => { 33858 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FilterSummary, { 33859 filter: filter, 33860 view: view, 33861 onChangeView: onChangeView, 33862 addFilterRef: addFilterRef, 33863 openedFilter: openedFilter 33864 }, filter.field); 33865 }), addFilter]; 33866 filterComponents.push(/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ResetFilter, { 33867 filters: filters, 33868 view: view, 33869 onChangeView: onChangeView 33870 }, "reset-filters")); 33871 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 33872 justify: "flex-start", 33873 style: { 33874 width: 'fit-content' 33875 }, 33876 className: "dataviews-filters__container", 33877 wrap: true, 33878 children: filterComponents 33879 }); 33880 } 33881 /* harmony default export */ const dataviews_filters = ((0,external_wp_element_namespaceObject.memo)(Filters)); 33882 33883 ;// ./node_modules/@wordpress/icons/build-module/library/block-table.js 33884 /** 33885 * WordPress dependencies 33886 */ 33887 33888 33889 const blockTable = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 33890 viewBox: "0 0 24 24", 33891 xmlns: "http://www.w3.org/2000/svg", 33892 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 33893 d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v3.5h-15V5c0-.3.2-.5.5-.5zm8 5.5h6.5v3.5H13V10zm-1.5 3.5h-7V10h7v3.5zm-7 5.5v-4h7v4.5H5c-.3 0-.5-.2-.5-.5zm14.5.5h-6V15h6.5v4c0 .3-.2.5-.5.5z" 33894 }) 33895 }); 33896 /* harmony default export */ const block_table = (blockTable); 33897 33898 ;// ./node_modules/@wordpress/icons/build-module/library/category.js 33899 /** 33900 * WordPress dependencies 33901 */ 33902 33903 33904 const category = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 33905 viewBox: "0 0 24 24", 33906 xmlns: "http://www.w3.org/2000/svg", 33907 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 33908 d: "M6 5.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM4 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2V6zm11-.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5h-3a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM13 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2h-3a2 2 0 01-2-2V6zm5 8.5h-3a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5zM15 13a2 2 0 00-2 2v3a2 2 0 002 2h3a2 2 0 002-2v-3a2 2 0 00-2-2h-3zm-9 1.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5v-3a.5.5 0 01.5-.5zM4 15a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2v-3z", 33909 fillRule: "evenodd", 33910 clipRule: "evenodd" 33911 }) 33912 }); 33913 /* harmony default export */ const library_category = (category); 33914 33915 ;// ./node_modules/@wordpress/icons/build-module/library/format-list-bullets-rtl.js 33916 /** 33917 * WordPress dependencies 33918 */ 33919 33920 33921 const formatListBulletsRTL = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 33922 xmlns: "http://www.w3.org/2000/svg", 33923 viewBox: "0 0 24 24", 33924 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 33925 d: "M4 8.8h8.9V7.2H4v1.6zm0 7h8.9v-1.5H4v1.5zM18 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z" 33926 }) 33927 }); 33928 /* harmony default export */ const format_list_bullets_rtl = (formatListBulletsRTL); 33929 33930 ;// ./node_modules/@wordpress/icons/build-module/library/format-list-bullets.js 33931 /** 33932 * WordPress dependencies 33933 */ 33934 33935 33936 const formatListBullets = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 33937 xmlns: "http://www.w3.org/2000/svg", 33938 viewBox: "0 0 24 24", 33939 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 33940 d: "M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM6 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-7c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" 33941 }) 33942 }); 33943 /* harmony default export */ const format_list_bullets = (formatListBullets); 33944 33945 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-selection-checkbox/index.js 33946 /** 33947 * WordPress dependencies 33948 */ 33949 33950 33951 33952 /** 33953 * Internal dependencies 33954 */ 33955 33956 function DataViewsSelectionCheckbox({ 33957 selection, 33958 onChangeSelection, 33959 item, 33960 getItemId, 33961 titleField, 33962 disabled 33963 }) { 33964 const id = getItemId(item); 33965 const checked = !disabled && selection.includes(id); 33966 33967 // Fallback label to ensure accessibility 33968 const selectionLabel = titleField?.getValue?.({ 33969 item 33970 }) || (0,external_wp_i18n_namespaceObject.__)('(no title)'); 33971 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { 33972 className: "dataviews-selection-checkbox", 33973 __nextHasNoMarginBottom: true, 33974 "aria-label": selectionLabel, 33975 "aria-disabled": disabled, 33976 checked: checked, 33977 onChange: () => { 33978 if (disabled) { 33979 return; 33980 } 33981 onChangeSelection(selection.includes(id) ? selection.filter(itemId => id !== itemId) : [...selection, id]); 33982 } 33983 }); 33984 } 33985 33986 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-item-actions/index.js 33987 /** 33988 * External dependencies 33989 */ 33990 33991 /** 33992 * WordPress dependencies 33993 */ 33994 33995 33996 33997 33998 33999 34000 /** 34001 * Internal dependencies 34002 */ 34003 34004 34005 const { 34006 Menu: dataviews_item_actions_Menu, 34007 kebabCase: dataviews_item_actions_kebabCase 34008 } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 34009 function ButtonTrigger({ 34010 action, 34011 onClick, 34012 items 34013 }) { 34014 const label = typeof action.label === 'string' ? action.label : action.label(items); 34015 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 34016 label: label, 34017 icon: action.icon, 34018 disabled: !!action.disabled, 34019 accessibleWhenDisabled: true, 34020 isDestructive: action.isDestructive, 34021 size: "compact", 34022 onClick: onClick 34023 }); 34024 } 34025 function MenuItemTrigger({ 34026 action, 34027 onClick, 34028 items 34029 }) { 34030 const label = typeof action.label === 'string' ? action.label : action.label(items); 34031 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_item_actions_Menu.Item, { 34032 disabled: action.disabled, 34033 onClick: onClick, 34034 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_item_actions_Menu.ItemLabel, { 34035 children: label 34036 }) 34037 }); 34038 } 34039 function ActionModal({ 34040 action, 34041 items, 34042 closeModal 34043 }) { 34044 const label = typeof action.label === 'string' ? action.label : action.label(items); 34045 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 34046 title: action.modalHeader || label, 34047 __experimentalHideHeader: !!action.hideModalHeader, 34048 onRequestClose: closeModal, 34049 focusOnMount: "firstContentElement", 34050 size: "medium", 34051 overlayClassName: `dataviews-action-modal dataviews-action-modal__$dataviews_item_actions_kebabCase(action.id)}`, 34052 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(action.RenderModal, { 34053 items: items, 34054 closeModal: closeModal 34055 }) 34056 }); 34057 } 34058 function ActionsMenuGroup({ 34059 actions, 34060 item, 34061 registry, 34062 setActiveModalAction 34063 }) { 34064 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_item_actions_Menu.Group, { 34065 children: actions.map(action => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MenuItemTrigger, { 34066 action: action, 34067 onClick: () => { 34068 if ('RenderModal' in action) { 34069 setActiveModalAction(action); 34070 return; 34071 } 34072 action.callback([item], { 34073 registry 34074 }); 34075 }, 34076 items: [item] 34077 }, action.id)) 34078 }); 34079 } 34080 function ItemActions({ 34081 item, 34082 actions, 34083 isCompact 34084 }) { 34085 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 34086 const { 34087 primaryActions, 34088 eligibleActions 34089 } = (0,external_wp_element_namespaceObject.useMemo)(() => { 34090 // If an action is eligible for all items, doesn't need 34091 // to provide the `isEligible` function. 34092 const _eligibleActions = actions.filter(action => !action.isEligible || action.isEligible(item)); 34093 const _primaryActions = _eligibleActions.filter(action => action.isPrimary && !!action.icon); 34094 return { 34095 primaryActions: _primaryActions, 34096 eligibleActions: _eligibleActions 34097 }; 34098 }, [actions, item]); 34099 if (isCompact) { 34100 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CompactItemActions, { 34101 item: item, 34102 actions: eligibleActions, 34103 isSmall: true, 34104 registry: registry 34105 }); 34106 } 34107 34108 // If all actions are primary, there is no need to render the dropdown. 34109 if (primaryActions.length === eligibleActions.length) { 34110 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrimaryActions, { 34111 item: item, 34112 actions: primaryActions, 34113 registry: registry 34114 }); 34115 } 34116 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 34117 spacing: 1, 34118 justify: "flex-end", 34119 className: "dataviews-item-actions", 34120 style: { 34121 flexShrink: '0', 34122 width: 'auto' 34123 }, 34124 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrimaryActions, { 34125 item: item, 34126 actions: primaryActions, 34127 registry: registry 34128 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CompactItemActions, { 34129 item: item, 34130 actions: eligibleActions, 34131 registry: registry 34132 })] 34133 }); 34134 } 34135 function CompactItemActions({ 34136 item, 34137 actions, 34138 isSmall, 34139 registry 34140 }) { 34141 const [activeModalAction, setActiveModalAction] = (0,external_wp_element_namespaceObject.useState)(null); 34142 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 34143 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(dataviews_item_actions_Menu, { 34144 placement: "bottom-end", 34145 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_item_actions_Menu.TriggerButton, { 34146 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 34147 size: isSmall ? 'small' : 'compact', 34148 icon: more_vertical, 34149 label: (0,external_wp_i18n_namespaceObject.__)('Actions'), 34150 accessibleWhenDisabled: true, 34151 disabled: !actions.length, 34152 className: "dataviews-all-actions-button" 34153 }) 34154 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_item_actions_Menu.Popover, { 34155 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionsMenuGroup, { 34156 actions: actions, 34157 item: item, 34158 registry: registry, 34159 setActiveModalAction: setActiveModalAction 34160 }) 34161 })] 34162 }), !!activeModalAction && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionModal, { 34163 action: activeModalAction, 34164 items: [item], 34165 closeModal: () => setActiveModalAction(null) 34166 })] 34167 }); 34168 } 34169 function PrimaryActions({ 34170 item, 34171 actions, 34172 registry 34173 }) { 34174 const [activeModalAction, setActiveModalAction] = (0,external_wp_element_namespaceObject.useState)(null); 34175 if (!Array.isArray(actions) || actions.length === 0) { 34176 return null; 34177 } 34178 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 34179 children: [actions.map(action => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ButtonTrigger, { 34180 action: action, 34181 onClick: () => { 34182 if ('RenderModal' in action) { 34183 setActiveModalAction(action); 34184 return; 34185 } 34186 action.callback([item], { 34187 registry 34188 }); 34189 }, 34190 items: [item] 34191 }, action.id)), !!activeModalAction && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionModal, { 34192 action: activeModalAction, 34193 items: [item], 34194 closeModal: () => setActiveModalAction(null) 34195 })] 34196 }); 34197 } 34198 34199 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-bulk-actions/index.js 34200 /** 34201 * External dependencies 34202 */ 34203 34204 /** 34205 * WordPress dependencies 34206 */ 34207 34208 34209 34210 34211 34212 34213 /** 34214 * Internal dependencies 34215 */ 34216 34217 34218 34219 function ActionWithModal({ 34220 action, 34221 items, 34222 ActionTriggerComponent 34223 }) { 34224 const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); 34225 const actionTriggerProps = { 34226 action, 34227 onClick: () => { 34228 setIsModalOpen(true); 34229 }, 34230 items 34231 }; 34232 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 34233 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionTriggerComponent, { 34234 ...actionTriggerProps 34235 }), isModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionModal, { 34236 action: action, 34237 items: items, 34238 closeModal: () => setIsModalOpen(false) 34239 })] 34240 }); 34241 } 34242 function useHasAPossibleBulkAction(actions, item) { 34243 return (0,external_wp_element_namespaceObject.useMemo)(() => { 34244 return actions.some(action => { 34245 return action.supportsBulk && (!action.isEligible || action.isEligible(item)); 34246 }); 34247 }, [actions, item]); 34248 } 34249 function useSomeItemHasAPossibleBulkAction(actions, data) { 34250 return (0,external_wp_element_namespaceObject.useMemo)(() => { 34251 return data.some(item => { 34252 return actions.some(action => { 34253 return action.supportsBulk && (!action.isEligible || action.isEligible(item)); 34254 }); 34255 }); 34256 }, [actions, data]); 34257 } 34258 function BulkSelectionCheckbox({ 34259 selection, 34260 onChangeSelection, 34261 data, 34262 actions, 34263 getItemId 34264 }) { 34265 const selectableItems = (0,external_wp_element_namespaceObject.useMemo)(() => { 34266 return data.filter(item => { 34267 return actions.some(action => action.supportsBulk && (!action.isEligible || action.isEligible(item))); 34268 }); 34269 }, [data, actions]); 34270 const selectedItems = data.filter(item => selection.includes(getItemId(item)) && selectableItems.includes(item)); 34271 const areAllSelected = selectedItems.length === selectableItems.length; 34272 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { 34273 className: "dataviews-view-table-selection-checkbox", 34274 __nextHasNoMarginBottom: true, 34275 checked: areAllSelected, 34276 indeterminate: !areAllSelected && !!selectedItems.length, 34277 onChange: () => { 34278 if (areAllSelected) { 34279 onChangeSelection([]); 34280 } else { 34281 onChangeSelection(selectableItems.map(item => getItemId(item))); 34282 } 34283 }, 34284 "aria-label": areAllSelected ? (0,external_wp_i18n_namespaceObject.__)('Deselect all') : (0,external_wp_i18n_namespaceObject.__)('Select all') 34285 }); 34286 } 34287 function ActionTrigger({ 34288 action, 34289 onClick, 34290 isBusy, 34291 items 34292 }) { 34293 const label = typeof action.label === 'string' ? action.label : action.label(items); 34294 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 34295 disabled: isBusy, 34296 accessibleWhenDisabled: true, 34297 label: label, 34298 icon: action.icon, 34299 isDestructive: action.isDestructive, 34300 size: "compact", 34301 onClick: onClick, 34302 isBusy: isBusy, 34303 tooltipPosition: "top" 34304 }); 34305 } 34306 const dataviews_bulk_actions_EMPTY_ARRAY = []; 34307 function ActionButton({ 34308 action, 34309 selectedItems, 34310 actionInProgress, 34311 setActionInProgress 34312 }) { 34313 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 34314 const selectedEligibleItems = (0,external_wp_element_namespaceObject.useMemo)(() => { 34315 return selectedItems.filter(item => { 34316 return !action.isEligible || action.isEligible(item); 34317 }); 34318 }, [action, selectedItems]); 34319 if ('RenderModal' in action) { 34320 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionWithModal, { 34321 action: action, 34322 items: selectedEligibleItems, 34323 ActionTriggerComponent: ActionTrigger 34324 }, action.id); 34325 } 34326 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionTrigger, { 34327 action: action, 34328 onClick: async () => { 34329 setActionInProgress(action.id); 34330 await action.callback(selectedItems, { 34331 registry 34332 }); 34333 setActionInProgress(null); 34334 }, 34335 items: selectedEligibleItems, 34336 isBusy: actionInProgress === action.id 34337 }, action.id); 34338 } 34339 function renderFooterContent(data, actions, getItemId, selection, actionsToShow, selectedItems, actionInProgress, setActionInProgress, onChangeSelection) { 34340 const message = selectedItems.length > 0 ? (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %d: number of items. */ 34341 (0,external_wp_i18n_namespaceObject._n)('%d Item selected', '%d Items selected', selectedItems.length), selectedItems.length) : (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %d: number of items. */ 34342 (0,external_wp_i18n_namespaceObject._n)('%d Item', '%d Items', data.length), data.length); 34343 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 34344 expanded: false, 34345 className: "dataviews-bulk-actions-footer__container", 34346 spacing: 3, 34347 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BulkSelectionCheckbox, { 34348 selection: selection, 34349 onChangeSelection: onChangeSelection, 34350 data: data, 34351 actions: actions, 34352 getItemId: getItemId 34353 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 34354 className: "dataviews-bulk-actions-footer__item-count", 34355 children: message 34356 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 34357 className: "dataviews-bulk-actions-footer__action-buttons", 34358 expanded: false, 34359 spacing: 1, 34360 children: [actionsToShow.map(action => { 34361 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionButton, { 34362 action: action, 34363 selectedItems: selectedItems, 34364 actionInProgress: actionInProgress, 34365 setActionInProgress: setActionInProgress 34366 }, action.id); 34367 }), selectedItems.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 34368 icon: close_small, 34369 showTooltip: true, 34370 tooltipPosition: "top", 34371 size: "compact", 34372 label: (0,external_wp_i18n_namespaceObject.__)('Cancel'), 34373 disabled: !!actionInProgress, 34374 accessibleWhenDisabled: false, 34375 onClick: () => { 34376 onChangeSelection(dataviews_bulk_actions_EMPTY_ARRAY); 34377 } 34378 })] 34379 })] 34380 }); 34381 } 34382 function FooterContent({ 34383 selection, 34384 actions, 34385 onChangeSelection, 34386 data, 34387 getItemId 34388 }) { 34389 const [actionInProgress, setActionInProgress] = (0,external_wp_element_namespaceObject.useState)(null); 34390 const footerContentRef = (0,external_wp_element_namespaceObject.useRef)(null); 34391 const bulkActions = (0,external_wp_element_namespaceObject.useMemo)(() => actions.filter(action => action.supportsBulk), [actions]); 34392 const selectableItems = (0,external_wp_element_namespaceObject.useMemo)(() => { 34393 return data.filter(item => { 34394 return bulkActions.some(action => !action.isEligible || action.isEligible(item)); 34395 }); 34396 }, [data, bulkActions]); 34397 const selectedItems = (0,external_wp_element_namespaceObject.useMemo)(() => { 34398 return data.filter(item => selection.includes(getItemId(item)) && selectableItems.includes(item)); 34399 }, [selection, data, getItemId, selectableItems]); 34400 const actionsToShow = (0,external_wp_element_namespaceObject.useMemo)(() => actions.filter(action => { 34401 return action.supportsBulk && action.icon && selectedItems.some(item => !action.isEligible || action.isEligible(item)); 34402 }), [actions, selectedItems]); 34403 if (!actionInProgress) { 34404 if (footerContentRef.current) { 34405 footerContentRef.current = null; 34406 } 34407 return renderFooterContent(data, actions, getItemId, selection, actionsToShow, selectedItems, actionInProgress, setActionInProgress, onChangeSelection); 34408 } else if (!footerContentRef.current) { 34409 footerContentRef.current = renderFooterContent(data, actions, getItemId, selection, actionsToShow, selectedItems, actionInProgress, setActionInProgress, onChangeSelection); 34410 } 34411 return footerContentRef.current; 34412 } 34413 function BulkActionsFooter() { 34414 const { 34415 data, 34416 selection, 34417 actions = dataviews_bulk_actions_EMPTY_ARRAY, 34418 onChangeSelection, 34419 getItemId 34420 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 34421 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FooterContent, { 34422 selection: selection, 34423 onChangeSelection: onChangeSelection, 34424 data: data, 34425 actions: actions, 34426 getItemId: getItemId 34427 }); 34428 } 34429 34430 ;// ./node_modules/@wordpress/icons/build-module/library/arrow-left.js 34431 /** 34432 * WordPress dependencies 34433 */ 34434 34435 34436 const arrowLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 34437 xmlns: "http://www.w3.org/2000/svg", 34438 viewBox: "0 0 24 24", 34439 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 34440 d: "M20 11.2H6.8l3.7-3.7-1-1L3.9 12l5.6 5.5 1-1-3.7-3.7H20z" 34441 }) 34442 }); 34443 /* harmony default export */ const arrow_left = (arrowLeft); 34444 34445 ;// ./node_modules/@wordpress/icons/build-module/library/arrow-right.js 34446 /** 34447 * WordPress dependencies 34448 */ 34449 34450 34451 const arrowRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 34452 xmlns: "http://www.w3.org/2000/svg", 34453 viewBox: "0 0 24 24", 34454 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 34455 d: "m14.5 6.5-1 1 3.7 3.7H4v1.6h13.2l-3.7 3.7 1 1 5.6-5.5z" 34456 }) 34457 }); 34458 /* harmony default export */ const arrow_right = (arrowRight); 34459 34460 ;// ./node_modules/@wordpress/icons/build-module/library/unseen.js 34461 /** 34462 * WordPress dependencies 34463 */ 34464 34465 34466 const unseen = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 34467 viewBox: "0 0 24 24", 34468 xmlns: "http://www.w3.org/2000/svg", 34469 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 34470 d: "M20.7 12.7s0-.1-.1-.2c0-.2-.2-.4-.4-.6-.3-.5-.9-1.2-1.6-1.8-.7-.6-1.5-1.3-2.6-1.8l-.6 1.4c.9.4 1.6 1 2.1 1.5.6.6 1.1 1.2 1.4 1.6.1.2.3.4.3.5v.1l.7-.3.7-.3Zm-5.2-9.3-1.8 4c-.5-.1-1.1-.2-1.7-.2-3 0-5.2 1.4-6.6 2.7-.7.7-1.2 1.3-1.6 1.8-.2.3-.3.5-.4.6 0 0 0 .1-.1.2s0 0 .7.3l.7.3V13c0-.1.2-.3.3-.5.3-.4.7-1 1.4-1.6 1.2-1.2 3-2.3 5.5-2.3H13v.3c-.4 0-.8-.1-1.1-.1-1.9 0-3.5 1.6-3.5 3.5s.6 2.3 1.6 2.9l-2 4.4.9.4 7.6-16.2-.9-.4Zm-3 12.6c1.7-.2 3-1.7 3-3.5s-.2-1.4-.6-1.9L12.4 16Z" 34471 }) 34472 }); 34473 /* harmony default export */ const library_unseen = (unseen); 34474 34475 ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/table/column-header-menu.js 34476 /** 34477 * External dependencies 34478 */ 34479 34480 /** 34481 * WordPress dependencies 34482 */ 34483 34484 34485 34486 34487 34488 /** 34489 * Internal dependencies 34490 */ 34491 34492 34493 34494 34495 const { 34496 Menu: column_header_menu_Menu 34497 } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 34498 function WithMenuSeparators({ 34499 children 34500 }) { 34501 return external_wp_element_namespaceObject.Children.toArray(children).filter(Boolean).map((child, i) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_element_namespaceObject.Fragment, { 34502 children: [i > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.Separator, {}), child] 34503 }, i)); 34504 } 34505 const _HeaderMenu = (0,external_wp_element_namespaceObject.forwardRef)(function HeaderMenu({ 34506 fieldId, 34507 view, 34508 fields, 34509 onChangeView, 34510 onHide, 34511 setOpenedFilter, 34512 canMove = true 34513 }, ref) { 34514 var _view$fields; 34515 const visibleFieldIds = (_view$fields = view.fields) !== null && _view$fields !== void 0 ? _view$fields : []; 34516 const index = visibleFieldIds?.indexOf(fieldId); 34517 const isSorted = view.sort?.field === fieldId; 34518 let isHidable = false; 34519 let isSortable = false; 34520 let canAddFilter = false; 34521 let operators = []; 34522 const field = fields.find(f => f.id === fieldId); 34523 if (!field) { 34524 // No combined or regular field found. 34525 return null; 34526 } 34527 isHidable = field.enableHiding !== false; 34528 isSortable = field.enableSorting !== false; 34529 const header = field.header; 34530 operators = sanitizeOperators(field); 34531 // Filter can be added: 34532 // 1. If the field is not already part of a view's filters. 34533 // 2. If the field meets the type and operator requirements. 34534 // 3. If it's not primary. If it is, it should be already visible. 34535 canAddFilter = !view.filters?.some(_filter => fieldId === _filter.field) && !!field.elements?.length && !!operators.length && !field.filterBy?.isPrimary; 34536 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(column_header_menu_Menu, { 34537 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(column_header_menu_Menu.TriggerButton, { 34538 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 34539 size: "compact", 34540 className: "dataviews-view-table-header-button", 34541 ref: ref, 34542 variant: "tertiary" 34543 }), 34544 children: [header, view.sort && isSorted && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 34545 "aria-hidden": "true", 34546 children: sortArrows[view.sort.direction] 34547 })] 34548 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.Popover, { 34549 style: { 34550 minWidth: '240px' 34551 }, 34552 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(WithMenuSeparators, { 34553 children: [isSortable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.Group, { 34554 children: SORTING_DIRECTIONS.map(direction => { 34555 const isChecked = view.sort && isSorted && view.sort.direction === direction; 34556 const value = `$fieldId}-$direction}`; 34557 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.RadioItem, { 34558 // All sorting radio items share the same name, so that 34559 // selecting a sorting option automatically deselects the 34560 // previously selected one, even if it is displayed in 34561 // another submenu. The field and direction are passed via 34562 // the `value` prop. 34563 name: "view-table-sorting", 34564 value: value, 34565 checked: isChecked, 34566 onChange: () => { 34567 onChangeView({ 34568 ...view, 34569 sort: { 34570 field: fieldId, 34571 direction 34572 }, 34573 showLevels: false 34574 }); 34575 }, 34576 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.ItemLabel, { 34577 children: sortLabels[direction] 34578 }) 34579 }, value); 34580 }) 34581 }), canAddFilter && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.Group, { 34582 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.Item, { 34583 prefix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 34584 icon: library_funnel 34585 }), 34586 onClick: () => { 34587 setOpenedFilter(fieldId); 34588 onChangeView({ 34589 ...view, 34590 page: 1, 34591 filters: [...(view.filters || []), { 34592 field: fieldId, 34593 value: undefined, 34594 operator: operators[0] 34595 }] 34596 }); 34597 }, 34598 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.ItemLabel, { 34599 children: (0,external_wp_i18n_namespaceObject.__)('Add filter') 34600 }) 34601 }) 34602 }), (canMove || isHidable) && field && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(column_header_menu_Menu.Group, { 34603 children: [canMove && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.Item, { 34604 prefix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 34605 icon: arrow_left 34606 }), 34607 disabled: index < 1, 34608 onClick: () => { 34609 var _visibleFieldIds$slic; 34610 onChangeView({ 34611 ...view, 34612 fields: [...((_visibleFieldIds$slic = visibleFieldIds.slice(0, index - 1)) !== null && _visibleFieldIds$slic !== void 0 ? _visibleFieldIds$slic : []), fieldId, visibleFieldIds[index - 1], ...visibleFieldIds.slice(index + 1)] 34613 }); 34614 }, 34615 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.ItemLabel, { 34616 children: (0,external_wp_i18n_namespaceObject.__)('Move left') 34617 }) 34618 }), canMove && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.Item, { 34619 prefix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 34620 icon: arrow_right 34621 }), 34622 disabled: index >= visibleFieldIds.length - 1, 34623 onClick: () => { 34624 var _visibleFieldIds$slic2; 34625 onChangeView({ 34626 ...view, 34627 fields: [...((_visibleFieldIds$slic2 = visibleFieldIds.slice(0, index)) !== null && _visibleFieldIds$slic2 !== void 0 ? _visibleFieldIds$slic2 : []), visibleFieldIds[index + 1], fieldId, ...visibleFieldIds.slice(index + 2)] 34628 }); 34629 }, 34630 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.ItemLabel, { 34631 children: (0,external_wp_i18n_namespaceObject.__)('Move right') 34632 }) 34633 }), isHidable && field && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.Item, { 34634 prefix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 34635 icon: library_unseen 34636 }), 34637 onClick: () => { 34638 onHide(field); 34639 onChangeView({ 34640 ...view, 34641 fields: visibleFieldIds.filter(id => id !== fieldId) 34642 }); 34643 }, 34644 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.ItemLabel, { 34645 children: (0,external_wp_i18n_namespaceObject.__)('Hide column') 34646 }) 34647 })] 34648 })] 34649 }) 34650 })] 34651 }); 34652 }); 34653 34654 // @ts-expect-error Lift the `Item` type argument through the forwardRef. 34655 const ColumnHeaderMenu = _HeaderMenu; 34656 /* harmony default export */ const column_header_menu = (ColumnHeaderMenu); 34657 34658 ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/utils/get-clickable-item-props.js 34659 function getClickableItemProps({ 34660 item, 34661 isItemClickable, 34662 onClickItem, 34663 className 34664 }) { 34665 if (!isItemClickable(item) || !onClickItem) { 34666 return { 34667 className 34668 }; 34669 } 34670 return { 34671 className: className ? `$className} $className}--clickable` : undefined, 34672 role: 'button', 34673 tabIndex: 0, 34674 onClick: event => { 34675 // Prevents onChangeSelection from triggering. 34676 event.stopPropagation(); 34677 onClickItem(item); 34678 }, 34679 onKeyDown: event => { 34680 if (event.key === 'Enter' || event.key === '' || event.key === ' ') { 34681 // Prevents onChangeSelection from triggering. 34682 event.stopPropagation(); 34683 onClickItem(item); 34684 } 34685 } 34686 }; 34687 } 34688 34689 ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/table/column-primary.js 34690 /** 34691 * WordPress dependencies 34692 */ 34693 34694 34695 /** 34696 * Internal dependencies 34697 */ 34698 34699 34700 34701 function ColumnPrimary({ 34702 item, 34703 level, 34704 titleField, 34705 mediaField, 34706 descriptionField, 34707 onClickItem, 34708 isItemClickable 34709 }) { 34710 const clickableProps = getClickableItemProps({ 34711 item, 34712 isItemClickable, 34713 onClickItem, 34714 className: 'dataviews-view-table__cell-content-wrapper dataviews-title-field' 34715 }); 34716 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 34717 spacing: 3, 34718 justify: "flex-start", 34719 children: [mediaField && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 34720 className: "dataviews-view-table__cell-content-wrapper dataviews-column-primary__media", 34721 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(mediaField.render, { 34722 item: item 34723 }) 34724 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 34725 spacing: 0, 34726 children: [titleField && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 34727 ...clickableProps, 34728 children: [level !== undefined && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { 34729 className: "dataviews-view-table__level", 34730 children: ['—'.repeat(level), "\xA0"] 34731 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(titleField.render, { 34732 item: item 34733 })] 34734 }), descriptionField && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(descriptionField.render, { 34735 item: item 34736 })] 34737 })] 34738 }); 34739 } 34740 /* harmony default export */ const column_primary = (ColumnPrimary); 34741 34742 ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/table/index.js 34743 /** 34744 * External dependencies 34745 */ 34746 34747 34748 /** 34749 * WordPress dependencies 34750 */ 34751 34752 34753 34754 34755 /** 34756 * Internal dependencies 34757 */ 34758 34759 34760 34761 34762 34763 34764 34765 function TableColumnField({ 34766 item, 34767 fields, 34768 column 34769 }) { 34770 const field = fields.find(f => f.id === column); 34771 if (!field) { 34772 return null; 34773 } 34774 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 34775 className: "dataviews-view-table__cell-content-wrapper", 34776 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(field.render, { 34777 item 34778 }) 34779 }); 34780 } 34781 function TableRow({ 34782 hasBulkActions, 34783 item, 34784 level, 34785 actions, 34786 fields, 34787 id, 34788 view, 34789 titleField, 34790 mediaField, 34791 descriptionField, 34792 selection, 34793 getItemId, 34794 isItemClickable, 34795 onClickItem, 34796 onChangeSelection 34797 }) { 34798 var _view$fields; 34799 const hasPossibleBulkAction = useHasAPossibleBulkAction(actions, item); 34800 const isSelected = hasPossibleBulkAction && selection.includes(id); 34801 const [isHovered, setIsHovered] = (0,external_wp_element_namespaceObject.useState)(false); 34802 const { 34803 showTitle = true, 34804 showMedia = true, 34805 showDescription = true 34806 } = view; 34807 const handleMouseEnter = () => { 34808 setIsHovered(true); 34809 }; 34810 const handleMouseLeave = () => { 34811 setIsHovered(false); 34812 }; 34813 34814 // Will be set to true if `onTouchStart` fires. This happens before 34815 // `onClick` and can be used to exclude touchscreen devices from certain 34816 // behaviours. 34817 const isTouchDeviceRef = (0,external_wp_element_namespaceObject.useRef)(false); 34818 const columns = (_view$fields = view.fields) !== null && _view$fields !== void 0 ? _view$fields : []; 34819 const hasPrimaryColumn = titleField && showTitle || mediaField && showMedia || descriptionField && showDescription; 34820 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("tr", { 34821 className: dist_clsx('dataviews-view-table__row', { 34822 'is-selected': hasPossibleBulkAction && isSelected, 34823 'is-hovered': isHovered, 34824 'has-bulk-actions': hasPossibleBulkAction 34825 }), 34826 onMouseEnter: handleMouseEnter, 34827 onMouseLeave: handleMouseLeave, 34828 onTouchStart: () => { 34829 isTouchDeviceRef.current = true; 34830 }, 34831 onClick: () => { 34832 if (!hasPossibleBulkAction) { 34833 return; 34834 } 34835 if (!isTouchDeviceRef.current && document.getSelection()?.type !== 'Range') { 34836 onChangeSelection(selection.includes(id) ? selection.filter(itemId => id !== itemId) : [id]); 34837 } 34838 }, 34839 children: [hasBulkActions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("td", { 34840 className: "dataviews-view-table__checkbox-column", 34841 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 34842 className: "dataviews-view-table__cell-content-wrapper", 34843 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsSelectionCheckbox, { 34844 item: item, 34845 selection: selection, 34846 onChangeSelection: onChangeSelection, 34847 getItemId: getItemId, 34848 titleField: titleField, 34849 disabled: !hasPossibleBulkAction 34850 }) 34851 }) 34852 }), hasPrimaryColumn && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("td", { 34853 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_primary, { 34854 item: item, 34855 level: level, 34856 titleField: showTitle ? titleField : undefined, 34857 mediaField: showMedia ? mediaField : undefined, 34858 descriptionField: showDescription ? descriptionField : undefined, 34859 isItemClickable: isItemClickable, 34860 onClickItem: onClickItem 34861 }) 34862 }), columns.map(column => { 34863 var _view$layout$styles$c; 34864 // Explicit picks the supported styles. 34865 const { 34866 width, 34867 maxWidth, 34868 minWidth 34869 } = (_view$layout$styles$c = view.layout?.styles?.[column]) !== null && _view$layout$styles$c !== void 0 ? _view$layout$styles$c : {}; 34870 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("td", { 34871 style: { 34872 width, 34873 maxWidth, 34874 minWidth 34875 }, 34876 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TableColumnField, { 34877 fields: fields, 34878 item: item, 34879 column: column 34880 }) 34881 }, column); 34882 }), !!actions?.length && 34883 /*#__PURE__*/ 34884 // Disable reason: we are not making the element interactive, 34885 // but preventing any click events from bubbling up to the 34886 // table row. This allows us to add a click handler to the row 34887 // itself (to toggle row selection) without erroneously 34888 // intercepting click events from ItemActions. 34889 /* eslint-disable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */ 34890 (0,external_ReactJSXRuntime_namespaceObject.jsx)("td", { 34891 className: "dataviews-view-table__actions-column", 34892 onClick: e => e.stopPropagation(), 34893 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemActions, { 34894 item: item, 34895 actions: actions 34896 }) 34897 }) 34898 /* eslint-enable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */] 34899 }); 34900 } 34901 function ViewTable({ 34902 actions, 34903 data, 34904 fields, 34905 getItemId, 34906 getItemLevel, 34907 isLoading = false, 34908 onChangeView, 34909 onChangeSelection, 34910 selection, 34911 setOpenedFilter, 34912 onClickItem, 34913 isItemClickable, 34914 view 34915 }) { 34916 var _view$fields2; 34917 const headerMenuRefs = (0,external_wp_element_namespaceObject.useRef)(new Map()); 34918 const headerMenuToFocusRef = (0,external_wp_element_namespaceObject.useRef)(); 34919 const [nextHeaderMenuToFocus, setNextHeaderMenuToFocus] = (0,external_wp_element_namespaceObject.useState)(); 34920 const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data); 34921 (0,external_wp_element_namespaceObject.useEffect)(() => { 34922 if (headerMenuToFocusRef.current) { 34923 headerMenuToFocusRef.current.focus(); 34924 headerMenuToFocusRef.current = undefined; 34925 } 34926 }); 34927 const tableNoticeId = (0,external_wp_element_namespaceObject.useId)(); 34928 if (nextHeaderMenuToFocus) { 34929 // If we need to force focus, we short-circuit rendering here 34930 // to prevent any additional work while we handle that. 34931 // Clearing out the focus directive is necessary to make sure 34932 // future renders don't cause unexpected focus jumps. 34933 headerMenuToFocusRef.current = nextHeaderMenuToFocus; 34934 setNextHeaderMenuToFocus(undefined); 34935 return; 34936 } 34937 const onHide = field => { 34938 const hidden = headerMenuRefs.current.get(field.id); 34939 const fallback = hidden ? headerMenuRefs.current.get(hidden.fallback) : undefined; 34940 setNextHeaderMenuToFocus(fallback?.node); 34941 }; 34942 const hasData = !!data?.length; 34943 const titleField = fields.find(field => field.id === view.titleField); 34944 const mediaField = fields.find(field => field.id === view.mediaField); 34945 const descriptionField = fields.find(field => field.id === view.descriptionField); 34946 const { 34947 showTitle = true, 34948 showMedia = true, 34949 showDescription = true 34950 } = view; 34951 const hasPrimaryColumn = titleField && showTitle || mediaField && showMedia || descriptionField && showDescription; 34952 const columns = (_view$fields2 = view.fields) !== null && _view$fields2 !== void 0 ? _view$fields2 : []; 34953 const headerMenuRef = (column, index) => node => { 34954 if (node) { 34955 headerMenuRefs.current.set(column, { 34956 node, 34957 fallback: columns[index > 0 ? index - 1 : 1] 34958 }); 34959 } else { 34960 headerMenuRefs.current.delete(column); 34961 } 34962 }; 34963 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 34964 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("table", { 34965 className: dist_clsx('dataviews-view-table', { 34966 [`has-$view.layout?.density}-density`]: view.layout?.density && ['compact', 'comfortable'].includes(view.layout.density) 34967 }), 34968 "aria-busy": isLoading, 34969 "aria-describedby": tableNoticeId, 34970 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("thead", { 34971 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("tr", { 34972 className: "dataviews-view-table__row", 34973 children: [hasBulkActions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("th", { 34974 className: "dataviews-view-table__checkbox-column", 34975 scope: "col", 34976 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BulkSelectionCheckbox, { 34977 selection: selection, 34978 onChangeSelection: onChangeSelection, 34979 data: data, 34980 actions: actions, 34981 getItemId: getItemId 34982 }) 34983 }), hasPrimaryColumn && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("th", { 34984 scope: "col", 34985 children: titleField && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu, { 34986 ref: headerMenuRef(titleField.id, 0), 34987 fieldId: titleField.id, 34988 view: view, 34989 fields: fields, 34990 onChangeView: onChangeView, 34991 onHide: onHide, 34992 setOpenedFilter: setOpenedFilter, 34993 canMove: false 34994 }) 34995 }), columns.map((column, index) => { 34996 var _view$layout$styles$c2; 34997 // Explicit picks the supported styles. 34998 const { 34999 width, 35000 maxWidth, 35001 minWidth 35002 } = (_view$layout$styles$c2 = view.layout?.styles?.[column]) !== null && _view$layout$styles$c2 !== void 0 ? _view$layout$styles$c2 : {}; 35003 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("th", { 35004 style: { 35005 width, 35006 maxWidth, 35007 minWidth 35008 }, 35009 "aria-sort": view.sort?.direction && view.sort?.field === column ? sortValues[view.sort.direction] : undefined, 35010 scope: "col", 35011 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu, { 35012 ref: headerMenuRef(column, index), 35013 fieldId: column, 35014 view: view, 35015 fields: fields, 35016 onChangeView: onChangeView, 35017 onHide: onHide, 35018 setOpenedFilter: setOpenedFilter 35019 }) 35020 }, column); 35021 }), !!actions?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("th", { 35022 className: "dataviews-view-table__actions-column", 35023 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 35024 className: "dataviews-view-table-header", 35025 children: (0,external_wp_i18n_namespaceObject.__)('Actions') 35026 }) 35027 })] 35028 }) 35029 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("tbody", { 35030 children: hasData && data.map((item, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TableRow, { 35031 item: item, 35032 level: view.showLevels && typeof getItemLevel === 'function' ? getItemLevel(item) : undefined, 35033 hasBulkActions: hasBulkActions, 35034 actions: actions, 35035 fields: fields, 35036 id: getItemId(item) || index.toString(), 35037 view: view, 35038 titleField: titleField, 35039 mediaField: mediaField, 35040 descriptionField: descriptionField, 35041 selection: selection, 35042 getItemId: getItemId, 35043 onChangeSelection: onChangeSelection, 35044 onClickItem: onClickItem, 35045 isItemClickable: isItemClickable 35046 }, getItemId(item))) 35047 })] 35048 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 35049 className: dist_clsx({ 35050 'dataviews-loading': isLoading, 35051 'dataviews-no-results': !hasData && !isLoading 35052 }), 35053 id: tableNoticeId, 35054 children: !hasData && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 35055 children: isLoading ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) : (0,external_wp_i18n_namespaceObject.__)('No results') 35056 }) 35057 })] 35058 }); 35059 } 35060 /* harmony default export */ const table = (ViewTable); 35061 35062 ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/grid/preview-size-picker.js 35063 /** 35064 * WordPress dependencies 35065 */ 35066 35067 35068 35069 35070 /** 35071 * Internal dependencies 35072 */ 35073 35074 35075 const viewportBreaks = { 35076 xhuge: { 35077 min: 3, 35078 max: 6, 35079 default: 5 35080 }, 35081 huge: { 35082 min: 2, 35083 max: 4, 35084 default: 4 35085 }, 35086 xlarge: { 35087 min: 2, 35088 max: 3, 35089 default: 3 35090 }, 35091 large: { 35092 min: 1, 35093 max: 2, 35094 default: 2 35095 }, 35096 mobile: { 35097 min: 1, 35098 max: 2, 35099 default: 2 35100 } 35101 }; 35102 35103 /** 35104 * Breakpoints were adjusted from media queries breakpoints to account for 35105 * the sidebar width. This was done to match the existing styles we had. 35106 */ 35107 const BREAKPOINTS = { 35108 xhuge: 1520, 35109 huge: 1140, 35110 xlarge: 780, 35111 large: 480, 35112 mobile: 0 35113 }; 35114 function useViewPortBreakpoint() { 35115 const containerWidth = (0,external_wp_element_namespaceObject.useContext)(dataviews_context).containerWidth; 35116 for (const [key, value] of Object.entries(BREAKPOINTS)) { 35117 if (containerWidth >= value) { 35118 return key; 35119 } 35120 } 35121 return 'mobile'; 35122 } 35123 function useUpdatedPreviewSizeOnViewportChange() { 35124 const view = (0,external_wp_element_namespaceObject.useContext)(dataviews_context).view; 35125 const viewport = useViewPortBreakpoint(); 35126 return (0,external_wp_element_namespaceObject.useMemo)(() => { 35127 const previewSize = view.layout?.previewSize; 35128 let newPreviewSize; 35129 if (!previewSize) { 35130 return; 35131 } 35132 const breakValues = viewportBreaks[viewport]; 35133 if (previewSize < breakValues.min) { 35134 newPreviewSize = breakValues.min; 35135 } 35136 if (previewSize > breakValues.max) { 35137 newPreviewSize = breakValues.max; 35138 } 35139 return newPreviewSize; 35140 }, [viewport, view]); 35141 } 35142 function PreviewSizePicker() { 35143 const viewport = useViewPortBreakpoint(); 35144 const context = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 35145 const view = context.view; 35146 const breakValues = viewportBreaks[viewport]; 35147 const previewSizeToUse = view.layout?.previewSize || breakValues.default; 35148 const marks = (0,external_wp_element_namespaceObject.useMemo)(() => Array.from({ 35149 length: breakValues.max - breakValues.min + 1 35150 }, (_, i) => { 35151 return { 35152 value: breakValues.min + i 35153 }; 35154 }), [breakValues]); 35155 if (viewport === 'mobile') { 35156 return null; 35157 } 35158 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RangeControl, { 35159 __nextHasNoMarginBottom: true, 35160 __next40pxDefaultSize: true, 35161 showTooltip: false, 35162 label: (0,external_wp_i18n_namespaceObject.__)('Preview size'), 35163 value: breakValues.max + breakValues.min - previewSizeToUse, 35164 marks: marks, 35165 min: breakValues.min, 35166 max: breakValues.max, 35167 withInputField: false, 35168 onChange: (value = 0) => { 35169 context.onChangeView({ 35170 ...view, 35171 layout: { 35172 ...view.layout, 35173 previewSize: breakValues.max + breakValues.min - value 35174 } 35175 }); 35176 }, 35177 step: 1 35178 }); 35179 } 35180 35181 ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/grid/index.js 35182 /** 35183 * External dependencies 35184 */ 35185 35186 35187 /** 35188 * WordPress dependencies 35189 */ 35190 35191 35192 35193 35194 /** 35195 * Internal dependencies 35196 */ 35197 35198 35199 35200 35201 35202 35203 35204 const { 35205 Badge 35206 } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 35207 function GridItem({ 35208 view, 35209 selection, 35210 onChangeSelection, 35211 onClickItem, 35212 isItemClickable, 35213 getItemId, 35214 item, 35215 actions, 35216 mediaField, 35217 titleField, 35218 descriptionField, 35219 regularFields, 35220 badgeFields, 35221 hasBulkActions 35222 }) { 35223 const { 35224 showTitle = true, 35225 showMedia = true, 35226 showDescription = true 35227 } = view; 35228 const hasBulkAction = useHasAPossibleBulkAction(actions, item); 35229 const id = getItemId(item); 35230 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(GridItem); 35231 const isSelected = selection.includes(id); 35232 const renderedMediaField = mediaField?.render ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(mediaField.render, { 35233 item: item 35234 }) : null; 35235 const renderedTitleField = showTitle && titleField?.render ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(titleField.render, { 35236 item: item 35237 }) : null; 35238 const clickableMediaItemProps = getClickableItemProps({ 35239 item, 35240 isItemClickable, 35241 onClickItem, 35242 className: 'dataviews-view-grid__media' 35243 }); 35244 const clickableTitleItemProps = getClickableItemProps({ 35245 item, 35246 isItemClickable, 35247 onClickItem, 35248 className: 'dataviews-view-grid__title-field dataviews-title-field' 35249 }); 35250 let mediaA11yProps; 35251 let titleA11yProps; 35252 if (isItemClickable(item) && onClickItem) { 35253 if (renderedTitleField) { 35254 mediaA11yProps = { 35255 'aria-labelledby': `dataviews-view-grid__title-field-$instanceId}` 35256 }; 35257 titleA11yProps = { 35258 id: `dataviews-view-grid__title-field-$instanceId}` 35259 }; 35260 } else { 35261 mediaA11yProps = { 35262 'aria-label': (0,external_wp_i18n_namespaceObject.__)('Navigate to item') 35263 }; 35264 } 35265 } 35266 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 35267 spacing: 0, 35268 className: dist_clsx('dataviews-view-grid__card', { 35269 'is-selected': hasBulkAction && isSelected 35270 }), 35271 onClickCapture: event => { 35272 if (event.ctrlKey || event.metaKey) { 35273 event.stopPropagation(); 35274 event.preventDefault(); 35275 if (!hasBulkAction) { 35276 return; 35277 } 35278 onChangeSelection(selection.includes(id) ? selection.filter(itemId => id !== itemId) : [...selection, id]); 35279 } 35280 }, 35281 children: [showMedia && renderedMediaField && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 35282 ...clickableMediaItemProps, 35283 ...mediaA11yProps, 35284 children: renderedMediaField 35285 }), hasBulkActions && showMedia && renderedMediaField && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsSelectionCheckbox, { 35286 item: item, 35287 selection: selection, 35288 onChangeSelection: onChangeSelection, 35289 getItemId: getItemId, 35290 titleField: titleField, 35291 disabled: !hasBulkAction 35292 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 35293 justify: "space-between", 35294 className: "dataviews-view-grid__title-actions", 35295 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 35296 ...clickableTitleItemProps, 35297 ...titleA11yProps, 35298 children: renderedTitleField 35299 }), !!actions?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemActions, { 35300 item: item, 35301 actions: actions, 35302 isCompact: true 35303 })] 35304 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 35305 spacing: 1, 35306 children: [showDescription && descriptionField?.render && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(descriptionField.render, { 35307 item: item 35308 }), !!badgeFields?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 35309 className: "dataviews-view-grid__badge-fields", 35310 spacing: 2, 35311 wrap: true, 35312 alignment: "top", 35313 justify: "flex-start", 35314 children: badgeFields.map(field => { 35315 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Badge, { 35316 className: "dataviews-view-grid__field-value", 35317 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(field.render, { 35318 item: item 35319 }) 35320 }, field.id); 35321 }) 35322 }), !!regularFields?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 35323 className: "dataviews-view-grid__fields", 35324 spacing: 1, 35325 children: regularFields.map(field => { 35326 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { 35327 className: "dataviews-view-grid__field", 35328 gap: 1, 35329 justify: "flex-start", 35330 expanded: true, 35331 style: { 35332 height: 'auto' 35333 }, 35334 direction: "row", 35335 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 35336 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 35337 className: "dataviews-view-grid__field-name", 35338 children: field.header 35339 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 35340 className: "dataviews-view-grid__field-value", 35341 style: { 35342 maxHeight: 'none' 35343 }, 35344 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(field.render, { 35345 item: item 35346 }) 35347 })] 35348 }) 35349 }, field.id); 35350 }) 35351 })] 35352 })] 35353 }, id); 35354 } 35355 function ViewGrid({ 35356 actions, 35357 data, 35358 fields, 35359 getItemId, 35360 isLoading, 35361 onChangeSelection, 35362 onClickItem, 35363 isItemClickable, 35364 selection, 35365 view 35366 }) { 35367 var _view$fields; 35368 const titleField = fields.find(field => field.id === view?.titleField); 35369 const mediaField = fields.find(field => field.id === view?.mediaField); 35370 const descriptionField = fields.find(field => field.id === view?.descriptionField); 35371 const otherFields = (_view$fields = view.fields) !== null && _view$fields !== void 0 ? _view$fields : []; 35372 const { 35373 regularFields, 35374 badgeFields 35375 } = otherFields.reduce((accumulator, fieldId) => { 35376 const field = fields.find(f => f.id === fieldId); 35377 if (!field) { 35378 return accumulator; 35379 } 35380 // If the field is a badge field, add it to the badgeFields array 35381 // otherwise add it to the rest visibleFields array. 35382 const key = view.layout?.badgeFields?.includes(fieldId) ? 'badgeFields' : 'regularFields'; 35383 accumulator[key].push(field); 35384 return accumulator; 35385 }, { 35386 regularFields: [], 35387 badgeFields: [] 35388 }); 35389 const hasData = !!data?.length; 35390 const updatedPreviewSize = useUpdatedPreviewSizeOnViewportChange(); 35391 const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data); 35392 const usedPreviewSize = updatedPreviewSize || view.layout?.previewSize; 35393 const gridStyle = usedPreviewSize ? { 35394 gridTemplateColumns: `repeat($usedPreviewSize}, minmax(0, 1fr))` 35395 } : {}; 35396 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 35397 children: [hasData && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, { 35398 gap: 8, 35399 columns: 2, 35400 alignment: "top", 35401 className: "dataviews-view-grid", 35402 style: gridStyle, 35403 "aria-busy": isLoading, 35404 children: data.map(item => { 35405 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GridItem, { 35406 view: view, 35407 selection: selection, 35408 onChangeSelection: onChangeSelection, 35409 onClickItem: onClickItem, 35410 isItemClickable: isItemClickable, 35411 getItemId: getItemId, 35412 item: item, 35413 actions: actions, 35414 mediaField: mediaField, 35415 titleField: titleField, 35416 descriptionField: descriptionField, 35417 regularFields: regularFields, 35418 badgeFields: badgeFields, 35419 hasBulkActions: hasBulkActions 35420 }, getItemId(item)); 35421 }) 35422 }), !hasData && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 35423 className: dist_clsx({ 35424 'dataviews-loading': isLoading, 35425 'dataviews-no-results': !isLoading 35426 }), 35427 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 35428 children: isLoading ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) : (0,external_wp_i18n_namespaceObject.__)('No results') 35429 }) 35430 })] 35431 }); 35432 } 35433 35434 ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/list/index.js 35435 /** 35436 * External dependencies 35437 */ 35438 35439 35440 /** 35441 * WordPress dependencies 35442 */ 35443 35444 35445 35446 35447 35448 35449 35450 /** 35451 * Internal dependencies 35452 */ 35453 35454 35455 35456 const { 35457 Menu: list_Menu 35458 } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 35459 function generateItemWrapperCompositeId(idPrefix) { 35460 return `$idPrefix}-item-wrapper`; 35461 } 35462 function generatePrimaryActionCompositeId(idPrefix, primaryActionId) { 35463 return `$idPrefix}-primary-action-$primaryActionId}`; 35464 } 35465 function generateDropdownTriggerCompositeId(idPrefix) { 35466 return `$idPrefix}-dropdown`; 35467 } 35468 function PrimaryActionGridCell({ 35469 idPrefix, 35470 primaryAction, 35471 item 35472 }) { 35473 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 35474 const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); 35475 const compositeItemId = generatePrimaryActionCompositeId(idPrefix, primaryAction.id); 35476 const label = typeof primaryAction.label === 'string' ? primaryAction.label : primaryAction.label([item]); 35477 return 'RenderModal' in primaryAction ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 35478 role: "gridcell", 35479 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Item, { 35480 id: compositeItemId, 35481 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 35482 label: label, 35483 disabled: !!primaryAction.disabled, 35484 accessibleWhenDisabled: true, 35485 icon: primaryAction.icon, 35486 isDestructive: primaryAction.isDestructive, 35487 size: "small", 35488 onClick: () => setIsModalOpen(true) 35489 }), 35490 children: isModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionModal, { 35491 action: primaryAction, 35492 items: [item], 35493 closeModal: () => setIsModalOpen(false) 35494 }) 35495 }) 35496 }, primaryAction.id) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 35497 role: "gridcell", 35498 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Item, { 35499 id: compositeItemId, 35500 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 35501 label: label, 35502 disabled: !!primaryAction.disabled, 35503 accessibleWhenDisabled: true, 35504 icon: primaryAction.icon, 35505 isDestructive: primaryAction.isDestructive, 35506 size: "small", 35507 onClick: () => { 35508 primaryAction.callback([item], { 35509 registry 35510 }); 35511 } 35512 }) 35513 }) 35514 }, primaryAction.id); 35515 } 35516 function ListItem({ 35517 view, 35518 actions, 35519 idPrefix, 35520 isSelected, 35521 item, 35522 titleField, 35523 mediaField, 35524 descriptionField, 35525 onSelect, 35526 otherFields, 35527 onDropdownTriggerKeyDown 35528 }) { 35529 const { 35530 showTitle = true, 35531 showMedia = true, 35532 showDescription = true 35533 } = view; 35534 const itemRef = (0,external_wp_element_namespaceObject.useRef)(null); 35535 const labelId = `$idPrefix}-label`; 35536 const descriptionId = `$idPrefix}-description`; 35537 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 35538 const [isHovered, setIsHovered] = (0,external_wp_element_namespaceObject.useState)(false); 35539 const [activeModalAction, setActiveModalAction] = (0,external_wp_element_namespaceObject.useState)(null); 35540 const handleHover = ({ 35541 type 35542 }) => { 35543 const isHover = type === 'mouseenter'; 35544 setIsHovered(isHover); 35545 }; 35546 (0,external_wp_element_namespaceObject.useEffect)(() => { 35547 if (isSelected) { 35548 itemRef.current?.scrollIntoView({ 35549 behavior: 'auto', 35550 block: 'nearest', 35551 inline: 'nearest' 35552 }); 35553 } 35554 }, [isSelected]); 35555 const { 35556 primaryAction, 35557 eligibleActions 35558 } = (0,external_wp_element_namespaceObject.useMemo)(() => { 35559 // If an action is eligible for all items, doesn't need 35560 // to provide the `isEligible` function. 35561 const _eligibleActions = actions.filter(action => !action.isEligible || action.isEligible(item)); 35562 const _primaryActions = _eligibleActions.filter(action => action.isPrimary && !!action.icon); 35563 return { 35564 primaryAction: _primaryActions[0], 35565 eligibleActions: _eligibleActions 35566 }; 35567 }, [actions, item]); 35568 const hasOnlyOnePrimaryAction = primaryAction && actions.length === 1; 35569 const renderedMediaField = showMedia && mediaField?.render ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 35570 className: "dataviews-view-list__media-wrapper", 35571 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(mediaField.render, { 35572 item: item 35573 }) 35574 }) : null; 35575 const renderedTitleField = showTitle && titleField?.render ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(titleField.render, { 35576 item: item 35577 }) : null; 35578 const usedActions = eligibleActions?.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 35579 spacing: 3, 35580 className: "dataviews-view-list__item-actions", 35581 children: [primaryAction && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrimaryActionGridCell, { 35582 idPrefix: idPrefix, 35583 primaryAction: primaryAction, 35584 item: item 35585 }), !hasOnlyOnePrimaryAction && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 35586 role: "gridcell", 35587 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(list_Menu, { 35588 placement: "bottom-end", 35589 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(list_Menu.TriggerButton, { 35590 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Item, { 35591 id: generateDropdownTriggerCompositeId(idPrefix), 35592 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 35593 size: "small", 35594 icon: more_vertical, 35595 label: (0,external_wp_i18n_namespaceObject.__)('Actions'), 35596 accessibleWhenDisabled: true, 35597 disabled: !actions.length, 35598 onKeyDown: onDropdownTriggerKeyDown 35599 }) 35600 }) 35601 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(list_Menu.Popover, { 35602 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionsMenuGroup, { 35603 actions: eligibleActions, 35604 item: item, 35605 registry: registry, 35606 setActiveModalAction: setActiveModalAction 35607 }) 35608 })] 35609 }), !!activeModalAction && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionModal, { 35610 action: activeModalAction, 35611 items: [item], 35612 closeModal: () => setActiveModalAction(null) 35613 })] 35614 })] 35615 }); 35616 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Row, { 35617 ref: itemRef, 35618 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {}), 35619 role: "row", 35620 className: dist_clsx({ 35621 'is-selected': isSelected, 35622 'is-hovered': isHovered 35623 }), 35624 onMouseEnter: handleHover, 35625 onMouseLeave: handleHover, 35626 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 35627 className: "dataviews-view-list__item-wrapper", 35628 spacing: 0, 35629 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 35630 role: "gridcell", 35631 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Item, { 35632 id: generateItemWrapperCompositeId(idPrefix), 35633 "aria-pressed": isSelected, 35634 "aria-labelledby": labelId, 35635 "aria-describedby": descriptionId, 35636 className: "dataviews-view-list__item", 35637 onClick: () => onSelect(item) 35638 }) 35639 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 35640 spacing: 3, 35641 justify: "start", 35642 alignment: "flex-start", 35643 children: [renderedMediaField, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 35644 spacing: 1, 35645 className: "dataviews-view-list__field-wrapper", 35646 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 35647 spacing: 0, 35648 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 35649 className: "dataviews-title-field", 35650 id: labelId, 35651 children: renderedTitleField 35652 }), usedActions] 35653 }), showDescription && descriptionField?.render && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 35654 className: "dataviews-view-list__field", 35655 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(descriptionField.render, { 35656 item: item 35657 }) 35658 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 35659 className: "dataviews-view-list__fields", 35660 id: descriptionId, 35661 children: otherFields.map(field => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 35662 className: "dataviews-view-list__field", 35663 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { 35664 as: "span", 35665 className: "dataviews-view-list__field-label", 35666 children: field.label 35667 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 35668 className: "dataviews-view-list__field-value", 35669 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(field.render, { 35670 item: item 35671 }) 35672 })] 35673 }, field.id)) 35674 })] 35675 })] 35676 })] 35677 }) 35678 }); 35679 } 35680 function isDefined(item) { 35681 return !!item; 35682 } 35683 function ViewList(props) { 35684 var _view$fields; 35685 const { 35686 actions, 35687 data, 35688 fields, 35689 getItemId, 35690 isLoading, 35691 onChangeSelection, 35692 selection, 35693 view 35694 } = props; 35695 const baseId = (0,external_wp_compose_namespaceObject.useInstanceId)(ViewList, 'view-list'); 35696 const selectedItem = data?.findLast(item => selection.includes(getItemId(item))); 35697 const titleField = fields.find(field => field.id === view.titleField); 35698 const mediaField = fields.find(field => field.id === view.mediaField); 35699 const descriptionField = fields.find(field => field.id === view.descriptionField); 35700 const otherFields = ((_view$fields = view?.fields) !== null && _view$fields !== void 0 ? _view$fields : []).map(fieldId => fields.find(f => fieldId === f.id)).filter(isDefined); 35701 const onSelect = item => onChangeSelection([getItemId(item)]); 35702 const generateCompositeItemIdPrefix = (0,external_wp_element_namespaceObject.useCallback)(item => `$baseId}-$getItemId(item)}`, [baseId, getItemId]); 35703 const isActiveCompositeItem = (0,external_wp_element_namespaceObject.useCallback)((item, idToCheck) => { 35704 // All composite items use the same prefix in their IDs. 35705 return idToCheck.startsWith(generateCompositeItemIdPrefix(item)); 35706 }, [generateCompositeItemIdPrefix]); 35707 35708 // Controlled state for the active composite item. 35709 const [activeCompositeId, setActiveCompositeId] = (0,external_wp_element_namespaceObject.useState)(undefined); 35710 35711 // Update the active composite item when the selected item changes. 35712 (0,external_wp_element_namespaceObject.useEffect)(() => { 35713 if (selectedItem) { 35714 setActiveCompositeId(generateItemWrapperCompositeId(generateCompositeItemIdPrefix(selectedItem))); 35715 } 35716 }, [selectedItem, generateCompositeItemIdPrefix]); 35717 const activeItemIndex = data.findIndex(item => isActiveCompositeItem(item, activeCompositeId !== null && activeCompositeId !== void 0 ? activeCompositeId : '')); 35718 const previousActiveItemIndex = (0,external_wp_compose_namespaceObject.usePrevious)(activeItemIndex); 35719 const isActiveIdInList = activeItemIndex !== -1; 35720 const selectCompositeItem = (0,external_wp_element_namespaceObject.useCallback)((targetIndex, generateCompositeId) => { 35721 // Clamping between 0 and data.length - 1 to avoid out of bounds. 35722 const clampedIndex = Math.min(data.length - 1, Math.max(0, targetIndex)); 35723 if (!data[clampedIndex]) { 35724 return; 35725 } 35726 const itemIdPrefix = generateCompositeItemIdPrefix(data[clampedIndex]); 35727 const targetCompositeItemId = generateCompositeId(itemIdPrefix); 35728 setActiveCompositeId(targetCompositeItemId); 35729 document.getElementById(targetCompositeItemId)?.focus(); 35730 }, [data, generateCompositeItemIdPrefix]); 35731 35732 // Select a new active composite item when the current active item 35733 // is removed from the list. 35734 (0,external_wp_element_namespaceObject.useEffect)(() => { 35735 const wasActiveIdInList = previousActiveItemIndex !== undefined && previousActiveItemIndex !== -1; 35736 if (!isActiveIdInList && wasActiveIdInList) { 35737 // By picking `previousActiveItemIndex` as the next item index, we are 35738 // basically picking the item that would have been after the deleted one. 35739 // If the previously active (and removed) item was the last of the list, 35740 // we will select the item before it — which is the new last item. 35741 selectCompositeItem(previousActiveItemIndex, generateItemWrapperCompositeId); 35742 } 35743 }, [isActiveIdInList, selectCompositeItem, previousActiveItemIndex]); 35744 35745 // Prevent the default behavior (open dropdown menu) and instead select the 35746 // dropdown menu trigger on the previous/next row. 35747 // https://github.com/ariakit/ariakit/issues/3768 35748 const onDropdownTriggerKeyDown = (0,external_wp_element_namespaceObject.useCallback)(event => { 35749 if (event.key === 'ArrowDown') { 35750 // Select the dropdown menu trigger item in the next row. 35751 event.preventDefault(); 35752 selectCompositeItem(activeItemIndex + 1, generateDropdownTriggerCompositeId); 35753 } 35754 if (event.key === 'ArrowUp') { 35755 // Select the dropdown menu trigger item in the previous row. 35756 event.preventDefault(); 35757 selectCompositeItem(activeItemIndex - 1, generateDropdownTriggerCompositeId); 35758 } 35759 }, [selectCompositeItem, activeItemIndex]); 35760 const hasData = data?.length; 35761 if (!hasData) { 35762 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 35763 className: dist_clsx({ 35764 'dataviews-loading': isLoading, 35765 'dataviews-no-results': !hasData && !isLoading 35766 }), 35767 children: !hasData && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 35768 children: isLoading ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) : (0,external_wp_i18n_namespaceObject.__)('No results') 35769 }) 35770 }); 35771 } 35772 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite, { 35773 id: baseId, 35774 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {}), 35775 className: "dataviews-view-list", 35776 role: "grid", 35777 activeId: activeCompositeId, 35778 setActiveId: setActiveCompositeId, 35779 children: data.map(item => { 35780 const id = generateCompositeItemIdPrefix(item); 35781 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ListItem, { 35782 view: view, 35783 idPrefix: id, 35784 actions: actions, 35785 item: item, 35786 isSelected: item === selectedItem, 35787 onSelect: onSelect, 35788 mediaField: mediaField, 35789 titleField: titleField, 35790 descriptionField: descriptionField, 35791 otherFields: otherFields, 35792 onDropdownTriggerKeyDown: onDropdownTriggerKeyDown 35793 }, id); 35794 }) 35795 }); 35796 } 35797 35798 ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/table/density-picker.js 35799 /** 35800 * WordPress dependencies 35801 */ 35802 35803 35804 35805 35806 /** 35807 * Internal dependencies 35808 */ 35809 35810 35811 function DensityPicker() { 35812 const context = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 35813 const view = context.view; 35814 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { 35815 __nextHasNoMarginBottom: true, 35816 size: "__unstable-large", 35817 label: (0,external_wp_i18n_namespaceObject.__)('Density'), 35818 value: view.layout?.density || 'balanced', 35819 onChange: value => { 35820 context.onChangeView({ 35821 ...view, 35822 layout: { 35823 ...view.layout, 35824 density: value 35825 } 35826 }); 35827 }, 35828 isBlock: true, 35829 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { 35830 value: "comfortable", 35831 label: (0,external_wp_i18n_namespaceObject._x)('Comfortable', 'Density option for DataView layout') 35832 }, "comfortable"), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { 35833 value: "balanced", 35834 label: (0,external_wp_i18n_namespaceObject._x)('Balanced', 'Density option for DataView layout') 35835 }, "balanced"), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { 35836 value: "compact", 35837 label: (0,external_wp_i18n_namespaceObject._x)('Compact', 'Density option for DataView layout') 35838 }, "compact")] 35839 }); 35840 } 35841 35842 ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/index.js 35843 /** 35844 * WordPress dependencies 35845 */ 35846 35847 35848 35849 /** 35850 * Internal dependencies 35851 */ 35852 35853 35854 35855 35856 35857 35858 const VIEW_LAYOUTS = [{ 35859 type: constants_LAYOUT_TABLE, 35860 label: (0,external_wp_i18n_namespaceObject.__)('Table'), 35861 component: table, 35862 icon: block_table, 35863 viewConfigOptions: DensityPicker 35864 }, { 35865 type: constants_LAYOUT_GRID, 35866 label: (0,external_wp_i18n_namespaceObject.__)('Grid'), 35867 component: ViewGrid, 35868 icon: library_category, 35869 viewConfigOptions: PreviewSizePicker 35870 }, { 35871 type: constants_LAYOUT_LIST, 35872 label: (0,external_wp_i18n_namespaceObject.__)('List'), 35873 component: ViewList, 35874 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? format_list_bullets_rtl : format_list_bullets 35875 }]; 35876 35877 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-layout/index.js 35878 /** 35879 * External dependencies 35880 */ 35881 35882 /** 35883 * WordPress dependencies 35884 */ 35885 35886 35887 /** 35888 * Internal dependencies 35889 */ 35890 35891 35892 35893 function DataViewsLayout() { 35894 const { 35895 actions = [], 35896 data, 35897 fields, 35898 getItemId, 35899 getItemLevel, 35900 isLoading, 35901 view, 35902 onChangeView, 35903 selection, 35904 onChangeSelection, 35905 setOpenedFilter, 35906 onClickItem, 35907 isItemClickable 35908 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 35909 const ViewComponent = VIEW_LAYOUTS.find(v => v.type === view.type)?.component; 35910 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ViewComponent, { 35911 actions: actions, 35912 data: data, 35913 fields: fields, 35914 getItemId: getItemId, 35915 getItemLevel: getItemLevel, 35916 isLoading: isLoading, 35917 onChangeView: onChangeView, 35918 onChangeSelection: onChangeSelection, 35919 selection: selection, 35920 setOpenedFilter: setOpenedFilter, 35921 onClickItem: onClickItem, 35922 isItemClickable: isItemClickable, 35923 view: view 35924 }); 35925 } 35926 35927 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-pagination/index.js 35928 /** 35929 * WordPress dependencies 35930 */ 35931 35932 35933 35934 35935 35936 /** 35937 * Internal dependencies 35938 */ 35939 35940 35941 function DataViewsPagination() { 35942 var _view$page; 35943 const { 35944 view, 35945 onChangeView, 35946 paginationInfo: { 35947 totalItems = 0, 35948 totalPages 35949 } 35950 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 35951 if (!totalItems || !totalPages) { 35952 return null; 35953 } 35954 const currentPage = (_view$page = view.page) !== null && _view$page !== void 0 ? _view$page : 1; 35955 const pageSelectOptions = Array.from(Array(totalPages)).map((_, i) => { 35956 const page = i + 1; 35957 return { 35958 value: page.toString(), 35959 label: page.toString(), 35960 'aria-label': currentPage === page ? (0,external_wp_i18n_namespaceObject.sprintf)( 35961 // translators: Current page number in total number of pages 35962 (0,external_wp_i18n_namespaceObject.__)('Page %1$s of %2$s'), currentPage, totalPages) : page.toString() 35963 }; 35964 }); 35965 return !!totalItems && totalPages !== 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 35966 expanded: false, 35967 className: "dataviews-pagination", 35968 justify: "end", 35969 spacing: 6, 35970 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 35971 justify: "flex-start", 35972 expanded: false, 35973 spacing: 1, 35974 className: "dataviews-pagination__page-select", 35975 children: (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( 35976 // translators: 1: Current page number, 2: Total number of pages. 35977 (0,external_wp_i18n_namespaceObject._x)('<div>Page</div>%1$s<div>of %2$s</div>', 'paging'), '<CurrentPage />', totalPages), { 35978 div: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 35979 "aria-hidden": true 35980 }), 35981 CurrentPage: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { 35982 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Current page'), 35983 value: currentPage.toString(), 35984 options: pageSelectOptions, 35985 onChange: newValue => { 35986 onChangeView({ 35987 ...view, 35988 page: +newValue 35989 }); 35990 }, 35991 size: "small", 35992 __nextHasNoMarginBottom: true, 35993 variant: "minimal" 35994 }) 35995 }) 35996 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 35997 expanded: false, 35998 spacing: 1, 35999 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 36000 onClick: () => onChangeView({ 36001 ...view, 36002 page: currentPage - 1 36003 }), 36004 disabled: currentPage === 1, 36005 accessibleWhenDisabled: true, 36006 label: (0,external_wp_i18n_namespaceObject.__)('Previous page'), 36007 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? library_next : library_previous, 36008 showTooltip: true, 36009 size: "compact", 36010 tooltipPosition: "top" 36011 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 36012 onClick: () => onChangeView({ 36013 ...view, 36014 page: currentPage + 1 36015 }), 36016 disabled: currentPage >= totalPages, 36017 accessibleWhenDisabled: true, 36018 label: (0,external_wp_i18n_namespaceObject.__)('Next page'), 36019 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? library_previous : library_next, 36020 showTooltip: true, 36021 size: "compact", 36022 tooltipPosition: "top" 36023 })] 36024 })] 36025 }); 36026 } 36027 /* harmony default export */ const dataviews_pagination = ((0,external_wp_element_namespaceObject.memo)(DataViewsPagination)); 36028 36029 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-footer/index.js 36030 /** 36031 * WordPress dependencies 36032 */ 36033 36034 36035 36036 /** 36037 * Internal dependencies 36038 */ 36039 36040 36041 36042 36043 36044 const dataviews_footer_EMPTY_ARRAY = []; 36045 function DataViewsFooter() { 36046 const { 36047 view, 36048 paginationInfo: { 36049 totalItems = 0, 36050 totalPages 36051 }, 36052 data, 36053 actions = dataviews_footer_EMPTY_ARRAY 36054 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 36055 const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data) && [constants_LAYOUT_TABLE, constants_LAYOUT_GRID].includes(view.type); 36056 if (!totalItems || !totalPages || totalPages <= 1 && !hasBulkActions) { 36057 return null; 36058 } 36059 return !!totalItems && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 36060 expanded: false, 36061 justify: "end", 36062 className: "dataviews-footer", 36063 children: [hasBulkActions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BulkActionsFooter, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_pagination, {})] 36064 }); 36065 } 36066 36067 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-search/index.js 36068 /** 36069 * WordPress dependencies 36070 */ 36071 36072 36073 36074 36075 36076 /** 36077 * Internal dependencies 36078 */ 36079 36080 36081 const DataViewsSearch = (0,external_wp_element_namespaceObject.memo)(function Search({ 36082 label 36083 }) { 36084 const { 36085 view, 36086 onChangeView 36087 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 36088 const [search, setSearch, debouncedSearch] = (0,external_wp_compose_namespaceObject.useDebouncedInput)(view.search); 36089 (0,external_wp_element_namespaceObject.useEffect)(() => { 36090 var _view$search; 36091 setSearch((_view$search = view.search) !== null && _view$search !== void 0 ? _view$search : ''); 36092 }, [view.search, setSearch]); 36093 const onChangeViewRef = (0,external_wp_element_namespaceObject.useRef)(onChangeView); 36094 const viewRef = (0,external_wp_element_namespaceObject.useRef)(view); 36095 (0,external_wp_element_namespaceObject.useEffect)(() => { 36096 onChangeViewRef.current = onChangeView; 36097 viewRef.current = view; 36098 }, [onChangeView, view]); 36099 (0,external_wp_element_namespaceObject.useEffect)(() => { 36100 if (debouncedSearch !== viewRef.current?.search) { 36101 onChangeViewRef.current({ 36102 ...viewRef.current, 36103 page: 1, 36104 search: debouncedSearch 36105 }); 36106 } 36107 }, [debouncedSearch]); 36108 const searchLabel = label || (0,external_wp_i18n_namespaceObject.__)('Search'); 36109 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SearchControl, { 36110 className: "dataviews-search", 36111 __nextHasNoMarginBottom: true, 36112 onChange: setSearch, 36113 value: search, 36114 label: searchLabel, 36115 placeholder: searchLabel, 36116 size: "compact" 36117 }); 36118 }); 36119 /* harmony default export */ const dataviews_search = (DataViewsSearch); 36120 36121 ;// ./node_modules/@wordpress/icons/build-module/library/lock.js 36122 /** 36123 * WordPress dependencies 36124 */ 36125 36126 36127 const lock_lock = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 36128 viewBox: "0 0 24 24", 36129 xmlns: "http://www.w3.org/2000/svg", 36130 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 36131 d: "M17 10h-1.2V7c0-2.1-1.7-3.8-3.8-3.8-2.1 0-3.8 1.7-3.8 3.8v3H7c-.6 0-1 .4-1 1v8c0 .6.4 1 1 1h10c.6 0 1-.4 1-1v-8c0-.6-.4-1-1-1zm-2.8 0H9.8V7c0-1.2 1-2.2 2.2-2.2s2.2 1 2.2 2.2v3z" 36132 }) 36133 }); 36134 /* harmony default export */ const library_lock = (lock_lock); 36135 36136 ;// ./node_modules/@wordpress/icons/build-module/library/cog.js 36137 /** 36138 * WordPress dependencies 36139 */ 36140 36141 36142 const cog = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 36143 xmlns: "http://www.w3.org/2000/svg", 36144 viewBox: "0 0 24 24", 36145 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 36146 fillRule: "evenodd", 36147 d: "M10.289 4.836A1 1 0 0111.275 4h1.306a1 1 0 01.987.836l.244 1.466c.787.26 1.503.679 2.108 1.218l1.393-.522a1 1 0 011.216.437l.653 1.13a1 1 0 01-.23 1.273l-1.148.944a6.025 6.025 0 010 2.435l1.149.946a1 1 0 01.23 1.272l-.653 1.13a1 1 0 01-1.216.437l-1.394-.522c-.605.54-1.32.958-2.108 1.218l-.244 1.466a1 1 0 01-.987.836h-1.306a1 1 0 01-.986-.836l-.244-1.466a5.995 5.995 0 01-2.108-1.218l-1.394.522a1 1 0 01-1.217-.436l-.653-1.131a1 1 0 01.23-1.272l1.149-.946a6.026 6.026 0 010-2.435l-1.148-.944a1 1 0 01-.23-1.272l.653-1.131a1 1 0 011.217-.437l1.393.522a5.994 5.994 0 012.108-1.218l.244-1.466zM14.929 12a3 3 0 11-6 0 3 3 0 016 0z", 36148 clipRule: "evenodd" 36149 }) 36150 }); 36151 /* harmony default export */ const library_cog = (cog); 36152 36153 ;// external ["wp","warning"] 36154 const external_wp_warning_namespaceObject = window["wp"]["warning"]; 36155 var external_wp_warning_default = /*#__PURE__*/__webpack_require__.n(external_wp_warning_namespaceObject); 36156 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-view-config/index.js 36157 /** 36158 * External dependencies 36159 */ 36160 36161 36162 36163 /** 36164 * WordPress dependencies 36165 */ 36166 36167 36168 36169 36170 36171 36172 36173 /** 36174 * Internal dependencies 36175 */ 36176 36177 36178 36179 36180 36181 const { 36182 Menu: dataviews_view_config_Menu 36183 } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 36184 const DATAVIEWS_CONFIG_POPOVER_PROPS = { 36185 className: 'dataviews-config__popover', 36186 placement: 'bottom-end', 36187 offset: 9 36188 }; 36189 function ViewTypeMenu({ 36190 defaultLayouts = { 36191 list: {}, 36192 grid: {}, 36193 table: {} 36194 } 36195 }) { 36196 const { 36197 view, 36198 onChangeView 36199 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 36200 const availableLayouts = Object.keys(defaultLayouts); 36201 if (availableLayouts.length <= 1) { 36202 return null; 36203 } 36204 const activeView = VIEW_LAYOUTS.find(v => view.type === v.type); 36205 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(dataviews_view_config_Menu, { 36206 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_Menu.TriggerButton, { 36207 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 36208 size: "compact", 36209 icon: activeView?.icon, 36210 label: (0,external_wp_i18n_namespaceObject.__)('Layout') 36211 }) 36212 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_Menu.Popover, { 36213 children: availableLayouts.map(layout => { 36214 const config = VIEW_LAYOUTS.find(v => v.type === layout); 36215 if (!config) { 36216 return null; 36217 } 36218 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_Menu.RadioItem, { 36219 value: layout, 36220 name: "view-actions-available-view", 36221 checked: layout === view.type, 36222 hideOnClick: true, 36223 onChange: e => { 36224 switch (e.target.value) { 36225 case 'list': 36226 case 'grid': 36227 case 'table': 36228 const viewWithoutLayout = { 36229 ...view 36230 }; 36231 if ('layout' in viewWithoutLayout) { 36232 delete viewWithoutLayout.layout; 36233 } 36234 // @ts-expect-error 36235 return onChangeView({ 36236 ...viewWithoutLayout, 36237 type: e.target.value, 36238 ...defaultLayouts[e.target.value] 36239 }); 36240 } 36241 true ? external_wp_warning_default()('Invalid dataview') : 0; 36242 }, 36243 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_Menu.ItemLabel, { 36244 children: config.label 36245 }) 36246 }, layout); 36247 }) 36248 })] 36249 }); 36250 } 36251 function SortFieldControl() { 36252 const { 36253 view, 36254 fields, 36255 onChangeView 36256 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 36257 const orderOptions = (0,external_wp_element_namespaceObject.useMemo)(() => { 36258 const sortableFields = fields.filter(field => field.enableSorting !== false); 36259 return sortableFields.map(field => { 36260 return { 36261 label: field.label, 36262 value: field.id 36263 }; 36264 }); 36265 }, [fields]); 36266 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { 36267 __nextHasNoMarginBottom: true, 36268 __next40pxDefaultSize: true, 36269 label: (0,external_wp_i18n_namespaceObject.__)('Sort by'), 36270 value: view.sort?.field, 36271 options: orderOptions, 36272 onChange: value => { 36273 onChangeView({ 36274 ...view, 36275 sort: { 36276 direction: view?.sort?.direction || 'desc', 36277 field: value 36278 }, 36279 showLevels: false 36280 }); 36281 } 36282 }); 36283 } 36284 function SortDirectionControl() { 36285 const { 36286 view, 36287 fields, 36288 onChangeView 36289 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 36290 const sortableFields = fields.filter(field => field.enableSorting !== false); 36291 if (sortableFields.length === 0) { 36292 return null; 36293 } 36294 let value = view.sort?.direction; 36295 if (!value && view.sort?.field) { 36296 value = 'desc'; 36297 } 36298 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { 36299 className: "dataviews-view-config__sort-direction", 36300 __nextHasNoMarginBottom: true, 36301 __next40pxDefaultSize: true, 36302 isBlock: true, 36303 label: (0,external_wp_i18n_namespaceObject.__)('Order'), 36304 value: value, 36305 onChange: newDirection => { 36306 if (newDirection === 'asc' || newDirection === 'desc') { 36307 onChangeView({ 36308 ...view, 36309 sort: { 36310 direction: newDirection, 36311 field: view.sort?.field || 36312 // If there is no field assigned as the sorting field assign the first sortable field. 36313 fields.find(field => field.enableSorting !== false)?.id || '' 36314 }, 36315 showLevels: false 36316 }); 36317 return; 36318 } 36319 true ? external_wp_warning_default()('Invalid direction') : 0; 36320 }, 36321 children: SORTING_DIRECTIONS.map(direction => { 36322 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, { 36323 value: direction, 36324 icon: sortIcons[direction], 36325 label: sortLabels[direction] 36326 }, direction); 36327 }) 36328 }); 36329 } 36330 const PAGE_SIZE_VALUES = [10, 20, 50, 100]; 36331 function ItemsPerPageControl() { 36332 const { 36333 view, 36334 onChangeView 36335 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 36336 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { 36337 __nextHasNoMarginBottom: true, 36338 __next40pxDefaultSize: true, 36339 isBlock: true, 36340 label: (0,external_wp_i18n_namespaceObject.__)('Items per page'), 36341 value: view.perPage || 10, 36342 disabled: !view?.sort?.field, 36343 onChange: newItemsPerPage => { 36344 const newItemsPerPageNumber = typeof newItemsPerPage === 'number' || newItemsPerPage === undefined ? newItemsPerPage : parseInt(newItemsPerPage, 10); 36345 onChangeView({ 36346 ...view, 36347 perPage: newItemsPerPageNumber, 36348 page: 1 36349 }); 36350 }, 36351 children: PAGE_SIZE_VALUES.map(value => { 36352 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { 36353 value: value, 36354 label: value.toString() 36355 }, value); 36356 }) 36357 }); 36358 } 36359 function PreviewOptions({ 36360 previewOptions, 36361 onChangePreviewOption, 36362 onMenuOpenChange, 36363 activeOption 36364 }) { 36365 const focusPreviewOptionsField = id => { 36366 // Focus the visibility button to avoid focus loss. 36367 // Our code is safe against the component being unmounted, so we don't need to worry about cleaning the timeout. 36368 // eslint-disable-next-line @wordpress/react-no-unsafe-timeout 36369 setTimeout(() => { 36370 const element = document.querySelector(`.dataviews-field-control__field-$id} .dataviews-field-control__field-preview-options-button`); 36371 if (element instanceof HTMLElement) { 36372 element.focus(); 36373 } 36374 }, 50); 36375 }; 36376 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(dataviews_view_config_Menu, { 36377 onOpenChange: onMenuOpenChange, 36378 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_Menu.TriggerButton, { 36379 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 36380 className: "dataviews-field-control__field-preview-options-button", 36381 size: "compact", 36382 icon: more_vertical, 36383 label: (0,external_wp_i18n_namespaceObject.__)('Preview') 36384 }) 36385 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_Menu.Popover, { 36386 children: previewOptions?.map(({ 36387 id, 36388 label 36389 }) => { 36390 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_Menu.RadioItem, { 36391 value: id, 36392 checked: id === activeOption, 36393 onChange: () => { 36394 onChangePreviewOption?.(id); 36395 focusPreviewOptionsField(id); 36396 }, 36397 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_Menu.ItemLabel, { 36398 children: label 36399 }) 36400 }, id); 36401 }) 36402 })] 36403 }); 36404 } 36405 function FieldItem({ 36406 field, 36407 label, 36408 description, 36409 isVisible, 36410 isFirst, 36411 isLast, 36412 canMove = true, 36413 onToggleVisibility, 36414 onMoveUp, 36415 onMoveDown, 36416 previewOptions, 36417 onChangePreviewOption 36418 }) { 36419 const [isChangingPreviewOption, setIsChangingPreviewOption] = (0,external_wp_element_namespaceObject.useState)(false); 36420 const focusVisibilityField = () => { 36421 // Focus the visibility button to avoid focus loss. 36422 // Our code is safe against the component being unmounted, so we don't need to worry about cleaning the timeout. 36423 // eslint-disable-next-line @wordpress/react-no-unsafe-timeout 36424 setTimeout(() => { 36425 const element = document.querySelector(`.dataviews-field-control__field-$field.id} .dataviews-field-control__field-visibility-button`); 36426 if (element instanceof HTMLElement) { 36427 element.focus(); 36428 } 36429 }, 50); 36430 }; 36431 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItem, { 36432 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 36433 expanded: true, 36434 className: dist_clsx('dataviews-field-control__field', `dataviews-field-control__field-$field.id}`, 36435 // The actions are hidden when the mouse is not hovering the item, or focus 36436 // is outside the item. 36437 // For actions that require a popover, a menu etc, that would mean that when the interactive element 36438 // opens and the focus goes there the actions would be hidden. 36439 // To avoid that we add a class to the item, that makes sure actions are visible while there is some 36440 // interaction with the item. 36441 { 36442 'is-interacting': isChangingPreviewOption 36443 }), 36444 justify: "flex-start", 36445 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 36446 className: "dataviews-field-control__icon", 36447 children: !canMove && !field.enableHiding && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 36448 icon: library_lock 36449 }) 36450 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { 36451 className: "dataviews-field-control__label-sub-label-container", 36452 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 36453 className: "dataviews-field-control__label", 36454 children: label || field.label 36455 }), description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 36456 className: "dataviews-field-control__sub-label", 36457 children: description 36458 })] 36459 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 36460 justify: "flex-end", 36461 expanded: false, 36462 className: "dataviews-field-control__actions", 36463 children: [isVisible && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 36464 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 36465 disabled: isFirst || !canMove, 36466 accessibleWhenDisabled: true, 36467 size: "compact", 36468 onClick: onMoveUp, 36469 icon: chevron_up, 36470 label: isFirst || !canMove ? (0,external_wp_i18n_namespaceObject.__)("This field can't be moved up") : (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: field label */ 36471 (0,external_wp_i18n_namespaceObject.__)('Move %s up'), field.label) 36472 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 36473 disabled: isLast || !canMove, 36474 accessibleWhenDisabled: true, 36475 size: "compact", 36476 onClick: onMoveDown, 36477 icon: chevron_down, 36478 label: isLast || !canMove ? (0,external_wp_i18n_namespaceObject.__)("This field can't be moved down") : (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: field label */ 36479 (0,external_wp_i18n_namespaceObject.__)('Move %s down'), field.label) 36480 })] 36481 }), onToggleVisibility && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 36482 className: "dataviews-field-control__field-visibility-button", 36483 disabled: !field.enableHiding, 36484 accessibleWhenDisabled: true, 36485 size: "compact", 36486 onClick: () => { 36487 onToggleVisibility(); 36488 focusVisibilityField(); 36489 }, 36490 icon: isVisible ? library_unseen : library_seen, 36491 label: isVisible ? (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: field label */ 36492 (0,external_wp_i18n_namespaceObject._x)('Hide %s', 'field'), field.label) : (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: field label */ 36493 (0,external_wp_i18n_namespaceObject._x)('Show %s', 'field'), field.label) 36494 }), previewOptions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreviewOptions, { 36495 previewOptions: previewOptions, 36496 onChangePreviewOption: onChangePreviewOption, 36497 onMenuOpenChange: setIsChangingPreviewOption, 36498 activeOption: field.id 36499 })] 36500 })] 36501 }) 36502 }); 36503 } 36504 function RegularFieldItem({ 36505 index, 36506 field, 36507 view, 36508 onChangeView 36509 }) { 36510 var _view$fields; 36511 const visibleFieldIds = (_view$fields = view.fields) !== null && _view$fields !== void 0 ? _view$fields : []; 36512 const isVisible = index !== undefined && visibleFieldIds.includes(field.id); 36513 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FieldItem, { 36514 field: field, 36515 isVisible: isVisible, 36516 isFirst: index !== undefined && index < 1, 36517 isLast: index !== undefined && index === visibleFieldIds.length - 1, 36518 onToggleVisibility: () => { 36519 onChangeView({ 36520 ...view, 36521 fields: isVisible ? visibleFieldIds.filter(fieldId => fieldId !== field.id) : [...visibleFieldIds, field.id] 36522 }); 36523 }, 36524 onMoveUp: index !== undefined ? () => { 36525 var _visibleFieldIds$slic; 36526 onChangeView({ 36527 ...view, 36528 fields: [...((_visibleFieldIds$slic = visibleFieldIds.slice(0, index - 1)) !== null && _visibleFieldIds$slic !== void 0 ? _visibleFieldIds$slic : []), field.id, visibleFieldIds[index - 1], ...visibleFieldIds.slice(index + 1)] 36529 }); 36530 } : undefined, 36531 onMoveDown: index !== undefined ? () => { 36532 var _visibleFieldIds$slic2; 36533 onChangeView({ 36534 ...view, 36535 fields: [...((_visibleFieldIds$slic2 = visibleFieldIds.slice(0, index)) !== null && _visibleFieldIds$slic2 !== void 0 ? _visibleFieldIds$slic2 : []), visibleFieldIds[index + 1], field.id, ...visibleFieldIds.slice(index + 2)] 36536 }); 36537 } : undefined 36538 }); 36539 } 36540 function dataviews_view_config_isDefined(item) { 36541 return !!item; 36542 } 36543 function FieldControl() { 36544 var _view$fields2; 36545 const { 36546 view, 36547 fields, 36548 onChangeView 36549 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 36550 const togglableFields = [view?.titleField, view?.mediaField, view?.descriptionField].filter(Boolean); 36551 const visibleFieldIds = (_view$fields2 = view.fields) !== null && _view$fields2 !== void 0 ? _view$fields2 : []; 36552 const hiddenFields = fields.filter(f => !visibleFieldIds.includes(f.id) && !togglableFields.includes(f.id) && f.type !== 'media'); 36553 const visibleFields = visibleFieldIds.map(fieldId => fields.find(f => f.id === fieldId)).filter(dataviews_view_config_isDefined); 36554 if (!visibleFields?.length && !hiddenFields?.length) { 36555 return null; 36556 } 36557 const titleField = fields.find(f => f.id === view.titleField); 36558 const previewField = fields.find(f => f.id === view.mediaField); 36559 const descriptionField = fields.find(f => f.id === view.descriptionField); 36560 const previewFields = fields.filter(f => f.type === 'media'); 36561 let previewFieldUI; 36562 if (previewFields.length > 1) { 36563 var _view$showMedia; 36564 const isPreviewFieldVisible = dataviews_view_config_isDefined(previewField) && ((_view$showMedia = view.showMedia) !== null && _view$showMedia !== void 0 ? _view$showMedia : true); 36565 previewFieldUI = dataviews_view_config_isDefined(previewField) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FieldItem, { 36566 field: previewField, 36567 label: (0,external_wp_i18n_namespaceObject.__)('Preview'), 36568 description: previewField.label, 36569 isVisible: isPreviewFieldVisible, 36570 onToggleVisibility: () => { 36571 onChangeView({ 36572 ...view, 36573 showMedia: !isPreviewFieldVisible 36574 }); 36575 }, 36576 canMove: false, 36577 previewOptions: previewFields.map(field => ({ 36578 label: field.label, 36579 id: field.id 36580 })), 36581 onChangePreviewOption: newPreviewId => onChangeView({ 36582 ...view, 36583 mediaField: newPreviewId 36584 }) 36585 }, previewField.id); 36586 } 36587 const lockedFields = [{ 36588 field: titleField, 36589 isVisibleFlag: 'showTitle' 36590 }, { 36591 field: previewField, 36592 isVisibleFlag: 'showMedia', 36593 ui: previewFieldUI 36594 }, { 36595 field: descriptionField, 36596 isVisibleFlag: 'showDescription' 36597 }].filter(({ 36598 field 36599 }) => dataviews_view_config_isDefined(field)); 36600 const visibleLockedFields = lockedFields.filter(({ 36601 field, 36602 isVisibleFlag 36603 }) => { 36604 var _view$isVisibleFlag; 36605 return ( 36606 // @ts-expect-error 36607 dataviews_view_config_isDefined(field) && ((_view$isVisibleFlag = view[isVisibleFlag]) !== null && _view$isVisibleFlag !== void 0 ? _view$isVisibleFlag : true) 36608 ); 36609 }); 36610 const hiddenLockedFields = lockedFields.filter(({ 36611 field, 36612 isVisibleFlag 36613 }) => { 36614 var _view$isVisibleFlag2; 36615 return ( 36616 // @ts-expect-error 36617 dataviews_view_config_isDefined(field) && !((_view$isVisibleFlag2 = view[isVisibleFlag]) !== null && _view$isVisibleFlag2 !== void 0 ? _view$isVisibleFlag2 : true) 36618 ); 36619 }); 36620 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 36621 className: "dataviews-field-control", 36622 spacing: 6, 36623 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 36624 className: "dataviews-view-config__properties", 36625 spacing: 0, 36626 children: (visibleLockedFields.length > 0 || !!visibleFields?.length) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { 36627 isBordered: true, 36628 isSeparated: true, 36629 children: [visibleLockedFields.map(({ 36630 field, 36631 isVisibleFlag, 36632 ui 36633 }) => { 36634 return ui !== null && ui !== void 0 ? ui : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FieldItem, { 36635 field: field, 36636 isVisible: true, 36637 onToggleVisibility: () => { 36638 onChangeView({ 36639 ...view, 36640 [isVisibleFlag]: false 36641 }); 36642 }, 36643 canMove: false 36644 }, field.id); 36645 }), visibleFields.map((field, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RegularFieldItem, { 36646 field: field, 36647 view: view, 36648 onChangeView: onChangeView, 36649 index: index 36650 }, field.id))] 36651 }) 36652 }), (!!hiddenFields?.length || !!hiddenLockedFields.length) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 36653 spacing: 4, 36654 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { 36655 style: { 36656 margin: 0 36657 }, 36658 children: (0,external_wp_i18n_namespaceObject.__)('Hidden') 36659 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 36660 className: "dataviews-view-config__properties", 36661 spacing: 0, 36662 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { 36663 isBordered: true, 36664 isSeparated: true, 36665 children: [hiddenLockedFields.length > 0 && hiddenLockedFields.map(({ 36666 field, 36667 isVisibleFlag, 36668 ui 36669 }) => { 36670 return ui !== null && ui !== void 0 ? ui : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FieldItem, { 36671 field: field, 36672 isVisible: false, 36673 onToggleVisibility: () => { 36674 onChangeView({ 36675 ...view, 36676 [isVisibleFlag]: true 36677 }); 36678 }, 36679 canMove: false 36680 }, field.id); 36681 }), hiddenFields.map(field => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RegularFieldItem, { 36682 field: field, 36683 view: view, 36684 onChangeView: onChangeView 36685 }, field.id))] 36686 }) 36687 })] 36688 })] 36689 }); 36690 } 36691 function SettingsSection({ 36692 title, 36693 description, 36694 children 36695 }) { 36696 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalGrid, { 36697 columns: 12, 36698 className: "dataviews-settings-section", 36699 gap: 4, 36700 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 36701 className: "dataviews-settings-section__sidebar", 36702 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 36703 level: 2, 36704 className: "dataviews-settings-section__title", 36705 children: title 36706 }), description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 36707 variant: "muted", 36708 className: "dataviews-settings-section__description", 36709 children: description 36710 })] 36711 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, { 36712 columns: 8, 36713 gap: 4, 36714 className: "dataviews-settings-section__content", 36715 children: children 36716 })] 36717 }); 36718 } 36719 function DataviewsViewConfigDropdown() { 36720 const { 36721 view 36722 } = (0,external_wp_element_namespaceObject.useContext)(dataviews_context); 36723 const popoverId = (0,external_wp_compose_namespaceObject.useInstanceId)(_DataViewsViewConfig, 'dataviews-view-config-dropdown'); 36724 const activeLayout = VIEW_LAYOUTS.find(layout => layout.type === view.type); 36725 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 36726 expandOnMobile: true, 36727 popoverProps: { 36728 ...DATAVIEWS_CONFIG_POPOVER_PROPS, 36729 id: popoverId 36730 }, 36731 renderToggle: ({ 36732 onToggle, 36733 isOpen 36734 }) => { 36735 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 36736 size: "compact", 36737 icon: library_cog, 36738 label: (0,external_wp_i18n_namespaceObject._x)('View options', 'View is used as a noun'), 36739 onClick: onToggle, 36740 "aria-expanded": isOpen ? 'true' : 'false', 36741 "aria-controls": popoverId 36742 }); 36743 }, 36744 renderContent: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, { 36745 paddingSize: "medium", 36746 className: "dataviews-config__popover-content-wrapper", 36747 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 36748 className: "dataviews-view-config", 36749 spacing: 6, 36750 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(SettingsSection, { 36751 title: (0,external_wp_i18n_namespaceObject.__)('Appearance'), 36752 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 36753 expanded: true, 36754 className: "is-divided-in-two", 36755 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SortFieldControl, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SortDirectionControl, {})] 36756 }), !!activeLayout?.viewConfigOptions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(activeLayout.viewConfigOptions, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemsPerPageControl, {})] 36757 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SettingsSection, { 36758 title: (0,external_wp_i18n_namespaceObject.__)('Properties'), 36759 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FieldControl, {}) 36760 })] 36761 }) 36762 }) 36763 }); 36764 } 36765 function _DataViewsViewConfig({ 36766 defaultLayouts = { 36767 list: {}, 36768 grid: {}, 36769 table: {} 36770 } 36771 }) { 36772 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 36773 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ViewTypeMenu, { 36774 defaultLayouts: defaultLayouts 36775 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataviewsViewConfigDropdown, {})] 36776 }); 36777 } 36778 const DataViewsViewConfig = (0,external_wp_element_namespaceObject.memo)(_DataViewsViewConfig); 36779 /* harmony default export */ const dataviews_view_config = (DataViewsViewConfig); 36780 36781 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews/index.js 36782 /** 36783 * External dependencies 36784 */ 36785 36786 /** 36787 * WordPress dependencies 36788 */ 36789 36790 36791 36792 36793 /** 36794 * Internal dependencies 36795 */ 36796 36797 36798 36799 36800 36801 36802 36803 36804 const defaultGetItemId = item => item.id; 36805 const defaultIsItemClickable = () => true; 36806 const dataviews_EMPTY_ARRAY = []; 36807 function DataViews({ 36808 view, 36809 onChangeView, 36810 fields, 36811 search = true, 36812 searchLabel = undefined, 36813 actions = dataviews_EMPTY_ARRAY, 36814 data, 36815 getItemId = defaultGetItemId, 36816 getItemLevel, 36817 isLoading = false, 36818 paginationInfo, 36819 defaultLayouts, 36820 selection: selectionProperty, 36821 onChangeSelection, 36822 onClickItem, 36823 isItemClickable = defaultIsItemClickable, 36824 header 36825 }) { 36826 const [containerWidth, setContainerWidth] = (0,external_wp_element_namespaceObject.useState)(0); 36827 const containerRef = (0,external_wp_compose_namespaceObject.useResizeObserver)(resizeObserverEntries => { 36828 setContainerWidth(resizeObserverEntries[0].borderBoxSize[0].inlineSize); 36829 }, { 36830 box: 'border-box' 36831 }); 36832 const [selectionState, setSelectionState] = (0,external_wp_element_namespaceObject.useState)([]); 36833 const isUncontrolled = selectionProperty === undefined || onChangeSelection === undefined; 36834 const selection = isUncontrolled ? selectionState : selectionProperty; 36835 const [openedFilter, setOpenedFilter] = (0,external_wp_element_namespaceObject.useState)(null); 36836 function setSelectionWithChange(value) { 36837 const newValue = typeof value === 'function' ? value(selection) : value; 36838 if (isUncontrolled) { 36839 setSelectionState(newValue); 36840 } 36841 if (onChangeSelection) { 36842 onChangeSelection(newValue); 36843 } 36844 } 36845 const _fields = (0,external_wp_element_namespaceObject.useMemo)(() => normalizeFields(fields), [fields]); 36846 const _selection = (0,external_wp_element_namespaceObject.useMemo)(() => { 36847 return selection.filter(id => data.some(item => getItemId(item) === id)); 36848 }, [selection, data, getItemId]); 36849 const filters = useFilters(_fields, view); 36850 const [isShowingFilter, setIsShowingFilter] = (0,external_wp_element_namespaceObject.useState)(() => (filters || []).some(filter => filter.isPrimary)); 36851 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_context.Provider, { 36852 value: { 36853 view, 36854 onChangeView, 36855 fields: _fields, 36856 actions, 36857 data, 36858 isLoading, 36859 paginationInfo, 36860 selection: _selection, 36861 onChangeSelection: setSelectionWithChange, 36862 openedFilter, 36863 setOpenedFilter, 36864 getItemId, 36865 getItemLevel, 36866 isItemClickable, 36867 onClickItem, 36868 containerWidth 36869 }, 36870 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 36871 className: "dataviews-wrapper", 36872 ref: containerRef, 36873 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 36874 alignment: "top", 36875 justify: "space-between", 36876 className: "dataviews__view-actions", 36877 spacing: 1, 36878 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 36879 justify: "start", 36880 expanded: false, 36881 className: "dataviews__search", 36882 children: [search && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_search, { 36883 label: searchLabel 36884 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FiltersToggle, { 36885 filters: filters, 36886 view: view, 36887 onChangeView: onChangeView, 36888 setOpenedFilter: setOpenedFilter, 36889 setIsShowingFilter: setIsShowingFilter, 36890 isShowingFilter: isShowingFilter 36891 })] 36892 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 36893 spacing: 1, 36894 expanded: false, 36895 style: { 36896 flexShrink: 0 36897 }, 36898 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config, { 36899 defaultLayouts: defaultLayouts 36900 }), header] 36901 })] 36902 }), isShowingFilter && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_filters, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsLayout, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsFooter, {})] 36903 }) 36904 }); 36905 } 36906 36907 ;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/use-pattern-settings.js 36908 /** 36909 * WordPress dependencies 36910 */ 36911 36912 36913 36914 36915 /** 36916 * Internal dependencies 36917 */ 36918 36919 36920 36921 function usePatternSettings() { 36922 var _storedSettings$__exp; 36923 const storedSettings = (0,external_wp_data_namespaceObject.useSelect)(select => { 36924 const { 36925 getSettings 36926 } = unlock(select(store)); 36927 return getSettings(); 36928 }, []); 36929 const settingsBlockPatterns = (_storedSettings$__exp = storedSettings.__experimentalAdditionalBlockPatterns) !== null && _storedSettings$__exp !== void 0 ? _storedSettings$__exp : 36930 // WP 6.0 36931 storedSettings.__experimentalBlockPatterns; // WP 5.9 36932 36933 const restBlockPatterns = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getBlockPatterns(), []); 36934 const blockPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => [...(settingsBlockPatterns || []), ...(restBlockPatterns || [])].filter(filterOutDuplicatesByName), [settingsBlockPatterns, restBlockPatterns]); 36935 const settings = (0,external_wp_element_namespaceObject.useMemo)(() => { 36936 const { 36937 __experimentalAdditionalBlockPatterns, 36938 ...restStoredSettings 36939 } = storedSettings; 36940 return { 36941 ...restStoredSettings, 36942 __experimentalBlockPatterns: blockPatterns, 36943 isPreviewMode: true 36944 }; 36945 }, [storedSettings, blockPatterns]); 36946 return settings; 36947 } 36948 36949 ;// ./node_modules/@wordpress/icons/build-module/library/symbol-filled.js 36950 /** 36951 * WordPress dependencies 36952 */ 36953 36954 36955 const symbolFilled = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 36956 xmlns: "http://www.w3.org/2000/svg", 36957 viewBox: "0 0 24 24", 36958 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 36959 d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-17.6 1L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z" 36960 }) 36961 }); 36962 /* harmony default export */ const symbol_filled = (symbolFilled); 36963 36964 ;// ./node_modules/@wordpress/icons/build-module/library/upload.js 36965 /** 36966 * WordPress dependencies 36967 */ 36968 36969 36970 const upload = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 36971 xmlns: "http://www.w3.org/2000/svg", 36972 viewBox: "0 0 24 24", 36973 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 36974 d: "M18.5 15v3.5H13V6.7l4.5 4.1 1-1.1-6.2-5.8-5.8 5.8 1 1.1 4-4v11.7h-6V15H4v5h16v-5z" 36975 }) 36976 }); 36977 /* harmony default export */ const library_upload = (upload); 36978 36979 ;// ./node_modules/@wordpress/edit-site/build-module/components/add-new-pattern/index.js 36980 /** 36981 * WordPress dependencies 36982 */ 36983 36984 36985 36986 36987 36988 36989 36990 36991 36992 36993 36994 /** 36995 * Internal dependencies 36996 */ 36997 36998 36999 37000 const { 37001 useHistory: add_new_pattern_useHistory, 37002 useLocation: add_new_pattern_useLocation 37003 } = unlock(external_wp_router_namespaceObject.privateApis); 37004 const { 37005 CreatePatternModal, 37006 useAddPatternCategory 37007 } = unlock(external_wp_patterns_namespaceObject.privateApis); 37008 const { 37009 CreateTemplatePartModal 37010 } = unlock(external_wp_editor_namespaceObject.privateApis); 37011 function AddNewPattern() { 37012 const history = add_new_pattern_useHistory(); 37013 const location = add_new_pattern_useLocation(); 37014 const [showPatternModal, setShowPatternModal] = (0,external_wp_element_namespaceObject.useState)(false); 37015 const [showTemplatePartModal, setShowTemplatePartModal] = (0,external_wp_element_namespaceObject.useState)(false); 37016 // eslint-disable-next-line @wordpress/no-unused-vars-before-return 37017 const { 37018 createPatternFromFile 37019 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(external_wp_patterns_namespaceObject.store)); 37020 const { 37021 createSuccessNotice, 37022 createErrorNotice 37023 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 37024 const patternUploadInputRef = (0,external_wp_element_namespaceObject.useRef)(); 37025 const { 37026 isBlockBasedTheme, 37027 addNewPatternLabel, 37028 addNewTemplatePartLabel, 37029 canCreatePattern, 37030 canCreateTemplatePart 37031 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 37032 const { 37033 getCurrentTheme, 37034 getPostType, 37035 canUser 37036 } = select(external_wp_coreData_namespaceObject.store); 37037 return { 37038 isBlockBasedTheme: getCurrentTheme()?.is_block_theme, 37039 addNewPatternLabel: getPostType(PATTERN_TYPES.user)?.labels?.add_new_item, 37040 addNewTemplatePartLabel: getPostType(TEMPLATE_PART_POST_TYPE)?.labels?.add_new_item, 37041 // Blocks refers to the wp_block post type, this checks the ability to create a post of that type. 37042 canCreatePattern: canUser('create', { 37043 kind: 'postType', 37044 name: PATTERN_TYPES.user 37045 }), 37046 canCreateTemplatePart: canUser('create', { 37047 kind: 'postType', 37048 name: TEMPLATE_PART_POST_TYPE 37049 }) 37050 }; 37051 }, []); 37052 function handleCreatePattern({ 37053 pattern 37054 }) { 37055 setShowPatternModal(false); 37056 history.navigate(`/$PATTERN_TYPES.user}/$pattern.id}?canvas=edit`); 37057 } 37058 function handleCreateTemplatePart(templatePart) { 37059 setShowTemplatePartModal(false); 37060 history.navigate(`/$TEMPLATE_PART_POST_TYPE}/$templatePart.id}?canvas=edit`); 37061 } 37062 function handleError() { 37063 setShowPatternModal(false); 37064 setShowTemplatePartModal(false); 37065 } 37066 const controls = []; 37067 if (canCreatePattern) { 37068 controls.push({ 37069 icon: library_symbol, 37070 onClick: () => setShowPatternModal(true), 37071 title: addNewPatternLabel 37072 }); 37073 } 37074 if (isBlockBasedTheme && canCreateTemplatePart) { 37075 controls.push({ 37076 icon: symbol_filled, 37077 onClick: () => setShowTemplatePartModal(true), 37078 title: addNewTemplatePartLabel 37079 }); 37080 } 37081 if (canCreatePattern) { 37082 controls.push({ 37083 icon: library_upload, 37084 onClick: () => { 37085 patternUploadInputRef.current.click(); 37086 }, 37087 title: (0,external_wp_i18n_namespaceObject.__)('Import pattern from JSON') 37088 }); 37089 } 37090 const { 37091 categoryMap, 37092 findOrCreateTerm 37093 } = useAddPatternCategory(); 37094 if (controls.length === 0) { 37095 return null; 37096 } 37097 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 37098 children: [addNewPatternLabel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { 37099 controls: controls, 37100 icon: null, 37101 toggleProps: { 37102 variant: 'primary', 37103 showTooltip: false, 37104 __next40pxDefaultSize: true 37105 }, 37106 text: addNewPatternLabel, 37107 label: addNewPatternLabel 37108 }), showPatternModal && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreatePatternModal, { 37109 onClose: () => setShowPatternModal(false), 37110 onSuccess: handleCreatePattern, 37111 onError: handleError 37112 }), showTemplatePartModal && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreateTemplatePartModal, { 37113 closeModal: () => setShowTemplatePartModal(false), 37114 blocks: [], 37115 onCreate: handleCreateTemplatePart, 37116 onError: handleError 37117 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("input", { 37118 type: "file", 37119 accept: ".json", 37120 hidden: true, 37121 ref: patternUploadInputRef, 37122 onChange: async event => { 37123 const file = event.target.files?.[0]; 37124 if (!file) { 37125 return; 37126 } 37127 try { 37128 let currentCategoryId; 37129 // When we're not handling template parts, we should 37130 // add or create the proper pattern category. 37131 if (location.query.postType !== TEMPLATE_PART_POST_TYPE) { 37132 /* 37133 * categoryMap.values() returns an iterator. 37134 * Iterator.prototype.find() is not yet widely supported. 37135 * Convert to array to use the Array.prototype.find method. 37136 */ 37137 const currentCategory = Array.from(categoryMap.values()).find(term => term.name === location.query.categoryId); 37138 if (currentCategory) { 37139 currentCategoryId = currentCategory.id || (await findOrCreateTerm(currentCategory.label)); 37140 } 37141 } 37142 const pattern = await createPatternFromFile(file, currentCategoryId ? [currentCategoryId] : undefined); 37143 37144 // Navigate to the All patterns category for the newly created pattern 37145 // if we're not on that page already and if we're not in the `my-patterns` 37146 // category. 37147 if (!currentCategoryId && location.query.categoryId !== 'my-patterns') { 37148 history.navigate(`/pattern?categoryId=$PATTERN_DEFAULT_CATEGORY}`); 37149 } 37150 createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( 37151 // translators: %s: The imported pattern's title. 37152 (0,external_wp_i18n_namespaceObject.__)('Imported "%s" from JSON.'), pattern.title.raw), { 37153 type: 'snackbar', 37154 id: 'import-pattern-success' 37155 }); 37156 } catch (err) { 37157 createErrorNotice(err.message, { 37158 type: 'snackbar', 37159 id: 'import-pattern-error' 37160 }); 37161 } finally { 37162 event.target.value = ''; 37163 } 37164 } 37165 })] 37166 }); 37167 } 37168 37169 ;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/rename-category-menu-item.js 37170 /** 37171 * WordPress dependencies 37172 */ 37173 37174 37175 37176 37177 /** 37178 * Internal dependencies 37179 */ 37180 37181 37182 /** 37183 * Internal dependencies 37184 */ 37185 37186 37187 const { 37188 RenamePatternCategoryModal 37189 } = unlock(external_wp_patterns_namespaceObject.privateApis); 37190 function RenameCategoryMenuItem({ 37191 category, 37192 onClose 37193 }) { 37194 const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); 37195 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 37196 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 37197 onClick: () => setIsModalOpen(true), 37198 children: (0,external_wp_i18n_namespaceObject.__)('Rename') 37199 }), isModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(rename_category_menu_item_RenameModal, { 37200 category: category, 37201 onClose: () => { 37202 setIsModalOpen(false); 37203 onClose(); 37204 } 37205 })] 37206 }); 37207 } 37208 function rename_category_menu_item_RenameModal({ 37209 category, 37210 onClose 37211 }) { 37212 // User created pattern categories have their properties updated when 37213 // retrieved via `getUserPatternCategories`. The rename modal expects an 37214 // object that will match the pattern category entity. 37215 const normalizedCategory = { 37216 id: category.id, 37217 slug: category.slug, 37218 name: category.label 37219 }; 37220 37221 // Optimization - only use pattern categories when the modal is open. 37222 const existingCategories = usePatternCategories(); 37223 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RenamePatternCategoryModal, { 37224 category: normalizedCategory, 37225 existingCategories: existingCategories, 37226 onClose: onClose, 37227 overlayClassName: "edit-site-list__rename-modal", 37228 focusOnMount: "firstContentElement", 37229 size: "small" 37230 }); 37231 } 37232 37233 ;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/delete-category-menu-item.js 37234 /** 37235 * WordPress dependencies 37236 */ 37237 37238 37239 37240 37241 37242 37243 37244 37245 37246 /** 37247 * Internal dependencies 37248 */ 37249 37250 37251 37252 const { 37253 useHistory: delete_category_menu_item_useHistory 37254 } = unlock(external_wp_router_namespaceObject.privateApis); 37255 function DeleteCategoryMenuItem({ 37256 category, 37257 onClose 37258 }) { 37259 const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); 37260 const history = delete_category_menu_item_useHistory(); 37261 const { 37262 createSuccessNotice, 37263 createErrorNotice 37264 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 37265 const { 37266 deleteEntityRecord, 37267 invalidateResolution 37268 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 37269 const onDelete = async () => { 37270 try { 37271 await deleteEntityRecord('taxonomy', 'wp_pattern_category', category.id, { 37272 force: true 37273 }, { 37274 throwOnError: true 37275 }); 37276 37277 // Prevent the need to refresh the page to get up-to-date categories 37278 // and pattern categorization. 37279 invalidateResolution('getUserPatternCategories'); 37280 invalidateResolution('getEntityRecords', ['postType', PATTERN_TYPES.user, { 37281 per_page: -1 37282 }]); 37283 createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: The pattern category's name */ 37284 (0,external_wp_i18n_namespaceObject._x)('"%s" deleted.', 'pattern category'), category.label), { 37285 type: 'snackbar', 37286 id: 'pattern-category-delete' 37287 }); 37288 onClose?.(); 37289 history.navigate(`/pattern?categoryId=$PATTERN_DEFAULT_CATEGORY}`); 37290 } catch (error) { 37291 const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while deleting the pattern category.'); 37292 createErrorNotice(errorMessage, { 37293 type: 'snackbar', 37294 id: 'pattern-category-delete' 37295 }); 37296 } 37297 }; 37298 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 37299 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 37300 isDestructive: true, 37301 onClick: () => setIsModalOpen(true), 37302 children: (0,external_wp_i18n_namespaceObject.__)('Delete') 37303 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { 37304 isOpen: isModalOpen, 37305 onConfirm: onDelete, 37306 onCancel: () => setIsModalOpen(false), 37307 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Delete'), 37308 className: "edit-site-patterns__delete-modal", 37309 title: (0,external_wp_i18n_namespaceObject.sprintf)( 37310 // translators: %s: The pattern category's name. 37311 (0,external_wp_i18n_namespaceObject._x)('Delete "%s"?', 'pattern category'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(category.label)), 37312 size: "medium", 37313 __experimentalHideHeader: false, 37314 children: (0,external_wp_i18n_namespaceObject.sprintf)( 37315 // translators: %s: The pattern category's name. 37316 (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to delete the category "%s"? The patterns will not be deleted.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(category.label)) 37317 })] 37318 }); 37319 } 37320 37321 ;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/header.js 37322 /** 37323 * WordPress dependencies 37324 */ 37325 37326 37327 37328 37329 37330 37331 /** 37332 * Internal dependencies 37333 */ 37334 37335 37336 37337 37338 37339 37340 function PatternsHeader({ 37341 categoryId, 37342 type, 37343 titleId, 37344 descriptionId 37345 }) { 37346 const { 37347 patternCategories 37348 } = usePatternCategories(); 37349 const templatePartAreas = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.default_template_part_areas || [], []); 37350 let title, description, patternCategory; 37351 if (type === TEMPLATE_PART_POST_TYPE) { 37352 const templatePartArea = templatePartAreas.find(area => area.area === categoryId); 37353 title = templatePartArea?.label || (0,external_wp_i18n_namespaceObject.__)('All Template Parts'); 37354 description = templatePartArea?.description || (0,external_wp_i18n_namespaceObject.__)('Includes every template part defined for any area.'); 37355 } else if (type === PATTERN_TYPES.user && !!categoryId) { 37356 patternCategory = patternCategories.find(category => category.name === categoryId); 37357 title = patternCategory?.label; 37358 description = patternCategory?.description; 37359 } 37360 if (!title) { 37361 return null; 37362 } 37363 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 37364 className: "edit-site-patterns__section-header", 37365 spacing: 1, 37366 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 37367 justify: "space-between", 37368 className: "edit-site-patterns__title", 37369 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 37370 as: "h2", 37371 level: 3, 37372 id: titleId, 37373 weight: 500, 37374 truncate: true, 37375 children: title 37376 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 37377 expanded: false, 37378 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AddNewPattern, {}), !!patternCategory?.id && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { 37379 icon: more_vertical, 37380 label: (0,external_wp_i18n_namespaceObject.__)('Actions'), 37381 toggleProps: { 37382 className: 'edit-site-patterns__button', 37383 description: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: pattern category name */ 37384 (0,external_wp_i18n_namespaceObject.__)('Action menu for %s pattern category'), title), 37385 size: 'compact' 37386 }, 37387 children: ({ 37388 onClose 37389 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { 37390 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RenameCategoryMenuItem, { 37391 category: patternCategory, 37392 onClose: onClose 37393 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DeleteCategoryMenuItem, { 37394 category: patternCategory, 37395 onClose: onClose 37396 })] 37397 }) 37398 })] 37399 })] 37400 }), description ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 37401 variant: "muted", 37402 as: "p", 37403 id: descriptionId, 37404 className: "edit-site-patterns__sub-title", 37405 children: description 37406 }) : null] 37407 }); 37408 } 37409 37410 ;// ./node_modules/@wordpress/icons/build-module/library/pencil.js 37411 /** 37412 * WordPress dependencies 37413 */ 37414 37415 37416 const pencil = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 37417 xmlns: "http://www.w3.org/2000/svg", 37418 viewBox: "0 0 24 24", 37419 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 37420 d: "m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z" 37421 }) 37422 }); 37423 /* harmony default export */ const library_pencil = (pencil); 37424 37425 ;// ./node_modules/@wordpress/icons/build-module/library/edit.js 37426 /** 37427 * Internal dependencies 37428 */ 37429 37430 37431 /* harmony default export */ const edit = (library_pencil); 37432 37433 ;// ./node_modules/@wordpress/edit-site/build-module/components/dataviews-actions/index.js 37434 /** 37435 * WordPress dependencies 37436 */ 37437 37438 37439 37440 37441 37442 /** 37443 * Internal dependencies 37444 */ 37445 37446 37447 const { 37448 useHistory: dataviews_actions_useHistory 37449 } = unlock(external_wp_router_namespaceObject.privateApis); 37450 const useEditPostAction = () => { 37451 const history = dataviews_actions_useHistory(); 37452 return (0,external_wp_element_namespaceObject.useMemo)(() => ({ 37453 id: 'edit-post', 37454 label: (0,external_wp_i18n_namespaceObject.__)('Edit'), 37455 isPrimary: true, 37456 icon: edit, 37457 isEligible(post) { 37458 if (post.status === 'trash') { 37459 return false; 37460 } 37461 // It's eligible for all post types except theme patterns. 37462 return post.type !== PATTERN_TYPES.theme; 37463 }, 37464 callback(items) { 37465 const post = items[0]; 37466 history.navigate(`/$post.type}/$post.id}?canvas=edit`); 37467 } 37468 }), [history]); 37469 }; 37470 37471 ;// ./node_modules/@wordpress/icons/build-module/library/plugins.js 37472 /** 37473 * WordPress dependencies 37474 */ 37475 37476 37477 const plugins = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 37478 xmlns: "http://www.w3.org/2000/svg", 37479 viewBox: "0 0 24 24", 37480 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 37481 d: "M10.5 4v4h3V4H15v4h1.5a1 1 0 011 1v4l-3 4v2a1 1 0 01-1 1h-3a1 1 0 01-1-1v-2l-3-4V9a1 1 0 011-1H9V4h1.5zm.5 12.5v2h2v-2l3-4v-3H8v3l3 4z" 37482 }) 37483 }); 37484 /* harmony default export */ const library_plugins = (plugins); 37485 37486 ;// ./node_modules/@wordpress/icons/build-module/library/globe.js 37487 /** 37488 * WordPress dependencies 37489 */ 37490 37491 37492 const globe = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 37493 xmlns: "http://www.w3.org/2000/svg", 37494 viewBox: "0 0 24 24", 37495 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 37496 d: "M12 3.3c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8s-4-8.8-8.8-8.8zm6.5 5.5h-2.6C15.4 7.3 14.8 6 14 5c2 .6 3.6 2 4.5 3.8zm.7 3.2c0 .6-.1 1.2-.2 1.8h-2.9c.1-.6.1-1.2.1-1.8s-.1-1.2-.1-1.8H19c.2.6.2 1.2.2 1.8zM12 18.7c-1-.7-1.8-1.9-2.3-3.5h4.6c-.5 1.6-1.3 2.9-2.3 3.5zm-2.6-4.9c-.1-.6-.1-1.1-.1-1.8 0-.6.1-1.2.1-1.8h5.2c.1.6.1 1.1.1 1.8s-.1 1.2-.1 1.8H9.4zM4.8 12c0-.6.1-1.2.2-1.8h2.9c-.1.6-.1 1.2-.1 1.8 0 .6.1 1.2.1 1.8H5c-.2-.6-.2-1.2-.2-1.8zM12 5.3c1 .7 1.8 1.9 2.3 3.5H9.7c.5-1.6 1.3-2.9 2.3-3.5zM10 5c-.8 1-1.4 2.3-1.8 3.8H5.5C6.4 7 8 5.6 10 5zM5.5 15.3h2.6c.4 1.5 1 2.8 1.8 3.7-1.8-.6-3.5-2-4.4-3.7zM14 19c.8-1 1.4-2.2 1.8-3.7h2.6C17.6 17 16 18.4 14 19z" 37497 }) 37498 }); 37499 /* harmony default export */ const library_globe = (globe); 37500 37501 ;// ./node_modules/@wordpress/icons/build-module/library/comment-author-avatar.js 37502 /** 37503 * WordPress dependencies 37504 */ 37505 37506 37507 const commentAuthorAvatar = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 37508 xmlns: "http://www.w3.org/2000/svg", 37509 viewBox: "0 0 24 24", 37510 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 37511 fillRule: "evenodd", 37512 d: "M7.25 16.437a6.5 6.5 0 1 1 9.5 0V16A2.75 2.75 0 0 0 14 13.25h-4A2.75 2.75 0 0 0 7.25 16v.437Zm1.5 1.193a6.47 6.47 0 0 0 3.25.87 6.47 6.47 0 0 0 3.25-.87V16c0-.69-.56-1.25-1.25-1.25h-4c-.69 0-1.25.56-1.25 1.25v1.63ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm10-2a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z", 37513 clipRule: "evenodd" 37514 }) 37515 }); 37516 /* harmony default export */ const comment_author_avatar = (commentAuthorAvatar); 37517 37518 ;// ./node_modules/@wordpress/edit-site/build-module/components/page-templates/hooks.js 37519 /** 37520 * WordPress dependencies 37521 */ 37522 37523 37524 37525 37526 /** 37527 * Internal dependencies 37528 */ 37529 37530 37531 /** @typedef {'wp_template'|'wp_template_part'} TemplateType */ 37532 37533 /** 37534 * @typedef {'theme'|'plugin'|'site'|'user'} AddedByType 37535 * 37536 * @typedef AddedByData 37537 * @type {Object} 37538 * @property {AddedByType} type The type of the data. 37539 * @property {JSX.Element} icon The icon to display. 37540 * @property {string} [imageUrl] The optional image URL to display. 37541 * @property {string} [text] The text to display. 37542 * @property {boolean} isCustomized Whether the template has been customized. 37543 * 37544 * @param {TemplateType} postType The template post type. 37545 * @param {number} postId The template post id. 37546 * @return {AddedByData} The added by object or null. 37547 */ 37548 function useAddedBy(postType, postId) { 37549 return (0,external_wp_data_namespaceObject.useSelect)(select => { 37550 const { 37551 getEntityRecord, 37552 getMedia, 37553 getUser, 37554 getEditedEntityRecord 37555 } = select(external_wp_coreData_namespaceObject.store); 37556 const template = getEditedEntityRecord('postType', postType, postId); 37557 const originalSource = template?.original_source; 37558 const authorText = template?.author_text; 37559 switch (originalSource) { 37560 case 'theme': 37561 { 37562 return { 37563 type: originalSource, 37564 icon: library_layout, 37565 text: authorText, 37566 isCustomized: template.source === TEMPLATE_ORIGINS.custom 37567 }; 37568 } 37569 case 'plugin': 37570 { 37571 return { 37572 type: originalSource, 37573 icon: library_plugins, 37574 text: authorText, 37575 isCustomized: template.source === TEMPLATE_ORIGINS.custom 37576 }; 37577 } 37578 case 'site': 37579 { 37580 const siteData = getEntityRecord('root', '__unstableBase'); 37581 return { 37582 type: originalSource, 37583 icon: library_globe, 37584 imageUrl: siteData?.site_logo ? getMedia(siteData.site_logo)?.source_url : undefined, 37585 text: authorText, 37586 isCustomized: false 37587 }; 37588 } 37589 default: 37590 { 37591 const user = getUser(template.author); 37592 return { 37593 type: 'user', 37594 icon: comment_author_avatar, 37595 imageUrl: user?.avatar_urls?.[48], 37596 text: authorText, 37597 isCustomized: false 37598 }; 37599 } 37600 } 37601 }, [postType, postId]); 37602 } 37603 37604 ;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/fields.js 37605 /** 37606 * External dependencies 37607 */ 37608 37609 37610 /** 37611 * WordPress dependencies 37612 */ 37613 37614 37615 37616 37617 37618 37619 37620 /** 37621 * Internal dependencies 37622 */ 37623 37624 37625 37626 37627 const { 37628 useGlobalStyle: fields_useGlobalStyle 37629 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 37630 function PreviewField({ 37631 item 37632 }) { 37633 const descriptionId = (0,external_wp_element_namespaceObject.useId)(); 37634 const description = item.description || item?.excerpt?.raw; 37635 const isTemplatePart = item.type === TEMPLATE_PART_POST_TYPE; 37636 const [backgroundColor] = fields_useGlobalStyle('color.background'); 37637 const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => { 37638 var _item$blocks; 37639 return (_item$blocks = item.blocks) !== null && _item$blocks !== void 0 ? _item$blocks : (0,external_wp_blocks_namespaceObject.parse)(item.content.raw, { 37640 __unstableSkipMigrationLogs: true 37641 }); 37642 }, [item?.content?.raw, item.blocks]); 37643 const isEmpty = !blocks?.length; 37644 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 37645 className: "page-patterns-preview-field", 37646 style: { 37647 backgroundColor 37648 }, 37649 "aria-describedby": !!description ? descriptionId : undefined, 37650 children: [isEmpty && isTemplatePart && (0,external_wp_i18n_namespaceObject.__)('Empty template part'), isEmpty && !isTemplatePart && (0,external_wp_i18n_namespaceObject.__)('Empty pattern'), !isEmpty && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockPreview.Async, { 37651 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockPreview, { 37652 blocks: blocks, 37653 viewportWidth: item.viewportWidth 37654 }) 37655 }), !!description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 37656 hidden: true, 37657 id: descriptionId, 37658 children: description 37659 })] 37660 }); 37661 } 37662 const previewField = { 37663 label: (0,external_wp_i18n_namespaceObject.__)('Preview'), 37664 id: 'preview', 37665 render: PreviewField, 37666 enableSorting: false 37667 }; 37668 const SYNC_FILTERS = [{ 37669 value: PATTERN_SYNC_TYPES.full, 37670 label: (0,external_wp_i18n_namespaceObject._x)('Synced', 'pattern (singular)'), 37671 description: (0,external_wp_i18n_namespaceObject.__)('Patterns that are kept in sync across the site.') 37672 }, { 37673 value: PATTERN_SYNC_TYPES.unsynced, 37674 label: (0,external_wp_i18n_namespaceObject._x)('Not synced', 'pattern (singular)'), 37675 description: (0,external_wp_i18n_namespaceObject.__)('Patterns that can be changed freely without affecting the site.') 37676 }]; 37677 const patternStatusField = { 37678 label: (0,external_wp_i18n_namespaceObject.__)('Sync status'), 37679 id: 'sync-status', 37680 render: ({ 37681 item 37682 }) => { 37683 const syncStatus = 'wp_pattern_sync_status' in item ? item.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full : PATTERN_SYNC_TYPES.unsynced; 37684 // User patterns can have their sync statuses checked directly. 37685 // Non-user patterns are all unsynced for the time being. 37686 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 37687 className: `edit-site-patterns__field-sync-status-$syncStatus}`, 37688 children: SYNC_FILTERS.find(({ 37689 value 37690 }) => value === syncStatus).label 37691 }); 37692 }, 37693 elements: SYNC_FILTERS, 37694 filterBy: { 37695 operators: [OPERATOR_IS], 37696 isPrimary: true 37697 }, 37698 enableSorting: false 37699 }; 37700 function AuthorField({ 37701 item 37702 }) { 37703 const [isImageLoaded, setIsImageLoaded] = (0,external_wp_element_namespaceObject.useState)(false); 37704 const { 37705 text, 37706 icon, 37707 imageUrl 37708 } = useAddedBy(item.type, item.id); 37709 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 37710 alignment: "left", 37711 spacing: 0, 37712 children: [imageUrl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 37713 className: dist_clsx('page-templates-author-field__avatar', { 37714 'is-loaded': isImageLoaded 37715 }), 37716 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 37717 onLoad: () => setIsImageLoaded(true), 37718 alt: "", 37719 src: imageUrl 37720 }) 37721 }), !imageUrl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 37722 className: "page-templates-author-field__icon", 37723 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { 37724 icon: icon 37725 }) 37726 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 37727 className: "page-templates-author-field__name", 37728 children: text 37729 })] 37730 }); 37731 } 37732 const templatePartAuthorField = { 37733 label: (0,external_wp_i18n_namespaceObject.__)('Author'), 37734 id: 'author', 37735 getValue: ({ 37736 item 37737 }) => item.author_text, 37738 render: AuthorField, 37739 filterBy: { 37740 isPrimary: true 37741 } 37742 }; 37743 37744 ;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/index.js 37745 /** 37746 * WordPress dependencies 37747 */ 37748 37749 37750 37751 37752 37753 37754 37755 37756 37757 /** 37758 * Internal dependencies 37759 */ 37760 37761 37762 37763 37764 37765 37766 37767 37768 37769 const { 37770 ExperimentalBlockEditorProvider: page_patterns_ExperimentalBlockEditorProvider 37771 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 37772 const { 37773 usePostActions, 37774 patternTitleField 37775 } = unlock(external_wp_editor_namespaceObject.privateApis); 37776 const { 37777 useLocation: page_patterns_useLocation, 37778 useHistory: page_patterns_useHistory 37779 } = unlock(external_wp_router_namespaceObject.privateApis); 37780 const page_patterns_EMPTY_ARRAY = []; 37781 const defaultLayouts = { 37782 [LAYOUT_TABLE]: { 37783 layout: { 37784 styles: { 37785 author: { 37786 width: '1%' 37787 } 37788 } 37789 } 37790 }, 37791 [LAYOUT_GRID]: { 37792 layout: { 37793 badgeFields: ['sync-status'] 37794 } 37795 } 37796 }; 37797 const DEFAULT_VIEW = { 37798 type: LAYOUT_GRID, 37799 search: '', 37800 page: 1, 37801 perPage: 20, 37802 titleField: 'title', 37803 mediaField: 'preview', 37804 fields: ['sync-status'], 37805 filters: [], 37806 ...defaultLayouts[LAYOUT_GRID] 37807 }; 37808 function DataviewsPatterns() { 37809 const { 37810 query: { 37811 postType = 'wp_block', 37812 categoryId: categoryIdFromURL 37813 } 37814 } = page_patterns_useLocation(); 37815 const history = page_patterns_useHistory(); 37816 const categoryId = categoryIdFromURL || PATTERN_DEFAULT_CATEGORY; 37817 const [view, setView] = (0,external_wp_element_namespaceObject.useState)(DEFAULT_VIEW); 37818 const previousCategoryId = (0,external_wp_compose_namespaceObject.usePrevious)(categoryId); 37819 const previousPostType = (0,external_wp_compose_namespaceObject.usePrevious)(postType); 37820 const viewSyncStatus = view.filters?.find(({ 37821 field 37822 }) => field === 'sync-status')?.value; 37823 const { 37824 patterns, 37825 isResolving 37826 } = use_patterns(postType, categoryId, { 37827 search: view.search, 37828 syncStatus: viewSyncStatus 37829 }); 37830 const { 37831 records 37832 } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', TEMPLATE_PART_POST_TYPE, { 37833 per_page: -1 37834 }); 37835 const authors = (0,external_wp_element_namespaceObject.useMemo)(() => { 37836 if (!records) { 37837 return page_patterns_EMPTY_ARRAY; 37838 } 37839 const authorsSet = new Set(); 37840 records.forEach(template => { 37841 authorsSet.add(template.author_text); 37842 }); 37843 return Array.from(authorsSet).map(author => ({ 37844 value: author, 37845 label: author 37846 })); 37847 }, [records]); 37848 const fields = (0,external_wp_element_namespaceObject.useMemo)(() => { 37849 const _fields = [previewField, patternTitleField]; 37850 if (postType === PATTERN_TYPES.user) { 37851 _fields.push(patternStatusField); 37852 } else if (postType === TEMPLATE_PART_POST_TYPE) { 37853 _fields.push({ 37854 ...templatePartAuthorField, 37855 elements: authors 37856 }); 37857 } 37858 return _fields; 37859 }, [postType, authors]); 37860 37861 // Reset the page number when the category changes. 37862 (0,external_wp_element_namespaceObject.useEffect)(() => { 37863 if (previousCategoryId !== categoryId || previousPostType !== postType) { 37864 setView(prevView => ({ 37865 ...prevView, 37866 page: 1 37867 })); 37868 } 37869 }, [categoryId, previousCategoryId, previousPostType, postType]); 37870 const { 37871 data, 37872 paginationInfo 37873 } = (0,external_wp_element_namespaceObject.useMemo)(() => { 37874 // Search is managed server-side as well as filters for patterns. 37875 // However, the author filter in template parts is done client-side. 37876 const viewWithoutFilters = { 37877 ...view 37878 }; 37879 delete viewWithoutFilters.search; 37880 if (postType !== TEMPLATE_PART_POST_TYPE) { 37881 viewWithoutFilters.filters = []; 37882 } 37883 return filterSortAndPaginate(patterns, viewWithoutFilters, fields); 37884 }, [patterns, view, fields, postType]); 37885 const dataWithPermissions = useAugmentPatternsWithPermissions(data); 37886 const templatePartActions = usePostActions({ 37887 postType: TEMPLATE_PART_POST_TYPE, 37888 context: 'list' 37889 }); 37890 const patternActions = usePostActions({ 37891 postType: PATTERN_TYPES.user, 37892 context: 'list' 37893 }); 37894 const editAction = useEditPostAction(); 37895 const actions = (0,external_wp_element_namespaceObject.useMemo)(() => { 37896 if (postType === TEMPLATE_PART_POST_TYPE) { 37897 return [editAction, ...templatePartActions].filter(Boolean); 37898 } 37899 return [editAction, ...patternActions].filter(Boolean); 37900 }, [editAction, postType, templatePartActions, patternActions]); 37901 const id = (0,external_wp_element_namespaceObject.useId)(); 37902 const settings = usePatternSettings(); 37903 // Wrap everything in a block editor provider. 37904 // This ensures 'styles' that are needed for the previews are synced 37905 // from the site editor store to the block editor store. 37906 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(page_patterns_ExperimentalBlockEditorProvider, { 37907 settings: settings, 37908 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Page, { 37909 title: (0,external_wp_i18n_namespaceObject.__)('Patterns content'), 37910 className: "edit-site-page-patterns-dataviews", 37911 hideTitleFromUI: true, 37912 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternsHeader, { 37913 categoryId: categoryId, 37914 type: postType, 37915 titleId: `$id}-title`, 37916 descriptionId: `$id}-description` 37917 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViews, { 37918 paginationInfo: paginationInfo, 37919 fields: fields, 37920 actions: actions, 37921 data: dataWithPermissions || page_patterns_EMPTY_ARRAY, 37922 getItemId: item => { 37923 var _item$name; 37924 return (_item$name = item.name) !== null && _item$name !== void 0 ? _item$name : item.id; 37925 }, 37926 isLoading: isResolving, 37927 isItemClickable: item => item.type !== PATTERN_TYPES.theme, 37928 onClickItem: item => { 37929 history.navigate(`/$item.type}/${[PATTERN_TYPES.user, TEMPLATE_PART_POST_TYPE].includes(item.type) ? item.id : item.name}?canvas=edit`); 37930 }, 37931 view: view, 37932 onChangeView: setView, 37933 defaultLayouts: defaultLayouts 37934 }, categoryId + postType)] 37935 }) 37936 }); 37937 } 37938 37939 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/patterns.js 37940 /** 37941 * Internal dependencies 37942 */ 37943 37944 37945 37946 37947 const patternsRoute = { 37948 name: 'patterns', 37949 path: '/pattern', 37950 areas: { 37951 sidebar({ 37952 siteData 37953 }) { 37954 const isBlockTheme = siteData.currentTheme?.is_block_theme; 37955 const backPath = isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? '/' : undefined; 37956 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenPatterns, { 37957 backPath: backPath 37958 }); 37959 }, 37960 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataviewsPatterns, {}), 37961 mobile({ 37962 siteData, 37963 query 37964 }) { 37965 const { 37966 categoryId 37967 } = query; 37968 const isBlockTheme = siteData.currentTheme?.is_block_theme; 37969 const backPath = isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? '/' : undefined; 37970 return !!categoryId ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataviewsPatterns, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenPatterns, { 37971 backPath: backPath 37972 }); 37973 } 37974 } 37975 }; 37976 37977 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/pattern-item.js 37978 /** 37979 * Internal dependencies 37980 */ 37981 37982 37983 37984 37985 const patternItemRoute = { 37986 name: 'pattern-item', 37987 path: '/wp_block/:postId', 37988 areas: { 37989 sidebar({ 37990 siteData 37991 }) { 37992 const isBlockTheme = siteData.currentTheme?.is_block_theme; 37993 const backPath = isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? '/' : undefined; 37994 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenPatterns, { 37995 backPath: backPath 37996 }); 37997 }, 37998 mobile: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}), 37999 preview: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) 38000 } 38001 }; 38002 38003 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/template-part-item.js 38004 /** 38005 * Internal dependencies 38006 */ 38007 38008 38009 38010 const templatePartItemRoute = { 38011 name: 'template-part-item', 38012 path: '/wp_template_part/*postId', 38013 areas: { 38014 sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenPatterns, { 38015 backPath: "/" 38016 }), 38017 mobile: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}), 38018 preview: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) 38019 } 38020 }; 38021 38022 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-templates-browse/content.js 38023 /** 38024 * WordPress dependencies 38025 */ 38026 38027 38028 38029 38030 38031 38032 38033 /** 38034 * Internal dependencies 38035 */ 38036 38037 38038 38039 38040 38041 38042 const { 38043 useLocation: content_useLocation 38044 } = unlock(external_wp_router_namespaceObject.privateApis); 38045 const content_EMPTY_ARRAY = []; 38046 function TemplateDataviewItem({ 38047 template, 38048 isActive 38049 }) { 38050 const { 38051 text, 38052 icon 38053 } = useAddedBy(template.type, template.id); 38054 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 38055 to: (0,external_wp_url_namespaceObject.addQueryArgs)('/template', { 38056 activeView: text 38057 }), 38058 icon: icon, 38059 "aria-current": isActive, 38060 children: text 38061 }); 38062 } 38063 function DataviewsTemplatesSidebarContent() { 38064 const { 38065 query: { 38066 activeView = 'all' 38067 } 38068 } = content_useLocation(); 38069 const { 38070 records 38071 } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', TEMPLATE_POST_TYPE, { 38072 per_page: -1 38073 }); 38074 const firstItemPerAuthorText = (0,external_wp_element_namespaceObject.useMemo)(() => { 38075 var _ref; 38076 const firstItemPerAuthor = records?.reduce((acc, template) => { 38077 const author = template.author_text; 38078 if (author && !acc[author]) { 38079 acc[author] = template; 38080 } 38081 return acc; 38082 }, {}); 38083 return (_ref = firstItemPerAuthor && Object.values(firstItemPerAuthor)) !== null && _ref !== void 0 ? _ref : content_EMPTY_ARRAY; 38084 }, [records]); 38085 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { 38086 className: "edit-site-sidebar-navigation-screen-templates-browse", 38087 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 38088 to: "/template", 38089 icon: library_layout, 38090 "aria-current": activeView === 'all', 38091 children: (0,external_wp_i18n_namespaceObject.__)('All templates') 38092 }), firstItemPerAuthorText.map(template => { 38093 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplateDataviewItem, { 38094 template: template, 38095 isActive: activeView === template.author_text 38096 }, template.author_text); 38097 })] 38098 }); 38099 } 38100 38101 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-templates-browse/index.js 38102 /** 38103 * WordPress dependencies 38104 */ 38105 38106 38107 /** 38108 * Internal dependencies 38109 */ 38110 38111 38112 38113 function SidebarNavigationScreenTemplatesBrowse({ 38114 backPath 38115 }) { 38116 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { 38117 title: (0,external_wp_i18n_namespaceObject.__)('Templates'), 38118 description: (0,external_wp_i18n_namespaceObject.__)('Create new templates, or reset any customizations made to the templates supplied by your theme.'), 38119 backPath: backPath, 38120 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataviewsTemplatesSidebarContent, {}) 38121 }); 38122 } 38123 38124 ;// ./node_modules/@wordpress/icons/build-module/library/home.js 38125 /** 38126 * WordPress dependencies 38127 */ 38128 38129 38130 const home = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 38131 xmlns: "http://www.w3.org/2000/svg", 38132 viewBox: "0 0 24 24", 38133 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 38134 d: "M12 4L4 7.9V20h16V7.9L12 4zm6.5 14.5H14V13h-4v5.5H5.5V8.8L12 5.7l6.5 3.1v9.7z" 38135 }) 38136 }); 38137 /* harmony default export */ const library_home = (home); 38138 38139 ;// ./node_modules/@wordpress/icons/build-module/library/verse.js 38140 /** 38141 * WordPress dependencies 38142 */ 38143 38144 38145 const verse = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 38146 viewBox: "0 0 24 24", 38147 xmlns: "http://www.w3.org/2000/svg", 38148 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 38149 d: "M17.8 2l-.9.3c-.1 0-3.6 1-5.2 2.1C10 5.5 9.3 6.5 8.9 7.1c-.6.9-1.7 4.7-1.7 6.3l-.9 2.3c-.2.4 0 .8.4 1 .1 0 .2.1.3.1.3 0 .6-.2.7-.5l.6-1.5c.3 0 .7-.1 1.2-.2.7-.1 1.4-.3 2.2-.5.8-.2 1.6-.5 2.4-.8.7-.3 1.4-.7 1.9-1.2s.8-1.2 1-1.9c.2-.7.3-1.6.4-2.4.1-.8.1-1.7.2-2.5 0-.8.1-1.5.2-2.1V2zm-1.9 5.6c-.1.8-.2 1.5-.3 2.1-.2.6-.4 1-.6 1.3-.3.3-.8.6-1.4.9-.7.3-1.4.5-2.2.8-.6.2-1.3.3-1.8.4L15 7.5c.3-.3.6-.7 1-1.1 0 .4 0 .8-.1 1.2zM6 20h8v-1.5H6V20z" 38150 }) 38151 }); 38152 /* harmony default export */ const library_verse = (verse); 38153 38154 ;// ./node_modules/@wordpress/icons/build-module/library/pin.js 38155 /** 38156 * WordPress dependencies 38157 */ 38158 38159 38160 const pin = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 38161 xmlns: "http://www.w3.org/2000/svg", 38162 viewBox: "0 0 24 24", 38163 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 38164 d: "m21.5 9.1-6.6-6.6-4.2 5.6c-1.2-.1-2.4.1-3.6.7-.1 0-.1.1-.2.1-.5.3-.9.6-1.2.9l3.7 3.7-5.7 5.7v1.1h1.1l5.7-5.7 3.7 3.7c.4-.4.7-.8.9-1.2.1-.1.1-.2.2-.3.6-1.1.8-2.4.6-3.6l5.6-4.1zm-7.3 3.5.1.9c.1.9 0 1.8-.4 2.6l-6-6c.8-.4 1.7-.5 2.6-.4l.9.1L15 4.9 19.1 9l-4.9 3.6z" 38165 }) 38166 }); 38167 /* harmony default export */ const library_pin = (pin); 38168 38169 ;// ./node_modules/@wordpress/icons/build-module/library/archive.js 38170 /** 38171 * WordPress dependencies 38172 */ 38173 38174 38175 const archive = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 38176 viewBox: "0 0 24 24", 38177 xmlns: "http://www.w3.org/2000/svg", 38178 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 38179 fillRule: "evenodd", 38180 clipRule: "evenodd", 38181 d: "M11.934 7.406a1 1 0 0 0 .914.594H19a.5.5 0 0 1 .5.5v9a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5h5.764a.5.5 0 0 1 .447.276l.723 1.63Zm1.064-1.216a.5.5 0 0 0 .462.31H19a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h5.764a2 2 0 0 1 1.789 1.106l.445 1.084ZM8.5 10.5h7V12h-7v-1.5Zm7 3.5h-7v1.5h7V14Z" 38182 }) 38183 }); 38184 /* harmony default export */ const library_archive = (archive); 38185 38186 ;// ./node_modules/@wordpress/icons/build-module/library/not-found.js 38187 /** 38188 * WordPress dependencies 38189 */ 38190 38191 38192 const notFound = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 38193 xmlns: "http://www.w3.org/2000/svg", 38194 viewBox: "0 0 24 24", 38195 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 38196 d: "M19 5H5c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm.5 12c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V7c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v10zm-11-7.6h-.7l-3.1 4.3h2.8V15h1v-1.3h.7v-.8h-.7V9.4zm-.9 3.5H6.3l1.2-1.7v1.7zm5.6-3.2c-.4-.2-.8-.4-1.2-.4-.5 0-.9.1-1.2.4-.4.2-.6.6-.8 1-.2.4-.3.9-.3 1.5s.1 1.1.3 1.6c.2.4.5.8.8 1 .4.2.8.4 1.2.4.5 0 .9-.1 1.2-.4.4-.2.6-.6.8-1 .2-.4.3-1 .3-1.6 0-.6-.1-1.1-.3-1.5-.1-.5-.4-.8-.8-1zm0 3.6c-.1.3-.3.5-.5.7-.2.1-.4.2-.7.2-.3 0-.5-.1-.7-.2-.2-.1-.4-.4-.5-.7-.1-.3-.2-.7-.2-1.2 0-.7.1-1.2.4-1.5.3-.3.6-.5 1-.5s.7.2 1 .5c.3.3.4.8.4 1.5-.1.5-.1.9-.2 1.2zm5-3.9h-.7l-3.1 4.3h2.8V15h1v-1.3h.7v-.8h-.7V9.4zm-1 3.5H16l1.2-1.7v1.7z" 38197 }) 38198 }); 38199 /* harmony default export */ const not_found = (notFound); 38200 38201 ;// ./node_modules/@wordpress/icons/build-module/library/list.js 38202 /** 38203 * WordPress dependencies 38204 */ 38205 38206 38207 const list = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 38208 viewBox: "0 0 24 24", 38209 xmlns: "http://www.w3.org/2000/svg", 38210 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 38211 d: "M4 4v1.5h16V4H4zm8 8.5h8V11h-8v1.5zM4 20h16v-1.5H4V20zm4-8c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2z" 38212 }) 38213 }); 38214 /* harmony default export */ const library_list = (list); 38215 38216 ;// ./node_modules/@wordpress/icons/build-module/library/block-meta.js 38217 /** 38218 * WordPress dependencies 38219 */ 38220 38221 38222 const blockMeta = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 38223 xmlns: "http://www.w3.org/2000/svg", 38224 viewBox: "0 0 24 24", 38225 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 38226 fillRule: "evenodd", 38227 d: "M8.95 11.25H4v1.5h4.95v4.5H13V18c0 1.1.9 2 2 2h3c1.1 0 2-.9 2-2v-3c0-1.1-.9-2-2-2h-3c-1.1 0-2 .9-2 2v.75h-2.55v-7.5H13V9c0 1.1.9 2 2 2h3c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-3c-1.1 0-2 .9-2 2v.75H8.95v4.5ZM14.5 15v3c0 .3.2.5.5.5h3c.3 0 .5-.2.5-.5v-3c0-.3-.2-.5-.5-.5h-3c-.3 0-.5.2-.5.5Zm0-6V6c0-.3.2-.5.5-.5h3c.3 0 .5.2.5.5v3c0 .3-.2.5-.5.5h-3c-.3 0-.5-.2-.5-.5Z", 38228 clipRule: "evenodd" 38229 }) 38230 }); 38231 /* harmony default export */ const block_meta = (blockMeta); 38232 38233 ;// ./node_modules/@wordpress/icons/build-module/library/calendar.js 38234 /** 38235 * WordPress dependencies 38236 */ 38237 38238 38239 const calendar = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 38240 viewBox: "0 0 24 24", 38241 xmlns: "http://www.w3.org/2000/svg", 38242 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 38243 d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm.5 16c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V7h15v12zM9 10H7v2h2v-2zm0 4H7v2h2v-2zm4-4h-2v2h2v-2zm4 0h-2v2h2v-2zm-4 4h-2v2h2v-2zm4 0h-2v2h2v-2z" 38244 }) 38245 }); 38246 /* harmony default export */ const library_calendar = (calendar); 38247 38248 ;// ./node_modules/@wordpress/icons/build-module/library/tag.js 38249 /** 38250 * WordPress dependencies 38251 */ 38252 38253 38254 const tag = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 38255 xmlns: "http://www.w3.org/2000/svg", 38256 viewBox: "0 0 24 24", 38257 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 38258 d: "M4.75 4a.75.75 0 0 0-.75.75v7.826c0 .2.08.39.22.53l6.72 6.716a2.313 2.313 0 0 0 3.276-.001l5.61-5.611-.531-.53.532.528a2.315 2.315 0 0 0 0-3.264L13.104 4.22a.75.75 0 0 0-.53-.22H4.75ZM19 12.576a.815.815 0 0 1-.236.574l-5.61 5.611a.814.814 0 0 1-1.153 0L5.5 12.264V5.5h6.763l6.5 6.502a.816.816 0 0 1 .237.574ZM8.75 9.75a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z" 38259 }) 38260 }); 38261 /* harmony default export */ const library_tag = (tag); 38262 38263 ;// ./node_modules/@wordpress/icons/build-module/library/media.js 38264 /** 38265 * WordPress dependencies 38266 */ 38267 38268 38269 const media = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { 38270 xmlns: "http://www.w3.org/2000/svg", 38271 viewBox: "0 0 24 24", 38272 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 38273 d: "m7 6.5 4 2.5-4 2.5z" 38274 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 38275 fillRule: "evenodd", 38276 clipRule: "evenodd", 38277 d: "m5 3c-1.10457 0-2 .89543-2 2v14c0 1.1046.89543 2 2 2h14c1.1046 0 2-.8954 2-2v-14c0-1.10457-.8954-2-2-2zm14 1.5h-14c-.27614 0-.5.22386-.5.5v10.7072l3.62953-2.6465c.25108-.1831.58905-.1924.84981-.0234l2.92666 1.8969 3.5712-3.4719c.2911-.2831.7545-.2831 1.0456 0l2.9772 2.8945v-9.3568c0-.27614-.2239-.5-.5-.5zm-14.5 14.5v-1.4364l4.09643-2.987 2.99567 1.9417c.2936.1903.6798.1523.9307-.0917l3.4772-3.3806 3.4772 3.3806.0228-.0234v2.5968c0 .2761-.2239.5-.5.5h-14c-.27614 0-.5-.2239-.5-.5z" 38278 })] 38279 }); 38280 /* harmony default export */ const library_media = (media); 38281 38282 ;// ./node_modules/@wordpress/icons/build-module/library/post.js 38283 /** 38284 * WordPress dependencies 38285 */ 38286 38287 38288 const post_post = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 38289 xmlns: "http://www.w3.org/2000/svg", 38290 viewBox: "0 0 24 24", 38291 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 38292 d: "m7.3 9.7 1.4 1.4c.2-.2.3-.3.4-.5 0 0 0-.1.1-.1.3-.5.4-1.1.3-1.6L12 7 9 4 7.2 6.5c-.6-.1-1.1 0-1.6.3 0 0-.1 0-.1.1-.3.1-.4.2-.6.4l1.4 1.4L4 11v1h1l2.3-2.3zM4 20h9v-1.5H4V20zm0-5.5V16h16v-1.5H4z" 38293 }) 38294 }); 38295 /* harmony default export */ const library_post = (post_post); 38296 38297 ;// ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/utils.js 38298 /** 38299 * WordPress dependencies 38300 */ 38301 38302 38303 38304 38305 38306 38307 38308 /** 38309 * Internal dependencies 38310 */ 38311 38312 const EMPTY_OBJECT = {}; 38313 38314 /** 38315 * @typedef IHasNameAndId 38316 * @property {string|number} id The entity's id. 38317 * @property {string} name The entity's name. 38318 */ 38319 38320 const utils_getValueFromObjectPath = (object, path) => { 38321 let value = object; 38322 path.split('.').forEach(fieldName => { 38323 value = value?.[fieldName]; 38324 }); 38325 return value; 38326 }; 38327 38328 /** 38329 * Helper util to map records to add a `name` prop from a 38330 * provided path, in order to handle all entities in the same 38331 * fashion(implementing`IHasNameAndId` interface). 38332 * 38333 * @param {Object[]} entities The array of entities. 38334 * @param {string} path The path to map a `name` property from the entity. 38335 * @return {IHasNameAndId[]} An array of entities that now implement the `IHasNameAndId` interface. 38336 */ 38337 const mapToIHasNameAndId = (entities, path) => { 38338 return (entities || []).map(entity => ({ 38339 ...entity, 38340 name: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(utils_getValueFromObjectPath(entity, path)) 38341 })); 38342 }; 38343 38344 /** 38345 * @typedef {Object} EntitiesInfo 38346 * @property {boolean} hasEntities If an entity has available records(posts, terms, etc..). 38347 * @property {number[]} existingEntitiesIds An array of the existing entities ids. 38348 */ 38349 38350 const useExistingTemplates = () => { 38351 return (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', TEMPLATE_POST_TYPE, { 38352 per_page: -1 38353 }), []); 38354 }; 38355 const useDefaultTemplateTypes = () => { 38356 return (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.default_template_types || [], []); 38357 }; 38358 const usePublicPostTypes = () => { 38359 const postTypes = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPostTypes({ 38360 per_page: -1 38361 }), []); 38362 return (0,external_wp_element_namespaceObject.useMemo)(() => { 38363 const excludedPostTypes = ['attachment']; 38364 return postTypes?.filter(({ 38365 viewable, 38366 slug 38367 }) => viewable && !excludedPostTypes.includes(slug)); 38368 }, [postTypes]); 38369 }; 38370 const usePublicTaxonomies = () => { 38371 const taxonomies = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getTaxonomies({ 38372 per_page: -1 38373 }), []); 38374 return (0,external_wp_element_namespaceObject.useMemo)(() => { 38375 return taxonomies?.filter(({ 38376 visibility 38377 }) => visibility?.publicly_queryable); 38378 }, [taxonomies]); 38379 }; 38380 function usePostTypeArchiveMenuItems() { 38381 const publicPostTypes = usePublicPostTypes(); 38382 const postTypesWithArchives = (0,external_wp_element_namespaceObject.useMemo)(() => publicPostTypes?.filter(postType => postType.has_archive), [publicPostTypes]); 38383 const existingTemplates = useExistingTemplates(); 38384 // We need to keep track of naming conflicts. If a conflict 38385 // occurs, we need to add slug. 38386 const postTypeLabels = (0,external_wp_element_namespaceObject.useMemo)(() => publicPostTypes?.reduce((accumulator, { 38387 labels 38388 }) => { 38389 const singularName = labels.singular_name.toLowerCase(); 38390 accumulator[singularName] = (accumulator[singularName] || 0) + 1; 38391 return accumulator; 38392 }, {}), [publicPostTypes]); 38393 const needsUniqueIdentifier = (0,external_wp_element_namespaceObject.useCallback)(({ 38394 labels, 38395 slug 38396 }) => { 38397 const singularName = labels.singular_name.toLowerCase(); 38398 return postTypeLabels[singularName] > 1 && singularName !== slug; 38399 }, [postTypeLabels]); 38400 return (0,external_wp_element_namespaceObject.useMemo)(() => postTypesWithArchives?.filter(postType => !(existingTemplates || []).some(existingTemplate => existingTemplate.slug === 'archive-' + postType.slug)).map(postType => { 38401 let title; 38402 if (needsUniqueIdentifier(postType)) { 38403 title = (0,external_wp_i18n_namespaceObject.sprintf)( 38404 // translators: %1s: Name of the post type e.g: "Post"; %2s: Slug of the post type e.g: "book". 38405 (0,external_wp_i18n_namespaceObject.__)('Archive: %1$s (%2$s)'), postType.labels.singular_name, postType.slug); 38406 } else { 38407 title = (0,external_wp_i18n_namespaceObject.sprintf)( 38408 // translators: %s: Name of the post type e.g: "Post". 38409 (0,external_wp_i18n_namespaceObject.__)('Archive: %s'), postType.labels.singular_name); 38410 } 38411 return { 38412 slug: 'archive-' + postType.slug, 38413 description: (0,external_wp_i18n_namespaceObject.sprintf)( 38414 // translators: %s: Name of the post type e.g: "Post". 38415 (0,external_wp_i18n_namespaceObject.__)('Displays an archive with the latest posts of type: %s.'), postType.labels.singular_name), 38416 title, 38417 // `icon` is the `menu_icon` property of a post type. We 38418 // only handle `dashicons` for now, even if the `menu_icon` 38419 // also supports urls and svg as values. 38420 icon: typeof postType.icon === 'string' && postType.icon.startsWith('dashicons-') ? postType.icon.slice(10) : library_archive, 38421 templatePrefix: 'archive' 38422 }; 38423 }) || [], [postTypesWithArchives, existingTemplates, needsUniqueIdentifier]); 38424 } 38425 const usePostTypeMenuItems = onClickMenuItem => { 38426 const publicPostTypes = usePublicPostTypes(); 38427 const existingTemplates = useExistingTemplates(); 38428 const defaultTemplateTypes = useDefaultTemplateTypes(); 38429 // We need to keep track of naming conflicts. If a conflict 38430 // occurs, we need to add slug. 38431 const templateLabels = (0,external_wp_element_namespaceObject.useMemo)(() => publicPostTypes?.reduce((accumulator, { 38432 labels 38433 }) => { 38434 const templateName = (labels.template_name || labels.singular_name).toLowerCase(); 38435 accumulator[templateName] = (accumulator[templateName] || 0) + 1; 38436 return accumulator; 38437 }, {}), [publicPostTypes]); 38438 const needsUniqueIdentifier = (0,external_wp_element_namespaceObject.useCallback)(({ 38439 labels, 38440 slug 38441 }) => { 38442 const templateName = (labels.template_name || labels.singular_name).toLowerCase(); 38443 return templateLabels[templateName] > 1 && templateName !== slug; 38444 }, [templateLabels]); 38445 38446 // `page`is a special case in template hierarchy. 38447 const templatePrefixes = (0,external_wp_element_namespaceObject.useMemo)(() => publicPostTypes?.reduce((accumulator, { 38448 slug 38449 }) => { 38450 let suffix = slug; 38451 if (slug !== 'page') { 38452 suffix = `single-$suffix}`; 38453 } 38454 accumulator[slug] = suffix; 38455 return accumulator; 38456 }, {}), [publicPostTypes]); 38457 const postTypesInfo = useEntitiesInfo('postType', templatePrefixes); 38458 const existingTemplateSlugs = (existingTemplates || []).map(({ 38459 slug 38460 }) => slug); 38461 const menuItems = (publicPostTypes || []).reduce((accumulator, postType) => { 38462 const { 38463 slug, 38464 labels, 38465 icon 38466 } = postType; 38467 // We need to check if the general template is part of the 38468 // defaultTemplateTypes. If it is, just use that info and 38469 // augment it with the specific template functionality. 38470 const generalTemplateSlug = templatePrefixes[slug]; 38471 const defaultTemplateType = defaultTemplateTypes?.find(({ 38472 slug: _slug 38473 }) => _slug === generalTemplateSlug); 38474 const hasGeneralTemplate = existingTemplateSlugs?.includes(generalTemplateSlug); 38475 const _needsUniqueIdentifier = needsUniqueIdentifier(postType); 38476 let menuItemTitle = labels.template_name || (0,external_wp_i18n_namespaceObject.sprintf)( 38477 // translators: %s: Name of the post type e.g: "Post". 38478 (0,external_wp_i18n_namespaceObject.__)('Single item: %s'), labels.singular_name); 38479 if (_needsUniqueIdentifier) { 38480 menuItemTitle = labels.template_name ? (0,external_wp_i18n_namespaceObject.sprintf)( 38481 // translators: 1: Name of the template e.g: "Single Item: Post". 2: Slug of the post type e.g: "book". 38482 (0,external_wp_i18n_namespaceObject._x)('%1$s (%2$s)', 'post type menu label'), labels.template_name, slug) : (0,external_wp_i18n_namespaceObject.sprintf)( 38483 // translators: 1: Name of the post type e.g: "Post". 2: Slug of the post type e.g: "book". 38484 (0,external_wp_i18n_namespaceObject._x)('Single item: %1$s (%2$s)', 'post type menu label'), labels.singular_name, slug); 38485 } 38486 const menuItem = defaultTemplateType ? { 38487 ...defaultTemplateType, 38488 templatePrefix: templatePrefixes[slug] 38489 } : { 38490 slug: generalTemplateSlug, 38491 title: menuItemTitle, 38492 description: (0,external_wp_i18n_namespaceObject.sprintf)( 38493 // translators: %s: Name of the post type e.g: "Post". 38494 (0,external_wp_i18n_namespaceObject.__)('Displays a single item: %s.'), labels.singular_name), 38495 // `icon` is the `menu_icon` property of a post type. We 38496 // only handle `dashicons` for now, even if the `menu_icon` 38497 // also supports urls and svg as values. 38498 icon: typeof icon === 'string' && icon.startsWith('dashicons-') ? icon.slice(10) : library_post, 38499 templatePrefix: templatePrefixes[slug] 38500 }; 38501 const hasEntities = postTypesInfo?.[slug]?.hasEntities; 38502 // We have a different template creation flow only if they have entities. 38503 if (hasEntities) { 38504 menuItem.onClick = template => { 38505 onClickMenuItem({ 38506 type: 'postType', 38507 slug, 38508 config: { 38509 recordNamePath: 'title.rendered', 38510 queryArgs: ({ 38511 search 38512 }) => { 38513 return { 38514 _fields: 'id,title,slug,link', 38515 orderBy: search ? 'relevance' : 'modified', 38516 exclude: postTypesInfo[slug].existingEntitiesIds 38517 }; 38518 }, 38519 getSpecificTemplate: suggestion => { 38520 const templateSlug = `$templatePrefixes[slug]}-$suggestion.slug}`; 38521 return { 38522 title: templateSlug, 38523 slug: templateSlug, 38524 templatePrefix: templatePrefixes[slug] 38525 }; 38526 } 38527 }, 38528 labels, 38529 hasGeneralTemplate, 38530 template 38531 }); 38532 }; 38533 } 38534 // We don't need to add the menu item if there are no 38535 // entities and the general template exists. 38536 if (!hasGeneralTemplate || hasEntities) { 38537 accumulator.push(menuItem); 38538 } 38539 return accumulator; 38540 }, []); 38541 // Split menu items into two groups: one for the default post types 38542 // and one for the rest. 38543 const postTypesMenuItems = (0,external_wp_element_namespaceObject.useMemo)(() => menuItems.reduce((accumulator, postType) => { 38544 const { 38545 slug 38546 } = postType; 38547 let key = 'postTypesMenuItems'; 38548 if (slug === 'page') { 38549 key = 'defaultPostTypesMenuItems'; 38550 } 38551 accumulator[key].push(postType); 38552 return accumulator; 38553 }, { 38554 defaultPostTypesMenuItems: [], 38555 postTypesMenuItems: [] 38556 }), [menuItems]); 38557 return postTypesMenuItems; 38558 }; 38559 const useTaxonomiesMenuItems = onClickMenuItem => { 38560 const publicTaxonomies = usePublicTaxonomies(); 38561 const existingTemplates = useExistingTemplates(); 38562 const defaultTemplateTypes = useDefaultTemplateTypes(); 38563 // `category` and `post_tag` are special cases in template hierarchy. 38564 const templatePrefixes = (0,external_wp_element_namespaceObject.useMemo)(() => publicTaxonomies?.reduce((accumulator, { 38565 slug 38566 }) => { 38567 let suffix = slug; 38568 if (!['category', 'post_tag'].includes(slug)) { 38569 suffix = `taxonomy-$suffix}`; 38570 } 38571 if (slug === 'post_tag') { 38572 suffix = `tag`; 38573 } 38574 accumulator[slug] = suffix; 38575 return accumulator; 38576 }, {}), [publicTaxonomies]); 38577 // We need to keep track of naming conflicts. If a conflict 38578 // occurs, we need to add slug. 38579 const taxonomyLabels = publicTaxonomies?.reduce((accumulator, { 38580 labels 38581 }) => { 38582 const templateName = (labels.template_name || labels.singular_name).toLowerCase(); 38583 accumulator[templateName] = (accumulator[templateName] || 0) + 1; 38584 return accumulator; 38585 }, {}); 38586 const needsUniqueIdentifier = (labels, slug) => { 38587 if (['category', 'post_tag'].includes(slug)) { 38588 return false; 38589 } 38590 const templateName = (labels.template_name || labels.singular_name).toLowerCase(); 38591 return taxonomyLabels[templateName] > 1 && templateName !== slug; 38592 }; 38593 const taxonomiesInfo = useEntitiesInfo('taxonomy', templatePrefixes); 38594 const existingTemplateSlugs = (existingTemplates || []).map(({ 38595 slug 38596 }) => slug); 38597 const menuItems = (publicTaxonomies || []).reduce((accumulator, taxonomy) => { 38598 const { 38599 slug, 38600 labels 38601 } = taxonomy; 38602 // We need to check if the general template is part of the 38603 // defaultTemplateTypes. If it is, just use that info and 38604 // augment it with the specific template functionality. 38605 const generalTemplateSlug = templatePrefixes[slug]; 38606 const defaultTemplateType = defaultTemplateTypes?.find(({ 38607 slug: _slug 38608 }) => _slug === generalTemplateSlug); 38609 const hasGeneralTemplate = existingTemplateSlugs?.includes(generalTemplateSlug); 38610 const _needsUniqueIdentifier = needsUniqueIdentifier(labels, slug); 38611 let menuItemTitle = labels.template_name || labels.singular_name; 38612 if (_needsUniqueIdentifier) { 38613 menuItemTitle = labels.template_name ? (0,external_wp_i18n_namespaceObject.sprintf)( 38614 // translators: 1: Name of the template e.g: "Products by Category". 2s: Slug of the taxonomy e.g: "product_cat". 38615 (0,external_wp_i18n_namespaceObject._x)('%1$s (%2$s)', 'taxonomy template menu label'), labels.template_name, slug) : (0,external_wp_i18n_namespaceObject.sprintf)( 38616 // translators: 1: Name of the taxonomy e.g: "Category". 2: Slug of the taxonomy e.g: "product_cat". 38617 (0,external_wp_i18n_namespaceObject._x)('%1$s (%2$s)', 'taxonomy menu label'), labels.singular_name, slug); 38618 } 38619 const menuItem = defaultTemplateType ? { 38620 ...defaultTemplateType, 38621 templatePrefix: templatePrefixes[slug] 38622 } : { 38623 slug: generalTemplateSlug, 38624 title: menuItemTitle, 38625 description: (0,external_wp_i18n_namespaceObject.sprintf)( 38626 // translators: %s: Name of the taxonomy e.g: "Product Categories". 38627 (0,external_wp_i18n_namespaceObject.__)('Displays taxonomy: %s.'), labels.singular_name), 38628 icon: block_meta, 38629 templatePrefix: templatePrefixes[slug] 38630 }; 38631 const hasEntities = taxonomiesInfo?.[slug]?.hasEntities; 38632 // We have a different template creation flow only if they have entities. 38633 if (hasEntities) { 38634 menuItem.onClick = template => { 38635 onClickMenuItem({ 38636 type: 'taxonomy', 38637 slug, 38638 config: { 38639 queryArgs: ({ 38640 search 38641 }) => { 38642 return { 38643 _fields: 'id,name,slug,link', 38644 orderBy: search ? 'name' : 'count', 38645 exclude: taxonomiesInfo[slug].existingEntitiesIds 38646 }; 38647 }, 38648 getSpecificTemplate: suggestion => { 38649 const templateSlug = `$templatePrefixes[slug]}-$suggestion.slug}`; 38650 return { 38651 title: templateSlug, 38652 slug: templateSlug, 38653 templatePrefix: templatePrefixes[slug] 38654 }; 38655 } 38656 }, 38657 labels, 38658 hasGeneralTemplate, 38659 template 38660 }); 38661 }; 38662 } 38663 // We don't need to add the menu item if there are no 38664 // entities and the general template exists. 38665 if (!hasGeneralTemplate || hasEntities) { 38666 accumulator.push(menuItem); 38667 } 38668 return accumulator; 38669 }, []); 38670 // Split menu items into two groups: one for the default taxonomies 38671 // and one for the rest. 38672 const taxonomiesMenuItems = (0,external_wp_element_namespaceObject.useMemo)(() => menuItems.reduce((accumulator, taxonomy) => { 38673 const { 38674 slug 38675 } = taxonomy; 38676 let key = 'taxonomiesMenuItems'; 38677 if (['category', 'tag'].includes(slug)) { 38678 key = 'defaultTaxonomiesMenuItems'; 38679 } 38680 accumulator[key].push(taxonomy); 38681 return accumulator; 38682 }, { 38683 defaultTaxonomiesMenuItems: [], 38684 taxonomiesMenuItems: [] 38685 }), [menuItems]); 38686 return taxonomiesMenuItems; 38687 }; 38688 const USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX = { 38689 user: 'author' 38690 }; 38691 const USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS = { 38692 user: { 38693 who: 'authors' 38694 } 38695 }; 38696 function useAuthorMenuItem(onClickMenuItem) { 38697 const existingTemplates = useExistingTemplates(); 38698 const defaultTemplateTypes = useDefaultTemplateTypes(); 38699 const authorInfo = useEntitiesInfo('root', USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX, USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS); 38700 let authorMenuItem = defaultTemplateTypes?.find(({ 38701 slug 38702 }) => slug === 'author'); 38703 if (!authorMenuItem) { 38704 authorMenuItem = { 38705 description: (0,external_wp_i18n_namespaceObject.__)('Displays latest posts written by a single author.'), 38706 slug: 'author', 38707 title: 'Author' 38708 }; 38709 } 38710 const hasGeneralTemplate = !!existingTemplates?.find(({ 38711 slug 38712 }) => slug === 'author'); 38713 if (authorInfo.user?.hasEntities) { 38714 authorMenuItem = { 38715 ...authorMenuItem, 38716 templatePrefix: 'author' 38717 }; 38718 authorMenuItem.onClick = template => { 38719 onClickMenuItem({ 38720 type: 'root', 38721 slug: 'user', 38722 config: { 38723 queryArgs: ({ 38724 search 38725 }) => { 38726 return { 38727 _fields: 'id,name,slug,link', 38728 orderBy: search ? 'name' : 'registered_date', 38729 exclude: authorInfo.user.existingEntitiesIds, 38730 who: 'authors' 38731 }; 38732 }, 38733 getSpecificTemplate: suggestion => { 38734 const templateSlug = `author-$suggestion.slug}`; 38735 return { 38736 title: templateSlug, 38737 slug: templateSlug, 38738 templatePrefix: 'author' 38739 }; 38740 } 38741 }, 38742 labels: { 38743 singular_name: (0,external_wp_i18n_namespaceObject.__)('Author'), 38744 search_items: (0,external_wp_i18n_namespaceObject.__)('Search Authors'), 38745 not_found: (0,external_wp_i18n_namespaceObject.__)('No authors found.'), 38746 all_items: (0,external_wp_i18n_namespaceObject.__)('All Authors') 38747 }, 38748 hasGeneralTemplate, 38749 template 38750 }); 38751 }; 38752 } 38753 if (!hasGeneralTemplate || authorInfo.user?.hasEntities) { 38754 return authorMenuItem; 38755 } 38756 } 38757 38758 /** 38759 * Helper hook that filters all the existing templates by the given 38760 * object with the entity's slug as key and the template prefix as value. 38761 * 38762 * Example: 38763 * `existingTemplates` is: [ { slug: 'tag-apple' }, { slug: 'page-about' }, { slug: 'tag' } ] 38764 * `templatePrefixes` is: { post_tag: 'tag' } 38765 * It will return: { post_tag: ['apple'] } 38766 * 38767 * Note: We append the `-` to the given template prefix in this function for our checks. 38768 * 38769 * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value. 38770 * @return {Record<string,string[]>} An object with the entity's slug as key and an array with the existing template slugs as value. 38771 */ 38772 const useExistingTemplateSlugs = templatePrefixes => { 38773 const existingTemplates = useExistingTemplates(); 38774 const existingSlugs = (0,external_wp_element_namespaceObject.useMemo)(() => { 38775 return Object.entries(templatePrefixes || {}).reduce((accumulator, [slug, prefix]) => { 38776 const slugsWithTemplates = (existingTemplates || []).reduce((_accumulator, existingTemplate) => { 38777 const _prefix = `$prefix}-`; 38778 if (existingTemplate.slug.startsWith(_prefix)) { 38779 _accumulator.push(existingTemplate.slug.substring(_prefix.length)); 38780 } 38781 return _accumulator; 38782 }, []); 38783 if (slugsWithTemplates.length) { 38784 accumulator[slug] = slugsWithTemplates; 38785 } 38786 return accumulator; 38787 }, {}); 38788 }, [templatePrefixes, existingTemplates]); 38789 return existingSlugs; 38790 }; 38791 38792 /** 38793 * Helper hook that finds the existing records with an associated template, 38794 * as they need to be excluded from the template suggestions. 38795 * 38796 * @param {string} entityName The entity's name. 38797 * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value. 38798 * @param {Record<string,Object>} additionalQueryParameters An object with the entity's slug as key and additional query parameters as value. 38799 * @return {Record<string,EntitiesInfo>} An object with the entity's slug as key and the existing records as value. 38800 */ 38801 const useTemplatesToExclude = (entityName, templatePrefixes, additionalQueryParameters = {}) => { 38802 const slugsToExcludePerEntity = useExistingTemplateSlugs(templatePrefixes); 38803 const recordsToExcludePerEntity = (0,external_wp_data_namespaceObject.useSelect)(select => { 38804 return Object.entries(slugsToExcludePerEntity || {}).reduce((accumulator, [slug, slugsWithTemplates]) => { 38805 const entitiesWithTemplates = select(external_wp_coreData_namespaceObject.store).getEntityRecords(entityName, slug, { 38806 _fields: 'id', 38807 context: 'view', 38808 slug: slugsWithTemplates, 38809 ...additionalQueryParameters[slug] 38810 }); 38811 if (entitiesWithTemplates?.length) { 38812 accumulator[slug] = entitiesWithTemplates; 38813 } 38814 return accumulator; 38815 }, {}); 38816 }, [slugsToExcludePerEntity]); 38817 return recordsToExcludePerEntity; 38818 }; 38819 38820 /** 38821 * Helper hook that returns information about an entity having 38822 * records that we can create a specific template for. 38823 * 38824 * For example we can search for `terms` in `taxonomy` entity or 38825 * `posts` in `postType` entity. 38826 * 38827 * First we need to find the existing records with an associated template, 38828 * to query afterwards for any remaining record, by excluding them. 38829 * 38830 * @param {string} entityName The entity's name. 38831 * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value. 38832 * @param {Record<string,Object>} additionalQueryParameters An object with the entity's slug as key and additional query parameters as value. 38833 * @return {Record<string,EntitiesInfo>} An object with the entity's slug as key and the EntitiesInfo as value. 38834 */ 38835 const useEntitiesInfo = (entityName, templatePrefixes, additionalQueryParameters = EMPTY_OBJECT) => { 38836 const recordsToExcludePerEntity = useTemplatesToExclude(entityName, templatePrefixes, additionalQueryParameters); 38837 const entitiesHasRecords = (0,external_wp_data_namespaceObject.useSelect)(select => { 38838 return Object.keys(templatePrefixes || {}).reduce((accumulator, slug) => { 38839 const existingEntitiesIds = recordsToExcludePerEntity?.[slug]?.map(({ 38840 id 38841 }) => id) || []; 38842 accumulator[slug] = !!select(external_wp_coreData_namespaceObject.store).getEntityRecords(entityName, slug, { 38843 per_page: 1, 38844 _fields: 'id', 38845 context: 'view', 38846 exclude: existingEntitiesIds, 38847 ...additionalQueryParameters[slug] 38848 })?.length; 38849 return accumulator; 38850 }, {}); 38851 }, [templatePrefixes, recordsToExcludePerEntity, entityName, additionalQueryParameters]); 38852 const entitiesInfo = (0,external_wp_element_namespaceObject.useMemo)(() => { 38853 return Object.keys(templatePrefixes || {}).reduce((accumulator, slug) => { 38854 const existingEntitiesIds = recordsToExcludePerEntity?.[slug]?.map(({ 38855 id 38856 }) => id) || []; 38857 accumulator[slug] = { 38858 hasEntities: entitiesHasRecords[slug], 38859 existingEntitiesIds 38860 }; 38861 return accumulator; 38862 }, {}); 38863 }, [templatePrefixes, recordsToExcludePerEntity, entitiesHasRecords]); 38864 return entitiesInfo; 38865 }; 38866 38867 ;// ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/add-custom-template-modal-content.js 38868 /** 38869 * WordPress dependencies 38870 */ 38871 38872 38873 38874 38875 38876 38877 38878 /** 38879 * Internal dependencies 38880 */ 38881 38882 38883 const add_custom_template_modal_content_EMPTY_ARRAY = []; 38884 function SuggestionListItem({ 38885 suggestion, 38886 search, 38887 onSelect, 38888 entityForSuggestions 38889 }) { 38890 const baseCssClass = 'edit-site-custom-template-modal__suggestions_list__list-item'; 38891 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Composite.Item, { 38892 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 38893 __next40pxDefaultSize: true, 38894 role: "option", 38895 className: baseCssClass, 38896 onClick: () => onSelect(entityForSuggestions.config.getSpecificTemplate(suggestion)) 38897 }), 38898 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 38899 size: "body", 38900 lineHeight: 1.53846153846 // 20px 38901 , 38902 weight: 500, 38903 className: `$baseCssClass}__title`, 38904 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextHighlight, { 38905 text: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(suggestion.name), 38906 highlight: search 38907 }) 38908 }), suggestion.link && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 38909 size: "body", 38910 lineHeight: 1.53846153846 // 20px 38911 , 38912 className: `$baseCssClass}__info`, 38913 children: suggestion.link 38914 })] 38915 }); 38916 } 38917 function useSearchSuggestions(entityForSuggestions, search) { 38918 const { 38919 config 38920 } = entityForSuggestions; 38921 const query = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 38922 order: 'asc', 38923 context: 'view', 38924 search, 38925 per_page: search ? 20 : 10, 38926 ...config.queryArgs(search) 38927 }), [search, config]); 38928 const { 38929 records: searchResults, 38930 hasResolved: searchHasResolved 38931 } = (0,external_wp_coreData_namespaceObject.useEntityRecords)(entityForSuggestions.type, entityForSuggestions.slug, query); 38932 const [suggestions, setSuggestions] = (0,external_wp_element_namespaceObject.useState)(add_custom_template_modal_content_EMPTY_ARRAY); 38933 (0,external_wp_element_namespaceObject.useEffect)(() => { 38934 if (!searchHasResolved) { 38935 return; 38936 } 38937 let newSuggestions = add_custom_template_modal_content_EMPTY_ARRAY; 38938 if (searchResults?.length) { 38939 newSuggestions = searchResults; 38940 if (config.recordNamePath) { 38941 newSuggestions = mapToIHasNameAndId(newSuggestions, config.recordNamePath); 38942 } 38943 } 38944 // Update suggestions only when the query has resolved, so as to keep 38945 // the previous results in the UI. 38946 setSuggestions(newSuggestions); 38947 }, [searchResults, searchHasResolved]); 38948 return suggestions; 38949 } 38950 function SuggestionList({ 38951 entityForSuggestions, 38952 onSelect 38953 }) { 38954 const [search, setSearch, debouncedSearch] = (0,external_wp_compose_namespaceObject.useDebouncedInput)(); 38955 const suggestions = useSearchSuggestions(entityForSuggestions, debouncedSearch); 38956 const { 38957 labels 38958 } = entityForSuggestions; 38959 const [showSearchControl, setShowSearchControl] = (0,external_wp_element_namespaceObject.useState)(false); 38960 if (!showSearchControl && suggestions?.length > 9) { 38961 setShowSearchControl(true); 38962 } 38963 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 38964 children: [showSearchControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SearchControl, { 38965 __nextHasNoMarginBottom: true, 38966 onChange: setSearch, 38967 value: search, 38968 label: labels.search_items, 38969 placeholder: labels.search_items 38970 }), !!suggestions?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite, { 38971 orientation: "vertical", 38972 role: "listbox", 38973 className: "edit-site-custom-template-modal__suggestions_list", 38974 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Suggestions list'), 38975 children: suggestions.map(suggestion => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SuggestionListItem, { 38976 suggestion: suggestion, 38977 search: debouncedSearch, 38978 onSelect: onSelect, 38979 entityForSuggestions: entityForSuggestions 38980 }, suggestion.slug)) 38981 }), debouncedSearch && !suggestions?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 38982 as: "p", 38983 className: "edit-site-custom-template-modal__no-results", 38984 children: labels.not_found 38985 })] 38986 }); 38987 } 38988 function AddCustomTemplateModalContent({ 38989 onSelect, 38990 entityForSuggestions 38991 }) { 38992 const [showSearchEntities, setShowSearchEntities] = (0,external_wp_element_namespaceObject.useState)(entityForSuggestions.hasGeneralTemplate); 38993 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 38994 spacing: 4, 38995 className: "edit-site-custom-template-modal__contents-wrapper", 38996 alignment: "left", 38997 children: [!showSearchEntities && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 38998 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 38999 as: "p", 39000 children: (0,external_wp_i18n_namespaceObject.__)('Select whether to create a single template for all items or a specific one.') 39001 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 39002 className: "edit-site-custom-template-modal__contents", 39003 gap: "4", 39004 align: "initial", 39005 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.FlexItem, { 39006 isBlock: true, 39007 as: external_wp_components_namespaceObject.Button, 39008 onClick: () => { 39009 const { 39010 slug, 39011 title, 39012 description, 39013 templatePrefix 39014 } = entityForSuggestions.template; 39015 onSelect({ 39016 slug, 39017 title, 39018 description, 39019 templatePrefix 39020 }); 39021 }, 39022 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 39023 as: "span", 39024 weight: 500, 39025 lineHeight: 1.53846153846 // 20px 39026 , 39027 children: entityForSuggestions.labels.all_items 39028 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 39029 as: "span", 39030 lineHeight: 1.53846153846 // 20px 39031 , 39032 children: 39033 // translators: The user is given the choice to set up a template for all items of a post type or taxonomy, or just a specific one. 39034 (0,external_wp_i18n_namespaceObject.__)('For all items') 39035 })] 39036 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.FlexItem, { 39037 isBlock: true, 39038 as: external_wp_components_namespaceObject.Button, 39039 onClick: () => { 39040 setShowSearchEntities(true); 39041 }, 39042 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 39043 as: "span", 39044 weight: 500, 39045 lineHeight: 1.53846153846 // 20px 39046 , 39047 children: entityForSuggestions.labels.singular_name 39048 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 39049 as: "span", 39050 lineHeight: 1.53846153846 // 20px 39051 , 39052 children: 39053 // translators: The user is given the choice to set up a template for all items of a post type or taxonomy, or just a specific one. 39054 (0,external_wp_i18n_namespaceObject.__)('For a specific item') 39055 })] 39056 })] 39057 })] 39058 }), showSearchEntities && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 39059 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 39060 as: "p", 39061 children: (0,external_wp_i18n_namespaceObject.__)('This template will be used only for the specific item chosen.') 39062 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SuggestionList, { 39063 entityForSuggestions: entityForSuggestions, 39064 onSelect: onSelect 39065 })] 39066 })] 39067 }); 39068 } 39069 /* harmony default export */ const add_custom_template_modal_content = (AddCustomTemplateModalContent); 39070 39071 ;// ./node_modules/tslib/tslib.es6.mjs 39072 /****************************************************************************** 39073 Copyright (c) Microsoft Corporation. 39074 39075 Permission to use, copy, modify, and/or distribute this software for any 39076 purpose with or without fee is hereby granted. 39077 39078 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 39079 REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 39080 AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 39081 INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 39082 LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 39083 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 39084 PERFORMANCE OF THIS SOFTWARE. 39085 ***************************************************************************** */ 39086 /* global Reflect, Promise, SuppressedError, Symbol, Iterator */ 39087 39088 var extendStatics = function(d, b) { 39089 extendStatics = Object.setPrototypeOf || 39090 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 39091 function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; 39092 return extendStatics(d, b); 39093 }; 39094 39095 function __extends(d, b) { 39096 if (typeof b !== "function" && b !== null) 39097 throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 39098 extendStatics(d, b); 39099 function __() { this.constructor = d; } 39100 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 39101 } 39102 39103 var __assign = function() { 39104 __assign = Object.assign || function __assign(t) { 39105 for (var s, i = 1, n = arguments.length; i < n; i++) { 39106 s = arguments[i]; 39107 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 39108 } 39109 return t; 39110 } 39111 return __assign.apply(this, arguments); 39112 } 39113 39114 function __rest(s, e) { 39115 var t = {}; 39116 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) 39117 t[p] = s[p]; 39118 if (s != null && typeof Object.getOwnPropertySymbols === "function") 39119 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { 39120 if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) 39121 t[p[i]] = s[p[i]]; 39122 } 39123 return t; 39124 } 39125 39126 function __decorate(decorators, target, key, desc) { 39127 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 39128 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 39129 else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 39130 return c > 3 && r && Object.defineProperty(target, key, r), r; 39131 } 39132 39133 function __param(paramIndex, decorator) { 39134 return function (target, key) { decorator(target, key, paramIndex); } 39135 } 39136 39137 function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { 39138 function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } 39139 var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; 39140 var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; 39141 var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); 39142 var _, done = false; 39143 for (var i = decorators.length - 1; i >= 0; i--) { 39144 var context = {}; 39145 for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; 39146 for (var p in contextIn.access) context.access[p] = contextIn.access[p]; 39147 context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; 39148 var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); 39149 if (kind === "accessor") { 39150 if (result === void 0) continue; 39151 if (result === null || typeof result !== "object") throw new TypeError("Object expected"); 39152 if (_ = accept(result.get)) descriptor.get = _; 39153 if (_ = accept(result.set)) descriptor.set = _; 39154 if (_ = accept(result.init)) initializers.unshift(_); 39155 } 39156 else if (_ = accept(result)) { 39157 if (kind === "field") initializers.unshift(_); 39158 else descriptor[key] = _; 39159 } 39160 } 39161 if (target) Object.defineProperty(target, contextIn.name, descriptor); 39162 done = true; 39163 }; 39164 39165 function __runInitializers(thisArg, initializers, value) { 39166 var useValue = arguments.length > 2; 39167 for (var i = 0; i < initializers.length; i++) { 39168 value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); 39169 } 39170 return useValue ? value : void 0; 39171 }; 39172 39173 function __propKey(x) { 39174 return typeof x === "symbol" ? x : "".concat(x); 39175 }; 39176 39177 function __setFunctionName(f, name, prefix) { 39178 if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; 39179 return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); 39180 }; 39181 39182 function __metadata(metadataKey, metadataValue) { 39183 if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); 39184 } 39185 39186 function __awaiter(thisArg, _arguments, P, generator) { 39187 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 39188 return new (P || (P = Promise))(function (resolve, reject) { 39189 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 39190 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 39191 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 39192 step((generator = generator.apply(thisArg, _arguments || [])).next()); 39193 }); 39194 } 39195 39196 function __generator(thisArg, body) { 39197 var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); 39198 return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; 39199 function verb(n) { return function (v) { return step([n, v]); }; } 39200 function step(op) { 39201 if (f) throw new TypeError("Generator is already executing."); 39202 while (g && (g = 0, op[0] && (_ = 0)), _) try { 39203 if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; 39204 if (y = 0, t) op = [op[0] & 2, t.value]; 39205 switch (op[0]) { 39206 case 0: case 1: t = op; break; 39207 case 4: _.label++; return { value: op[1], done: false }; 39208 case 5: _.label++; y = op[1]; op = [0]; continue; 39209 case 7: op = _.ops.pop(); _.trys.pop(); continue; 39210 default: 39211 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } 39212 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } 39213 if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } 39214 if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } 39215 if (t[2]) _.ops.pop(); 39216 _.trys.pop(); continue; 39217 } 39218 op = body.call(thisArg, _); 39219 } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } 39220 if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; 39221 } 39222 } 39223 39224 var __createBinding = Object.create ? (function(o, m, k, k2) { 39225 if (k2 === undefined) k2 = k; 39226 var desc = Object.getOwnPropertyDescriptor(m, k); 39227 if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { 39228 desc = { enumerable: true, get: function() { return m[k]; } }; 39229 } 39230 Object.defineProperty(o, k2, desc); 39231 }) : (function(o, m, k, k2) { 39232 if (k2 === undefined) k2 = k; 39233 o[k2] = m[k]; 39234 }); 39235 39236 function __exportStar(m, o) { 39237 for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); 39238 } 39239 39240 function __values(o) { 39241 var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; 39242 if (m) return m.call(o); 39243 if (o && typeof o.length === "number") return { 39244 next: function () { 39245 if (o && i >= o.length) o = void 0; 39246 return { value: o && o[i++], done: !o }; 39247 } 39248 }; 39249 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); 39250 } 39251 39252 function __read(o, n) { 39253 var m = typeof Symbol === "function" && o[Symbol.iterator]; 39254 if (!m) return o; 39255 var i = m.call(o), r, ar = [], e; 39256 try { 39257 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); 39258 } 39259 catch (error) { e = { error: error }; } 39260 finally { 39261 try { 39262 if (r && !r.done && (m = i["return"])) m.call(i); 39263 } 39264 finally { if (e) throw e.error; } 39265 } 39266 return ar; 39267 } 39268 39269 /** @deprecated */ 39270 function __spread() { 39271 for (var ar = [], i = 0; i < arguments.length; i++) 39272 ar = ar.concat(__read(arguments[i])); 39273 return ar; 39274 } 39275 39276 /** @deprecated */ 39277 function __spreadArrays() { 39278 for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; 39279 for (var r = Array(s), k = 0, i = 0; i < il; i++) 39280 for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) 39281 r[k] = a[j]; 39282 return r; 39283 } 39284 39285 function __spreadArray(to, from, pack) { 39286 if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { 39287 if (ar || !(i in from)) { 39288 if (!ar) ar = Array.prototype.slice.call(from, 0, i); 39289 ar[i] = from[i]; 39290 } 39291 } 39292 return to.concat(ar || Array.prototype.slice.call(from)); 39293 } 39294 39295 function __await(v) { 39296 return this instanceof __await ? (this.v = v, this) : new __await(v); 39297 } 39298 39299 function __asyncGenerator(thisArg, _arguments, generator) { 39300 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); 39301 var g = generator.apply(thisArg, _arguments || []), i, q = []; 39302 return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; 39303 function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } 39304 function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } } 39305 function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } 39306 function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } 39307 function fulfill(value) { resume("next", value); } 39308 function reject(value) { resume("throw", value); } 39309 function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } 39310 } 39311 39312 function __asyncDelegator(o) { 39313 var i, p; 39314 return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; 39315 function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; } 39316 } 39317 39318 function __asyncValues(o) { 39319 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); 39320 var m = o[Symbol.asyncIterator], i; 39321 return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); 39322 function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } 39323 function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } 39324 } 39325 39326 function __makeTemplateObject(cooked, raw) { 39327 if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } 39328 return cooked; 39329 }; 39330 39331 var __setModuleDefault = Object.create ? (function(o, v) { 39332 Object.defineProperty(o, "default", { enumerable: true, value: v }); 39333 }) : function(o, v) { 39334 o["default"] = v; 39335 }; 39336 39337 var ownKeys = function(o) { 39338 ownKeys = Object.getOwnPropertyNames || function (o) { 39339 var ar = []; 39340 for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; 39341 return ar; 39342 }; 39343 return ownKeys(o); 39344 }; 39345 39346 function __importStar(mod) { 39347 if (mod && mod.__esModule) return mod; 39348 var result = {}; 39349 if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); 39350 __setModuleDefault(result, mod); 39351 return result; 39352 } 39353 39354 function __importDefault(mod) { 39355 return (mod && mod.__esModule) ? mod : { default: mod }; 39356 } 39357 39358 function __classPrivateFieldGet(receiver, state, kind, f) { 39359 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); 39360 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); 39361 return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); 39362 } 39363 39364 function __classPrivateFieldSet(receiver, state, value, kind, f) { 39365 if (kind === "m") throw new TypeError("Private method is not writable"); 39366 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); 39367 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); 39368 return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; 39369 } 39370 39371 function __classPrivateFieldIn(state, receiver) { 39372 if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); 39373 return typeof state === "function" ? receiver === state : state.has(receiver); 39374 } 39375 39376 function __addDisposableResource(env, value, async) { 39377 if (value !== null && value !== void 0) { 39378 if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); 39379 var dispose, inner; 39380 if (async) { 39381 if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); 39382 dispose = value[Symbol.asyncDispose]; 39383 } 39384 if (dispose === void 0) { 39385 if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); 39386 dispose = value[Symbol.dispose]; 39387 if (async) inner = dispose; 39388 } 39389 if (typeof dispose !== "function") throw new TypeError("Object not disposable."); 39390 if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; 39391 env.stack.push({ value: value, dispose: dispose, async: async }); 39392 } 39393 else if (async) { 39394 env.stack.push({ async: true }); 39395 } 39396 return value; 39397 } 39398 39399 var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { 39400 var e = new Error(message); 39401 return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; 39402 }; 39403 39404 function __disposeResources(env) { 39405 function fail(e) { 39406 env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; 39407 env.hasError = true; 39408 } 39409 var r, s = 0; 39410 function next() { 39411 while (r = env.stack.pop()) { 39412 try { 39413 if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); 39414 if (r.dispose) { 39415 var result = r.dispose.call(r.value); 39416 if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); 39417 } 39418 else s |= 1; 39419 } 39420 catch (e) { 39421 fail(e); 39422 } 39423 } 39424 if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); 39425 if (env.hasError) throw env.error; 39426 } 39427 return next(); 39428 } 39429 39430 function __rewriteRelativeImportExtension(path, preserveJsx) { 39431 if (typeof path === "string" && /^\.\.?\//.test(path)) { 39432 return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) { 39433 return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js"); 39434 }); 39435 } 39436 return path; 39437 } 39438 39439 /* harmony default export */ const tslib_es6 = ({ 39440 __extends, 39441 __assign, 39442 __rest, 39443 __decorate, 39444 __param, 39445 __esDecorate, 39446 __runInitializers, 39447 __propKey, 39448 __setFunctionName, 39449 __metadata, 39450 __awaiter, 39451 __generator, 39452 __createBinding, 39453 __exportStar, 39454 __values, 39455 __read, 39456 __spread, 39457 __spreadArrays, 39458 __spreadArray, 39459 __await, 39460 __asyncGenerator, 39461 __asyncDelegator, 39462 __asyncValues, 39463 __makeTemplateObject, 39464 __importStar, 39465 __importDefault, 39466 __classPrivateFieldGet, 39467 __classPrivateFieldSet, 39468 __classPrivateFieldIn, 39469 __addDisposableResource, 39470 __disposeResources, 39471 __rewriteRelativeImportExtension, 39472 }); 39473 39474 ;// ./node_modules/lower-case/dist.es2015/index.js 39475 /** 39476 * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt 39477 */ 39478 var SUPPORTED_LOCALE = { 39479 tr: { 39480 regexp: /\u0130|\u0049|\u0049\u0307/g, 39481 map: { 39482 İ: "\u0069", 39483 I: "\u0131", 39484 İ: "\u0069", 39485 }, 39486 }, 39487 az: { 39488 regexp: /\u0130/g, 39489 map: { 39490 İ: "\u0069", 39491 I: "\u0131", 39492 İ: "\u0069", 39493 }, 39494 }, 39495 lt: { 39496 regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g, 39497 map: { 39498 I: "\u0069\u0307", 39499 J: "\u006A\u0307", 39500 Į: "\u012F\u0307", 39501 Ì: "\u0069\u0307\u0300", 39502 Í: "\u0069\u0307\u0301", 39503 Ĩ: "\u0069\u0307\u0303", 39504 }, 39505 }, 39506 }; 39507 /** 39508 * Localized lower case. 39509 */ 39510 function localeLowerCase(str, locale) { 39511 var lang = SUPPORTED_LOCALE[locale.toLowerCase()]; 39512 if (lang) 39513 return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; })); 39514 return lowerCase(str); 39515 } 39516 /** 39517 * Lower case as a function. 39518 */ 39519 function lowerCase(str) { 39520 return str.toLowerCase(); 39521 } 39522 39523 ;// ./node_modules/no-case/dist.es2015/index.js 39524 39525 // Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case"). 39526 var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g]; 39527 // Remove all non-word characters. 39528 var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi; 39529 /** 39530 * Normalize the string into something other libraries can manipulate easier. 39531 */ 39532 function noCase(input, options) { 39533 if (options === void 0) { options = {}; } 39534 var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d; 39535 var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0"); 39536 var start = 0; 39537 var end = result.length; 39538 // Trim the delimiter from around the output string. 39539 while (result.charAt(start) === "\0") 39540 start++; 39541 while (result.charAt(end - 1) === "\0") 39542 end--; 39543 // Transform each token independently. 39544 return result.slice(start, end).split("\0").map(transform).join(delimiter); 39545 } 39546 /** 39547 * Replace `re` in the input string with the replacement value. 39548 */ 39549 function replace(input, re, value) { 39550 if (re instanceof RegExp) 39551 return input.replace(re, value); 39552 return re.reduce(function (input, re) { return input.replace(re, value); }, input); 39553 } 39554 39555 ;// ./node_modules/dot-case/dist.es2015/index.js 39556 39557 39558 function dotCase(input, options) { 39559 if (options === void 0) { options = {}; } 39560 return noCase(input, __assign({ delimiter: "." }, options)); 39561 } 39562 39563 ;// ./node_modules/param-case/dist.es2015/index.js 39564 39565 39566 function paramCase(input, options) { 39567 if (options === void 0) { options = {}; } 39568 return dotCase(input, __assign({ delimiter: "-" }, options)); 39569 } 39570 39571 ;// ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/add-custom-generic-template-modal-content.js 39572 /** 39573 * External dependencies 39574 */ 39575 39576 39577 /** 39578 * WordPress dependencies 39579 */ 39580 39581 39582 39583 39584 function AddCustomGenericTemplateModalContent({ 39585 onClose, 39586 createTemplate 39587 }) { 39588 const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(''); 39589 const defaultTitle = (0,external_wp_i18n_namespaceObject.__)('Custom Template'); 39590 const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false); 39591 async function onCreateTemplate(event) { 39592 event.preventDefault(); 39593 if (isBusy) { 39594 return; 39595 } 39596 setIsBusy(true); 39597 try { 39598 await createTemplate({ 39599 slug: 'wp-custom-template-' + paramCase(title || defaultTitle), 39600 title: title || defaultTitle 39601 }, false); 39602 } finally { 39603 setIsBusy(false); 39604 } 39605 } 39606 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { 39607 onSubmit: onCreateTemplate, 39608 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 39609 spacing: 6, 39610 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { 39611 __next40pxDefaultSize: true, 39612 __nextHasNoMarginBottom: true, 39613 label: (0,external_wp_i18n_namespaceObject.__)('Name'), 39614 value: title, 39615 onChange: setTitle, 39616 placeholder: defaultTitle, 39617 disabled: isBusy, 39618 help: (0,external_wp_i18n_namespaceObject.__)( 39619 // eslint-disable-next-line no-restricted-syntax -- 'sidebar' is a common web design term for layouts 39620 'Describe the template, e.g. "Post with sidebar". A custom template can be manually applied to any post or page.') 39621 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 39622 className: "edit-site-custom-generic-template__modal-actions", 39623 justify: "right", 39624 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 39625 __next40pxDefaultSize: true, 39626 variant: "tertiary", 39627 onClick: () => { 39628 onClose(); 39629 }, 39630 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 39631 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 39632 __next40pxDefaultSize: true, 39633 variant: "primary", 39634 type: "submit", 39635 isBusy: isBusy, 39636 "aria-disabled": isBusy, 39637 children: (0,external_wp_i18n_namespaceObject.__)('Create') 39638 })] 39639 })] 39640 }) 39641 }); 39642 } 39643 /* harmony default export */ const add_custom_generic_template_modal_content = (AddCustomGenericTemplateModalContent); 39644 39645 ;// ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/index.js 39646 /** 39647 * External dependencies 39648 */ 39649 39650 39651 /** 39652 * WordPress dependencies 39653 */ 39654 39655 39656 39657 39658 39659 39660 39661 39662 39663 39664 39665 /** 39666 * Internal dependencies 39667 */ 39668 39669 39670 /** 39671 * Internal dependencies 39672 */ 39673 39674 39675 39676 39677 39678 const { 39679 useHistory: add_new_template_useHistory 39680 } = unlock(external_wp_router_namespaceObject.privateApis); 39681 const DEFAULT_TEMPLATE_SLUGS = ['front-page', 'home', 'single', 'page', 'index', 'archive', 'author', 'category', 'date', 'tag', 'search', '404']; 39682 const TEMPLATE_ICONS = { 39683 'front-page': library_home, 39684 home: library_verse, 39685 single: library_pin, 39686 page: library_page, 39687 archive: library_archive, 39688 search: library_search, 39689 404: not_found, 39690 index: library_list, 39691 category: library_category, 39692 author: comment_author_avatar, 39693 taxonomy: block_meta, 39694 date: library_calendar, 39695 tag: library_tag, 39696 attachment: library_media 39697 }; 39698 function TemplateListItem({ 39699 title, 39700 direction, 39701 className, 39702 description, 39703 icon, 39704 onClick, 39705 children 39706 }) { 39707 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 39708 __next40pxDefaultSize: true, 39709 className: className, 39710 onClick: onClick, 39711 label: description, 39712 showTooltip: !!description, 39713 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 39714 as: "span", 39715 spacing: 2, 39716 align: "center", 39717 justify: "center", 39718 style: { 39719 width: '100%' 39720 }, 39721 direction: direction, 39722 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 39723 className: "edit-site-add-new-template__template-icon", 39724 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 39725 icon: icon 39726 }) 39727 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 39728 className: "edit-site-add-new-template__template-name", 39729 alignment: "center", 39730 spacing: 0, 39731 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 39732 align: "center", 39733 weight: 500, 39734 lineHeight: 1.53846153846 // 20px 39735 , 39736 children: title 39737 }), children] 39738 })] 39739 }) 39740 }); 39741 } 39742 const modalContentMap = { 39743 templatesList: 1, 39744 customTemplate: 2, 39745 customGenericTemplate: 3 39746 }; 39747 function NewTemplateModal({ 39748 onClose 39749 }) { 39750 const [modalContent, setModalContent] = (0,external_wp_element_namespaceObject.useState)(modalContentMap.templatesList); 39751 const [entityForSuggestions, setEntityForSuggestions] = (0,external_wp_element_namespaceObject.useState)({}); 39752 const [isSubmitting, setIsSubmitting] = (0,external_wp_element_namespaceObject.useState)(false); 39753 const missingTemplates = useMissingTemplates(setEntityForSuggestions, () => setModalContent(modalContentMap.customTemplate)); 39754 const history = add_new_template_useHistory(); 39755 const { 39756 saveEntityRecord 39757 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 39758 const { 39759 createErrorNotice, 39760 createSuccessNotice 39761 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 39762 const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); 39763 const homeUrl = (0,external_wp_data_namespaceObject.useSelect)(select => { 39764 // Site index. 39765 return select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', '__unstableBase')?.home; 39766 }, []); 39767 const TEMPLATE_SHORT_DESCRIPTIONS = { 39768 'front-page': homeUrl, 39769 date: (0,external_wp_i18n_namespaceObject.sprintf)( 39770 // translators: %s: The homepage url. 39771 (0,external_wp_i18n_namespaceObject.__)('E.g. %s'), homeUrl + '/' + new Date().getFullYear()) 39772 }; 39773 async function createTemplate(template, isWPSuggestion = true) { 39774 if (isSubmitting) { 39775 return; 39776 } 39777 setIsSubmitting(true); 39778 try { 39779 const { 39780 title, 39781 description, 39782 slug 39783 } = template; 39784 const newTemplate = await saveEntityRecord('postType', TEMPLATE_POST_TYPE, { 39785 description, 39786 // Slugs need to be strings, so this is for template `404` 39787 slug: slug.toString(), 39788 status: 'publish', 39789 title, 39790 // This adds a post meta field in template that is part of `is_custom` value calculation. 39791 is_wp_suggestion: isWPSuggestion 39792 }, { 39793 throwOnError: true 39794 }); 39795 39796 // Navigate to the created template editor. 39797 history.navigate(`/$TEMPLATE_POST_TYPE}/$newTemplate.id}?canvas=edit`); 39798 createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( 39799 // translators: %s: Title of the created post or template, e.g: "Hello world". 39800 (0,external_wp_i18n_namespaceObject.__)('"%s" successfully created.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(newTemplate.title?.rendered || title)), { 39801 type: 'snackbar' 39802 }); 39803 } catch (error) { 39804 const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the template.'); 39805 createErrorNotice(errorMessage, { 39806 type: 'snackbar' 39807 }); 39808 } finally { 39809 setIsSubmitting(false); 39810 } 39811 } 39812 const onModalClose = () => { 39813 onClose(); 39814 setModalContent(modalContentMap.templatesList); 39815 }; 39816 let modalTitle = (0,external_wp_i18n_namespaceObject.__)('Add template'); 39817 if (modalContent === modalContentMap.customTemplate) { 39818 modalTitle = (0,external_wp_i18n_namespaceObject.sprintf)( 39819 // translators: %s: Name of the post type e.g: "Post". 39820 (0,external_wp_i18n_namespaceObject.__)('Add template: %s'), entityForSuggestions.labels.singular_name); 39821 } else if (modalContent === modalContentMap.customGenericTemplate) { 39822 modalTitle = (0,external_wp_i18n_namespaceObject.__)('Create custom template'); 39823 } 39824 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Modal, { 39825 title: modalTitle, 39826 className: dist_clsx('edit-site-add-new-template__modal', { 39827 'edit-site-add-new-template__modal_template_list': modalContent === modalContentMap.templatesList, 39828 'edit-site-custom-template-modal': modalContent === modalContentMap.customTemplate 39829 }), 39830 onRequestClose: onModalClose, 39831 overlayClassName: modalContent === modalContentMap.customGenericTemplate ? 'edit-site-custom-generic-template__modal' : undefined, 39832 children: [modalContent === modalContentMap.templatesList && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalGrid, { 39833 columns: isMobile ? 2 : 3, 39834 gap: 4, 39835 align: "flex-start", 39836 justify: "center", 39837 className: "edit-site-add-new-template__template-list__contents", 39838 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { 39839 className: "edit-site-add-new-template__template-list__prompt", 39840 children: (0,external_wp_i18n_namespaceObject.__)('Select what the new template should apply to:') 39841 }), missingTemplates.map(template => { 39842 const { 39843 title, 39844 slug, 39845 onClick 39846 } = template; 39847 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplateListItem, { 39848 title: title, 39849 direction: "column", 39850 className: "edit-site-add-new-template__template-button", 39851 description: TEMPLATE_SHORT_DESCRIPTIONS[slug], 39852 icon: TEMPLATE_ICONS[slug] || library_layout, 39853 onClick: () => onClick ? onClick(template) : createTemplate(template) 39854 }, slug); 39855 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplateListItem, { 39856 title: (0,external_wp_i18n_namespaceObject.__)('Custom template'), 39857 direction: "row", 39858 className: "edit-site-add-new-template__custom-template-button", 39859 icon: edit, 39860 onClick: () => setModalContent(modalContentMap.customGenericTemplate), 39861 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 39862 lineHeight: 1.53846153846 // 20px 39863 , 39864 children: (0,external_wp_i18n_namespaceObject.__)('A custom template can be manually applied to any post or page.') 39865 }) 39866 })] 39867 }), modalContent === modalContentMap.customTemplate && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_custom_template_modal_content, { 39868 onSelect: createTemplate, 39869 entityForSuggestions: entityForSuggestions 39870 }), modalContent === modalContentMap.customGenericTemplate && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_custom_generic_template_modal_content, { 39871 onClose: onModalClose, 39872 createTemplate: createTemplate 39873 })] 39874 }); 39875 } 39876 function NewTemplate() { 39877 const [showModal, setShowModal] = (0,external_wp_element_namespaceObject.useState)(false); 39878 const { 39879 postType 39880 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 39881 const { 39882 getPostType 39883 } = select(external_wp_coreData_namespaceObject.store); 39884 return { 39885 postType: getPostType(TEMPLATE_POST_TYPE) 39886 }; 39887 }, []); 39888 if (!postType) { 39889 return null; 39890 } 39891 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 39892 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 39893 variant: "primary", 39894 onClick: () => setShowModal(true), 39895 label: postType.labels.add_new_item, 39896 __next40pxDefaultSize: true, 39897 children: postType.labels.add_new_item 39898 }), showModal && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NewTemplateModal, { 39899 onClose: () => setShowModal(false) 39900 })] 39901 }); 39902 } 39903 function useMissingTemplates(setEntityForSuggestions, onClick) { 39904 const existingTemplates = useExistingTemplates(); 39905 const defaultTemplateTypes = useDefaultTemplateTypes(); 39906 const existingTemplateSlugs = (existingTemplates || []).map(({ 39907 slug 39908 }) => slug); 39909 const missingDefaultTemplates = (defaultTemplateTypes || []).filter(template => DEFAULT_TEMPLATE_SLUGS.includes(template.slug) && !existingTemplateSlugs.includes(template.slug)); 39910 const onClickMenuItem = _entityForSuggestions => { 39911 onClick?.(); 39912 setEntityForSuggestions(_entityForSuggestions); 39913 }; 39914 // We need to replace existing default template types with 39915 // the create specific template functionality. The original 39916 // info (title, description, etc.) is preserved in the 39917 // used hooks. 39918 const enhancedMissingDefaultTemplateTypes = [...missingDefaultTemplates]; 39919 const { 39920 defaultTaxonomiesMenuItems, 39921 taxonomiesMenuItems 39922 } = useTaxonomiesMenuItems(onClickMenuItem); 39923 const { 39924 defaultPostTypesMenuItems, 39925 postTypesMenuItems 39926 } = usePostTypeMenuItems(onClickMenuItem); 39927 const authorMenuItem = useAuthorMenuItem(onClickMenuItem); 39928 [...defaultTaxonomiesMenuItems, ...defaultPostTypesMenuItems, authorMenuItem].forEach(menuItem => { 39929 if (!menuItem) { 39930 return; 39931 } 39932 const matchIndex = enhancedMissingDefaultTemplateTypes.findIndex(template => template.slug === menuItem.slug); 39933 // Some default template types might have been filtered above from 39934 // `missingDefaultTemplates` because they only check for the general 39935 // template. So here we either replace or append the item, augmented 39936 // with the check if it has available specific item to create a 39937 // template for. 39938 if (matchIndex > -1) { 39939 enhancedMissingDefaultTemplateTypes[matchIndex] = menuItem; 39940 } else { 39941 enhancedMissingDefaultTemplateTypes.push(menuItem); 39942 } 39943 }); 39944 // Update the sort order to match the DEFAULT_TEMPLATE_SLUGS order. 39945 enhancedMissingDefaultTemplateTypes?.sort((template1, template2) => { 39946 return DEFAULT_TEMPLATE_SLUGS.indexOf(template1.slug) - DEFAULT_TEMPLATE_SLUGS.indexOf(template2.slug); 39947 }); 39948 const missingTemplates = [...enhancedMissingDefaultTemplateTypes, ...usePostTypeArchiveMenuItems(), ...postTypesMenuItems, ...taxonomiesMenuItems]; 39949 return missingTemplates; 39950 } 39951 /* harmony default export */ const add_new_template = ((0,external_wp_element_namespaceObject.memo)(NewTemplate)); 39952 39953 ;// ./node_modules/@wordpress/edit-site/build-module/components/page-templates/fields.js 39954 /** 39955 * External dependencies 39956 */ 39957 39958 39959 /** 39960 * WordPress dependencies 39961 */ 39962 39963 39964 39965 39966 39967 39968 39969 39970 /** 39971 * Internal dependencies 39972 */ 39973 39974 39975 39976 39977 const { 39978 useGlobalStyle: page_templates_fields_useGlobalStyle 39979 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 39980 function fields_PreviewField({ 39981 item 39982 }) { 39983 const settings = usePatternSettings(); 39984 const [backgroundColor = 'white'] = page_templates_fields_useGlobalStyle('color.background'); 39985 const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => { 39986 return (0,external_wp_blocks_namespaceObject.parse)(item.content.raw); 39987 }, [item.content.raw]); 39988 const isEmpty = !blocks?.length; 39989 // Wrap everything in a block editor provider to ensure 'styles' that are needed 39990 // for the previews are synced between the site editor store and the block editor store. 39991 // Additionally we need to have the `__experimentalBlockPatterns` setting in order to 39992 // render patterns inside the previews. 39993 // TODO: Same approach is used in the patterns list and it becomes obvious that some of 39994 // the block editor settings are needed in context where we don't have the block editor. 39995 // Explore how we can solve this in a better way. 39996 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.EditorProvider, { 39997 post: item, 39998 settings: settings, 39999 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 40000 className: "page-templates-preview-field", 40001 style: { 40002 backgroundColor 40003 }, 40004 children: [isEmpty && (0,external_wp_i18n_namespaceObject.__)('Empty template'), !isEmpty && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockPreview.Async, { 40005 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockPreview, { 40006 blocks: blocks 40007 }) 40008 })] 40009 }) 40010 }); 40011 } 40012 const fields_previewField = { 40013 label: (0,external_wp_i18n_namespaceObject.__)('Preview'), 40014 id: 'preview', 40015 render: fields_PreviewField, 40016 enableSorting: false 40017 }; 40018 const descriptionField = { 40019 label: (0,external_wp_i18n_namespaceObject.__)('Description'), 40020 id: 'description', 40021 render: ({ 40022 item 40023 }) => { 40024 return item.description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 40025 className: "page-templates-description", 40026 children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.description) 40027 }); 40028 }, 40029 enableSorting: false, 40030 enableGlobalSearch: true 40031 }; 40032 function fields_AuthorField({ 40033 item 40034 }) { 40035 const [isImageLoaded, setIsImageLoaded] = (0,external_wp_element_namespaceObject.useState)(false); 40036 const { 40037 text, 40038 icon, 40039 imageUrl 40040 } = useAddedBy(item.type, item.id); 40041 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 40042 alignment: "left", 40043 spacing: 0, 40044 children: [imageUrl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 40045 className: dist_clsx('page-templates-author-field__avatar', { 40046 'is-loaded': isImageLoaded 40047 }), 40048 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 40049 onLoad: () => setIsImageLoaded(true), 40050 alt: "", 40051 src: imageUrl 40052 }) 40053 }), !imageUrl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 40054 className: "page-templates-author-field__icon", 40055 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 40056 icon: icon 40057 }) 40058 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 40059 className: "page-templates-author-field__name", 40060 children: text 40061 })] 40062 }); 40063 } 40064 const authorField = { 40065 label: (0,external_wp_i18n_namespaceObject.__)('Author'), 40066 id: 'author', 40067 getValue: ({ 40068 item 40069 }) => item.author_text, 40070 render: fields_AuthorField 40071 }; 40072 40073 ;// ./node_modules/@wordpress/edit-site/build-module/components/page-templates/index.js 40074 /** 40075 * WordPress dependencies 40076 */ 40077 40078 40079 40080 40081 40082 40083 40084 40085 /** 40086 * Internal dependencies 40087 */ 40088 40089 40090 40091 40092 40093 40094 40095 40096 const { 40097 usePostActions: page_templates_usePostActions, 40098 templateTitleField 40099 } = unlock(external_wp_editor_namespaceObject.privateApis); 40100 const { 40101 useHistory: page_templates_useHistory, 40102 useLocation: page_templates_useLocation 40103 } = unlock(external_wp_router_namespaceObject.privateApis); 40104 const { 40105 useEntityRecordsWithPermissions 40106 } = unlock(external_wp_coreData_namespaceObject.privateApis); 40107 const page_templates_EMPTY_ARRAY = []; 40108 const page_templates_defaultLayouts = { 40109 [LAYOUT_TABLE]: { 40110 showMedia: false, 40111 layout: { 40112 styles: { 40113 author: { 40114 width: '1%' 40115 } 40116 } 40117 } 40118 }, 40119 [LAYOUT_GRID]: { 40120 showMedia: true 40121 }, 40122 [LAYOUT_LIST]: { 40123 showMedia: false 40124 } 40125 }; 40126 const page_templates_DEFAULT_VIEW = { 40127 type: LAYOUT_GRID, 40128 search: '', 40129 page: 1, 40130 perPage: 20, 40131 sort: { 40132 field: 'title', 40133 direction: 'asc' 40134 }, 40135 titleField: 'title', 40136 descriptionField: 'description', 40137 mediaField: 'preview', 40138 fields: ['author'], 40139 filters: [], 40140 ...page_templates_defaultLayouts[LAYOUT_GRID] 40141 }; 40142 function PageTemplates() { 40143 const { 40144 path, 40145 query 40146 } = page_templates_useLocation(); 40147 const { 40148 activeView = 'all', 40149 layout, 40150 postId 40151 } = query; 40152 const [selection, setSelection] = (0,external_wp_element_namespaceObject.useState)([postId]); 40153 const defaultView = (0,external_wp_element_namespaceObject.useMemo)(() => { 40154 const usedType = layout !== null && layout !== void 0 ? layout : page_templates_DEFAULT_VIEW.type; 40155 return { 40156 ...page_templates_DEFAULT_VIEW, 40157 type: usedType, 40158 filters: activeView !== 'all' ? [{ 40159 field: 'author', 40160 operator: 'isAny', 40161 value: [activeView] 40162 }] : [], 40163 ...page_templates_defaultLayouts[usedType] 40164 }; 40165 }, [layout, activeView]); 40166 const [view, setView] = (0,external_wp_element_namespaceObject.useState)(defaultView); 40167 40168 // Sync the layout from the URL to the view state. 40169 (0,external_wp_element_namespaceObject.useEffect)(() => { 40170 setView(currentView => ({ 40171 ...currentView, 40172 type: layout !== null && layout !== void 0 ? layout : page_templates_DEFAULT_VIEW.type 40173 })); 40174 }, [setView, layout]); 40175 40176 // Sync the active view from the URL to the view state. 40177 (0,external_wp_element_namespaceObject.useEffect)(() => { 40178 setView(currentView => ({ 40179 ...currentView, 40180 filters: activeView !== 'all' ? [{ 40181 field: 'author', 40182 operator: OPERATOR_IS_ANY, 40183 value: [activeView] 40184 }] : [] 40185 })); 40186 }, [setView, activeView]); 40187 const { 40188 records, 40189 isResolving: isLoadingData 40190 } = useEntityRecordsWithPermissions('postType', TEMPLATE_POST_TYPE, { 40191 per_page: -1 40192 }); 40193 const history = page_templates_useHistory(); 40194 const onChangeSelection = (0,external_wp_element_namespaceObject.useCallback)(items => { 40195 setSelection(items); 40196 if (view?.type === LAYOUT_LIST) { 40197 history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { 40198 postId: items.length === 1 ? items[0] : undefined 40199 })); 40200 } 40201 }, [history, path, view?.type]); 40202 const authors = (0,external_wp_element_namespaceObject.useMemo)(() => { 40203 if (!records) { 40204 return page_templates_EMPTY_ARRAY; 40205 } 40206 const authorsSet = new Set(); 40207 records.forEach(template => { 40208 authorsSet.add(template.author_text); 40209 }); 40210 return Array.from(authorsSet).map(author => ({ 40211 value: author, 40212 label: author 40213 })); 40214 }, [records]); 40215 const fields = (0,external_wp_element_namespaceObject.useMemo)(() => [fields_previewField, templateTitleField, descriptionField, { 40216 ...authorField, 40217 elements: authors 40218 }], [authors]); 40219 const { 40220 data, 40221 paginationInfo 40222 } = (0,external_wp_element_namespaceObject.useMemo)(() => { 40223 return filterSortAndPaginate(records, view, fields); 40224 }, [records, view, fields]); 40225 const postTypeActions = page_templates_usePostActions({ 40226 postType: TEMPLATE_POST_TYPE, 40227 context: 'list' 40228 }); 40229 const editAction = useEditPostAction(); 40230 const actions = (0,external_wp_element_namespaceObject.useMemo)(() => [editAction, ...postTypeActions], [postTypeActions, editAction]); 40231 const onChangeView = (0,external_wp_compose_namespaceObject.useEvent)(newView => { 40232 setView(newView); 40233 if (newView.type !== layout) { 40234 history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { 40235 layout: newView.type 40236 })); 40237 } 40238 }); 40239 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Page, { 40240 className: "edit-site-page-templates", 40241 title: (0,external_wp_i18n_namespaceObject.__)('Templates'), 40242 actions: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(add_new_template, {}), 40243 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViews, { 40244 paginationInfo: paginationInfo, 40245 fields: fields, 40246 actions: actions, 40247 data: data, 40248 isLoading: isLoadingData, 40249 view: view, 40250 onChangeView: onChangeView, 40251 onChangeSelection: onChangeSelection, 40252 isItemClickable: () => true, 40253 onClickItem: ({ 40254 id 40255 }) => { 40256 history.navigate(`/wp_template/$id}?canvas=edit`); 40257 }, 40258 selection: selection, 40259 defaultLayouts: page_templates_defaultLayouts 40260 }, activeView) 40261 }); 40262 } 40263 40264 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/templates.js 40265 /** 40266 * Internal dependencies 40267 */ 40268 40269 40270 40271 40272 40273 const templatesRoute = { 40274 name: 'templates', 40275 path: '/template', 40276 areas: { 40277 sidebar({ 40278 siteData 40279 }) { 40280 const isBlockTheme = siteData.currentTheme?.is_block_theme; 40281 return isBlockTheme ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenTemplatesBrowse, { 40282 backPath: "/" 40283 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); 40284 }, 40285 content({ 40286 siteData 40287 }) { 40288 const isBlockTheme = siteData.currentTheme?.is_block_theme; 40289 return isBlockTheme ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PageTemplates, {}) : undefined; 40290 }, 40291 preview({ 40292 query, 40293 siteData 40294 }) { 40295 const isBlockTheme = siteData.currentTheme?.is_block_theme; 40296 if (!isBlockTheme) { 40297 return undefined; 40298 } 40299 const isListView = query.layout === 'list'; 40300 return isListView ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : undefined; 40301 }, 40302 mobile({ 40303 siteData 40304 }) { 40305 const isBlockTheme = siteData.currentTheme?.is_block_theme; 40306 return isBlockTheme ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PageTemplates, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); 40307 } 40308 }, 40309 widths: { 40310 content({ 40311 query 40312 }) { 40313 const isListView = query.layout === 'list'; 40314 return isListView ? 380 : undefined; 40315 } 40316 } 40317 }; 40318 40319 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/template-item.js 40320 /** 40321 * Internal dependencies 40322 */ 40323 40324 40325 40326 40327 const templateItemRoute = { 40328 name: 'template-item', 40329 path: '/wp_template/*postId', 40330 areas: { 40331 sidebar({ 40332 siteData 40333 }) { 40334 const isBlockTheme = siteData.currentTheme?.is_block_theme; 40335 return isBlockTheme ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenTemplatesBrowse, { 40336 backPath: "/" 40337 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); 40338 }, 40339 mobile({ 40340 siteData 40341 }) { 40342 const isBlockTheme = siteData.currentTheme?.is_block_theme; 40343 return isBlockTheme ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); 40344 }, 40345 preview({ 40346 siteData 40347 }) { 40348 const isBlockTheme = siteData.currentTheme?.is_block_theme; 40349 return isBlockTheme ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); 40350 } 40351 } 40352 }; 40353 40354 ;// ./node_modules/@wordpress/icons/build-module/library/pages.js 40355 /** 40356 * WordPress dependencies 40357 */ 40358 40359 40360 const pages = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { 40361 xmlns: "http://www.w3.org/2000/svg", 40362 viewBox: "0 0 24 24", 40363 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 40364 d: "M14.5 5.5h-7V7h7V5.5ZM7.5 9h7v1.5h-7V9Zm7 3.5h-7V14h7v-1.5Z" 40365 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 40366 d: "M16 2H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2ZM6 3.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H6a.5.5 0 0 1-.5-.5V4a.5.5 0 0 1 .5-.5Z" 40367 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 40368 d: "M20 8v11c0 .69-.31 1-.999 1H6v1.5h13.001c1.52 0 2.499-.982 2.499-2.5V8H20Z" 40369 })] 40370 }); 40371 /* harmony default export */ const library_pages = (pages); 40372 40373 ;// ./node_modules/@wordpress/icons/build-module/library/published.js 40374 /** 40375 * WordPress dependencies 40376 */ 40377 40378 40379 const published = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 40380 xmlns: "http://www.w3.org/2000/svg", 40381 viewBox: "0 0 24 24", 40382 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 40383 fillRule: "evenodd", 40384 clipRule: "evenodd", 40385 d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm11.53-1.47-1.06-1.06L11 12.94l-1.47-1.47-1.06 1.06L11 15.06l4.53-4.53Z" 40386 }) 40387 }); 40388 /* harmony default export */ const library_published = (published); 40389 40390 ;// ./node_modules/@wordpress/icons/build-module/library/scheduled.js 40391 /** 40392 * WordPress dependencies 40393 */ 40394 40395 40396 const scheduled = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 40397 xmlns: "http://www.w3.org/2000/svg", 40398 viewBox: "0 0 24 24", 40399 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 40400 fillRule: "evenodd", 40401 clipRule: "evenodd", 40402 d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm9 1V8h-1.5v3.5h-2V13H13Z" 40403 }) 40404 }); 40405 /* harmony default export */ const library_scheduled = (scheduled); 40406 40407 ;// ./node_modules/@wordpress/icons/build-module/library/drafts.js 40408 /** 40409 * WordPress dependencies 40410 */ 40411 40412 40413 const drafts = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 40414 xmlns: "http://www.w3.org/2000/svg", 40415 viewBox: "0 0 24 24", 40416 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 40417 fillRule: "evenodd", 40418 clipRule: "evenodd", 40419 d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8 4a4 4 0 0 0 4-4H8a4 4 0 0 0 4 4Z" 40420 }) 40421 }); 40422 /* harmony default export */ const library_drafts = (drafts); 40423 40424 ;// ./node_modules/@wordpress/icons/build-module/library/pending.js 40425 /** 40426 * WordPress dependencies 40427 */ 40428 40429 40430 const pending = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 40431 xmlns: "http://www.w3.org/2000/svg", 40432 viewBox: "0 0 24 24", 40433 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 40434 fillRule: "evenodd", 40435 clipRule: "evenodd", 40436 d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8 4a4 4 0 0 1-4-4h4V8a4 4 0 0 1 0 8Z" 40437 }) 40438 }); 40439 /* harmony default export */ const library_pending = (pending); 40440 40441 ;// ./node_modules/@wordpress/icons/build-module/library/not-allowed.js 40442 /** 40443 * WordPress dependencies 40444 */ 40445 40446 40447 const notAllowed = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 40448 xmlns: "http://www.w3.org/2000/svg", 40449 viewBox: "0 0 24 24", 40450 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 40451 fillRule: "evenodd", 40452 clipRule: "evenodd", 40453 d: "M12 18.5A6.5 6.5 0 0 1 6.93 7.931l9.139 9.138A6.473 6.473 0 0 1 12 18.5Zm5.123-2.498a6.5 6.5 0 0 0-9.124-9.124l9.124 9.124ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Z" 40454 }) 40455 }); 40456 /* harmony default export */ const not_allowed = (notAllowed); 40457 40458 ;// ./node_modules/@wordpress/icons/build-module/library/trash.js 40459 /** 40460 * WordPress dependencies 40461 */ 40462 40463 40464 const trash = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 40465 xmlns: "http://www.w3.org/2000/svg", 40466 viewBox: "0 0 24 24", 40467 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 40468 fillRule: "evenodd", 40469 clipRule: "evenodd", 40470 d: "M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z" 40471 }) 40472 }); 40473 /* harmony default export */ const library_trash = (trash); 40474 40475 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-dataviews/default-views.js 40476 /** 40477 * WordPress dependencies 40478 */ 40479 40480 40481 40482 40483 40484 40485 /** 40486 * Internal dependencies 40487 */ 40488 40489 const default_views_defaultLayouts = { 40490 [LAYOUT_TABLE]: {}, 40491 [LAYOUT_GRID]: {}, 40492 [LAYOUT_LIST]: {} 40493 }; 40494 const DEFAULT_POST_BASE = { 40495 type: LAYOUT_LIST, 40496 search: '', 40497 filters: [], 40498 page: 1, 40499 perPage: 20, 40500 sort: { 40501 field: 'title', 40502 direction: 'asc' 40503 }, 40504 showLevels: true, 40505 titleField: 'title', 40506 mediaField: 'featured_media', 40507 fields: ['author', 'status'], 40508 ...default_views_defaultLayouts[LAYOUT_LIST] 40509 }; 40510 function useDefaultViews({ 40511 postType 40512 }) { 40513 const labels = (0,external_wp_data_namespaceObject.useSelect)(select => { 40514 const { 40515 getPostType 40516 } = select(external_wp_coreData_namespaceObject.store); 40517 return getPostType(postType)?.labels; 40518 }, [postType]); 40519 return (0,external_wp_element_namespaceObject.useMemo)(() => { 40520 return [{ 40521 title: labels?.all_items || (0,external_wp_i18n_namespaceObject.__)('All items'), 40522 slug: 'all', 40523 icon: library_pages, 40524 view: DEFAULT_POST_BASE 40525 }, { 40526 title: (0,external_wp_i18n_namespaceObject.__)('Published'), 40527 slug: 'published', 40528 icon: library_published, 40529 view: DEFAULT_POST_BASE, 40530 filters: [{ 40531 field: 'status', 40532 operator: OPERATOR_IS_ANY, 40533 value: 'publish' 40534 }] 40535 }, { 40536 title: (0,external_wp_i18n_namespaceObject.__)('Scheduled'), 40537 slug: 'future', 40538 icon: library_scheduled, 40539 view: DEFAULT_POST_BASE, 40540 filters: [{ 40541 field: 'status', 40542 operator: OPERATOR_IS_ANY, 40543 value: 'future' 40544 }] 40545 }, { 40546 title: (0,external_wp_i18n_namespaceObject.__)('Drafts'), 40547 slug: 'drafts', 40548 icon: library_drafts, 40549 view: DEFAULT_POST_BASE, 40550 filters: [{ 40551 field: 'status', 40552 operator: OPERATOR_IS_ANY, 40553 value: 'draft' 40554 }] 40555 }, { 40556 title: (0,external_wp_i18n_namespaceObject.__)('Pending'), 40557 slug: 'pending', 40558 icon: library_pending, 40559 view: DEFAULT_POST_BASE, 40560 filters: [{ 40561 field: 'status', 40562 operator: OPERATOR_IS_ANY, 40563 value: 'pending' 40564 }] 40565 }, { 40566 title: (0,external_wp_i18n_namespaceObject.__)('Private'), 40567 slug: 'private', 40568 icon: not_allowed, 40569 view: DEFAULT_POST_BASE, 40570 filters: [{ 40571 field: 'status', 40572 operator: OPERATOR_IS_ANY, 40573 value: 'private' 40574 }] 40575 }, { 40576 title: (0,external_wp_i18n_namespaceObject.__)('Trash'), 40577 slug: 'trash', 40578 icon: library_trash, 40579 view: { 40580 ...DEFAULT_POST_BASE, 40581 type: LAYOUT_TABLE, 40582 layout: default_views_defaultLayouts[LAYOUT_TABLE].layout 40583 }, 40584 filters: [{ 40585 field: 'status', 40586 operator: OPERATOR_IS_ANY, 40587 value: 'trash' 40588 }] 40589 }]; 40590 }, [labels]); 40591 } 40592 40593 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-dataviews/dataview-item.js 40594 /** 40595 * External dependencies 40596 */ 40597 40598 40599 /** 40600 * WordPress dependencies 40601 */ 40602 40603 40604 40605 40606 40607 /** 40608 * Internal dependencies 40609 */ 40610 40611 40612 40613 const { 40614 useLocation: dataview_item_useLocation 40615 } = unlock(external_wp_router_namespaceObject.privateApis); 40616 function DataViewItem({ 40617 title, 40618 slug, 40619 customViewId, 40620 type, 40621 icon, 40622 isActive, 40623 isCustom, 40624 suffix 40625 }) { 40626 const { 40627 path 40628 } = dataview_item_useLocation(); 40629 const iconToUse = icon || VIEW_LAYOUTS.find(v => v.type === type).icon; 40630 let activeView = isCustom ? customViewId : slug; 40631 if (activeView === 'all') { 40632 activeView = undefined; 40633 } 40634 const query = { 40635 layout: type, 40636 activeView, 40637 isCustom: isCustom ? 'true' : undefined 40638 }; 40639 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 40640 justify: "flex-start", 40641 className: dist_clsx('edit-site-sidebar-dataviews-dataview-item', { 40642 'is-selected': isActive 40643 }), 40644 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 40645 icon: iconToUse, 40646 to: (0,external_wp_url_namespaceObject.addQueryArgs)(path, query), 40647 "aria-current": isActive ? 'true' : undefined, 40648 children: title 40649 }), suffix] 40650 }); 40651 } 40652 40653 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-dataviews/add-new-view.js 40654 /** 40655 * WordPress dependencies 40656 */ 40657 40658 40659 40660 40661 40662 40663 40664 40665 40666 /** 40667 * Internal dependencies 40668 */ 40669 40670 40671 40672 40673 const { 40674 useLocation: add_new_view_useLocation, 40675 useHistory: add_new_view_useHistory 40676 } = unlock(external_wp_router_namespaceObject.privateApis); 40677 function AddNewItemModalContent({ 40678 type, 40679 setIsAdding 40680 }) { 40681 const history = add_new_view_useHistory(); 40682 const { 40683 path 40684 } = add_new_view_useLocation(); 40685 const { 40686 saveEntityRecord 40687 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 40688 const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(''); 40689 const [isSaving, setIsSaving] = (0,external_wp_element_namespaceObject.useState)(false); 40690 const defaultViews = useDefaultViews({ 40691 postType: type 40692 }); 40693 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { 40694 onSubmit: async event => { 40695 event.preventDefault(); 40696 setIsSaving(true); 40697 const { 40698 getEntityRecords 40699 } = (0,external_wp_data_namespaceObject.resolveSelect)(external_wp_coreData_namespaceObject.store); 40700 let dataViewTaxonomyId; 40701 const dataViewTypeRecords = await getEntityRecords('taxonomy', 'wp_dataviews_type', { 40702 slug: type 40703 }); 40704 if (dataViewTypeRecords && dataViewTypeRecords.length > 0) { 40705 dataViewTaxonomyId = dataViewTypeRecords[0].id; 40706 } else { 40707 const record = await saveEntityRecord('taxonomy', 'wp_dataviews_type', { 40708 name: type 40709 }); 40710 if (record && record.id) { 40711 dataViewTaxonomyId = record.id; 40712 } 40713 } 40714 const savedRecord = await saveEntityRecord('postType', 'wp_dataviews', { 40715 title, 40716 status: 'publish', 40717 wp_dataviews_type: dataViewTaxonomyId, 40718 content: JSON.stringify(defaultViews[0].view) 40719 }); 40720 history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { 40721 activeView: savedRecord.id, 40722 isCustom: 'true' 40723 })); 40724 setIsSaving(false); 40725 setIsAdding(false); 40726 }, 40727 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 40728 spacing: "5", 40729 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { 40730 __next40pxDefaultSize: true, 40731 __nextHasNoMarginBottom: true, 40732 label: (0,external_wp_i18n_namespaceObject.__)('Name'), 40733 value: title, 40734 onChange: setTitle, 40735 placeholder: (0,external_wp_i18n_namespaceObject.__)('My view'), 40736 className: "patterns-create-modal__name-input" 40737 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 40738 justify: "right", 40739 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 40740 __next40pxDefaultSize: true, 40741 variant: "tertiary", 40742 onClick: () => { 40743 setIsAdding(false); 40744 }, 40745 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 40746 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 40747 __next40pxDefaultSize: true, 40748 variant: "primary", 40749 type: "submit", 40750 "aria-disabled": !title || isSaving, 40751 isBusy: isSaving, 40752 children: (0,external_wp_i18n_namespaceObject.__)('Create') 40753 })] 40754 })] 40755 }) 40756 }); 40757 } 40758 function AddNewItem({ 40759 type 40760 }) { 40761 const [isAdding, setIsAdding] = (0,external_wp_element_namespaceObject.useState)(false); 40762 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 40763 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationItem, { 40764 icon: library_plus, 40765 onClick: () => { 40766 setIsAdding(true); 40767 }, 40768 className: "dataviews__siderbar-content-add-new-item", 40769 children: (0,external_wp_i18n_namespaceObject.__)('New view') 40770 }), isAdding && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 40771 title: (0,external_wp_i18n_namespaceObject.__)('Add new view'), 40772 onRequestClose: () => { 40773 setIsAdding(false); 40774 }, 40775 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AddNewItemModalContent, { 40776 type: type, 40777 setIsAdding: setIsAdding 40778 }) 40779 })] 40780 }); 40781 } 40782 40783 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-dataviews/custom-dataviews-list.js 40784 /** 40785 * WordPress dependencies 40786 */ 40787 40788 40789 40790 40791 40792 40793 40794 40795 /** 40796 * Internal dependencies 40797 */ 40798 40799 40800 40801 40802 const { 40803 useHistory: custom_dataviews_list_useHistory, 40804 useLocation: custom_dataviews_list_useLocation 40805 } = unlock(external_wp_router_namespaceObject.privateApis); 40806 const custom_dataviews_list_EMPTY_ARRAY = []; 40807 function RenameItemModalContent({ 40808 dataviewId, 40809 currentTitle, 40810 setIsRenaming 40811 }) { 40812 const { 40813 editEntityRecord 40814 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 40815 const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(currentTitle); 40816 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { 40817 onSubmit: async event => { 40818 event.preventDefault(); 40819 await editEntityRecord('postType', 'wp_dataviews', dataviewId, { 40820 title 40821 }); 40822 setIsRenaming(false); 40823 }, 40824 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 40825 spacing: "5", 40826 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { 40827 __next40pxDefaultSize: true, 40828 __nextHasNoMarginBottom: true, 40829 label: (0,external_wp_i18n_namespaceObject.__)('Name'), 40830 value: title, 40831 onChange: setTitle, 40832 placeholder: (0,external_wp_i18n_namespaceObject.__)('My view'), 40833 className: "patterns-create-modal__name-input" 40834 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 40835 justify: "right", 40836 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 40837 variant: "tertiary", 40838 __next40pxDefaultSize: true, 40839 onClick: () => { 40840 setIsRenaming(false); 40841 }, 40842 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 40843 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 40844 variant: "primary", 40845 type: "submit", 40846 "aria-disabled": !title, 40847 __next40pxDefaultSize: true, 40848 children: (0,external_wp_i18n_namespaceObject.__)('Save') 40849 })] 40850 })] 40851 }) 40852 }); 40853 } 40854 function CustomDataViewItem({ 40855 dataviewId, 40856 isActive 40857 }) { 40858 const history = custom_dataviews_list_useHistory(); 40859 const location = custom_dataviews_list_useLocation(); 40860 const { 40861 dataview 40862 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 40863 const { 40864 getEditedEntityRecord 40865 } = select(external_wp_coreData_namespaceObject.store); 40866 return { 40867 dataview: getEditedEntityRecord('postType', 'wp_dataviews', dataviewId) 40868 }; 40869 }, [dataviewId]); 40870 const { 40871 deleteEntityRecord 40872 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 40873 const type = (0,external_wp_element_namespaceObject.useMemo)(() => { 40874 const viewContent = JSON.parse(dataview.content); 40875 return viewContent.type; 40876 }, [dataview.content]); 40877 const [isRenaming, setIsRenaming] = (0,external_wp_element_namespaceObject.useState)(false); 40878 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 40879 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewItem, { 40880 title: dataview.title, 40881 type: type, 40882 isActive: isActive, 40883 isCustom: true, 40884 customViewId: dataviewId, 40885 suffix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { 40886 icon: more_vertical, 40887 label: (0,external_wp_i18n_namespaceObject.__)('Actions'), 40888 className: "edit-site-sidebar-dataviews-dataview-item__dropdown-menu", 40889 toggleProps: { 40890 style: { 40891 color: 'inherit' 40892 }, 40893 size: 'small' 40894 }, 40895 children: ({ 40896 onClose 40897 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { 40898 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 40899 onClick: () => { 40900 setIsRenaming(true); 40901 onClose(); 40902 }, 40903 children: (0,external_wp_i18n_namespaceObject.__)('Rename') 40904 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 40905 onClick: async () => { 40906 await deleteEntityRecord('postType', 'wp_dataviews', dataview.id, { 40907 force: true 40908 }); 40909 if (isActive) { 40910 history.replace({ 40911 postType: location.query.postType 40912 }); 40913 } 40914 onClose(); 40915 }, 40916 isDestructive: true, 40917 children: (0,external_wp_i18n_namespaceObject.__)('Delete') 40918 })] 40919 }) 40920 }) 40921 }), isRenaming && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 40922 title: (0,external_wp_i18n_namespaceObject.__)('Rename'), 40923 onRequestClose: () => { 40924 setIsRenaming(false); 40925 }, 40926 focusOnMount: "firstContentElement", 40927 size: "small", 40928 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RenameItemModalContent, { 40929 dataviewId: dataviewId, 40930 setIsRenaming: setIsRenaming, 40931 currentTitle: dataview.title 40932 }) 40933 })] 40934 }); 40935 } 40936 function useCustomDataViews(type) { 40937 const customDataViews = (0,external_wp_data_namespaceObject.useSelect)(select => { 40938 const { 40939 getEntityRecords 40940 } = select(external_wp_coreData_namespaceObject.store); 40941 const dataViewTypeRecords = getEntityRecords('taxonomy', 'wp_dataviews_type', { 40942 slug: type 40943 }); 40944 if (!dataViewTypeRecords || dataViewTypeRecords.length === 0) { 40945 return custom_dataviews_list_EMPTY_ARRAY; 40946 } 40947 const dataViews = getEntityRecords('postType', 'wp_dataviews', { 40948 wp_dataviews_type: dataViewTypeRecords[0].id, 40949 orderby: 'date', 40950 order: 'asc' 40951 }); 40952 if (!dataViews) { 40953 return custom_dataviews_list_EMPTY_ARRAY; 40954 } 40955 return dataViews; 40956 }); 40957 return customDataViews; 40958 } 40959 function CustomDataViewsList({ 40960 type, 40961 activeView, 40962 isCustom 40963 }) { 40964 const customDataViews = useCustomDataViews(type); 40965 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 40966 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 40967 className: "edit-site-sidebar-navigation-screen-dataviews__group-header", 40968 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 40969 level: 2, 40970 children: (0,external_wp_i18n_namespaceObject.__)('Custom Views') 40971 }) 40972 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { 40973 className: "edit-site-sidebar-navigation-screen-dataviews__custom-items", 40974 children: [customDataViews.map(customViewRecord => { 40975 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CustomDataViewItem, { 40976 dataviewId: customViewRecord.id, 40977 isActive: isCustom && Number(activeView) === customViewRecord.id 40978 }, customViewRecord.id); 40979 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AddNewItem, { 40980 type: type 40981 })] 40982 })] 40983 }); 40984 } 40985 40986 ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-dataviews/index.js 40987 /** 40988 * WordPress dependencies 40989 */ 40990 40991 40992 40993 /** 40994 * Internal dependencies 40995 */ 40996 40997 40998 40999 41000 41001 const { 41002 useLocation: sidebar_dataviews_useLocation 41003 } = unlock(external_wp_router_namespaceObject.privateApis); 41004 function DataViewsSidebarContent({ 41005 postType 41006 }) { 41007 const { 41008 query: { 41009 activeView = 'all', 41010 isCustom = 'false' 41011 } 41012 } = sidebar_dataviews_useLocation(); 41013 const defaultViews = useDefaultViews({ 41014 postType 41015 }); 41016 if (!postType) { 41017 return null; 41018 } 41019 const isCustomBoolean = isCustom === 'true'; 41020 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 41021 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { 41022 className: "edit-site-sidebar-dataviews", 41023 children: defaultViews.map(dataview => { 41024 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewItem, { 41025 slug: dataview.slug, 41026 title: dataview.title, 41027 icon: dataview.icon, 41028 type: dataview.view.type, 41029 isActive: !isCustomBoolean && dataview.slug === activeView, 41030 isCustom: false 41031 }, dataview.slug); 41032 }) 41033 }), window?.__experimentalCustomViews && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CustomDataViewsList, { 41034 activeView: activeView, 41035 type: postType, 41036 isCustom: true 41037 })] 41038 }); 41039 } 41040 41041 ;// ./node_modules/@wordpress/icons/build-module/library/drawer-right.js 41042 /** 41043 * WordPress dependencies 41044 */ 41045 41046 41047 const drawerRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 41048 width: "24", 41049 height: "24", 41050 xmlns: "http://www.w3.org/2000/svg", 41051 viewBox: "0 0 24 24", 41052 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 41053 fillRule: "evenodd", 41054 clipRule: "evenodd", 41055 d: "M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4 14.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h8v13zm4.5-.5c0 .3-.2.5-.5.5h-2.5v-13H18c.3 0 .5.2.5.5v12z" 41056 }) 41057 }); 41058 /* harmony default export */ const drawer_right = (drawerRight); 41059 41060 ;// ./node_modules/@wordpress/edit-site/build-module/components/add-new-post/index.js 41061 /** 41062 * WordPress dependencies 41063 */ 41064 41065 41066 41067 41068 41069 41070 41071 41072 41073 function AddNewPostModal({ 41074 postType, 41075 onSave, 41076 onClose 41077 }) { 41078 const labels = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPostType(postType)?.labels, [postType]); 41079 const [isCreatingPost, setIsCreatingPost] = (0,external_wp_element_namespaceObject.useState)(false); 41080 const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(''); 41081 const { 41082 saveEntityRecord 41083 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 41084 const { 41085 createErrorNotice, 41086 createSuccessNotice 41087 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 41088 const { 41089 resolveSelect 41090 } = (0,external_wp_data_namespaceObject.useRegistry)(); 41091 async function createPost(event) { 41092 event.preventDefault(); 41093 if (isCreatingPost) { 41094 return; 41095 } 41096 setIsCreatingPost(true); 41097 try { 41098 const postTypeObject = await resolveSelect(external_wp_coreData_namespaceObject.store).getPostType(postType); 41099 const newPage = await saveEntityRecord('postType', postType, { 41100 status: 'draft', 41101 title, 41102 slug: title !== null && title !== void 0 ? title : undefined, 41103 content: !!postTypeObject.template && postTypeObject.template.length ? (0,external_wp_blocks_namespaceObject.serialize)((0,external_wp_blocks_namespaceObject.synchronizeBlocksWithTemplate)([], postTypeObject.template)) : undefined 41104 }, { 41105 throwOnError: true 41106 }); 41107 onSave(newPage); 41108 createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( 41109 // translators: %s: Title of the created post or template, e.g: "Hello world". 41110 (0,external_wp_i18n_namespaceObject.__)('"%s" successfully created.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(newPage.title?.rendered || title)), { 41111 type: 'snackbar' 41112 }); 41113 } catch (error) { 41114 const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the item.'); 41115 createErrorNotice(errorMessage, { 41116 type: 'snackbar' 41117 }); 41118 } finally { 41119 setIsCreatingPost(false); 41120 } 41121 } 41122 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 41123 title: 41124 // translators: %s: post type singular_name label e.g: "Page". 41125 (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Draft new: %s'), labels?.singular_name), 41126 onRequestClose: onClose, 41127 focusOnMount: "firstContentElement", 41128 size: "small", 41129 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { 41130 onSubmit: createPost, 41131 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 41132 spacing: 4, 41133 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { 41134 __next40pxDefaultSize: true, 41135 __nextHasNoMarginBottom: true, 41136 label: (0,external_wp_i18n_namespaceObject.__)('Title'), 41137 onChange: setTitle, 41138 placeholder: (0,external_wp_i18n_namespaceObject.__)('No title'), 41139 value: title 41140 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 41141 spacing: 2, 41142 justify: "end", 41143 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 41144 __next40pxDefaultSize: true, 41145 variant: "tertiary", 41146 onClick: onClose, 41147 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 41148 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 41149 __next40pxDefaultSize: true, 41150 variant: "primary", 41151 type: "submit", 41152 isBusy: isCreatingPost, 41153 "aria-disabled": isCreatingPost, 41154 children: (0,external_wp_i18n_namespaceObject.__)('Create draft') 41155 })] 41156 })] 41157 }) 41158 }) 41159 }); 41160 } 41161 41162 ;// ./node_modules/@wordpress/edit-site/build-module/components/post-list/index.js 41163 /** 41164 * WordPress dependencies 41165 */ 41166 41167 41168 41169 41170 41171 41172 41173 41174 41175 41176 41177 41178 /** 41179 * Internal dependencies 41180 */ 41181 41182 41183 41184 41185 41186 41187 41188 const { 41189 usePostActions: post_list_usePostActions, 41190 usePostFields 41191 } = unlock(external_wp_editor_namespaceObject.privateApis); 41192 const { 41193 useLocation: post_list_useLocation, 41194 useHistory: post_list_useHistory 41195 } = unlock(external_wp_router_namespaceObject.privateApis); 41196 const { 41197 useEntityRecordsWithPermissions: post_list_useEntityRecordsWithPermissions 41198 } = unlock(external_wp_coreData_namespaceObject.privateApis); 41199 const post_list_EMPTY_ARRAY = []; 41200 const getDefaultView = (defaultViews, activeView) => { 41201 return defaultViews.find(({ 41202 slug 41203 }) => slug === activeView)?.view; 41204 }; 41205 const getCustomView = editedEntityRecord => { 41206 if (!editedEntityRecord?.content) { 41207 return undefined; 41208 } 41209 const content = JSON.parse(editedEntityRecord.content); 41210 if (!content) { 41211 return undefined; 41212 } 41213 return { 41214 ...content, 41215 ...default_views_defaultLayouts[content.type] 41216 }; 41217 }; 41218 41219 /** 41220 * This function abstracts working with default & custom views by 41221 * providing a [ state, setState ] tuple based on the URL parameters. 41222 * 41223 * Consumers use the provided tuple to work with state 41224 * and don't have to deal with the specifics of default & custom views. 41225 * 41226 * @param {string} postType Post type to retrieve default views for. 41227 * @return {Array} The [ state, setState ] tuple. 41228 */ 41229 function useView(postType) { 41230 const { 41231 path, 41232 query: { 41233 activeView = 'all', 41234 isCustom = 'false', 41235 layout 41236 } 41237 } = post_list_useLocation(); 41238 const history = post_list_useHistory(); 41239 const defaultViews = useDefaultViews({ 41240 postType 41241 }); 41242 const { 41243 editEntityRecord 41244 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 41245 const editedEntityRecord = (0,external_wp_data_namespaceObject.useSelect)(select => { 41246 if (isCustom !== 'true') { 41247 return undefined; 41248 } 41249 const { 41250 getEditedEntityRecord 41251 } = select(external_wp_coreData_namespaceObject.store); 41252 return getEditedEntityRecord('postType', 'wp_dataviews', Number(activeView)); 41253 }, [activeView, isCustom]); 41254 const [view, setView] = (0,external_wp_element_namespaceObject.useState)(() => { 41255 let initialView; 41256 if (isCustom === 'true') { 41257 var _getCustomView; 41258 initialView = (_getCustomView = getCustomView(editedEntityRecord)) !== null && _getCustomView !== void 0 ? _getCustomView : { 41259 type: layout !== null && layout !== void 0 ? layout : LAYOUT_LIST 41260 }; 41261 } else { 41262 var _getDefaultView; 41263 initialView = (_getDefaultView = getDefaultView(defaultViews, activeView)) !== null && _getDefaultView !== void 0 ? _getDefaultView : { 41264 type: layout !== null && layout !== void 0 ? layout : LAYOUT_LIST 41265 }; 41266 } 41267 const type = layout !== null && layout !== void 0 ? layout : initialView.type; 41268 return { 41269 ...initialView, 41270 type, 41271 ...default_views_defaultLayouts[type] 41272 }; 41273 }); 41274 const setViewWithUrlUpdate = (0,external_wp_compose_namespaceObject.useEvent)(newView => { 41275 setView(newView); 41276 if (isCustom === 'true' && editedEntityRecord?.id) { 41277 editEntityRecord('postType', 'wp_dataviews', editedEntityRecord?.id, { 41278 content: JSON.stringify(newView) 41279 }); 41280 } 41281 const currentUrlLayout = layout !== null && layout !== void 0 ? layout : LAYOUT_LIST; 41282 if (newView.type !== currentUrlLayout) { 41283 history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { 41284 layout: newView.type 41285 })); 41286 } 41287 }); 41288 41289 // When layout URL param changes, update the view type 41290 // without affecting any other config. 41291 const onUrlLayoutChange = (0,external_wp_compose_namespaceObject.useEvent)(() => { 41292 setView(prevView => { 41293 const newType = layout !== null && layout !== void 0 ? layout : LAYOUT_LIST; 41294 if (newType === prevView.type) { 41295 return prevView; 41296 } 41297 return { 41298 ...prevView, 41299 type: newType, 41300 ...default_views_defaultLayouts[newType] 41301 }; 41302 }); 41303 }); 41304 (0,external_wp_element_namespaceObject.useEffect)(() => { 41305 onUrlLayoutChange(); 41306 }, [onUrlLayoutChange, layout]); 41307 41308 // When activeView or isCustom URL parameters change, reset the view. 41309 const onUrlActiveViewChange = (0,external_wp_compose_namespaceObject.useEvent)(() => { 41310 let newView; 41311 if (isCustom === 'true') { 41312 newView = getCustomView(editedEntityRecord); 41313 } else { 41314 newView = getDefaultView(defaultViews, activeView); 41315 } 41316 if (newView) { 41317 const type = layout !== null && layout !== void 0 ? layout : newView.type; 41318 setView({ 41319 ...newView, 41320 type, 41321 ...default_views_defaultLayouts[type] 41322 }); 41323 } 41324 }); 41325 (0,external_wp_element_namespaceObject.useEffect)(() => { 41326 onUrlActiveViewChange(); 41327 }, [onUrlActiveViewChange, activeView, isCustom, defaultViews, editedEntityRecord]); 41328 return [view, setViewWithUrlUpdate]; 41329 } 41330 const DEFAULT_STATUSES = 'draft,future,pending,private,publish'; // All but 'trash'. 41331 41332 function getItemId(item) { 41333 return item.id.toString(); 41334 } 41335 function getItemLevel(item) { 41336 return item.level; 41337 } 41338 function PostList({ 41339 postType 41340 }) { 41341 var _postId$split, _data$map, _usePrevious; 41342 const [view, setView] = useView(postType); 41343 const defaultViews = useDefaultViews({ 41344 postType 41345 }); 41346 const history = post_list_useHistory(); 41347 const location = post_list_useLocation(); 41348 const { 41349 postId, 41350 quickEdit = false, 41351 isCustom, 41352 activeView = 'all' 41353 } = location.query; 41354 const [selection, setSelection] = (0,external_wp_element_namespaceObject.useState)((_postId$split = postId?.split(',')) !== null && _postId$split !== void 0 ? _postId$split : []); 41355 const onChangeSelection = (0,external_wp_element_namespaceObject.useCallback)(items => { 41356 var _location$query$isCus; 41357 setSelection(items); 41358 if (((_location$query$isCus = location.query.isCustom) !== null && _location$query$isCus !== void 0 ? _location$query$isCus : 'false') === 'false') { 41359 history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(location.path, { 41360 postId: items.join(',') 41361 })); 41362 } 41363 }, [location.path, location.query.isCustom, history]); 41364 const getActiveViewFilters = (views, match) => { 41365 var _found$filters; 41366 const found = views.find(({ 41367 slug 41368 }) => slug === match); 41369 return (_found$filters = found?.filters) !== null && _found$filters !== void 0 ? _found$filters : []; 41370 }; 41371 const { 41372 isLoading: isLoadingFields, 41373 fields: _fields 41374 } = usePostFields({ 41375 postType 41376 }); 41377 const fields = (0,external_wp_element_namespaceObject.useMemo)(() => { 41378 const activeViewFilters = getActiveViewFilters(defaultViews, activeView).map(({ 41379 field 41380 }) => field); 41381 return _fields.map(field => ({ 41382 ...field, 41383 elements: activeViewFilters.includes(field.id) ? [] : field.elements 41384 })); 41385 }, [_fields, defaultViews, activeView]); 41386 const queryArgs = (0,external_wp_element_namespaceObject.useMemo)(() => { 41387 const filters = {}; 41388 view.filters?.forEach(filter => { 41389 if (filter.field === 'status' && filter.operator === OPERATOR_IS_ANY) { 41390 filters.status = filter.value; 41391 } 41392 if (filter.field === 'author' && filter.operator === OPERATOR_IS_ANY) { 41393 filters.author = filter.value; 41394 } else if (filter.field === 'author' && filter.operator === OPERATOR_IS_NONE) { 41395 filters.author_exclude = filter.value; 41396 } 41397 }); 41398 41399 // The bundled views want data filtered without displaying the filter. 41400 const activeViewFilters = getActiveViewFilters(defaultViews, activeView); 41401 activeViewFilters.forEach(filter => { 41402 if (filter.field === 'status' && filter.operator === OPERATOR_IS_ANY) { 41403 filters.status = filter.value; 41404 } 41405 if (filter.field === 'author' && filter.operator === OPERATOR_IS_ANY) { 41406 filters.author = filter.value; 41407 } else if (filter.field === 'author' && filter.operator === OPERATOR_IS_NONE) { 41408 filters.author_exclude = filter.value; 41409 } 41410 }); 41411 41412 // We want to provide a different default item for the status filter 41413 // than the REST API provides. 41414 if (!filters.status || filters.status === '') { 41415 filters.status = DEFAULT_STATUSES; 41416 } 41417 return { 41418 per_page: view.perPage, 41419 page: view.page, 41420 _embed: 'author', 41421 order: view.sort?.direction, 41422 orderby: view.sort?.field, 41423 orderby_hierarchy: !!view.showLevels, 41424 search: view.search, 41425 ...filters 41426 }; 41427 }, [view, activeView, defaultViews]); 41428 const { 41429 records, 41430 isResolving: isLoadingData, 41431 totalItems, 41432 totalPages 41433 } = post_list_useEntityRecordsWithPermissions('postType', postType, queryArgs); 41434 41435 // The REST API sort the authors by ID, but we want to sort them by name. 41436 const data = (0,external_wp_element_namespaceObject.useMemo)(() => { 41437 if (!isLoadingFields && view?.sort?.field === 'author') { 41438 return filterSortAndPaginate(records, { 41439 sort: { 41440 ...view.sort 41441 } 41442 }, fields).data; 41443 } 41444 return records; 41445 }, [records, fields, isLoadingFields, view?.sort]); 41446 const ids = (_data$map = data?.map(record => getItemId(record))) !== null && _data$map !== void 0 ? _data$map : []; 41447 const prevIds = (_usePrevious = (0,external_wp_compose_namespaceObject.usePrevious)(ids)) !== null && _usePrevious !== void 0 ? _usePrevious : []; 41448 const deletedIds = prevIds.filter(id => !ids.includes(id)); 41449 const postIdWasDeleted = deletedIds.includes(postId); 41450 (0,external_wp_element_namespaceObject.useEffect)(() => { 41451 if (postIdWasDeleted) { 41452 history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(location.path, { 41453 postId: undefined 41454 })); 41455 } 41456 }, [history, postIdWasDeleted, location.path]); 41457 const paginationInfo = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 41458 totalItems, 41459 totalPages 41460 }), [totalItems, totalPages]); 41461 const { 41462 labels, 41463 canCreateRecord 41464 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 41465 const { 41466 getPostType, 41467 canUser 41468 } = select(external_wp_coreData_namespaceObject.store); 41469 return { 41470 labels: getPostType(postType)?.labels, 41471 canCreateRecord: canUser('create', { 41472 kind: 'postType', 41473 name: postType 41474 }) 41475 }; 41476 }, [postType]); 41477 const postTypeActions = post_list_usePostActions({ 41478 postType, 41479 context: 'list' 41480 }); 41481 const editAction = useEditPostAction(); 41482 const actions = (0,external_wp_element_namespaceObject.useMemo)(() => [editAction, ...postTypeActions], [postTypeActions, editAction]); 41483 const [showAddPostModal, setShowAddPostModal] = (0,external_wp_element_namespaceObject.useState)(false); 41484 const openModal = () => setShowAddPostModal(true); 41485 const closeModal = () => setShowAddPostModal(false); 41486 const handleNewPage = ({ 41487 type, 41488 id 41489 }) => { 41490 history.navigate(`/$type}/$id}?canvas=edit`); 41491 closeModal(); 41492 }; 41493 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Page, { 41494 title: labels?.name, 41495 actions: labels?.add_new_item && canCreateRecord && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 41496 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 41497 variant: "primary", 41498 onClick: openModal, 41499 __next40pxDefaultSize: true, 41500 children: labels.add_new_item 41501 }), showAddPostModal && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AddNewPostModal, { 41502 postType: postType, 41503 onSave: handleNewPage, 41504 onClose: closeModal 41505 })] 41506 }), 41507 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViews, { 41508 paginationInfo: paginationInfo, 41509 fields: fields, 41510 actions: actions, 41511 data: data || post_list_EMPTY_ARRAY, 41512 isLoading: isLoadingData || isLoadingFields, 41513 view: view, 41514 onChangeView: setView, 41515 selection: selection, 41516 onChangeSelection: onChangeSelection, 41517 isItemClickable: item => item.status !== 'trash', 41518 onClickItem: ({ 41519 id 41520 }) => { 41521 history.navigate(`/$postType}/$id}?canvas=edit`); 41522 }, 41523 getItemId: getItemId, 41524 getItemLevel: getItemLevel, 41525 defaultLayouts: default_views_defaultLayouts, 41526 header: window.__experimentalQuickEditDataViews && view.type !== LAYOUT_LIST && postType === 'page' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 41527 size: "compact", 41528 isPressed: quickEdit, 41529 icon: drawer_right, 41530 label: (0,external_wp_i18n_namespaceObject.__)('Details'), 41531 onClick: () => { 41532 history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(location.path, { 41533 quickEdit: quickEdit ? undefined : true 41534 })); 41535 } 41536 }) 41537 }, activeView + isCustom) 41538 }); 41539 } 41540 41541 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataform-context/index.js 41542 /** 41543 * WordPress dependencies 41544 */ 41545 41546 41547 /** 41548 * Internal dependencies 41549 */ 41550 41551 const DataFormContext = (0,external_wp_element_namespaceObject.createContext)({ 41552 fields: [] 41553 }); 41554 function DataFormProvider({ 41555 fields, 41556 children 41557 }) { 41558 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataFormContext.Provider, { 41559 value: { 41560 fields 41561 }, 41562 children: children 41563 }); 41564 } 41565 /* harmony default export */ const dataform_context = (DataFormContext); 41566 41567 ;// ./node_modules/@wordpress/dataviews/build-module/dataforms-layouts/is-combined-field.js 41568 /** 41569 * Internal dependencies 41570 */ 41571 41572 function isCombinedField(field) { 41573 return field.children !== undefined; 41574 } 41575 41576 ;// ./node_modules/@wordpress/dataviews/build-module/dataforms-layouts/regular/index.js 41577 /** 41578 * WordPress dependencies 41579 */ 41580 41581 41582 41583 /** 41584 * Internal dependencies 41585 */ 41586 41587 41588 41589 41590 41591 function regular_Header({ 41592 title 41593 }) { 41594 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 41595 className: "dataforms-layouts-regular__header", 41596 spacing: 4, 41597 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 41598 alignment: "center", 41599 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 41600 level: 2, 41601 size: 13, 41602 children: title 41603 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {})] 41604 }) 41605 }); 41606 } 41607 function FormRegularField({ 41608 data, 41609 field, 41610 onChange, 41611 hideLabelFromVision 41612 }) { 41613 var _field$labelPosition; 41614 const { 41615 fields 41616 } = (0,external_wp_element_namespaceObject.useContext)(dataform_context); 41617 const form = (0,external_wp_element_namespaceObject.useMemo)(() => { 41618 if (isCombinedField(field)) { 41619 return { 41620 fields: field.children.map(child => { 41621 if (typeof child === 'string') { 41622 return { 41623 id: child 41624 }; 41625 } 41626 return child; 41627 }), 41628 type: 'regular' 41629 }; 41630 } 41631 return { 41632 type: 'regular', 41633 fields: [] 41634 }; 41635 }, [field]); 41636 if (isCombinedField(field)) { 41637 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 41638 children: [!hideLabelFromVision && field.label && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(regular_Header, { 41639 title: field.label 41640 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataFormLayout, { 41641 data: data, 41642 form: form, 41643 onChange: onChange 41644 })] 41645 }); 41646 } 41647 const labelPosition = (_field$labelPosition = field.labelPosition) !== null && _field$labelPosition !== void 0 ? _field$labelPosition : 'top'; 41648 const fieldDefinition = fields.find(fieldDef => fieldDef.id === field.id); 41649 if (!fieldDefinition) { 41650 return null; 41651 } 41652 if (labelPosition === 'side') { 41653 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 41654 className: "dataforms-layouts-regular__field", 41655 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 41656 className: "dataforms-layouts-regular__field-label", 41657 children: fieldDefinition.label 41658 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 41659 className: "dataforms-layouts-regular__field-control", 41660 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(fieldDefinition.Edit, { 41661 data: data, 41662 field: fieldDefinition, 41663 onChange: onChange, 41664 hideLabelFromVision: true 41665 }, fieldDefinition.id) 41666 })] 41667 }); 41668 } 41669 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 41670 className: "dataforms-layouts-regular__field", 41671 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(fieldDefinition.Edit, { 41672 data: data, 41673 field: fieldDefinition, 41674 onChange: onChange, 41675 hideLabelFromVision: labelPosition === 'none' ? true : hideLabelFromVision 41676 }) 41677 }); 41678 } 41679 41680 ;// ./node_modules/@wordpress/dataviews/build-module/dataforms-layouts/panel/index.js 41681 /** 41682 * WordPress dependencies 41683 */ 41684 41685 41686 41687 41688 41689 /** 41690 * Internal dependencies 41691 */ 41692 41693 41694 41695 41696 41697 function DropdownHeader({ 41698 title, 41699 onClose 41700 }) { 41701 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 41702 className: "dataforms-layouts-panel__dropdown-header", 41703 spacing: 4, 41704 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 41705 alignment: "center", 41706 children: [title && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 41707 level: 2, 41708 size: 13, 41709 children: title 41710 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {}), onClose && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 41711 label: (0,external_wp_i18n_namespaceObject.__)('Close'), 41712 icon: close_small, 41713 onClick: onClose, 41714 size: "small" 41715 })] 41716 }) 41717 }); 41718 } 41719 function PanelDropdown({ 41720 fieldDefinition, 41721 popoverAnchor, 41722 labelPosition = 'side', 41723 data, 41724 onChange, 41725 field 41726 }) { 41727 const fieldLabel = isCombinedField(field) ? field.label : fieldDefinition?.label; 41728 const form = (0,external_wp_element_namespaceObject.useMemo)(() => { 41729 if (isCombinedField(field)) { 41730 return { 41731 type: 'regular', 41732 fields: field.children.map(child => { 41733 if (typeof child === 'string') { 41734 return { 41735 id: child 41736 }; 41737 } 41738 return child; 41739 }) 41740 }; 41741 } 41742 // If not explicit children return the field id itself. 41743 return { 41744 type: 'regular', 41745 fields: [{ 41746 id: field.id 41747 }] 41748 }; 41749 }, [field]); 41750 41751 // Memoize popoverProps to avoid returning a new object every time. 41752 const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 41753 // Anchor the popover to the middle of the entire row so that it doesn't 41754 // move around when the label changes. 41755 anchor: popoverAnchor, 41756 placement: 'left-start', 41757 offset: 36, 41758 shift: true 41759 }), [popoverAnchor]); 41760 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 41761 contentClassName: "dataforms-layouts-panel__field-dropdown", 41762 popoverProps: popoverProps, 41763 focusOnMount: true, 41764 toggleProps: { 41765 size: 'compact', 41766 variant: 'tertiary', 41767 tooltipPosition: 'middle left' 41768 }, 41769 renderToggle: ({ 41770 isOpen, 41771 onToggle 41772 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 41773 className: "dataforms-layouts-panel__field-control", 41774 size: "compact", 41775 variant: ['none', 'top'].includes(labelPosition) ? 'link' : 'tertiary', 41776 "aria-expanded": isOpen, 41777 "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( 41778 // translators: %s: Field name. 41779 (0,external_wp_i18n_namespaceObject._x)('Edit %s', 'field'), fieldLabel), 41780 onClick: onToggle, 41781 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(fieldDefinition.render, { 41782 item: data 41783 }) 41784 }), 41785 renderContent: ({ 41786 onClose 41787 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 41788 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DropdownHeader, { 41789 title: fieldLabel, 41790 onClose: onClose 41791 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataFormLayout, { 41792 data: data, 41793 form: form, 41794 onChange: onChange, 41795 children: (FieldLayout, nestedField) => { 41796 var _form$fields; 41797 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FieldLayout, { 41798 data: data, 41799 field: nestedField, 41800 onChange: onChange, 41801 hideLabelFromVision: ((_form$fields = form?.fields) !== null && _form$fields !== void 0 ? _form$fields : []).length < 2 41802 }, nestedField.id); 41803 } 41804 })] 41805 }) 41806 }); 41807 } 41808 function FormPanelField({ 41809 data, 41810 field, 41811 onChange 41812 }) { 41813 var _field$labelPosition; 41814 const { 41815 fields 41816 } = (0,external_wp_element_namespaceObject.useContext)(dataform_context); 41817 const fieldDefinition = fields.find(fieldDef => { 41818 // Default to the first child if it is a combined field. 41819 if (isCombinedField(field)) { 41820 const children = field.children.filter(child => typeof child === 'string' || !isCombinedField(child)); 41821 const firstChildFieldId = typeof children[0] === 'string' ? children[0] : children[0].id; 41822 return fieldDef.id === firstChildFieldId; 41823 } 41824 return fieldDef.id === field.id; 41825 }); 41826 const labelPosition = (_field$labelPosition = field.labelPosition) !== null && _field$labelPosition !== void 0 ? _field$labelPosition : 'side'; 41827 41828 // Use internal state instead of a ref to make sure that the component 41829 // re-renders when the popover's anchor updates. 41830 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 41831 if (!fieldDefinition) { 41832 return null; 41833 } 41834 const fieldLabel = isCombinedField(field) ? field.label : fieldDefinition?.label; 41835 if (labelPosition === 'top') { 41836 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 41837 className: "dataforms-layouts-panel__field", 41838 spacing: 0, 41839 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 41840 className: "dataforms-layouts-panel__field-label", 41841 style: { 41842 paddingBottom: 0 41843 }, 41844 children: fieldLabel 41845 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 41846 className: "dataforms-layouts-panel__field-control", 41847 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PanelDropdown, { 41848 field: field, 41849 popoverAnchor: popoverAnchor, 41850 fieldDefinition: fieldDefinition, 41851 data: data, 41852 onChange: onChange, 41853 labelPosition: labelPosition 41854 }) 41855 })] 41856 }); 41857 } 41858 if (labelPosition === 'none') { 41859 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 41860 className: "dataforms-layouts-panel__field", 41861 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PanelDropdown, { 41862 field: field, 41863 popoverAnchor: popoverAnchor, 41864 fieldDefinition: fieldDefinition, 41865 data: data, 41866 onChange: onChange, 41867 labelPosition: labelPosition 41868 }) 41869 }); 41870 } 41871 41872 // Defaults to label position side. 41873 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 41874 ref: setPopoverAnchor, 41875 className: "dataforms-layouts-panel__field", 41876 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 41877 className: "dataforms-layouts-panel__field-label", 41878 children: fieldLabel 41879 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 41880 className: "dataforms-layouts-panel__field-control", 41881 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PanelDropdown, { 41882 field: field, 41883 popoverAnchor: popoverAnchor, 41884 fieldDefinition: fieldDefinition, 41885 data: data, 41886 onChange: onChange, 41887 labelPosition: labelPosition 41888 }) 41889 })] 41890 }); 41891 } 41892 41893 ;// ./node_modules/@wordpress/dataviews/build-module/dataforms-layouts/index.js 41894 /** 41895 * Internal dependencies 41896 */ 41897 41898 41899 const FORM_FIELD_LAYOUTS = [{ 41900 type: 'regular', 41901 component: FormRegularField 41902 }, { 41903 type: 'panel', 41904 component: FormPanelField 41905 }]; 41906 function getFormFieldLayout(type) { 41907 return FORM_FIELD_LAYOUTS.find(layout => layout.type === type); 41908 } 41909 41910 ;// ./node_modules/@wordpress/dataviews/build-module/normalize-form-fields.js 41911 /** 41912 * Internal dependencies 41913 */ 41914 41915 function normalizeFormFields(form) { 41916 var _form$type, _form$labelPosition, _form$fields; 41917 let layout = 'regular'; 41918 if (['regular', 'panel'].includes((_form$type = form.type) !== null && _form$type !== void 0 ? _form$type : '')) { 41919 layout = form.type; 41920 } 41921 const labelPosition = (_form$labelPosition = form.labelPosition) !== null && _form$labelPosition !== void 0 ? _form$labelPosition : layout === 'regular' ? 'top' : 'side'; 41922 return ((_form$fields = form.fields) !== null && _form$fields !== void 0 ? _form$fields : []).map(field => { 41923 var _field$layout, _field$labelPosition; 41924 if (typeof field === 'string') { 41925 return { 41926 id: field, 41927 layout, 41928 labelPosition 41929 }; 41930 } 41931 const fieldLayout = (_field$layout = field.layout) !== null && _field$layout !== void 0 ? _field$layout : layout; 41932 const fieldLabelPosition = (_field$labelPosition = field.labelPosition) !== null && _field$labelPosition !== void 0 ? _field$labelPosition : fieldLayout === 'regular' ? 'top' : 'side'; 41933 return { 41934 ...field, 41935 layout: fieldLayout, 41936 labelPosition: fieldLabelPosition 41937 }; 41938 }); 41939 } 41940 41941 ;// ./node_modules/@wordpress/dataviews/build-module/dataforms-layouts/data-form-layout.js 41942 /** 41943 * WordPress dependencies 41944 */ 41945 41946 41947 41948 /** 41949 * Internal dependencies 41950 */ 41951 41952 41953 41954 41955 41956 41957 function DataFormLayout({ 41958 data, 41959 form, 41960 onChange, 41961 children 41962 }) { 41963 const { 41964 fields: fieldDefinitions 41965 } = (0,external_wp_element_namespaceObject.useContext)(dataform_context); 41966 function getFieldDefinition(field) { 41967 const fieldId = typeof field === 'string' ? field : field.id; 41968 return fieldDefinitions.find(fieldDefinition => fieldDefinition.id === fieldId); 41969 } 41970 const normalizedFormFields = (0,external_wp_element_namespaceObject.useMemo)(() => normalizeFormFields(form), [form]); 41971 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 41972 spacing: 2, 41973 children: normalizedFormFields.map(formField => { 41974 const FieldLayout = getFormFieldLayout(formField.layout)?.component; 41975 if (!FieldLayout) { 41976 return null; 41977 } 41978 const fieldDefinition = !isCombinedField(formField) ? getFieldDefinition(formField) : undefined; 41979 if (fieldDefinition && fieldDefinition.isVisible && !fieldDefinition.isVisible(data)) { 41980 return null; 41981 } 41982 if (children) { 41983 return children(FieldLayout, formField); 41984 } 41985 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FieldLayout, { 41986 data: data, 41987 field: formField, 41988 onChange: onChange 41989 }, formField.id); 41990 }) 41991 }); 41992 } 41993 41994 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataform/index.js 41995 /** 41996 * WordPress dependencies 41997 */ 41998 41999 42000 /** 42001 * Internal dependencies 42002 */ 42003 42004 42005 42006 42007 42008 function DataForm({ 42009 data, 42010 form, 42011 fields, 42012 onChange 42013 }) { 42014 const normalizedFields = (0,external_wp_element_namespaceObject.useMemo)(() => normalizeFields(fields), [fields]); 42015 if (!form.fields) { 42016 return null; 42017 } 42018 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataFormProvider, { 42019 fields: normalizedFields, 42020 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataFormLayout, { 42021 data: data, 42022 form: form, 42023 onChange: onChange 42024 }) 42025 }); 42026 } 42027 42028 ;// ./node_modules/@wordpress/edit-site/build-module/components/post-edit/index.js 42029 /** 42030 * External dependencies 42031 */ 42032 42033 42034 /** 42035 * WordPress dependencies 42036 */ 42037 42038 42039 42040 42041 42042 42043 42044 42045 /** 42046 * Internal dependencies 42047 */ 42048 42049 42050 42051 42052 42053 const { 42054 usePostFields: post_edit_usePostFields, 42055 PostCardPanel 42056 } = unlock(external_wp_editor_namespaceObject.privateApis); 42057 const fieldsWithBulkEditSupport = ['title', 'status', 'date', 'author', 'comment_status']; 42058 function PostEditForm({ 42059 postType, 42060 postId 42061 }) { 42062 const ids = (0,external_wp_element_namespaceObject.useMemo)(() => postId.split(','), [postId]); 42063 const { 42064 record, 42065 hasFinishedResolution 42066 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 42067 const args = ['postType', postType, ids[0]]; 42068 const { 42069 getEditedEntityRecord, 42070 hasFinishedResolution: hasFinished 42071 } = select(external_wp_coreData_namespaceObject.store); 42072 return { 42073 record: ids.length === 1 ? getEditedEntityRecord(...args) : null, 42074 hasFinishedResolution: hasFinished('getEditedEntityRecord', args) 42075 }; 42076 }, [postType, ids]); 42077 const [multiEdits, setMultiEdits] = (0,external_wp_element_namespaceObject.useState)({}); 42078 const { 42079 editEntityRecord 42080 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 42081 const { 42082 fields: _fields 42083 } = post_edit_usePostFields({ 42084 postType 42085 }); 42086 const fields = (0,external_wp_element_namespaceObject.useMemo)(() => _fields?.map(field => { 42087 if (field.id === 'status') { 42088 return { 42089 ...field, 42090 elements: field.elements.filter(element => element.value !== 'trash') 42091 }; 42092 } 42093 return field; 42094 }), [_fields]); 42095 const form = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 42096 type: 'panel', 42097 fields: [{ 42098 id: 'featured_media', 42099 layout: 'regular' 42100 }, { 42101 id: 'status', 42102 label: (0,external_wp_i18n_namespaceObject.__)('Status & Visibility'), 42103 children: ['status', 'password'] 42104 }, 'author', 'date', 'slug', 'parent', 'comment_status', { 42105 label: (0,external_wp_i18n_namespaceObject.__)('Template'), 42106 labelPosition: 'side', 42107 id: 'template', 42108 layout: 'regular' 42109 }].filter(field => ids.length === 1 || fieldsWithBulkEditSupport.includes(field)) 42110 }), [ids]); 42111 const onChange = edits => { 42112 for (const id of ids) { 42113 if (edits.status && edits.status !== 'future' && record?.status === 'future' && new Date(record.date) > new Date()) { 42114 edits.date = null; 42115 } 42116 if (edits.status && edits.status === 'private' && record.password) { 42117 edits.password = ''; 42118 } 42119 editEntityRecord('postType', postType, id, edits); 42120 if (ids.length > 1) { 42121 setMultiEdits(prev => ({ 42122 ...prev, 42123 ...edits 42124 })); 42125 } 42126 } 42127 }; 42128 (0,external_wp_element_namespaceObject.useEffect)(() => { 42129 setMultiEdits({}); 42130 }, [ids]); 42131 const { 42132 ExperimentalBlockEditorProvider 42133 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 42134 const settings = usePatternSettings(); 42135 42136 /** 42137 * The template field depends on the block editor settings. 42138 * This is a workaround to ensure that the block editor settings are available. 42139 * For more information, see: https://github.com/WordPress/gutenberg/issues/67521 42140 */ 42141 const fieldsWithDependency = (0,external_wp_element_namespaceObject.useMemo)(() => { 42142 return fields.map(field => { 42143 if (field.id === 'template') { 42144 return { 42145 ...field, 42146 Edit: data => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ExperimentalBlockEditorProvider, { 42147 settings: settings, 42148 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(field.Edit, { 42149 ...data 42150 }) 42151 }) 42152 }; 42153 } 42154 return field; 42155 }); 42156 }, [fields, settings]); 42157 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 42158 spacing: 4, 42159 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostCardPanel, { 42160 postType: postType, 42161 postId: ids 42162 }), hasFinishedResolution && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataForm, { 42163 data: ids.length === 1 ? record : multiEdits, 42164 fields: fieldsWithDependency, 42165 form: form, 42166 onChange: onChange 42167 })] 42168 }); 42169 } 42170 function PostEdit({ 42171 postType, 42172 postId 42173 }) { 42174 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Page, { 42175 className: dist_clsx('edit-site-post-edit', { 42176 'is-empty': !postId 42177 }), 42178 label: (0,external_wp_i18n_namespaceObject.__)('Post Edit'), 42179 children: [postId && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostEditForm, { 42180 postType: postType, 42181 postId: postId 42182 }), !postId && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 42183 children: (0,external_wp_i18n_namespaceObject.__)('Select a page to edit') 42184 })] 42185 }); 42186 } 42187 42188 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/pages.js 42189 /** 42190 * WordPress dependencies 42191 */ 42192 42193 42194 42195 /** 42196 * Internal dependencies 42197 */ 42198 42199 42200 42201 42202 42203 42204 42205 42206 const { 42207 useLocation: pages_useLocation 42208 } = unlock(external_wp_router_namespaceObject.privateApis); 42209 function MobilePagesView() { 42210 const { 42211 query = {} 42212 } = pages_useLocation(); 42213 const { 42214 canvas = 'view' 42215 } = query; 42216 return canvas === 'edit' ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostList, { 42217 postType: "page" 42218 }); 42219 } 42220 const pagesRoute = { 42221 name: 'pages', 42222 path: '/page', 42223 areas: { 42224 sidebar({ 42225 siteData 42226 }) { 42227 const isBlockTheme = siteData.currentTheme?.is_block_theme; 42228 return isBlockTheme ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { 42229 title: (0,external_wp_i18n_namespaceObject.__)('Pages'), 42230 backPath: "/", 42231 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsSidebarContent, { 42232 postType: "page" 42233 }) 42234 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); 42235 }, 42236 content({ 42237 siteData 42238 }) { 42239 const isBlockTheme = siteData.currentTheme?.is_block_theme; 42240 return isBlockTheme ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostList, { 42241 postType: "page" 42242 }) : undefined; 42243 }, 42244 preview({ 42245 query, 42246 siteData 42247 }) { 42248 const isBlockTheme = siteData.currentTheme?.is_block_theme; 42249 if (!isBlockTheme) { 42250 return undefined; 42251 } 42252 const isListView = (query.layout === 'list' || !query.layout) && query.isCustom !== 'true'; 42253 return isListView ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : undefined; 42254 }, 42255 mobile({ 42256 siteData 42257 }) { 42258 const isBlockTheme = siteData.currentTheme?.is_block_theme; 42259 return isBlockTheme ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MobilePagesView, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); 42260 }, 42261 edit({ 42262 query 42263 }) { 42264 var _query$layout; 42265 const hasQuickEdit = ((_query$layout = query.layout) !== null && _query$layout !== void 0 ? _query$layout : 'list') !== 'list' && !!query.quickEdit; 42266 return hasQuickEdit ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostEdit, { 42267 postType: "page", 42268 postId: query.postId 42269 }) : undefined; 42270 } 42271 }, 42272 widths: { 42273 content({ 42274 query 42275 }) { 42276 const isListView = (query.layout === 'list' || !query.layout) && query.isCustom !== 'true'; 42277 return isListView ? 380 : undefined; 42278 }, 42279 edit({ 42280 query 42281 }) { 42282 var _query$layout2; 42283 const hasQuickEdit = ((_query$layout2 = query.layout) !== null && _query$layout2 !== void 0 ? _query$layout2 : 'list') !== 'list' && !!query.quickEdit; 42284 return hasQuickEdit ? 380 : undefined; 42285 } 42286 } 42287 }; 42288 42289 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/page-item.js 42290 /** 42291 * WordPress dependencies 42292 */ 42293 42294 42295 /** 42296 * Internal dependencies 42297 */ 42298 42299 42300 42301 42302 42303 const pageItemRoute = { 42304 name: 'page-item', 42305 path: '/page/:postId', 42306 areas: { 42307 sidebar({ 42308 siteData 42309 }) { 42310 const isBlockTheme = siteData.currentTheme?.is_block_theme; 42311 return isBlockTheme ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { 42312 title: (0,external_wp_i18n_namespaceObject.__)('Pages'), 42313 backPath: "/", 42314 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsSidebarContent, { 42315 postType: "page" 42316 }) 42317 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); 42318 }, 42319 mobile({ 42320 siteData 42321 }) { 42322 const isBlockTheme = siteData.currentTheme?.is_block_theme; 42323 return isBlockTheme ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); 42324 }, 42325 preview({ 42326 siteData 42327 }) { 42328 const isBlockTheme = siteData.currentTheme?.is_block_theme; 42329 return isBlockTheme ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); 42330 } 42331 } 42332 }; 42333 42334 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/stylebook.js 42335 /** 42336 * WordPress dependencies 42337 */ 42338 42339 42340 /** 42341 * Internal dependencies 42342 */ 42343 42344 42345 42346 42347 42348 const stylebookRoute = { 42349 name: 'stylebook', 42350 path: '/stylebook', 42351 areas: { 42352 sidebar({ 42353 siteData 42354 }) { 42355 return isClassicThemeWithStyleBookSupport(siteData) ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { 42356 title: (0,external_wp_i18n_namespaceObject.__)('Styles'), 42357 backPath: "/", 42358 description: (0,external_wp_i18n_namespaceObject.__)(`Preview your website's visual identity: colors, typography, and blocks.`) 42359 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); 42360 }, 42361 preview({ 42362 siteData 42363 }) { 42364 return isClassicThemeWithStyleBookSupport(siteData) ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleBookPreview, { 42365 isStatic: true 42366 }) : undefined; 42367 }, 42368 mobile({ 42369 siteData 42370 }) { 42371 return isClassicThemeWithStyleBookSupport(siteData) ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleBookPreview, { 42372 isStatic: true 42373 }) : undefined; 42374 } 42375 } 42376 }; 42377 42378 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/notfound.js 42379 /** 42380 * WordPress dependencies 42381 */ 42382 42383 42384 /** 42385 * Internal dependencies 42386 */ 42387 42388 42389 42390 function NotFoundError() { 42391 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { 42392 status: "error", 42393 isDismissible: false, 42394 children: (0,external_wp_i18n_namespaceObject.__)('The requested page could not be found. Please check the URL.') 42395 }); 42396 } 42397 const notFoundRoute = { 42398 name: 'notfound', 42399 path: '*', 42400 areas: { 42401 sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenMain, {}), 42402 mobile: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenMain, { 42403 customDescription: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NotFoundError, {}) 42404 }), 42405 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { 42406 padding: 2, 42407 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NotFoundError, {}) 42408 }) 42409 } 42410 }; 42411 42412 ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/index.js 42413 /** 42414 * WordPress dependencies 42415 */ 42416 42417 42418 42419 /** 42420 * Internal dependencies 42421 */ 42422 42423 42424 42425 42426 42427 42428 42429 42430 42431 42432 42433 42434 42435 42436 42437 const site_editor_routes_routes = [pageItemRoute, pagesRoute, templateItemRoute, templatesRoute, templatePartItemRoute, patternItemRoute, patternsRoute, navigationItemRoute, navigationRoute, stylesRoute, homeRoute, stylebookRoute, notFoundRoute]; 42438 function useRegisterSiteEditorRoutes() { 42439 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 42440 const { 42441 registerRoute 42442 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 42443 (0,external_wp_element_namespaceObject.useEffect)(() => { 42444 registry.batch(() => { 42445 site_editor_routes_routes.forEach(registerRoute); 42446 }); 42447 }, [registry, registerRoute]); 42448 } 42449 42450 ;// ./node_modules/@wordpress/edit-site/build-module/components/app/index.js 42451 /** 42452 * WordPress dependencies 42453 */ 42454 42455 42456 42457 42458 42459 /** 42460 * Internal dependencies 42461 */ 42462 42463 42464 42465 42466 42467 42468 42469 42470 const { 42471 RouterProvider 42472 } = unlock(external_wp_router_namespaceObject.privateApis); 42473 function AppLayout() { 42474 useCommonCommands(); 42475 useSetCommandContext(); 42476 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LayoutWithGlobalStylesProvider, {}); 42477 } 42478 function App() { 42479 useRegisterSiteEditorRoutes(); 42480 const { 42481 routes, 42482 currentTheme, 42483 editorSettings 42484 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 42485 return { 42486 routes: unlock(select(store)).getRoutes(), 42487 currentTheme: select(external_wp_coreData_namespaceObject.store).getCurrentTheme(), 42488 // This is a temp solution until the has_theme_json value is available for the current theme. 42489 editorSettings: select(store).getSettings() 42490 }; 42491 }, []); 42492 const beforeNavigate = (0,external_wp_element_namespaceObject.useCallback)(({ 42493 path, 42494 query 42495 }) => { 42496 if (!isPreviewingTheme()) { 42497 return { 42498 path, 42499 query 42500 }; 42501 } 42502 return { 42503 path, 42504 query: { 42505 ...query, 42506 wp_theme_preview: 'wp_theme_preview' in query ? query.wp_theme_preview : currentlyPreviewingTheme() 42507 } 42508 }; 42509 }, []); 42510 const matchResolverArgsValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 42511 siteData: { 42512 currentTheme, 42513 editorSettings 42514 } 42515 }), [currentTheme, editorSettings]); 42516 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RouterProvider, { 42517 routes: routes, 42518 pathArg: "p", 42519 beforeNavigate: beforeNavigate, 42520 matchResolverArgs: matchResolverArgsValue, 42521 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AppLayout, {}) 42522 }); 42523 } 42524 42525 ;// ./node_modules/@wordpress/edit-site/build-module/deprecated.js 42526 /** 42527 * WordPress dependencies 42528 */ 42529 42530 42531 42532 42533 const isSiteEditor = (0,external_wp_url_namespaceObject.getPath)(window.location.href)?.includes('site-editor.php'); 42534 const deprecateSlot = name => { 42535 external_wp_deprecated_default()(`wp.editPost.$name}`, { 42536 since: '6.6', 42537 alternative: `wp.editor.$name}` 42538 }); 42539 }; 42540 42541 /* eslint-disable jsdoc/require-param */ 42542 /** 42543 * @see PluginMoreMenuItem in @wordpress/editor package. 42544 */ 42545 function PluginMoreMenuItem(props) { 42546 if (!isSiteEditor) { 42547 return null; 42548 } 42549 deprecateSlot('PluginMoreMenuItem'); 42550 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginMoreMenuItem, { 42551 ...props 42552 }); 42553 } 42554 42555 /** 42556 * @see PluginSidebar in @wordpress/editor package. 42557 */ 42558 function PluginSidebar(props) { 42559 if (!isSiteEditor) { 42560 return null; 42561 } 42562 deprecateSlot('PluginSidebar'); 42563 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginSidebar, { 42564 ...props 42565 }); 42566 } 42567 42568 /** 42569 * @see PluginSidebarMoreMenuItem in @wordpress/editor package. 42570 */ 42571 function PluginSidebarMoreMenuItem(props) { 42572 if (!isSiteEditor) { 42573 return null; 42574 } 42575 deprecateSlot('PluginSidebarMoreMenuItem'); 42576 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginSidebarMoreMenuItem, { 42577 ...props 42578 }); 42579 } 42580 /* eslint-enable jsdoc/require-param */ 42581 42582 ;// ./node_modules/@wordpress/edit-site/build-module/components/posts-app-routes/posts.js 42583 /** 42584 * WordPress dependencies 42585 */ 42586 42587 42588 42589 /** 42590 * Internal dependencies 42591 */ 42592 42593 42594 42595 42596 42597 42598 42599 const { 42600 useLocation: posts_useLocation 42601 } = unlock(external_wp_router_namespaceObject.privateApis); 42602 function MobilePostsView() { 42603 const { 42604 query = {} 42605 } = posts_useLocation(); 42606 const { 42607 canvas = 'view' 42608 } = query; 42609 return canvas === 'edit' ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostList, { 42610 postType: "post" 42611 }); 42612 } 42613 const postsRoute = { 42614 name: 'posts', 42615 path: '/', 42616 areas: { 42617 sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { 42618 title: (0,external_wp_i18n_namespaceObject.__)('Posts'), 42619 isRoot: true, 42620 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsSidebarContent, { 42621 postType: "post" 42622 }) 42623 }), 42624 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostList, { 42625 postType: "post" 42626 }), 42627 preview({ 42628 query 42629 }) { 42630 const isListView = (query.layout === 'list' || !query.layout) && query.isCustom !== 'true'; 42631 return isListView ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, { 42632 isPostsList: true 42633 }) : undefined; 42634 }, 42635 mobile: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MobilePostsView, {}), 42636 edit({ 42637 query 42638 }) { 42639 var _query$layout; 42640 const hasQuickEdit = ((_query$layout = query.layout) !== null && _query$layout !== void 0 ? _query$layout : 'list') === 'list' && !!query.quickEdit; 42641 return hasQuickEdit ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostEdit, { 42642 postType: "post", 42643 postId: query.postId 42644 }) : undefined; 42645 } 42646 }, 42647 widths: { 42648 content({ 42649 query 42650 }) { 42651 const isListView = (query.layout === 'list' || !query.layout) && query.isCustom !== 'true'; 42652 return isListView ? 380 : undefined; 42653 }, 42654 edit({ 42655 query 42656 }) { 42657 var _query$layout2; 42658 const hasQuickEdit = ((_query$layout2 = query.layout) !== null && _query$layout2 !== void 0 ? _query$layout2 : 'list') === 'list' && !!query.quickEdit; 42659 return hasQuickEdit ? 380 : undefined; 42660 } 42661 } 42662 }; 42663 42664 ;// ./node_modules/@wordpress/edit-site/build-module/components/posts-app-routes/post-item.js 42665 /** 42666 * WordPress dependencies 42667 */ 42668 42669 42670 /** 42671 * Internal dependencies 42672 */ 42673 42674 42675 42676 42677 const postItemRoute = { 42678 name: 'post-item', 42679 path: '/post/:postId', 42680 areas: { 42681 sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreen, { 42682 title: (0,external_wp_i18n_namespaceObject.__)('Posts'), 42683 isRoot: true, 42684 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsSidebarContent, { 42685 postType: "post" 42686 }) 42687 }), 42688 mobile: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, { 42689 isPostsList: true 42690 }), 42691 preview: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, { 42692 isPostsList: true 42693 }) 42694 } 42695 }; 42696 42697 ;// ./node_modules/@wordpress/edit-site/build-module/components/posts-app-routes/index.js 42698 /** 42699 * WordPress dependencies 42700 */ 42701 42702 42703 42704 /** 42705 * Internal dependencies 42706 */ 42707 42708 42709 42710 42711 const posts_app_routes_routes = [postItemRoute, postsRoute]; 42712 function useRegisterPostsAppRoutes() { 42713 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 42714 const { 42715 registerRoute 42716 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 42717 (0,external_wp_element_namespaceObject.useEffect)(() => { 42718 registry.batch(() => { 42719 posts_app_routes_routes.forEach(registerRoute); 42720 }); 42721 }, [registry, registerRoute]); 42722 } 42723 42724 ;// ./node_modules/@wordpress/edit-site/build-module/components/posts-app/index.js 42725 /** 42726 * WordPress dependencies 42727 */ 42728 42729 42730 42731 /** 42732 * Internal dependencies 42733 */ 42734 42735 42736 42737 42738 42739 const { 42740 RouterProvider: posts_app_RouterProvider 42741 } = unlock(external_wp_router_namespaceObject.privateApis); 42742 function PostsApp() { 42743 useRegisterPostsAppRoutes(); 42744 const routes = (0,external_wp_data_namespaceObject.useSelect)(select => { 42745 return unlock(select(store)).getRoutes(); 42746 }, []); 42747 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(posts_app_RouterProvider, { 42748 routes: routes, 42749 pathArg: "p", 42750 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LayoutWithGlobalStylesProvider, {}) 42751 }); 42752 } 42753 42754 ;// ./node_modules/@wordpress/edit-site/build-module/posts.js 42755 /** 42756 * WordPress dependencies 42757 */ 42758 42759 42760 42761 42762 42763 42764 42765 /** 42766 * Internal dependencies 42767 */ 42768 42769 42770 42771 /** 42772 * Internal dependencies 42773 */ 42774 42775 42776 /** 42777 * Initializes the "Posts Dashboard" 42778 * @param {string} id ID of the root element to render the screen in. 42779 * @param {Object} settings Editor settings. 42780 */ 42781 42782 function initializePostsDashboard(id, settings) { 42783 if (true) { 42784 return; 42785 } 42786 const target = document.getElementById(id); 42787 const root = (0,external_wp_element_namespaceObject.createRoot)(target); 42788 (0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).reapplyBlockTypeFilters(); 42789 const coreBlocks = (0,external_wp_blockLibrary_namespaceObject.__experimentalGetCoreBlocks)().filter(({ 42790 name 42791 }) => name !== 'core/freeform'); 42792 (0,external_wp_blockLibrary_namespaceObject.registerCoreBlocks)(coreBlocks); 42793 (0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).setFreeformFallbackBlockName('core/html'); 42794 (0,external_wp_widgets_namespaceObject.registerLegacyWidgetBlock)({ 42795 inserter: false 42796 }); 42797 (0,external_wp_widgets_namespaceObject.registerWidgetGroupBlock)({ 42798 inserter: false 42799 }); 42800 if (false) {} 42801 42802 // We dispatch actions and update the store synchronously before rendering 42803 // so that we won't trigger unnecessary re-renders with useEffect. 42804 (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core/edit-site', { 42805 welcomeGuide: true, 42806 welcomeGuideStyles: true, 42807 welcomeGuidePage: true, 42808 welcomeGuideTemplate: true 42809 }); 42810 (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core', { 42811 allowRightClickOverrides: true, 42812 distractionFree: false, 42813 editorMode: 'visual', 42814 editorTool: 'edit', 42815 fixedToolbar: false, 42816 focusMode: false, 42817 inactivePanels: [], 42818 keepCaretInsideBlock: false, 42819 openPanels: ['post-status'], 42820 showBlockBreadcrumbs: true, 42821 showListViewByDefault: false, 42822 enableChoosePatternModal: true 42823 }); 42824 (0,external_wp_data_namespaceObject.dispatch)(store).updateSettings(settings); 42825 42826 // Prevent the default browser action for files dropped outside of dropzones. 42827 window.addEventListener('dragover', e => e.preventDefault(), false); 42828 window.addEventListener('drop', e => e.preventDefault(), false); 42829 root.render(/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.StrictMode, { 42830 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostsApp, {}) 42831 })); 42832 return root; 42833 } 42834 42835 ;// ./node_modules/@wordpress/edit-site/build-module/index.js 42836 /** 42837 * WordPress dependencies 42838 */ 42839 42840 42841 42842 42843 42844 42845 42846 42847 42848 /** 42849 * Internal dependencies 42850 */ 42851 42852 42853 42854 42855 42856 const { 42857 registerCoreBlockBindingsSources 42858 } = unlock(external_wp_editor_namespaceObject.privateApis); 42859 42860 /** 42861 * Initializes the site editor screen. 42862 * 42863 * @param {string} id ID of the root element to render the screen in. 42864 * @param {Object} settings Editor settings. 42865 */ 42866 function initializeEditor(id, settings) { 42867 const target = document.getElementById(id); 42868 const root = (0,external_wp_element_namespaceObject.createRoot)(target); 42869 (0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).reapplyBlockTypeFilters(); 42870 const coreBlocks = (0,external_wp_blockLibrary_namespaceObject.__experimentalGetCoreBlocks)().filter(({ 42871 name 42872 }) => name !== 'core/freeform'); 42873 (0,external_wp_blockLibrary_namespaceObject.registerCoreBlocks)(coreBlocks); 42874 registerCoreBlockBindingsSources(); 42875 (0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).setFreeformFallbackBlockName('core/html'); 42876 (0,external_wp_widgets_namespaceObject.registerLegacyWidgetBlock)({ 42877 inserter: false 42878 }); 42879 (0,external_wp_widgets_namespaceObject.registerWidgetGroupBlock)({ 42880 inserter: false 42881 }); 42882 if (false) {} 42883 42884 // We dispatch actions and update the store synchronously before rendering 42885 // so that we won't trigger unnecessary re-renders with useEffect. 42886 (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core/edit-site', { 42887 welcomeGuide: true, 42888 welcomeGuideStyles: true, 42889 welcomeGuidePage: true, 42890 welcomeGuideTemplate: true 42891 }); 42892 (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core', { 42893 allowRightClickOverrides: true, 42894 distractionFree: false, 42895 editorMode: 'visual', 42896 editorTool: 'edit', 42897 fixedToolbar: false, 42898 focusMode: false, 42899 inactivePanels: [], 42900 keepCaretInsideBlock: false, 42901 openPanels: ['post-status'], 42902 showBlockBreadcrumbs: true, 42903 showListViewByDefault: false, 42904 enableChoosePatternModal: true 42905 }); 42906 if (window.__experimentalMediaProcessing) { 42907 (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core/media', { 42908 requireApproval: true, 42909 optimizeOnUpload: true 42910 }); 42911 } 42912 (0,external_wp_data_namespaceObject.dispatch)(store).updateSettings(settings); 42913 42914 // Prevent the default browser action for files dropped outside of dropzones. 42915 window.addEventListener('dragover', e => e.preventDefault(), false); 42916 window.addEventListener('drop', e => e.preventDefault(), false); 42917 root.render(/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.StrictMode, { 42918 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(App, {}) 42919 })); 42920 return root; 42921 } 42922 function reinitializeEditor() { 42923 external_wp_deprecated_default()('wp.editSite.reinitializeEditor', { 42924 since: '6.2', 42925 version: '6.3' 42926 }); 42927 } 42928 42929 42930 42931 42932 // Temporary: While the posts dashboard is being iterated on 42933 // it's being built in the same package as the site editor. 42934 42935 42936 })(); 42937 42938 (window.wp = window.wp || {}).editSite = __webpack_exports__; 42939 /******/ })() 42940 ;
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated : Thu Apr 3 08:20:01 2025 | Cross-referenced by PHPXref |